From d1eed41cd57b78e8c336b76933ac3b37c70a94d5 Mon Sep 17 00:00:00 2001 From: Jan Paw Date: Thu, 3 Dec 2020 22:49:33 +0100 Subject: [PATCH] Add basic support for ATmega4809 --- Cargo.toml | 1 + Makefile | 2 +- README.md | 1 + patch/atmega4809.yaml | 1 + src/devices/mod.rs | 20 +- src/lib.rs | 5 + vendor/atmega4809.atdf | 2475 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 2503 insertions(+), 2 deletions(-) create mode 100644 patch/atmega4809.yaml create mode 100644 vendor/atmega4809.atdf diff --git a/Cargo.toml b/Cargo.toml index e787ba8..60b2e25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,6 +27,7 @@ atmega2560 = [] atmega8 = [] atmega328p = [] atmega328pb = [] +atmega4809 = [] atmega48p = [] atmega32u4 = [] atmega64 = [] diff --git a/Makefile b/Makefile index 7a1faf6..4103de8 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ all: deps chips -CHIPS := atmega1280 atmega168 atmega2560 atmega8 atmega328p atmega328pb atmega32u4 atmega48p atmega64 atmega644 attiny84 attiny85 attiny88 +CHIPS := atmega1280 atmega168 atmega2560 atmega8 atmega328p atmega328pb atmega32u4 atmega4809 atmega48p atmega64 atmega644 attiny84 attiny85 attiny88 RUSTUP_TOOLCHAIN ?= nightly diff --git a/README.md b/README.md index 9c35871..0f97e3e 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Via the feature you can select which chip you want the register specifications f * `atmega8` * `atmega328p` * `atmega32u4` +* `atmega4809` * `atmega48p` * `atmega64` * `atmega644` diff --git a/patch/atmega4809.yaml b/patch/atmega4809.yaml new file mode 100644 index 0000000..e874590 --- /dev/null +++ b/patch/atmega4809.yaml @@ -0,0 +1 @@ +_svd: ../svd/atmega4809.svd diff --git a/src/devices/mod.rs b/src/devices/mod.rs index aa50753..56059bb 100644 --- a/src/devices/mod.rs +++ b/src/devices/mod.rs @@ -98,7 +98,6 @@ impl atmega328pb::Peripherals { } } - /// [ATmega32U4](https://www.microchip.com/wwwproducts/en/ATmega32U4) #[cfg(feature = "atmega32u4")] pub mod atmega32u4; @@ -118,6 +117,25 @@ impl atmega32u4::Peripherals { } } +/// [ATmega4809](https://www.microchip.com/wwwproducts/en/ATmega4809) +#[cfg(feature = "atmega4809")] +pub mod atmega4809; + +#[cfg(feature = "atmega4809")] +impl atmega4809::Peripherals { + /// Returns all the peripherals *once* + #[inline] + pub fn take() -> Option { + crate::interrupt::free(|_| { + if unsafe { DEVICE_PERIPHERALS } { + None + } else { + Some(unsafe { atmega4809::Peripherals::steal() }) + } + }) + } +} + /// [ATmega48P](https://www.microchip.com/wwwproducts/en/ATmega48P) #[cfg(feature = "atmega48p")] pub mod atmega48p; diff --git a/src/lib.rs b/src/lib.rs index 8b17b93..712e75e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,6 +6,7 @@ #![cfg_attr(feature = "atmega328p", doc = "**atmega328p**,")] #![cfg_attr(feature = "atmega328pb", doc = "**atmega328pb**,")] #![cfg_attr(feature = "atmega32u4", doc = "**atmega32u4**,")] +#![cfg_attr(feature = "atmega4809", doc = "**atmega4809**,")] #![cfg_attr(feature = "atmega48p", doc = "**atmega48p**,")] #![cfg_attr(feature = "atmega64", doc = "**atmega64**,")] #![cfg_attr(feature = "atmega644", doc = "**atmega644**,")] @@ -23,6 +24,7 @@ //! * `atmega328p` //! * `atmega328pb` //! * `atmega32u4` +//! * `atmega4809` //! * `atmega48p` //! * `atmega64` //! * `attiny85` @@ -87,6 +89,8 @@ pub use crate::devices::atmega328p; pub use crate::devices::atmega328pb; #[cfg(feature = "atmega32u4")] pub use crate::devices::atmega32u4; +#[cfg(feature = "atmega4809")] +pub use crate::devices::atmega4809; #[cfg(feature = "atmega48p")] pub use crate::devices::atmega48p; #[cfg(feature = "atmega64")] @@ -110,6 +114,7 @@ pub use crate::devices::attiny88; feature = "atmega328p", feature = "atmega328pb", feature = "atmega32u4", + feature = "atmega4809", feature = "atmega48p", feature = "atmega64", feature = "atmega644", diff --git a/vendor/atmega4809.atdf b/vendor/atmega4809.atdf new file mode 100644 index 0000000..c9ca60f --- /dev/null +++ b/vendor/atmega4809.atdf @@ -0,0 +1,2475 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- 2.49.0