#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![no_std]
#![cfg_attr(docsrs, feature(doc_cfg))]
pub const NVIC_PRIO_BITS: u8 = 3;
#[cfg(feature = "rt")]
pub use self::Interrupt as interrupt;
pub use cortex_m::peripheral::Peripherals as CorePeripherals;
pub use cortex_m::peripheral::{CBP, CPUID, DCB, DWT, FPB, FPU, ITM, MPU, NVIC, SCB, SYST, TPIU};
#[cfg(feature = "rt")]
pub use cortex_m_rt::interrupt;
#[allow(unused_imports)]
use generic::*;
pub mod generic;
#[cfg(feature = "rt")]
extern "C" {
fn EMU();
fn WDOG0();
fn LDMA();
fn GPIO_EVEN();
fn TIMER0();
fn USART0_RX();
fn USART0_TX();
fn ACMP0();
fn ADC0();
fn IDAC0();
fn I2C0();
fn GPIO_ODD();
fn TIMER1();
fn USART1_RX();
fn USART1_TX();
fn LEUART0();
fn PCNT0();
fn CMU();
fn MSC();
fn CRYPTO();
fn LETIMER0();
fn RTCC();
fn CRYOTIMER();
fn FPUEH();
}
#[doc(hidden)]
#[repr(C)]
pub union Vector {
_handler: unsafe extern "C" fn(),
_reserved: u32,
}
#[cfg(feature = "rt")]
#[doc(hidden)]
#[link_section = ".vector_table.interrupts"]
#[no_mangle]
pub static __INTERRUPTS: [Vector; 34] = [
Vector { _handler: EMU },
Vector { _reserved: 0 },
Vector { _handler: WDOG0 },
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector { _handler: LDMA },
Vector {
_handler: GPIO_EVEN,
},
Vector { _handler: TIMER0 },
Vector {
_handler: USART0_RX,
},
Vector {
_handler: USART0_TX,
},
Vector { _handler: ACMP0 },
Vector { _handler: ADC0 },
Vector { _handler: IDAC0 },
Vector { _handler: I2C0 },
Vector { _handler: GPIO_ODD },
Vector { _handler: TIMER1 },
Vector {
_handler: USART1_RX,
},
Vector {
_handler: USART1_TX,
},
Vector { _handler: LEUART0 },
Vector { _handler: PCNT0 },
Vector { _handler: CMU },
Vector { _handler: MSC },
Vector { _handler: CRYPTO },
Vector { _handler: LETIMER0 },
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector { _handler: RTCC },
Vector { _reserved: 0 },
Vector {
_handler: CRYOTIMER,
},
Vector { _reserved: 0 },
Vector { _handler: FPUEH },
];
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[repr(u16)]
pub enum Interrupt {
EMU = 0,
WDOG0 = 2,
LDMA = 8,
GPIO_EVEN = 9,
TIMER0 = 10,
USART0_RX = 11,
USART0_TX = 12,
ACMP0 = 13,
ADC0 = 14,
IDAC0 = 15,
I2C0 = 16,
GPIO_ODD = 17,
TIMER1 = 18,
USART1_RX = 19,
USART1_TX = 20,
LEUART0 = 21,
PCNT0 = 22,
CMU = 23,
MSC = 24,
CRYPTO = 25,
LETIMER0 = 26,
RTCC = 29,
CRYOTIMER = 31,
FPUEH = 33,
}
unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
#[inline(always)]
fn number(self) -> u16 {
self as u16
}
}
pub type Msc = crate::Periph<msc::RegisterBlock, 0x400e_0000>;
impl core::fmt::Debug for Msc {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Msc").finish()
}
}
pub mod msc;
pub type Emu = crate::Periph<emu::RegisterBlock, 0x400e_3000>;
impl core::fmt::Debug for Emu {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Emu").finish()
}
}
pub mod emu;
pub type Rmu = crate::Periph<rmu::RegisterBlock, 0x400e_5000>;
impl core::fmt::Debug for Rmu {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Rmu").finish()
}
}
pub mod rmu;
pub type Cmu = crate::Periph<cmu::RegisterBlock, 0x400e_4000>;
impl core::fmt::Debug for Cmu {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cmu").finish()
}
}
pub mod cmu;
pub type Crypto = crate::Periph<crypto::RegisterBlock, 0x400f_0000>;
impl core::fmt::Debug for Crypto {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Crypto").finish()
}
}
pub mod crypto;
pub type Gpio = crate::Periph<gpio::RegisterBlock, 0x4000_a000>;
impl core::fmt::Debug for Gpio {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Gpio").finish()
}
}
pub mod gpio;
pub type Prs = crate::Periph<prs::RegisterBlock, 0x400e_6000>;
impl core::fmt::Debug for Prs {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Prs").finish()
}
}
pub mod prs;
pub type Ldma = crate::Periph<ldma::RegisterBlock, 0x400e_2000>;
impl core::fmt::Debug for Ldma {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ldma").finish()
}
}
pub mod ldma;
pub type Fpueh = crate::Periph<fpueh::RegisterBlock, 0x400e_1000>;
impl core::fmt::Debug for Fpueh {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Fpueh").finish()
}
}
pub mod fpueh;
pub type Gpcrc = crate::Periph<gpcrc::RegisterBlock, 0x4001_c000>;
impl core::fmt::Debug for Gpcrc {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Gpcrc").finish()
}
}
pub mod gpcrc;
pub type Timer0 = crate::Periph<timer0::RegisterBlock, 0x4001_8000>;
impl core::fmt::Debug for Timer0 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Timer0").finish()
}
}
pub mod timer0;
pub type Timer1 = crate::Periph<timer0::RegisterBlock, 0x4001_8400>;
impl core::fmt::Debug for Timer1 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Timer1").finish()
}
}
pub use self::timer0 as timer1;
pub type Usart0 = crate::Periph<usart0::RegisterBlock, 0x4001_0000>;
impl core::fmt::Debug for Usart0 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Usart0").finish()
}
}
pub mod usart0;
pub type Usart1 = crate::Periph<usart0::RegisterBlock, 0x4001_0400>;
impl core::fmt::Debug for Usart1 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Usart1").finish()
}
}
pub use self::usart0 as usart1;
pub type Leuart0 = crate::Periph<leuart0::RegisterBlock, 0x4004_a000>;
impl core::fmt::Debug for Leuart0 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Leuart0").finish()
}
}
pub mod leuart0;
pub type Letimer0 = crate::Periph<letimer0::RegisterBlock, 0x4004_6000>;
impl core::fmt::Debug for Letimer0 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Letimer0").finish()
}
}
pub mod letimer0;
pub type Cryotimer = crate::Periph<cryotimer::RegisterBlock, 0x4001_e000>;
impl core::fmt::Debug for Cryotimer {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cryotimer").finish()
}
}
pub mod cryotimer;
pub type Pcnt0 = crate::Periph<pcnt0::RegisterBlock, 0x4004_e000>;
impl core::fmt::Debug for Pcnt0 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Pcnt0").finish()
}
}
pub mod pcnt0;
pub type I2c0 = crate::Periph<i2c0::RegisterBlock, 0x4000_c000>;
impl core::fmt::Debug for I2c0 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("I2c0").finish()
}
}
pub mod i2c0;
pub type Adc0 = crate::Periph<adc0::RegisterBlock, 0x4000_2000>;
impl core::fmt::Debug for Adc0 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Adc0").finish()
}
}
pub mod adc0;
pub type Acmp0 = crate::Periph<acmp0::RegisterBlock, 0x4000_0000>;
impl core::fmt::Debug for Acmp0 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Acmp0").finish()
}
}
pub mod acmp0;
pub type Acmp1 = crate::Periph<acmp1::RegisterBlock, 0x4000_0400>;
impl core::fmt::Debug for Acmp1 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Acmp1").finish()
}
}
pub mod acmp1;
pub type Idac0 = crate::Periph<idac0::RegisterBlock, 0x4000_6000>;
impl core::fmt::Debug for Idac0 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Idac0").finish()
}
}
pub mod idac0;
pub type Rtcc = crate::Periph<rtcc::RegisterBlock, 0x4004_2000>;
impl core::fmt::Debug for Rtcc {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Rtcc").finish()
}
}
pub mod rtcc;
pub type Wdog0 = crate::Periph<wdog0::RegisterBlock, 0x4005_2000>;
impl core::fmt::Debug for Wdog0 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Wdog0").finish()
}
}
pub mod wdog0;
pub type Di = crate::Periph<di::RegisterBlock, 0x0fe0_81b0>;
impl core::fmt::Debug for Di {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Di").finish()
}
}
pub mod di;
#[no_mangle]
static mut DEVICE_PERIPHERALS: bool = false;
#[allow(non_snake_case)]
pub struct Peripherals {
pub msc: Msc,
pub emu: Emu,
pub rmu: Rmu,
pub cmu: Cmu,
pub crypto: Crypto,
pub gpio: Gpio,
pub prs: Prs,
pub ldma: Ldma,
pub fpueh: Fpueh,
pub gpcrc: Gpcrc,
pub timer0: Timer0,
pub timer1: Timer1,
pub usart0: Usart0,
pub usart1: Usart1,
pub leuart0: Leuart0,
pub letimer0: Letimer0,
pub cryotimer: Cryotimer,
pub pcnt0: Pcnt0,
pub i2c0: I2c0,
pub adc0: Adc0,
pub acmp0: Acmp0,
pub acmp1: Acmp1,
pub idac0: Idac0,
pub rtcc: Rtcc,
pub wdog0: Wdog0,
pub di: Di,
}
impl Peripherals {
#[cfg(feature = "critical-section")]
#[inline]
pub fn take() -> Option<Self> {
critical_section::with(|_| {
if unsafe { DEVICE_PERIPHERALS } {
return None;
}
Some(unsafe { Peripherals::steal() })
})
}
#[inline]
pub unsafe fn steal() -> Self {
DEVICE_PERIPHERALS = true;
Peripherals {
msc: Msc::steal(),
emu: Emu::steal(),
rmu: Rmu::steal(),
cmu: Cmu::steal(),
crypto: Crypto::steal(),
gpio: Gpio::steal(),
prs: Prs::steal(),
ldma: Ldma::steal(),
fpueh: Fpueh::steal(),
gpcrc: Gpcrc::steal(),
timer0: Timer0::steal(),
timer1: Timer1::steal(),
usart0: Usart0::steal(),
usart1: Usart1::steal(),
leuart0: Leuart0::steal(),
letimer0: Letimer0::steal(),
cryotimer: Cryotimer::steal(),
pcnt0: Pcnt0::steal(),
i2c0: I2c0::steal(),
adc0: Adc0::steal(),
acmp0: Acmp0::steal(),
acmp1: Acmp1::steal(),
idac0: Idac0::steal(),
rtcc: Rtcc::steal(),
wdog0: Wdog0::steal(),
di: Di::steal(),
}
}
}