#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![doc = "Peripheral access API (generated using chiptool v0.1.0 (bcf538a 2026-05-18))"]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Interrupt {
#[doc = "0 - FPU"]
FPU = 0,
#[doc = "1 - CACHE"]
CACHE = 1,
#[doc = "3 - SPU"]
SPU = 3,
#[doc = "5 - CLOCK_POWER"]
CLOCK_POWER = 5,
#[doc = "8 - SERIAL0"]
SERIAL0 = 8,
#[doc = "9 - SERIAL1"]
SERIAL1 = 9,
#[doc = "10 - SPIM4"]
SPIM4 = 10,
#[doc = "11 - SERIAL2"]
SERIAL2 = 11,
#[doc = "12 - SERIAL3"]
SERIAL3 = 12,
#[doc = "13 - GPIOTE0"]
GPIOTE0 = 13,
#[doc = "14 - SAADC"]
SAADC = 14,
#[doc = "15 - TIMER0"]
TIMER0 = 15,
#[doc = "16 - TIMER1"]
TIMER1 = 16,
#[doc = "17 - TIMER2"]
TIMER2 = 17,
#[doc = "20 - RTC0"]
RTC0 = 20,
#[doc = "21 - RTC1"]
RTC1 = 21,
#[doc = "24 - WDT0"]
WDT0 = 24,
#[doc = "25 - WDT1"]
WDT1 = 25,
#[doc = "26 - COMP_LPCOMP"]
COMP_LPCOMP = 26,
#[doc = "27 - EGU0"]
EGU0 = 27,
#[doc = "28 - EGU1"]
EGU1 = 28,
#[doc = "29 - EGU2"]
EGU2 = 29,
#[doc = "30 - EGU3"]
EGU3 = 30,
#[doc = "31 - EGU4"]
EGU4 = 31,
#[doc = "32 - EGU5"]
EGU5 = 32,
#[doc = "33 - PWM0"]
PWM0 = 33,
#[doc = "34 - PWM1"]
PWM1 = 34,
#[doc = "35 - PWM2"]
PWM2 = 35,
#[doc = "36 - PWM3"]
PWM3 = 36,
#[doc = "38 - PDM0"]
PDM0 = 38,
#[doc = "40 - I2S0"]
I2S0 = 40,
#[doc = "42 - IPC"]
IPC = 42,
#[doc = "43 - QSPI"]
QSPI = 43,
#[doc = "45 - NFCT"]
NFCT = 45,
#[doc = "47 - GPIOTE1"]
GPIOTE1 = 47,
#[doc = "51 - QDEC0"]
QDEC0 = 51,
#[doc = "52 - QDEC1"]
QDEC1 = 52,
#[doc = "54 - USBD"]
USBD = 54,
#[doc = "55 - USBREGULATOR"]
USBREGULATOR = 55,
#[doc = "57 - KMU"]
KMU = 57,
#[doc = "68 - CRYPTOCELL"]
CRYPTOCELL = 68,
}
unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
#[inline(always)]
fn number(self) -> u16 {
self as u16
}
}
#[cfg(feature = "rt")]
mod _vectors {
unsafe extern "C" {
fn FPU();
fn CACHE();
fn SPU();
fn CLOCK_POWER();
fn SERIAL0();
fn SERIAL1();
fn SPIM4();
fn SERIAL2();
fn SERIAL3();
fn GPIOTE0();
fn SAADC();
fn TIMER0();
fn TIMER1();
fn TIMER2();
fn RTC0();
fn RTC1();
fn WDT0();
fn WDT1();
fn COMP_LPCOMP();
fn EGU0();
fn EGU1();
fn EGU2();
fn EGU3();
fn EGU4();
fn EGU5();
fn PWM0();
fn PWM1();
fn PWM2();
fn PWM3();
fn PDM0();
fn I2S0();
fn IPC();
fn QSPI();
fn NFCT();
fn GPIOTE1();
fn QDEC0();
fn QDEC1();
fn USBD();
fn USBREGULATOR();
fn KMU();
fn CRYPTOCELL();
}
pub union Vector {
_handler: unsafe extern "C" fn(),
_reserved: u32,
}
#[unsafe(link_section = ".vector_table.interrupts")]
#[unsafe(no_mangle)]
pub static __INTERRUPTS: [Vector; 69] = [
Vector { _handler: FPU },
Vector { _handler: CACHE },
Vector { _reserved: 0 },
Vector { _handler: SPU },
Vector { _reserved: 0 },
Vector {
_handler: CLOCK_POWER,
},
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector { _handler: SERIAL0 },
Vector { _handler: SERIAL1 },
Vector { _handler: SPIM4 },
Vector { _handler: SERIAL2 },
Vector { _handler: SERIAL3 },
Vector { _handler: GPIOTE0 },
Vector { _handler: SAADC },
Vector { _handler: TIMER0 },
Vector { _handler: TIMER1 },
Vector { _handler: TIMER2 },
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector { _handler: RTC0 },
Vector { _handler: RTC1 },
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector { _handler: WDT0 },
Vector { _handler: WDT1 },
Vector {
_handler: COMP_LPCOMP,
},
Vector { _handler: EGU0 },
Vector { _handler: EGU1 },
Vector { _handler: EGU2 },
Vector { _handler: EGU3 },
Vector { _handler: EGU4 },
Vector { _handler: EGU5 },
Vector { _handler: PWM0 },
Vector { _handler: PWM1 },
Vector { _handler: PWM2 },
Vector { _handler: PWM3 },
Vector { _reserved: 0 },
Vector { _handler: PDM0 },
Vector { _reserved: 0 },
Vector { _handler: I2S0 },
Vector { _reserved: 0 },
Vector { _handler: IPC },
Vector { _handler: QSPI },
Vector { _reserved: 0 },
Vector { _handler: NFCT },
Vector { _reserved: 0 },
Vector { _handler: GPIOTE1 },
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector { _handler: QDEC0 },
Vector { _handler: QDEC1 },
Vector { _reserved: 0 },
Vector { _handler: USBD },
Vector {
_handler: USBREGULATOR,
},
Vector { _reserved: 0 },
Vector { _handler: KMU },
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector {
_handler: CRYPTOCELL,
},
];
}
#[doc = "CACHEDATA"]
pub const CACHEDATA_S: cachedata::Cachedata =
unsafe { cachedata::Cachedata::from_ptr(0x00f0_0000usize as _) };
#[doc = "CACHEINFO"]
pub const CACHEINFO_S: cacheinfo::Cacheinfo =
unsafe { cacheinfo::Cacheinfo::from_ptr(0x00f0_8000usize as _) };
#[doc = "Factory Information Configuration Registers"]
pub const FICR_S: ficr::Ficr = unsafe { ficr::Ficr::from_ptr(0x00ff_0000usize as _) };
#[doc = "User Information Configuration Registers User information configuration registers"]
pub const UICR_S: uicr::Uicr = unsafe { uicr::Uicr::from_ptr(0x00ff_8000usize as _) };
#[doc = "Domain configuration management 0"]
pub const DCNF_NS: dcnf::Dcnf = unsafe { dcnf::Dcnf::from_ptr(0x4000_0000usize as _) };
#[doc = "FPU control peripheral 0"]
pub const FPU_NS: fpu::Fpu = unsafe { fpu::Fpu::from_ptr(0x4000_0000usize as _) };
#[doc = "Oscillator control 0"]
pub const OSCILLATORS_NS: oscillators::Oscillators =
unsafe { oscillators::Oscillators::from_ptr(0x4000_4000usize as _) };
#[doc = "Voltage regulators 0"]
pub const REGULATORS_NS: regulators::Regulators =
unsafe { regulators::Regulators::from_ptr(0x4000_4000usize as _) };
#[doc = "Clock management 0"]
pub const CLOCK_NS: clock::Clock = unsafe { clock::Clock::from_ptr(0x4000_5000usize as _) };
#[doc = "Power control 0"]
pub const POWER_NS: power::Power = unsafe { power::Power::from_ptr(0x4000_5000usize as _) };
#[doc = "Reset control 0"]
pub const RESET_NS: reset::Reset = unsafe { reset::Reset::from_ptr(0x4000_5000usize as _) };
#[doc = "Control access port 0"]
pub const CTRLAP_NS: ctrlapperi::Ctrlapperi =
unsafe { ctrlapperi::Ctrlapperi::from_ptr(0x4000_6000usize as _) };
#[doc = "Serial Peripheral Interface Master with EasyDMA 0"]
pub const SPIM0_NS: spim::Spim = unsafe { spim::Spim::from_ptr(0x4000_8000usize as _) };
#[doc = "SPI Slave 0"]
pub const SPIS0_NS: spis::Spis = unsafe { spis::Spis::from_ptr(0x4000_8000usize as _) };
#[doc = "I2C compatible Two-Wire Master Interface with EasyDMA 0"]
pub const TWIM0_NS: twim::Twim = unsafe { twim::Twim::from_ptr(0x4000_8000usize as _) };
#[doc = "I2C compatible Two-Wire Slave Interface with EasyDMA 0"]
pub const TWIS0_NS: twis::Twis = unsafe { twis::Twis::from_ptr(0x4000_8000usize as _) };
#[doc = "UART with EasyDMA 0"]
pub const UARTE0_NS: uarte::Uarte = unsafe { uarte::Uarte::from_ptr(0x4000_8000usize as _) };
#[doc = "Serial Peripheral Interface Master with EasyDMA 2"]
pub const SPIM1_NS: spim::Spim = unsafe { spim::Spim::from_ptr(0x4000_9000usize as _) };
#[doc = "SPI Slave 2"]
pub const SPIS1_NS: spis::Spis = unsafe { spis::Spis::from_ptr(0x4000_9000usize as _) };
#[doc = "I2C compatible Two-Wire Master Interface with EasyDMA 2"]
pub const TWIM1_NS: twim::Twim = unsafe { twim::Twim::from_ptr(0x4000_9000usize as _) };
#[doc = "I2C compatible Two-Wire Slave Interface with EasyDMA 2"]
pub const TWIS1_NS: twis::Twis = unsafe { twis::Twis::from_ptr(0x4000_9000usize as _) };
#[doc = "UART with EasyDMA 2"]
pub const UARTE1_NS: uarte::Uarte = unsafe { uarte::Uarte::from_ptr(0x4000_9000usize as _) };
#[doc = "Serial Peripheral Interface Master with EasyDMA 4"]
pub const SPIM4_NS: spim::Spim = unsafe { spim::Spim::from_ptr(0x4000_a000usize as _) };
#[doc = "Serial Peripheral Interface Master with EasyDMA 6"]
pub const SPIM2_NS: spim::Spim = unsafe { spim::Spim::from_ptr(0x4000_b000usize as _) };
#[doc = "SPI Slave 4"]
pub const SPIS2_NS: spis::Spis = unsafe { spis::Spis::from_ptr(0x4000_b000usize as _) };
#[doc = "I2C compatible Two-Wire Master Interface with EasyDMA 4"]
pub const TWIM2_NS: twim::Twim = unsafe { twim::Twim::from_ptr(0x4000_b000usize as _) };
#[doc = "I2C compatible Two-Wire Slave Interface with EasyDMA 4"]
pub const TWIS2_NS: twis::Twis = unsafe { twis::Twis::from_ptr(0x4000_b000usize as _) };
#[doc = "UART with EasyDMA 4"]
pub const UARTE2_NS: uarte::Uarte = unsafe { uarte::Uarte::from_ptr(0x4000_b000usize as _) };
#[doc = "Serial Peripheral Interface Master with EasyDMA 8"]
pub const SPIM3_NS: spim::Spim = unsafe { spim::Spim::from_ptr(0x4000_c000usize as _) };
#[doc = "SPI Slave 6"]
pub const SPIS3_NS: spis::Spis = unsafe { spis::Spis::from_ptr(0x4000_c000usize as _) };
#[doc = "I2C compatible Two-Wire Master Interface with EasyDMA 6"]
pub const TWIM3_NS: twim::Twim = unsafe { twim::Twim::from_ptr(0x4000_c000usize as _) };
#[doc = "I2C compatible Two-Wire Slave Interface with EasyDMA 6"]
pub const TWIS3_NS: twis::Twis = unsafe { twis::Twis::from_ptr(0x4000_c000usize as _) };
#[doc = "UART with EasyDMA 6"]
pub const UARTE3_NS: uarte::Uarte = unsafe { uarte::Uarte::from_ptr(0x4000_c000usize as _) };
#[doc = "Analog to Digital Converter 0"]
pub const SAADC_NS: saadc::Saadc = unsafe { saadc::Saadc::from_ptr(0x4000_e000usize as _) };
#[doc = "Timer/Counter 0"]
pub const TIMER0_NS: timer::Timer = unsafe { timer::Timer::from_ptr(0x4000_f000usize as _) };
#[doc = "Timer/Counter 2"]
pub const TIMER1_NS: timer::Timer = unsafe { timer::Timer::from_ptr(0x4001_0000usize as _) };
#[doc = "Timer/Counter 4"]
pub const TIMER2_NS: timer::Timer = unsafe { timer::Timer::from_ptr(0x4001_1000usize as _) };
#[doc = "Real-time counter 0"]
pub const RTC0_NS: rtc::Rtc = unsafe { rtc::Rtc::from_ptr(0x4001_4000usize as _) };
#[doc = "Real-time counter 2"]
pub const RTC1_NS: rtc::Rtc = unsafe { rtc::Rtc::from_ptr(0x4001_5000usize as _) };
#[doc = "Distributed programmable peripheral interconnect controller 0"]
pub const DPPIC_NS: dppic::Dppic = unsafe { dppic::Dppic::from_ptr(0x4001_7000usize as _) };
#[doc = "Watchdog Timer 0"]
pub const WDT0_NS: wdt::Wdt = unsafe { wdt::Wdt::from_ptr(0x4001_8000usize as _) };
#[doc = "Watchdog Timer 2"]
pub const WDT1_NS: wdt::Wdt = unsafe { wdt::Wdt::from_ptr(0x4001_9000usize as _) };
#[doc = "Comparator 0"]
pub const COMP_NS: comp::Comp = unsafe { comp::Comp::from_ptr(0x4001_a000usize as _) };
#[doc = "Low-power comparator 0"]
pub const LPCOMP_NS: lpcomp::Lpcomp = unsafe { lpcomp::Lpcomp::from_ptr(0x4001_a000usize as _) };
#[doc = "Event generator unit 0"]
pub const EGU0_NS: egu::Egu = unsafe { egu::Egu::from_ptr(0x4001_b000usize as _) };
#[doc = "Event generator unit 2"]
pub const EGU1_NS: egu::Egu = unsafe { egu::Egu::from_ptr(0x4001_c000usize as _) };
#[doc = "Event generator unit 4"]
pub const EGU2_NS: egu::Egu = unsafe { egu::Egu::from_ptr(0x4001_d000usize as _) };
#[doc = "Event generator unit 6"]
pub const EGU3_NS: egu::Egu = unsafe { egu::Egu::from_ptr(0x4001_e000usize as _) };
#[doc = "Event generator unit 8"]
pub const EGU4_NS: egu::Egu = unsafe { egu::Egu::from_ptr(0x4001_f000usize as _) };
#[doc = "Event generator unit 10"]
pub const EGU5_NS: egu::Egu = unsafe { egu::Egu::from_ptr(0x4002_0000usize as _) };
#[doc = "Pulse width modulation unit 0"]
pub const PWM0_NS: pwm::Pwm = unsafe { pwm::Pwm::from_ptr(0x4002_1000usize as _) };
#[doc = "Pulse width modulation unit 2"]
pub const PWM1_NS: pwm::Pwm = unsafe { pwm::Pwm::from_ptr(0x4002_2000usize as _) };
#[doc = "Pulse width modulation unit 4"]
pub const PWM2_NS: pwm::Pwm = unsafe { pwm::Pwm::from_ptr(0x4002_3000usize as _) };
#[doc = "Pulse width modulation unit 6"]
pub const PWM3_NS: pwm::Pwm = unsafe { pwm::Pwm::from_ptr(0x4002_4000usize as _) };
#[doc = "Pulse Density Modulation (Digital Microphone) Interface 0"]
pub const PDM0_NS: pdm::Pdm = unsafe { pdm::Pdm::from_ptr(0x4002_6000usize as _) };
#[doc = "Inter-IC Sound 0"]
pub const I2S0_NS: i2s::I2s = unsafe { i2s::I2s::from_ptr(0x4002_8000usize as _) };
#[doc = "Interprocessor communication 0"]
pub const IPC_NS: ipc::Ipc = unsafe { ipc::Ipc::from_ptr(0x4002_a000usize as _) };
#[doc = "External flash interface 0"]
pub const QSPI_NS: qspi::Qspi = unsafe { qspi::Qspi::from_ptr(0x4002_b000usize as _) };
#[doc = "NFC-A compatible radio 0"]
pub const NFCT_NS: nfct::Nfct = unsafe { nfct::Nfct::from_ptr(0x4002_d000usize as _) };
#[doc = "GPIO Tasks and Events 1"]
pub const GPIOTE1_NS: gpiote::Gpiote = unsafe { gpiote::Gpiote::from_ptr(0x4002_f000usize as _) };
#[doc = "MUTEX 0"]
pub const MUTEX_NS: mutex::Mutex = unsafe { mutex::Mutex::from_ptr(0x4003_0000usize as _) };
#[doc = "Quadrature Decoder 0"]
pub const QDEC0_NS: qdec::Qdec = unsafe { qdec::Qdec::from_ptr(0x4003_3000usize as _) };
#[doc = "Quadrature Decoder 2"]
pub const QDEC1_NS: qdec::Qdec = unsafe { qdec::Qdec::from_ptr(0x4003_4000usize as _) };
#[doc = "Universal serial bus device 0"]
pub const USBD_NS: usbd::Usbd = unsafe { usbd::Usbd::from_ptr(0x4003_6000usize as _) };
#[doc = "USB Regulator 0"]
pub const USBREGULATOR_NS: usbreg::Usbreg =
unsafe { usbreg::Usbreg::from_ptr(0x4003_7000usize as _) };
#[doc = "Key management unit 0"]
pub const KMU_NS: kmu::Kmu = unsafe { kmu::Kmu::from_ptr(0x4003_9000usize as _) };
#[doc = "Non-volatile memory controller 0"]
pub const NVMC_NS: nvmc::Nvmc = unsafe { nvmc::Nvmc::from_ptr(0x4003_9000usize as _) };
#[doc = "Volatile Memory controller 0"]
pub const VMC_NS: vmc::Vmc = unsafe { vmc::Vmc::from_ptr(0x4008_1000usize as _) };
#[doc = "GPIO Port 0"]
pub const P0_NS: gpio::Gpio = unsafe { gpio::Gpio::from_ptr(0x4084_2500usize as _) };
#[doc = "GPIO Port 1"]
pub const P1_NS: gpio::Gpio = unsafe { gpio::Gpio::from_ptr(0x4084_2800usize as _) };
#[doc = "Domain configuration management 1"]
pub const DCNF_S: dcnf::Dcnf = unsafe { dcnf::Dcnf::from_ptr(0x5000_0000usize as _) };
#[doc = "FPU control peripheral 1"]
pub const FPU_S: fpu::Fpu = unsafe { fpu::Fpu::from_ptr(0x5000_0000usize as _) };
#[doc = "Cache"]
pub const CACHE_S: cache::Cache = unsafe { cache::Cache::from_ptr(0x5000_1000usize as _) };
#[doc = "System protection unit"]
pub const SPU_S: spu::Spu = unsafe { spu::Spu::from_ptr(0x5000_3000usize as _) };
#[doc = "Oscillator control 1"]
pub const OSCILLATORS_S: oscillators::Oscillators =
unsafe { oscillators::Oscillators::from_ptr(0x5000_4000usize as _) };
#[doc = "Voltage regulators 1"]
pub const REGULATORS_S: regulators::Regulators =
unsafe { regulators::Regulators::from_ptr(0x5000_4000usize as _) };
#[doc = "Clock management 1"]
pub const CLOCK_S: clock::Clock = unsafe { clock::Clock::from_ptr(0x5000_5000usize as _) };
#[doc = "Power control 1"]
pub const POWER_S: power::Power = unsafe { power::Power::from_ptr(0x5000_5000usize as _) };
#[doc = "Reset control 1"]
pub const RESET_S: reset::Reset = unsafe { reset::Reset::from_ptr(0x5000_5000usize as _) };
#[doc = "Control access port 1"]
pub const CTRLAP_S: ctrlapperi::Ctrlapperi =
unsafe { ctrlapperi::Ctrlapperi::from_ptr(0x5000_6000usize as _) };
#[doc = "Serial Peripheral Interface Master with EasyDMA 1"]
pub const SPIM0_S: spim::Spim = unsafe { spim::Spim::from_ptr(0x5000_8000usize as _) };
#[doc = "SPI Slave 1"]
pub const SPIS0_S: spis::Spis = unsafe { spis::Spis::from_ptr(0x5000_8000usize as _) };
#[doc = "I2C compatible Two-Wire Master Interface with EasyDMA 1"]
pub const TWIM0_S: twim::Twim = unsafe { twim::Twim::from_ptr(0x5000_8000usize as _) };
#[doc = "I2C compatible Two-Wire Slave Interface with EasyDMA 1"]
pub const TWIS0_S: twis::Twis = unsafe { twis::Twis::from_ptr(0x5000_8000usize as _) };
#[doc = "UART with EasyDMA 1"]
pub const UARTE0_S: uarte::Uarte = unsafe { uarte::Uarte::from_ptr(0x5000_8000usize as _) };
#[doc = "Serial Peripheral Interface Master with EasyDMA 3"]
pub const SPIM1_S: spim::Spim = unsafe { spim::Spim::from_ptr(0x5000_9000usize as _) };
#[doc = "SPI Slave 3"]
pub const SPIS1_S: spis::Spis = unsafe { spis::Spis::from_ptr(0x5000_9000usize as _) };
#[doc = "I2C compatible Two-Wire Master Interface with EasyDMA 3"]
pub const TWIM1_S: twim::Twim = unsafe { twim::Twim::from_ptr(0x5000_9000usize as _) };
#[doc = "I2C compatible Two-Wire Slave Interface with EasyDMA 3"]
pub const TWIS1_S: twis::Twis = unsafe { twis::Twis::from_ptr(0x5000_9000usize as _) };
#[doc = "UART with EasyDMA 3"]
pub const UARTE1_S: uarte::Uarte = unsafe { uarte::Uarte::from_ptr(0x5000_9000usize as _) };
#[doc = "Serial Peripheral Interface Master with EasyDMA 5"]
pub const SPIM4_S: spim::Spim = unsafe { spim::Spim::from_ptr(0x5000_a000usize as _) };
#[doc = "Serial Peripheral Interface Master with EasyDMA 7"]
pub const SPIM2_S: spim::Spim = unsafe { spim::Spim::from_ptr(0x5000_b000usize as _) };
#[doc = "SPI Slave 5"]
pub const SPIS2_S: spis::Spis = unsafe { spis::Spis::from_ptr(0x5000_b000usize as _) };
#[doc = "I2C compatible Two-Wire Master Interface with EasyDMA 5"]
pub const TWIM2_S: twim::Twim = unsafe { twim::Twim::from_ptr(0x5000_b000usize as _) };
#[doc = "I2C compatible Two-Wire Slave Interface with EasyDMA 5"]
pub const TWIS2_S: twis::Twis = unsafe { twis::Twis::from_ptr(0x5000_b000usize as _) };
#[doc = "UART with EasyDMA 5"]
pub const UARTE2_S: uarte::Uarte = unsafe { uarte::Uarte::from_ptr(0x5000_b000usize as _) };
#[doc = "Serial Peripheral Interface Master with EasyDMA 9"]
pub const SPIM3_S: spim::Spim = unsafe { spim::Spim::from_ptr(0x5000_c000usize as _) };
#[doc = "SPI Slave 7"]
pub const SPIS3_S: spis::Spis = unsafe { spis::Spis::from_ptr(0x5000_c000usize as _) };
#[doc = "I2C compatible Two-Wire Master Interface with EasyDMA 7"]
pub const TWIM3_S: twim::Twim = unsafe { twim::Twim::from_ptr(0x5000_c000usize as _) };
#[doc = "I2C compatible Two-Wire Slave Interface with EasyDMA 7"]
pub const TWIS3_S: twis::Twis = unsafe { twis::Twis::from_ptr(0x5000_c000usize as _) };
#[doc = "UART with EasyDMA 7"]
pub const UARTE3_S: uarte::Uarte = unsafe { uarte::Uarte::from_ptr(0x5000_c000usize as _) };
#[doc = "GPIO Tasks and Events 0"]
pub const GPIOTE0_S: gpiote::Gpiote = unsafe { gpiote::Gpiote::from_ptr(0x5000_d000usize as _) };
#[doc = "Analog to Digital Converter 1"]
pub const SAADC_S: saadc::Saadc = unsafe { saadc::Saadc::from_ptr(0x5000_e000usize as _) };
#[doc = "Timer/Counter 1"]
pub const TIMER0_S: timer::Timer = unsafe { timer::Timer::from_ptr(0x5000_f000usize as _) };
#[doc = "Timer/Counter 3"]
pub const TIMER1_S: timer::Timer = unsafe { timer::Timer::from_ptr(0x5001_0000usize as _) };
#[doc = "Timer/Counter 5"]
pub const TIMER2_S: timer::Timer = unsafe { timer::Timer::from_ptr(0x5001_1000usize as _) };
#[doc = "Real-time counter 1"]
pub const RTC0_S: rtc::Rtc = unsafe { rtc::Rtc::from_ptr(0x5001_4000usize as _) };
#[doc = "Real-time counter 3"]
pub const RTC1_S: rtc::Rtc = unsafe { rtc::Rtc::from_ptr(0x5001_5000usize as _) };
#[doc = "Distributed programmable peripheral interconnect controller 1"]
pub const DPPIC_S: dppic::Dppic = unsafe { dppic::Dppic::from_ptr(0x5001_7000usize as _) };
#[doc = "Watchdog Timer 1"]
pub const WDT0_S: wdt::Wdt = unsafe { wdt::Wdt::from_ptr(0x5001_8000usize as _) };
#[doc = "Watchdog Timer 3"]
pub const WDT1_S: wdt::Wdt = unsafe { wdt::Wdt::from_ptr(0x5001_9000usize as _) };
#[doc = "Comparator 1"]
pub const COMP_S: comp::Comp = unsafe { comp::Comp::from_ptr(0x5001_a000usize as _) };
#[doc = "Low-power comparator 1"]
pub const LPCOMP_S: lpcomp::Lpcomp = unsafe { lpcomp::Lpcomp::from_ptr(0x5001_a000usize as _) };
#[doc = "Event generator unit 1"]
pub const EGU0_S: egu::Egu = unsafe { egu::Egu::from_ptr(0x5001_b000usize as _) };
#[doc = "Event generator unit 3"]
pub const EGU1_S: egu::Egu = unsafe { egu::Egu::from_ptr(0x5001_c000usize as _) };
#[doc = "Event generator unit 5"]
pub const EGU2_S: egu::Egu = unsafe { egu::Egu::from_ptr(0x5001_d000usize as _) };
#[doc = "Event generator unit 7"]
pub const EGU3_S: egu::Egu = unsafe { egu::Egu::from_ptr(0x5001_e000usize as _) };
#[doc = "Event generator unit 9"]
pub const EGU4_S: egu::Egu = unsafe { egu::Egu::from_ptr(0x5001_f000usize as _) };
#[doc = "Event generator unit 11"]
pub const EGU5_S: egu::Egu = unsafe { egu::Egu::from_ptr(0x5002_0000usize as _) };
#[doc = "Pulse width modulation unit 1"]
pub const PWM0_S: pwm::Pwm = unsafe { pwm::Pwm::from_ptr(0x5002_1000usize as _) };
#[doc = "Pulse width modulation unit 3"]
pub const PWM1_S: pwm::Pwm = unsafe { pwm::Pwm::from_ptr(0x5002_2000usize as _) };
#[doc = "Pulse width modulation unit 5"]
pub const PWM2_S: pwm::Pwm = unsafe { pwm::Pwm::from_ptr(0x5002_3000usize as _) };
#[doc = "Pulse width modulation unit 7"]
pub const PWM3_S: pwm::Pwm = unsafe { pwm::Pwm::from_ptr(0x5002_4000usize as _) };
#[doc = "Pulse Density Modulation (Digital Microphone) Interface 1"]
pub const PDM0_S: pdm::Pdm = unsafe { pdm::Pdm::from_ptr(0x5002_6000usize as _) };
#[doc = "Inter-IC Sound 1"]
pub const I2S0_S: i2s::I2s = unsafe { i2s::I2s::from_ptr(0x5002_8000usize as _) };
#[doc = "Interprocessor communication 1"]
pub const IPC_S: ipc::Ipc = unsafe { ipc::Ipc::from_ptr(0x5002_a000usize as _) };
#[doc = "External flash interface 1"]
pub const QSPI_S: qspi::Qspi = unsafe { qspi::Qspi::from_ptr(0x5002_b000usize as _) };
#[doc = "NFC-A compatible radio 1"]
pub const NFCT_S: nfct::Nfct = unsafe { nfct::Nfct::from_ptr(0x5002_d000usize as _) };
#[doc = "MUTEX 1"]
pub const MUTEX_S: mutex::Mutex = unsafe { mutex::Mutex::from_ptr(0x5003_0000usize as _) };
#[doc = "Quadrature Decoder 1"]
pub const QDEC0_S: qdec::Qdec = unsafe { qdec::Qdec::from_ptr(0x5003_3000usize as _) };
#[doc = "Quadrature Decoder 3"]
pub const QDEC1_S: qdec::Qdec = unsafe { qdec::Qdec::from_ptr(0x5003_4000usize as _) };
#[doc = "Universal serial bus device 1"]
pub const USBD_S: usbd::Usbd = unsafe { usbd::Usbd::from_ptr(0x5003_6000usize as _) };
#[doc = "USB Regulator 1"]
pub const USBREGULATOR_S: usbreg::Usbreg =
unsafe { usbreg::Usbreg::from_ptr(0x5003_7000usize as _) };
#[doc = "Key management unit 1"]
pub const KMU_S: kmu::Kmu = unsafe { kmu::Kmu::from_ptr(0x5003_9000usize as _) };
#[doc = "Non-volatile memory controller 1"]
pub const NVMC_S: nvmc::Nvmc = unsafe { nvmc::Nvmc::from_ptr(0x5003_9000usize as _) };
#[doc = "Volatile Memory controller 1"]
pub const VMC_S: vmc::Vmc = unsafe { vmc::Vmc::from_ptr(0x5008_1000usize as _) };
#[doc = "GPIO Port 2"]
pub const P0_S: gpio::Gpio = unsafe { gpio::Gpio::from_ptr(0x5084_2500usize as _) };
#[doc = "GPIO Port 3"]
pub const P1_S: gpio::Gpio = unsafe { gpio::Gpio::from_ptr(0x5084_2800usize as _) };
#[doc = "CRYPTOCELL register interface"]
pub const CRYPTOCELL_S: cryptocell::Cryptocell =
unsafe { cryptocell::Cryptocell::from_ptr(0x5084_4000usize as _) };
#[doc = "CRYPTOCELL AES engine"]
pub const CC_AES_S: cc_aes::CcAes = unsafe { cc_aes::CcAes::from_ptr(0x5084_5000usize as _) };
#[doc = "CRYPTOCELL AHB interface"]
pub const CC_AHB_S: cc_ahb::CcAhb = unsafe { cc_ahb::CcAhb::from_ptr(0x5084_5000usize as _) };
#[doc = "CryptoCell AO"]
pub const CC_AO_S: cc_ao::CcAo = unsafe { cc_ao::CcAo::from_ptr(0x5084_5000usize as _) };
#[doc = "CRYPTOCELL CHACHA engine"]
pub const CC_CHACHA_S: cc_chacha::CcChacha =
unsafe { cc_chacha::CcChacha::from_ptr(0x5084_5000usize as _) };
#[doc = "CRYPTOCELL CTL interface"]
pub const CC_CTL_S: cc_ctl::CcCtl = unsafe { cc_ctl::CcCtl::from_ptr(0x5084_5000usize as _) };
#[doc = "CRYPTOCELL Data IN interface"]
pub const CC_DIN_S: cc_din::CcDin = unsafe { cc_din::CcDin::from_ptr(0x5084_5000usize as _) };
#[doc = "CRYPTOCELL Data OUT interface"]
pub const CC_DOUT_S: cc_dout::CcDout = unsafe { cc_dout::CcDout::from_ptr(0x5084_5000usize as _) };
#[doc = "CRYPTOCELL GHASH engine"]
pub const CC_GHASH_S: cc_ghash::CcGhash =
unsafe { cc_ghash::CcGhash::from_ptr(0x5084_5000usize as _) };
#[doc = "CRYPTOCELL HASH engine"]
pub const CC_HASH_S: cc_hash::CcHash = unsafe { cc_hash::CcHash::from_ptr(0x5084_5000usize as _) };
#[doc = "CRYPTOCELL HOST register interface"]
pub const CC_HOST_RGF_S: cc_host_rgf::CcHostRgf =
unsafe { cc_host_rgf::CcHostRgf::from_ptr(0x5084_5000usize as _) };
#[doc = "CRYPTOCELL MISC interface"]
pub const CC_MISC_S: cc_misc::CcMisc = unsafe { cc_misc::CcMisc::from_ptr(0x5084_5000usize as _) };
#[doc = "CRYPTOCELL PKA engine"]
pub const CC_PKA_S: cc_pka::CcPka = unsafe { cc_pka::CcPka::from_ptr(0x5084_5000usize as _) };
#[doc = "CRYPTOCELL RNG engine"]
pub const CC_RNG_S: cc_rng::CcRng = unsafe { cc_rng::CcRng::from_ptr(0x5084_5000usize as _) };
#[doc = "CRYPTOCELL RNG SRAM interface"]
pub const CC_RNG_SRAM_S: cc_rng_sram::CcRngSram =
unsafe { cc_rng_sram::CcRngSram::from_ptr(0x5084_5000usize as _) };
#[doc = "Cross-Trigger Interface control. NOTE: this is not a separate peripheral, but describes CM33 functionality."]
pub const CTI_S: cti::Cti = unsafe { cti::Cti::from_ptr(0xe004_2000usize as _) };
#[doc = "Trace and debug control"]
pub const TAD_S: tad::Tad = unsafe { tad::Tad::from_ptr(0xe008_0000usize as _) };
#[doc = r" Number available in the NVIC for configuring priority"]
#[cfg(feature = "rt")]
pub const NVIC_PRIO_BITS: u8 = 3;
#[cfg(feature = "rt")]
pub use cortex_m_rt::interrupt;
#[cfg(feature = "rt")]
pub use Interrupt as interrupt;
pub mod cache {
#[doc = "Cache."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cache {
ptr: *mut u8,
}
unsafe impl Send for Cache {}
unsafe impl Sync for Cache {}
impl Cache {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn profiling(self, n: usize) -> Profiling {
assert!(n < 2usize);
unsafe { Profiling::from_ptr(self.ptr.wrapping_add(0x0400usize + n * 32usize) as _) }
}
#[doc = "Enable cache."]
#[inline(always)]
pub const fn enable(self) -> crate::common::Reg<regs::Enable, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0500usize) as _) }
}
#[doc = "Invalidate the cache."]
#[inline(always)]
pub const fn invalidate(self) -> crate::common::Reg<regs::Invalidate, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0504usize) as _) }
}
#[doc = "Erase the cache."]
#[inline(always)]
pub const fn erase(self) -> crate::common::Reg<regs::Erase, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0508usize) as _) }
}
#[doc = "Enable the profiling counters."]
#[inline(always)]
pub const fn profilingenable(
self,
) -> crate::common::Reg<regs::Profilingenable, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x050cusize) as _) }
}
#[doc = "Clear the profiling counters."]
#[inline(always)]
pub const fn profilingclear(
self,
) -> crate::common::Reg<regs::Profilingclear, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0510usize) as _) }
}
#[doc = "Cache mode. Switching from Cache to Ram mode causes the RAM to be cleared. Switching from RAM to Cache mode causes the cache to be invalidated."]
#[inline(always)]
pub const fn mode(self) -> crate::common::Reg<regs::Mode, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0514usize) as _) }
}
#[doc = "Lock debug mode."]
#[inline(always)]
pub const fn debuglock(self) -> crate::common::Reg<regs::Debuglock, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0518usize) as _) }
}
#[doc = "Cache erase status."]
#[inline(always)]
pub const fn erasestatus(self) -> crate::common::Reg<regs::Erasestatus, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x051cusize) as _) }
}
#[doc = "Lock cache updates. Prevents updating of cache content on cache misses, but will continue to lookup instruction/data fetches in content already present in the cache. Ignored in RAM mode."]
#[inline(always)]
pub const fn writelock(self) -> crate::common::Reg<regs::Writelock, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0520usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Profiling {
ptr: *mut u8,
}
unsafe impl Send for Profiling {}
unsafe impl Sync for Profiling {}
impl Profiling {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: Instruction fetch cache hit counter for cache region n, where n=0 means Flash and n=1 means XIP."]
#[inline(always)]
pub const fn ihit(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Description cluster: Instruction fetch cache miss counter for cache region n, where n=0 means Flash and n=1 means XIP."]
#[inline(always)]
pub const fn imiss(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Description cluster: Data fetch cache hit counter for cache region n, where n=0 means Flash and n=1 means XIP."]
#[inline(always)]
pub const fn dhit(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Description cluster: Data fetch cache miss counter for cache region n, where n=0 means Flash and n=1 means XIP."]
#[inline(always)]
pub const fn dmiss(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
}
pub mod regs {
#[doc = "Lock debug mode."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Debuglock(pub u32);
impl Debuglock {
#[doc = "Lock debug mode."]
#[must_use]
#[inline(always)]
pub const fn debuglock(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Lock debug mode."]
#[inline(always)]
pub const fn set_debuglock(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Debuglock {
#[inline(always)]
fn default() -> Debuglock {
Debuglock(0)
}
}
impl core::fmt::Debug for Debuglock {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Debuglock")
.field("debuglock", &self.debuglock())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Debuglock {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Debuglock {{ debuglock: {=bool:?} }}", self.debuglock())
}
}
#[doc = "Enable cache."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Enable(pub u32);
impl Enable {
#[doc = "Enable cache."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable cache."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Enable {
#[inline(always)]
fn default() -> Enable {
Enable(0)
}
}
impl core::fmt::Debug for Enable {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Enable")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Enable {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Enable {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "Erase the cache."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Erase(pub u32);
impl Erase {
#[doc = "Erase the cache."]
#[must_use]
#[inline(always)]
pub const fn erase(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Erase the cache."]
#[inline(always)]
pub const fn set_erase(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Erase {
#[inline(always)]
fn default() -> Erase {
Erase(0)
}
}
impl core::fmt::Debug for Erase {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Erase")
.field("erase", &self.erase())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Erase {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Erase {{ erase: {=bool:?} }}", self.erase())
}
}
#[doc = "Cache erase status."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Erasestatus(pub u32);
impl Erasestatus {
#[doc = "Cache erase status."]
#[must_use]
#[inline(always)]
pub const fn erasestatus(&self) -> super::vals::Erasestatus {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Erasestatus::from_bits(val as u8)
}
#[doc = "Cache erase status."]
#[inline(always)]
pub const fn set_erasestatus(&mut self, val: super::vals::Erasestatus) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Erasestatus {
#[inline(always)]
fn default() -> Erasestatus {
Erasestatus(0)
}
}
impl core::fmt::Debug for Erasestatus {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Erasestatus")
.field("erasestatus", &self.erasestatus())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Erasestatus {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Erasestatus {{ erasestatus: {:?} }}", self.erasestatus())
}
}
#[doc = "Invalidate the cache."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Invalidate(pub u32);
impl Invalidate {
#[doc = "Invalidate the cache."]
#[must_use]
#[inline(always)]
pub const fn invalidate(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Invalidate the cache."]
#[inline(always)]
pub const fn set_invalidate(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Invalidate {
#[inline(always)]
fn default() -> Invalidate {
Invalidate(0)
}
}
impl core::fmt::Debug for Invalidate {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Invalidate")
.field("invalidate", &self.invalidate())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Invalidate {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Invalidate {{ invalidate: {=bool:?} }}",
self.invalidate()
)
}
}
#[doc = "Cache mode. Switching from Cache to Ram mode causes the RAM to be cleared. Switching from RAM to Cache mode causes the cache to be invalidated."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Mode(pub u32);
impl Mode {
#[doc = "Cache mode."]
#[must_use]
#[inline(always)]
pub const fn mode(&self) -> super::vals::Mode {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Mode::from_bits(val as u8)
}
#[doc = "Cache mode."]
#[inline(always)]
pub const fn set_mode(&mut self, val: super::vals::Mode) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Mode {
#[inline(always)]
fn default() -> Mode {
Mode(0)
}
}
impl core::fmt::Debug for Mode {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Mode").field("mode", &self.mode()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Mode {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Mode {{ mode: {:?} }}", self.mode())
}
}
#[doc = "Clear the profiling counters."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Profilingclear(pub u32);
impl Profilingclear {
#[doc = "Clearing the profiling counters."]
#[must_use]
#[inline(always)]
pub const fn clear(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Clearing the profiling counters."]
#[inline(always)]
pub const fn set_clear(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Profilingclear {
#[inline(always)]
fn default() -> Profilingclear {
Profilingclear(0)
}
}
impl core::fmt::Debug for Profilingclear {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Profilingclear")
.field("clear", &self.clear())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Profilingclear {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Profilingclear {{ clear: {=bool:?} }}", self.clear())
}
}
#[doc = "Enable the profiling counters."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Profilingenable(pub u32);
impl Profilingenable {
#[doc = "Enable the profiling counters."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable the profiling counters."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Profilingenable {
#[inline(always)]
fn default() -> Profilingenable {
Profilingenable(0)
}
}
impl core::fmt::Debug for Profilingenable {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Profilingenable")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Profilingenable {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Profilingenable {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "Lock cache updates. Prevents updating of cache content on cache misses, but will continue to lookup instruction/data fetches in content already present in the cache. Ignored in RAM mode."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Writelock(pub u32);
impl Writelock {
#[doc = "Lock cache updates."]
#[must_use]
#[inline(always)]
pub const fn writelock(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Lock cache updates."]
#[inline(always)]
pub const fn set_writelock(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Writelock {
#[inline(always)]
fn default() -> Writelock {
Writelock(0)
}
}
impl core::fmt::Debug for Writelock {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Writelock")
.field("writelock", &self.writelock())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Writelock {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Writelock {{ writelock: {=bool:?} }}", self.writelock())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Erasestatus {
#[doc = "Erase is not complete or hasn't started."]
Idle = 0x0,
#[doc = "Cache erase is finished."]
Finished = 0x01,
}
impl Erasestatus {
#[inline(always)]
pub const fn from_bits(val: u8) -> Erasestatus {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Erasestatus {
#[inline(always)]
fn from(val: u8) -> Erasestatus {
Erasestatus::from_bits(val)
}
}
impl From<Erasestatus> for u8 {
#[inline(always)]
fn from(val: Erasestatus) -> u8 {
Erasestatus::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Mode {
#[doc = "Cache mode."]
Cache = 0x0,
#[doc = "RAM mode."]
Ram = 0x01,
}
impl Mode {
#[inline(always)]
pub const fn from_bits(val: u8) -> Mode {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Mode {
#[inline(always)]
fn from(val: u8) -> Mode {
Mode::from_bits(val)
}
}
impl From<Mode> for u8 {
#[inline(always)]
fn from(val: Mode) -> u8 {
Mode::to_bits(val)
}
}
}
}
pub mod cachedata {
#[doc = "CACHEDATA."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cachedata {
ptr: *mut u8,
}
unsafe impl Send for Cachedata {}
unsafe impl Sync for Cachedata {}
impl Cachedata {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn set(self, n: usize) -> Set {
assert!(n < 256usize);
unsafe { Set::from_ptr(self.ptr.wrapping_add(0x0usize + n * 32usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Set {
ptr: *mut u8,
}
unsafe impl Send for Set {}
unsafe impl Sync for Set {}
impl Set {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn way(self, n: usize) -> Way {
assert!(n < 2usize);
unsafe { Way::from_ptr(self.ptr.wrapping_add(0x0usize + n * 16usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Way {
ptr: *mut u8,
}
unsafe impl Send for Way {}
unsafe impl Sync for Way {}
impl Way {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: Cache data bits \\[31:0\\] of SET\\[n\\], WAY\\[o\\]."]
#[inline(always)]
pub const fn data0(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Description cluster: Cache data bits \\[63:32\\] of SET\\[n\\], WAY\\[o\\]."]
#[inline(always)]
pub const fn data1(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Description cluster: Cache data bits \\[95:64\\] of SET\\[n\\], WAY\\[o\\]."]
#[inline(always)]
pub const fn data2(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Description cluster: Cache data bits \\[127:96\\] of SET\\[n\\], WAY\\[o\\]."]
#[inline(always)]
pub const fn data3(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
}
}
pub mod cacheinfo {
#[doc = "CACHEINFO."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cacheinfo {
ptr: *mut u8,
}
unsafe impl Send for Cacheinfo {}
unsafe impl Sync for Cacheinfo {}
impl Cacheinfo {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn set(self, n: usize) -> Set {
assert!(n < 256usize);
unsafe { Set::from_ptr(self.ptr.wrapping_add(0x0usize + n * 8usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Set {
ptr: *mut u8,
}
unsafe impl Send for Set {}
unsafe impl Sync for Set {}
impl Set {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description collection: Cache information for SET\\[n\\], WAY\\[o\\]."]
#[inline(always)]
pub const fn way(self, n: usize) -> crate::common::Reg<regs::Way, crate::common::RW> {
assert!(n < 2usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize + n * 4usize) as _)
}
}
}
pub mod regs {
#[doc = "Description collection: Cache information for SET\\[n\\], WAY\\[o\\]."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Way(pub u32);
impl Way {
#[doc = "Cache tag."]
#[must_use]
#[inline(always)]
pub const fn tag(&self) -> u32 {
let val = (self.0 >> 0usize) & 0x0001_ffff;
val as u32
}
#[doc = "Cache tag."]
#[inline(always)]
pub const fn set_tag(&mut self, val: u32) {
self.0 =
(self.0 & !(0x0001_ffff << 0usize)) | (((val as u32) & 0x0001_ffff) << 0usize);
}
#[doc = "Valid bit."]
#[must_use]
#[inline(always)]
pub const fn v(&self) -> bool {
let val = (self.0 >> 30usize) & 0x01;
val != 0
}
#[doc = "Valid bit."]
#[inline(always)]
pub const fn set_v(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize);
}
#[doc = "Most recently used way."]
#[must_use]
#[inline(always)]
pub const fn mru(&self) -> super::vals::Mru {
let val = (self.0 >> 31usize) & 0x01;
super::vals::Mru::from_bits(val as u8)
}
#[doc = "Most recently used way."]
#[inline(always)]
pub const fn set_mru(&mut self, val: super::vals::Mru) {
self.0 =
(self.0 & !(0x01 << 31usize)) | (((val.to_bits() as u32) & 0x01) << 31usize);
}
}
impl Default for Way {
#[inline(always)]
fn default() -> Way {
Way(0)
}
}
impl core::fmt::Debug for Way {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Way")
.field("tag", &self.tag())
.field("v", &self.v())
.field("mru", &self.mru())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Way {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Way {{ tag: {=u32:?}, v: {=bool:?}, mru: {:?} }}",
self.tag(),
self.v(),
self.mru()
)
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Mru {
#[doc = "Way0 was most recently used."]
Way0 = 0x0,
#[doc = "Way1 was most recently used."]
Way1 = 0x01,
}
impl Mru {
#[inline(always)]
pub const fn from_bits(val: u8) -> Mru {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Mru {
#[inline(always)]
fn from(val: u8) -> Mru {
Mru::from_bits(val)
}
}
impl From<Mru> for u8 {
#[inline(always)]
fn from(val: Mru) -> u8 {
Mru::to_bits(val)
}
}
}
}
pub mod cc_aes {
#[doc = "CRYPTOCELL AES engine."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct CcAes {
ptr: *mut u8,
}
unsafe impl Send for CcAes {}
unsafe impl Sync for CcAes {}
impl CcAes {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description collection: AES key value to use in non-tunneling operations, or as the first tunnel stage key in tunneling operations. The initial AES_KEY_0\\[0\\] register holds the least significant bits \\[31:0\\] of the key value."]
#[inline(always)]
pub const fn aes_key_0(self, n: usize) -> crate::common::Reg<u32, crate::common::W> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0400usize + n * 4usize) as _)
}
}
#[doc = "Description collection: AES key value to use as the second tunnel stage key in tunneling operations. The initial AES_KEY_1\\[0\\] register holds the least significant bits \\[31:0\\] of the key value."]
#[inline(always)]
pub const fn aes_key_1(self, n: usize) -> crate::common::Reg<u32, crate::common::W> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0420usize + n * 4usize) as _)
}
}
#[doc = "Description collection: AES Initialization Vector (IV) to use in non-tunneling operations, or as the first tunnel stage IV in tunneling operations. The initial AES_IV_0\\[0\\] register holds the least significant bits \\[31:0\\] of the IV."]
#[inline(always)]
pub const fn aes_iv_0(self, n: usize) -> crate::common::Reg<u32, crate::common::RW> {
assert!(n < 4usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0440usize + n * 4usize) as _)
}
}
#[doc = "Description collection: AES Initialization Vector (IV) to use as the second tunnel stage IV in tunneling operations. The initial AES_IV_1\\[0\\] register holds the least significant bits \\[31:0\\] of the IV."]
#[inline(always)]
pub const fn aes_iv_1(self, n: usize) -> crate::common::Reg<u32, crate::common::RW> {
assert!(n < 4usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0450usize + n * 4usize) as _)
}
}
#[doc = "Description collection: AES counter (CTR) to use in non-tunneling and tunneling operations. The initial AES_CTR\\[0\\] register holds the least significant bits \\[31:0\\] of the CTR."]
#[inline(always)]
pub const fn aes_ctr(self, n: usize) -> crate::common::Reg<u32, crate::common::RW> {
assert!(n < 4usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0460usize + n * 4usize) as _)
}
}
#[doc = "Status register for AES engine activity."]
#[inline(always)]
pub const fn aes_busy(self) -> crate::common::Reg<regs::AesBusy, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0470usize) as _) }
}
#[doc = "Writing to this address triggers the AES engine to generate K1 and K2 for AES-CMAC operations."]
#[inline(always)]
pub const fn aes_cmac_init(
self,
) -> crate::common::Reg<regs::AesCmacInit, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x047cusize) as _) }
}
#[doc = "This register should be set with the amount of remaining bytes until the end of the current AES operation."]
#[inline(always)]
pub const fn aes_remaining_bytes(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04bcusize) as _) }
}
#[doc = "Control the AES engine behavior."]
#[inline(always)]
pub const fn aes_control(self) -> crate::common::Reg<regs::AesControl, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04c0usize) as _) }
}
#[doc = "Hardware configuration of the AES engine. Reset value holds the supported features."]
#[inline(always)]
pub const fn aes_hw_flags(self) -> crate::common::Reg<regs::AesHwFlags, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04c8usize) as _) }
}
#[doc = "This register enables the AES CTR no increment mode in which the counter mode is not incremented between two blocks."]
#[inline(always)]
pub const fn aes_ctr_no_increment(
self,
) -> crate::common::Reg<regs::AesCtrNoIncrement, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04d8usize) as _) }
}
#[doc = "Reset the AES engine."]
#[inline(always)]
pub const fn aes_sw_reset(self) -> crate::common::Reg<regs::AesSwReset, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04f4usize) as _) }
}
#[doc = "Writing to this address triggers the AES engine to perform a CMAC operation with size 0. The CMAC result can be read from the AES_IV_0 register."]
#[inline(always)]
pub const fn aes_cmac_size0_kick(
self,
) -> crate::common::Reg<regs::AesCmacSize0Kick, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0524usize) as _) }
}
}
pub mod regs {
#[doc = "Status register for AES engine activity."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct AesBusy(pub u32);
impl AesBusy {
#[doc = "AES engine status."]
#[must_use]
#[inline(always)]
pub const fn status(&self) -> super::vals::Status {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Status::from_bits(val as u8)
}
#[doc = "AES engine status."]
#[inline(always)]
pub const fn set_status(&mut self, val: super::vals::Status) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for AesBusy {
#[inline(always)]
fn default() -> AesBusy {
AesBusy(0)
}
}
impl core::fmt::Debug for AesBusy {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("AesBusy")
.field("status", &self.status())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for AesBusy {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "AesBusy {{ status: {:?} }}", self.status())
}
}
#[doc = "Writing to this address triggers the AES engine to generate K1 and K2 for AES-CMAC operations."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct AesCmacInit(pub u32);
impl AesCmacInit {
#[doc = "Generate K1 and K2 for the AES-CMAC operations."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Generate K1 and K2 for the AES-CMAC operations."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for AesCmacInit {
#[inline(always)]
fn default() -> AesCmacInit {
AesCmacInit(0)
}
}
impl core::fmt::Debug for AesCmacInit {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("AesCmacInit")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for AesCmacInit {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "AesCmacInit {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "Writing to this address triggers the AES engine to perform a CMAC operation with size 0. The CMAC result can be read from the AES_IV_0 register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct AesCmacSize0Kick(pub u32);
impl AesCmacSize0Kick {
#[doc = "Force AES CMAC operation with size 0."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Force AES CMAC operation with size 0."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for AesCmacSize0Kick {
#[inline(always)]
fn default() -> AesCmacSize0Kick {
AesCmacSize0Kick(0)
}
}
impl core::fmt::Debug for AesCmacSize0Kick {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("AesCmacSize0Kick")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for AesCmacSize0Kick {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "AesCmacSize0Kick {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "Control the AES engine behavior."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct AesControl(pub u32);
impl AesControl {
#[doc = "Set AES encrypt or decrypt mode in non-tunneling operations."]
#[must_use]
#[inline(always)]
pub const fn dec_key0(&self) -> super::vals::DecKey0 {
let val = (self.0 >> 0usize) & 0x01;
super::vals::DecKey0::from_bits(val as u8)
}
#[doc = "Set AES encrypt or decrypt mode in non-tunneling operations."]
#[inline(always)]
pub const fn set_dec_key0(&mut self, val: super::vals::DecKey0) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "This field allows to add distinction to the CBC and CTR modes defined in field MODE_KEY0. If MODE_KEY0 is set to CBC in combination with this field, AES mode is CBC-CTS. If MODE_KEY0 is set to CTR in combination with this field, AES mode is GCTR."]
#[must_use]
#[inline(always)]
pub const fn mode0_is_cbc_cts(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "This field allows to add distinction to the CBC and CTR modes defined in field MODE_KEY0. If MODE_KEY0 is set to CBC in combination with this field, AES mode is CBC-CTS. If MODE_KEY0 is set to CTR in combination with this field, AES mode is GCTR."]
#[inline(always)]
pub const fn set_mode0_is_cbc_cts(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Set the AES mode in non-tunneling operations, or the AES mode of the first stage in tunneling operations."]
#[must_use]
#[inline(always)]
pub const fn mode_key0(&self) -> super::vals::ModeKey0 {
let val = (self.0 >> 2usize) & 0x07;
super::vals::ModeKey0::from_bits(val as u8)
}
#[doc = "Set the AES mode in non-tunneling operations, or the AES mode of the first stage in tunneling operations."]
#[inline(always)]
pub const fn set_mode_key0(&mut self, val: super::vals::ModeKey0) {
self.0 = (self.0 & !(0x07 << 2usize)) | (((val.to_bits() as u32) & 0x07) << 2usize);
}
#[doc = "Set the AES mode of the second stage in tunneling operations."]
#[must_use]
#[inline(always)]
pub const fn mode_key1(&self) -> super::vals::ModeKey1 {
let val = (self.0 >> 5usize) & 0x07;
super::vals::ModeKey1::from_bits(val as u8)
}
#[doc = "Set the AES mode of the second stage in tunneling operations."]
#[inline(always)]
pub const fn set_mode_key1(&mut self, val: super::vals::ModeKey1) {
self.0 = (self.0 & !(0x07 << 5usize)) | (((val.to_bits() as u32) & 0x07) << 5usize);
}
#[doc = "If MODE_KEY0 is set to CBC, and this field is set, the mode is CBC with ESSIV."]
#[must_use]
#[inline(always)]
pub const fn cbc_is_essiv(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "If MODE_KEY0 is set to CBC, and this field is set, the mode is CBC with ESSIV."]
#[inline(always)]
pub const fn set_cbc_is_essiv(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "Configure AES engine for standard non-tunneling or tunneling operations."]
#[must_use]
#[inline(always)]
pub const fn aes_tunnel(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "Configure AES engine for standard non-tunneling or tunneling operations."]
#[inline(always)]
pub const fn set_aes_tunnel(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[doc = "If MODE_KEY0 is set to CBC, and this field is set, the mode is CBC Bitlocker."]
#[must_use]
#[inline(always)]
pub const fn cbc_is_bitlocker(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "If MODE_KEY0 is set to CBC, and this field is set, the mode is CBC Bitlocker."]
#[inline(always)]
pub const fn set_cbc_is_bitlocker(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "Set the AES key length in non-tunneling operations, or the AES key length of the first stage in tunneling operations."]
#[must_use]
#[inline(always)]
pub const fn nk_key0(&self) -> super::vals::NkKey0 {
let val = (self.0 >> 12usize) & 0x03;
super::vals::NkKey0::from_bits(val as u8)
}
#[doc = "Set the AES key length in non-tunneling operations, or the AES key length of the first stage in tunneling operations."]
#[inline(always)]
pub const fn set_nk_key0(&mut self, val: super::vals::NkKey0) {
self.0 =
(self.0 & !(0x03 << 12usize)) | (((val.to_bits() as u32) & 0x03) << 12usize);
}
#[doc = "Set the AES key length of the second stage in tunneling operations."]
#[must_use]
#[inline(always)]
pub const fn nk_key1(&self) -> super::vals::NkKey1 {
let val = (self.0 >> 14usize) & 0x03;
super::vals::NkKey1::from_bits(val as u8)
}
#[doc = "Set the AES key length of the second stage in tunneling operations."]
#[inline(always)]
pub const fn set_nk_key1(&mut self, val: super::vals::NkKey1) {
self.0 =
(self.0 & !(0x03 << 14usize)) | (((val.to_bits() as u32) & 0x03) << 14usize);
}
#[doc = "Configure if first tunnel stage performs encrypt or decrypt operation."]
#[must_use]
#[inline(always)]
pub const fn aes_tunnel1_decrypt(&self) -> super::vals::AesTunnel1Decrypt {
let val = (self.0 >> 22usize) & 0x01;
super::vals::AesTunnel1Decrypt::from_bits(val as u8)
}
#[doc = "Configure if first tunnel stage performs encrypt or decrypt operation."]
#[inline(always)]
pub const fn set_aes_tunnel1_decrypt(&mut self, val: super::vals::AesTunnel1Decrypt) {
self.0 =
(self.0 & !(0x01 << 22usize)) | (((val.to_bits() as u32) & 0x01) << 22usize);
}
#[doc = "For tunneling operations this field determine the data that is fed to the second tunneling stage."]
#[must_use]
#[inline(always)]
pub const fn aes_tun_b1_uses_padded_data_in(&self) -> bool {
let val = (self.0 >> 23usize) & 0x01;
val != 0
}
#[doc = "For tunneling operations this field determine the data that is fed to the second tunneling stage."]
#[inline(always)]
pub const fn set_aes_tun_b1_uses_padded_data_in(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize);
}
#[doc = "Configure if first tunnel stage performs encrypt or decrypt operation."]
#[must_use]
#[inline(always)]
pub const fn aes_tunnel0_encrypt(&self) -> super::vals::AesTunnel0Encrypt {
let val = (self.0 >> 24usize) & 0x01;
super::vals::AesTunnel0Encrypt::from_bits(val as u8)
}
#[doc = "Configure if first tunnel stage performs encrypt or decrypt operation."]
#[inline(always)]
pub const fn set_aes_tunnel0_encrypt(&mut self, val: super::vals::AesTunnel0Encrypt) {
self.0 =
(self.0 & !(0x01 << 24usize)) | (((val.to_bits() as u32) & 0x01) << 24usize);
}
#[doc = "This fields configure if the AES engine output is the result of the first or second tunneling stage."]
#[must_use]
#[inline(always)]
pub const fn aes_output_mid_tunnel_data(&self) -> super::vals::AesOutputMidTunnelData {
let val = (self.0 >> 25usize) & 0x01;
super::vals::AesOutputMidTunnelData::from_bits(val as u8)
}
#[doc = "This fields configure if the AES engine output is the result of the first or second tunneling stage."]
#[inline(always)]
pub const fn set_aes_output_mid_tunnel_data(
&mut self,
val: super::vals::AesOutputMidTunnelData,
) {
self.0 =
(self.0 & !(0x01 << 25usize)) | (((val.to_bits() as u32) & 0x01) << 25usize);
}
#[doc = "This field configure if the input data to the second tunnel stage is to be padded with zeroes according to how many bytes are remaining."]
#[must_use]
#[inline(always)]
pub const fn aes_tunnel_b1_pad_en(&self) -> bool {
let val = (self.0 >> 26usize) & 0x01;
val != 0
}
#[doc = "This field configure if the input data to the second tunnel stage is to be padded with zeroes according to how many bytes are remaining."]
#[inline(always)]
pub const fn set_aes_tunnel_b1_pad_en(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
}
#[doc = "This field determines for AES-TO-HASH-AND-DOUT tunneling operations, whether the AES outputs to the HASH the result of the first or the second tunneling stage."]
#[must_use]
#[inline(always)]
pub const fn aes_out_mid_tun_to_hash(&self) -> super::vals::AesOutMidTunToHash {
let val = (self.0 >> 28usize) & 0x01;
super::vals::AesOutMidTunToHash::from_bits(val as u8)
}
#[doc = "This field determines for AES-TO-HASH-AND-DOUT tunneling operations, whether the AES outputs to the HASH the result of the first or the second tunneling stage."]
#[inline(always)]
pub const fn set_aes_out_mid_tun_to_hash(
&mut self,
val: super::vals::AesOutMidTunToHash,
) {
self.0 =
(self.0 & !(0x01 << 28usize)) | (((val.to_bits() as u32) & 0x01) << 28usize);
}
#[doc = "Using direct access and not the DIN-DOUT DMA interface."]
#[must_use]
#[inline(always)]
pub const fn direct_access(&self) -> bool {
let val = (self.0 >> 31usize) & 0x01;
val != 0
}
#[doc = "Using direct access and not the DIN-DOUT DMA interface."]
#[inline(always)]
pub const fn set_direct_access(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
}
}
impl Default for AesControl {
#[inline(always)]
fn default() -> AesControl {
AesControl(0)
}
}
impl core::fmt::Debug for AesControl {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("AesControl")
.field("dec_key0", &self.dec_key0())
.field("mode0_is_cbc_cts", &self.mode0_is_cbc_cts())
.field("mode_key0", &self.mode_key0())
.field("mode_key1", &self.mode_key1())
.field("cbc_is_essiv", &self.cbc_is_essiv())
.field("aes_tunnel", &self.aes_tunnel())
.field("cbc_is_bitlocker", &self.cbc_is_bitlocker())
.field("nk_key0", &self.nk_key0())
.field("nk_key1", &self.nk_key1())
.field("aes_tunnel1_decrypt", &self.aes_tunnel1_decrypt())
.field(
"aes_tun_b1_uses_padded_data_in",
&self.aes_tun_b1_uses_padded_data_in(),
)
.field("aes_tunnel0_encrypt", &self.aes_tunnel0_encrypt())
.field(
"aes_output_mid_tunnel_data",
&self.aes_output_mid_tunnel_data(),
)
.field("aes_tunnel_b1_pad_en", &self.aes_tunnel_b1_pad_en())
.field("aes_out_mid_tun_to_hash", &self.aes_out_mid_tun_to_hash())
.field("direct_access", &self.direct_access())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for AesControl {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "AesControl {{ dec_key0: {:?}, mode0_is_cbc_cts: {=bool:?}, mode_key0: {:?}, mode_key1: {:?}, cbc_is_essiv: {=bool:?}, aes_tunnel: {=bool:?}, cbc_is_bitlocker: {=bool:?}, nk_key0: {:?}, nk_key1: {:?}, aes_tunnel1_decrypt: {:?}, aes_tun_b1_uses_padded_data_in: {=bool:?}, aes_tunnel0_encrypt: {:?}, aes_output_mid_tunnel_data: {:?}, aes_tunnel_b1_pad_en: {=bool:?}, aes_out_mid_tun_to_hash: {:?}, direct_access: {=bool:?} }}" , self . dec_key0 () , self . mode0_is_cbc_cts () , self . mode_key0 () , self . mode_key1 () , self . cbc_is_essiv () , self . aes_tunnel () , self . cbc_is_bitlocker () , self . nk_key0 () , self . nk_key1 () , self . aes_tunnel1_decrypt () , self . aes_tun_b1_uses_padded_data_in () , self . aes_tunnel0_encrypt () , self . aes_output_mid_tunnel_data () , self . aes_tunnel_b1_pad_en () , self . aes_out_mid_tun_to_hash () , self . direct_access ())
}
}
#[doc = "This register enables the AES CTR no increment mode in which the counter mode is not incremented between two blocks."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct AesCtrNoIncrement(pub u32);
impl AesCtrNoIncrement {
#[doc = "This field enables the AES CTR no increment mode in which the counter mode is not incremented between two blocks."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "This field enables the AES CTR no increment mode in which the counter mode is not incremented between two blocks."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for AesCtrNoIncrement {
#[inline(always)]
fn default() -> AesCtrNoIncrement {
AesCtrNoIncrement(0)
}
}
impl core::fmt::Debug for AesCtrNoIncrement {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("AesCtrNoIncrement")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for AesCtrNoIncrement {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"AesCtrNoIncrement {{ enable: {=bool:?} }}",
self.enable()
)
}
}
#[doc = "Hardware configuration of the AES engine. Reset value holds the supported features."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct AesHwFlags(pub u32);
impl AesHwFlags {
#[doc = "If this flag is set, the engine support 192 bits and 256 bits key size."]
#[must_use]
#[inline(always)]
pub const fn support_256_192_key(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine support 192 bits and 256 bits key size."]
#[inline(always)]
pub const fn set_support_256_192_key(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "If this flag is set, the engine support AES_LARGE_RKEK."]
#[must_use]
#[inline(always)]
pub const fn aes_large_rkek(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine support AES_LARGE_RKEK."]
#[inline(always)]
pub const fn set_aes_large_rkek(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "If this flag is set, the engine support DPA countermeasures."]
#[must_use]
#[inline(always)]
pub const fn dpa_cntrmsr_exist(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine support DPA countermeasures."]
#[inline(always)]
pub const fn set_dpa_cntrmsr_exist(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "If this flag is set, the engine support AES CTR mode."]
#[must_use]
#[inline(always)]
pub const fn ctr_exist(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine support AES CTR mode."]
#[inline(always)]
pub const fn set_ctr_exist(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "If this flag is set, the engine only support encrypt operations."]
#[must_use]
#[inline(always)]
pub const fn only_encrypt(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine only support encrypt operations."]
#[inline(always)]
pub const fn set_only_encrypt(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "If this flag is set, the engine uses SBOX tables."]
#[must_use]
#[inline(always)]
pub const fn use_sbox_table(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine uses SBOX tables."]
#[inline(always)]
pub const fn set_use_sbox_table(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "If this flag is set, the engine uses 5 SBOX where each AES round takes 4 cycles."]
#[must_use]
#[inline(always)]
pub const fn use_5_sboxes(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine uses 5 SBOX where each AES round takes 4 cycles."]
#[inline(always)]
pub const fn set_use_5_sboxes(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "If this flag is set, the engine contains the PREV_IV register for faster AES XCBC MAC calculation."]
#[must_use]
#[inline(always)]
pub const fn aes_support_prev_iv(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine contains the PREV_IV register for faster AES XCBC MAC calculation."]
#[inline(always)]
pub const fn set_aes_support_prev_iv(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "If this flag is set, the engine support tunneling operations."]
#[must_use]
#[inline(always)]
pub const fn aes_tunnel_exist(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine support tunneling operations."]
#[inline(always)]
pub const fn set_aes_tunnel_exist(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[doc = "If this flag is set, the engine support a second register set for tunneling operations."]
#[must_use]
#[inline(always)]
pub const fn second_regs_set_exist(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine support a second register set for tunneling operations."]
#[inline(always)]
pub const fn set_second_regs_set_exist(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "If this flag is set, the engine support DFA countermeasures."]
#[must_use]
#[inline(always)]
pub const fn dfa_cntrmsr_exist(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine support DFA countermeasures."]
#[inline(always)]
pub const fn set_dfa_cntrmsr_exist(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
}
impl Default for AesHwFlags {
#[inline(always)]
fn default() -> AesHwFlags {
AesHwFlags(0)
}
}
impl core::fmt::Debug for AesHwFlags {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("AesHwFlags")
.field("support_256_192_key", &self.support_256_192_key())
.field("aes_large_rkek", &self.aes_large_rkek())
.field("dpa_cntrmsr_exist", &self.dpa_cntrmsr_exist())
.field("ctr_exist", &self.ctr_exist())
.field("only_encrypt", &self.only_encrypt())
.field("use_sbox_table", &self.use_sbox_table())
.field("use_5_sboxes", &self.use_5_sboxes())
.field("aes_support_prev_iv", &self.aes_support_prev_iv())
.field("aes_tunnel_exist", &self.aes_tunnel_exist())
.field("second_regs_set_exist", &self.second_regs_set_exist())
.field("dfa_cntrmsr_exist", &self.dfa_cntrmsr_exist())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for AesHwFlags {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "AesHwFlags {{ support_256_192_key: {=bool:?}, aes_large_rkek: {=bool:?}, dpa_cntrmsr_exist: {=bool:?}, ctr_exist: {=bool:?}, only_encrypt: {=bool:?}, use_sbox_table: {=bool:?}, use_5_sboxes: {=bool:?}, aes_support_prev_iv: {=bool:?}, aes_tunnel_exist: {=bool:?}, second_regs_set_exist: {=bool:?}, dfa_cntrmsr_exist: {=bool:?} }}" , self . support_256_192_key () , self . aes_large_rkek () , self . dpa_cntrmsr_exist () , self . ctr_exist () , self . only_encrypt () , self . use_sbox_table () , self . use_5_sboxes () , self . aes_support_prev_iv () , self . aes_tunnel_exist () , self . second_regs_set_exist () , self . dfa_cntrmsr_exist ())
}
}
#[doc = "Reset the AES engine."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct AesSwReset(pub u32);
impl AesSwReset {
#[doc = "Writing any value to this address resets the AES engine. The reset takes 4 CPU clock cycles to complete."]
#[must_use]
#[inline(always)]
pub const fn reset(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Writing any value to this address resets the AES engine. The reset takes 4 CPU clock cycles to complete."]
#[inline(always)]
pub const fn set_reset(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for AesSwReset {
#[inline(always)]
fn default() -> AesSwReset {
AesSwReset(0)
}
}
impl core::fmt::Debug for AesSwReset {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("AesSwReset")
.field("reset", &self.reset())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for AesSwReset {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "AesSwReset {{ reset: {=bool:?} }}", self.reset())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum AesOutMidTunToHash {
#[doc = "The AES engine writes to the HASH the result of the second tunnel stage."]
SecondStage = 0x0,
#[doc = "The AES engine writes to the HASH the result of the first tunnel stage."]
FirstStage = 0x01,
}
impl AesOutMidTunToHash {
#[inline(always)]
pub const fn from_bits(val: u8) -> AesOutMidTunToHash {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for AesOutMidTunToHash {
#[inline(always)]
fn from(val: u8) -> AesOutMidTunToHash {
AesOutMidTunToHash::from_bits(val)
}
}
impl From<AesOutMidTunToHash> for u8 {
#[inline(always)]
fn from(val: AesOutMidTunToHash) -> u8 {
AesOutMidTunToHash::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum AesOutputMidTunnelData {
#[doc = "Output result from the second tunnel stage (standard tunneling)."]
SecondStage = 0x0,
#[doc = "Output result from the first tunnel stage."]
FirstStage = 0x01,
}
impl AesOutputMidTunnelData {
#[inline(always)]
pub const fn from_bits(val: u8) -> AesOutputMidTunnelData {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for AesOutputMidTunnelData {
#[inline(always)]
fn from(val: u8) -> AesOutputMidTunnelData {
AesOutputMidTunnelData::from_bits(val)
}
}
impl From<AesOutputMidTunnelData> for u8 {
#[inline(always)]
fn from(val: AesOutputMidTunnelData) -> u8 {
AesOutputMidTunnelData::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum AesTunnel0Encrypt {
#[doc = "First tunnel stage performs decrypt operations."]
Decrypt = 0x0,
#[doc = "First tunnel stage performs encrypt operations."]
Encrypt = 0x01,
}
impl AesTunnel0Encrypt {
#[inline(always)]
pub const fn from_bits(val: u8) -> AesTunnel0Encrypt {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for AesTunnel0Encrypt {
#[inline(always)]
fn from(val: u8) -> AesTunnel0Encrypt {
AesTunnel0Encrypt::from_bits(val)
}
}
impl From<AesTunnel0Encrypt> for u8 {
#[inline(always)]
fn from(val: AesTunnel0Encrypt) -> u8 {
AesTunnel0Encrypt::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum AesTunnel1Decrypt {
#[doc = "Second tunnel stage performs encrypt operations."]
Encrypt = 0x0,
#[doc = "Second tunnel stage performs decrypt operations."]
Decrypt = 0x01,
}
impl AesTunnel1Decrypt {
#[inline(always)]
pub const fn from_bits(val: u8) -> AesTunnel1Decrypt {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for AesTunnel1Decrypt {
#[inline(always)]
fn from(val: u8) -> AesTunnel1Decrypt {
AesTunnel1Decrypt::from_bits(val)
}
}
impl From<AesTunnel1Decrypt> for u8 {
#[inline(always)]
fn from(val: AesTunnel1Decrypt) -> u8 {
AesTunnel1Decrypt::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum DecKey0 {
#[doc = "Perform AES encryption."]
Encrypt = 0x0,
#[doc = "Perform AES decryption."]
Decrypt = 0x01,
}
impl DecKey0 {
#[inline(always)]
pub const fn from_bits(val: u8) -> DecKey0 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for DecKey0 {
#[inline(always)]
fn from(val: u8) -> DecKey0 {
DecKey0::from_bits(val)
}
}
impl From<DecKey0> for u8 {
#[inline(always)]
fn from(val: DecKey0) -> u8 {
DecKey0::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum ModeKey0 {
#[doc = "Electronic codebook mode."]
Ecb = 0x0,
#[doc = "Cipher block chaining mode."]
Cbc = 0x01,
#[doc = "Counter mode."]
Ctr = 0x02,
#[doc = "Cipher Block Chaining Message Authentication Code."]
CbcMac = 0x03,
#[doc = "Xor-Encrypt-Xor (XEX)-based tweaked-codebook mode with ciphertext stealing (XTS)."]
XexXts = 0x04,
#[doc = "AES in CBC mode with extensions to overcome fixed length limitations."]
XcbcMac = 0x05,
#[doc = "AES Output FeedBack mode."]
Ofb = 0x06,
#[doc = "Cipher-based Message Authentication Code."]
Cmac = 0x07,
}
impl ModeKey0 {
#[inline(always)]
pub const fn from_bits(val: u8) -> ModeKey0 {
unsafe { core::mem::transmute(val & 0x07) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for ModeKey0 {
#[inline(always)]
fn from(val: u8) -> ModeKey0 {
ModeKey0::from_bits(val)
}
}
impl From<ModeKey0> for u8 {
#[inline(always)]
fn from(val: ModeKey0) -> u8 {
ModeKey0::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum ModeKey1 {
#[doc = "Electronic codebook mode."]
Ecb = 0x0,
#[doc = "Cipher block chaining mode."]
Cbc = 0x01,
#[doc = "Counter mode."]
Ctr = 0x02,
#[doc = "Cipher block chaining message authentication code mode."]
CbcMac = 0x03,
#[doc = "Xor-Encrypt-Xor (XEX)-based tweaked-codebook mode with ciphertext stealing (XTS)."]
XexXts = 0x04,
#[doc = "AES in CBC mode with extensions to overcome fixed length limitations."]
XcbcMac = 0x05,
#[doc = "AES Output FeedBack mode."]
Ofb = 0x06,
#[doc = "Cipher-based Message Authentication Code."]
Cmac = 0x07,
}
impl ModeKey1 {
#[inline(always)]
pub const fn from_bits(val: u8) -> ModeKey1 {
unsafe { core::mem::transmute(val & 0x07) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for ModeKey1 {
#[inline(always)]
fn from(val: u8) -> ModeKey1 {
ModeKey1::from_bits(val)
}
}
impl From<ModeKey1> for u8 {
#[inline(always)]
fn from(val: ModeKey1) -> u8 {
ModeKey1::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum NkKey0 {
#[doc = "128 bits key length."]
_128bits = 0x0,
#[doc = "192 bits key length."]
_192bits = 0x01,
#[doc = "256 bits key length."]
_256bits = 0x02,
_RESERVED_3 = 0x03,
}
impl NkKey0 {
#[inline(always)]
pub const fn from_bits(val: u8) -> NkKey0 {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for NkKey0 {
#[inline(always)]
fn from(val: u8) -> NkKey0 {
NkKey0::from_bits(val)
}
}
impl From<NkKey0> for u8 {
#[inline(always)]
fn from(val: NkKey0) -> u8 {
NkKey0::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum NkKey1 {
#[doc = "128 bits key length."]
_128bits = 0x0,
#[doc = "192 bits key length."]
_192bits = 0x01,
#[doc = "256 bits key length."]
_256bits = 0x02,
_RESERVED_3 = 0x03,
}
impl NkKey1 {
#[inline(always)]
pub const fn from_bits(val: u8) -> NkKey1 {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for NkKey1 {
#[inline(always)]
fn from(val: u8) -> NkKey1 {
NkKey1::from_bits(val)
}
}
impl From<NkKey1> for u8 {
#[inline(always)]
fn from(val: NkKey1) -> u8 {
NkKey1::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Status {
#[doc = "AES engine is idle."]
Idle = 0x0,
#[doc = "AES engine is busy."]
Busy = 0x01,
}
impl Status {
#[inline(always)]
pub const fn from_bits(val: u8) -> Status {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Status {
#[inline(always)]
fn from(val: u8) -> Status {
Status::from_bits(val)
}
}
impl From<Status> for u8 {
#[inline(always)]
fn from(val: Status) -> u8 {
Status::to_bits(val)
}
}
}
}
pub mod cc_ahb {
#[doc = "CRYPTOCELL AHB interface."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct CcAhb {
ptr: *mut u8,
}
unsafe impl Send for CcAhb {}
unsafe impl Sync for CcAhb {}
impl CcAhb {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "This register forces the AHB transactions from CRYPTOCELL master to be always singles."]
#[inline(always)]
pub const fn ahbm_singles(
self,
) -> crate::common::Reg<regs::AhbmSingles, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0b00usize) as _) }
}
#[doc = "This register holds the AHB HPROT value."]
#[inline(always)]
pub const fn ahbm_hprot(self) -> crate::common::Reg<regs::AhbmHprot, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0b04usize) as _) }
}
#[doc = "This register holds AHB HMASTLOCK value."]
#[inline(always)]
pub const fn ahbm_hmastlock(
self,
) -> crate::common::Reg<regs::AhbmHmastlock, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0b08usize) as _) }
}
#[doc = "This register holds AHB HNONSEC value."]
#[inline(always)]
pub const fn ahbm_hnonsec(
self,
) -> crate::common::Reg<regs::AhbmHnonsec, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0b0cusize) as _) }
}
}
pub mod regs {
#[doc = "This register holds AHB HMASTLOCK value."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct AhbmHmastlock(pub u32);
impl AhbmHmastlock {
#[doc = "The AHB HMASTLOCK value."]
#[must_use]
#[inline(always)]
pub const fn ahb_hmastlock(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "The AHB HMASTLOCK value."]
#[inline(always)]
pub const fn set_ahb_hmastlock(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for AhbmHmastlock {
#[inline(always)]
fn default() -> AhbmHmastlock {
AhbmHmastlock(0)
}
}
impl core::fmt::Debug for AhbmHmastlock {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("AhbmHmastlock")
.field("ahb_hmastlock", &self.ahb_hmastlock())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for AhbmHmastlock {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"AhbmHmastlock {{ ahb_hmastlock: {=bool:?} }}",
self.ahb_hmastlock()
)
}
}
#[doc = "This register holds AHB HNONSEC value."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct AhbmHnonsec(pub u32);
impl AhbmHnonsec {
#[doc = "The AHB HNONSEC value for write transaction."]
#[must_use]
#[inline(always)]
pub const fn ahb_write_hnonsec(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "The AHB HNONSEC value for write transaction."]
#[inline(always)]
pub const fn set_ahb_write_hnonsec(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "The AHB HNONSEC value for read transaction."]
#[must_use]
#[inline(always)]
pub const fn ahb_read_hnonsec(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "The AHB HNONSEC value for read transaction."]
#[inline(always)]
pub const fn set_ahb_read_hnonsec(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
}
impl Default for AhbmHnonsec {
#[inline(always)]
fn default() -> AhbmHnonsec {
AhbmHnonsec(0)
}
}
impl core::fmt::Debug for AhbmHnonsec {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("AhbmHnonsec")
.field("ahb_write_hnonsec", &self.ahb_write_hnonsec())
.field("ahb_read_hnonsec", &self.ahb_read_hnonsec())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for AhbmHnonsec {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"AhbmHnonsec {{ ahb_write_hnonsec: {=bool:?}, ahb_read_hnonsec: {=bool:?} }}",
self.ahb_write_hnonsec(),
self.ahb_read_hnonsec()
)
}
}
#[doc = "This register holds the AHB HPROT value."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct AhbmHprot(pub u32);
impl AhbmHprot {
#[doc = "The AHB HPROT value."]
#[must_use]
#[inline(always)]
pub const fn ahb_hprot(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x0f;
val as u8
}
#[doc = "The AHB HPROT value."]
#[inline(always)]
pub const fn set_ahb_hprot(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val as u32) & 0x0f) << 0usize);
}
}
impl Default for AhbmHprot {
#[inline(always)]
fn default() -> AhbmHprot {
AhbmHprot(0)
}
}
impl core::fmt::Debug for AhbmHprot {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("AhbmHprot")
.field("ahb_hprot", &self.ahb_hprot())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for AhbmHprot {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "AhbmHprot {{ ahb_hprot: {=u8:?} }}", self.ahb_hprot())
}
}
#[doc = "This register forces the AHB transactions from CRYPTOCELL master to be always singles."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct AhbmSingles(pub u32);
impl AhbmSingles {
#[doc = "Force AHB singles."]
#[must_use]
#[inline(always)]
pub const fn ahb_singles(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Force AHB singles."]
#[inline(always)]
pub const fn set_ahb_singles(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for AhbmSingles {
#[inline(always)]
fn default() -> AhbmSingles {
AhbmSingles(0)
}
}
impl core::fmt::Debug for AhbmSingles {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("AhbmSingles")
.field("ahb_singles", &self.ahb_singles())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for AhbmSingles {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"AhbmSingles {{ ahb_singles: {=bool:?} }}",
self.ahb_singles()
)
}
}
}
}
pub mod cc_ao {
#[doc = "CryptoCell AO."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct CcAo {
ptr: *mut u8,
}
unsafe impl Send for CcAo {}
unsafe impl Sync for CcAo {}
impl CcAo {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "This register holds the AO_APB_FILTERING configuration."]
#[inline(always)]
pub const fn ao_apb_filtering(
self,
) -> crate::common::Reg<regs::AoApbFiltering, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0e38usize) as _) }
}
#[doc = "Reset the CRYPTOCELL subsystem."]
#[inline(always)]
pub const fn cc_sw_reset(self) -> crate::common::Reg<regs::CcSwReset, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0e40usize) as _) }
}
}
pub mod regs {
#[doc = "This register holds the AO_APB_FILTERING configuration."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct AoApbFiltering(pub u32);
impl AoApbFiltering {
#[doc = "When this FW controlled field is set, the APB slave accepts only secure accesses."]
#[must_use]
#[inline(always)]
pub const fn only_sec_access_allowed(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "When this FW controlled field is set, the APB slave accepts only secure accesses."]
#[inline(always)]
pub const fn set_only_sec_access_allowed(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "When this FW controlled field is set, the ONLY_SEC_ACCESS_ALLOWED field cannot be modified until the next PoR."]
#[must_use]
#[inline(always)]
pub const fn only_sec_access_allowed_lock(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "When this FW controlled field is set, the ONLY_SEC_ACCESS_ALLOWED field cannot be modified until the next PoR."]
#[inline(always)]
pub const fn set_only_sec_access_allowed_lock(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "When this FW controlled field is set, the APB slave accepts only privileged accesses."]
#[must_use]
#[inline(always)]
pub const fn only_priv_access_allowed(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "When this FW controlled field is set, the APB slave accepts only privileged accesses."]
#[inline(always)]
pub const fn set_only_priv_access_allowed(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "When this FW controlled field is set, the APBC_ONLY_PRIV_ACCESS_ALLOWED field cannot be modified until the next PoR."]
#[must_use]
#[inline(always)]
pub const fn only_priv_access_allowed_lock(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "When this FW controlled field is set, the APBC_ONLY_PRIV_ACCESS_ALLOWED field cannot be modified until the next PoR."]
#[inline(always)]
pub const fn set_only_priv_access_allowed_lock(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
}
impl Default for AoApbFiltering {
#[inline(always)]
fn default() -> AoApbFiltering {
AoApbFiltering(0)
}
}
impl core::fmt::Debug for AoApbFiltering {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("AoApbFiltering")
.field("only_sec_access_allowed", &self.only_sec_access_allowed())
.field(
"only_sec_access_allowed_lock",
&self.only_sec_access_allowed_lock(),
)
.field("only_priv_access_allowed", &self.only_priv_access_allowed())
.field(
"only_priv_access_allowed_lock",
&self.only_priv_access_allowed_lock(),
)
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for AoApbFiltering {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "AoApbFiltering {{ only_sec_access_allowed: {=bool:?}, only_sec_access_allowed_lock: {=bool:?}, only_priv_access_allowed: {=bool:?}, only_priv_access_allowed_lock: {=bool:?} }}" , self . only_sec_access_allowed () , self . only_sec_access_allowed_lock () , self . only_priv_access_allowed () , self . only_priv_access_allowed_lock ())
}
}
#[doc = "Reset the CRYPTOCELL subsystem."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct CcSwReset(pub u32);
impl CcSwReset {
#[doc = "Writing any value to this address resets the CRYPTOCELL subsystem. The reset takes 4 CPU clock cycles to complete."]
#[must_use]
#[inline(always)]
pub const fn reset(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Writing any value to this address resets the CRYPTOCELL subsystem. The reset takes 4 CPU clock cycles to complete."]
#[inline(always)]
pub const fn set_reset(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for CcSwReset {
#[inline(always)]
fn default() -> CcSwReset {
CcSwReset(0)
}
}
impl core::fmt::Debug for CcSwReset {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CcSwReset")
.field("reset", &self.reset())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for CcSwReset {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "CcSwReset {{ reset: {=bool:?} }}", self.reset())
}
}
}
}
pub mod cc_chacha {
#[doc = "CRYPTOCELL CHACHA engine."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct CcChacha {
ptr: *mut u8,
}
unsafe impl Send for CcChacha {}
unsafe impl Sync for CcChacha {}
impl CcChacha {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Control the CHACHA engine behavior."]
#[inline(always)]
pub const fn chacha_control(
self,
) -> crate::common::Reg<regs::ChachaControl, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0380usize) as _) }
}
#[doc = "CHACHA engine HW version."]
#[inline(always)]
pub const fn chacha_version(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0384usize) as _) }
}
#[doc = "Description collection: CHACHA key value to use. The initial CHACHA_KEY\\[0\\] register holds the least significant bits \\[31:0\\] of the key value."]
#[inline(always)]
pub const fn chacha_key(self, n: usize) -> crate::common::Reg<u32, crate::common::W> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0388usize + n * 4usize) as _)
}
}
#[doc = "Description collection: CHACHA Initialization Vector (IV) to use. The IV is also known as the nonce."]
#[inline(always)]
pub const fn chacha_iv(self, n: usize) -> crate::common::Reg<u32, crate::common::RW> {
assert!(n < 2usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x03a8usize + n * 4usize) as _)
}
}
#[doc = "Status register for CHACHA engine activity."]
#[inline(always)]
pub const fn chacha_busy(self) -> crate::common::Reg<regs::ChachaBusy, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x03b0usize) as _) }
}
#[doc = "Hardware configuration of the CHACHA engine. Reset value holds the supported features."]
#[inline(always)]
pub const fn chacha_hw_flags(
self,
) -> crate::common::Reg<regs::ChachaHwFlags, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x03b4usize) as _) }
}
#[doc = "Store the LSB value of the block counter, in order to support suspend/resume of operation."]
#[inline(always)]
pub const fn chacha_block_cnt_lsb(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x03b8usize) as _) }
}
#[doc = "Store the MSB value of the block counter, in order to support suspend/resume of operation."]
#[inline(always)]
pub const fn chacha_block_cnt_msb(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x03bcusize) as _) }
}
#[doc = "Reset the CHACHA engine."]
#[inline(always)]
pub const fn chacha_sw_reset(
self,
) -> crate::common::Reg<regs::ChachaSwReset, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x03c0usize) as _) }
}
#[doc = "Description collection: The auto-generated key to use in Poly1305 MAC calculation. The initial CHACHA_POLY1305_KEY\\[0\\] register holds the least significant bits \\[31:0\\] of the key value."]
#[inline(always)]
pub const fn chacha_poly1305_key(
self,
n: usize,
) -> crate::common::Reg<u32, crate::common::R> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x03c4usize + n * 4usize) as _)
}
}
#[doc = "CHACHA engine data order configuration."]
#[inline(always)]
pub const fn chacha_endianness(
self,
) -> crate::common::Reg<regs::ChachaEndianness, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x03e4usize) as _) }
}
#[doc = "Debug register for the CHACHA engine."]
#[inline(always)]
pub const fn chacha_debug(self) -> crate::common::Reg<regs::ChachaDebug, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x03e8usize) as _) }
}
}
pub mod regs {
#[doc = "Status register for CHACHA engine activity."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct ChachaBusy(pub u32);
impl ChachaBusy {
#[doc = "CHACHA engine status."]
#[must_use]
#[inline(always)]
pub const fn status(&self) -> super::vals::Status {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Status::from_bits(val as u8)
}
#[doc = "CHACHA engine status."]
#[inline(always)]
pub const fn set_status(&mut self, val: super::vals::Status) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for ChachaBusy {
#[inline(always)]
fn default() -> ChachaBusy {
ChachaBusy(0)
}
}
impl core::fmt::Debug for ChachaBusy {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("ChachaBusy")
.field("status", &self.status())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for ChachaBusy {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "ChachaBusy {{ status: {:?} }}", self.status())
}
}
#[doc = "Control the CHACHA engine behavior."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct ChachaControl(pub u32);
impl ChachaControl {
#[doc = "Run engine in ChaCha or Salsa mode."]
#[must_use]
#[inline(always)]
pub const fn chacha_or_salsa(&self) -> super::vals::ChachaOrSalsa {
let val = (self.0 >> 0usize) & 0x01;
super::vals::ChachaOrSalsa::from_bits(val as u8)
}
#[doc = "Run engine in ChaCha or Salsa mode."]
#[inline(always)]
pub const fn set_chacha_or_salsa(&mut self, val: super::vals::ChachaOrSalsa) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "Perform initialization for a new message."]
#[must_use]
#[inline(always)]
pub const fn init(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Perform initialization for a new message."]
#[inline(always)]
pub const fn set_init(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Generate the key to use in Poly1305 message authentication code calculation."]
#[must_use]
#[inline(always)]
pub const fn gen_key_poly1305(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Generate the key to use in Poly1305 message authentication code calculation."]
#[inline(always)]
pub const fn set_gen_key_poly1305(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Key length selection."]
#[must_use]
#[inline(always)]
pub const fn key_len(&self) -> super::vals::KeyLen {
let val = (self.0 >> 3usize) & 0x01;
super::vals::KeyLen::from_bits(val as u8)
}
#[doc = "Key length selection."]
#[inline(always)]
pub const fn set_key_len(&mut self, val: super::vals::KeyLen) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val.to_bits() as u32) & 0x01) << 3usize);
}
#[doc = "Set number of permutation rounds, default value is 20."]
#[must_use]
#[inline(always)]
pub const fn num_of_rounds(&self) -> super::vals::NumOfRounds {
let val = (self.0 >> 4usize) & 0x03;
super::vals::NumOfRounds::from_bits(val as u8)
}
#[doc = "Set number of permutation rounds, default value is 20."]
#[inline(always)]
pub const fn set_num_of_rounds(&mut self, val: super::vals::NumOfRounds) {
self.0 = (self.0 & !(0x03 << 4usize)) | (((val.to_bits() as u32) & 0x03) << 4usize);
}
#[doc = "Reset block counter for new messages."]
#[must_use]
#[inline(always)]
pub const fn reset_block_cnt(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Reset block counter for new messages."]
#[inline(always)]
pub const fn set_reset_block_cnt(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Use 96 bits Initialization Vector (IV)."]
#[must_use]
#[inline(always)]
pub const fn use_iv_96bit(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "Use 96 bits Initialization Vector (IV)."]
#[inline(always)]
pub const fn set_use_iv_96bit(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
}
impl Default for ChachaControl {
#[inline(always)]
fn default() -> ChachaControl {
ChachaControl(0)
}
}
impl core::fmt::Debug for ChachaControl {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("ChachaControl")
.field("chacha_or_salsa", &self.chacha_or_salsa())
.field("init", &self.init())
.field("gen_key_poly1305", &self.gen_key_poly1305())
.field("key_len", &self.key_len())
.field("num_of_rounds", &self.num_of_rounds())
.field("reset_block_cnt", &self.reset_block_cnt())
.field("use_iv_96bit", &self.use_iv_96bit())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for ChachaControl {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "ChachaControl {{ chacha_or_salsa: {:?}, init: {=bool:?}, gen_key_poly1305: {=bool:?}, key_len: {:?}, num_of_rounds: {:?}, reset_block_cnt: {=bool:?}, use_iv_96bit: {=bool:?} }}" , self . chacha_or_salsa () , self . init () , self . gen_key_poly1305 () , self . key_len () , self . num_of_rounds () , self . reset_block_cnt () , self . use_iv_96bit ())
}
}
#[doc = "Debug register for the CHACHA engine."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct ChachaDebug(pub u32);
impl ChachaDebug {
#[doc = "Reflects the debug state of the CHACHA FSM."]
#[must_use]
#[inline(always)]
pub const fn fsm_state(&self) -> super::vals::FsmState {
let val = (self.0 >> 0usize) & 0x03;
super::vals::FsmState::from_bits(val as u8)
}
#[doc = "Reflects the debug state of the CHACHA FSM."]
#[inline(always)]
pub const fn set_fsm_state(&mut self, val: super::vals::FsmState) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for ChachaDebug {
#[inline(always)]
fn default() -> ChachaDebug {
ChachaDebug(0)
}
}
impl core::fmt::Debug for ChachaDebug {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("ChachaDebug")
.field("fsm_state", &self.fsm_state())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for ChachaDebug {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "ChachaDebug {{ fsm_state: {:?} }}", self.fsm_state())
}
}
#[doc = "CHACHA engine data order configuration."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct ChachaEndianness(pub u32);
impl ChachaEndianness {
#[doc = "Change the word order of the input data."]
#[must_use]
#[inline(always)]
pub const fn chacha_din_word_order(&self) -> super::vals::ChachaDinWordOrder {
let val = (self.0 >> 0usize) & 0x01;
super::vals::ChachaDinWordOrder::from_bits(val as u8)
}
#[doc = "Change the word order of the input data."]
#[inline(always)]
pub const fn set_chacha_din_word_order(
&mut self,
val: super::vals::ChachaDinWordOrder,
) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "Change the byte order of the input data."]
#[must_use]
#[inline(always)]
pub const fn chacha_din_byte_order(&self) -> super::vals::ChachaDinByteOrder {
let val = (self.0 >> 1usize) & 0x01;
super::vals::ChachaDinByteOrder::from_bits(val as u8)
}
#[doc = "Change the byte order of the input data."]
#[inline(always)]
pub const fn set_chacha_din_byte_order(
&mut self,
val: super::vals::ChachaDinByteOrder,
) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val.to_bits() as u32) & 0x01) << 1usize);
}
#[doc = "Change the quarter of a matrix order in the engine."]
#[must_use]
#[inline(always)]
pub const fn chacha_core_matrix_lbe_order(
&self,
) -> super::vals::ChachaCoreMatrixLbeOrder {
let val = (self.0 >> 2usize) & 0x01;
super::vals::ChachaCoreMatrixLbeOrder::from_bits(val as u8)
}
#[doc = "Change the quarter of a matrix order in the engine."]
#[inline(always)]
pub const fn set_chacha_core_matrix_lbe_order(
&mut self,
val: super::vals::ChachaCoreMatrixLbeOrder,
) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val.to_bits() as u32) & 0x01) << 2usize);
}
#[doc = "Change the word order of the output data."]
#[must_use]
#[inline(always)]
pub const fn chacha_dout_word_order(&self) -> super::vals::ChachaDoutWordOrder {
let val = (self.0 >> 3usize) & 0x01;
super::vals::ChachaDoutWordOrder::from_bits(val as u8)
}
#[doc = "Change the word order of the output data."]
#[inline(always)]
pub const fn set_chacha_dout_word_order(
&mut self,
val: super::vals::ChachaDoutWordOrder,
) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val.to_bits() as u32) & 0x01) << 3usize);
}
#[doc = "Change the byte order of the output data."]
#[must_use]
#[inline(always)]
pub const fn chacha_dout_byte_order(&self) -> super::vals::ChachaDoutByteOrder {
let val = (self.0 >> 4usize) & 0x01;
super::vals::ChachaDoutByteOrder::from_bits(val as u8)
}
#[doc = "Change the byte order of the output data."]
#[inline(always)]
pub const fn set_chacha_dout_byte_order(
&mut self,
val: super::vals::ChachaDoutByteOrder,
) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val.to_bits() as u32) & 0x01) << 4usize);
}
}
impl Default for ChachaEndianness {
#[inline(always)]
fn default() -> ChachaEndianness {
ChachaEndianness(0)
}
}
impl core::fmt::Debug for ChachaEndianness {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("ChachaEndianness")
.field("chacha_din_word_order", &self.chacha_din_word_order())
.field("chacha_din_byte_order", &self.chacha_din_byte_order())
.field(
"chacha_core_matrix_lbe_order",
&self.chacha_core_matrix_lbe_order(),
)
.field("chacha_dout_word_order", &self.chacha_dout_word_order())
.field("chacha_dout_byte_order", &self.chacha_dout_byte_order())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for ChachaEndianness {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "ChachaEndianness {{ chacha_din_word_order: {:?}, chacha_din_byte_order: {:?}, chacha_core_matrix_lbe_order: {:?}, chacha_dout_word_order: {:?}, chacha_dout_byte_order: {:?} }}" , self . chacha_din_word_order () , self . chacha_din_byte_order () , self . chacha_core_matrix_lbe_order () , self . chacha_dout_word_order () , self . chacha_dout_byte_order ())
}
}
#[doc = "Hardware configuration of the CHACHA engine. Reset value holds the supported features."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct ChachaHwFlags(pub u32);
impl ChachaHwFlags {
#[doc = "If this flag is set, the engine include ChaCha support."]
#[must_use]
#[inline(always)]
pub const fn chacha_exists(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine include ChaCha support."]
#[inline(always)]
pub const fn set_chacha_exists(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "If this flag is set, the engine include Salsa support."]
#[must_use]
#[inline(always)]
pub const fn salsa_exists(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine include Salsa support."]
#[inline(always)]
pub const fn set_salsa_exists(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "If this flag is set, the next matrix calculated when the current one is written to data output path."]
#[must_use]
#[inline(always)]
pub const fn fast_chacha(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the next matrix calculated when the current one is written to data output path."]
#[inline(always)]
pub const fn set_fast_chacha(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
}
impl Default for ChachaHwFlags {
#[inline(always)]
fn default() -> ChachaHwFlags {
ChachaHwFlags(0)
}
}
impl core::fmt::Debug for ChachaHwFlags {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("ChachaHwFlags")
.field("chacha_exists", &self.chacha_exists())
.field("salsa_exists", &self.salsa_exists())
.field("fast_chacha", &self.fast_chacha())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for ChachaHwFlags {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "ChachaHwFlags {{ chacha_exists: {=bool:?}, salsa_exists: {=bool:?}, fast_chacha: {=bool:?} }}" , self . chacha_exists () , self . salsa_exists () , self . fast_chacha ())
}
}
#[doc = "Reset the CHACHA engine."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct ChachaSwReset(pub u32);
impl ChachaSwReset {
#[doc = "Writing any value to this address resets the CHACHA engine. The reset takes 4 CPU clock cycles to complete."]
#[must_use]
#[inline(always)]
pub const fn reset(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Writing any value to this address resets the CHACHA engine. The reset takes 4 CPU clock cycles to complete."]
#[inline(always)]
pub const fn set_reset(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for ChachaSwReset {
#[inline(always)]
fn default() -> ChachaSwReset {
ChachaSwReset(0)
}
}
impl core::fmt::Debug for ChachaSwReset {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("ChachaSwReset")
.field("reset", &self.reset())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for ChachaSwReset {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "ChachaSwReset {{ reset: {=bool:?} }}", self.reset())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum ChachaCoreMatrixLbeOrder {
#[doc = "Use default quarter of matrix order, where quarters are ordered as follows: q0, q1, q2, q3. Each quarter represents a 128-bits section of the matrix."]
Default = 0x0,
#[doc = "Reverse the order of matrix quarters, where quarters are re-ordered as follows: q3, q2, q1, q0. Each quarter represents a 128-bits section of the matrix."]
Reverse = 0x01,
}
impl ChachaCoreMatrixLbeOrder {
#[inline(always)]
pub const fn from_bits(val: u8) -> ChachaCoreMatrixLbeOrder {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for ChachaCoreMatrixLbeOrder {
#[inline(always)]
fn from(val: u8) -> ChachaCoreMatrixLbeOrder {
ChachaCoreMatrixLbeOrder::from_bits(val)
}
}
impl From<ChachaCoreMatrixLbeOrder> for u8 {
#[inline(always)]
fn from(val: ChachaCoreMatrixLbeOrder) -> u8 {
ChachaCoreMatrixLbeOrder::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum ChachaDinByteOrder {
#[doc = "Use default byte order within each input word, where bytes are ordered as follows: B0, B1, B2, B3."]
Default = 0x0,
#[doc = "Reverse the byte order within each input word, where bytes are re-ordered as follows: B3, B2, B1, B0."]
Reverse = 0x01,
}
impl ChachaDinByteOrder {
#[inline(always)]
pub const fn from_bits(val: u8) -> ChachaDinByteOrder {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for ChachaDinByteOrder {
#[inline(always)]
fn from(val: u8) -> ChachaDinByteOrder {
ChachaDinByteOrder::from_bits(val)
}
}
impl From<ChachaDinByteOrder> for u8 {
#[inline(always)]
fn from(val: ChachaDinByteOrder) -> u8 {
ChachaDinByteOrder::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum ChachaDinWordOrder {
#[doc = "Use default word order for 128-bits input, where words are ordered as follows: w0, w1, w2, w3."]
Default = 0x0,
#[doc = "Reverses the word order for 128-bits input, where words are re-ordered as follows: w3, w2, w1, w0."]
Reverse = 0x01,
}
impl ChachaDinWordOrder {
#[inline(always)]
pub const fn from_bits(val: u8) -> ChachaDinWordOrder {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for ChachaDinWordOrder {
#[inline(always)]
fn from(val: u8) -> ChachaDinWordOrder {
ChachaDinWordOrder::from_bits(val)
}
}
impl From<ChachaDinWordOrder> for u8 {
#[inline(always)]
fn from(val: ChachaDinWordOrder) -> u8 {
ChachaDinWordOrder::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum ChachaDoutByteOrder {
#[doc = "Use default byte order within each output word, where bytes are ordered as follows: B0, B1, B2, B3."]
Default = 0x0,
#[doc = "Reverse the byte order within each output word, where bytes are re-ordered as follows: B3, B2, B1, B0."]
Reverse = 0x01,
}
impl ChachaDoutByteOrder {
#[inline(always)]
pub const fn from_bits(val: u8) -> ChachaDoutByteOrder {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for ChachaDoutByteOrder {
#[inline(always)]
fn from(val: u8) -> ChachaDoutByteOrder {
ChachaDoutByteOrder::from_bits(val)
}
}
impl From<ChachaDoutByteOrder> for u8 {
#[inline(always)]
fn from(val: ChachaDoutByteOrder) -> u8 {
ChachaDoutByteOrder::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum ChachaDoutWordOrder {
#[doc = "Uses default word order for 128-bits output, where words are ordered as follows: w0, w1, w2, w3."]
Default = 0x0,
#[doc = "Reverse the word order for 128-bits output, where words are re-ordered as follows: w3, w2, w1, w0."]
Reverse = 0x01,
}
impl ChachaDoutWordOrder {
#[inline(always)]
pub const fn from_bits(val: u8) -> ChachaDoutWordOrder {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for ChachaDoutWordOrder {
#[inline(always)]
fn from(val: u8) -> ChachaDoutWordOrder {
ChachaDoutWordOrder::from_bits(val)
}
}
impl From<ChachaDoutWordOrder> for u8 {
#[inline(always)]
fn from(val: ChachaDoutWordOrder) -> u8 {
ChachaDoutWordOrder::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum ChachaOrSalsa {
#[doc = "Run engine in ChaCha mode."]
ChaCha = 0x0,
#[doc = "Run engine in Salsa mode."]
Salsa = 0x01,
}
impl ChachaOrSalsa {
#[inline(always)]
pub const fn from_bits(val: u8) -> ChachaOrSalsa {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for ChachaOrSalsa {
#[inline(always)]
fn from(val: u8) -> ChachaOrSalsa {
ChachaOrSalsa::from_bits(val)
}
}
impl From<ChachaOrSalsa> for u8 {
#[inline(always)]
fn from(val: ChachaOrSalsa) -> u8 {
ChachaOrSalsa::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum FsmState {
#[doc = "CHACHA FSM is in idle state."]
IdleState = 0x0,
#[doc = "CHACHA FSM is in init state."]
InitState = 0x01,
#[doc = "CHACHA FSM is in rounds state."]
RoundsState = 0x02,
#[doc = "CHACHA FSM is in final state."]
FinalState = 0x03,
}
impl FsmState {
#[inline(always)]
pub const fn from_bits(val: u8) -> FsmState {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for FsmState {
#[inline(always)]
fn from(val: u8) -> FsmState {
FsmState::from_bits(val)
}
}
impl From<FsmState> for u8 {
#[inline(always)]
fn from(val: FsmState) -> u8 {
FsmState::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum KeyLen {
#[doc = "Use 256 bits key length."]
_256bits = 0x0,
#[doc = "Use 128 bits key length."]
_128bits = 0x01,
}
impl KeyLen {
#[inline(always)]
pub const fn from_bits(val: u8) -> KeyLen {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for KeyLen {
#[inline(always)]
fn from(val: u8) -> KeyLen {
KeyLen::from_bits(val)
}
}
impl From<KeyLen> for u8 {
#[inline(always)]
fn from(val: KeyLen) -> u8 {
KeyLen::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum NumOfRounds {
#[doc = "Use 20 rounds of rotation (default)."]
Default = 0x0,
#[doc = "Use 12 rounds of rotation."]
_12rounds = 0x01,
#[doc = "Use 8 rounds of rotation."]
_8rounds = 0x02,
_RESERVED_3 = 0x03,
}
impl NumOfRounds {
#[inline(always)]
pub const fn from_bits(val: u8) -> NumOfRounds {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for NumOfRounds {
#[inline(always)]
fn from(val: u8) -> NumOfRounds {
NumOfRounds::from_bits(val)
}
}
impl From<NumOfRounds> for u8 {
#[inline(always)]
fn from(val: NumOfRounds) -> u8 {
NumOfRounds::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Status {
#[doc = "CHACHA engine is idle."]
Idle = 0x0,
#[doc = "CHACHA engine is busy."]
Busy = 0x01,
}
impl Status {
#[inline(always)]
pub const fn from_bits(val: u8) -> Status {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Status {
#[inline(always)]
fn from(val: u8) -> Status {
Status::from_bits(val)
}
}
impl From<Status> for u8 {
#[inline(always)]
fn from(val: Status) -> u8 {
Status::to_bits(val)
}
}
}
}
pub mod cc_ctl {
#[doc = "CRYPTOCELL CTL interface."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct CcCtl {
ptr: *mut u8,
}
unsafe impl Send for CcCtl {}
unsafe impl Sync for CcCtl {}
impl CcCtl {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Defines the cryptographic flow."]
#[inline(always)]
pub const fn crypto_ctl(self) -> crate::common::Reg<regs::CryptoCtl, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0900usize) as _) }
}
#[doc = "Status register for cryptographic cores engine activity."]
#[inline(always)]
pub const fn crypto_busy(self) -> crate::common::Reg<regs::CryptoBusy, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0910usize) as _) }
}
#[doc = "Status register for HASH engine activity."]
#[inline(always)]
pub const fn hash_busy(self) -> crate::common::Reg<regs::HashBusy, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x091cusize) as _) }
}
#[doc = "A general-purpose read/write register."]
#[inline(always)]
pub const fn context_id(self) -> crate::common::Reg<regs::ContextId, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0930usize) as _) }
}
}
pub mod regs {
#[doc = "A general-purpose read/write register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct ContextId(pub u32);
impl ContextId {
#[doc = "Context ID."]
#[must_use]
#[inline(always)]
pub const fn context_id(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Context ID."]
#[inline(always)]
pub const fn set_context_id(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for ContextId {
#[inline(always)]
fn default() -> ContextId {
ContextId(0)
}
}
impl core::fmt::Debug for ContextId {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("ContextId")
.field("context_id", &self.context_id())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for ContextId {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "ContextId {{ context_id: {=u8:?} }}", self.context_id())
}
}
#[doc = "Status register for cryptographic cores engine activity."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct CryptoBusy(pub u32);
impl CryptoBusy {
#[doc = "Cryptographic core engines status."]
#[must_use]
#[inline(always)]
pub const fn status(&self) -> super::vals::CryptoBusyStatus {
let val = (self.0 >> 0usize) & 0x01;
super::vals::CryptoBusyStatus::from_bits(val as u8)
}
#[doc = "Cryptographic core engines status."]
#[inline(always)]
pub const fn set_status(&mut self, val: super::vals::CryptoBusyStatus) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for CryptoBusy {
#[inline(always)]
fn default() -> CryptoBusy {
CryptoBusy(0)
}
}
impl core::fmt::Debug for CryptoBusy {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CryptoBusy")
.field("status", &self.status())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for CryptoBusy {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "CryptoBusy {{ status: {:?} }}", self.status())
}
}
#[doc = "Defines the cryptographic flow."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct CryptoCtl(pub u32);
impl CryptoCtl {
#[doc = "Configure the cryptographic engine mode."]
#[must_use]
#[inline(always)]
pub const fn mode(&self) -> super::vals::Mode {
let val = (self.0 >> 0usize) & 0x1f;
super::vals::Mode::from_bits(val as u8)
}
#[doc = "Configure the cryptographic engine mode."]
#[inline(always)]
pub const fn set_mode(&mut self, val: super::vals::Mode) {
self.0 = (self.0 & !(0x1f << 0usize)) | (((val.to_bits() as u32) & 0x1f) << 0usize);
}
}
impl Default for CryptoCtl {
#[inline(always)]
fn default() -> CryptoCtl {
CryptoCtl(0)
}
}
impl core::fmt::Debug for CryptoCtl {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CryptoCtl")
.field("mode", &self.mode())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for CryptoCtl {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "CryptoCtl {{ mode: {:?} }}", self.mode())
}
}
#[doc = "Status register for HASH engine activity."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct HashBusy(pub u32);
impl HashBusy {
#[doc = "Hash engine status."]
#[must_use]
#[inline(always)]
pub const fn status(&self) -> super::vals::HashBusyStatus {
let val = (self.0 >> 0usize) & 0x01;
super::vals::HashBusyStatus::from_bits(val as u8)
}
#[doc = "Hash engine status."]
#[inline(always)]
pub const fn set_status(&mut self, val: super::vals::HashBusyStatus) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for HashBusy {
#[inline(always)]
fn default() -> HashBusy {
HashBusy(0)
}
}
impl core::fmt::Debug for HashBusy {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("HashBusy")
.field("status", &self.status())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for HashBusy {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "HashBusy {{ status: {:?} }}", self.status())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum CryptoBusyStatus {
#[doc = "Cryptographic core engines are idle."]
Idle = 0x0,
#[doc = "Cryptographic core engines are busy."]
Busy = 0x01,
}
impl CryptoBusyStatus {
#[inline(always)]
pub const fn from_bits(val: u8) -> CryptoBusyStatus {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for CryptoBusyStatus {
#[inline(always)]
fn from(val: u8) -> CryptoBusyStatus {
CryptoBusyStatus::from_bits(val)
}
}
impl From<CryptoBusyStatus> for u8 {
#[inline(always)]
fn from(val: CryptoBusyStatus) -> u8 {
CryptoBusyStatus::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum HashBusyStatus {
#[doc = "HASH engine is idle."]
Idle = 0x0,
#[doc = "HASH engine is busy."]
Busy = 0x01,
}
impl HashBusyStatus {
#[inline(always)]
pub const fn from_bits(val: u8) -> HashBusyStatus {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for HashBusyStatus {
#[inline(always)]
fn from(val: u8) -> HashBusyStatus {
HashBusyStatus::from_bits(val)
}
}
impl From<HashBusyStatus> for u8 {
#[inline(always)]
fn from(val: HashBusyStatus) -> u8 {
HashBusyStatus::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Mode {
#[doc = "Bypass cryptographic engine."]
Bypass = 0x0,
#[doc = "Use AES engine."]
AesActive = 0x01,
#[doc = "Pipe AES engine output to HASH engine input."]
AesToHashActive = 0x02,
#[doc = "Process input using both AES and HASH engine in parallell."]
AesAndHashActive = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
#[doc = "Use HASH engine."]
HashActive = 0x07,
_RESERVED_8 = 0x08,
#[doc = "Calculate AES MAC and bypass."]
AesmacAndBypassActive = 0x09,
#[doc = "Pipe AES engine output to HASH engine input. The resulting digest output is piped to DOUT buffer."]
AesToHashAndDoutActive = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
#[doc = "Use CHACHA engine."]
ChaChaActive = 0x10,
_RESERVED_11 = 0x11,
_RESERVED_12 = 0x12,
_RESERVED_13 = 0x13,
_RESERVED_14 = 0x14,
_RESERVED_15 = 0x15,
_RESERVED_16 = 0x16,
_RESERVED_17 = 0x17,
_RESERVED_18 = 0x18,
_RESERVED_19 = 0x19,
_RESERVED_1a = 0x1a,
_RESERVED_1b = 0x1b,
_RESERVED_1c = 0x1c,
_RESERVED_1d = 0x1d,
_RESERVED_1e = 0x1e,
_RESERVED_1f = 0x1f,
}
impl Mode {
#[inline(always)]
pub const fn from_bits(val: u8) -> Mode {
unsafe { core::mem::transmute(val & 0x1f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Mode {
#[inline(always)]
fn from(val: u8) -> Mode {
Mode::from_bits(val)
}
}
impl From<Mode> for u8 {
#[inline(always)]
fn from(val: Mode) -> u8 {
Mode::to_bits(val)
}
}
}
}
pub mod cc_din {
#[doc = "CRYPTOCELL Data IN interface."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct CcDin {
ptr: *mut u8,
}
unsafe impl Send for CcDin {}
unsafe impl Sync for CcDin {}
impl CcDin {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Used by CPU to write data directly to the DIN buffer, which is then sent to the cryptographic engines for processing."]
#[inline(always)]
pub const fn din_buffer(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0c00usize) as _) }
}
#[doc = "Status register for DIN DMA engine activity when accessing memory."]
#[inline(always)]
pub const fn din_dma_mem_busy(
self,
) -> crate::common::Reg<regs::DinDmaMemBusy, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0c20usize) as _) }
}
#[doc = "Data source address in memory."]
#[inline(always)]
pub const fn src_mem_addr(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0c28usize) as _) }
}
#[doc = "The number of bytes to be read from memory. Writing to this register triggers the DMA operation."]
#[inline(always)]
pub const fn src_mem_size(self) -> crate::common::Reg<regs::SrcMemSize, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0c2cusize) as _) }
}
#[doc = "Data source address in RNG SRAM."]
#[inline(always)]
pub const fn src_sram_addr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0c30usize) as _) }
}
#[doc = "The number of bytes to be read from RNG SRAM. Writing to this register triggers the DMA operation."]
#[inline(always)]
pub const fn src_sram_size(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0c34usize) as _) }
}
#[doc = "Status register for DIN DMA engine activity when accessing RNG SRAM."]
#[inline(always)]
pub const fn din_dma_sram_busy(
self,
) -> crate::common::Reg<regs::DinDmaSramBusy, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0c38usize) as _) }
}
#[doc = "Configure the endianness of DIN DMA transactions towards RNG SRAM."]
#[inline(always)]
pub const fn din_dma_sram_endianness(
self,
) -> crate::common::Reg<regs::DinDmaSramEndianness, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0c3cusize) as _) }
}
#[doc = "Reset the DIN DMA engine."]
#[inline(always)]
pub const fn din_sw_reset(self) -> crate::common::Reg<regs::DinSwReset, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0c44usize) as _) }
}
#[doc = "Specifies the number of bytes the CPU will write to the DIN_BUFFER, ensuring the cryptographic engine processes the correct amount of data."]
#[inline(always)]
pub const fn din_cpu_data(self) -> crate::common::Reg<regs::DinCpuData, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0c48usize) as _) }
}
#[doc = "Indicates that the next CPU write to the DIN_BUFFER is the last in the sequence. This is needed only when the data size is NOT modulo 4 (e.g. HASH padding)."]
#[inline(always)]
pub const fn din_write_align(
self,
) -> crate::common::Reg<regs::DinWriteAlign, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0c4cusize) as _) }
}
#[doc = "Register indicating if DIN FIFO is empty and if more data can be accepted."]
#[inline(always)]
pub const fn din_fifo_empty(
self,
) -> crate::common::Reg<regs::DinFifoEmpty, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0c50usize) as _) }
}
#[doc = "Reset the DIN FIFO, effectively clearing the FIFO for new data."]
#[inline(always)]
pub const fn din_fifo_reset(
self,
) -> crate::common::Reg<regs::DinFifoReset, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0c58usize) as _) }
}
}
pub mod regs {
#[doc = "Specifies the number of bytes the CPU will write to the DIN_BUFFER, ensuring the cryptographic engine processes the correct amount of data."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DinCpuData(pub u32);
impl DinCpuData {
#[doc = "When using CPU direct write to the DIN_BUFFER, the size of input data in bytes should be written to this register."]
#[must_use]
#[inline(always)]
pub const fn size(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "When using CPU direct write to the DIN_BUFFER, the size of input data in bytes should be written to this register."]
#[inline(always)]
pub const fn set_size(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for DinCpuData {
#[inline(always)]
fn default() -> DinCpuData {
DinCpuData(0)
}
}
impl core::fmt::Debug for DinCpuData {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DinCpuData")
.field("size", &self.size())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for DinCpuData {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "DinCpuData {{ size: {=u16:?} }}", self.size())
}
}
#[doc = "Status register for DIN DMA engine activity when accessing memory."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DinDmaMemBusy(pub u32);
impl DinDmaMemBusy {
#[doc = "DIN memory DMA engine status."]
#[must_use]
#[inline(always)]
pub const fn status(&self) -> super::vals::DinDmaMemBusyStatus {
let val = (self.0 >> 0usize) & 0x01;
super::vals::DinDmaMemBusyStatus::from_bits(val as u8)
}
#[doc = "DIN memory DMA engine status."]
#[inline(always)]
pub const fn set_status(&mut self, val: super::vals::DinDmaMemBusyStatus) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for DinDmaMemBusy {
#[inline(always)]
fn default() -> DinDmaMemBusy {
DinDmaMemBusy(0)
}
}
impl core::fmt::Debug for DinDmaMemBusy {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DinDmaMemBusy")
.field("status", &self.status())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for DinDmaMemBusy {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "DinDmaMemBusy {{ status: {:?} }}", self.status())
}
}
#[doc = "Status register for DIN DMA engine activity when accessing RNG SRAM."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DinDmaSramBusy(pub u32);
impl DinDmaSramBusy {
#[doc = "DIN RNG SRAM DMA engine status."]
#[must_use]
#[inline(always)]
pub const fn status(&self) -> super::vals::DinDmaSramBusyStatus {
let val = (self.0 >> 0usize) & 0x01;
super::vals::DinDmaSramBusyStatus::from_bits(val as u8)
}
#[doc = "DIN RNG SRAM DMA engine status."]
#[inline(always)]
pub const fn set_status(&mut self, val: super::vals::DinDmaSramBusyStatus) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for DinDmaSramBusy {
#[inline(always)]
fn default() -> DinDmaSramBusy {
DinDmaSramBusy(0)
}
}
impl core::fmt::Debug for DinDmaSramBusy {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DinDmaSramBusy")
.field("status", &self.status())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for DinDmaSramBusy {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "DinDmaSramBusy {{ status: {:?} }}", self.status())
}
}
#[doc = "Configure the endianness of DIN DMA transactions towards RNG SRAM."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DinDmaSramEndianness(pub u32);
impl DinDmaSramEndianness {
#[doc = "Endianness of DIN DMA transactions towards RNG SRAM. The default value is little-endian."]
#[must_use]
#[inline(always)]
pub const fn endian(&self) -> super::vals::Endian {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Endian::from_bits(val as u8)
}
#[doc = "Endianness of DIN DMA transactions towards RNG SRAM. The default value is little-endian."]
#[inline(always)]
pub const fn set_endian(&mut self, val: super::vals::Endian) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for DinDmaSramEndianness {
#[inline(always)]
fn default() -> DinDmaSramEndianness {
DinDmaSramEndianness(0)
}
}
impl core::fmt::Debug for DinDmaSramEndianness {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DinDmaSramEndianness")
.field("endian", &self.endian())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for DinDmaSramEndianness {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "DinDmaSramEndianness {{ endian: {:?} }}", self.endian())
}
}
#[doc = "Register indicating if DIN FIFO is empty and if more data can be accepted."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DinFifoEmpty(pub u32);
impl DinFifoEmpty {
#[doc = "DIN FIFO status."]
#[must_use]
#[inline(always)]
pub const fn status(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "DIN FIFO status."]
#[inline(always)]
pub const fn set_status(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for DinFifoEmpty {
#[inline(always)]
fn default() -> DinFifoEmpty {
DinFifoEmpty(0)
}
}
impl core::fmt::Debug for DinFifoEmpty {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DinFifoEmpty")
.field("status", &self.status())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for DinFifoEmpty {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "DinFifoEmpty {{ status: {=bool:?} }}", self.status())
}
}
#[doc = "Reset the DIN FIFO, effectively clearing the FIFO for new data."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DinFifoReset(pub u32);
impl DinFifoReset {
#[doc = "Writing any value to this address resets the DIN FIFO."]
#[must_use]
#[inline(always)]
pub const fn reset(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Writing any value to this address resets the DIN FIFO."]
#[inline(always)]
pub const fn set_reset(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for DinFifoReset {
#[inline(always)]
fn default() -> DinFifoReset {
DinFifoReset(0)
}
}
impl core::fmt::Debug for DinFifoReset {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DinFifoReset")
.field("reset", &self.reset())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for DinFifoReset {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "DinFifoReset {{ reset: {=bool:?} }}", self.reset())
}
}
#[doc = "Reset the DIN DMA engine."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DinSwReset(pub u32);
impl DinSwReset {
#[doc = "Writing any value to this address resets the DIN DMA engine. The reset takes 4 CPU clock cycles to complete."]
#[must_use]
#[inline(always)]
pub const fn reset(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Writing any value to this address resets the DIN DMA engine. The reset takes 4 CPU clock cycles to complete."]
#[inline(always)]
pub const fn set_reset(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for DinSwReset {
#[inline(always)]
fn default() -> DinSwReset {
DinSwReset(0)
}
}
impl core::fmt::Debug for DinSwReset {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DinSwReset")
.field("reset", &self.reset())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for DinSwReset {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "DinSwReset {{ reset: {=bool:?} }}", self.reset())
}
}
#[doc = "Indicates that the next CPU write to the DIN_BUFFER is the last in the sequence. This is needed only when the data size is NOT modulo 4 (e.g. HASH padding)."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DinWriteAlign(pub u32);
impl DinWriteAlign {
#[doc = "Next CPU write to the DIN_BUFFER is the last word."]
#[must_use]
#[inline(always)]
pub const fn last(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Next CPU write to the DIN_BUFFER is the last word."]
#[inline(always)]
pub const fn set_last(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for DinWriteAlign {
#[inline(always)]
fn default() -> DinWriteAlign {
DinWriteAlign(0)
}
}
impl core::fmt::Debug for DinWriteAlign {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DinWriteAlign")
.field("last", &self.last())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for DinWriteAlign {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "DinWriteAlign {{ last: {=bool:?} }}", self.last())
}
}
#[doc = "The number of bytes to be read from memory. Writing to this register triggers the DMA operation."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct SrcMemSize(pub u32);
impl SrcMemSize {
#[doc = "Total number of bytes to read from memory."]
#[must_use]
#[inline(always)]
pub const fn size(&self) -> u32 {
let val = (self.0 >> 0usize) & 0x3fff_ffff;
val as u32
}
#[doc = "Total number of bytes to read from memory."]
#[inline(always)]
pub const fn set_size(&mut self, val: u32) {
self.0 =
(self.0 & !(0x3fff_ffff << 0usize)) | (((val as u32) & 0x3fff_ffff) << 0usize);
}
#[doc = "This field is reserved."]
#[must_use]
#[inline(always)]
pub const fn first(&self) -> bool {
let val = (self.0 >> 30usize) & 0x01;
val != 0
}
#[doc = "This field is reserved."]
#[inline(always)]
pub const fn set_first(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize);
}
#[doc = "This field is reserved."]
#[must_use]
#[inline(always)]
pub const fn last(&self) -> bool {
let val = (self.0 >> 31usize) & 0x01;
val != 0
}
#[doc = "This field is reserved."]
#[inline(always)]
pub const fn set_last(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
}
}
impl Default for SrcMemSize {
#[inline(always)]
fn default() -> SrcMemSize {
SrcMemSize(0)
}
}
impl core::fmt::Debug for SrcMemSize {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("SrcMemSize")
.field("size", &self.size())
.field("first", &self.first())
.field("last", &self.last())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for SrcMemSize {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"SrcMemSize {{ size: {=u32:?}, first: {=bool:?}, last: {=bool:?} }}",
self.size(),
self.first(),
self.last()
)
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum DinDmaMemBusyStatus {
#[doc = "DIN memory DMA engine is idle."]
Idle = 0x0,
#[doc = "DIN memory DMA engine is busy."]
Busy = 0x01,
}
impl DinDmaMemBusyStatus {
#[inline(always)]
pub const fn from_bits(val: u8) -> DinDmaMemBusyStatus {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for DinDmaMemBusyStatus {
#[inline(always)]
fn from(val: u8) -> DinDmaMemBusyStatus {
DinDmaMemBusyStatus::from_bits(val)
}
}
impl From<DinDmaMemBusyStatus> for u8 {
#[inline(always)]
fn from(val: DinDmaMemBusyStatus) -> u8 {
DinDmaMemBusyStatus::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum DinDmaSramBusyStatus {
#[doc = "DIN RNG SRAM DMA engine is idle."]
Idle = 0x0,
#[doc = "DIN RNG SRAM DMA engine is busy."]
Busy = 0x01,
}
impl DinDmaSramBusyStatus {
#[inline(always)]
pub const fn from_bits(val: u8) -> DinDmaSramBusyStatus {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for DinDmaSramBusyStatus {
#[inline(always)]
fn from(val: u8) -> DinDmaSramBusyStatus {
DinDmaSramBusyStatus::from_bits(val)
}
}
impl From<DinDmaSramBusyStatus> for u8 {
#[inline(always)]
fn from(val: DinDmaSramBusyStatus) -> u8 {
DinDmaSramBusyStatus::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Endian {
#[doc = "Use little-endian format for RNG SRAM DMA transactions."]
LittleEndian = 0x0,
#[doc = "Use big-endian format for RNG SRAM DMA transactions."]
BigEndian = 0x01,
}
impl Endian {
#[inline(always)]
pub const fn from_bits(val: u8) -> Endian {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Endian {
#[inline(always)]
fn from(val: u8) -> Endian {
Endian::from_bits(val)
}
}
impl From<Endian> for u8 {
#[inline(always)]
fn from(val: Endian) -> u8 {
Endian::to_bits(val)
}
}
}
}
pub mod cc_dout {
#[doc = "CRYPTOCELL Data OUT interface."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct CcDout {
ptr: *mut u8,
}
unsafe impl Send for CcDout {}
unsafe impl Sync for CcDout {}
impl CcDout {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Cryptographic results directly accessible by the CPU."]
#[inline(always)]
pub const fn dout_buffer(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0d00usize) as _) }
}
#[doc = "Status register for DOUT DMA engine activity when accessing memory."]
#[inline(always)]
pub const fn dout_dma_mem_busy(
self,
) -> crate::common::Reg<regs::DoutDmaMemBusy, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0d20usize) as _) }
}
#[doc = "Data destination address in memory."]
#[inline(always)]
pub const fn dst_mem_addr(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0d28usize) as _) }
}
#[doc = "The number of bytes to be written to memory."]
#[inline(always)]
pub const fn dst_mem_size(self) -> crate::common::Reg<regs::DstMemSize, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0d2cusize) as _) }
}
#[doc = "Data destination address in RNG SRAM."]
#[inline(always)]
pub const fn dst_sram_addr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0d30usize) as _) }
}
#[doc = "The number of bytes to be written to RNG SRAM."]
#[inline(always)]
pub const fn dst_sram_size(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0d34usize) as _) }
}
#[doc = "Status register for DOUT DMA engine activity when accessing RNG SRAM."]
#[inline(always)]
pub const fn dout_dma_sram_busy(
self,
) -> crate::common::Reg<regs::DoutDmaSramBusy, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0d38usize) as _) }
}
#[doc = "Configure the endianness of DOUT DMA transactions towards RNG SRAM."]
#[inline(always)]
pub const fn dout_dma_sram_endianness(
self,
) -> crate::common::Reg<regs::DoutDmaSramEndianness, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0d3cusize) as _) }
}
#[doc = "Indication that the next CPU read from the DOUT_BUFFER is the last in the sequence. This is needed only when the data size is NOT modulo 4 (e.g. HASH padding)."]
#[inline(always)]
pub const fn dout_read_align(
self,
) -> crate::common::Reg<regs::DoutReadAlign, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0d44usize) as _) }
}
#[doc = "Register indicating if DOUT FIFO is empty or if more data will come."]
#[inline(always)]
pub const fn dout_fifo_empty(
self,
) -> crate::common::Reg<regs::DoutFifoEmpty, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0d50usize) as _) }
}
#[doc = "Reset the DOUT DMA engine."]
#[inline(always)]
pub const fn dout_sw_reset(
self,
) -> crate::common::Reg<regs::DoutSwReset, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0d58usize) as _) }
}
}
pub mod regs {
#[doc = "Status register for DOUT DMA engine activity when accessing memory."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DoutDmaMemBusy(pub u32);
impl DoutDmaMemBusy {
#[doc = "DOUT memory DMA engine status."]
#[must_use]
#[inline(always)]
pub const fn status(&self) -> super::vals::DoutDmaMemBusyStatus {
let val = (self.0 >> 0usize) & 0x01;
super::vals::DoutDmaMemBusyStatus::from_bits(val as u8)
}
#[doc = "DOUT memory DMA engine status."]
#[inline(always)]
pub const fn set_status(&mut self, val: super::vals::DoutDmaMemBusyStatus) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for DoutDmaMemBusy {
#[inline(always)]
fn default() -> DoutDmaMemBusy {
DoutDmaMemBusy(0)
}
}
impl core::fmt::Debug for DoutDmaMemBusy {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DoutDmaMemBusy")
.field("status", &self.status())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for DoutDmaMemBusy {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "DoutDmaMemBusy {{ status: {:?} }}", self.status())
}
}
#[doc = "Status register for DOUT DMA engine activity when accessing RNG SRAM."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DoutDmaSramBusy(pub u32);
impl DoutDmaSramBusy {
#[doc = "DOUT RNG SRAM DMA engine status."]
#[must_use]
#[inline(always)]
pub const fn status(&self) -> super::vals::DoutDmaSramBusyStatus {
let val = (self.0 >> 0usize) & 0x01;
super::vals::DoutDmaSramBusyStatus::from_bits(val as u8)
}
#[doc = "DOUT RNG SRAM DMA engine status."]
#[inline(always)]
pub const fn set_status(&mut self, val: super::vals::DoutDmaSramBusyStatus) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for DoutDmaSramBusy {
#[inline(always)]
fn default() -> DoutDmaSramBusy {
DoutDmaSramBusy(0)
}
}
impl core::fmt::Debug for DoutDmaSramBusy {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DoutDmaSramBusy")
.field("status", &self.status())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for DoutDmaSramBusy {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "DoutDmaSramBusy {{ status: {:?} }}", self.status())
}
}
#[doc = "Configure the endianness of DOUT DMA transactions towards RNG SRAM."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DoutDmaSramEndianness(pub u32);
impl DoutDmaSramEndianness {
#[doc = "Endianness of DOUT DMA transactions towards RNG SRAM. The default value is little-endian."]
#[must_use]
#[inline(always)]
pub const fn endian(&self) -> super::vals::Endian {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Endian::from_bits(val as u8)
}
#[doc = "Endianness of DOUT DMA transactions towards RNG SRAM. The default value is little-endian."]
#[inline(always)]
pub const fn set_endian(&mut self, val: super::vals::Endian) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for DoutDmaSramEndianness {
#[inline(always)]
fn default() -> DoutDmaSramEndianness {
DoutDmaSramEndianness(0)
}
}
impl core::fmt::Debug for DoutDmaSramEndianness {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DoutDmaSramEndianness")
.field("endian", &self.endian())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for DoutDmaSramEndianness {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "DoutDmaSramEndianness {{ endian: {:?} }}", self.endian())
}
}
#[doc = "Register indicating if DOUT FIFO is empty or if more data will come."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DoutFifoEmpty(pub u32);
impl DoutFifoEmpty {
#[doc = "DOUT FIFO status."]
#[must_use]
#[inline(always)]
pub const fn status(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "DOUT FIFO status."]
#[inline(always)]
pub const fn set_status(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for DoutFifoEmpty {
#[inline(always)]
fn default() -> DoutFifoEmpty {
DoutFifoEmpty(0)
}
}
impl core::fmt::Debug for DoutFifoEmpty {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DoutFifoEmpty")
.field("status", &self.status())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for DoutFifoEmpty {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "DoutFifoEmpty {{ status: {=bool:?} }}", self.status())
}
}
#[doc = "Indication that the next CPU read from the DOUT_BUFFER is the last in the sequence. This is needed only when the data size is NOT modulo 4 (e.g. HASH padding)."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DoutReadAlign(pub u32);
impl DoutReadAlign {
#[doc = "Next CPU read from the DOUT_BUFFER is the last word, and the remaining read aligned content can be flushed."]
#[must_use]
#[inline(always)]
pub const fn last(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Next CPU read from the DOUT_BUFFER is the last word, and the remaining read aligned content can be flushed."]
#[inline(always)]
pub const fn set_last(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for DoutReadAlign {
#[inline(always)]
fn default() -> DoutReadAlign {
DoutReadAlign(0)
}
}
impl core::fmt::Debug for DoutReadAlign {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DoutReadAlign")
.field("last", &self.last())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for DoutReadAlign {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "DoutReadAlign {{ last: {=bool:?} }}", self.last())
}
}
#[doc = "Reset the DOUT DMA engine."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DoutSwReset(pub u32);
impl DoutSwReset {
#[doc = "Writing any value to this address resets the DOUT DMA engine. The reset takes 4 CPU clock cycles to complete."]
#[must_use]
#[inline(always)]
pub const fn reset(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Writing any value to this address resets the DOUT DMA engine. The reset takes 4 CPU clock cycles to complete."]
#[inline(always)]
pub const fn set_reset(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for DoutSwReset {
#[inline(always)]
fn default() -> DoutSwReset {
DoutSwReset(0)
}
}
impl core::fmt::Debug for DoutSwReset {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DoutSwReset")
.field("reset", &self.reset())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for DoutSwReset {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "DoutSwReset {{ reset: {=bool:?} }}", self.reset())
}
}
#[doc = "The number of bytes to be written to memory."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DstMemSize(pub u32);
impl DstMemSize {
#[doc = "Total number of bytes to write to memory."]
#[must_use]
#[inline(always)]
pub const fn size(&self) -> u32 {
let val = (self.0 >> 0usize) & 0x3fff_ffff;
val as u32
}
#[doc = "Total number of bytes to write to memory."]
#[inline(always)]
pub const fn set_size(&mut self, val: u32) {
self.0 =
(self.0 & !(0x3fff_ffff << 0usize)) | (((val as u32) & 0x3fff_ffff) << 0usize);
}
#[doc = "This field is reserved."]
#[must_use]
#[inline(always)]
pub const fn first(&self) -> bool {
let val = (self.0 >> 30usize) & 0x01;
val != 0
}
#[doc = "This field is reserved."]
#[inline(always)]
pub const fn set_first(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize);
}
#[doc = "This field is reserved."]
#[must_use]
#[inline(always)]
pub const fn last(&self) -> bool {
let val = (self.0 >> 31usize) & 0x01;
val != 0
}
#[doc = "This field is reserved."]
#[inline(always)]
pub const fn set_last(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
}
}
impl Default for DstMemSize {
#[inline(always)]
fn default() -> DstMemSize {
DstMemSize(0)
}
}
impl core::fmt::Debug for DstMemSize {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DstMemSize")
.field("size", &self.size())
.field("first", &self.first())
.field("last", &self.last())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for DstMemSize {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"DstMemSize {{ size: {=u32:?}, first: {=bool:?}, last: {=bool:?} }}",
self.size(),
self.first(),
self.last()
)
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum DoutDmaMemBusyStatus {
#[doc = "DOUT memory DMA engine is idle."]
Idle = 0x0,
#[doc = "DOUT memory DMA engine is busy."]
Busy = 0x01,
}
impl DoutDmaMemBusyStatus {
#[inline(always)]
pub const fn from_bits(val: u8) -> DoutDmaMemBusyStatus {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for DoutDmaMemBusyStatus {
#[inline(always)]
fn from(val: u8) -> DoutDmaMemBusyStatus {
DoutDmaMemBusyStatus::from_bits(val)
}
}
impl From<DoutDmaMemBusyStatus> for u8 {
#[inline(always)]
fn from(val: DoutDmaMemBusyStatus) -> u8 {
DoutDmaMemBusyStatus::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum DoutDmaSramBusyStatus {
#[doc = "DOUT RNG SRAM DMA engine is idle."]
Idle = 0x0,
#[doc = "DOUT RNG SRAM DMA engine is busy."]
Busy = 0x01,
}
impl DoutDmaSramBusyStatus {
#[inline(always)]
pub const fn from_bits(val: u8) -> DoutDmaSramBusyStatus {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for DoutDmaSramBusyStatus {
#[inline(always)]
fn from(val: u8) -> DoutDmaSramBusyStatus {
DoutDmaSramBusyStatus::from_bits(val)
}
}
impl From<DoutDmaSramBusyStatus> for u8 {
#[inline(always)]
fn from(val: DoutDmaSramBusyStatus) -> u8 {
DoutDmaSramBusyStatus::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Endian {
#[doc = "Use little-endian format for RNG SRAM DMA transactions."]
LittleEndian = 0x0,
#[doc = "Use big-endian format for RNG SRAM DMA transactions."]
BigEndian = 0x01,
}
impl Endian {
#[inline(always)]
pub const fn from_bits(val: u8) -> Endian {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Endian {
#[inline(always)]
fn from(val: u8) -> Endian {
Endian::from_bits(val)
}
}
impl From<Endian> for u8 {
#[inline(always)]
fn from(val: Endian) -> u8 {
Endian::to_bits(val)
}
}
}
}
pub mod cc_ghash {
#[doc = "CRYPTOCELL GHASH engine."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct CcGhash {
ptr: *mut u8,
}
unsafe impl Send for CcGhash {}
unsafe impl Sync for CcGhash {}
impl CcGhash {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description collection: GHASH subkey value to use. The initial GHASH_SUBKEY\\[0\\] register holds the least significant bits \\[31:0\\] of the subkey value."]
#[inline(always)]
pub const fn ghash_subkey(self, n: usize) -> crate::common::Reg<u32, crate::common::W> {
assert!(n < 4usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0960usize + n * 4usize) as _)
}
}
#[doc = "Description collection: GHASH Initialization Vector (IV) to use. The initial GHASH_IV\\[0\\] register holds the least significant bits \\[31:0\\] of the IV."]
#[inline(always)]
pub const fn ghash_iv(self, n: usize) -> crate::common::Reg<u32, crate::common::RW> {
assert!(n < 4usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0970usize + n * 4usize) as _)
}
}
#[doc = "Status register for GHASH engine activity."]
#[inline(always)]
pub const fn ghash_busy(self) -> crate::common::Reg<regs::GhashBusy, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0980usize) as _) }
}
#[doc = "Configure the GHASH engine for a new GHASH operation."]
#[inline(always)]
pub const fn ghash_init(self) -> crate::common::Reg<regs::GhashInit, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0984usize) as _) }
}
}
pub mod regs {
#[doc = "Status register for GHASH engine activity."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct GhashBusy(pub u32);
impl GhashBusy {
#[doc = "GHASH engine status."]
#[must_use]
#[inline(always)]
pub const fn status(&self) -> super::vals::Status {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Status::from_bits(val as u8)
}
#[doc = "GHASH engine status."]
#[inline(always)]
pub const fn set_status(&mut self, val: super::vals::Status) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for GhashBusy {
#[inline(always)]
fn default() -> GhashBusy {
GhashBusy(0)
}
}
impl core::fmt::Debug for GhashBusy {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("GhashBusy")
.field("status", &self.status())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for GhashBusy {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "GhashBusy {{ status: {:?} }}", self.status())
}
}
#[doc = "Configure the GHASH engine for a new GHASH operation."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct GhashInit(pub u32);
impl GhashInit {
#[doc = "Initialize a new GHASH operation."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Initialize a new GHASH operation."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for GhashInit {
#[inline(always)]
fn default() -> GhashInit {
GhashInit(0)
}
}
impl core::fmt::Debug for GhashInit {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("GhashInit")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for GhashInit {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "GhashInit {{ enable: {=bool:?} }}", self.enable())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Status {
#[doc = "GHASH engine is idle."]
Idle = 0x0,
#[doc = "GHASH engine is busy."]
Busy = 0x01,
}
impl Status {
#[inline(always)]
pub const fn from_bits(val: u8) -> Status {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Status {
#[inline(always)]
fn from(val: u8) -> Status {
Status::from_bits(val)
}
}
impl From<Status> for u8 {
#[inline(always)]
fn from(val: Status) -> u8 {
Status::to_bits(val)
}
}
}
}
pub mod cc_hash {
#[doc = "CRYPTOCELL HASH engine."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct CcHash {
ptr: *mut u8,
}
unsafe impl Send for CcHash {}
unsafe impl Sync for CcHash {}
impl CcHash {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description collection: HASH_H value registers. The initial HASH_H\\[0\\] register holds the least significant bits \\[31:0\\] of the value."]
#[inline(always)]
pub const fn hash_h(self, n: usize) -> crate::common::Reg<u32, crate::common::RW> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0640usize + n * 4usize) as _)
}
}
#[doc = "Configure the HASH engine to automatically pad data at the end of the DMA transfer to complete the digest operation."]
#[inline(always)]
pub const fn hash_pad_auto(
self,
) -> crate::common::Reg<regs::HashPadAuto, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0684usize) as _) }
}
#[doc = "Perform an XOR operation of the DIN DMA engine input data being fed into the HASH engine. Set this register to '0' if XOR is not required."]
#[inline(always)]
pub const fn hash_xor_din(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0688usize) as _) }
}
#[doc = "Configure HASH engine initial state registers."]
#[inline(always)]
pub const fn hash_init_state(
self,
) -> crate::common::Reg<regs::HashInitState, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0694usize) as _) }
}
#[doc = "Select HASH or GHASH engine as the digest engine to use."]
#[inline(always)]
pub const fn hash_select(self) -> crate::common::Reg<regs::HashSelect, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x06a4usize) as _) }
}
#[doc = "Control the HASH engine behavior."]
#[inline(always)]
pub const fn hash_control(
self,
) -> crate::common::Reg<regs::HashControl, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x07c0usize) as _) }
}
#[doc = "Enable the hardware padding feature of the HASH engine."]
#[inline(always)]
pub const fn hash_pad(self) -> crate::common::Reg<regs::HashPad, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x07c4usize) as _) }
}
#[doc = "Force the hardware padding operation to trigger if the input data length is zero bytes."]
#[inline(always)]
pub const fn hash_pad_force(
self,
) -> crate::common::Reg<regs::HashPadForce, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x07c8usize) as _) }
}
#[doc = "Bits \\[31:0\\] of the number of bytes that have been digested so far."]
#[inline(always)]
pub const fn hash_cur_len_0(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x07ccusize) as _) }
}
#[doc = "Bits \\[63:32\\] of the number of bytes that have been digested so far."]
#[inline(always)]
pub const fn hash_cur_len_1(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x07d0usize) as _) }
}
#[doc = "Hardware configuration of the HASH engine. Reset value holds the supported features."]
#[inline(always)]
pub const fn hash_hw_flags(
self,
) -> crate::common::Reg<regs::HashHwFlags, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x07dcusize) as _) }
}
#[doc = "Reset the HASH engine."]
#[inline(always)]
pub const fn hash_sw_reset(
self,
) -> crate::common::Reg<regs::HashSwReset, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x07e4usize) as _) }
}
#[doc = "Configure the endianness of HASH data and padding generation."]
#[inline(always)]
pub const fn hash_endianness(
self,
) -> crate::common::Reg<regs::HashEndianness, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x07e8usize) as _) }
}
}
pub mod regs {
#[doc = "Control the HASH engine behavior."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct HashControl(pub u32);
impl HashControl {
#[doc = "Select HASH mode to execute."]
#[must_use]
#[inline(always)]
pub const fn mode(&self) -> super::vals::Mode {
let val = (self.0 >> 0usize) & 0x0f;
super::vals::Mode::from_bits(val as u8)
}
#[doc = "Select HASH mode to execute."]
#[inline(always)]
pub const fn set_mode(&mut self, val: super::vals::Mode) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val.to_bits() as u32) & 0x0f) << 0usize);
}
}
impl Default for HashControl {
#[inline(always)]
fn default() -> HashControl {
HashControl(0)
}
}
impl core::fmt::Debug for HashControl {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("HashControl")
.field("mode", &self.mode())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for HashControl {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "HashControl {{ mode: {:?} }}", self.mode())
}
}
#[doc = "Configure the endianness of HASH data and padding generation."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct HashEndianness(pub u32);
impl HashEndianness {
#[doc = "Endianness of HASH data and padding generation. The default value is little-endian."]
#[must_use]
#[inline(always)]
pub const fn endian(&self) -> super::vals::Endian {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Endian::from_bits(val as u8)
}
#[doc = "Endianness of HASH data and padding generation. The default value is little-endian."]
#[inline(always)]
pub const fn set_endian(&mut self, val: super::vals::Endian) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for HashEndianness {
#[inline(always)]
fn default() -> HashEndianness {
HashEndianness(0)
}
}
impl core::fmt::Debug for HashEndianness {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("HashEndianness")
.field("endian", &self.endian())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for HashEndianness {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "HashEndianness {{ endian: {:?} }}", self.endian())
}
}
#[doc = "Hardware configuration of the HASH engine. Reset value holds the supported features."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct HashHwFlags(pub u32);
impl HashHwFlags {
#[doc = "Indicates the number of concurrent words the hash is using to compute signature."]
#[must_use]
#[inline(always)]
pub const fn cw(&self) -> super::vals::Cw {
let val = (self.0 >> 0usize) & 0x0f;
super::vals::Cw::from_bits(val as u8)
}
#[doc = "Indicates the number of concurrent words the hash is using to compute signature."]
#[inline(always)]
pub const fn set_cw(&mut self, val: super::vals::Cw) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val.to_bits() as u32) & 0x0f) << 0usize);
}
#[doc = "Indicate if Hi adders are present for each Hi value or 1 adder is shared for all Hi."]
#[must_use]
#[inline(always)]
pub const fn ch(&self) -> super::vals::Ch {
let val = (self.0 >> 4usize) & 0x0f;
super::vals::Ch::from_bits(val as u8)
}
#[doc = "Indicate if Hi adders are present for each Hi value or 1 adder is shared for all Hi."]
#[inline(always)]
pub const fn set_ch(&mut self, val: super::vals::Ch) {
self.0 = (self.0 & !(0x0f << 4usize)) | (((val.to_bits() as u32) & 0x0f) << 4usize);
}
#[doc = "Determine the granularity of word size."]
#[must_use]
#[inline(always)]
pub const fn dw(&self) -> super::vals::Dw {
let val = (self.0 >> 8usize) & 0x0f;
super::vals::Dw::from_bits(val as u8)
}
#[doc = "Determine the granularity of word size."]
#[inline(always)]
pub const fn set_dw(&mut self, val: super::vals::Dw) {
self.0 = (self.0 & !(0x0f << 8usize)) | (((val.to_bits() as u32) & 0x0f) << 8usize);
}
#[doc = "If this flag is set, the engine include SHA-512 support."]
#[must_use]
#[inline(always)]
pub const fn sha_512_exists(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine include SHA-512 support."]
#[inline(always)]
pub const fn set_sha_512_exists(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "If this flag is set, the engine include pad block support."]
#[must_use]
#[inline(always)]
pub const fn pad_exists(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine include pad block support."]
#[inline(always)]
pub const fn set_pad_exists(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "If this flag is set, the engine include MD5 support."]
#[must_use]
#[inline(always)]
pub const fn md5_exists(&self) -> bool {
let val = (self.0 >> 14usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine include MD5 support."]
#[inline(always)]
pub const fn set_md5_exists(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
}
#[doc = "If this flag is set, the engine include HMAC support."]
#[must_use]
#[inline(always)]
pub const fn hmac_exists(&self) -> bool {
let val = (self.0 >> 15usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine include HMAC support."]
#[inline(always)]
pub const fn set_hmac_exists(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
}
#[doc = "If this flag is set, the engine include SHA-256 support."]
#[must_use]
#[inline(always)]
pub const fn sha_256_exists(&self) -> bool {
let val = (self.0 >> 16usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine include SHA-256 support."]
#[inline(always)]
pub const fn set_sha_256_exists(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
}
#[doc = "If this flag is set, the engine include compare digest logic."]
#[must_use]
#[inline(always)]
pub const fn hash_compare_exists(&self) -> bool {
let val = (self.0 >> 17usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine include compare digest logic."]
#[inline(always)]
pub const fn set_hash_compare_exists(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
}
#[doc = "If this flag is set, the engine include HASH to DOUT support."]
#[must_use]
#[inline(always)]
pub const fn dump_hash_to_dout_exists(&self) -> bool {
let val = (self.0 >> 18usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine include HASH to DOUT support."]
#[inline(always)]
pub const fn set_dump_hash_to_dout_exists(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
}
}
impl Default for HashHwFlags {
#[inline(always)]
fn default() -> HashHwFlags {
HashHwFlags(0)
}
}
impl core::fmt::Debug for HashHwFlags {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("HashHwFlags")
.field("cw", &self.cw())
.field("ch", &self.ch())
.field("dw", &self.dw())
.field("sha_512_exists", &self.sha_512_exists())
.field("pad_exists", &self.pad_exists())
.field("md5_exists", &self.md5_exists())
.field("hmac_exists", &self.hmac_exists())
.field("sha_256_exists", &self.sha_256_exists())
.field("hash_compare_exists", &self.hash_compare_exists())
.field("dump_hash_to_dout_exists", &self.dump_hash_to_dout_exists())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for HashHwFlags {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "HashHwFlags {{ cw: {:?}, ch: {:?}, dw: {:?}, sha_512_exists: {=bool:?}, pad_exists: {=bool:?}, md5_exists: {=bool:?}, hmac_exists: {=bool:?}, sha_256_exists: {=bool:?}, hash_compare_exists: {=bool:?}, dump_hash_to_dout_exists: {=bool:?} }}" , self . cw () , self . ch () , self . dw () , self . sha_512_exists () , self . pad_exists () , self . md5_exists () , self . hmac_exists () , self . sha_256_exists () , self . hash_compare_exists () , self . dump_hash_to_dout_exists ())
}
}
#[doc = "Configure HASH engine initial state registers."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct HashInitState(pub u32);
impl HashInitState {
#[doc = "Enable loading of data to initial state registers. Digest/IV for HASH/AES_MAC."]
#[must_use]
#[inline(always)]
pub const fn load(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable loading of data to initial state registers. Digest/IV for HASH/AES_MAC."]
#[inline(always)]
pub const fn set_load(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for HashInitState {
#[inline(always)]
fn default() -> HashInitState {
HashInitState(0)
}
}
impl core::fmt::Debug for HashInitState {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("HashInitState")
.field("load", &self.load())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for HashInitState {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "HashInitState {{ load: {=bool:?} }}", self.load())
}
}
#[doc = "Enable the hardware padding feature of the HASH engine."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct HashPad(pub u32);
impl HashPad {
#[doc = "Configure hardware padding feature."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Configure hardware padding feature."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for HashPad {
#[inline(always)]
fn default() -> HashPad {
HashPad(0)
}
}
impl core::fmt::Debug for HashPad {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("HashPad")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for HashPad {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "HashPad {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "Configure the HASH engine to automatically pad data at the end of the DMA transfer to complete the digest operation."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct HashPadAuto(pub u32);
impl HashPadAuto {
#[doc = "Enable automatic padding in hardware."]
#[must_use]
#[inline(always)]
pub const fn hwpad(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable automatic padding in hardware."]
#[inline(always)]
pub const fn set_hwpad(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for HashPadAuto {
#[inline(always)]
fn default() -> HashPadAuto {
HashPadAuto(0)
}
}
impl core::fmt::Debug for HashPadAuto {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("HashPadAuto")
.field("hwpad", &self.hwpad())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for HashPadAuto {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "HashPadAuto {{ hwpad: {=bool:?} }}", self.hwpad())
}
}
#[doc = "Force the hardware padding operation to trigger if the input data length is zero bytes."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct HashPadForce(pub u32);
impl HashPadForce {
#[doc = "Trigger hardware padding operation."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Trigger hardware padding operation."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
}
impl Default for HashPadForce {
#[inline(always)]
fn default() -> HashPadForce {
HashPadForce(0)
}
}
impl core::fmt::Debug for HashPadForce {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("HashPadForce")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for HashPadForce {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "HashPadForce {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "Select HASH or GHASH engine as the digest engine to use."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct HashSelect(pub u32);
impl HashSelect {
#[doc = "Select HASH or GHASH engine as the digest engine."]
#[must_use]
#[inline(always)]
pub const fn engine(&self) -> super::vals::Engine {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Engine::from_bits(val as u8)
}
#[doc = "Select HASH or GHASH engine as the digest engine."]
#[inline(always)]
pub const fn set_engine(&mut self, val: super::vals::Engine) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for HashSelect {
#[inline(always)]
fn default() -> HashSelect {
HashSelect(0)
}
}
impl core::fmt::Debug for HashSelect {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("HashSelect")
.field("engine", &self.engine())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for HashSelect {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "HashSelect {{ engine: {:?} }}", self.engine())
}
}
#[doc = "Reset the HASH engine."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct HashSwReset(pub u32);
impl HashSwReset {
#[doc = "Writing any value to this address resets the HASH engine. The reset takes 4 CPU clock cycles to complete."]
#[must_use]
#[inline(always)]
pub const fn reset(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Writing any value to this address resets the HASH engine. The reset takes 4 CPU clock cycles to complete."]
#[inline(always)]
pub const fn set_reset(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for HashSwReset {
#[inline(always)]
fn default() -> HashSwReset {
HashSwReset(0)
}
}
impl core::fmt::Debug for HashSwReset {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("HashSwReset")
.field("reset", &self.reset())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for HashSwReset {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "HashSwReset {{ reset: {=bool:?} }}", self.reset())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Ch {
#[doc = "One Hi value is updated at a time."]
One = 0x0,
#[doc = "All Hi values are updated at the same time."]
All = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Ch {
#[inline(always)]
pub const fn from_bits(val: u8) -> Ch {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Ch {
#[inline(always)]
fn from(val: u8) -> Ch {
Ch::from_bits(val)
}
}
impl From<Ch> for u8 {
#[inline(always)]
fn from(val: Ch) -> u8 {
Ch::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Cw {
_RESERVED_0 = 0x0,
#[doc = "One concurrent word used by hash during signature generation."]
One = 0x01,
#[doc = "Two concurrent words used by hash during signature generation."]
Two = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Cw {
#[inline(always)]
pub const fn from_bits(val: u8) -> Cw {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Cw {
#[inline(always)]
fn from(val: u8) -> Cw {
Cw::from_bits(val)
}
}
impl From<Cw> for u8 {
#[inline(always)]
fn from(val: Cw) -> u8 {
Cw::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Dw {
#[doc = "32 bits word data."]
_32bits = 0x0,
#[doc = "64 bits word data."]
_64bits = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Dw {
#[inline(always)]
pub const fn from_bits(val: u8) -> Dw {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Dw {
#[inline(always)]
fn from(val: u8) -> Dw {
Dw::from_bits(val)
}
}
impl From<Dw> for u8 {
#[inline(always)]
fn from(val: Dw) -> u8 {
Dw::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Endian {
#[doc = "Use little-endian format for data and padding."]
LittleEndian = 0x0,
#[doc = "Use big-endian format for data and padding."]
BigEndian = 0x01,
}
impl Endian {
#[inline(always)]
pub const fn from_bits(val: u8) -> Endian {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Endian {
#[inline(always)]
fn from(val: u8) -> Endian {
Endian::from_bits(val)
}
}
impl From<Endian> for u8 {
#[inline(always)]
fn from(val: Endian) -> u8 {
Endian::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Engine {
#[doc = "Select the HASH engine."]
Hash = 0x0,
_RESERVED_1 = 0x01,
#[doc = "Select the GHASH engine."]
Ghash = 0x02,
_RESERVED_3 = 0x03,
}
impl Engine {
#[inline(always)]
pub const fn from_bits(val: u8) -> Engine {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Engine {
#[inline(always)]
fn from(val: u8) -> Engine {
Engine::from_bits(val)
}
}
impl From<Engine> for u8 {
#[inline(always)]
fn from(val: Engine) -> u8 {
Engine::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Mode {
_RESERVED_0 = 0x0,
#[doc = "Select SHA1 mode."]
Sha1 = 0x01,
#[doc = "Select SHA256 mode."]
Sha256 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
#[doc = "Select SHA224 mode."]
Sha224 = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Mode {
#[inline(always)]
pub const fn from_bits(val: u8) -> Mode {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Mode {
#[inline(always)]
fn from(val: u8) -> Mode {
Mode::from_bits(val)
}
}
impl From<Mode> for u8 {
#[inline(always)]
fn from(val: Mode) -> u8 {
Mode::to_bits(val)
}
}
}
}
pub mod cc_host_rgf {
#[doc = "CRYPTOCELL HOST register interface."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct CcHostRgf {
ptr: *mut u8,
}
unsafe impl Send for CcHostRgf {}
unsafe impl Sync for CcHostRgf {}
impl CcHostRgf {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Interrupt request register. Each bit of this register holds the interrupt status of a single interrupt source. If corresponding IMR bit is unmasked, an interrupt is generated."]
#[inline(always)]
pub const fn irr(self) -> crate::common::Reg<regs::Irr, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0a00usize) as _) }
}
#[doc = "Interrupt mask register. Each bit of this register holds the mask of a single interrupt source."]
#[inline(always)]
pub const fn imr(self) -> crate::common::Reg<regs::Imr, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0a04usize) as _) }
}
#[doc = "Interrupt clear register. Writing a 1 bit into a field in this register will clear the corresponding bit in IRR."]
#[inline(always)]
pub const fn icr(self) -> crate::common::Reg<regs::Icr, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0a08usize) as _) }
}
#[doc = "This register defines the endianness of the Host-accessible registers, and can only be written once."]
#[inline(always)]
pub const fn endianness(self) -> crate::common::Reg<regs::Endianness, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0a0cusize) as _) }
}
#[doc = "This register holds the CRYPTOCELL subsystem signature. See reset value."]
#[inline(always)]
pub const fn host_signature(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0a24usize) as _) }
}
#[doc = "Hardware configuration of the CRYPTOCELL subsystem. Reset value holds the supported features."]
#[inline(always)]
pub const fn host_boot(self) -> crate::common::Reg<regs::HostBoot, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0a28usize) as _) }
}
#[doc = "Idle state register for the CRYPTOCELL subsystem."]
#[inline(always)]
pub const fn host_cc_is_idle(
self,
) -> crate::common::Reg<regs::HostCcIsIdle, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0a7cusize) as _) }
}
#[doc = "This register start the power-down sequence."]
#[inline(always)]
pub const fn host_powerdown(
self,
) -> crate::common::Reg<regs::HostPowerdown, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0a80usize) as _) }
}
}
pub mod regs {
#[doc = "This register defines the endianness of the Host-accessible registers, and can only be written once."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Endianness(pub u32);
impl Endianness {
#[doc = "DOUT write endianness."]
#[must_use]
#[inline(always)]
pub const fn dout_wr_bg(&self) -> super::vals::DoutWrBg {
let val = (self.0 >> 3usize) & 0x01;
super::vals::DoutWrBg::from_bits(val as u8)
}
#[doc = "DOUT write endianness."]
#[inline(always)]
pub const fn set_dout_wr_bg(&mut self, val: super::vals::DoutWrBg) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val.to_bits() as u32) & 0x01) << 3usize);
}
#[doc = "DIN read endianness."]
#[must_use]
#[inline(always)]
pub const fn din_rd_bg(&self) -> super::vals::DinRdBg {
let val = (self.0 >> 7usize) & 0x01;
super::vals::DinRdBg::from_bits(val as u8)
}
#[doc = "DIN read endianness."]
#[inline(always)]
pub const fn set_din_rd_bg(&mut self, val: super::vals::DinRdBg) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val.to_bits() as u32) & 0x01) << 7usize);
}
#[doc = "DOUT write word endianness."]
#[must_use]
#[inline(always)]
pub const fn dout_wr_wbg(&self) -> super::vals::DoutWrWbg {
let val = (self.0 >> 11usize) & 0x01;
super::vals::DoutWrWbg::from_bits(val as u8)
}
#[doc = "DOUT write word endianness."]
#[inline(always)]
pub const fn set_dout_wr_wbg(&mut self, val: super::vals::DoutWrWbg) {
self.0 =
(self.0 & !(0x01 << 11usize)) | (((val.to_bits() as u32) & 0x01) << 11usize);
}
#[doc = "DIN read word endianness."]
#[must_use]
#[inline(always)]
pub const fn din_rd_wbg(&self) -> super::vals::DinRdWbg {
let val = (self.0 >> 15usize) & 0x01;
super::vals::DinRdWbg::from_bits(val as u8)
}
#[doc = "DIN read word endianness."]
#[inline(always)]
pub const fn set_din_rd_wbg(&mut self, val: super::vals::DinRdWbg) {
self.0 =
(self.0 & !(0x01 << 15usize)) | (((val.to_bits() as u32) & 0x01) << 15usize);
}
}
impl Default for Endianness {
#[inline(always)]
fn default() -> Endianness {
Endianness(0)
}
}
impl core::fmt::Debug for Endianness {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Endianness")
.field("dout_wr_bg", &self.dout_wr_bg())
.field("din_rd_bg", &self.din_rd_bg())
.field("dout_wr_wbg", &self.dout_wr_wbg())
.field("din_rd_wbg", &self.din_rd_wbg())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Endianness {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Endianness {{ dout_wr_bg: {:?}, din_rd_bg: {:?}, dout_wr_wbg: {:?}, din_rd_wbg: {:?} }}" , self . dout_wr_bg () , self . din_rd_bg () , self . dout_wr_wbg () , self . din_rd_wbg ())
}
}
#[doc = "Hardware configuration of the CRYPTOCELL subsystem. Reset value holds the supported features."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct HostBoot(pub u32);
impl HostBoot {
#[doc = "If this flag is set, full power gating is implemented."]
#[must_use]
#[inline(always)]
pub const fn power_gating_exists_local(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, full power gating is implemented."]
#[inline(always)]
pub const fn set_power_gating_exists_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "If this flag is set, large RKEK is supported."]
#[must_use]
#[inline(always)]
pub const fn large_rkek_local(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, large RKEK is supported."]
#[inline(always)]
pub const fn set_large_rkek_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "If this flag is set, HASH in fuses is supported."]
#[must_use]
#[inline(always)]
pub const fn hash_in_fuses_local(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, HASH in fuses is supported."]
#[inline(always)]
pub const fn set_hash_in_fuses_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "If this flag is set, external secure memory is supported."]
#[must_use]
#[inline(always)]
pub const fn ext_mem_secured_local(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, external secure memory is supported."]
#[inline(always)]
pub const fn set_ext_mem_secured_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "If this flag is set, RKEK ECC is supported."]
#[must_use]
#[inline(always)]
pub const fn rkek_ecc_exists_local_n(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, RKEK ECC is supported."]
#[inline(always)]
pub const fn set_rkek_ecc_exists_local_n(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "SRAM size."]
#[must_use]
#[inline(always)]
pub const fn sram_size_local(&self) -> u8 {
let val = (self.0 >> 6usize) & 0x07;
val as u8
}
#[doc = "SRAM size."]
#[inline(always)]
pub const fn set_sram_size_local(&mut self, val: u8) {
self.0 = (self.0 & !(0x07 << 6usize)) | (((val as u32) & 0x07) << 6usize);
}
#[doc = "If this flag is set, Descriptors are supported."]
#[must_use]
#[inline(always)]
pub const fn dscrptr_exists_local(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, Descriptors are supported."]
#[inline(always)]
pub const fn set_dscrptr_exists_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "If this flag is set, PAU is supported."]
#[must_use]
#[inline(always)]
pub const fn pau_exists_local(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, PAU is supported."]
#[inline(always)]
pub const fn set_pau_exists_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[doc = "If this flag is set, the RNG engine is present."]
#[must_use]
#[inline(always)]
pub const fn rng_exists_local(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the RNG engine is present."]
#[inline(always)]
pub const fn set_rng_exists_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "If this flag is set, the PKA engine is present."]
#[must_use]
#[inline(always)]
pub const fn pka_exists_local(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the PKA engine is present."]
#[inline(always)]
pub const fn set_pka_exists_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "If this flag is set, the RC4 engine is present."]
#[must_use]
#[inline(always)]
pub const fn rc4_exists_local(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the RC4 engine is present."]
#[inline(always)]
pub const fn set_rc4_exists_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "If this flag is set, the HASH engine supports SHA512."]
#[must_use]
#[inline(always)]
pub const fn sha_512_prsnt_local(&self) -> bool {
let val = (self.0 >> 14usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the HASH engine supports SHA512."]
#[inline(always)]
pub const fn set_sha_512_prsnt_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
}
#[doc = "If this flag is set, the HASH engine supports SHA256."]
#[must_use]
#[inline(always)]
pub const fn sha_256_prsnt_local(&self) -> bool {
let val = (self.0 >> 15usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the HASH engine supports SHA256."]
#[inline(always)]
pub const fn set_sha_256_prsnt_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
}
#[doc = "If this flag is set, the HASH engine supports MD5."]
#[must_use]
#[inline(always)]
pub const fn md5_prsnt_local(&self) -> bool {
let val = (self.0 >> 16usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the HASH engine supports MD5."]
#[inline(always)]
pub const fn set_md5_prsnt_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
}
#[doc = "If this flag is set, the HASH engine is present."]
#[must_use]
#[inline(always)]
pub const fn hash_exists_local(&self) -> bool {
let val = (self.0 >> 17usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the HASH engine is present."]
#[inline(always)]
pub const fn set_hash_exists_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
}
#[doc = "If this flag is set, the C2 engine is present."]
#[must_use]
#[inline(always)]
pub const fn c2_exists_local(&self) -> bool {
let val = (self.0 >> 18usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the C2 engine is present."]
#[inline(always)]
pub const fn set_c2_exists_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
}
#[doc = "If this flag is set, the DES engine is present."]
#[must_use]
#[inline(always)]
pub const fn des_exists_local(&self) -> bool {
let val = (self.0 >> 19usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the DES engine is present."]
#[inline(always)]
pub const fn set_des_exists_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
}
#[doc = "If this flag is set, AES XCBC-MAC mode is supported."]
#[must_use]
#[inline(always)]
pub const fn aes_xcbc_mac_exists_local(&self) -> bool {
let val = (self.0 >> 20usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, AES XCBC-MAC mode is supported."]
#[inline(always)]
pub const fn set_aes_xcbc_mac_exists_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
}
#[doc = "If this flag is set, AES CMAC mode is supported."]
#[must_use]
#[inline(always)]
pub const fn aes_cmac_exists_local(&self) -> bool {
let val = (self.0 >> 21usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, AES CMAC mode is supported."]
#[inline(always)]
pub const fn set_aes_cmac_exists_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize);
}
#[doc = "If this flag is set, AES CCM mode is supported."]
#[must_use]
#[inline(always)]
pub const fn aes_ccm_exists_local(&self) -> bool {
let val = (self.0 >> 22usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, AES CCM mode is supported."]
#[inline(always)]
pub const fn set_aes_ccm_exists_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 22usize)) | (((val as u32) & 0x01) << 22usize);
}
#[doc = "If this flag is set, AES XEX mode T-value calculation in HW is supported."]
#[must_use]
#[inline(always)]
pub const fn aes_xex_hw_t_calc_local(&self) -> bool {
let val = (self.0 >> 23usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, AES XEX mode T-value calculation in HW is supported."]
#[inline(always)]
pub const fn set_aes_xex_hw_t_calc_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize);
}
#[doc = "If this flag is set, AES XEX mode is supported."]
#[must_use]
#[inline(always)]
pub const fn aes_xex_exists_local(&self) -> bool {
let val = (self.0 >> 24usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, AES XEX mode is supported."]
#[inline(always)]
pub const fn set_aes_xex_exists_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
}
#[doc = "If this flag is set, AES CTR mode is supported."]
#[must_use]
#[inline(always)]
pub const fn ctr_exists_local(&self) -> bool {
let val = (self.0 >> 25usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, AES CTR mode is supported."]
#[inline(always)]
pub const fn set_ctr_exists_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize);
}
#[doc = "If this flag is set, the AES engine data input support byte size resolution."]
#[must_use]
#[inline(always)]
pub const fn aes_din_byte_resolution_local(&self) -> bool {
let val = (self.0 >> 26usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the AES engine data input support byte size resolution."]
#[inline(always)]
pub const fn set_aes_din_byte_resolution_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
}
#[doc = "If this flag is set, the AES engine supports tunneling operations."]
#[must_use]
#[inline(always)]
pub const fn tunneling_enb_local(&self) -> bool {
let val = (self.0 >> 27usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the AES engine supports tunneling operations."]
#[inline(always)]
pub const fn set_tunneling_enb_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 27usize)) | (((val as u32) & 0x01) << 27usize);
}
#[doc = "If this flag is set, the AES engine supports 192/256 bits key sizes."]
#[must_use]
#[inline(always)]
pub const fn support_256_192_key_local(&self) -> bool {
let val = (self.0 >> 28usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the AES engine supports 192/256 bits key sizes."]
#[inline(always)]
pub const fn set_support_256_192_key_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize);
}
#[doc = "If this flag is set, the AES engine only support encryption."]
#[must_use]
#[inline(always)]
pub const fn only_encrypt_local(&self) -> bool {
let val = (self.0 >> 29usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the AES engine only support encryption."]
#[inline(always)]
pub const fn set_only_encrypt_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize);
}
#[doc = "If this flag is set, the AES engine is present."]
#[must_use]
#[inline(always)]
pub const fn aes_exists_local(&self) -> bool {
let val = (self.0 >> 30usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the AES engine is present."]
#[inline(always)]
pub const fn set_aes_exists_local(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize);
}
}
impl Default for HostBoot {
#[inline(always)]
fn default() -> HostBoot {
HostBoot(0)
}
}
impl core::fmt::Debug for HostBoot {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("HostBoot")
.field(
"power_gating_exists_local",
&self.power_gating_exists_local(),
)
.field("large_rkek_local", &self.large_rkek_local())
.field("hash_in_fuses_local", &self.hash_in_fuses_local())
.field("ext_mem_secured_local", &self.ext_mem_secured_local())
.field("rkek_ecc_exists_local_n", &self.rkek_ecc_exists_local_n())
.field("sram_size_local", &self.sram_size_local())
.field("dscrptr_exists_local", &self.dscrptr_exists_local())
.field("pau_exists_local", &self.pau_exists_local())
.field("rng_exists_local", &self.rng_exists_local())
.field("pka_exists_local", &self.pka_exists_local())
.field("rc4_exists_local", &self.rc4_exists_local())
.field("sha_512_prsnt_local", &self.sha_512_prsnt_local())
.field("sha_256_prsnt_local", &self.sha_256_prsnt_local())
.field("md5_prsnt_local", &self.md5_prsnt_local())
.field("hash_exists_local", &self.hash_exists_local())
.field("c2_exists_local", &self.c2_exists_local())
.field("des_exists_local", &self.des_exists_local())
.field(
"aes_xcbc_mac_exists_local",
&self.aes_xcbc_mac_exists_local(),
)
.field("aes_cmac_exists_local", &self.aes_cmac_exists_local())
.field("aes_ccm_exists_local", &self.aes_ccm_exists_local())
.field("aes_xex_hw_t_calc_local", &self.aes_xex_hw_t_calc_local())
.field("aes_xex_exists_local", &self.aes_xex_exists_local())
.field("ctr_exists_local", &self.ctr_exists_local())
.field(
"aes_din_byte_resolution_local",
&self.aes_din_byte_resolution_local(),
)
.field("tunneling_enb_local", &self.tunneling_enb_local())
.field(
"support_256_192_key_local",
&self.support_256_192_key_local(),
)
.field("only_encrypt_local", &self.only_encrypt_local())
.field("aes_exists_local", &self.aes_exists_local())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for HostBoot {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "HostBoot {{ power_gating_exists_local: {=bool:?}, large_rkek_local: {=bool:?}, hash_in_fuses_local: {=bool:?}, ext_mem_secured_local: {=bool:?}, rkek_ecc_exists_local_n: {=bool:?}, sram_size_local: {=u8:?}, dscrptr_exists_local: {=bool:?}, pau_exists_local: {=bool:?}, rng_exists_local: {=bool:?}, pka_exists_local: {=bool:?}, rc4_exists_local: {=bool:?}, sha_512_prsnt_local: {=bool:?}, sha_256_prsnt_local: {=bool:?}, md5_prsnt_local: {=bool:?}, hash_exists_local: {=bool:?}, c2_exists_local: {=bool:?}, des_exists_local: {=bool:?}, aes_xcbc_mac_exists_local: {=bool:?}, aes_cmac_exists_local: {=bool:?}, aes_ccm_exists_local: {=bool:?}, aes_xex_hw_t_calc_local: {=bool:?}, aes_xex_exists_local: {=bool:?}, ctr_exists_local: {=bool:?}, aes_din_byte_resolution_local: {=bool:?}, tunneling_enb_local: {=bool:?}, support_256_192_key_local: {=bool:?}, only_encrypt_local: {=bool:?}, aes_exists_local: {=bool:?} }}" , self . power_gating_exists_local () , self . large_rkek_local () , self . hash_in_fuses_local () , self . ext_mem_secured_local () , self . rkek_ecc_exists_local_n () , self . sram_size_local () , self . dscrptr_exists_local () , self . pau_exists_local () , self . rng_exists_local () , self . pka_exists_local () , self . rc4_exists_local () , self . sha_512_prsnt_local () , self . sha_256_prsnt_local () , self . md5_prsnt_local () , self . hash_exists_local () , self . c2_exists_local () , self . des_exists_local () , self . aes_xcbc_mac_exists_local () , self . aes_cmac_exists_local () , self . aes_ccm_exists_local () , self . aes_xex_hw_t_calc_local () , self . aes_xex_exists_local () , self . ctr_exists_local () , self . aes_din_byte_resolution_local () , self . tunneling_enb_local () , self . support_256_192_key_local () , self . only_encrypt_local () , self . aes_exists_local ())
}
}
#[doc = "Idle state register for the CRYPTOCELL subsystem."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct HostCcIsIdle(pub u32);
impl HostCcIsIdle {
#[doc = "CRYPTOCELL idle state."]
#[must_use]
#[inline(always)]
pub const fn host_cc_is_idle(&self) -> super::vals::HostCcIsIdle {
let val = (self.0 >> 0usize) & 0x01;
super::vals::HostCcIsIdle::from_bits(val as u8)
}
#[doc = "CRYPTOCELL idle state."]
#[inline(always)]
pub const fn set_host_cc_is_idle(&mut self, val: super::vals::HostCcIsIdle) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "Symmetric flow busy state."]
#[must_use]
#[inline(always)]
pub const fn sym_is_busy(&self) -> super::vals::SymIsBusy {
let val = (self.0 >> 2usize) & 0x01;
super::vals::SymIsBusy::from_bits(val as u8)
}
#[doc = "Symmetric flow busy state."]
#[inline(always)]
pub const fn set_sym_is_busy(&mut self, val: super::vals::SymIsBusy) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val.to_bits() as u32) & 0x01) << 2usize);
}
#[doc = "AHB state machine idle state."]
#[must_use]
#[inline(always)]
pub const fn ahb_is_idle(&self) -> super::vals::AhbIsIdle {
let val = (self.0 >> 3usize) & 0x01;
super::vals::AhbIsIdle::from_bits(val as u8)
}
#[doc = "AHB state machine idle state."]
#[inline(always)]
pub const fn set_ahb_is_idle(&mut self, val: super::vals::AhbIsIdle) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val.to_bits() as u32) & 0x01) << 3usize);
}
#[doc = "RNG engine idle state."]
#[must_use]
#[inline(always)]
pub const fn rng_is_idle(&self) -> super::vals::RngIsIdle {
let val = (self.0 >> 7usize) & 0x01;
super::vals::RngIsIdle::from_bits(val as u8)
}
#[doc = "RNG engine idle state."]
#[inline(always)]
pub const fn set_rng_is_idle(&mut self, val: super::vals::RngIsIdle) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val.to_bits() as u32) & 0x01) << 7usize);
}
#[doc = "PKA engine idle state."]
#[must_use]
#[inline(always)]
pub const fn pka_is_idle(&self) -> super::vals::PkaIsIdle {
let val = (self.0 >> 8usize) & 0x01;
super::vals::PkaIsIdle::from_bits(val as u8)
}
#[doc = "PKA engine idle state."]
#[inline(always)]
pub const fn set_pka_is_idle(&mut self, val: super::vals::PkaIsIdle) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val.to_bits() as u32) & 0x01) << 8usize);
}
#[doc = "Cryptographic flow idle state."]
#[must_use]
#[inline(always)]
pub const fn crypto_is_idle(&self) -> super::vals::CryptoIsIdle {
let val = (self.0 >> 9usize) & 0x01;
super::vals::CryptoIsIdle::from_bits(val as u8)
}
#[doc = "Cryptographic flow idle state."]
#[inline(always)]
pub const fn set_crypto_is_idle(&mut self, val: super::vals::CryptoIsIdle) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val.to_bits() as u32) & 0x01) << 9usize);
}
}
impl Default for HostCcIsIdle {
#[inline(always)]
fn default() -> HostCcIsIdle {
HostCcIsIdle(0)
}
}
impl core::fmt::Debug for HostCcIsIdle {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("HostCcIsIdle")
.field("host_cc_is_idle", &self.host_cc_is_idle())
.field("sym_is_busy", &self.sym_is_busy())
.field("ahb_is_idle", &self.ahb_is_idle())
.field("rng_is_idle", &self.rng_is_idle())
.field("pka_is_idle", &self.pka_is_idle())
.field("crypto_is_idle", &self.crypto_is_idle())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for HostCcIsIdle {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "HostCcIsIdle {{ host_cc_is_idle: {:?}, sym_is_busy: {:?}, ahb_is_idle: {:?}, rng_is_idle: {:?}, pka_is_idle: {:?}, crypto_is_idle: {:?} }}" , self . host_cc_is_idle () , self . sym_is_busy () , self . ahb_is_idle () , self . rng_is_idle () , self . pka_is_idle () , self . crypto_is_idle ())
}
}
#[doc = "This register start the power-down sequence."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct HostPowerdown(pub u32);
impl HostPowerdown {
#[doc = "Power down enable register."]
#[must_use]
#[inline(always)]
pub const fn host_powerdown(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Power down enable register."]
#[inline(always)]
pub const fn set_host_powerdown(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for HostPowerdown {
#[inline(always)]
fn default() -> HostPowerdown {
HostPowerdown(0)
}
}
impl core::fmt::Debug for HostPowerdown {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("HostPowerdown")
.field("host_powerdown", &self.host_powerdown())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for HostPowerdown {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"HostPowerdown {{ host_powerdown: {=bool:?} }}",
self.host_powerdown()
)
}
}
#[doc = "Interrupt clear register. Writing a 1 bit into a field in this register will clear the corresponding bit in IRR."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Icr(pub u32);
impl Icr {
#[doc = "The RNG SRAM to DIN DMA done interrupt clear."]
#[must_use]
#[inline(always)]
pub const fn sram_to_din_clear(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "The RNG SRAM to DIN DMA done interrupt clear."]
#[inline(always)]
pub const fn set_sram_to_din_clear(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "The DOUT to RNG SRAM DMA done interrupt clear."]
#[must_use]
#[inline(always)]
pub const fn dout_to_sram_clear(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "The DOUT to RNG SRAM DMA done interrupt clear."]
#[inline(always)]
pub const fn set_dout_to_sram_clear(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "The memory to DIN DMA done interrupt clear."]
#[must_use]
#[inline(always)]
pub const fn mem_to_din_clear(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "The memory to DIN DMA done interrupt clear."]
#[inline(always)]
pub const fn set_mem_to_din_clear(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "The DOUT to memory DMA done interrupt clear."]
#[must_use]
#[inline(always)]
pub const fn dout_to_mem_clear(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "The DOUT to memory DMA done interrupt clear."]
#[inline(always)]
pub const fn set_dout_to_mem_clear(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "The AHB error interrupt clear."]
#[must_use]
#[inline(always)]
pub const fn ahb_err_clear(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "The AHB error interrupt clear."]
#[inline(always)]
pub const fn set_ahb_err_clear(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "The PKA end of operation interrupt clear."]
#[must_use]
#[inline(always)]
pub const fn pka_clear(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "The PKA end of operation interrupt clear."]
#[inline(always)]
pub const fn set_pka_clear(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "The RNG interrupt clear. Register RNG_ISR in the RNG engine must be cleared before this interrupt can be cleared."]
#[must_use]
#[inline(always)]
pub const fn rng_clear(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "The RNG interrupt clear. Register RNG_ISR in the RNG engine must be cleared before this interrupt can be cleared."]
#[inline(always)]
pub const fn set_rng_clear(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[doc = "The symmetric engine DMA completed interrupt clear."]
#[must_use]
#[inline(always)]
pub const fn sym_dma_clear(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "The symmetric engine DMA completed interrupt clear."]
#[inline(always)]
pub const fn set_sym_dma_clear(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
}
impl Default for Icr {
#[inline(always)]
fn default() -> Icr {
Icr(0)
}
}
impl core::fmt::Debug for Icr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Icr")
.field("sram_to_din_clear", &self.sram_to_din_clear())
.field("dout_to_sram_clear", &self.dout_to_sram_clear())
.field("mem_to_din_clear", &self.mem_to_din_clear())
.field("dout_to_mem_clear", &self.dout_to_mem_clear())
.field("ahb_err_clear", &self.ahb_err_clear())
.field("pka_clear", &self.pka_clear())
.field("rng_clear", &self.rng_clear())
.field("sym_dma_clear", &self.sym_dma_clear())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Icr {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Icr {{ sram_to_din_clear: {=bool:?}, dout_to_sram_clear: {=bool:?}, mem_to_din_clear: {=bool:?}, dout_to_mem_clear: {=bool:?}, ahb_err_clear: {=bool:?}, pka_clear: {=bool:?}, rng_clear: {=bool:?}, sym_dma_clear: {=bool:?} }}" , self . sram_to_din_clear () , self . dout_to_sram_clear () , self . mem_to_din_clear () , self . dout_to_mem_clear () , self . ahb_err_clear () , self . pka_clear () , self . rng_clear () , self . sym_dma_clear ())
}
}
#[doc = "Interrupt mask register. Each bit of this register holds the mask of a single interrupt source."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Imr(pub u32);
impl Imr {
#[doc = "The RNG SRAM to DIN DMA done interrupt mask."]
#[must_use]
#[inline(always)]
pub const fn sram_to_din_mask(&self) -> super::vals::SramToDinMask {
let val = (self.0 >> 4usize) & 0x01;
super::vals::SramToDinMask::from_bits(val as u8)
}
#[doc = "The RNG SRAM to DIN DMA done interrupt mask."]
#[inline(always)]
pub const fn set_sram_to_din_mask(&mut self, val: super::vals::SramToDinMask) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val.to_bits() as u32) & 0x01) << 4usize);
}
#[doc = "The DOUT to RNG SRAM DMA done interrupt mask."]
#[must_use]
#[inline(always)]
pub const fn dout_to_sram_mask(&self) -> super::vals::DoutToSramMask {
let val = (self.0 >> 5usize) & 0x01;
super::vals::DoutToSramMask::from_bits(val as u8)
}
#[doc = "The DOUT to RNG SRAM DMA done interrupt mask."]
#[inline(always)]
pub const fn set_dout_to_sram_mask(&mut self, val: super::vals::DoutToSramMask) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val.to_bits() as u32) & 0x01) << 5usize);
}
#[doc = "The memory to DIN DMA done interrupt mask."]
#[must_use]
#[inline(always)]
pub const fn mem_to_din_mask(&self) -> super::vals::MemToDinMask {
let val = (self.0 >> 6usize) & 0x01;
super::vals::MemToDinMask::from_bits(val as u8)
}
#[doc = "The memory to DIN DMA done interrupt mask."]
#[inline(always)]
pub const fn set_mem_to_din_mask(&mut self, val: super::vals::MemToDinMask) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val.to_bits() as u32) & 0x01) << 6usize);
}
#[doc = "The DOUT to memory DMA done interrupt mask."]
#[must_use]
#[inline(always)]
pub const fn dout_to_mem_mask(&self) -> super::vals::DoutToMemMask {
let val = (self.0 >> 7usize) & 0x01;
super::vals::DoutToMemMask::from_bits(val as u8)
}
#[doc = "The DOUT to memory DMA done interrupt mask."]
#[inline(always)]
pub const fn set_dout_to_mem_mask(&mut self, val: super::vals::DoutToMemMask) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val.to_bits() as u32) & 0x01) << 7usize);
}
#[doc = "The AHB error interrupt mask."]
#[must_use]
#[inline(always)]
pub const fn ahb_err_mask(&self) -> super::vals::AhbErrMask {
let val = (self.0 >> 8usize) & 0x01;
super::vals::AhbErrMask::from_bits(val as u8)
}
#[doc = "The AHB error interrupt mask."]
#[inline(always)]
pub const fn set_ahb_err_mask(&mut self, val: super::vals::AhbErrMask) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val.to_bits() as u32) & 0x01) << 8usize);
}
#[doc = "The PKA end of operation interrupt mask."]
#[must_use]
#[inline(always)]
pub const fn pka_mask(&self) -> super::vals::PkaMask {
let val = (self.0 >> 9usize) & 0x01;
super::vals::PkaMask::from_bits(val as u8)
}
#[doc = "The PKA end of operation interrupt mask."]
#[inline(always)]
pub const fn set_pka_mask(&mut self, val: super::vals::PkaMask) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val.to_bits() as u32) & 0x01) << 9usize);
}
#[doc = "The RNG interrupt mask."]
#[must_use]
#[inline(always)]
pub const fn rng_mask(&self) -> super::vals::RngMask {
let val = (self.0 >> 10usize) & 0x01;
super::vals::RngMask::from_bits(val as u8)
}
#[doc = "The RNG interrupt mask."]
#[inline(always)]
pub const fn set_rng_mask(&mut self, val: super::vals::RngMask) {
self.0 =
(self.0 & !(0x01 << 10usize)) | (((val.to_bits() as u32) & 0x01) << 10usize);
}
#[doc = "The symmetric engine DMA completed interrupt mask."]
#[must_use]
#[inline(always)]
pub const fn sym_dma_mask(&self) -> super::vals::SymDmaMask {
let val = (self.0 >> 11usize) & 0x01;
super::vals::SymDmaMask::from_bits(val as u8)
}
#[doc = "The symmetric engine DMA completed interrupt mask."]
#[inline(always)]
pub const fn set_sym_dma_mask(&mut self, val: super::vals::SymDmaMask) {
self.0 =
(self.0 & !(0x01 << 11usize)) | (((val.to_bits() as u32) & 0x01) << 11usize);
}
}
impl Default for Imr {
#[inline(always)]
fn default() -> Imr {
Imr(0)
}
}
impl core::fmt::Debug for Imr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Imr")
.field("sram_to_din_mask", &self.sram_to_din_mask())
.field("dout_to_sram_mask", &self.dout_to_sram_mask())
.field("mem_to_din_mask", &self.mem_to_din_mask())
.field("dout_to_mem_mask", &self.dout_to_mem_mask())
.field("ahb_err_mask", &self.ahb_err_mask())
.field("pka_mask", &self.pka_mask())
.field("rng_mask", &self.rng_mask())
.field("sym_dma_mask", &self.sym_dma_mask())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Imr {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Imr {{ sram_to_din_mask: {:?}, dout_to_sram_mask: {:?}, mem_to_din_mask: {:?}, dout_to_mem_mask: {:?}, ahb_err_mask: {:?}, pka_mask: {:?}, rng_mask: {:?}, sym_dma_mask: {:?} }}" , self . sram_to_din_mask () , self . dout_to_sram_mask () , self . mem_to_din_mask () , self . dout_to_mem_mask () , self . ahb_err_mask () , self . pka_mask () , self . rng_mask () , self . sym_dma_mask ())
}
}
#[doc = "Interrupt request register. Each bit of this register holds the interrupt status of a single interrupt source. If corresponding IMR bit is unmasked, an interrupt is generated."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Irr(pub u32);
impl Irr {
#[doc = "The RNG SRAM to DIN DMA done interrupt status. This interrupt is asserted when all data was delivered from RNG SRAM to DIN buffer."]
#[must_use]
#[inline(always)]
pub const fn sram_to_din_int(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "The RNG SRAM to DIN DMA done interrupt status. This interrupt is asserted when all data was delivered from RNG SRAM to DIN buffer."]
#[inline(always)]
pub const fn set_sram_to_din_int(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "The DOUT to RNG SRAM DMA done interrupt status. This interrupt is asserted when all data was delivered from DOUT buffer to RNG SRAM."]
#[must_use]
#[inline(always)]
pub const fn dout_to_sram_int(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "The DOUT to RNG SRAM DMA done interrupt status. This interrupt is asserted when all data was delivered from DOUT buffer to RNG SRAM."]
#[inline(always)]
pub const fn set_dout_to_sram_int(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "The memory to DIN DMA done interrupt status. This interrupt is asserted when all data was delivered from memory to DIN buffer."]
#[must_use]
#[inline(always)]
pub const fn mem_to_din_int(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "The memory to DIN DMA done interrupt status. This interrupt is asserted when all data was delivered from memory to DIN buffer."]
#[inline(always)]
pub const fn set_mem_to_din_int(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "The DOUT to memory DMA done interrupt status. This interrupt is asserted when all data was delivered from DOUT buffer to memory."]
#[must_use]
#[inline(always)]
pub const fn dout_to_mem_int(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "The DOUT to memory DMA done interrupt status. This interrupt is asserted when all data was delivered from DOUT buffer to memory."]
#[inline(always)]
pub const fn set_dout_to_mem_int(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "The AHB error interrupt status."]
#[must_use]
#[inline(always)]
pub const fn ahb_err_int(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "The AHB error interrupt status."]
#[inline(always)]
pub const fn set_ahb_err_int(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "The PKA end of operation interrupt status."]
#[must_use]
#[inline(always)]
pub const fn pka_int(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "The PKA end of operation interrupt status."]
#[inline(always)]
pub const fn set_pka_int(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "The RNG interrupt status."]
#[must_use]
#[inline(always)]
pub const fn rng_int(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "The RNG interrupt status."]
#[inline(always)]
pub const fn set_rng_int(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[doc = "The symmetric engine DMA completed interrupt status."]
#[must_use]
#[inline(always)]
pub const fn sym_dma_int(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "The symmetric engine DMA completed interrupt status."]
#[inline(always)]
pub const fn set_sym_dma_int(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
}
impl Default for Irr {
#[inline(always)]
fn default() -> Irr {
Irr(0)
}
}
impl core::fmt::Debug for Irr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Irr")
.field("sram_to_din_int", &self.sram_to_din_int())
.field("dout_to_sram_int", &self.dout_to_sram_int())
.field("mem_to_din_int", &self.mem_to_din_int())
.field("dout_to_mem_int", &self.dout_to_mem_int())
.field("ahb_err_int", &self.ahb_err_int())
.field("pka_int", &self.pka_int())
.field("rng_int", &self.rng_int())
.field("sym_dma_int", &self.sym_dma_int())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Irr {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Irr {{ sram_to_din_int: {=bool:?}, dout_to_sram_int: {=bool:?}, mem_to_din_int: {=bool:?}, dout_to_mem_int: {=bool:?}, ahb_err_int: {=bool:?}, pka_int: {=bool:?}, rng_int: {=bool:?}, sym_dma_int: {=bool:?} }}" , self . sram_to_din_int () , self . dout_to_sram_int () , self . mem_to_din_int () , self . dout_to_mem_int () , self . ahb_err_int () , self . pka_int () , self . rng_int () , self . sym_dma_int ())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum AhbErrMask {
#[doc = "Do not mask AHB error interrupt i.e. interrupt is generated."]
IrqEnable = 0x0,
#[doc = "Mask AHB error interrupt i.e. no interrupt is generated."]
IrqDisable = 0x01,
}
impl AhbErrMask {
#[inline(always)]
pub const fn from_bits(val: u8) -> AhbErrMask {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for AhbErrMask {
#[inline(always)]
fn from(val: u8) -> AhbErrMask {
AhbErrMask::from_bits(val)
}
}
impl From<AhbErrMask> for u8 {
#[inline(always)]
fn from(val: AhbErrMask) -> u8 {
AhbErrMask::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum AhbIsIdle {
#[doc = "AHB state machine busy."]
Busy = 0x0,
#[doc = "AHB state machine idle."]
Idle = 0x01,
}
impl AhbIsIdle {
#[inline(always)]
pub const fn from_bits(val: u8) -> AhbIsIdle {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for AhbIsIdle {
#[inline(always)]
fn from(val: u8) -> AhbIsIdle {
AhbIsIdle::from_bits(val)
}
}
impl From<AhbIsIdle> for u8 {
#[inline(always)]
fn from(val: AhbIsIdle) -> u8 {
AhbIsIdle::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum CryptoIsIdle {
#[doc = "Cryptographic flow busy."]
Busy = 0x0,
#[doc = "Cryptographic flow idle."]
Idle = 0x01,
}
impl CryptoIsIdle {
#[inline(always)]
pub const fn from_bits(val: u8) -> CryptoIsIdle {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for CryptoIsIdle {
#[inline(always)]
fn from(val: u8) -> CryptoIsIdle {
CryptoIsIdle::from_bits(val)
}
}
impl From<CryptoIsIdle> for u8 {
#[inline(always)]
fn from(val: CryptoIsIdle) -> u8 {
CryptoIsIdle::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum DinRdBg {
#[doc = "Configure DIN read as little-endian."]
LittleEndian = 0x0,
#[doc = "Configure DIN read as big-endian."]
BigEndian = 0x01,
}
impl DinRdBg {
#[inline(always)]
pub const fn from_bits(val: u8) -> DinRdBg {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for DinRdBg {
#[inline(always)]
fn from(val: u8) -> DinRdBg {
DinRdBg::from_bits(val)
}
}
impl From<DinRdBg> for u8 {
#[inline(always)]
fn from(val: DinRdBg) -> u8 {
DinRdBg::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum DinRdWbg {
#[doc = "Configure DIN read word as little-endian."]
LittleEndian = 0x0,
#[doc = "Configure DIN read word as big-endian."]
BigEndian = 0x01,
}
impl DinRdWbg {
#[inline(always)]
pub const fn from_bits(val: u8) -> DinRdWbg {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for DinRdWbg {
#[inline(always)]
fn from(val: u8) -> DinRdWbg {
DinRdWbg::from_bits(val)
}
}
impl From<DinRdWbg> for u8 {
#[inline(always)]
fn from(val: DinRdWbg) -> u8 {
DinRdWbg::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum DoutToMemMask {
#[doc = "Do not mask DOUT to memory DMA done interrupt i.e. interrupt is generated."]
IrqEnable = 0x0,
#[doc = "Mask DOUT to memory DMA done interrupt i.e. no interrupt is generated."]
IrqDisable = 0x01,
}
impl DoutToMemMask {
#[inline(always)]
pub const fn from_bits(val: u8) -> DoutToMemMask {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for DoutToMemMask {
#[inline(always)]
fn from(val: u8) -> DoutToMemMask {
DoutToMemMask::from_bits(val)
}
}
impl From<DoutToMemMask> for u8 {
#[inline(always)]
fn from(val: DoutToMemMask) -> u8 {
DoutToMemMask::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum DoutToSramMask {
#[doc = "Do not mask DOUT to RNG SRAM DMA done interrupt i.e. interrupt is generated."]
IrqEnable = 0x0,
#[doc = "Mask DOUT to RNG SRAM DMA done interrupt i.e. no interrupt is generated."]
IrqDisable = 0x01,
}
impl DoutToSramMask {
#[inline(always)]
pub const fn from_bits(val: u8) -> DoutToSramMask {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for DoutToSramMask {
#[inline(always)]
fn from(val: u8) -> DoutToSramMask {
DoutToSramMask::from_bits(val)
}
}
impl From<DoutToSramMask> for u8 {
#[inline(always)]
fn from(val: DoutToSramMask) -> u8 {
DoutToSramMask::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum DoutWrBg {
#[doc = "Configure DOUT write as little-endian."]
LittleEndian = 0x0,
#[doc = "Configure DOUT write as big-endian."]
BigEndian = 0x01,
}
impl DoutWrBg {
#[inline(always)]
pub const fn from_bits(val: u8) -> DoutWrBg {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for DoutWrBg {
#[inline(always)]
fn from(val: u8) -> DoutWrBg {
DoutWrBg::from_bits(val)
}
}
impl From<DoutWrBg> for u8 {
#[inline(always)]
fn from(val: DoutWrBg) -> u8 {
DoutWrBg::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum DoutWrWbg {
#[doc = "Configure DOUT write word as little-endian."]
LittleEndian = 0x0,
#[doc = "Configure DOUT write word as big-endian."]
BigEndian = 0x01,
}
impl DoutWrWbg {
#[inline(always)]
pub const fn from_bits(val: u8) -> DoutWrWbg {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for DoutWrWbg {
#[inline(always)]
fn from(val: u8) -> DoutWrWbg {
DoutWrWbg::from_bits(val)
}
}
impl From<DoutWrWbg> for u8 {
#[inline(always)]
fn from(val: DoutWrWbg) -> u8 {
DoutWrWbg::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum HostCcIsIdle {
#[doc = "CRYPTOCELL subsystem busy."]
Busy = 0x0,
#[doc = "CRYPTOCELL subsystem idle."]
Idle = 0x01,
}
impl HostCcIsIdle {
#[inline(always)]
pub const fn from_bits(val: u8) -> HostCcIsIdle {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for HostCcIsIdle {
#[inline(always)]
fn from(val: u8) -> HostCcIsIdle {
HostCcIsIdle::from_bits(val)
}
}
impl From<HostCcIsIdle> for u8 {
#[inline(always)]
fn from(val: HostCcIsIdle) -> u8 {
HostCcIsIdle::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum MemToDinMask {
#[doc = "Do not mask memory to DIN DMA done interrupt i.e. interrupt is generated."]
IrqEnable = 0x0,
#[doc = "Mask memory to DIN DMA done interrupt i.e. no interrupt is generated."]
IrqDisable = 0x01,
}
impl MemToDinMask {
#[inline(always)]
pub const fn from_bits(val: u8) -> MemToDinMask {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for MemToDinMask {
#[inline(always)]
fn from(val: u8) -> MemToDinMask {
MemToDinMask::from_bits(val)
}
}
impl From<MemToDinMask> for u8 {
#[inline(always)]
fn from(val: MemToDinMask) -> u8 {
MemToDinMask::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum PkaIsIdle {
#[doc = "PKA engine busy."]
Busy = 0x0,
#[doc = "PKA engine idle."]
Idle = 0x01,
}
impl PkaIsIdle {
#[inline(always)]
pub const fn from_bits(val: u8) -> PkaIsIdle {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for PkaIsIdle {
#[inline(always)]
fn from(val: u8) -> PkaIsIdle {
PkaIsIdle::from_bits(val)
}
}
impl From<PkaIsIdle> for u8 {
#[inline(always)]
fn from(val: PkaIsIdle) -> u8 {
PkaIsIdle::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum PkaMask {
#[doc = "Do not mask PKA end of operation interrupt i.e. interrupt is generated."]
IrqEnable = 0x0,
#[doc = "Mask PKA end of operation interrupt i.e. no interrupt is generated."]
IrqDisable = 0x01,
}
impl PkaMask {
#[inline(always)]
pub const fn from_bits(val: u8) -> PkaMask {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for PkaMask {
#[inline(always)]
fn from(val: u8) -> PkaMask {
PkaMask::from_bits(val)
}
}
impl From<PkaMask> for u8 {
#[inline(always)]
fn from(val: PkaMask) -> u8 {
PkaMask::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RngIsIdle {
#[doc = "RNG engine busy."]
Busy = 0x0,
#[doc = "RNG engine idle."]
Idle = 0x01,
}
impl RngIsIdle {
#[inline(always)]
pub const fn from_bits(val: u8) -> RngIsIdle {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for RngIsIdle {
#[inline(always)]
fn from(val: u8) -> RngIsIdle {
RngIsIdle::from_bits(val)
}
}
impl From<RngIsIdle> for u8 {
#[inline(always)]
fn from(val: RngIsIdle) -> u8 {
RngIsIdle::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RngMask {
#[doc = "Do not mask RNG interrupt i.e. interrupt is generated."]
IrqEnable = 0x0,
#[doc = "Mask RNG interrupt i.e. no interrupt is generated."]
IrqDisable = 0x01,
}
impl RngMask {
#[inline(always)]
pub const fn from_bits(val: u8) -> RngMask {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for RngMask {
#[inline(always)]
fn from(val: u8) -> RngMask {
RngMask::from_bits(val)
}
}
impl From<RngMask> for u8 {
#[inline(always)]
fn from(val: RngMask) -> u8 {
RngMask::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum SramToDinMask {
#[doc = "Do not mask RNG SRAM to DIN DMA done interrupt i.e. interrupt is generated."]
IrqEnable = 0x0,
#[doc = "Mask RNG SRAM to DIN DMA done interrupt i.e. no interrupt is generated."]
IrqDisable = 0x01,
}
impl SramToDinMask {
#[inline(always)]
pub const fn from_bits(val: u8) -> SramToDinMask {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for SramToDinMask {
#[inline(always)]
fn from(val: u8) -> SramToDinMask {
SramToDinMask::from_bits(val)
}
}
impl From<SramToDinMask> for u8 {
#[inline(always)]
fn from(val: SramToDinMask) -> u8 {
SramToDinMask::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum SymDmaMask {
#[doc = "Do not mask the symmetric engine DMA completed interrupt i.e. interrupt is generated."]
IrqEnable = 0x0,
#[doc = "Mask the symmetric engine DMA completed interrupt i.e. no interrupt is generated."]
IrqDisable = 0x01,
}
impl SymDmaMask {
#[inline(always)]
pub const fn from_bits(val: u8) -> SymDmaMask {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for SymDmaMask {
#[inline(always)]
fn from(val: u8) -> SymDmaMask {
SymDmaMask::from_bits(val)
}
}
impl From<SymDmaMask> for u8 {
#[inline(always)]
fn from(val: SymDmaMask) -> u8 {
SymDmaMask::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum SymIsBusy {
#[doc = "Symmetric flow idle."]
Idle = 0x0,
#[doc = "Symmetric flow busy."]
Busy = 0x01,
}
impl SymIsBusy {
#[inline(always)]
pub const fn from_bits(val: u8) -> SymIsBusy {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for SymIsBusy {
#[inline(always)]
fn from(val: u8) -> SymIsBusy {
SymIsBusy::from_bits(val)
}
}
impl From<SymIsBusy> for u8 {
#[inline(always)]
fn from(val: SymIsBusy) -> u8 {
SymIsBusy::to_bits(val)
}
}
}
}
pub mod cc_misc {
#[doc = "CRYPTOCELL MISC interface."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct CcMisc {
ptr: *mut u8,
}
unsafe impl Send for CcMisc {}
unsafe impl Sync for CcMisc {}
impl CcMisc {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Clock control for the AES engine."]
#[inline(always)]
pub const fn aes_clk(self) -> crate::common::Reg<regs::AesClk, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0810usize) as _) }
}
#[doc = "Clock control for the HASH engine."]
#[inline(always)]
pub const fn hash_clk(self) -> crate::common::Reg<regs::HashClk, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0818usize) as _) }
}
#[doc = "Clock control for the PKA engine."]
#[inline(always)]
pub const fn pka_clk(self) -> crate::common::Reg<regs::PkaClk, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x081cusize) as _) }
}
#[doc = "Clock control for the DMA engines."]
#[inline(always)]
pub const fn dma_clk(self) -> crate::common::Reg<regs::DmaClk, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0820usize) as _) }
}
#[doc = "CRYPTOCELL clocks status register."]
#[inline(always)]
pub const fn clk_status(self) -> crate::common::Reg<regs::ClkStatus, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0824usize) as _) }
}
#[doc = "Clock control for the CHACHA engine."]
#[inline(always)]
pub const fn chacha_clk(self) -> crate::common::Reg<regs::ChachaClk, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0858usize) as _) }
}
}
pub mod regs {
#[doc = "Clock control for the AES engine."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct AesClk(pub u32);
impl AesClk {
#[doc = "Enables clock for the AES engine."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enables clock for the AES engine."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for AesClk {
#[inline(always)]
fn default() -> AesClk {
AesClk(0)
}
}
impl core::fmt::Debug for AesClk {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("AesClk")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for AesClk {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "AesClk {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "Clock control for the CHACHA engine."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct ChachaClk(pub u32);
impl ChachaClk {
#[doc = "Enables clock for the CHACHA engine."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enables clock for the CHACHA engine."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for ChachaClk {
#[inline(always)]
fn default() -> ChachaClk {
ChachaClk(0)
}
}
impl core::fmt::Debug for ChachaClk {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("ChachaClk")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for ChachaClk {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "ChachaClk {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "CRYPTOCELL clocks status register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct ClkStatus(pub u32);
impl ClkStatus {
#[doc = "Status of AES engine clock."]
#[must_use]
#[inline(always)]
pub const fn aes_clk(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Status of AES engine clock."]
#[inline(always)]
pub const fn set_aes_clk(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Status of HASH engine clock."]
#[must_use]
#[inline(always)]
pub const fn hash_clk(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Status of HASH engine clock."]
#[inline(always)]
pub const fn set_hash_clk(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Status of PKA engine clock."]
#[must_use]
#[inline(always)]
pub const fn pka_clk(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Status of PKA engine clock."]
#[inline(always)]
pub const fn set_pka_clk(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Status of CHACHA engine clock."]
#[must_use]
#[inline(always)]
pub const fn chacha_clk(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Status of CHACHA engine clock."]
#[inline(always)]
pub const fn set_chacha_clk(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Status of DMA engines clock."]
#[must_use]
#[inline(always)]
pub const fn dma_clk(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Status of DMA engines clock."]
#[inline(always)]
pub const fn set_dma_clk(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
}
impl Default for ClkStatus {
#[inline(always)]
fn default() -> ClkStatus {
ClkStatus(0)
}
}
impl core::fmt::Debug for ClkStatus {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("ClkStatus")
.field("aes_clk", &self.aes_clk())
.field("hash_clk", &self.hash_clk())
.field("pka_clk", &self.pka_clk())
.field("chacha_clk", &self.chacha_clk())
.field("dma_clk", &self.dma_clk())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for ClkStatus {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "ClkStatus {{ aes_clk: {=bool:?}, hash_clk: {=bool:?}, pka_clk: {=bool:?}, chacha_clk: {=bool:?}, dma_clk: {=bool:?} }}" , self . aes_clk () , self . hash_clk () , self . pka_clk () , self . chacha_clk () , self . dma_clk ())
}
}
#[doc = "Clock control for the DMA engines."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DmaClk(pub u32);
impl DmaClk {
#[doc = "Enables clock for the DMA engines."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enables clock for the DMA engines."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for DmaClk {
#[inline(always)]
fn default() -> DmaClk {
DmaClk(0)
}
}
impl core::fmt::Debug for DmaClk {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DmaClk")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for DmaClk {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "DmaClk {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "Clock control for the HASH engine."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct HashClk(pub u32);
impl HashClk {
#[doc = "Enables clock for the HASH engine."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enables clock for the HASH engine."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for HashClk {
#[inline(always)]
fn default() -> HashClk {
HashClk(0)
}
}
impl core::fmt::Debug for HashClk {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("HashClk")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for HashClk {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "HashClk {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "Clock control for the PKA engine."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct PkaClk(pub u32);
impl PkaClk {
#[doc = "Enables clock for the PKA engine."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enables clock for the PKA engine."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for PkaClk {
#[inline(always)]
fn default() -> PkaClk {
PkaClk(0)
}
}
impl core::fmt::Debug for PkaClk {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("PkaClk")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for PkaClk {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "PkaClk {{ enable: {=bool:?} }}", self.enable())
}
}
}
}
pub mod cc_pka {
#[doc = "CRYPTOCELL PKA engine."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct CcPka {
ptr: *mut u8,
}
unsafe impl Send for CcPka {}
unsafe impl Sync for CcPka {}
impl CcPka {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description collection: Register for mapping the virtual register R\\[n\\] to a physical address in the PKA SRAM."]
#[inline(always)]
pub const fn memory_map(
self,
n: usize,
) -> crate::common::Reg<regs::MemoryMap, crate::common::RW> {
assert!(n < 32usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize + n * 4usize) as _)
}
}
#[doc = "Operation code to be executed by the PKA engine. Writing to this register triggers the PKA operation."]
#[inline(always)]
pub const fn opcode(self) -> crate::common::Reg<regs::Opcode, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x80usize) as _) }
}
#[doc = "This register defines the N, Np, T0, and T1 virtual register index."]
#[inline(always)]
pub const fn n_np_t0_t1_addr(
self,
) -> crate::common::Reg<regs::NNpT0T1Addr, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x84usize) as _) }
}
#[doc = "This register holds the status for the PKA pipeline."]
#[inline(always)]
pub const fn pka_status(self) -> crate::common::Reg<regs::PkaStatus, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x88usize) as _) }
}
#[doc = "Reset the PKA engine."]
#[inline(always)]
pub const fn pka_sw_reset(self) -> crate::common::Reg<regs::PkaSwReset, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x8cusize) as _) }
}
#[doc = "Description collection: This register holds the operands bit size."]
#[inline(always)]
pub const fn pka_l(self, n: usize) -> crate::common::Reg<regs::PkaL, crate::common::RW> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x90usize + n * 4usize) as _)
}
}
#[doc = "Status register indicating if the PKA pipeline is ready to receive a new OPCODE."]
#[inline(always)]
pub const fn pka_pipe(self) -> crate::common::Reg<regs::PkaPipe, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xb0usize) as _) }
}
#[doc = "Status register indicating if the PKA operation has been completed."]
#[inline(always)]
pub const fn pka_done(self) -> crate::common::Reg<regs::PkaDone, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xb4usize) as _) }
}
#[doc = "PKA engine HW version. Reset value holds the version."]
#[inline(always)]
pub const fn pka_version(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xc4usize) as _) }
}
#[doc = "Start address in PKA SRAM for subsequent write transactions."]
#[inline(always)]
pub const fn pka_sram_waddr(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xd4usize) as _) }
}
#[doc = "Write data to PKA SRAM. Writing to this register triggers a DMA transaction writing data into PKA SRAM. The DMA address offset is automatically incremented during write."]
#[inline(always)]
pub const fn pka_sram_wdata(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xd8usize) as _) }
}
#[doc = "Read data from PKA SRAM. Reading from this register triggers a DMA transaction read data from PKA SRAM. The DMA address offset is automatically incremented during read."]
#[inline(always)]
pub const fn pka_sram_rdata(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xdcusize) as _) }
}
#[doc = "Register for clearing PKA SRAM write buffer."]
#[inline(always)]
pub const fn pka_sram_wclear(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xe0usize) as _) }
}
#[doc = "Start address in PKA SRAM for subsequent read transactions."]
#[inline(always)]
pub const fn pka_sram_raddr(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xe4usize) as _) }
}
}
pub mod regs {
#[doc = "Description collection: Register for mapping the virtual register R\\[n\\] to a physical address in the PKA SRAM."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct MemoryMap(pub u32);
impl MemoryMap {
#[doc = "The physical word address used for the virtual register."]
#[must_use]
#[inline(always)]
pub const fn addr(&self) -> u16 {
let val = (self.0 >> 1usize) & 0x03ff;
val as u16
}
#[doc = "The physical word address used for the virtual register."]
#[inline(always)]
pub const fn set_addr(&mut self, val: u16) {
self.0 = (self.0 & !(0x03ff << 1usize)) | (((val as u32) & 0x03ff) << 1usize);
}
}
impl Default for MemoryMap {
#[inline(always)]
fn default() -> MemoryMap {
MemoryMap(0)
}
}
impl core::fmt::Debug for MemoryMap {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("MemoryMap")
.field("addr", &self.addr())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for MemoryMap {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "MemoryMap {{ addr: {=u16:?} }}", self.addr())
}
}
#[doc = "This register defines the N, Np, T0, and T1 virtual register index."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct NNpT0T1Addr(pub u32);
impl NNpT0T1Addr {
#[doc = "Register N virtual register index. Default is R0."]
#[must_use]
#[inline(always)]
pub const fn n_virtual_addr(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x1f;
val as u8
}
#[doc = "Register N virtual register index. Default is R0."]
#[inline(always)]
pub const fn set_n_virtual_addr(&mut self, val: u8) {
self.0 = (self.0 & !(0x1f << 0usize)) | (((val as u32) & 0x1f) << 0usize);
}
#[doc = "Register Np virtual register index. Default is R1."]
#[must_use]
#[inline(always)]
pub const fn np_virtual_addr(&self) -> u8 {
let val = (self.0 >> 5usize) & 0x1f;
val as u8
}
#[doc = "Register Np virtual register index. Default is R1."]
#[inline(always)]
pub const fn set_np_virtual_addr(&mut self, val: u8) {
self.0 = (self.0 & !(0x1f << 5usize)) | (((val as u32) & 0x1f) << 5usize);
}
#[doc = "Temporary register 0 virtual register index. Default is R30."]
#[must_use]
#[inline(always)]
pub const fn t0_virtual_addr(&self) -> u8 {
let val = (self.0 >> 10usize) & 0x1f;
val as u8
}
#[doc = "Temporary register 0 virtual register index. Default is R30."]
#[inline(always)]
pub const fn set_t0_virtual_addr(&mut self, val: u8) {
self.0 = (self.0 & !(0x1f << 10usize)) | (((val as u32) & 0x1f) << 10usize);
}
#[doc = "Temporary register 1 virtual register index. Default is R31."]
#[must_use]
#[inline(always)]
pub const fn t1_virtual_addr(&self) -> u8 {
let val = (self.0 >> 15usize) & 0x1f;
val as u8
}
#[doc = "Temporary register 1 virtual register index. Default is R31."]
#[inline(always)]
pub const fn set_t1_virtual_addr(&mut self, val: u8) {
self.0 = (self.0 & !(0x1f << 15usize)) | (((val as u32) & 0x1f) << 15usize);
}
}
impl Default for NNpT0T1Addr {
#[inline(always)]
fn default() -> NNpT0T1Addr {
NNpT0T1Addr(0)
}
}
impl core::fmt::Debug for NNpT0T1Addr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("NNpT0T1Addr")
.field("n_virtual_addr", &self.n_virtual_addr())
.field("np_virtual_addr", &self.np_virtual_addr())
.field("t0_virtual_addr", &self.t0_virtual_addr())
.field("t1_virtual_addr", &self.t1_virtual_addr())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for NNpT0T1Addr {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "NNpT0T1Addr {{ n_virtual_addr: {=u8:?}, np_virtual_addr: {=u8:?}, t0_virtual_addr: {=u8:?}, t1_virtual_addr: {=u8:?} }}" , self . n_virtual_addr () , self . np_virtual_addr () , self . t0_virtual_addr () , self . t1_virtual_addr ())
}
}
#[doc = "Operation code to be executed by the PKA engine. Writing to this register triggers the PKA operation."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Opcode(pub u32);
impl Opcode {
#[doc = "Holds the operation tag or the operand C virtual register index."]
#[must_use]
#[inline(always)]
pub const fn tag(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x3f;
val as u8
}
#[doc = "Holds the operation tag or the operand C virtual register index."]
#[inline(always)]
pub const fn set_tag(&mut self, val: u8) {
self.0 = (self.0 & !(0x3f << 0usize)) | (((val as u32) & 0x3f) << 0usize);
}
#[doc = "Result register virtual register index."]
#[must_use]
#[inline(always)]
pub const fn reg_r(&self) -> u8 {
let val = (self.0 >> 6usize) & 0x1f;
val as u8
}
#[doc = "Result register virtual register index."]
#[inline(always)]
pub const fn set_reg_r(&mut self, val: u8) {
self.0 = (self.0 & !(0x1f << 6usize)) | (((val as u32) & 0x1f) << 6usize);
}
#[doc = "This field controls the interpretation of REG_R."]
#[must_use]
#[inline(always)]
pub const fn discard_r(&self) -> super::vals::DiscardR {
let val = (self.0 >> 11usize) & 0x01;
super::vals::DiscardR::from_bits(val as u8)
}
#[doc = "This field controls the interpretation of REG_R."]
#[inline(always)]
pub const fn set_discard_r(&mut self, val: super::vals::DiscardR) {
self.0 =
(self.0 & !(0x01 << 11usize)) | (((val.to_bits() as u32) & 0x01) << 11usize);
}
#[doc = "Operand B virtual register index."]
#[must_use]
#[inline(always)]
pub const fn reg_b(&self) -> u8 {
let val = (self.0 >> 12usize) & 0x1f;
val as u8
}
#[doc = "Operand B virtual register index."]
#[inline(always)]
pub const fn set_reg_b(&mut self, val: u8) {
self.0 = (self.0 & !(0x1f << 12usize)) | (((val as u32) & 0x1f) << 12usize);
}
#[doc = "This field controls the interpretation of REG_B."]
#[must_use]
#[inline(always)]
pub const fn const_b(&self) -> super::vals::ConstB {
let val = (self.0 >> 17usize) & 0x01;
super::vals::ConstB::from_bits(val as u8)
}
#[doc = "This field controls the interpretation of REG_B."]
#[inline(always)]
pub const fn set_const_b(&mut self, val: super::vals::ConstB) {
self.0 =
(self.0 & !(0x01 << 17usize)) | (((val.to_bits() as u32) & 0x01) << 17usize);
}
#[doc = "Operand A virtual register index."]
#[must_use]
#[inline(always)]
pub const fn reg_a(&self) -> u8 {
let val = (self.0 >> 18usize) & 0x1f;
val as u8
}
#[doc = "Operand A virtual register index."]
#[inline(always)]
pub const fn set_reg_a(&mut self, val: u8) {
self.0 = (self.0 & !(0x1f << 18usize)) | (((val as u32) & 0x1f) << 18usize);
}
#[doc = "This field controls the interpretation of REG_A."]
#[must_use]
#[inline(always)]
pub const fn const_a(&self) -> super::vals::ConstA {
let val = (self.0 >> 23usize) & 0x01;
super::vals::ConstA::from_bits(val as u8)
}
#[doc = "This field controls the interpretation of REG_A."]
#[inline(always)]
pub const fn set_const_a(&mut self, val: super::vals::ConstA) {
self.0 =
(self.0 & !(0x01 << 23usize)) | (((val.to_bits() as u32) & 0x01) << 23usize);
}
#[doc = "The length of the operands. This value serves as an PKA length register index. E.g.: if LEN field value is set to 0, PKA_L\\[0\\] holds the size of the operands."]
#[must_use]
#[inline(always)]
pub const fn len(&self) -> u8 {
let val = (self.0 >> 24usize) & 0x07;
val as u8
}
#[doc = "The length of the operands. This value serves as an PKA length register index. E.g.: if LEN field value is set to 0, PKA_L\\[0\\] holds the size of the operands."]
#[inline(always)]
pub const fn set_len(&mut self, val: u8) {
self.0 = (self.0 & !(0x07 << 24usize)) | (((val as u32) & 0x07) << 24usize);
}
#[doc = "Operation code to be executed by the PKA engine."]
#[must_use]
#[inline(always)]
pub const fn opcode(&self) -> super::vals::Opcode {
let val = (self.0 >> 27usize) & 0x1f;
super::vals::Opcode::from_bits(val as u8)
}
#[doc = "Operation code to be executed by the PKA engine."]
#[inline(always)]
pub const fn set_opcode(&mut self, val: super::vals::Opcode) {
self.0 =
(self.0 & !(0x1f << 27usize)) | (((val.to_bits() as u32) & 0x1f) << 27usize);
}
}
impl Default for Opcode {
#[inline(always)]
fn default() -> Opcode {
Opcode(0)
}
}
impl core::fmt::Debug for Opcode {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Opcode")
.field("tag", &self.tag())
.field("reg_r", &self.reg_r())
.field("discard_r", &self.discard_r())
.field("reg_b", &self.reg_b())
.field("const_b", &self.const_b())
.field("reg_a", &self.reg_a())
.field("const_a", &self.const_a())
.field("len", &self.len())
.field("opcode", &self.opcode())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Opcode {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Opcode {{ tag: {=u8:?}, reg_r: {=u8:?}, discard_r: {:?}, reg_b: {=u8:?}, const_b: {:?}, reg_a: {=u8:?}, const_a: {:?}, len: {=u8:?}, opcode: {:?} }}" , self . tag () , self . reg_r () , self . discard_r () , self . reg_b () , self . const_b () , self . reg_a () , self . const_a () , self . len () , self . opcode ())
}
}
#[doc = "Status register indicating if the PKA operation has been completed."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct PkaDone(pub u32);
impl PkaDone {
#[doc = "PKA operation status."]
#[must_use]
#[inline(always)]
pub const fn status(&self) -> super::vals::PkaDoneStatus {
let val = (self.0 >> 0usize) & 0x01;
super::vals::PkaDoneStatus::from_bits(val as u8)
}
#[doc = "PKA operation status."]
#[inline(always)]
pub const fn set_status(&mut self, val: super::vals::PkaDoneStatus) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for PkaDone {
#[inline(always)]
fn default() -> PkaDone {
PkaDone(0)
}
}
impl core::fmt::Debug for PkaDone {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("PkaDone")
.field("status", &self.status())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for PkaDone {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "PkaDone {{ status: {:?} }}", self.status())
}
}
#[doc = "Description collection: This register holds the operands bit size."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct PkaL(pub u32);
impl PkaL {
#[doc = "Operand bit size."]
#[must_use]
#[inline(always)]
pub const fn op_size(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x1fff;
val as u16
}
#[doc = "Operand bit size."]
#[inline(always)]
pub const fn set_op_size(&mut self, val: u16) {
self.0 = (self.0 & !(0x1fff << 0usize)) | (((val as u32) & 0x1fff) << 0usize);
}
}
impl Default for PkaL {
#[inline(always)]
fn default() -> PkaL {
PkaL(0)
}
}
impl core::fmt::Debug for PkaL {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("PkaL")
.field("op_size", &self.op_size())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for PkaL {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "PkaL {{ op_size: {=u16:?} }}", self.op_size())
}
}
#[doc = "Status register indicating if the PKA pipeline is ready to receive a new OPCODE."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct PkaPipe(pub u32);
impl PkaPipe {
#[doc = "PKA pipeline status."]
#[must_use]
#[inline(always)]
pub const fn status(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "PKA pipeline status."]
#[inline(always)]
pub const fn set_status(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for PkaPipe {
#[inline(always)]
fn default() -> PkaPipe {
PkaPipe(0)
}
}
impl core::fmt::Debug for PkaPipe {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("PkaPipe")
.field("status", &self.status())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for PkaPipe {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "PkaPipe {{ status: {=bool:?} }}", self.status())
}
}
#[doc = "This register holds the status for the PKA pipeline."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct PkaStatus(pub u32);
impl PkaStatus {
#[doc = "The most significant 4-bits of the operand updated in shift operation."]
#[must_use]
#[inline(always)]
pub const fn alu_msb_4bits(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x0f;
val as u8
}
#[doc = "The most significant 4-bits of the operand updated in shift operation."]
#[inline(always)]
pub const fn set_alu_msb_4bits(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val as u32) & 0x0f) << 0usize);
}
#[doc = "The least significant 4-bits of the operand updated in shift operation."]
#[must_use]
#[inline(always)]
pub const fn alu_lsb_4bits(&self) -> u8 {
let val = (self.0 >> 4usize) & 0x0f;
val as u8
}
#[doc = "The least significant 4-bits of the operand updated in shift operation."]
#[inline(always)]
pub const fn set_alu_lsb_4bits(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 4usize)) | (((val as u32) & 0x0f) << 4usize);
}
#[doc = "Indicates the MSB sign of the last operation."]
#[must_use]
#[inline(always)]
pub const fn alu_sign_out(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Indicates the MSB sign of the last operation."]
#[inline(always)]
pub const fn set_alu_sign_out(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "Holds the carry of the last ALU operation."]
#[must_use]
#[inline(always)]
pub const fn alu_carry(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Holds the carry of the last ALU operation."]
#[inline(always)]
pub const fn set_alu_carry(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Holds the carry of the last modular operation."]
#[must_use]
#[inline(always)]
pub const fn alu_carry_mod(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "Holds the carry of the last modular operation."]
#[inline(always)]
pub const fn set_alu_carry_mod(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[doc = "Indicates the last subtraction operation sign."]
#[must_use]
#[inline(always)]
pub const fn alu_sub_is_zero(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "Indicates the last subtraction operation sign."]
#[inline(always)]
pub const fn set_alu_sub_is_zero(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "Indicates if the result of ALU OUT is zero."]
#[must_use]
#[inline(always)]
pub const fn alu_out_zero(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "Indicates if the result of ALU OUT is zero."]
#[inline(always)]
pub const fn set_alu_out_zero(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "Modular overflow flag."]
#[must_use]
#[inline(always)]
pub const fn alu_modovrflw(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "Modular overflow flag."]
#[inline(always)]
pub const fn set_alu_modovrflw(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "Indication if the division is done by zero."]
#[must_use]
#[inline(always)]
pub const fn div_by_zero(&self) -> bool {
let val = (self.0 >> 14usize) & 0x01;
val != 0
}
#[doc = "Indication if the division is done by zero."]
#[inline(always)]
pub const fn set_div_by_zero(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
}
#[doc = "Indicates the modular inverse of zero."]
#[must_use]
#[inline(always)]
pub const fn modinv_of_zero(&self) -> bool {
let val = (self.0 >> 15usize) & 0x01;
val != 0
}
#[doc = "Indicates the modular inverse of zero."]
#[inline(always)]
pub const fn set_modinv_of_zero(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
}
#[doc = "Opcode of the last operation."]
#[must_use]
#[inline(always)]
pub const fn opcode(&self) -> u8 {
let val = (self.0 >> 16usize) & 0x1f;
val as u8
}
#[doc = "Opcode of the last operation."]
#[inline(always)]
pub const fn set_opcode(&mut self, val: u8) {
self.0 = (self.0 & !(0x1f << 16usize)) | (((val as u32) & 0x1f) << 16usize);
}
}
impl Default for PkaStatus {
#[inline(always)]
fn default() -> PkaStatus {
PkaStatus(0)
}
}
impl core::fmt::Debug for PkaStatus {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("PkaStatus")
.field("alu_msb_4bits", &self.alu_msb_4bits())
.field("alu_lsb_4bits", &self.alu_lsb_4bits())
.field("alu_sign_out", &self.alu_sign_out())
.field("alu_carry", &self.alu_carry())
.field("alu_carry_mod", &self.alu_carry_mod())
.field("alu_sub_is_zero", &self.alu_sub_is_zero())
.field("alu_out_zero", &self.alu_out_zero())
.field("alu_modovrflw", &self.alu_modovrflw())
.field("div_by_zero", &self.div_by_zero())
.field("modinv_of_zero", &self.modinv_of_zero())
.field("opcode", &self.opcode())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for PkaStatus {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "PkaStatus {{ alu_msb_4bits: {=u8:?}, alu_lsb_4bits: {=u8:?}, alu_sign_out: {=bool:?}, alu_carry: {=bool:?}, alu_carry_mod: {=bool:?}, alu_sub_is_zero: {=bool:?}, alu_out_zero: {=bool:?}, alu_modovrflw: {=bool:?}, div_by_zero: {=bool:?}, modinv_of_zero: {=bool:?}, opcode: {=u8:?} }}" , self . alu_msb_4bits () , self . alu_lsb_4bits () , self . alu_sign_out () , self . alu_carry () , self . alu_carry_mod () , self . alu_sub_is_zero () , self . alu_out_zero () , self . alu_modovrflw () , self . div_by_zero () , self . modinv_of_zero () , self . opcode ())
}
}
#[doc = "Reset the PKA engine."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct PkaSwReset(pub u32);
impl PkaSwReset {
#[doc = "Writing any value to this address resets the PKA engine. The reset takes 4 CPU clock cycles to complete."]
#[must_use]
#[inline(always)]
pub const fn reset(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Writing any value to this address resets the PKA engine. The reset takes 4 CPU clock cycles to complete."]
#[inline(always)]
pub const fn set_reset(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for PkaSwReset {
#[inline(always)]
fn default() -> PkaSwReset {
PkaSwReset(0)
}
}
impl core::fmt::Debug for PkaSwReset {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("PkaSwReset")
.field("reset", &self.reset())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for PkaSwReset {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "PkaSwReset {{ reset: {=bool:?} }}", self.reset())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum ConstA {
#[doc = "REG_A is intepreted as a register index."]
Register = 0x0,
#[doc = "REG_A is intepreted as a constant."]
Constant = 0x01,
}
impl ConstA {
#[inline(always)]
pub const fn from_bits(val: u8) -> ConstA {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for ConstA {
#[inline(always)]
fn from(val: u8) -> ConstA {
ConstA::from_bits(val)
}
}
impl From<ConstA> for u8 {
#[inline(always)]
fn from(val: ConstA) -> u8 {
ConstA::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum ConstB {
#[doc = "REG_B is intepreted as a register index."]
Register = 0x0,
#[doc = "REG_B is intepreted as a constant."]
Constant = 0x01,
}
impl ConstB {
#[inline(always)]
pub const fn from_bits(val: u8) -> ConstB {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for ConstB {
#[inline(always)]
fn from(val: u8) -> ConstB {
ConstB::from_bits(val)
}
}
impl From<ConstB> for u8 {
#[inline(always)]
fn from(val: ConstB) -> u8 {
ConstB::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum DiscardR {
#[doc = "REG_R is intepreted as a register index."]
Register = 0x0,
#[doc = "Result is discarded."]
Discard = 0x01,
}
impl DiscardR {
#[inline(always)]
pub const fn from_bits(val: u8) -> DiscardR {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for DiscardR {
#[inline(always)]
fn from(val: u8) -> DiscardR {
DiscardR::from_bits(val)
}
}
impl From<DiscardR> for u8 {
#[inline(always)]
fn from(val: DiscardR) -> u8 {
DiscardR::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Opcode {
#[doc = "Terminate operation."]
Terminate = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
#[doc = "Add or Increment."]
AddInc = 0x04,
#[doc = "Subtract, Decrement, or Negate."]
SubDecNeg = 0x05,
#[doc = "Modular Add or Modular Increment."]
ModAddInc = 0x06,
#[doc = "Modular Subtract, Modular Decrement, or Modular Negate."]
ModSubDecNeg = 0x07,
#[doc = "Perform AND, test, or clear."]
Andtst0clr0 = 0x08,
#[doc = "Perform OR, copy, or set bits."]
Orcopyset0 = 0x09,
#[doc = "Perform XOR, flip bits, invert, or compare."]
Xorflp0invcmp = 0x0a,
_RESERVED_b = 0x0b,
#[doc = "Shift right 0 operation."]
Shr0 = 0x0c,
#[doc = "Shift right 1 operation."]
Shr1 = 0x0d,
#[doc = "Shift left 0 operation."]
Shl0 = 0x0e,
#[doc = "Shift left 1 operation."]
Shl1 = 0x0f,
#[doc = "Multiply low operation."]
MulLow = 0x10,
#[doc = "Modular multiply operation."]
ModMul = 0x11,
#[doc = "Modular multiply N operation."]
ModMulN = 0x12,
#[doc = "Modular exponentiation operation."]
ModExp = 0x13,
#[doc = "Division operation."]
Division = 0x14,
#[doc = "Modular inversion operation."]
ModInv = 0x15,
#[doc = "Modular division operation."]
ModDiv = 0x16,
#[doc = "Multiply high operation."]
MulHigh = 0x17,
#[doc = "Modular multiplication acceleration."]
ModMlac = 0x18,
#[doc = "Modular multiplication acceleration where final reduction is omitted."]
ModMlacnr = 0x19,
_RESERVED_1a = 0x1a,
#[doc = "Reduction operation."]
Reduction = 0x1b,
_RESERVED_1c = 0x1c,
_RESERVED_1d = 0x1d,
_RESERVED_1e = 0x1e,
_RESERVED_1f = 0x1f,
}
impl Opcode {
#[inline(always)]
pub const fn from_bits(val: u8) -> Opcode {
unsafe { core::mem::transmute(val & 0x1f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Opcode {
#[inline(always)]
fn from(val: u8) -> Opcode {
Opcode::from_bits(val)
}
}
impl From<Opcode> for u8 {
#[inline(always)]
fn from(val: Opcode) -> u8 {
Opcode::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum PkaDoneStatus {
#[doc = "PKA operation is processing."]
Processing = 0x0,
#[doc = "PKA operation is completed and pipeline is empty."]
Completed = 0x01,
}
impl PkaDoneStatus {
#[inline(always)]
pub const fn from_bits(val: u8) -> PkaDoneStatus {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for PkaDoneStatus {
#[inline(always)]
fn from(val: u8) -> PkaDoneStatus {
PkaDoneStatus::from_bits(val)
}
}
impl From<PkaDoneStatus> for u8 {
#[inline(always)]
fn from(val: PkaDoneStatus) -> u8 {
PkaDoneStatus::to_bits(val)
}
}
}
}
pub mod cc_rng {
#[doc = "CRYPTOCELL RNG engine."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct CcRng {
ptr: *mut u8,
}
unsafe impl Send for CcRng {}
unsafe impl Sync for CcRng {}
impl CcRng {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Interrupt mask register. Each bit of this register holds the mask of a single interrupt source."]
#[inline(always)]
pub const fn rng_imr(self) -> crate::common::Reg<regs::RngImr, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0100usize) as _) }
}
#[doc = "Interrupt status register. Each bit of this register holds the interrupt status of a single interrupt source. If corresponding RNG_IMR bit is unmasked, an interrupt is generated."]
#[inline(always)]
pub const fn rng_isr(self) -> crate::common::Reg<regs::RngIsr, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0104usize) as _) }
}
#[doc = "Interrupt clear register. Writing a 1 bit into a field in this register will clear the corresponding bit in RNG_ISR."]
#[inline(always)]
pub const fn rng_icr(self) -> crate::common::Reg<regs::RngIcr, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0108usize) as _) }
}
#[doc = "TRNG ring oscillator length configuration."]
#[inline(always)]
pub const fn trng_config(self) -> crate::common::Reg<regs::TrngConfig, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x010cusize) as _) }
}
#[doc = "This register indicates if TRNG entropy collection is valid."]
#[inline(always)]
pub const fn trng_valid(self) -> crate::common::Reg<regs::TrngValid, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0110usize) as _) }
}
#[doc = "Description collection: The entropy holding registers (EHR) hold 192-bits random data collected by the TRNG. The initial EHR_DATA\\[0\\] register holds the least significant bits \\[31:0\\] of the random data value."]
#[inline(always)]
pub const fn ehr_data(self, n: usize) -> crate::common::Reg<u32, crate::common::R> {
assert!(n < 6usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0114usize + n * 4usize) as _)
}
}
#[doc = "This register controls the ring oscillator circuit used as a noise source."]
#[inline(always)]
pub const fn noise_source(
self,
) -> crate::common::Reg<regs::NoiseSource, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x012cusize) as _) }
}
#[doc = "Sample count defining the number of CPU clock cycles between two consecutive noise source samples."]
#[inline(always)]
pub const fn sample_cnt(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0130usize) as _) }
}
#[doc = "Statistics counter for autocorrelation test activations. Statistics collection is stopped if one of the counters reach its limit of all ones."]
#[inline(always)]
pub const fn autocorr_statistic(
self,
) -> crate::common::Reg<regs::AutocorrStatistic, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0134usize) as _) }
}
#[doc = "Debug register for the TRNG. This register is used to bypass TRNG tests in hardware."]
#[inline(always)]
pub const fn trng_debug(self) -> crate::common::Reg<regs::TrngDebug, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0138usize) as _) }
}
#[doc = "Reset the RNG engine."]
#[inline(always)]
pub const fn rng_sw_reset(self) -> crate::common::Reg<regs::RngSwReset, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0140usize) as _) }
}
#[doc = "Status register for RNG engine activity."]
#[inline(always)]
pub const fn rng_busy(self) -> crate::common::Reg<regs::RngBusy, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01b8usize) as _) }
}
#[doc = "Reset the TRNG, including internal counter of collected bits and registers EHR_DATA and TRNG_VALID."]
#[inline(always)]
pub const fn trng_reset(self) -> crate::common::Reg<regs::TrngReset, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01bcusize) as _) }
}
#[doc = "Hardware configuration of RNG engine. Reset value holds the supported features."]
#[inline(always)]
pub const fn rng_hw_flags(self) -> crate::common::Reg<regs::RngHwFlags, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01c0usize) as _) }
}
#[doc = "Control clock for the RNG engine."]
#[inline(always)]
pub const fn rng_clk(self) -> crate::common::Reg<regs::RngClk, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01c4usize) as _) }
}
#[doc = "Writing to this register enables the RNG DMA engine."]
#[inline(always)]
pub const fn rng_dma(self) -> crate::common::Reg<regs::RngDma, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01c8usize) as _) }
}
#[doc = "This register defines which ring oscillator length configuration should be used when using the RNG DMA engine."]
#[inline(always)]
pub const fn rng_dma_rosc_len(
self,
) -> crate::common::Reg<regs::RngDmaRoscLen, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01ccusize) as _) }
}
#[doc = "This register defines the start address in TRNG SRAM for the TRNG data to be collected by the RNG DMA engine."]
#[inline(always)]
pub const fn rng_dma_sram_addr(
self,
) -> crate::common::Reg<regs::RngDmaSramAddr, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01d0usize) as _) }
}
#[doc = "This register defines the number of 192-bits samples that the RNG DMA engine collects per run."]
#[inline(always)]
pub const fn rng_dma_samples_num(
self,
) -> crate::common::Reg<regs::RngDmaSamplesNum, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01d4usize) as _) }
}
#[doc = "This register defines the maximum number of CPU clock cycles per TRNG collection of 192-bits samples. If the number of cycles for a collection exceeds this threshold the WATCHDOG interrupt is triggered."]
#[inline(always)]
pub const fn rng_watchdog_val(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01d8usize) as _) }
}
#[doc = "Status register for RNG DMA engine activity."]
#[inline(always)]
pub const fn rng_dma_busy(self) -> crate::common::Reg<regs::RngDmaBusy, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01dcusize) as _) }
}
}
pub mod regs {
#[doc = "Statistics counter for autocorrelation test activations. Statistics collection is stopped if one of the counters reach its limit of all ones."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct AutocorrStatistic(pub u32);
impl AutocorrStatistic {
#[doc = "Count each time an autocorrelation test starts. Any write to the field resets the counter."]
#[must_use]
#[inline(always)]
pub const fn autocorr_trys(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x3fff;
val as u16
}
#[doc = "Count each time an autocorrelation test starts. Any write to the field resets the counter."]
#[inline(always)]
pub const fn set_autocorr_trys(&mut self, val: u16) {
self.0 = (self.0 & !(0x3fff << 0usize)) | (((val as u32) & 0x3fff) << 0usize);
}
#[doc = "Count each time an autocorrelation test fails. Any write to the field resets the counter."]
#[must_use]
#[inline(always)]
pub const fn autocorr_fails(&self) -> u8 {
let val = (self.0 >> 14usize) & 0xff;
val as u8
}
#[doc = "Count each time an autocorrelation test fails. Any write to the field resets the counter."]
#[inline(always)]
pub const fn set_autocorr_fails(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 14usize)) | (((val as u32) & 0xff) << 14usize);
}
}
impl Default for AutocorrStatistic {
#[inline(always)]
fn default() -> AutocorrStatistic {
AutocorrStatistic(0)
}
}
impl core::fmt::Debug for AutocorrStatistic {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("AutocorrStatistic")
.field("autocorr_trys", &self.autocorr_trys())
.field("autocorr_fails", &self.autocorr_fails())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for AutocorrStatistic {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"AutocorrStatistic {{ autocorr_trys: {=u16:?}, autocorr_fails: {=u8:?} }}",
self.autocorr_trys(),
self.autocorr_fails()
)
}
}
#[doc = "This register controls the ring oscillator circuit used as a noise source."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct NoiseSource(pub u32);
impl NoiseSource {
#[doc = "Enable or disable the noise source."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable the noise source."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for NoiseSource {
#[inline(always)]
fn default() -> NoiseSource {
NoiseSource(0)
}
}
impl core::fmt::Debug for NoiseSource {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("NoiseSource")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for NoiseSource {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "NoiseSource {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "Status register for RNG engine activity."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RngBusy(pub u32);
impl RngBusy {
#[doc = "RNG engine status."]
#[must_use]
#[inline(always)]
pub const fn status(&self) -> super::vals::RngBusyStatus {
let val = (self.0 >> 0usize) & 0x01;
super::vals::RngBusyStatus::from_bits(val as u8)
}
#[doc = "RNG engine status."]
#[inline(always)]
pub const fn set_status(&mut self, val: super::vals::RngBusyStatus) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "TRNG status."]
#[must_use]
#[inline(always)]
pub const fn trng_status(&self) -> super::vals::TrngStatus {
let val = (self.0 >> 1usize) & 0x01;
super::vals::TrngStatus::from_bits(val as u8)
}
#[doc = "TRNG status."]
#[inline(always)]
pub const fn set_trng_status(&mut self, val: super::vals::TrngStatus) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val.to_bits() as u32) & 0x01) << 1usize);
}
}
impl Default for RngBusy {
#[inline(always)]
fn default() -> RngBusy {
RngBusy(0)
}
}
impl core::fmt::Debug for RngBusy {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RngBusy")
.field("status", &self.status())
.field("trng_status", &self.trng_status())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RngBusy {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"RngBusy {{ status: {:?}, trng_status: {:?} }}",
self.status(),
self.trng_status()
)
}
}
#[doc = "Control clock for the RNG engine."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RngClk(pub u32);
impl RngClk {
#[doc = "Enables clock for the RNG engine."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enables clock for the RNG engine."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for RngClk {
#[inline(always)]
fn default() -> RngClk {
RngClk(0)
}
}
impl core::fmt::Debug for RngClk {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RngClk")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RngClk {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "RngClk {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "Writing to this register enables the RNG DMA engine."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RngDma(pub u32);
impl RngDma {
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for RngDma {
#[inline(always)]
fn default() -> RngDma {
RngDma(0)
}
}
impl core::fmt::Debug for RngDma {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RngDma")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RngDma {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "RngDma {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "Status register for RNG DMA engine activity."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RngDmaBusy(pub u32);
impl RngDmaBusy {
#[doc = "RNG DMA engine status."]
#[must_use]
#[inline(always)]
pub const fn status(&self) -> super::vals::RngDmaBusyStatus {
let val = (self.0 >> 0usize) & 0x01;
super::vals::RngDmaBusyStatus::from_bits(val as u8)
}
#[doc = "RNG DMA engine status."]
#[inline(always)]
pub const fn set_status(&mut self, val: super::vals::RngDmaBusyStatus) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "The active ring oscillator length configuration used by the RNG DMA engine."]
#[must_use]
#[inline(always)]
pub const fn rosc_len(&self) -> super::vals::RngDmaBusyRoscLen {
let val = (self.0 >> 1usize) & 0x03;
super::vals::RngDmaBusyRoscLen::from_bits(val as u8)
}
#[doc = "The active ring oscillator length configuration used by the RNG DMA engine."]
#[inline(always)]
pub const fn set_rosc_len(&mut self, val: super::vals::RngDmaBusyRoscLen) {
self.0 = (self.0 & !(0x03 << 1usize)) | (((val.to_bits() as u32) & 0x03) << 1usize);
}
#[doc = "Number of samples already collected using the current ring oscillator configuration."]
#[must_use]
#[inline(always)]
pub const fn num_of_samples(&self) -> u8 {
let val = (self.0 >> 3usize) & 0xff;
val as u8
}
#[doc = "Number of samples already collected using the current ring oscillator configuration."]
#[inline(always)]
pub const fn set_num_of_samples(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 3usize)) | (((val as u32) & 0xff) << 3usize);
}
}
impl Default for RngDmaBusy {
#[inline(always)]
fn default() -> RngDmaBusy {
RngDmaBusy(0)
}
}
impl core::fmt::Debug for RngDmaBusy {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RngDmaBusy")
.field("status", &self.status())
.field("rosc_len", &self.rosc_len())
.field("num_of_samples", &self.num_of_samples())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RngDmaBusy {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"RngDmaBusy {{ status: {:?}, rosc_len: {:?}, num_of_samples: {=u8:?} }}",
self.status(),
self.rosc_len(),
self.num_of_samples()
)
}
}
#[doc = "This register defines which ring oscillator length configuration should be used when using the RNG DMA engine."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RngDmaRoscLen(pub u32);
impl RngDmaRoscLen {
#[doc = "Use shortest ROSC1 ring oscillator configuration."]
#[must_use]
#[inline(always)]
pub const fn rosc1(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Use shortest ROSC1 ring oscillator configuration."]
#[inline(always)]
pub const fn set_rosc1(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Use ROSC2 ring oscillator configuration."]
#[must_use]
#[inline(always)]
pub const fn rosc2(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Use ROSC2 ring oscillator configuration."]
#[inline(always)]
pub const fn set_rosc2(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Use ROSC3 ring oscillator configuration."]
#[must_use]
#[inline(always)]
pub const fn rosc3(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Use ROSC3 ring oscillator configuration."]
#[inline(always)]
pub const fn set_rosc3(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Use longest ROSC4 ring oscillator configuration."]
#[must_use]
#[inline(always)]
pub const fn rosc4(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Use longest ROSC4 ring oscillator configuration."]
#[inline(always)]
pub const fn set_rosc4(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
}
impl Default for RngDmaRoscLen {
#[inline(always)]
fn default() -> RngDmaRoscLen {
RngDmaRoscLen(0)
}
}
impl core::fmt::Debug for RngDmaRoscLen {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RngDmaRoscLen")
.field("rosc1", &self.rosc1())
.field("rosc2", &self.rosc2())
.field("rosc3", &self.rosc3())
.field("rosc4", &self.rosc4())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RngDmaRoscLen {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "RngDmaRoscLen {{ rosc1: {=bool:?}, rosc2: {=bool:?}, rosc3: {=bool:?}, rosc4: {=bool:?} }}" , self . rosc1 () , self . rosc2 () , self . rosc3 () , self . rosc4 ())
}
}
#[doc = "This register defines the number of 192-bits samples that the RNG DMA engine collects per run."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RngDmaSamplesNum(pub u32);
impl RngDmaSamplesNum {
#[doc = "Defines the number of 192-bits samples that the DMA engine collects per run."]
#[must_use]
#[inline(always)]
pub const fn rng_samples_num(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Defines the number of 192-bits samples that the DMA engine collects per run."]
#[inline(always)]
pub const fn set_rng_samples_num(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for RngDmaSamplesNum {
#[inline(always)]
fn default() -> RngDmaSamplesNum {
RngDmaSamplesNum(0)
}
}
impl core::fmt::Debug for RngDmaSamplesNum {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RngDmaSamplesNum")
.field("rng_samples_num", &self.rng_samples_num())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RngDmaSamplesNum {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"RngDmaSamplesNum {{ rng_samples_num: {=u8:?} }}",
self.rng_samples_num()
)
}
}
#[doc = "This register defines the start address in TRNG SRAM for the TRNG data to be collected by the RNG DMA engine."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RngDmaSramAddr(pub u32);
impl RngDmaSramAddr {
#[doc = "Start address of the TRNG data in TRNG SRAM."]
#[must_use]
#[inline(always)]
pub const fn rng_sram_dma_addr(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x07ff;
val as u16
}
#[doc = "Start address of the TRNG data in TRNG SRAM."]
#[inline(always)]
pub const fn set_rng_sram_dma_addr(&mut self, val: u16) {
self.0 = (self.0 & !(0x07ff << 0usize)) | (((val as u32) & 0x07ff) << 0usize);
}
}
impl Default for RngDmaSramAddr {
#[inline(always)]
fn default() -> RngDmaSramAddr {
RngDmaSramAddr(0)
}
}
impl core::fmt::Debug for RngDmaSramAddr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RngDmaSramAddr")
.field("rng_sram_dma_addr", &self.rng_sram_dma_addr())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RngDmaSramAddr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"RngDmaSramAddr {{ rng_sram_dma_addr: {=u16:?} }}",
self.rng_sram_dma_addr()
)
}
}
#[doc = "Hardware configuration of RNG engine. Reset value holds the supported features."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RngHwFlags(pub u32);
impl RngHwFlags {
#[doc = "Data width supported by the entropy collector."]
#[must_use]
#[inline(always)]
pub const fn ehr_width(&self) -> super::vals::EhrWidth {
let val = (self.0 >> 0usize) & 0x01;
super::vals::EhrWidth::from_bits(val as u8)
}
#[doc = "Data width supported by the entropy collector."]
#[inline(always)]
pub const fn set_ehr_width(&mut self, val: super::vals::EhrWidth) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "If this flag is set, the engine include support for continuous random number generator test."]
#[must_use]
#[inline(always)]
pub const fn crngt_exists(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine include support for continuous random number generator test."]
#[inline(always)]
pub const fn set_crngt_exists(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "If this flag is set, the engine include support for autocorrelation test."]
#[must_use]
#[inline(always)]
pub const fn autocorr_exists(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine include support for autocorrelation test."]
#[inline(always)]
pub const fn set_autocorr_exists(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "If this flag is set, the engine include support for bypassing TRNG tests."]
#[must_use]
#[inline(always)]
pub const fn bypass_exists(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine include support for bypassing TRNG tests."]
#[inline(always)]
pub const fn set_bypass_exists(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "If this flag is set, the engine include a pseudo-random number generator."]
#[must_use]
#[inline(always)]
pub const fn prng_exists(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine include a pseudo-random number generator."]
#[inline(always)]
pub const fn set_prng_exists(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "If this flag is set, the engine include support for known answer tests."]
#[must_use]
#[inline(always)]
pub const fn kat_exists(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine include support for known answer tests."]
#[inline(always)]
pub const fn set_kat_exists(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "If this flag is set, the engine include support for automatic reseeding."]
#[must_use]
#[inline(always)]
pub const fn reseeding_exists(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "If this flag is set, the engine include support for automatic reseeding."]
#[inline(always)]
pub const fn set_reseeding_exists(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[must_use]
#[inline(always)]
pub const fn rng_use_5_sboxes(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_rng_use_5_sboxes(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
}
impl Default for RngHwFlags {
#[inline(always)]
fn default() -> RngHwFlags {
RngHwFlags(0)
}
}
impl core::fmt::Debug for RngHwFlags {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RngHwFlags")
.field("ehr_width", &self.ehr_width())
.field("crngt_exists", &self.crngt_exists())
.field("autocorr_exists", &self.autocorr_exists())
.field("bypass_exists", &self.bypass_exists())
.field("prng_exists", &self.prng_exists())
.field("kat_exists", &self.kat_exists())
.field("reseeding_exists", &self.reseeding_exists())
.field("rng_use_5_sboxes", &self.rng_use_5_sboxes())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RngHwFlags {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "RngHwFlags {{ ehr_width: {:?}, crngt_exists: {=bool:?}, autocorr_exists: {=bool:?}, bypass_exists: {=bool:?}, prng_exists: {=bool:?}, kat_exists: {=bool:?}, reseeding_exists: {=bool:?}, rng_use_5_sboxes: {=bool:?} }}" , self . ehr_width () , self . crngt_exists () , self . autocorr_exists () , self . bypass_exists () , self . prng_exists () , self . kat_exists () , self . reseeding_exists () , self . rng_use_5_sboxes ())
}
}
#[doc = "Interrupt clear register. Writing a 1 bit into a field in this register will clear the corresponding bit in RNG_ISR."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RngIcr(pub u32);
impl RngIcr {
#[doc = "Writing value '1' clears corresponding bit in RNG_ISR."]
#[must_use]
#[inline(always)]
pub const fn ehr_valid_clear(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Writing value '1' clears corresponding bit in RNG_ISR."]
#[inline(always)]
pub const fn set_ehr_valid_clear(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Cannot be cleared by software! Only RNG reset clears this bit."]
#[must_use]
#[inline(always)]
pub const fn autocorr_err_clear(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Cannot be cleared by software! Only RNG reset clears this bit."]
#[inline(always)]
pub const fn set_autocorr_err_clear(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Writing value '1' clears corresponding bit in RNG_ISR."]
#[must_use]
#[inline(always)]
pub const fn crngt_err_clear(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Writing value '1' clears corresponding bit in RNG_ISR."]
#[inline(always)]
pub const fn set_crngt_err_clear(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Writing value '1' clears corresponding bit in RNG_ISR."]
#[must_use]
#[inline(always)]
pub const fn vnc_err_clear(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Writing value '1' clears corresponding bit in RNG_ISR."]
#[inline(always)]
pub const fn set_vnc_err_clear(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Writing value '1' clears corresponding bit in RNG_ISR."]
#[must_use]
#[inline(always)]
pub const fn watchdog_clear(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Writing value '1' clears corresponding bit in RNG_ISR."]
#[inline(always)]
pub const fn set_watchdog_clear(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Writing value '1' clears corresponding bit in RNG_ISR."]
#[must_use]
#[inline(always)]
pub const fn dma_done_clear(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Writing value '1' clears corresponding bit in RNG_ISR."]
#[inline(always)]
pub const fn set_dma_done_clear(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
}
impl Default for RngIcr {
#[inline(always)]
fn default() -> RngIcr {
RngIcr(0)
}
}
impl core::fmt::Debug for RngIcr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RngIcr")
.field("ehr_valid_clear", &self.ehr_valid_clear())
.field("autocorr_err_clear", &self.autocorr_err_clear())
.field("crngt_err_clear", &self.crngt_err_clear())
.field("vnc_err_clear", &self.vnc_err_clear())
.field("watchdog_clear", &self.watchdog_clear())
.field("dma_done_clear", &self.dma_done_clear())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RngIcr {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "RngIcr {{ ehr_valid_clear: {=bool:?}, autocorr_err_clear: {=bool:?}, crngt_err_clear: {=bool:?}, vnc_err_clear: {=bool:?}, watchdog_clear: {=bool:?}, dma_done_clear: {=bool:?} }}" , self . ehr_valid_clear () , self . autocorr_err_clear () , self . crngt_err_clear () , self . vnc_err_clear () , self . watchdog_clear () , self . dma_done_clear ())
}
}
#[doc = "Interrupt mask register. Each bit of this register holds the mask of a single interrupt source."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RngImr(pub u32);
impl RngImr {
#[doc = "See RNG_ISR for explanation on this interrupt."]
#[must_use]
#[inline(always)]
pub const fn ehr_valid_mask(&self) -> super::vals::EhrValidMask {
let val = (self.0 >> 0usize) & 0x01;
super::vals::EhrValidMask::from_bits(val as u8)
}
#[doc = "See RNG_ISR for explanation on this interrupt."]
#[inline(always)]
pub const fn set_ehr_valid_mask(&mut self, val: super::vals::EhrValidMask) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "See RNG_ISR for explanation on this interrupt."]
#[must_use]
#[inline(always)]
pub const fn autocorr_err_mask(&self) -> super::vals::AutocorrErrMask {
let val = (self.0 >> 1usize) & 0x01;
super::vals::AutocorrErrMask::from_bits(val as u8)
}
#[doc = "See RNG_ISR for explanation on this interrupt."]
#[inline(always)]
pub const fn set_autocorr_err_mask(&mut self, val: super::vals::AutocorrErrMask) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val.to_bits() as u32) & 0x01) << 1usize);
}
#[doc = "See RNG_ISR for explanation on this interrupt."]
#[must_use]
#[inline(always)]
pub const fn crngt_err_mask(&self) -> super::vals::CrngtErrMask {
let val = (self.0 >> 2usize) & 0x01;
super::vals::CrngtErrMask::from_bits(val as u8)
}
#[doc = "See RNG_ISR for explanation on this interrupt."]
#[inline(always)]
pub const fn set_crngt_err_mask(&mut self, val: super::vals::CrngtErrMask) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val.to_bits() as u32) & 0x01) << 2usize);
}
#[doc = "See RNG_ISR for explanation on this interrupt."]
#[must_use]
#[inline(always)]
pub const fn vnc_err_mask(&self) -> super::vals::VncErrMask {
let val = (self.0 >> 3usize) & 0x01;
super::vals::VncErrMask::from_bits(val as u8)
}
#[doc = "See RNG_ISR for explanation on this interrupt."]
#[inline(always)]
pub const fn set_vnc_err_mask(&mut self, val: super::vals::VncErrMask) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val.to_bits() as u32) & 0x01) << 3usize);
}
#[doc = "See RNG_ISR for explanation on this interrupt."]
#[must_use]
#[inline(always)]
pub const fn watchdog_mask(&self) -> super::vals::WatchdogMask {
let val = (self.0 >> 4usize) & 0x01;
super::vals::WatchdogMask::from_bits(val as u8)
}
#[doc = "See RNG_ISR for explanation on this interrupt."]
#[inline(always)]
pub const fn set_watchdog_mask(&mut self, val: super::vals::WatchdogMask) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val.to_bits() as u32) & 0x01) << 4usize);
}
#[doc = "See RNG_ISR for explanation on this interrupt."]
#[must_use]
#[inline(always)]
pub const fn dma_done_mask(&self) -> super::vals::DmaDoneMask {
let val = (self.0 >> 5usize) & 0x01;
super::vals::DmaDoneMask::from_bits(val as u8)
}
#[doc = "See RNG_ISR for explanation on this interrupt."]
#[inline(always)]
pub const fn set_dma_done_mask(&mut self, val: super::vals::DmaDoneMask) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val.to_bits() as u32) & 0x01) << 5usize);
}
}
impl Default for RngImr {
#[inline(always)]
fn default() -> RngImr {
RngImr(0)
}
}
impl core::fmt::Debug for RngImr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RngImr")
.field("ehr_valid_mask", &self.ehr_valid_mask())
.field("autocorr_err_mask", &self.autocorr_err_mask())
.field("crngt_err_mask", &self.crngt_err_mask())
.field("vnc_err_mask", &self.vnc_err_mask())
.field("watchdog_mask", &self.watchdog_mask())
.field("dma_done_mask", &self.dma_done_mask())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RngImr {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "RngImr {{ ehr_valid_mask: {:?}, autocorr_err_mask: {:?}, crngt_err_mask: {:?}, vnc_err_mask: {:?}, watchdog_mask: {:?}, dma_done_mask: {:?} }}" , self . ehr_valid_mask () , self . autocorr_err_mask () , self . crngt_err_mask () , self . vnc_err_mask () , self . watchdog_mask () , self . dma_done_mask ())
}
}
#[doc = "Interrupt status register. Each bit of this register holds the interrupt status of a single interrupt source. If corresponding RNG_IMR bit is unmasked, an interrupt is generated."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RngIsr(pub u32);
impl RngIsr {
#[doc = "192-bits have been collected and are ready to be read."]
#[must_use]
#[inline(always)]
pub const fn ehr_valid_int(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "192-bits have been collected and are ready to be read."]
#[inline(always)]
pub const fn set_ehr_valid_int(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Autocorrelation error. Failure occurs when autocorrelation test has failed four times in a row. Once set, the TRNG ceases to function until next reset."]
#[must_use]
#[inline(always)]
pub const fn autocorr_err_int(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Autocorrelation error. Failure occurs when autocorrelation test has failed four times in a row. Once set, the TRNG ceases to function until next reset."]
#[inline(always)]
pub const fn set_autocorr_err_int(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Continuous random number generator test error. Failure occurs when two consecutive blocks of 16 collected bits are equal."]
#[must_use]
#[inline(always)]
pub const fn crngt_err_int(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Continuous random number generator test error. Failure occurs when two consecutive blocks of 16 collected bits are equal."]
#[inline(always)]
pub const fn set_crngt_err_int(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "von Neumann corrector error. Failure occurs if 32 consecutive collected bits are identical, ZERO, or ONE."]
#[must_use]
#[inline(always)]
pub const fn vnc_err_int(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "von Neumann corrector error. Failure occurs if 32 consecutive collected bits are identical, ZERO, or ONE."]
#[inline(always)]
pub const fn set_vnc_err_int(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Maximum number of CPU clock cycles per sample have been exceeded. See RNG_WATCHDOG_VAL for more information."]
#[must_use]
#[inline(always)]
pub const fn watchdog_int(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Maximum number of CPU clock cycles per sample have been exceeded. See RNG_WATCHDOG_VAL for more information."]
#[inline(always)]
pub const fn set_watchdog_int(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "RNG DMA to SRAM is completed."]
#[must_use]
#[inline(always)]
pub const fn dma_done_int(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "RNG DMA to SRAM is completed."]
#[inline(always)]
pub const fn set_dma_done_int(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
}
impl Default for RngIsr {
#[inline(always)]
fn default() -> RngIsr {
RngIsr(0)
}
}
impl core::fmt::Debug for RngIsr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RngIsr")
.field("ehr_valid_int", &self.ehr_valid_int())
.field("autocorr_err_int", &self.autocorr_err_int())
.field("crngt_err_int", &self.crngt_err_int())
.field("vnc_err_int", &self.vnc_err_int())
.field("watchdog_int", &self.watchdog_int())
.field("dma_done_int", &self.dma_done_int())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RngIsr {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "RngIsr {{ ehr_valid_int: {=bool:?}, autocorr_err_int: {=bool:?}, crngt_err_int: {=bool:?}, vnc_err_int: {=bool:?}, watchdog_int: {=bool:?}, dma_done_int: {=bool:?} }}" , self . ehr_valid_int () , self . autocorr_err_int () , self . crngt_err_int () , self . vnc_err_int () , self . watchdog_int () , self . dma_done_int ())
}
}
#[doc = "Reset the RNG engine."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RngSwReset(pub u32);
impl RngSwReset {
#[doc = "Writing any value to this address resets the RNG engine. The reset takes 4 CPU clock cycles to complete."]
#[must_use]
#[inline(always)]
pub const fn reset(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Writing any value to this address resets the RNG engine. The reset takes 4 CPU clock cycles to complete."]
#[inline(always)]
pub const fn set_reset(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for RngSwReset {
#[inline(always)]
fn default() -> RngSwReset {
RngSwReset(0)
}
}
impl core::fmt::Debug for RngSwReset {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RngSwReset")
.field("reset", &self.reset())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RngSwReset {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "RngSwReset {{ reset: {=bool:?} }}", self.reset())
}
}
#[doc = "TRNG ring oscillator length configuration."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TrngConfig(pub u32);
impl TrngConfig {
#[doc = "Set the length of the oscillator ring (= the number of inverters) out of four possible configurations."]
#[must_use]
#[inline(always)]
pub const fn rosc_len(&self) -> super::vals::TrngConfigRoscLen {
let val = (self.0 >> 0usize) & 0x03;
super::vals::TrngConfigRoscLen::from_bits(val as u8)
}
#[doc = "Set the length of the oscillator ring (= the number of inverters) out of four possible configurations."]
#[inline(always)]
pub const fn set_rosc_len(&mut self, val: super::vals::TrngConfigRoscLen) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for TrngConfig {
#[inline(always)]
fn default() -> TrngConfig {
TrngConfig(0)
}
}
impl core::fmt::Debug for TrngConfig {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TrngConfig")
.field("rosc_len", &self.rosc_len())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for TrngConfig {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "TrngConfig {{ rosc_len: {:?} }}", self.rosc_len())
}
}
#[doc = "Debug register for the TRNG. This register is used to bypass TRNG tests in hardware."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TrngDebug(pub u32);
impl TrngDebug {
#[doc = "Bypass the von Neumann corrector post-processing test, including the 32 consecutive bits test."]
#[must_use]
#[inline(always)]
pub const fn vnc_bypass(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Bypass the von Neumann corrector post-processing test, including the 32 consecutive bits test."]
#[inline(always)]
pub const fn set_vnc_bypass(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Bypass the Continuous Random Number Generator Test (CRNGT)."]
#[must_use]
#[inline(always)]
pub const fn crngt_bypass(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Bypass the Continuous Random Number Generator Test (CRNGT)."]
#[inline(always)]
pub const fn set_crngt_bypass(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Bypass the autocorrelation test."]
#[must_use]
#[inline(always)]
pub const fn autocorr_bypass(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Bypass the autocorrelation test."]
#[inline(always)]
pub const fn set_autocorr_bypass(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
}
impl Default for TrngDebug {
#[inline(always)]
fn default() -> TrngDebug {
TrngDebug(0)
}
}
impl core::fmt::Debug for TrngDebug {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TrngDebug")
.field("vnc_bypass", &self.vnc_bypass())
.field("crngt_bypass", &self.crngt_bypass())
.field("autocorr_bypass", &self.autocorr_bypass())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for TrngDebug {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "TrngDebug {{ vnc_bypass: {=bool:?}, crngt_bypass: {=bool:?}, autocorr_bypass: {=bool:?} }}" , self . vnc_bypass () , self . crngt_bypass () , self . autocorr_bypass ())
}
}
#[doc = "Reset the TRNG, including internal counter of collected bits and registers EHR_DATA and TRNG_VALID."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TrngReset(pub u32);
impl TrngReset {
#[doc = "Writing any value to this address resets the internal bits counter and registers EHR_DATA and TRNG_VALID. Register NOISE_SOURCE must be disabled in order for the reset to take place."]
#[must_use]
#[inline(always)]
pub const fn reset(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Writing any value to this address resets the internal bits counter and registers EHR_DATA and TRNG_VALID. Register NOISE_SOURCE must be disabled in order for the reset to take place."]
#[inline(always)]
pub const fn set_reset(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for TrngReset {
#[inline(always)]
fn default() -> TrngReset {
TrngReset(0)
}
}
impl core::fmt::Debug for TrngReset {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TrngReset")
.field("reset", &self.reset())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for TrngReset {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "TrngReset {{ reset: {=bool:?} }}", self.reset())
}
}
#[doc = "This register indicates if TRNG entropy collection is valid."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TrngValid(pub u32);
impl TrngValid {
#[doc = "A value of 1 indicates that collection of bits in the TRNG is completed, and data can be read from EHR_DATA registers."]
#[must_use]
#[inline(always)]
pub const fn ehr_data(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "A value of 1 indicates that collection of bits in the TRNG is completed, and data can be read from EHR_DATA registers."]
#[inline(always)]
pub const fn set_ehr_data(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for TrngValid {
#[inline(always)]
fn default() -> TrngValid {
TrngValid(0)
}
}
impl core::fmt::Debug for TrngValid {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TrngValid")
.field("ehr_data", &self.ehr_data())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for TrngValid {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "TrngValid {{ ehr_data: {=bool:?} }}", self.ehr_data())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum AutocorrErrMask {
#[doc = "Do not mask autocorrelation interrupt i.e. interrupt is generated."]
IrqEnable = 0x0,
#[doc = "Mask autocorrelation interrupt i.e. no interrupt is generated."]
IrqDisable = 0x01,
}
impl AutocorrErrMask {
#[inline(always)]
pub const fn from_bits(val: u8) -> AutocorrErrMask {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for AutocorrErrMask {
#[inline(always)]
fn from(val: u8) -> AutocorrErrMask {
AutocorrErrMask::from_bits(val)
}
}
impl From<AutocorrErrMask> for u8 {
#[inline(always)]
fn from(val: AutocorrErrMask) -> u8 {
AutocorrErrMask::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum CrngtErrMask {
#[doc = "Do not mask the CRNGT error interrupt i.e. interrupt is generated."]
IrqEnable = 0x0,
#[doc = "Mask the CRNGT error interrupt i.e. no interrupt is generated."]
IrqDisable = 0x01,
}
impl CrngtErrMask {
#[inline(always)]
pub const fn from_bits(val: u8) -> CrngtErrMask {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for CrngtErrMask {
#[inline(always)]
fn from(val: u8) -> CrngtErrMask {
CrngtErrMask::from_bits(val)
}
}
impl From<CrngtErrMask> for u8 {
#[inline(always)]
fn from(val: CrngtErrMask) -> u8 {
CrngtErrMask::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum DmaDoneMask {
#[doc = "Do not mask the RNG DMA completion interrupt i.e. interrupt is generated."]
IrqEnable = 0x0,
#[doc = "Mask the RNG DMA completion interrupt i.e. no interrupt is generated."]
IrqDisable = 0x01,
}
impl DmaDoneMask {
#[inline(always)]
pub const fn from_bits(val: u8) -> DmaDoneMask {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for DmaDoneMask {
#[inline(always)]
fn from(val: u8) -> DmaDoneMask {
DmaDoneMask::from_bits(val)
}
}
impl From<DmaDoneMask> for u8 {
#[inline(always)]
fn from(val: DmaDoneMask) -> u8 {
DmaDoneMask::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum EhrValidMask {
#[doc = "Do not mask EHR interrupt i.e. interrupt is generated."]
IrqEnable = 0x0,
#[doc = "Mask EHR interrupt i.e. no interrupt is generated."]
IrqDisable = 0x01,
}
impl EhrValidMask {
#[inline(always)]
pub const fn from_bits(val: u8) -> EhrValidMask {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for EhrValidMask {
#[inline(always)]
fn from(val: u8) -> EhrValidMask {
EhrValidMask::from_bits(val)
}
}
impl From<EhrValidMask> for u8 {
#[inline(always)]
fn from(val: EhrValidMask) -> u8 {
EhrValidMask::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum EhrWidth {
#[doc = "128 bits EHR width."]
_128bits = 0x0,
#[doc = "192 bits EHR width."]
_192bits = 0x01,
}
impl EhrWidth {
#[inline(always)]
pub const fn from_bits(val: u8) -> EhrWidth {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for EhrWidth {
#[inline(always)]
fn from(val: u8) -> EhrWidth {
EhrWidth::from_bits(val)
}
}
impl From<EhrWidth> for u8 {
#[inline(always)]
fn from(val: EhrWidth) -> u8 {
EhrWidth::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RngBusyStatus {
#[doc = "RNG engine is idle."]
Idle = 0x0,
#[doc = "RNG engine is busy."]
Busy = 0x01,
}
impl RngBusyStatus {
#[inline(always)]
pub const fn from_bits(val: u8) -> RngBusyStatus {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for RngBusyStatus {
#[inline(always)]
fn from(val: u8) -> RngBusyStatus {
RngBusyStatus::from_bits(val)
}
}
impl From<RngBusyStatus> for u8 {
#[inline(always)]
fn from(val: RngBusyStatus) -> u8 {
RngBusyStatus::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RngDmaBusyRoscLen {
#[doc = "Shortest ROSC1 ring oscillator configuration used."]
Rosc1 = 0x0,
#[doc = "ROSC2 ring oscillator configuration used."]
Rosc2 = 0x01,
#[doc = "ROSC3 ring oscillator configuration used."]
Rosc3 = 0x02,
#[doc = "Longest ROSC4 ring oscillator configuration used."]
Rosc4 = 0x03,
}
impl RngDmaBusyRoscLen {
#[inline(always)]
pub const fn from_bits(val: u8) -> RngDmaBusyRoscLen {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for RngDmaBusyRoscLen {
#[inline(always)]
fn from(val: u8) -> RngDmaBusyRoscLen {
RngDmaBusyRoscLen::from_bits(val)
}
}
impl From<RngDmaBusyRoscLen> for u8 {
#[inline(always)]
fn from(val: RngDmaBusyRoscLen) -> u8 {
RngDmaBusyRoscLen::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RngDmaBusyStatus {
#[doc = "RNG DMA engine is idle."]
Idle = 0x0,
#[doc = "RNG DMA engine is busy."]
Busy = 0x01,
}
impl RngDmaBusyStatus {
#[inline(always)]
pub const fn from_bits(val: u8) -> RngDmaBusyStatus {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for RngDmaBusyStatus {
#[inline(always)]
fn from(val: u8) -> RngDmaBusyStatus {
RngDmaBusyStatus::from_bits(val)
}
}
impl From<RngDmaBusyStatus> for u8 {
#[inline(always)]
fn from(val: RngDmaBusyStatus) -> u8 {
RngDmaBusyStatus::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum TrngConfigRoscLen {
#[doc = "Use shortest ROSC1 ring oscillator configuration."]
Rosc1 = 0x0,
#[doc = "Use ROSC2 ring oscillator configuration."]
Rosc2 = 0x01,
#[doc = "Use ROSC3 ring oscillator configuration."]
Rosc3 = 0x02,
#[doc = "Use longest ROSC4 ring oscillator configuration."]
Rosc4 = 0x03,
}
impl TrngConfigRoscLen {
#[inline(always)]
pub const fn from_bits(val: u8) -> TrngConfigRoscLen {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for TrngConfigRoscLen {
#[inline(always)]
fn from(val: u8) -> TrngConfigRoscLen {
TrngConfigRoscLen::from_bits(val)
}
}
impl From<TrngConfigRoscLen> for u8 {
#[inline(always)]
fn from(val: TrngConfigRoscLen) -> u8 {
TrngConfigRoscLen::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum TrngStatus {
#[doc = "TRNG is idle."]
Idle = 0x0,
#[doc = "TRNG is busy."]
Busy = 0x01,
}
impl TrngStatus {
#[inline(always)]
pub const fn from_bits(val: u8) -> TrngStatus {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for TrngStatus {
#[inline(always)]
fn from(val: u8) -> TrngStatus {
TrngStatus::from_bits(val)
}
}
impl From<TrngStatus> for u8 {
#[inline(always)]
fn from(val: TrngStatus) -> u8 {
TrngStatus::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum VncErrMask {
#[doc = "Do not mask the von Neumann corrector error interrupt i.e. interrupt is generated."]
IrqEnable = 0x0,
#[doc = "Mask the von Neumann corrector error interrupt i.e. no interrupt is generated."]
IrqDisable = 0x01,
}
impl VncErrMask {
#[inline(always)]
pub const fn from_bits(val: u8) -> VncErrMask {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for VncErrMask {
#[inline(always)]
fn from(val: u8) -> VncErrMask {
VncErrMask::from_bits(val)
}
}
impl From<VncErrMask> for u8 {
#[inline(always)]
fn from(val: VncErrMask) -> u8 {
VncErrMask::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum WatchdogMask {
#[doc = "Do not mask the watchdog interrupt i.e. interrupt is generated."]
IrqEnable = 0x0,
#[doc = "Mask the watchdog interrupt i.e. no interrupt is generated."]
IrqDisable = 0x01,
}
impl WatchdogMask {
#[inline(always)]
pub const fn from_bits(val: u8) -> WatchdogMask {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for WatchdogMask {
#[inline(always)]
fn from(val: u8) -> WatchdogMask {
WatchdogMask::from_bits(val)
}
}
impl From<WatchdogMask> for u8 {
#[inline(always)]
fn from(val: WatchdogMask) -> u8 {
WatchdogMask::to_bits(val)
}
}
}
}
pub mod cc_rng_sram {
#[doc = "CRYPTOCELL RNG SRAM interface."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct CcRngSram {
ptr: *mut u8,
}
unsafe impl Send for CcRngSram {}
unsafe impl Sync for CcRngSram {}
impl CcRngSram {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Read/Write data from RNG SRAM."]
#[inline(always)]
pub const fn sram_data(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0f00usize) as _) }
}
#[doc = "First address given to RNG SRAM DMA for read/write transactions from/to RNG SRAM."]
#[inline(always)]
pub const fn sram_addr(self) -> crate::common::Reg<regs::SramAddr, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0f04usize) as _) }
}
#[doc = "RNG SRAM DMA engine is ready to read/write from/to RNG SRAM."]
#[inline(always)]
pub const fn sram_data_ready(
self,
) -> crate::common::Reg<regs::SramDataReady, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0f08usize) as _) }
}
}
pub mod regs {
#[doc = "First address given to RNG SRAM DMA for read/write transactions from/to RNG SRAM."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct SramAddr(pub u32);
impl SramAddr {
#[doc = "RNG SRAM starting address."]
#[must_use]
#[inline(always)]
pub const fn sram_addr(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x7fff;
val as u16
}
#[doc = "RNG SRAM starting address."]
#[inline(always)]
pub const fn set_sram_addr(&mut self, val: u16) {
self.0 = (self.0 & !(0x7fff << 0usize)) | (((val as u32) & 0x7fff) << 0usize);
}
}
impl Default for SramAddr {
#[inline(always)]
fn default() -> SramAddr {
SramAddr(0)
}
}
impl core::fmt::Debug for SramAddr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("SramAddr")
.field("sram_addr", &self.sram_addr())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for SramAddr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "SramAddr {{ sram_addr: {=u16:?} }}", self.sram_addr())
}
}
#[doc = "RNG SRAM DMA engine is ready to read/write from/to RNG SRAM."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct SramDataReady(pub u32);
impl SramDataReady {
#[doc = "RNG SRAM DMA status."]
#[must_use]
#[inline(always)]
pub const fn sram_ready(&self) -> super::vals::SramReady {
let val = (self.0 >> 0usize) & 0x01;
super::vals::SramReady::from_bits(val as u8)
}
#[doc = "RNG SRAM DMA status."]
#[inline(always)]
pub const fn set_sram_ready(&mut self, val: super::vals::SramReady) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for SramDataReady {
#[inline(always)]
fn default() -> SramDataReady {
SramDataReady(0)
}
}
impl core::fmt::Debug for SramDataReady {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("SramDataReady")
.field("sram_ready", &self.sram_ready())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for SramDataReady {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "SramDataReady {{ sram_ready: {:?} }}", self.sram_ready())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum SramReady {
#[doc = "DMA is busy."]
Busy = 0x0,
#[doc = "DMA is idle."]
Idle = 0x01,
}
impl SramReady {
#[inline(always)]
pub const fn from_bits(val: u8) -> SramReady {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for SramReady {
#[inline(always)]
fn from(val: u8) -> SramReady {
SramReady::from_bits(val)
}
}
impl From<SramReady> for u8 {
#[inline(always)]
fn from(val: SramReady) -> u8 {
SramReady::to_bits(val)
}
}
}
}
pub mod clock {
#[doc = "Clock management 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Clock {
ptr: *mut u8,
}
unsafe impl Send for Clock {}
unsafe impl Sync for Clock {}
impl Clock {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Start HFCLK128M/HFCLK64M source as selected in HFCLKSRC."]
#[inline(always)]
pub const fn tasks_hfclkstart(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Stop HFCLK128M/HFCLK64M source."]
#[inline(always)]
pub const fn tasks_hfclkstop(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Start LFCLK source as selected in LFCLKSRC."]
#[inline(always)]
pub const fn tasks_lfclkstart(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Stop LFCLK source."]
#[inline(always)]
pub const fn tasks_lfclkstop(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
#[doc = "Start calibration of LFRC oscillator."]
#[inline(always)]
pub const fn tasks_cal(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
#[doc = "Start HFCLKAUDIO source."]
#[inline(always)]
pub const fn tasks_hfclkaudiostart(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x18usize) as _) }
}
#[doc = "Stop HFCLKAUDIO source."]
#[inline(always)]
pub const fn tasks_hfclkaudiostop(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x1cusize) as _) }
}
#[doc = "Start HFCLK192M source as selected in HFCLK192MSRC."]
#[inline(always)]
pub const fn tasks_hfclk192mstart(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x20usize) as _) }
}
#[doc = "Stop HFCLK192M source."]
#[inline(always)]
pub const fn tasks_hfclk192mstop(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x24usize) as _) }
}
#[doc = "Subscribe configuration for task HFCLKSTART."]
#[inline(always)]
pub const fn subscribe_hfclkstart(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x80usize) as _) }
}
#[doc = "Subscribe configuration for task HFCLKSTOP."]
#[inline(always)]
pub const fn subscribe_hfclkstop(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x84usize) as _) }
}
#[doc = "Subscribe configuration for task LFCLKSTART."]
#[inline(always)]
pub const fn subscribe_lfclkstart(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x88usize) as _) }
}
#[doc = "Subscribe configuration for task LFCLKSTOP."]
#[inline(always)]
pub const fn subscribe_lfclkstop(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x8cusize) as _) }
}
#[doc = "Subscribe configuration for task CAL."]
#[inline(always)]
pub const fn subscribe_cal(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x90usize) as _) }
}
#[doc = "Subscribe configuration for task HFCLKAUDIOSTART."]
#[inline(always)]
pub const fn subscribe_hfclkaudiostart(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x98usize) as _) }
}
#[doc = "Subscribe configuration for task HFCLKAUDIOSTOP."]
#[inline(always)]
pub const fn subscribe_hfclkaudiostop(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x9cusize) as _) }
}
#[doc = "Subscribe configuration for task HFCLK192MSTART."]
#[inline(always)]
pub const fn subscribe_hfclk192mstart(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xa0usize) as _) }
}
#[doc = "Subscribe configuration for task HFCLK192MSTOP."]
#[inline(always)]
pub const fn subscribe_hfclk192mstop(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xa4usize) as _) }
}
#[doc = "HFCLK128M/HFCLK64M source started."]
#[inline(always)]
pub const fn events_hfclkstarted(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0100usize) as _) }
}
#[doc = "LFCLK source started."]
#[inline(always)]
pub const fn events_lfclkstarted(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0104usize) as _) }
}
#[doc = "Calibration of LFRC oscillator complete event."]
#[inline(always)]
pub const fn events_done(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x011cusize) as _) }
}
#[doc = "HFCLKAUDIO source started."]
#[inline(always)]
pub const fn events_hfclkaudiostarted(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0120usize) as _) }
}
#[doc = "HFCLK192M source started."]
#[inline(always)]
pub const fn events_hfclk192mstarted(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0124usize) as _) }
}
#[doc = "Publish configuration for event HFCLKSTARTED."]
#[inline(always)]
pub const fn publish_hfclkstarted(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0180usize) as _) }
}
#[doc = "Publish configuration for event LFCLKSTARTED."]
#[inline(always)]
pub const fn publish_lfclkstarted(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0184usize) as _) }
}
#[doc = "Publish configuration for event DONE."]
#[inline(always)]
pub const fn publish_done(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x019cusize) as _) }
}
#[doc = "Publish configuration for event HFCLKAUDIOSTARTED."]
#[inline(always)]
pub const fn publish_hfclkaudiostarted(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01a0usize) as _) }
}
#[doc = "Publish configuration for event HFCLK192MSTARTED."]
#[inline(always)]
pub const fn publish_hfclk192mstarted(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01a4usize) as _) }
}
#[doc = "Enable or disable interrupt."]
#[inline(always)]
pub const fn inten(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0300usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "Pending interrupts."]
#[inline(always)]
pub const fn intpend(self) -> crate::common::Reg<regs::Int, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x030cusize) as _) }
}
#[doc = "Status indicating that HFCLKSTART task has been triggered."]
#[inline(always)]
pub const fn hfclkrun(self) -> crate::common::Reg<regs::Hfclkrun, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0408usize) as _) }
}
#[doc = "Status indicating which HFCLK128M/HFCLK64M source is running This register value in any CLOCK instance reflects status only due to configurations/actions in that CLOCK instance."]
#[inline(always)]
pub const fn hfclkstat(self) -> crate::common::Reg<regs::Hfclkstat, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x040cusize) as _) }
}
#[doc = "Status indicating that LFCLKSTART task has been triggered."]
#[inline(always)]
pub const fn lfclkrun(self) -> crate::common::Reg<regs::Lfclkrun, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0414usize) as _) }
}
#[doc = "Status indicating which LFCLK source is running This register value in any CLOCK instance reflects status only due to configurations/actions in that CLOCK instance."]
#[inline(always)]
pub const fn lfclkstat(self) -> crate::common::Reg<regs::Lfclkstat, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0418usize) as _) }
}
#[doc = "Copy of LFCLKSRC register, set when LFCLKSTART task was triggered."]
#[inline(always)]
pub const fn lfclksrccopy(
self,
) -> crate::common::Reg<regs::Lfclksrccopy, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x041cusize) as _) }
}
#[doc = "Status indicating that HFCLKAUDIOSTART task has been triggered."]
#[inline(always)]
pub const fn hfclkaudiorun(
self,
) -> crate::common::Reg<regs::Hfclkaudiorun, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0450usize) as _) }
}
#[doc = "Status indicating which HFCLKAUDIO source is running."]
#[inline(always)]
pub const fn hfclkaudiostat(
self,
) -> crate::common::Reg<regs::Hfclkaudiostat, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0454usize) as _) }
}
#[doc = "Status indicating that HFCLK192MSTART task has been triggered."]
#[inline(always)]
pub const fn hfclk192mrun(
self,
) -> crate::common::Reg<regs::Hfclk192mrun, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0458usize) as _) }
}
#[doc = "Status indicating which HFCLK192M source is running."]
#[inline(always)]
pub const fn hfclk192mstat(
self,
) -> crate::common::Reg<regs::Hfclk192mstat, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x045cusize) as _) }
}
#[doc = "Clock source for HFCLK128M/HFCLK64M."]
#[inline(always)]
pub const fn hfclksrc(self) -> crate::common::Reg<regs::Hfclksrc, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0514usize) as _) }
}
#[doc = "Clock source for LFCLK."]
#[inline(always)]
pub const fn lfclksrc(self) -> crate::common::Reg<regs::Lfclksrc, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0518usize) as _) }
}
#[doc = "HFCLK128M frequency configuration."]
#[inline(always)]
pub const fn hfclkctrl(self) -> crate::common::Reg<regs::Hfclkctrl, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0558usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn hfclkaudio(self) -> Hfclkaudio {
unsafe { Hfclkaudio::from_ptr(self.ptr.wrapping_add(0x055cusize) as _) }
}
#[doc = "Automatic or manual control of HFCLK128M/HFCLK64M."]
#[inline(always)]
pub const fn hfclkalwaysrun(
self,
) -> crate::common::Reg<regs::Hfclkalwaysrun, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0570usize) as _) }
}
#[doc = "Automatic or manual control of LFCLK."]
#[inline(always)]
pub const fn lfclkalwaysrun(
self,
) -> crate::common::Reg<regs::Lfclkalwaysrun, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0574usize) as _) }
}
#[doc = "Automatic or manual control of HFCLKAUDIO."]
#[inline(always)]
pub const fn hfclkaudioalwaysrun(
self,
) -> crate::common::Reg<regs::Hfclkaudioalwaysrun, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x057cusize) as _) }
}
#[doc = "Clock source for HFCLK192M."]
#[inline(always)]
pub const fn hfclk192msrc(
self,
) -> crate::common::Reg<regs::Hfclk192msrc, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0580usize) as _) }
}
#[doc = "Automatic or manual control of HFCLK192M."]
#[inline(always)]
pub const fn hfclk192malwaysrun(
self,
) -> crate::common::Reg<regs::Hfclk192malwaysrun, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0584usize) as _) }
}
#[doc = "HFCLK192M frequency configuration."]
#[inline(always)]
pub const fn hfclk192mctrl(
self,
) -> crate::common::Reg<regs::Hfclk192mctrl, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x05b8usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Hfclkaudio {
ptr: *mut u8,
}
unsafe impl Send for Hfclkaudio {}
unsafe impl Sync for Hfclkaudio {}
impl Hfclkaudio {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Audio PLL frequency in 11.176 MHz - 11.402 MHz or 12.165 MHz - 12.411 MHz frequency bands."]
#[inline(always)]
pub const fn frequency(self) -> crate::common::Reg<regs::Frequency, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
}
pub mod regs {
#[doc = "Audio PLL frequency in 11.176 MHz - 11.402 MHz or 12.165 MHz - 12.411 MHz frequency bands."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Frequency(pub u32);
impl Frequency {
#[doc = "Frequency 0: 10.666 MHz 65535: 13.333 MHz."]
#[must_use]
#[inline(always)]
pub const fn frequency(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Frequency 0: 10.666 MHz 65535: 13.333 MHz."]
#[inline(always)]
pub const fn set_frequency(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for Frequency {
#[inline(always)]
fn default() -> Frequency {
Frequency(0)
}
}
impl core::fmt::Debug for Frequency {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Frequency")
.field("frequency", &self.frequency())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Frequency {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Frequency {{ frequency: {=u16:?} }}", self.frequency())
}
}
#[doc = "Automatic or manual control of HFCLK192M."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Hfclk192malwaysrun(pub u32);
impl Hfclk192malwaysrun {
#[doc = "Ensure clock is always running."]
#[must_use]
#[inline(always)]
pub const fn alwaysrun(&self) -> super::vals::Hfclk192malwaysrunAlwaysrun {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Hfclk192malwaysrunAlwaysrun::from_bits(val as u8)
}
#[doc = "Ensure clock is always running."]
#[inline(always)]
pub const fn set_alwaysrun(&mut self, val: super::vals::Hfclk192malwaysrunAlwaysrun) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Hfclk192malwaysrun {
#[inline(always)]
fn default() -> Hfclk192malwaysrun {
Hfclk192malwaysrun(0)
}
}
impl core::fmt::Debug for Hfclk192malwaysrun {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Hfclk192malwaysrun")
.field("alwaysrun", &self.alwaysrun())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Hfclk192malwaysrun {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Hfclk192malwaysrun {{ alwaysrun: {:?} }}",
self.alwaysrun()
)
}
}
#[doc = "HFCLK192M frequency configuration."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Hfclk192mctrl(pub u32);
impl Hfclk192mctrl {
#[doc = "High frequency clock HCLK192M."]
#[must_use]
#[inline(always)]
pub const fn hclk192m(&self) -> super::vals::Hclk192m {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Hclk192m::from_bits(val as u8)
}
#[doc = "High frequency clock HCLK192M."]
#[inline(always)]
pub const fn set_hclk192m(&mut self, val: super::vals::Hclk192m) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for Hfclk192mctrl {
#[inline(always)]
fn default() -> Hfclk192mctrl {
Hfclk192mctrl(0)
}
}
impl core::fmt::Debug for Hfclk192mctrl {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Hfclk192mctrl")
.field("hclk192m", &self.hclk192m())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Hfclk192mctrl {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Hfclk192mctrl {{ hclk192m: {:?} }}", self.hclk192m())
}
}
#[doc = "Status indicating that HFCLK192MSTART task has been triggered."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Hfclk192mrun(pub u32);
impl Hfclk192mrun {
#[doc = "HFCLK192MSTART task triggered or not."]
#[must_use]
#[inline(always)]
pub const fn status(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "HFCLK192MSTART task triggered or not."]
#[inline(always)]
pub const fn set_status(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Hfclk192mrun {
#[inline(always)]
fn default() -> Hfclk192mrun {
Hfclk192mrun(0)
}
}
impl core::fmt::Debug for Hfclk192mrun {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Hfclk192mrun")
.field("status", &self.status())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Hfclk192mrun {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Hfclk192mrun {{ status: {=bool:?} }}", self.status())
}
}
#[doc = "Clock source for HFCLK192M."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Hfclk192msrc(pub u32);
impl Hfclk192msrc {
#[doc = "Select which HFCLK192M source is started by the HFCLK192MSTART task."]
#[must_use]
#[inline(always)]
pub const fn src(&self) -> super::vals::Hfclk192msrcSrc {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Hfclk192msrcSrc::from_bits(val as u8)
}
#[doc = "Select which HFCLK192M source is started by the HFCLK192MSTART task."]
#[inline(always)]
pub const fn set_src(&mut self, val: super::vals::Hfclk192msrcSrc) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Hfclk192msrc {
#[inline(always)]
fn default() -> Hfclk192msrc {
Hfclk192msrc(0)
}
}
impl core::fmt::Debug for Hfclk192msrc {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Hfclk192msrc")
.field("src", &self.src())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Hfclk192msrc {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Hfclk192msrc {{ src: {:?} }}", self.src())
}
}
#[doc = "Status indicating which HFCLK192M source is running."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Hfclk192mstat(pub u32);
impl Hfclk192mstat {
#[doc = "Active clock source."]
#[must_use]
#[inline(always)]
pub const fn src(&self) -> super::vals::Hfclk192mstatSrc {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Hfclk192mstatSrc::from_bits(val as u8)
}
#[doc = "Active clock source."]
#[inline(always)]
pub const fn set_src(&mut self, val: super::vals::Hfclk192mstatSrc) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "ALWAYSRUN activated."]
#[must_use]
#[inline(always)]
pub const fn alwaysrunning(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "ALWAYSRUN activated."]
#[inline(always)]
pub const fn set_alwaysrunning(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "HFCLK192M state."]
#[must_use]
#[inline(always)]
pub const fn state(&self) -> bool {
let val = (self.0 >> 16usize) & 0x01;
val != 0
}
#[doc = "HFCLK192M state."]
#[inline(always)]
pub const fn set_state(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
}
}
impl Default for Hfclk192mstat {
#[inline(always)]
fn default() -> Hfclk192mstat {
Hfclk192mstat(0)
}
}
impl core::fmt::Debug for Hfclk192mstat {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Hfclk192mstat")
.field("src", &self.src())
.field("alwaysrunning", &self.alwaysrunning())
.field("state", &self.state())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Hfclk192mstat {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Hfclk192mstat {{ src: {:?}, alwaysrunning: {=bool:?}, state: {=bool:?} }}",
self.src(),
self.alwaysrunning(),
self.state()
)
}
}
#[doc = "Automatic or manual control of HFCLK128M/HFCLK64M."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Hfclkalwaysrun(pub u32);
impl Hfclkalwaysrun {
#[doc = "Ensure clock is always running."]
#[must_use]
#[inline(always)]
pub const fn alwaysrun(&self) -> super::vals::HfclkalwaysrunAlwaysrun {
let val = (self.0 >> 0usize) & 0x01;
super::vals::HfclkalwaysrunAlwaysrun::from_bits(val as u8)
}
#[doc = "Ensure clock is always running."]
#[inline(always)]
pub const fn set_alwaysrun(&mut self, val: super::vals::HfclkalwaysrunAlwaysrun) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Hfclkalwaysrun {
#[inline(always)]
fn default() -> Hfclkalwaysrun {
Hfclkalwaysrun(0)
}
}
impl core::fmt::Debug for Hfclkalwaysrun {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Hfclkalwaysrun")
.field("alwaysrun", &self.alwaysrun())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Hfclkalwaysrun {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Hfclkalwaysrun {{ alwaysrun: {:?} }}", self.alwaysrun())
}
}
#[doc = "Automatic or manual control of HFCLKAUDIO."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Hfclkaudioalwaysrun(pub u32);
impl Hfclkaudioalwaysrun {
#[doc = "Ensure clock is always running."]
#[must_use]
#[inline(always)]
pub const fn alwaysrun(&self) -> super::vals::HfclkaudioalwaysrunAlwaysrun {
let val = (self.0 >> 0usize) & 0x01;
super::vals::HfclkaudioalwaysrunAlwaysrun::from_bits(val as u8)
}
#[doc = "Ensure clock is always running."]
#[inline(always)]
pub const fn set_alwaysrun(&mut self, val: super::vals::HfclkaudioalwaysrunAlwaysrun) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Hfclkaudioalwaysrun {
#[inline(always)]
fn default() -> Hfclkaudioalwaysrun {
Hfclkaudioalwaysrun(0)
}
}
impl core::fmt::Debug for Hfclkaudioalwaysrun {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Hfclkaudioalwaysrun")
.field("alwaysrun", &self.alwaysrun())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Hfclkaudioalwaysrun {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Hfclkaudioalwaysrun {{ alwaysrun: {:?} }}",
self.alwaysrun()
)
}
}
#[doc = "Status indicating that HFCLKAUDIOSTART task has been triggered."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Hfclkaudiorun(pub u32);
impl Hfclkaudiorun {
#[doc = "HFCLKAUDIOSTART task triggered or not."]
#[must_use]
#[inline(always)]
pub const fn status(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "HFCLKAUDIOSTART task triggered or not."]
#[inline(always)]
pub const fn set_status(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Hfclkaudiorun {
#[inline(always)]
fn default() -> Hfclkaudiorun {
Hfclkaudiorun(0)
}
}
impl core::fmt::Debug for Hfclkaudiorun {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Hfclkaudiorun")
.field("status", &self.status())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Hfclkaudiorun {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Hfclkaudiorun {{ status: {=bool:?} }}", self.status())
}
}
#[doc = "Status indicating which HFCLKAUDIO source is running."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Hfclkaudiostat(pub u32);
impl Hfclkaudiostat {
#[doc = "ALWAYSRUN activated."]
#[must_use]
#[inline(always)]
pub const fn alwaysrunning(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "ALWAYSRUN activated."]
#[inline(always)]
pub const fn set_alwaysrunning(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "HFCLKAUDIO state."]
#[must_use]
#[inline(always)]
pub const fn state(&self) -> bool {
let val = (self.0 >> 16usize) & 0x01;
val != 0
}
#[doc = "HFCLKAUDIO state."]
#[inline(always)]
pub const fn set_state(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
}
}
impl Default for Hfclkaudiostat {
#[inline(always)]
fn default() -> Hfclkaudiostat {
Hfclkaudiostat(0)
}
}
impl core::fmt::Debug for Hfclkaudiostat {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Hfclkaudiostat")
.field("alwaysrunning", &self.alwaysrunning())
.field("state", &self.state())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Hfclkaudiostat {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Hfclkaudiostat {{ alwaysrunning: {=bool:?}, state: {=bool:?} }}",
self.alwaysrunning(),
self.state()
)
}
}
#[doc = "HFCLK128M frequency configuration."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Hfclkctrl(pub u32);
impl Hfclkctrl {
#[doc = "High frequency clock HCLK."]
#[must_use]
#[inline(always)]
pub const fn hclk(&self) -> super::vals::Hclk {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Hclk::from_bits(val as u8)
}
#[doc = "High frequency clock HCLK."]
#[inline(always)]
pub const fn set_hclk(&mut self, val: super::vals::Hclk) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for Hfclkctrl {
#[inline(always)]
fn default() -> Hfclkctrl {
Hfclkctrl(0)
}
}
impl core::fmt::Debug for Hfclkctrl {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Hfclkctrl")
.field("hclk", &self.hclk())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Hfclkctrl {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Hfclkctrl {{ hclk: {:?} }}", self.hclk())
}
}
#[doc = "Status indicating that HFCLKSTART task has been triggered."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Hfclkrun(pub u32);
impl Hfclkrun {
#[doc = "HFCLKSTART task triggered or not."]
#[must_use]
#[inline(always)]
pub const fn status(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "HFCLKSTART task triggered or not."]
#[inline(always)]
pub const fn set_status(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Hfclkrun {
#[inline(always)]
fn default() -> Hfclkrun {
Hfclkrun(0)
}
}
impl core::fmt::Debug for Hfclkrun {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Hfclkrun")
.field("status", &self.status())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Hfclkrun {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Hfclkrun {{ status: {=bool:?} }}", self.status())
}
}
#[doc = "Clock source for HFCLK128M/HFCLK64M."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Hfclksrc(pub u32);
impl Hfclksrc {
#[doc = "Select which HFCLK source is started by the HFCLKSTART task."]
#[must_use]
#[inline(always)]
pub const fn src(&self) -> super::vals::HfclksrcSrc {
let val = (self.0 >> 0usize) & 0x01;
super::vals::HfclksrcSrc::from_bits(val as u8)
}
#[doc = "Select which HFCLK source is started by the HFCLKSTART task."]
#[inline(always)]
pub const fn set_src(&mut self, val: super::vals::HfclksrcSrc) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Hfclksrc {
#[inline(always)]
fn default() -> Hfclksrc {
Hfclksrc(0)
}
}
impl core::fmt::Debug for Hfclksrc {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Hfclksrc")
.field("src", &self.src())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Hfclksrc {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Hfclksrc {{ src: {:?} }}", self.src())
}
}
#[doc = "Status indicating which HFCLK128M/HFCLK64M source is running This register value in any CLOCK instance reflects status only due to configurations/actions in that CLOCK instance."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Hfclkstat(pub u32);
impl Hfclkstat {
#[doc = "Active clock source."]
#[must_use]
#[inline(always)]
pub const fn src(&self) -> super::vals::HfclkstatSrc {
let val = (self.0 >> 0usize) & 0x01;
super::vals::HfclkstatSrc::from_bits(val as u8)
}
#[doc = "Active clock source."]
#[inline(always)]
pub const fn set_src(&mut self, val: super::vals::HfclkstatSrc) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "ALWAYSRUN activated."]
#[must_use]
#[inline(always)]
pub const fn alwaysrunning(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "ALWAYSRUN activated."]
#[inline(always)]
pub const fn set_alwaysrunning(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "HFCLK state."]
#[must_use]
#[inline(always)]
pub const fn state(&self) -> bool {
let val = (self.0 >> 16usize) & 0x01;
val != 0
}
#[doc = "HFCLK state."]
#[inline(always)]
pub const fn set_state(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
}
}
impl Default for Hfclkstat {
#[inline(always)]
fn default() -> Hfclkstat {
Hfclkstat(0)
}
}
impl core::fmt::Debug for Hfclkstat {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Hfclkstat")
.field("src", &self.src())
.field("alwaysrunning", &self.alwaysrunning())
.field("state", &self.state())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Hfclkstat {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Hfclkstat {{ src: {:?}, alwaysrunning: {=bool:?}, state: {=bool:?} }}",
self.src(),
self.alwaysrunning(),
self.state()
)
}
}
#[doc = "Enable or disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Enable or disable interrupt for event HFCLKSTARTED."]
#[must_use]
#[inline(always)]
pub const fn hfclkstarted(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event HFCLKSTARTED."]
#[inline(always)]
pub const fn set_hfclkstarted(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Enable or disable interrupt for event LFCLKSTARTED."]
#[must_use]
#[inline(always)]
pub const fn lfclkstarted(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event LFCLKSTARTED."]
#[inline(always)]
pub const fn set_lfclkstarted(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enable or disable interrupt for event DONE."]
#[must_use]
#[inline(always)]
pub const fn done(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event DONE."]
#[inline(always)]
pub const fn set_done(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Enable or disable interrupt for event HFCLKAUDIOSTARTED."]
#[must_use]
#[inline(always)]
pub const fn hfclkaudiostarted(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event HFCLKAUDIOSTARTED."]
#[inline(always)]
pub const fn set_hfclkaudiostarted(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "Enable or disable interrupt for event HFCLK192MSTARTED."]
#[must_use]
#[inline(always)]
pub const fn hfclk192mstarted(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event HFCLK192MSTARTED."]
#[inline(always)]
pub const fn set_hfclk192mstarted(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("hfclkstarted", &self.hfclkstarted())
.field("lfclkstarted", &self.lfclkstarted())
.field("done", &self.done())
.field("hfclkaudiostarted", &self.hfclkaudiostarted())
.field("hfclk192mstarted", &self.hfclk192mstarted())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Int {{ hfclkstarted: {=bool:?}, lfclkstarted: {=bool:?}, done: {=bool:?}, hfclkaudiostarted: {=bool:?}, hfclk192mstarted: {=bool:?} }}" , self . hfclkstarted () , self . lfclkstarted () , self . done () , self . hfclkaudiostarted () , self . hfclk192mstarted ())
}
}
#[doc = "Automatic or manual control of LFCLK."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Lfclkalwaysrun(pub u32);
impl Lfclkalwaysrun {
#[doc = "Ensure clock is always running."]
#[must_use]
#[inline(always)]
pub const fn alwaysrun(&self) -> super::vals::LfclkalwaysrunAlwaysrun {
let val = (self.0 >> 0usize) & 0x01;
super::vals::LfclkalwaysrunAlwaysrun::from_bits(val as u8)
}
#[doc = "Ensure clock is always running."]
#[inline(always)]
pub const fn set_alwaysrun(&mut self, val: super::vals::LfclkalwaysrunAlwaysrun) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Lfclkalwaysrun {
#[inline(always)]
fn default() -> Lfclkalwaysrun {
Lfclkalwaysrun(0)
}
}
impl core::fmt::Debug for Lfclkalwaysrun {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Lfclkalwaysrun")
.field("alwaysrun", &self.alwaysrun())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Lfclkalwaysrun {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Lfclkalwaysrun {{ alwaysrun: {:?} }}", self.alwaysrun())
}
}
#[doc = "Status indicating that LFCLKSTART task has been triggered."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Lfclkrun(pub u32);
impl Lfclkrun {
#[doc = "LFCLKSTART task triggered or not."]
#[must_use]
#[inline(always)]
pub const fn status(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "LFCLKSTART task triggered or not."]
#[inline(always)]
pub const fn set_status(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Lfclkrun {
#[inline(always)]
fn default() -> Lfclkrun {
Lfclkrun(0)
}
}
impl core::fmt::Debug for Lfclkrun {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Lfclkrun")
.field("status", &self.status())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Lfclkrun {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Lfclkrun {{ status: {=bool:?} }}", self.status())
}
}
#[doc = "Clock source for LFCLK."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Lfclksrc(pub u32);
impl Lfclksrc {
#[doc = "Select which LFCLK source is started by the LFCLKSTART task."]
#[must_use]
#[inline(always)]
pub const fn src(&self) -> super::vals::Lfclksrc {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Lfclksrc::from_bits(val as u8)
}
#[doc = "Select which LFCLK source is started by the LFCLKSTART task."]
#[inline(always)]
pub const fn set_src(&mut self, val: super::vals::Lfclksrc) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for Lfclksrc {
#[inline(always)]
fn default() -> Lfclksrc {
Lfclksrc(0)
}
}
impl core::fmt::Debug for Lfclksrc {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Lfclksrc")
.field("src", &self.src())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Lfclksrc {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Lfclksrc {{ src: {:?} }}", self.src())
}
}
#[doc = "Copy of LFCLKSRC register, set when LFCLKSTART task was triggered."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Lfclksrccopy(pub u32);
impl Lfclksrccopy {
#[doc = "Clock source."]
#[must_use]
#[inline(always)]
pub const fn src(&self) -> super::vals::Lfclksrc {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Lfclksrc::from_bits(val as u8)
}
#[doc = "Clock source."]
#[inline(always)]
pub const fn set_src(&mut self, val: super::vals::Lfclksrc) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for Lfclksrccopy {
#[inline(always)]
fn default() -> Lfclksrccopy {
Lfclksrccopy(0)
}
}
impl core::fmt::Debug for Lfclksrccopy {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Lfclksrccopy")
.field("src", &self.src())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Lfclksrccopy {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Lfclksrccopy {{ src: {:?} }}", self.src())
}
}
#[doc = "Status indicating which LFCLK source is running This register value in any CLOCK instance reflects status only due to configurations/actions in that CLOCK instance."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Lfclkstat(pub u32);
impl Lfclkstat {
#[doc = "Active clock source."]
#[must_use]
#[inline(always)]
pub const fn src(&self) -> super::vals::Lfclksrc {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Lfclksrc::from_bits(val as u8)
}
#[doc = "Active clock source."]
#[inline(always)]
pub const fn set_src(&mut self, val: super::vals::Lfclksrc) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
#[doc = "ALWAYSRUN activated."]
#[must_use]
#[inline(always)]
pub const fn alwaysrunning(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "ALWAYSRUN activated."]
#[inline(always)]
pub const fn set_alwaysrunning(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "LFCLK state."]
#[must_use]
#[inline(always)]
pub const fn state(&self) -> bool {
let val = (self.0 >> 16usize) & 0x01;
val != 0
}
#[doc = "LFCLK state."]
#[inline(always)]
pub const fn set_state(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
}
}
impl Default for Lfclkstat {
#[inline(always)]
fn default() -> Lfclkstat {
Lfclkstat(0)
}
}
impl core::fmt::Debug for Lfclkstat {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Lfclkstat")
.field("src", &self.src())
.field("alwaysrunning", &self.alwaysrunning())
.field("state", &self.state())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Lfclkstat {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Lfclkstat {{ src: {:?}, alwaysrunning: {=bool:?}, state: {=bool:?} }}",
self.src(),
self.alwaysrunning(),
self.state()
)
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Hclk {
#[doc = "Divide HFCLK by 1."]
Div1 = 0x0,
#[doc = "Divide HFCLK by 2."]
Div2 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
}
impl Hclk {
#[inline(always)]
pub const fn from_bits(val: u8) -> Hclk {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Hclk {
#[inline(always)]
fn from(val: u8) -> Hclk {
Hclk::from_bits(val)
}
}
impl From<Hclk> for u8 {
#[inline(always)]
fn from(val: Hclk) -> u8 {
Hclk::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Hclk192m {
#[doc = "Divide HFCLK192M by 1."]
Div1 = 0x0,
#[doc = "Divide HFCLK192M by 2."]
Div2 = 0x01,
#[doc = "Divide HFCLK192M by 4."]
Div4 = 0x02,
_RESERVED_3 = 0x03,
}
impl Hclk192m {
#[inline(always)]
pub const fn from_bits(val: u8) -> Hclk192m {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Hclk192m {
#[inline(always)]
fn from(val: u8) -> Hclk192m {
Hclk192m::from_bits(val)
}
}
impl From<Hclk192m> for u8 {
#[inline(always)]
fn from(val: Hclk192m) -> u8 {
Hclk192m::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Hfclk192malwaysrunAlwaysrun {
#[doc = "Use automatic clock control."]
Automatic = 0x0,
#[doc = "Ensure clock is always running."]
AlwaysRun = 0x01,
}
impl Hfclk192malwaysrunAlwaysrun {
#[inline(always)]
pub const fn from_bits(val: u8) -> Hfclk192malwaysrunAlwaysrun {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Hfclk192malwaysrunAlwaysrun {
#[inline(always)]
fn from(val: u8) -> Hfclk192malwaysrunAlwaysrun {
Hfclk192malwaysrunAlwaysrun::from_bits(val)
}
}
impl From<Hfclk192malwaysrunAlwaysrun> for u8 {
#[inline(always)]
fn from(val: Hfclk192malwaysrunAlwaysrun) -> u8 {
Hfclk192malwaysrunAlwaysrun::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Hfclk192msrcSrc {
#[doc = "HFCLK192MSTART task starts HFINT oscillator."]
Hfint = 0x0,
#[doc = "HFCLK192MSTART task starts HFXO oscillator."]
Hfxo = 0x01,
}
impl Hfclk192msrcSrc {
#[inline(always)]
pub const fn from_bits(val: u8) -> Hfclk192msrcSrc {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Hfclk192msrcSrc {
#[inline(always)]
fn from(val: u8) -> Hfclk192msrcSrc {
Hfclk192msrcSrc::from_bits(val)
}
}
impl From<Hfclk192msrcSrc> for u8 {
#[inline(always)]
fn from(val: Hfclk192msrcSrc) -> u8 {
Hfclk192msrcSrc::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Hfclk192mstatSrc {
#[doc = "Clock source: HFINT - on-chip oscillator."]
Hfint = 0x0,
#[doc = "Clock source: HFXO - derived from external 32 MHz crystal oscillator."]
Hfxo = 0x01,
}
impl Hfclk192mstatSrc {
#[inline(always)]
pub const fn from_bits(val: u8) -> Hfclk192mstatSrc {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Hfclk192mstatSrc {
#[inline(always)]
fn from(val: u8) -> Hfclk192mstatSrc {
Hfclk192mstatSrc::from_bits(val)
}
}
impl From<Hfclk192mstatSrc> for u8 {
#[inline(always)]
fn from(val: Hfclk192mstatSrc) -> u8 {
Hfclk192mstatSrc::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum HfclkalwaysrunAlwaysrun {
#[doc = "Use automatic clock control."]
Automatic = 0x0,
#[doc = "Ensure clock is always running."]
AlwaysRun = 0x01,
}
impl HfclkalwaysrunAlwaysrun {
#[inline(always)]
pub const fn from_bits(val: u8) -> HfclkalwaysrunAlwaysrun {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for HfclkalwaysrunAlwaysrun {
#[inline(always)]
fn from(val: u8) -> HfclkalwaysrunAlwaysrun {
HfclkalwaysrunAlwaysrun::from_bits(val)
}
}
impl From<HfclkalwaysrunAlwaysrun> for u8 {
#[inline(always)]
fn from(val: HfclkalwaysrunAlwaysrun) -> u8 {
HfclkalwaysrunAlwaysrun::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum HfclkaudioalwaysrunAlwaysrun {
#[doc = "Use automatic clock control."]
Automatic = 0x0,
#[doc = "Ensure clock is always running."]
AlwaysRun = 0x01,
}
impl HfclkaudioalwaysrunAlwaysrun {
#[inline(always)]
pub const fn from_bits(val: u8) -> HfclkaudioalwaysrunAlwaysrun {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for HfclkaudioalwaysrunAlwaysrun {
#[inline(always)]
fn from(val: u8) -> HfclkaudioalwaysrunAlwaysrun {
HfclkaudioalwaysrunAlwaysrun::from_bits(val)
}
}
impl From<HfclkaudioalwaysrunAlwaysrun> for u8 {
#[inline(always)]
fn from(val: HfclkaudioalwaysrunAlwaysrun) -> u8 {
HfclkaudioalwaysrunAlwaysrun::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum HfclksrcSrc {
#[doc = "HFCLKSTART task starts HFINT oscillator."]
Hfint = 0x0,
#[doc = "HFCLKSTART task starts HFXO oscillator."]
Hfxo = 0x01,
}
impl HfclksrcSrc {
#[inline(always)]
pub const fn from_bits(val: u8) -> HfclksrcSrc {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for HfclksrcSrc {
#[inline(always)]
fn from(val: u8) -> HfclksrcSrc {
HfclksrcSrc::from_bits(val)
}
}
impl From<HfclksrcSrc> for u8 {
#[inline(always)]
fn from(val: HfclksrcSrc) -> u8 {
HfclksrcSrc::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum HfclkstatSrc {
#[doc = "Clock source: HFINT - 128 MHz on-chip oscillator."]
Hfint = 0x0,
#[doc = "Clock source: HFXO - 128 MHz clock derived from external 32 MHz crystal oscillator."]
Hfxo = 0x01,
}
impl HfclkstatSrc {
#[inline(always)]
pub const fn from_bits(val: u8) -> HfclkstatSrc {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for HfclkstatSrc {
#[inline(always)]
fn from(val: u8) -> HfclkstatSrc {
HfclkstatSrc::from_bits(val)
}
}
impl From<HfclkstatSrc> for u8 {
#[inline(always)]
fn from(val: HfclkstatSrc) -> u8 {
HfclkstatSrc::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum LfclkalwaysrunAlwaysrun {
#[doc = "Use automatic clock control."]
Automatic = 0x0,
#[doc = "Ensure clock is always running."]
AlwaysRun = 0x01,
}
impl LfclkalwaysrunAlwaysrun {
#[inline(always)]
pub const fn from_bits(val: u8) -> LfclkalwaysrunAlwaysrun {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for LfclkalwaysrunAlwaysrun {
#[inline(always)]
fn from(val: u8) -> LfclkalwaysrunAlwaysrun {
LfclkalwaysrunAlwaysrun::from_bits(val)
}
}
impl From<LfclkalwaysrunAlwaysrun> for u8 {
#[inline(always)]
fn from(val: LfclkalwaysrunAlwaysrun) -> u8 {
LfclkalwaysrunAlwaysrun::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Lfclksrc {
_RESERVED_0 = 0x0,
#[doc = "32.768 kHz RC oscillator."]
Lfrc = 0x01,
#[doc = "32.768 kHz crystal oscillator."]
Lfxo = 0x02,
#[doc = "32.768 kHz synthesized from HFCLK."]
Lfsynt = 0x03,
}
impl Lfclksrc {
#[inline(always)]
pub const fn from_bits(val: u8) -> Lfclksrc {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Lfclksrc {
#[inline(always)]
fn from(val: u8) -> Lfclksrc {
Lfclksrc::from_bits(val)
}
}
impl From<Lfclksrc> for u8 {
#[inline(always)]
fn from(val: Lfclksrc) -> u8 {
Lfclksrc::to_bits(val)
}
}
}
}
pub mod common {
use core::marker::PhantomData;
#[derive(Copy, Clone, PartialEq, Eq)]
pub struct RW;
#[derive(Copy, Clone, PartialEq, Eq)]
pub struct R;
#[derive(Copy, Clone, PartialEq, Eq)]
pub struct W;
mod sealed {
use super::*;
pub trait Access {}
impl Access for R {}
impl Access for W {}
impl Access for RW {}
}
pub trait Access: sealed::Access + Copy {}
impl Access for R {}
impl Access for W {}
impl Access for RW {}
pub trait Read: Access {}
impl Read for RW {}
impl Read for R {}
pub trait Write: Access {}
impl Write for RW {}
impl Write for W {}
#[derive(Copy, Clone, PartialEq, Eq)]
pub struct Reg<T: Copy, A: Access> {
ptr: *mut u8,
phantom: PhantomData<*mut (T, A)>,
}
unsafe impl<T: Copy, A: Access> Send for Reg<T, A> {}
unsafe impl<T: Copy, A: Access> Sync for Reg<T, A> {}
impl<T: Copy, A: Access> Reg<T, A> {
#[allow(clippy::missing_safety_doc)]
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut T) -> Self {
Self {
ptr: ptr as _,
phantom: PhantomData,
}
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut T {
self.ptr as _
}
}
impl<T: Copy, A: Read> Reg<T, A> {
#[inline(always)]
pub fn read(&self) -> T {
unsafe { (self.ptr as *mut T).read_volatile() }
}
}
impl<T: Copy, A: Write> Reg<T, A> {
#[inline(always)]
pub fn write_value(&self, val: T) {
unsafe { (self.ptr as *mut T).write_volatile(val) }
}
}
impl<T: Default + Copy, A: Write> Reg<T, A> {
#[inline(always)]
pub fn write(&self, f: impl FnOnce(&mut T)) {
let mut val = Default::default();
f(&mut val);
self.write_value(val);
}
}
impl<T: Copy, A: Read + Write> Reg<T, A> {
#[inline(always)]
pub fn modify(&self, f: impl FnOnce(&mut T)) {
let mut val = self.read();
f(&mut val);
self.write_value(val);
}
}
}
pub mod comp {
#[doc = "Comparator 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Comp {
ptr: *mut u8,
}
unsafe impl Send for Comp {}
unsafe impl Sync for Comp {}
impl Comp {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Start comparator."]
#[inline(always)]
pub const fn tasks_start(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Stop comparator."]
#[inline(always)]
pub const fn tasks_stop(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Sample comparator value."]
#[inline(always)]
pub const fn tasks_sample(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Subscribe configuration for task START."]
#[inline(always)]
pub const fn subscribe_start(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x80usize) as _) }
}
#[doc = "Subscribe configuration for task STOP."]
#[inline(always)]
pub const fn subscribe_stop(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x84usize) as _) }
}
#[doc = "Subscribe configuration for task SAMPLE."]
#[inline(always)]
pub const fn subscribe_sample(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x88usize) as _) }
}
#[doc = "COMP is ready and output is valid."]
#[inline(always)]
pub const fn events_ready(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0100usize) as _) }
}
#[doc = "Downward crossing."]
#[inline(always)]
pub const fn events_down(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0104usize) as _) }
}
#[doc = "Upward crossing."]
#[inline(always)]
pub const fn events_up(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0108usize) as _) }
}
#[doc = "Downward or upward crossing."]
#[inline(always)]
pub const fn events_cross(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x010cusize) as _) }
}
#[doc = "Publish configuration for event READY."]
#[inline(always)]
pub const fn publish_ready(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0180usize) as _) }
}
#[doc = "Publish configuration for event DOWN."]
#[inline(always)]
pub const fn publish_down(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0184usize) as _) }
}
#[doc = "Publish configuration for event UP."]
#[inline(always)]
pub const fn publish_up(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0188usize) as _) }
}
#[doc = "Publish configuration for event CROSS."]
#[inline(always)]
pub const fn publish_cross(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x018cusize) as _) }
}
#[doc = "Shortcuts between local events and tasks."]
#[inline(always)]
pub const fn shorts(self) -> crate::common::Reg<regs::Shorts, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0200usize) as _) }
}
#[doc = "Enable or disable interrupt."]
#[inline(always)]
pub const fn inten(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0300usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "Compare result."]
#[inline(always)]
pub const fn result(self) -> crate::common::Reg<regs::Result, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0400usize) as _) }
}
#[doc = "COMP enable."]
#[inline(always)]
pub const fn enable(self) -> crate::common::Reg<regs::Enable, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0500usize) as _) }
}
#[doc = "Pin select."]
#[inline(always)]
pub const fn psel(self) -> crate::common::Reg<regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0504usize) as _) }
}
#[doc = "Reference source select for single-ended mode."]
#[inline(always)]
pub const fn refsel(self) -> crate::common::Reg<regs::Refsel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0508usize) as _) }
}
#[doc = "External reference select."]
#[inline(always)]
pub const fn extrefsel(self) -> crate::common::Reg<regs::Extrefsel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x050cusize) as _) }
}
#[doc = "Threshold configuration for hysteresis unit."]
#[inline(always)]
pub const fn th(self) -> crate::common::Reg<regs::Th, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0530usize) as _) }
}
#[doc = "Mode configuration."]
#[inline(always)]
pub const fn mode(self) -> crate::common::Reg<regs::Mode, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0534usize) as _) }
}
#[doc = "Comparator hysteresis enable."]
#[inline(always)]
pub const fn hyst(self) -> crate::common::Reg<regs::Hyst, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0538usize) as _) }
}
#[doc = "Current source select on analog input."]
#[inline(always)]
pub const fn isource(self) -> crate::common::Reg<regs::Isource, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x053cusize) as _) }
}
}
pub mod regs {
#[doc = "COMP enable."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Enable(pub u32);
impl Enable {
#[doc = "Enable or disable COMP."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> super::vals::Enable {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Enable::from_bits(val as u8)
}
#[doc = "Enable or disable COMP."]
#[inline(always)]
pub const fn set_enable(&mut self, val: super::vals::Enable) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for Enable {
#[inline(always)]
fn default() -> Enable {
Enable(0)
}
}
impl core::fmt::Debug for Enable {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Enable")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Enable {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Enable {{ enable: {:?} }}", self.enable())
}
}
#[doc = "External reference select."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Extrefsel(pub u32);
impl Extrefsel {
#[doc = "External analog reference select."]
#[must_use]
#[inline(always)]
pub const fn extrefsel(&self) -> super::vals::Extrefsel {
let val = (self.0 >> 0usize) & 0x07;
super::vals::Extrefsel::from_bits(val as u8)
}
#[doc = "External analog reference select."]
#[inline(always)]
pub const fn set_extrefsel(&mut self, val: super::vals::Extrefsel) {
self.0 = (self.0 & !(0x07 << 0usize)) | (((val.to_bits() as u32) & 0x07) << 0usize);
}
}
impl Default for Extrefsel {
#[inline(always)]
fn default() -> Extrefsel {
Extrefsel(0)
}
}
impl core::fmt::Debug for Extrefsel {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Extrefsel")
.field("extrefsel", &self.extrefsel())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Extrefsel {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Extrefsel {{ extrefsel: {:?} }}", self.extrefsel())
}
}
#[doc = "Comparator hysteresis enable."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Hyst(pub u32);
impl Hyst {
#[doc = "Comparator hysteresis."]
#[must_use]
#[inline(always)]
pub const fn hyst(&self) -> super::vals::Hyst {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Hyst::from_bits(val as u8)
}
#[doc = "Comparator hysteresis."]
#[inline(always)]
pub const fn set_hyst(&mut self, val: super::vals::Hyst) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Hyst {
#[inline(always)]
fn default() -> Hyst {
Hyst(0)
}
}
impl core::fmt::Debug for Hyst {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Hyst").field("hyst", &self.hyst()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Hyst {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Hyst {{ hyst: {:?} }}", self.hyst())
}
}
#[doc = "Enable or disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Enable or disable interrupt for event READY."]
#[must_use]
#[inline(always)]
pub const fn ready(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event READY."]
#[inline(always)]
pub const fn set_ready(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Enable or disable interrupt for event DOWN."]
#[must_use]
#[inline(always)]
pub const fn down(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event DOWN."]
#[inline(always)]
pub const fn set_down(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enable or disable interrupt for event UP."]
#[must_use]
#[inline(always)]
pub const fn up(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event UP."]
#[inline(always)]
pub const fn set_up(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Enable or disable interrupt for event CROSS."]
#[must_use]
#[inline(always)]
pub const fn cross(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event CROSS."]
#[inline(always)]
pub const fn set_cross(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("ready", &self.ready())
.field("down", &self.down())
.field("up", &self.up())
.field("cross", &self.cross())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Int {{ ready: {=bool:?}, down: {=bool:?}, up: {=bool:?}, cross: {=bool:?} }}",
self.ready(),
self.down(),
self.up(),
self.cross()
)
}
}
#[doc = "Current source select on analog input."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Isource(pub u32);
impl Isource {
#[doc = "Comparator hysteresis."]
#[must_use]
#[inline(always)]
pub const fn isource(&self) -> super::vals::Isource {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Isource::from_bits(val as u8)
}
#[doc = "Comparator hysteresis."]
#[inline(always)]
pub const fn set_isource(&mut self, val: super::vals::Isource) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for Isource {
#[inline(always)]
fn default() -> Isource {
Isource(0)
}
}
impl core::fmt::Debug for Isource {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Isource")
.field("isource", &self.isource())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Isource {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Isource {{ isource: {:?} }}", self.isource())
}
}
#[doc = "Mode configuration."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Mode(pub u32);
impl Mode {
#[doc = "Speed and power modes."]
#[must_use]
#[inline(always)]
pub const fn sp(&self) -> super::vals::Sp {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Sp::from_bits(val as u8)
}
#[doc = "Speed and power modes."]
#[inline(always)]
pub const fn set_sp(&mut self, val: super::vals::Sp) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
#[doc = "Main operation modes."]
#[must_use]
#[inline(always)]
pub const fn main(&self) -> super::vals::Main {
let val = (self.0 >> 8usize) & 0x01;
super::vals::Main::from_bits(val as u8)
}
#[doc = "Main operation modes."]
#[inline(always)]
pub const fn set_main(&mut self, val: super::vals::Main) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val.to_bits() as u32) & 0x01) << 8usize);
}
}
impl Default for Mode {
#[inline(always)]
fn default() -> Mode {
Mode(0)
}
}
impl core::fmt::Debug for Mode {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Mode")
.field("sp", &self.sp())
.field("main", &self.main())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Mode {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Mode {{ sp: {:?}, main: {:?} }}", self.sp(), self.main())
}
}
#[doc = "Pin select."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Psel(pub u32);
impl Psel {
#[doc = "Analog pin select."]
#[must_use]
#[inline(always)]
pub const fn psel(&self) -> super::vals::PselPsel {
let val = (self.0 >> 0usize) & 0x07;
super::vals::PselPsel::from_bits(val as u8)
}
#[doc = "Analog pin select."]
#[inline(always)]
pub const fn set_psel(&mut self, val: super::vals::PselPsel) {
self.0 = (self.0 & !(0x07 << 0usize)) | (((val.to_bits() as u32) & 0x07) << 0usize);
}
}
impl Default for Psel {
#[inline(always)]
fn default() -> Psel {
Psel(0)
}
}
impl core::fmt::Debug for Psel {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Psel").field("psel", &self.psel()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Psel {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Psel {{ psel: {:?} }}", self.psel())
}
}
#[doc = "Reference source select for single-ended mode."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Refsel(pub u32);
impl Refsel {
#[doc = "Reference select."]
#[must_use]
#[inline(always)]
pub const fn refsel(&self) -> super::vals::Refsel {
let val = (self.0 >> 0usize) & 0x07;
super::vals::Refsel::from_bits(val as u8)
}
#[doc = "Reference select."]
#[inline(always)]
pub const fn set_refsel(&mut self, val: super::vals::Refsel) {
self.0 = (self.0 & !(0x07 << 0usize)) | (((val.to_bits() as u32) & 0x07) << 0usize);
}
}
impl Default for Refsel {
#[inline(always)]
fn default() -> Refsel {
Refsel(0)
}
}
impl core::fmt::Debug for Refsel {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Refsel")
.field("refsel", &self.refsel())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Refsel {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Refsel {{ refsel: {:?} }}", self.refsel())
}
}
#[doc = "Compare result."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Result(pub u32);
impl Result {
#[doc = "Result of last compare. Decision point SAMPLE task."]
#[must_use]
#[inline(always)]
pub const fn result(&self) -> super::vals::Result {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Result::from_bits(val as u8)
}
#[doc = "Result of last compare. Decision point SAMPLE task."]
#[inline(always)]
pub const fn set_result(&mut self, val: super::vals::Result) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Result {
#[inline(always)]
fn default() -> Result {
Result(0)
}
}
impl core::fmt::Debug for Result {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Result")
.field("result", &self.result())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Result {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Result {{ result: {:?} }}", self.result())
}
}
#[doc = "Shortcuts between local events and tasks."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Shorts(pub u32);
impl Shorts {
#[doc = "Shortcut between event READY and task SAMPLE."]
#[must_use]
#[inline(always)]
pub const fn ready_sample(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event READY and task SAMPLE."]
#[inline(always)]
pub const fn set_ready_sample(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Shortcut between event READY and task STOP."]
#[must_use]
#[inline(always)]
pub const fn ready_stop(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event READY and task STOP."]
#[inline(always)]
pub const fn set_ready_stop(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Shortcut between event DOWN and task STOP."]
#[must_use]
#[inline(always)]
pub const fn down_stop(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event DOWN and task STOP."]
#[inline(always)]
pub const fn set_down_stop(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Shortcut between event UP and task STOP."]
#[must_use]
#[inline(always)]
pub const fn up_stop(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event UP and task STOP."]
#[inline(always)]
pub const fn set_up_stop(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Shortcut between event CROSS and task STOP."]
#[must_use]
#[inline(always)]
pub const fn cross_stop(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event CROSS and task STOP."]
#[inline(always)]
pub const fn set_cross_stop(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
}
impl Default for Shorts {
#[inline(always)]
fn default() -> Shorts {
Shorts(0)
}
}
impl core::fmt::Debug for Shorts {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Shorts")
.field("ready_sample", &self.ready_sample())
.field("ready_stop", &self.ready_stop())
.field("down_stop", &self.down_stop())
.field("up_stop", &self.up_stop())
.field("cross_stop", &self.cross_stop())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Shorts {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Shorts {{ ready_sample: {=bool:?}, ready_stop: {=bool:?}, down_stop: {=bool:?}, up_stop: {=bool:?}, cross_stop: {=bool:?} }}" , self . ready_sample () , self . ready_stop () , self . down_stop () , self . up_stop () , self . cross_stop ())
}
}
#[doc = "Threshold configuration for hysteresis unit."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Th(pub u32);
impl Th {
#[doc = "VDOWN = (THDOWN+1)/64*VREF."]
#[must_use]
#[inline(always)]
pub const fn thdown(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x3f;
val as u8
}
#[doc = "VDOWN = (THDOWN+1)/64*VREF."]
#[inline(always)]
pub const fn set_thdown(&mut self, val: u8) {
self.0 = (self.0 & !(0x3f << 0usize)) | (((val as u32) & 0x3f) << 0usize);
}
#[doc = "VUP = (THUP+1)/64*VREF."]
#[must_use]
#[inline(always)]
pub const fn thup(&self) -> u8 {
let val = (self.0 >> 8usize) & 0x3f;
val as u8
}
#[doc = "VUP = (THUP+1)/64*VREF."]
#[inline(always)]
pub const fn set_thup(&mut self, val: u8) {
self.0 = (self.0 & !(0x3f << 8usize)) | (((val as u32) & 0x3f) << 8usize);
}
}
impl Default for Th {
#[inline(always)]
fn default() -> Th {
Th(0)
}
}
impl core::fmt::Debug for Th {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Th")
.field("thdown", &self.thdown())
.field("thup", &self.thup())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Th {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Th {{ thdown: {=u8:?}, thup: {=u8:?} }}",
self.thdown(),
self.thup()
)
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Enable {
#[doc = "Disable."]
Disabled = 0x0,
_RESERVED_1 = 0x01,
#[doc = "Enable."]
Enabled = 0x02,
_RESERVED_3 = 0x03,
}
impl Enable {
#[inline(always)]
pub const fn from_bits(val: u8) -> Enable {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Enable {
#[inline(always)]
fn from(val: u8) -> Enable {
Enable::from_bits(val)
}
}
impl From<Enable> for u8 {
#[inline(always)]
fn from(val: Enable) -> u8 {
Enable::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Extrefsel {
#[doc = "Use AIN0 as external analog reference."]
AnalogReference0 = 0x0,
#[doc = "Use AIN1 as external analog reference."]
AnalogReference1 = 0x01,
#[doc = "Use AIN2 as external analog reference."]
AnalogReference2 = 0x02,
#[doc = "Use AIN3 as external analog reference."]
AnalogReference3 = 0x03,
#[doc = "Use AIN4 as external analog reference."]
AnalogReference4 = 0x04,
#[doc = "Use AIN5 as external analog reference."]
AnalogReference5 = 0x05,
#[doc = "Use AIN6 as external analog reference."]
AnalogReference6 = 0x06,
#[doc = "Use AIN7 as external analog reference."]
AnalogReference7 = 0x07,
}
impl Extrefsel {
#[inline(always)]
pub const fn from_bits(val: u8) -> Extrefsel {
unsafe { core::mem::transmute(val & 0x07) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Extrefsel {
#[inline(always)]
fn from(val: u8) -> Extrefsel {
Extrefsel::from_bits(val)
}
}
impl From<Extrefsel> for u8 {
#[inline(always)]
fn from(val: Extrefsel) -> u8 {
Extrefsel::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Hyst {
#[doc = "Comparator hysteresis disabled."]
NoHyst = 0x0,
#[doc = "Comparator hysteresis enabled."]
Hyst50mV = 0x01,
}
impl Hyst {
#[inline(always)]
pub const fn from_bits(val: u8) -> Hyst {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Hyst {
#[inline(always)]
fn from(val: u8) -> Hyst {
Hyst::from_bits(val)
}
}
impl From<Hyst> for u8 {
#[inline(always)]
fn from(val: Hyst) -> u8 {
Hyst::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Isource {
#[doc = "Current source disabled."]
Off = 0x0,
#[doc = "Current source enabled (+/- 2.5 uA)."]
Ien2mA5 = 0x01,
#[doc = "Current source enabled (+/- 5 uA)."]
Ien5mA = 0x02,
#[doc = "Current source enabled (+/- 10 uA)."]
Ien10mA = 0x03,
}
impl Isource {
#[inline(always)]
pub const fn from_bits(val: u8) -> Isource {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Isource {
#[inline(always)]
fn from(val: u8) -> Isource {
Isource::from_bits(val)
}
}
impl From<Isource> for u8 {
#[inline(always)]
fn from(val: Isource) -> u8 {
Isource::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Main {
#[doc = "Single-ended mode."]
Se = 0x0,
#[doc = "Differential mode."]
Diff = 0x01,
}
impl Main {
#[inline(always)]
pub const fn from_bits(val: u8) -> Main {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Main {
#[inline(always)]
fn from(val: u8) -> Main {
Main::from_bits(val)
}
}
impl From<Main> for u8 {
#[inline(always)]
fn from(val: Main) -> u8 {
Main::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum PselPsel {
#[doc = "AIN0 selected as analog input."]
AnalogInput0 = 0x0,
#[doc = "AIN1 selected as analog input."]
AnalogInput1 = 0x01,
#[doc = "AIN2 selected as analog input."]
AnalogInput2 = 0x02,
#[doc = "AIN3 selected as analog input."]
AnalogInput3 = 0x03,
#[doc = "AIN4 selected as analog input."]
AnalogInput4 = 0x04,
#[doc = "AIN5 selected as analog input."]
AnalogInput5 = 0x05,
#[doc = "AIN6 selected as analog input."]
AnalogInput6 = 0x06,
#[doc = "AIN7 selected as analog input."]
AnalogInput7 = 0x07,
}
impl PselPsel {
#[inline(always)]
pub const fn from_bits(val: u8) -> PselPsel {
unsafe { core::mem::transmute(val & 0x07) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for PselPsel {
#[inline(always)]
fn from(val: u8) -> PselPsel {
PselPsel::from_bits(val)
}
}
impl From<PselPsel> for u8 {
#[inline(always)]
fn from(val: PselPsel) -> u8 {
PselPsel::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Refsel {
#[doc = "VREF = internal 1.2 V reference (VDD >= 1.7 V)."]
Int1v2 = 0x0,
#[doc = "VREF = internal 1.8 V reference (VDD >= VREF + 0.2 V)."]
Int1v8 = 0x01,
#[doc = "VREF = internal 2.4 V reference (VDD >= VREF + 0.2 V)."]
Int2v4 = 0x02,
_RESERVED_3 = 0x03,
#[doc = "VREF = VDD."]
Vdd = 0x04,
#[doc = "VREF = AREF."]
ARef = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
}
impl Refsel {
#[inline(always)]
pub const fn from_bits(val: u8) -> Refsel {
unsafe { core::mem::transmute(val & 0x07) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Refsel {
#[inline(always)]
fn from(val: u8) -> Refsel {
Refsel::from_bits(val)
}
}
impl From<Refsel> for u8 {
#[inline(always)]
fn from(val: Refsel) -> u8 {
Refsel::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Result {
#[doc = "Input voltage is below the threshold (VIN+ < VIN-)."]
Below = 0x0,
#[doc = "Input voltage is above the threshold (VIN+ > VIN-)."]
Above = 0x01,
}
impl Result {
#[inline(always)]
pub const fn from_bits(val: u8) -> Result {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Result {
#[inline(always)]
fn from(val: u8) -> Result {
Result::from_bits(val)
}
}
impl From<Result> for u8 {
#[inline(always)]
fn from(val: Result) -> u8 {
Result::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Sp {
#[doc = "Low-power mode."]
Low = 0x0,
#[doc = "Normal mode."]
Normal = 0x01,
#[doc = "High-speed mode."]
High = 0x02,
_RESERVED_3 = 0x03,
}
impl Sp {
#[inline(always)]
pub const fn from_bits(val: u8) -> Sp {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Sp {
#[inline(always)]
fn from(val: u8) -> Sp {
Sp::from_bits(val)
}
}
impl From<Sp> for u8 {
#[inline(always)]
fn from(val: Sp) -> u8 {
Sp::to_bits(val)
}
}
}
}
pub mod cryptocell {
#[doc = "CRYPTOCELL register interface."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cryptocell {
ptr: *mut u8,
}
unsafe impl Send for Cryptocell {}
unsafe impl Sync for Cryptocell {}
impl Cryptocell {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Enable CRYPTOCELL subsystem."]
#[inline(always)]
pub const fn enable(self) -> crate::common::Reg<regs::Enable, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0500usize) as _) }
}
}
pub mod regs {
#[doc = "Enable CRYPTOCELL subsystem."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Enable(pub u32);
impl Enable {
#[doc = "Enable or disable the CRYPTOCELL subsystem."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable the CRYPTOCELL subsystem."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Enable {
#[inline(always)]
fn default() -> Enable {
Enable(0)
}
}
impl core::fmt::Debug for Enable {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Enable")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Enable {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Enable {{ enable: {=bool:?} }}", self.enable())
}
}
}
}
pub mod cti {
#[doc = "Cross-Trigger Interface control. NOTE: this is not a separate peripheral, but describes CM33 functionality."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cti {
ptr: *mut u8,
}
unsafe impl Send for Cti {}
unsafe impl Sync for Cti {}
impl Cti {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "CTI Control register."]
#[inline(always)]
pub const fn cticontrol(self) -> crate::common::Reg<regs::Cticontrol, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "CTI Interrupt Acknowledge register."]
#[inline(always)]
pub const fn ctiintack(self) -> crate::common::Reg<regs::Ctiintack, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
#[doc = "CTI Application Trigger Set register."]
#[inline(always)]
pub const fn ctiappset(self) -> crate::common::Reg<regs::Ctiappset, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x14usize) as _) }
}
#[doc = "CTI Application Trigger Clear register."]
#[inline(always)]
pub const fn ctiappclear(self) -> crate::common::Reg<regs::Ctiappclear, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x18usize) as _) }
}
#[doc = "CTI Application Pulse register."]
#[inline(always)]
pub const fn ctiapppulse(self) -> crate::common::Reg<regs::Ctiapppulse, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x1cusize) as _) }
}
#[doc = "Description collection: CTI Trigger to Channel Enable register."]
#[inline(always)]
pub const fn ctiinen(
self,
n: usize,
) -> crate::common::Reg<regs::Ctiinen, crate::common::RW> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x20usize + n * 4usize) as _)
}
}
#[doc = "Description collection: CTI Channel to Trigger Enable register."]
#[inline(always)]
pub const fn ctiouten(
self,
n: usize,
) -> crate::common::Reg<regs::Ctiouten, crate::common::RW> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xa0usize + n * 4usize) as _)
}
}
#[doc = "CTI Trigger In Status register."]
#[inline(always)]
pub const fn ctitriginstatus(
self,
) -> crate::common::Reg<regs::Ctitriginstatus, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0130usize) as _) }
}
#[doc = "CTI Trigger Out Status register."]
#[inline(always)]
pub const fn ctitrigoutstatus(
self,
) -> crate::common::Reg<regs::Ctitrigoutstatus, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0134usize) as _) }
}
#[doc = "CTI Channel In Status register."]
#[inline(always)]
pub const fn ctichinstatus(
self,
) -> crate::common::Reg<regs::Ctichinstatus, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0138usize) as _) }
}
#[doc = "Enable CTI Channel Gate register."]
#[inline(always)]
pub const fn ctigate(self) -> crate::common::Reg<regs::Ctigate, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0140usize) as _) }
}
#[doc = "Device Architecture register."]
#[inline(always)]
pub const fn devarch(self) -> crate::common::Reg<regs::Devarch, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0fbcusize) as _) }
}
#[doc = "Device Configuration register."]
#[inline(always)]
pub const fn devid(self) -> crate::common::Reg<regs::Devid, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0fc8usize) as _) }
}
#[doc = "Device Type Identifier register."]
#[inline(always)]
pub const fn devtype(self) -> crate::common::Reg<regs::Devtype, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0fccusize) as _) }
}
#[doc = "Peripheral ID4 Register."]
#[inline(always)]
pub const fn pidr4(self) -> crate::common::Reg<regs::Pidr4, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0fd0usize) as _) }
}
#[doc = "Peripheral ID5 register."]
#[inline(always)]
pub const fn pidr5(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0fd4usize) as _) }
}
#[doc = "Peripheral ID6 register."]
#[inline(always)]
pub const fn pidr6(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0fd8usize) as _) }
}
#[doc = "Peripheral ID7 register."]
#[inline(always)]
pub const fn pidr7(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0fdcusize) as _) }
}
#[doc = "Peripheral ID0 Register."]
#[inline(always)]
pub const fn pidr0(self) -> crate::common::Reg<regs::Pidr0, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0fe0usize) as _) }
}
#[doc = "Peripheral ID1 Register."]
#[inline(always)]
pub const fn pidr1(self) -> crate::common::Reg<regs::Pidr1, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0fe4usize) as _) }
}
#[doc = "Peripheral ID2 Register."]
#[inline(always)]
pub const fn pidr2(self) -> crate::common::Reg<regs::Pidr2, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0fe8usize) as _) }
}
#[doc = "Peripheral ID3 Register."]
#[inline(always)]
pub const fn pidr3(self) -> crate::common::Reg<regs::Pidr3, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0fecusize) as _) }
}
#[doc = "Component ID0 Register."]
#[inline(always)]
pub const fn cidr0(self) -> crate::common::Reg<regs::Cidr0, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0ff0usize) as _) }
}
#[doc = "Component ID1 Register."]
#[inline(always)]
pub const fn cidr1(self) -> crate::common::Reg<regs::Cidr1, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0ff4usize) as _) }
}
#[doc = "Component ID2 Register."]
#[inline(always)]
pub const fn cidr2(self) -> crate::common::Reg<regs::Cidr2, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0ff8usize) as _) }
}
#[doc = "Component ID3 Register."]
#[inline(always)]
pub const fn cidr3(self) -> crate::common::Reg<regs::Cidr3, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0ffcusize) as _) }
}
}
pub mod regs {
#[doc = "Component ID0 Register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cidr0(pub u32);
impl Cidr0 {
#[doc = "Preamble\\[0\\]. Contains bits\\[7:0\\] of the component identification code."]
#[must_use]
#[inline(always)]
pub const fn prmbl_0(&self) -> super::vals::Prmbl0 {
let val = (self.0 >> 0usize) & 0xff;
super::vals::Prmbl0::from_bits(val as u8)
}
#[doc = "Preamble\\[0\\]. Contains bits\\[7:0\\] of the component identification code."]
#[inline(always)]
pub const fn set_prmbl_0(&mut self, val: super::vals::Prmbl0) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val.to_bits() as u32) & 0xff) << 0usize);
}
}
impl Default for Cidr0 {
#[inline(always)]
fn default() -> Cidr0 {
Cidr0(0)
}
}
impl core::fmt::Debug for Cidr0 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cidr0")
.field("prmbl_0", &self.prmbl_0())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cidr0 {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Cidr0 {{ prmbl_0: {:?} }}", self.prmbl_0())
}
}
#[doc = "Component ID1 Register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cidr1(pub u32);
impl Cidr1 {
#[doc = "Preamble\\[1\\]. Contains bits\\[11:8\\] of the component identification code."]
#[must_use]
#[inline(always)]
pub const fn prmbl_1(&self) -> super::vals::Prmbl1 {
let val = (self.0 >> 0usize) & 0x0f;
super::vals::Prmbl1::from_bits(val as u8)
}
#[doc = "Preamble\\[1\\]. Contains bits\\[11:8\\] of the component identification code."]
#[inline(always)]
pub const fn set_prmbl_1(&mut self, val: super::vals::Prmbl1) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val.to_bits() as u32) & 0x0f) << 0usize);
}
#[doc = "Class of the component, for example, whether the component is a ROM table or a generic CoreSight component. Contains bits\\[15:12\\] of the component identification code."]
#[must_use]
#[inline(always)]
pub const fn class(&self) -> super::vals::Class {
let val = (self.0 >> 4usize) & 0x0f;
super::vals::Class::from_bits(val as u8)
}
#[doc = "Class of the component, for example, whether the component is a ROM table or a generic CoreSight component. Contains bits\\[15:12\\] of the component identification code."]
#[inline(always)]
pub const fn set_class(&mut self, val: super::vals::Class) {
self.0 = (self.0 & !(0x0f << 4usize)) | (((val.to_bits() as u32) & 0x0f) << 4usize);
}
}
impl Default for Cidr1 {
#[inline(always)]
fn default() -> Cidr1 {
Cidr1(0)
}
}
impl core::fmt::Debug for Cidr1 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cidr1")
.field("prmbl_1", &self.prmbl_1())
.field("class", &self.class())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cidr1 {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Cidr1 {{ prmbl_1: {:?}, class: {:?} }}",
self.prmbl_1(),
self.class()
)
}
}
#[doc = "Component ID2 Register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cidr2(pub u32);
impl Cidr2 {
#[doc = "Preamble\\[2\\]. Contains bits\\[23:16\\] of the component identification code."]
#[must_use]
#[inline(always)]
pub const fn prmbl_2(&self) -> super::vals::Prmbl2 {
let val = (self.0 >> 0usize) & 0xff;
super::vals::Prmbl2::from_bits(val as u8)
}
#[doc = "Preamble\\[2\\]. Contains bits\\[23:16\\] of the component identification code."]
#[inline(always)]
pub const fn set_prmbl_2(&mut self, val: super::vals::Prmbl2) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val.to_bits() as u32) & 0xff) << 0usize);
}
}
impl Default for Cidr2 {
#[inline(always)]
fn default() -> Cidr2 {
Cidr2(0)
}
}
impl core::fmt::Debug for Cidr2 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cidr2")
.field("prmbl_2", &self.prmbl_2())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cidr2 {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Cidr2 {{ prmbl_2: {:?} }}", self.prmbl_2())
}
}
#[doc = "Component ID3 Register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cidr3(pub u32);
impl Cidr3 {
#[doc = "Preamble\\[3\\]. Contains bits\\[31:24\\] of the component identification code."]
#[must_use]
#[inline(always)]
pub const fn prmbl_3(&self) -> super::vals::Prmbl3 {
let val = (self.0 >> 0usize) & 0xff;
super::vals::Prmbl3::from_bits(val as u8)
}
#[doc = "Preamble\\[3\\]. Contains bits\\[31:24\\] of the component identification code."]
#[inline(always)]
pub const fn set_prmbl_3(&mut self, val: super::vals::Prmbl3) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val.to_bits() as u32) & 0xff) << 0usize);
}
}
impl Default for Cidr3 {
#[inline(always)]
fn default() -> Cidr3 {
Cidr3(0)
}
}
impl core::fmt::Debug for Cidr3 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cidr3")
.field("prmbl_3", &self.prmbl_3())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cidr3 {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Cidr3 {{ prmbl_3: {:?} }}", self.prmbl_3())
}
}
#[doc = "CTI Application Trigger Clear register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ctiappclear(pub u32);
impl Ctiappclear {
#[doc = "Sets the corresponding bits in the CTIAPPSET to 0. There is one bit of the register for each channel."]
#[must_use]
#[inline(always)]
pub const fn appclear_0(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Sets the corresponding bits in the CTIAPPSET to 0. There is one bit of the register for each channel."]
#[inline(always)]
pub const fn set_appclear_0(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Sets the corresponding bits in the CTIAPPSET to 0. There is one bit of the register for each channel."]
#[must_use]
#[inline(always)]
pub const fn appclear_1(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Sets the corresponding bits in the CTIAPPSET to 0. There is one bit of the register for each channel."]
#[inline(always)]
pub const fn set_appclear_1(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Sets the corresponding bits in the CTIAPPSET to 0. There is one bit of the register for each channel."]
#[must_use]
#[inline(always)]
pub const fn appclear_2(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Sets the corresponding bits in the CTIAPPSET to 0. There is one bit of the register for each channel."]
#[inline(always)]
pub const fn set_appclear_2(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Sets the corresponding bits in the CTIAPPSET to 0. There is one bit of the register for each channel."]
#[must_use]
#[inline(always)]
pub const fn appclear_3(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Sets the corresponding bits in the CTIAPPSET to 0. There is one bit of the register for each channel."]
#[inline(always)]
pub const fn set_appclear_3(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
}
impl Default for Ctiappclear {
#[inline(always)]
fn default() -> Ctiappclear {
Ctiappclear(0)
}
}
impl core::fmt::Debug for Ctiappclear {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ctiappclear")
.field("appclear_0", &self.appclear_0())
.field("appclear_1", &self.appclear_1())
.field("appclear_2", &self.appclear_2())
.field("appclear_3", &self.appclear_3())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ctiappclear {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Ctiappclear {{ appclear_0: {=bool:?}, appclear_1: {=bool:?}, appclear_2: {=bool:?}, appclear_3: {=bool:?} }}" , self . appclear_0 () , self . appclear_1 () , self . appclear_2 () , self . appclear_3 ())
}
}
#[doc = "CTI Application Pulse register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ctiapppulse(pub u32);
impl Ctiapppulse {
#[doc = "Setting a bit HIGH generates a channel event pulse for the selected channel. There is one bit of the register for each channel."]
#[must_use]
#[inline(always)]
pub const fn appulse_0(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Setting a bit HIGH generates a channel event pulse for the selected channel. There is one bit of the register for each channel."]
#[inline(always)]
pub const fn set_appulse_0(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Setting a bit HIGH generates a channel event pulse for the selected channel. There is one bit of the register for each channel."]
#[must_use]
#[inline(always)]
pub const fn appulse_1(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Setting a bit HIGH generates a channel event pulse for the selected channel. There is one bit of the register for each channel."]
#[inline(always)]
pub const fn set_appulse_1(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Setting a bit HIGH generates a channel event pulse for the selected channel. There is one bit of the register for each channel."]
#[must_use]
#[inline(always)]
pub const fn appulse_2(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Setting a bit HIGH generates a channel event pulse for the selected channel. There is one bit of the register for each channel."]
#[inline(always)]
pub const fn set_appulse_2(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Setting a bit HIGH generates a channel event pulse for the selected channel. There is one bit of the register for each channel."]
#[must_use]
#[inline(always)]
pub const fn appulse_3(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Setting a bit HIGH generates a channel event pulse for the selected channel. There is one bit of the register for each channel."]
#[inline(always)]
pub const fn set_appulse_3(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
}
impl Default for Ctiapppulse {
#[inline(always)]
fn default() -> Ctiapppulse {
Ctiapppulse(0)
}
}
impl core::fmt::Debug for Ctiapppulse {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ctiapppulse")
.field("appulse_0", &self.appulse_0())
.field("appulse_1", &self.appulse_1())
.field("appulse_2", &self.appulse_2())
.field("appulse_3", &self.appulse_3())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ctiapppulse {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Ctiapppulse {{ appulse_0: {=bool:?}, appulse_1: {=bool:?}, appulse_2: {=bool:?}, appulse_3: {=bool:?} }}" , self . appulse_0 () , self . appulse_1 () , self . appulse_2 () , self . appulse_3 ())
}
}
#[doc = "CTI Application Trigger Set register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ctiappset(pub u32);
impl Ctiappset {
#[doc = "Application trigger event for channel 0."]
#[must_use]
#[inline(always)]
pub const fn appset_0(&self) -> super::vals::Appset0 {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Appset0::from_bits(val as u8)
}
#[doc = "Application trigger event for channel 0."]
#[inline(always)]
pub const fn set_appset_0(&mut self, val: super::vals::Appset0) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "Application trigger event for channel 1."]
#[must_use]
#[inline(always)]
pub const fn appset_1(&self) -> super::vals::Appset1 {
let val = (self.0 >> 1usize) & 0x01;
super::vals::Appset1::from_bits(val as u8)
}
#[doc = "Application trigger event for channel 1."]
#[inline(always)]
pub const fn set_appset_1(&mut self, val: super::vals::Appset1) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val.to_bits() as u32) & 0x01) << 1usize);
}
#[doc = "Application trigger event for channel 2."]
#[must_use]
#[inline(always)]
pub const fn appset_2(&self) -> super::vals::Appset2 {
let val = (self.0 >> 2usize) & 0x01;
super::vals::Appset2::from_bits(val as u8)
}
#[doc = "Application trigger event for channel 2."]
#[inline(always)]
pub const fn set_appset_2(&mut self, val: super::vals::Appset2) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val.to_bits() as u32) & 0x01) << 2usize);
}
#[doc = "Application trigger event for channel 3."]
#[must_use]
#[inline(always)]
pub const fn appset_3(&self) -> super::vals::Appset3 {
let val = (self.0 >> 3usize) & 0x01;
super::vals::Appset3::from_bits(val as u8)
}
#[doc = "Application trigger event for channel 3."]
#[inline(always)]
pub const fn set_appset_3(&mut self, val: super::vals::Appset3) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val.to_bits() as u32) & 0x01) << 3usize);
}
}
impl Default for Ctiappset {
#[inline(always)]
fn default() -> Ctiappset {
Ctiappset(0)
}
}
impl core::fmt::Debug for Ctiappset {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ctiappset")
.field("appset_0", &self.appset_0())
.field("appset_1", &self.appset_1())
.field("appset_2", &self.appset_2())
.field("appset_3", &self.appset_3())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ctiappset {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Ctiappset {{ appset_0: {:?}, appset_1: {:?}, appset_2: {:?}, appset_3: {:?} }}" , self . appset_0 () , self . appset_1 () , self . appset_2 () , self . appset_3 ())
}
}
#[doc = "CTI Channel In Status register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ctichinstatus(pub u32);
impl Ctichinstatus {
#[doc = "Shows the status of the ctitrigin 0 input."]
#[must_use]
#[inline(always)]
pub const fn ctichinstatus_0(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Shows the status of the ctitrigin 0 input."]
#[inline(always)]
pub const fn set_ctichinstatus_0(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Shows the status of the ctitrigin 1 input."]
#[must_use]
#[inline(always)]
pub const fn ctichinstatus_1(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Shows the status of the ctitrigin 1 input."]
#[inline(always)]
pub const fn set_ctichinstatus_1(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Shows the status of the ctitrigin 2 input."]
#[must_use]
#[inline(always)]
pub const fn ctichinstatus_2(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Shows the status of the ctitrigin 2 input."]
#[inline(always)]
pub const fn set_ctichinstatus_2(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Shows the status of the ctitrigin 3 input."]
#[must_use]
#[inline(always)]
pub const fn ctichinstatus_3(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Shows the status of the ctitrigin 3 input."]
#[inline(always)]
pub const fn set_ctichinstatus_3(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
}
impl Default for Ctichinstatus {
#[inline(always)]
fn default() -> Ctichinstatus {
Ctichinstatus(0)
}
}
impl core::fmt::Debug for Ctichinstatus {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ctichinstatus")
.field("ctichinstatus_0", &self.ctichinstatus_0())
.field("ctichinstatus_1", &self.ctichinstatus_1())
.field("ctichinstatus_2", &self.ctichinstatus_2())
.field("ctichinstatus_3", &self.ctichinstatus_3())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ctichinstatus {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Ctichinstatus {{ ctichinstatus_0: {=bool:?}, ctichinstatus_1: {=bool:?}, ctichinstatus_2: {=bool:?}, ctichinstatus_3: {=bool:?} }}" , self . ctichinstatus_0 () , self . ctichinstatus_1 () , self . ctichinstatus_2 () , self . ctichinstatus_3 ())
}
}
#[doc = "CTI Control register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cticontrol(pub u32);
impl Cticontrol {
#[doc = "Enables or disables the CTI."]
#[must_use]
#[inline(always)]
pub const fn glben(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enables or disables the CTI."]
#[inline(always)]
pub const fn set_glben(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Cticontrol {
#[inline(always)]
fn default() -> Cticontrol {
Cticontrol(0)
}
}
impl core::fmt::Debug for Cticontrol {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cticontrol")
.field("glben", &self.glben())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cticontrol {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Cticontrol {{ glben: {=bool:?} }}", self.glben())
}
}
#[doc = "Enable CTI Channel Gate register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ctigate(pub u32);
impl Ctigate {
#[doc = "Enable ctichout0."]
#[must_use]
#[inline(always)]
pub const fn ctigateen_0(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable ctichout0."]
#[inline(always)]
pub const fn set_ctigateen_0(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Enable ctichout1."]
#[must_use]
#[inline(always)]
pub const fn ctigateen_1(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enable ctichout1."]
#[inline(always)]
pub const fn set_ctigateen_1(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enable ctichout2."]
#[must_use]
#[inline(always)]
pub const fn ctigateen_2(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Enable ctichout2."]
#[inline(always)]
pub const fn set_ctigateen_2(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Enable ctichout3."]
#[must_use]
#[inline(always)]
pub const fn ctigateen_3(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Enable ctichout3."]
#[inline(always)]
pub const fn set_ctigateen_3(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
}
impl Default for Ctigate {
#[inline(always)]
fn default() -> Ctigate {
Ctigate(0)
}
}
impl core::fmt::Debug for Ctigate {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ctigate")
.field("ctigateen_0", &self.ctigateen_0())
.field("ctigateen_1", &self.ctigateen_1())
.field("ctigateen_2", &self.ctigateen_2())
.field("ctigateen_3", &self.ctigateen_3())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ctigate {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Ctigate {{ ctigateen_0: {=bool:?}, ctigateen_1: {=bool:?}, ctigateen_2: {=bool:?}, ctigateen_3: {=bool:?} }}" , self . ctigateen_0 () , self . ctigateen_1 () , self . ctigateen_2 () , self . ctigateen_3 ())
}
}
#[doc = "Description collection: CTI Trigger to Channel Enable register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ctiinen(pub u32);
impl Ctiinen {
#[doc = "Enables a cross trigger event to channel 0 when a ctitrigin input is activated."]
#[must_use]
#[inline(always)]
pub const fn triginen_0(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enables a cross trigger event to channel 0 when a ctitrigin input is activated."]
#[inline(always)]
pub const fn set_triginen_0(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Enables a cross trigger event to channel 1 when a ctitrigin input is activated."]
#[must_use]
#[inline(always)]
pub const fn triginen_1(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enables a cross trigger event to channel 1 when a ctitrigin input is activated."]
#[inline(always)]
pub const fn set_triginen_1(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enables a cross trigger event to channel 2 when a ctitrigin input is activated."]
#[must_use]
#[inline(always)]
pub const fn triginen_2(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Enables a cross trigger event to channel 2 when a ctitrigin input is activated."]
#[inline(always)]
pub const fn set_triginen_2(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Enables a cross trigger event to channel 3 when a ctitrigin input is activated."]
#[must_use]
#[inline(always)]
pub const fn triginen_3(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Enables a cross trigger event to channel 3 when a ctitrigin input is activated."]
#[inline(always)]
pub const fn set_triginen_3(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
}
impl Default for Ctiinen {
#[inline(always)]
fn default() -> Ctiinen {
Ctiinen(0)
}
}
impl core::fmt::Debug for Ctiinen {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ctiinen")
.field("triginen_0", &self.triginen_0())
.field("triginen_1", &self.triginen_1())
.field("triginen_2", &self.triginen_2())
.field("triginen_3", &self.triginen_3())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ctiinen {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Ctiinen {{ triginen_0: {=bool:?}, triginen_1: {=bool:?}, triginen_2: {=bool:?}, triginen_3: {=bool:?} }}" , self . triginen_0 () , self . triginen_1 () , self . triginen_2 () , self . triginen_3 ())
}
}
#[doc = "CTI Interrupt Acknowledge register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ctiintack(pub u32);
impl Ctiintack {
#[doc = "Acknowledges the ctitrigout 0 output."]
#[must_use]
#[inline(always)]
pub const fn intack_0(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Acknowledges the ctitrigout 0 output."]
#[inline(always)]
pub const fn set_intack_0(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Acknowledges the ctitrigout 1 output."]
#[must_use]
#[inline(always)]
pub const fn intack_1(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Acknowledges the ctitrigout 1 output."]
#[inline(always)]
pub const fn set_intack_1(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Acknowledges the ctitrigout 2 output."]
#[must_use]
#[inline(always)]
pub const fn intack_2(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Acknowledges the ctitrigout 2 output."]
#[inline(always)]
pub const fn set_intack_2(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Acknowledges the ctitrigout 3 output."]
#[must_use]
#[inline(always)]
pub const fn intack_3(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Acknowledges the ctitrigout 3 output."]
#[inline(always)]
pub const fn set_intack_3(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Acknowledges the ctitrigout 4 output."]
#[must_use]
#[inline(always)]
pub const fn intack_4(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Acknowledges the ctitrigout 4 output."]
#[inline(always)]
pub const fn set_intack_4(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Acknowledges the ctitrigout 5 output."]
#[must_use]
#[inline(always)]
pub const fn intack_5(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Acknowledges the ctitrigout 5 output."]
#[inline(always)]
pub const fn set_intack_5(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Acknowledges the ctitrigout 6 output."]
#[must_use]
#[inline(always)]
pub const fn intack_6(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Acknowledges the ctitrigout 6 output."]
#[inline(always)]
pub const fn set_intack_6(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "Acknowledges the ctitrigout 7 output."]
#[must_use]
#[inline(always)]
pub const fn intack_7(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Acknowledges the ctitrigout 7 output."]
#[inline(always)]
pub const fn set_intack_7(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
}
impl Default for Ctiintack {
#[inline(always)]
fn default() -> Ctiintack {
Ctiintack(0)
}
}
impl core::fmt::Debug for Ctiintack {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ctiintack")
.field("intack_0", &self.intack_0())
.field("intack_1", &self.intack_1())
.field("intack_2", &self.intack_2())
.field("intack_3", &self.intack_3())
.field("intack_4", &self.intack_4())
.field("intack_5", &self.intack_5())
.field("intack_6", &self.intack_6())
.field("intack_7", &self.intack_7())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ctiintack {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Ctiintack {{ intack_0: {=bool:?}, intack_1: {=bool:?}, intack_2: {=bool:?}, intack_3: {=bool:?}, intack_4: {=bool:?}, intack_5: {=bool:?}, intack_6: {=bool:?}, intack_7: {=bool:?} }}" , self . intack_0 () , self . intack_1 () , self . intack_2 () , self . intack_3 () , self . intack_4 () , self . intack_5 () , self . intack_6 () , self . intack_7 ())
}
}
#[doc = "Description collection: CTI Channel to Trigger Enable register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ctiouten(pub u32);
impl Ctiouten {
#[doc = "Enables a cross trigger event to ctitrigout when channel 0 is activated."]
#[must_use]
#[inline(always)]
pub const fn trigouten_0(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enables a cross trigger event to ctitrigout when channel 0 is activated."]
#[inline(always)]
pub const fn set_trigouten_0(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Enables a cross trigger event to ctitrigout when channel 1 is activated."]
#[must_use]
#[inline(always)]
pub const fn trigouten_1(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enables a cross trigger event to ctitrigout when channel 1 is activated."]
#[inline(always)]
pub const fn set_trigouten_1(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enables a cross trigger event to ctitrigout when channel 2 is activated."]
#[must_use]
#[inline(always)]
pub const fn trigouten_2(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Enables a cross trigger event to ctitrigout when channel 2 is activated."]
#[inline(always)]
pub const fn set_trigouten_2(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Enables a cross trigger event to ctitrigout when channel 3 is activated."]
#[must_use]
#[inline(always)]
pub const fn trigouten_3(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Enables a cross trigger event to ctitrigout when channel 3 is activated."]
#[inline(always)]
pub const fn set_trigouten_3(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
}
impl Default for Ctiouten {
#[inline(always)]
fn default() -> Ctiouten {
Ctiouten(0)
}
}
impl core::fmt::Debug for Ctiouten {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ctiouten")
.field("trigouten_0", &self.trigouten_0())
.field("trigouten_1", &self.trigouten_1())
.field("trigouten_2", &self.trigouten_2())
.field("trigouten_3", &self.trigouten_3())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ctiouten {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Ctiouten {{ trigouten_0: {=bool:?}, trigouten_1: {=bool:?}, trigouten_2: {=bool:?}, trigouten_3: {=bool:?} }}" , self . trigouten_0 () , self . trigouten_1 () , self . trigouten_2 () , self . trigouten_3 ())
}
}
#[doc = "CTI Trigger In Status register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ctitriginstatus(pub u32);
impl Ctitriginstatus {
#[doc = "Shows the status of ctitrigin0 input."]
#[must_use]
#[inline(always)]
pub const fn triginstatus_0(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Shows the status of ctitrigin0 input."]
#[inline(always)]
pub const fn set_triginstatus_0(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Shows the status of ctitrigin1 input."]
#[must_use]
#[inline(always)]
pub const fn triginstatus_1(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Shows the status of ctitrigin1 input."]
#[inline(always)]
pub const fn set_triginstatus_1(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Shows the status of ctitrigin2 input."]
#[must_use]
#[inline(always)]
pub const fn triginstatus_2(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Shows the status of ctitrigin2 input."]
#[inline(always)]
pub const fn set_triginstatus_2(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Shows the status of ctitrigin3 input."]
#[must_use]
#[inline(always)]
pub const fn triginstatus_3(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Shows the status of ctitrigin3 input."]
#[inline(always)]
pub const fn set_triginstatus_3(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Shows the status of ctitrigin4 input."]
#[must_use]
#[inline(always)]
pub const fn triginstatus_4(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Shows the status of ctitrigin4 input."]
#[inline(always)]
pub const fn set_triginstatus_4(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Shows the status of ctitrigin5 input."]
#[must_use]
#[inline(always)]
pub const fn triginstatus_5(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Shows the status of ctitrigin5 input."]
#[inline(always)]
pub const fn set_triginstatus_5(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Shows the status of ctitrigin6 input."]
#[must_use]
#[inline(always)]
pub const fn triginstatus_6(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Shows the status of ctitrigin6 input."]
#[inline(always)]
pub const fn set_triginstatus_6(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "Shows the status of ctitrigin7 input."]
#[must_use]
#[inline(always)]
pub const fn triginstatus_7(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Shows the status of ctitrigin7 input."]
#[inline(always)]
pub const fn set_triginstatus_7(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
}
impl Default for Ctitriginstatus {
#[inline(always)]
fn default() -> Ctitriginstatus {
Ctitriginstatus(0)
}
}
impl core::fmt::Debug for Ctitriginstatus {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ctitriginstatus")
.field("triginstatus_0", &self.triginstatus_0())
.field("triginstatus_1", &self.triginstatus_1())
.field("triginstatus_2", &self.triginstatus_2())
.field("triginstatus_3", &self.triginstatus_3())
.field("triginstatus_4", &self.triginstatus_4())
.field("triginstatus_5", &self.triginstatus_5())
.field("triginstatus_6", &self.triginstatus_6())
.field("triginstatus_7", &self.triginstatus_7())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ctitriginstatus {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Ctitriginstatus {{ triginstatus_0: {=bool:?}, triginstatus_1: {=bool:?}, triginstatus_2: {=bool:?}, triginstatus_3: {=bool:?}, triginstatus_4: {=bool:?}, triginstatus_5: {=bool:?}, triginstatus_6: {=bool:?}, triginstatus_7: {=bool:?} }}" , self . triginstatus_0 () , self . triginstatus_1 () , self . triginstatus_2 () , self . triginstatus_3 () , self . triginstatus_4 () , self . triginstatus_5 () , self . triginstatus_6 () , self . triginstatus_7 ())
}
}
#[doc = "CTI Trigger Out Status register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ctitrigoutstatus(pub u32);
impl Ctitrigoutstatus {
#[doc = "Shows the status of ctitrigout0 output."]
#[must_use]
#[inline(always)]
pub const fn trigoutstatus_0(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Shows the status of ctitrigout0 output."]
#[inline(always)]
pub const fn set_trigoutstatus_0(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Shows the status of ctitrigout1 output."]
#[must_use]
#[inline(always)]
pub const fn trigoutstatus_1(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Shows the status of ctitrigout1 output."]
#[inline(always)]
pub const fn set_trigoutstatus_1(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Shows the status of ctitrigout2 output."]
#[must_use]
#[inline(always)]
pub const fn trigoutstatus_2(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Shows the status of ctitrigout2 output."]
#[inline(always)]
pub const fn set_trigoutstatus_2(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Shows the status of ctitrigout3 output."]
#[must_use]
#[inline(always)]
pub const fn trigoutstatus_3(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Shows the status of ctitrigout3 output."]
#[inline(always)]
pub const fn set_trigoutstatus_3(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Shows the status of ctitrigout4 output."]
#[must_use]
#[inline(always)]
pub const fn trigoutstatus_4(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Shows the status of ctitrigout4 output."]
#[inline(always)]
pub const fn set_trigoutstatus_4(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Shows the status of ctitrigout5 output."]
#[must_use]
#[inline(always)]
pub const fn trigoutstatus_5(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Shows the status of ctitrigout5 output."]
#[inline(always)]
pub const fn set_trigoutstatus_5(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Shows the status of ctitrigout6 output."]
#[must_use]
#[inline(always)]
pub const fn trigoutstatus_6(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Shows the status of ctitrigout6 output."]
#[inline(always)]
pub const fn set_trigoutstatus_6(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "Shows the status of ctitrigout7 output."]
#[must_use]
#[inline(always)]
pub const fn trigoutstatus_7(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Shows the status of ctitrigout7 output."]
#[inline(always)]
pub const fn set_trigoutstatus_7(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
}
impl Default for Ctitrigoutstatus {
#[inline(always)]
fn default() -> Ctitrigoutstatus {
Ctitrigoutstatus(0)
}
}
impl core::fmt::Debug for Ctitrigoutstatus {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ctitrigoutstatus")
.field("trigoutstatus_0", &self.trigoutstatus_0())
.field("trigoutstatus_1", &self.trigoutstatus_1())
.field("trigoutstatus_2", &self.trigoutstatus_2())
.field("trigoutstatus_3", &self.trigoutstatus_3())
.field("trigoutstatus_4", &self.trigoutstatus_4())
.field("trigoutstatus_5", &self.trigoutstatus_5())
.field("trigoutstatus_6", &self.trigoutstatus_6())
.field("trigoutstatus_7", &self.trigoutstatus_7())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ctitrigoutstatus {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Ctitrigoutstatus {{ trigoutstatus_0: {=bool:?}, trigoutstatus_1: {=bool:?}, trigoutstatus_2: {=bool:?}, trigoutstatus_3: {=bool:?}, trigoutstatus_4: {=bool:?}, trigoutstatus_5: {=bool:?}, trigoutstatus_6: {=bool:?}, trigoutstatus_7: {=bool:?} }}" , self . trigoutstatus_0 () , self . trigoutstatus_1 () , self . trigoutstatus_2 () , self . trigoutstatus_3 () , self . trigoutstatus_4 () , self . trigoutstatus_5 () , self . trigoutstatus_6 () , self . trigoutstatus_7 ())
}
}
#[doc = "Device Architecture register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Devarch(pub u32);
impl Devarch {
#[doc = "Contains the CTI device architecture."]
#[must_use]
#[inline(always)]
pub const fn architecture(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Contains the CTI device architecture."]
#[inline(always)]
pub const fn set_architecture(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Devarch {
#[inline(always)]
fn default() -> Devarch {
Devarch(0)
}
}
impl core::fmt::Debug for Devarch {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Devarch")
.field("architecture", &self.architecture())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Devarch {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Devarch {{ architecture: {=bool:?} }}",
self.architecture()
)
}
}
#[doc = "Device Configuration register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Devid(pub u32);
impl Devid {
#[doc = "Indicates the number of multiplexers available on Trigger Inputs and Trigger Outputs that are using asicctl. The default value of 0b00000 indicates that no multiplexing is present."]
#[must_use]
#[inline(always)]
pub const fn extmuxnum(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x1f;
val as u8
}
#[doc = "Indicates the number of multiplexers available on Trigger Inputs and Trigger Outputs that are using asicctl. The default value of 0b00000 indicates that no multiplexing is present."]
#[inline(always)]
pub const fn set_extmuxnum(&mut self, val: u8) {
self.0 = (self.0 & !(0x1f << 0usize)) | (((val as u32) & 0x1f) << 0usize);
}
#[doc = "Number of ECT triggers available."]
#[must_use]
#[inline(always)]
pub const fn numtrig(&self) -> u8 {
let val = (self.0 >> 8usize) & 0xff;
val as u8
}
#[doc = "Number of ECT triggers available."]
#[inline(always)]
pub const fn set_numtrig(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize);
}
#[doc = "Number of ECT channels available."]
#[must_use]
#[inline(always)]
pub const fn numch(&self) -> u8 {
let val = (self.0 >> 16usize) & 0x0f;
val as u8
}
#[doc = "Number of ECT channels available."]
#[inline(always)]
pub const fn set_numch(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 16usize)) | (((val as u32) & 0x0f) << 16usize);
}
}
impl Default for Devid {
#[inline(always)]
fn default() -> Devid {
Devid(0)
}
}
impl core::fmt::Debug for Devid {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Devid")
.field("extmuxnum", &self.extmuxnum())
.field("numtrig", &self.numtrig())
.field("numch", &self.numch())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Devid {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Devid {{ extmuxnum: {=u8:?}, numtrig: {=u8:?}, numch: {=u8:?} }}",
self.extmuxnum(),
self.numtrig(),
self.numch()
)
}
}
#[doc = "Device Type Identifier register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Devtype(pub u32);
impl Devtype {
#[doc = "Major classification of the type of the debug component as specified in the Arm Architecture Specification for this debug and trace component."]
#[must_use]
#[inline(always)]
pub const fn major(&self) -> super::vals::Major {
let val = (self.0 >> 0usize) & 0x0f;
super::vals::Major::from_bits(val as u8)
}
#[doc = "Major classification of the type of the debug component as specified in the Arm Architecture Specification for this debug and trace component."]
#[inline(always)]
pub const fn set_major(&mut self, val: super::vals::Major) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val.to_bits() as u32) & 0x0f) << 0usize);
}
#[doc = "Sub-classification of the type of the debug component as specified in the Arm Architecture Specification within the major classification as specified in the MAJOR field."]
#[must_use]
#[inline(always)]
pub const fn sub(&self) -> super::vals::Sub {
let val = (self.0 >> 4usize) & 0x0f;
super::vals::Sub::from_bits(val as u8)
}
#[doc = "Sub-classification of the type of the debug component as specified in the Arm Architecture Specification within the major classification as specified in the MAJOR field."]
#[inline(always)]
pub const fn set_sub(&mut self, val: super::vals::Sub) {
self.0 = (self.0 & !(0x0f << 4usize)) | (((val.to_bits() as u32) & 0x0f) << 4usize);
}
}
impl Default for Devtype {
#[inline(always)]
fn default() -> Devtype {
Devtype(0)
}
}
impl core::fmt::Debug for Devtype {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Devtype")
.field("major", &self.major())
.field("sub", &self.sub())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Devtype {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Devtype {{ major: {:?}, sub: {:?} }}",
self.major(),
self.sub()
)
}
}
#[doc = "Peripheral ID0 Register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Pidr0(pub u32);
impl Pidr0 {
#[doc = "Bits\\[7:0\\] of the 12-bit part number of the component. The designer of the component assigns this part number."]
#[must_use]
#[inline(always)]
pub const fn part_0(&self) -> super::vals::Part0 {
let val = (self.0 >> 0usize) & 0xff;
super::vals::Part0::from_bits(val as u8)
}
#[doc = "Bits\\[7:0\\] of the 12-bit part number of the component. The designer of the component assigns this part number."]
#[inline(always)]
pub const fn set_part_0(&mut self, val: super::vals::Part0) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val.to_bits() as u32) & 0xff) << 0usize);
}
}
impl Default for Pidr0 {
#[inline(always)]
fn default() -> Pidr0 {
Pidr0(0)
}
}
impl core::fmt::Debug for Pidr0 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Pidr0")
.field("part_0", &self.part_0())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Pidr0 {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Pidr0 {{ part_0: {:?} }}", self.part_0())
}
}
#[doc = "Peripheral ID1 Register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Pidr1(pub u32);
impl Pidr1 {
#[doc = "Bits\\[11:8\\] of the 12-bit part number of the component. The designer of the component assigns this part number."]
#[must_use]
#[inline(always)]
pub const fn part_1(&self) -> super::vals::Part1 {
let val = (self.0 >> 0usize) & 0x0f;
super::vals::Part1::from_bits(val as u8)
}
#[doc = "Bits\\[11:8\\] of the 12-bit part number of the component. The designer of the component assigns this part number."]
#[inline(always)]
pub const fn set_part_1(&mut self, val: super::vals::Part1) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val.to_bits() as u32) & 0x0f) << 0usize);
}
#[doc = "Together, PIDR1.DES_0, PIDR2.DES_1, and PIDR4.DES_2 identify the designer of the component."]
#[must_use]
#[inline(always)]
pub const fn des_0(&self) -> super::vals::Des0 {
let val = (self.0 >> 4usize) & 0x0f;
super::vals::Des0::from_bits(val as u8)
}
#[doc = "Together, PIDR1.DES_0, PIDR2.DES_1, and PIDR4.DES_2 identify the designer of the component."]
#[inline(always)]
pub const fn set_des_0(&mut self, val: super::vals::Des0) {
self.0 = (self.0 & !(0x0f << 4usize)) | (((val.to_bits() as u32) & 0x0f) << 4usize);
}
}
impl Default for Pidr1 {
#[inline(always)]
fn default() -> Pidr1 {
Pidr1(0)
}
}
impl core::fmt::Debug for Pidr1 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Pidr1")
.field("part_1", &self.part_1())
.field("des_0", &self.des_0())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Pidr1 {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Pidr1 {{ part_1: {:?}, des_0: {:?} }}",
self.part_1(),
self.des_0()
)
}
}
#[doc = "Peripheral ID2 Register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Pidr2(pub u32);
impl Pidr2 {
#[doc = "Together, PIDR1.DES_0, PIDR2.DES_1, and PIDR4.DES_2 identify the designer of the component."]
#[must_use]
#[inline(always)]
pub const fn des_1(&self) -> super::vals::Des1 {
let val = (self.0 >> 0usize) & 0x07;
super::vals::Des1::from_bits(val as u8)
}
#[doc = "Together, PIDR1.DES_0, PIDR2.DES_1, and PIDR4.DES_2 identify the designer of the component."]
#[inline(always)]
pub const fn set_des_1(&mut self, val: super::vals::Des1) {
self.0 = (self.0 & !(0x07 << 0usize)) | (((val.to_bits() as u32) & 0x07) << 0usize);
}
#[doc = "Always 1. Indicates that the JEDEC-assigned designer ID is used."]
#[must_use]
#[inline(always)]
pub const fn jedec(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Always 1. Indicates that the JEDEC-assigned designer ID is used."]
#[inline(always)]
pub const fn set_jedec(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Peripheral revision."]
#[must_use]
#[inline(always)]
pub const fn revision(&self) -> super::vals::Revision {
let val = (self.0 >> 4usize) & 0x0f;
super::vals::Revision::from_bits(val as u8)
}
#[doc = "Peripheral revision."]
#[inline(always)]
pub const fn set_revision(&mut self, val: super::vals::Revision) {
self.0 = (self.0 & !(0x0f << 4usize)) | (((val.to_bits() as u32) & 0x0f) << 4usize);
}
}
impl Default for Pidr2 {
#[inline(always)]
fn default() -> Pidr2 {
Pidr2(0)
}
}
impl core::fmt::Debug for Pidr2 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Pidr2")
.field("des_1", &self.des_1())
.field("jedec", &self.jedec())
.field("revision", &self.revision())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Pidr2 {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Pidr2 {{ des_1: {:?}, jedec: {=bool:?}, revision: {:?} }}",
self.des_1(),
self.jedec(),
self.revision()
)
}
}
#[doc = "Peripheral ID3 Register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Pidr3(pub u32);
impl Pidr3 {
#[doc = "Customer Modified. Indicates whether the customer has modified the behavior of the component. In most cases, this field is 0b0000. Customers change this value when they make authorized modifications to this component."]
#[must_use]
#[inline(always)]
pub const fn cmod(&self) -> super::vals::Cmod {
let val = (self.0 >> 0usize) & 0x0f;
super::vals::Cmod::from_bits(val as u8)
}
#[doc = "Customer Modified. Indicates whether the customer has modified the behavior of the component. In most cases, this field is 0b0000. Customers change this value when they make authorized modifications to this component."]
#[inline(always)]
pub const fn set_cmod(&mut self, val: super::vals::Cmod) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val.to_bits() as u32) & 0x0f) << 0usize);
}
#[doc = "Indicates minor errata fixes specific to the revision of the component being used, for example metal fixes after implementation. In most cases, this field is 0b0000. Arm recommends that the component designers ensure that a metal fix can change this field if required, for example, by driving it from registers that reset to 0b0000."]
#[must_use]
#[inline(always)]
pub const fn revand(&self) -> super::vals::Revand {
let val = (self.0 >> 4usize) & 0x0f;
super::vals::Revand::from_bits(val as u8)
}
#[doc = "Indicates minor errata fixes specific to the revision of the component being used, for example metal fixes after implementation. In most cases, this field is 0b0000. Arm recommends that the component designers ensure that a metal fix can change this field if required, for example, by driving it from registers that reset to 0b0000."]
#[inline(always)]
pub const fn set_revand(&mut self, val: super::vals::Revand) {
self.0 = (self.0 & !(0x0f << 4usize)) | (((val.to_bits() as u32) & 0x0f) << 4usize);
}
}
impl Default for Pidr3 {
#[inline(always)]
fn default() -> Pidr3 {
Pidr3(0)
}
}
impl core::fmt::Debug for Pidr3 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Pidr3")
.field("cmod", &self.cmod())
.field("revand", &self.revand())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Pidr3 {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Pidr3 {{ cmod: {:?}, revand: {:?} }}",
self.cmod(),
self.revand()
)
}
}
#[doc = "Peripheral ID4 Register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Pidr4(pub u32);
impl Pidr4 {
#[doc = "Together, PIDR1.DES_0, PIDR2.DES_1, and PIDR4.DES_2 identify the designer of the component."]
#[must_use]
#[inline(always)]
pub const fn des_2(&self) -> super::vals::Des2 {
let val = (self.0 >> 0usize) & 0x0f;
super::vals::Des2::from_bits(val as u8)
}
#[doc = "Together, PIDR1.DES_0, PIDR2.DES_1, and PIDR4.DES_2 identify the designer of the component."]
#[inline(always)]
pub const fn set_des_2(&mut self, val: super::vals::Des2) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val.to_bits() as u32) & 0x0f) << 0usize);
}
#[doc = "Always 0b0000. Indicates that the device only occupies 4KB of memory."]
#[must_use]
#[inline(always)]
pub const fn size(&self) -> u8 {
let val = (self.0 >> 4usize) & 0x0f;
val as u8
}
#[doc = "Always 0b0000. Indicates that the device only occupies 4KB of memory."]
#[inline(always)]
pub const fn set_size(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 4usize)) | (((val as u32) & 0x0f) << 4usize);
}
}
impl Default for Pidr4 {
#[inline(always)]
fn default() -> Pidr4 {
Pidr4(0)
}
}
impl core::fmt::Debug for Pidr4 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Pidr4")
.field("des_2", &self.des_2())
.field("size", &self.size())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Pidr4 {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Pidr4 {{ des_2: {:?}, size: {=u8:?} }}",
self.des_2(),
self.size()
)
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Appset0 {
#[doc = "Application trigger 0 is inactive."]
Inactive = 0x0,
#[doc = "Application trigger 0 is active."]
RActiveWActivate = 0x01,
}
impl Appset0 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Appset0 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Appset0 {
#[inline(always)]
fn from(val: u8) -> Appset0 {
Appset0::from_bits(val)
}
}
impl From<Appset0> for u8 {
#[inline(always)]
fn from(val: Appset0) -> u8 {
Appset0::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Appset1 {
#[doc = "Application trigger 1 is inactive."]
Inactive = 0x0,
#[doc = "Application trigger 1 is active."]
RActiveWActivate = 0x01,
}
impl Appset1 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Appset1 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Appset1 {
#[inline(always)]
fn from(val: u8) -> Appset1 {
Appset1::from_bits(val)
}
}
impl From<Appset1> for u8 {
#[inline(always)]
fn from(val: Appset1) -> u8 {
Appset1::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Appset2 {
#[doc = "Application trigger 2 is inactive."]
Inactive = 0x0,
#[doc = "Application trigger 2 is active."]
RActiveWActivate = 0x01,
}
impl Appset2 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Appset2 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Appset2 {
#[inline(always)]
fn from(val: u8) -> Appset2 {
Appset2::from_bits(val)
}
}
impl From<Appset2> for u8 {
#[inline(always)]
fn from(val: Appset2) -> u8 {
Appset2::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Appset3 {
#[doc = "Application trigger 3 is inactive."]
Inactive = 0x0,
#[doc = "Application trigger 3 is active."]
RActiveWActivate = 0x01,
}
impl Appset3 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Appset3 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Appset3 {
#[inline(always)]
fn from(val: u8) -> Appset3 {
Appset3::from_bits(val)
}
}
impl From<Appset3> for u8 {
#[inline(always)]
fn from(val: Appset3) -> u8 {
Appset3::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Class {
_RESERVED_0 = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
#[doc = "Indicates that the component is a CoreSight component."]
Coresight = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Class {
#[inline(always)]
pub const fn from_bits(val: u8) -> Class {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Class {
#[inline(always)]
fn from(val: u8) -> Class {
Class::from_bits(val)
}
}
impl From<Class> for u8 {
#[inline(always)]
fn from(val: Class) -> u8 {
Class::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Cmod {
#[doc = "Indicates that the customer has not modified this component."]
Unmodified = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Cmod {
#[inline(always)]
pub const fn from_bits(val: u8) -> Cmod {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Cmod {
#[inline(always)]
fn from(val: u8) -> Cmod {
Cmod::from_bits(val)
}
}
impl From<Cmod> for u8 {
#[inline(always)]
fn from(val: Cmod) -> u8 {
Cmod::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Des0 {
_RESERVED_0 = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
#[doc = "Arm. Bits\\[3:0\\] of the JEDEC JEP106 Identity Code."]
Arm = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Des0 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Des0 {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Des0 {
#[inline(always)]
fn from(val: u8) -> Des0 {
Des0::from_bits(val)
}
}
impl From<Des0> for u8 {
#[inline(always)]
fn from(val: Des0) -> u8 {
Des0::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Des1 {
_RESERVED_0 = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
#[doc = "Arm. Bits\\[6:4\\] of the JEDEC JEP106 Identity Code."]
Arm = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
}
impl Des1 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Des1 {
unsafe { core::mem::transmute(val & 0x07) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Des1 {
#[inline(always)]
fn from(val: u8) -> Des1 {
Des1::from_bits(val)
}
}
impl From<Des1> for u8 {
#[inline(always)]
fn from(val: Des1) -> u8 {
Des1::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Des2 {
_RESERVED_0 = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
#[doc = "JEDEC continuation code."]
Code = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Des2 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Des2 {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Des2 {
#[inline(always)]
fn from(val: u8) -> Des2 {
Des2::from_bits(val)
}
}
impl From<Des2> for u8 {
#[inline(always)]
fn from(val: Des2) -> u8 {
Des2::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Major {
_RESERVED_0 = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
#[doc = "Indicates that this component allows a debugger to control other components in an Arm CoreSight SoC-400 system."]
Controller = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Major {
#[inline(always)]
pub const fn from_bits(val: u8) -> Major {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Major {
#[inline(always)]
fn from(val: u8) -> Major {
Major::from_bits(val)
}
}
impl From<Major> for u8 {
#[inline(always)]
fn from(val: Major) -> u8 {
Major::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Part0(u8);
impl Part0 {
#[doc = "Indicates bits\\[7:0\\] of the part number of the component."]
pub const PartnumberL: Self = Self(0x21);
}
impl Part0 {
pub const fn from_bits(val: u8) -> Part0 {
Self(val & 0xff)
}
pub const fn to_bits(self) -> u8 {
self.0
}
}
impl core::fmt::Debug for Part0 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x21 => f.write_str("PartnumberL"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Part0 {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x21 => defmt::write!(f, "PartnumberL"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u8> for Part0 {
#[inline(always)]
fn from(val: u8) -> Part0 {
Part0::from_bits(val)
}
}
impl From<Part0> for u8 {
#[inline(always)]
fn from(val: Part0) -> u8 {
Part0::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Part1 {
_RESERVED_0 = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
#[doc = "Indicates bits\\[11:8\\] of the part number of the component."]
PartnumberH = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Part1 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Part1 {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Part1 {
#[inline(always)]
fn from(val: u8) -> Part1 {
Part1::from_bits(val)
}
}
impl From<Part1> for u8 {
#[inline(always)]
fn from(val: Part1) -> u8 {
Part1::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Prmbl0(u8);
impl Prmbl0 {
#[doc = "Bits\\[7:0\\] of the identification code."]
pub const Value: Self = Self(0x0d);
}
impl Prmbl0 {
pub const fn from_bits(val: u8) -> Prmbl0 {
Self(val & 0xff)
}
pub const fn to_bits(self) -> u8 {
self.0
}
}
impl core::fmt::Debug for Prmbl0 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x0d => f.write_str("Value"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Prmbl0 {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x0d => defmt::write!(f, "Value"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u8> for Prmbl0 {
#[inline(always)]
fn from(val: u8) -> Prmbl0 {
Prmbl0::from_bits(val)
}
}
impl From<Prmbl0> for u8 {
#[inline(always)]
fn from(val: Prmbl0) -> u8 {
Prmbl0::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Prmbl1 {
#[doc = "Bits\\[11:8\\] of the identification code."]
Value = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Prmbl1 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Prmbl1 {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Prmbl1 {
#[inline(always)]
fn from(val: u8) -> Prmbl1 {
Prmbl1::from_bits(val)
}
}
impl From<Prmbl1> for u8 {
#[inline(always)]
fn from(val: Prmbl1) -> u8 {
Prmbl1::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Prmbl2(u8);
impl Prmbl2 {
#[doc = "Bits\\[23:16\\] of the identification code."]
pub const Value: Self = Self(0x05);
}
impl Prmbl2 {
pub const fn from_bits(val: u8) -> Prmbl2 {
Self(val & 0xff)
}
pub const fn to_bits(self) -> u8 {
self.0
}
}
impl core::fmt::Debug for Prmbl2 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x05 => f.write_str("Value"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Prmbl2 {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x05 => defmt::write!(f, "Value"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u8> for Prmbl2 {
#[inline(always)]
fn from(val: u8) -> Prmbl2 {
Prmbl2::from_bits(val)
}
}
impl From<Prmbl2> for u8 {
#[inline(always)]
fn from(val: Prmbl2) -> u8 {
Prmbl2::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Prmbl3(u8);
impl Prmbl3 {
#[doc = "Bits\\[31:24\\] of the identification code."]
pub const Value: Self = Self(0xb1);
}
impl Prmbl3 {
pub const fn from_bits(val: u8) -> Prmbl3 {
Self(val & 0xff)
}
pub const fn to_bits(self) -> u8 {
self.0
}
}
impl core::fmt::Debug for Prmbl3 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0xb1 => f.write_str("Value"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Prmbl3 {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0xb1 => defmt::write!(f, "Value"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u8> for Prmbl3 {
#[inline(always)]
fn from(val: u8) -> Prmbl3 {
Prmbl3::from_bits(val)
}
}
impl From<Prmbl3> for u8 {
#[inline(always)]
fn from(val: Prmbl3) -> u8 {
Prmbl3::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Revand {
#[doc = "Indicates that there are no errata fixes to this component."]
NoErrata = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Revand {
#[inline(always)]
pub const fn from_bits(val: u8) -> Revand {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Revand {
#[inline(always)]
fn from(val: u8) -> Revand {
Revand::from_bits(val)
}
}
impl From<Revand> for u8 {
#[inline(always)]
fn from(val: Revand) -> u8 {
Revand::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Revision {
#[doc = "This device is at r0p0."]
Rev0p0 = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Revision {
#[inline(always)]
pub const fn from_bits(val: u8) -> Revision {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Revision {
#[inline(always)]
fn from(val: u8) -> Revision {
Revision::from_bits(val)
}
}
impl From<Revision> for u8 {
#[inline(always)]
fn from(val: Revision) -> u8 {
Revision::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Sub {
_RESERVED_0 = 0x0,
#[doc = "Indicates that this component is a sub-triggering component."]
Crosstrigger = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Sub {
#[inline(always)]
pub const fn from_bits(val: u8) -> Sub {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Sub {
#[inline(always)]
fn from(val: u8) -> Sub {
Sub::from_bits(val)
}
}
impl From<Sub> for u8 {
#[inline(always)]
fn from(val: Sub) -> u8 {
Sub::to_bits(val)
}
}
}
}
pub mod ctrlapperi {
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Approtect {
ptr: *mut u8,
}
unsafe impl Send for Approtect {}
unsafe impl Sync for Approtect {}
impl Approtect {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "This register locks the APPROTECT.DISABLE register from being written to until next reset."]
#[inline(always)]
pub const fn lock(self) -> crate::common::Reg<regs::ApprotectLock, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "This register disables the APPROTECT register and enables debug access to non-secure mode."]
#[inline(always)]
pub const fn disable(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
#[doc = "Control access port 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ctrlapperi {
ptr: *mut u8,
}
unsafe impl Send for Ctrlapperi {}
unsafe impl Sync for Ctrlapperi {}
impl Ctrlapperi {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn mailbox(self) -> Mailbox {
unsafe { Mailbox::from_ptr(self.ptr.wrapping_add(0x0400usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn eraseprotect(self) -> Eraseprotect {
unsafe { Eraseprotect::from_ptr(self.ptr.wrapping_add(0x0500usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn approtect(self) -> Approtect {
unsafe { Approtect::from_ptr(self.ptr.wrapping_add(0x0540usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn secureapprotect(self) -> Secureapprotect {
unsafe { Secureapprotect::from_ptr(self.ptr.wrapping_add(0x0548usize) as _) }
}
#[doc = "Status bits for CTRL-AP peripheral."]
#[inline(always)]
pub const fn status(self) -> crate::common::Reg<regs::Status, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0600usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Eraseprotect {
ptr: *mut u8,
}
unsafe impl Send for Eraseprotect {}
unsafe impl Sync for Eraseprotect {}
impl Eraseprotect {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "This register locks the ERASEPROTECT.DISABLE register from being written until next reset."]
#[inline(always)]
pub const fn lock(self) -> crate::common::Reg<regs::EraseprotectLock, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "This register disables the ERASEPROTECT register and performs an ERASEALL operation."]
#[inline(always)]
pub const fn disable(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Mailbox {
ptr: *mut u8,
}
unsafe impl Send for Mailbox {}
unsafe impl Sync for Mailbox {}
impl Mailbox {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Data sent from the debugger to the CPU."]
#[inline(always)]
pub const fn rxdata(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "This register shows a status that indicates if data sent from the debugger to the CPU has been read."]
#[inline(always)]
pub const fn rxstatus(self) -> crate::common::Reg<regs::Rxstatus, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Data sent from the CPU to the debugger."]
#[inline(always)]
pub const fn txdata(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x80usize) as _) }
}
#[doc = "This register shows a status that indicates if the data sent from the CPU to the debugger has been read."]
#[inline(always)]
pub const fn txstatus(self) -> crate::common::Reg<regs::Txstatus, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x84usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Secureapprotect {
ptr: *mut u8,
}
unsafe impl Send for Secureapprotect {}
unsafe impl Sync for Secureapprotect {}
impl Secureapprotect {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "This register locks the SECUREAPPROTECT.DISABLE register from being written until next reset."]
#[inline(always)]
pub const fn lock(
self,
) -> crate::common::Reg<regs::SecureapprotectLock, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "This register disables the SECUREAPPROTECT register and enables debug access to secure mode."]
#[inline(always)]
pub const fn disable(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
pub mod regs {
#[doc = "This register locks the APPROTECT.DISABLE register from being written to until next reset."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct ApprotectLock(pub u32);
impl ApprotectLock {
#[doc = "Lock the APPROTECT.DISABLE register from being written to until next reset."]
#[must_use]
#[inline(always)]
pub const fn lock(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Lock the APPROTECT.DISABLE register from being written to until next reset."]
#[inline(always)]
pub const fn set_lock(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for ApprotectLock {
#[inline(always)]
fn default() -> ApprotectLock {
ApprotectLock(0)
}
}
impl core::fmt::Debug for ApprotectLock {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("ApprotectLock")
.field("lock", &self.lock())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for ApprotectLock {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "ApprotectLock {{ lock: {=bool:?} }}", self.lock())
}
}
#[doc = "This register locks the ERASEPROTECT.DISABLE register from being written until next reset."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct EraseprotectLock(pub u32);
impl EraseprotectLock {
#[doc = "Lock ERASEPROTECT.DISABLE register from being written until next reset."]
#[must_use]
#[inline(always)]
pub const fn lock(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Lock ERASEPROTECT.DISABLE register from being written until next reset."]
#[inline(always)]
pub const fn set_lock(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for EraseprotectLock {
#[inline(always)]
fn default() -> EraseprotectLock {
EraseprotectLock(0)
}
}
impl core::fmt::Debug for EraseprotectLock {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("EraseprotectLock")
.field("lock", &self.lock())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for EraseprotectLock {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "EraseprotectLock {{ lock: {=bool:?} }}", self.lock())
}
}
#[doc = "This register shows a status that indicates if data sent from the debugger to the CPU has been read."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Rxstatus(pub u32);
impl Rxstatus {
#[doc = "Status of data in register RXDATA."]
#[must_use]
#[inline(always)]
pub const fn rxstatus(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Status of data in register RXDATA."]
#[inline(always)]
pub const fn set_rxstatus(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Rxstatus {
#[inline(always)]
fn default() -> Rxstatus {
Rxstatus(0)
}
}
impl core::fmt::Debug for Rxstatus {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Rxstatus")
.field("rxstatus", &self.rxstatus())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Rxstatus {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Rxstatus {{ rxstatus: {=bool:?} }}", self.rxstatus())
}
}
#[doc = "This register locks the SECUREAPPROTECT.DISABLE register from being written until next reset."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct SecureapprotectLock(pub u32);
impl SecureapprotectLock {
#[doc = "Lock register SECUREAPPROTECT.DISABLE from being written until next reset."]
#[must_use]
#[inline(always)]
pub const fn lock(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Lock register SECUREAPPROTECT.DISABLE from being written until next reset."]
#[inline(always)]
pub const fn set_lock(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for SecureapprotectLock {
#[inline(always)]
fn default() -> SecureapprotectLock {
SecureapprotectLock(0)
}
}
impl core::fmt::Debug for SecureapprotectLock {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("SecureapprotectLock")
.field("lock", &self.lock())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for SecureapprotectLock {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "SecureapprotectLock {{ lock: {=bool:?} }}", self.lock())
}
}
#[doc = "Status bits for CTRL-AP peripheral."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Status(pub u32);
impl Status {
#[doc = "Status bit for UICR part of access port protection at last reset."]
#[must_use]
#[inline(always)]
pub const fn uicrapprotect(&self) -> super::vals::Uicrapprotect {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Uicrapprotect::from_bits(val as u8)
}
#[doc = "Status bit for UICR part of access port protection at last reset."]
#[inline(always)]
pub const fn set_uicrapprotect(&mut self, val: super::vals::Uicrapprotect) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "Status bit for UICR part of secure access port protection at last reset."]
#[must_use]
#[inline(always)]
pub const fn uicrsecureapprotect(&self) -> super::vals::Uicrsecureapprotect {
let val = (self.0 >> 1usize) & 0x01;
super::vals::Uicrsecureapprotect::from_bits(val as u8)
}
#[doc = "Status bit for UICR part of secure access port protection at last reset."]
#[inline(always)]
pub const fn set_uicrsecureapprotect(&mut self, val: super::vals::Uicrsecureapprotect) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val.to_bits() as u32) & 0x01) << 1usize);
}
#[doc = "Status bit for device debug interface mode."]
#[must_use]
#[inline(always)]
pub const fn dbgifacemode(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Status bit for device debug interface mode."]
#[inline(always)]
pub const fn set_dbgifacemode(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
}
impl Default for Status {
#[inline(always)]
fn default() -> Status {
Status(0)
}
}
impl core::fmt::Debug for Status {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Status")
.field("uicrapprotect", &self.uicrapprotect())
.field("uicrsecureapprotect", &self.uicrsecureapprotect())
.field("dbgifacemode", &self.dbgifacemode())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Status {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Status {{ uicrapprotect: {:?}, uicrsecureapprotect: {:?}, dbgifacemode: {=bool:?} }}" , self . uicrapprotect () , self . uicrsecureapprotect () , self . dbgifacemode ())
}
}
#[doc = "This register shows a status that indicates if the data sent from the CPU to the debugger has been read."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Txstatus(pub u32);
impl Txstatus {
#[doc = "Status of data in register TXDATA."]
#[must_use]
#[inline(always)]
pub const fn txstatus(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Status of data in register TXDATA."]
#[inline(always)]
pub const fn set_txstatus(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Txstatus {
#[inline(always)]
fn default() -> Txstatus {
Txstatus(0)
}
}
impl core::fmt::Debug for Txstatus {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Txstatus")
.field("txstatus", &self.txstatus())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Txstatus {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Txstatus {{ txstatus: {=bool:?} }}", self.txstatus())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Uicrapprotect {
#[doc = "APPROTECT was enabled in UICR."]
Enabled = 0x0,
#[doc = "APPROTECT wasdisabled in UICR."]
Disabled = 0x01,
}
impl Uicrapprotect {
#[inline(always)]
pub const fn from_bits(val: u8) -> Uicrapprotect {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Uicrapprotect {
#[inline(always)]
fn from(val: u8) -> Uicrapprotect {
Uicrapprotect::from_bits(val)
}
}
impl From<Uicrapprotect> for u8 {
#[inline(always)]
fn from(val: Uicrapprotect) -> u8 {
Uicrapprotect::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Uicrsecureapprotect {
#[doc = "SECUREAPPROTECT was enabled in UICR."]
Enabled = 0x0,
#[doc = "SECUREAPPROTECT was disabled in UICR."]
Disabled = 0x01,
}
impl Uicrsecureapprotect {
#[inline(always)]
pub const fn from_bits(val: u8) -> Uicrsecureapprotect {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Uicrsecureapprotect {
#[inline(always)]
fn from(val: u8) -> Uicrsecureapprotect {
Uicrsecureapprotect::from_bits(val)
}
}
impl From<Uicrsecureapprotect> for u8 {
#[inline(always)]
fn from(val: Uicrsecureapprotect) -> u8 {
Uicrsecureapprotect::to_bits(val)
}
}
}
}
pub mod dcnf {
#[doc = "Domain configuration management 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Dcnf {
ptr: *mut u8,
}
unsafe impl Send for Dcnf {}
unsafe impl Sync for Dcnf {}
impl Dcnf {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "CPU ID of this subsystem."]
#[inline(always)]
pub const fn cpuid(self) -> crate::common::Reg<regs::Cpuid, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0420usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn extperi(self, n: usize) -> Extperi {
assert!(n < 1usize);
unsafe { Extperi::from_ptr(self.ptr.wrapping_add(0x0440usize + n * 4usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn extram(self, n: usize) -> Extram {
assert!(n < 1usize);
unsafe { Extram::from_ptr(self.ptr.wrapping_add(0x0460usize + n * 4usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn extcode(self, n: usize) -> Extcode {
assert!(n < 1usize);
unsafe { Extcode::from_ptr(self.ptr.wrapping_add(0x0480usize + n * 4usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Extcode {
ptr: *mut u8,
}
unsafe impl Send for Extcode {}
unsafe impl Sync for Extcode {}
impl Extcode {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: Control access from master connected to AMLI master port EXTCODE\\[n\\]."]
#[inline(always)]
pub const fn protect(self) -> crate::common::Reg<regs::ExtcodeProtect, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Extperi {
ptr: *mut u8,
}
unsafe impl Send for Extperi {}
unsafe impl Sync for Extperi {}
impl Extperi {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: Control access for master connected to AMLI master port EXTPERI\\[n\\]."]
#[inline(always)]
pub const fn protect(self) -> crate::common::Reg<regs::ExtperiProtect, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Extram {
ptr: *mut u8,
}
unsafe impl Send for Extram {}
unsafe impl Sync for Extram {}
impl Extram {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: Control access from master connected to AMLI master port EXTRAM\\[n\\]."]
#[inline(always)]
pub const fn protect(self) -> crate::common::Reg<regs::ExtramProtect, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
}
pub mod regs {
#[doc = "CPU ID of this subsystem."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cpuid(pub u32);
impl Cpuid {
#[doc = "CPU ID."]
#[must_use]
#[inline(always)]
pub const fn cpuid(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "CPU ID."]
#[inline(always)]
pub const fn set_cpuid(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for Cpuid {
#[inline(always)]
fn default() -> Cpuid {
Cpuid(0)
}
}
impl core::fmt::Debug for Cpuid {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cpuid")
.field("cpuid", &self.cpuid())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cpuid {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Cpuid {{ cpuid: {=u8:?} }}", self.cpuid())
}
}
#[doc = "Description cluster: Control access from master connected to AMLI master port EXTCODE\\[n\\]."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct ExtcodeProtect(pub u32);
impl ExtcodeProtect {
#[doc = "Control access to slave 0 of master EXTCODE\\[n\\]."]
#[must_use]
#[inline(always)]
pub const fn slave0(&self) -> super::vals::ExtcodeProtectSlave0 {
let val = (self.0 >> 0usize) & 0x01;
super::vals::ExtcodeProtectSlave0::from_bits(val as u8)
}
#[doc = "Control access to slave 0 of master EXTCODE\\[n\\]."]
#[inline(always)]
pub const fn set_slave0(&mut self, val: super::vals::ExtcodeProtectSlave0) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for ExtcodeProtect {
#[inline(always)]
fn default() -> ExtcodeProtect {
ExtcodeProtect(0)
}
}
impl core::fmt::Debug for ExtcodeProtect {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("ExtcodeProtect")
.field("slave0", &self.slave0())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for ExtcodeProtect {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "ExtcodeProtect {{ slave0: {:?} }}", self.slave0())
}
}
#[doc = "Description cluster: Control access for master connected to AMLI master port EXTPERI\\[n\\]."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct ExtperiProtect(pub u32);
impl ExtperiProtect {
#[doc = "Control access to slave 0 of master EXTPERI\\[n\\]."]
#[must_use]
#[inline(always)]
pub const fn slave0(&self) -> super::vals::ExtperiProtectSlave0 {
let val = (self.0 >> 0usize) & 0x01;
super::vals::ExtperiProtectSlave0::from_bits(val as u8)
}
#[doc = "Control access to slave 0 of master EXTPERI\\[n\\]."]
#[inline(always)]
pub const fn set_slave0(&mut self, val: super::vals::ExtperiProtectSlave0) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for ExtperiProtect {
#[inline(always)]
fn default() -> ExtperiProtect {
ExtperiProtect(0)
}
}
impl core::fmt::Debug for ExtperiProtect {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("ExtperiProtect")
.field("slave0", &self.slave0())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for ExtperiProtect {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "ExtperiProtect {{ slave0: {:?} }}", self.slave0())
}
}
#[doc = "Description cluster: Control access from master connected to AMLI master port EXTRAM\\[n\\]."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct ExtramProtect(pub u32);
impl ExtramProtect {
#[doc = "Control access to slave 0 of master EXTRAM\\[n\\]."]
#[must_use]
#[inline(always)]
pub const fn slave0(&self) -> super::vals::ExtramProtectSlave0 {
let val = (self.0 >> 0usize) & 0x01;
super::vals::ExtramProtectSlave0::from_bits(val as u8)
}
#[doc = "Control access to slave 0 of master EXTRAM\\[n\\]."]
#[inline(always)]
pub const fn set_slave0(&mut self, val: super::vals::ExtramProtectSlave0) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "Control access to slave 1 of master EXTRAM\\[n\\]."]
#[must_use]
#[inline(always)]
pub const fn slave1(&self) -> super::vals::Slave1 {
let val = (self.0 >> 1usize) & 0x01;
super::vals::Slave1::from_bits(val as u8)
}
#[doc = "Control access to slave 1 of master EXTRAM\\[n\\]."]
#[inline(always)]
pub const fn set_slave1(&mut self, val: super::vals::Slave1) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val.to_bits() as u32) & 0x01) << 1usize);
}
#[doc = "Control access to slave 2 of master EXTRAM\\[n\\]."]
#[must_use]
#[inline(always)]
pub const fn slave2(&self) -> super::vals::Slave2 {
let val = (self.0 >> 2usize) & 0x01;
super::vals::Slave2::from_bits(val as u8)
}
#[doc = "Control access to slave 2 of master EXTRAM\\[n\\]."]
#[inline(always)]
pub const fn set_slave2(&mut self, val: super::vals::Slave2) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val.to_bits() as u32) & 0x01) << 2usize);
}
#[doc = "Control access to slave 3 of master EXTRAM\\[n\\]."]
#[must_use]
#[inline(always)]
pub const fn slave3(&self) -> super::vals::Slave3 {
let val = (self.0 >> 3usize) & 0x01;
super::vals::Slave3::from_bits(val as u8)
}
#[doc = "Control access to slave 3 of master EXTRAM\\[n\\]."]
#[inline(always)]
pub const fn set_slave3(&mut self, val: super::vals::Slave3) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val.to_bits() as u32) & 0x01) << 3usize);
}
#[doc = "Control access to slave 4 of master EXTRAM\\[n\\]."]
#[must_use]
#[inline(always)]
pub const fn slave4(&self) -> super::vals::Slave4 {
let val = (self.0 >> 4usize) & 0x01;
super::vals::Slave4::from_bits(val as u8)
}
#[doc = "Control access to slave 4 of master EXTRAM\\[n\\]."]
#[inline(always)]
pub const fn set_slave4(&mut self, val: super::vals::Slave4) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val.to_bits() as u32) & 0x01) << 4usize);
}
#[doc = "Control access to slave 5 of master EXTRAM\\[n\\]."]
#[must_use]
#[inline(always)]
pub const fn slave5(&self) -> super::vals::Slave5 {
let val = (self.0 >> 5usize) & 0x01;
super::vals::Slave5::from_bits(val as u8)
}
#[doc = "Control access to slave 5 of master EXTRAM\\[n\\]."]
#[inline(always)]
pub const fn set_slave5(&mut self, val: super::vals::Slave5) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val.to_bits() as u32) & 0x01) << 5usize);
}
#[doc = "Control access to slave 6 of master EXTRAM\\[n\\]."]
#[must_use]
#[inline(always)]
pub const fn slave6(&self) -> super::vals::Slave6 {
let val = (self.0 >> 6usize) & 0x01;
super::vals::Slave6::from_bits(val as u8)
}
#[doc = "Control access to slave 6 of master EXTRAM\\[n\\]."]
#[inline(always)]
pub const fn set_slave6(&mut self, val: super::vals::Slave6) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val.to_bits() as u32) & 0x01) << 6usize);
}
#[doc = "Control access to slave 7 of master EXTRAM\\[n\\]."]
#[must_use]
#[inline(always)]
pub const fn slave7(&self) -> super::vals::Slave7 {
let val = (self.0 >> 7usize) & 0x01;
super::vals::Slave7::from_bits(val as u8)
}
#[doc = "Control access to slave 7 of master EXTRAM\\[n\\]."]
#[inline(always)]
pub const fn set_slave7(&mut self, val: super::vals::Slave7) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val.to_bits() as u32) & 0x01) << 7usize);
}
}
impl Default for ExtramProtect {
#[inline(always)]
fn default() -> ExtramProtect {
ExtramProtect(0)
}
}
impl core::fmt::Debug for ExtramProtect {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("ExtramProtect")
.field("slave0", &self.slave0())
.field("slave1", &self.slave1())
.field("slave2", &self.slave2())
.field("slave3", &self.slave3())
.field("slave4", &self.slave4())
.field("slave5", &self.slave5())
.field("slave6", &self.slave6())
.field("slave7", &self.slave7())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for ExtramProtect {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "ExtramProtect {{ slave0: {:?}, slave1: {:?}, slave2: {:?}, slave3: {:?}, slave4: {:?}, slave5: {:?}, slave6: {:?}, slave7: {:?} }}" , self . slave0 () , self . slave1 () , self . slave2 () , self . slave3 () , self . slave4 () , self . slave5 () , self . slave6 () , self . slave7 ())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum ExtcodeProtectSlave0 {
#[doc = "Access to slave is allowed."]
Allowed = 0x0,
#[doc = "Access to slave is blocked."]
Blocked = 0x01,
}
impl ExtcodeProtectSlave0 {
#[inline(always)]
pub const fn from_bits(val: u8) -> ExtcodeProtectSlave0 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for ExtcodeProtectSlave0 {
#[inline(always)]
fn from(val: u8) -> ExtcodeProtectSlave0 {
ExtcodeProtectSlave0::from_bits(val)
}
}
impl From<ExtcodeProtectSlave0> for u8 {
#[inline(always)]
fn from(val: ExtcodeProtectSlave0) -> u8 {
ExtcodeProtectSlave0::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum ExtperiProtectSlave0 {
#[doc = "Access to slave is allowed."]
Allowed = 0x0,
#[doc = "Access to slave is blocked."]
Blocked = 0x01,
}
impl ExtperiProtectSlave0 {
#[inline(always)]
pub const fn from_bits(val: u8) -> ExtperiProtectSlave0 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for ExtperiProtectSlave0 {
#[inline(always)]
fn from(val: u8) -> ExtperiProtectSlave0 {
ExtperiProtectSlave0::from_bits(val)
}
}
impl From<ExtperiProtectSlave0> for u8 {
#[inline(always)]
fn from(val: ExtperiProtectSlave0) -> u8 {
ExtperiProtectSlave0::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum ExtramProtectSlave0 {
#[doc = "Access to slave is allowed."]
Allowed = 0x0,
#[doc = "Access to slave is blocked."]
Blocked = 0x01,
}
impl ExtramProtectSlave0 {
#[inline(always)]
pub const fn from_bits(val: u8) -> ExtramProtectSlave0 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for ExtramProtectSlave0 {
#[inline(always)]
fn from(val: u8) -> ExtramProtectSlave0 {
ExtramProtectSlave0::from_bits(val)
}
}
impl From<ExtramProtectSlave0> for u8 {
#[inline(always)]
fn from(val: ExtramProtectSlave0) -> u8 {
ExtramProtectSlave0::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Slave1 {
#[doc = "Access to slave is allowed."]
Allowed = 0x0,
#[doc = "Access to slave is blocked."]
Blocked = 0x01,
}
impl Slave1 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Slave1 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Slave1 {
#[inline(always)]
fn from(val: u8) -> Slave1 {
Slave1::from_bits(val)
}
}
impl From<Slave1> for u8 {
#[inline(always)]
fn from(val: Slave1) -> u8 {
Slave1::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Slave2 {
#[doc = "Access to slave is allowed."]
Allowed = 0x0,
#[doc = "Access to slave is blocked."]
Blocked = 0x01,
}
impl Slave2 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Slave2 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Slave2 {
#[inline(always)]
fn from(val: u8) -> Slave2 {
Slave2::from_bits(val)
}
}
impl From<Slave2> for u8 {
#[inline(always)]
fn from(val: Slave2) -> u8 {
Slave2::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Slave3 {
#[doc = "Access to slave is allowed."]
Allowed = 0x0,
#[doc = "Access to slave is blocked."]
Blocked = 0x01,
}
impl Slave3 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Slave3 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Slave3 {
#[inline(always)]
fn from(val: u8) -> Slave3 {
Slave3::from_bits(val)
}
}
impl From<Slave3> for u8 {
#[inline(always)]
fn from(val: Slave3) -> u8 {
Slave3::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Slave4 {
#[doc = "Access to slave is allowed."]
Allowed = 0x0,
#[doc = "Access to slave is blocked."]
Blocked = 0x01,
}
impl Slave4 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Slave4 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Slave4 {
#[inline(always)]
fn from(val: u8) -> Slave4 {
Slave4::from_bits(val)
}
}
impl From<Slave4> for u8 {
#[inline(always)]
fn from(val: Slave4) -> u8 {
Slave4::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Slave5 {
#[doc = "Access to slave is allowed."]
Allowed = 0x0,
#[doc = "Access to slave is blocked."]
Blocked = 0x01,
}
impl Slave5 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Slave5 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Slave5 {
#[inline(always)]
fn from(val: u8) -> Slave5 {
Slave5::from_bits(val)
}
}
impl From<Slave5> for u8 {
#[inline(always)]
fn from(val: Slave5) -> u8 {
Slave5::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Slave6 {
#[doc = "Access to slave is allowed."]
Allowed = 0x0,
#[doc = "Access to slave is blocked."]
Blocked = 0x01,
}
impl Slave6 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Slave6 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Slave6 {
#[inline(always)]
fn from(val: u8) -> Slave6 {
Slave6::from_bits(val)
}
}
impl From<Slave6> for u8 {
#[inline(always)]
fn from(val: Slave6) -> u8 {
Slave6::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Slave7 {
#[doc = "Access to slave is allowed."]
Allowed = 0x0,
#[doc = "Access to slave is blocked."]
Blocked = 0x01,
}
impl Slave7 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Slave7 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Slave7 {
#[inline(always)]
fn from(val: u8) -> Slave7 {
Slave7::from_bits(val)
}
}
impl From<Slave7> for u8 {
#[inline(always)]
fn from(val: Slave7) -> u8 {
Slave7::to_bits(val)
}
}
}
}
pub mod dppic {
#[doc = "Distributed programmable peripheral interconnect controller 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Dppic {
ptr: *mut u8,
}
unsafe impl Send for Dppic {}
unsafe impl Sync for Dppic {}
impl Dppic {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Channel group tasks."]
#[inline(always)]
pub const fn tasks_chg(self, n: usize) -> TasksChg {
assert!(n < 6usize);
unsafe { TasksChg::from_ptr(self.ptr.wrapping_add(0x0usize + n * 8usize) as _) }
}
#[doc = "Subscribe configuration for tasks."]
#[inline(always)]
pub const fn subscribe_chg(self, n: usize) -> SubscribeChg {
assert!(n < 6usize);
unsafe { SubscribeChg::from_ptr(self.ptr.wrapping_add(0x80usize + n * 8usize) as _) }
}
#[doc = "Channel enable register."]
#[inline(always)]
pub const fn chen(self) -> crate::common::Reg<regs::Chen, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0500usize) as _) }
}
#[doc = "Channel enable set register."]
#[inline(always)]
pub const fn chenset(self) -> crate::common::Reg<regs::Chen, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0504usize) as _) }
}
#[doc = "Channel enable clear register."]
#[inline(always)]
pub const fn chenclr(self) -> crate::common::Reg<regs::Chen, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0508usize) as _) }
}
#[doc = "Description collection: Channel group n Note: Writes to this register are ignored if either SUBSCRIBE_CHG\\[n\\].EN or SUBSCRIBE_CHG\\[n\\].DIS is enabled."]
#[inline(always)]
pub const fn chg(self, n: usize) -> crate::common::Reg<regs::Chg, crate::common::RW> {
assert!(n < 6usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0800usize + n * 4usize) as _)
}
}
}
#[doc = "Subscribe configuration for tasks."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct SubscribeChg {
ptr: *mut u8,
}
unsafe impl Send for SubscribeChg {}
unsafe impl Sync for SubscribeChg {}
impl SubscribeChg {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: Subscribe configuration for task CHG\\[n\\].EN."]
#[inline(always)]
pub const fn en(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Description cluster: Subscribe configuration for task CHG\\[n\\].DIS."]
#[inline(always)]
pub const fn dis(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
#[doc = "Channel group tasks."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TasksChg {
ptr: *mut u8,
}
unsafe impl Send for TasksChg {}
unsafe impl Sync for TasksChg {}
impl TasksChg {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: Enable channel group n."]
#[inline(always)]
pub const fn en(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Description cluster: Disable channel group n."]
#[inline(always)]
pub const fn dis(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
pub mod regs {
#[doc = "Channel enable register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Chen(pub u32);
impl Chen {
#[doc = "Enable or disable channel 0."]
#[must_use]
#[inline(always)]
pub const fn ch(&self, n: usize) -> bool {
assert!(n < 32usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Enable or disable channel 0."]
#[inline(always)]
pub const fn set_ch(&mut self, n: usize, val: bool) {
assert!(n < 32usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Chen {
#[inline(always)]
fn default() -> Chen {
Chen(0)
}
}
impl core::fmt::Debug for Chen {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Chen")
.field("ch[0]", &self.ch(0usize))
.field("ch[1]", &self.ch(1usize))
.field("ch[2]", &self.ch(2usize))
.field("ch[3]", &self.ch(3usize))
.field("ch[4]", &self.ch(4usize))
.field("ch[5]", &self.ch(5usize))
.field("ch[6]", &self.ch(6usize))
.field("ch[7]", &self.ch(7usize))
.field("ch[8]", &self.ch(8usize))
.field("ch[9]", &self.ch(9usize))
.field("ch[10]", &self.ch(10usize))
.field("ch[11]", &self.ch(11usize))
.field("ch[12]", &self.ch(12usize))
.field("ch[13]", &self.ch(13usize))
.field("ch[14]", &self.ch(14usize))
.field("ch[15]", &self.ch(15usize))
.field("ch[16]", &self.ch(16usize))
.field("ch[17]", &self.ch(17usize))
.field("ch[18]", &self.ch(18usize))
.field("ch[19]", &self.ch(19usize))
.field("ch[20]", &self.ch(20usize))
.field("ch[21]", &self.ch(21usize))
.field("ch[22]", &self.ch(22usize))
.field("ch[23]", &self.ch(23usize))
.field("ch[24]", &self.ch(24usize))
.field("ch[25]", &self.ch(25usize))
.field("ch[26]", &self.ch(26usize))
.field("ch[27]", &self.ch(27usize))
.field("ch[28]", &self.ch(28usize))
.field("ch[29]", &self.ch(29usize))
.field("ch[30]", &self.ch(30usize))
.field("ch[31]", &self.ch(31usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Chen {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Chen {{ ch[0]: {=bool:?}, ch[1]: {=bool:?}, ch[2]: {=bool:?}, ch[3]: {=bool:?}, ch[4]: {=bool:?}, ch[5]: {=bool:?}, ch[6]: {=bool:?}, ch[7]: {=bool:?}, ch[8]: {=bool:?}, ch[9]: {=bool:?}, ch[10]: {=bool:?}, ch[11]: {=bool:?}, ch[12]: {=bool:?}, ch[13]: {=bool:?}, ch[14]: {=bool:?}, ch[15]: {=bool:?}, ch[16]: {=bool:?}, ch[17]: {=bool:?}, ch[18]: {=bool:?}, ch[19]: {=bool:?}, ch[20]: {=bool:?}, ch[21]: {=bool:?}, ch[22]: {=bool:?}, ch[23]: {=bool:?}, ch[24]: {=bool:?}, ch[25]: {=bool:?}, ch[26]: {=bool:?}, ch[27]: {=bool:?}, ch[28]: {=bool:?}, ch[29]: {=bool:?}, ch[30]: {=bool:?}, ch[31]: {=bool:?} }}" , self . ch (0usize) , self . ch (1usize) , self . ch (2usize) , self . ch (3usize) , self . ch (4usize) , self . ch (5usize) , self . ch (6usize) , self . ch (7usize) , self . ch (8usize) , self . ch (9usize) , self . ch (10usize) , self . ch (11usize) , self . ch (12usize) , self . ch (13usize) , self . ch (14usize) , self . ch (15usize) , self . ch (16usize) , self . ch (17usize) , self . ch (18usize) , self . ch (19usize) , self . ch (20usize) , self . ch (21usize) , self . ch (22usize) , self . ch (23usize) , self . ch (24usize) , self . ch (25usize) , self . ch (26usize) , self . ch (27usize) , self . ch (28usize) , self . ch (29usize) , self . ch (30usize) , self . ch (31usize))
}
}
#[doc = "Description collection: Channel group n Note: Writes to this register are ignored if either SUBSCRIBE_CHG\\[n\\].EN or SUBSCRIBE_CHG\\[n\\].DIS is enabled."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Chg(pub u32);
impl Chg {
#[doc = "Include or exclude channel 0."]
#[must_use]
#[inline(always)]
pub const fn ch(&self, n: usize) -> bool {
assert!(n < 32usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Include or exclude channel 0."]
#[inline(always)]
pub const fn set_ch(&mut self, n: usize, val: bool) {
assert!(n < 32usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Chg {
#[inline(always)]
fn default() -> Chg {
Chg(0)
}
}
impl core::fmt::Debug for Chg {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Chg")
.field("ch[0]", &self.ch(0usize))
.field("ch[1]", &self.ch(1usize))
.field("ch[2]", &self.ch(2usize))
.field("ch[3]", &self.ch(3usize))
.field("ch[4]", &self.ch(4usize))
.field("ch[5]", &self.ch(5usize))
.field("ch[6]", &self.ch(6usize))
.field("ch[7]", &self.ch(7usize))
.field("ch[8]", &self.ch(8usize))
.field("ch[9]", &self.ch(9usize))
.field("ch[10]", &self.ch(10usize))
.field("ch[11]", &self.ch(11usize))
.field("ch[12]", &self.ch(12usize))
.field("ch[13]", &self.ch(13usize))
.field("ch[14]", &self.ch(14usize))
.field("ch[15]", &self.ch(15usize))
.field("ch[16]", &self.ch(16usize))
.field("ch[17]", &self.ch(17usize))
.field("ch[18]", &self.ch(18usize))
.field("ch[19]", &self.ch(19usize))
.field("ch[20]", &self.ch(20usize))
.field("ch[21]", &self.ch(21usize))
.field("ch[22]", &self.ch(22usize))
.field("ch[23]", &self.ch(23usize))
.field("ch[24]", &self.ch(24usize))
.field("ch[25]", &self.ch(25usize))
.field("ch[26]", &self.ch(26usize))
.field("ch[27]", &self.ch(27usize))
.field("ch[28]", &self.ch(28usize))
.field("ch[29]", &self.ch(29usize))
.field("ch[30]", &self.ch(30usize))
.field("ch[31]", &self.ch(31usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Chg {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Chg {{ ch[0]: {=bool:?}, ch[1]: {=bool:?}, ch[2]: {=bool:?}, ch[3]: {=bool:?}, ch[4]: {=bool:?}, ch[5]: {=bool:?}, ch[6]: {=bool:?}, ch[7]: {=bool:?}, ch[8]: {=bool:?}, ch[9]: {=bool:?}, ch[10]: {=bool:?}, ch[11]: {=bool:?}, ch[12]: {=bool:?}, ch[13]: {=bool:?}, ch[14]: {=bool:?}, ch[15]: {=bool:?}, ch[16]: {=bool:?}, ch[17]: {=bool:?}, ch[18]: {=bool:?}, ch[19]: {=bool:?}, ch[20]: {=bool:?}, ch[21]: {=bool:?}, ch[22]: {=bool:?}, ch[23]: {=bool:?}, ch[24]: {=bool:?}, ch[25]: {=bool:?}, ch[26]: {=bool:?}, ch[27]: {=bool:?}, ch[28]: {=bool:?}, ch[29]: {=bool:?}, ch[30]: {=bool:?}, ch[31]: {=bool:?} }}" , self . ch (0usize) , self . ch (1usize) , self . ch (2usize) , self . ch (3usize) , self . ch (4usize) , self . ch (5usize) , self . ch (6usize) , self . ch (7usize) , self . ch (8usize) , self . ch (9usize) , self . ch (10usize) , self . ch (11usize) , self . ch (12usize) , self . ch (13usize) , self . ch (14usize) , self . ch (15usize) , self . ch (16usize) , self . ch (17usize) , self . ch (18usize) , self . ch (19usize) , self . ch (20usize) , self . ch (21usize) , self . ch (22usize) , self . ch (23usize) , self . ch (24usize) , self . ch (25usize) , self . ch (26usize) , self . ch (27usize) , self . ch (28usize) , self . ch (29usize) , self . ch (30usize) , self . ch (31usize))
}
}
}
}
pub mod egu {
#[doc = "Event generator unit 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Egu {
ptr: *mut u8,
}
unsafe impl Send for Egu {}
unsafe impl Sync for Egu {}
impl Egu {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description collection: Trigger n for triggering the corresponding TRIGGERED\\[n\\] event."]
#[inline(always)]
pub const fn tasks_trigger(self, n: usize) -> crate::common::Reg<u32, crate::common::W> {
assert!(n < 16usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize + n * 4usize) as _)
}
}
#[doc = "Description collection: Subscribe configuration for task TRIGGER\\[n\\]."]
#[inline(always)]
pub const fn subscribe_trigger(
self,
n: usize,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
assert!(n < 16usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x80usize + n * 4usize) as _)
}
}
#[doc = "Description collection: Event number n generated by triggering the corresponding TRIGGER\\[n\\] task."]
#[inline(always)]
pub const fn events_triggered(
self,
n: usize,
) -> crate::common::Reg<u32, crate::common::RW> {
assert!(n < 16usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0100usize + n * 4usize) as _)
}
}
#[doc = "Description collection: Publish configuration for event TRIGGERED\\[n\\]."]
#[inline(always)]
pub const fn publish_triggered(
self,
n: usize,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
assert!(n < 16usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0180usize + n * 4usize) as _)
}
}
#[doc = "Enable or disable interrupt."]
#[inline(always)]
pub const fn inten(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0300usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
}
pub mod regs {
#[doc = "Enable or disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Enable or disable interrupt for event TRIGGERED\\[0\\]."]
#[must_use]
#[inline(always)]
pub const fn triggered(&self, n: usize) -> bool {
assert!(n < 16usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event TRIGGERED\\[0\\]."]
#[inline(always)]
pub const fn set_triggered(&mut self, n: usize, val: bool) {
assert!(n < 16usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("triggered[0]", &self.triggered(0usize))
.field("triggered[1]", &self.triggered(1usize))
.field("triggered[2]", &self.triggered(2usize))
.field("triggered[3]", &self.triggered(3usize))
.field("triggered[4]", &self.triggered(4usize))
.field("triggered[5]", &self.triggered(5usize))
.field("triggered[6]", &self.triggered(6usize))
.field("triggered[7]", &self.triggered(7usize))
.field("triggered[8]", &self.triggered(8usize))
.field("triggered[9]", &self.triggered(9usize))
.field("triggered[10]", &self.triggered(10usize))
.field("triggered[11]", &self.triggered(11usize))
.field("triggered[12]", &self.triggered(12usize))
.field("triggered[13]", &self.triggered(13usize))
.field("triggered[14]", &self.triggered(14usize))
.field("triggered[15]", &self.triggered(15usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Int {{ triggered[0]: {=bool:?}, triggered[1]: {=bool:?}, triggered[2]: {=bool:?}, triggered[3]: {=bool:?}, triggered[4]: {=bool:?}, triggered[5]: {=bool:?}, triggered[6]: {=bool:?}, triggered[7]: {=bool:?}, triggered[8]: {=bool:?}, triggered[9]: {=bool:?}, triggered[10]: {=bool:?}, triggered[11]: {=bool:?}, triggered[12]: {=bool:?}, triggered[13]: {=bool:?}, triggered[14]: {=bool:?}, triggered[15]: {=bool:?} }}" , self . triggered (0usize) , self . triggered (1usize) , self . triggered (2usize) , self . triggered (3usize) , self . triggered (4usize) , self . triggered (5usize) , self . triggered (6usize) , self . triggered (7usize) , self . triggered (8usize) , self . triggered (9usize) , self . triggered (10usize) , self . triggered (11usize) , self . triggered (12usize) , self . triggered (13usize) , self . triggered (14usize) , self . triggered (15usize))
}
}
}
}
pub mod ficr {
#[doc = "Factory Information Configuration Registers."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ficr {
ptr: *mut u8,
}
unsafe impl Send for Ficr {}
unsafe impl Sync for Ficr {}
impl Ficr {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Device info."]
#[inline(always)]
pub const fn info(self) -> Info {
unsafe { Info::from_ptr(self.ptr.wrapping_add(0x0200usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn trimcnf(self, n: usize) -> Trimcnf {
assert!(n < 32usize);
unsafe { Trimcnf::from_ptr(self.ptr.wrapping_add(0x0300usize + n * 8usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn nfc(self) -> Nfc {
unsafe { Nfc::from_ptr(self.ptr.wrapping_add(0x0450usize) as _) }
}
#[doc = "NIST800-90B RNG calibration data."]
#[inline(always)]
pub const fn trng90b(self) -> Trng90b {
unsafe { Trng90b::from_ptr(self.ptr.wrapping_add(0x0c00usize) as _) }
}
#[doc = "XOSC32M capacitor selection trim values."]
#[inline(always)]
pub const fn xosc32mtrim(self) -> crate::common::Reg<regs::Xosc32mtrim, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0c20usize) as _) }
}
}
#[doc = "Device info."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Info {
ptr: *mut u8,
}
unsafe impl Send for Info {}
unsafe impl Sync for Info {}
impl Info {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Configuration identifier."]
#[inline(always)]
pub const fn configid(self) -> crate::common::Reg<regs::Configid, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Description collection: Device identifier."]
#[inline(always)]
pub const fn deviceid(self, n: usize) -> crate::common::Reg<u32, crate::common::R> {
assert!(n < 2usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize + n * 4usize) as _)
}
}
#[doc = "Part code."]
#[inline(always)]
pub const fn part(self) -> crate::common::Reg<regs::Part, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
#[doc = "Part Variant, Hardware version and Production configuration."]
#[inline(always)]
pub const fn variant(self) -> crate::common::Reg<regs::Variant, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
#[doc = "Package option."]
#[inline(always)]
pub const fn package(self) -> crate::common::Reg<regs::Package, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x14usize) as _) }
}
#[doc = "RAM variant."]
#[inline(always)]
pub const fn ram(self) -> crate::common::Reg<regs::Ram, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x18usize) as _) }
}
#[doc = "Flash variant."]
#[inline(always)]
pub const fn flash(self) -> crate::common::Reg<regs::Flash, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x1cusize) as _) }
}
#[doc = "Code memory page size in bytes."]
#[inline(always)]
pub const fn codepagesize(
self,
) -> crate::common::Reg<regs::Codepagesize, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x20usize) as _) }
}
#[doc = "Code memory size."]
#[inline(always)]
pub const fn codesize(self) -> crate::common::Reg<regs::Codesize, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x24usize) as _) }
}
#[doc = "Device type."]
#[inline(always)]
pub const fn devicetype(self) -> crate::common::Reg<regs::Devicetype, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x28usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Nfc {
ptr: *mut u8,
}
unsafe impl Send for Nfc {}
unsafe impl Sync for Nfc {}
impl Nfc {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Default header for NFC Tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST."]
#[inline(always)]
pub const fn tagheader0(self) -> crate::common::Reg<regs::Tagheader0, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Default header for NFC Tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST."]
#[inline(always)]
pub const fn tagheader1(self) -> crate::common::Reg<regs::Tagheader1, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Default header for NFC Tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST."]
#[inline(always)]
pub const fn tagheader2(self) -> crate::common::Reg<regs::Tagheader2, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Default header for NFC Tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST."]
#[inline(always)]
pub const fn tagheader3(self) -> crate::common::Reg<regs::Tagheader3, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Trimcnf {
ptr: *mut u8,
}
unsafe impl Send for Trimcnf {}
unsafe impl Sync for Trimcnf {}
impl Trimcnf {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: Address of the PAR register which will be written."]
#[inline(always)]
pub const fn addr(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Description cluster: Data."]
#[inline(always)]
pub const fn data(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
#[doc = "NIST800-90B RNG calibration data."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Trng90b {
ptr: *mut u8,
}
unsafe impl Send for Trng90b {}
unsafe impl Sync for Trng90b {}
impl Trng90b {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Amount of bytes for the required entropy bits."]
#[inline(always)]
pub const fn bytes(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Repetition counter cutoff."]
#[inline(always)]
pub const fn rccutoff(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Adaptive proportion cutoff."]
#[inline(always)]
pub const fn apcutoff(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Amount of bytes for the startup tests."]
#[inline(always)]
pub const fn startup(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
#[doc = "Sample count for ring oscillator 1."]
#[inline(always)]
pub const fn rosc1(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
#[doc = "Sample count for ring oscillator 2."]
#[inline(always)]
pub const fn rosc2(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x14usize) as _) }
}
#[doc = "Sample count for ring oscillator 3."]
#[inline(always)]
pub const fn rosc3(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x18usize) as _) }
}
#[doc = "Sample count for ring oscillator 4."]
#[inline(always)]
pub const fn rosc4(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x1cusize) as _) }
}
}
pub mod regs {
#[doc = "Code memory page size in bytes."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Codepagesize(pub u32);
impl Codepagesize {
#[doc = "Code memory page size in bytes."]
#[must_use]
#[inline(always)]
pub const fn codepagesize(&self) -> super::vals::Codepagesize {
let val = (self.0 >> 0usize) & 0xffff_ffff;
super::vals::Codepagesize::from_bits(val as u32)
}
#[doc = "Code memory page size in bytes."]
#[inline(always)]
pub const fn set_codepagesize(&mut self, val: super::vals::Codepagesize) {
self.0 = (self.0 & !(0xffff_ffff << 0usize))
| (((val.to_bits() as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Codepagesize {
#[inline(always)]
fn default() -> Codepagesize {
Codepagesize(0)
}
}
impl core::fmt::Debug for Codepagesize {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Codepagesize")
.field("codepagesize", &self.codepagesize())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Codepagesize {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Codepagesize {{ codepagesize: {:?} }}",
self.codepagesize()
)
}
}
#[doc = "Code memory size."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Codesize(pub u32);
impl Codesize {
#[doc = "Code memory size in number of pages."]
#[must_use]
#[inline(always)]
pub const fn codesize(&self) -> super::vals::Codesize {
let val = (self.0 >> 0usize) & 0xffff_ffff;
super::vals::Codesize::from_bits(val as u32)
}
#[doc = "Code memory size in number of pages."]
#[inline(always)]
pub const fn set_codesize(&mut self, val: super::vals::Codesize) {
self.0 = (self.0 & !(0xffff_ffff << 0usize))
| (((val.to_bits() as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Codesize {
#[inline(always)]
fn default() -> Codesize {
Codesize(0)
}
}
impl core::fmt::Debug for Codesize {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Codesize")
.field("codesize", &self.codesize())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Codesize {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Codesize {{ codesize: {:?} }}", self.codesize())
}
}
#[doc = "Configuration identifier."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Configid(pub u32);
impl Configid {
#[doc = "Identification number for the HW."]
#[must_use]
#[inline(always)]
pub const fn hwid(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Identification number for the HW."]
#[inline(always)]
pub const fn set_hwid(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for Configid {
#[inline(always)]
fn default() -> Configid {
Configid(0)
}
}
impl core::fmt::Debug for Configid {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Configid")
.field("hwid", &self.hwid())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Configid {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Configid {{ hwid: {=u16:?} }}", self.hwid())
}
}
#[doc = "Device type."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Devicetype(pub u32);
impl Devicetype {
#[doc = "Device type."]
#[must_use]
#[inline(always)]
pub const fn devicetype(&self) -> super::vals::Devicetype {
let val = (self.0 >> 0usize) & 0xffff_ffff;
super::vals::Devicetype::from_bits(val as u32)
}
#[doc = "Device type."]
#[inline(always)]
pub const fn set_devicetype(&mut self, val: super::vals::Devicetype) {
self.0 = (self.0 & !(0xffff_ffff << 0usize))
| (((val.to_bits() as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Devicetype {
#[inline(always)]
fn default() -> Devicetype {
Devicetype(0)
}
}
impl core::fmt::Debug for Devicetype {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Devicetype")
.field("devicetype", &self.devicetype())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Devicetype {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Devicetype {{ devicetype: {:?} }}", self.devicetype())
}
}
#[doc = "Flash variant."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Flash(pub u32);
impl Flash {
#[doc = "Flash variant."]
#[must_use]
#[inline(always)]
pub const fn flash(&self) -> super::vals::Flash {
let val = (self.0 >> 0usize) & 0xffff_ffff;
super::vals::Flash::from_bits(val as u32)
}
#[doc = "Flash variant."]
#[inline(always)]
pub const fn set_flash(&mut self, val: super::vals::Flash) {
self.0 = (self.0 & !(0xffff_ffff << 0usize))
| (((val.to_bits() as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Flash {
#[inline(always)]
fn default() -> Flash {
Flash(0)
}
}
impl core::fmt::Debug for Flash {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Flash")
.field("flash", &self.flash())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Flash {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Flash {{ flash: {:?} }}", self.flash())
}
}
#[doc = "Package option."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Package(pub u32);
impl Package {
#[doc = "Package option."]
#[must_use]
#[inline(always)]
pub const fn package(&self) -> super::vals::Package {
let val = (self.0 >> 0usize) & 0xffff_ffff;
super::vals::Package::from_bits(val as u32)
}
#[doc = "Package option."]
#[inline(always)]
pub const fn set_package(&mut self, val: super::vals::Package) {
self.0 = (self.0 & !(0xffff_ffff << 0usize))
| (((val.to_bits() as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Package {
#[inline(always)]
fn default() -> Package {
Package(0)
}
}
impl core::fmt::Debug for Package {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Package")
.field("package", &self.package())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Package {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Package {{ package: {:?} }}", self.package())
}
}
#[doc = "Part code."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Part(pub u32);
impl Part {
#[doc = "Part code."]
#[must_use]
#[inline(always)]
pub const fn part(&self) -> super::vals::Part {
let val = (self.0 >> 0usize) & 0xffff_ffff;
super::vals::Part::from_bits(val as u32)
}
#[doc = "Part code."]
#[inline(always)]
pub const fn set_part(&mut self, val: super::vals::Part) {
self.0 = (self.0 & !(0xffff_ffff << 0usize))
| (((val.to_bits() as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Part {
#[inline(always)]
fn default() -> Part {
Part(0)
}
}
impl core::fmt::Debug for Part {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Part").field("part", &self.part()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Part {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Part {{ part: {:?} }}", self.part())
}
}
#[doc = "RAM variant."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ram(pub u32);
impl Ram {
#[doc = "RAM variant."]
#[must_use]
#[inline(always)]
pub const fn ram(&self) -> super::vals::Ram {
let val = (self.0 >> 0usize) & 0xffff_ffff;
super::vals::Ram::from_bits(val as u32)
}
#[doc = "RAM variant."]
#[inline(always)]
pub const fn set_ram(&mut self, val: super::vals::Ram) {
self.0 = (self.0 & !(0xffff_ffff << 0usize))
| (((val.to_bits() as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Ram {
#[inline(always)]
fn default() -> Ram {
Ram(0)
}
}
impl core::fmt::Debug for Ram {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ram").field("ram", &self.ram()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ram {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Ram {{ ram: {:?} }}", self.ram())
}
}
#[doc = "Default header for NFC Tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Tagheader0(pub u32);
impl Tagheader0 {
#[doc = "Default Manufacturer ID: Nordic Semiconductor ASA has ICM 0x5F."]
#[must_use]
#[inline(always)]
pub const fn mfgid(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Default Manufacturer ID: Nordic Semiconductor ASA has ICM 0x5F."]
#[inline(always)]
pub const fn set_mfgid(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
#[doc = "Unique identifier byte 1."]
#[must_use]
#[inline(always)]
pub const fn ud1(&self) -> u8 {
let val = (self.0 >> 8usize) & 0xff;
val as u8
}
#[doc = "Unique identifier byte 1."]
#[inline(always)]
pub const fn set_ud1(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize);
}
#[doc = "Unique identifier byte 2."]
#[must_use]
#[inline(always)]
pub const fn ud2(&self) -> u8 {
let val = (self.0 >> 16usize) & 0xff;
val as u8
}
#[doc = "Unique identifier byte 2."]
#[inline(always)]
pub const fn set_ud2(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize);
}
#[doc = "Unique identifier byte 3."]
#[must_use]
#[inline(always)]
pub const fn ud3(&self) -> u8 {
let val = (self.0 >> 24usize) & 0xff;
val as u8
}
#[doc = "Unique identifier byte 3."]
#[inline(always)]
pub const fn set_ud3(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 24usize)) | (((val as u32) & 0xff) << 24usize);
}
}
impl Default for Tagheader0 {
#[inline(always)]
fn default() -> Tagheader0 {
Tagheader0(0)
}
}
impl core::fmt::Debug for Tagheader0 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Tagheader0")
.field("mfgid", &self.mfgid())
.field("ud1", &self.ud1())
.field("ud2", &self.ud2())
.field("ud3", &self.ud3())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Tagheader0 {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Tagheader0 {{ mfgid: {=u8:?}, ud1: {=u8:?}, ud2: {=u8:?}, ud3: {=u8:?} }}",
self.mfgid(),
self.ud1(),
self.ud2(),
self.ud3()
)
}
}
#[doc = "Default header for NFC Tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Tagheader1(pub u32);
impl Tagheader1 {
#[doc = "Unique identifier byte 4."]
#[must_use]
#[inline(always)]
pub const fn ud4(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Unique identifier byte 4."]
#[inline(always)]
pub const fn set_ud4(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
#[doc = "Unique identifier byte 5."]
#[must_use]
#[inline(always)]
pub const fn ud5(&self) -> u8 {
let val = (self.0 >> 8usize) & 0xff;
val as u8
}
#[doc = "Unique identifier byte 5."]
#[inline(always)]
pub const fn set_ud5(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize);
}
#[doc = "Unique identifier byte 6."]
#[must_use]
#[inline(always)]
pub const fn ud6(&self) -> u8 {
let val = (self.0 >> 16usize) & 0xff;
val as u8
}
#[doc = "Unique identifier byte 6."]
#[inline(always)]
pub const fn set_ud6(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize);
}
#[doc = "Unique identifier byte 7."]
#[must_use]
#[inline(always)]
pub const fn ud7(&self) -> u8 {
let val = (self.0 >> 24usize) & 0xff;
val as u8
}
#[doc = "Unique identifier byte 7."]
#[inline(always)]
pub const fn set_ud7(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 24usize)) | (((val as u32) & 0xff) << 24usize);
}
}
impl Default for Tagheader1 {
#[inline(always)]
fn default() -> Tagheader1 {
Tagheader1(0)
}
}
impl core::fmt::Debug for Tagheader1 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Tagheader1")
.field("ud4", &self.ud4())
.field("ud5", &self.ud5())
.field("ud6", &self.ud6())
.field("ud7", &self.ud7())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Tagheader1 {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Tagheader1 {{ ud4: {=u8:?}, ud5: {=u8:?}, ud6: {=u8:?}, ud7: {=u8:?} }}",
self.ud4(),
self.ud5(),
self.ud6(),
self.ud7()
)
}
}
#[doc = "Default header for NFC Tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Tagheader2(pub u32);
impl Tagheader2 {
#[doc = "Unique identifier byte 8."]
#[must_use]
#[inline(always)]
pub const fn ud8(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Unique identifier byte 8."]
#[inline(always)]
pub const fn set_ud8(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
#[doc = "Unique identifier byte 9."]
#[must_use]
#[inline(always)]
pub const fn ud9(&self) -> u8 {
let val = (self.0 >> 8usize) & 0xff;
val as u8
}
#[doc = "Unique identifier byte 9."]
#[inline(always)]
pub const fn set_ud9(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize);
}
#[doc = "Unique identifier byte 10."]
#[must_use]
#[inline(always)]
pub const fn ud10(&self) -> u8 {
let val = (self.0 >> 16usize) & 0xff;
val as u8
}
#[doc = "Unique identifier byte 10."]
#[inline(always)]
pub const fn set_ud10(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize);
}
#[doc = "Unique identifier byte 11."]
#[must_use]
#[inline(always)]
pub const fn ud11(&self) -> u8 {
let val = (self.0 >> 24usize) & 0xff;
val as u8
}
#[doc = "Unique identifier byte 11."]
#[inline(always)]
pub const fn set_ud11(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 24usize)) | (((val as u32) & 0xff) << 24usize);
}
}
impl Default for Tagheader2 {
#[inline(always)]
fn default() -> Tagheader2 {
Tagheader2(0)
}
}
impl core::fmt::Debug for Tagheader2 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Tagheader2")
.field("ud8", &self.ud8())
.field("ud9", &self.ud9())
.field("ud10", &self.ud10())
.field("ud11", &self.ud11())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Tagheader2 {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Tagheader2 {{ ud8: {=u8:?}, ud9: {=u8:?}, ud10: {=u8:?}, ud11: {=u8:?} }}",
self.ud8(),
self.ud9(),
self.ud10(),
self.ud11()
)
}
}
#[doc = "Default header for NFC Tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Tagheader3(pub u32);
impl Tagheader3 {
#[doc = "Unique identifier byte 12."]
#[must_use]
#[inline(always)]
pub const fn ud12(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Unique identifier byte 12."]
#[inline(always)]
pub const fn set_ud12(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
#[doc = "Unique identifier byte 13."]
#[must_use]
#[inline(always)]
pub const fn ud13(&self) -> u8 {
let val = (self.0 >> 8usize) & 0xff;
val as u8
}
#[doc = "Unique identifier byte 13."]
#[inline(always)]
pub const fn set_ud13(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize);
}
#[doc = "Unique identifier byte 14."]
#[must_use]
#[inline(always)]
pub const fn ud14(&self) -> u8 {
let val = (self.0 >> 16usize) & 0xff;
val as u8
}
#[doc = "Unique identifier byte 14."]
#[inline(always)]
pub const fn set_ud14(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize);
}
#[doc = "Unique identifier byte 15."]
#[must_use]
#[inline(always)]
pub const fn ud15(&self) -> u8 {
let val = (self.0 >> 24usize) & 0xff;
val as u8
}
#[doc = "Unique identifier byte 15."]
#[inline(always)]
pub const fn set_ud15(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 24usize)) | (((val as u32) & 0xff) << 24usize);
}
}
impl Default for Tagheader3 {
#[inline(always)]
fn default() -> Tagheader3 {
Tagheader3(0)
}
}
impl core::fmt::Debug for Tagheader3 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Tagheader3")
.field("ud12", &self.ud12())
.field("ud13", &self.ud13())
.field("ud14", &self.ud14())
.field("ud15", &self.ud15())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Tagheader3 {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Tagheader3 {{ ud12: {=u8:?}, ud13: {=u8:?}, ud14: {=u8:?}, ud15: {=u8:?} }}",
self.ud12(),
self.ud13(),
self.ud14(),
self.ud15()
)
}
}
#[doc = "Part Variant, Hardware version and Production configuration."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Variant(pub u32);
impl Variant {
#[doc = "Part Variant, Hardware version and Production configuration, encoded as ASCII."]
#[must_use]
#[inline(always)]
pub const fn variant(&self) -> super::vals::Variant {
let val = (self.0 >> 0usize) & 0xffff_ffff;
super::vals::Variant::from_bits(val as u32)
}
#[doc = "Part Variant, Hardware version and Production configuration, encoded as ASCII."]
#[inline(always)]
pub const fn set_variant(&mut self, val: super::vals::Variant) {
self.0 = (self.0 & !(0xffff_ffff << 0usize))
| (((val.to_bits() as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Variant {
#[inline(always)]
fn default() -> Variant {
Variant(0)
}
}
impl core::fmt::Debug for Variant {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Variant")
.field("variant", &self.variant())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Variant {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Variant {{ variant: {:?} }}", self.variant())
}
}
#[doc = "XOSC32M capacitor selection trim values."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Xosc32mtrim(pub u32);
impl Xosc32mtrim {
#[doc = "Slope trim factor on twos complement form."]
#[must_use]
#[inline(always)]
pub const fn slope(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x1f;
val as u8
}
#[doc = "Slope trim factor on twos complement form."]
#[inline(always)]
pub const fn set_slope(&mut self, val: u8) {
self.0 = (self.0 & !(0x1f << 0usize)) | (((val as u32) & 0x1f) << 0usize);
}
#[doc = "Offset trim factor on integer form."]
#[must_use]
#[inline(always)]
pub const fn offset(&self) -> u8 {
let val = (self.0 >> 5usize) & 0x1f;
val as u8
}
#[doc = "Offset trim factor on integer form."]
#[inline(always)]
pub const fn set_offset(&mut self, val: u8) {
self.0 = (self.0 & !(0x1f << 5usize)) | (((val as u32) & 0x1f) << 5usize);
}
}
impl Default for Xosc32mtrim {
#[inline(always)]
fn default() -> Xosc32mtrim {
Xosc32mtrim(0)
}
}
impl core::fmt::Debug for Xosc32mtrim {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Xosc32mtrim")
.field("slope", &self.slope())
.field("offset", &self.offset())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Xosc32mtrim {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Xosc32mtrim {{ slope: {=u8:?}, offset: {=u8:?} }}",
self.slope(),
self.offset()
)
}
}
}
pub mod vals {
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Codepagesize(u32);
impl Codepagesize {
#[doc = "4 kByte."]
pub const K4096: Self = Self(0x1000);
}
impl Codepagesize {
pub const fn from_bits(val: u32) -> Codepagesize {
Self(val & 0xffff_ffff)
}
pub const fn to_bits(self) -> u32 {
self.0
}
}
impl core::fmt::Debug for Codepagesize {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x1000 => f.write_str("K4096"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Codepagesize {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x1000 => defmt::write!(f, "K4096"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u32> for Codepagesize {
#[inline(always)]
fn from(val: u32) -> Codepagesize {
Codepagesize::from_bits(val)
}
}
impl From<Codepagesize> for u32 {
#[inline(always)]
fn from(val: Codepagesize) -> u32 {
Codepagesize::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Codesize(u32);
impl Codesize {
#[doc = "256 pages."]
pub const P256: Self = Self(0x0100);
}
impl Codesize {
pub const fn from_bits(val: u32) -> Codesize {
Self(val & 0xffff_ffff)
}
pub const fn to_bits(self) -> u32 {
self.0
}
}
impl core::fmt::Debug for Codesize {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x0100 => f.write_str("P256"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Codesize {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x0100 => defmt::write!(f, "P256"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u32> for Codesize {
#[inline(always)]
fn from(val: u32) -> Codesize {
Codesize::from_bits(val)
}
}
impl From<Codesize> for u32 {
#[inline(always)]
fn from(val: Codesize) -> u32 {
Codesize::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Devicetype(u32);
impl Devicetype {
#[doc = "Device is an physical DIE."]
pub const Die: Self = Self(0x0);
#[doc = "Device is an FPGA."]
pub const Fpga: Self = Self(0xffff_ffff);
}
impl Devicetype {
pub const fn from_bits(val: u32) -> Devicetype {
Self(val & 0xffff_ffff)
}
pub const fn to_bits(self) -> u32 {
self.0
}
}
impl core::fmt::Debug for Devicetype {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x0 => f.write_str("Die"),
0xffff_ffff => f.write_str("Fpga"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Devicetype {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x0 => defmt::write!(f, "Die"),
0xffff_ffff => defmt::write!(f, "Fpga"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u32> for Devicetype {
#[inline(always)]
fn from(val: u32) -> Devicetype {
Devicetype::from_bits(val)
}
}
impl From<Devicetype> for u32 {
#[inline(always)]
fn from(val: Devicetype) -> u32 {
Devicetype::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Flash(u32);
impl Flash {
#[doc = "128 kByte FLASH."]
pub const K128: Self = Self(0x80);
#[doc = "256 kByte FLASH."]
pub const K256: Self = Self(0x0100);
#[doc = "512 kByte FLASH."]
pub const K512: Self = Self(0x0200);
#[doc = "1 MByte FLASH."]
pub const K1024: Self = Self(0x0400);
#[doc = "2 MByte FLASH."]
pub const K2048: Self = Self(0x0800);
#[doc = "Unspecified."]
pub const Unspecified: Self = Self(0xffff_ffff);
}
impl Flash {
pub const fn from_bits(val: u32) -> Flash {
Self(val & 0xffff_ffff)
}
pub const fn to_bits(self) -> u32 {
self.0
}
}
impl core::fmt::Debug for Flash {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x80 => f.write_str("K128"),
0x0100 => f.write_str("K256"),
0x0200 => f.write_str("K512"),
0x0400 => f.write_str("K1024"),
0x0800 => f.write_str("K2048"),
0xffff_ffff => f.write_str("Unspecified"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Flash {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x80 => defmt::write!(f, "K128"),
0x0100 => defmt::write!(f, "K256"),
0x0200 => defmt::write!(f, "K512"),
0x0400 => defmt::write!(f, "K1024"),
0x0800 => defmt::write!(f, "K2048"),
0xffff_ffff => defmt::write!(f, "Unspecified"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u32> for Flash {
#[inline(always)]
fn from(val: u32) -> Flash {
Flash::from_bits(val)
}
}
impl From<Flash> for u32 {
#[inline(always)]
fn from(val: Flash) -> u32 {
Flash::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Package(u32);
impl Package {
#[doc = "QKxx - 94-pin aQFN."]
pub const Qk: Self = Self(0x2000);
#[doc = "CLxx - WLCSP."]
pub const Cl: Self = Self(0x2005);
#[doc = "Unspecified."]
pub const Unspecified: Self = Self(0xffff_ffff);
}
impl Package {
pub const fn from_bits(val: u32) -> Package {
Self(val & 0xffff_ffff)
}
pub const fn to_bits(self) -> u32 {
self.0
}
}
impl core::fmt::Debug for Package {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x2000 => f.write_str("Qk"),
0x2005 => f.write_str("Cl"),
0xffff_ffff => f.write_str("Unspecified"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Package {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x2000 => defmt::write!(f, "Qk"),
0x2005 => defmt::write!(f, "Cl"),
0xffff_ffff => defmt::write!(f, "Unspecified"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u32> for Package {
#[inline(always)]
fn from(val: u32) -> Package {
Package::from_bits(val)
}
}
impl From<Package> for u32 {
#[inline(always)]
fn from(val: Package) -> u32 {
Package::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Part(u32);
impl Part {
#[doc = "nRF5340."]
pub const N5340: Self = Self(0x5340);
#[doc = "Unspecified."]
pub const Unspecified: Self = Self(0xffff_ffff);
}
impl Part {
pub const fn from_bits(val: u32) -> Part {
Self(val & 0xffff_ffff)
}
pub const fn to_bits(self) -> u32 {
self.0
}
}
impl core::fmt::Debug for Part {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x5340 => f.write_str("N5340"),
0xffff_ffff => f.write_str("Unspecified"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Part {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x5340 => defmt::write!(f, "N5340"),
0xffff_ffff => defmt::write!(f, "Unspecified"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u32> for Part {
#[inline(always)]
fn from(val: u32) -> Part {
Part::from_bits(val)
}
}
impl From<Part> for u32 {
#[inline(always)]
fn from(val: Part) -> u32 {
Part::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Ram(u32);
impl Ram {
#[doc = "16 kByte RAM."]
pub const K16: Self = Self(0x10);
#[doc = "32 kByte RAM."]
pub const K32: Self = Self(0x20);
#[doc = "64 kByte RAM."]
pub const K64: Self = Self(0x40);
#[doc = "128 kByte RAM."]
pub const K128: Self = Self(0x80);
#[doc = "256 kByte RAM."]
pub const K256: Self = Self(0x0100);
#[doc = "512 kByte RAM."]
pub const K512: Self = Self(0x0200);
#[doc = "Unspecified."]
pub const Unspecified: Self = Self(0xffff_ffff);
}
impl Ram {
pub const fn from_bits(val: u32) -> Ram {
Self(val & 0xffff_ffff)
}
pub const fn to_bits(self) -> u32 {
self.0
}
}
impl core::fmt::Debug for Ram {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x10 => f.write_str("K16"),
0x20 => f.write_str("K32"),
0x40 => f.write_str("K64"),
0x80 => f.write_str("K128"),
0x0100 => f.write_str("K256"),
0x0200 => f.write_str("K512"),
0xffff_ffff => f.write_str("Unspecified"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ram {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x10 => defmt::write!(f, "K16"),
0x20 => defmt::write!(f, "K32"),
0x40 => defmt::write!(f, "K64"),
0x80 => defmt::write!(f, "K128"),
0x0100 => defmt::write!(f, "K256"),
0x0200 => defmt::write!(f, "K512"),
0xffff_ffff => defmt::write!(f, "Unspecified"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u32> for Ram {
#[inline(always)]
fn from(val: u32) -> Ram {
Ram::from_bits(val)
}
}
impl From<Ram> for u32 {
#[inline(always)]
fn from(val: Ram) -> u32 {
Ram::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Variant(u32);
impl Variant {
#[doc = "CLAA."]
pub const Claa: Self = Self(0x434c_4141);
#[doc = "QKAA."]
pub const Qkaa: Self = Self(0x514b_4141);
#[doc = "Unspecified."]
pub const Unspecified: Self = Self(0xffff_ffff);
}
impl Variant {
pub const fn from_bits(val: u32) -> Variant {
Self(val & 0xffff_ffff)
}
pub const fn to_bits(self) -> u32 {
self.0
}
}
impl core::fmt::Debug for Variant {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x434c_4141 => f.write_str("Claa"),
0x514b_4141 => f.write_str("Qkaa"),
0xffff_ffff => f.write_str("Unspecified"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Variant {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x434c_4141 => defmt::write!(f, "Claa"),
0x514b_4141 => defmt::write!(f, "Qkaa"),
0xffff_ffff => defmt::write!(f, "Unspecified"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u32> for Variant {
#[inline(always)]
fn from(val: u32) -> Variant {
Variant::from_bits(val)
}
}
impl From<Variant> for u32 {
#[inline(always)]
fn from(val: Variant) -> u32 {
Variant::to_bits(val)
}
}
}
}
pub mod fpu {
#[doc = "FPU control peripheral 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Fpu {
ptr: *mut u8,
}
unsafe impl Send for Fpu {}
unsafe impl Sync for Fpu {}
impl Fpu {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "An FPUIOC exception triggered by an invalid operation has occurred in the FPU."]
#[inline(always)]
pub const fn events_invalidoperation(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0100usize) as _) }
}
#[doc = "An FPUDZC exception triggered by a floating-point divide-by-zero operation has occurred in the FPU."]
#[inline(always)]
pub const fn events_dividebyzero(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0104usize) as _) }
}
#[doc = "An FPUOFC exception triggered by a floating-point overflow has occurred in the FPU."]
#[inline(always)]
pub const fn events_overflow(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0108usize) as _) }
}
#[doc = "An FPUUFC exception triggered by a floating-point underflow has occurred in the FPU."]
#[inline(always)]
pub const fn events_underflow(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x010cusize) as _) }
}
#[doc = "An FPUIXC exception triggered by an inexact floating-point operation has occurred in the FPU."]
#[inline(always)]
pub const fn events_inexact(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0110usize) as _) }
}
#[doc = "An FPUIDC exception triggered by a denormal floating-point input has occurred in the FPU."]
#[inline(always)]
pub const fn events_denormalinput(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0114usize) as _) }
}
#[doc = "Enable or disable interrupt."]
#[inline(always)]
pub const fn inten(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0300usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
}
pub mod regs {
#[doc = "Enable or disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Enable or disable interrupt for event INVALIDOPERATION."]
#[must_use]
#[inline(always)]
pub const fn invalidoperation(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event INVALIDOPERATION."]
#[inline(always)]
pub const fn set_invalidoperation(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Enable or disable interrupt for event DIVIDEBYZERO."]
#[must_use]
#[inline(always)]
pub const fn dividebyzero(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event DIVIDEBYZERO."]
#[inline(always)]
pub const fn set_dividebyzero(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enable or disable interrupt for event OVERFLOW."]
#[must_use]
#[inline(always)]
pub const fn overflow(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event OVERFLOW."]
#[inline(always)]
pub const fn set_overflow(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Enable or disable interrupt for event UNDERFLOW."]
#[must_use]
#[inline(always)]
pub const fn underflow(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event UNDERFLOW."]
#[inline(always)]
pub const fn set_underflow(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Enable or disable interrupt for event INEXACT."]
#[must_use]
#[inline(always)]
pub const fn inexact(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event INEXACT."]
#[inline(always)]
pub const fn set_inexact(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Enable or disable interrupt for event DENORMALINPUT."]
#[must_use]
#[inline(always)]
pub const fn denormalinput(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event DENORMALINPUT."]
#[inline(always)]
pub const fn set_denormalinput(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("invalidoperation", &self.invalidoperation())
.field("dividebyzero", &self.dividebyzero())
.field("overflow", &self.overflow())
.field("underflow", &self.underflow())
.field("inexact", &self.inexact())
.field("denormalinput", &self.denormalinput())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Int {{ invalidoperation: {=bool:?}, dividebyzero: {=bool:?}, overflow: {=bool:?}, underflow: {=bool:?}, inexact: {=bool:?}, denormalinput: {=bool:?} }}" , self . invalidoperation () , self . dividebyzero () , self . overflow () , self . underflow () , self . inexact () , self . denormalinput ())
}
}
}
}
pub mod gpio {
#[doc = "GPIO Port 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Gpio {
ptr: *mut u8,
}
unsafe impl Send for Gpio {}
unsafe impl Sync for Gpio {}
impl Gpio {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Write GPIO port."]
#[inline(always)]
pub const fn out(self) -> crate::common::Reg<regs::Out, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Set individual bits in GPIO port."]
#[inline(always)]
pub const fn outset(self) -> crate::common::Reg<regs::Outset, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Clear individual bits in GPIO port."]
#[inline(always)]
pub const fn outclr(self) -> crate::common::Reg<regs::Outclr, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
#[doc = "Read GPIO port."]
#[inline(always)]
pub const fn in_(self) -> crate::common::Reg<regs::In, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
#[doc = "Direction of GPIO pins."]
#[inline(always)]
pub const fn dir(self) -> crate::common::Reg<regs::Dir, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x14usize) as _) }
}
#[doc = "DIR set register."]
#[inline(always)]
pub const fn dirset(self) -> crate::common::Reg<regs::Dirset, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x18usize) as _) }
}
#[doc = "DIR clear register."]
#[inline(always)]
pub const fn dirclr(self) -> crate::common::Reg<regs::Dirclr, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x1cusize) as _) }
}
#[doc = "Latch register indicating what GPIO pins that have met the criteria set in the PIN_CNF\\[n\\].SENSE registers."]
#[inline(always)]
pub const fn latch(self) -> crate::common::Reg<regs::Latch, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x20usize) as _) }
}
#[doc = "Select between default DETECT signal behavior and LDETECT mode."]
#[inline(always)]
pub const fn detectmode(self) -> crate::common::Reg<regs::Detectmode, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x24usize) as _) }
}
#[doc = "Select between default DETECT signal behavior and LDETECT mode."]
#[inline(always)]
pub const fn detectmode_sec(
self,
) -> crate::common::Reg<regs::DetectmodeSec, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x28usize) as _) }
}
#[doc = "Description collection: Configuration of GPIO pins."]
#[inline(always)]
pub const fn pin_cnf(
self,
n: usize,
) -> crate::common::Reg<regs::PinCnf, crate::common::RW> {
assert!(n < 32usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0200usize + n * 4usize) as _)
}
}
}
pub mod regs {
#[doc = "Select between default DETECT signal behavior and LDETECT mode."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Detectmode(pub u32);
impl Detectmode {
#[doc = "Select between default DETECT signal behavior and LDETECT mode."]
#[must_use]
#[inline(always)]
pub const fn detectmode(&self) -> super::vals::Detectmode {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Detectmode::from_bits(val as u8)
}
#[doc = "Select between default DETECT signal behavior and LDETECT mode."]
#[inline(always)]
pub const fn set_detectmode(&mut self, val: super::vals::Detectmode) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Detectmode {
#[inline(always)]
fn default() -> Detectmode {
Detectmode(0)
}
}
impl core::fmt::Debug for Detectmode {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Detectmode")
.field("detectmode", &self.detectmode())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Detectmode {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Detectmode {{ detectmode: {:?} }}", self.detectmode())
}
}
#[doc = "Select between default DETECT signal behavior and LDETECT mode."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DetectmodeSec(pub u32);
impl DetectmodeSec {
#[doc = "Select between default DETECT signal behavior and LDETECT mode."]
#[must_use]
#[inline(always)]
pub const fn detectmode(&self) -> super::vals::Detectmode {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Detectmode::from_bits(val as u8)
}
#[doc = "Select between default DETECT signal behavior and LDETECT mode."]
#[inline(always)]
pub const fn set_detectmode(&mut self, val: super::vals::Detectmode) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for DetectmodeSec {
#[inline(always)]
fn default() -> DetectmodeSec {
DetectmodeSec(0)
}
}
impl core::fmt::Debug for DetectmodeSec {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DetectmodeSec")
.field("detectmode", &self.detectmode())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for DetectmodeSec {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "DetectmodeSec {{ detectmode: {:?} }}", self.detectmode())
}
}
#[doc = "Direction of GPIO pins."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Dir(pub u32);
impl Dir {
#[doc = "Pin 0."]
#[must_use]
#[inline(always)]
pub const fn pin(&self, n: usize) -> super::vals::Dir {
assert!(n < 32usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
super::vals::Dir::from_bits(val as u8)
}
#[doc = "Pin 0."]
#[inline(always)]
pub const fn set_pin(&mut self, n: usize, val: super::vals::Dir) {
assert!(n < 32usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val.to_bits() as u32) & 0x01) << offs);
}
}
impl Default for Dir {
#[inline(always)]
fn default() -> Dir {
Dir(0)
}
}
impl core::fmt::Debug for Dir {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Dir")
.field("pin[0]", &self.pin(0usize))
.field("pin[1]", &self.pin(1usize))
.field("pin[2]", &self.pin(2usize))
.field("pin[3]", &self.pin(3usize))
.field("pin[4]", &self.pin(4usize))
.field("pin[5]", &self.pin(5usize))
.field("pin[6]", &self.pin(6usize))
.field("pin[7]", &self.pin(7usize))
.field("pin[8]", &self.pin(8usize))
.field("pin[9]", &self.pin(9usize))
.field("pin[10]", &self.pin(10usize))
.field("pin[11]", &self.pin(11usize))
.field("pin[12]", &self.pin(12usize))
.field("pin[13]", &self.pin(13usize))
.field("pin[14]", &self.pin(14usize))
.field("pin[15]", &self.pin(15usize))
.field("pin[16]", &self.pin(16usize))
.field("pin[17]", &self.pin(17usize))
.field("pin[18]", &self.pin(18usize))
.field("pin[19]", &self.pin(19usize))
.field("pin[20]", &self.pin(20usize))
.field("pin[21]", &self.pin(21usize))
.field("pin[22]", &self.pin(22usize))
.field("pin[23]", &self.pin(23usize))
.field("pin[24]", &self.pin(24usize))
.field("pin[25]", &self.pin(25usize))
.field("pin[26]", &self.pin(26usize))
.field("pin[27]", &self.pin(27usize))
.field("pin[28]", &self.pin(28usize))
.field("pin[29]", &self.pin(29usize))
.field("pin[30]", &self.pin(30usize))
.field("pin[31]", &self.pin(31usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Dir {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Dir {{ pin[0]: {:?}, pin[1]: {:?}, pin[2]: {:?}, pin[3]: {:?}, pin[4]: {:?}, pin[5]: {:?}, pin[6]: {:?}, pin[7]: {:?}, pin[8]: {:?}, pin[9]: {:?}, pin[10]: {:?}, pin[11]: {:?}, pin[12]: {:?}, pin[13]: {:?}, pin[14]: {:?}, pin[15]: {:?}, pin[16]: {:?}, pin[17]: {:?}, pin[18]: {:?}, pin[19]: {:?}, pin[20]: {:?}, pin[21]: {:?}, pin[22]: {:?}, pin[23]: {:?}, pin[24]: {:?}, pin[25]: {:?}, pin[26]: {:?}, pin[27]: {:?}, pin[28]: {:?}, pin[29]: {:?}, pin[30]: {:?}, pin[31]: {:?} }}" , self . pin (0usize) , self . pin (1usize) , self . pin (2usize) , self . pin (3usize) , self . pin (4usize) , self . pin (5usize) , self . pin (6usize) , self . pin (7usize) , self . pin (8usize) , self . pin (9usize) , self . pin (10usize) , self . pin (11usize) , self . pin (12usize) , self . pin (13usize) , self . pin (14usize) , self . pin (15usize) , self . pin (16usize) , self . pin (17usize) , self . pin (18usize) , self . pin (19usize) , self . pin (20usize) , self . pin (21usize) , self . pin (22usize) , self . pin (23usize) , self . pin (24usize) , self . pin (25usize) , self . pin (26usize) , self . pin (27usize) , self . pin (28usize) , self . pin (29usize) , self . pin (30usize) , self . pin (31usize))
}
}
#[doc = "DIR clear register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Dirclr(pub u32);
impl Dirclr {
#[doc = "Set as input pin 0."]
#[must_use]
#[inline(always)]
pub const fn pin(&self, n: usize) -> bool {
assert!(n < 32usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Set as input pin 0."]
#[inline(always)]
pub const fn set_pin(&mut self, n: usize, val: bool) {
assert!(n < 32usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Dirclr {
#[inline(always)]
fn default() -> Dirclr {
Dirclr(0)
}
}
impl core::fmt::Debug for Dirclr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Dirclr")
.field("pin[0]", &self.pin(0usize))
.field("pin[1]", &self.pin(1usize))
.field("pin[2]", &self.pin(2usize))
.field("pin[3]", &self.pin(3usize))
.field("pin[4]", &self.pin(4usize))
.field("pin[5]", &self.pin(5usize))
.field("pin[6]", &self.pin(6usize))
.field("pin[7]", &self.pin(7usize))
.field("pin[8]", &self.pin(8usize))
.field("pin[9]", &self.pin(9usize))
.field("pin[10]", &self.pin(10usize))
.field("pin[11]", &self.pin(11usize))
.field("pin[12]", &self.pin(12usize))
.field("pin[13]", &self.pin(13usize))
.field("pin[14]", &self.pin(14usize))
.field("pin[15]", &self.pin(15usize))
.field("pin[16]", &self.pin(16usize))
.field("pin[17]", &self.pin(17usize))
.field("pin[18]", &self.pin(18usize))
.field("pin[19]", &self.pin(19usize))
.field("pin[20]", &self.pin(20usize))
.field("pin[21]", &self.pin(21usize))
.field("pin[22]", &self.pin(22usize))
.field("pin[23]", &self.pin(23usize))
.field("pin[24]", &self.pin(24usize))
.field("pin[25]", &self.pin(25usize))
.field("pin[26]", &self.pin(26usize))
.field("pin[27]", &self.pin(27usize))
.field("pin[28]", &self.pin(28usize))
.field("pin[29]", &self.pin(29usize))
.field("pin[30]", &self.pin(30usize))
.field("pin[31]", &self.pin(31usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Dirclr {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Dirclr {{ pin[0]: {=bool:?}, pin[1]: {=bool:?}, pin[2]: {=bool:?}, pin[3]: {=bool:?}, pin[4]: {=bool:?}, pin[5]: {=bool:?}, pin[6]: {=bool:?}, pin[7]: {=bool:?}, pin[8]: {=bool:?}, pin[9]: {=bool:?}, pin[10]: {=bool:?}, pin[11]: {=bool:?}, pin[12]: {=bool:?}, pin[13]: {=bool:?}, pin[14]: {=bool:?}, pin[15]: {=bool:?}, pin[16]: {=bool:?}, pin[17]: {=bool:?}, pin[18]: {=bool:?}, pin[19]: {=bool:?}, pin[20]: {=bool:?}, pin[21]: {=bool:?}, pin[22]: {=bool:?}, pin[23]: {=bool:?}, pin[24]: {=bool:?}, pin[25]: {=bool:?}, pin[26]: {=bool:?}, pin[27]: {=bool:?}, pin[28]: {=bool:?}, pin[29]: {=bool:?}, pin[30]: {=bool:?}, pin[31]: {=bool:?} }}" , self . pin (0usize) , self . pin (1usize) , self . pin (2usize) , self . pin (3usize) , self . pin (4usize) , self . pin (5usize) , self . pin (6usize) , self . pin (7usize) , self . pin (8usize) , self . pin (9usize) , self . pin (10usize) , self . pin (11usize) , self . pin (12usize) , self . pin (13usize) , self . pin (14usize) , self . pin (15usize) , self . pin (16usize) , self . pin (17usize) , self . pin (18usize) , self . pin (19usize) , self . pin (20usize) , self . pin (21usize) , self . pin (22usize) , self . pin (23usize) , self . pin (24usize) , self . pin (25usize) , self . pin (26usize) , self . pin (27usize) , self . pin (28usize) , self . pin (29usize) , self . pin (30usize) , self . pin (31usize))
}
}
#[doc = "DIR set register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Dirset(pub u32);
impl Dirset {
#[doc = "Set as output pin 0."]
#[must_use]
#[inline(always)]
pub const fn pin(&self, n: usize) -> bool {
assert!(n < 32usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Set as output pin 0."]
#[inline(always)]
pub const fn set_pin(&mut self, n: usize, val: bool) {
assert!(n < 32usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Dirset {
#[inline(always)]
fn default() -> Dirset {
Dirset(0)
}
}
impl core::fmt::Debug for Dirset {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Dirset")
.field("pin[0]", &self.pin(0usize))
.field("pin[1]", &self.pin(1usize))
.field("pin[2]", &self.pin(2usize))
.field("pin[3]", &self.pin(3usize))
.field("pin[4]", &self.pin(4usize))
.field("pin[5]", &self.pin(5usize))
.field("pin[6]", &self.pin(6usize))
.field("pin[7]", &self.pin(7usize))
.field("pin[8]", &self.pin(8usize))
.field("pin[9]", &self.pin(9usize))
.field("pin[10]", &self.pin(10usize))
.field("pin[11]", &self.pin(11usize))
.field("pin[12]", &self.pin(12usize))
.field("pin[13]", &self.pin(13usize))
.field("pin[14]", &self.pin(14usize))
.field("pin[15]", &self.pin(15usize))
.field("pin[16]", &self.pin(16usize))
.field("pin[17]", &self.pin(17usize))
.field("pin[18]", &self.pin(18usize))
.field("pin[19]", &self.pin(19usize))
.field("pin[20]", &self.pin(20usize))
.field("pin[21]", &self.pin(21usize))
.field("pin[22]", &self.pin(22usize))
.field("pin[23]", &self.pin(23usize))
.field("pin[24]", &self.pin(24usize))
.field("pin[25]", &self.pin(25usize))
.field("pin[26]", &self.pin(26usize))
.field("pin[27]", &self.pin(27usize))
.field("pin[28]", &self.pin(28usize))
.field("pin[29]", &self.pin(29usize))
.field("pin[30]", &self.pin(30usize))
.field("pin[31]", &self.pin(31usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Dirset {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Dirset {{ pin[0]: {=bool:?}, pin[1]: {=bool:?}, pin[2]: {=bool:?}, pin[3]: {=bool:?}, pin[4]: {=bool:?}, pin[5]: {=bool:?}, pin[6]: {=bool:?}, pin[7]: {=bool:?}, pin[8]: {=bool:?}, pin[9]: {=bool:?}, pin[10]: {=bool:?}, pin[11]: {=bool:?}, pin[12]: {=bool:?}, pin[13]: {=bool:?}, pin[14]: {=bool:?}, pin[15]: {=bool:?}, pin[16]: {=bool:?}, pin[17]: {=bool:?}, pin[18]: {=bool:?}, pin[19]: {=bool:?}, pin[20]: {=bool:?}, pin[21]: {=bool:?}, pin[22]: {=bool:?}, pin[23]: {=bool:?}, pin[24]: {=bool:?}, pin[25]: {=bool:?}, pin[26]: {=bool:?}, pin[27]: {=bool:?}, pin[28]: {=bool:?}, pin[29]: {=bool:?}, pin[30]: {=bool:?}, pin[31]: {=bool:?} }}" , self . pin (0usize) , self . pin (1usize) , self . pin (2usize) , self . pin (3usize) , self . pin (4usize) , self . pin (5usize) , self . pin (6usize) , self . pin (7usize) , self . pin (8usize) , self . pin (9usize) , self . pin (10usize) , self . pin (11usize) , self . pin (12usize) , self . pin (13usize) , self . pin (14usize) , self . pin (15usize) , self . pin (16usize) , self . pin (17usize) , self . pin (18usize) , self . pin (19usize) , self . pin (20usize) , self . pin (21usize) , self . pin (22usize) , self . pin (23usize) , self . pin (24usize) , self . pin (25usize) , self . pin (26usize) , self . pin (27usize) , self . pin (28usize) , self . pin (29usize) , self . pin (30usize) , self . pin (31usize))
}
}
#[doc = "Read GPIO port."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct In(pub u32);
impl In {
#[doc = "Pin 0."]
#[must_use]
#[inline(always)]
pub const fn pin(&self, n: usize) -> bool {
assert!(n < 32usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Pin 0."]
#[inline(always)]
pub const fn set_pin(&mut self, n: usize, val: bool) {
assert!(n < 32usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for In {
#[inline(always)]
fn default() -> In {
In(0)
}
}
impl core::fmt::Debug for In {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("In")
.field("pin[0]", &self.pin(0usize))
.field("pin[1]", &self.pin(1usize))
.field("pin[2]", &self.pin(2usize))
.field("pin[3]", &self.pin(3usize))
.field("pin[4]", &self.pin(4usize))
.field("pin[5]", &self.pin(5usize))
.field("pin[6]", &self.pin(6usize))
.field("pin[7]", &self.pin(7usize))
.field("pin[8]", &self.pin(8usize))
.field("pin[9]", &self.pin(9usize))
.field("pin[10]", &self.pin(10usize))
.field("pin[11]", &self.pin(11usize))
.field("pin[12]", &self.pin(12usize))
.field("pin[13]", &self.pin(13usize))
.field("pin[14]", &self.pin(14usize))
.field("pin[15]", &self.pin(15usize))
.field("pin[16]", &self.pin(16usize))
.field("pin[17]", &self.pin(17usize))
.field("pin[18]", &self.pin(18usize))
.field("pin[19]", &self.pin(19usize))
.field("pin[20]", &self.pin(20usize))
.field("pin[21]", &self.pin(21usize))
.field("pin[22]", &self.pin(22usize))
.field("pin[23]", &self.pin(23usize))
.field("pin[24]", &self.pin(24usize))
.field("pin[25]", &self.pin(25usize))
.field("pin[26]", &self.pin(26usize))
.field("pin[27]", &self.pin(27usize))
.field("pin[28]", &self.pin(28usize))
.field("pin[29]", &self.pin(29usize))
.field("pin[30]", &self.pin(30usize))
.field("pin[31]", &self.pin(31usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for In {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "In {{ pin[0]: {=bool:?}, pin[1]: {=bool:?}, pin[2]: {=bool:?}, pin[3]: {=bool:?}, pin[4]: {=bool:?}, pin[5]: {=bool:?}, pin[6]: {=bool:?}, pin[7]: {=bool:?}, pin[8]: {=bool:?}, pin[9]: {=bool:?}, pin[10]: {=bool:?}, pin[11]: {=bool:?}, pin[12]: {=bool:?}, pin[13]: {=bool:?}, pin[14]: {=bool:?}, pin[15]: {=bool:?}, pin[16]: {=bool:?}, pin[17]: {=bool:?}, pin[18]: {=bool:?}, pin[19]: {=bool:?}, pin[20]: {=bool:?}, pin[21]: {=bool:?}, pin[22]: {=bool:?}, pin[23]: {=bool:?}, pin[24]: {=bool:?}, pin[25]: {=bool:?}, pin[26]: {=bool:?}, pin[27]: {=bool:?}, pin[28]: {=bool:?}, pin[29]: {=bool:?}, pin[30]: {=bool:?}, pin[31]: {=bool:?} }}" , self . pin (0usize) , self . pin (1usize) , self . pin (2usize) , self . pin (3usize) , self . pin (4usize) , self . pin (5usize) , self . pin (6usize) , self . pin (7usize) , self . pin (8usize) , self . pin (9usize) , self . pin (10usize) , self . pin (11usize) , self . pin (12usize) , self . pin (13usize) , self . pin (14usize) , self . pin (15usize) , self . pin (16usize) , self . pin (17usize) , self . pin (18usize) , self . pin (19usize) , self . pin (20usize) , self . pin (21usize) , self . pin (22usize) , self . pin (23usize) , self . pin (24usize) , self . pin (25usize) , self . pin (26usize) , self . pin (27usize) , self . pin (28usize) , self . pin (29usize) , self . pin (30usize) , self . pin (31usize))
}
}
#[doc = "Latch register indicating what GPIO pins that have met the criteria set in the PIN_CNF\\[n\\].SENSE registers."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Latch(pub u32);
impl Latch {
#[doc = "Status on whether PIN\\[0\\] has met criteria set in PIN_CNF\\[0\\].SENSE register. Write '1' to clear."]
#[must_use]
#[inline(always)]
pub const fn pin(&self, n: usize) -> bool {
assert!(n < 32usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Status on whether PIN\\[0\\] has met criteria set in PIN_CNF\\[0\\].SENSE register. Write '1' to clear."]
#[inline(always)]
pub const fn set_pin(&mut self, n: usize, val: bool) {
assert!(n < 32usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Latch {
#[inline(always)]
fn default() -> Latch {
Latch(0)
}
}
impl core::fmt::Debug for Latch {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Latch")
.field("pin[0]", &self.pin(0usize))
.field("pin[1]", &self.pin(1usize))
.field("pin[2]", &self.pin(2usize))
.field("pin[3]", &self.pin(3usize))
.field("pin[4]", &self.pin(4usize))
.field("pin[5]", &self.pin(5usize))
.field("pin[6]", &self.pin(6usize))
.field("pin[7]", &self.pin(7usize))
.field("pin[8]", &self.pin(8usize))
.field("pin[9]", &self.pin(9usize))
.field("pin[10]", &self.pin(10usize))
.field("pin[11]", &self.pin(11usize))
.field("pin[12]", &self.pin(12usize))
.field("pin[13]", &self.pin(13usize))
.field("pin[14]", &self.pin(14usize))
.field("pin[15]", &self.pin(15usize))
.field("pin[16]", &self.pin(16usize))
.field("pin[17]", &self.pin(17usize))
.field("pin[18]", &self.pin(18usize))
.field("pin[19]", &self.pin(19usize))
.field("pin[20]", &self.pin(20usize))
.field("pin[21]", &self.pin(21usize))
.field("pin[22]", &self.pin(22usize))
.field("pin[23]", &self.pin(23usize))
.field("pin[24]", &self.pin(24usize))
.field("pin[25]", &self.pin(25usize))
.field("pin[26]", &self.pin(26usize))
.field("pin[27]", &self.pin(27usize))
.field("pin[28]", &self.pin(28usize))
.field("pin[29]", &self.pin(29usize))
.field("pin[30]", &self.pin(30usize))
.field("pin[31]", &self.pin(31usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Latch {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Latch {{ pin[0]: {=bool:?}, pin[1]: {=bool:?}, pin[2]: {=bool:?}, pin[3]: {=bool:?}, pin[4]: {=bool:?}, pin[5]: {=bool:?}, pin[6]: {=bool:?}, pin[7]: {=bool:?}, pin[8]: {=bool:?}, pin[9]: {=bool:?}, pin[10]: {=bool:?}, pin[11]: {=bool:?}, pin[12]: {=bool:?}, pin[13]: {=bool:?}, pin[14]: {=bool:?}, pin[15]: {=bool:?}, pin[16]: {=bool:?}, pin[17]: {=bool:?}, pin[18]: {=bool:?}, pin[19]: {=bool:?}, pin[20]: {=bool:?}, pin[21]: {=bool:?}, pin[22]: {=bool:?}, pin[23]: {=bool:?}, pin[24]: {=bool:?}, pin[25]: {=bool:?}, pin[26]: {=bool:?}, pin[27]: {=bool:?}, pin[28]: {=bool:?}, pin[29]: {=bool:?}, pin[30]: {=bool:?}, pin[31]: {=bool:?} }}" , self . pin (0usize) , self . pin (1usize) , self . pin (2usize) , self . pin (3usize) , self . pin (4usize) , self . pin (5usize) , self . pin (6usize) , self . pin (7usize) , self . pin (8usize) , self . pin (9usize) , self . pin (10usize) , self . pin (11usize) , self . pin (12usize) , self . pin (13usize) , self . pin (14usize) , self . pin (15usize) , self . pin (16usize) , self . pin (17usize) , self . pin (18usize) , self . pin (19usize) , self . pin (20usize) , self . pin (21usize) , self . pin (22usize) , self . pin (23usize) , self . pin (24usize) , self . pin (25usize) , self . pin (26usize) , self . pin (27usize) , self . pin (28usize) , self . pin (29usize) , self . pin (30usize) , self . pin (31usize))
}
}
#[doc = "Write GPIO port."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Out(pub u32);
impl Out {
#[doc = "Pin 0."]
#[must_use]
#[inline(always)]
pub const fn pin(&self, n: usize) -> bool {
assert!(n < 32usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Pin 0."]
#[inline(always)]
pub const fn set_pin(&mut self, n: usize, val: bool) {
assert!(n < 32usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Out {
#[inline(always)]
fn default() -> Out {
Out(0)
}
}
impl core::fmt::Debug for Out {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Out")
.field("pin[0]", &self.pin(0usize))
.field("pin[1]", &self.pin(1usize))
.field("pin[2]", &self.pin(2usize))
.field("pin[3]", &self.pin(3usize))
.field("pin[4]", &self.pin(4usize))
.field("pin[5]", &self.pin(5usize))
.field("pin[6]", &self.pin(6usize))
.field("pin[7]", &self.pin(7usize))
.field("pin[8]", &self.pin(8usize))
.field("pin[9]", &self.pin(9usize))
.field("pin[10]", &self.pin(10usize))
.field("pin[11]", &self.pin(11usize))
.field("pin[12]", &self.pin(12usize))
.field("pin[13]", &self.pin(13usize))
.field("pin[14]", &self.pin(14usize))
.field("pin[15]", &self.pin(15usize))
.field("pin[16]", &self.pin(16usize))
.field("pin[17]", &self.pin(17usize))
.field("pin[18]", &self.pin(18usize))
.field("pin[19]", &self.pin(19usize))
.field("pin[20]", &self.pin(20usize))
.field("pin[21]", &self.pin(21usize))
.field("pin[22]", &self.pin(22usize))
.field("pin[23]", &self.pin(23usize))
.field("pin[24]", &self.pin(24usize))
.field("pin[25]", &self.pin(25usize))
.field("pin[26]", &self.pin(26usize))
.field("pin[27]", &self.pin(27usize))
.field("pin[28]", &self.pin(28usize))
.field("pin[29]", &self.pin(29usize))
.field("pin[30]", &self.pin(30usize))
.field("pin[31]", &self.pin(31usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Out {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Out {{ pin[0]: {=bool:?}, pin[1]: {=bool:?}, pin[2]: {=bool:?}, pin[3]: {=bool:?}, pin[4]: {=bool:?}, pin[5]: {=bool:?}, pin[6]: {=bool:?}, pin[7]: {=bool:?}, pin[8]: {=bool:?}, pin[9]: {=bool:?}, pin[10]: {=bool:?}, pin[11]: {=bool:?}, pin[12]: {=bool:?}, pin[13]: {=bool:?}, pin[14]: {=bool:?}, pin[15]: {=bool:?}, pin[16]: {=bool:?}, pin[17]: {=bool:?}, pin[18]: {=bool:?}, pin[19]: {=bool:?}, pin[20]: {=bool:?}, pin[21]: {=bool:?}, pin[22]: {=bool:?}, pin[23]: {=bool:?}, pin[24]: {=bool:?}, pin[25]: {=bool:?}, pin[26]: {=bool:?}, pin[27]: {=bool:?}, pin[28]: {=bool:?}, pin[29]: {=bool:?}, pin[30]: {=bool:?}, pin[31]: {=bool:?} }}" , self . pin (0usize) , self . pin (1usize) , self . pin (2usize) , self . pin (3usize) , self . pin (4usize) , self . pin (5usize) , self . pin (6usize) , self . pin (7usize) , self . pin (8usize) , self . pin (9usize) , self . pin (10usize) , self . pin (11usize) , self . pin (12usize) , self . pin (13usize) , self . pin (14usize) , self . pin (15usize) , self . pin (16usize) , self . pin (17usize) , self . pin (18usize) , self . pin (19usize) , self . pin (20usize) , self . pin (21usize) , self . pin (22usize) , self . pin (23usize) , self . pin (24usize) , self . pin (25usize) , self . pin (26usize) , self . pin (27usize) , self . pin (28usize) , self . pin (29usize) , self . pin (30usize) , self . pin (31usize))
}
}
#[doc = "Clear individual bits in GPIO port."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Outclr(pub u32);
impl Outclr {
#[doc = "Pin 0."]
#[must_use]
#[inline(always)]
pub const fn pin(&self, n: usize) -> bool {
assert!(n < 32usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Pin 0."]
#[inline(always)]
pub const fn set_pin(&mut self, n: usize, val: bool) {
assert!(n < 32usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Outclr {
#[inline(always)]
fn default() -> Outclr {
Outclr(0)
}
}
impl core::fmt::Debug for Outclr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Outclr")
.field("pin[0]", &self.pin(0usize))
.field("pin[1]", &self.pin(1usize))
.field("pin[2]", &self.pin(2usize))
.field("pin[3]", &self.pin(3usize))
.field("pin[4]", &self.pin(4usize))
.field("pin[5]", &self.pin(5usize))
.field("pin[6]", &self.pin(6usize))
.field("pin[7]", &self.pin(7usize))
.field("pin[8]", &self.pin(8usize))
.field("pin[9]", &self.pin(9usize))
.field("pin[10]", &self.pin(10usize))
.field("pin[11]", &self.pin(11usize))
.field("pin[12]", &self.pin(12usize))
.field("pin[13]", &self.pin(13usize))
.field("pin[14]", &self.pin(14usize))
.field("pin[15]", &self.pin(15usize))
.field("pin[16]", &self.pin(16usize))
.field("pin[17]", &self.pin(17usize))
.field("pin[18]", &self.pin(18usize))
.field("pin[19]", &self.pin(19usize))
.field("pin[20]", &self.pin(20usize))
.field("pin[21]", &self.pin(21usize))
.field("pin[22]", &self.pin(22usize))
.field("pin[23]", &self.pin(23usize))
.field("pin[24]", &self.pin(24usize))
.field("pin[25]", &self.pin(25usize))
.field("pin[26]", &self.pin(26usize))
.field("pin[27]", &self.pin(27usize))
.field("pin[28]", &self.pin(28usize))
.field("pin[29]", &self.pin(29usize))
.field("pin[30]", &self.pin(30usize))
.field("pin[31]", &self.pin(31usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Outclr {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Outclr {{ pin[0]: {=bool:?}, pin[1]: {=bool:?}, pin[2]: {=bool:?}, pin[3]: {=bool:?}, pin[4]: {=bool:?}, pin[5]: {=bool:?}, pin[6]: {=bool:?}, pin[7]: {=bool:?}, pin[8]: {=bool:?}, pin[9]: {=bool:?}, pin[10]: {=bool:?}, pin[11]: {=bool:?}, pin[12]: {=bool:?}, pin[13]: {=bool:?}, pin[14]: {=bool:?}, pin[15]: {=bool:?}, pin[16]: {=bool:?}, pin[17]: {=bool:?}, pin[18]: {=bool:?}, pin[19]: {=bool:?}, pin[20]: {=bool:?}, pin[21]: {=bool:?}, pin[22]: {=bool:?}, pin[23]: {=bool:?}, pin[24]: {=bool:?}, pin[25]: {=bool:?}, pin[26]: {=bool:?}, pin[27]: {=bool:?}, pin[28]: {=bool:?}, pin[29]: {=bool:?}, pin[30]: {=bool:?}, pin[31]: {=bool:?} }}" , self . pin (0usize) , self . pin (1usize) , self . pin (2usize) , self . pin (3usize) , self . pin (4usize) , self . pin (5usize) , self . pin (6usize) , self . pin (7usize) , self . pin (8usize) , self . pin (9usize) , self . pin (10usize) , self . pin (11usize) , self . pin (12usize) , self . pin (13usize) , self . pin (14usize) , self . pin (15usize) , self . pin (16usize) , self . pin (17usize) , self . pin (18usize) , self . pin (19usize) , self . pin (20usize) , self . pin (21usize) , self . pin (22usize) , self . pin (23usize) , self . pin (24usize) , self . pin (25usize) , self . pin (26usize) , self . pin (27usize) , self . pin (28usize) , self . pin (29usize) , self . pin (30usize) , self . pin (31usize))
}
}
#[doc = "Set individual bits in GPIO port."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Outset(pub u32);
impl Outset {
#[doc = "Pin 0."]
#[must_use]
#[inline(always)]
pub const fn pin(&self, n: usize) -> bool {
assert!(n < 32usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Pin 0."]
#[inline(always)]
pub const fn set_pin(&mut self, n: usize, val: bool) {
assert!(n < 32usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Outset {
#[inline(always)]
fn default() -> Outset {
Outset(0)
}
}
impl core::fmt::Debug for Outset {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Outset")
.field("pin[0]", &self.pin(0usize))
.field("pin[1]", &self.pin(1usize))
.field("pin[2]", &self.pin(2usize))
.field("pin[3]", &self.pin(3usize))
.field("pin[4]", &self.pin(4usize))
.field("pin[5]", &self.pin(5usize))
.field("pin[6]", &self.pin(6usize))
.field("pin[7]", &self.pin(7usize))
.field("pin[8]", &self.pin(8usize))
.field("pin[9]", &self.pin(9usize))
.field("pin[10]", &self.pin(10usize))
.field("pin[11]", &self.pin(11usize))
.field("pin[12]", &self.pin(12usize))
.field("pin[13]", &self.pin(13usize))
.field("pin[14]", &self.pin(14usize))
.field("pin[15]", &self.pin(15usize))
.field("pin[16]", &self.pin(16usize))
.field("pin[17]", &self.pin(17usize))
.field("pin[18]", &self.pin(18usize))
.field("pin[19]", &self.pin(19usize))
.field("pin[20]", &self.pin(20usize))
.field("pin[21]", &self.pin(21usize))
.field("pin[22]", &self.pin(22usize))
.field("pin[23]", &self.pin(23usize))
.field("pin[24]", &self.pin(24usize))
.field("pin[25]", &self.pin(25usize))
.field("pin[26]", &self.pin(26usize))
.field("pin[27]", &self.pin(27usize))
.field("pin[28]", &self.pin(28usize))
.field("pin[29]", &self.pin(29usize))
.field("pin[30]", &self.pin(30usize))
.field("pin[31]", &self.pin(31usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Outset {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Outset {{ pin[0]: {=bool:?}, pin[1]: {=bool:?}, pin[2]: {=bool:?}, pin[3]: {=bool:?}, pin[4]: {=bool:?}, pin[5]: {=bool:?}, pin[6]: {=bool:?}, pin[7]: {=bool:?}, pin[8]: {=bool:?}, pin[9]: {=bool:?}, pin[10]: {=bool:?}, pin[11]: {=bool:?}, pin[12]: {=bool:?}, pin[13]: {=bool:?}, pin[14]: {=bool:?}, pin[15]: {=bool:?}, pin[16]: {=bool:?}, pin[17]: {=bool:?}, pin[18]: {=bool:?}, pin[19]: {=bool:?}, pin[20]: {=bool:?}, pin[21]: {=bool:?}, pin[22]: {=bool:?}, pin[23]: {=bool:?}, pin[24]: {=bool:?}, pin[25]: {=bool:?}, pin[26]: {=bool:?}, pin[27]: {=bool:?}, pin[28]: {=bool:?}, pin[29]: {=bool:?}, pin[30]: {=bool:?}, pin[31]: {=bool:?} }}" , self . pin (0usize) , self . pin (1usize) , self . pin (2usize) , self . pin (3usize) , self . pin (4usize) , self . pin (5usize) , self . pin (6usize) , self . pin (7usize) , self . pin (8usize) , self . pin (9usize) , self . pin (10usize) , self . pin (11usize) , self . pin (12usize) , self . pin (13usize) , self . pin (14usize) , self . pin (15usize) , self . pin (16usize) , self . pin (17usize) , self . pin (18usize) , self . pin (19usize) , self . pin (20usize) , self . pin (21usize) , self . pin (22usize) , self . pin (23usize) , self . pin (24usize) , self . pin (25usize) , self . pin (26usize) , self . pin (27usize) , self . pin (28usize) , self . pin (29usize) , self . pin (30usize) , self . pin (31usize))
}
}
#[doc = "Description collection: Configuration of GPIO pins."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct PinCnf(pub u32);
impl PinCnf {
#[doc = "Pin direction. Same physical register as DIR register."]
#[must_use]
#[inline(always)]
pub const fn dir(&self) -> super::vals::Dir {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Dir::from_bits(val as u8)
}
#[doc = "Pin direction. Same physical register as DIR register."]
#[inline(always)]
pub const fn set_dir(&mut self, val: super::vals::Dir) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "Connect or disconnect input buffer."]
#[must_use]
#[inline(always)]
pub const fn input(&self) -> super::vals::Input {
let val = (self.0 >> 1usize) & 0x01;
super::vals::Input::from_bits(val as u8)
}
#[doc = "Connect or disconnect input buffer."]
#[inline(always)]
pub const fn set_input(&mut self, val: super::vals::Input) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val.to_bits() as u32) & 0x01) << 1usize);
}
#[doc = "Pull configuration."]
#[must_use]
#[inline(always)]
pub const fn pull(&self) -> super::vals::Pull {
let val = (self.0 >> 2usize) & 0x03;
super::vals::Pull::from_bits(val as u8)
}
#[doc = "Pull configuration."]
#[inline(always)]
pub const fn set_pull(&mut self, val: super::vals::Pull) {
self.0 = (self.0 & !(0x03 << 2usize)) | (((val.to_bits() as u32) & 0x03) << 2usize);
}
#[doc = "Drive configuration."]
#[must_use]
#[inline(always)]
pub const fn drive(&self) -> super::vals::Drive {
let val = (self.0 >> 8usize) & 0x0f;
super::vals::Drive::from_bits(val as u8)
}
#[doc = "Drive configuration."]
#[inline(always)]
pub const fn set_drive(&mut self, val: super::vals::Drive) {
self.0 = (self.0 & !(0x0f << 8usize)) | (((val.to_bits() as u32) & 0x0f) << 8usize);
}
#[doc = "Pin sensing mechanism."]
#[must_use]
#[inline(always)]
pub const fn sense(&self) -> super::vals::Sense {
let val = (self.0 >> 16usize) & 0x03;
super::vals::Sense::from_bits(val as u8)
}
#[doc = "Pin sensing mechanism."]
#[inline(always)]
pub const fn set_sense(&mut self, val: super::vals::Sense) {
self.0 =
(self.0 & !(0x03 << 16usize)) | (((val.to_bits() as u32) & 0x03) << 16usize);
}
#[doc = "Select which MCU/Subsystem controls this pin Note: this field is only accessible from secure code."]
#[must_use]
#[inline(always)]
pub const fn mcusel(&self) -> super::vals::Mcusel {
let val = (self.0 >> 28usize) & 0x07;
super::vals::Mcusel::from_bits(val as u8)
}
#[doc = "Select which MCU/Subsystem controls this pin Note: this field is only accessible from secure code."]
#[inline(always)]
pub const fn set_mcusel(&mut self, val: super::vals::Mcusel) {
self.0 =
(self.0 & !(0x07 << 28usize)) | (((val.to_bits() as u32) & 0x07) << 28usize);
}
}
impl Default for PinCnf {
#[inline(always)]
fn default() -> PinCnf {
PinCnf(0)
}
}
impl core::fmt::Debug for PinCnf {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("PinCnf")
.field("dir", &self.dir())
.field("input", &self.input())
.field("pull", &self.pull())
.field("drive", &self.drive())
.field("sense", &self.sense())
.field("mcusel", &self.mcusel())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for PinCnf {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "PinCnf {{ dir: {:?}, input: {:?}, pull: {:?}, drive: {:?}, sense: {:?}, mcusel: {:?} }}" , self . dir () , self . input () , self . pull () , self . drive () , self . sense () , self . mcusel ())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Detectmode {
#[doc = "DETECT directly connected to PIN DETECT signals."]
Default = 0x0,
#[doc = "Use the latched LDETECT behavior."]
Ldetect = 0x01,
}
impl Detectmode {
#[inline(always)]
pub const fn from_bits(val: u8) -> Detectmode {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Detectmode {
#[inline(always)]
fn from(val: u8) -> Detectmode {
Detectmode::from_bits(val)
}
}
impl From<Detectmode> for u8 {
#[inline(always)]
fn from(val: Detectmode) -> u8 {
Detectmode::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Dir {
#[doc = "Configure pin as an input pin."]
Input = 0x0,
#[doc = "Configure pin as an output pin."]
Output = 0x01,
}
impl Dir {
#[inline(always)]
pub const fn from_bits(val: u8) -> Dir {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Dir {
#[inline(always)]
fn from(val: u8) -> Dir {
Dir::from_bits(val)
}
}
impl From<Dir> for u8 {
#[inline(always)]
fn from(val: Dir) -> u8 {
Dir::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Drive {
#[doc = "Standard '0', standard '1'."]
S0s1 = 0x0,
#[doc = "High drive '0', standard '1'."]
H0s1 = 0x01,
#[doc = "Standard '0', high drive '1'."]
S0h1 = 0x02,
#[doc = "High drive '0', high 'drive '1''."]
H0h1 = 0x03,
#[doc = "Disconnect '0', standard '1' (normally used for wired-or connections)."]
D0s1 = 0x04,
#[doc = "Disconnect '0', high drive '1' (normally used for wired-or connections)."]
D0h1 = 0x05,
#[doc = "Standard '0', disconnect '1' (normally used for wired-and connections)."]
S0d1 = 0x06,
#[doc = "High drive '0', disconnect '1' (normally used for wired-and connections)."]
H0d1 = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
#[doc = "Extra high drive '0', extra high drive '1'."]
E0e1 = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Drive {
#[inline(always)]
pub const fn from_bits(val: u8) -> Drive {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Drive {
#[inline(always)]
fn from(val: u8) -> Drive {
Drive::from_bits(val)
}
}
impl From<Drive> for u8 {
#[inline(always)]
fn from(val: Drive) -> u8 {
Drive::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Input {
#[doc = "Connect input buffer."]
Connect = 0x0,
#[doc = "Disconnect input buffer."]
Disconnect = 0x01,
}
impl Input {
#[inline(always)]
pub const fn from_bits(val: u8) -> Input {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Input {
#[inline(always)]
fn from(val: u8) -> Input {
Input::from_bits(val)
}
}
impl From<Input> for u8 {
#[inline(always)]
fn from(val: Input) -> u8 {
Input::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Mcusel {
#[doc = "Application MCU."]
AppMcu = 0x0,
#[doc = "Network MCU."]
NetworkMcu = 0x01,
_RESERVED_2 = 0x02,
#[doc = "Peripheral with dedicated pins."]
Peripheral = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
#[doc = "Trace and Debug Subsystem."]
Tnd = 0x07,
}
impl Mcusel {
#[inline(always)]
pub const fn from_bits(val: u8) -> Mcusel {
unsafe { core::mem::transmute(val & 0x07) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Mcusel {
#[inline(always)]
fn from(val: u8) -> Mcusel {
Mcusel::from_bits(val)
}
}
impl From<Mcusel> for u8 {
#[inline(always)]
fn from(val: Mcusel) -> u8 {
Mcusel::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pull {
#[doc = "No pull."]
Disabled = 0x0,
#[doc = "Pull down on pin."]
Pulldown = 0x01,
_RESERVED_2 = 0x02,
#[doc = "Pull up on pin."]
Pullup = 0x03,
}
impl Pull {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pull {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pull {
#[inline(always)]
fn from(val: u8) -> Pull {
Pull::from_bits(val)
}
}
impl From<Pull> for u8 {
#[inline(always)]
fn from(val: Pull) -> u8 {
Pull::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Sense {
#[doc = "Disabled."]
Disabled = 0x0,
_RESERVED_1 = 0x01,
#[doc = "Sense for high level."]
High = 0x02,
#[doc = "Sense for low level."]
Low = 0x03,
}
impl Sense {
#[inline(always)]
pub const fn from_bits(val: u8) -> Sense {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Sense {
#[inline(always)]
fn from(val: u8) -> Sense {
Sense::from_bits(val)
}
}
impl From<Sense> for u8 {
#[inline(always)]
fn from(val: Sense) -> u8 {
Sense::to_bits(val)
}
}
}
}
pub mod gpiote {
#[doc = "GPIO Tasks and Events 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Gpiote {
ptr: *mut u8,
}
unsafe impl Send for Gpiote {}
unsafe impl Sync for Gpiote {}
impl Gpiote {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description collection: Task for writing to pin specified in CONFIG\\[n\\].PSEL. Action on pin is configured in CONFIG\\[n\\].POLARITY."]
#[inline(always)]
pub const fn tasks_out(self, n: usize) -> crate::common::Reg<u32, crate::common::W> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize + n * 4usize) as _)
}
}
#[doc = "Description collection: Task for writing to pin specified in CONFIG\\[n\\].PSEL. Action on pin is to set it high."]
#[inline(always)]
pub const fn tasks_set(self, n: usize) -> crate::common::Reg<u32, crate::common::W> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x30usize + n * 4usize) as _)
}
}
#[doc = "Description collection: Task for writing to pin specified in CONFIG\\[n\\].PSEL. Action on pin is to set it low."]
#[inline(always)]
pub const fn tasks_clr(self, n: usize) -> crate::common::Reg<u32, crate::common::W> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x60usize + n * 4usize) as _)
}
}
#[doc = "Description collection: Subscribe configuration for task OUT\\[n\\]."]
#[inline(always)]
pub const fn subscribe_out(
self,
n: usize,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x80usize + n * 4usize) as _)
}
}
#[doc = "Description collection: Subscribe configuration for task SET\\[n\\]."]
#[inline(always)]
pub const fn subscribe_set(
self,
n: usize,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xb0usize + n * 4usize) as _)
}
}
#[doc = "Description collection: Subscribe configuration for task CLR\\[n\\]."]
#[inline(always)]
pub const fn subscribe_clr(
self,
n: usize,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xe0usize + n * 4usize) as _)
}
}
#[doc = "Description collection: Event generated from pin specified in CONFIG\\[n\\].PSEL."]
#[inline(always)]
pub const fn events_in(self, n: usize) -> crate::common::Reg<u32, crate::common::RW> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0100usize + n * 4usize) as _)
}
}
#[doc = "Event generated from multiple input GPIO pins with SENSE mechanism enabled."]
#[inline(always)]
pub const fn events_port(self, n: usize) -> crate::common::Reg<u32, crate::common::RW> {
assert!(n < 1usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x017cusize + n * 0usize) as _)
}
}
#[doc = "Description collection: Publish configuration for event IN\\[n\\]."]
#[inline(always)]
pub const fn publish_in(
self,
n: usize,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0180usize + n * 4usize) as _)
}
}
#[doc = "Publish configuration for event PORT."]
#[inline(always)]
pub const fn publish_port(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01fcusize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self, n: usize) -> crate::common::Reg<regs::Int, crate::common::RW> {
assert!(n < 1usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize + n * 0usize) as _)
}
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self, n: usize) -> crate::common::Reg<regs::Int, crate::common::RW> {
assert!(n < 1usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize + n * 0usize) as _)
}
}
#[doc = "Latency selection for Event mode (MODE=Event) with rising or falling edge detection on the pin."]
#[inline(always)]
pub const fn latency(self) -> crate::common::Reg<regs::Latency, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0504usize) as _) }
}
#[doc = "Description collection: Configuration for OUT\\[n\\], SET\\[n\\], and CLR\\[n\\] tasks and IN\\[n\\] event."]
#[inline(always)]
pub const fn config(self, n: usize) -> crate::common::Reg<regs::Config, crate::common::RW> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0510usize + n * 4usize) as _)
}
}
}
pub mod regs {
#[doc = "Description collection: Configuration for OUT\\[n\\], SET\\[n\\], and CLR\\[n\\] tasks and IN\\[n\\] event."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Config(pub u32);
impl Config {
#[doc = "Mode."]
#[must_use]
#[inline(always)]
pub const fn mode(&self) -> super::vals::Mode {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Mode::from_bits(val as u8)
}
#[doc = "Mode."]
#[inline(always)]
pub const fn set_mode(&mut self, val: super::vals::Mode) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
#[doc = "GPIO number associated with SET\\[n\\], CLR\\[n\\], and OUT\\[n\\] tasks and IN\\[n\\] event."]
#[must_use]
#[inline(always)]
pub const fn psel(&self) -> u8 {
let val = (self.0 >> 8usize) & 0x1f;
val as u8
}
#[doc = "GPIO number associated with SET\\[n\\], CLR\\[n\\], and OUT\\[n\\] tasks and IN\\[n\\] event."]
#[inline(always)]
pub const fn set_psel(&mut self, val: u8) {
self.0 = (self.0 & !(0x1f << 8usize)) | (((val as u32) & 0x1f) << 8usize);
}
#[doc = "Port number."]
#[must_use]
#[inline(always)]
pub const fn port(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "Port number."]
#[inline(always)]
pub const fn set_port(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "When In task mode: Operation to be performed on output when OUT\\[n\\] task is triggered. When In event mode: Operation on input that shall trigger IN\\[n\\] event."]
#[must_use]
#[inline(always)]
pub const fn polarity(&self) -> super::vals::Polarity {
let val = (self.0 >> 16usize) & 0x03;
super::vals::Polarity::from_bits(val as u8)
}
#[doc = "When In task mode: Operation to be performed on output when OUT\\[n\\] task is triggered. When In event mode: Operation on input that shall trigger IN\\[n\\] event."]
#[inline(always)]
pub const fn set_polarity(&mut self, val: super::vals::Polarity) {
self.0 =
(self.0 & !(0x03 << 16usize)) | (((val.to_bits() as u32) & 0x03) << 16usize);
}
#[doc = "When in task mode: Initial value of the output when the GPIOTE channel is configured. When in event mode: No effect."]
#[must_use]
#[inline(always)]
pub const fn outinit(&self) -> super::vals::Outinit {
let val = (self.0 >> 20usize) & 0x01;
super::vals::Outinit::from_bits(val as u8)
}
#[doc = "When in task mode: Initial value of the output when the GPIOTE channel is configured. When in event mode: No effect."]
#[inline(always)]
pub const fn set_outinit(&mut self, val: super::vals::Outinit) {
self.0 =
(self.0 & !(0x01 << 20usize)) | (((val.to_bits() as u32) & 0x01) << 20usize);
}
}
impl Default for Config {
#[inline(always)]
fn default() -> Config {
Config(0)
}
}
impl core::fmt::Debug for Config {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Config")
.field("mode", &self.mode())
.field("psel", &self.psel())
.field("port", &self.port())
.field("polarity", &self.polarity())
.field("outinit", &self.outinit())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Config {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Config {{ mode: {:?}, psel: {=u8:?}, port: {=bool:?}, polarity: {:?}, outinit: {:?} }}" , self . mode () , self . psel () , self . port () , self . polarity () , self . outinit ())
}
}
#[doc = "Disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Write '1' to disable interrupt for event IN\\[0\\]."]
#[must_use]
#[inline(always)]
pub const fn in_(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event IN\\[0\\]."]
#[inline(always)]
pub const fn set_in_(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "Write '1' to disable interrupt for event PORT."]
#[must_use]
#[inline(always)]
pub const fn port(&self) -> bool {
let val = (self.0 >> 31usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event PORT."]
#[inline(always)]
pub const fn set_port(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("in_[0]", &self.in_(0usize))
.field("in_[1]", &self.in_(1usize))
.field("in_[2]", &self.in_(2usize))
.field("in_[3]", &self.in_(3usize))
.field("in_[4]", &self.in_(4usize))
.field("in_[5]", &self.in_(5usize))
.field("in_[6]", &self.in_(6usize))
.field("in_[7]", &self.in_(7usize))
.field("port", &self.port())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Int {{ in_[0]: {=bool:?}, in_[1]: {=bool:?}, in_[2]: {=bool:?}, in_[3]: {=bool:?}, in_[4]: {=bool:?}, in_[5]: {=bool:?}, in_[6]: {=bool:?}, in_[7]: {=bool:?}, port: {=bool:?} }}" , self . in_ (0usize) , self . in_ (1usize) , self . in_ (2usize) , self . in_ (3usize) , self . in_ (4usize) , self . in_ (5usize) , self . in_ (6usize) , self . in_ (7usize) , self . port ())
}
}
#[doc = "Latency selection for Event mode (MODE=Event) with rising or falling edge detection on the pin."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Latency(pub u32);
impl Latency {
#[doc = "Latency setting."]
#[must_use]
#[inline(always)]
pub const fn latency(&self) -> super::vals::Latency {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Latency::from_bits(val as u8)
}
#[doc = "Latency setting."]
#[inline(always)]
pub const fn set_latency(&mut self, val: super::vals::Latency) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Latency {
#[inline(always)]
fn default() -> Latency {
Latency(0)
}
}
impl core::fmt::Debug for Latency {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Latency")
.field("latency", &self.latency())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Latency {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Latency {{ latency: {:?} }}", self.latency())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Latency {
#[doc = "Low power setting."]
LowPower = 0x0,
#[doc = "Low latency setting."]
LowLatency = 0x01,
}
impl Latency {
#[inline(always)]
pub const fn from_bits(val: u8) -> Latency {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Latency {
#[inline(always)]
fn from(val: u8) -> Latency {
Latency::from_bits(val)
}
}
impl From<Latency> for u8 {
#[inline(always)]
fn from(val: Latency) -> u8 {
Latency::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Mode {
#[doc = "Disabled. Pin specified by PSEL will not be acquired by the GPIOTE module."]
Disabled = 0x0,
#[doc = "Event mode."]
Event = 0x01,
_RESERVED_2 = 0x02,
#[doc = "Task mode."]
Task = 0x03,
}
impl Mode {
#[inline(always)]
pub const fn from_bits(val: u8) -> Mode {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Mode {
#[inline(always)]
fn from(val: u8) -> Mode {
Mode::from_bits(val)
}
}
impl From<Mode> for u8 {
#[inline(always)]
fn from(val: Mode) -> u8 {
Mode::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Outinit {
#[doc = "Task mode: Initial value of pin before task triggering is low."]
Low = 0x0,
#[doc = "Task mode: Initial value of pin before task triggering is high."]
High = 0x01,
}
impl Outinit {
#[inline(always)]
pub const fn from_bits(val: u8) -> Outinit {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Outinit {
#[inline(always)]
fn from(val: u8) -> Outinit {
Outinit::from_bits(val)
}
}
impl From<Outinit> for u8 {
#[inline(always)]
fn from(val: Outinit) -> u8 {
Outinit::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Polarity {
#[doc = "Task mode: No effect on pin from OUT\\[n\\] task. Event mode: no IN\\[n\\] event generated on pin activity."]
None = 0x0,
#[doc = "Task mode: Set pin from OUT\\[n\\] task. Event mode: Generate IN\\[n\\] event when rising edge on pin."]
LoToHi = 0x01,
#[doc = "Task mode: Clear pin from OUT\\[n\\] task. Event mode: Generate IN\\[n\\] event when falling edge on pin."]
HiToLo = 0x02,
#[doc = "Task mode: Toggle pin from OUT\\[n\\]. Event mode: Generate IN\\[n\\] when any change on pin."]
Toggle = 0x03,
}
impl Polarity {
#[inline(always)]
pub const fn from_bits(val: u8) -> Polarity {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Polarity {
#[inline(always)]
fn from(val: u8) -> Polarity {
Polarity::from_bits(val)
}
}
impl From<Polarity> for u8 {
#[inline(always)]
fn from(val: Polarity) -> u8 {
Polarity::to_bits(val)
}
}
}
}
pub mod i2s {
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Config {
ptr: *mut u8,
}
unsafe impl Send for Config {}
unsafe impl Sync for Config {}
impl Config {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "I2S mode."]
#[inline(always)]
pub const fn mode(self) -> crate::common::Reg<regs::Mode, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Reception (RX) enable."]
#[inline(always)]
pub const fn rxen(self) -> crate::common::Reg<regs::Rxen, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Transmission (TX) enable."]
#[inline(always)]
pub const fn txen(self) -> crate::common::Reg<regs::Txen, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Master clock generator enable."]
#[inline(always)]
pub const fn mcken(self) -> crate::common::Reg<regs::Mcken, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
#[doc = "I2S clock generator control."]
#[inline(always)]
pub const fn mckfreq(self) -> crate::common::Reg<regs::Mckfreq, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
#[doc = "MCK / LRCK ratio."]
#[inline(always)]
pub const fn ratio(self) -> crate::common::Reg<regs::Ratio, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x14usize) as _) }
}
#[doc = "Sample width."]
#[inline(always)]
pub const fn swidth(self) -> crate::common::Reg<regs::Swidth, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x18usize) as _) }
}
#[doc = "Alignment of sample within a frame."]
#[inline(always)]
pub const fn align(self) -> crate::common::Reg<regs::Align, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x1cusize) as _) }
}
#[doc = "Frame format."]
#[inline(always)]
pub const fn format(self) -> crate::common::Reg<regs::Format, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x20usize) as _) }
}
#[doc = "Enable channels."]
#[inline(always)]
pub const fn channels(self) -> crate::common::Reg<regs::Channels, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x24usize) as _) }
}
#[doc = "Clock source selection for the I2S module."]
#[inline(always)]
pub const fn clkconfig(self) -> crate::common::Reg<regs::Clkconfig, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x28usize) as _) }
}
}
#[doc = "Inter-IC Sound 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct I2s {
ptr: *mut u8,
}
unsafe impl Send for I2s {}
unsafe impl Sync for I2s {}
impl I2s {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Starts continuous I2S transfer. Also starts MCK generator when this is enabled."]
#[inline(always)]
pub const fn tasks_start(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Stops I2S transfer and MCK generator. Triggering this task will cause the event STOPPED to be generated."]
#[inline(always)]
pub const fn tasks_stop(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Subscribe configuration for task START."]
#[inline(always)]
pub const fn subscribe_start(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x80usize) as _) }
}
#[doc = "Subscribe configuration for task STOP."]
#[inline(always)]
pub const fn subscribe_stop(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x84usize) as _) }
}
#[doc = "The RXD.PTR register has been copied to internal double-buffers. When the I2S module is started and RX is enabled, this event will be generated for every RXTXD.MAXCNT words received on the SDIN pin."]
#[inline(always)]
pub const fn events_rxptrupd(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0104usize) as _) }
}
#[doc = "I2S transfer stopped."]
#[inline(always)]
pub const fn events_stopped(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0108usize) as _) }
}
#[doc = "The TDX.PTR register has been copied to internal double-buffers. When the I2S module is started and TX is enabled, this event will be generated for every RXTXD.MAXCNT words that are sent on the SDOUT pin."]
#[inline(always)]
pub const fn events_txptrupd(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0114usize) as _) }
}
#[doc = "Frame start event, generated on the active edge of LRCK."]
#[inline(always)]
pub const fn events_framestart(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x011cusize) as _) }
}
#[doc = "Publish configuration for event RXPTRUPD."]
#[inline(always)]
pub const fn publish_rxptrupd(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0184usize) as _) }
}
#[doc = "Publish configuration for event STOPPED."]
#[inline(always)]
pub const fn publish_stopped(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0188usize) as _) }
}
#[doc = "Publish configuration for event TXPTRUPD."]
#[inline(always)]
pub const fn publish_txptrupd(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0194usize) as _) }
}
#[doc = "Publish configuration for event FRAMESTART."]
#[inline(always)]
pub const fn publish_framestart(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x019cusize) as _) }
}
#[doc = "Enable or disable interrupt."]
#[inline(always)]
pub const fn inten(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0300usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "Enable I2S module."]
#[inline(always)]
pub const fn enable(self) -> crate::common::Reg<regs::Enable, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0500usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn config(self) -> Config {
unsafe { Config::from_ptr(self.ptr.wrapping_add(0x0504usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn rxd(self) -> Rxd {
unsafe { Rxd::from_ptr(self.ptr.wrapping_add(0x0538usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn txd(self) -> Txd {
unsafe { Txd::from_ptr(self.ptr.wrapping_add(0x0540usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn rxtxd(self) -> Rxtxd {
unsafe { Rxtxd::from_ptr(self.ptr.wrapping_add(0x0550usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn psel(self) -> Psel {
unsafe { Psel::from_ptr(self.ptr.wrapping_add(0x0560usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Psel {
ptr: *mut u8,
}
unsafe impl Send for Psel {}
unsafe impl Sync for Psel {}
impl Psel {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Pin select for MCK signal."]
#[inline(always)]
pub const fn mck(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Pin select for SCK signal."]
#[inline(always)]
pub const fn sck(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Pin select for LRCK signal."]
#[inline(always)]
pub const fn lrck(
self,
) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Pin select for SDIN signal."]
#[inline(always)]
pub const fn sdin(
self,
) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
#[doc = "Pin select for SDOUT signal."]
#[inline(always)]
pub const fn sdout(
self,
) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Rxd {
ptr: *mut u8,
}
unsafe impl Send for Rxd {}
unsafe impl Sync for Rxd {}
impl Rxd {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Receive buffer RAM start address."]
#[inline(always)]
pub const fn ptr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Rxtxd {
ptr: *mut u8,
}
unsafe impl Send for Rxtxd {}
unsafe impl Sync for Rxtxd {}
impl Rxtxd {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Size of RXD and TXD buffers."]
#[inline(always)]
pub const fn maxcnt(self) -> crate::common::Reg<regs::Maxcnt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Txd {
ptr: *mut u8,
}
unsafe impl Send for Txd {}
unsafe impl Sync for Txd {}
impl Txd {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Transmit buffer RAM start address."]
#[inline(always)]
pub const fn ptr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
}
pub mod regs {
#[doc = "Alignment of sample within a frame."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Align(pub u32);
impl Align {
#[doc = "Alignment of sample within a frame."]
#[must_use]
#[inline(always)]
pub const fn align(&self) -> super::vals::Align {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Align::from_bits(val as u8)
}
#[doc = "Alignment of sample within a frame."]
#[inline(always)]
pub const fn set_align(&mut self, val: super::vals::Align) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Align {
#[inline(always)]
fn default() -> Align {
Align(0)
}
}
impl core::fmt::Debug for Align {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Align")
.field("align", &self.align())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Align {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Align {{ align: {:?} }}", self.align())
}
}
#[doc = "Enable channels."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Channels(pub u32);
impl Channels {
#[doc = "Enable channels."]
#[must_use]
#[inline(always)]
pub const fn channels(&self) -> super::vals::Channels {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Channels::from_bits(val as u8)
}
#[doc = "Enable channels."]
#[inline(always)]
pub const fn set_channels(&mut self, val: super::vals::Channels) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for Channels {
#[inline(always)]
fn default() -> Channels {
Channels(0)
}
}
impl core::fmt::Debug for Channels {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Channels")
.field("channels", &self.channels())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Channels {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Channels {{ channels: {:?} }}", self.channels())
}
}
#[doc = "Clock source selection for the I2S module."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Clkconfig(pub u32);
impl Clkconfig {
#[doc = "Clock source selection."]
#[must_use]
#[inline(always)]
pub const fn clksrc(&self) -> super::vals::Clksrc {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Clksrc::from_bits(val as u8)
}
#[doc = "Clock source selection."]
#[inline(always)]
pub const fn set_clksrc(&mut self, val: super::vals::Clksrc) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "Bypass clock generator. MCK will be equal to source input. If bypass is enabled the MCKFREQ setting has no effect."]
#[must_use]
#[inline(always)]
pub const fn bypass(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Bypass clock generator. MCK will be equal to source input. If bypass is enabled the MCKFREQ setting has no effect."]
#[inline(always)]
pub const fn set_bypass(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
}
impl Default for Clkconfig {
#[inline(always)]
fn default() -> Clkconfig {
Clkconfig(0)
}
}
impl core::fmt::Debug for Clkconfig {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Clkconfig")
.field("clksrc", &self.clksrc())
.field("bypass", &self.bypass())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Clkconfig {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Clkconfig {{ clksrc: {:?}, bypass: {=bool:?} }}",
self.clksrc(),
self.bypass()
)
}
}
#[doc = "Enable I2S module."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Enable(pub u32);
impl Enable {
#[doc = "Enable I2S module."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable I2S module."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Enable {
#[inline(always)]
fn default() -> Enable {
Enable(0)
}
}
impl core::fmt::Debug for Enable {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Enable")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Enable {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Enable {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "Frame format."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Format(pub u32);
impl Format {
#[doc = "Frame format."]
#[must_use]
#[inline(always)]
pub const fn format(&self) -> super::vals::Format {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Format::from_bits(val as u8)
}
#[doc = "Frame format."]
#[inline(always)]
pub const fn set_format(&mut self, val: super::vals::Format) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Format {
#[inline(always)]
fn default() -> Format {
Format(0)
}
}
impl core::fmt::Debug for Format {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Format")
.field("format", &self.format())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Format {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Format {{ format: {:?} }}", self.format())
}
}
#[doc = "Enable or disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Enable or disable interrupt for event RXPTRUPD."]
#[must_use]
#[inline(always)]
pub const fn rxptrupd(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RXPTRUPD."]
#[inline(always)]
pub const fn set_rxptrupd(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enable or disable interrupt for event STOPPED."]
#[must_use]
#[inline(always)]
pub const fn stopped(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event STOPPED."]
#[inline(always)]
pub const fn set_stopped(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Enable or disable interrupt for event TXPTRUPD."]
#[must_use]
#[inline(always)]
pub const fn txptrupd(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event TXPTRUPD."]
#[inline(always)]
pub const fn set_txptrupd(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Enable or disable interrupt for event FRAMESTART."]
#[must_use]
#[inline(always)]
pub const fn framestart(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event FRAMESTART."]
#[inline(always)]
pub const fn set_framestart(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("rxptrupd", &self.rxptrupd())
.field("stopped", &self.stopped())
.field("txptrupd", &self.txptrupd())
.field("framestart", &self.framestart())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Int {{ rxptrupd: {=bool:?}, stopped: {=bool:?}, txptrupd: {=bool:?}, framestart: {=bool:?} }}" , self . rxptrupd () , self . stopped () , self . txptrupd () , self . framestart ())
}
}
#[doc = "Size of RXD and TXD buffers."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Maxcnt(pub u32);
impl Maxcnt {
#[doc = "Size of RXD and TXD buffers in number of 32 bit words."]
#[must_use]
#[inline(always)]
pub const fn maxcnt(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x3fff;
val as u16
}
#[doc = "Size of RXD and TXD buffers in number of 32 bit words."]
#[inline(always)]
pub const fn set_maxcnt(&mut self, val: u16) {
self.0 = (self.0 & !(0x3fff << 0usize)) | (((val as u32) & 0x3fff) << 0usize);
}
}
impl Default for Maxcnt {
#[inline(always)]
fn default() -> Maxcnt {
Maxcnt(0)
}
}
impl core::fmt::Debug for Maxcnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Maxcnt")
.field("maxcnt", &self.maxcnt())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Maxcnt {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Maxcnt {{ maxcnt: {=u16:?} }}", self.maxcnt())
}
}
#[doc = "Master clock generator enable."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Mcken(pub u32);
impl Mcken {
#[doc = "Master clock generator enable."]
#[must_use]
#[inline(always)]
pub const fn mcken(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Master clock generator enable."]
#[inline(always)]
pub const fn set_mcken(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Mcken {
#[inline(always)]
fn default() -> Mcken {
Mcken(0)
}
}
impl core::fmt::Debug for Mcken {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Mcken")
.field("mcken", &self.mcken())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Mcken {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Mcken {{ mcken: {=bool:?} }}", self.mcken())
}
}
#[doc = "I2S clock generator control."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Mckfreq(pub u32);
impl Mckfreq {
#[doc = "I2S MCK frequency configuration NOTE: Enumerations are deprecated, use MCKFREQ equation. NOTE: The 12 least significant bits of the register are ignored and shall be set to zero."]
#[must_use]
#[inline(always)]
pub const fn mckfreq(&self) -> super::vals::Mckfreq {
let val = (self.0 >> 0usize) & 0xffff_ffff;
super::vals::Mckfreq::from_bits(val as u32)
}
#[doc = "I2S MCK frequency configuration NOTE: Enumerations are deprecated, use MCKFREQ equation. NOTE: The 12 least significant bits of the register are ignored and shall be set to zero."]
#[inline(always)]
pub const fn set_mckfreq(&mut self, val: super::vals::Mckfreq) {
self.0 = (self.0 & !(0xffff_ffff << 0usize))
| (((val.to_bits() as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Mckfreq {
#[inline(always)]
fn default() -> Mckfreq {
Mckfreq(0)
}
}
impl core::fmt::Debug for Mckfreq {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Mckfreq")
.field("mckfreq", &self.mckfreq())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Mckfreq {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Mckfreq {{ mckfreq: {:?} }}", self.mckfreq())
}
}
#[doc = "I2S mode."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Mode(pub u32);
impl Mode {
#[doc = "I2S mode."]
#[must_use]
#[inline(always)]
pub const fn mode(&self) -> super::vals::Mode {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Mode::from_bits(val as u8)
}
#[doc = "I2S mode."]
#[inline(always)]
pub const fn set_mode(&mut self, val: super::vals::Mode) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Mode {
#[inline(always)]
fn default() -> Mode {
Mode(0)
}
}
impl core::fmt::Debug for Mode {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Mode").field("mode", &self.mode()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Mode {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Mode {{ mode: {:?} }}", self.mode())
}
}
#[doc = "MCK / LRCK ratio."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ratio(pub u32);
impl Ratio {
#[doc = "MCK / LRCK ratio."]
#[must_use]
#[inline(always)]
pub const fn ratio(&self) -> super::vals::Ratio {
let val = (self.0 >> 0usize) & 0x0f;
super::vals::Ratio::from_bits(val as u8)
}
#[doc = "MCK / LRCK ratio."]
#[inline(always)]
pub const fn set_ratio(&mut self, val: super::vals::Ratio) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val.to_bits() as u32) & 0x0f) << 0usize);
}
}
impl Default for Ratio {
#[inline(always)]
fn default() -> Ratio {
Ratio(0)
}
}
impl core::fmt::Debug for Ratio {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ratio")
.field("ratio", &self.ratio())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ratio {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Ratio {{ ratio: {:?} }}", self.ratio())
}
}
#[doc = "Reception (RX) enable."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Rxen(pub u32);
impl Rxen {
#[doc = "Reception (RX) enable."]
#[must_use]
#[inline(always)]
pub const fn rxen(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Reception (RX) enable."]
#[inline(always)]
pub const fn set_rxen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Rxen {
#[inline(always)]
fn default() -> Rxen {
Rxen(0)
}
}
impl core::fmt::Debug for Rxen {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Rxen").field("rxen", &self.rxen()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Rxen {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Rxen {{ rxen: {=bool:?} }}", self.rxen())
}
}
#[doc = "Sample width."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Swidth(pub u32);
impl Swidth {
#[doc = "Sample and half-frame width."]
#[must_use]
#[inline(always)]
pub const fn swidth(&self) -> super::vals::Swidth {
let val = (self.0 >> 0usize) & 0x07;
super::vals::Swidth::from_bits(val as u8)
}
#[doc = "Sample and half-frame width."]
#[inline(always)]
pub const fn set_swidth(&mut self, val: super::vals::Swidth) {
self.0 = (self.0 & !(0x07 << 0usize)) | (((val.to_bits() as u32) & 0x07) << 0usize);
}
}
impl Default for Swidth {
#[inline(always)]
fn default() -> Swidth {
Swidth(0)
}
}
impl core::fmt::Debug for Swidth {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Swidth")
.field("swidth", &self.swidth())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Swidth {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Swidth {{ swidth: {:?} }}", self.swidth())
}
}
#[doc = "Transmission (TX) enable."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Txen(pub u32);
impl Txen {
#[doc = "Transmission (TX) enable."]
#[must_use]
#[inline(always)]
pub const fn txen(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Transmission (TX) enable."]
#[inline(always)]
pub const fn set_txen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Txen {
#[inline(always)]
fn default() -> Txen {
Txen(0)
}
}
impl core::fmt::Debug for Txen {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Txen").field("txen", &self.txen()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Txen {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Txen {{ txen: {=bool:?} }}", self.txen())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Align {
#[doc = "Left-aligned."]
Left = 0x0,
#[doc = "Right-aligned."]
Right = 0x01,
}
impl Align {
#[inline(always)]
pub const fn from_bits(val: u8) -> Align {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Align {
#[inline(always)]
fn from(val: u8) -> Align {
Align::from_bits(val)
}
}
impl From<Align> for u8 {
#[inline(always)]
fn from(val: Align) -> u8 {
Align::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channels {
#[doc = "Stereo."]
Stereo = 0x0,
#[doc = "Left only."]
Left = 0x01,
#[doc = "Right only."]
Right = 0x02,
_RESERVED_3 = 0x03,
}
impl Channels {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channels {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channels {
#[inline(always)]
fn from(val: u8) -> Channels {
Channels::from_bits(val)
}
}
impl From<Channels> for u8 {
#[inline(always)]
fn from(val: Channels) -> u8 {
Channels::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Clksrc {
#[doc = "32MHz peripheral clock."]
Pclk32m = 0x0,
#[doc = "Audio PLL clock."]
Aclk = 0x01,
}
impl Clksrc {
#[inline(always)]
pub const fn from_bits(val: u8) -> Clksrc {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Clksrc {
#[inline(always)]
fn from(val: u8) -> Clksrc {
Clksrc::from_bits(val)
}
}
impl From<Clksrc> for u8 {
#[inline(always)]
fn from(val: Clksrc) -> u8 {
Clksrc::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Format {
#[doc = "Original I2S format."]
I2s = 0x0,
#[doc = "Alternate (left- or right-aligned) format."]
Aligned = 0x01,
}
impl Format {
#[inline(always)]
pub const fn from_bits(val: u8) -> Format {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Format {
#[inline(always)]
fn from(val: u8) -> Format {
Format::from_bits(val)
}
}
impl From<Format> for u8 {
#[inline(always)]
fn from(val: Format) -> u8 {
Format::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Mckfreq(u32);
impl Mckfreq {
#[doc = "32 MHz / 125 = 0.256 MHz Deprecated, use MCKFREQ equation."]
pub const _32mdiv125: Self = Self(0x020c_0000);
#[doc = "32 MHz / 63 = 0.5079365 MHz Deprecated, use MCKFREQ equation."]
pub const _32mdiv63: Self = Self(0x0410_0000);
#[doc = "32 MHz / 42 = 0.7619048 MHz Deprecated, use MCKFREQ equation."]
pub const _32mdiv42: Self = Self(0x0600_0000);
#[doc = "32 MHz / 32 = 1.0 MHz Deprecated, use MCKFREQ equation."]
pub const _32mdiv32: Self = Self(0x0800_0000);
#[doc = "32 MHz / 31 = 1.0322581 MHz Deprecated, use MCKFREQ equation."]
pub const _32mdiv31: Self = Self(0x0840_0000);
#[doc = "32 MHz / 30 = 1.0666667 MHz Deprecated, use MCKFREQ equation."]
pub const _32mdiv30: Self = Self(0x0880_0000);
#[doc = "32 MHz / 23 = 1.3913043 MHz Deprecated, use MCKFREQ equation."]
pub const _32mdiv23: Self = Self(0x0b00_0000);
#[doc = "32 MHz / 21 = 1.5238095 MHz Deprecated, use MCKFREQ equation."]
pub const _32mdiv21: Self = Self(0x0c00_0000);
#[doc = "32 MHz / 16 = 2.0 MHz Deprecated, use MCKFREQ equation."]
pub const _32mdiv16: Self = Self(0x1000_0000);
#[doc = "32 MHz / 15 = 2.1333333 MHz Deprecated, use MCKFREQ equation."]
pub const _32mdiv15: Self = Self(0x1100_0000);
#[doc = "32 MHz / 11 = 2.9090909 MHz Deprecated, use MCKFREQ equation."]
pub const _32mdiv11: Self = Self(0x1600_0000);
#[doc = "32 MHz / 10 = 3.2 MHz Deprecated, use MCKFREQ equation."]
pub const _32mdiv10: Self = Self(0x1800_0000);
#[doc = "32 MHz / 8 = 4.0 MHz Deprecated, use MCKFREQ equation."]
pub const _32mdiv8: Self = Self(0x2000_0000);
#[doc = "32 MHz / 6 = 5.3333333 MHz Deprecated, use MCKFREQ equation."]
pub const _32mdiv6: Self = Self(0x2800_0000);
#[doc = "32 MHz / 5 = 6.4 MHz Deprecated, use MCKFREQ equation."]
pub const _32mdiv5: Self = Self(0x3000_0000);
#[doc = "32 MHz / 4 = 8.0 MHz Deprecated, use MCKFREQ equation."]
pub const _32mdiv4: Self = Self(0x4000_0000);
#[doc = "32 MHz / 3 = 10.6666667 MHz Deprecated, use MCKFREQ equation."]
pub const _32mdiv3: Self = Self(0x5000_0000);
#[doc = "32 MHz / 2 = 16.0 MHz Deprecated, use MCKFREQ equation."]
pub const _32mdiv2: Self = Self(0x8000_0000);
}
impl Mckfreq {
pub const fn from_bits(val: u32) -> Mckfreq {
Self(val & 0xffff_ffff)
}
pub const fn to_bits(self) -> u32 {
self.0
}
}
impl core::fmt::Debug for Mckfreq {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x020c_0000 => f.write_str("_32mdiv125"),
0x0410_0000 => f.write_str("_32mdiv63"),
0x0600_0000 => f.write_str("_32mdiv42"),
0x0800_0000 => f.write_str("_32mdiv32"),
0x0840_0000 => f.write_str("_32mdiv31"),
0x0880_0000 => f.write_str("_32mdiv30"),
0x0b00_0000 => f.write_str("_32mdiv23"),
0x0c00_0000 => f.write_str("_32mdiv21"),
0x1000_0000 => f.write_str("_32mdiv16"),
0x1100_0000 => f.write_str("_32mdiv15"),
0x1600_0000 => f.write_str("_32mdiv11"),
0x1800_0000 => f.write_str("_32mdiv10"),
0x2000_0000 => f.write_str("_32mdiv8"),
0x2800_0000 => f.write_str("_32mdiv6"),
0x3000_0000 => f.write_str("_32mdiv5"),
0x4000_0000 => f.write_str("_32mdiv4"),
0x5000_0000 => f.write_str("_32mdiv3"),
0x8000_0000 => f.write_str("_32mdiv2"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Mckfreq {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x020c_0000 => defmt::write!(f, "_32mdiv125"),
0x0410_0000 => defmt::write!(f, "_32mdiv63"),
0x0600_0000 => defmt::write!(f, "_32mdiv42"),
0x0800_0000 => defmt::write!(f, "_32mdiv32"),
0x0840_0000 => defmt::write!(f, "_32mdiv31"),
0x0880_0000 => defmt::write!(f, "_32mdiv30"),
0x0b00_0000 => defmt::write!(f, "_32mdiv23"),
0x0c00_0000 => defmt::write!(f, "_32mdiv21"),
0x1000_0000 => defmt::write!(f, "_32mdiv16"),
0x1100_0000 => defmt::write!(f, "_32mdiv15"),
0x1600_0000 => defmt::write!(f, "_32mdiv11"),
0x1800_0000 => defmt::write!(f, "_32mdiv10"),
0x2000_0000 => defmt::write!(f, "_32mdiv8"),
0x2800_0000 => defmt::write!(f, "_32mdiv6"),
0x3000_0000 => defmt::write!(f, "_32mdiv5"),
0x4000_0000 => defmt::write!(f, "_32mdiv4"),
0x5000_0000 => defmt::write!(f, "_32mdiv3"),
0x8000_0000 => defmt::write!(f, "_32mdiv2"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u32> for Mckfreq {
#[inline(always)]
fn from(val: u32) -> Mckfreq {
Mckfreq::from_bits(val)
}
}
impl From<Mckfreq> for u32 {
#[inline(always)]
fn from(val: Mckfreq) -> u32 {
Mckfreq::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Mode {
#[doc = "Master mode. SCK and LRCK generated from internal master clcok (MCK) and output on pins defined by PSEL.xxx."]
Master = 0x0,
#[doc = "Slave mode. SCK and LRCK generated by external master and received on pins defined by PSEL.xxx."]
Slave = 0x01,
}
impl Mode {
#[inline(always)]
pub const fn from_bits(val: u8) -> Mode {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Mode {
#[inline(always)]
fn from(val: u8) -> Mode {
Mode::from_bits(val)
}
}
impl From<Mode> for u8 {
#[inline(always)]
fn from(val: Mode) -> u8 {
Mode::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Ratio {
#[doc = "LRCK = MCK / 32."]
_32x = 0x0,
#[doc = "LRCK = MCK / 48."]
_48x = 0x01,
#[doc = "LRCK = MCK / 64."]
_64x = 0x02,
#[doc = "LRCK = MCK / 96."]
_96x = 0x03,
#[doc = "LRCK = MCK / 128."]
_128x = 0x04,
#[doc = "LRCK = MCK / 192."]
_192x = 0x05,
#[doc = "LRCK = MCK / 256."]
_256x = 0x06,
#[doc = "LRCK = MCK / 384."]
_384x = 0x07,
#[doc = "LRCK = MCK / 512."]
_512x = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Ratio {
#[inline(always)]
pub const fn from_bits(val: u8) -> Ratio {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Ratio {
#[inline(always)]
fn from(val: u8) -> Ratio {
Ratio::from_bits(val)
}
}
impl From<Ratio> for u8 {
#[inline(always)]
fn from(val: Ratio) -> u8 {
Ratio::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Swidth {
#[doc = "8 bit sample."]
_8bit = 0x0,
#[doc = "16 bit sample."]
_16bit = 0x01,
#[doc = "24 bit sample."]
_24bit = 0x02,
#[doc = "32 bit sample."]
_32bit = 0x03,
#[doc = "8 bit sample in a 16-bit half-frame."]
_8bitIn16 = 0x04,
#[doc = "8 bit sample in a 32-bit half-frame."]
_8bitIn32 = 0x05,
#[doc = "16 bit sample in a 32-bit half-frame."]
_16bitIn32 = 0x06,
#[doc = "24 bit sample in a 32-bit half-frame."]
_24bitIn32 = 0x07,
}
impl Swidth {
#[inline(always)]
pub const fn from_bits(val: u8) -> Swidth {
unsafe { core::mem::transmute(val & 0x07) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Swidth {
#[inline(always)]
fn from(val: u8) -> Swidth {
Swidth::from_bits(val)
}
}
impl From<Swidth> for u8 {
#[inline(always)]
fn from(val: Swidth) -> u8 {
Swidth::to_bits(val)
}
}
}
}
pub mod ipc {
#[doc = "Interprocessor communication 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ipc {
ptr: *mut u8,
}
unsafe impl Send for Ipc {}
unsafe impl Sync for Ipc {}
impl Ipc {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description collection: Trigger events on IPC channel enabled in SEND_CNF\\[n\\]."]
#[inline(always)]
pub const fn tasks_send(self, n: usize) -> crate::common::Reg<u32, crate::common::W> {
assert!(n < 16usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize + n * 4usize) as _)
}
}
#[doc = "Description collection: Subscribe configuration for task SEND\\[n\\]."]
#[inline(always)]
pub const fn subscribe_send(
self,
n: usize,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
assert!(n < 16usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x80usize + n * 4usize) as _)
}
}
#[doc = "Description collection: Event received on one or more of the enabled IPC channels in RECEIVE_CNF\\[n\\]."]
#[inline(always)]
pub const fn events_receive(self, n: usize) -> crate::common::Reg<u32, crate::common::RW> {
assert!(n < 16usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0100usize + n * 4usize) as _)
}
}
#[doc = "Description collection: Publish configuration for event RECEIVE\\[n\\]."]
#[inline(always)]
pub const fn publish_receive(
self,
n: usize,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
assert!(n < 16usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0180usize + n * 4usize) as _)
}
}
#[doc = "Enable or disable interrupt."]
#[inline(always)]
pub const fn inten(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0300usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "Pending interrupts."]
#[inline(always)]
pub const fn intpend(self) -> crate::common::Reg<regs::Int, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x030cusize) as _) }
}
#[doc = "Description collection: Send event configuration for TASKS_SEND\\[n\\]."]
#[inline(always)]
pub const fn send_cnf(
self,
n: usize,
) -> crate::common::Reg<regs::SendCnf, crate::common::RW> {
assert!(n < 16usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0510usize + n * 4usize) as _)
}
}
#[doc = "Description collection: Receive event configuration for EVENTS_RECEIVE\\[n\\]."]
#[inline(always)]
pub const fn receive_cnf(
self,
n: usize,
) -> crate::common::Reg<regs::ReceiveCnf, crate::common::RW> {
assert!(n < 16usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0590usize + n * 4usize) as _)
}
}
#[doc = "Description collection: General purpose memory."]
#[inline(always)]
pub const fn gpmem(self, n: usize) -> crate::common::Reg<u32, crate::common::RW> {
assert!(n < 2usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0610usize + n * 4usize) as _)
}
}
}
pub mod regs {
#[doc = "Enable or disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Enable or disable interrupt for event RECEIVE\\[0\\]."]
#[must_use]
#[inline(always)]
pub const fn receive0(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[0\\]."]
#[inline(always)]
pub const fn set_receive0(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[1\\]."]
#[must_use]
#[inline(always)]
pub const fn receive1(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[1\\]."]
#[inline(always)]
pub const fn set_receive1(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[2\\]."]
#[must_use]
#[inline(always)]
pub const fn receive2(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[2\\]."]
#[inline(always)]
pub const fn set_receive2(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[3\\]."]
#[must_use]
#[inline(always)]
pub const fn receive3(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[3\\]."]
#[inline(always)]
pub const fn set_receive3(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[4\\]."]
#[must_use]
#[inline(always)]
pub const fn receive4(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[4\\]."]
#[inline(always)]
pub const fn set_receive4(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[5\\]."]
#[must_use]
#[inline(always)]
pub const fn receive5(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[5\\]."]
#[inline(always)]
pub const fn set_receive5(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[6\\]."]
#[must_use]
#[inline(always)]
pub const fn receive6(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[6\\]."]
#[inline(always)]
pub const fn set_receive6(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[7\\]."]
#[must_use]
#[inline(always)]
pub const fn receive7(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[7\\]."]
#[inline(always)]
pub const fn set_receive7(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[8\\]."]
#[must_use]
#[inline(always)]
pub const fn receive8(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[8\\]."]
#[inline(always)]
pub const fn set_receive8(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[9\\]."]
#[must_use]
#[inline(always)]
pub const fn receive9(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[9\\]."]
#[inline(always)]
pub const fn set_receive9(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[10\\]."]
#[must_use]
#[inline(always)]
pub const fn receive10(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[10\\]."]
#[inline(always)]
pub const fn set_receive10(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[11\\]."]
#[must_use]
#[inline(always)]
pub const fn receive11(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[11\\]."]
#[inline(always)]
pub const fn set_receive11(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[12\\]."]
#[must_use]
#[inline(always)]
pub const fn receive12(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[12\\]."]
#[inline(always)]
pub const fn set_receive12(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[13\\]."]
#[must_use]
#[inline(always)]
pub const fn receive13(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[13\\]."]
#[inline(always)]
pub const fn set_receive13(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[14\\]."]
#[must_use]
#[inline(always)]
pub const fn receive14(&self) -> bool {
let val = (self.0 >> 14usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[14\\]."]
#[inline(always)]
pub const fn set_receive14(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[15\\]."]
#[must_use]
#[inline(always)]
pub const fn receive15(&self) -> bool {
let val = (self.0 >> 15usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RECEIVE\\[15\\]."]
#[inline(always)]
pub const fn set_receive15(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("receive0", &self.receive0())
.field("receive1", &self.receive1())
.field("receive2", &self.receive2())
.field("receive3", &self.receive3())
.field("receive4", &self.receive4())
.field("receive5", &self.receive5())
.field("receive6", &self.receive6())
.field("receive7", &self.receive7())
.field("receive8", &self.receive8())
.field("receive9", &self.receive9())
.field("receive10", &self.receive10())
.field("receive11", &self.receive11())
.field("receive12", &self.receive12())
.field("receive13", &self.receive13())
.field("receive14", &self.receive14())
.field("receive15", &self.receive15())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Int {{ receive0: {=bool:?}, receive1: {=bool:?}, receive2: {=bool:?}, receive3: {=bool:?}, receive4: {=bool:?}, receive5: {=bool:?}, receive6: {=bool:?}, receive7: {=bool:?}, receive8: {=bool:?}, receive9: {=bool:?}, receive10: {=bool:?}, receive11: {=bool:?}, receive12: {=bool:?}, receive13: {=bool:?}, receive14: {=bool:?}, receive15: {=bool:?} }}" , self . receive0 () , self . receive1 () , self . receive2 () , self . receive3 () , self . receive4 () , self . receive5 () , self . receive6 () , self . receive7 () , self . receive8 () , self . receive9 () , self . receive10 () , self . receive11 () , self . receive12 () , self . receive13 () , self . receive14 () , self . receive15 ())
}
}
#[doc = "Description collection: Receive event configuration for EVENTS_RECEIVE\\[n\\]."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct ReceiveCnf(pub u32);
impl ReceiveCnf {
#[doc = "Enable subscription to IPC channel 0."]
#[must_use]
#[inline(always)]
pub const fn chen0(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable subscription to IPC channel 0."]
#[inline(always)]
pub const fn set_chen0(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Enable subscription to IPC channel 1."]
#[must_use]
#[inline(always)]
pub const fn chen1(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enable subscription to IPC channel 1."]
#[inline(always)]
pub const fn set_chen1(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enable subscription to IPC channel 2."]
#[must_use]
#[inline(always)]
pub const fn chen2(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Enable subscription to IPC channel 2."]
#[inline(always)]
pub const fn set_chen2(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Enable subscription to IPC channel 3."]
#[must_use]
#[inline(always)]
pub const fn chen3(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Enable subscription to IPC channel 3."]
#[inline(always)]
pub const fn set_chen3(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Enable subscription to IPC channel 4."]
#[must_use]
#[inline(always)]
pub const fn chen4(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Enable subscription to IPC channel 4."]
#[inline(always)]
pub const fn set_chen4(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Enable subscription to IPC channel 5."]
#[must_use]
#[inline(always)]
pub const fn chen5(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Enable subscription to IPC channel 5."]
#[inline(always)]
pub const fn set_chen5(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Enable subscription to IPC channel 6."]
#[must_use]
#[inline(always)]
pub const fn chen6(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Enable subscription to IPC channel 6."]
#[inline(always)]
pub const fn set_chen6(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "Enable subscription to IPC channel 7."]
#[must_use]
#[inline(always)]
pub const fn chen7(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Enable subscription to IPC channel 7."]
#[inline(always)]
pub const fn set_chen7(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Enable subscription to IPC channel 8."]
#[must_use]
#[inline(always)]
pub const fn chen8(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Enable subscription to IPC channel 8."]
#[inline(always)]
pub const fn set_chen8(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "Enable subscription to IPC channel 9."]
#[must_use]
#[inline(always)]
pub const fn chen9(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Enable subscription to IPC channel 9."]
#[inline(always)]
pub const fn set_chen9(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Enable subscription to IPC channel 10."]
#[must_use]
#[inline(always)]
pub const fn chen10(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "Enable subscription to IPC channel 10."]
#[inline(always)]
pub const fn set_chen10(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[doc = "Enable subscription to IPC channel 11."]
#[must_use]
#[inline(always)]
pub const fn chen11(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "Enable subscription to IPC channel 11."]
#[inline(always)]
pub const fn set_chen11(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "Enable subscription to IPC channel 12."]
#[must_use]
#[inline(always)]
pub const fn chen12(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "Enable subscription to IPC channel 12."]
#[inline(always)]
pub const fn set_chen12(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "Enable subscription to IPC channel 13."]
#[must_use]
#[inline(always)]
pub const fn chen13(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "Enable subscription to IPC channel 13."]
#[inline(always)]
pub const fn set_chen13(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "Enable subscription to IPC channel 14."]
#[must_use]
#[inline(always)]
pub const fn chen14(&self) -> bool {
let val = (self.0 >> 14usize) & 0x01;
val != 0
}
#[doc = "Enable subscription to IPC channel 14."]
#[inline(always)]
pub const fn set_chen14(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
}
#[doc = "Enable subscription to IPC channel 15."]
#[must_use]
#[inline(always)]
pub const fn chen15(&self) -> bool {
let val = (self.0 >> 15usize) & 0x01;
val != 0
}
#[doc = "Enable subscription to IPC channel 15."]
#[inline(always)]
pub const fn set_chen15(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
}
}
impl Default for ReceiveCnf {
#[inline(always)]
fn default() -> ReceiveCnf {
ReceiveCnf(0)
}
}
impl core::fmt::Debug for ReceiveCnf {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("ReceiveCnf")
.field("chen0", &self.chen0())
.field("chen1", &self.chen1())
.field("chen2", &self.chen2())
.field("chen3", &self.chen3())
.field("chen4", &self.chen4())
.field("chen5", &self.chen5())
.field("chen6", &self.chen6())
.field("chen7", &self.chen7())
.field("chen8", &self.chen8())
.field("chen9", &self.chen9())
.field("chen10", &self.chen10())
.field("chen11", &self.chen11())
.field("chen12", &self.chen12())
.field("chen13", &self.chen13())
.field("chen14", &self.chen14())
.field("chen15", &self.chen15())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for ReceiveCnf {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "ReceiveCnf {{ chen0: {=bool:?}, chen1: {=bool:?}, chen2: {=bool:?}, chen3: {=bool:?}, chen4: {=bool:?}, chen5: {=bool:?}, chen6: {=bool:?}, chen7: {=bool:?}, chen8: {=bool:?}, chen9: {=bool:?}, chen10: {=bool:?}, chen11: {=bool:?}, chen12: {=bool:?}, chen13: {=bool:?}, chen14: {=bool:?}, chen15: {=bool:?} }}" , self . chen0 () , self . chen1 () , self . chen2 () , self . chen3 () , self . chen4 () , self . chen5 () , self . chen6 () , self . chen7 () , self . chen8 () , self . chen9 () , self . chen10 () , self . chen11 () , self . chen12 () , self . chen13 () , self . chen14 () , self . chen15 ())
}
}
#[doc = "Description collection: Send event configuration for TASKS_SEND\\[n\\]."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct SendCnf(pub u32);
impl SendCnf {
#[doc = "Enable broadcasting on IPC channel 0."]
#[must_use]
#[inline(always)]
pub const fn chen0(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable broadcasting on IPC channel 0."]
#[inline(always)]
pub const fn set_chen0(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Enable broadcasting on IPC channel 1."]
#[must_use]
#[inline(always)]
pub const fn chen1(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enable broadcasting on IPC channel 1."]
#[inline(always)]
pub const fn set_chen1(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enable broadcasting on IPC channel 2."]
#[must_use]
#[inline(always)]
pub const fn chen2(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Enable broadcasting on IPC channel 2."]
#[inline(always)]
pub const fn set_chen2(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Enable broadcasting on IPC channel 3."]
#[must_use]
#[inline(always)]
pub const fn chen3(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Enable broadcasting on IPC channel 3."]
#[inline(always)]
pub const fn set_chen3(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Enable broadcasting on IPC channel 4."]
#[must_use]
#[inline(always)]
pub const fn chen4(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Enable broadcasting on IPC channel 4."]
#[inline(always)]
pub const fn set_chen4(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Enable broadcasting on IPC channel 5."]
#[must_use]
#[inline(always)]
pub const fn chen5(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Enable broadcasting on IPC channel 5."]
#[inline(always)]
pub const fn set_chen5(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Enable broadcasting on IPC channel 6."]
#[must_use]
#[inline(always)]
pub const fn chen6(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Enable broadcasting on IPC channel 6."]
#[inline(always)]
pub const fn set_chen6(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "Enable broadcasting on IPC channel 7."]
#[must_use]
#[inline(always)]
pub const fn chen7(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Enable broadcasting on IPC channel 7."]
#[inline(always)]
pub const fn set_chen7(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Enable broadcasting on IPC channel 8."]
#[must_use]
#[inline(always)]
pub const fn chen8(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Enable broadcasting on IPC channel 8."]
#[inline(always)]
pub const fn set_chen8(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "Enable broadcasting on IPC channel 9."]
#[must_use]
#[inline(always)]
pub const fn chen9(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Enable broadcasting on IPC channel 9."]
#[inline(always)]
pub const fn set_chen9(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Enable broadcasting on IPC channel 10."]
#[must_use]
#[inline(always)]
pub const fn chen10(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "Enable broadcasting on IPC channel 10."]
#[inline(always)]
pub const fn set_chen10(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[doc = "Enable broadcasting on IPC channel 11."]
#[must_use]
#[inline(always)]
pub const fn chen11(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "Enable broadcasting on IPC channel 11."]
#[inline(always)]
pub const fn set_chen11(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "Enable broadcasting on IPC channel 12."]
#[must_use]
#[inline(always)]
pub const fn chen12(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "Enable broadcasting on IPC channel 12."]
#[inline(always)]
pub const fn set_chen12(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "Enable broadcasting on IPC channel 13."]
#[must_use]
#[inline(always)]
pub const fn chen13(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "Enable broadcasting on IPC channel 13."]
#[inline(always)]
pub const fn set_chen13(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "Enable broadcasting on IPC channel 14."]
#[must_use]
#[inline(always)]
pub const fn chen14(&self) -> bool {
let val = (self.0 >> 14usize) & 0x01;
val != 0
}
#[doc = "Enable broadcasting on IPC channel 14."]
#[inline(always)]
pub const fn set_chen14(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
}
#[doc = "Enable broadcasting on IPC channel 15."]
#[must_use]
#[inline(always)]
pub const fn chen15(&self) -> bool {
let val = (self.0 >> 15usize) & 0x01;
val != 0
}
#[doc = "Enable broadcasting on IPC channel 15."]
#[inline(always)]
pub const fn set_chen15(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
}
}
impl Default for SendCnf {
#[inline(always)]
fn default() -> SendCnf {
SendCnf(0)
}
}
impl core::fmt::Debug for SendCnf {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("SendCnf")
.field("chen0", &self.chen0())
.field("chen1", &self.chen1())
.field("chen2", &self.chen2())
.field("chen3", &self.chen3())
.field("chen4", &self.chen4())
.field("chen5", &self.chen5())
.field("chen6", &self.chen6())
.field("chen7", &self.chen7())
.field("chen8", &self.chen8())
.field("chen9", &self.chen9())
.field("chen10", &self.chen10())
.field("chen11", &self.chen11())
.field("chen12", &self.chen12())
.field("chen13", &self.chen13())
.field("chen14", &self.chen14())
.field("chen15", &self.chen15())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for SendCnf {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "SendCnf {{ chen0: {=bool:?}, chen1: {=bool:?}, chen2: {=bool:?}, chen3: {=bool:?}, chen4: {=bool:?}, chen5: {=bool:?}, chen6: {=bool:?}, chen7: {=bool:?}, chen8: {=bool:?}, chen9: {=bool:?}, chen10: {=bool:?}, chen11: {=bool:?}, chen12: {=bool:?}, chen13: {=bool:?}, chen14: {=bool:?}, chen15: {=bool:?} }}" , self . chen0 () , self . chen1 () , self . chen2 () , self . chen3 () , self . chen4 () , self . chen5 () , self . chen6 () , self . chen7 () , self . chen8 () , self . chen9 () , self . chen10 () , self . chen11 () , self . chen12 () , self . chen13 () , self . chen14 () , self . chen15 ())
}
}
}
}
pub mod kmu {
#[doc = "Key management unit 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Kmu {
ptr: *mut u8,
}
unsafe impl Send for Kmu {}
unsafe impl Sync for Kmu {}
impl Kmu {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Push a key slot over secure APB."]
#[inline(always)]
pub const fn tasks_push_keyslot(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Key slot successfully pushed over secure APB."]
#[inline(always)]
pub const fn events_keyslot_pushed(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0100usize) as _) }
}
#[doc = "Key slot has been revoked and cannot be tasked for selection."]
#[inline(always)]
pub const fn events_keyslot_revoked(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0104usize) as _) }
}
#[doc = "No key slot selected, no destination address defined, or error during push operation."]
#[inline(always)]
pub const fn events_keyslot_error(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0108usize) as _) }
}
#[doc = "Enable or disable interrupt."]
#[inline(always)]
pub const fn inten(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0300usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "Pending interrupts."]
#[inline(always)]
pub const fn intpend(self) -> crate::common::Reg<regs::Int, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x030cusize) as _) }
}
#[doc = "Status bits for KMU operation."]
#[inline(always)]
pub const fn status(self) -> crate::common::Reg<regs::Status, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x040cusize) as _) }
}
#[doc = "Select key slot to be read over AHB or pushed over secure APB when TASKS_PUSH_KEYSLOT is started."]
#[inline(always)]
pub const fn selectkeyslot(
self,
) -> crate::common::Reg<regs::Selectkeyslot, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0500usize) as _) }
}
}
pub mod regs {
#[doc = "Enable or disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Enable or disable interrupt for event KEYSLOT_PUSHED."]
#[must_use]
#[inline(always)]
pub const fn keyslot_pushed(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event KEYSLOT_PUSHED."]
#[inline(always)]
pub const fn set_keyslot_pushed(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Enable or disable interrupt for event KEYSLOT_REVOKED."]
#[must_use]
#[inline(always)]
pub const fn keyslot_revoked(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event KEYSLOT_REVOKED."]
#[inline(always)]
pub const fn set_keyslot_revoked(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enable or disable interrupt for event KEYSLOT_ERROR."]
#[must_use]
#[inline(always)]
pub const fn keyslot_error(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event KEYSLOT_ERROR."]
#[inline(always)]
pub const fn set_keyslot_error(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("keyslot_pushed", &self.keyslot_pushed())
.field("keyslot_revoked", &self.keyslot_revoked())
.field("keyslot_error", &self.keyslot_error())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Int {{ keyslot_pushed: {=bool:?}, keyslot_revoked: {=bool:?}, keyslot_error: {=bool:?} }}" , self . keyslot_pushed () , self . keyslot_revoked () , self . keyslot_error ())
}
}
#[doc = "Select key slot to be read over AHB or pushed over secure APB when TASKS_PUSH_KEYSLOT is started."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Selectkeyslot(pub u32);
impl Selectkeyslot {
#[doc = "Select key slot ID to be read over AHB, or pushed over secure APB, when TASKS_PUSH_KEYSLOT is started. NOTE: ID=0 is not a valid key slot ID. The 0 ID should be used when the KMU is idle or not in use. NOTE: Index N in UICR->KEYSLOT.KEY\\[N\\] and UICR->KEYSLOT.CONFIG\\[N\\] corresponds to KMU key slot ID=N+1."]
#[must_use]
#[inline(always)]
pub const fn id(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Select key slot ID to be read over AHB, or pushed over secure APB, when TASKS_PUSH_KEYSLOT is started. NOTE: ID=0 is not a valid key slot ID. The 0 ID should be used when the KMU is idle or not in use. NOTE: Index N in UICR->KEYSLOT.KEY\\[N\\] and UICR->KEYSLOT.CONFIG\\[N\\] corresponds to KMU key slot ID=N+1."]
#[inline(always)]
pub const fn set_id(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for Selectkeyslot {
#[inline(always)]
fn default() -> Selectkeyslot {
Selectkeyslot(0)
}
}
impl core::fmt::Debug for Selectkeyslot {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Selectkeyslot")
.field("id", &self.id())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Selectkeyslot {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Selectkeyslot {{ id: {=u8:?} }}", self.id())
}
}
#[doc = "Status bits for KMU operation."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Status(pub u32);
impl Status {
#[doc = "Key slot ID successfully selected by the KMU."]
#[must_use]
#[inline(always)]
pub const fn selected(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Key slot ID successfully selected by the KMU."]
#[inline(always)]
pub const fn set_selected(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Violation status."]
#[must_use]
#[inline(always)]
pub const fn blocked(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Violation status."]
#[inline(always)]
pub const fn set_blocked(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
}
impl Default for Status {
#[inline(always)]
fn default() -> Status {
Status(0)
}
}
impl core::fmt::Debug for Status {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Status")
.field("selected", &self.selected())
.field("blocked", &self.blocked())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Status {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Status {{ selected: {=bool:?}, blocked: {=bool:?} }}",
self.selected(),
self.blocked()
)
}
}
}
}
pub mod lpcomp {
#[doc = "Low-power comparator 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Lpcomp {
ptr: *mut u8,
}
unsafe impl Send for Lpcomp {}
unsafe impl Sync for Lpcomp {}
impl Lpcomp {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Start comparator."]
#[inline(always)]
pub const fn tasks_start(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Stop comparator."]
#[inline(always)]
pub const fn tasks_stop(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Sample comparator value."]
#[inline(always)]
pub const fn tasks_sample(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Subscribe configuration for task START."]
#[inline(always)]
pub const fn subscribe_start(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x80usize) as _) }
}
#[doc = "Subscribe configuration for task STOP."]
#[inline(always)]
pub const fn subscribe_stop(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x84usize) as _) }
}
#[doc = "Subscribe configuration for task SAMPLE."]
#[inline(always)]
pub const fn subscribe_sample(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x88usize) as _) }
}
#[doc = "LPCOMP is ready and output is valid."]
#[inline(always)]
pub const fn events_ready(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0100usize) as _) }
}
#[doc = "Downward crossing."]
#[inline(always)]
pub const fn events_down(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0104usize) as _) }
}
#[doc = "Upward crossing."]
#[inline(always)]
pub const fn events_up(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0108usize) as _) }
}
#[doc = "Downward or upward crossing."]
#[inline(always)]
pub const fn events_cross(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x010cusize) as _) }
}
#[doc = "Publish configuration for event READY."]
#[inline(always)]
pub const fn publish_ready(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0180usize) as _) }
}
#[doc = "Publish configuration for event DOWN."]
#[inline(always)]
pub const fn publish_down(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0184usize) as _) }
}
#[doc = "Publish configuration for event UP."]
#[inline(always)]
pub const fn publish_up(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0188usize) as _) }
}
#[doc = "Publish configuration for event CROSS."]
#[inline(always)]
pub const fn publish_cross(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x018cusize) as _) }
}
#[doc = "Shortcuts between local events and tasks."]
#[inline(always)]
pub const fn shorts(self) -> crate::common::Reg<regs::Shorts, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0200usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "Compare result."]
#[inline(always)]
pub const fn result(self) -> crate::common::Reg<regs::Result, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0400usize) as _) }
}
#[doc = "Enable LPCOMP."]
#[inline(always)]
pub const fn enable(self) -> crate::common::Reg<regs::Enable, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0500usize) as _) }
}
#[doc = "Input pin select."]
#[inline(always)]
pub const fn psel(self) -> crate::common::Reg<regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0504usize) as _) }
}
#[doc = "Reference select."]
#[inline(always)]
pub const fn refsel(self) -> crate::common::Reg<regs::Refsel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0508usize) as _) }
}
#[doc = "External reference select."]
#[inline(always)]
pub const fn extrefsel(self) -> crate::common::Reg<regs::Extrefsel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x050cusize) as _) }
}
#[doc = "Analog detect configuration."]
#[inline(always)]
pub const fn anadetect(self) -> crate::common::Reg<regs::Anadetect, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0520usize) as _) }
}
#[doc = "Comparator hysteresis enable."]
#[inline(always)]
pub const fn hyst(self) -> crate::common::Reg<regs::Hyst, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0538usize) as _) }
}
}
pub mod regs {
#[doc = "Analog detect configuration."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Anadetect(pub u32);
impl Anadetect {
#[doc = "Analog detect configuration."]
#[must_use]
#[inline(always)]
pub const fn anadetect(&self) -> super::vals::Anadetect {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Anadetect::from_bits(val as u8)
}
#[doc = "Analog detect configuration."]
#[inline(always)]
pub const fn set_anadetect(&mut self, val: super::vals::Anadetect) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for Anadetect {
#[inline(always)]
fn default() -> Anadetect {
Anadetect(0)
}
}
impl core::fmt::Debug for Anadetect {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Anadetect")
.field("anadetect", &self.anadetect())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Anadetect {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Anadetect {{ anadetect: {:?} }}", self.anadetect())
}
}
#[doc = "Enable LPCOMP."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Enable(pub u32);
impl Enable {
#[doc = "Enable or disable LPCOMP."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> super::vals::Enable {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Enable::from_bits(val as u8)
}
#[doc = "Enable or disable LPCOMP."]
#[inline(always)]
pub const fn set_enable(&mut self, val: super::vals::Enable) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for Enable {
#[inline(always)]
fn default() -> Enable {
Enable(0)
}
}
impl core::fmt::Debug for Enable {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Enable")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Enable {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Enable {{ enable: {:?} }}", self.enable())
}
}
#[doc = "External reference select."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Extrefsel(pub u32);
impl Extrefsel {
#[doc = "External analog reference select."]
#[must_use]
#[inline(always)]
pub const fn extrefsel(&self) -> super::vals::Extrefsel {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Extrefsel::from_bits(val as u8)
}
#[doc = "External analog reference select."]
#[inline(always)]
pub const fn set_extrefsel(&mut self, val: super::vals::Extrefsel) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Extrefsel {
#[inline(always)]
fn default() -> Extrefsel {
Extrefsel(0)
}
}
impl core::fmt::Debug for Extrefsel {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Extrefsel")
.field("extrefsel", &self.extrefsel())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Extrefsel {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Extrefsel {{ extrefsel: {:?} }}", self.extrefsel())
}
}
#[doc = "Comparator hysteresis enable."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Hyst(pub u32);
impl Hyst {
#[doc = "Comparator hysteresis enable."]
#[must_use]
#[inline(always)]
pub const fn hyst(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Comparator hysteresis enable."]
#[inline(always)]
pub const fn set_hyst(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Hyst {
#[inline(always)]
fn default() -> Hyst {
Hyst(0)
}
}
impl core::fmt::Debug for Hyst {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Hyst").field("hyst", &self.hyst()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Hyst {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Hyst {{ hyst: {=bool:?} }}", self.hyst())
}
}
#[doc = "Disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Write '1' to disable interrupt for event READY."]
#[must_use]
#[inline(always)]
pub const fn ready(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event READY."]
#[inline(always)]
pub const fn set_ready(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Write '1' to disable interrupt for event DOWN."]
#[must_use]
#[inline(always)]
pub const fn down(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event DOWN."]
#[inline(always)]
pub const fn set_down(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Write '1' to disable interrupt for event UP."]
#[must_use]
#[inline(always)]
pub const fn up(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event UP."]
#[inline(always)]
pub const fn set_up(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Write '1' to disable interrupt for event CROSS."]
#[must_use]
#[inline(always)]
pub const fn cross(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event CROSS."]
#[inline(always)]
pub const fn set_cross(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("ready", &self.ready())
.field("down", &self.down())
.field("up", &self.up())
.field("cross", &self.cross())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Int {{ ready: {=bool:?}, down: {=bool:?}, up: {=bool:?}, cross: {=bool:?} }}",
self.ready(),
self.down(),
self.up(),
self.cross()
)
}
}
#[doc = "Input pin select."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Psel(pub u32);
impl Psel {
#[doc = "Analog pin select."]
#[must_use]
#[inline(always)]
pub const fn psel(&self) -> super::vals::PselPsel {
let val = (self.0 >> 0usize) & 0x07;
super::vals::PselPsel::from_bits(val as u8)
}
#[doc = "Analog pin select."]
#[inline(always)]
pub const fn set_psel(&mut self, val: super::vals::PselPsel) {
self.0 = (self.0 & !(0x07 << 0usize)) | (((val.to_bits() as u32) & 0x07) << 0usize);
}
}
impl Default for Psel {
#[inline(always)]
fn default() -> Psel {
Psel(0)
}
}
impl core::fmt::Debug for Psel {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Psel").field("psel", &self.psel()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Psel {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Psel {{ psel: {:?} }}", self.psel())
}
}
#[doc = "Reference select."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Refsel(pub u32);
impl Refsel {
#[doc = "Reference select."]
#[must_use]
#[inline(always)]
pub const fn refsel(&self) -> super::vals::Refsel {
let val = (self.0 >> 0usize) & 0x0f;
super::vals::Refsel::from_bits(val as u8)
}
#[doc = "Reference select."]
#[inline(always)]
pub const fn set_refsel(&mut self, val: super::vals::Refsel) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val.to_bits() as u32) & 0x0f) << 0usize);
}
}
impl Default for Refsel {
#[inline(always)]
fn default() -> Refsel {
Refsel(0)
}
}
impl core::fmt::Debug for Refsel {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Refsel")
.field("refsel", &self.refsel())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Refsel {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Refsel {{ refsel: {:?} }}", self.refsel())
}
}
#[doc = "Compare result."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Result(pub u32);
impl Result {
#[doc = "Result of last compare. Decision point SAMPLE task."]
#[must_use]
#[inline(always)]
pub const fn result(&self) -> super::vals::Result {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Result::from_bits(val as u8)
}
#[doc = "Result of last compare. Decision point SAMPLE task."]
#[inline(always)]
pub const fn set_result(&mut self, val: super::vals::Result) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Result {
#[inline(always)]
fn default() -> Result {
Result(0)
}
}
impl core::fmt::Debug for Result {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Result")
.field("result", &self.result())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Result {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Result {{ result: {:?} }}", self.result())
}
}
#[doc = "Shortcuts between local events and tasks."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Shorts(pub u32);
impl Shorts {
#[doc = "Shortcut between event READY and task SAMPLE."]
#[must_use]
#[inline(always)]
pub const fn ready_sample(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event READY and task SAMPLE."]
#[inline(always)]
pub const fn set_ready_sample(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Shortcut between event READY and task STOP."]
#[must_use]
#[inline(always)]
pub const fn ready_stop(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event READY and task STOP."]
#[inline(always)]
pub const fn set_ready_stop(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Shortcut between event DOWN and task STOP."]
#[must_use]
#[inline(always)]
pub const fn down_stop(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event DOWN and task STOP."]
#[inline(always)]
pub const fn set_down_stop(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Shortcut between event UP and task STOP."]
#[must_use]
#[inline(always)]
pub const fn up_stop(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event UP and task STOP."]
#[inline(always)]
pub const fn set_up_stop(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Shortcut between event CROSS and task STOP."]
#[must_use]
#[inline(always)]
pub const fn cross_stop(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event CROSS and task STOP."]
#[inline(always)]
pub const fn set_cross_stop(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
}
impl Default for Shorts {
#[inline(always)]
fn default() -> Shorts {
Shorts(0)
}
}
impl core::fmt::Debug for Shorts {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Shorts")
.field("ready_sample", &self.ready_sample())
.field("ready_stop", &self.ready_stop())
.field("down_stop", &self.down_stop())
.field("up_stop", &self.up_stop())
.field("cross_stop", &self.cross_stop())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Shorts {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Shorts {{ ready_sample: {=bool:?}, ready_stop: {=bool:?}, down_stop: {=bool:?}, up_stop: {=bool:?}, cross_stop: {=bool:?} }}" , self . ready_sample () , self . ready_stop () , self . down_stop () , self . up_stop () , self . cross_stop ())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Anadetect {
#[doc = "Generate ANADETECT on crossing, both upward crossing and downward crossing."]
Cross = 0x0,
#[doc = "Generate ANADETECT on upward crossing only."]
Up = 0x01,
#[doc = "Generate ANADETECT on downward crossing only."]
Down = 0x02,
_RESERVED_3 = 0x03,
}
impl Anadetect {
#[inline(always)]
pub const fn from_bits(val: u8) -> Anadetect {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Anadetect {
#[inline(always)]
fn from(val: u8) -> Anadetect {
Anadetect::from_bits(val)
}
}
impl From<Anadetect> for u8 {
#[inline(always)]
fn from(val: Anadetect) -> u8 {
Anadetect::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Enable {
#[doc = "Disable."]
Disabled = 0x0,
#[doc = "Enable."]
Enabled = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
}
impl Enable {
#[inline(always)]
pub const fn from_bits(val: u8) -> Enable {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Enable {
#[inline(always)]
fn from(val: u8) -> Enable {
Enable::from_bits(val)
}
}
impl From<Enable> for u8 {
#[inline(always)]
fn from(val: Enable) -> u8 {
Enable::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Extrefsel {
#[doc = "Use AIN0 as external analog reference."]
AnalogReference0 = 0x0,
#[doc = "Use AIN1 as external analog reference."]
AnalogReference1 = 0x01,
}
impl Extrefsel {
#[inline(always)]
pub const fn from_bits(val: u8) -> Extrefsel {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Extrefsel {
#[inline(always)]
fn from(val: u8) -> Extrefsel {
Extrefsel::from_bits(val)
}
}
impl From<Extrefsel> for u8 {
#[inline(always)]
fn from(val: Extrefsel) -> u8 {
Extrefsel::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum PselPsel {
#[doc = "AIN0 selected as analog input."]
AnalogInput0 = 0x0,
#[doc = "AIN1 selected as analog input."]
AnalogInput1 = 0x01,
#[doc = "AIN2 selected as analog input."]
AnalogInput2 = 0x02,
#[doc = "AIN3 selected as analog input."]
AnalogInput3 = 0x03,
#[doc = "AIN4 selected as analog input."]
AnalogInput4 = 0x04,
#[doc = "AIN5 selected as analog input."]
AnalogInput5 = 0x05,
#[doc = "AIN6 selected as analog input."]
AnalogInput6 = 0x06,
#[doc = "AIN7 selected as analog input."]
AnalogInput7 = 0x07,
}
impl PselPsel {
#[inline(always)]
pub const fn from_bits(val: u8) -> PselPsel {
unsafe { core::mem::transmute(val & 0x07) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for PselPsel {
#[inline(always)]
fn from(val: u8) -> PselPsel {
PselPsel::from_bits(val)
}
}
impl From<PselPsel> for u8 {
#[inline(always)]
fn from(val: PselPsel) -> u8 {
PselPsel::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Refsel {
#[doc = "VDD * 1/8 selected as reference."]
Ref18vdd = 0x0,
#[doc = "VDD * 2/8 selected as reference."]
Ref28vdd = 0x01,
#[doc = "VDD * 3/8 selected as reference."]
Ref38vdd = 0x02,
#[doc = "VDD * 4/8 selected as reference."]
Ref48vdd = 0x03,
#[doc = "VDD * 5/8 selected as reference."]
Ref58vdd = 0x04,
#[doc = "VDD * 6/8 selected as reference."]
Ref68vdd = 0x05,
#[doc = "VDD * 7/8 selected as reference."]
Ref78vdd = 0x06,
#[doc = "External analog reference selected."]
ARef = 0x07,
#[doc = "VDD * 1/16 selected as reference."]
Ref116vdd = 0x08,
#[doc = "VDD * 3/16 selected as reference."]
Ref316vdd = 0x09,
#[doc = "VDD * 5/16 selected as reference."]
Ref516vdd = 0x0a,
#[doc = "VDD * 7/16 selected as reference."]
Ref716vdd = 0x0b,
#[doc = "VDD * 9/16 selected as reference."]
Ref916vdd = 0x0c,
#[doc = "VDD * 11/16 selected as reference."]
Ref1116vdd = 0x0d,
#[doc = "VDD * 13/16 selected as reference."]
Ref1316vdd = 0x0e,
#[doc = "VDD * 15/16 selected as reference."]
Ref1516vdd = 0x0f,
}
impl Refsel {
#[inline(always)]
pub const fn from_bits(val: u8) -> Refsel {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Refsel {
#[inline(always)]
fn from(val: u8) -> Refsel {
Refsel::from_bits(val)
}
}
impl From<Refsel> for u8 {
#[inline(always)]
fn from(val: Refsel) -> u8 {
Refsel::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Result {
#[doc = "Input voltage is below the reference threshold (VIN+ < VIN-)."]
Below = 0x0,
#[doc = "Input voltage is above the reference threshold (VIN+ > VIN-)."]
Above = 0x01,
}
impl Result {
#[inline(always)]
pub const fn from_bits(val: u8) -> Result {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Result {
#[inline(always)]
fn from(val: u8) -> Result {
Result::from_bits(val)
}
}
impl From<Result> for u8 {
#[inline(always)]
fn from(val: Result) -> u8 {
Result::to_bits(val)
}
}
}
}
pub mod mutex {
#[doc = "MUTEX 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Mutex {
ptr: *mut u8,
}
unsafe impl Send for Mutex {}
unsafe impl Sync for Mutex {}
impl Mutex {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description collection: Mutex register."]
#[inline(always)]
pub const fn mutex(self, n: usize) -> crate::common::Reg<regs::Mutex, crate::common::RW> {
assert!(n < 16usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0400usize + n * 4usize) as _)
}
}
}
pub mod regs {
#[doc = "Description collection: Mutex register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Mutex(pub u32);
impl Mutex {
#[doc = "Mutex register n."]
#[must_use]
#[inline(always)]
pub const fn mutex(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Mutex register n."]
#[inline(always)]
pub const fn set_mutex(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Mutex {
#[inline(always)]
fn default() -> Mutex {
Mutex(0)
}
}
impl core::fmt::Debug for Mutex {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Mutex")
.field("mutex", &self.mutex())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Mutex {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Mutex {{ mutex: {=bool:?} }}", self.mutex())
}
}
}
}
pub mod nfct {
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Framestatus {
ptr: *mut u8,
}
unsafe impl Send for Framestatus {}
unsafe impl Sync for Framestatus {}
impl Framestatus {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Result of last incoming frame."]
#[inline(always)]
pub const fn rx(self) -> crate::common::Reg<regs::Rx, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
}
#[doc = "NFC-A compatible radio 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Nfct {
ptr: *mut u8,
}
unsafe impl Send for Nfct {}
unsafe impl Sync for Nfct {}
impl Nfct {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Activate NFCT peripheral for incoming and outgoing frames, change state to activated."]
#[inline(always)]
pub const fn tasks_activate(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Disable NFCT peripheral."]
#[inline(always)]
pub const fn tasks_disable(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Enable NFC sense field mode, change state to sense mode."]
#[inline(always)]
pub const fn tasks_sense(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Start transmission of an outgoing frame, change state to transmit."]
#[inline(always)]
pub const fn tasks_starttx(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
#[doc = "Initializes the EasyDMA for receive."]
#[inline(always)]
pub const fn tasks_enablerxdata(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x1cusize) as _) }
}
#[doc = "Force state machine to IDLE state."]
#[inline(always)]
pub const fn tasks_goidle(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x24usize) as _) }
}
#[doc = "Force state machine to SLEEP_A state."]
#[inline(always)]
pub const fn tasks_gosleep(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x28usize) as _) }
}
#[doc = "Subscribe configuration for task ACTIVATE."]
#[inline(always)]
pub const fn subscribe_activate(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x80usize) as _) }
}
#[doc = "Subscribe configuration for task DISABLE."]
#[inline(always)]
pub const fn subscribe_disable(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x84usize) as _) }
}
#[doc = "Subscribe configuration for task SENSE."]
#[inline(always)]
pub const fn subscribe_sense(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x88usize) as _) }
}
#[doc = "Subscribe configuration for task STARTTX."]
#[inline(always)]
pub const fn subscribe_starttx(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x8cusize) as _) }
}
#[doc = "Subscribe configuration for task ENABLERXDATA."]
#[inline(always)]
pub const fn subscribe_enablerxdata(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x9cusize) as _) }
}
#[doc = "Subscribe configuration for task GOIDLE."]
#[inline(always)]
pub const fn subscribe_goidle(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xa4usize) as _) }
}
#[doc = "Subscribe configuration for task GOSLEEP."]
#[inline(always)]
pub const fn subscribe_gosleep(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xa8usize) as _) }
}
#[doc = "The NFCT peripheral is ready to receive and send frames."]
#[inline(always)]
pub const fn events_ready(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0100usize) as _) }
}
#[doc = "Remote NFC field detected."]
#[inline(always)]
pub const fn events_fielddetected(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0104usize) as _) }
}
#[doc = "Remote NFC field lost."]
#[inline(always)]
pub const fn events_fieldlost(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0108usize) as _) }
}
#[doc = "Marks the start of the first symbol of a transmitted frame."]
#[inline(always)]
pub const fn events_txframestart(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x010cusize) as _) }
}
#[doc = "Marks the end of the last transmitted on-air symbol of a frame."]
#[inline(always)]
pub const fn events_txframeend(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0110usize) as _) }
}
#[doc = "Marks the end of the first symbol of a received frame."]
#[inline(always)]
pub const fn events_rxframestart(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0114usize) as _) }
}
#[doc = "Received data has been checked (CRC, parity) and transferred to RAM, and EasyDMA has ended accessing the RX buffer."]
#[inline(always)]
pub const fn events_rxframeend(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0118usize) as _) }
}
#[doc = "NFC error reported. The ERRORSTATUS register contains details on the source of the error."]
#[inline(always)]
pub const fn events_error(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x011cusize) as _) }
}
#[doc = "NFC RX frame error reported. The FRAMESTATUS.RX register contains details on the source of the error."]
#[inline(always)]
pub const fn events_rxerror(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0128usize) as _) }
}
#[doc = "RX buffer (as defined by PACKETPTR and MAXLEN) in Data RAM full."]
#[inline(always)]
pub const fn events_endrx(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x012cusize) as _) }
}
#[doc = "Transmission of data in RAM has ended, and EasyDMA has ended accessing the TX buffer."]
#[inline(always)]
pub const fn events_endtx(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0130usize) as _) }
}
#[doc = "Auto collision resolution process has started."]
#[inline(always)]
pub const fn events_autocolresstarted(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0138usize) as _) }
}
#[doc = "NFC auto collision resolution error reported."]
#[inline(always)]
pub const fn events_collision(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0148usize) as _) }
}
#[doc = "NFC auto collision resolution successfully completed."]
#[inline(always)]
pub const fn events_selected(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x014cusize) as _) }
}
#[doc = "EasyDMA is ready to receive or send frames."]
#[inline(always)]
pub const fn events_started(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0150usize) as _) }
}
#[doc = "Publish configuration for event READY."]
#[inline(always)]
pub const fn publish_ready(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0180usize) as _) }
}
#[doc = "Publish configuration for event FIELDDETECTED."]
#[inline(always)]
pub const fn publish_fielddetected(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0184usize) as _) }
}
#[doc = "Publish configuration for event FIELDLOST."]
#[inline(always)]
pub const fn publish_fieldlost(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0188usize) as _) }
}
#[doc = "Publish configuration for event TXFRAMESTART."]
#[inline(always)]
pub const fn publish_txframestart(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x018cusize) as _) }
}
#[doc = "Publish configuration for event TXFRAMEEND."]
#[inline(always)]
pub const fn publish_txframeend(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0190usize) as _) }
}
#[doc = "Publish configuration for event RXFRAMESTART."]
#[inline(always)]
pub const fn publish_rxframestart(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0194usize) as _) }
}
#[doc = "Publish configuration for event RXFRAMEEND."]
#[inline(always)]
pub const fn publish_rxframeend(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0198usize) as _) }
}
#[doc = "Publish configuration for event ERROR."]
#[inline(always)]
pub const fn publish_error(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x019cusize) as _) }
}
#[doc = "Publish configuration for event RXERROR."]
#[inline(always)]
pub const fn publish_rxerror(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01a8usize) as _) }
}
#[doc = "Publish configuration for event ENDRX."]
#[inline(always)]
pub const fn publish_endrx(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01acusize) as _) }
}
#[doc = "Publish configuration for event ENDTX."]
#[inline(always)]
pub const fn publish_endtx(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01b0usize) as _) }
}
#[doc = "Publish configuration for event AUTOCOLRESSTARTED."]
#[inline(always)]
pub const fn publish_autocolresstarted(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01b8usize) as _) }
}
#[doc = "Publish configuration for event COLLISION."]
#[inline(always)]
pub const fn publish_collision(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01c8usize) as _) }
}
#[doc = "Publish configuration for event SELECTED."]
#[inline(always)]
pub const fn publish_selected(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01ccusize) as _) }
}
#[doc = "Publish configuration for event STARTED."]
#[inline(always)]
pub const fn publish_started(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01d0usize) as _) }
}
#[doc = "Shortcuts between local events and tasks."]
#[inline(always)]
pub const fn shorts(self) -> crate::common::Reg<regs::Shorts, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0200usize) as _) }
}
#[doc = "Enable or disable interrupt."]
#[inline(always)]
pub const fn inten(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0300usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "NFC Error Status register."]
#[inline(always)]
pub const fn errorstatus(self) -> crate::common::Reg<regs::Errorstatus, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0404usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn framestatus(self) -> Framestatus {
unsafe { Framestatus::from_ptr(self.ptr.wrapping_add(0x040cusize) as _) }
}
#[doc = "Current operating state of NFC tag."]
#[inline(always)]
pub const fn nfctagstate(self) -> crate::common::Reg<regs::Nfctagstate, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0410usize) as _) }
}
#[doc = "Sleep state during automatic collision resolution."]
#[inline(always)]
pub const fn sleepstate(self) -> crate::common::Reg<regs::Sleepstate, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0420usize) as _) }
}
#[doc = "Indicates the presence or not of a valid field."]
#[inline(always)]
pub const fn fieldpresent(
self,
) -> crate::common::Reg<regs::Fieldpresent, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x043cusize) as _) }
}
#[doc = "Minimum frame delay."]
#[inline(always)]
pub const fn framedelaymin(
self,
) -> crate::common::Reg<regs::Framedelaymin, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0504usize) as _) }
}
#[doc = "Maximum frame delay."]
#[inline(always)]
pub const fn framedelaymax(
self,
) -> crate::common::Reg<regs::Framedelaymax, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0508usize) as _) }
}
#[doc = "Configuration register for the Frame Delay Timer."]
#[inline(always)]
pub const fn framedelaymode(
self,
) -> crate::common::Reg<regs::Framedelaymode, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x050cusize) as _) }
}
#[doc = "Packet pointer for TXD and RXD data storage in Data RAM."]
#[inline(always)]
pub const fn packetptr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0510usize) as _) }
}
#[doc = "Size of the RAM buffer allocated to TXD and RXD data storage each."]
#[inline(always)]
pub const fn maxlen(self) -> crate::common::Reg<regs::Maxlen, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0514usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn txd(self) -> Txd {
unsafe { Txd::from_ptr(self.ptr.wrapping_add(0x0518usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn rxd(self) -> Rxd {
unsafe { Rxd::from_ptr(self.ptr.wrapping_add(0x0520usize) as _) }
}
#[doc = "Enables the modulation output to a GPIO pin which can be connected to a second external antenna."]
#[inline(always)]
pub const fn modulationctrl(
self,
) -> crate::common::Reg<regs::Modulationctrl, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x052cusize) as _) }
}
#[doc = "Pin select for Modulation control."]
#[inline(always)]
pub const fn modulationpsel(
self,
) -> crate::common::Reg<regs::Modulationpsel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0538usize) as _) }
}
#[doc = "Last NFCID1 part (4, 7 or 10 bytes ID)."]
#[inline(always)]
pub const fn nfcid1_last(self) -> crate::common::Reg<regs::Nfcid1Last, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0590usize) as _) }
}
#[doc = "Second last NFCID1 part (7 or 10 bytes ID)."]
#[inline(always)]
pub const fn nfcid1_2nd_last(
self,
) -> crate::common::Reg<regs::Nfcid12ndLast, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0594usize) as _) }
}
#[doc = "Third last NFCID1 part (10 bytes ID)."]
#[inline(always)]
pub const fn nfcid1_3rd_last(
self,
) -> crate::common::Reg<regs::Nfcid13rdLast, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0598usize) as _) }
}
#[doc = "Controls the auto collision resolution function. This setting must be done before the NFCT peripheral is activated."]
#[inline(always)]
pub const fn autocolresconfig(
self,
) -> crate::common::Reg<regs::Autocolresconfig, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x059cusize) as _) }
}
#[doc = "NFC-A SENS_RES auto-response settings."]
#[inline(always)]
pub const fn sensres(self) -> crate::common::Reg<regs::Sensres, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x05a0usize) as _) }
}
#[doc = "NFC-A SEL_RES auto-response settings."]
#[inline(always)]
pub const fn selres(self) -> crate::common::Reg<regs::Selres, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x05a4usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Rxd {
ptr: *mut u8,
}
unsafe impl Send for Rxd {}
unsafe impl Sync for Rxd {}
impl Rxd {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Configuration of incoming frames."]
#[inline(always)]
pub const fn frameconfig(
self,
) -> crate::common::Reg<regs::RxdFrameconfig, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Size of last incoming frame."]
#[inline(always)]
pub const fn amount(self) -> crate::common::Reg<regs::RxdAmount, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Txd {
ptr: *mut u8,
}
unsafe impl Send for Txd {}
unsafe impl Sync for Txd {}
impl Txd {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Configuration of outgoing frames."]
#[inline(always)]
pub const fn frameconfig(
self,
) -> crate::common::Reg<regs::TxdFrameconfig, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Size of outgoing frame."]
#[inline(always)]
pub const fn amount(self) -> crate::common::Reg<regs::TxdAmount, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
pub mod regs {
#[doc = "Controls the auto collision resolution function. This setting must be done before the NFCT peripheral is activated."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Autocolresconfig(pub u32);
impl Autocolresconfig {
#[doc = "Enables/disables auto collision resolution."]
#[must_use]
#[inline(always)]
pub const fn mode(&self) -> super::vals::Mode {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Mode::from_bits(val as u8)
}
#[doc = "Enables/disables auto collision resolution."]
#[inline(always)]
pub const fn set_mode(&mut self, val: super::vals::Mode) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Autocolresconfig {
#[inline(always)]
fn default() -> Autocolresconfig {
Autocolresconfig(0)
}
}
impl core::fmt::Debug for Autocolresconfig {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Autocolresconfig")
.field("mode", &self.mode())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Autocolresconfig {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Autocolresconfig {{ mode: {:?} }}", self.mode())
}
}
#[doc = "NFC Error Status register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Errorstatus(pub u32);
impl Errorstatus {
#[doc = "No STARTTX task triggered before expiration of the time set in FRAMEDELAYMAX."]
#[must_use]
#[inline(always)]
pub const fn framedelaytimeout(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "No STARTTX task triggered before expiration of the time set in FRAMEDELAYMAX."]
#[inline(always)]
pub const fn set_framedelaytimeout(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Errorstatus {
#[inline(always)]
fn default() -> Errorstatus {
Errorstatus(0)
}
}
impl core::fmt::Debug for Errorstatus {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Errorstatus")
.field("framedelaytimeout", &self.framedelaytimeout())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Errorstatus {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Errorstatus {{ framedelaytimeout: {=bool:?} }}",
self.framedelaytimeout()
)
}
}
#[doc = "Indicates the presence or not of a valid field."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Fieldpresent(pub u32);
impl Fieldpresent {
#[doc = "Indicates if a valid field is present. Available only in the activated state."]
#[must_use]
#[inline(always)]
pub const fn fieldpresent(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Indicates if a valid field is present. Available only in the activated state."]
#[inline(always)]
pub const fn set_fieldpresent(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Indicates if the low level has locked to the field."]
#[must_use]
#[inline(always)]
pub const fn lockdetect(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Indicates if the low level has locked to the field."]
#[inline(always)]
pub const fn set_lockdetect(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
}
impl Default for Fieldpresent {
#[inline(always)]
fn default() -> Fieldpresent {
Fieldpresent(0)
}
}
impl core::fmt::Debug for Fieldpresent {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Fieldpresent")
.field("fieldpresent", &self.fieldpresent())
.field("lockdetect", &self.lockdetect())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Fieldpresent {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Fieldpresent {{ fieldpresent: {=bool:?}, lockdetect: {=bool:?} }}",
self.fieldpresent(),
self.lockdetect()
)
}
}
#[doc = "Maximum frame delay."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Framedelaymax(pub u32);
impl Framedelaymax {
#[doc = "Maximum frame delay in number of 13.56 MHz clock cycles."]
#[must_use]
#[inline(always)]
pub const fn framedelaymax(&self) -> u32 {
let val = (self.0 >> 0usize) & 0x000f_ffff;
val as u32
}
#[doc = "Maximum frame delay in number of 13.56 MHz clock cycles."]
#[inline(always)]
pub const fn set_framedelaymax(&mut self, val: u32) {
self.0 =
(self.0 & !(0x000f_ffff << 0usize)) | (((val as u32) & 0x000f_ffff) << 0usize);
}
}
impl Default for Framedelaymax {
#[inline(always)]
fn default() -> Framedelaymax {
Framedelaymax(0)
}
}
impl core::fmt::Debug for Framedelaymax {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Framedelaymax")
.field("framedelaymax", &self.framedelaymax())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Framedelaymax {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Framedelaymax {{ framedelaymax: {=u32:?} }}",
self.framedelaymax()
)
}
}
#[doc = "Minimum frame delay."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Framedelaymin(pub u32);
impl Framedelaymin {
#[doc = "Minimum frame delay in number of 13.56 MHz clock cycles."]
#[must_use]
#[inline(always)]
pub const fn framedelaymin(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Minimum frame delay in number of 13.56 MHz clock cycles."]
#[inline(always)]
pub const fn set_framedelaymin(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for Framedelaymin {
#[inline(always)]
fn default() -> Framedelaymin {
Framedelaymin(0)
}
}
impl core::fmt::Debug for Framedelaymin {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Framedelaymin")
.field("framedelaymin", &self.framedelaymin())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Framedelaymin {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Framedelaymin {{ framedelaymin: {=u16:?} }}",
self.framedelaymin()
)
}
}
#[doc = "Configuration register for the Frame Delay Timer."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Framedelaymode(pub u32);
impl Framedelaymode {
#[doc = "Configuration register for the Frame Delay Timer."]
#[must_use]
#[inline(always)]
pub const fn framedelaymode(&self) -> super::vals::Framedelaymode {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Framedelaymode::from_bits(val as u8)
}
#[doc = "Configuration register for the Frame Delay Timer."]
#[inline(always)]
pub const fn set_framedelaymode(&mut self, val: super::vals::Framedelaymode) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for Framedelaymode {
#[inline(always)]
fn default() -> Framedelaymode {
Framedelaymode(0)
}
}
impl core::fmt::Debug for Framedelaymode {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Framedelaymode")
.field("framedelaymode", &self.framedelaymode())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Framedelaymode {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Framedelaymode {{ framedelaymode: {:?} }}",
self.framedelaymode()
)
}
}
#[doc = "Enable or disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Enable or disable interrupt for event READY."]
#[must_use]
#[inline(always)]
pub const fn ready(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event READY."]
#[inline(always)]
pub const fn set_ready(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Enable or disable interrupt for event FIELDDETECTED."]
#[must_use]
#[inline(always)]
pub const fn fielddetected(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event FIELDDETECTED."]
#[inline(always)]
pub const fn set_fielddetected(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enable or disable interrupt for event FIELDLOST."]
#[must_use]
#[inline(always)]
pub const fn fieldlost(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event FIELDLOST."]
#[inline(always)]
pub const fn set_fieldlost(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Enable or disable interrupt for event TXFRAMESTART."]
#[must_use]
#[inline(always)]
pub const fn txframestart(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event TXFRAMESTART."]
#[inline(always)]
pub const fn set_txframestart(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Enable or disable interrupt for event TXFRAMEEND."]
#[must_use]
#[inline(always)]
pub const fn txframeend(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event TXFRAMEEND."]
#[inline(always)]
pub const fn set_txframeend(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Enable or disable interrupt for event RXFRAMESTART."]
#[must_use]
#[inline(always)]
pub const fn rxframestart(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RXFRAMESTART."]
#[inline(always)]
pub const fn set_rxframestart(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Enable or disable interrupt for event RXFRAMEEND."]
#[must_use]
#[inline(always)]
pub const fn rxframeend(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RXFRAMEEND."]
#[inline(always)]
pub const fn set_rxframeend(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "Enable or disable interrupt for event ERROR."]
#[must_use]
#[inline(always)]
pub const fn error(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event ERROR."]
#[inline(always)]
pub const fn set_error(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Enable or disable interrupt for event RXERROR."]
#[must_use]
#[inline(always)]
pub const fn rxerror(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RXERROR."]
#[inline(always)]
pub const fn set_rxerror(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[doc = "Enable or disable interrupt for event ENDRX."]
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event ENDRX."]
#[inline(always)]
pub const fn set_endrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "Enable or disable interrupt for event ENDTX."]
#[must_use]
#[inline(always)]
pub const fn endtx(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event ENDTX."]
#[inline(always)]
pub const fn set_endtx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "Enable or disable interrupt for event AUTOCOLRESSTARTED."]
#[must_use]
#[inline(always)]
pub const fn autocolresstarted(&self) -> bool {
let val = (self.0 >> 14usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event AUTOCOLRESSTARTED."]
#[inline(always)]
pub const fn set_autocolresstarted(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
}
#[doc = "Enable or disable interrupt for event COLLISION."]
#[must_use]
#[inline(always)]
pub const fn collision(&self) -> bool {
let val = (self.0 >> 18usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event COLLISION."]
#[inline(always)]
pub const fn set_collision(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
}
#[doc = "Enable or disable interrupt for event SELECTED."]
#[must_use]
#[inline(always)]
pub const fn selected(&self) -> bool {
let val = (self.0 >> 19usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event SELECTED."]
#[inline(always)]
pub const fn set_selected(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
}
#[doc = "Enable or disable interrupt for event STARTED."]
#[must_use]
#[inline(always)]
pub const fn started(&self) -> bool {
let val = (self.0 >> 20usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event STARTED."]
#[inline(always)]
pub const fn set_started(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("ready", &self.ready())
.field("fielddetected", &self.fielddetected())
.field("fieldlost", &self.fieldlost())
.field("txframestart", &self.txframestart())
.field("txframeend", &self.txframeend())
.field("rxframestart", &self.rxframestart())
.field("rxframeend", &self.rxframeend())
.field("error", &self.error())
.field("rxerror", &self.rxerror())
.field("endrx", &self.endrx())
.field("endtx", &self.endtx())
.field("autocolresstarted", &self.autocolresstarted())
.field("collision", &self.collision())
.field("selected", &self.selected())
.field("started", &self.started())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Int {{ ready: {=bool:?}, fielddetected: {=bool:?}, fieldlost: {=bool:?}, txframestart: {=bool:?}, txframeend: {=bool:?}, rxframestart: {=bool:?}, rxframeend: {=bool:?}, error: {=bool:?}, rxerror: {=bool:?}, endrx: {=bool:?}, endtx: {=bool:?}, autocolresstarted: {=bool:?}, collision: {=bool:?}, selected: {=bool:?}, started: {=bool:?} }}" , self . ready () , self . fielddetected () , self . fieldlost () , self . txframestart () , self . txframeend () , self . rxframestart () , self . rxframeend () , self . error () , self . rxerror () , self . endrx () , self . endtx () , self . autocolresstarted () , self . collision () , self . selected () , self . started ())
}
}
#[doc = "Size of the RAM buffer allocated to TXD and RXD data storage each."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Maxlen(pub u32);
impl Maxlen {
#[doc = "Size of the RAM buffer allocated to TXD and RXD data storage each."]
#[must_use]
#[inline(always)]
pub const fn maxlen(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x01ff;
val as u16
}
#[doc = "Size of the RAM buffer allocated to TXD and RXD data storage each."]
#[inline(always)]
pub const fn set_maxlen(&mut self, val: u16) {
self.0 = (self.0 & !(0x01ff << 0usize)) | (((val as u32) & 0x01ff) << 0usize);
}
}
impl Default for Maxlen {
#[inline(always)]
fn default() -> Maxlen {
Maxlen(0)
}
}
impl core::fmt::Debug for Maxlen {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Maxlen")
.field("maxlen", &self.maxlen())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Maxlen {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Maxlen {{ maxlen: {=u16:?} }}", self.maxlen())
}
}
#[doc = "Enables the modulation output to a GPIO pin which can be connected to a second external antenna."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Modulationctrl(pub u32);
impl Modulationctrl {
#[doc = "Configuration of modulation control."]
#[must_use]
#[inline(always)]
pub const fn modulationctrl(&self) -> super::vals::Modulationctrl {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Modulationctrl::from_bits(val as u8)
}
#[doc = "Configuration of modulation control."]
#[inline(always)]
pub const fn set_modulationctrl(&mut self, val: super::vals::Modulationctrl) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for Modulationctrl {
#[inline(always)]
fn default() -> Modulationctrl {
Modulationctrl(0)
}
}
impl core::fmt::Debug for Modulationctrl {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Modulationctrl")
.field("modulationctrl", &self.modulationctrl())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Modulationctrl {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Modulationctrl {{ modulationctrl: {:?} }}",
self.modulationctrl()
)
}
}
#[doc = "Pin select for Modulation control."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Modulationpsel(pub u32);
impl Modulationpsel {
#[doc = "Pin number."]
#[must_use]
#[inline(always)]
pub const fn pin(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x1f;
val as u8
}
#[doc = "Pin number."]
#[inline(always)]
pub const fn set_pin(&mut self, val: u8) {
self.0 = (self.0 & !(0x1f << 0usize)) | (((val as u32) & 0x1f) << 0usize);
}
#[doc = "Port number."]
#[must_use]
#[inline(always)]
pub const fn port(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Port number."]
#[inline(always)]
pub const fn set_port(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Connection."]
#[must_use]
#[inline(always)]
pub const fn connect(&self) -> super::super::shared::vals::Connect {
let val = (self.0 >> 31usize) & 0x01;
super::super::shared::vals::Connect::from_bits(val as u8)
}
#[doc = "Connection."]
#[inline(always)]
pub const fn set_connect(&mut self, val: super::super::shared::vals::Connect) {
self.0 =
(self.0 & !(0x01 << 31usize)) | (((val.to_bits() as u32) & 0x01) << 31usize);
}
}
impl Default for Modulationpsel {
#[inline(always)]
fn default() -> Modulationpsel {
Modulationpsel(0)
}
}
impl core::fmt::Debug for Modulationpsel {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Modulationpsel")
.field("pin", &self.pin())
.field("port", &self.port())
.field("connect", &self.connect())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Modulationpsel {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Modulationpsel {{ pin: {=u8:?}, port: {=bool:?}, connect: {:?} }}",
self.pin(),
self.port(),
self.connect()
)
}
}
#[doc = "Second last NFCID1 part (7 or 10 bytes ID)."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Nfcid12ndLast(pub u32);
impl Nfcid12ndLast {
#[doc = "NFCID1 byte V."]
#[must_use]
#[inline(always)]
pub const fn nfcid1_v(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "NFCID1 byte V."]
#[inline(always)]
pub const fn set_nfcid1_v(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
#[doc = "NFCID1 byte U."]
#[must_use]
#[inline(always)]
pub const fn nfcid1_u(&self) -> u8 {
let val = (self.0 >> 8usize) & 0xff;
val as u8
}
#[doc = "NFCID1 byte U."]
#[inline(always)]
pub const fn set_nfcid1_u(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize);
}
#[doc = "NFCID1 byte T."]
#[must_use]
#[inline(always)]
pub const fn nfcid1_t(&self) -> u8 {
let val = (self.0 >> 16usize) & 0xff;
val as u8
}
#[doc = "NFCID1 byte T."]
#[inline(always)]
pub const fn set_nfcid1_t(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize);
}
}
impl Default for Nfcid12ndLast {
#[inline(always)]
fn default() -> Nfcid12ndLast {
Nfcid12ndLast(0)
}
}
impl core::fmt::Debug for Nfcid12ndLast {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Nfcid12ndLast")
.field("nfcid1_v", &self.nfcid1_v())
.field("nfcid1_u", &self.nfcid1_u())
.field("nfcid1_t", &self.nfcid1_t())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Nfcid12ndLast {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Nfcid12ndLast {{ nfcid1_v: {=u8:?}, nfcid1_u: {=u8:?}, nfcid1_t: {=u8:?} }}",
self.nfcid1_v(),
self.nfcid1_u(),
self.nfcid1_t()
)
}
}
#[doc = "Third last NFCID1 part (10 bytes ID)."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Nfcid13rdLast(pub u32);
impl Nfcid13rdLast {
#[doc = "NFCID1 byte S."]
#[must_use]
#[inline(always)]
pub const fn nfcid1_s(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "NFCID1 byte S."]
#[inline(always)]
pub const fn set_nfcid1_s(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
#[doc = "NFCID1 byte R."]
#[must_use]
#[inline(always)]
pub const fn nfcid1_r(&self) -> u8 {
let val = (self.0 >> 8usize) & 0xff;
val as u8
}
#[doc = "NFCID1 byte R."]
#[inline(always)]
pub const fn set_nfcid1_r(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize);
}
#[doc = "NFCID1 byte Q."]
#[must_use]
#[inline(always)]
pub const fn nfcid1_q(&self) -> u8 {
let val = (self.0 >> 16usize) & 0xff;
val as u8
}
#[doc = "NFCID1 byte Q."]
#[inline(always)]
pub const fn set_nfcid1_q(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize);
}
}
impl Default for Nfcid13rdLast {
#[inline(always)]
fn default() -> Nfcid13rdLast {
Nfcid13rdLast(0)
}
}
impl core::fmt::Debug for Nfcid13rdLast {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Nfcid13rdLast")
.field("nfcid1_s", &self.nfcid1_s())
.field("nfcid1_r", &self.nfcid1_r())
.field("nfcid1_q", &self.nfcid1_q())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Nfcid13rdLast {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Nfcid13rdLast {{ nfcid1_s: {=u8:?}, nfcid1_r: {=u8:?}, nfcid1_q: {=u8:?} }}",
self.nfcid1_s(),
self.nfcid1_r(),
self.nfcid1_q()
)
}
}
#[doc = "Last NFCID1 part (4, 7 or 10 bytes ID)."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Nfcid1Last(pub u32);
impl Nfcid1Last {
#[doc = "NFCID1 byte Z (very last byte sent)."]
#[must_use]
#[inline(always)]
pub const fn nfcid1_z(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "NFCID1 byte Z (very last byte sent)."]
#[inline(always)]
pub const fn set_nfcid1_z(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
#[doc = "NFCID1 byte Y."]
#[must_use]
#[inline(always)]
pub const fn nfcid1_y(&self) -> u8 {
let val = (self.0 >> 8usize) & 0xff;
val as u8
}
#[doc = "NFCID1 byte Y."]
#[inline(always)]
pub const fn set_nfcid1_y(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize);
}
#[doc = "NFCID1 byte X."]
#[must_use]
#[inline(always)]
pub const fn nfcid1_x(&self) -> u8 {
let val = (self.0 >> 16usize) & 0xff;
val as u8
}
#[doc = "NFCID1 byte X."]
#[inline(always)]
pub const fn set_nfcid1_x(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize);
}
#[doc = "NFCID1 byte W."]
#[must_use]
#[inline(always)]
pub const fn nfcid1_w(&self) -> u8 {
let val = (self.0 >> 24usize) & 0xff;
val as u8
}
#[doc = "NFCID1 byte W."]
#[inline(always)]
pub const fn set_nfcid1_w(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 24usize)) | (((val as u32) & 0xff) << 24usize);
}
}
impl Default for Nfcid1Last {
#[inline(always)]
fn default() -> Nfcid1Last {
Nfcid1Last(0)
}
}
impl core::fmt::Debug for Nfcid1Last {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Nfcid1Last")
.field("nfcid1_z", &self.nfcid1_z())
.field("nfcid1_y", &self.nfcid1_y())
.field("nfcid1_x", &self.nfcid1_x())
.field("nfcid1_w", &self.nfcid1_w())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Nfcid1Last {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Nfcid1Last {{ nfcid1_z: {=u8:?}, nfcid1_y: {=u8:?}, nfcid1_x: {=u8:?}, nfcid1_w: {=u8:?} }}" , self . nfcid1_z () , self . nfcid1_y () , self . nfcid1_x () , self . nfcid1_w ())
}
}
#[doc = "Current operating state of NFC tag."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Nfctagstate(pub u32);
impl Nfctagstate {
#[doc = "NfcTag state."]
#[must_use]
#[inline(always)]
pub const fn nfctagstate(&self) -> super::vals::Nfctagstate {
let val = (self.0 >> 0usize) & 0x07;
super::vals::Nfctagstate::from_bits(val as u8)
}
#[doc = "NfcTag state."]
#[inline(always)]
pub const fn set_nfctagstate(&mut self, val: super::vals::Nfctagstate) {
self.0 = (self.0 & !(0x07 << 0usize)) | (((val.to_bits() as u32) & 0x07) << 0usize);
}
}
impl Default for Nfctagstate {
#[inline(always)]
fn default() -> Nfctagstate {
Nfctagstate(0)
}
}
impl core::fmt::Debug for Nfctagstate {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Nfctagstate")
.field("nfctagstate", &self.nfctagstate())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Nfctagstate {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Nfctagstate {{ nfctagstate: {:?} }}", self.nfctagstate())
}
}
#[doc = "Result of last incoming frame."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Rx(pub u32);
impl Rx {
#[doc = "No valid end of frame (EoF) detected."]
#[must_use]
#[inline(always)]
pub const fn crcerror(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "No valid end of frame (EoF) detected."]
#[inline(always)]
pub const fn set_crcerror(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Parity status of received frame."]
#[must_use]
#[inline(always)]
pub const fn paritystatus(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Parity status of received frame."]
#[inline(always)]
pub const fn set_paritystatus(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Overrun detected."]
#[must_use]
#[inline(always)]
pub const fn overrun(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Overrun detected."]
#[inline(always)]
pub const fn set_overrun(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
}
impl Default for Rx {
#[inline(always)]
fn default() -> Rx {
Rx(0)
}
}
impl core::fmt::Debug for Rx {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Rx")
.field("crcerror", &self.crcerror())
.field("paritystatus", &self.paritystatus())
.field("overrun", &self.overrun())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Rx {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Rx {{ crcerror: {=bool:?}, paritystatus: {=bool:?}, overrun: {=bool:?} }}",
self.crcerror(),
self.paritystatus(),
self.overrun()
)
}
}
#[doc = "Size of last incoming frame."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RxdAmount(pub u32);
impl RxdAmount {
#[doc = "Number of bits in the last byte in the frame, if less than 8 (including CRC, but excluding parity and SoF/EoF framing)."]
#[must_use]
#[inline(always)]
pub const fn rxdatabits(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x07;
val as u8
}
#[doc = "Number of bits in the last byte in the frame, if less than 8 (including CRC, but excluding parity and SoF/EoF framing)."]
#[inline(always)]
pub const fn set_rxdatabits(&mut self, val: u8) {
self.0 = (self.0 & !(0x07 << 0usize)) | (((val as u32) & 0x07) << 0usize);
}
#[doc = "Number of complete bytes received in the frame (including CRC, but excluding parity and SoF/EoF framing)."]
#[must_use]
#[inline(always)]
pub const fn rxdatabytes(&self) -> u16 {
let val = (self.0 >> 3usize) & 0x01ff;
val as u16
}
#[doc = "Number of complete bytes received in the frame (including CRC, but excluding parity and SoF/EoF framing)."]
#[inline(always)]
pub const fn set_rxdatabytes(&mut self, val: u16) {
self.0 = (self.0 & !(0x01ff << 3usize)) | (((val as u32) & 0x01ff) << 3usize);
}
}
impl Default for RxdAmount {
#[inline(always)]
fn default() -> RxdAmount {
RxdAmount(0)
}
}
impl core::fmt::Debug for RxdAmount {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RxdAmount")
.field("rxdatabits", &self.rxdatabits())
.field("rxdatabytes", &self.rxdatabytes())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RxdAmount {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"RxdAmount {{ rxdatabits: {=u8:?}, rxdatabytes: {=u16:?} }}",
self.rxdatabits(),
self.rxdatabytes()
)
}
}
#[doc = "Configuration of incoming frames."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RxdFrameconfig(pub u32);
impl RxdFrameconfig {
#[doc = "Indicates if parity expected in RX frame."]
#[must_use]
#[inline(always)]
pub const fn parity(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Indicates if parity expected in RX frame."]
#[inline(always)]
pub const fn set_parity(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "SoF expected or not in RX frames."]
#[must_use]
#[inline(always)]
pub const fn sof(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "SoF expected or not in RX frames."]
#[inline(always)]
pub const fn set_sof(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "CRC mode for incoming frames."]
#[must_use]
#[inline(always)]
pub const fn crcmoderx(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "CRC mode for incoming frames."]
#[inline(always)]
pub const fn set_crcmoderx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
}
impl Default for RxdFrameconfig {
#[inline(always)]
fn default() -> RxdFrameconfig {
RxdFrameconfig(0)
}
}
impl core::fmt::Debug for RxdFrameconfig {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RxdFrameconfig")
.field("parity", &self.parity())
.field("sof", &self.sof())
.field("crcmoderx", &self.crcmoderx())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RxdFrameconfig {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"RxdFrameconfig {{ parity: {=bool:?}, sof: {=bool:?}, crcmoderx: {=bool:?} }}",
self.parity(),
self.sof(),
self.crcmoderx()
)
}
}
#[doc = "NFC-A SEL_RES auto-response settings."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Selres(pub u32);
impl Selres {
#[doc = "Reserved for future use. Shall be 0."]
#[must_use]
#[inline(always)]
pub const fn rfu10(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x03;
val as u8
}
#[doc = "Reserved for future use. Shall be 0."]
#[inline(always)]
pub const fn set_rfu10(&mut self, val: u8) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val as u32) & 0x03) << 0usize);
}
#[doc = "Cascade as defined by the b3 of SEL_RES response in the NFC Forum, NFC Digital Protocol Technical Specification (controlled by hardware, shall be 0)."]
#[must_use]
#[inline(always)]
pub const fn cascade(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Cascade as defined by the b3 of SEL_RES response in the NFC Forum, NFC Digital Protocol Technical Specification (controlled by hardware, shall be 0)."]
#[inline(always)]
pub const fn set_cascade(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Reserved for future use. Shall be 0."]
#[must_use]
#[inline(always)]
pub const fn rfu43(&self) -> u8 {
let val = (self.0 >> 3usize) & 0x03;
val as u8
}
#[doc = "Reserved for future use. Shall be 0."]
#[inline(always)]
pub const fn set_rfu43(&mut self, val: u8) {
self.0 = (self.0 & !(0x03 << 3usize)) | (((val as u32) & 0x03) << 3usize);
}
#[doc = "Protocol as defined by the b7:b6 of SEL_RES response in the NFC Forum, NFC Digital Protocol Technical Specification."]
#[must_use]
#[inline(always)]
pub const fn protocol(&self) -> u8 {
let val = (self.0 >> 5usize) & 0x03;
val as u8
}
#[doc = "Protocol as defined by the b7:b6 of SEL_RES response in the NFC Forum, NFC Digital Protocol Technical Specification."]
#[inline(always)]
pub const fn set_protocol(&mut self, val: u8) {
self.0 = (self.0 & !(0x03 << 5usize)) | (((val as u32) & 0x03) << 5usize);
}
#[doc = "Reserved for future use. Shall be 0."]
#[must_use]
#[inline(always)]
pub const fn rfu7(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Reserved for future use. Shall be 0."]
#[inline(always)]
pub const fn set_rfu7(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
}
impl Default for Selres {
#[inline(always)]
fn default() -> Selres {
Selres(0)
}
}
impl core::fmt::Debug for Selres {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Selres")
.field("rfu10", &self.rfu10())
.field("cascade", &self.cascade())
.field("rfu43", &self.rfu43())
.field("protocol", &self.protocol())
.field("rfu7", &self.rfu7())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Selres {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Selres {{ rfu10: {=u8:?}, cascade: {=bool:?}, rfu43: {=u8:?}, protocol: {=u8:?}, rfu7: {=bool:?} }}" , self . rfu10 () , self . cascade () , self . rfu43 () , self . protocol () , self . rfu7 ())
}
}
#[doc = "NFC-A SENS_RES auto-response settings."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Sensres(pub u32);
impl Sensres {
#[doc = "Bit frame SDD as defined by the b5:b1 of byte 1 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification."]
#[must_use]
#[inline(always)]
pub const fn bitframesdd(&self) -> super::vals::Bitframesdd {
let val = (self.0 >> 0usize) & 0x1f;
super::vals::Bitframesdd::from_bits(val as u8)
}
#[doc = "Bit frame SDD as defined by the b5:b1 of byte 1 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification."]
#[inline(always)]
pub const fn set_bitframesdd(&mut self, val: super::vals::Bitframesdd) {
self.0 = (self.0 & !(0x1f << 0usize)) | (((val.to_bits() as u32) & 0x1f) << 0usize);
}
#[doc = "Reserved for future use. Shall be 0."]
#[must_use]
#[inline(always)]
pub const fn rfu5(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Reserved for future use. Shall be 0."]
#[inline(always)]
pub const fn set_rfu5(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "NFCID1 size. This value is used by the auto collision resolution engine."]
#[must_use]
#[inline(always)]
pub const fn nfcidsize(&self) -> super::vals::Nfcidsize {
let val = (self.0 >> 6usize) & 0x03;
super::vals::Nfcidsize::from_bits(val as u8)
}
#[doc = "NFCID1 size. This value is used by the auto collision resolution engine."]
#[inline(always)]
pub const fn set_nfcidsize(&mut self, val: super::vals::Nfcidsize) {
self.0 = (self.0 & !(0x03 << 6usize)) | (((val.to_bits() as u32) & 0x03) << 6usize);
}
#[doc = "Tag platform configuration as defined by the b4:b1 of byte 2 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification."]
#[must_use]
#[inline(always)]
pub const fn platfconfig(&self) -> u8 {
let val = (self.0 >> 8usize) & 0x0f;
val as u8
}
#[doc = "Tag platform configuration as defined by the b4:b1 of byte 2 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification."]
#[inline(always)]
pub const fn set_platfconfig(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 8usize)) | (((val as u32) & 0x0f) << 8usize);
}
#[doc = "Reserved for future use. Shall be 0."]
#[must_use]
#[inline(always)]
pub const fn rfu74(&self) -> u8 {
let val = (self.0 >> 12usize) & 0x0f;
val as u8
}
#[doc = "Reserved for future use. Shall be 0."]
#[inline(always)]
pub const fn set_rfu74(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 12usize)) | (((val as u32) & 0x0f) << 12usize);
}
}
impl Default for Sensres {
#[inline(always)]
fn default() -> Sensres {
Sensres(0)
}
}
impl core::fmt::Debug for Sensres {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Sensres")
.field("bitframesdd", &self.bitframesdd())
.field("rfu5", &self.rfu5())
.field("nfcidsize", &self.nfcidsize())
.field("platfconfig", &self.platfconfig())
.field("rfu74", &self.rfu74())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Sensres {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Sensres {{ bitframesdd: {:?}, rfu5: {=bool:?}, nfcidsize: {:?}, platfconfig: {=u8:?}, rfu74: {=u8:?} }}" , self . bitframesdd () , self . rfu5 () , self . nfcidsize () , self . platfconfig () , self . rfu74 ())
}
}
#[doc = "Shortcuts between local events and tasks."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Shorts(pub u32);
impl Shorts {
#[doc = "Shortcut between event FIELDDETECTED and task ACTIVATE."]
#[must_use]
#[inline(always)]
pub const fn fielddetected_activate(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event FIELDDETECTED and task ACTIVATE."]
#[inline(always)]
pub const fn set_fielddetected_activate(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Shortcut between event FIELDLOST and task SENSE."]
#[must_use]
#[inline(always)]
pub const fn fieldlost_sense(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event FIELDLOST and task SENSE."]
#[inline(always)]
pub const fn set_fieldlost_sense(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Shortcut between event TXFRAMEEND and task ENABLERXDATA."]
#[must_use]
#[inline(always)]
pub const fn txframeend_enablerxdata(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event TXFRAMEEND and task ENABLERXDATA."]
#[inline(always)]
pub const fn set_txframeend_enablerxdata(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
}
impl Default for Shorts {
#[inline(always)]
fn default() -> Shorts {
Shorts(0)
}
}
impl core::fmt::Debug for Shorts {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Shorts")
.field("fielddetected_activate", &self.fielddetected_activate())
.field("fieldlost_sense", &self.fieldlost_sense())
.field("txframeend_enablerxdata", &self.txframeend_enablerxdata())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Shorts {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Shorts {{ fielddetected_activate: {=bool:?}, fieldlost_sense: {=bool:?}, txframeend_enablerxdata: {=bool:?} }}" , self . fielddetected_activate () , self . fieldlost_sense () , self . txframeend_enablerxdata ())
}
}
#[doc = "Sleep state during automatic collision resolution."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Sleepstate(pub u32);
impl Sleepstate {
#[doc = "Reflects the sleep state during automatic collision resolution. Set to IDLE by a GOIDLE task. Set to SLEEP_A when a valid SLEEP_REQ frame is received or by a GOSLEEP task."]
#[must_use]
#[inline(always)]
pub const fn sleepstate(&self) -> super::vals::Sleepstate {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Sleepstate::from_bits(val as u8)
}
#[doc = "Reflects the sleep state during automatic collision resolution. Set to IDLE by a GOIDLE task. Set to SLEEP_A when a valid SLEEP_REQ frame is received or by a GOSLEEP task."]
#[inline(always)]
pub const fn set_sleepstate(&mut self, val: super::vals::Sleepstate) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Sleepstate {
#[inline(always)]
fn default() -> Sleepstate {
Sleepstate(0)
}
}
impl core::fmt::Debug for Sleepstate {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Sleepstate")
.field("sleepstate", &self.sleepstate())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Sleepstate {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Sleepstate {{ sleepstate: {:?} }}", self.sleepstate())
}
}
#[doc = "Size of outgoing frame."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TxdAmount(pub u32);
impl TxdAmount {
#[doc = "Number of bits in the last or first byte read from RAM that shall be included in the frame (excluding parity bit)."]
#[must_use]
#[inline(always)]
pub const fn txdatabits(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x07;
val as u8
}
#[doc = "Number of bits in the last or first byte read from RAM that shall be included in the frame (excluding parity bit)."]
#[inline(always)]
pub const fn set_txdatabits(&mut self, val: u8) {
self.0 = (self.0 & !(0x07 << 0usize)) | (((val as u32) & 0x07) << 0usize);
}
#[doc = "Number of complete bytes that shall be included in the frame, excluding CRC, parity, and framing."]
#[must_use]
#[inline(always)]
pub const fn txdatabytes(&self) -> u16 {
let val = (self.0 >> 3usize) & 0x01ff;
val as u16
}
#[doc = "Number of complete bytes that shall be included in the frame, excluding CRC, parity, and framing."]
#[inline(always)]
pub const fn set_txdatabytes(&mut self, val: u16) {
self.0 = (self.0 & !(0x01ff << 3usize)) | (((val as u32) & 0x01ff) << 3usize);
}
}
impl Default for TxdAmount {
#[inline(always)]
fn default() -> TxdAmount {
TxdAmount(0)
}
}
impl core::fmt::Debug for TxdAmount {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TxdAmount")
.field("txdatabits", &self.txdatabits())
.field("txdatabytes", &self.txdatabytes())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for TxdAmount {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"TxdAmount {{ txdatabits: {=u8:?}, txdatabytes: {=u16:?} }}",
self.txdatabits(),
self.txdatabytes()
)
}
}
#[doc = "Configuration of outgoing frames."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TxdFrameconfig(pub u32);
impl TxdFrameconfig {
#[doc = "Indicates if parity is added to the frame."]
#[must_use]
#[inline(always)]
pub const fn parity(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Indicates if parity is added to the frame."]
#[inline(always)]
pub const fn set_parity(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Discarding unused bits at start or end of a frame."]
#[must_use]
#[inline(always)]
pub const fn discardmode(&self) -> super::vals::Discardmode {
let val = (self.0 >> 1usize) & 0x01;
super::vals::Discardmode::from_bits(val as u8)
}
#[doc = "Discarding unused bits at start or end of a frame."]
#[inline(always)]
pub const fn set_discardmode(&mut self, val: super::vals::Discardmode) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val.to_bits() as u32) & 0x01) << 1usize);
}
#[doc = "Adding SoF or not in TX frames."]
#[must_use]
#[inline(always)]
pub const fn sof(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Adding SoF or not in TX frames."]
#[inline(always)]
pub const fn set_sof(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "CRC mode for outgoing frames."]
#[must_use]
#[inline(always)]
pub const fn crcmodetx(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "CRC mode for outgoing frames."]
#[inline(always)]
pub const fn set_crcmodetx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
}
impl Default for TxdFrameconfig {
#[inline(always)]
fn default() -> TxdFrameconfig {
TxdFrameconfig(0)
}
}
impl core::fmt::Debug for TxdFrameconfig {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TxdFrameconfig")
.field("parity", &self.parity())
.field("discardmode", &self.discardmode())
.field("sof", &self.sof())
.field("crcmodetx", &self.crcmodetx())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for TxdFrameconfig {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "TxdFrameconfig {{ parity: {=bool:?}, discardmode: {:?}, sof: {=bool:?}, crcmodetx: {=bool:?} }}" , self . parity () , self . discardmode () , self . sof () , self . crcmodetx ())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Bitframesdd {
#[doc = "SDD pattern 00000."]
Sdd00000 = 0x0,
#[doc = "SDD pattern 00001."]
Sdd00001 = 0x01,
#[doc = "SDD pattern 00010."]
Sdd00010 = 0x02,
_RESERVED_3 = 0x03,
#[doc = "SDD pattern 00100."]
Sdd00100 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
#[doc = "SDD pattern 01000."]
Sdd01000 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
#[doc = "SDD pattern 10000."]
Sdd10000 = 0x10,
_RESERVED_11 = 0x11,
_RESERVED_12 = 0x12,
_RESERVED_13 = 0x13,
_RESERVED_14 = 0x14,
_RESERVED_15 = 0x15,
_RESERVED_16 = 0x16,
_RESERVED_17 = 0x17,
_RESERVED_18 = 0x18,
_RESERVED_19 = 0x19,
_RESERVED_1a = 0x1a,
_RESERVED_1b = 0x1b,
_RESERVED_1c = 0x1c,
_RESERVED_1d = 0x1d,
_RESERVED_1e = 0x1e,
_RESERVED_1f = 0x1f,
}
impl Bitframesdd {
#[inline(always)]
pub const fn from_bits(val: u8) -> Bitframesdd {
unsafe { core::mem::transmute(val & 0x1f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Bitframesdd {
#[inline(always)]
fn from(val: u8) -> Bitframesdd {
Bitframesdd::from_bits(val)
}
}
impl From<Bitframesdd> for u8 {
#[inline(always)]
fn from(val: Bitframesdd) -> u8 {
Bitframesdd::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Discardmode {
#[doc = "Unused bits are discarded at end of frame (EoF)."]
DiscardEnd = 0x0,
#[doc = "Unused bits are discarded at start of frame (SoF)."]
DiscardStart = 0x01,
}
impl Discardmode {
#[inline(always)]
pub const fn from_bits(val: u8) -> Discardmode {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Discardmode {
#[inline(always)]
fn from(val: u8) -> Discardmode {
Discardmode::from_bits(val)
}
}
impl From<Discardmode> for u8 {
#[inline(always)]
fn from(val: Discardmode) -> u8 {
Discardmode::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Framedelaymode {
#[doc = "Transmission is independent of frame timer and will start when the STARTTX task is triggered. No timeout."]
FreeRun = 0x0,
#[doc = "Frame is transmitted between FRAMEDELAYMIN and FRAMEDELAYMAX."]
Window = 0x01,
#[doc = "Frame is transmitted exactly at FRAMEDELAYMAX."]
ExactVal = 0x02,
#[doc = "Frame is transmitted on a bit grid between FRAMEDELAYMIN and FRAMEDELAYMAX."]
WindowGrid = 0x03,
}
impl Framedelaymode {
#[inline(always)]
pub const fn from_bits(val: u8) -> Framedelaymode {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Framedelaymode {
#[inline(always)]
fn from(val: u8) -> Framedelaymode {
Framedelaymode::from_bits(val)
}
}
impl From<Framedelaymode> for u8 {
#[inline(always)]
fn from(val: Framedelaymode) -> u8 {
Framedelaymode::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Mode {
#[doc = "Auto collision resolution enabled."]
Enabled = 0x0,
#[doc = "Auto collision resolution disabled."]
Disabled = 0x01,
}
impl Mode {
#[inline(always)]
pub const fn from_bits(val: u8) -> Mode {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Mode {
#[inline(always)]
fn from(val: u8) -> Mode {
Mode::from_bits(val)
}
}
impl From<Mode> for u8 {
#[inline(always)]
fn from(val: Mode) -> u8 {
Mode::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Modulationctrl {
#[doc = "Invalid, defaults to same behaviour as for Internal."]
Invalid = 0x0,
#[doc = "Use internal modulator only."]
Internal = 0x01,
#[doc = "Output digital modulation signal to a GPIO pin."]
ModToGpio = 0x02,
#[doc = "Use internal modulator and output digital modulation signal to a GPIO pin."]
InternalAndModToGpio = 0x03,
}
impl Modulationctrl {
#[inline(always)]
pub const fn from_bits(val: u8) -> Modulationctrl {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Modulationctrl {
#[inline(always)]
fn from(val: u8) -> Modulationctrl {
Modulationctrl::from_bits(val)
}
}
impl From<Modulationctrl> for u8 {
#[inline(always)]
fn from(val: Modulationctrl) -> u8 {
Modulationctrl::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Nfcidsize {
#[doc = "NFCID1 size: single (4 bytes)."]
Nfcid1single = 0x0,
#[doc = "NFCID1 size: double (7 bytes)."]
Nfcid1double = 0x01,
#[doc = "NFCID1 size: triple (10 bytes)."]
Nfcid1triple = 0x02,
_RESERVED_3 = 0x03,
}
impl Nfcidsize {
#[inline(always)]
pub const fn from_bits(val: u8) -> Nfcidsize {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Nfcidsize {
#[inline(always)]
fn from(val: u8) -> Nfcidsize {
Nfcidsize::from_bits(val)
}
}
impl From<Nfcidsize> for u8 {
#[inline(always)]
fn from(val: Nfcidsize) -> u8 {
Nfcidsize::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Nfctagstate {
#[doc = "Disabled or sense."]
Disabled = 0x0,
_RESERVED_1 = 0x01,
#[doc = "RampUp."]
RampUp = 0x02,
#[doc = "Idle."]
Idle = 0x03,
#[doc = "Receive."]
Receive = 0x04,
#[doc = "FrameDelay."]
FrameDelay = 0x05,
#[doc = "Transmit."]
Transmit = 0x06,
_RESERVED_7 = 0x07,
}
impl Nfctagstate {
#[inline(always)]
pub const fn from_bits(val: u8) -> Nfctagstate {
unsafe { core::mem::transmute(val & 0x07) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Nfctagstate {
#[inline(always)]
fn from(val: u8) -> Nfctagstate {
Nfctagstate::from_bits(val)
}
}
impl From<Nfctagstate> for u8 {
#[inline(always)]
fn from(val: Nfctagstate) -> u8 {
Nfctagstate::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Sleepstate {
#[doc = "State is IDLE."]
Idle = 0x0,
#[doc = "State is SLEEP_A."]
SleepA = 0x01,
}
impl Sleepstate {
#[inline(always)]
pub const fn from_bits(val: u8) -> Sleepstate {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Sleepstate {
#[inline(always)]
fn from(val: u8) -> Sleepstate {
Sleepstate::from_bits(val)
}
}
impl From<Sleepstate> for u8 {
#[inline(always)]
fn from(val: Sleepstate) -> u8 {
Sleepstate::to_bits(val)
}
}
}
}
pub mod nvmc {
#[doc = "Non-volatile memory controller 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Nvmc {
ptr: *mut u8,
}
unsafe impl Send for Nvmc {}
unsafe impl Sync for Nvmc {}
impl Nvmc {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Ready flag."]
#[inline(always)]
pub const fn ready(self) -> crate::common::Reg<regs::Ready, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0400usize) as _) }
}
#[doc = "Ready flag."]
#[inline(always)]
pub const fn readynext(self) -> crate::common::Reg<regs::Readynext, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0408usize) as _) }
}
#[doc = "Configuration register."]
#[inline(always)]
pub const fn config(self) -> crate::common::Reg<regs::Config, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0504usize) as _) }
}
#[doc = "Register for erasing all non-volatile user memory."]
#[inline(always)]
pub const fn eraseall(self) -> crate::common::Reg<regs::Eraseall, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x050cusize) as _) }
}
#[doc = "Register for partial erase configuration."]
#[inline(always)]
pub const fn erasepagepartialcfg(
self,
) -> crate::common::Reg<regs::Erasepagepartialcfg, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x051cusize) as _) }
}
#[doc = "Non-secure configuration register."]
#[inline(always)]
pub const fn configns(self) -> crate::common::Reg<regs::Configns, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0584usize) as _) }
}
#[doc = "Non-secure APPROTECT enable register."]
#[inline(always)]
pub const fn writeuicrns(self) -> crate::common::Reg<regs::Writeuicrns, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0588usize) as _) }
}
}
pub mod regs {
#[doc = "Configuration register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Config(pub u32);
impl Config {
#[doc = "Program memory access mode. It is strongly recommended to only activate erase and write modes when they are actively used."]
#[must_use]
#[inline(always)]
pub const fn wen(&self) -> super::vals::Wen {
let val = (self.0 >> 0usize) & 0x07;
super::vals::Wen::from_bits(val as u8)
}
#[doc = "Program memory access mode. It is strongly recommended to only activate erase and write modes when they are actively used."]
#[inline(always)]
pub const fn set_wen(&mut self, val: super::vals::Wen) {
self.0 = (self.0 & !(0x07 << 0usize)) | (((val.to_bits() as u32) & 0x07) << 0usize);
}
}
impl Default for Config {
#[inline(always)]
fn default() -> Config {
Config(0)
}
}
impl core::fmt::Debug for Config {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Config").field("wen", &self.wen()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Config {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Config {{ wen: {:?} }}", self.wen())
}
}
#[doc = "Non-secure configuration register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Configns(pub u32);
impl Configns {
#[doc = "Program memory access mode. It is strongly recommended to only activate erase and write modes when they are actively used."]
#[must_use]
#[inline(always)]
pub const fn wen(&self) -> super::vals::ConfignsWen {
let val = (self.0 >> 0usize) & 0x03;
super::vals::ConfignsWen::from_bits(val as u8)
}
#[doc = "Program memory access mode. It is strongly recommended to only activate erase and write modes when they are actively used."]
#[inline(always)]
pub const fn set_wen(&mut self, val: super::vals::ConfignsWen) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for Configns {
#[inline(always)]
fn default() -> Configns {
Configns(0)
}
}
impl core::fmt::Debug for Configns {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Configns")
.field("wen", &self.wen())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Configns {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Configns {{ wen: {:?} }}", self.wen())
}
}
#[doc = "Register for erasing all non-volatile user memory."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Eraseall(pub u32);
impl Eraseall {
#[doc = "Erase all non-volatile memory including UICR registers. Before the non-volatile memory can be erased, erasing must be enabled by setting CONFIG.WEN=Een."]
#[must_use]
#[inline(always)]
pub const fn eraseall(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Erase all non-volatile memory including UICR registers. Before the non-volatile memory can be erased, erasing must be enabled by setting CONFIG.WEN=Een."]
#[inline(always)]
pub const fn set_eraseall(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Eraseall {
#[inline(always)]
fn default() -> Eraseall {
Eraseall(0)
}
}
impl core::fmt::Debug for Eraseall {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Eraseall")
.field("eraseall", &self.eraseall())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Eraseall {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Eraseall {{ eraseall: {=bool:?} }}", self.eraseall())
}
}
#[doc = "Register for partial erase configuration."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Erasepagepartialcfg(pub u32);
impl Erasepagepartialcfg {
#[doc = "Duration of the partial erase in milliseconds."]
#[must_use]
#[inline(always)]
pub const fn duration(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x7f;
val as u8
}
#[doc = "Duration of the partial erase in milliseconds."]
#[inline(always)]
pub const fn set_duration(&mut self, val: u8) {
self.0 = (self.0 & !(0x7f << 0usize)) | (((val as u32) & 0x7f) << 0usize);
}
}
impl Default for Erasepagepartialcfg {
#[inline(always)]
fn default() -> Erasepagepartialcfg {
Erasepagepartialcfg(0)
}
}
impl core::fmt::Debug for Erasepagepartialcfg {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Erasepagepartialcfg")
.field("duration", &self.duration())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Erasepagepartialcfg {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Erasepagepartialcfg {{ duration: {=u8:?} }}",
self.duration()
)
}
}
#[doc = "Ready flag."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ready(pub u32);
impl Ready {
#[doc = "NVMC is ready or busy."]
#[must_use]
#[inline(always)]
pub const fn ready(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "NVMC is ready or busy."]
#[inline(always)]
pub const fn set_ready(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Ready {
#[inline(always)]
fn default() -> Ready {
Ready(0)
}
}
impl core::fmt::Debug for Ready {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ready")
.field("ready", &self.ready())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ready {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Ready {{ ready: {=bool:?} }}", self.ready())
}
}
#[doc = "Ready flag."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Readynext(pub u32);
impl Readynext {
#[doc = "NVMC can accept a new write operation."]
#[must_use]
#[inline(always)]
pub const fn readynext(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "NVMC can accept a new write operation."]
#[inline(always)]
pub const fn set_readynext(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Readynext {
#[inline(always)]
fn default() -> Readynext {
Readynext(0)
}
}
impl core::fmt::Debug for Readynext {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Readynext")
.field("readynext", &self.readynext())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Readynext {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Readynext {{ readynext: {=bool:?} }}", self.readynext())
}
}
#[doc = "Non-secure APPROTECT enable register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Writeuicrns(pub u32);
impl Writeuicrns {
#[doc = "Allow non-secure code to set APPROTECT."]
#[must_use]
#[inline(always)]
pub const fn set(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Allow non-secure code to set APPROTECT."]
#[inline(always)]
pub const fn set_set(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Key to write in order to validate the write operation."]
#[must_use]
#[inline(always)]
pub const fn key(&self) -> super::vals::Key {
let val = (self.0 >> 4usize) & 0x0fff_ffff;
super::vals::Key::from_bits(val as u32)
}
#[doc = "Key to write in order to validate the write operation."]
#[inline(always)]
pub const fn set_key(&mut self, val: super::vals::Key) {
self.0 = (self.0 & !(0x0fff_ffff << 4usize))
| (((val.to_bits() as u32) & 0x0fff_ffff) << 4usize);
}
}
impl Default for Writeuicrns {
#[inline(always)]
fn default() -> Writeuicrns {
Writeuicrns(0)
}
}
impl core::fmt::Debug for Writeuicrns {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Writeuicrns")
.field("set", &self.set())
.field("key", &self.key())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Writeuicrns {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Writeuicrns {{ set: {=bool:?}, key: {:?} }}",
self.set(),
self.key()
)
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum ConfignsWen {
#[doc = "Read only access."]
Ren = 0x0,
#[doc = "Write enabled."]
Wen = 0x01,
#[doc = "Erase enabled."]
Een = 0x02,
_RESERVED_3 = 0x03,
}
impl ConfignsWen {
#[inline(always)]
pub const fn from_bits(val: u8) -> ConfignsWen {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for ConfignsWen {
#[inline(always)]
fn from(val: u8) -> ConfignsWen {
ConfignsWen::from_bits(val)
}
}
impl From<ConfignsWen> for u8 {
#[inline(always)]
fn from(val: ConfignsWen) -> u8 {
ConfignsWen::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Key(u32);
impl Key {
#[doc = "Key value."]
pub const Keyvalid: Self = Self(0x0afb_e5a7);
}
impl Key {
pub const fn from_bits(val: u32) -> Key {
Self(val & 0x0fff_ffff)
}
pub const fn to_bits(self) -> u32 {
self.0
}
}
impl core::fmt::Debug for Key {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x0afb_e5a7 => f.write_str("Keyvalid"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Key {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x0afb_e5a7 => defmt::write!(f, "Keyvalid"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u32> for Key {
#[inline(always)]
fn from(val: u32) -> Key {
Key::from_bits(val)
}
}
impl From<Key> for u32 {
#[inline(always)]
fn from(val: Key) -> u32 {
Key::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Wen {
#[doc = "Read only access."]
Ren = 0x0,
#[doc = "Write enabled."]
Wen = 0x01,
#[doc = "Erase enabled."]
Een = 0x02,
_RESERVED_3 = 0x03,
#[doc = "Partial erase enabled."]
PEen = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
}
impl Wen {
#[inline(always)]
pub const fn from_bits(val: u8) -> Wen {
unsafe { core::mem::transmute(val & 0x07) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Wen {
#[inline(always)]
fn from(val: u8) -> Wen {
Wen::from_bits(val)
}
}
impl From<Wen> for u8 {
#[inline(always)]
fn from(val: Wen) -> u8 {
Wen::to_bits(val)
}
}
}
}
pub mod oscillators {
#[doc = "Oscillator control 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Oscillators {
ptr: *mut u8,
}
unsafe impl Send for Oscillators {}
unsafe impl Sync for Oscillators {}
impl Oscillators {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Programmable capacitance of XC1 and XC2."]
#[inline(always)]
pub const fn xosc32mcaps(self) -> crate::common::Reg<regs::Xosc32mcaps, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x05c4usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn xosc32ki(self) -> Xosc32ki {
unsafe { Xosc32ki::from_ptr(self.ptr.wrapping_add(0x06c0usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Xosc32ki {
ptr: *mut u8,
}
unsafe impl Send for Xosc32ki {}
unsafe impl Sync for Xosc32ki {}
impl Xosc32ki {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Enable or disable bypass of LFCLK crystal oscillator with external clock source."]
#[inline(always)]
pub const fn bypass(self) -> crate::common::Reg<regs::Bypass, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Control usage of internal load capacitors."]
#[inline(always)]
pub const fn intcap(self) -> crate::common::Reg<regs::Intcap, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
}
pub mod regs {
#[doc = "Enable or disable bypass of LFCLK crystal oscillator with external clock source."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Bypass(pub u32);
impl Bypass {
#[doc = "Enable or disable bypass of LFCLK crystal oscillator with external clock source."]
#[must_use]
#[inline(always)]
pub const fn bypass(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable bypass of LFCLK crystal oscillator with external clock source."]
#[inline(always)]
pub const fn set_bypass(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Bypass {
#[inline(always)]
fn default() -> Bypass {
Bypass(0)
}
}
impl core::fmt::Debug for Bypass {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Bypass")
.field("bypass", &self.bypass())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Bypass {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Bypass {{ bypass: {=bool:?} }}", self.bypass())
}
}
#[doc = "Control usage of internal load capacitors."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Intcap(pub u32);
impl Intcap {
#[doc = "Control usage of internal load capacitors."]
#[must_use]
#[inline(always)]
pub const fn intcap(&self) -> super::vals::Intcap {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Intcap::from_bits(val as u8)
}
#[doc = "Control usage of internal load capacitors."]
#[inline(always)]
pub const fn set_intcap(&mut self, val: super::vals::Intcap) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for Intcap {
#[inline(always)]
fn default() -> Intcap {
Intcap(0)
}
}
impl core::fmt::Debug for Intcap {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Intcap")
.field("intcap", &self.intcap())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Intcap {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Intcap {{ intcap: {:?} }}", self.intcap())
}
}
#[doc = "Programmable capacitance of XC1 and XC2."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Xosc32mcaps(pub u32);
impl Xosc32mcaps {
#[doc = "Value representing capacitance, calculated using provided equation."]
#[must_use]
#[inline(always)]
pub const fn capvalue(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x1f;
val as u8
}
#[doc = "Value representing capacitance, calculated using provided equation."]
#[inline(always)]
pub const fn set_capvalue(&mut self, val: u8) {
self.0 = (self.0 & !(0x1f << 0usize)) | (((val as u32) & 0x1f) << 0usize);
}
#[doc = "Enable on-chip capacitors on XC1 and XC2."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Enable on-chip capacitors on XC1 and XC2."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
}
impl Default for Xosc32mcaps {
#[inline(always)]
fn default() -> Xosc32mcaps {
Xosc32mcaps(0)
}
}
impl core::fmt::Debug for Xosc32mcaps {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Xosc32mcaps")
.field("capvalue", &self.capvalue())
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Xosc32mcaps {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Xosc32mcaps {{ capvalue: {=u8:?}, enable: {=bool:?} }}",
self.capvalue(),
self.enable()
)
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Intcap {
#[doc = "Use external load capacitors."]
External = 0x0,
#[doc = "6 pF internal load capacitance."]
C6pf = 0x01,
#[doc = "7 pF internal load capacitance."]
C7pf = 0x02,
#[doc = "9 pF internal load capacitance."]
C9pf = 0x03,
}
impl Intcap {
#[inline(always)]
pub const fn from_bits(val: u8) -> Intcap {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Intcap {
#[inline(always)]
fn from(val: u8) -> Intcap {
Intcap::from_bits(val)
}
}
impl From<Intcap> for u8 {
#[inline(always)]
fn from(val: Intcap) -> u8 {
Intcap::to_bits(val)
}
}
}
}
pub mod pdm {
#[doc = "Pulse Density Modulation (Digital Microphone) Interface 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Pdm {
ptr: *mut u8,
}
unsafe impl Send for Pdm {}
unsafe impl Sync for Pdm {}
impl Pdm {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Starts continuous PDM transfer."]
#[inline(always)]
pub const fn tasks_start(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Stops PDM transfer."]
#[inline(always)]
pub const fn tasks_stop(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Subscribe configuration for task START."]
#[inline(always)]
pub const fn subscribe_start(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x80usize) as _) }
}
#[doc = "Subscribe configuration for task STOP."]
#[inline(always)]
pub const fn subscribe_stop(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x84usize) as _) }
}
#[doc = "PDM transfer has started."]
#[inline(always)]
pub const fn events_started(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0100usize) as _) }
}
#[doc = "PDM transfer has finished."]
#[inline(always)]
pub const fn events_stopped(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0104usize) as _) }
}
#[doc = "The PDM has written the last sample specified by SAMPLE.MAXCNT (or the last sample after a STOP task has been received) to Data RAM."]
#[inline(always)]
pub const fn events_end(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0108usize) as _) }
}
#[doc = "Publish configuration for event STARTED."]
#[inline(always)]
pub const fn publish_started(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0180usize) as _) }
}
#[doc = "Publish configuration for event STOPPED."]
#[inline(always)]
pub const fn publish_stopped(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0184usize) as _) }
}
#[doc = "Publish configuration for event END."]
#[inline(always)]
pub const fn publish_end(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0188usize) as _) }
}
#[doc = "Enable or disable interrupt."]
#[inline(always)]
pub const fn inten(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0300usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "PDM module enable register."]
#[inline(always)]
pub const fn enable(self) -> crate::common::Reg<regs::Enable, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0500usize) as _) }
}
#[doc = "PDM clock generator control."]
#[inline(always)]
pub const fn pdmclkctrl(self) -> crate::common::Reg<regs::Pdmclkctrl, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0504usize) as _) }
}
#[doc = "Defines the routing of the connected PDM microphones' signals."]
#[inline(always)]
pub const fn mode(self) -> crate::common::Reg<regs::Mode, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0508usize) as _) }
}
#[doc = "Left output gain adjustment."]
#[inline(always)]
pub const fn gainl(self) -> crate::common::Reg<regs::Gainl, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0518usize) as _) }
}
#[doc = "Right output gain adjustment."]
#[inline(always)]
pub const fn gainr(self) -> crate::common::Reg<regs::Gainr, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x051cusize) as _) }
}
#[doc = "Selects the ratio between PDM_CLK and output sample rate. Change PDMCLKCTRL accordingly."]
#[inline(always)]
pub const fn ratio(self) -> crate::common::Reg<regs::Ratio, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0520usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn psel(self) -> Psel {
unsafe { Psel::from_ptr(self.ptr.wrapping_add(0x0540usize) as _) }
}
#[doc = "Master clock generator configuration."]
#[inline(always)]
pub const fn mclkconfig(self) -> crate::common::Reg<regs::Mclkconfig, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x054cusize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn sample(self) -> Sample {
unsafe { Sample::from_ptr(self.ptr.wrapping_add(0x0560usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Psel {
ptr: *mut u8,
}
unsafe impl Send for Psel {}
unsafe impl Sync for Psel {}
impl Psel {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Pin number configuration for PDM CLK signal."]
#[inline(always)]
pub const fn clk(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Pin number configuration for PDM DIN signal."]
#[inline(always)]
pub const fn din(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Sample {
ptr: *mut u8,
}
unsafe impl Send for Sample {}
unsafe impl Sync for Sample {}
impl Sample {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "RAM address pointer to write samples to with EasyDMA."]
#[inline(always)]
pub const fn ptr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Number of samples to allocate memory for in EasyDMA mode."]
#[inline(always)]
pub const fn maxcnt(self) -> crate::common::Reg<regs::Maxcnt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
pub mod regs {
#[doc = "PDM module enable register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Enable(pub u32);
impl Enable {
#[doc = "Enable or disable PDM module."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable PDM module."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Enable {
#[inline(always)]
fn default() -> Enable {
Enable(0)
}
}
impl core::fmt::Debug for Enable {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Enable")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Enable {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Enable {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "Left output gain adjustment."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Gainl(pub u32);
impl Gainl {
#[doc = "Left output gain adjustment, in 0.5 dB steps, around the default module gain (see electrical parameters) 0x00 -20 dB gain adjust 0x01 -19.5 dB gain adjust (...) 0x27 -0.5 dB gain adjust 0x28 0 dB gain adjust 0x29 +0.5 dB gain adjust (...) 0x4F +19.5 dB gain adjust 0x50 +20 dB gain adjust."]
#[must_use]
#[inline(always)]
pub const fn gainl(&self) -> super::vals::Gain {
let val = (self.0 >> 0usize) & 0x7f;
super::vals::Gain::from_bits(val as u8)
}
#[doc = "Left output gain adjustment, in 0.5 dB steps, around the default module gain (see electrical parameters) 0x00 -20 dB gain adjust 0x01 -19.5 dB gain adjust (...) 0x27 -0.5 dB gain adjust 0x28 0 dB gain adjust 0x29 +0.5 dB gain adjust (...) 0x4F +19.5 dB gain adjust 0x50 +20 dB gain adjust."]
#[inline(always)]
pub const fn set_gainl(&mut self, val: super::vals::Gain) {
self.0 = (self.0 & !(0x7f << 0usize)) | (((val.to_bits() as u32) & 0x7f) << 0usize);
}
}
impl Default for Gainl {
#[inline(always)]
fn default() -> Gainl {
Gainl(0)
}
}
impl core::fmt::Debug for Gainl {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Gainl")
.field("gainl", &self.gainl())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Gainl {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Gainl {{ gainl: {:?} }}", self.gainl())
}
}
#[doc = "Right output gain adjustment."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Gainr(pub u32);
impl Gainr {
#[doc = "Right output gain adjustment, in 0.5 dB steps, around the default module gain (see electrical parameters)."]
#[must_use]
#[inline(always)]
pub const fn gainr(&self) -> super::vals::Gain {
let val = (self.0 >> 0usize) & 0x7f;
super::vals::Gain::from_bits(val as u8)
}
#[doc = "Right output gain adjustment, in 0.5 dB steps, around the default module gain (see electrical parameters)."]
#[inline(always)]
pub const fn set_gainr(&mut self, val: super::vals::Gain) {
self.0 = (self.0 & !(0x7f << 0usize)) | (((val.to_bits() as u32) & 0x7f) << 0usize);
}
}
impl Default for Gainr {
#[inline(always)]
fn default() -> Gainr {
Gainr(0)
}
}
impl core::fmt::Debug for Gainr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Gainr")
.field("gainr", &self.gainr())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Gainr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Gainr {{ gainr: {:?} }}", self.gainr())
}
}
#[doc = "Enable or disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Enable or disable interrupt for event STARTED."]
#[must_use]
#[inline(always)]
pub const fn started(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event STARTED."]
#[inline(always)]
pub const fn set_started(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Enable or disable interrupt for event STOPPED."]
#[must_use]
#[inline(always)]
pub const fn stopped(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event STOPPED."]
#[inline(always)]
pub const fn set_stopped(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enable or disable interrupt for event END."]
#[must_use]
#[inline(always)]
pub const fn end(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event END."]
#[inline(always)]
pub const fn set_end(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("started", &self.started())
.field("stopped", &self.stopped())
.field("end", &self.end())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Int {{ started: {=bool:?}, stopped: {=bool:?}, end: {=bool:?} }}",
self.started(),
self.stopped(),
self.end()
)
}
}
#[doc = "Number of samples to allocate memory for in EasyDMA mode."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Maxcnt(pub u32);
impl Maxcnt {
#[doc = "Length of DMA RAM allocation in number of samples."]
#[must_use]
#[inline(always)]
pub const fn buffsize(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x7fff;
val as u16
}
#[doc = "Length of DMA RAM allocation in number of samples."]
#[inline(always)]
pub const fn set_buffsize(&mut self, val: u16) {
self.0 = (self.0 & !(0x7fff << 0usize)) | (((val as u32) & 0x7fff) << 0usize);
}
}
impl Default for Maxcnt {
#[inline(always)]
fn default() -> Maxcnt {
Maxcnt(0)
}
}
impl core::fmt::Debug for Maxcnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Maxcnt")
.field("buffsize", &self.buffsize())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Maxcnt {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Maxcnt {{ buffsize: {=u16:?} }}", self.buffsize())
}
}
#[doc = "Master clock generator configuration."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Mclkconfig(pub u32);
impl Mclkconfig {
#[doc = "Master clock source selection."]
#[must_use]
#[inline(always)]
pub const fn src(&self) -> super::vals::Src {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Src::from_bits(val as u8)
}
#[doc = "Master clock source selection."]
#[inline(always)]
pub const fn set_src(&mut self, val: super::vals::Src) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Mclkconfig {
#[inline(always)]
fn default() -> Mclkconfig {
Mclkconfig(0)
}
}
impl core::fmt::Debug for Mclkconfig {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Mclkconfig")
.field("src", &self.src())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Mclkconfig {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Mclkconfig {{ src: {:?} }}", self.src())
}
}
#[doc = "Defines the routing of the connected PDM microphones' signals."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Mode(pub u32);
impl Mode {
#[doc = "Mono or stereo operation."]
#[must_use]
#[inline(always)]
pub const fn operation(&self) -> super::vals::Operation {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Operation::from_bits(val as u8)
}
#[doc = "Mono or stereo operation."]
#[inline(always)]
pub const fn set_operation(&mut self, val: super::vals::Operation) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "Defines on which PDM_CLK edge left (or mono) is sampled."]
#[must_use]
#[inline(always)]
pub const fn edge(&self) -> super::vals::Edge {
let val = (self.0 >> 1usize) & 0x01;
super::vals::Edge::from_bits(val as u8)
}
#[doc = "Defines on which PDM_CLK edge left (or mono) is sampled."]
#[inline(always)]
pub const fn set_edge(&mut self, val: super::vals::Edge) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val.to_bits() as u32) & 0x01) << 1usize);
}
}
impl Default for Mode {
#[inline(always)]
fn default() -> Mode {
Mode(0)
}
}
impl core::fmt::Debug for Mode {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Mode")
.field("operation", &self.operation())
.field("edge", &self.edge())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Mode {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Mode {{ operation: {:?}, edge: {:?} }}",
self.operation(),
self.edge()
)
}
}
#[doc = "PDM clock generator control."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Pdmclkctrl(pub u32);
impl Pdmclkctrl {
#[doc = "PDM_CLK frequency configuration. Enumerations are deprecated, use PDMCLKCTRL equation to find the register value. The 12 least significant bits of the register are ignored and shall be set to zero."]
#[must_use]
#[inline(always)]
pub const fn freq(&self) -> super::vals::Freq {
let val = (self.0 >> 0usize) & 0xffff_ffff;
super::vals::Freq::from_bits(val as u32)
}
#[doc = "PDM_CLK frequency configuration. Enumerations are deprecated, use PDMCLKCTRL equation to find the register value. The 12 least significant bits of the register are ignored and shall be set to zero."]
#[inline(always)]
pub const fn set_freq(&mut self, val: super::vals::Freq) {
self.0 = (self.0 & !(0xffff_ffff << 0usize))
| (((val.to_bits() as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Pdmclkctrl {
#[inline(always)]
fn default() -> Pdmclkctrl {
Pdmclkctrl(0)
}
}
impl core::fmt::Debug for Pdmclkctrl {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Pdmclkctrl")
.field("freq", &self.freq())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Pdmclkctrl {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Pdmclkctrl {{ freq: {:?} }}", self.freq())
}
}
#[doc = "Selects the ratio between PDM_CLK and output sample rate. Change PDMCLKCTRL accordingly."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ratio(pub u32);
impl Ratio {
#[doc = "Selects the ratio between PDM_CLK and output sample rate."]
#[must_use]
#[inline(always)]
pub const fn ratio(&self) -> super::vals::Ratio {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Ratio::from_bits(val as u8)
}
#[doc = "Selects the ratio between PDM_CLK and output sample rate."]
#[inline(always)]
pub const fn set_ratio(&mut self, val: super::vals::Ratio) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Ratio {
#[inline(always)]
fn default() -> Ratio {
Ratio(0)
}
}
impl core::fmt::Debug for Ratio {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ratio")
.field("ratio", &self.ratio())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ratio {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Ratio {{ ratio: {:?} }}", self.ratio())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Edge {
#[doc = "Left (or mono) is sampled on falling edge of PDM_CLK."]
LeftFalling = 0x0,
#[doc = "Left (or mono) is sampled on rising edge of PDM_CLK."]
LeftRising = 0x01,
}
impl Edge {
#[inline(always)]
pub const fn from_bits(val: u8) -> Edge {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Edge {
#[inline(always)]
fn from(val: u8) -> Edge {
Edge::from_bits(val)
}
}
impl From<Edge> for u8 {
#[inline(always)]
fn from(val: Edge) -> u8 {
Edge::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Freq(u32);
impl Freq {
#[doc = "PDM_CLK = 32 MHz / 32 = 1.000 MHz."]
pub const _1000k: Self = Self(0x0800_0000);
#[doc = "PDM_CLK = 32 MHz / 31 = 1.032 MHz. Nominal clock for RATIO=Ratio64."]
pub const Default: Self = Self(0x0840_0000);
#[doc = "PDM_CLK = 32 MHz / 30 = 1.067 MHz."]
pub const _1067k: Self = Self(0x0880_0000);
#[doc = "PDM_CLK = 32 MHz / 26 = 1.231 MHz."]
pub const _1231k: Self = Self(0x0980_0000);
#[doc = "PDM_CLK = 32 MHz / 25 = 1.280 MHz. Nominal clock for RATIO=Ratio80."]
pub const _1280k: Self = Self(0x0a00_0000);
#[doc = "PDM_CLK = 32 MHz / 24 = 1.333 MHz."]
pub const _1333k: Self = Self(0x0a80_0000);
}
impl Freq {
pub const fn from_bits(val: u32) -> Freq {
Self(val & 0xffff_ffff)
}
pub const fn to_bits(self) -> u32 {
self.0
}
}
impl core::fmt::Debug for Freq {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x0800_0000 => f.write_str("_1000k"),
0x0840_0000 => f.write_str("Default"),
0x0880_0000 => f.write_str("_1067k"),
0x0980_0000 => f.write_str("_1231k"),
0x0a00_0000 => f.write_str("_1280k"),
0x0a80_0000 => f.write_str("_1333k"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Freq {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x0800_0000 => defmt::write!(f, "_1000k"),
0x0840_0000 => defmt::write!(f, "Default"),
0x0880_0000 => defmt::write!(f, "_1067k"),
0x0980_0000 => defmt::write!(f, "_1231k"),
0x0a00_0000 => defmt::write!(f, "_1280k"),
0x0a80_0000 => defmt::write!(f, "_1333k"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u32> for Freq {
#[inline(always)]
fn from(val: u32) -> Freq {
Freq::from_bits(val)
}
}
impl From<Freq> for u32 {
#[inline(always)]
fn from(val: Freq) -> u32 {
Freq::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Gain(u8);
impl Gain {
#[doc = "-20 dB gain adjustment (minimum)."]
pub const MinGain: Self = Self(0x0);
#[doc = "0 dB gain adjustment."]
pub const DefaultGain: Self = Self(0x28);
#[doc = "+20 dB gain adjustment (maximum)."]
pub const MaxGain: Self = Self(0x50);
}
impl Gain {
pub const fn from_bits(val: u8) -> Gain {
Self(val & 0x7f)
}
pub const fn to_bits(self) -> u8 {
self.0
}
}
impl core::fmt::Debug for Gain {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x0 => f.write_str("MinGain"),
0x28 => f.write_str("DefaultGain"),
0x50 => f.write_str("MaxGain"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Gain {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x0 => defmt::write!(f, "MinGain"),
0x28 => defmt::write!(f, "DefaultGain"),
0x50 => defmt::write!(f, "MaxGain"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u8> for Gain {
#[inline(always)]
fn from(val: u8) -> Gain {
Gain::from_bits(val)
}
}
impl From<Gain> for u8 {
#[inline(always)]
fn from(val: Gain) -> u8 {
Gain::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Operation {
#[doc = "Sample and store one pair (left + right) of 16-bit samples per RAM word R=\\[31:16\\]; L=\\[15:0\\]."]
Stereo = 0x0,
#[doc = "Sample and store two successive left samples (16 bits each) per RAM word L1=\\[31:16\\]; L0=\\[15:0\\]."]
Mono = 0x01,
}
impl Operation {
#[inline(always)]
pub const fn from_bits(val: u8) -> Operation {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Operation {
#[inline(always)]
fn from(val: u8) -> Operation {
Operation::from_bits(val)
}
}
impl From<Operation> for u8 {
#[inline(always)]
fn from(val: Operation) -> u8 {
Operation::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Ratio {
#[doc = "Ratio of 64."]
Ratio64 = 0x0,
#[doc = "Ratio of 80."]
Ratio80 = 0x01,
}
impl Ratio {
#[inline(always)]
pub const fn from_bits(val: u8) -> Ratio {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Ratio {
#[inline(always)]
fn from(val: u8) -> Ratio {
Ratio::from_bits(val)
}
}
impl From<Ratio> for u8 {
#[inline(always)]
fn from(val: Ratio) -> u8 {
Ratio::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Src {
#[doc = "32 MHz peripheral clock."]
Pclk32m = 0x0,
#[doc = "Audio PLL clock."]
Aclk = 0x01,
}
impl Src {
#[inline(always)]
pub const fn from_bits(val: u8) -> Src {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Src {
#[inline(always)]
fn from(val: u8) -> Src {
Src::from_bits(val)
}
}
impl From<Src> for u8 {
#[inline(always)]
fn from(val: Src) -> u8 {
Src::to_bits(val)
}
}
}
}
pub mod power {
#[doc = "Power control 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Power {
ptr: *mut u8,
}
unsafe impl Send for Power {}
unsafe impl Sync for Power {}
impl Power {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Enable Constant Latency mode."]
#[inline(always)]
pub const fn tasks_constlat(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x78usize) as _) }
}
#[doc = "Enable Low-Power mode (variable latency)."]
#[inline(always)]
pub const fn tasks_lowpwr(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x7cusize) as _) }
}
#[doc = "Subscribe configuration for task CONSTLAT."]
#[inline(always)]
pub const fn subscribe_constlat(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xf8usize) as _) }
}
#[doc = "Subscribe configuration for task LOWPWR."]
#[inline(always)]
pub const fn subscribe_lowpwr(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xfcusize) as _) }
}
#[doc = "Power failure warning."]
#[inline(always)]
pub const fn events_pofwarn(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0108usize) as _) }
}
#[doc = "CPU entered WFI/WFE sleep."]
#[inline(always)]
pub const fn events_sleepenter(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0114usize) as _) }
}
#[doc = "CPU exited WFI/WFE sleep."]
#[inline(always)]
pub const fn events_sleepexit(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0118usize) as _) }
}
#[doc = "Publish configuration for event POFWARN."]
#[inline(always)]
pub const fn publish_pofwarn(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0188usize) as _) }
}
#[doc = "Publish configuration for event SLEEPENTER."]
#[inline(always)]
pub const fn publish_sleepenter(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0194usize) as _) }
}
#[doc = "Publish configuration for event SLEEPEXIT."]
#[inline(always)]
pub const fn publish_sleepexit(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0198usize) as _) }
}
#[doc = "Enable or disable interrupt."]
#[inline(always)]
pub const fn inten(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0300usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "Description collection: General purpose retention register."]
#[inline(always)]
pub const fn gpregret(
self,
n: usize,
) -> crate::common::Reg<regs::Gpregret, crate::common::RW> {
assert!(n < 2usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x051cusize + n * 4usize) as _)
}
}
}
pub mod regs {
#[doc = "Description collection: General purpose retention register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Gpregret(pub u32);
impl Gpregret {
#[doc = "General purpose retention register."]
#[must_use]
#[inline(always)]
pub const fn gpregret(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "General purpose retention register."]
#[inline(always)]
pub const fn set_gpregret(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for Gpregret {
#[inline(always)]
fn default() -> Gpregret {
Gpregret(0)
}
}
impl core::fmt::Debug for Gpregret {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Gpregret")
.field("gpregret", &self.gpregret())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Gpregret {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Gpregret {{ gpregret: {=u8:?} }}", self.gpregret())
}
}
#[doc = "Enable or disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Enable or disable interrupt for event POFWARN."]
#[must_use]
#[inline(always)]
pub const fn pofwarn(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event POFWARN."]
#[inline(always)]
pub const fn set_pofwarn(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Enable or disable interrupt for event SLEEPENTER."]
#[must_use]
#[inline(always)]
pub const fn sleepenter(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event SLEEPENTER."]
#[inline(always)]
pub const fn set_sleepenter(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Enable or disable interrupt for event SLEEPEXIT."]
#[must_use]
#[inline(always)]
pub const fn sleepexit(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event SLEEPEXIT."]
#[inline(always)]
pub const fn set_sleepexit(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("pofwarn", &self.pofwarn())
.field("sleepenter", &self.sleepenter())
.field("sleepexit", &self.sleepexit())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Int {{ pofwarn: {=bool:?}, sleepenter: {=bool:?}, sleepexit: {=bool:?} }}",
self.pofwarn(),
self.sleepenter(),
self.sleepexit()
)
}
}
}
}
pub mod pwm {
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Dma {
ptr: *mut u8,
}
unsafe impl Send for Dma {}
unsafe impl Sync for Dma {}
impl Dma {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn seq(self, n: usize) -> DmaSeq {
assert!(n < 2usize);
unsafe { DmaSeq::from_ptr(self.ptr.wrapping_add(0x0usize + n * 32usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DmaSeq {
ptr: *mut u8,
}
unsafe impl Send for DmaSeq {}
unsafe impl Sync for DmaSeq {}
impl DmaSeq {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: Beginning address in RAM of this sequence."]
#[inline(always)]
pub const fn ptr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Description cluster: Number of values (duty cycles) in this sequence."]
#[inline(always)]
pub const fn maxcnt(self) -> crate::common::Reg<regs::Cnt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Description cluster: Number of additional PWM periods between samples loaded into compare register."]
#[inline(always)]
pub const fn refresh(self) -> crate::common::Reg<regs::Refresh, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Description cluster: Time added after the sequence."]
#[inline(always)]
pub const fn enddelay(self) -> crate::common::Reg<regs::Enddelay, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Psel {
ptr: *mut u8,
}
unsafe impl Send for Psel {}
unsafe impl Sync for Psel {}
impl Psel {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description collection: Output pin select for PWM channel n."]
#[inline(always)]
pub const fn out(
self,
n: usize,
) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
assert!(n < 4usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize + n * 4usize) as _)
}
}
}
#[doc = "Pulse width modulation unit 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Pwm {
ptr: *mut u8,
}
unsafe impl Send for Pwm {}
unsafe impl Sync for Pwm {}
impl Pwm {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Stops PWM pulse generation on all channels at the end of current PWM period, and stops sequence playback."]
#[inline(always)]
pub const fn tasks_stop(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[inline(always)]
pub const fn tasks_dma(self) -> TasksDma {
unsafe { TasksDma::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Steps by one value in the current sequence on all enabled channels if DECODER.MODE=NextStep. Does not cause PWM generation to start if not running."]
#[inline(always)]
pub const fn tasks_nextstep(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
#[doc = "Subscribe configuration for task STOP."]
#[inline(always)]
pub const fn subscribe_stop(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x84usize) as _) }
}
#[doc = "Description collection: Subscribe configuration for task SEQSTART\\[n\\]."]
#[inline(always)]
pub const fn subscribe_seqstart(
self,
n: usize,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
assert!(n < 2usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x88usize + n * 4usize) as _)
}
}
#[doc = "Subscribe configuration for task NEXTSTEP."]
#[inline(always)]
pub const fn subscribe_nextstep(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x90usize) as _) }
}
#[doc = "Response to STOP task, emitted when PWM pulses are no longer generated."]
#[inline(always)]
pub const fn events_stopped(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0104usize) as _) }
}
#[doc = "Description collection: First PWM period started on sequence n."]
#[inline(always)]
pub const fn events_seqstarted(
self,
n: usize,
) -> crate::common::Reg<u32, crate::common::RW> {
assert!(n < 2usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0108usize + n * 4usize) as _)
}
}
#[doc = "Description collection: Emitted at end of every sequence n, when last value from RAM has been applied to wave counter."]
#[inline(always)]
pub const fn events_seqend(self, n: usize) -> crate::common::Reg<u32, crate::common::RW> {
assert!(n < 2usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0110usize + n * 4usize) as _)
}
}
#[doc = "Emitted at the end of each PWM period."]
#[inline(always)]
pub const fn events_pwmperiodend(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0118usize) as _) }
}
#[doc = "Concatenated sequences have been played the amount of times defined in LOOP.CNT."]
#[inline(always)]
pub const fn events_loopsdone(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x011cusize) as _) }
}
#[doc = "Publish configuration for event STOPPED."]
#[inline(always)]
pub const fn publish_stopped(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0184usize) as _) }
}
#[doc = "Description collection: Publish configuration for event SEQSTARTED\\[n\\]."]
#[inline(always)]
pub const fn publish_seqstarted(
self,
n: usize,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
assert!(n < 2usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0188usize + n * 4usize) as _)
}
}
#[doc = "Description collection: Publish configuration for event SEQEND\\[n\\]."]
#[inline(always)]
pub const fn publish_seqend(
self,
n: usize,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
assert!(n < 2usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0190usize + n * 4usize) as _)
}
}
#[doc = "Publish configuration for event PWMPERIODEND."]
#[inline(always)]
pub const fn publish_pwmperiodend(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0198usize) as _) }
}
#[doc = "Publish configuration for event LOOPSDONE."]
#[inline(always)]
pub const fn publish_loopsdone(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x019cusize) as _) }
}
#[doc = "Shortcuts between local events and tasks."]
#[inline(always)]
pub const fn shorts(self) -> crate::common::Reg<regs::Shorts, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0200usize) as _) }
}
#[doc = "Enable or disable interrupt."]
#[inline(always)]
pub const fn inten(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0300usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "PWM module enable register."]
#[inline(always)]
pub const fn enable(self) -> crate::common::Reg<regs::Enable, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0500usize) as _) }
}
#[doc = "Selects operating mode of the wave counter."]
#[inline(always)]
pub const fn mode(self) -> crate::common::Reg<regs::Mode, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0504usize) as _) }
}
#[doc = "Value up to which the pulse generator counter counts."]
#[inline(always)]
pub const fn countertop(self) -> crate::common::Reg<regs::Countertop, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0508usize) as _) }
}
#[doc = "Configuration for PWM_CLK."]
#[inline(always)]
pub const fn prescaler(self) -> crate::common::Reg<regs::Prescaler, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x050cusize) as _) }
}
#[doc = "Configuration of the decoder."]
#[inline(always)]
pub const fn decoder(self) -> crate::common::Reg<regs::Decoder, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0510usize) as _) }
}
#[doc = "Number of playbacks of a loop."]
#[inline(always)]
pub const fn loop_(self) -> crate::common::Reg<regs::Loop, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0514usize) as _) }
}
#[inline(always)]
pub const fn dma(self) -> Dma {
unsafe { Dma::from_ptr(self.ptr.wrapping_add(0x0520usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn psel(self) -> Psel {
unsafe { Psel::from_ptr(self.ptr.wrapping_add(0x0560usize) as _) }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TasksDma {
ptr: *mut u8,
}
unsafe impl Send for TasksDma {}
unsafe impl Sync for TasksDma {}
impl TasksDma {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[inline(always)]
pub const fn seq(self, n: usize) -> TasksDmaSeq {
assert!(n < 2usize);
unsafe { TasksDmaSeq::from_ptr(self.ptr.wrapping_add(0x0usize + n * 4usize) as _) }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TasksDmaSeq {
ptr: *mut u8,
}
unsafe impl Send for TasksDmaSeq {}
unsafe impl Sync for TasksDmaSeq {}
impl TasksDmaSeq {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description collection: Loads the first PWM value on all enabled channels from sequence n, and starts playing that sequence at the rate defined in SEQ\\[n\\]REFRESH and/or DECODER.MODE. Causes PWM generation to start if not running."]
#[inline(always)]
pub const fn start(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
}
pub mod regs {
#[doc = "Description cluster: Number of values (duty cycles) in this sequence."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cnt(pub u32);
impl Cnt {
#[doc = "Number of values (duty cycles) in this sequence."]
#[must_use]
#[inline(always)]
pub const fn cnt(&self) -> super::vals::CntCnt {
let val = (self.0 >> 0usize) & 0x7fff;
super::vals::CntCnt::from_bits(val as u16)
}
#[doc = "Number of values (duty cycles) in this sequence."]
#[inline(always)]
pub const fn set_cnt(&mut self, val: super::vals::CntCnt) {
self.0 =
(self.0 & !(0x7fff << 0usize)) | (((val.to_bits() as u32) & 0x7fff) << 0usize);
}
}
impl Default for Cnt {
#[inline(always)]
fn default() -> Cnt {
Cnt(0)
}
}
impl core::fmt::Debug for Cnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cnt").field("cnt", &self.cnt()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cnt {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Cnt {{ cnt: {:?} }}", self.cnt())
}
}
#[doc = "Value up to which the pulse generator counter counts."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Countertop(pub u32);
impl Countertop {
#[doc = "Value up to which the pulse generator counter counts. This register is ignored when DECODER.MODE=WaveForm and only values from RAM are used."]
#[must_use]
#[inline(always)]
pub const fn countertop(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x7fff;
val as u16
}
#[doc = "Value up to which the pulse generator counter counts. This register is ignored when DECODER.MODE=WaveForm and only values from RAM are used."]
#[inline(always)]
pub const fn set_countertop(&mut self, val: u16) {
self.0 = (self.0 & !(0x7fff << 0usize)) | (((val as u32) & 0x7fff) << 0usize);
}
}
impl Default for Countertop {
#[inline(always)]
fn default() -> Countertop {
Countertop(0)
}
}
impl core::fmt::Debug for Countertop {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Countertop")
.field("countertop", &self.countertop())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Countertop {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Countertop {{ countertop: {=u16:?} }}",
self.countertop()
)
}
}
#[doc = "Configuration of the decoder."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Decoder(pub u32);
impl Decoder {
#[doc = "How a sequence is read from RAM and spread to the compare register."]
#[must_use]
#[inline(always)]
pub const fn load(&self) -> super::vals::Load {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Load::from_bits(val as u8)
}
#[doc = "How a sequence is read from RAM and spread to the compare register."]
#[inline(always)]
pub const fn set_load(&mut self, val: super::vals::Load) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
#[doc = "Selects source for advancing the active sequence."]
#[must_use]
#[inline(always)]
pub const fn mode(&self) -> super::vals::Mode {
let val = (self.0 >> 8usize) & 0x01;
super::vals::Mode::from_bits(val as u8)
}
#[doc = "Selects source for advancing the active sequence."]
#[inline(always)]
pub const fn set_mode(&mut self, val: super::vals::Mode) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val.to_bits() as u32) & 0x01) << 8usize);
}
}
impl Default for Decoder {
#[inline(always)]
fn default() -> Decoder {
Decoder(0)
}
}
impl core::fmt::Debug for Decoder {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Decoder")
.field("load", &self.load())
.field("mode", &self.mode())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Decoder {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Decoder {{ load: {:?}, mode: {:?} }}",
self.load(),
self.mode()
)
}
}
#[doc = "PWM module enable register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Enable(pub u32);
impl Enable {
#[doc = "Enable or disable PWM module."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable PWM module."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Enable {
#[inline(always)]
fn default() -> Enable {
Enable(0)
}
}
impl core::fmt::Debug for Enable {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Enable")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Enable {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Enable {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "Description cluster: Time added after the sequence."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Enddelay(pub u32);
impl Enddelay {
#[doc = "Time added after the sequence in PWM periods."]
#[must_use]
#[inline(always)]
pub const fn cnt(&self) -> u32 {
let val = (self.0 >> 0usize) & 0x00ff_ffff;
val as u32
}
#[doc = "Time added after the sequence in PWM periods."]
#[inline(always)]
pub const fn set_cnt(&mut self, val: u32) {
self.0 =
(self.0 & !(0x00ff_ffff << 0usize)) | (((val as u32) & 0x00ff_ffff) << 0usize);
}
}
impl Default for Enddelay {
#[inline(always)]
fn default() -> Enddelay {
Enddelay(0)
}
}
impl core::fmt::Debug for Enddelay {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Enddelay")
.field("cnt", &self.cnt())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Enddelay {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Enddelay {{ cnt: {=u32:?} }}", self.cnt())
}
}
#[doc = "Enable or disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Enable or disable interrupt for event STOPPED."]
#[must_use]
#[inline(always)]
pub const fn stopped(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event STOPPED."]
#[inline(always)]
pub const fn set_stopped(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enable or disable interrupt for event SEQSTARTED\\[0\\]."]
#[must_use]
#[inline(always)]
pub const fn seqstarted0(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event SEQSTARTED\\[0\\]."]
#[inline(always)]
pub const fn set_seqstarted0(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Enable or disable interrupt for event SEQSTARTED\\[1\\]."]
#[must_use]
#[inline(always)]
pub const fn seqstarted1(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event SEQSTARTED\\[1\\]."]
#[inline(always)]
pub const fn set_seqstarted1(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Enable or disable interrupt for event SEQEND\\[0\\]."]
#[must_use]
#[inline(always)]
pub const fn seqend0(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event SEQEND\\[0\\]."]
#[inline(always)]
pub const fn set_seqend0(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Enable or disable interrupt for event SEQEND\\[1\\]."]
#[must_use]
#[inline(always)]
pub const fn seqend1(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event SEQEND\\[1\\]."]
#[inline(always)]
pub const fn set_seqend1(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Enable or disable interrupt for event PWMPERIODEND."]
#[must_use]
#[inline(always)]
pub const fn pwmperiodend(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event PWMPERIODEND."]
#[inline(always)]
pub const fn set_pwmperiodend(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "Enable or disable interrupt for event LOOPSDONE."]
#[must_use]
#[inline(always)]
pub const fn loopsdone(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event LOOPSDONE."]
#[inline(always)]
pub const fn set_loopsdone(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("stopped", &self.stopped())
.field("seqstarted0", &self.seqstarted0())
.field("seqstarted1", &self.seqstarted1())
.field("seqend0", &self.seqend0())
.field("seqend1", &self.seqend1())
.field("pwmperiodend", &self.pwmperiodend())
.field("loopsdone", &self.loopsdone())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Int {{ stopped: {=bool:?}, seqstarted0: {=bool:?}, seqstarted1: {=bool:?}, seqend0: {=bool:?}, seqend1: {=bool:?}, pwmperiodend: {=bool:?}, loopsdone: {=bool:?} }}" , self . stopped () , self . seqstarted0 () , self . seqstarted1 () , self . seqend0 () , self . seqend1 () , self . pwmperiodend () , self . loopsdone ())
}
}
#[doc = "Number of playbacks of a loop."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Loop(pub u32);
impl Loop {
#[doc = "Number of playbacks of pattern cycles."]
#[must_use]
#[inline(always)]
pub const fn cnt(&self) -> super::vals::LoopCnt {
let val = (self.0 >> 0usize) & 0xffff;
super::vals::LoopCnt::from_bits(val as u16)
}
#[doc = "Number of playbacks of pattern cycles."]
#[inline(always)]
pub const fn set_cnt(&mut self, val: super::vals::LoopCnt) {
self.0 =
(self.0 & !(0xffff << 0usize)) | (((val.to_bits() as u32) & 0xffff) << 0usize);
}
}
impl Default for Loop {
#[inline(always)]
fn default() -> Loop {
Loop(0)
}
}
impl core::fmt::Debug for Loop {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Loop").field("cnt", &self.cnt()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Loop {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Loop {{ cnt: {:?} }}", self.cnt())
}
}
#[doc = "Selects operating mode of the wave counter."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Mode(pub u32);
impl Mode {
#[doc = "Selects up mode or up-and-down mode for the counter."]
#[must_use]
#[inline(always)]
pub const fn updown(&self) -> super::vals::Updown {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Updown::from_bits(val as u8)
}
#[doc = "Selects up mode or up-and-down mode for the counter."]
#[inline(always)]
pub const fn set_updown(&mut self, val: super::vals::Updown) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Mode {
#[inline(always)]
fn default() -> Mode {
Mode(0)
}
}
impl core::fmt::Debug for Mode {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Mode")
.field("updown", &self.updown())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Mode {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Mode {{ updown: {:?} }}", self.updown())
}
}
#[doc = "Configuration for PWM_CLK."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Prescaler(pub u32);
impl Prescaler {
#[doc = "Prescaler of PWM_CLK."]
#[must_use]
#[inline(always)]
pub const fn prescaler(&self) -> super::vals::Prescaler {
let val = (self.0 >> 0usize) & 0x07;
super::vals::Prescaler::from_bits(val as u8)
}
#[doc = "Prescaler of PWM_CLK."]
#[inline(always)]
pub const fn set_prescaler(&mut self, val: super::vals::Prescaler) {
self.0 = (self.0 & !(0x07 << 0usize)) | (((val.to_bits() as u32) & 0x07) << 0usize);
}
}
impl Default for Prescaler {
#[inline(always)]
fn default() -> Prescaler {
Prescaler(0)
}
}
impl core::fmt::Debug for Prescaler {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Prescaler")
.field("prescaler", &self.prescaler())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Prescaler {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Prescaler {{ prescaler: {:?} }}", self.prescaler())
}
}
#[doc = "Description cluster: Number of additional PWM periods between samples loaded into compare register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Refresh(pub u32);
impl Refresh {
#[doc = "Number of additional PWM periods between samples loaded into compare register (load every REFRESH.CNT+1 PWM periods)."]
#[must_use]
#[inline(always)]
pub const fn cnt(&self) -> super::vals::RefreshCnt {
let val = (self.0 >> 0usize) & 0x00ff_ffff;
super::vals::RefreshCnt::from_bits(val as u32)
}
#[doc = "Number of additional PWM periods between samples loaded into compare register (load every REFRESH.CNT+1 PWM periods)."]
#[inline(always)]
pub const fn set_cnt(&mut self, val: super::vals::RefreshCnt) {
self.0 = (self.0 & !(0x00ff_ffff << 0usize))
| (((val.to_bits() as u32) & 0x00ff_ffff) << 0usize);
}
}
impl Default for Refresh {
#[inline(always)]
fn default() -> Refresh {
Refresh(0)
}
}
impl core::fmt::Debug for Refresh {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Refresh").field("cnt", &self.cnt()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Refresh {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Refresh {{ cnt: {:?} }}", self.cnt())
}
}
#[doc = "Shortcuts between local events and tasks."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Shorts(pub u32);
impl Shorts {
#[doc = "Shortcut between event SEQEND\\[0\\] and task STOP."]
#[must_use]
#[inline(always)]
pub const fn seqend0_stop(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event SEQEND\\[0\\] and task STOP."]
#[inline(always)]
pub const fn set_seqend0_stop(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Shortcut between event SEQEND\\[1\\] and task STOP."]
#[must_use]
#[inline(always)]
pub const fn seqend1_stop(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event SEQEND\\[1\\] and task STOP."]
#[inline(always)]
pub const fn set_seqend1_stop(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Shortcut between event LOOPSDONE and task SEQSTART\\[0\\]."]
#[must_use]
#[inline(always)]
pub const fn loopsdone_dma_seq0_start(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event LOOPSDONE and task SEQSTART\\[0\\]."]
#[inline(always)]
pub const fn set_loopsdone_dma_seq0_start(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Shortcut between event LOOPSDONE and task SEQSTART\\[1\\]."]
#[must_use]
#[inline(always)]
pub const fn loopsdone_seqstart1(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event LOOPSDONE and task SEQSTART\\[1\\]."]
#[inline(always)]
pub const fn set_loopsdone_seqstart1(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Shortcut between event LOOPSDONE and task STOP."]
#[must_use]
#[inline(always)]
pub const fn loopsdone_stop(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event LOOPSDONE and task STOP."]
#[inline(always)]
pub const fn set_loopsdone_stop(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
}
impl Default for Shorts {
#[inline(always)]
fn default() -> Shorts {
Shorts(0)
}
}
impl core::fmt::Debug for Shorts {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Shorts")
.field("seqend0_stop", &self.seqend0_stop())
.field("seqend1_stop", &self.seqend1_stop())
.field("loopsdone_dma_seq0_start", &self.loopsdone_dma_seq0_start())
.field("loopsdone_seqstart1", &self.loopsdone_seqstart1())
.field("loopsdone_stop", &self.loopsdone_stop())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Shorts {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Shorts {{ seqend0_stop: {=bool:?}, seqend1_stop: {=bool:?}, loopsdone_dma_seq0_start: {=bool:?}, loopsdone_seqstart1: {=bool:?}, loopsdone_stop: {=bool:?} }}" , self . seqend0_stop () , self . seqend1_stop () , self . loopsdone_dma_seq0_start () , self . loopsdone_seqstart1 () , self . loopsdone_stop ())
}
}
}
pub mod vals {
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct CntCnt(u16);
impl CntCnt {
#[doc = "Sequence is disabled, and shall not be started as it is empty."]
pub const Disabled: Self = Self(0x0);
}
impl CntCnt {
pub const fn from_bits(val: u16) -> CntCnt {
Self(val & 0x7fff)
}
pub const fn to_bits(self) -> u16 {
self.0
}
}
impl core::fmt::Debug for CntCnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x0 => f.write_str("Disabled"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for CntCnt {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x0 => defmt::write!(f, "Disabled"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u16> for CntCnt {
#[inline(always)]
fn from(val: u16) -> CntCnt {
CntCnt::from_bits(val)
}
}
impl From<CntCnt> for u16 {
#[inline(always)]
fn from(val: CntCnt) -> u16 {
CntCnt::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Load {
#[doc = "1st half word (16-bit) used in all PWM channels 0..3."]
Common = 0x0,
#[doc = "1st half word (16-bit) used in channel 0..1; 2nd word in channel 2..3."]
Grouped = 0x01,
#[doc = "1st half word (16-bit) in ch.0; 2nd in ch.1; ...; 4th in ch.3."]
Individual = 0x02,
#[doc = "1st half word (16-bit) in ch.0; 2nd in ch.1; ...; 4th in COUNTERTOP."]
WaveForm = 0x03,
}
impl Load {
#[inline(always)]
pub const fn from_bits(val: u8) -> Load {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Load {
#[inline(always)]
fn from(val: u8) -> Load {
Load::from_bits(val)
}
}
impl From<Load> for u8 {
#[inline(always)]
fn from(val: Load) -> u8 {
Load::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct LoopCnt(u16);
impl LoopCnt {
#[doc = "Looping disabled (stop at the end of the sequence)."]
pub const Disabled: Self = Self(0x0);
}
impl LoopCnt {
pub const fn from_bits(val: u16) -> LoopCnt {
Self(val & 0xffff)
}
pub const fn to_bits(self) -> u16 {
self.0
}
}
impl core::fmt::Debug for LoopCnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x0 => f.write_str("Disabled"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for LoopCnt {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x0 => defmt::write!(f, "Disabled"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u16> for LoopCnt {
#[inline(always)]
fn from(val: u16) -> LoopCnt {
LoopCnt::from_bits(val)
}
}
impl From<LoopCnt> for u16 {
#[inline(always)]
fn from(val: LoopCnt) -> u16 {
LoopCnt::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Mode {
#[doc = "SEQ\\[n\\].REFRESH is used to determine loading internal compare registers."]
RefreshCount = 0x0,
#[doc = "NEXTSTEP task causes a new value to be loaded to internal compare registers."]
NextStep = 0x01,
}
impl Mode {
#[inline(always)]
pub const fn from_bits(val: u8) -> Mode {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Mode {
#[inline(always)]
fn from(val: u8) -> Mode {
Mode::from_bits(val)
}
}
impl From<Mode> for u8 {
#[inline(always)]
fn from(val: Mode) -> u8 {
Mode::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Prescaler {
#[doc = "Divide by 1 (16 MHz)."]
Div1 = 0x0,
#[doc = "Divide by 2 (8 MHz)."]
Div2 = 0x01,
#[doc = "Divide by 4 (4 MHz)."]
Div4 = 0x02,
#[doc = "Divide by 8 (2 MHz)."]
Div8 = 0x03,
#[doc = "Divide by 16 (1 MHz)."]
Div16 = 0x04,
#[doc = "Divide by 32 (500 kHz)."]
Div32 = 0x05,
#[doc = "Divide by 64 (250 kHz)."]
Div64 = 0x06,
#[doc = "Divide by 128 (125 kHz)."]
Div128 = 0x07,
}
impl Prescaler {
#[inline(always)]
pub const fn from_bits(val: u8) -> Prescaler {
unsafe { core::mem::transmute(val & 0x07) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Prescaler {
#[inline(always)]
fn from(val: u8) -> Prescaler {
Prescaler::from_bits(val)
}
}
impl From<Prescaler> for u8 {
#[inline(always)]
fn from(val: Prescaler) -> u8 {
Prescaler::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct RefreshCnt(u32);
impl RefreshCnt {
#[doc = "Update every PWM period."]
pub const Continuous: Self = Self(0x0);
}
impl RefreshCnt {
pub const fn from_bits(val: u32) -> RefreshCnt {
Self(val & 0x00ff_ffff)
}
pub const fn to_bits(self) -> u32 {
self.0
}
}
impl core::fmt::Debug for RefreshCnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x0 => f.write_str("Continuous"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RefreshCnt {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x0 => defmt::write!(f, "Continuous"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u32> for RefreshCnt {
#[inline(always)]
fn from(val: u32) -> RefreshCnt {
RefreshCnt::from_bits(val)
}
}
impl From<RefreshCnt> for u32 {
#[inline(always)]
fn from(val: RefreshCnt) -> u32 {
RefreshCnt::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Updown {
#[doc = "Up counter, edge-aligned PWM duty cycle."]
Up = 0x0,
#[doc = "Up and down counter, center-aligned PWM duty cycle."]
UpAndDown = 0x01,
}
impl Updown {
#[inline(always)]
pub const fn from_bits(val: u8) -> Updown {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Updown {
#[inline(always)]
fn from(val: u8) -> Updown {
Updown::from_bits(val)
}
}
impl From<Updown> for u8 {
#[inline(always)]
fn from(val: Updown) -> u8 {
Updown::to_bits(val)
}
}
}
}
pub mod qdec {
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Psel {
ptr: *mut u8,
}
unsafe impl Send for Psel {}
unsafe impl Sync for Psel {}
impl Psel {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Pin select for LED signal."]
#[inline(always)]
pub const fn led(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Pin select for A signal."]
#[inline(always)]
pub const fn a(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Pin select for B signal."]
#[inline(always)]
pub const fn b(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
}
#[doc = "Quadrature Decoder 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Qdec {
ptr: *mut u8,
}
unsafe impl Send for Qdec {}
unsafe impl Sync for Qdec {}
impl Qdec {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Task starting the quadrature decoder."]
#[inline(always)]
pub const fn tasks_start(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Task stopping the quadrature decoder."]
#[inline(always)]
pub const fn tasks_stop(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Read and clear ACC and ACCDBL."]
#[inline(always)]
pub const fn tasks_readclracc(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Read and clear ACC."]
#[inline(always)]
pub const fn tasks_rdclracc(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
#[doc = "Read and clear ACCDBL."]
#[inline(always)]
pub const fn tasks_rdclrdbl(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
#[doc = "Subscribe configuration for task START."]
#[inline(always)]
pub const fn subscribe_start(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x80usize) as _) }
}
#[doc = "Subscribe configuration for task STOP."]
#[inline(always)]
pub const fn subscribe_stop(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x84usize) as _) }
}
#[doc = "Subscribe configuration for task READCLRACC."]
#[inline(always)]
pub const fn subscribe_readclracc(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x88usize) as _) }
}
#[doc = "Subscribe configuration for task RDCLRACC."]
#[inline(always)]
pub const fn subscribe_rdclracc(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x8cusize) as _) }
}
#[doc = "Subscribe configuration for task RDCLRDBL."]
#[inline(always)]
pub const fn subscribe_rdclrdbl(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x90usize) as _) }
}
#[doc = "Event being generated for every new sample value written to the SAMPLE register."]
#[inline(always)]
pub const fn events_samplerdy(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0100usize) as _) }
}
#[doc = "Non-null report ready."]
#[inline(always)]
pub const fn events_reportrdy(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0104usize) as _) }
}
#[doc = "ACC or ACCDBL register overflow."]
#[inline(always)]
pub const fn events_accof(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0108usize) as _) }
}
#[doc = "Double displacement(s) detected."]
#[inline(always)]
pub const fn events_dblrdy(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x010cusize) as _) }
}
#[doc = "QDEC has been stopped."]
#[inline(always)]
pub const fn events_stopped(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0110usize) as _) }
}
#[doc = "Publish configuration for event SAMPLERDY."]
#[inline(always)]
pub const fn publish_samplerdy(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0180usize) as _) }
}
#[doc = "Publish configuration for event REPORTRDY."]
#[inline(always)]
pub const fn publish_reportrdy(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0184usize) as _) }
}
#[doc = "Publish configuration for event ACCOF."]
#[inline(always)]
pub const fn publish_accof(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0188usize) as _) }
}
#[doc = "Publish configuration for event DBLRDY."]
#[inline(always)]
pub const fn publish_dblrdy(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x018cusize) as _) }
}
#[doc = "Publish configuration for event STOPPED."]
#[inline(always)]
pub const fn publish_stopped(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0190usize) as _) }
}
#[doc = "Shortcuts between local events and tasks."]
#[inline(always)]
pub const fn shorts(self) -> crate::common::Reg<regs::Shorts, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0200usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "Enable the quadrature decoder."]
#[inline(always)]
pub const fn enable(self) -> crate::common::Reg<regs::Enable, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0500usize) as _) }
}
#[doc = "LED output pin polarity."]
#[inline(always)]
pub const fn ledpol(self) -> crate::common::Reg<regs::Ledpol, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0504usize) as _) }
}
#[doc = "Sample period."]
#[inline(always)]
pub const fn sampleper(self) -> crate::common::Reg<regs::Sampleper, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0508usize) as _) }
}
#[doc = "Motion sample value."]
#[inline(always)]
pub const fn sample(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x050cusize) as _) }
}
#[doc = "Number of samples to be taken before REPORTRDY and DBLRDY events can be generated."]
#[inline(always)]
pub const fn reportper(self) -> crate::common::Reg<regs::Reportper, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0510usize) as _) }
}
#[doc = "Register accumulating the valid transitions."]
#[inline(always)]
pub const fn acc(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0514usize) as _) }
}
#[doc = "Snapshot of the ACC register, updated by the READCLRACC or RDCLRACC task."]
#[inline(always)]
pub const fn accread(self) -> crate::common::Reg<u32, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0518usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn psel(self) -> Psel {
unsafe { Psel::from_ptr(self.ptr.wrapping_add(0x051cusize) as _) }
}
#[doc = "Enable input debounce filters."]
#[inline(always)]
pub const fn dbfen(self) -> crate::common::Reg<regs::Dbfen, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0528usize) as _) }
}
#[doc = "Time period the LED is switched ON prior to sampling."]
#[inline(always)]
pub const fn ledpre(self) -> crate::common::Reg<regs::Ledpre, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0540usize) as _) }
}
#[doc = "Register accumulating the number of detected double transitions."]
#[inline(always)]
pub const fn accdbl(self) -> crate::common::Reg<regs::Accdbl, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0544usize) as _) }
}
#[doc = "Snapshot of the ACCDBL, updated by the READCLRACC or RDCLRDBL task."]
#[inline(always)]
pub const fn accdblread(self) -> crate::common::Reg<regs::Accdblread, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0548usize) as _) }
}
}
pub mod regs {
#[doc = "Register accumulating the number of detected double transitions."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Accdbl(pub u32);
impl Accdbl {
#[doc = "Register accumulating the number of detected double or illegal transitions. ( SAMPLE = 2 )."]
#[must_use]
#[inline(always)]
pub const fn accdbl(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x0f;
val as u8
}
#[doc = "Register accumulating the number of detected double or illegal transitions. ( SAMPLE = 2 )."]
#[inline(always)]
pub const fn set_accdbl(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val as u32) & 0x0f) << 0usize);
}
}
impl Default for Accdbl {
#[inline(always)]
fn default() -> Accdbl {
Accdbl(0)
}
}
impl core::fmt::Debug for Accdbl {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Accdbl")
.field("accdbl", &self.accdbl())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Accdbl {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Accdbl {{ accdbl: {=u8:?} }}", self.accdbl())
}
}
#[doc = "Snapshot of the ACCDBL, updated by the READCLRACC or RDCLRDBL task."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Accdblread(pub u32);
impl Accdblread {
#[doc = "Snapshot of the ACCDBL register. This field is updated when the READCLRACC or RDCLRDBL task is triggered."]
#[must_use]
#[inline(always)]
pub const fn accdblread(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x0f;
val as u8
}
#[doc = "Snapshot of the ACCDBL register. This field is updated when the READCLRACC or RDCLRDBL task is triggered."]
#[inline(always)]
pub const fn set_accdblread(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val as u32) & 0x0f) << 0usize);
}
}
impl Default for Accdblread {
#[inline(always)]
fn default() -> Accdblread {
Accdblread(0)
}
}
impl core::fmt::Debug for Accdblread {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Accdblread")
.field("accdblread", &self.accdblread())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Accdblread {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Accdblread {{ accdblread: {=u8:?} }}", self.accdblread())
}
}
#[doc = "Enable input debounce filters."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Dbfen(pub u32);
impl Dbfen {
#[doc = "Enable input debounce filters."]
#[must_use]
#[inline(always)]
pub const fn dbfen(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable input debounce filters."]
#[inline(always)]
pub const fn set_dbfen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Dbfen {
#[inline(always)]
fn default() -> Dbfen {
Dbfen(0)
}
}
impl core::fmt::Debug for Dbfen {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Dbfen")
.field("dbfen", &self.dbfen())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Dbfen {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Dbfen {{ dbfen: {=bool:?} }}", self.dbfen())
}
}
#[doc = "Enable the quadrature decoder."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Enable(pub u32);
impl Enable {
#[doc = "Enable or disable the quadrature decoder."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable the quadrature decoder."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Enable {
#[inline(always)]
fn default() -> Enable {
Enable(0)
}
}
impl core::fmt::Debug for Enable {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Enable")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Enable {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Enable {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "Disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Write '1' to disable interrupt for event SAMPLERDY."]
#[must_use]
#[inline(always)]
pub const fn samplerdy(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event SAMPLERDY."]
#[inline(always)]
pub const fn set_samplerdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Write '1' to disable interrupt for event REPORTRDY."]
#[must_use]
#[inline(always)]
pub const fn reportrdy(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event REPORTRDY."]
#[inline(always)]
pub const fn set_reportrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Write '1' to disable interrupt for event ACCOF."]
#[must_use]
#[inline(always)]
pub const fn accof(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event ACCOF."]
#[inline(always)]
pub const fn set_accof(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Write '1' to disable interrupt for event DBLRDY."]
#[must_use]
#[inline(always)]
pub const fn dblrdy(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event DBLRDY."]
#[inline(always)]
pub const fn set_dblrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Write '1' to disable interrupt for event STOPPED."]
#[must_use]
#[inline(always)]
pub const fn stopped(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event STOPPED."]
#[inline(always)]
pub const fn set_stopped(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("samplerdy", &self.samplerdy())
.field("reportrdy", &self.reportrdy())
.field("accof", &self.accof())
.field("dblrdy", &self.dblrdy())
.field("stopped", &self.stopped())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Int {{ samplerdy: {=bool:?}, reportrdy: {=bool:?}, accof: {=bool:?}, dblrdy: {=bool:?}, stopped: {=bool:?} }}" , self . samplerdy () , self . reportrdy () , self . accof () , self . dblrdy () , self . stopped ())
}
}
#[doc = "LED output pin polarity."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ledpol(pub u32);
impl Ledpol {
#[doc = "LED output pin polarity."]
#[must_use]
#[inline(always)]
pub const fn ledpol(&self) -> super::vals::Ledpol {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Ledpol::from_bits(val as u8)
}
#[doc = "LED output pin polarity."]
#[inline(always)]
pub const fn set_ledpol(&mut self, val: super::vals::Ledpol) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Ledpol {
#[inline(always)]
fn default() -> Ledpol {
Ledpol(0)
}
}
impl core::fmt::Debug for Ledpol {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ledpol")
.field("ledpol", &self.ledpol())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ledpol {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Ledpol {{ ledpol: {:?} }}", self.ledpol())
}
}
#[doc = "Time period the LED is switched ON prior to sampling."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ledpre(pub u32);
impl Ledpre {
#[doc = "Period in us the LED is switched on prior to sampling."]
#[must_use]
#[inline(always)]
pub const fn ledpre(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x01ff;
val as u16
}
#[doc = "Period in us the LED is switched on prior to sampling."]
#[inline(always)]
pub const fn set_ledpre(&mut self, val: u16) {
self.0 = (self.0 & !(0x01ff << 0usize)) | (((val as u32) & 0x01ff) << 0usize);
}
}
impl Default for Ledpre {
#[inline(always)]
fn default() -> Ledpre {
Ledpre(0)
}
}
impl core::fmt::Debug for Ledpre {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ledpre")
.field("ledpre", &self.ledpre())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ledpre {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Ledpre {{ ledpre: {=u16:?} }}", self.ledpre())
}
}
#[doc = "Number of samples to be taken before REPORTRDY and DBLRDY events can be generated."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Reportper(pub u32);
impl Reportper {
#[doc = "Specifies the number of samples to be accumulated in the ACC register before the REPORTRDY and DBLRDY events can be generated."]
#[must_use]
#[inline(always)]
pub const fn reportper(&self) -> super::vals::Reportper {
let val = (self.0 >> 0usize) & 0x0f;
super::vals::Reportper::from_bits(val as u8)
}
#[doc = "Specifies the number of samples to be accumulated in the ACC register before the REPORTRDY and DBLRDY events can be generated."]
#[inline(always)]
pub const fn set_reportper(&mut self, val: super::vals::Reportper) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val.to_bits() as u32) & 0x0f) << 0usize);
}
}
impl Default for Reportper {
#[inline(always)]
fn default() -> Reportper {
Reportper(0)
}
}
impl core::fmt::Debug for Reportper {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Reportper")
.field("reportper", &self.reportper())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Reportper {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Reportper {{ reportper: {:?} }}", self.reportper())
}
}
#[doc = "Sample period."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Sampleper(pub u32);
impl Sampleper {
#[doc = "Sample period. The SAMPLE register will be updated for every new sample."]
#[must_use]
#[inline(always)]
pub const fn sampleper(&self) -> super::vals::Sampleper {
let val = (self.0 >> 0usize) & 0x0f;
super::vals::Sampleper::from_bits(val as u8)
}
#[doc = "Sample period. The SAMPLE register will be updated for every new sample."]
#[inline(always)]
pub const fn set_sampleper(&mut self, val: super::vals::Sampleper) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val.to_bits() as u32) & 0x0f) << 0usize);
}
}
impl Default for Sampleper {
#[inline(always)]
fn default() -> Sampleper {
Sampleper(0)
}
}
impl core::fmt::Debug for Sampleper {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Sampleper")
.field("sampleper", &self.sampleper())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Sampleper {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Sampleper {{ sampleper: {:?} }}", self.sampleper())
}
}
#[doc = "Shortcuts between local events and tasks."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Shorts(pub u32);
impl Shorts {
#[doc = "Shortcut between event REPORTRDY and task READCLRACC."]
#[must_use]
#[inline(always)]
pub const fn reportrdy_readclracc(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event REPORTRDY and task READCLRACC."]
#[inline(always)]
pub const fn set_reportrdy_readclracc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Shortcut between event SAMPLERDY and task STOP."]
#[must_use]
#[inline(always)]
pub const fn samplerdy_stop(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event SAMPLERDY and task STOP."]
#[inline(always)]
pub const fn set_samplerdy_stop(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Shortcut between event REPORTRDY and task RDCLRACC."]
#[must_use]
#[inline(always)]
pub const fn reportrdy_rdclracc(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event REPORTRDY and task RDCLRACC."]
#[inline(always)]
pub const fn set_reportrdy_rdclracc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Shortcut between event REPORTRDY and task STOP."]
#[must_use]
#[inline(always)]
pub const fn reportrdy_stop(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event REPORTRDY and task STOP."]
#[inline(always)]
pub const fn set_reportrdy_stop(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Shortcut between event DBLRDY and task RDCLRDBL."]
#[must_use]
#[inline(always)]
pub const fn dblrdy_rdclrdbl(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event DBLRDY and task RDCLRDBL."]
#[inline(always)]
pub const fn set_dblrdy_rdclrdbl(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Shortcut between event DBLRDY and task STOP."]
#[must_use]
#[inline(always)]
pub const fn dblrdy_stop(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event DBLRDY and task STOP."]
#[inline(always)]
pub const fn set_dblrdy_stop(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Shortcut between event SAMPLERDY and task READCLRACC."]
#[must_use]
#[inline(always)]
pub const fn samplerdy_readclracc(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event SAMPLERDY and task READCLRACC."]
#[inline(always)]
pub const fn set_samplerdy_readclracc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
}
impl Default for Shorts {
#[inline(always)]
fn default() -> Shorts {
Shorts(0)
}
}
impl core::fmt::Debug for Shorts {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Shorts")
.field("reportrdy_readclracc", &self.reportrdy_readclracc())
.field("samplerdy_stop", &self.samplerdy_stop())
.field("reportrdy_rdclracc", &self.reportrdy_rdclracc())
.field("reportrdy_stop", &self.reportrdy_stop())
.field("dblrdy_rdclrdbl", &self.dblrdy_rdclrdbl())
.field("dblrdy_stop", &self.dblrdy_stop())
.field("samplerdy_readclracc", &self.samplerdy_readclracc())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Shorts {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Shorts {{ reportrdy_readclracc: {=bool:?}, samplerdy_stop: {=bool:?}, reportrdy_rdclracc: {=bool:?}, reportrdy_stop: {=bool:?}, dblrdy_rdclrdbl: {=bool:?}, dblrdy_stop: {=bool:?}, samplerdy_readclracc: {=bool:?} }}" , self . reportrdy_readclracc () , self . samplerdy_stop () , self . reportrdy_rdclracc () , self . reportrdy_stop () , self . dblrdy_rdclrdbl () , self . dblrdy_stop () , self . samplerdy_readclracc ())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Ledpol {
#[doc = "Led active on output pin low."]
ActiveLow = 0x0,
#[doc = "Led active on output pin high."]
ActiveHigh = 0x01,
}
impl Ledpol {
#[inline(always)]
pub const fn from_bits(val: u8) -> Ledpol {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Ledpol {
#[inline(always)]
fn from(val: u8) -> Ledpol {
Ledpol::from_bits(val)
}
}
impl From<Ledpol> for u8 {
#[inline(always)]
fn from(val: Ledpol) -> u8 {
Ledpol::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Reportper {
#[doc = "10 samples/report."]
_10smpl = 0x0,
#[doc = "40 samples/report."]
_40smpl = 0x01,
#[doc = "80 samples/report."]
_80smpl = 0x02,
#[doc = "120 samples/report."]
_120smpl = 0x03,
#[doc = "160 samples/report."]
_160smpl = 0x04,
#[doc = "200 samples/report."]
_200smpl = 0x05,
#[doc = "240 samples/report."]
_240smpl = 0x06,
#[doc = "280 samples/report."]
_280smpl = 0x07,
#[doc = "1 sample/report."]
_1smpl = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Reportper {
#[inline(always)]
pub const fn from_bits(val: u8) -> Reportper {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Reportper {
#[inline(always)]
fn from(val: u8) -> Reportper {
Reportper::from_bits(val)
}
}
impl From<Reportper> for u8 {
#[inline(always)]
fn from(val: Reportper) -> u8 {
Reportper::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Sampleper {
#[doc = "128 us."]
_128us = 0x0,
#[doc = "256 us."]
_256us = 0x01,
#[doc = "512 us."]
_512us = 0x02,
#[doc = "1024 us."]
_1024us = 0x03,
#[doc = "2048 us."]
_2048us = 0x04,
#[doc = "4096 us."]
_4096us = 0x05,
#[doc = "8192 us."]
_8192us = 0x06,
#[doc = "16384 us."]
_16384us = 0x07,
#[doc = "32768 us."]
_32ms = 0x08,
#[doc = "65536 us."]
_65ms = 0x09,
#[doc = "131072 us."]
_131ms = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Sampleper {
#[inline(always)]
pub const fn from_bits(val: u8) -> Sampleper {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Sampleper {
#[inline(always)]
fn from(val: u8) -> Sampleper {
Sampleper::from_bits(val)
}
}
impl From<Sampleper> for u8 {
#[inline(always)]
fn from(val: Sampleper) -> u8 {
Sampleper::to_bits(val)
}
}
}
}
pub mod qspi {
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DmaEnc {
ptr: *mut u8,
}
unsafe impl Send for DmaEnc {}
unsafe impl Sync for DmaEnc {}
impl DmaEnc {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Bits 31:0 of DMA AES KEY."]
#[inline(always)]
pub const fn key0(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Bits 63:32 of DMA AES KEY."]
#[inline(always)]
pub const fn key1(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Bits 95:64 of DMA AES KEY."]
#[inline(always)]
pub const fn key2(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Bits 127:96 of DMA AES KEY."]
#[inline(always)]
pub const fn key3(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
#[doc = "Bits 31:0 of DMA NONCE."]
#[inline(always)]
pub const fn nonce0(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
#[doc = "Bits 63:32 of DMA NONCE."]
#[inline(always)]
pub const fn nonce1(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x14usize) as _) }
}
#[doc = "Bits 95:64 of DMA NONCE."]
#[inline(always)]
pub const fn nonce2(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x18usize) as _) }
}
#[doc = "Enable stream cipher for EasyDMA."]
#[inline(always)]
pub const fn enable(self) -> crate::common::Reg<regs::DmaEncEnable, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x1cusize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Erase {
ptr: *mut u8,
}
unsafe impl Send for Erase {}
unsafe impl Sync for Erase {}
impl Erase {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Start address of flash block to be erased."]
#[inline(always)]
pub const fn ptr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Size of block to be erased."]
#[inline(always)]
pub const fn len(self) -> crate::common::Reg<regs::Len, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Psel {
ptr: *mut u8,
}
unsafe impl Send for Psel {}
unsafe impl Sync for Psel {}
impl Psel {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Pin select for serial clock SCK."]
#[inline(always)]
pub const fn sck(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Pin select for chip select signal CSN."]
#[inline(always)]
pub const fn csn(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Pin select for serial data MOSI/IO0."]
#[inline(always)]
pub const fn io0(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
#[doc = "Pin select for serial data MISO/IO1."]
#[inline(always)]
pub const fn io1(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
#[doc = "Pin select for serial data WP/IO2."]
#[inline(always)]
pub const fn io2(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x14usize) as _) }
}
#[doc = "Pin select for serial data HOLD/IO3."]
#[inline(always)]
pub const fn io3(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x18usize) as _) }
}
}
#[doc = "External flash interface 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Qspi {
ptr: *mut u8,
}
unsafe impl Send for Qspi {}
unsafe impl Sync for Qspi {}
impl Qspi {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Activate QSPI interface."]
#[inline(always)]
pub const fn tasks_activate(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Start transfer from external flash memory to internal RAM."]
#[inline(always)]
pub const fn tasks_readstart(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Start transfer from internal RAM to external flash memory."]
#[inline(always)]
pub const fn tasks_writestart(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Start external flash memory erase operation."]
#[inline(always)]
pub const fn tasks_erasestart(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
#[doc = "Deactivate QSPI interface."]
#[inline(always)]
pub const fn tasks_deactivate(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
#[doc = "Subscribe configuration for task ACTIVATE."]
#[inline(always)]
pub const fn subscribe_activate(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x80usize) as _) }
}
#[doc = "Subscribe configuration for task READSTART."]
#[inline(always)]
pub const fn subscribe_readstart(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x84usize) as _) }
}
#[doc = "Subscribe configuration for task WRITESTART."]
#[inline(always)]
pub const fn subscribe_writestart(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x88usize) as _) }
}
#[doc = "Subscribe configuration for task ERASESTART."]
#[inline(always)]
pub const fn subscribe_erasestart(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x8cusize) as _) }
}
#[doc = "Subscribe configuration for task DEACTIVATE."]
#[inline(always)]
pub const fn subscribe_deactivate(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x90usize) as _) }
}
#[doc = "QSPI peripheral is ready. This event will be generated as a response to all QSPI tasks except DEACTIVATE."]
#[inline(always)]
pub const fn events_ready(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0100usize) as _) }
}
#[doc = "Publish configuration for event READY."]
#[inline(always)]
pub const fn publish_ready(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0180usize) as _) }
}
#[doc = "Enable or disable interrupt."]
#[inline(always)]
pub const fn inten(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0300usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "Enable QSPI peripheral and acquire the pins selected in PSELn registers."]
#[inline(always)]
pub const fn enable(self) -> crate::common::Reg<regs::QspiEnable, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0500usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn read(self) -> Read {
unsafe { Read::from_ptr(self.ptr.wrapping_add(0x0504usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn write(self) -> Write {
unsafe { Write::from_ptr(self.ptr.wrapping_add(0x0510usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn erase(self) -> Erase {
unsafe { Erase::from_ptr(self.ptr.wrapping_add(0x051cusize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn psel(self) -> Psel {
unsafe { Psel::from_ptr(self.ptr.wrapping_add(0x0524usize) as _) }
}
#[doc = "Address offset into the external memory for Execute in Place operation."]
#[inline(always)]
pub const fn xipoffset(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0540usize) as _) }
}
#[doc = "Interface configuration."]
#[inline(always)]
pub const fn ifconfig0(self) -> crate::common::Reg<regs::Ifconfig0, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0544usize) as _) }
}
#[doc = "Enable Execute in Place operation."]
#[inline(always)]
pub const fn xipen(self) -> crate::common::Reg<regs::Xipen, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x054cusize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn xip_enc(self) -> XipEnc {
unsafe { XipEnc::from_ptr(self.ptr.wrapping_add(0x0560usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn dma_enc(self) -> DmaEnc {
unsafe { DmaEnc::from_ptr(self.ptr.wrapping_add(0x0580usize) as _) }
}
#[doc = "Interface configuration."]
#[inline(always)]
pub const fn ifconfig1(self) -> crate::common::Reg<regs::Ifconfig1, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0600usize) as _) }
}
#[doc = "Status register."]
#[inline(always)]
pub const fn status(self) -> crate::common::Reg<regs::Status, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0604usize) as _) }
}
#[doc = "Set the duration required to enter/exit deep power-down mode (DPM)."]
#[inline(always)]
pub const fn dpmdur(self) -> crate::common::Reg<regs::Dpmdur, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0614usize) as _) }
}
#[doc = "Extended address configuration."]
#[inline(always)]
pub const fn addrconf(self) -> crate::common::Reg<regs::Addrconf, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0624usize) as _) }
}
#[doc = "Custom instruction configuration register."]
#[inline(always)]
pub const fn cinstrconf(self) -> crate::common::Reg<regs::Cinstrconf, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0634usize) as _) }
}
#[doc = "Custom instruction data register 0."]
#[inline(always)]
pub const fn cinstrdat0(self) -> crate::common::Reg<regs::Cinstrdat0, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0638usize) as _) }
}
#[doc = "Custom instruction data register 1."]
#[inline(always)]
pub const fn cinstrdat1(self) -> crate::common::Reg<regs::Cinstrdat1, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x063cusize) as _) }
}
#[doc = "SPI interface timing."]
#[inline(always)]
pub const fn iftiming(self) -> crate::common::Reg<regs::Iftiming, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0640usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Read {
ptr: *mut u8,
}
unsafe impl Send for Read {}
unsafe impl Sync for Read {}
impl Read {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Flash memory source address."]
#[inline(always)]
pub const fn src(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "RAM destination address."]
#[inline(always)]
pub const fn dst(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Read transfer length."]
#[inline(always)]
pub const fn cnt(self) -> crate::common::Reg<regs::ReadCnt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Write {
ptr: *mut u8,
}
unsafe impl Send for Write {}
unsafe impl Sync for Write {}
impl Write {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Flash destination address."]
#[inline(always)]
pub const fn dst(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "RAM source address."]
#[inline(always)]
pub const fn src(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Write transfer length."]
#[inline(always)]
pub const fn cnt(self) -> crate::common::Reg<regs::WriteCnt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct XipEnc {
ptr: *mut u8,
}
unsafe impl Send for XipEnc {}
unsafe impl Sync for XipEnc {}
impl XipEnc {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Bits 31:0 of XIP AES KEY."]
#[inline(always)]
pub const fn key0(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Bits 63:32 of XIP AES KEY."]
#[inline(always)]
pub const fn key1(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Bits 95:64 of XIP AES KEY."]
#[inline(always)]
pub const fn key2(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Bits 127:96 of XIP AES KEY."]
#[inline(always)]
pub const fn key3(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
#[doc = "Bits 31:0 of XIP NONCE."]
#[inline(always)]
pub const fn nonce0(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
#[doc = "Bits 63:32 of XIP NONCE."]
#[inline(always)]
pub const fn nonce1(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x14usize) as _) }
}
#[doc = "Bits 95:64 of XIP NONCE."]
#[inline(always)]
pub const fn nonce2(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x18usize) as _) }
}
#[doc = "Enable stream cipher for XIP."]
#[inline(always)]
pub const fn enable(self) -> crate::common::Reg<regs::XipEncEnable, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x1cusize) as _) }
}
}
pub mod regs {
#[doc = "Extended address configuration."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Addrconf(pub u32);
impl Addrconf {
#[doc = "Opcode that enters the 32-bit addressing mode."]
#[must_use]
#[inline(always)]
pub const fn opcode(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Opcode that enters the 32-bit addressing mode."]
#[inline(always)]
pub const fn set_opcode(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
#[doc = "Byte 0 following opcode."]
#[must_use]
#[inline(always)]
pub const fn byte0(&self) -> u8 {
let val = (self.0 >> 8usize) & 0xff;
val as u8
}
#[doc = "Byte 0 following opcode."]
#[inline(always)]
pub const fn set_byte0(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize);
}
#[doc = "Byte 1 following byte 0."]
#[must_use]
#[inline(always)]
pub const fn byte1(&self) -> u8 {
let val = (self.0 >> 16usize) & 0xff;
val as u8
}
#[doc = "Byte 1 following byte 0."]
#[inline(always)]
pub const fn set_byte1(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize);
}
#[doc = "Extended addressing mode."]
#[must_use]
#[inline(always)]
pub const fn mode(&self) -> super::vals::Mode {
let val = (self.0 >> 24usize) & 0x03;
super::vals::Mode::from_bits(val as u8)
}
#[doc = "Extended addressing mode."]
#[inline(always)]
pub const fn set_mode(&mut self, val: super::vals::Mode) {
self.0 =
(self.0 & !(0x03 << 24usize)) | (((val.to_bits() as u32) & 0x03) << 24usize);
}
#[doc = "Wait for write complete before sending command."]
#[must_use]
#[inline(always)]
pub const fn wipwait(&self) -> bool {
let val = (self.0 >> 26usize) & 0x01;
val != 0
}
#[doc = "Wait for write complete before sending command."]
#[inline(always)]
pub const fn set_wipwait(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
}
#[doc = "Send WREN (write enable opcode 0x06) before instruction."]
#[must_use]
#[inline(always)]
pub const fn wren(&self) -> bool {
let val = (self.0 >> 27usize) & 0x01;
val != 0
}
#[doc = "Send WREN (write enable opcode 0x06) before instruction."]
#[inline(always)]
pub const fn set_wren(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 27usize)) | (((val as u32) & 0x01) << 27usize);
}
}
impl Default for Addrconf {
#[inline(always)]
fn default() -> Addrconf {
Addrconf(0)
}
}
impl core::fmt::Debug for Addrconf {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Addrconf")
.field("opcode", &self.opcode())
.field("byte0", &self.byte0())
.field("byte1", &self.byte1())
.field("mode", &self.mode())
.field("wipwait", &self.wipwait())
.field("wren", &self.wren())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Addrconf {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Addrconf {{ opcode: {=u8:?}, byte0: {=u8:?}, byte1: {=u8:?}, mode: {:?}, wipwait: {=bool:?}, wren: {=bool:?} }}" , self . opcode () , self . byte0 () , self . byte1 () , self . mode () , self . wipwait () , self . wren ())
}
}
#[doc = "Custom instruction configuration register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cinstrconf(pub u32);
impl Cinstrconf {
#[doc = "Opcode of Custom instruction."]
#[must_use]
#[inline(always)]
pub const fn opcode(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Opcode of Custom instruction."]
#[inline(always)]
pub const fn set_opcode(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
#[doc = "Length of custom instruction in number of bytes."]
#[must_use]
#[inline(always)]
pub const fn length(&self) -> super::vals::Length {
let val = (self.0 >> 8usize) & 0x0f;
super::vals::Length::from_bits(val as u8)
}
#[doc = "Length of custom instruction in number of bytes."]
#[inline(always)]
pub const fn set_length(&mut self, val: super::vals::Length) {
self.0 = (self.0 & !(0x0f << 8usize)) | (((val.to_bits() as u32) & 0x0f) << 8usize);
}
#[doc = "Level of the IO2 pin (if connected) during transmission of custom instruction."]
#[must_use]
#[inline(always)]
pub const fn lio2(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "Level of the IO2 pin (if connected) during transmission of custom instruction."]
#[inline(always)]
pub const fn set_lio2(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "Level of the IO3 pin (if connected) during transmission of custom instruction."]
#[must_use]
#[inline(always)]
pub const fn lio3(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "Level of the IO3 pin (if connected) during transmission of custom instruction."]
#[inline(always)]
pub const fn set_lio3(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "Wait for write complete before sending command."]
#[must_use]
#[inline(always)]
pub const fn wipwait(&self) -> bool {
let val = (self.0 >> 14usize) & 0x01;
val != 0
}
#[doc = "Wait for write complete before sending command."]
#[inline(always)]
pub const fn set_wipwait(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
}
#[doc = "Send WREN (write enable opcode 0x06) before instruction."]
#[must_use]
#[inline(always)]
pub const fn wren(&self) -> bool {
let val = (self.0 >> 15usize) & 0x01;
val != 0
}
#[doc = "Send WREN (write enable opcode 0x06) before instruction."]
#[inline(always)]
pub const fn set_wren(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
}
#[doc = "Enable Long frame mode. When enabled, a custom instruction transaction has to be ended by writing the LFSTOP field."]
#[must_use]
#[inline(always)]
pub const fn lfen(&self) -> bool {
let val = (self.0 >> 16usize) & 0x01;
val != 0
}
#[doc = "Enable Long frame mode. When enabled, a custom instruction transaction has to be ended by writing the LFSTOP field."]
#[inline(always)]
pub const fn set_lfen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
}
#[doc = "Stop (finalize) long frame transaction."]
#[must_use]
#[inline(always)]
pub const fn lfstop(&self) -> bool {
let val = (self.0 >> 17usize) & 0x01;
val != 0
}
#[doc = "Stop (finalize) long frame transaction."]
#[inline(always)]
pub const fn set_lfstop(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
}
}
impl Default for Cinstrconf {
#[inline(always)]
fn default() -> Cinstrconf {
Cinstrconf(0)
}
}
impl core::fmt::Debug for Cinstrconf {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cinstrconf")
.field("opcode", &self.opcode())
.field("length", &self.length())
.field("lio2", &self.lio2())
.field("lio3", &self.lio3())
.field("wipwait", &self.wipwait())
.field("wren", &self.wren())
.field("lfen", &self.lfen())
.field("lfstop", &self.lfstop())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cinstrconf {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Cinstrconf {{ opcode: {=u8:?}, length: {:?}, lio2: {=bool:?}, lio3: {=bool:?}, wipwait: {=bool:?}, wren: {=bool:?}, lfen: {=bool:?}, lfstop: {=bool:?} }}" , self . opcode () , self . length () , self . lio2 () , self . lio3 () , self . wipwait () , self . wren () , self . lfen () , self . lfstop ())
}
}
#[doc = "Custom instruction data register 0."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cinstrdat0(pub u32);
impl Cinstrdat0 {
#[doc = "Data byte 0."]
#[must_use]
#[inline(always)]
pub const fn byte0(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Data byte 0."]
#[inline(always)]
pub const fn set_byte0(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
#[doc = "Data byte 1."]
#[must_use]
#[inline(always)]
pub const fn byte1(&self) -> u8 {
let val = (self.0 >> 8usize) & 0xff;
val as u8
}
#[doc = "Data byte 1."]
#[inline(always)]
pub const fn set_byte1(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize);
}
#[doc = "Data byte 2."]
#[must_use]
#[inline(always)]
pub const fn byte2(&self) -> u8 {
let val = (self.0 >> 16usize) & 0xff;
val as u8
}
#[doc = "Data byte 2."]
#[inline(always)]
pub const fn set_byte2(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize);
}
#[doc = "Data byte 3."]
#[must_use]
#[inline(always)]
pub const fn byte3(&self) -> u8 {
let val = (self.0 >> 24usize) & 0xff;
val as u8
}
#[doc = "Data byte 3."]
#[inline(always)]
pub const fn set_byte3(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 24usize)) | (((val as u32) & 0xff) << 24usize);
}
}
impl Default for Cinstrdat0 {
#[inline(always)]
fn default() -> Cinstrdat0 {
Cinstrdat0(0)
}
}
impl core::fmt::Debug for Cinstrdat0 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cinstrdat0")
.field("byte0", &self.byte0())
.field("byte1", &self.byte1())
.field("byte2", &self.byte2())
.field("byte3", &self.byte3())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cinstrdat0 {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Cinstrdat0 {{ byte0: {=u8:?}, byte1: {=u8:?}, byte2: {=u8:?}, byte3: {=u8:?} }}" , self . byte0 () , self . byte1 () , self . byte2 () , self . byte3 ())
}
}
#[doc = "Custom instruction data register 1."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cinstrdat1(pub u32);
impl Cinstrdat1 {
#[doc = "Data byte 4."]
#[must_use]
#[inline(always)]
pub const fn byte4(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Data byte 4."]
#[inline(always)]
pub const fn set_byte4(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
#[doc = "Data byte 5."]
#[must_use]
#[inline(always)]
pub const fn byte5(&self) -> u8 {
let val = (self.0 >> 8usize) & 0xff;
val as u8
}
#[doc = "Data byte 5."]
#[inline(always)]
pub const fn set_byte5(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize);
}
#[doc = "Data byte 6."]
#[must_use]
#[inline(always)]
pub const fn byte6(&self) -> u8 {
let val = (self.0 >> 16usize) & 0xff;
val as u8
}
#[doc = "Data byte 6."]
#[inline(always)]
pub const fn set_byte6(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize);
}
#[doc = "Data byte 7."]
#[must_use]
#[inline(always)]
pub const fn byte7(&self) -> u8 {
let val = (self.0 >> 24usize) & 0xff;
val as u8
}
#[doc = "Data byte 7."]
#[inline(always)]
pub const fn set_byte7(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 24usize)) | (((val as u32) & 0xff) << 24usize);
}
}
impl Default for Cinstrdat1 {
#[inline(always)]
fn default() -> Cinstrdat1 {
Cinstrdat1(0)
}
}
impl core::fmt::Debug for Cinstrdat1 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cinstrdat1")
.field("byte4", &self.byte4())
.field("byte5", &self.byte5())
.field("byte6", &self.byte6())
.field("byte7", &self.byte7())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cinstrdat1 {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Cinstrdat1 {{ byte4: {=u8:?}, byte5: {=u8:?}, byte6: {=u8:?}, byte7: {=u8:?} }}" , self . byte4 () , self . byte5 () , self . byte6 () , self . byte7 ())
}
}
#[doc = "Enable stream cipher for EasyDMA."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DmaEncEnable(pub u32);
impl DmaEncEnable {
#[doc = "Enable or disable stream cipher for EasyDMA."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable stream cipher for EasyDMA."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for DmaEncEnable {
#[inline(always)]
fn default() -> DmaEncEnable {
DmaEncEnable(0)
}
}
impl core::fmt::Debug for DmaEncEnable {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DmaEncEnable")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for DmaEncEnable {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "DmaEncEnable {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "Set the duration required to enter/exit deep power-down mode (DPM)."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Dpmdur(pub u32);
impl Dpmdur {
#[doc = "Duration needed by external flash to enter DPM. Duration is given as ENTER * 256 * 31.25 ns."]
#[must_use]
#[inline(always)]
pub const fn enter(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Duration needed by external flash to enter DPM. Duration is given as ENTER * 256 * 31.25 ns."]
#[inline(always)]
pub const fn set_enter(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
#[doc = "Duration needed by external flash to exit DPM. Duration is given as EXIT * 256 * 31.25 ns."]
#[must_use]
#[inline(always)]
pub const fn exit(&self) -> u16 {
let val = (self.0 >> 16usize) & 0xffff;
val as u16
}
#[doc = "Duration needed by external flash to exit DPM. Duration is given as EXIT * 256 * 31.25 ns."]
#[inline(always)]
pub const fn set_exit(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 16usize)) | (((val as u32) & 0xffff) << 16usize);
}
}
impl Default for Dpmdur {
#[inline(always)]
fn default() -> Dpmdur {
Dpmdur(0)
}
}
impl core::fmt::Debug for Dpmdur {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Dpmdur")
.field("enter", &self.enter())
.field("exit", &self.exit())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Dpmdur {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Dpmdur {{ enter: {=u16:?}, exit: {=u16:?} }}",
self.enter(),
self.exit()
)
}
}
#[doc = "Interface configuration."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ifconfig0(pub u32);
impl Ifconfig0 {
#[doc = "Configure number of data lines and opcode used for reading."]
#[must_use]
#[inline(always)]
pub const fn readoc(&self) -> super::vals::Readoc {
let val = (self.0 >> 0usize) & 0x07;
super::vals::Readoc::from_bits(val as u8)
}
#[doc = "Configure number of data lines and opcode used for reading."]
#[inline(always)]
pub const fn set_readoc(&mut self, val: super::vals::Readoc) {
self.0 = (self.0 & !(0x07 << 0usize)) | (((val.to_bits() as u32) & 0x07) << 0usize);
}
#[doc = "Configure number of data lines and opcode used for writing."]
#[must_use]
#[inline(always)]
pub const fn writeoc(&self) -> super::vals::Writeoc {
let val = (self.0 >> 3usize) & 0x07;
super::vals::Writeoc::from_bits(val as u8)
}
#[doc = "Configure number of data lines and opcode used for writing."]
#[inline(always)]
pub const fn set_writeoc(&mut self, val: super::vals::Writeoc) {
self.0 = (self.0 & !(0x07 << 3usize)) | (((val.to_bits() as u32) & 0x07) << 3usize);
}
#[doc = "Addressing mode."]
#[must_use]
#[inline(always)]
pub const fn addrmode(&self) -> super::vals::Addrmode {
let val = (self.0 >> 6usize) & 0x01;
super::vals::Addrmode::from_bits(val as u8)
}
#[doc = "Addressing mode."]
#[inline(always)]
pub const fn set_addrmode(&mut self, val: super::vals::Addrmode) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val.to_bits() as u32) & 0x01) << 6usize);
}
#[doc = "Enable deep power-down mode (DPM) feature."]
#[must_use]
#[inline(always)]
pub const fn dpmenable(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Enable deep power-down mode (DPM) feature."]
#[inline(always)]
pub const fn set_dpmenable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Page size for commands PP, PP2O, PP4O and PP4IO."]
#[must_use]
#[inline(always)]
pub const fn ppsize(&self) -> super::vals::Ppsize {
let val = (self.0 >> 12usize) & 0x01;
super::vals::Ppsize::from_bits(val as u8)
}
#[doc = "Page size for commands PP, PP2O, PP4O and PP4IO."]
#[inline(always)]
pub const fn set_ppsize(&mut self, val: super::vals::Ppsize) {
self.0 =
(self.0 & !(0x01 << 12usize)) | (((val.to_bits() as u32) & 0x01) << 12usize);
}
}
impl Default for Ifconfig0 {
#[inline(always)]
fn default() -> Ifconfig0 {
Ifconfig0(0)
}
}
impl core::fmt::Debug for Ifconfig0 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ifconfig0")
.field("readoc", &self.readoc())
.field("writeoc", &self.writeoc())
.field("addrmode", &self.addrmode())
.field("dpmenable", &self.dpmenable())
.field("ppsize", &self.ppsize())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ifconfig0 {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Ifconfig0 {{ readoc: {:?}, writeoc: {:?}, addrmode: {:?}, dpmenable: {=bool:?}, ppsize: {:?} }}" , self . readoc () , self . writeoc () , self . addrmode () , self . dpmenable () , self . ppsize ())
}
}
#[doc = "Interface configuration."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ifconfig1(pub u32);
impl Ifconfig1 {
#[doc = "Minimum amount of time that the CSN pin must stay high before it can go low again. Value is specified in number of 32 MHz periods (31.25 ns)."]
#[must_use]
#[inline(always)]
pub const fn sckdelay(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Minimum amount of time that the CSN pin must stay high before it can go low again. Value is specified in number of 32 MHz periods (31.25 ns)."]
#[inline(always)]
pub const fn set_sckdelay(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
#[doc = "Enter/exit deep power-down mode (DPM) for external flash memory."]
#[must_use]
#[inline(always)]
pub const fn dpmen(&self) -> bool {
let val = (self.0 >> 24usize) & 0x01;
val != 0
}
#[doc = "Enter/exit deep power-down mode (DPM) for external flash memory."]
#[inline(always)]
pub const fn set_dpmen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
}
#[doc = "Select SPI mode."]
#[must_use]
#[inline(always)]
pub const fn spimode(&self) -> super::vals::Spimode {
let val = (self.0 >> 25usize) & 0x01;
super::vals::Spimode::from_bits(val as u8)
}
#[doc = "Select SPI mode."]
#[inline(always)]
pub const fn set_spimode(&mut self, val: super::vals::Spimode) {
self.0 =
(self.0 & !(0x01 << 25usize)) | (((val.to_bits() as u32) & 0x01) << 25usize);
}
#[doc = "SCK frequency is derived from PCLK192M with SCK frequency = PCLK192M / (2*(SCKFREQ + 1))."]
#[must_use]
#[inline(always)]
pub const fn sckfreq(&self) -> u8 {
let val = (self.0 >> 28usize) & 0x0f;
val as u8
}
#[doc = "SCK frequency is derived from PCLK192M with SCK frequency = PCLK192M / (2*(SCKFREQ + 1))."]
#[inline(always)]
pub const fn set_sckfreq(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 28usize)) | (((val as u32) & 0x0f) << 28usize);
}
}
impl Default for Ifconfig1 {
#[inline(always)]
fn default() -> Ifconfig1 {
Ifconfig1(0)
}
}
impl core::fmt::Debug for Ifconfig1 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ifconfig1")
.field("sckdelay", &self.sckdelay())
.field("dpmen", &self.dpmen())
.field("spimode", &self.spimode())
.field("sckfreq", &self.sckfreq())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ifconfig1 {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Ifconfig1 {{ sckdelay: {=u8:?}, dpmen: {=bool:?}, spimode: {:?}, sckfreq: {=u8:?} }}" , self . sckdelay () , self . dpmen () , self . spimode () , self . sckfreq ())
}
}
#[doc = "SPI interface timing."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Iftiming(pub u32);
impl Iftiming {
#[doc = "Timing related to sampling of the input serial data. The value of RXDELAY specifies the number of prescaled 192 MHz cycles delay from the the rising edge of the SPI Clock (SCK) until the input serial data is sampled. For example, if RXDELAY is set to 0, the input serial data is sampled on the rising edge of SCK."]
#[must_use]
#[inline(always)]
pub const fn rxdelay(&self) -> u8 {
let val = (self.0 >> 8usize) & 0x07;
val as u8
}
#[doc = "Timing related to sampling of the input serial data. The value of RXDELAY specifies the number of prescaled 192 MHz cycles delay from the the rising edge of the SPI Clock (SCK) until the input serial data is sampled. For example, if RXDELAY is set to 0, the input serial data is sampled on the rising edge of SCK."]
#[inline(always)]
pub const fn set_rxdelay(&mut self, val: u8) {
self.0 = (self.0 & !(0x07 << 8usize)) | (((val as u32) & 0x07) << 8usize);
}
}
impl Default for Iftiming {
#[inline(always)]
fn default() -> Iftiming {
Iftiming(0)
}
}
impl core::fmt::Debug for Iftiming {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Iftiming")
.field("rxdelay", &self.rxdelay())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Iftiming {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Iftiming {{ rxdelay: {=u8:?} }}", self.rxdelay())
}
}
#[doc = "Enable or disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Enable or disable interrupt for event READY."]
#[must_use]
#[inline(always)]
pub const fn ready(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event READY."]
#[inline(always)]
pub const fn set_ready(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int").field("ready", &self.ready()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Int {{ ready: {=bool:?} }}", self.ready())
}
}
#[doc = "Size of block to be erased."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Len(pub u32);
impl Len {
#[doc = "LEN."]
#[must_use]
#[inline(always)]
pub const fn len(&self) -> super::vals::Len {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Len::from_bits(val as u8)
}
#[doc = "LEN."]
#[inline(always)]
pub const fn set_len(&mut self, val: super::vals::Len) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for Len {
#[inline(always)]
fn default() -> Len {
Len(0)
}
}
impl core::fmt::Debug for Len {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Len").field("len", &self.len()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Len {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Len {{ len: {:?} }}", self.len())
}
}
#[doc = "Enable QSPI peripheral and acquire the pins selected in PSELn registers."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct QspiEnable(pub u32);
impl QspiEnable {
#[doc = "Enable or disable QSPI."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable QSPI."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for QspiEnable {
#[inline(always)]
fn default() -> QspiEnable {
QspiEnable(0)
}
}
impl core::fmt::Debug for QspiEnable {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("QspiEnable")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for QspiEnable {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "QspiEnable {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "Read transfer length."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct ReadCnt(pub u32);
impl ReadCnt {
#[doc = "Read transfer length in number of bytes. The length must be a multiple of 4 bytes."]
#[must_use]
#[inline(always)]
pub const fn cnt(&self) -> u32 {
let val = (self.0 >> 0usize) & 0x001f_ffff;
val as u32
}
#[doc = "Read transfer length in number of bytes. The length must be a multiple of 4 bytes."]
#[inline(always)]
pub const fn set_cnt(&mut self, val: u32) {
self.0 =
(self.0 & !(0x001f_ffff << 0usize)) | (((val as u32) & 0x001f_ffff) << 0usize);
}
}
impl Default for ReadCnt {
#[inline(always)]
fn default() -> ReadCnt {
ReadCnt(0)
}
}
impl core::fmt::Debug for ReadCnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("ReadCnt").field("cnt", &self.cnt()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for ReadCnt {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "ReadCnt {{ cnt: {=u32:?} }}", self.cnt())
}
}
#[doc = "Status register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Status(pub u32);
impl Status {
#[doc = "Deep power-down mode (DPM) status of external flash."]
#[must_use]
#[inline(always)]
pub const fn dpm(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Deep power-down mode (DPM) status of external flash."]
#[inline(always)]
pub const fn set_dpm(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Ready status."]
#[must_use]
#[inline(always)]
pub const fn ready(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Ready status."]
#[inline(always)]
pub const fn set_ready(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Value of external flash device Status Register. When the external flash has two bytes status register this field includes the value of the low byte."]
#[must_use]
#[inline(always)]
pub const fn sreg(&self) -> u8 {
let val = (self.0 >> 24usize) & 0xff;
val as u8
}
#[doc = "Value of external flash device Status Register. When the external flash has two bytes status register this field includes the value of the low byte."]
#[inline(always)]
pub const fn set_sreg(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 24usize)) | (((val as u32) & 0xff) << 24usize);
}
}
impl Default for Status {
#[inline(always)]
fn default() -> Status {
Status(0)
}
}
impl core::fmt::Debug for Status {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Status")
.field("dpm", &self.dpm())
.field("ready", &self.ready())
.field("sreg", &self.sreg())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Status {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Status {{ dpm: {=bool:?}, ready: {=bool:?}, sreg: {=u8:?} }}",
self.dpm(),
self.ready(),
self.sreg()
)
}
}
#[doc = "Write transfer length."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct WriteCnt(pub u32);
impl WriteCnt {
#[doc = "Write transfer length in number of bytes. The length must be a multiple of 4 bytes."]
#[must_use]
#[inline(always)]
pub const fn cnt(&self) -> u32 {
let val = (self.0 >> 0usize) & 0x001f_ffff;
val as u32
}
#[doc = "Write transfer length in number of bytes. The length must be a multiple of 4 bytes."]
#[inline(always)]
pub const fn set_cnt(&mut self, val: u32) {
self.0 =
(self.0 & !(0x001f_ffff << 0usize)) | (((val as u32) & 0x001f_ffff) << 0usize);
}
}
impl Default for WriteCnt {
#[inline(always)]
fn default() -> WriteCnt {
WriteCnt(0)
}
}
impl core::fmt::Debug for WriteCnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("WriteCnt")
.field("cnt", &self.cnt())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for WriteCnt {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "WriteCnt {{ cnt: {=u32:?} }}", self.cnt())
}
}
#[doc = "Enable stream cipher for XIP."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct XipEncEnable(pub u32);
impl XipEncEnable {
#[doc = "Enable or disable stream cipher for XIP."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable stream cipher for XIP."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for XipEncEnable {
#[inline(always)]
fn default() -> XipEncEnable {
XipEncEnable(0)
}
}
impl core::fmt::Debug for XipEncEnable {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("XipEncEnable")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for XipEncEnable {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "XipEncEnable {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "Enable Execute in Place operation."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Xipen(pub u32);
impl Xipen {
#[doc = "Enable XIP AHB Slave interface and access to XIP memory range."]
#[must_use]
#[inline(always)]
pub const fn xipen(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable XIP AHB Slave interface and access to XIP memory range."]
#[inline(always)]
pub const fn set_xipen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Xipen {
#[inline(always)]
fn default() -> Xipen {
Xipen(0)
}
}
impl core::fmt::Debug for Xipen {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Xipen")
.field("xipen", &self.xipen())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Xipen {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Xipen {{ xipen: {=bool:?} }}", self.xipen())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Addrmode {
#[doc = "24-bit addressing."]
_24bit = 0x0,
#[doc = "32-bit addressing."]
_32bit = 0x01,
}
impl Addrmode {
#[inline(always)]
pub const fn from_bits(val: u8) -> Addrmode {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Addrmode {
#[inline(always)]
fn from(val: u8) -> Addrmode {
Addrmode::from_bits(val)
}
}
impl From<Addrmode> for u8 {
#[inline(always)]
fn from(val: Addrmode) -> u8 {
Addrmode::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Len {
#[doc = "Erase 4 kB block (flash command 0x20)."]
_4kb = 0x0,
#[doc = "Erase 64 kB block (flash command 0xD8)."]
_64kb = 0x01,
#[doc = "Erase all (flash command 0xC7)."]
All = 0x02,
_RESERVED_3 = 0x03,
}
impl Len {
#[inline(always)]
pub const fn from_bits(val: u8) -> Len {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Len {
#[inline(always)]
fn from(val: u8) -> Len {
Len::from_bits(val)
}
}
impl From<Len> for u8 {
#[inline(always)]
fn from(val: Len) -> u8 {
Len::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Length {
_RESERVED_0 = 0x0,
#[doc = "Send opcode only."]
_1b = 0x01,
#[doc = "Send opcode, CINSTRDAT0.BYTE0."]
_2b = 0x02,
#[doc = "Send opcode, CINSTRDAT0.BYTE0 -> CINSTRDAT0.BYTE1."]
_3b = 0x03,
#[doc = "Send opcode, CINSTRDAT0.BYTE0 -> CINSTRDAT0.BYTE2."]
_4b = 0x04,
#[doc = "Send opcode, CINSTRDAT0.BYTE0 -> CINSTRDAT0.BYTE3."]
_5b = 0x05,
#[doc = "Send opcode, CINSTRDAT0.BYTE0 -> CINSTRDAT1.BYTE4."]
_6b = 0x06,
#[doc = "Send opcode, CINSTRDAT0.BYTE0 -> CINSTRDAT1.BYTE5."]
_7b = 0x07,
#[doc = "Send opcode, CINSTRDAT0.BYTE0 -> CINSTRDAT1.BYTE6."]
_8b = 0x08,
#[doc = "Send opcode, CINSTRDAT0.BYTE0 -> CINSTRDAT1.BYTE7."]
_9b = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Length {
#[inline(always)]
pub const fn from_bits(val: u8) -> Length {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Length {
#[inline(always)]
fn from(val: u8) -> Length {
Length::from_bits(val)
}
}
impl From<Length> for u8 {
#[inline(always)]
fn from(val: Length) -> u8 {
Length::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Mode {
#[doc = "Do not send any instruction."]
NoInstr = 0x0,
#[doc = "Send opcode."]
Opcode = 0x01,
#[doc = "Send opcode, BYTE0."]
OpByte0 = 0x02,
#[doc = "Send opcode, BYTE0, BYTE1."]
All = 0x03,
}
impl Mode {
#[inline(always)]
pub const fn from_bits(val: u8) -> Mode {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Mode {
#[inline(always)]
fn from(val: u8) -> Mode {
Mode::from_bits(val)
}
}
impl From<Mode> for u8 {
#[inline(always)]
fn from(val: Mode) -> u8 {
Mode::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Ppsize {
#[doc = "256 bytes."]
_256bytes = 0x0,
#[doc = "512 bytes."]
_512bytes = 0x01,
}
impl Ppsize {
#[inline(always)]
pub const fn from_bits(val: u8) -> Ppsize {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Ppsize {
#[inline(always)]
fn from(val: u8) -> Ppsize {
Ppsize::from_bits(val)
}
}
impl From<Ppsize> for u8 {
#[inline(always)]
fn from(val: Ppsize) -> u8 {
Ppsize::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Readoc {
#[doc = "Single data line SPI. FAST_READ (opcode 0x0B)."]
Fastread = 0x0,
#[doc = "Dual data line SPI. READ2O (opcode 0x3B)."]
Read2o = 0x01,
#[doc = "Dual data line SPI. READ2IO (opcode 0xBB)."]
Read2io = 0x02,
#[doc = "Quad data line SPI. READ4O (opcode 0x6B)."]
Read4o = 0x03,
#[doc = "Quad data line SPI. READ4IO (opcode 0xEB)."]
Read4io = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
}
impl Readoc {
#[inline(always)]
pub const fn from_bits(val: u8) -> Readoc {
unsafe { core::mem::transmute(val & 0x07) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Readoc {
#[inline(always)]
fn from(val: u8) -> Readoc {
Readoc::from_bits(val)
}
}
impl From<Readoc> for u8 {
#[inline(always)]
fn from(val: Readoc) -> u8 {
Readoc::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Spimode {
#[doc = "Mode 0: Data are captured on the clock rising edge and data is output on a falling edge. Base level of clock is 0 (CPOL=0, CPHA=0)."]
Mode0 = 0x0,
#[doc = "Mode 3: Data are captured on the clock rising edge and data is output on a falling edge. Base level of clock is 1 (CPOL=1, CPHA=1)."]
Mode3 = 0x01,
}
impl Spimode {
#[inline(always)]
pub const fn from_bits(val: u8) -> Spimode {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Spimode {
#[inline(always)]
fn from(val: u8) -> Spimode {
Spimode::from_bits(val)
}
}
impl From<Spimode> for u8 {
#[inline(always)]
fn from(val: Spimode) -> u8 {
Spimode::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Writeoc {
#[doc = "Single data line SPI. PP (opcode 0x02)."]
Pp = 0x0,
#[doc = "Dual data line SPI. PP2O (opcode 0xA2)."]
Pp2o = 0x01,
#[doc = "Quad data line SPI. PP4O (opcode 0x32)."]
Pp4o = 0x02,
#[doc = "Quad data line SPI. PP4IO (opcode 0x38)."]
Pp4io = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
}
impl Writeoc {
#[inline(always)]
pub const fn from_bits(val: u8) -> Writeoc {
unsafe { core::mem::transmute(val & 0x07) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Writeoc {
#[inline(always)]
fn from(val: u8) -> Writeoc {
Writeoc::from_bits(val)
}
}
impl From<Writeoc> for u8 {
#[inline(always)]
fn from(val: Writeoc) -> u8 {
Writeoc::to_bits(val)
}
}
}
}
pub mod regulators {
#[doc = "Voltage regulators 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Regulators {
ptr: *mut u8,
}
unsafe impl Send for Regulators {}
unsafe impl Sync for Regulators {}
impl Regulators {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Main supply status."]
#[inline(always)]
pub const fn mainregstatus(
self,
) -> crate::common::Reg<regs::Mainregstatus, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0428usize) as _) }
}
#[doc = "System OFF register."]
#[inline(always)]
pub const fn systemoff(self) -> crate::common::Reg<regs::Systemoff, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0500usize) as _) }
}
#[doc = "Power-fail comparator configuration."]
#[inline(always)]
pub const fn pofcon(self) -> crate::common::Reg<regs::Pofcon, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0510usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn vregmain(self) -> Vregmain {
unsafe { Vregmain::from_ptr(self.ptr.wrapping_add(0x0704usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn vregradio(self) -> Vregradio {
unsafe { Vregradio::from_ptr(self.ptr.wrapping_add(0x0900usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn vregh(self) -> Vregh {
unsafe { Vregh::from_ptr(self.ptr.wrapping_add(0x0b00usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Vregh {
ptr: *mut u8,
}
unsafe impl Send for Vregh {}
unsafe impl Sync for Vregh {}
impl Vregh {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "DC/DC enable register for VREGH."]
#[inline(always)]
pub const fn dcdcen(self) -> crate::common::Reg<regs::VreghDcdcen, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "When VREGH is in DC/DC mode, enable VREGH silent mode to supply external components from VDD. Silent mode has lower voltage ripple. Silent mode is used when DC/DC is enabled, and is ignored in LDO mode. Disabling silent mode reduces current consumption in sleep."]
#[inline(always)]
pub const fn extsilenten(self) -> crate::common::Reg<regs::Extsilenten, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x40usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Vregmain {
ptr: *mut u8,
}
unsafe impl Send for Vregmain {}
unsafe impl Sync for Vregmain {}
impl Vregmain {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "DC/DC enable register for VREGMAIN."]
#[inline(always)]
pub const fn dcdcen(self) -> crate::common::Reg<regs::VregmainDcdcen, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Vregradio {
ptr: *mut u8,
}
unsafe impl Send for Vregradio {}
unsafe impl Sync for Vregradio {}
impl Vregradio {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "DC/DC enable register for VREGRADIO."]
#[inline(always)]
pub const fn dcdcen(self) -> crate::common::Reg<regs::VregradioDcdcen, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
pub mod regs {
#[doc = "When VREGH is in DC/DC mode, enable VREGH silent mode to supply external components from VDD. Silent mode has lower voltage ripple. Silent mode is used when DC/DC is enabled, and is ignored in LDO mode. Disabling silent mode reduces current consumption in sleep."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Extsilenten(pub u32);
impl Extsilenten {
#[doc = "Enable silent external DC/DC supply."]
#[must_use]
#[inline(always)]
pub const fn extsilenten(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable silent external DC/DC supply."]
#[inline(always)]
pub const fn set_extsilenten(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Extsilenten {
#[inline(always)]
fn default() -> Extsilenten {
Extsilenten(0)
}
}
impl core::fmt::Debug for Extsilenten {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Extsilenten")
.field("extsilenten", &self.extsilenten())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Extsilenten {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Extsilenten {{ extsilenten: {=bool:?} }}",
self.extsilenten()
)
}
}
#[doc = "Main supply status."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Mainregstatus(pub u32);
impl Mainregstatus {
#[doc = "VREGH status."]
#[must_use]
#[inline(always)]
pub const fn vregh(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "VREGH status."]
#[inline(always)]
pub const fn set_vregh(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Mainregstatus {
#[inline(always)]
fn default() -> Mainregstatus {
Mainregstatus(0)
}
}
impl core::fmt::Debug for Mainregstatus {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Mainregstatus")
.field("vregh", &self.vregh())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Mainregstatus {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Mainregstatus {{ vregh: {=bool:?} }}", self.vregh())
}
}
#[doc = "Power-fail comparator configuration."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Pofcon(pub u32);
impl Pofcon {
#[doc = "Enable or disable power-fail comparator."]
#[must_use]
#[inline(always)]
pub const fn pof(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable power-fail comparator."]
#[inline(always)]
pub const fn set_pof(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Power-fail comparator threshold setting."]
#[must_use]
#[inline(always)]
pub const fn threshold(&self) -> super::vals::Threshold {
let val = (self.0 >> 1usize) & 0x0f;
super::vals::Threshold::from_bits(val as u8)
}
#[doc = "Power-fail comparator threshold setting."]
#[inline(always)]
pub const fn set_threshold(&mut self, val: super::vals::Threshold) {
self.0 = (self.0 & !(0x0f << 1usize)) | (((val.to_bits() as u32) & 0x0f) << 1usize);
}
#[doc = "Power-fail comparator threshold setting for voltage supply on VDDH."]
#[must_use]
#[inline(always)]
pub const fn thresholdvddh(&self) -> super::vals::Thresholdvddh {
let val = (self.0 >> 8usize) & 0x0f;
super::vals::Thresholdvddh::from_bits(val as u8)
}
#[doc = "Power-fail comparator threshold setting for voltage supply on VDDH."]
#[inline(always)]
pub const fn set_thresholdvddh(&mut self, val: super::vals::Thresholdvddh) {
self.0 = (self.0 & !(0x0f << 8usize)) | (((val.to_bits() as u32) & 0x0f) << 8usize);
}
}
impl Default for Pofcon {
#[inline(always)]
fn default() -> Pofcon {
Pofcon(0)
}
}
impl core::fmt::Debug for Pofcon {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Pofcon")
.field("pof", &self.pof())
.field("threshold", &self.threshold())
.field("thresholdvddh", &self.thresholdvddh())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Pofcon {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Pofcon {{ pof: {=bool:?}, threshold: {:?}, thresholdvddh: {:?} }}",
self.pof(),
self.threshold(),
self.thresholdvddh()
)
}
}
#[doc = "System OFF register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Systemoff(pub u32);
impl Systemoff {
#[doc = "Enable System OFF mode."]
#[must_use]
#[inline(always)]
pub const fn systemoff(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable System OFF mode."]
#[inline(always)]
pub const fn set_systemoff(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Systemoff {
#[inline(always)]
fn default() -> Systemoff {
Systemoff(0)
}
}
impl core::fmt::Debug for Systemoff {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Systemoff")
.field("systemoff", &self.systemoff())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Systemoff {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Systemoff {{ systemoff: {=bool:?} }}", self.systemoff())
}
}
#[doc = "DC/DC enable register for VREGH."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct VreghDcdcen(pub u32);
impl VreghDcdcen {
#[doc = "Enable or disable DC/DC converter."]
#[must_use]
#[inline(always)]
pub const fn dcdcen(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable DC/DC converter."]
#[inline(always)]
pub const fn set_dcdcen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for VreghDcdcen {
#[inline(always)]
fn default() -> VreghDcdcen {
VreghDcdcen(0)
}
}
impl core::fmt::Debug for VreghDcdcen {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("VreghDcdcen")
.field("dcdcen", &self.dcdcen())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for VreghDcdcen {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "VreghDcdcen {{ dcdcen: {=bool:?} }}", self.dcdcen())
}
}
#[doc = "DC/DC enable register for VREGMAIN."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct VregmainDcdcen(pub u32);
impl VregmainDcdcen {
#[doc = "Enable or disable DC/DC converter."]
#[must_use]
#[inline(always)]
pub const fn dcdcen(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable DC/DC converter."]
#[inline(always)]
pub const fn set_dcdcen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for VregmainDcdcen {
#[inline(always)]
fn default() -> VregmainDcdcen {
VregmainDcdcen(0)
}
}
impl core::fmt::Debug for VregmainDcdcen {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("VregmainDcdcen")
.field("dcdcen", &self.dcdcen())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for VregmainDcdcen {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "VregmainDcdcen {{ dcdcen: {=bool:?} }}", self.dcdcen())
}
}
#[doc = "DC/DC enable register for VREGRADIO."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct VregradioDcdcen(pub u32);
impl VregradioDcdcen {
#[doc = "Enable or disable DC/DC converter."]
#[must_use]
#[inline(always)]
pub const fn dcdcen(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable DC/DC converter."]
#[inline(always)]
pub const fn set_dcdcen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for VregradioDcdcen {
#[inline(always)]
fn default() -> VregradioDcdcen {
VregradioDcdcen(0)
}
}
impl core::fmt::Debug for VregradioDcdcen {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("VregradioDcdcen")
.field("dcdcen", &self.dcdcen())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for VregradioDcdcen {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "VregradioDcdcen {{ dcdcen: {=bool:?} }}", self.dcdcen())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Threshold {
_RESERVED_0 = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
#[doc = "Set threshold to 1.9 V."]
V19 = 0x06,
#[doc = "Set threshold to 2.0 V."]
V20 = 0x07,
#[doc = "Set threshold to 2.1 V."]
V21 = 0x08,
#[doc = "Set threshold to 2.2 V."]
V22 = 0x09,
#[doc = "Set threshold to 2.3 V."]
V23 = 0x0a,
#[doc = "Set threshold to 2.4 V."]
V24 = 0x0b,
#[doc = "Set threshold to 2.5 V."]
V25 = 0x0c,
#[doc = "Set threshold to 2.6 V."]
V26 = 0x0d,
#[doc = "Set threshold to 2.7 V."]
V27 = 0x0e,
#[doc = "Set threshold to 2.8 V."]
V28 = 0x0f,
}
impl Threshold {
#[inline(always)]
pub const fn from_bits(val: u8) -> Threshold {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Threshold {
#[inline(always)]
fn from(val: u8) -> Threshold {
Threshold::from_bits(val)
}
}
impl From<Threshold> for u8 {
#[inline(always)]
fn from(val: Threshold) -> u8 {
Threshold::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Thresholdvddh {
#[doc = "Set threshold to 2.7 V."]
V27 = 0x0,
#[doc = "Set threshold to 2.8 V."]
V28 = 0x01,
#[doc = "Set threshold to 2.9 V."]
V29 = 0x02,
#[doc = "Set threshold to 3.0 V."]
V30 = 0x03,
#[doc = "Set threshold to 3.1 V."]
V31 = 0x04,
#[doc = "Set threshold to 3.2 V."]
V32 = 0x05,
#[doc = "Set threshold to 3.3 V."]
V33 = 0x06,
#[doc = "Set threshold to 3.4 V."]
V34 = 0x07,
#[doc = "Set threshold to 3.5 V."]
V35 = 0x08,
#[doc = "Set threshold to 3.6 V."]
V36 = 0x09,
#[doc = "Set threshold to 3.7 V."]
V37 = 0x0a,
#[doc = "Set threshold to 3.8 V."]
V38 = 0x0b,
#[doc = "Set threshold to 3.9 V."]
V39 = 0x0c,
#[doc = "Set threshold to 4.0 V."]
V40 = 0x0d,
#[doc = "Set threshold to 4.1 V."]
V41 = 0x0e,
#[doc = "Set threshold to 4.2 V."]
V42 = 0x0f,
}
impl Thresholdvddh {
#[inline(always)]
pub const fn from_bits(val: u8) -> Thresholdvddh {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Thresholdvddh {
#[inline(always)]
fn from(val: u8) -> Thresholdvddh {
Thresholdvddh::from_bits(val)
}
}
impl From<Thresholdvddh> for u8 {
#[inline(always)]
fn from(val: Thresholdvddh) -> u8 {
Thresholdvddh::to_bits(val)
}
}
}
}
pub mod reset {
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Network {
ptr: *mut u8,
}
unsafe impl Send for Network {}
unsafe impl Sync for Network {}
impl Network {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Force network core off."]
#[inline(always)]
pub const fn forceoff(self) -> crate::common::Reg<regs::Forceoff, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
#[doc = "Reset control 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Reset {
ptr: *mut u8,
}
unsafe impl Send for Reset {}
unsafe impl Sync for Reset {}
impl Reset {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Reset reason."]
#[inline(always)]
pub const fn resetreas(self) -> crate::common::Reg<regs::Resetreas, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0400usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn network(self) -> Network {
unsafe { Network::from_ptr(self.ptr.wrapping_add(0x0610usize) as _) }
}
}
pub mod regs {
#[doc = "Force network core off."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Forceoff(pub u32);
impl Forceoff {
#[doc = "Force network core off."]
#[must_use]
#[inline(always)]
pub const fn forceoff(&self) -> super::vals::Forceoff {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Forceoff::from_bits(val as u8)
}
#[doc = "Force network core off."]
#[inline(always)]
pub const fn set_forceoff(&mut self, val: super::vals::Forceoff) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Forceoff {
#[inline(always)]
fn default() -> Forceoff {
Forceoff(0)
}
}
impl core::fmt::Debug for Forceoff {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Forceoff")
.field("forceoff", &self.forceoff())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Forceoff {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Forceoff {{ forceoff: {:?} }}", self.forceoff())
}
}
#[doc = "Reset reason."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Resetreas(pub u32);
impl Resetreas {
#[doc = "Reset from pin reset detected."]
#[must_use]
#[inline(always)]
pub const fn resetpin(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Reset from pin reset detected."]
#[inline(always)]
pub const fn set_resetpin(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Reset from application watchdog timer 0 detected."]
#[must_use]
#[inline(always)]
pub const fn dog0(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Reset from application watchdog timer 0 detected."]
#[inline(always)]
pub const fn set_dog0(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Reset from application CTRL-AP detected."]
#[must_use]
#[inline(always)]
pub const fn ctrlap(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Reset from application CTRL-AP detected."]
#[inline(always)]
pub const fn set_ctrlap(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Reset from application soft reset detected."]
#[must_use]
#[inline(always)]
pub const fn sreq(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Reset from application soft reset detected."]
#[inline(always)]
pub const fn set_sreq(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Reset from application CPU lockup detected."]
#[must_use]
#[inline(always)]
pub const fn lockup(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Reset from application CPU lockup detected."]
#[inline(always)]
pub const fn set_lockup(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Reset due to wakeup from System OFF mode when wakeup is triggered by DETECT signal from GPIO."]
#[must_use]
#[inline(always)]
pub const fn off(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Reset due to wakeup from System OFF mode when wakeup is triggered by DETECT signal from GPIO."]
#[inline(always)]
pub const fn set_off(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Reset due to wakeup from System OFF mode when wakeup is triggered by ANADETECT signal from LPCOMP."]
#[must_use]
#[inline(always)]
pub const fn lpcomp(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Reset due to wakeup from System OFF mode when wakeup is triggered by ANADETECT signal from LPCOMP."]
#[inline(always)]
pub const fn set_lpcomp(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "Reset due to wakeup from System OFF mode when wakeup is triggered by entering the Debug Interface mode."]
#[must_use]
#[inline(always)]
pub const fn dif(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Reset due to wakeup from System OFF mode when wakeup is triggered by entering the Debug Interface mode."]
#[inline(always)]
pub const fn set_dif(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Reset after wakeup from System OFF mode due to NFC field being detected."]
#[must_use]
#[inline(always)]
pub const fn nfc(&self) -> bool {
let val = (self.0 >> 24usize) & 0x01;
val != 0
}
#[doc = "Reset after wakeup from System OFF mode due to NFC field being detected."]
#[inline(always)]
pub const fn set_nfc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
}
#[doc = "Reset from application watchdog timer 1 detected."]
#[must_use]
#[inline(always)]
pub const fn dog1(&self) -> bool {
let val = (self.0 >> 25usize) & 0x01;
val != 0
}
#[doc = "Reset from application watchdog timer 1 detected."]
#[inline(always)]
pub const fn set_dog1(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize);
}
#[doc = "Reset after wakeup from System OFF mode due to VBUS rising into valid range."]
#[must_use]
#[inline(always)]
pub const fn vbus(&self) -> bool {
let val = (self.0 >> 26usize) & 0x01;
val != 0
}
#[doc = "Reset after wakeup from System OFF mode due to VBUS rising into valid range."]
#[inline(always)]
pub const fn set_vbus(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
}
}
impl Default for Resetreas {
#[inline(always)]
fn default() -> Resetreas {
Resetreas(0)
}
}
impl core::fmt::Debug for Resetreas {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Resetreas")
.field("resetpin", &self.resetpin())
.field("dog0", &self.dog0())
.field("ctrlap", &self.ctrlap())
.field("sreq", &self.sreq())
.field("lockup", &self.lockup())
.field("off", &self.off())
.field("lpcomp", &self.lpcomp())
.field("dif", &self.dif())
.field("nfc", &self.nfc())
.field("dog1", &self.dog1())
.field("vbus", &self.vbus())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Resetreas {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Resetreas {{ resetpin: {=bool:?}, dog0: {=bool:?}, ctrlap: {=bool:?}, sreq: {=bool:?}, lockup: {=bool:?}, off: {=bool:?}, lpcomp: {=bool:?}, dif: {=bool:?}, nfc: {=bool:?}, dog1: {=bool:?}, vbus: {=bool:?} }}" , self . resetpin () , self . dog0 () , self . ctrlap () , self . sreq () , self . lockup () , self . off () , self . lpcomp () , self . dif () , self . nfc () , self . dog1 () , self . vbus ())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Forceoff {
#[doc = "Release Force-OFF."]
Release = 0x0,
#[doc = "Hold Force-OFF."]
Hold = 0x01,
}
impl Forceoff {
#[inline(always)]
pub const fn from_bits(val: u8) -> Forceoff {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Forceoff {
#[inline(always)]
fn from(val: u8) -> Forceoff {
Forceoff::from_bits(val)
}
}
impl From<Forceoff> for u8 {
#[inline(always)]
fn from(val: Forceoff) -> u8 {
Forceoff::to_bits(val)
}
}
}
}
pub mod rtc {
#[doc = "Real-time counter 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Rtc {
ptr: *mut u8,
}
unsafe impl Send for Rtc {}
unsafe impl Sync for Rtc {}
impl Rtc {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Start RTC counter."]
#[inline(always)]
pub const fn tasks_start(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Stop RTC counter."]
#[inline(always)]
pub const fn tasks_stop(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Clear RTC counter."]
#[inline(always)]
pub const fn tasks_clear(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Set counter to 0xFFFFF0."]
#[inline(always)]
pub const fn tasks_trigovrflw(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
#[doc = "Description collection: Capture RTC counter to CC\\[n\\] register."]
#[inline(always)]
pub const fn tasks_capture(self, n: usize) -> crate::common::Reg<u32, crate::common::W> {
assert!(n < 4usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x40usize + n * 4usize) as _)
}
}
#[doc = "Subscribe configuration for task START."]
#[inline(always)]
pub const fn subscribe_start(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x80usize) as _) }
}
#[doc = "Subscribe configuration for task STOP."]
#[inline(always)]
pub const fn subscribe_stop(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x84usize) as _) }
}
#[doc = "Subscribe configuration for task CLEAR."]
#[inline(always)]
pub const fn subscribe_clear(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x88usize) as _) }
}
#[doc = "Subscribe configuration for task TRIGOVRFLW."]
#[inline(always)]
pub const fn subscribe_trigovrflw(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x8cusize) as _) }
}
#[doc = "Description collection: Subscribe configuration for task CAPTURE\\[n\\]."]
#[inline(always)]
pub const fn subscribe_capture(
self,
n: usize,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
assert!(n < 4usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xc0usize + n * 4usize) as _)
}
}
#[doc = "Event on counter increment."]
#[inline(always)]
pub const fn events_tick(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0100usize) as _) }
}
#[doc = "Event on counter overflow."]
#[inline(always)]
pub const fn events_ovrflw(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0104usize) as _) }
}
#[doc = "Description collection: Compare event on CC\\[n\\] match."]
#[inline(always)]
pub const fn events_compare(self, n: usize) -> crate::common::Reg<u32, crate::common::RW> {
assert!(n < 4usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0140usize + n * 4usize) as _)
}
}
#[doc = "Publish configuration for event TICK."]
#[inline(always)]
pub const fn publish_tick(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0180usize) as _) }
}
#[doc = "Publish configuration for event OVRFLW."]
#[inline(always)]
pub const fn publish_ovrflw(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0184usize) as _) }
}
#[doc = "Description collection: Publish configuration for event COMPARE\\[n\\]."]
#[inline(always)]
pub const fn publish_compare(
self,
n: usize,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
assert!(n < 4usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01c0usize + n * 4usize) as _)
}
}
#[doc = "Shortcuts between local events and tasks."]
#[inline(always)]
pub const fn shorts(self) -> crate::common::Reg<regs::Shorts, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0200usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "Enable or disable event routing."]
#[inline(always)]
pub const fn evten(self) -> crate::common::Reg<regs::Evt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0340usize) as _) }
}
#[doc = "Enable event routing."]
#[inline(always)]
pub const fn evtenset(self) -> crate::common::Reg<regs::Evt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0344usize) as _) }
}
#[doc = "Disable event routing."]
#[inline(always)]
pub const fn evtenclr(self) -> crate::common::Reg<regs::Evt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0348usize) as _) }
}
#[doc = "Current counter value."]
#[inline(always)]
pub const fn counter(self) -> crate::common::Reg<regs::Counter, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0504usize) as _) }
}
#[doc = "12-bit prescaler for counter frequency (32768 / (PRESCALER + 1)). Must be written when RTC is stopped."]
#[inline(always)]
pub const fn prescaler(self) -> crate::common::Reg<regs::Prescaler, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0508usize) as _) }
}
#[doc = "Description collection: Compare register n."]
#[inline(always)]
pub const fn cc(self, n: usize) -> crate::common::Reg<regs::Cc, crate::common::RW> {
assert!(n < 4usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0540usize + n * 4usize) as _)
}
}
}
pub mod regs {
#[doc = "Description collection: Compare register n."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cc(pub u32);
impl Cc {
#[doc = "Compare value."]
#[must_use]
#[inline(always)]
pub const fn compare(&self) -> u32 {
let val = (self.0 >> 0usize) & 0x00ff_ffff;
val as u32
}
#[doc = "Compare value."]
#[inline(always)]
pub const fn set_compare(&mut self, val: u32) {
self.0 =
(self.0 & !(0x00ff_ffff << 0usize)) | (((val as u32) & 0x00ff_ffff) << 0usize);
}
}
impl Default for Cc {
#[inline(always)]
fn default() -> Cc {
Cc(0)
}
}
impl core::fmt::Debug for Cc {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cc")
.field("compare", &self.compare())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cc {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Cc {{ compare: {=u32:?} }}", self.compare())
}
}
#[doc = "Current counter value."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Counter(pub u32);
impl Counter {
#[doc = "Counter value."]
#[must_use]
#[inline(always)]
pub const fn counter(&self) -> u32 {
let val = (self.0 >> 0usize) & 0x00ff_ffff;
val as u32
}
#[doc = "Counter value."]
#[inline(always)]
pub const fn set_counter(&mut self, val: u32) {
self.0 =
(self.0 & !(0x00ff_ffff << 0usize)) | (((val as u32) & 0x00ff_ffff) << 0usize);
}
}
impl Default for Counter {
#[inline(always)]
fn default() -> Counter {
Counter(0)
}
}
impl core::fmt::Debug for Counter {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Counter")
.field("counter", &self.counter())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Counter {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Counter {{ counter: {=u32:?} }}", self.counter())
}
}
#[doc = "Enable or disable event routing."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Evt(pub u32);
impl Evt {
#[doc = "Enable or disable event routing for event TICK."]
#[must_use]
#[inline(always)]
pub const fn tick(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable event routing for event TICK."]
#[inline(always)]
pub const fn set_tick(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Enable or disable event routing for event OVRFLW."]
#[must_use]
#[inline(always)]
pub const fn ovrflw(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enable or disable event routing for event OVRFLW."]
#[inline(always)]
pub const fn set_ovrflw(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enable or disable event routing for event COMPARE\\[0\\]."]
#[must_use]
#[inline(always)]
pub const fn compare(&self, n: usize) -> bool {
assert!(n < 4usize);
let offs = 16usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Enable or disable event routing for event COMPARE\\[0\\]."]
#[inline(always)]
pub const fn set_compare(&mut self, n: usize, val: bool) {
assert!(n < 4usize);
let offs = 16usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Evt {
#[inline(always)]
fn default() -> Evt {
Evt(0)
}
}
impl core::fmt::Debug for Evt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Evt")
.field("tick", &self.tick())
.field("ovrflw", &self.ovrflw())
.field("compare[0]", &self.compare(0usize))
.field("compare[1]", &self.compare(1usize))
.field("compare[2]", &self.compare(2usize))
.field("compare[3]", &self.compare(3usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Evt {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Evt {{ tick: {=bool:?}, ovrflw: {=bool:?}, compare[0]: {=bool:?}, compare[1]: {=bool:?}, compare[2]: {=bool:?}, compare[3]: {=bool:?} }}" , self . tick () , self . ovrflw () , self . compare (0usize) , self . compare (1usize) , self . compare (2usize) , self . compare (3usize))
}
}
#[doc = "Disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Write '1' to disable interrupt for event TICK."]
#[must_use]
#[inline(always)]
pub const fn tick(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event TICK."]
#[inline(always)]
pub const fn set_tick(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Write '1' to disable interrupt for event OVRFLW."]
#[must_use]
#[inline(always)]
pub const fn ovrflw(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event OVRFLW."]
#[inline(always)]
pub const fn set_ovrflw(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Write '1' to disable interrupt for event COMPARE\\[0\\]."]
#[must_use]
#[inline(always)]
pub const fn compare(&self, n: usize) -> bool {
assert!(n < 4usize);
let offs = 16usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event COMPARE\\[0\\]."]
#[inline(always)]
pub const fn set_compare(&mut self, n: usize, val: bool) {
assert!(n < 4usize);
let offs = 16usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("tick", &self.tick())
.field("ovrflw", &self.ovrflw())
.field("compare[0]", &self.compare(0usize))
.field("compare[1]", &self.compare(1usize))
.field("compare[2]", &self.compare(2usize))
.field("compare[3]", &self.compare(3usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Int {{ tick: {=bool:?}, ovrflw: {=bool:?}, compare[0]: {=bool:?}, compare[1]: {=bool:?}, compare[2]: {=bool:?}, compare[3]: {=bool:?} }}" , self . tick () , self . ovrflw () , self . compare (0usize) , self . compare (1usize) , self . compare (2usize) , self . compare (3usize))
}
}
#[doc = "12-bit prescaler for counter frequency (32768 / (PRESCALER + 1)). Must be written when RTC is stopped."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Prescaler(pub u32);
impl Prescaler {
#[doc = "Prescaler value."]
#[must_use]
#[inline(always)]
pub const fn prescaler(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x0fff;
val as u16
}
#[doc = "Prescaler value."]
#[inline(always)]
pub const fn set_prescaler(&mut self, val: u16) {
self.0 = (self.0 & !(0x0fff << 0usize)) | (((val as u32) & 0x0fff) << 0usize);
}
}
impl Default for Prescaler {
#[inline(always)]
fn default() -> Prescaler {
Prescaler(0)
}
}
impl core::fmt::Debug for Prescaler {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Prescaler")
.field("prescaler", &self.prescaler())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Prescaler {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Prescaler {{ prescaler: {=u16:?} }}", self.prescaler())
}
}
#[doc = "Shortcuts between local events and tasks."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Shorts(pub u32);
impl Shorts {
#[doc = "Shortcut between event COMPARE\\[0\\] and task CLEAR."]
#[must_use]
#[inline(always)]
pub const fn comparen_clear(&self, n: usize) -> bool {
assert!(n < 4usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Shortcut between event COMPARE\\[0\\] and task CLEAR."]
#[inline(always)]
pub const fn set_comparen_clear(&mut self, n: usize, val: bool) {
assert!(n < 4usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Shorts {
#[inline(always)]
fn default() -> Shorts {
Shorts(0)
}
}
impl core::fmt::Debug for Shorts {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Shorts")
.field("comparen_clear[0]", &self.comparen_clear(0usize))
.field("comparen_clear[1]", &self.comparen_clear(1usize))
.field("comparen_clear[2]", &self.comparen_clear(2usize))
.field("comparen_clear[3]", &self.comparen_clear(3usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Shorts {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Shorts {{ comparen_clear[0]: {=bool:?}, comparen_clear[1]: {=bool:?}, comparen_clear[2]: {=bool:?}, comparen_clear[3]: {=bool:?} }}" , self . comparen_clear (0usize) , self . comparen_clear (1usize) , self . comparen_clear (2usize) , self . comparen_clear (3usize))
}
}
}
}
pub mod saadc {
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ch {
ptr: *mut u8,
}
unsafe impl Send for Ch {}
unsafe impl Sync for Ch {}
impl Ch {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: Input positive pin selection for CH\\[n\\]."]
#[inline(always)]
pub const fn pselp(self) -> crate::common::Reg<regs::Pselp, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Description cluster: Input negative pin selection for CH\\[n\\]."]
#[inline(always)]
pub const fn pseln(self) -> crate::common::Reg<regs::Pseln, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Description cluster: Input configuration for CH\\[n\\]."]
#[inline(always)]
pub const fn config(self) -> crate::common::Reg<regs::Config, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Description cluster: High/low limits for event monitoring a channel."]
#[inline(always)]
pub const fn limit(self) -> crate::common::Reg<regs::Limit, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
}
#[doc = "Peripheral events."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct EventsCh {
ptr: *mut u8,
}
unsafe impl Send for EventsCh {}
unsafe impl Sync for EventsCh {}
impl EventsCh {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: Last results is equal or above CH\\[n\\].LIMIT.HIGH."]
#[inline(always)]
pub const fn limith(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Description cluster: Last results is equal or below CH\\[n\\].LIMIT.LOW."]
#[inline(always)]
pub const fn limitl(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
#[doc = "Publish configuration for events."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct PublishCh {
ptr: *mut u8,
}
unsafe impl Send for PublishCh {}
unsafe impl Sync for PublishCh {}
impl PublishCh {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: Publish configuration for event CH\\[n\\].LIMITH."]
#[inline(always)]
pub const fn limith(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Description cluster: Publish configuration for event CH\\[n\\].LIMITL."]
#[inline(always)]
pub const fn limitl(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
#[doc = "RESULT EasyDMA channel."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Result {
ptr: *mut u8,
}
unsafe impl Send for Result {}
unsafe impl Sync for Result {}
impl Result {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Data pointer."]
#[inline(always)]
pub const fn ptr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Maximum number of buffer words to transfer."]
#[inline(always)]
pub const fn maxcnt(self) -> crate::common::Reg<regs::Maxcnt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Number of buffer words transferred since last START."]
#[inline(always)]
pub const fn amount(self) -> crate::common::Reg<regs::Amount, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
}
#[doc = "Analog to Digital Converter 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Saadc {
ptr: *mut u8,
}
unsafe impl Send for Saadc {}
unsafe impl Sync for Saadc {}
impl Saadc {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Start the ADC and prepare the result buffer in RAM."]
#[inline(always)]
pub const fn tasks_start(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Take one ADC sample, if scan is enabled all channels are sampled."]
#[inline(always)]
pub const fn tasks_sample(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Stop the ADC and terminate any ongoing conversion."]
#[inline(always)]
pub const fn tasks_stop(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Starts offset auto-calibration."]
#[inline(always)]
pub const fn tasks_calibrateoffset(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
#[doc = "Subscribe configuration for task START."]
#[inline(always)]
pub const fn subscribe_start(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x80usize) as _) }
}
#[doc = "Subscribe configuration for task SAMPLE."]
#[inline(always)]
pub const fn subscribe_sample(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x84usize) as _) }
}
#[doc = "Subscribe configuration for task STOP."]
#[inline(always)]
pub const fn subscribe_stop(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x88usize) as _) }
}
#[doc = "Subscribe configuration for task CALIBRATEOFFSET."]
#[inline(always)]
pub const fn subscribe_calibrateoffset(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x8cusize) as _) }
}
#[doc = "The ADC has started."]
#[inline(always)]
pub const fn events_started(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0100usize) as _) }
}
#[doc = "The ADC has filled up the Result buffer."]
#[inline(always)]
pub const fn events_end(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0104usize) as _) }
}
#[doc = "A conversion task has been completed. Depending on the mode, multiple conversions might be needed for a result to be transferred to RAM."]
#[inline(always)]
pub const fn events_done(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0108usize) as _) }
}
#[doc = "A result is ready to get transferred to RAM."]
#[inline(always)]
pub const fn events_resultdone(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x010cusize) as _) }
}
#[doc = "Calibration is complete."]
#[inline(always)]
pub const fn events_calibratedone(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0110usize) as _) }
}
#[doc = "The ADC has stopped."]
#[inline(always)]
pub const fn events_stopped(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0114usize) as _) }
}
#[doc = "Peripheral events."]
#[inline(always)]
pub const fn events_ch(self, n: usize) -> EventsCh {
assert!(n < 8usize);
unsafe { EventsCh::from_ptr(self.ptr.wrapping_add(0x0118usize + n * 8usize) as _) }
}
#[doc = "Publish configuration for event STARTED."]
#[inline(always)]
pub const fn publish_started(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0180usize) as _) }
}
#[doc = "Publish configuration for event END."]
#[inline(always)]
pub const fn publish_end(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0184usize) as _) }
}
#[doc = "Publish configuration for event DONE."]
#[inline(always)]
pub const fn publish_done(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0188usize) as _) }
}
#[doc = "Publish configuration for event RESULTDONE."]
#[inline(always)]
pub const fn publish_resultdone(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x018cusize) as _) }
}
#[doc = "Publish configuration for event CALIBRATEDONE."]
#[inline(always)]
pub const fn publish_calibratedone(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0190usize) as _) }
}
#[doc = "Publish configuration for event STOPPED."]
#[inline(always)]
pub const fn publish_stopped(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0194usize) as _) }
}
#[doc = "Publish configuration for events."]
#[inline(always)]
pub const fn publish_ch(self, n: usize) -> PublishCh {
assert!(n < 8usize);
unsafe { PublishCh::from_ptr(self.ptr.wrapping_add(0x0198usize + n * 8usize) as _) }
}
#[doc = "Enable or disable interrupt."]
#[inline(always)]
pub const fn inten(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0300usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "Status."]
#[inline(always)]
pub const fn status(self) -> crate::common::Reg<regs::Status, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0400usize) as _) }
}
#[doc = "Enable or disable ADC."]
#[inline(always)]
pub const fn enable(self) -> crate::common::Reg<regs::Enable, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0500usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn ch(self, n: usize) -> Ch {
assert!(n < 8usize);
unsafe { Ch::from_ptr(self.ptr.wrapping_add(0x0510usize + n * 16usize) as _) }
}
#[doc = "Resolution configuration."]
#[inline(always)]
pub const fn resolution(self) -> crate::common::Reg<regs::Resolution, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x05f0usize) as _) }
}
#[doc = "Oversampling configuration. OVERSAMPLE should not be combined with SCAN. The RESOLUTION is applied before averaging, thus for high OVERSAMPLE a higher RESOLUTION should be used."]
#[inline(always)]
pub const fn oversample(self) -> crate::common::Reg<regs::Oversample, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x05f4usize) as _) }
}
#[doc = "Controls normal or continuous sample rate."]
#[inline(always)]
pub const fn samplerate(self) -> crate::common::Reg<regs::Samplerate, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x05f8usize) as _) }
}
#[doc = "RESULT EasyDMA channel."]
#[inline(always)]
pub const fn result(self) -> Result {
unsafe { Result::from_ptr(self.ptr.wrapping_add(0x062cusize) as _) }
}
}
pub mod regs {
#[doc = "Number of buffer words transferred since last START."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Amount(pub u32);
impl Amount {
#[doc = "Number of buffer words transferred since last START. This register can be read after an END or STOPPED event."]
#[must_use]
#[inline(always)]
pub const fn amount(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x7fff;
val as u16
}
#[doc = "Number of buffer words transferred since last START. This register can be read after an END or STOPPED event."]
#[inline(always)]
pub const fn set_amount(&mut self, val: u16) {
self.0 = (self.0 & !(0x7fff << 0usize)) | (((val as u32) & 0x7fff) << 0usize);
}
}
impl Default for Amount {
#[inline(always)]
fn default() -> Amount {
Amount(0)
}
}
impl core::fmt::Debug for Amount {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Amount")
.field("amount", &self.amount())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Amount {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Amount {{ amount: {=u16:?} }}", self.amount())
}
}
#[doc = "Description cluster: Input configuration for CH\\[n\\]."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Config(pub u32);
impl Config {
#[doc = "Positive channel resistor control."]
#[must_use]
#[inline(always)]
pub const fn resp(&self) -> super::vals::Resp {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Resp::from_bits(val as u8)
}
#[doc = "Positive channel resistor control."]
#[inline(always)]
pub const fn set_resp(&mut self, val: super::vals::Resp) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
#[doc = "Negative channel resistor control."]
#[must_use]
#[inline(always)]
pub const fn resn(&self) -> super::vals::Resn {
let val = (self.0 >> 4usize) & 0x03;
super::vals::Resn::from_bits(val as u8)
}
#[doc = "Negative channel resistor control."]
#[inline(always)]
pub const fn set_resn(&mut self, val: super::vals::Resn) {
self.0 = (self.0 & !(0x03 << 4usize)) | (((val.to_bits() as u32) & 0x03) << 4usize);
}
#[doc = "Gain control."]
#[must_use]
#[inline(always)]
pub const fn gain(&self) -> super::vals::Gain {
let val = (self.0 >> 8usize) & 0x07;
super::vals::Gain::from_bits(val as u8)
}
#[doc = "Gain control."]
#[inline(always)]
pub const fn set_gain(&mut self, val: super::vals::Gain) {
self.0 = (self.0 & !(0x07 << 8usize)) | (((val.to_bits() as u32) & 0x07) << 8usize);
}
#[doc = "Reference control."]
#[must_use]
#[inline(always)]
pub const fn refsel(&self) -> super::vals::Refsel {
let val = (self.0 >> 12usize) & 0x01;
super::vals::Refsel::from_bits(val as u8)
}
#[doc = "Reference control."]
#[inline(always)]
pub const fn set_refsel(&mut self, val: super::vals::Refsel) {
self.0 =
(self.0 & !(0x01 << 12usize)) | (((val.to_bits() as u32) & 0x01) << 12usize);
}
#[doc = "Acquisition time, the time the ADC uses to sample the input voltage."]
#[must_use]
#[inline(always)]
pub const fn tacq(&self) -> super::vals::Tacq {
let val = (self.0 >> 16usize) & 0x07;
super::vals::Tacq::from_bits(val as u8)
}
#[doc = "Acquisition time, the time the ADC uses to sample the input voltage."]
#[inline(always)]
pub const fn set_tacq(&mut self, val: super::vals::Tacq) {
self.0 =
(self.0 & !(0x07 << 16usize)) | (((val.to_bits() as u32) & 0x07) << 16usize);
}
#[doc = "Enable differential mode."]
#[must_use]
#[inline(always)]
pub const fn mode(&self) -> super::vals::ConfigMode {
let val = (self.0 >> 20usize) & 0x01;
super::vals::ConfigMode::from_bits(val as u8)
}
#[doc = "Enable differential mode."]
#[inline(always)]
pub const fn set_mode(&mut self, val: super::vals::ConfigMode) {
self.0 =
(self.0 & !(0x01 << 20usize)) | (((val.to_bits() as u32) & 0x01) << 20usize);
}
#[doc = "Enable burst mode."]
#[must_use]
#[inline(always)]
pub const fn burst(&self) -> bool {
let val = (self.0 >> 24usize) & 0x01;
val != 0
}
#[doc = "Enable burst mode."]
#[inline(always)]
pub const fn set_burst(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
}
}
impl Default for Config {
#[inline(always)]
fn default() -> Config {
Config(0)
}
}
impl core::fmt::Debug for Config {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Config")
.field("resp", &self.resp())
.field("resn", &self.resn())
.field("gain", &self.gain())
.field("refsel", &self.refsel())
.field("tacq", &self.tacq())
.field("mode", &self.mode())
.field("burst", &self.burst())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Config {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Config {{ resp: {:?}, resn: {:?}, gain: {:?}, refsel: {:?}, tacq: {:?}, mode: {:?}, burst: {=bool:?} }}" , self . resp () , self . resn () , self . gain () , self . refsel () , self . tacq () , self . mode () , self . burst ())
}
}
#[doc = "Enable or disable ADC."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Enable(pub u32);
impl Enable {
#[doc = "Enable or disable ADC."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable ADC."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Enable {
#[inline(always)]
fn default() -> Enable {
Enable(0)
}
}
impl core::fmt::Debug for Enable {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Enable")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Enable {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Enable {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "Enable or disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Enable or disable interrupt for event STARTED."]
#[must_use]
#[inline(always)]
pub const fn started(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event STARTED."]
#[inline(always)]
pub const fn set_started(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Enable or disable interrupt for event END."]
#[must_use]
#[inline(always)]
pub const fn end(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event END."]
#[inline(always)]
pub const fn set_end(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enable or disable interrupt for event DONE."]
#[must_use]
#[inline(always)]
pub const fn done(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event DONE."]
#[inline(always)]
pub const fn set_done(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Enable or disable interrupt for event RESULTDONE."]
#[must_use]
#[inline(always)]
pub const fn resultdone(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RESULTDONE."]
#[inline(always)]
pub const fn set_resultdone(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Enable or disable interrupt for event CALIBRATEDONE."]
#[must_use]
#[inline(always)]
pub const fn calibratedone(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event CALIBRATEDONE."]
#[inline(always)]
pub const fn set_calibratedone(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Enable or disable interrupt for event STOPPED."]
#[must_use]
#[inline(always)]
pub const fn stopped(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event STOPPED."]
#[inline(always)]
pub const fn set_stopped(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Enable or disable interrupt for event CH0LIMITH."]
#[must_use]
#[inline(always)]
pub const fn chlimith(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 6usize + n * 2usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event CH0LIMITH."]
#[inline(always)]
pub const fn set_chlimith(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 6usize + n * 2usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "Enable or disable interrupt for event CH0LIMITL."]
#[must_use]
#[inline(always)]
pub const fn chlimitl(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 7usize + n * 2usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event CH0LIMITL."]
#[inline(always)]
pub const fn set_chlimitl(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 7usize + n * 2usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("started", &self.started())
.field("end", &self.end())
.field("done", &self.done())
.field("resultdone", &self.resultdone())
.field("calibratedone", &self.calibratedone())
.field("stopped", &self.stopped())
.field("chlimith[0]", &self.chlimith(0usize))
.field("chlimith[1]", &self.chlimith(1usize))
.field("chlimith[2]", &self.chlimith(2usize))
.field("chlimith[3]", &self.chlimith(3usize))
.field("chlimith[4]", &self.chlimith(4usize))
.field("chlimith[5]", &self.chlimith(5usize))
.field("chlimith[6]", &self.chlimith(6usize))
.field("chlimith[7]", &self.chlimith(7usize))
.field("chlimitl[0]", &self.chlimitl(0usize))
.field("chlimitl[1]", &self.chlimitl(1usize))
.field("chlimitl[2]", &self.chlimitl(2usize))
.field("chlimitl[3]", &self.chlimitl(3usize))
.field("chlimitl[4]", &self.chlimitl(4usize))
.field("chlimitl[5]", &self.chlimitl(5usize))
.field("chlimitl[6]", &self.chlimitl(6usize))
.field("chlimitl[7]", &self.chlimitl(7usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Int {{ started: {=bool:?}, end: {=bool:?}, done: {=bool:?}, resultdone: {=bool:?}, calibratedone: {=bool:?}, stopped: {=bool:?}, chlimith[0]: {=bool:?}, chlimith[1]: {=bool:?}, chlimith[2]: {=bool:?}, chlimith[3]: {=bool:?}, chlimith[4]: {=bool:?}, chlimith[5]: {=bool:?}, chlimith[6]: {=bool:?}, chlimith[7]: {=bool:?}, chlimitl[0]: {=bool:?}, chlimitl[1]: {=bool:?}, chlimitl[2]: {=bool:?}, chlimitl[3]: {=bool:?}, chlimitl[4]: {=bool:?}, chlimitl[5]: {=bool:?}, chlimitl[6]: {=bool:?}, chlimitl[7]: {=bool:?} }}" , self . started () , self . end () , self . done () , self . resultdone () , self . calibratedone () , self . stopped () , self . chlimith (0usize) , self . chlimith (1usize) , self . chlimith (2usize) , self . chlimith (3usize) , self . chlimith (4usize) , self . chlimith (5usize) , self . chlimith (6usize) , self . chlimith (7usize) , self . chlimitl (0usize) , self . chlimitl (1usize) , self . chlimitl (2usize) , self . chlimitl (3usize) , self . chlimitl (4usize) , self . chlimitl (5usize) , self . chlimitl (6usize) , self . chlimitl (7usize))
}
}
#[doc = "Description cluster: High/low limits for event monitoring a channel."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Limit(pub u32);
impl Limit {
#[doc = "Low level limit."]
#[must_use]
#[inline(always)]
pub const fn low(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Low level limit."]
#[inline(always)]
pub const fn set_low(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
#[doc = "High level limit."]
#[must_use]
#[inline(always)]
pub const fn high(&self) -> u16 {
let val = (self.0 >> 16usize) & 0xffff;
val as u16
}
#[doc = "High level limit."]
#[inline(always)]
pub const fn set_high(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 16usize)) | (((val as u32) & 0xffff) << 16usize);
}
}
impl Default for Limit {
#[inline(always)]
fn default() -> Limit {
Limit(0)
}
}
impl core::fmt::Debug for Limit {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Limit")
.field("low", &self.low())
.field("high", &self.high())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Limit {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Limit {{ low: {=u16:?}, high: {=u16:?} }}",
self.low(),
self.high()
)
}
}
#[doc = "Maximum number of buffer words to transfer."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Maxcnt(pub u32);
impl Maxcnt {
#[doc = "Maximum number of buffer words to transfer."]
#[must_use]
#[inline(always)]
pub const fn maxcnt(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x7fff;
val as u16
}
#[doc = "Maximum number of buffer words to transfer."]
#[inline(always)]
pub const fn set_maxcnt(&mut self, val: u16) {
self.0 = (self.0 & !(0x7fff << 0usize)) | (((val as u32) & 0x7fff) << 0usize);
}
}
impl Default for Maxcnt {
#[inline(always)]
fn default() -> Maxcnt {
Maxcnt(0)
}
}
impl core::fmt::Debug for Maxcnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Maxcnt")
.field("maxcnt", &self.maxcnt())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Maxcnt {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Maxcnt {{ maxcnt: {=u16:?} }}", self.maxcnt())
}
}
#[doc = "Oversampling configuration. OVERSAMPLE should not be combined with SCAN. The RESOLUTION is applied before averaging, thus for high OVERSAMPLE a higher RESOLUTION should be used."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Oversample(pub u32);
impl Oversample {
#[doc = "Oversample control."]
#[must_use]
#[inline(always)]
pub const fn oversample(&self) -> super::vals::Oversample {
let val = (self.0 >> 0usize) & 0x0f;
super::vals::Oversample::from_bits(val as u8)
}
#[doc = "Oversample control."]
#[inline(always)]
pub const fn set_oversample(&mut self, val: super::vals::Oversample) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val.to_bits() as u32) & 0x0f) << 0usize);
}
}
impl Default for Oversample {
#[inline(always)]
fn default() -> Oversample {
Oversample(0)
}
}
impl core::fmt::Debug for Oversample {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Oversample")
.field("oversample", &self.oversample())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Oversample {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Oversample {{ oversample: {:?} }}", self.oversample())
}
}
#[doc = "Description cluster: Input negative pin selection for CH\\[n\\]."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Pseln(pub u32);
impl Pseln {
#[doc = "Analog negative input, enables differential channel."]
#[must_use]
#[inline(always)]
pub const fn pseln(&self) -> super::vals::Psel {
let val = (self.0 >> 0usize) & 0x1f;
super::vals::Psel::from_bits(val as u8)
}
#[doc = "Analog negative input, enables differential channel."]
#[inline(always)]
pub const fn set_pseln(&mut self, val: super::vals::Psel) {
self.0 = (self.0 & !(0x1f << 0usize)) | (((val.to_bits() as u32) & 0x1f) << 0usize);
}
}
impl Default for Pseln {
#[inline(always)]
fn default() -> Pseln {
Pseln(0)
}
}
impl core::fmt::Debug for Pseln {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Pseln")
.field("pseln", &self.pseln())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Pseln {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Pseln {{ pseln: {:?} }}", self.pseln())
}
}
#[doc = "Description cluster: Input positive pin selection for CH\\[n\\]."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Pselp(pub u32);
impl Pselp {
#[doc = "Analog positive input channel."]
#[must_use]
#[inline(always)]
pub const fn pselp(&self) -> super::vals::Psel {
let val = (self.0 >> 0usize) & 0x1f;
super::vals::Psel::from_bits(val as u8)
}
#[doc = "Analog positive input channel."]
#[inline(always)]
pub const fn set_pselp(&mut self, val: super::vals::Psel) {
self.0 = (self.0 & !(0x1f << 0usize)) | (((val.to_bits() as u32) & 0x1f) << 0usize);
}
}
impl Default for Pselp {
#[inline(always)]
fn default() -> Pselp {
Pselp(0)
}
}
impl core::fmt::Debug for Pselp {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Pselp")
.field("pselp", &self.pselp())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Pselp {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Pselp {{ pselp: {:?} }}", self.pselp())
}
}
#[doc = "Resolution configuration."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Resolution(pub u32);
impl Resolution {
#[doc = "Set the resolution."]
#[must_use]
#[inline(always)]
pub const fn val(&self) -> super::vals::Val {
let val = (self.0 >> 0usize) & 0x07;
super::vals::Val::from_bits(val as u8)
}
#[doc = "Set the resolution."]
#[inline(always)]
pub const fn set_val(&mut self, val: super::vals::Val) {
self.0 = (self.0 & !(0x07 << 0usize)) | (((val.to_bits() as u32) & 0x07) << 0usize);
}
}
impl Default for Resolution {
#[inline(always)]
fn default() -> Resolution {
Resolution(0)
}
}
impl core::fmt::Debug for Resolution {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Resolution")
.field("val", &self.val())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Resolution {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Resolution {{ val: {:?} }}", self.val())
}
}
#[doc = "Controls normal or continuous sample rate."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Samplerate(pub u32);
impl Samplerate {
#[doc = "Capture and compare value; sample rate is 16 MHz/CC."]
#[must_use]
#[inline(always)]
pub const fn cc(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x07ff;
val as u16
}
#[doc = "Capture and compare value; sample rate is 16 MHz/CC."]
#[inline(always)]
pub const fn set_cc(&mut self, val: u16) {
self.0 = (self.0 & !(0x07ff << 0usize)) | (((val as u32) & 0x07ff) << 0usize);
}
#[doc = "Select mode for sample rate control."]
#[must_use]
#[inline(always)]
pub const fn mode(&self) -> super::vals::SamplerateMode {
let val = (self.0 >> 12usize) & 0x01;
super::vals::SamplerateMode::from_bits(val as u8)
}
#[doc = "Select mode for sample rate control."]
#[inline(always)]
pub const fn set_mode(&mut self, val: super::vals::SamplerateMode) {
self.0 =
(self.0 & !(0x01 << 12usize)) | (((val.to_bits() as u32) & 0x01) << 12usize);
}
}
impl Default for Samplerate {
#[inline(always)]
fn default() -> Samplerate {
Samplerate(0)
}
}
impl core::fmt::Debug for Samplerate {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Samplerate")
.field("cc", &self.cc())
.field("mode", &self.mode())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Samplerate {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Samplerate {{ cc: {=u16:?}, mode: {:?} }}",
self.cc(),
self.mode()
)
}
}
#[doc = "Status."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Status(pub u32);
impl Status {
#[doc = "Status."]
#[must_use]
#[inline(always)]
pub const fn status(&self) -> super::vals::Status {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Status::from_bits(val as u8)
}
#[doc = "Status."]
#[inline(always)]
pub const fn set_status(&mut self, val: super::vals::Status) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Status {
#[inline(always)]
fn default() -> Status {
Status(0)
}
}
impl core::fmt::Debug for Status {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Status")
.field("status", &self.status())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Status {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Status {{ status: {:?} }}", self.status())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum ConfigMode {
#[doc = "Single-ended, PSELN will be ignored, negative input to ADC shorted to GND."]
Se = 0x0,
#[doc = "Differential."]
Diff = 0x01,
}
impl ConfigMode {
#[inline(always)]
pub const fn from_bits(val: u8) -> ConfigMode {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for ConfigMode {
#[inline(always)]
fn from(val: u8) -> ConfigMode {
ConfigMode::from_bits(val)
}
}
impl From<ConfigMode> for u8 {
#[inline(always)]
fn from(val: ConfigMode) -> u8 {
ConfigMode::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Gain {
#[doc = "1/6."]
Gain16 = 0x0,
#[doc = "1/5."]
Gain15 = 0x01,
#[doc = "1/4."]
Gain14 = 0x02,
#[doc = "1/3."]
Gain13 = 0x03,
#[doc = "1/2."]
Gain12 = 0x04,
#[doc = "1."]
Gain1 = 0x05,
#[doc = "2."]
Gain2 = 0x06,
#[doc = "4."]
Gain4 = 0x07,
}
impl Gain {
#[inline(always)]
pub const fn from_bits(val: u8) -> Gain {
unsafe { core::mem::transmute(val & 0x07) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Gain {
#[inline(always)]
fn from(val: u8) -> Gain {
Gain::from_bits(val)
}
}
impl From<Gain> for u8 {
#[inline(always)]
fn from(val: Gain) -> u8 {
Gain::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Oversample {
#[doc = "Bypass oversampling."]
Bypass = 0x0,
#[doc = "Oversample 2x."]
Over2x = 0x01,
#[doc = "Oversample 4x."]
Over4x = 0x02,
#[doc = "Oversample 8x."]
Over8x = 0x03,
#[doc = "Oversample 16x."]
Over16x = 0x04,
#[doc = "Oversample 32x."]
Over32x = 0x05,
#[doc = "Oversample 64x."]
Over64x = 0x06,
#[doc = "Oversample 128x."]
Over128x = 0x07,
#[doc = "Oversample 256x."]
Over256x = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Oversample {
#[inline(always)]
pub const fn from_bits(val: u8) -> Oversample {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Oversample {
#[inline(always)]
fn from(val: u8) -> Oversample {
Oversample::from_bits(val)
}
}
impl From<Oversample> for u8 {
#[inline(always)]
fn from(val: Oversample) -> u8 {
Oversample::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Psel {
#[doc = "Not connected."]
Nc = 0x0,
#[doc = "AIN0."]
AnalogInput0 = 0x01,
#[doc = "AIN1."]
AnalogInput1 = 0x02,
#[doc = "AIN2."]
AnalogInput2 = 0x03,
#[doc = "AIN3."]
AnalogInput3 = 0x04,
#[doc = "AIN4."]
AnalogInput4 = 0x05,
#[doc = "AIN5."]
AnalogInput5 = 0x06,
#[doc = "AIN6."]
AnalogInput6 = 0x07,
#[doc = "AIN7."]
AnalogInput7 = 0x08,
#[doc = "VDD."]
Vdd = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
#[doc = "VDDH/5."]
Vddhdiv5 = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
_RESERVED_10 = 0x10,
_RESERVED_11 = 0x11,
_RESERVED_12 = 0x12,
_RESERVED_13 = 0x13,
_RESERVED_14 = 0x14,
_RESERVED_15 = 0x15,
_RESERVED_16 = 0x16,
_RESERVED_17 = 0x17,
_RESERVED_18 = 0x18,
_RESERVED_19 = 0x19,
_RESERVED_1a = 0x1a,
_RESERVED_1b = 0x1b,
_RESERVED_1c = 0x1c,
_RESERVED_1d = 0x1d,
_RESERVED_1e = 0x1e,
_RESERVED_1f = 0x1f,
}
impl Psel {
#[inline(always)]
pub const fn from_bits(val: u8) -> Psel {
unsafe { core::mem::transmute(val & 0x1f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Psel {
#[inline(always)]
fn from(val: u8) -> Psel {
Psel::from_bits(val)
}
}
impl From<Psel> for u8 {
#[inline(always)]
fn from(val: Psel) -> u8 {
Psel::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Refsel {
#[doc = "Internal reference (0.6 V)."]
Internal = 0x0,
#[doc = "VDD/4 as reference."]
Vdd14 = 0x01,
}
impl Refsel {
#[inline(always)]
pub const fn from_bits(val: u8) -> Refsel {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Refsel {
#[inline(always)]
fn from(val: u8) -> Refsel {
Refsel::from_bits(val)
}
}
impl From<Refsel> for u8 {
#[inline(always)]
fn from(val: Refsel) -> u8 {
Refsel::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Resn {
#[doc = "Bypass resistor ladder."]
Bypass = 0x0,
#[doc = "Pull-down to GND."]
Pulldown = 0x01,
#[doc = "Pull-up to VDD."]
Pullup = 0x02,
#[doc = "Set input at VDD/2."]
Vdd12 = 0x03,
}
impl Resn {
#[inline(always)]
pub const fn from_bits(val: u8) -> Resn {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Resn {
#[inline(always)]
fn from(val: u8) -> Resn {
Resn::from_bits(val)
}
}
impl From<Resn> for u8 {
#[inline(always)]
fn from(val: Resn) -> u8 {
Resn::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Resp {
#[doc = "Bypass resistor ladder."]
Bypass = 0x0,
#[doc = "Pull-down to GND."]
Pulldown = 0x01,
#[doc = "Pull-up to VDD."]
Pullup = 0x02,
#[doc = "Set input at VDD/2."]
Vdd12 = 0x03,
}
impl Resp {
#[inline(always)]
pub const fn from_bits(val: u8) -> Resp {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Resp {
#[inline(always)]
fn from(val: u8) -> Resp {
Resp::from_bits(val)
}
}
impl From<Resp> for u8 {
#[inline(always)]
fn from(val: Resp) -> u8 {
Resp::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum SamplerateMode {
#[doc = "Rate is controlled from SAMPLE task."]
Task = 0x0,
#[doc = "Rate is controlled from local timer (use CC to control the rate)."]
Timers = 0x01,
}
impl SamplerateMode {
#[inline(always)]
pub const fn from_bits(val: u8) -> SamplerateMode {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for SamplerateMode {
#[inline(always)]
fn from(val: u8) -> SamplerateMode {
SamplerateMode::from_bits(val)
}
}
impl From<SamplerateMode> for u8 {
#[inline(always)]
fn from(val: SamplerateMode) -> u8 {
SamplerateMode::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Status {
#[doc = "ADC is ready. No ongoing conversion."]
Ready = 0x0,
#[doc = "ADC is busy. Single conversion in progress."]
Busy = 0x01,
}
impl Status {
#[inline(always)]
pub const fn from_bits(val: u8) -> Status {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Status {
#[inline(always)]
fn from(val: u8) -> Status {
Status::from_bits(val)
}
}
impl From<Status> for u8 {
#[inline(always)]
fn from(val: Status) -> u8 {
Status::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Tacq {
#[doc = "3 us."]
_3us = 0x0,
#[doc = "5 us."]
_5us = 0x01,
#[doc = "10 us."]
_10us = 0x02,
#[doc = "15 us."]
_15us = 0x03,
#[doc = "20 us."]
_20us = 0x04,
#[doc = "40 us."]
_40us = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
}
impl Tacq {
#[inline(always)]
pub const fn from_bits(val: u8) -> Tacq {
unsafe { core::mem::transmute(val & 0x07) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Tacq {
#[inline(always)]
fn from(val: u8) -> Tacq {
Tacq::from_bits(val)
}
}
impl From<Tacq> for u8 {
#[inline(always)]
fn from(val: Tacq) -> u8 {
Tacq::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Val {
#[doc = "8 bit."]
_8bit = 0x0,
#[doc = "10 bit."]
_10bit = 0x01,
#[doc = "12 bit."]
_12bit = 0x02,
#[doc = "14 bit."]
_14bit = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
}
impl Val {
#[inline(always)]
pub const fn from_bits(val: u8) -> Val {
unsafe { core::mem::transmute(val & 0x07) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Val {
#[inline(always)]
fn from(val: u8) -> Val {
Val::from_bits(val)
}
}
impl From<Val> for u8 {
#[inline(always)]
fn from(val: Val) -> u8 {
Val::to_bits(val)
}
}
}
}
pub mod shared {
pub mod regs {
#[doc = "Pin select for LRCK signal."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Psel(pub u32);
impl Psel {
#[doc = "Pin number."]
#[must_use]
#[inline(always)]
pub const fn pin(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x1f;
val as u8
}
#[doc = "Pin number."]
#[inline(always)]
pub const fn set_pin(&mut self, val: u8) {
self.0 = (self.0 & !(0x1f << 0usize)) | (((val as u32) & 0x1f) << 0usize);
}
#[doc = "Port number."]
#[must_use]
#[inline(always)]
pub const fn port(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Port number."]
#[inline(always)]
pub const fn set_port(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Connection."]
#[must_use]
#[inline(always)]
pub const fn connect(&self) -> super::vals::Connect {
let val = (self.0 >> 31usize) & 0x01;
super::vals::Connect::from_bits(val as u8)
}
#[doc = "Connection."]
#[inline(always)]
pub const fn set_connect(&mut self, val: super::vals::Connect) {
self.0 =
(self.0 & !(0x01 << 31usize)) | (((val.to_bits() as u32) & 0x01) << 31usize);
}
}
impl Default for Psel {
#[inline(always)]
fn default() -> Psel {
Psel(0)
}
}
impl core::fmt::Debug for Psel {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Psel")
.field("pin", &self.pin())
.field("port", &self.port())
.field("connect", &self.connect())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Psel {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Psel {{ pin: {=u8:?}, port: {=bool:?}, connect: {:?} }}",
self.pin(),
self.port(),
self.connect()
)
}
}
#[doc = "Publish configuration for event DONE."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Publish(pub u32);
impl Publish {
#[doc = "DPPI channel that event DONE will publish to."]
#[must_use]
#[inline(always)]
pub const fn chidx(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "DPPI channel that event DONE will publish to."]
#[inline(always)]
pub const fn set_chidx(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
#[must_use]
#[inline(always)]
pub const fn en(&self) -> bool {
let val = (self.0 >> 31usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_en(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
}
}
impl Default for Publish {
#[inline(always)]
fn default() -> Publish {
Publish(0)
}
}
impl core::fmt::Debug for Publish {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Publish")
.field("chidx", &self.chidx())
.field("en", &self.en())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Publish {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Publish {{ chidx: {=u8:?}, en: {=bool:?} }}",
self.chidx(),
self.en()
)
}
}
#[doc = "Subscribe configuration for task CAL."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Subscribe(pub u32);
impl Subscribe {
#[doc = "DPPI channel that task CAL will subscribe to."]
#[must_use]
#[inline(always)]
pub const fn chidx(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "DPPI channel that task CAL will subscribe to."]
#[inline(always)]
pub const fn set_chidx(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
#[must_use]
#[inline(always)]
pub const fn en(&self) -> bool {
let val = (self.0 >> 31usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_en(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
}
}
impl Default for Subscribe {
#[inline(always)]
fn default() -> Subscribe {
Subscribe(0)
}
}
impl core::fmt::Debug for Subscribe {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Subscribe")
.field("chidx", &self.chidx())
.field("en", &self.en())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Subscribe {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Subscribe {{ chidx: {=u8:?}, en: {=bool:?} }}",
self.chidx(),
self.en()
)
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Connect {
#[doc = "Connect."]
Connected = 0x0,
#[doc = "Disconnect."]
Disconnected = 0x01,
}
impl Connect {
#[inline(always)]
pub const fn from_bits(val: u8) -> Connect {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Connect {
#[inline(always)]
fn from(val: u8) -> Connect {
Connect::from_bits(val)
}
}
impl From<Connect> for u8 {
#[inline(always)]
fn from(val: Connect) -> u8 {
Connect::to_bits(val)
}
}
}
}
pub mod spim {
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Dma {
ptr: *mut u8,
}
unsafe impl Send for Dma {}
unsafe impl Sync for Dma {}
impl Dma {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "RXD EasyDMA channel."]
#[inline(always)]
pub const fn rx(self) -> DmaRx {
unsafe { DmaRx::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "TXD EasyDMA channel."]
#[inline(always)]
pub const fn tx(self) -> DmaTx {
unsafe { DmaTx::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
}
#[doc = "RXD EasyDMA channel."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DmaRx {
ptr: *mut u8,
}
unsafe impl Send for DmaRx {}
unsafe impl Sync for DmaRx {}
impl DmaRx {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Data pointer."]
#[inline(always)]
pub const fn ptr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Maximum number of bytes in receive buffer."]
#[inline(always)]
pub const fn maxcnt(self) -> crate::common::Reg<regs::RxdMaxcnt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Number of bytes transferred in the last transaction."]
#[inline(always)]
pub const fn amount(self) -> crate::common::Reg<regs::RxdAmount, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "EasyDMA list type."]
#[inline(always)]
pub const fn list(self) -> crate::common::Reg<regs::RxdList, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
}
#[doc = "TXD EasyDMA channel."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DmaTx {
ptr: *mut u8,
}
unsafe impl Send for DmaTx {}
unsafe impl Sync for DmaTx {}
impl DmaTx {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Data pointer."]
#[inline(always)]
pub const fn ptr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Number of bytes in transmit buffer."]
#[inline(always)]
pub const fn maxcnt(self) -> crate::common::Reg<regs::TxdMaxcnt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Number of bytes transferred in the last transaction."]
#[inline(always)]
pub const fn amount(self) -> crate::common::Reg<regs::TxdAmount, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "EasyDMA list type."]
#[inline(always)]
pub const fn list(self) -> crate::common::Reg<regs::TxdList, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Iftiming {
ptr: *mut u8,
}
unsafe impl Send for Iftiming {}
unsafe impl Sync for Iftiming {}
impl Iftiming {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Sample delay for input serial data on MISO."]
#[inline(always)]
pub const fn rxdelay(self) -> crate::common::Reg<regs::Rxdelay, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Minimum duration between edge of CSN and edge of SCK. When SHORTS.END_START is used, this is also the minimum duration CSN must stay high between transactions."]
#[inline(always)]
pub const fn csndur(self) -> crate::common::Reg<regs::Csndur, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Psel {
ptr: *mut u8,
}
unsafe impl Send for Psel {}
unsafe impl Sync for Psel {}
impl Psel {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Pin select for SCK."]
#[inline(always)]
pub const fn sck(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Pin select for MOSI signal."]
#[inline(always)]
pub const fn mosi(
self,
) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Pin select for MISO signal."]
#[inline(always)]
pub const fn miso(
self,
) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Pin select for CSN."]
#[inline(always)]
pub const fn csn(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
}
#[doc = "Serial Peripheral Interface Master with EasyDMA 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Spim {
ptr: *mut u8,
}
unsafe impl Send for Spim {}
unsafe impl Sync for Spim {}
impl Spim {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Start SPI transaction."]
#[inline(always)]
pub const fn tasks_start(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
#[doc = "Stop SPI transaction."]
#[inline(always)]
pub const fn tasks_stop(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x14usize) as _) }
}
#[doc = "Suspend SPI transaction."]
#[inline(always)]
pub const fn tasks_suspend(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x1cusize) as _) }
}
#[doc = "Resume SPI transaction."]
#[inline(always)]
pub const fn tasks_resume(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x20usize) as _) }
}
#[doc = "Subscribe configuration for task START."]
#[inline(always)]
pub const fn subscribe_start(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x90usize) as _) }
}
#[doc = "Subscribe configuration for task STOP."]
#[inline(always)]
pub const fn subscribe_stop(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x94usize) as _) }
}
#[doc = "Subscribe configuration for task SUSPEND."]
#[inline(always)]
pub const fn subscribe_suspend(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x9cusize) as _) }
}
#[doc = "Subscribe configuration for task RESUME."]
#[inline(always)]
pub const fn subscribe_resume(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xa0usize) as _) }
}
#[doc = "SPI transaction has stopped."]
#[inline(always)]
pub const fn events_stopped(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0104usize) as _) }
}
#[doc = "End of RXD buffer reached."]
#[inline(always)]
pub const fn events_endrx(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0110usize) as _) }
}
#[doc = "End of RXD buffer and TXD buffer reached."]
#[inline(always)]
pub const fn events_end(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0118usize) as _) }
}
#[doc = "End of TXD buffer reached."]
#[inline(always)]
pub const fn events_endtx(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0120usize) as _) }
}
#[doc = "Transaction started."]
#[inline(always)]
pub const fn events_started(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x014cusize) as _) }
}
#[doc = "Publish configuration for event STOPPED."]
#[inline(always)]
pub const fn publish_stopped(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0184usize) as _) }
}
#[doc = "Publish configuration for event ENDRX."]
#[inline(always)]
pub const fn publish_endrx(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0190usize) as _) }
}
#[doc = "Publish configuration for event END."]
#[inline(always)]
pub const fn publish_end(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0198usize) as _) }
}
#[doc = "Publish configuration for event ENDTX."]
#[inline(always)]
pub const fn publish_endtx(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01a0usize) as _) }
}
#[doc = "Publish configuration for event STARTED."]
#[inline(always)]
pub const fn publish_started(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01ccusize) as _) }
}
#[doc = "Shortcuts between local events and tasks."]
#[inline(always)]
pub const fn shorts(self) -> crate::common::Reg<regs::Shorts, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0200usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "Stall status for EasyDMA RAM accesses. The fields in this register are set to STALL by hardware whenever a stall occurres and can be cleared (set to NOSTALL) by the CPU."]
#[inline(always)]
pub const fn stallstat(self) -> crate::common::Reg<regs::Stallstat, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0400usize) as _) }
}
#[doc = "Enable SPIM."]
#[inline(always)]
pub const fn enable(self) -> crate::common::Reg<regs::Enable, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0500usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn psel(self) -> Psel {
unsafe { Psel::from_ptr(self.ptr.wrapping_add(0x0508usize) as _) }
}
#[doc = "SPI frequency. Accuracy depends on the HFCLK source selected."]
#[inline(always)]
pub const fn frequency(self) -> crate::common::Reg<regs::Frequency, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0524usize) as _) }
}
#[inline(always)]
pub const fn dma(self) -> Dma {
unsafe { Dma::from_ptr(self.ptr.wrapping_add(0x0534usize) as _) }
}
#[doc = "Configuration register."]
#[inline(always)]
pub const fn config(self) -> crate::common::Reg<regs::Config, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0554usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn iftiming(self) -> Iftiming {
unsafe { Iftiming::from_ptr(self.ptr.wrapping_add(0x0560usize) as _) }
}
#[doc = "Polarity of CSN output."]
#[inline(always)]
pub const fn csnpol(self) -> crate::common::Reg<regs::Csnpol, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0568usize) as _) }
}
#[doc = "Pin select for DCX signal."]
#[inline(always)]
pub const fn pseldcx(
self,
) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x056cusize) as _) }
}
#[doc = "DCX configuration."]
#[inline(always)]
pub const fn dcxcnt(self) -> crate::common::Reg<regs::Dcxcnt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0570usize) as _) }
}
#[doc = "Byte transmitted after TXD.MAXCNT bytes have been transmitted in the case when RXD.MAXCNT is greater than TXD.MAXCNT."]
#[inline(always)]
pub const fn orc(self) -> crate::common::Reg<regs::Orc, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x05c0usize) as _) }
}
}
pub mod regs {
#[doc = "Configuration register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Config(pub u32);
impl Config {
#[doc = "Bit order."]
#[must_use]
#[inline(always)]
pub const fn order(&self) -> super::vals::Order {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Order::from_bits(val as u8)
}
#[doc = "Bit order."]
#[inline(always)]
pub const fn set_order(&mut self, val: super::vals::Order) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "Serial clock (SCK) phase."]
#[must_use]
#[inline(always)]
pub const fn cpha(&self) -> super::vals::Cpha {
let val = (self.0 >> 1usize) & 0x01;
super::vals::Cpha::from_bits(val as u8)
}
#[doc = "Serial clock (SCK) phase."]
#[inline(always)]
pub const fn set_cpha(&mut self, val: super::vals::Cpha) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val.to_bits() as u32) & 0x01) << 1usize);
}
#[doc = "Serial clock (SCK) polarity."]
#[must_use]
#[inline(always)]
pub const fn cpol(&self) -> super::vals::Cpol {
let val = (self.0 >> 2usize) & 0x01;
super::vals::Cpol::from_bits(val as u8)
}
#[doc = "Serial clock (SCK) polarity."]
#[inline(always)]
pub const fn set_cpol(&mut self, val: super::vals::Cpol) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val.to_bits() as u32) & 0x01) << 2usize);
}
}
impl Default for Config {
#[inline(always)]
fn default() -> Config {
Config(0)
}
}
impl core::fmt::Debug for Config {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Config")
.field("order", &self.order())
.field("cpha", &self.cpha())
.field("cpol", &self.cpol())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Config {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Config {{ order: {:?}, cpha: {:?}, cpol: {:?} }}",
self.order(),
self.cpha(),
self.cpol()
)
}
}
#[doc = "Minimum duration between edge of CSN and edge of SCK. When SHORTS.END_START is used, this is also the minimum duration CSN must stay high between transactions."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Csndur(pub u32);
impl Csndur {
#[doc = "Minimum duration between edge of CSN and edge of SCK. When SHORTS.END_START is used, this is the minimum duration CSN must stay high between transactions. The value is specified in number of 64 MHz clock cycles (15.625 ns)."]
#[must_use]
#[inline(always)]
pub const fn csndur(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Minimum duration between edge of CSN and edge of SCK. When SHORTS.END_START is used, this is the minimum duration CSN must stay high between transactions. The value is specified in number of 64 MHz clock cycles (15.625 ns)."]
#[inline(always)]
pub const fn set_csndur(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for Csndur {
#[inline(always)]
fn default() -> Csndur {
Csndur(0)
}
}
impl core::fmt::Debug for Csndur {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Csndur")
.field("csndur", &self.csndur())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Csndur {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Csndur {{ csndur: {=u8:?} }}", self.csndur())
}
}
#[doc = "Polarity of CSN output."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Csnpol(pub u32);
impl Csnpol {
#[doc = "Polarity of CSN output."]
#[must_use]
#[inline(always)]
pub const fn csnpol(&self) -> super::vals::Csnpol {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Csnpol::from_bits(val as u8)
}
#[doc = "Polarity of CSN output."]
#[inline(always)]
pub const fn set_csnpol(&mut self, val: super::vals::Csnpol) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Csnpol {
#[inline(always)]
fn default() -> Csnpol {
Csnpol(0)
}
}
impl core::fmt::Debug for Csnpol {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Csnpol")
.field("csnpol", &self.csnpol())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Csnpol {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Csnpol {{ csnpol: {:?} }}", self.csnpol())
}
}
#[doc = "DCX configuration."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Dcxcnt(pub u32);
impl Dcxcnt {
#[doc = "This register specifies the number of command bytes preceding the data bytes. The PSEL.DCX line will be low during transmission of command bytes and high during transmission of data bytes. Value 0xF indicates that all bytes are command bytes."]
#[must_use]
#[inline(always)]
pub const fn dcxcnt(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x0f;
val as u8
}
#[doc = "This register specifies the number of command bytes preceding the data bytes. The PSEL.DCX line will be low during transmission of command bytes and high during transmission of data bytes. Value 0xF indicates that all bytes are command bytes."]
#[inline(always)]
pub const fn set_dcxcnt(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val as u32) & 0x0f) << 0usize);
}
}
impl Default for Dcxcnt {
#[inline(always)]
fn default() -> Dcxcnt {
Dcxcnt(0)
}
}
impl core::fmt::Debug for Dcxcnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Dcxcnt")
.field("dcxcnt", &self.dcxcnt())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Dcxcnt {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Dcxcnt {{ dcxcnt: {=u8:?} }}", self.dcxcnt())
}
}
#[doc = "Enable SPIM."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Enable(pub u32);
impl Enable {
#[doc = "Enable or disable SPIM."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> super::vals::Enable {
let val = (self.0 >> 0usize) & 0x0f;
super::vals::Enable::from_bits(val as u8)
}
#[doc = "Enable or disable SPIM."]
#[inline(always)]
pub const fn set_enable(&mut self, val: super::vals::Enable) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val.to_bits() as u32) & 0x0f) << 0usize);
}
}
impl Default for Enable {
#[inline(always)]
fn default() -> Enable {
Enable(0)
}
}
impl core::fmt::Debug for Enable {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Enable")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Enable {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Enable {{ enable: {:?} }}", self.enable())
}
}
#[doc = "SPI frequency. Accuracy depends on the HFCLK source selected."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Frequency(pub u32);
impl Frequency {
#[doc = "SPI master data rate."]
#[must_use]
#[inline(always)]
pub const fn frequency(&self) -> super::vals::Frequency {
let val = (self.0 >> 0usize) & 0xffff_ffff;
super::vals::Frequency::from_bits(val as u32)
}
#[doc = "SPI master data rate."]
#[inline(always)]
pub const fn set_frequency(&mut self, val: super::vals::Frequency) {
self.0 = (self.0 & !(0xffff_ffff << 0usize))
| (((val.to_bits() as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Frequency {
#[inline(always)]
fn default() -> Frequency {
Frequency(0)
}
}
impl core::fmt::Debug for Frequency {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Frequency")
.field("frequency", &self.frequency())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Frequency {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Frequency {{ frequency: {:?} }}", self.frequency())
}
}
#[doc = "Disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Write '1' to disable interrupt for event STOPPED."]
#[must_use]
#[inline(always)]
pub const fn stopped(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event STOPPED."]
#[inline(always)]
pub const fn set_stopped(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Write '1' to disable interrupt for event ENDRX."]
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event ENDRX."]
#[inline(always)]
pub const fn set_endrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Write '1' to disable interrupt for event END."]
#[must_use]
#[inline(always)]
pub const fn end(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event END."]
#[inline(always)]
pub const fn set_end(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "Write '1' to disable interrupt for event ENDTX."]
#[must_use]
#[inline(always)]
pub const fn endtx(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event ENDTX."]
#[inline(always)]
pub const fn set_endtx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "Write '1' to disable interrupt for event STARTED."]
#[must_use]
#[inline(always)]
pub const fn started(&self) -> bool {
let val = (self.0 >> 19usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event STARTED."]
#[inline(always)]
pub const fn set_started(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("stopped", &self.stopped())
.field("endrx", &self.endrx())
.field("end", &self.end())
.field("endtx", &self.endtx())
.field("started", &self.started())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Int {{ stopped: {=bool:?}, endrx: {=bool:?}, end: {=bool:?}, endtx: {=bool:?}, started: {=bool:?} }}" , self . stopped () , self . endrx () , self . end () , self . endtx () , self . started ())
}
}
#[doc = "Byte transmitted after TXD.MAXCNT bytes have been transmitted in the case when RXD.MAXCNT is greater than TXD.MAXCNT."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Orc(pub u32);
impl Orc {
#[doc = "Byte transmitted after TXD.MAXCNT bytes have been transmitted in the case when RXD.MAXCNT is greater than TXD.MAXCNT."]
#[must_use]
#[inline(always)]
pub const fn orc(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Byte transmitted after TXD.MAXCNT bytes have been transmitted in the case when RXD.MAXCNT is greater than TXD.MAXCNT."]
#[inline(always)]
pub const fn set_orc(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for Orc {
#[inline(always)]
fn default() -> Orc {
Orc(0)
}
}
impl core::fmt::Debug for Orc {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Orc").field("orc", &self.orc()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Orc {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Orc {{ orc: {=u8:?} }}", self.orc())
}
}
#[doc = "Number of bytes transferred in the last transaction."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RxdAmount(pub u32);
impl RxdAmount {
#[doc = "Number of bytes transferred in the last transaction."]
#[must_use]
#[inline(always)]
pub const fn amount(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Number of bytes transferred in the last transaction."]
#[inline(always)]
pub const fn set_amount(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for RxdAmount {
#[inline(always)]
fn default() -> RxdAmount {
RxdAmount(0)
}
}
impl core::fmt::Debug for RxdAmount {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RxdAmount")
.field("amount", &self.amount())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RxdAmount {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "RxdAmount {{ amount: {=u16:?} }}", self.amount())
}
}
#[doc = "EasyDMA list type."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RxdList(pub u32);
impl RxdList {
#[doc = "List type."]
#[must_use]
#[inline(always)]
pub const fn list(&self) -> super::vals::RxdListList {
let val = (self.0 >> 0usize) & 0x03;
super::vals::RxdListList::from_bits(val as u8)
}
#[doc = "List type."]
#[inline(always)]
pub const fn set_list(&mut self, val: super::vals::RxdListList) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for RxdList {
#[inline(always)]
fn default() -> RxdList {
RxdList(0)
}
}
impl core::fmt::Debug for RxdList {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RxdList")
.field("list", &self.list())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RxdList {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "RxdList {{ list: {:?} }}", self.list())
}
}
#[doc = "Maximum number of bytes in receive buffer."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RxdMaxcnt(pub u32);
impl RxdMaxcnt {
#[doc = "Maximum number of bytes in receive buffer."]
#[must_use]
#[inline(always)]
pub const fn maxcnt(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Maximum number of bytes in receive buffer."]
#[inline(always)]
pub const fn set_maxcnt(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for RxdMaxcnt {
#[inline(always)]
fn default() -> RxdMaxcnt {
RxdMaxcnt(0)
}
}
impl core::fmt::Debug for RxdMaxcnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RxdMaxcnt")
.field("maxcnt", &self.maxcnt())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RxdMaxcnt {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "RxdMaxcnt {{ maxcnt: {=u16:?} }}", self.maxcnt())
}
}
#[doc = "Sample delay for input serial data on MISO."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Rxdelay(pub u32);
impl Rxdelay {
#[doc = "Sample delay for input serial data on MISO. The value specifies the number of 64 MHz clock cycles (15.625 ns) delay from the the sampling edge of SCK (leading edge for CONFIG.CPHA = 0, trailing edge for CONFIG.CPHA = 1) until the input serial data is sampled. As en example, if RXDELAY = 0 and CONFIG.CPHA = 0, the input serial data is sampled on the rising edge of SCK."]
#[must_use]
#[inline(always)]
pub const fn rxdelay(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x07;
val as u8
}
#[doc = "Sample delay for input serial data on MISO. The value specifies the number of 64 MHz clock cycles (15.625 ns) delay from the the sampling edge of SCK (leading edge for CONFIG.CPHA = 0, trailing edge for CONFIG.CPHA = 1) until the input serial data is sampled. As en example, if RXDELAY = 0 and CONFIG.CPHA = 0, the input serial data is sampled on the rising edge of SCK."]
#[inline(always)]
pub const fn set_rxdelay(&mut self, val: u8) {
self.0 = (self.0 & !(0x07 << 0usize)) | (((val as u32) & 0x07) << 0usize);
}
}
impl Default for Rxdelay {
#[inline(always)]
fn default() -> Rxdelay {
Rxdelay(0)
}
}
impl core::fmt::Debug for Rxdelay {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Rxdelay")
.field("rxdelay", &self.rxdelay())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Rxdelay {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Rxdelay {{ rxdelay: {=u8:?} }}", self.rxdelay())
}
}
#[doc = "Shortcuts between local events and tasks."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Shorts(pub u32);
impl Shorts {
#[doc = "Shortcut between event END and task START."]
#[must_use]
#[inline(always)]
pub const fn end_start(&self) -> bool {
let val = (self.0 >> 17usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event END and task START."]
#[inline(always)]
pub const fn set_end_start(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
}
}
impl Default for Shorts {
#[inline(always)]
fn default() -> Shorts {
Shorts(0)
}
}
impl core::fmt::Debug for Shorts {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Shorts")
.field("end_start", &self.end_start())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Shorts {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Shorts {{ end_start: {=bool:?} }}", self.end_start())
}
}
#[doc = "Stall status for EasyDMA RAM accesses. The fields in this register are set to STALL by hardware whenever a stall occurres and can be cleared (set to NOSTALL) by the CPU."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Stallstat(pub u32);
impl Stallstat {
#[doc = "Stall status for EasyDMA RAM reads."]
#[must_use]
#[inline(always)]
pub const fn tx(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Stall status for EasyDMA RAM reads."]
#[inline(always)]
pub const fn set_tx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Stall status for EasyDMA RAM writes."]
#[must_use]
#[inline(always)]
pub const fn rx(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Stall status for EasyDMA RAM writes."]
#[inline(always)]
pub const fn set_rx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
}
impl Default for Stallstat {
#[inline(always)]
fn default() -> Stallstat {
Stallstat(0)
}
}
impl core::fmt::Debug for Stallstat {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Stallstat")
.field("tx", &self.tx())
.field("rx", &self.rx())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Stallstat {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Stallstat {{ tx: {=bool:?}, rx: {=bool:?} }}",
self.tx(),
self.rx()
)
}
}
#[doc = "Number of bytes transferred in the last transaction."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TxdAmount(pub u32);
impl TxdAmount {
#[doc = "Number of bytes transferred in the last transaction."]
#[must_use]
#[inline(always)]
pub const fn amount(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Number of bytes transferred in the last transaction."]
#[inline(always)]
pub const fn set_amount(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for TxdAmount {
#[inline(always)]
fn default() -> TxdAmount {
TxdAmount(0)
}
}
impl core::fmt::Debug for TxdAmount {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TxdAmount")
.field("amount", &self.amount())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for TxdAmount {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "TxdAmount {{ amount: {=u16:?} }}", self.amount())
}
}
#[doc = "EasyDMA list type."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TxdList(pub u32);
impl TxdList {
#[doc = "List type."]
#[must_use]
#[inline(always)]
pub const fn list(&self) -> super::vals::TxdListList {
let val = (self.0 >> 0usize) & 0x03;
super::vals::TxdListList::from_bits(val as u8)
}
#[doc = "List type."]
#[inline(always)]
pub const fn set_list(&mut self, val: super::vals::TxdListList) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for TxdList {
#[inline(always)]
fn default() -> TxdList {
TxdList(0)
}
}
impl core::fmt::Debug for TxdList {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TxdList")
.field("list", &self.list())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for TxdList {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "TxdList {{ list: {:?} }}", self.list())
}
}
#[doc = "Number of bytes in transmit buffer."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TxdMaxcnt(pub u32);
impl TxdMaxcnt {
#[doc = "Maximum number of bytes in transmit buffer."]
#[must_use]
#[inline(always)]
pub const fn maxcnt(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Maximum number of bytes in transmit buffer."]
#[inline(always)]
pub const fn set_maxcnt(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for TxdMaxcnt {
#[inline(always)]
fn default() -> TxdMaxcnt {
TxdMaxcnt(0)
}
}
impl core::fmt::Debug for TxdMaxcnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TxdMaxcnt")
.field("maxcnt", &self.maxcnt())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for TxdMaxcnt {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "TxdMaxcnt {{ maxcnt: {=u16:?} }}", self.maxcnt())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Cpha {
#[doc = "Sample on leading edge of clock, shift serial data on trailing edge."]
Leading = 0x0,
#[doc = "Sample on trailing edge of clock, shift serial data on leading edge."]
Trailing = 0x01,
}
impl Cpha {
#[inline(always)]
pub const fn from_bits(val: u8) -> Cpha {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Cpha {
#[inline(always)]
fn from(val: u8) -> Cpha {
Cpha::from_bits(val)
}
}
impl From<Cpha> for u8 {
#[inline(always)]
fn from(val: Cpha) -> u8 {
Cpha::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Cpol {
#[doc = "Active high."]
ActiveHigh = 0x0,
#[doc = "Active low."]
ActiveLow = 0x01,
}
impl Cpol {
#[inline(always)]
pub const fn from_bits(val: u8) -> Cpol {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Cpol {
#[inline(always)]
fn from(val: u8) -> Cpol {
Cpol::from_bits(val)
}
}
impl From<Cpol> for u8 {
#[inline(always)]
fn from(val: Cpol) -> u8 {
Cpol::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Csnpol {
#[doc = "Active low (idle state high)."]
Low = 0x0,
#[doc = "Active high (idle state low)."]
High = 0x01,
}
impl Csnpol {
#[inline(always)]
pub const fn from_bits(val: u8) -> Csnpol {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Csnpol {
#[inline(always)]
fn from(val: u8) -> Csnpol {
Csnpol::from_bits(val)
}
}
impl From<Csnpol> for u8 {
#[inline(always)]
fn from(val: Csnpol) -> u8 {
Csnpol::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Enable {
#[doc = "Disable SPIM."]
Disabled = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
#[doc = "Enable SPIM."]
Enabled = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Enable {
#[inline(always)]
pub const fn from_bits(val: u8) -> Enable {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Enable {
#[inline(always)]
fn from(val: u8) -> Enable {
Enable::from_bits(val)
}
}
impl From<Enable> for u8 {
#[inline(always)]
fn from(val: Enable) -> u8 {
Enable::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Frequency(u32);
impl Frequency {
#[doc = "125 kbps."]
pub const K125: Self = Self(0x0200_0000);
#[doc = "250 kbps."]
pub const K250: Self = Self(0x0400_0000);
#[doc = "500 kbps."]
pub const K500: Self = Self(0x0800_0000);
#[doc = "16 Mbps."]
pub const M16: Self = Self(0x0a00_0000);
#[doc = "1 Mbps."]
pub const M1: Self = Self(0x1000_0000);
#[doc = "32 Mbps."]
pub const M32: Self = Self(0x1400_0000);
#[doc = "2 Mbps."]
pub const M2: Self = Self(0x2000_0000);
#[doc = "4 Mbps."]
pub const M4: Self = Self(0x4000_0000);
#[doc = "8 Mbps."]
pub const M8: Self = Self(0x8000_0000);
}
impl Frequency {
pub const fn from_bits(val: u32) -> Frequency {
Self(val & 0xffff_ffff)
}
pub const fn to_bits(self) -> u32 {
self.0
}
}
impl core::fmt::Debug for Frequency {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x0200_0000 => f.write_str("K125"),
0x0400_0000 => f.write_str("K250"),
0x0800_0000 => f.write_str("K500"),
0x0a00_0000 => f.write_str("M16"),
0x1000_0000 => f.write_str("M1"),
0x1400_0000 => f.write_str("M32"),
0x2000_0000 => f.write_str("M2"),
0x4000_0000 => f.write_str("M4"),
0x8000_0000 => f.write_str("M8"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Frequency {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x0200_0000 => defmt::write!(f, "K125"),
0x0400_0000 => defmt::write!(f, "K250"),
0x0800_0000 => defmt::write!(f, "K500"),
0x0a00_0000 => defmt::write!(f, "M16"),
0x1000_0000 => defmt::write!(f, "M1"),
0x1400_0000 => defmt::write!(f, "M32"),
0x2000_0000 => defmt::write!(f, "M2"),
0x4000_0000 => defmt::write!(f, "M4"),
0x8000_0000 => defmt::write!(f, "M8"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u32> for Frequency {
#[inline(always)]
fn from(val: u32) -> Frequency {
Frequency::from_bits(val)
}
}
impl From<Frequency> for u32 {
#[inline(always)]
fn from(val: Frequency) -> u32 {
Frequency::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Order {
#[doc = "Most significant bit shifted out first."]
MsbFirst = 0x0,
#[doc = "Least significant bit shifted out first."]
LsbFirst = 0x01,
}
impl Order {
#[inline(always)]
pub const fn from_bits(val: u8) -> Order {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Order {
#[inline(always)]
fn from(val: u8) -> Order {
Order::from_bits(val)
}
}
impl From<Order> for u8 {
#[inline(always)]
fn from(val: Order) -> u8 {
Order::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RxdListList {
#[doc = "Disable EasyDMA list."]
Disabled = 0x0,
#[doc = "Use array list."]
ArrayList = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
}
impl RxdListList {
#[inline(always)]
pub const fn from_bits(val: u8) -> RxdListList {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for RxdListList {
#[inline(always)]
fn from(val: u8) -> RxdListList {
RxdListList::from_bits(val)
}
}
impl From<RxdListList> for u8 {
#[inline(always)]
fn from(val: RxdListList) -> u8 {
RxdListList::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum TxdListList {
#[doc = "Disable EasyDMA list."]
Disabled = 0x0,
#[doc = "Use array list."]
ArrayList = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
}
impl TxdListList {
#[inline(always)]
pub const fn from_bits(val: u8) -> TxdListList {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for TxdListList {
#[inline(always)]
fn from(val: u8) -> TxdListList {
TxdListList::from_bits(val)
}
}
impl From<TxdListList> for u8 {
#[inline(always)]
fn from(val: TxdListList) -> u8 {
TxdListList::to_bits(val)
}
}
}
}
pub mod spis {
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Dma {
ptr: *mut u8,
}
unsafe impl Send for Dma {}
unsafe impl Sync for Dma {}
impl Dma {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn rx(self) -> DmaRx {
unsafe { DmaRx::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn tx(self) -> DmaTx {
unsafe { DmaTx::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DmaRx {
ptr: *mut u8,
}
unsafe impl Send for DmaRx {}
unsafe impl Sync for DmaRx {}
impl DmaRx {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "RXD data pointer."]
#[inline(always)]
pub const fn ptr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Maximum number of bytes in receive buffer."]
#[inline(always)]
pub const fn maxcnt(self) -> crate::common::Reg<regs::RxdMaxcnt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Number of bytes received in last granted transaction."]
#[inline(always)]
pub const fn amount(self) -> crate::common::Reg<regs::RxdAmount, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "EasyDMA list type."]
#[inline(always)]
pub const fn list(self) -> crate::common::Reg<regs::RxdList, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DmaTx {
ptr: *mut u8,
}
unsafe impl Send for DmaTx {}
unsafe impl Sync for DmaTx {}
impl DmaTx {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "TXD data pointer."]
#[inline(always)]
pub const fn ptr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Maximum number of bytes in transmit buffer."]
#[inline(always)]
pub const fn maxcnt(self) -> crate::common::Reg<regs::TxdMaxcnt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Number of bytes transmitted in last granted transaction."]
#[inline(always)]
pub const fn amount(self) -> crate::common::Reg<regs::TxdAmount, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "EasyDMA list type."]
#[inline(always)]
pub const fn list(self) -> crate::common::Reg<regs::TxdList, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct EventsDma {
ptr: *mut u8,
}
unsafe impl Send for EventsDma {}
unsafe impl Sync for EventsDma {}
impl EventsDma {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[inline(always)]
pub const fn rx(self) -> EventsDmaRx {
unsafe { EventsDmaRx::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct EventsDmaRx {
ptr: *mut u8,
}
unsafe impl Send for EventsDmaRx {}
unsafe impl Sync for EventsDmaRx {}
impl EventsDmaRx {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "End of RXD buffer reached."]
#[inline(always)]
pub const fn end(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Psel {
ptr: *mut u8,
}
unsafe impl Send for Psel {}
unsafe impl Sync for Psel {}
impl Psel {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Pin select for SCK."]
#[inline(always)]
pub const fn sck(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Pin select for MISO signal."]
#[inline(always)]
pub const fn miso(
self,
) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Pin select for MOSI signal."]
#[inline(always)]
pub const fn mosi(
self,
) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Pin select for CSN signal."]
#[inline(always)]
pub const fn csn(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
}
#[doc = "SPI Slave 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Spis {
ptr: *mut u8,
}
unsafe impl Send for Spis {}
unsafe impl Sync for Spis {}
impl Spis {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Acquire SPI semaphore."]
#[inline(always)]
pub const fn tasks_acquire(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x24usize) as _) }
}
#[doc = "Release SPI semaphore, enabling the SPI slave to acquire it."]
#[inline(always)]
pub const fn tasks_release(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x28usize) as _) }
}
#[doc = "Subscribe configuration for task ACQUIRE."]
#[inline(always)]
pub const fn subscribe_acquire(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xa4usize) as _) }
}
#[doc = "Subscribe configuration for task RELEASE."]
#[inline(always)]
pub const fn subscribe_release(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xa8usize) as _) }
}
#[doc = "Granted transaction completed."]
#[inline(always)]
pub const fn events_end(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0104usize) as _) }
}
#[inline(always)]
pub const fn events_dma(self) -> EventsDma {
unsafe { EventsDma::from_ptr(self.ptr.wrapping_add(0x0110usize) as _) }
}
#[doc = "Semaphore acquired."]
#[inline(always)]
pub const fn events_acquired(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0128usize) as _) }
}
#[doc = "Publish configuration for event END."]
#[inline(always)]
pub const fn publish_end(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0184usize) as _) }
}
#[doc = "Publish configuration for event ENDRX."]
#[inline(always)]
pub const fn publish_endrx(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0190usize) as _) }
}
#[doc = "Publish configuration for event ACQUIRED."]
#[inline(always)]
pub const fn publish_acquired(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01a8usize) as _) }
}
#[doc = "Shortcuts between local events and tasks."]
#[inline(always)]
pub const fn shorts(self) -> crate::common::Reg<regs::Shorts, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0200usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "Semaphore status register."]
#[inline(always)]
pub const fn semstat(self) -> crate::common::Reg<regs::Semstat, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0400usize) as _) }
}
#[doc = "Status from last transaction."]
#[inline(always)]
pub const fn status(self) -> crate::common::Reg<regs::Status, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0440usize) as _) }
}
#[doc = "Enable SPI slave."]
#[inline(always)]
pub const fn enable(self) -> crate::common::Reg<regs::Enable, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0500usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn psel(self) -> Psel {
unsafe { Psel::from_ptr(self.ptr.wrapping_add(0x0508usize) as _) }
}
#[inline(always)]
pub const fn dma(self) -> Dma {
unsafe { Dma::from_ptr(self.ptr.wrapping_add(0x0534usize) as _) }
}
#[doc = "Configuration register."]
#[inline(always)]
pub const fn config(self) -> crate::common::Reg<regs::Config, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0554usize) as _) }
}
#[doc = "Default character. Character clocked out in case of an ignored transaction."]
#[inline(always)]
pub const fn def(self) -> crate::common::Reg<regs::Def, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x055cusize) as _) }
}
#[doc = "Over-read character."]
#[inline(always)]
pub const fn orc(self) -> crate::common::Reg<regs::Orc, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x05c0usize) as _) }
}
}
pub mod regs {
#[doc = "Configuration register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Config(pub u32);
impl Config {
#[doc = "Bit order."]
#[must_use]
#[inline(always)]
pub const fn order(&self) -> super::vals::Order {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Order::from_bits(val as u8)
}
#[doc = "Bit order."]
#[inline(always)]
pub const fn set_order(&mut self, val: super::vals::Order) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "Serial clock (SCK) phase."]
#[must_use]
#[inline(always)]
pub const fn cpha(&self) -> super::vals::Cpha {
let val = (self.0 >> 1usize) & 0x01;
super::vals::Cpha::from_bits(val as u8)
}
#[doc = "Serial clock (SCK) phase."]
#[inline(always)]
pub const fn set_cpha(&mut self, val: super::vals::Cpha) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val.to_bits() as u32) & 0x01) << 1usize);
}
#[doc = "Serial clock (SCK) polarity."]
#[must_use]
#[inline(always)]
pub const fn cpol(&self) -> super::vals::Cpol {
let val = (self.0 >> 2usize) & 0x01;
super::vals::Cpol::from_bits(val as u8)
}
#[doc = "Serial clock (SCK) polarity."]
#[inline(always)]
pub const fn set_cpol(&mut self, val: super::vals::Cpol) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val.to_bits() as u32) & 0x01) << 2usize);
}
}
impl Default for Config {
#[inline(always)]
fn default() -> Config {
Config(0)
}
}
impl core::fmt::Debug for Config {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Config")
.field("order", &self.order())
.field("cpha", &self.cpha())
.field("cpol", &self.cpol())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Config {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Config {{ order: {:?}, cpha: {:?}, cpol: {:?} }}",
self.order(),
self.cpha(),
self.cpol()
)
}
}
#[doc = "Default character. Character clocked out in case of an ignored transaction."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Def(pub u32);
impl Def {
#[doc = "Default character. Character clocked out in case of an ignored transaction."]
#[must_use]
#[inline(always)]
pub const fn def(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Default character. Character clocked out in case of an ignored transaction."]
#[inline(always)]
pub const fn set_def(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for Def {
#[inline(always)]
fn default() -> Def {
Def(0)
}
}
impl core::fmt::Debug for Def {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Def").field("def", &self.def()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Def {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Def {{ def: {=u8:?} }}", self.def())
}
}
#[doc = "Enable SPI slave."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Enable(pub u32);
impl Enable {
#[doc = "Enable or disable SPI slave."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> super::vals::Enable {
let val = (self.0 >> 0usize) & 0x0f;
super::vals::Enable::from_bits(val as u8)
}
#[doc = "Enable or disable SPI slave."]
#[inline(always)]
pub const fn set_enable(&mut self, val: super::vals::Enable) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val.to_bits() as u32) & 0x0f) << 0usize);
}
}
impl Default for Enable {
#[inline(always)]
fn default() -> Enable {
Enable(0)
}
}
impl core::fmt::Debug for Enable {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Enable")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Enable {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Enable {{ enable: {:?} }}", self.enable())
}
}
#[doc = "Disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Write '1' to disable interrupt for event END."]
#[must_use]
#[inline(always)]
pub const fn end(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event END."]
#[inline(always)]
pub const fn set_end(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Write '1' to disable interrupt for event ENDRX."]
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event ENDRX."]
#[inline(always)]
pub const fn set_endrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Write '1' to disable interrupt for event ACQUIRED."]
#[must_use]
#[inline(always)]
pub const fn acquired(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event ACQUIRED."]
#[inline(always)]
pub const fn set_acquired(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("end", &self.end())
.field("endrx", &self.endrx())
.field("acquired", &self.acquired())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Int {{ end: {=bool:?}, endrx: {=bool:?}, acquired: {=bool:?} }}",
self.end(),
self.endrx(),
self.acquired()
)
}
}
#[doc = "Over-read character."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Orc(pub u32);
impl Orc {
#[doc = "Over-read character. Character clocked out after an over-read of the transmit buffer."]
#[must_use]
#[inline(always)]
pub const fn orc(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Over-read character. Character clocked out after an over-read of the transmit buffer."]
#[inline(always)]
pub const fn set_orc(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for Orc {
#[inline(always)]
fn default() -> Orc {
Orc(0)
}
}
impl core::fmt::Debug for Orc {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Orc").field("orc", &self.orc()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Orc {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Orc {{ orc: {=u8:?} }}", self.orc())
}
}
#[doc = "Number of bytes received in last granted transaction."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RxdAmount(pub u32);
impl RxdAmount {
#[doc = "Number of bytes received in the last granted transaction."]
#[must_use]
#[inline(always)]
pub const fn amount(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Number of bytes received in the last granted transaction."]
#[inline(always)]
pub const fn set_amount(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for RxdAmount {
#[inline(always)]
fn default() -> RxdAmount {
RxdAmount(0)
}
}
impl core::fmt::Debug for RxdAmount {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RxdAmount")
.field("amount", &self.amount())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RxdAmount {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "RxdAmount {{ amount: {=u16:?} }}", self.amount())
}
}
#[doc = "EasyDMA list type."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RxdList(pub u32);
impl RxdList {
#[doc = "List type."]
#[must_use]
#[inline(always)]
pub const fn list(&self) -> super::vals::RxdListList {
let val = (self.0 >> 0usize) & 0x03;
super::vals::RxdListList::from_bits(val as u8)
}
#[doc = "List type."]
#[inline(always)]
pub const fn set_list(&mut self, val: super::vals::RxdListList) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for RxdList {
#[inline(always)]
fn default() -> RxdList {
RxdList(0)
}
}
impl core::fmt::Debug for RxdList {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RxdList")
.field("list", &self.list())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RxdList {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "RxdList {{ list: {:?} }}", self.list())
}
}
#[doc = "Maximum number of bytes in receive buffer."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RxdMaxcnt(pub u32);
impl RxdMaxcnt {
#[doc = "Maximum number of bytes in receive buffer."]
#[must_use]
#[inline(always)]
pub const fn maxcnt(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Maximum number of bytes in receive buffer."]
#[inline(always)]
pub const fn set_maxcnt(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for RxdMaxcnt {
#[inline(always)]
fn default() -> RxdMaxcnt {
RxdMaxcnt(0)
}
}
impl core::fmt::Debug for RxdMaxcnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RxdMaxcnt")
.field("maxcnt", &self.maxcnt())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RxdMaxcnt {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "RxdMaxcnt {{ maxcnt: {=u16:?} }}", self.maxcnt())
}
}
#[doc = "Semaphore status register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Semstat(pub u32);
impl Semstat {
#[doc = "Semaphore status."]
#[must_use]
#[inline(always)]
pub const fn semstat(&self) -> super::vals::Semstat {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Semstat::from_bits(val as u8)
}
#[doc = "Semaphore status."]
#[inline(always)]
pub const fn set_semstat(&mut self, val: super::vals::Semstat) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for Semstat {
#[inline(always)]
fn default() -> Semstat {
Semstat(0)
}
}
impl core::fmt::Debug for Semstat {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Semstat")
.field("semstat", &self.semstat())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Semstat {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Semstat {{ semstat: {:?} }}", self.semstat())
}
}
#[doc = "Shortcuts between local events and tasks."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Shorts(pub u32);
impl Shorts {
#[doc = "Shortcut between event END and task ACQUIRE."]
#[must_use]
#[inline(always)]
pub const fn end_acquire(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event END and task ACQUIRE."]
#[inline(always)]
pub const fn set_end_acquire(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
}
impl Default for Shorts {
#[inline(always)]
fn default() -> Shorts {
Shorts(0)
}
}
impl core::fmt::Debug for Shorts {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Shorts")
.field("end_acquire", &self.end_acquire())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Shorts {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Shorts {{ end_acquire: {=bool:?} }}", self.end_acquire())
}
}
#[doc = "Status from last transaction."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Status(pub u32);
impl Status {
#[doc = "TX buffer over-read detected, and prevented."]
#[must_use]
#[inline(always)]
pub const fn overread(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "TX buffer over-read detected, and prevented."]
#[inline(always)]
pub const fn set_overread(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "RX buffer overflow detected, and prevented."]
#[must_use]
#[inline(always)]
pub const fn overflow(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "RX buffer overflow detected, and prevented."]
#[inline(always)]
pub const fn set_overflow(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
}
impl Default for Status {
#[inline(always)]
fn default() -> Status {
Status(0)
}
}
impl core::fmt::Debug for Status {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Status")
.field("overread", &self.overread())
.field("overflow", &self.overflow())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Status {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Status {{ overread: {=bool:?}, overflow: {=bool:?} }}",
self.overread(),
self.overflow()
)
}
}
#[doc = "Number of bytes transmitted in last granted transaction."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TxdAmount(pub u32);
impl TxdAmount {
#[doc = "Number of bytes transmitted in last granted transaction."]
#[must_use]
#[inline(always)]
pub const fn amount(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Number of bytes transmitted in last granted transaction."]
#[inline(always)]
pub const fn set_amount(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for TxdAmount {
#[inline(always)]
fn default() -> TxdAmount {
TxdAmount(0)
}
}
impl core::fmt::Debug for TxdAmount {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TxdAmount")
.field("amount", &self.amount())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for TxdAmount {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "TxdAmount {{ amount: {=u16:?} }}", self.amount())
}
}
#[doc = "EasyDMA list type."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TxdList(pub u32);
impl TxdList {
#[doc = "List type."]
#[must_use]
#[inline(always)]
pub const fn list(&self) -> super::vals::TxdListList {
let val = (self.0 >> 0usize) & 0x03;
super::vals::TxdListList::from_bits(val as u8)
}
#[doc = "List type."]
#[inline(always)]
pub const fn set_list(&mut self, val: super::vals::TxdListList) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for TxdList {
#[inline(always)]
fn default() -> TxdList {
TxdList(0)
}
}
impl core::fmt::Debug for TxdList {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TxdList")
.field("list", &self.list())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for TxdList {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "TxdList {{ list: {:?} }}", self.list())
}
}
#[doc = "Maximum number of bytes in transmit buffer."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TxdMaxcnt(pub u32);
impl TxdMaxcnt {
#[doc = "Maximum number of bytes in transmit buffer."]
#[must_use]
#[inline(always)]
pub const fn maxcnt(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Maximum number of bytes in transmit buffer."]
#[inline(always)]
pub const fn set_maxcnt(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for TxdMaxcnt {
#[inline(always)]
fn default() -> TxdMaxcnt {
TxdMaxcnt(0)
}
}
impl core::fmt::Debug for TxdMaxcnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TxdMaxcnt")
.field("maxcnt", &self.maxcnt())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for TxdMaxcnt {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "TxdMaxcnt {{ maxcnt: {=u16:?} }}", self.maxcnt())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Cpha {
#[doc = "Sample on leading edge of clock, shift serial data on trailing edge."]
Leading = 0x0,
#[doc = "Sample on trailing edge of clock, shift serial data on leading edge."]
Trailing = 0x01,
}
impl Cpha {
#[inline(always)]
pub const fn from_bits(val: u8) -> Cpha {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Cpha {
#[inline(always)]
fn from(val: u8) -> Cpha {
Cpha::from_bits(val)
}
}
impl From<Cpha> for u8 {
#[inline(always)]
fn from(val: Cpha) -> u8 {
Cpha::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Cpol {
#[doc = "Active high."]
ActiveHigh = 0x0,
#[doc = "Active low."]
ActiveLow = 0x01,
}
impl Cpol {
#[inline(always)]
pub const fn from_bits(val: u8) -> Cpol {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Cpol {
#[inline(always)]
fn from(val: u8) -> Cpol {
Cpol::from_bits(val)
}
}
impl From<Cpol> for u8 {
#[inline(always)]
fn from(val: Cpol) -> u8 {
Cpol::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Enable {
#[doc = "Disable SPI slave."]
Disabled = 0x0,
_RESERVED_1 = 0x01,
#[doc = "Enable SPI slave."]
Enabled = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Enable {
#[inline(always)]
pub const fn from_bits(val: u8) -> Enable {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Enable {
#[inline(always)]
fn from(val: u8) -> Enable {
Enable::from_bits(val)
}
}
impl From<Enable> for u8 {
#[inline(always)]
fn from(val: Enable) -> u8 {
Enable::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Order {
#[doc = "Most significant bit shifted out first."]
MsbFirst = 0x0,
#[doc = "Least significant bit shifted out first."]
LsbFirst = 0x01,
}
impl Order {
#[inline(always)]
pub const fn from_bits(val: u8) -> Order {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Order {
#[inline(always)]
fn from(val: u8) -> Order {
Order::from_bits(val)
}
}
impl From<Order> for u8 {
#[inline(always)]
fn from(val: Order) -> u8 {
Order::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RxdListList {
#[doc = "Disable EasyDMA list."]
Disabled = 0x0,
#[doc = "Use array list."]
ArrayList = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
}
impl RxdListList {
#[inline(always)]
pub const fn from_bits(val: u8) -> RxdListList {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for RxdListList {
#[inline(always)]
fn from(val: u8) -> RxdListList {
RxdListList::from_bits(val)
}
}
impl From<RxdListList> for u8 {
#[inline(always)]
fn from(val: RxdListList) -> u8 {
RxdListList::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Semstat {
#[doc = "Semaphore is free."]
Free = 0x0,
#[doc = "Semaphore is assigned to CPU."]
Cpu = 0x01,
#[doc = "Semaphore is assigned to SPI slave."]
Spis = 0x02,
#[doc = "Semaphore is assigned to SPI but a handover to the CPU is pending."]
CpuPending = 0x03,
}
impl Semstat {
#[inline(always)]
pub const fn from_bits(val: u8) -> Semstat {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Semstat {
#[inline(always)]
fn from(val: u8) -> Semstat {
Semstat::from_bits(val)
}
}
impl From<Semstat> for u8 {
#[inline(always)]
fn from(val: Semstat) -> u8 {
Semstat::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum TxdListList {
#[doc = "Disable EasyDMA list."]
Disabled = 0x0,
#[doc = "Use array list."]
ArrayList = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
}
impl TxdListList {
#[inline(always)]
pub const fn from_bits(val: u8) -> TxdListList {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for TxdListList {
#[inline(always)]
fn from(val: u8) -> TxdListList {
TxdListList::from_bits(val)
}
}
impl From<TxdListList> for u8 {
#[inline(always)]
fn from(val: TxdListList) -> u8 {
TxdListList::to_bits(val)
}
}
}
}
pub mod spu {
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Dppi {
ptr: *mut u8,
}
unsafe impl Send for Dppi {}
unsafe impl Sync for Dppi {}
impl Dppi {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: Select between secure and non-secure attribute for the DPPI channels."]
#[inline(always)]
pub const fn perm(self) -> crate::common::Reg<regs::DppiPerm, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Description cluster: Prevent further modification of the corresponding PERM register."]
#[inline(always)]
pub const fn lock(self) -> crate::common::Reg<regs::DppiLock, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Extdomain {
ptr: *mut u8,
}
unsafe impl Send for Extdomain {}
unsafe impl Sync for Extdomain {}
impl Extdomain {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: Access for bus access generated from the external domain n List capabilities of the external domain n."]
#[inline(always)]
pub const fn perm(self) -> crate::common::Reg<regs::ExtdomainPerm, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Flashnsc {
ptr: *mut u8,
}
unsafe impl Send for Flashnsc {}
unsafe impl Sync for Flashnsc {}
impl Flashnsc {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: Define which flash region can contain the non-secure callable (NSC) region n."]
#[inline(always)]
pub const fn region(self) -> crate::common::Reg<regs::FlashnscRegion, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Description cluster: Define the size of the non-secure callable (NSC) region n."]
#[inline(always)]
pub const fn size(self) -> crate::common::Reg<regs::FlashnscSize, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Flashregion {
ptr: *mut u8,
}
unsafe impl Send for Flashregion {}
unsafe impl Sync for Flashregion {}
impl Flashregion {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: Access permissions for flash region n."]
#[inline(always)]
pub const fn perm(self) -> crate::common::Reg<regs::FlashregionPerm, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Gpioport {
ptr: *mut u8,
}
unsafe impl Send for Gpioport {}
unsafe impl Sync for Gpioport {}
impl Gpioport {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: Select between secure and non-secure attribute for pins 0 to 31 of port n."]
#[inline(always)]
pub const fn perm(self) -> crate::common::Reg<regs::GpioportPerm, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Description cluster: Prevent further modification of the corresponding PERM register."]
#[inline(always)]
pub const fn lock(self) -> crate::common::Reg<regs::GpioportLock, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Periphid {
ptr: *mut u8,
}
unsafe impl Send for Periphid {}
unsafe impl Sync for Periphid {}
impl Periphid {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: List capabilities and access permissions for the peripheral with ID n."]
#[inline(always)]
pub const fn perm(self) -> crate::common::Reg<regs::PeriphidPerm, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ramnsc {
ptr: *mut u8,
}
unsafe impl Send for Ramnsc {}
unsafe impl Sync for Ramnsc {}
impl Ramnsc {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: Define which RAM region can contain the non-secure callable (NSC) region n."]
#[inline(always)]
pub const fn region(self) -> crate::common::Reg<regs::RamnscRegion, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Description cluster: Define the size of the non-secure callable (NSC) region n."]
#[inline(always)]
pub const fn size(self) -> crate::common::Reg<regs::RamnscSize, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ramregion {
ptr: *mut u8,
}
unsafe impl Send for Ramregion {}
unsafe impl Sync for Ramregion {}
impl Ramregion {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: Access permissions for RAM region n."]
#[inline(always)]
pub const fn perm(self) -> crate::common::Reg<regs::RamregionPerm, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
}
#[doc = "System protection unit."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Spu {
ptr: *mut u8,
}
unsafe impl Send for Spu {}
unsafe impl Sync for Spu {}
impl Spu {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "A security violation has been detected for the RAM memory space."]
#[inline(always)]
pub const fn events_ramaccerr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0100usize) as _) }
}
#[doc = "A security violation has been detected for the flash memory space."]
#[inline(always)]
pub const fn events_flashaccerr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0104usize) as _) }
}
#[doc = "A security violation has been detected on one or several peripherals."]
#[inline(always)]
pub const fn events_periphaccerr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0108usize) as _) }
}
#[doc = "Publish configuration for event RAMACCERR."]
#[inline(always)]
pub const fn publish_ramaccerr(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0180usize) as _) }
}
#[doc = "Publish configuration for event FLASHACCERR."]
#[inline(always)]
pub const fn publish_flashaccerr(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0184usize) as _) }
}
#[doc = "Publish configuration for event PERIPHACCERR."]
#[inline(always)]
pub const fn publish_periphaccerr(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0188usize) as _) }
}
#[doc = "Enable or disable interrupt."]
#[inline(always)]
pub const fn inten(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0300usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "Show implemented features for the current device."]
#[inline(always)]
pub const fn cap(self) -> crate::common::Reg<regs::Cap, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0400usize) as _) }
}
#[doc = "Configure bits to lock down CPU features at runtime."]
#[inline(always)]
pub const fn cpulock(self) -> crate::common::Reg<regs::Cpulock, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0404usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn extdomain(self, n: usize) -> Extdomain {
assert!(n < 1usize);
unsafe { Extdomain::from_ptr(self.ptr.wrapping_add(0x0440usize + n * 4usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn dppi(self, n: usize) -> Dppi {
assert!(n < 1usize);
unsafe { Dppi::from_ptr(self.ptr.wrapping_add(0x0480usize + n * 8usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn gpioport(self, n: usize) -> Gpioport {
assert!(n < 2usize);
unsafe { Gpioport::from_ptr(self.ptr.wrapping_add(0x04c0usize + n * 8usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn flashnsc(self, n: usize) -> Flashnsc {
assert!(n < 2usize);
unsafe { Flashnsc::from_ptr(self.ptr.wrapping_add(0x0500usize + n * 8usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn ramnsc(self, n: usize) -> Ramnsc {
assert!(n < 2usize);
unsafe { Ramnsc::from_ptr(self.ptr.wrapping_add(0x0540usize + n * 8usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn flashregion(self, n: usize) -> Flashregion {
assert!(n < 64usize);
unsafe { Flashregion::from_ptr(self.ptr.wrapping_add(0x0600usize + n * 4usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn ramregion(self, n: usize) -> Ramregion {
assert!(n < 64usize);
unsafe { Ramregion::from_ptr(self.ptr.wrapping_add(0x0700usize + n * 4usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn periphid(self, n: usize) -> Periphid {
assert!(n < 256usize);
unsafe { Periphid::from_ptr(self.ptr.wrapping_add(0x0800usize + n * 4usize) as _) }
}
}
pub mod regs {
#[doc = "Show implemented features for the current device."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cap(pub u32);
impl Cap {
#[doc = "Show Arm TrustZone status."]
#[must_use]
#[inline(always)]
pub const fn tzm(&self) -> super::vals::Tzm {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Tzm::from_bits(val as u8)
}
#[doc = "Show Arm TrustZone status."]
#[inline(always)]
pub const fn set_tzm(&mut self, val: super::vals::Tzm) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Cap {
#[inline(always)]
fn default() -> Cap {
Cap(0)
}
}
impl core::fmt::Debug for Cap {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cap").field("tzm", &self.tzm()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cap {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Cap {{ tzm: {:?} }}", self.tzm())
}
}
#[doc = "Configure bits to lock down CPU features at runtime."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cpulock(pub u32);
impl Cpulock {
#[doc = "Write '1' to prevent updating the secure interrupt configuration until the next reset."]
#[must_use]
#[inline(always)]
pub const fn locksvtaircr(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Write '1' to prevent updating the secure interrupt configuration until the next reset."]
#[inline(always)]
pub const fn set_locksvtaircr(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Write '1' to prevent updating the non-secure vector table base address until the next reset."]
#[must_use]
#[inline(always)]
pub const fn locknsvtor(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Write '1' to prevent updating the non-secure vector table base address until the next reset."]
#[inline(always)]
pub const fn set_locknsvtor(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Write '1' to prevent updating the secure MPU regions until the next reset."]
#[must_use]
#[inline(always)]
pub const fn locksmpu(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Write '1' to prevent updating the secure MPU regions until the next reset."]
#[inline(always)]
pub const fn set_locksmpu(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Write '1' to prevent updating the Non-secure MPU regions until the next reset."]
#[must_use]
#[inline(always)]
pub const fn locknsmpu(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Write '1' to prevent updating the Non-secure MPU regions until the next reset."]
#[inline(always)]
pub const fn set_locknsmpu(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Write '1' to prevent updating the secure SAU regions until the next reset."]
#[must_use]
#[inline(always)]
pub const fn locksau(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Write '1' to prevent updating the secure SAU regions until the next reset."]
#[inline(always)]
pub const fn set_locksau(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
}
impl Default for Cpulock {
#[inline(always)]
fn default() -> Cpulock {
Cpulock(0)
}
}
impl core::fmt::Debug for Cpulock {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cpulock")
.field("locksvtaircr", &self.locksvtaircr())
.field("locknsvtor", &self.locknsvtor())
.field("locksmpu", &self.locksmpu())
.field("locknsmpu", &self.locknsmpu())
.field("locksau", &self.locksau())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cpulock {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Cpulock {{ locksvtaircr: {=bool:?}, locknsvtor: {=bool:?}, locksmpu: {=bool:?}, locknsmpu: {=bool:?}, locksau: {=bool:?} }}" , self . locksvtaircr () , self . locknsvtor () , self . locksmpu () , self . locknsmpu () , self . locksau ())
}
}
#[doc = "Description cluster: Prevent further modification of the corresponding PERM register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DppiLock(pub u32);
impl DppiLock {
#[must_use]
#[inline(always)]
pub const fn lock(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_lock(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for DppiLock {
#[inline(always)]
fn default() -> DppiLock {
DppiLock(0)
}
}
impl core::fmt::Debug for DppiLock {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DppiLock")
.field("lock", &self.lock())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for DppiLock {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "DppiLock {{ lock: {=bool:?} }}", self.lock())
}
}
#[doc = "Description cluster: Select between secure and non-secure attribute for the DPPI channels."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DppiPerm(pub u32);
impl DppiPerm {
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel0(&self) -> super::vals::Channel0 {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Channel0::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel0(&mut self, val: super::vals::Channel0) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel1(&self) -> super::vals::Channel1 {
let val = (self.0 >> 1usize) & 0x01;
super::vals::Channel1::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel1(&mut self, val: super::vals::Channel1) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val.to_bits() as u32) & 0x01) << 1usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel2(&self) -> super::vals::Channel2 {
let val = (self.0 >> 2usize) & 0x01;
super::vals::Channel2::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel2(&mut self, val: super::vals::Channel2) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val.to_bits() as u32) & 0x01) << 2usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel3(&self) -> super::vals::Channel3 {
let val = (self.0 >> 3usize) & 0x01;
super::vals::Channel3::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel3(&mut self, val: super::vals::Channel3) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val.to_bits() as u32) & 0x01) << 3usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel4(&self) -> super::vals::Channel4 {
let val = (self.0 >> 4usize) & 0x01;
super::vals::Channel4::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel4(&mut self, val: super::vals::Channel4) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val.to_bits() as u32) & 0x01) << 4usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel5(&self) -> super::vals::Channel5 {
let val = (self.0 >> 5usize) & 0x01;
super::vals::Channel5::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel5(&mut self, val: super::vals::Channel5) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val.to_bits() as u32) & 0x01) << 5usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel6(&self) -> super::vals::Channel6 {
let val = (self.0 >> 6usize) & 0x01;
super::vals::Channel6::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel6(&mut self, val: super::vals::Channel6) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val.to_bits() as u32) & 0x01) << 6usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel7(&self) -> super::vals::Channel7 {
let val = (self.0 >> 7usize) & 0x01;
super::vals::Channel7::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel7(&mut self, val: super::vals::Channel7) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val.to_bits() as u32) & 0x01) << 7usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel8(&self) -> super::vals::Channel8 {
let val = (self.0 >> 8usize) & 0x01;
super::vals::Channel8::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel8(&mut self, val: super::vals::Channel8) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val.to_bits() as u32) & 0x01) << 8usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel9(&self) -> super::vals::Channel9 {
let val = (self.0 >> 9usize) & 0x01;
super::vals::Channel9::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel9(&mut self, val: super::vals::Channel9) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val.to_bits() as u32) & 0x01) << 9usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel10(&self) -> super::vals::Channel10 {
let val = (self.0 >> 10usize) & 0x01;
super::vals::Channel10::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel10(&mut self, val: super::vals::Channel10) {
self.0 =
(self.0 & !(0x01 << 10usize)) | (((val.to_bits() as u32) & 0x01) << 10usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel11(&self) -> super::vals::Channel11 {
let val = (self.0 >> 11usize) & 0x01;
super::vals::Channel11::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel11(&mut self, val: super::vals::Channel11) {
self.0 =
(self.0 & !(0x01 << 11usize)) | (((val.to_bits() as u32) & 0x01) << 11usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel12(&self) -> super::vals::Channel12 {
let val = (self.0 >> 12usize) & 0x01;
super::vals::Channel12::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel12(&mut self, val: super::vals::Channel12) {
self.0 =
(self.0 & !(0x01 << 12usize)) | (((val.to_bits() as u32) & 0x01) << 12usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel13(&self) -> super::vals::Channel13 {
let val = (self.0 >> 13usize) & 0x01;
super::vals::Channel13::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel13(&mut self, val: super::vals::Channel13) {
self.0 =
(self.0 & !(0x01 << 13usize)) | (((val.to_bits() as u32) & 0x01) << 13usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel14(&self) -> super::vals::Channel14 {
let val = (self.0 >> 14usize) & 0x01;
super::vals::Channel14::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel14(&mut self, val: super::vals::Channel14) {
self.0 =
(self.0 & !(0x01 << 14usize)) | (((val.to_bits() as u32) & 0x01) << 14usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel15(&self) -> super::vals::Channel15 {
let val = (self.0 >> 15usize) & 0x01;
super::vals::Channel15::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel15(&mut self, val: super::vals::Channel15) {
self.0 =
(self.0 & !(0x01 << 15usize)) | (((val.to_bits() as u32) & 0x01) << 15usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel16(&self) -> super::vals::Channel16 {
let val = (self.0 >> 16usize) & 0x01;
super::vals::Channel16::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel16(&mut self, val: super::vals::Channel16) {
self.0 =
(self.0 & !(0x01 << 16usize)) | (((val.to_bits() as u32) & 0x01) << 16usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel17(&self) -> super::vals::Channel17 {
let val = (self.0 >> 17usize) & 0x01;
super::vals::Channel17::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel17(&mut self, val: super::vals::Channel17) {
self.0 =
(self.0 & !(0x01 << 17usize)) | (((val.to_bits() as u32) & 0x01) << 17usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel18(&self) -> super::vals::Channel18 {
let val = (self.0 >> 18usize) & 0x01;
super::vals::Channel18::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel18(&mut self, val: super::vals::Channel18) {
self.0 =
(self.0 & !(0x01 << 18usize)) | (((val.to_bits() as u32) & 0x01) << 18usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel19(&self) -> super::vals::Channel19 {
let val = (self.0 >> 19usize) & 0x01;
super::vals::Channel19::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel19(&mut self, val: super::vals::Channel19) {
self.0 =
(self.0 & !(0x01 << 19usize)) | (((val.to_bits() as u32) & 0x01) << 19usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel20(&self) -> super::vals::Channel20 {
let val = (self.0 >> 20usize) & 0x01;
super::vals::Channel20::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel20(&mut self, val: super::vals::Channel20) {
self.0 =
(self.0 & !(0x01 << 20usize)) | (((val.to_bits() as u32) & 0x01) << 20usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel21(&self) -> super::vals::Channel21 {
let val = (self.0 >> 21usize) & 0x01;
super::vals::Channel21::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel21(&mut self, val: super::vals::Channel21) {
self.0 =
(self.0 & !(0x01 << 21usize)) | (((val.to_bits() as u32) & 0x01) << 21usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel22(&self) -> super::vals::Channel22 {
let val = (self.0 >> 22usize) & 0x01;
super::vals::Channel22::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel22(&mut self, val: super::vals::Channel22) {
self.0 =
(self.0 & !(0x01 << 22usize)) | (((val.to_bits() as u32) & 0x01) << 22usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel23(&self) -> super::vals::Channel23 {
let val = (self.0 >> 23usize) & 0x01;
super::vals::Channel23::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel23(&mut self, val: super::vals::Channel23) {
self.0 =
(self.0 & !(0x01 << 23usize)) | (((val.to_bits() as u32) & 0x01) << 23usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel24(&self) -> super::vals::Channel24 {
let val = (self.0 >> 24usize) & 0x01;
super::vals::Channel24::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel24(&mut self, val: super::vals::Channel24) {
self.0 =
(self.0 & !(0x01 << 24usize)) | (((val.to_bits() as u32) & 0x01) << 24usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel25(&self) -> super::vals::Channel25 {
let val = (self.0 >> 25usize) & 0x01;
super::vals::Channel25::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel25(&mut self, val: super::vals::Channel25) {
self.0 =
(self.0 & !(0x01 << 25usize)) | (((val.to_bits() as u32) & 0x01) << 25usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel26(&self) -> super::vals::Channel26 {
let val = (self.0 >> 26usize) & 0x01;
super::vals::Channel26::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel26(&mut self, val: super::vals::Channel26) {
self.0 =
(self.0 & !(0x01 << 26usize)) | (((val.to_bits() as u32) & 0x01) << 26usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel27(&self) -> super::vals::Channel27 {
let val = (self.0 >> 27usize) & 0x01;
super::vals::Channel27::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel27(&mut self, val: super::vals::Channel27) {
self.0 =
(self.0 & !(0x01 << 27usize)) | (((val.to_bits() as u32) & 0x01) << 27usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel28(&self) -> super::vals::Channel28 {
let val = (self.0 >> 28usize) & 0x01;
super::vals::Channel28::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel28(&mut self, val: super::vals::Channel28) {
self.0 =
(self.0 & !(0x01 << 28usize)) | (((val.to_bits() as u32) & 0x01) << 28usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel29(&self) -> super::vals::Channel29 {
let val = (self.0 >> 29usize) & 0x01;
super::vals::Channel29::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel29(&mut self, val: super::vals::Channel29) {
self.0 =
(self.0 & !(0x01 << 29usize)) | (((val.to_bits() as u32) & 0x01) << 29usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel30(&self) -> super::vals::Channel30 {
let val = (self.0 >> 30usize) & 0x01;
super::vals::Channel30::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel30(&mut self, val: super::vals::Channel30) {
self.0 =
(self.0 & !(0x01 << 30usize)) | (((val.to_bits() as u32) & 0x01) << 30usize);
}
#[doc = "Select secure attribute."]
#[must_use]
#[inline(always)]
pub const fn channel31(&self) -> super::vals::Channel31 {
let val = (self.0 >> 31usize) & 0x01;
super::vals::Channel31::from_bits(val as u8)
}
#[doc = "Select secure attribute."]
#[inline(always)]
pub const fn set_channel31(&mut self, val: super::vals::Channel31) {
self.0 =
(self.0 & !(0x01 << 31usize)) | (((val.to_bits() as u32) & 0x01) << 31usize);
}
}
impl Default for DppiPerm {
#[inline(always)]
fn default() -> DppiPerm {
DppiPerm(0)
}
}
impl core::fmt::Debug for DppiPerm {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DppiPerm")
.field("channel0", &self.channel0())
.field("channel1", &self.channel1())
.field("channel2", &self.channel2())
.field("channel3", &self.channel3())
.field("channel4", &self.channel4())
.field("channel5", &self.channel5())
.field("channel6", &self.channel6())
.field("channel7", &self.channel7())
.field("channel8", &self.channel8())
.field("channel9", &self.channel9())
.field("channel10", &self.channel10())
.field("channel11", &self.channel11())
.field("channel12", &self.channel12())
.field("channel13", &self.channel13())
.field("channel14", &self.channel14())
.field("channel15", &self.channel15())
.field("channel16", &self.channel16())
.field("channel17", &self.channel17())
.field("channel18", &self.channel18())
.field("channel19", &self.channel19())
.field("channel20", &self.channel20())
.field("channel21", &self.channel21())
.field("channel22", &self.channel22())
.field("channel23", &self.channel23())
.field("channel24", &self.channel24())
.field("channel25", &self.channel25())
.field("channel26", &self.channel26())
.field("channel27", &self.channel27())
.field("channel28", &self.channel28())
.field("channel29", &self.channel29())
.field("channel30", &self.channel30())
.field("channel31", &self.channel31())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for DppiPerm {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "DppiPerm {{ channel0: {:?}, channel1: {:?}, channel2: {:?}, channel3: {:?}, channel4: {:?}, channel5: {:?}, channel6: {:?}, channel7: {:?}, channel8: {:?}, channel9: {:?}, channel10: {:?}, channel11: {:?}, channel12: {:?}, channel13: {:?}, channel14: {:?}, channel15: {:?}, channel16: {:?}, channel17: {:?}, channel18: {:?}, channel19: {:?}, channel20: {:?}, channel21: {:?}, channel22: {:?}, channel23: {:?}, channel24: {:?}, channel25: {:?}, channel26: {:?}, channel27: {:?}, channel28: {:?}, channel29: {:?}, channel30: {:?}, channel31: {:?} }}" , self . channel0 () , self . channel1 () , self . channel2 () , self . channel3 () , self . channel4 () , self . channel5 () , self . channel6 () , self . channel7 () , self . channel8 () , self . channel9 () , self . channel10 () , self . channel11 () , self . channel12 () , self . channel13 () , self . channel14 () , self . channel15 () , self . channel16 () , self . channel17 () , self . channel18 () , self . channel19 () , self . channel20 () , self . channel21 () , self . channel22 () , self . channel23 () , self . channel24 () , self . channel25 () , self . channel26 () , self . channel27 () , self . channel28 () , self . channel29 () , self . channel30 () , self . channel31 ())
}
}
#[doc = "Description cluster: Access for bus access generated from the external domain n List capabilities of the external domain n."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct ExtdomainPerm(pub u32);
impl ExtdomainPerm {
#[doc = "Define configuration capabilities for TrustZone Cortex-M secure attribute."]
#[must_use]
#[inline(always)]
pub const fn securemapping(&self) -> super::vals::ExtdomainPermSecuremapping {
let val = (self.0 >> 0usize) & 0x03;
super::vals::ExtdomainPermSecuremapping::from_bits(val as u8)
}
#[doc = "Define configuration capabilities for TrustZone Cortex-M secure attribute."]
#[inline(always)]
pub const fn set_securemapping(
&mut self,
val: super::vals::ExtdomainPermSecuremapping,
) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
#[doc = "Peripheral security mapping."]
#[must_use]
#[inline(always)]
pub const fn secattr(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Peripheral security mapping."]
#[inline(always)]
pub const fn set_secattr(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[must_use]
#[inline(always)]
pub const fn lock(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_lock(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
}
impl Default for ExtdomainPerm {
#[inline(always)]
fn default() -> ExtdomainPerm {
ExtdomainPerm(0)
}
}
impl core::fmt::Debug for ExtdomainPerm {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("ExtdomainPerm")
.field("securemapping", &self.securemapping())
.field("secattr", &self.secattr())
.field("lock", &self.lock())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for ExtdomainPerm {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"ExtdomainPerm {{ securemapping: {:?}, secattr: {=bool:?}, lock: {=bool:?} }}",
self.securemapping(),
self.secattr(),
self.lock()
)
}
}
#[doc = "Description cluster: Define which flash region can contain the non-secure callable (NSC) region n."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct FlashnscRegion(pub u32);
impl FlashnscRegion {
#[doc = "Region number."]
#[must_use]
#[inline(always)]
pub const fn region(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x3f;
val as u8
}
#[doc = "Region number."]
#[inline(always)]
pub const fn set_region(&mut self, val: u8) {
self.0 = (self.0 & !(0x3f << 0usize)) | (((val as u32) & 0x3f) << 0usize);
}
#[must_use]
#[inline(always)]
pub const fn lock(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_lock(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
}
impl Default for FlashnscRegion {
#[inline(always)]
fn default() -> FlashnscRegion {
FlashnscRegion(0)
}
}
impl core::fmt::Debug for FlashnscRegion {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("FlashnscRegion")
.field("region", &self.region())
.field("lock", &self.lock())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for FlashnscRegion {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"FlashnscRegion {{ region: {=u8:?}, lock: {=bool:?} }}",
self.region(),
self.lock()
)
}
}
#[doc = "Description cluster: Define the size of the non-secure callable (NSC) region n."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct FlashnscSize(pub u32);
impl FlashnscSize {
#[doc = "Size of the non-secure callable (NSC) region n."]
#[must_use]
#[inline(always)]
pub const fn size(&self) -> super::vals::FlashnscSizeSize {
let val = (self.0 >> 0usize) & 0x0f;
super::vals::FlashnscSizeSize::from_bits(val as u8)
}
#[doc = "Size of the non-secure callable (NSC) region n."]
#[inline(always)]
pub const fn set_size(&mut self, val: super::vals::FlashnscSizeSize) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val.to_bits() as u32) & 0x0f) << 0usize);
}
#[must_use]
#[inline(always)]
pub const fn lock(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_lock(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
}
impl Default for FlashnscSize {
#[inline(always)]
fn default() -> FlashnscSize {
FlashnscSize(0)
}
}
impl core::fmt::Debug for FlashnscSize {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("FlashnscSize")
.field("size", &self.size())
.field("lock", &self.lock())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for FlashnscSize {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"FlashnscSize {{ size: {:?}, lock: {=bool:?} }}",
self.size(),
self.lock()
)
}
}
#[doc = "Description cluster: Access permissions for flash region n."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct FlashregionPerm(pub u32);
impl FlashregionPerm {
#[doc = "Configure instruction fetch permissions from flash region n."]
#[must_use]
#[inline(always)]
pub const fn execute(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Configure instruction fetch permissions from flash region n."]
#[inline(always)]
pub const fn set_execute(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Configure write permission for flash region n."]
#[must_use]
#[inline(always)]
pub const fn write(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Configure write permission for flash region n."]
#[inline(always)]
pub const fn set_write(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Configure read permissions for flash region n."]
#[must_use]
#[inline(always)]
pub const fn read(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Configure read permissions for flash region n."]
#[inline(always)]
pub const fn set_read(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Security attribute for flash region n."]
#[must_use]
#[inline(always)]
pub const fn secattr(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Security attribute for flash region n."]
#[inline(always)]
pub const fn set_secattr(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[must_use]
#[inline(always)]
pub const fn lock(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_lock(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
}
impl Default for FlashregionPerm {
#[inline(always)]
fn default() -> FlashregionPerm {
FlashregionPerm(0)
}
}
impl core::fmt::Debug for FlashregionPerm {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("FlashregionPerm")
.field("execute", &self.execute())
.field("write", &self.write())
.field("read", &self.read())
.field("secattr", &self.secattr())
.field("lock", &self.lock())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for FlashregionPerm {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "FlashregionPerm {{ execute: {=bool:?}, write: {=bool:?}, read: {=bool:?}, secattr: {=bool:?}, lock: {=bool:?} }}" , self . execute () , self . write () , self . read () , self . secattr () , self . lock ())
}
}
#[doc = "Description cluster: Prevent further modification of the corresponding PERM register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct GpioportLock(pub u32);
impl GpioportLock {
#[must_use]
#[inline(always)]
pub const fn lock(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_lock(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for GpioportLock {
#[inline(always)]
fn default() -> GpioportLock {
GpioportLock(0)
}
}
impl core::fmt::Debug for GpioportLock {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("GpioportLock")
.field("lock", &self.lock())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for GpioportLock {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "GpioportLock {{ lock: {=bool:?} }}", self.lock())
}
}
#[doc = "Description cluster: Select between secure and non-secure attribute for pins 0 to 31 of port n."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct GpioportPerm(pub u32);
impl GpioportPerm {
#[doc = "Select secure attribute attribute for PIN 0."]
#[must_use]
#[inline(always)]
pub const fn pin0(&self) -> super::vals::Pin0 {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Pin0::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 0."]
#[inline(always)]
pub const fn set_pin0(&mut self, val: super::vals::Pin0) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "Select secure attribute attribute for PIN 1."]
#[must_use]
#[inline(always)]
pub const fn pin1(&self) -> super::vals::Pin1 {
let val = (self.0 >> 1usize) & 0x01;
super::vals::Pin1::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 1."]
#[inline(always)]
pub const fn set_pin1(&mut self, val: super::vals::Pin1) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val.to_bits() as u32) & 0x01) << 1usize);
}
#[doc = "Select secure attribute attribute for PIN 2."]
#[must_use]
#[inline(always)]
pub const fn pin2(&self) -> super::vals::Pin2 {
let val = (self.0 >> 2usize) & 0x01;
super::vals::Pin2::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 2."]
#[inline(always)]
pub const fn set_pin2(&mut self, val: super::vals::Pin2) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val.to_bits() as u32) & 0x01) << 2usize);
}
#[doc = "Select secure attribute attribute for PIN 3."]
#[must_use]
#[inline(always)]
pub const fn pin3(&self) -> super::vals::Pin3 {
let val = (self.0 >> 3usize) & 0x01;
super::vals::Pin3::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 3."]
#[inline(always)]
pub const fn set_pin3(&mut self, val: super::vals::Pin3) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val.to_bits() as u32) & 0x01) << 3usize);
}
#[doc = "Select secure attribute attribute for PIN 4."]
#[must_use]
#[inline(always)]
pub const fn pin4(&self) -> super::vals::Pin4 {
let val = (self.0 >> 4usize) & 0x01;
super::vals::Pin4::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 4."]
#[inline(always)]
pub const fn set_pin4(&mut self, val: super::vals::Pin4) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val.to_bits() as u32) & 0x01) << 4usize);
}
#[doc = "Select secure attribute attribute for PIN 5."]
#[must_use]
#[inline(always)]
pub const fn pin5(&self) -> super::vals::Pin5 {
let val = (self.0 >> 5usize) & 0x01;
super::vals::Pin5::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 5."]
#[inline(always)]
pub const fn set_pin5(&mut self, val: super::vals::Pin5) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val.to_bits() as u32) & 0x01) << 5usize);
}
#[doc = "Select secure attribute attribute for PIN 6."]
#[must_use]
#[inline(always)]
pub const fn pin6(&self) -> super::vals::Pin6 {
let val = (self.0 >> 6usize) & 0x01;
super::vals::Pin6::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 6."]
#[inline(always)]
pub const fn set_pin6(&mut self, val: super::vals::Pin6) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val.to_bits() as u32) & 0x01) << 6usize);
}
#[doc = "Select secure attribute attribute for PIN 7."]
#[must_use]
#[inline(always)]
pub const fn pin7(&self) -> super::vals::Pin7 {
let val = (self.0 >> 7usize) & 0x01;
super::vals::Pin7::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 7."]
#[inline(always)]
pub const fn set_pin7(&mut self, val: super::vals::Pin7) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val.to_bits() as u32) & 0x01) << 7usize);
}
#[doc = "Select secure attribute attribute for PIN 8."]
#[must_use]
#[inline(always)]
pub const fn pin8(&self) -> super::vals::Pin8 {
let val = (self.0 >> 8usize) & 0x01;
super::vals::Pin8::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 8."]
#[inline(always)]
pub const fn set_pin8(&mut self, val: super::vals::Pin8) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val.to_bits() as u32) & 0x01) << 8usize);
}
#[doc = "Select secure attribute attribute for PIN 9."]
#[must_use]
#[inline(always)]
pub const fn pin9(&self) -> super::vals::Pin9 {
let val = (self.0 >> 9usize) & 0x01;
super::vals::Pin9::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 9."]
#[inline(always)]
pub const fn set_pin9(&mut self, val: super::vals::Pin9) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val.to_bits() as u32) & 0x01) << 9usize);
}
#[doc = "Select secure attribute attribute for PIN 10."]
#[must_use]
#[inline(always)]
pub const fn pin10(&self) -> super::vals::Pin10 {
let val = (self.0 >> 10usize) & 0x01;
super::vals::Pin10::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 10."]
#[inline(always)]
pub const fn set_pin10(&mut self, val: super::vals::Pin10) {
self.0 =
(self.0 & !(0x01 << 10usize)) | (((val.to_bits() as u32) & 0x01) << 10usize);
}
#[doc = "Select secure attribute attribute for PIN 11."]
#[must_use]
#[inline(always)]
pub const fn pin11(&self) -> super::vals::Pin11 {
let val = (self.0 >> 11usize) & 0x01;
super::vals::Pin11::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 11."]
#[inline(always)]
pub const fn set_pin11(&mut self, val: super::vals::Pin11) {
self.0 =
(self.0 & !(0x01 << 11usize)) | (((val.to_bits() as u32) & 0x01) << 11usize);
}
#[doc = "Select secure attribute attribute for PIN 12."]
#[must_use]
#[inline(always)]
pub const fn pin12(&self) -> super::vals::Pin12 {
let val = (self.0 >> 12usize) & 0x01;
super::vals::Pin12::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 12."]
#[inline(always)]
pub const fn set_pin12(&mut self, val: super::vals::Pin12) {
self.0 =
(self.0 & !(0x01 << 12usize)) | (((val.to_bits() as u32) & 0x01) << 12usize);
}
#[doc = "Select secure attribute attribute for PIN 13."]
#[must_use]
#[inline(always)]
pub const fn pin13(&self) -> super::vals::Pin13 {
let val = (self.0 >> 13usize) & 0x01;
super::vals::Pin13::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 13."]
#[inline(always)]
pub const fn set_pin13(&mut self, val: super::vals::Pin13) {
self.0 =
(self.0 & !(0x01 << 13usize)) | (((val.to_bits() as u32) & 0x01) << 13usize);
}
#[doc = "Select secure attribute attribute for PIN 14."]
#[must_use]
#[inline(always)]
pub const fn pin14(&self) -> super::vals::Pin14 {
let val = (self.0 >> 14usize) & 0x01;
super::vals::Pin14::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 14."]
#[inline(always)]
pub const fn set_pin14(&mut self, val: super::vals::Pin14) {
self.0 =
(self.0 & !(0x01 << 14usize)) | (((val.to_bits() as u32) & 0x01) << 14usize);
}
#[doc = "Select secure attribute attribute for PIN 15."]
#[must_use]
#[inline(always)]
pub const fn pin15(&self) -> super::vals::Pin15 {
let val = (self.0 >> 15usize) & 0x01;
super::vals::Pin15::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 15."]
#[inline(always)]
pub const fn set_pin15(&mut self, val: super::vals::Pin15) {
self.0 =
(self.0 & !(0x01 << 15usize)) | (((val.to_bits() as u32) & 0x01) << 15usize);
}
#[doc = "Select secure attribute attribute for PIN 16."]
#[must_use]
#[inline(always)]
pub const fn pin16(&self) -> super::vals::Pin16 {
let val = (self.0 >> 16usize) & 0x01;
super::vals::Pin16::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 16."]
#[inline(always)]
pub const fn set_pin16(&mut self, val: super::vals::Pin16) {
self.0 =
(self.0 & !(0x01 << 16usize)) | (((val.to_bits() as u32) & 0x01) << 16usize);
}
#[doc = "Select secure attribute attribute for PIN 17."]
#[must_use]
#[inline(always)]
pub const fn pin17(&self) -> super::vals::Pin17 {
let val = (self.0 >> 17usize) & 0x01;
super::vals::Pin17::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 17."]
#[inline(always)]
pub const fn set_pin17(&mut self, val: super::vals::Pin17) {
self.0 =
(self.0 & !(0x01 << 17usize)) | (((val.to_bits() as u32) & 0x01) << 17usize);
}
#[doc = "Select secure attribute attribute for PIN 18."]
#[must_use]
#[inline(always)]
pub const fn pin18(&self) -> super::vals::Pin18 {
let val = (self.0 >> 18usize) & 0x01;
super::vals::Pin18::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 18."]
#[inline(always)]
pub const fn set_pin18(&mut self, val: super::vals::Pin18) {
self.0 =
(self.0 & !(0x01 << 18usize)) | (((val.to_bits() as u32) & 0x01) << 18usize);
}
#[doc = "Select secure attribute attribute for PIN 19."]
#[must_use]
#[inline(always)]
pub const fn pin19(&self) -> super::vals::Pin19 {
let val = (self.0 >> 19usize) & 0x01;
super::vals::Pin19::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 19."]
#[inline(always)]
pub const fn set_pin19(&mut self, val: super::vals::Pin19) {
self.0 =
(self.0 & !(0x01 << 19usize)) | (((val.to_bits() as u32) & 0x01) << 19usize);
}
#[doc = "Select secure attribute attribute for PIN 20."]
#[must_use]
#[inline(always)]
pub const fn pin20(&self) -> super::vals::Pin20 {
let val = (self.0 >> 20usize) & 0x01;
super::vals::Pin20::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 20."]
#[inline(always)]
pub const fn set_pin20(&mut self, val: super::vals::Pin20) {
self.0 =
(self.0 & !(0x01 << 20usize)) | (((val.to_bits() as u32) & 0x01) << 20usize);
}
#[doc = "Select secure attribute attribute for PIN 21."]
#[must_use]
#[inline(always)]
pub const fn pin21(&self) -> super::vals::Pin21 {
let val = (self.0 >> 21usize) & 0x01;
super::vals::Pin21::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 21."]
#[inline(always)]
pub const fn set_pin21(&mut self, val: super::vals::Pin21) {
self.0 =
(self.0 & !(0x01 << 21usize)) | (((val.to_bits() as u32) & 0x01) << 21usize);
}
#[doc = "Select secure attribute attribute for PIN 22."]
#[must_use]
#[inline(always)]
pub const fn pin22(&self) -> super::vals::Pin22 {
let val = (self.0 >> 22usize) & 0x01;
super::vals::Pin22::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 22."]
#[inline(always)]
pub const fn set_pin22(&mut self, val: super::vals::Pin22) {
self.0 =
(self.0 & !(0x01 << 22usize)) | (((val.to_bits() as u32) & 0x01) << 22usize);
}
#[doc = "Select secure attribute attribute for PIN 23."]
#[must_use]
#[inline(always)]
pub const fn pin23(&self) -> super::vals::Pin23 {
let val = (self.0 >> 23usize) & 0x01;
super::vals::Pin23::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 23."]
#[inline(always)]
pub const fn set_pin23(&mut self, val: super::vals::Pin23) {
self.0 =
(self.0 & !(0x01 << 23usize)) | (((val.to_bits() as u32) & 0x01) << 23usize);
}
#[doc = "Select secure attribute attribute for PIN 24."]
#[must_use]
#[inline(always)]
pub const fn pin24(&self) -> super::vals::Pin24 {
let val = (self.0 >> 24usize) & 0x01;
super::vals::Pin24::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 24."]
#[inline(always)]
pub const fn set_pin24(&mut self, val: super::vals::Pin24) {
self.0 =
(self.0 & !(0x01 << 24usize)) | (((val.to_bits() as u32) & 0x01) << 24usize);
}
#[doc = "Select secure attribute attribute for PIN 25."]
#[must_use]
#[inline(always)]
pub const fn pin25(&self) -> super::vals::Pin25 {
let val = (self.0 >> 25usize) & 0x01;
super::vals::Pin25::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 25."]
#[inline(always)]
pub const fn set_pin25(&mut self, val: super::vals::Pin25) {
self.0 =
(self.0 & !(0x01 << 25usize)) | (((val.to_bits() as u32) & 0x01) << 25usize);
}
#[doc = "Select secure attribute attribute for PIN 26."]
#[must_use]
#[inline(always)]
pub const fn pin26(&self) -> super::vals::Pin26 {
let val = (self.0 >> 26usize) & 0x01;
super::vals::Pin26::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 26."]
#[inline(always)]
pub const fn set_pin26(&mut self, val: super::vals::Pin26) {
self.0 =
(self.0 & !(0x01 << 26usize)) | (((val.to_bits() as u32) & 0x01) << 26usize);
}
#[doc = "Select secure attribute attribute for PIN 27."]
#[must_use]
#[inline(always)]
pub const fn pin27(&self) -> super::vals::Pin27 {
let val = (self.0 >> 27usize) & 0x01;
super::vals::Pin27::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 27."]
#[inline(always)]
pub const fn set_pin27(&mut self, val: super::vals::Pin27) {
self.0 =
(self.0 & !(0x01 << 27usize)) | (((val.to_bits() as u32) & 0x01) << 27usize);
}
#[doc = "Select secure attribute attribute for PIN 28."]
#[must_use]
#[inline(always)]
pub const fn pin28(&self) -> super::vals::Pin28 {
let val = (self.0 >> 28usize) & 0x01;
super::vals::Pin28::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 28."]
#[inline(always)]
pub const fn set_pin28(&mut self, val: super::vals::Pin28) {
self.0 =
(self.0 & !(0x01 << 28usize)) | (((val.to_bits() as u32) & 0x01) << 28usize);
}
#[doc = "Select secure attribute attribute for PIN 29."]
#[must_use]
#[inline(always)]
pub const fn pin29(&self) -> super::vals::Pin29 {
let val = (self.0 >> 29usize) & 0x01;
super::vals::Pin29::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 29."]
#[inline(always)]
pub const fn set_pin29(&mut self, val: super::vals::Pin29) {
self.0 =
(self.0 & !(0x01 << 29usize)) | (((val.to_bits() as u32) & 0x01) << 29usize);
}
#[doc = "Select secure attribute attribute for PIN 30."]
#[must_use]
#[inline(always)]
pub const fn pin30(&self) -> super::vals::Pin30 {
let val = (self.0 >> 30usize) & 0x01;
super::vals::Pin30::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 30."]
#[inline(always)]
pub const fn set_pin30(&mut self, val: super::vals::Pin30) {
self.0 =
(self.0 & !(0x01 << 30usize)) | (((val.to_bits() as u32) & 0x01) << 30usize);
}
#[doc = "Select secure attribute attribute for PIN 31."]
#[must_use]
#[inline(always)]
pub const fn pin31(&self) -> super::vals::Pin31 {
let val = (self.0 >> 31usize) & 0x01;
super::vals::Pin31::from_bits(val as u8)
}
#[doc = "Select secure attribute attribute for PIN 31."]
#[inline(always)]
pub const fn set_pin31(&mut self, val: super::vals::Pin31) {
self.0 =
(self.0 & !(0x01 << 31usize)) | (((val.to_bits() as u32) & 0x01) << 31usize);
}
}
impl Default for GpioportPerm {
#[inline(always)]
fn default() -> GpioportPerm {
GpioportPerm(0)
}
}
impl core::fmt::Debug for GpioportPerm {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("GpioportPerm")
.field("pin0", &self.pin0())
.field("pin1", &self.pin1())
.field("pin2", &self.pin2())
.field("pin3", &self.pin3())
.field("pin4", &self.pin4())
.field("pin5", &self.pin5())
.field("pin6", &self.pin6())
.field("pin7", &self.pin7())
.field("pin8", &self.pin8())
.field("pin9", &self.pin9())
.field("pin10", &self.pin10())
.field("pin11", &self.pin11())
.field("pin12", &self.pin12())
.field("pin13", &self.pin13())
.field("pin14", &self.pin14())
.field("pin15", &self.pin15())
.field("pin16", &self.pin16())
.field("pin17", &self.pin17())
.field("pin18", &self.pin18())
.field("pin19", &self.pin19())
.field("pin20", &self.pin20())
.field("pin21", &self.pin21())
.field("pin22", &self.pin22())
.field("pin23", &self.pin23())
.field("pin24", &self.pin24())
.field("pin25", &self.pin25())
.field("pin26", &self.pin26())
.field("pin27", &self.pin27())
.field("pin28", &self.pin28())
.field("pin29", &self.pin29())
.field("pin30", &self.pin30())
.field("pin31", &self.pin31())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for GpioportPerm {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "GpioportPerm {{ pin0: {:?}, pin1: {:?}, pin2: {:?}, pin3: {:?}, pin4: {:?}, pin5: {:?}, pin6: {:?}, pin7: {:?}, pin8: {:?}, pin9: {:?}, pin10: {:?}, pin11: {:?}, pin12: {:?}, pin13: {:?}, pin14: {:?}, pin15: {:?}, pin16: {:?}, pin17: {:?}, pin18: {:?}, pin19: {:?}, pin20: {:?}, pin21: {:?}, pin22: {:?}, pin23: {:?}, pin24: {:?}, pin25: {:?}, pin26: {:?}, pin27: {:?}, pin28: {:?}, pin29: {:?}, pin30: {:?}, pin31: {:?} }}" , self . pin0 () , self . pin1 () , self . pin2 () , self . pin3 () , self . pin4 () , self . pin5 () , self . pin6 () , self . pin7 () , self . pin8 () , self . pin9 () , self . pin10 () , self . pin11 () , self . pin12 () , self . pin13 () , self . pin14 () , self . pin15 () , self . pin16 () , self . pin17 () , self . pin18 () , self . pin19 () , self . pin20 () , self . pin21 () , self . pin22 () , self . pin23 () , self . pin24 () , self . pin25 () , self . pin26 () , self . pin27 () , self . pin28 () , self . pin29 () , self . pin30 () , self . pin31 ())
}
}
#[doc = "Enable or disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Enable or disable interrupt for event RAMACCERR."]
#[must_use]
#[inline(always)]
pub const fn ramaccerr(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RAMACCERR."]
#[inline(always)]
pub const fn set_ramaccerr(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Enable or disable interrupt for event FLASHACCERR."]
#[must_use]
#[inline(always)]
pub const fn flashaccerr(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event FLASHACCERR."]
#[inline(always)]
pub const fn set_flashaccerr(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enable or disable interrupt for event PERIPHACCERR."]
#[must_use]
#[inline(always)]
pub const fn periphaccerr(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event PERIPHACCERR."]
#[inline(always)]
pub const fn set_periphaccerr(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("ramaccerr", &self.ramaccerr())
.field("flashaccerr", &self.flashaccerr())
.field("periphaccerr", &self.periphaccerr())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Int {{ ramaccerr: {=bool:?}, flashaccerr: {=bool:?}, periphaccerr: {=bool:?} }}" , self . ramaccerr () , self . flashaccerr () , self . periphaccerr ())
}
}
#[doc = "Description cluster: List capabilities and access permissions for the peripheral with ID n."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct PeriphidPerm(pub u32);
impl PeriphidPerm {
#[doc = "Define configuration capabilities for Arm TrustZone Cortex-M secure attribute."]
#[must_use]
#[inline(always)]
pub const fn securemapping(&self) -> super::vals::PeriphidPermSecuremapping {
let val = (self.0 >> 0usize) & 0x03;
super::vals::PeriphidPermSecuremapping::from_bits(val as u8)
}
#[doc = "Define configuration capabilities for Arm TrustZone Cortex-M secure attribute."]
#[inline(always)]
pub const fn set_securemapping(&mut self, val: super::vals::PeriphidPermSecuremapping) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
#[doc = "Indicates if the peripheral has DMA capabilities and if DMA transfer can be assigned to a different security attribute than the peripheral itself."]
#[must_use]
#[inline(always)]
pub const fn dma(&self) -> super::vals::Dma {
let val = (self.0 >> 2usize) & 0x03;
super::vals::Dma::from_bits(val as u8)
}
#[doc = "Indicates if the peripheral has DMA capabilities and if DMA transfer can be assigned to a different security attribute than the peripheral itself."]
#[inline(always)]
pub const fn set_dma(&mut self, val: super::vals::Dma) {
self.0 = (self.0 & !(0x03 << 2usize)) | (((val.to_bits() as u32) & 0x03) << 2usize);
}
#[doc = "Peripheral security mapping."]
#[must_use]
#[inline(always)]
pub const fn secattr(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Peripheral security mapping."]
#[inline(always)]
pub const fn set_secattr(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Security attribution for the DMA transfer."]
#[must_use]
#[inline(always)]
pub const fn dmasec(&self) -> super::vals::Dmasec {
let val = (self.0 >> 5usize) & 0x01;
super::vals::Dmasec::from_bits(val as u8)
}
#[doc = "Security attribution for the DMA transfer."]
#[inline(always)]
pub const fn set_dmasec(&mut self, val: super::vals::Dmasec) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val.to_bits() as u32) & 0x01) << 5usize);
}
#[must_use]
#[inline(always)]
pub const fn lock(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_lock(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "Indicate if a peripheral is present with ID n."]
#[must_use]
#[inline(always)]
pub const fn present(&self) -> super::vals::Present {
let val = (self.0 >> 31usize) & 0x01;
super::vals::Present::from_bits(val as u8)
}
#[doc = "Indicate if a peripheral is present with ID n."]
#[inline(always)]
pub const fn set_present(&mut self, val: super::vals::Present) {
self.0 =
(self.0 & !(0x01 << 31usize)) | (((val.to_bits() as u32) & 0x01) << 31usize);
}
}
impl Default for PeriphidPerm {
#[inline(always)]
fn default() -> PeriphidPerm {
PeriphidPerm(0)
}
}
impl core::fmt::Debug for PeriphidPerm {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("PeriphidPerm")
.field("securemapping", &self.securemapping())
.field("dma", &self.dma())
.field("secattr", &self.secattr())
.field("dmasec", &self.dmasec())
.field("lock", &self.lock())
.field("present", &self.present())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for PeriphidPerm {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "PeriphidPerm {{ securemapping: {:?}, dma: {:?}, secattr: {=bool:?}, dmasec: {:?}, lock: {=bool:?}, present: {:?} }}" , self . securemapping () , self . dma () , self . secattr () , self . dmasec () , self . lock () , self . present ())
}
}
#[doc = "Description cluster: Define which RAM region can contain the non-secure callable (NSC) region n."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RamnscRegion(pub u32);
impl RamnscRegion {
#[doc = "Region number."]
#[must_use]
#[inline(always)]
pub const fn region(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x3f;
val as u8
}
#[doc = "Region number."]
#[inline(always)]
pub const fn set_region(&mut self, val: u8) {
self.0 = (self.0 & !(0x3f << 0usize)) | (((val as u32) & 0x3f) << 0usize);
}
#[must_use]
#[inline(always)]
pub const fn lock(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_lock(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
}
impl Default for RamnscRegion {
#[inline(always)]
fn default() -> RamnscRegion {
RamnscRegion(0)
}
}
impl core::fmt::Debug for RamnscRegion {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RamnscRegion")
.field("region", &self.region())
.field("lock", &self.lock())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RamnscRegion {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"RamnscRegion {{ region: {=u8:?}, lock: {=bool:?} }}",
self.region(),
self.lock()
)
}
}
#[doc = "Description cluster: Define the size of the non-secure callable (NSC) region n."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RamnscSize(pub u32);
impl RamnscSize {
#[doc = "Size of the non-secure callable (NSC) region n."]
#[must_use]
#[inline(always)]
pub const fn size(&self) -> super::vals::RamnscSizeSize {
let val = (self.0 >> 0usize) & 0x0f;
super::vals::RamnscSizeSize::from_bits(val as u8)
}
#[doc = "Size of the non-secure callable (NSC) region n."]
#[inline(always)]
pub const fn set_size(&mut self, val: super::vals::RamnscSizeSize) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val.to_bits() as u32) & 0x0f) << 0usize);
}
#[must_use]
#[inline(always)]
pub const fn lock(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_lock(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
}
impl Default for RamnscSize {
#[inline(always)]
fn default() -> RamnscSize {
RamnscSize(0)
}
}
impl core::fmt::Debug for RamnscSize {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RamnscSize")
.field("size", &self.size())
.field("lock", &self.lock())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RamnscSize {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"RamnscSize {{ size: {:?}, lock: {=bool:?} }}",
self.size(),
self.lock()
)
}
}
#[doc = "Description cluster: Access permissions for RAM region n."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RamregionPerm(pub u32);
impl RamregionPerm {
#[doc = "Configure instruction fetch permissions from RAM region n."]
#[must_use]
#[inline(always)]
pub const fn execute(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Configure instruction fetch permissions from RAM region n."]
#[inline(always)]
pub const fn set_execute(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Configure write permission for RAM region n."]
#[must_use]
#[inline(always)]
pub const fn write(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Configure write permission for RAM region n."]
#[inline(always)]
pub const fn set_write(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Configure read permissions for RAM region n."]
#[must_use]
#[inline(always)]
pub const fn read(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Configure read permissions for RAM region n."]
#[inline(always)]
pub const fn set_read(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Security attribute for RAM region n."]
#[must_use]
#[inline(always)]
pub const fn secattr(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Security attribute for RAM region n."]
#[inline(always)]
pub const fn set_secattr(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[must_use]
#[inline(always)]
pub const fn lock(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_lock(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
}
impl Default for RamregionPerm {
#[inline(always)]
fn default() -> RamregionPerm {
RamregionPerm(0)
}
}
impl core::fmt::Debug for RamregionPerm {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RamregionPerm")
.field("execute", &self.execute())
.field("write", &self.write())
.field("read", &self.read())
.field("secattr", &self.secattr())
.field("lock", &self.lock())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RamregionPerm {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "RamregionPerm {{ execute: {=bool:?}, write: {=bool:?}, read: {=bool:?}, secattr: {=bool:?}, lock: {=bool:?} }}" , self . execute () , self . write () , self . read () , self . secattr () , self . lock ())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel0 {
#[doc = "Channel 0 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 0 has its secure attribute set."]
Secure = 0x01,
}
impl Channel0 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel0 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel0 {
#[inline(always)]
fn from(val: u8) -> Channel0 {
Channel0::from_bits(val)
}
}
impl From<Channel0> for u8 {
#[inline(always)]
fn from(val: Channel0) -> u8 {
Channel0::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel1 {
#[doc = "Channel 1 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 1 has its secure attribute set."]
Secure = 0x01,
}
impl Channel1 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel1 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel1 {
#[inline(always)]
fn from(val: u8) -> Channel1 {
Channel1::from_bits(val)
}
}
impl From<Channel1> for u8 {
#[inline(always)]
fn from(val: Channel1) -> u8 {
Channel1::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel10 {
#[doc = "Channel 10 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 10 has its secure attribute set."]
Secure = 0x01,
}
impl Channel10 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel10 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel10 {
#[inline(always)]
fn from(val: u8) -> Channel10 {
Channel10::from_bits(val)
}
}
impl From<Channel10> for u8 {
#[inline(always)]
fn from(val: Channel10) -> u8 {
Channel10::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel11 {
#[doc = "Channel 11 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 11 has its secure attribute set."]
Secure = 0x01,
}
impl Channel11 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel11 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel11 {
#[inline(always)]
fn from(val: u8) -> Channel11 {
Channel11::from_bits(val)
}
}
impl From<Channel11> for u8 {
#[inline(always)]
fn from(val: Channel11) -> u8 {
Channel11::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel12 {
#[doc = "Channel 12 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 12 has its secure attribute set."]
Secure = 0x01,
}
impl Channel12 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel12 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel12 {
#[inline(always)]
fn from(val: u8) -> Channel12 {
Channel12::from_bits(val)
}
}
impl From<Channel12> for u8 {
#[inline(always)]
fn from(val: Channel12) -> u8 {
Channel12::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel13 {
#[doc = "Channel 13 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 13 has its secure attribute set."]
Secure = 0x01,
}
impl Channel13 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel13 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel13 {
#[inline(always)]
fn from(val: u8) -> Channel13 {
Channel13::from_bits(val)
}
}
impl From<Channel13> for u8 {
#[inline(always)]
fn from(val: Channel13) -> u8 {
Channel13::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel14 {
#[doc = "Channel 14 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 14 has its secure attribute set."]
Secure = 0x01,
}
impl Channel14 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel14 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel14 {
#[inline(always)]
fn from(val: u8) -> Channel14 {
Channel14::from_bits(val)
}
}
impl From<Channel14> for u8 {
#[inline(always)]
fn from(val: Channel14) -> u8 {
Channel14::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel15 {
#[doc = "Channel 15 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 15 has its secure attribute set."]
Secure = 0x01,
}
impl Channel15 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel15 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel15 {
#[inline(always)]
fn from(val: u8) -> Channel15 {
Channel15::from_bits(val)
}
}
impl From<Channel15> for u8 {
#[inline(always)]
fn from(val: Channel15) -> u8 {
Channel15::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel16 {
#[doc = "Channel 16 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 16 has its secure attribute set."]
Secure = 0x01,
}
impl Channel16 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel16 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel16 {
#[inline(always)]
fn from(val: u8) -> Channel16 {
Channel16::from_bits(val)
}
}
impl From<Channel16> for u8 {
#[inline(always)]
fn from(val: Channel16) -> u8 {
Channel16::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel17 {
#[doc = "Channel 17 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 17 has its secure attribute set."]
Secure = 0x01,
}
impl Channel17 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel17 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel17 {
#[inline(always)]
fn from(val: u8) -> Channel17 {
Channel17::from_bits(val)
}
}
impl From<Channel17> for u8 {
#[inline(always)]
fn from(val: Channel17) -> u8 {
Channel17::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel18 {
#[doc = "Channel 18 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 18 has its secure attribute set."]
Secure = 0x01,
}
impl Channel18 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel18 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel18 {
#[inline(always)]
fn from(val: u8) -> Channel18 {
Channel18::from_bits(val)
}
}
impl From<Channel18> for u8 {
#[inline(always)]
fn from(val: Channel18) -> u8 {
Channel18::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel19 {
#[doc = "Channel 19 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 19 has its secure attribute set."]
Secure = 0x01,
}
impl Channel19 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel19 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel19 {
#[inline(always)]
fn from(val: u8) -> Channel19 {
Channel19::from_bits(val)
}
}
impl From<Channel19> for u8 {
#[inline(always)]
fn from(val: Channel19) -> u8 {
Channel19::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel2 {
#[doc = "Channel 2 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 2 has its secure attribute set."]
Secure = 0x01,
}
impl Channel2 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel2 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel2 {
#[inline(always)]
fn from(val: u8) -> Channel2 {
Channel2::from_bits(val)
}
}
impl From<Channel2> for u8 {
#[inline(always)]
fn from(val: Channel2) -> u8 {
Channel2::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel20 {
#[doc = "Channel 20 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 20 has its secure attribute set."]
Secure = 0x01,
}
impl Channel20 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel20 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel20 {
#[inline(always)]
fn from(val: u8) -> Channel20 {
Channel20::from_bits(val)
}
}
impl From<Channel20> for u8 {
#[inline(always)]
fn from(val: Channel20) -> u8 {
Channel20::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel21 {
#[doc = "Channel 21 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 21 has its secure attribute set."]
Secure = 0x01,
}
impl Channel21 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel21 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel21 {
#[inline(always)]
fn from(val: u8) -> Channel21 {
Channel21::from_bits(val)
}
}
impl From<Channel21> for u8 {
#[inline(always)]
fn from(val: Channel21) -> u8 {
Channel21::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel22 {
#[doc = "Channel 22 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 22 has its secure attribute set."]
Secure = 0x01,
}
impl Channel22 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel22 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel22 {
#[inline(always)]
fn from(val: u8) -> Channel22 {
Channel22::from_bits(val)
}
}
impl From<Channel22> for u8 {
#[inline(always)]
fn from(val: Channel22) -> u8 {
Channel22::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel23 {
#[doc = "Channel 23 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 23 has its secure attribute set."]
Secure = 0x01,
}
impl Channel23 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel23 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel23 {
#[inline(always)]
fn from(val: u8) -> Channel23 {
Channel23::from_bits(val)
}
}
impl From<Channel23> for u8 {
#[inline(always)]
fn from(val: Channel23) -> u8 {
Channel23::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel24 {
#[doc = "Channel 24 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 24 has its secure attribute set."]
Secure = 0x01,
}
impl Channel24 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel24 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel24 {
#[inline(always)]
fn from(val: u8) -> Channel24 {
Channel24::from_bits(val)
}
}
impl From<Channel24> for u8 {
#[inline(always)]
fn from(val: Channel24) -> u8 {
Channel24::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel25 {
#[doc = "Channel 25 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 25 has its secure attribute set."]
Secure = 0x01,
}
impl Channel25 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel25 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel25 {
#[inline(always)]
fn from(val: u8) -> Channel25 {
Channel25::from_bits(val)
}
}
impl From<Channel25> for u8 {
#[inline(always)]
fn from(val: Channel25) -> u8 {
Channel25::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel26 {
#[doc = "Channel 26 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 26 has its secure attribute set."]
Secure = 0x01,
}
impl Channel26 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel26 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel26 {
#[inline(always)]
fn from(val: u8) -> Channel26 {
Channel26::from_bits(val)
}
}
impl From<Channel26> for u8 {
#[inline(always)]
fn from(val: Channel26) -> u8 {
Channel26::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel27 {
#[doc = "Channel 27 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 27 has its secure attribute set."]
Secure = 0x01,
}
impl Channel27 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel27 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel27 {
#[inline(always)]
fn from(val: u8) -> Channel27 {
Channel27::from_bits(val)
}
}
impl From<Channel27> for u8 {
#[inline(always)]
fn from(val: Channel27) -> u8 {
Channel27::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel28 {
#[doc = "Channel 28 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 28 has its secure attribute set."]
Secure = 0x01,
}
impl Channel28 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel28 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel28 {
#[inline(always)]
fn from(val: u8) -> Channel28 {
Channel28::from_bits(val)
}
}
impl From<Channel28> for u8 {
#[inline(always)]
fn from(val: Channel28) -> u8 {
Channel28::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel29 {
#[doc = "Channel 29 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 29 has its secure attribute set."]
Secure = 0x01,
}
impl Channel29 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel29 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel29 {
#[inline(always)]
fn from(val: u8) -> Channel29 {
Channel29::from_bits(val)
}
}
impl From<Channel29> for u8 {
#[inline(always)]
fn from(val: Channel29) -> u8 {
Channel29::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel3 {
#[doc = "Channel 3 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 3 has its secure attribute set."]
Secure = 0x01,
}
impl Channel3 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel3 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel3 {
#[inline(always)]
fn from(val: u8) -> Channel3 {
Channel3::from_bits(val)
}
}
impl From<Channel3> for u8 {
#[inline(always)]
fn from(val: Channel3) -> u8 {
Channel3::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel30 {
#[doc = "Channel 30 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 30 has its secure attribute set."]
Secure = 0x01,
}
impl Channel30 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel30 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel30 {
#[inline(always)]
fn from(val: u8) -> Channel30 {
Channel30::from_bits(val)
}
}
impl From<Channel30> for u8 {
#[inline(always)]
fn from(val: Channel30) -> u8 {
Channel30::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel31 {
#[doc = "Channel 31 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 31 has its secure attribute set."]
Secure = 0x01,
}
impl Channel31 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel31 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel31 {
#[inline(always)]
fn from(val: u8) -> Channel31 {
Channel31::from_bits(val)
}
}
impl From<Channel31> for u8 {
#[inline(always)]
fn from(val: Channel31) -> u8 {
Channel31::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel4 {
#[doc = "Channel 4 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 4 has its secure attribute set."]
Secure = 0x01,
}
impl Channel4 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel4 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel4 {
#[inline(always)]
fn from(val: u8) -> Channel4 {
Channel4::from_bits(val)
}
}
impl From<Channel4> for u8 {
#[inline(always)]
fn from(val: Channel4) -> u8 {
Channel4::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel5 {
#[doc = "Channel 5 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 5 has its secure attribute set."]
Secure = 0x01,
}
impl Channel5 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel5 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel5 {
#[inline(always)]
fn from(val: u8) -> Channel5 {
Channel5::from_bits(val)
}
}
impl From<Channel5> for u8 {
#[inline(always)]
fn from(val: Channel5) -> u8 {
Channel5::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel6 {
#[doc = "Channel 6 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 6 has its secure attribute set."]
Secure = 0x01,
}
impl Channel6 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel6 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel6 {
#[inline(always)]
fn from(val: u8) -> Channel6 {
Channel6::from_bits(val)
}
}
impl From<Channel6> for u8 {
#[inline(always)]
fn from(val: Channel6) -> u8 {
Channel6::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel7 {
#[doc = "Channel 7 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 7 has its secure attribute set."]
Secure = 0x01,
}
impl Channel7 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel7 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel7 {
#[inline(always)]
fn from(val: u8) -> Channel7 {
Channel7::from_bits(val)
}
}
impl From<Channel7> for u8 {
#[inline(always)]
fn from(val: Channel7) -> u8 {
Channel7::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel8 {
#[doc = "Channel 8 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 8 has its secure attribute set."]
Secure = 0x01,
}
impl Channel8 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel8 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel8 {
#[inline(always)]
fn from(val: u8) -> Channel8 {
Channel8::from_bits(val)
}
}
impl From<Channel8> for u8 {
#[inline(always)]
fn from(val: Channel8) -> u8 {
Channel8::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Channel9 {
#[doc = "Channel 9 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Channel 9 has its secure attribute set."]
Secure = 0x01,
}
impl Channel9 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Channel9 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Channel9 {
#[inline(always)]
fn from(val: u8) -> Channel9 {
Channel9::from_bits(val)
}
}
impl From<Channel9> for u8 {
#[inline(always)]
fn from(val: Channel9) -> u8 {
Channel9::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Dma {
#[doc = "Peripheral has no DMA capability."]
NoDma = 0x0,
#[doc = "Peripheral has DMA and DMA transfers always have the same security attribute as assigned to the peripheral."]
NoSeparateAttribute = 0x01,
#[doc = "Peripheral has DMA and DMA transfers can have a different security attribute than the one assigned to the peripheral."]
SeparateAttribute = 0x02,
_RESERVED_3 = 0x03,
}
impl Dma {
#[inline(always)]
pub const fn from_bits(val: u8) -> Dma {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Dma {
#[inline(always)]
fn from(val: u8) -> Dma {
Dma::from_bits(val)
}
}
impl From<Dma> for u8 {
#[inline(always)]
fn from(val: Dma) -> u8 {
Dma::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Dmasec {
#[doc = "DMA transfers initiated by this peripheral have the non-secure attribute set."]
NonSecure = 0x0,
#[doc = "DMA transfers initiated by this peripheral have the secure attribute set."]
Secure = 0x01,
}
impl Dmasec {
#[inline(always)]
pub const fn from_bits(val: u8) -> Dmasec {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Dmasec {
#[inline(always)]
fn from(val: u8) -> Dmasec {
Dmasec::from_bits(val)
}
}
impl From<Dmasec> for u8 {
#[inline(always)]
fn from(val: Dmasec) -> u8 {
Dmasec::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum ExtdomainPermSecuremapping {
#[doc = "The bus access from this external domain always have the non-secure attribute set."]
NonSecure = 0x0,
#[doc = "The bus access from this external domain always have the secure attribute set."]
Secure = 0x01,
#[doc = "Non-secure or secure attribute for bus access from this domain is defined by the EXTDOMAIN\\[n\\].PERM register."]
UserSelectable = 0x02,
_RESERVED_3 = 0x03,
}
impl ExtdomainPermSecuremapping {
#[inline(always)]
pub const fn from_bits(val: u8) -> ExtdomainPermSecuremapping {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for ExtdomainPermSecuremapping {
#[inline(always)]
fn from(val: u8) -> ExtdomainPermSecuremapping {
ExtdomainPermSecuremapping::from_bits(val)
}
}
impl From<ExtdomainPermSecuremapping> for u8 {
#[inline(always)]
fn from(val: ExtdomainPermSecuremapping) -> u8 {
ExtdomainPermSecuremapping::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum FlashnscSizeSize {
#[doc = "The region n is not defined as a non-secure callable region. Normal security attributes (secure or non-secure) are enforced."]
Disabled = 0x0,
#[doc = "The region n is defined as non-secure callable with size 32 bytes."]
_32 = 0x01,
#[doc = "The region n is defined as non-secure callable with size 64 bytes."]
_64 = 0x02,
#[doc = "The region n is defined as non-secure callable with size 128 bytes."]
_128 = 0x03,
#[doc = "The region n is defined as non-secure callable with size 256 bytes."]
_256 = 0x04,
#[doc = "The region n is defined as non-secure callable with size 512 bytes."]
_512 = 0x05,
#[doc = "The region n is defined as non-secure callable with size 1024 bytes."]
_1024 = 0x06,
#[doc = "The region n is defined as non-secure callable with size 2048 bytes."]
_2048 = 0x07,
#[doc = "The region n is defined as non-secure callable with size 4096 bytes."]
_4096 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl FlashnscSizeSize {
#[inline(always)]
pub const fn from_bits(val: u8) -> FlashnscSizeSize {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for FlashnscSizeSize {
#[inline(always)]
fn from(val: u8) -> FlashnscSizeSize {
FlashnscSizeSize::from_bits(val)
}
}
impl From<FlashnscSizeSize> for u8 {
#[inline(always)]
fn from(val: FlashnscSizeSize) -> u8 {
FlashnscSizeSize::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum PeriphidPermSecuremapping {
#[doc = "This peripheral is always accessible as a non-secure peripheral."]
NonSecure = 0x0,
#[doc = "This peripheral is always accessible as a secure peripheral."]
Secure = 0x01,
#[doc = "Non-secure or secure attribute for this peripheral is defined by the PERIPHID\\[n\\].PERM register."]
UserSelectable = 0x02,
#[doc = "This peripheral implements the split security mechanism. Non-secure or secure attribute for this peripheral is defined by the PERIPHID\\[n\\].PERM register."]
Split = 0x03,
}
impl PeriphidPermSecuremapping {
#[inline(always)]
pub const fn from_bits(val: u8) -> PeriphidPermSecuremapping {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for PeriphidPermSecuremapping {
#[inline(always)]
fn from(val: u8) -> PeriphidPermSecuremapping {
PeriphidPermSecuremapping::from_bits(val)
}
}
impl From<PeriphidPermSecuremapping> for u8 {
#[inline(always)]
fn from(val: PeriphidPermSecuremapping) -> u8 {
PeriphidPermSecuremapping::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin0 {
#[doc = "Pin 0 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 0 has its secure attribute set."]
Secure = 0x01,
}
impl Pin0 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin0 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin0 {
#[inline(always)]
fn from(val: u8) -> Pin0 {
Pin0::from_bits(val)
}
}
impl From<Pin0> for u8 {
#[inline(always)]
fn from(val: Pin0) -> u8 {
Pin0::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin1 {
#[doc = "Pin 1 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 1 has its secure attribute set."]
Secure = 0x01,
}
impl Pin1 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin1 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin1 {
#[inline(always)]
fn from(val: u8) -> Pin1 {
Pin1::from_bits(val)
}
}
impl From<Pin1> for u8 {
#[inline(always)]
fn from(val: Pin1) -> u8 {
Pin1::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin10 {
#[doc = "Pin 10 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 10 has its secure attribute set."]
Secure = 0x01,
}
impl Pin10 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin10 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin10 {
#[inline(always)]
fn from(val: u8) -> Pin10 {
Pin10::from_bits(val)
}
}
impl From<Pin10> for u8 {
#[inline(always)]
fn from(val: Pin10) -> u8 {
Pin10::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin11 {
#[doc = "Pin 11 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 11 has its secure attribute set."]
Secure = 0x01,
}
impl Pin11 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin11 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin11 {
#[inline(always)]
fn from(val: u8) -> Pin11 {
Pin11::from_bits(val)
}
}
impl From<Pin11> for u8 {
#[inline(always)]
fn from(val: Pin11) -> u8 {
Pin11::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin12 {
#[doc = "Pin 12 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 12 has its secure attribute set."]
Secure = 0x01,
}
impl Pin12 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin12 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin12 {
#[inline(always)]
fn from(val: u8) -> Pin12 {
Pin12::from_bits(val)
}
}
impl From<Pin12> for u8 {
#[inline(always)]
fn from(val: Pin12) -> u8 {
Pin12::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin13 {
#[doc = "Pin 13 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 13 has its secure attribute set."]
Secure = 0x01,
}
impl Pin13 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin13 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin13 {
#[inline(always)]
fn from(val: u8) -> Pin13 {
Pin13::from_bits(val)
}
}
impl From<Pin13> for u8 {
#[inline(always)]
fn from(val: Pin13) -> u8 {
Pin13::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin14 {
#[doc = "Pin 14 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 14 has its secure attribute set."]
Secure = 0x01,
}
impl Pin14 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin14 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin14 {
#[inline(always)]
fn from(val: u8) -> Pin14 {
Pin14::from_bits(val)
}
}
impl From<Pin14> for u8 {
#[inline(always)]
fn from(val: Pin14) -> u8 {
Pin14::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin15 {
#[doc = "Pin 15 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 15 has its secure attribute set."]
Secure = 0x01,
}
impl Pin15 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin15 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin15 {
#[inline(always)]
fn from(val: u8) -> Pin15 {
Pin15::from_bits(val)
}
}
impl From<Pin15> for u8 {
#[inline(always)]
fn from(val: Pin15) -> u8 {
Pin15::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin16 {
#[doc = "Pin 16 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 16 has its secure attribute set."]
Secure = 0x01,
}
impl Pin16 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin16 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin16 {
#[inline(always)]
fn from(val: u8) -> Pin16 {
Pin16::from_bits(val)
}
}
impl From<Pin16> for u8 {
#[inline(always)]
fn from(val: Pin16) -> u8 {
Pin16::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin17 {
#[doc = "Pin 17 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 17 has its secure attribute set."]
Secure = 0x01,
}
impl Pin17 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin17 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin17 {
#[inline(always)]
fn from(val: u8) -> Pin17 {
Pin17::from_bits(val)
}
}
impl From<Pin17> for u8 {
#[inline(always)]
fn from(val: Pin17) -> u8 {
Pin17::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin18 {
#[doc = "Pin 18 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 18 has its secure attribute set."]
Secure = 0x01,
}
impl Pin18 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin18 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin18 {
#[inline(always)]
fn from(val: u8) -> Pin18 {
Pin18::from_bits(val)
}
}
impl From<Pin18> for u8 {
#[inline(always)]
fn from(val: Pin18) -> u8 {
Pin18::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin19 {
#[doc = "Pin 19 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 19 has its secure attribute set."]
Secure = 0x01,
}
impl Pin19 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin19 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin19 {
#[inline(always)]
fn from(val: u8) -> Pin19 {
Pin19::from_bits(val)
}
}
impl From<Pin19> for u8 {
#[inline(always)]
fn from(val: Pin19) -> u8 {
Pin19::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin2 {
#[doc = "Pin 2 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 2 has its secure attribute set."]
Secure = 0x01,
}
impl Pin2 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin2 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin2 {
#[inline(always)]
fn from(val: u8) -> Pin2 {
Pin2::from_bits(val)
}
}
impl From<Pin2> for u8 {
#[inline(always)]
fn from(val: Pin2) -> u8 {
Pin2::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin20 {
#[doc = "Pin 20 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 20 has its secure attribute set."]
Secure = 0x01,
}
impl Pin20 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin20 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin20 {
#[inline(always)]
fn from(val: u8) -> Pin20 {
Pin20::from_bits(val)
}
}
impl From<Pin20> for u8 {
#[inline(always)]
fn from(val: Pin20) -> u8 {
Pin20::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin21 {
#[doc = "Pin 21 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 21 has its secure attribute set."]
Secure = 0x01,
}
impl Pin21 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin21 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin21 {
#[inline(always)]
fn from(val: u8) -> Pin21 {
Pin21::from_bits(val)
}
}
impl From<Pin21> for u8 {
#[inline(always)]
fn from(val: Pin21) -> u8 {
Pin21::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin22 {
#[doc = "Pin 22 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 22 has its secure attribute set."]
Secure = 0x01,
}
impl Pin22 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin22 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin22 {
#[inline(always)]
fn from(val: u8) -> Pin22 {
Pin22::from_bits(val)
}
}
impl From<Pin22> for u8 {
#[inline(always)]
fn from(val: Pin22) -> u8 {
Pin22::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin23 {
#[doc = "Pin 23 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 23 has its secure attribute set."]
Secure = 0x01,
}
impl Pin23 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin23 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin23 {
#[inline(always)]
fn from(val: u8) -> Pin23 {
Pin23::from_bits(val)
}
}
impl From<Pin23> for u8 {
#[inline(always)]
fn from(val: Pin23) -> u8 {
Pin23::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin24 {
#[doc = "Pin 24 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 24 has its secure attribute set."]
Secure = 0x01,
}
impl Pin24 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin24 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin24 {
#[inline(always)]
fn from(val: u8) -> Pin24 {
Pin24::from_bits(val)
}
}
impl From<Pin24> for u8 {
#[inline(always)]
fn from(val: Pin24) -> u8 {
Pin24::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin25 {
#[doc = "Pin 25 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 25 has its secure attribute set."]
Secure = 0x01,
}
impl Pin25 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin25 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin25 {
#[inline(always)]
fn from(val: u8) -> Pin25 {
Pin25::from_bits(val)
}
}
impl From<Pin25> for u8 {
#[inline(always)]
fn from(val: Pin25) -> u8 {
Pin25::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin26 {
#[doc = "Pin 26 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 26 has its secure attribute set."]
Secure = 0x01,
}
impl Pin26 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin26 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin26 {
#[inline(always)]
fn from(val: u8) -> Pin26 {
Pin26::from_bits(val)
}
}
impl From<Pin26> for u8 {
#[inline(always)]
fn from(val: Pin26) -> u8 {
Pin26::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin27 {
#[doc = "Pin 27 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 27 has its secure attribute set."]
Secure = 0x01,
}
impl Pin27 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin27 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin27 {
#[inline(always)]
fn from(val: u8) -> Pin27 {
Pin27::from_bits(val)
}
}
impl From<Pin27> for u8 {
#[inline(always)]
fn from(val: Pin27) -> u8 {
Pin27::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin28 {
#[doc = "Pin 28 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 28 has its secure attribute set."]
Secure = 0x01,
}
impl Pin28 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin28 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin28 {
#[inline(always)]
fn from(val: u8) -> Pin28 {
Pin28::from_bits(val)
}
}
impl From<Pin28> for u8 {
#[inline(always)]
fn from(val: Pin28) -> u8 {
Pin28::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin29 {
#[doc = "Pin 29 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 29 has its secure attribute set."]
Secure = 0x01,
}
impl Pin29 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin29 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin29 {
#[inline(always)]
fn from(val: u8) -> Pin29 {
Pin29::from_bits(val)
}
}
impl From<Pin29> for u8 {
#[inline(always)]
fn from(val: Pin29) -> u8 {
Pin29::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin3 {
#[doc = "Pin 3 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 3 has its secure attribute set."]
Secure = 0x01,
}
impl Pin3 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin3 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin3 {
#[inline(always)]
fn from(val: u8) -> Pin3 {
Pin3::from_bits(val)
}
}
impl From<Pin3> for u8 {
#[inline(always)]
fn from(val: Pin3) -> u8 {
Pin3::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin30 {
#[doc = "Pin 30 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 30 has its secure attribute set."]
Secure = 0x01,
}
impl Pin30 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin30 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin30 {
#[inline(always)]
fn from(val: u8) -> Pin30 {
Pin30::from_bits(val)
}
}
impl From<Pin30> for u8 {
#[inline(always)]
fn from(val: Pin30) -> u8 {
Pin30::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin31 {
#[doc = "Pin 31 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 31 has its secure attribute set."]
Secure = 0x01,
}
impl Pin31 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin31 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin31 {
#[inline(always)]
fn from(val: u8) -> Pin31 {
Pin31::from_bits(val)
}
}
impl From<Pin31> for u8 {
#[inline(always)]
fn from(val: Pin31) -> u8 {
Pin31::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin4 {
#[doc = "Pin 4 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 4 has its secure attribute set."]
Secure = 0x01,
}
impl Pin4 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin4 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin4 {
#[inline(always)]
fn from(val: u8) -> Pin4 {
Pin4::from_bits(val)
}
}
impl From<Pin4> for u8 {
#[inline(always)]
fn from(val: Pin4) -> u8 {
Pin4::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin5 {
#[doc = "Pin 5 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 5 has its secure attribute set."]
Secure = 0x01,
}
impl Pin5 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin5 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin5 {
#[inline(always)]
fn from(val: u8) -> Pin5 {
Pin5::from_bits(val)
}
}
impl From<Pin5> for u8 {
#[inline(always)]
fn from(val: Pin5) -> u8 {
Pin5::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin6 {
#[doc = "Pin 6 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 6 has its secure attribute set."]
Secure = 0x01,
}
impl Pin6 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin6 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin6 {
#[inline(always)]
fn from(val: u8) -> Pin6 {
Pin6::from_bits(val)
}
}
impl From<Pin6> for u8 {
#[inline(always)]
fn from(val: Pin6) -> u8 {
Pin6::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin7 {
#[doc = "Pin 7 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 7 has its secure attribute set."]
Secure = 0x01,
}
impl Pin7 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin7 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin7 {
#[inline(always)]
fn from(val: u8) -> Pin7 {
Pin7::from_bits(val)
}
}
impl From<Pin7> for u8 {
#[inline(always)]
fn from(val: Pin7) -> u8 {
Pin7::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin8 {
#[doc = "Pin 8 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 8 has its secure attribute set."]
Secure = 0x01,
}
impl Pin8 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin8 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin8 {
#[inline(always)]
fn from(val: u8) -> Pin8 {
Pin8::from_bits(val)
}
}
impl From<Pin8> for u8 {
#[inline(always)]
fn from(val: Pin8) -> u8 {
Pin8::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Pin9 {
#[doc = "Pin 9 has its non-secure attribute set."]
NonSecure = 0x0,
#[doc = "Pin 9 has its secure attribute set."]
Secure = 0x01,
}
impl Pin9 {
#[inline(always)]
pub const fn from_bits(val: u8) -> Pin9 {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Pin9 {
#[inline(always)]
fn from(val: u8) -> Pin9 {
Pin9::from_bits(val)
}
}
impl From<Pin9> for u8 {
#[inline(always)]
fn from(val: Pin9) -> u8 {
Pin9::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Present {
#[doc = "Peripheral is not present."]
NotPresent = 0x0,
#[doc = "Peripheral is present."]
IsPresent = 0x01,
}
impl Present {
#[inline(always)]
pub const fn from_bits(val: u8) -> Present {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Present {
#[inline(always)]
fn from(val: u8) -> Present {
Present::from_bits(val)
}
}
impl From<Present> for u8 {
#[inline(always)]
fn from(val: Present) -> u8 {
Present::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RamnscSizeSize {
#[doc = "The region n is not defined as a non-secure callable region. Normal security attributes (secure or non-secure) are enforced."]
Disabled = 0x0,
#[doc = "The region n is defined as non-secure callable with size 32 bytes."]
_32 = 0x01,
#[doc = "The region n is defined as non-secure callable with size 64 bytes."]
_64 = 0x02,
#[doc = "The region n is defined as non-secure callable with size 128 bytes."]
_128 = 0x03,
#[doc = "The region n is defined as non-secure callable with size 256 bytes."]
_256 = 0x04,
#[doc = "The region n is defined as non-secure callable with size 512 bytes."]
_512 = 0x05,
#[doc = "The region n is defined as non-secure callable with size 1024 bytes."]
_1024 = 0x06,
#[doc = "The region n is defined as non-secure callable with size 2048 bytes."]
_2048 = 0x07,
#[doc = "The region n is defined as non-secure callable with size 4096 bytes."]
_4096 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl RamnscSizeSize {
#[inline(always)]
pub const fn from_bits(val: u8) -> RamnscSizeSize {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for RamnscSizeSize {
#[inline(always)]
fn from(val: u8) -> RamnscSizeSize {
RamnscSizeSize::from_bits(val)
}
}
impl From<RamnscSizeSize> for u8 {
#[inline(always)]
fn from(val: RamnscSizeSize) -> u8 {
RamnscSizeSize::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Tzm {
#[doc = "Arm TrustZone support not available."]
NotAvailable = 0x0,
#[doc = "Arm TrustZone support is available."]
Enabled = 0x01,
}
impl Tzm {
#[inline(always)]
pub const fn from_bits(val: u8) -> Tzm {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Tzm {
#[inline(always)]
fn from(val: u8) -> Tzm {
Tzm::from_bits(val)
}
}
impl From<Tzm> for u8 {
#[inline(always)]
fn from(val: Tzm) -> u8 {
Tzm::to_bits(val)
}
}
}
}
pub mod tad {
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Psel {
ptr: *mut u8,
}
unsafe impl Send for Psel {}
unsafe impl Sync for Psel {}
impl Psel {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Pin configuration for TRACECLK."]
#[inline(always)]
pub const fn traceclk(
self,
) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Pin configuration for TRACEDATA\\[0\\]."]
#[inline(always)]
pub const fn tracedata0(
self,
) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Pin configuration for TRACEDATA\\[1\\]."]
#[inline(always)]
pub const fn tracedata1(
self,
) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Pin configuration for TRACEDATA\\[2\\]."]
#[inline(always)]
pub const fn tracedata2(
self,
) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
#[doc = "Pin configuration for TRACEDATA\\[3\\]."]
#[inline(always)]
pub const fn tracedata3(
self,
) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
}
#[doc = "Trace and debug control."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Tad {
ptr: *mut u8,
}
unsafe impl Send for Tad {}
unsafe impl Sync for Tad {}
impl Tad {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Start all trace and debug clocks."]
#[inline(always)]
pub const fn clockstart(self) -> crate::common::Reg<regs::Clockstart, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Stop all trace and debug clocks."]
#[inline(always)]
pub const fn clockstop(self) -> crate::common::Reg<regs::Clockstop, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Enable debug domain and aquire selected GPIOs."]
#[inline(always)]
pub const fn enable(self) -> crate::common::Reg<regs::Enable, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0500usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn psel(self) -> Psel {
unsafe { Psel::from_ptr(self.ptr.wrapping_add(0x0504usize) as _) }
}
#[doc = "Clocking options for the Trace Port debug interface Reset behavior is the same as debug components."]
#[inline(always)]
pub const fn traceportspeed(
self,
) -> crate::common::Reg<regs::Traceportspeed, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0518usize) as _) }
}
}
pub mod regs {
#[doc = "Start all trace and debug clocks."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Clockstart(pub u32);
impl Clockstart {
#[must_use]
#[inline(always)]
pub const fn start(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_start(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Clockstart {
#[inline(always)]
fn default() -> Clockstart {
Clockstart(0)
}
}
impl core::fmt::Debug for Clockstart {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Clockstart")
.field("start", &self.start())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Clockstart {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Clockstart {{ start: {=bool:?} }}", self.start())
}
}
#[doc = "Stop all trace and debug clocks."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Clockstop(pub u32);
impl Clockstop {
#[must_use]
#[inline(always)]
pub const fn stop(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_stop(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Clockstop {
#[inline(always)]
fn default() -> Clockstop {
Clockstop(0)
}
}
impl core::fmt::Debug for Clockstop {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Clockstop")
.field("stop", &self.stop())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Clockstop {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Clockstop {{ stop: {=bool:?} }}", self.stop())
}
}
#[doc = "Enable debug domain and aquire selected GPIOs."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Enable(pub u32);
impl Enable {
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Enable {
#[inline(always)]
fn default() -> Enable {
Enable(0)
}
}
impl core::fmt::Debug for Enable {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Enable")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Enable {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Enable {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "Clocking options for the Trace Port debug interface Reset behavior is the same as debug components."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Traceportspeed(pub u32);
impl Traceportspeed {
#[doc = "Speed of Trace Port clock. Note that the TRACECLK pin output will be divided again by two from the Trace Port clock."]
#[must_use]
#[inline(always)]
pub const fn traceportspeed(&self) -> super::vals::Traceportspeed {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Traceportspeed::from_bits(val as u8)
}
#[doc = "Speed of Trace Port clock. Note that the TRACECLK pin output will be divided again by two from the Trace Port clock."]
#[inline(always)]
pub const fn set_traceportspeed(&mut self, val: super::vals::Traceportspeed) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for Traceportspeed {
#[inline(always)]
fn default() -> Traceportspeed {
Traceportspeed(0)
}
}
impl core::fmt::Debug for Traceportspeed {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Traceportspeed")
.field("traceportspeed", &self.traceportspeed())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Traceportspeed {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Traceportspeed {{ traceportspeed: {:?} }}",
self.traceportspeed()
)
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum PselTraceclkPin {
_RESERVED_0 = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
#[doc = "TRACECLK pin."]
Traceclk = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
_RESERVED_10 = 0x10,
_RESERVED_11 = 0x11,
_RESERVED_12 = 0x12,
_RESERVED_13 = 0x13,
_RESERVED_14 = 0x14,
_RESERVED_15 = 0x15,
_RESERVED_16 = 0x16,
_RESERVED_17 = 0x17,
_RESERVED_18 = 0x18,
_RESERVED_19 = 0x19,
_RESERVED_1a = 0x1a,
_RESERVED_1b = 0x1b,
_RESERVED_1c = 0x1c,
_RESERVED_1d = 0x1d,
_RESERVED_1e = 0x1e,
_RESERVED_1f = 0x1f,
}
impl PselTraceclkPin {
#[inline(always)]
pub const fn from_bits(val: u8) -> PselTraceclkPin {
unsafe { core::mem::transmute(val & 0x1f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for PselTraceclkPin {
#[inline(always)]
fn from(val: u8) -> PselTraceclkPin {
PselTraceclkPin::from_bits(val)
}
}
impl From<PselTraceclkPin> for u8 {
#[inline(always)]
fn from(val: PselTraceclkPin) -> u8 {
PselTraceclkPin::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum PselTracedata0Pin {
_RESERVED_0 = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
#[doc = "TRACEDATA0 pin."]
Tracedata0 = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
_RESERVED_10 = 0x10,
_RESERVED_11 = 0x11,
_RESERVED_12 = 0x12,
_RESERVED_13 = 0x13,
_RESERVED_14 = 0x14,
_RESERVED_15 = 0x15,
_RESERVED_16 = 0x16,
_RESERVED_17 = 0x17,
_RESERVED_18 = 0x18,
_RESERVED_19 = 0x19,
_RESERVED_1a = 0x1a,
_RESERVED_1b = 0x1b,
_RESERVED_1c = 0x1c,
_RESERVED_1d = 0x1d,
_RESERVED_1e = 0x1e,
_RESERVED_1f = 0x1f,
}
impl PselTracedata0Pin {
#[inline(always)]
pub const fn from_bits(val: u8) -> PselTracedata0Pin {
unsafe { core::mem::transmute(val & 0x1f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for PselTracedata0Pin {
#[inline(always)]
fn from(val: u8) -> PselTracedata0Pin {
PselTracedata0Pin::from_bits(val)
}
}
impl From<PselTracedata0Pin> for u8 {
#[inline(always)]
fn from(val: PselTracedata0Pin) -> u8 {
PselTracedata0Pin::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum PselTracedata1Pin {
_RESERVED_0 = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
#[doc = "TRACEDATA1 pin."]
Tracedata1 = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
_RESERVED_10 = 0x10,
_RESERVED_11 = 0x11,
_RESERVED_12 = 0x12,
_RESERVED_13 = 0x13,
_RESERVED_14 = 0x14,
_RESERVED_15 = 0x15,
_RESERVED_16 = 0x16,
_RESERVED_17 = 0x17,
_RESERVED_18 = 0x18,
_RESERVED_19 = 0x19,
_RESERVED_1a = 0x1a,
_RESERVED_1b = 0x1b,
_RESERVED_1c = 0x1c,
_RESERVED_1d = 0x1d,
_RESERVED_1e = 0x1e,
_RESERVED_1f = 0x1f,
}
impl PselTracedata1Pin {
#[inline(always)]
pub const fn from_bits(val: u8) -> PselTracedata1Pin {
unsafe { core::mem::transmute(val & 0x1f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for PselTracedata1Pin {
#[inline(always)]
fn from(val: u8) -> PselTracedata1Pin {
PselTracedata1Pin::from_bits(val)
}
}
impl From<PselTracedata1Pin> for u8 {
#[inline(always)]
fn from(val: PselTracedata1Pin) -> u8 {
PselTracedata1Pin::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum PselTracedata2Pin {
_RESERVED_0 = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
#[doc = "TRACEDATA2 pin."]
Tracedata2 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
_RESERVED_10 = 0x10,
_RESERVED_11 = 0x11,
_RESERVED_12 = 0x12,
_RESERVED_13 = 0x13,
_RESERVED_14 = 0x14,
_RESERVED_15 = 0x15,
_RESERVED_16 = 0x16,
_RESERVED_17 = 0x17,
_RESERVED_18 = 0x18,
_RESERVED_19 = 0x19,
_RESERVED_1a = 0x1a,
_RESERVED_1b = 0x1b,
_RESERVED_1c = 0x1c,
_RESERVED_1d = 0x1d,
_RESERVED_1e = 0x1e,
_RESERVED_1f = 0x1f,
}
impl PselTracedata2Pin {
#[inline(always)]
pub const fn from_bits(val: u8) -> PselTracedata2Pin {
unsafe { core::mem::transmute(val & 0x1f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for PselTracedata2Pin {
#[inline(always)]
fn from(val: u8) -> PselTracedata2Pin {
PselTracedata2Pin::from_bits(val)
}
}
impl From<PselTracedata2Pin> for u8 {
#[inline(always)]
fn from(val: PselTracedata2Pin) -> u8 {
PselTracedata2Pin::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum PselTracedata3Pin {
_RESERVED_0 = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
#[doc = "TRACEDATA3 pin."]
Tracedata3 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
_RESERVED_10 = 0x10,
_RESERVED_11 = 0x11,
_RESERVED_12 = 0x12,
_RESERVED_13 = 0x13,
_RESERVED_14 = 0x14,
_RESERVED_15 = 0x15,
_RESERVED_16 = 0x16,
_RESERVED_17 = 0x17,
_RESERVED_18 = 0x18,
_RESERVED_19 = 0x19,
_RESERVED_1a = 0x1a,
_RESERVED_1b = 0x1b,
_RESERVED_1c = 0x1c,
_RESERVED_1d = 0x1d,
_RESERVED_1e = 0x1e,
_RESERVED_1f = 0x1f,
}
impl PselTracedata3Pin {
#[inline(always)]
pub const fn from_bits(val: u8) -> PselTracedata3Pin {
unsafe { core::mem::transmute(val & 0x1f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for PselTracedata3Pin {
#[inline(always)]
fn from(val: u8) -> PselTracedata3Pin {
PselTracedata3Pin::from_bits(val)
}
}
impl From<PselTracedata3Pin> for u8 {
#[inline(always)]
fn from(val: PselTracedata3Pin) -> u8 {
PselTracedata3Pin::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Traceportspeed {
#[doc = "Trace Port clock is: 64MHz."]
_64mHz = 0x0,
#[doc = "Trace Port clock is: 32MHz."]
_32mHz = 0x01,
#[doc = "Trace Port clock is: 16MHz."]
_16mHz = 0x02,
#[doc = "Trace Port clock is: 8MHz."]
_8mHz = 0x03,
}
impl Traceportspeed {
#[inline(always)]
pub const fn from_bits(val: u8) -> Traceportspeed {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Traceportspeed {
#[inline(always)]
fn from(val: u8) -> Traceportspeed {
Traceportspeed::from_bits(val)
}
}
impl From<Traceportspeed> for u8 {
#[inline(always)]
fn from(val: Traceportspeed) -> u8 {
Traceportspeed::to_bits(val)
}
}
}
}
pub mod timer {
#[doc = "Timer/Counter 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Timer {
ptr: *mut u8,
}
unsafe impl Send for Timer {}
unsafe impl Sync for Timer {}
impl Timer {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Start Timer."]
#[inline(always)]
pub const fn tasks_start(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Stop Timer."]
#[inline(always)]
pub const fn tasks_stop(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Increment Timer (Counter mode only)."]
#[inline(always)]
pub const fn tasks_count(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Clear time."]
#[inline(always)]
pub const fn tasks_clear(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
#[doc = "Deprecated register - Shut down timer."]
#[inline(always)]
pub const fn tasks_shutdown(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
#[doc = "Description collection: Capture Timer value to CC\\[n\\] register."]
#[inline(always)]
pub const fn tasks_capture(self, n: usize) -> crate::common::Reg<u32, crate::common::W> {
assert!(n < 6usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x40usize + n * 4usize) as _)
}
}
#[doc = "Subscribe configuration for task START."]
#[inline(always)]
pub const fn subscribe_start(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x80usize) as _) }
}
#[doc = "Subscribe configuration for task STOP."]
#[inline(always)]
pub const fn subscribe_stop(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x84usize) as _) }
}
#[doc = "Subscribe configuration for task COUNT."]
#[inline(always)]
pub const fn subscribe_count(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x88usize) as _) }
}
#[doc = "Subscribe configuration for task CLEAR."]
#[inline(always)]
pub const fn subscribe_clear(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x8cusize) as _) }
}
#[doc = "Deprecated register - Subscribe configuration for task SHUTDOWN."]
#[inline(always)]
pub const fn subscribe_shutdown(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x90usize) as _) }
}
#[doc = "Description collection: Subscribe configuration for task CAPTURE\\[n\\]."]
#[inline(always)]
pub const fn subscribe_capture(
self,
n: usize,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
assert!(n < 6usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xc0usize + n * 4usize) as _)
}
}
#[doc = "Description collection: Compare event on CC\\[n\\] match."]
#[inline(always)]
pub const fn events_compare(self, n: usize) -> crate::common::Reg<u32, crate::common::RW> {
assert!(n < 6usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0140usize + n * 4usize) as _)
}
}
#[doc = "Description collection: Publish configuration for event COMPARE\\[n\\]."]
#[inline(always)]
pub const fn publish_compare(
self,
n: usize,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
assert!(n < 6usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01c0usize + n * 4usize) as _)
}
}
#[doc = "Shortcuts between local events and tasks."]
#[inline(always)]
pub const fn shorts(self) -> crate::common::Reg<regs::Shorts, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0200usize) as _) }
}
#[doc = "Enable or disable interrupt."]
#[inline(always)]
pub const fn inten(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0300usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "Timer mode selection."]
#[inline(always)]
pub const fn mode(self) -> crate::common::Reg<regs::Mode, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0504usize) as _) }
}
#[doc = "Configure the number of bits used by the TIMER."]
#[inline(always)]
pub const fn bitmode(self) -> crate::common::Reg<regs::Bitmode, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0508usize) as _) }
}
#[doc = "Timer prescaler register."]
#[inline(always)]
pub const fn prescaler(self) -> crate::common::Reg<regs::Prescaler, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0510usize) as _) }
}
#[doc = "Description collection: Capture/Compare register n."]
#[inline(always)]
pub const fn cc(self, n: usize) -> crate::common::Reg<u32, crate::common::RW> {
assert!(n < 6usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0540usize + n * 4usize) as _)
}
}
#[doc = "Description collection: Enable one-shot operation for Capture/Compare channel n."]
#[inline(always)]
pub const fn oneshoten(
self,
n: usize,
) -> crate::common::Reg<regs::Oneshoten, crate::common::RW> {
assert!(n < 6usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0580usize + n * 4usize) as _)
}
}
}
pub mod regs {
#[doc = "Configure the number of bits used by the TIMER."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Bitmode(pub u32);
impl Bitmode {
#[doc = "Timer bit width."]
#[must_use]
#[inline(always)]
pub const fn bitmode(&self) -> super::vals::Bitmode {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Bitmode::from_bits(val as u8)
}
#[doc = "Timer bit width."]
#[inline(always)]
pub const fn set_bitmode(&mut self, val: super::vals::Bitmode) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for Bitmode {
#[inline(always)]
fn default() -> Bitmode {
Bitmode(0)
}
}
impl core::fmt::Debug for Bitmode {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Bitmode")
.field("bitmode", &self.bitmode())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Bitmode {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Bitmode {{ bitmode: {:?} }}", self.bitmode())
}
}
#[doc = "Enable or disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Enable or disable interrupt for event COMPARE\\[0\\]."]
#[must_use]
#[inline(always)]
pub const fn compare(&self, n: usize) -> bool {
assert!(n < 6usize);
let offs = 16usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event COMPARE\\[0\\]."]
#[inline(always)]
pub const fn set_compare(&mut self, n: usize, val: bool) {
assert!(n < 6usize);
let offs = 16usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("compare[0]", &self.compare(0usize))
.field("compare[1]", &self.compare(1usize))
.field("compare[2]", &self.compare(2usize))
.field("compare[3]", &self.compare(3usize))
.field("compare[4]", &self.compare(4usize))
.field("compare[5]", &self.compare(5usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Int {{ compare[0]: {=bool:?}, compare[1]: {=bool:?}, compare[2]: {=bool:?}, compare[3]: {=bool:?}, compare[4]: {=bool:?}, compare[5]: {=bool:?} }}" , self . compare (0usize) , self . compare (1usize) , self . compare (2usize) , self . compare (3usize) , self . compare (4usize) , self . compare (5usize))
}
}
#[doc = "Timer mode selection."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Mode(pub u32);
impl Mode {
#[doc = "Timer mode."]
#[must_use]
#[inline(always)]
pub const fn mode(&self) -> super::vals::Mode {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Mode::from_bits(val as u8)
}
#[doc = "Timer mode."]
#[inline(always)]
pub const fn set_mode(&mut self, val: super::vals::Mode) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for Mode {
#[inline(always)]
fn default() -> Mode {
Mode(0)
}
}
impl core::fmt::Debug for Mode {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Mode").field("mode", &self.mode()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Mode {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Mode {{ mode: {:?} }}", self.mode())
}
}
#[doc = "Description collection: Enable one-shot operation for Capture/Compare channel n."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Oneshoten(pub u32);
impl Oneshoten {
#[doc = "Enable one-shot operation."]
#[must_use]
#[inline(always)]
pub const fn oneshoten(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable one-shot operation."]
#[inline(always)]
pub const fn set_oneshoten(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Oneshoten {
#[inline(always)]
fn default() -> Oneshoten {
Oneshoten(0)
}
}
impl core::fmt::Debug for Oneshoten {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Oneshoten")
.field("oneshoten", &self.oneshoten())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Oneshoten {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Oneshoten {{ oneshoten: {=bool:?} }}", self.oneshoten())
}
}
#[doc = "Timer prescaler register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Prescaler(pub u32);
impl Prescaler {
#[doc = "Prescaler value."]
#[must_use]
#[inline(always)]
pub const fn prescaler(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x0f;
val as u8
}
#[doc = "Prescaler value."]
#[inline(always)]
pub const fn set_prescaler(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val as u32) & 0x0f) << 0usize);
}
}
impl Default for Prescaler {
#[inline(always)]
fn default() -> Prescaler {
Prescaler(0)
}
}
impl core::fmt::Debug for Prescaler {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Prescaler")
.field("prescaler", &self.prescaler())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Prescaler {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Prescaler {{ prescaler: {=u8:?} }}", self.prescaler())
}
}
#[doc = "Shortcuts between local events and tasks."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Shorts(pub u32);
impl Shorts {
#[doc = "Shortcut between event COMPARE\\[0\\] and task CLEAR."]
#[must_use]
#[inline(always)]
pub const fn compare_clear(&self, n: usize) -> bool {
assert!(n < 6usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Shortcut between event COMPARE\\[0\\] and task CLEAR."]
#[inline(always)]
pub const fn set_compare_clear(&mut self, n: usize, val: bool) {
assert!(n < 6usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "Shortcut between event COMPARE\\[0\\] and task STOP."]
#[must_use]
#[inline(always)]
pub const fn compare_stop(&self, n: usize) -> bool {
assert!(n < 6usize);
let offs = 16usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Shortcut between event COMPARE\\[0\\] and task STOP."]
#[inline(always)]
pub const fn set_compare_stop(&mut self, n: usize, val: bool) {
assert!(n < 6usize);
let offs = 16usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Shorts {
#[inline(always)]
fn default() -> Shorts {
Shorts(0)
}
}
impl core::fmt::Debug for Shorts {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Shorts")
.field("compare_clear[0]", &self.compare_clear(0usize))
.field("compare_clear[1]", &self.compare_clear(1usize))
.field("compare_clear[2]", &self.compare_clear(2usize))
.field("compare_clear[3]", &self.compare_clear(3usize))
.field("compare_clear[4]", &self.compare_clear(4usize))
.field("compare_clear[5]", &self.compare_clear(5usize))
.field("compare_stop[0]", &self.compare_stop(0usize))
.field("compare_stop[1]", &self.compare_stop(1usize))
.field("compare_stop[2]", &self.compare_stop(2usize))
.field("compare_stop[3]", &self.compare_stop(3usize))
.field("compare_stop[4]", &self.compare_stop(4usize))
.field("compare_stop[5]", &self.compare_stop(5usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Shorts {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Shorts {{ compare_clear[0]: {=bool:?}, compare_clear[1]: {=bool:?}, compare_clear[2]: {=bool:?}, compare_clear[3]: {=bool:?}, compare_clear[4]: {=bool:?}, compare_clear[5]: {=bool:?}, compare_stop[0]: {=bool:?}, compare_stop[1]: {=bool:?}, compare_stop[2]: {=bool:?}, compare_stop[3]: {=bool:?}, compare_stop[4]: {=bool:?}, compare_stop[5]: {=bool:?} }}" , self . compare_clear (0usize) , self . compare_clear (1usize) , self . compare_clear (2usize) , self . compare_clear (3usize) , self . compare_clear (4usize) , self . compare_clear (5usize) , self . compare_stop (0usize) , self . compare_stop (1usize) , self . compare_stop (2usize) , self . compare_stop (3usize) , self . compare_stop (4usize) , self . compare_stop (5usize))
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Bitmode {
#[doc = "16 bit timer bit width."]
_16bit = 0x0,
#[doc = "8 bit timer bit width."]
_08bit = 0x01,
#[doc = "24 bit timer bit width."]
_24bit = 0x02,
#[doc = "32 bit timer bit width."]
_32bit = 0x03,
}
impl Bitmode {
#[inline(always)]
pub const fn from_bits(val: u8) -> Bitmode {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Bitmode {
#[inline(always)]
fn from(val: u8) -> Bitmode {
Bitmode::from_bits(val)
}
}
impl From<Bitmode> for u8 {
#[inline(always)]
fn from(val: Bitmode) -> u8 {
Bitmode::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Mode {
#[doc = "Select Timer mode."]
Timer = 0x0,
#[doc = "Deprecated enumerator - Select Counter mode."]
Counter = 0x01,
#[doc = "Select Low Power Counter mode."]
LowPowerCounter = 0x02,
_RESERVED_3 = 0x03,
}
impl Mode {
#[inline(always)]
pub const fn from_bits(val: u8) -> Mode {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Mode {
#[inline(always)]
fn from(val: u8) -> Mode {
Mode::from_bits(val)
}
}
impl From<Mode> for u8 {
#[inline(always)]
fn from(val: Mode) -> u8 {
Mode::to_bits(val)
}
}
}
}
pub mod twim {
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Dma {
ptr: *mut u8,
}
unsafe impl Send for Dma {}
unsafe impl Sync for Dma {}
impl Dma {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "RXD EasyDMA channel."]
#[inline(always)]
pub const fn rx(self) -> DmaRx {
unsafe { DmaRx::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "TXD EasyDMA channel."]
#[inline(always)]
pub const fn tx(self) -> DmaTx {
unsafe { DmaTx::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
}
#[doc = "RXD EasyDMA channel."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DmaRx {
ptr: *mut u8,
}
unsafe impl Send for DmaRx {}
unsafe impl Sync for DmaRx {}
impl DmaRx {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Data pointer."]
#[inline(always)]
pub const fn ptr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Maximum number of bytes in receive buffer."]
#[inline(always)]
pub const fn maxcnt(self) -> crate::common::Reg<regs::RxdMaxcnt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Number of bytes transferred in the last transaction."]
#[inline(always)]
pub const fn amount(self) -> crate::common::Reg<regs::RxdAmount, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "EasyDMA list type."]
#[inline(always)]
pub const fn list(self) -> crate::common::Reg<regs::RxdList, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
}
#[doc = "TXD EasyDMA channel."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DmaTx {
ptr: *mut u8,
}
unsafe impl Send for DmaTx {}
unsafe impl Sync for DmaTx {}
impl DmaTx {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Data pointer."]
#[inline(always)]
pub const fn ptr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Maximum number of bytes in transmit buffer."]
#[inline(always)]
pub const fn maxcnt(self) -> crate::common::Reg<regs::TxdMaxcnt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Number of bytes transferred in the last transaction."]
#[inline(always)]
pub const fn amount(self) -> crate::common::Reg<regs::TxdAmount, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "EasyDMA list type."]
#[inline(always)]
pub const fn list(self) -> crate::common::Reg<regs::TxdList, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Psel {
ptr: *mut u8,
}
unsafe impl Send for Psel {}
unsafe impl Sync for Psel {}
impl Psel {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Pin select for SCL signal."]
#[inline(always)]
pub const fn scl(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Pin select for SDA signal."]
#[inline(always)]
pub const fn sda(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TasksDma {
ptr: *mut u8,
}
unsafe impl Send for TasksDma {}
unsafe impl Sync for TasksDma {}
impl TasksDma {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[inline(always)]
pub const fn rx(self) -> TasksDmaRx {
unsafe { TasksDmaRx::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[inline(always)]
pub const fn tx(self) -> TasksDmaTx {
unsafe { TasksDmaTx::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TasksDmaRx {
ptr: *mut u8,
}
unsafe impl Send for TasksDmaRx {}
unsafe impl Sync for TasksDmaRx {}
impl TasksDmaRx {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Start TWI receive sequence."]
#[inline(always)]
pub const fn start(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TasksDmaTx {
ptr: *mut u8,
}
unsafe impl Send for TasksDmaTx {}
unsafe impl Sync for TasksDmaTx {}
impl TasksDmaTx {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Start TWI transmit sequence."]
#[inline(always)]
pub const fn start(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
}
#[doc = "I2C compatible Two-Wire Master Interface with EasyDMA 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Twim {
ptr: *mut u8,
}
unsafe impl Send for Twim {}
unsafe impl Sync for Twim {}
impl Twim {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[inline(always)]
pub const fn tasks_dma(self) -> TasksDma {
unsafe { TasksDma::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Stop TWI transaction. Must be issued while the TWI master is not suspended."]
#[inline(always)]
pub const fn tasks_stop(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x14usize) as _) }
}
#[doc = "Suspend TWI transaction."]
#[inline(always)]
pub const fn tasks_suspend(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x1cusize) as _) }
}
#[doc = "Resume TWI transaction."]
#[inline(always)]
pub const fn tasks_resume(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x20usize) as _) }
}
#[doc = "Subscribe configuration for task STARTRX."]
#[inline(always)]
pub const fn subscribe_startrx(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x80usize) as _) }
}
#[doc = "Subscribe configuration for task STARTTX."]
#[inline(always)]
pub const fn subscribe_starttx(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x88usize) as _) }
}
#[doc = "Subscribe configuration for task STOP."]
#[inline(always)]
pub const fn subscribe_stop(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x94usize) as _) }
}
#[doc = "Subscribe configuration for task SUSPEND."]
#[inline(always)]
pub const fn subscribe_suspend(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x9cusize) as _) }
}
#[doc = "Subscribe configuration for task RESUME."]
#[inline(always)]
pub const fn subscribe_resume(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xa0usize) as _) }
}
#[doc = "TWI stopped."]
#[inline(always)]
pub const fn events_stopped(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0104usize) as _) }
}
#[doc = "TWI error."]
#[inline(always)]
pub const fn events_error(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0124usize) as _) }
}
#[doc = "SUSPEND task has been issued, TWI traffic is now suspended."]
#[inline(always)]
pub const fn events_suspended(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0148usize) as _) }
}
#[doc = "Receive sequence started."]
#[inline(always)]
pub const fn events_rxstarted(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x014cusize) as _) }
}
#[doc = "Transmit sequence started."]
#[inline(always)]
pub const fn events_txstarted(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0150usize) as _) }
}
#[doc = "Byte boundary, starting to receive the last byte."]
#[inline(always)]
pub const fn events_lastrx(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x015cusize) as _) }
}
#[doc = "Byte boundary, starting to transmit the last byte."]
#[inline(always)]
pub const fn events_lasttx(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0160usize) as _) }
}
#[doc = "Publish configuration for event STOPPED."]
#[inline(always)]
pub const fn publish_stopped(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0184usize) as _) }
}
#[doc = "Publish configuration for event ERROR."]
#[inline(always)]
pub const fn publish_error(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01a4usize) as _) }
}
#[doc = "Publish configuration for event SUSPENDED."]
#[inline(always)]
pub const fn publish_suspended(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01c8usize) as _) }
}
#[doc = "Publish configuration for event RXSTARTED."]
#[inline(always)]
pub const fn publish_rxstarted(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01ccusize) as _) }
}
#[doc = "Publish configuration for event TXSTARTED."]
#[inline(always)]
pub const fn publish_txstarted(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01d0usize) as _) }
}
#[doc = "Publish configuration for event LASTRX."]
#[inline(always)]
pub const fn publish_lastrx(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01dcusize) as _) }
}
#[doc = "Publish configuration for event LASTTX."]
#[inline(always)]
pub const fn publish_lasttx(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01e0usize) as _) }
}
#[doc = "Shortcuts between local events and tasks."]
#[inline(always)]
pub const fn shorts(self) -> crate::common::Reg<regs::Shorts, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0200usize) as _) }
}
#[doc = "Enable or disable interrupt."]
#[inline(always)]
pub const fn inten(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0300usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "Error source."]
#[inline(always)]
pub const fn errorsrc(self) -> crate::common::Reg<regs::Errorsrc, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04c4usize) as _) }
}
#[doc = "Enable TWIM."]
#[inline(always)]
pub const fn enable(self) -> crate::common::Reg<regs::Enable, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0500usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn psel(self) -> Psel {
unsafe { Psel::from_ptr(self.ptr.wrapping_add(0x0508usize) as _) }
}
#[doc = "TWI frequency. Accuracy depends on the HFCLK source selected."]
#[inline(always)]
pub const fn frequency(self) -> crate::common::Reg<regs::Frequency, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0524usize) as _) }
}
#[inline(always)]
pub const fn dma(self) -> Dma {
unsafe { Dma::from_ptr(self.ptr.wrapping_add(0x0534usize) as _) }
}
#[doc = "Address used in the TWI transfer."]
#[inline(always)]
pub const fn address(self) -> crate::common::Reg<regs::Address, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0588usize) as _) }
}
}
pub mod regs {
#[doc = "Address used in the TWI transfer."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Address(pub u32);
impl Address {
#[doc = "Address used in the TWI transfer."]
#[must_use]
#[inline(always)]
pub const fn address(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x7f;
val as u8
}
#[doc = "Address used in the TWI transfer."]
#[inline(always)]
pub const fn set_address(&mut self, val: u8) {
self.0 = (self.0 & !(0x7f << 0usize)) | (((val as u32) & 0x7f) << 0usize);
}
}
impl Default for Address {
#[inline(always)]
fn default() -> Address {
Address(0)
}
}
impl core::fmt::Debug for Address {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Address")
.field("address", &self.address())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Address {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Address {{ address: {=u8:?} }}", self.address())
}
}
#[doc = "Enable TWIM."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Enable(pub u32);
impl Enable {
#[doc = "Enable or disable TWIM."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> super::vals::Enable {
let val = (self.0 >> 0usize) & 0x0f;
super::vals::Enable::from_bits(val as u8)
}
#[doc = "Enable or disable TWIM."]
#[inline(always)]
pub const fn set_enable(&mut self, val: super::vals::Enable) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val.to_bits() as u32) & 0x0f) << 0usize);
}
}
impl Default for Enable {
#[inline(always)]
fn default() -> Enable {
Enable(0)
}
}
impl core::fmt::Debug for Enable {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Enable")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Enable {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Enable {{ enable: {:?} }}", self.enable())
}
}
#[doc = "Error source."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Errorsrc(pub u32);
impl Errorsrc {
#[doc = "Overrun error."]
#[must_use]
#[inline(always)]
pub const fn overrun(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Overrun error."]
#[inline(always)]
pub const fn set_overrun(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "NACK received after sending the address (write '1' to clear)."]
#[must_use]
#[inline(always)]
pub const fn anack(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "NACK received after sending the address (write '1' to clear)."]
#[inline(always)]
pub const fn set_anack(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "NACK received after sending a data byte (write '1' to clear)."]
#[must_use]
#[inline(always)]
pub const fn dnack(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "NACK received after sending a data byte (write '1' to clear)."]
#[inline(always)]
pub const fn set_dnack(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
}
impl Default for Errorsrc {
#[inline(always)]
fn default() -> Errorsrc {
Errorsrc(0)
}
}
impl core::fmt::Debug for Errorsrc {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Errorsrc")
.field("overrun", &self.overrun())
.field("anack", &self.anack())
.field("dnack", &self.dnack())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Errorsrc {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Errorsrc {{ overrun: {=bool:?}, anack: {=bool:?}, dnack: {=bool:?} }}",
self.overrun(),
self.anack(),
self.dnack()
)
}
}
#[doc = "TWI frequency. Accuracy depends on the HFCLK source selected."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Frequency(pub u32);
impl Frequency {
#[doc = "TWI master clock frequency."]
#[must_use]
#[inline(always)]
pub const fn frequency(&self) -> super::vals::Frequency {
let val = (self.0 >> 0usize) & 0xffff_ffff;
super::vals::Frequency::from_bits(val as u32)
}
#[doc = "TWI master clock frequency."]
#[inline(always)]
pub const fn set_frequency(&mut self, val: super::vals::Frequency) {
self.0 = (self.0 & !(0xffff_ffff << 0usize))
| (((val.to_bits() as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Frequency {
#[inline(always)]
fn default() -> Frequency {
Frequency(0)
}
}
impl core::fmt::Debug for Frequency {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Frequency")
.field("frequency", &self.frequency())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Frequency {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Frequency {{ frequency: {:?} }}", self.frequency())
}
}
#[doc = "Enable or disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Enable or disable interrupt for event STOPPED."]
#[must_use]
#[inline(always)]
pub const fn stopped(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event STOPPED."]
#[inline(always)]
pub const fn set_stopped(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enable or disable interrupt for event ERROR."]
#[must_use]
#[inline(always)]
pub const fn error(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event ERROR."]
#[inline(always)]
pub const fn set_error(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Enable or disable interrupt for event SUSPENDED."]
#[must_use]
#[inline(always)]
pub const fn suspended(&self) -> bool {
let val = (self.0 >> 18usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event SUSPENDED."]
#[inline(always)]
pub const fn set_suspended(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
}
#[doc = "Enable or disable interrupt for event RXSTARTED."]
#[must_use]
#[inline(always)]
pub const fn rxstarted(&self) -> bool {
let val = (self.0 >> 19usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RXSTARTED."]
#[inline(always)]
pub const fn set_rxstarted(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
}
#[doc = "Enable or disable interrupt for event TXSTARTED."]
#[must_use]
#[inline(always)]
pub const fn txstarted(&self) -> bool {
let val = (self.0 >> 20usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event TXSTARTED."]
#[inline(always)]
pub const fn set_txstarted(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
}
#[doc = "Enable or disable interrupt for event LASTRX."]
#[must_use]
#[inline(always)]
pub const fn lastrx(&self) -> bool {
let val = (self.0 >> 23usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event LASTRX."]
#[inline(always)]
pub const fn set_lastrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize);
}
#[doc = "Enable or disable interrupt for event LASTTX."]
#[must_use]
#[inline(always)]
pub const fn lasttx(&self) -> bool {
let val = (self.0 >> 24usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event LASTTX."]
#[inline(always)]
pub const fn set_lasttx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("stopped", &self.stopped())
.field("error", &self.error())
.field("suspended", &self.suspended())
.field("rxstarted", &self.rxstarted())
.field("txstarted", &self.txstarted())
.field("lastrx", &self.lastrx())
.field("lasttx", &self.lasttx())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Int {{ stopped: {=bool:?}, error: {=bool:?}, suspended: {=bool:?}, rxstarted: {=bool:?}, txstarted: {=bool:?}, lastrx: {=bool:?}, lasttx: {=bool:?} }}" , self . stopped () , self . error () , self . suspended () , self . rxstarted () , self . txstarted () , self . lastrx () , self . lasttx ())
}
}
#[doc = "Number of bytes transferred in the last transaction."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RxdAmount(pub u32);
impl RxdAmount {
#[doc = "Number of bytes transferred in the last transaction. In case of NACK error, includes the NACK'ed byte."]
#[must_use]
#[inline(always)]
pub const fn amount(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Number of bytes transferred in the last transaction. In case of NACK error, includes the NACK'ed byte."]
#[inline(always)]
pub const fn set_amount(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for RxdAmount {
#[inline(always)]
fn default() -> RxdAmount {
RxdAmount(0)
}
}
impl core::fmt::Debug for RxdAmount {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RxdAmount")
.field("amount", &self.amount())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RxdAmount {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "RxdAmount {{ amount: {=u16:?} }}", self.amount())
}
}
#[doc = "EasyDMA list type."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RxdList(pub u32);
impl RxdList {
#[doc = "List type."]
#[must_use]
#[inline(always)]
pub const fn list(&self) -> super::vals::RxdListList {
let val = (self.0 >> 0usize) & 0x07;
super::vals::RxdListList::from_bits(val as u8)
}
#[doc = "List type."]
#[inline(always)]
pub const fn set_list(&mut self, val: super::vals::RxdListList) {
self.0 = (self.0 & !(0x07 << 0usize)) | (((val.to_bits() as u32) & 0x07) << 0usize);
}
}
impl Default for RxdList {
#[inline(always)]
fn default() -> RxdList {
RxdList(0)
}
}
impl core::fmt::Debug for RxdList {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RxdList")
.field("list", &self.list())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RxdList {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "RxdList {{ list: {:?} }}", self.list())
}
}
#[doc = "Maximum number of bytes in receive buffer."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RxdMaxcnt(pub u32);
impl RxdMaxcnt {
#[doc = "Maximum number of bytes in receive buffer."]
#[must_use]
#[inline(always)]
pub const fn maxcnt(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Maximum number of bytes in receive buffer."]
#[inline(always)]
pub const fn set_maxcnt(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for RxdMaxcnt {
#[inline(always)]
fn default() -> RxdMaxcnt {
RxdMaxcnt(0)
}
}
impl core::fmt::Debug for RxdMaxcnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RxdMaxcnt")
.field("maxcnt", &self.maxcnt())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RxdMaxcnt {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "RxdMaxcnt {{ maxcnt: {=u16:?} }}", self.maxcnt())
}
}
#[doc = "Shortcuts between local events and tasks."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Shorts(pub u32);
impl Shorts {
#[doc = "Shortcut between event LASTTX and task STARTRX."]
#[must_use]
#[inline(always)]
pub const fn lasttx_dma_rx_start(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event LASTTX and task STARTRX."]
#[inline(always)]
pub const fn set_lasttx_dma_rx_start(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Shortcut between event LASTTX and task SUSPEND."]
#[must_use]
#[inline(always)]
pub const fn lasttx_suspend(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event LASTTX and task SUSPEND."]
#[inline(always)]
pub const fn set_lasttx_suspend(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "Shortcut between event LASTTX and task STOP."]
#[must_use]
#[inline(always)]
pub const fn lasttx_stop(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event LASTTX and task STOP."]
#[inline(always)]
pub const fn set_lasttx_stop(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Shortcut between event LASTRX and task STARTTX."]
#[must_use]
#[inline(always)]
pub const fn lastrx_dma_tx_start(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event LASTRX and task STARTTX."]
#[inline(always)]
pub const fn set_lastrx_dma_tx_start(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[doc = "Shortcut between event LASTRX and task STOP."]
#[must_use]
#[inline(always)]
pub const fn lastrx_stop(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event LASTRX and task STOP."]
#[inline(always)]
pub const fn set_lastrx_stop(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
}
impl Default for Shorts {
#[inline(always)]
fn default() -> Shorts {
Shorts(0)
}
}
impl core::fmt::Debug for Shorts {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Shorts")
.field("lasttx_dma_rx_start", &self.lasttx_dma_rx_start())
.field("lasttx_suspend", &self.lasttx_suspend())
.field("lasttx_stop", &self.lasttx_stop())
.field("lastrx_dma_tx_start", &self.lastrx_dma_tx_start())
.field("lastrx_stop", &self.lastrx_stop())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Shorts {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Shorts {{ lasttx_dma_rx_start: {=bool:?}, lasttx_suspend: {=bool:?}, lasttx_stop: {=bool:?}, lastrx_dma_tx_start: {=bool:?}, lastrx_stop: {=bool:?} }}" , self . lasttx_dma_rx_start () , self . lasttx_suspend () , self . lasttx_stop () , self . lastrx_dma_tx_start () , self . lastrx_stop ())
}
}
#[doc = "Number of bytes transferred in the last transaction."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TxdAmount(pub u32);
impl TxdAmount {
#[doc = "Number of bytes transferred in the last transaction. In case of NACK error, includes the NACK'ed byte."]
#[must_use]
#[inline(always)]
pub const fn amount(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Number of bytes transferred in the last transaction. In case of NACK error, includes the NACK'ed byte."]
#[inline(always)]
pub const fn set_amount(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for TxdAmount {
#[inline(always)]
fn default() -> TxdAmount {
TxdAmount(0)
}
}
impl core::fmt::Debug for TxdAmount {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TxdAmount")
.field("amount", &self.amount())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for TxdAmount {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "TxdAmount {{ amount: {=u16:?} }}", self.amount())
}
}
#[doc = "EasyDMA list type."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TxdList(pub u32);
impl TxdList {
#[doc = "List type."]
#[must_use]
#[inline(always)]
pub const fn list(&self) -> super::vals::TxdListList {
let val = (self.0 >> 0usize) & 0x07;
super::vals::TxdListList::from_bits(val as u8)
}
#[doc = "List type."]
#[inline(always)]
pub const fn set_list(&mut self, val: super::vals::TxdListList) {
self.0 = (self.0 & !(0x07 << 0usize)) | (((val.to_bits() as u32) & 0x07) << 0usize);
}
}
impl Default for TxdList {
#[inline(always)]
fn default() -> TxdList {
TxdList(0)
}
}
impl core::fmt::Debug for TxdList {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TxdList")
.field("list", &self.list())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for TxdList {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "TxdList {{ list: {:?} }}", self.list())
}
}
#[doc = "Maximum number of bytes in transmit buffer."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TxdMaxcnt(pub u32);
impl TxdMaxcnt {
#[doc = "Maximum number of bytes in transmit buffer."]
#[must_use]
#[inline(always)]
pub const fn maxcnt(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Maximum number of bytes in transmit buffer."]
#[inline(always)]
pub const fn set_maxcnt(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for TxdMaxcnt {
#[inline(always)]
fn default() -> TxdMaxcnt {
TxdMaxcnt(0)
}
}
impl core::fmt::Debug for TxdMaxcnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TxdMaxcnt")
.field("maxcnt", &self.maxcnt())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for TxdMaxcnt {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "TxdMaxcnt {{ maxcnt: {=u16:?} }}", self.maxcnt())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Enable {
#[doc = "Disable TWIM."]
Disabled = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
#[doc = "Enable TWIM."]
Enabled = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Enable {
#[inline(always)]
pub const fn from_bits(val: u8) -> Enable {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Enable {
#[inline(always)]
fn from(val: u8) -> Enable {
Enable::from_bits(val)
}
}
impl From<Enable> for u8 {
#[inline(always)]
fn from(val: Enable) -> u8 {
Enable::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Frequency(u32);
impl Frequency {
#[doc = "100 kbps."]
pub const K100: Self = Self(0x0198_0000);
#[doc = "250 kbps."]
pub const K250: Self = Self(0x0400_0000);
#[doc = "400 kbps."]
pub const K400: Self = Self(0x0640_0000);
#[doc = "1000 kbps."]
pub const K1000: Self = Self(0x0ff0_0000);
}
impl Frequency {
pub const fn from_bits(val: u32) -> Frequency {
Self(val & 0xffff_ffff)
}
pub const fn to_bits(self) -> u32 {
self.0
}
}
impl core::fmt::Debug for Frequency {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x0198_0000 => f.write_str("K100"),
0x0400_0000 => f.write_str("K250"),
0x0640_0000 => f.write_str("K400"),
0x0ff0_0000 => f.write_str("K1000"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Frequency {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x0198_0000 => defmt::write!(f, "K100"),
0x0400_0000 => defmt::write!(f, "K250"),
0x0640_0000 => defmt::write!(f, "K400"),
0x0ff0_0000 => defmt::write!(f, "K1000"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u32> for Frequency {
#[inline(always)]
fn from(val: u32) -> Frequency {
Frequency::from_bits(val)
}
}
impl From<Frequency> for u32 {
#[inline(always)]
fn from(val: Frequency) -> u32 {
Frequency::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RxdListList {
#[doc = "Disable EasyDMA list."]
Disabled = 0x0,
#[doc = "Use array list."]
ArrayList = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
}
impl RxdListList {
#[inline(always)]
pub const fn from_bits(val: u8) -> RxdListList {
unsafe { core::mem::transmute(val & 0x07) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for RxdListList {
#[inline(always)]
fn from(val: u8) -> RxdListList {
RxdListList::from_bits(val)
}
}
impl From<RxdListList> for u8 {
#[inline(always)]
fn from(val: RxdListList) -> u8 {
RxdListList::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum TxdListList {
#[doc = "Disable EasyDMA list."]
Disabled = 0x0,
#[doc = "Use array list."]
ArrayList = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
}
impl TxdListList {
#[inline(always)]
pub const fn from_bits(val: u8) -> TxdListList {
unsafe { core::mem::transmute(val & 0x07) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for TxdListList {
#[inline(always)]
fn from(val: u8) -> TxdListList {
TxdListList::from_bits(val)
}
}
impl From<TxdListList> for u8 {
#[inline(always)]
fn from(val: TxdListList) -> u8 {
TxdListList::to_bits(val)
}
}
}
}
pub mod twis {
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Dma {
ptr: *mut u8,
}
unsafe impl Send for Dma {}
unsafe impl Sync for Dma {}
impl Dma {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "RXD EasyDMA channel."]
#[inline(always)]
pub const fn rx(self) -> DmaRx {
unsafe { DmaRx::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "TXD EasyDMA channel."]
#[inline(always)]
pub const fn tx(self) -> DmaTx {
unsafe { DmaTx::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
}
#[doc = "RXD EasyDMA channel."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DmaRx {
ptr: *mut u8,
}
unsafe impl Send for DmaRx {}
unsafe impl Sync for DmaRx {}
impl DmaRx {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "RXD Data pointer."]
#[inline(always)]
pub const fn ptr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Maximum number of bytes in RXD buffer."]
#[inline(always)]
pub const fn maxcnt(self) -> crate::common::Reg<regs::RxdMaxcnt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Number of bytes transferred in the last RXD transaction."]
#[inline(always)]
pub const fn amount(self) -> crate::common::Reg<regs::RxdAmount, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "EasyDMA list type."]
#[inline(always)]
pub const fn list(self) -> crate::common::Reg<regs::RxdList, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
}
#[doc = "TXD EasyDMA channel."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DmaTx {
ptr: *mut u8,
}
unsafe impl Send for DmaTx {}
unsafe impl Sync for DmaTx {}
impl DmaTx {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "TXD Data pointer."]
#[inline(always)]
pub const fn ptr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Maximum number of bytes in TXD buffer."]
#[inline(always)]
pub const fn maxcnt(self) -> crate::common::Reg<regs::TxdMaxcnt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Number of bytes transferred in the last TXD transaction."]
#[inline(always)]
pub const fn amount(self) -> crate::common::Reg<regs::TxdAmount, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "EasyDMA list type."]
#[inline(always)]
pub const fn list(self) -> crate::common::Reg<regs::TxdList, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Psel {
ptr: *mut u8,
}
unsafe impl Send for Psel {}
unsafe impl Sync for Psel {}
impl Psel {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Pin select for SCL signal."]
#[inline(always)]
pub const fn scl(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Pin select for SDA signal."]
#[inline(always)]
pub const fn sda(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
#[doc = "I2C compatible Two-Wire Slave Interface with EasyDMA 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Twis {
ptr: *mut u8,
}
unsafe impl Send for Twis {}
unsafe impl Sync for Twis {}
impl Twis {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Stop TWI transaction."]
#[inline(always)]
pub const fn tasks_stop(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x14usize) as _) }
}
#[doc = "Suspend TWI transaction."]
#[inline(always)]
pub const fn tasks_suspend(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x1cusize) as _) }
}
#[doc = "Resume TWI transaction."]
#[inline(always)]
pub const fn tasks_resume(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x20usize) as _) }
}
#[doc = "Prepare the TWI slave to respond to a write command."]
#[inline(always)]
pub const fn tasks_preparerx(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x30usize) as _) }
}
#[doc = "Prepare the TWI slave to respond to a read command."]
#[inline(always)]
pub const fn tasks_preparetx(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x34usize) as _) }
}
#[doc = "Subscribe configuration for task STOP."]
#[inline(always)]
pub const fn subscribe_stop(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x94usize) as _) }
}
#[doc = "Subscribe configuration for task SUSPEND."]
#[inline(always)]
pub const fn subscribe_suspend(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x9cusize) as _) }
}
#[doc = "Subscribe configuration for task RESUME."]
#[inline(always)]
pub const fn subscribe_resume(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xa0usize) as _) }
}
#[doc = "Subscribe configuration for task PREPARERX."]
#[inline(always)]
pub const fn subscribe_preparerx(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xb0usize) as _) }
}
#[doc = "Subscribe configuration for task PREPARETX."]
#[inline(always)]
pub const fn subscribe_preparetx(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xb4usize) as _) }
}
#[doc = "TWI stopped."]
#[inline(always)]
pub const fn events_stopped(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0104usize) as _) }
}
#[doc = "TWI error."]
#[inline(always)]
pub const fn events_error(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0124usize) as _) }
}
#[doc = "Receive sequence started."]
#[inline(always)]
pub const fn events_rxstarted(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x014cusize) as _) }
}
#[doc = "Transmit sequence started."]
#[inline(always)]
pub const fn events_txstarted(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0150usize) as _) }
}
#[doc = "Write command received."]
#[inline(always)]
pub const fn events_write(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0164usize) as _) }
}
#[doc = "Read command received."]
#[inline(always)]
pub const fn events_read(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0168usize) as _) }
}
#[doc = "Publish configuration for event STOPPED."]
#[inline(always)]
pub const fn publish_stopped(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0184usize) as _) }
}
#[doc = "Publish configuration for event ERROR."]
#[inline(always)]
pub const fn publish_error(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01a4usize) as _) }
}
#[doc = "Publish configuration for event RXSTARTED."]
#[inline(always)]
pub const fn publish_rxstarted(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01ccusize) as _) }
}
#[doc = "Publish configuration for event TXSTARTED."]
#[inline(always)]
pub const fn publish_txstarted(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01d0usize) as _) }
}
#[doc = "Publish configuration for event WRITE."]
#[inline(always)]
pub const fn publish_write(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01e4usize) as _) }
}
#[doc = "Publish configuration for event READ."]
#[inline(always)]
pub const fn publish_read(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01e8usize) as _) }
}
#[doc = "Shortcuts between local events and tasks."]
#[inline(always)]
pub const fn shorts(self) -> crate::common::Reg<regs::Shorts, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0200usize) as _) }
}
#[doc = "Enable or disable interrupt."]
#[inline(always)]
pub const fn inten(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0300usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "Error source."]
#[inline(always)]
pub const fn errorsrc(self) -> crate::common::Reg<regs::Errorsrc, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04d0usize) as _) }
}
#[doc = "Status register indicating which address had a match."]
#[inline(always)]
pub const fn match_(self) -> crate::common::Reg<regs::Match, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04d4usize) as _) }
}
#[doc = "Enable TWIS."]
#[inline(always)]
pub const fn enable(self) -> crate::common::Reg<regs::Enable, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0500usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn psel(self) -> Psel {
unsafe { Psel::from_ptr(self.ptr.wrapping_add(0x0508usize) as _) }
}
#[inline(always)]
pub const fn dma(self) -> Dma {
unsafe { Dma::from_ptr(self.ptr.wrapping_add(0x0534usize) as _) }
}
#[doc = "Description collection: TWI slave address n."]
#[inline(always)]
pub const fn address(
self,
n: usize,
) -> crate::common::Reg<regs::Address, crate::common::RW> {
assert!(n < 2usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0588usize + n * 4usize) as _)
}
}
#[doc = "Configuration register for the address match mechanism."]
#[inline(always)]
pub const fn config(self) -> crate::common::Reg<regs::Config, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0594usize) as _) }
}
#[doc = "Over-read character. Character sent out in case of an over-read of the transmit buffer."]
#[inline(always)]
pub const fn orc(self) -> crate::common::Reg<regs::Orc, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x05c0usize) as _) }
}
}
pub mod regs {
#[doc = "Description collection: TWI slave address n."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Address(pub u32);
impl Address {
#[doc = "TWI slave address."]
#[must_use]
#[inline(always)]
pub const fn address(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x7f;
val as u8
}
#[doc = "TWI slave address."]
#[inline(always)]
pub const fn set_address(&mut self, val: u8) {
self.0 = (self.0 & !(0x7f << 0usize)) | (((val as u32) & 0x7f) << 0usize);
}
}
impl Default for Address {
#[inline(always)]
fn default() -> Address {
Address(0)
}
}
impl core::fmt::Debug for Address {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Address")
.field("address", &self.address())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Address {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Address {{ address: {=u8:?} }}", self.address())
}
}
#[doc = "Configuration register for the address match mechanism."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Config(pub u32);
impl Config {
#[doc = "Enable or disable address matching on ADDRESS\\[0\\]."]
#[must_use]
#[inline(always)]
pub const fn address0(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable address matching on ADDRESS\\[0\\]."]
#[inline(always)]
pub const fn set_address0(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Enable or disable address matching on ADDRESS\\[1\\]."]
#[must_use]
#[inline(always)]
pub const fn address1(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enable or disable address matching on ADDRESS\\[1\\]."]
#[inline(always)]
pub const fn set_address1(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
}
impl Default for Config {
#[inline(always)]
fn default() -> Config {
Config(0)
}
}
impl core::fmt::Debug for Config {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Config")
.field("address0", &self.address0())
.field("address1", &self.address1())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Config {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Config {{ address0: {=bool:?}, address1: {=bool:?} }}",
self.address0(),
self.address1()
)
}
}
#[doc = "Enable TWIS."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Enable(pub u32);
impl Enable {
#[doc = "Enable or disable TWIS."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> super::vals::Enable {
let val = (self.0 >> 0usize) & 0x0f;
super::vals::Enable::from_bits(val as u8)
}
#[doc = "Enable or disable TWIS."]
#[inline(always)]
pub const fn set_enable(&mut self, val: super::vals::Enable) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val.to_bits() as u32) & 0x0f) << 0usize);
}
}
impl Default for Enable {
#[inline(always)]
fn default() -> Enable {
Enable(0)
}
}
impl core::fmt::Debug for Enable {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Enable")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Enable {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Enable {{ enable: {:?} }}", self.enable())
}
}
#[doc = "Error source."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Errorsrc(pub u32);
impl Errorsrc {
#[doc = "RX buffer overflow detected, and prevented."]
#[must_use]
#[inline(always)]
pub const fn overflow(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "RX buffer overflow detected, and prevented."]
#[inline(always)]
pub const fn set_overflow(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "NACK sent after receiving a data byte."]
#[must_use]
#[inline(always)]
pub const fn dnack(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "NACK sent after receiving a data byte."]
#[inline(always)]
pub const fn set_dnack(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "TX buffer over-read detected, and prevented."]
#[must_use]
#[inline(always)]
pub const fn overread(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "TX buffer over-read detected, and prevented."]
#[inline(always)]
pub const fn set_overread(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
}
impl Default for Errorsrc {
#[inline(always)]
fn default() -> Errorsrc {
Errorsrc(0)
}
}
impl core::fmt::Debug for Errorsrc {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Errorsrc")
.field("overflow", &self.overflow())
.field("dnack", &self.dnack())
.field("overread", &self.overread())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Errorsrc {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Errorsrc {{ overflow: {=bool:?}, dnack: {=bool:?}, overread: {=bool:?} }}",
self.overflow(),
self.dnack(),
self.overread()
)
}
}
#[doc = "Enable or disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Enable or disable interrupt for event STOPPED."]
#[must_use]
#[inline(always)]
pub const fn stopped(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event STOPPED."]
#[inline(always)]
pub const fn set_stopped(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enable or disable interrupt for event ERROR."]
#[must_use]
#[inline(always)]
pub const fn error(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event ERROR."]
#[inline(always)]
pub const fn set_error(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Enable or disable interrupt for event RXSTARTED."]
#[must_use]
#[inline(always)]
pub const fn rxstarted(&self) -> bool {
let val = (self.0 >> 19usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RXSTARTED."]
#[inline(always)]
pub const fn set_rxstarted(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
}
#[doc = "Enable or disable interrupt for event TXSTARTED."]
#[must_use]
#[inline(always)]
pub const fn txstarted(&self) -> bool {
let val = (self.0 >> 20usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event TXSTARTED."]
#[inline(always)]
pub const fn set_txstarted(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
}
#[doc = "Enable or disable interrupt for event WRITE."]
#[must_use]
#[inline(always)]
pub const fn write(&self) -> bool {
let val = (self.0 >> 25usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event WRITE."]
#[inline(always)]
pub const fn set_write(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize);
}
#[doc = "Enable or disable interrupt for event READ."]
#[must_use]
#[inline(always)]
pub const fn read(&self) -> bool {
let val = (self.0 >> 26usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event READ."]
#[inline(always)]
pub const fn set_read(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("stopped", &self.stopped())
.field("error", &self.error())
.field("rxstarted", &self.rxstarted())
.field("txstarted", &self.txstarted())
.field("write", &self.write())
.field("read", &self.read())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Int {{ stopped: {=bool:?}, error: {=bool:?}, rxstarted: {=bool:?}, txstarted: {=bool:?}, write: {=bool:?}, read: {=bool:?} }}" , self . stopped () , self . error () , self . rxstarted () , self . txstarted () , self . write () , self . read ())
}
}
#[doc = "Status register indicating which address had a match."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Match(pub u32);
impl Match {
#[doc = "Indication of which address in ADDRESS that matched the incoming address."]
#[must_use]
#[inline(always)]
pub const fn match_(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Indication of which address in ADDRESS that matched the incoming address."]
#[inline(always)]
pub const fn set_match_(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Match {
#[inline(always)]
fn default() -> Match {
Match(0)
}
}
impl core::fmt::Debug for Match {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Match")
.field("match_", &self.match_())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Match {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Match {{ match_: {=bool:?} }}", self.match_())
}
}
#[doc = "Over-read character. Character sent out in case of an over-read of the transmit buffer."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Orc(pub u32);
impl Orc {
#[doc = "Over-read character. Character sent out in case of an over-read of the transmit buffer."]
#[must_use]
#[inline(always)]
pub const fn orc(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Over-read character. Character sent out in case of an over-read of the transmit buffer."]
#[inline(always)]
pub const fn set_orc(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for Orc {
#[inline(always)]
fn default() -> Orc {
Orc(0)
}
}
impl core::fmt::Debug for Orc {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Orc").field("orc", &self.orc()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Orc {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Orc {{ orc: {=u8:?} }}", self.orc())
}
}
#[doc = "Number of bytes transferred in the last RXD transaction."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RxdAmount(pub u32);
impl RxdAmount {
#[doc = "Number of bytes transferred in the last RXD transaction."]
#[must_use]
#[inline(always)]
pub const fn amount(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Number of bytes transferred in the last RXD transaction."]
#[inline(always)]
pub const fn set_amount(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for RxdAmount {
#[inline(always)]
fn default() -> RxdAmount {
RxdAmount(0)
}
}
impl core::fmt::Debug for RxdAmount {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RxdAmount")
.field("amount", &self.amount())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RxdAmount {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "RxdAmount {{ amount: {=u16:?} }}", self.amount())
}
}
#[doc = "EasyDMA list type."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RxdList(pub u32);
impl RxdList {
#[doc = "List type."]
#[must_use]
#[inline(always)]
pub const fn list(&self) -> super::vals::RxdListList {
let val = (self.0 >> 0usize) & 0x03;
super::vals::RxdListList::from_bits(val as u8)
}
#[doc = "List type."]
#[inline(always)]
pub const fn set_list(&mut self, val: super::vals::RxdListList) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for RxdList {
#[inline(always)]
fn default() -> RxdList {
RxdList(0)
}
}
impl core::fmt::Debug for RxdList {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RxdList")
.field("list", &self.list())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RxdList {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "RxdList {{ list: {:?} }}", self.list())
}
}
#[doc = "Maximum number of bytes in RXD buffer."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RxdMaxcnt(pub u32);
impl RxdMaxcnt {
#[doc = "Maximum number of bytes in RXD buffer."]
#[must_use]
#[inline(always)]
pub const fn maxcnt(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Maximum number of bytes in RXD buffer."]
#[inline(always)]
pub const fn set_maxcnt(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for RxdMaxcnt {
#[inline(always)]
fn default() -> RxdMaxcnt {
RxdMaxcnt(0)
}
}
impl core::fmt::Debug for RxdMaxcnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RxdMaxcnt")
.field("maxcnt", &self.maxcnt())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RxdMaxcnt {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "RxdMaxcnt {{ maxcnt: {=u16:?} }}", self.maxcnt())
}
}
#[doc = "Shortcuts between local events and tasks."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Shorts(pub u32);
impl Shorts {
#[doc = "Shortcut between event WRITE and task SUSPEND."]
#[must_use]
#[inline(always)]
pub const fn write_suspend(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event WRITE and task SUSPEND."]
#[inline(always)]
pub const fn set_write_suspend(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "Shortcut between event READ and task SUSPEND."]
#[must_use]
#[inline(always)]
pub const fn read_suspend(&self) -> bool {
let val = (self.0 >> 14usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event READ and task SUSPEND."]
#[inline(always)]
pub const fn set_read_suspend(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
}
}
impl Default for Shorts {
#[inline(always)]
fn default() -> Shorts {
Shorts(0)
}
}
impl core::fmt::Debug for Shorts {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Shorts")
.field("write_suspend", &self.write_suspend())
.field("read_suspend", &self.read_suspend())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Shorts {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Shorts {{ write_suspend: {=bool:?}, read_suspend: {=bool:?} }}",
self.write_suspend(),
self.read_suspend()
)
}
}
#[doc = "Number of bytes transferred in the last TXD transaction."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TxdAmount(pub u32);
impl TxdAmount {
#[doc = "Number of bytes transferred in the last TXD transaction."]
#[must_use]
#[inline(always)]
pub const fn amount(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Number of bytes transferred in the last TXD transaction."]
#[inline(always)]
pub const fn set_amount(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for TxdAmount {
#[inline(always)]
fn default() -> TxdAmount {
TxdAmount(0)
}
}
impl core::fmt::Debug for TxdAmount {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TxdAmount")
.field("amount", &self.amount())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for TxdAmount {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "TxdAmount {{ amount: {=u16:?} }}", self.amount())
}
}
#[doc = "EasyDMA list type."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TxdList(pub u32);
impl TxdList {
#[doc = "List type."]
#[must_use]
#[inline(always)]
pub const fn list(&self) -> super::vals::TxdListList {
let val = (self.0 >> 0usize) & 0x03;
super::vals::TxdListList::from_bits(val as u8)
}
#[doc = "List type."]
#[inline(always)]
pub const fn set_list(&mut self, val: super::vals::TxdListList) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
}
impl Default for TxdList {
#[inline(always)]
fn default() -> TxdList {
TxdList(0)
}
}
impl core::fmt::Debug for TxdList {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TxdList")
.field("list", &self.list())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for TxdList {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "TxdList {{ list: {:?} }}", self.list())
}
}
#[doc = "Maximum number of bytes in TXD buffer."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TxdMaxcnt(pub u32);
impl TxdMaxcnt {
#[doc = "Maximum number of bytes in TXD buffer."]
#[must_use]
#[inline(always)]
pub const fn maxcnt(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Maximum number of bytes in TXD buffer."]
#[inline(always)]
pub const fn set_maxcnt(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for TxdMaxcnt {
#[inline(always)]
fn default() -> TxdMaxcnt {
TxdMaxcnt(0)
}
}
impl core::fmt::Debug for TxdMaxcnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TxdMaxcnt")
.field("maxcnt", &self.maxcnt())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for TxdMaxcnt {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "TxdMaxcnt {{ maxcnt: {=u16:?} }}", self.maxcnt())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Enable {
#[doc = "Disable TWIS."]
Disabled = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
#[doc = "Enable TWIS."]
Enabled = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Enable {
#[inline(always)]
pub const fn from_bits(val: u8) -> Enable {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Enable {
#[inline(always)]
fn from(val: u8) -> Enable {
Enable::from_bits(val)
}
}
impl From<Enable> for u8 {
#[inline(always)]
fn from(val: Enable) -> u8 {
Enable::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RxdListList {
#[doc = "Disable EasyDMA list."]
Disabled = 0x0,
#[doc = "Use array list."]
ArrayList = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
}
impl RxdListList {
#[inline(always)]
pub const fn from_bits(val: u8) -> RxdListList {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for RxdListList {
#[inline(always)]
fn from(val: u8) -> RxdListList {
RxdListList::from_bits(val)
}
}
impl From<RxdListList> for u8 {
#[inline(always)]
fn from(val: RxdListList) -> u8 {
RxdListList::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum TxdListList {
#[doc = "Disable EasyDMA list."]
Disabled = 0x0,
#[doc = "Use array list."]
ArrayList = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
}
impl TxdListList {
#[inline(always)]
pub const fn from_bits(val: u8) -> TxdListList {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for TxdListList {
#[inline(always)]
fn from(val: u8) -> TxdListList {
TxdListList::from_bits(val)
}
}
impl From<TxdListList> for u8 {
#[inline(always)]
fn from(val: TxdListList) -> u8 {
TxdListList::to_bits(val)
}
}
}
}
pub mod uarte {
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Dma {
ptr: *mut u8,
}
unsafe impl Send for Dma {}
unsafe impl Sync for Dma {}
impl Dma {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "RXD EasyDMA channel."]
#[inline(always)]
pub const fn rx(self) -> DmaRx {
unsafe { DmaRx::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "TXD EasyDMA channel."]
#[inline(always)]
pub const fn tx(self) -> DmaTx {
unsafe { DmaTx::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
}
#[doc = "RXD EasyDMA channel."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DmaRx {
ptr: *mut u8,
}
unsafe impl Send for DmaRx {}
unsafe impl Sync for DmaRx {}
impl DmaRx {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Data pointer."]
#[inline(always)]
pub const fn ptr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Maximum number of bytes in receive buffer."]
#[inline(always)]
pub const fn maxcnt(self) -> crate::common::Reg<regs::RxdMaxcnt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Number of bytes transferred in the last transaction."]
#[inline(always)]
pub const fn amount(self) -> crate::common::Reg<regs::RxdAmount, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
}
#[doc = "TXD EasyDMA channel."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DmaTx {
ptr: *mut u8,
}
unsafe impl Send for DmaTx {}
unsafe impl Sync for DmaTx {}
impl DmaTx {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Data pointer."]
#[inline(always)]
pub const fn ptr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Maximum number of bytes in transmit buffer."]
#[inline(always)]
pub const fn maxcnt(self) -> crate::common::Reg<regs::TxdMaxcnt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Number of bytes transferred in the last transaction."]
#[inline(always)]
pub const fn amount(self) -> crate::common::Reg<regs::TxdAmount, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct EventsDma {
ptr: *mut u8,
}
unsafe impl Send for EventsDma {}
unsafe impl Sync for EventsDma {}
impl EventsDma {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[inline(always)]
pub const fn rx(self) -> EventsDmaRx {
unsafe { EventsDmaRx::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[inline(always)]
pub const fn tx(self) -> EventsDmaTx {
unsafe { EventsDmaTx::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct EventsDmaRx {
ptr: *mut u8,
}
unsafe impl Send for EventsDmaRx {}
unsafe impl Sync for EventsDmaRx {}
impl EventsDmaRx {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Receive buffer is filled up."]
#[inline(always)]
pub const fn end(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "UART receiver has started."]
#[inline(always)]
pub const fn ready(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x3cusize) as _) }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct EventsDmaTx {
ptr: *mut u8,
}
unsafe impl Send for EventsDmaTx {}
unsafe impl Sync for EventsDmaTx {}
impl EventsDmaTx {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Last TX byte transmitted."]
#[inline(always)]
pub const fn end(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "UART transmitter has started."]
#[inline(always)]
pub const fn ready(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x30usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Psel {
ptr: *mut u8,
}
unsafe impl Send for Psel {}
unsafe impl Sync for Psel {}
impl Psel {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Pin select for RTS signal."]
#[inline(always)]
pub const fn rts(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Pin select for TXD signal."]
#[inline(always)]
pub const fn txd(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Pin select for CTS signal."]
#[inline(always)]
pub const fn cts(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
#[doc = "Pin select for RXD signal."]
#[inline(always)]
pub const fn rxd(self) -> crate::common::Reg<super::shared::regs::Psel, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0cusize) as _) }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TasksDma {
ptr: *mut u8,
}
unsafe impl Send for TasksDma {}
unsafe impl Sync for TasksDma {}
impl TasksDma {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[inline(always)]
pub const fn rx(self) -> TasksDmaRx {
unsafe { TasksDmaRx::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[inline(always)]
pub const fn tx(self) -> TasksDmaTx {
unsafe { TasksDmaTx::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TasksDmaRx {
ptr: *mut u8,
}
unsafe impl Send for TasksDmaRx {}
unsafe impl Sync for TasksDmaRx {}
impl TasksDmaRx {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Start UART receiver."]
#[inline(always)]
pub const fn start(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Stop UART receiver."]
#[inline(always)]
pub const fn stop(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TasksDmaTx {
ptr: *mut u8,
}
unsafe impl Send for TasksDmaTx {}
unsafe impl Sync for TasksDmaTx {}
impl TasksDmaTx {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Start UART transmitter."]
#[inline(always)]
pub const fn start(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Stop UART transmitter."]
#[inline(always)]
pub const fn stop(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
#[doc = "UART with EasyDMA 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Uarte {
ptr: *mut u8,
}
unsafe impl Send for Uarte {}
unsafe impl Sync for Uarte {}
impl Uarte {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[inline(always)]
pub const fn tasks_dma(self) -> TasksDma {
unsafe { TasksDma::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Flush RX FIFO into RX buffer."]
#[inline(always)]
pub const fn tasks_flushrx(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x2cusize) as _) }
}
#[doc = "Subscribe configuration for task STARTRX."]
#[inline(always)]
pub const fn subscribe_startrx(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x80usize) as _) }
}
#[doc = "Subscribe configuration for task STOPRX."]
#[inline(always)]
pub const fn subscribe_stoprx(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x84usize) as _) }
}
#[doc = "Subscribe configuration for task STARTTX."]
#[inline(always)]
pub const fn subscribe_starttx(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x88usize) as _) }
}
#[doc = "Subscribe configuration for task STOPTX."]
#[inline(always)]
pub const fn subscribe_stoptx(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x8cusize) as _) }
}
#[doc = "Subscribe configuration for task FLUSHRX."]
#[inline(always)]
pub const fn subscribe_flushrx(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xacusize) as _) }
}
#[doc = "CTS is activated (set low). Clear To Send."]
#[inline(always)]
pub const fn events_cts(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0100usize) as _) }
}
#[doc = "CTS is deactivated (set high). Not Clear To Send."]
#[inline(always)]
pub const fn events_ncts(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0104usize) as _) }
}
#[doc = "Data received in RXD (but potentially not yet transferred to Data RAM)."]
#[inline(always)]
pub const fn events_rxdrdy(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0108usize) as _) }
}
#[inline(always)]
pub const fn events_dma(self) -> EventsDma {
unsafe { EventsDma::from_ptr(self.ptr.wrapping_add(0x0110usize) as _) }
}
#[doc = "Data sent from TXD."]
#[inline(always)]
pub const fn events_txdrdy(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x011cusize) as _) }
}
#[doc = "Error detected."]
#[inline(always)]
pub const fn events_error(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0124usize) as _) }
}
#[doc = "Receiver timeout."]
#[inline(always)]
pub const fn events_rxto(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0144usize) as _) }
}
#[doc = "Transmitter stopped."]
#[inline(always)]
pub const fn events_txstopped(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0158usize) as _) }
}
#[doc = "Publish configuration for event CTS."]
#[inline(always)]
pub const fn publish_cts(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0180usize) as _) }
}
#[doc = "Publish configuration for event NCTS."]
#[inline(always)]
pub const fn publish_ncts(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0184usize) as _) }
}
#[doc = "Publish configuration for event RXDRDY."]
#[inline(always)]
pub const fn publish_rxdrdy(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0188usize) as _) }
}
#[doc = "Publish configuration for event ENDRX."]
#[inline(always)]
pub const fn publish_endrx(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0190usize) as _) }
}
#[doc = "Publish configuration for event TXDRDY."]
#[inline(always)]
pub const fn publish_txdrdy(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x019cusize) as _) }
}
#[doc = "Publish configuration for event ENDTX."]
#[inline(always)]
pub const fn publish_endtx(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01a0usize) as _) }
}
#[doc = "Publish configuration for event ERROR."]
#[inline(always)]
pub const fn publish_error(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01a4usize) as _) }
}
#[doc = "Publish configuration for event RXTO."]
#[inline(always)]
pub const fn publish_rxto(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01c4usize) as _) }
}
#[doc = "Publish configuration for event RXSTARTED."]
#[inline(always)]
pub const fn publish_rxstarted(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01ccusize) as _) }
}
#[doc = "Publish configuration for event TXSTARTED."]
#[inline(always)]
pub const fn publish_txstarted(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01d0usize) as _) }
}
#[doc = "Publish configuration for event TXSTOPPED."]
#[inline(always)]
pub const fn publish_txstopped(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01d8usize) as _) }
}
#[doc = "Shortcuts between local events and tasks."]
#[inline(always)]
pub const fn shorts(self) -> crate::common::Reg<regs::Shorts, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0200usize) as _) }
}
#[doc = "Enable or disable interrupt."]
#[inline(always)]
pub const fn inten(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0300usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "Error source."]
#[inline(always)]
pub const fn errorsrc(self) -> crate::common::Reg<regs::Errorsrc, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0480usize) as _) }
}
#[doc = "Enable UART."]
#[inline(always)]
pub const fn enable(self) -> crate::common::Reg<regs::Enable, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0500usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn psel(self) -> Psel {
unsafe { Psel::from_ptr(self.ptr.wrapping_add(0x0508usize) as _) }
}
#[doc = "Baud rate. Accuracy depends on the HFCLK source selected."]
#[inline(always)]
pub const fn baudrate(self) -> crate::common::Reg<regs::Baudrate, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0524usize) as _) }
}
#[inline(always)]
pub const fn dma(self) -> Dma {
unsafe { Dma::from_ptr(self.ptr.wrapping_add(0x0534usize) as _) }
}
#[doc = "Configuration of parity and hardware flow control."]
#[inline(always)]
pub const fn config(self) -> crate::common::Reg<regs::Config, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x056cusize) as _) }
}
}
pub mod regs {
#[doc = "Baud rate. Accuracy depends on the HFCLK source selected."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Baudrate(pub u32);
impl Baudrate {
#[doc = "Baud rate."]
#[must_use]
#[inline(always)]
pub const fn baudrate(&self) -> super::vals::Baudrate {
let val = (self.0 >> 0usize) & 0xffff_ffff;
super::vals::Baudrate::from_bits(val as u32)
}
#[doc = "Baud rate."]
#[inline(always)]
pub const fn set_baudrate(&mut self, val: super::vals::Baudrate) {
self.0 = (self.0 & !(0xffff_ffff << 0usize))
| (((val.to_bits() as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Baudrate {
#[inline(always)]
fn default() -> Baudrate {
Baudrate(0)
}
}
impl core::fmt::Debug for Baudrate {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Baudrate")
.field("baudrate", &self.baudrate())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Baudrate {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Baudrate {{ baudrate: {:?} }}", self.baudrate())
}
}
#[doc = "Configuration of parity and hardware flow control."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Config(pub u32);
impl Config {
#[doc = "Hardware flow control."]
#[must_use]
#[inline(always)]
pub const fn hwfc(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Hardware flow control."]
#[inline(always)]
pub const fn set_hwfc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Parity."]
#[must_use]
#[inline(always)]
pub const fn parity(&self) -> super::vals::ConfigParity {
let val = (self.0 >> 1usize) & 0x07;
super::vals::ConfigParity::from_bits(val as u8)
}
#[doc = "Parity."]
#[inline(always)]
pub const fn set_parity(&mut self, val: super::vals::ConfigParity) {
self.0 = (self.0 & !(0x07 << 1usize)) | (((val.to_bits() as u32) & 0x07) << 1usize);
}
#[doc = "Stop bits."]
#[must_use]
#[inline(always)]
pub const fn stop(&self) -> super::vals::Stop {
let val = (self.0 >> 4usize) & 0x01;
super::vals::Stop::from_bits(val as u8)
}
#[doc = "Stop bits."]
#[inline(always)]
pub const fn set_stop(&mut self, val: super::vals::Stop) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val.to_bits() as u32) & 0x01) << 4usize);
}
#[doc = "Even or odd parity type."]
#[must_use]
#[inline(always)]
pub const fn paritytype(&self) -> super::vals::Paritytype {
let val = (self.0 >> 8usize) & 0x01;
super::vals::Paritytype::from_bits(val as u8)
}
#[doc = "Even or odd parity type."]
#[inline(always)]
pub const fn set_paritytype(&mut self, val: super::vals::Paritytype) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val.to_bits() as u32) & 0x01) << 8usize);
}
}
impl Default for Config {
#[inline(always)]
fn default() -> Config {
Config(0)
}
}
impl core::fmt::Debug for Config {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Config")
.field("hwfc", &self.hwfc())
.field("parity", &self.parity())
.field("stop", &self.stop())
.field("paritytype", &self.paritytype())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Config {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Config {{ hwfc: {=bool:?}, parity: {:?}, stop: {:?}, paritytype: {:?} }}",
self.hwfc(),
self.parity(),
self.stop(),
self.paritytype()
)
}
}
#[doc = "Enable UART."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Enable(pub u32);
impl Enable {
#[doc = "Enable or disable UARTE."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> super::vals::Enable {
let val = (self.0 >> 0usize) & 0x0f;
super::vals::Enable::from_bits(val as u8)
}
#[doc = "Enable or disable UARTE."]
#[inline(always)]
pub const fn set_enable(&mut self, val: super::vals::Enable) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val.to_bits() as u32) & 0x0f) << 0usize);
}
}
impl Default for Enable {
#[inline(always)]
fn default() -> Enable {
Enable(0)
}
}
impl core::fmt::Debug for Enable {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Enable")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Enable {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Enable {{ enable: {:?} }}", self.enable())
}
}
#[doc = "Error source."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Errorsrc(pub u32);
impl Errorsrc {
#[doc = "Overrun error."]
#[must_use]
#[inline(always)]
pub const fn overrun(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Overrun error."]
#[inline(always)]
pub const fn set_overrun(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Parity error."]
#[must_use]
#[inline(always)]
pub const fn parity(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Parity error."]
#[inline(always)]
pub const fn set_parity(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Framing error occurred."]
#[must_use]
#[inline(always)]
pub const fn framing(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Framing error occurred."]
#[inline(always)]
pub const fn set_framing(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Break condition."]
#[must_use]
#[inline(always)]
pub const fn break_(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Break condition."]
#[inline(always)]
pub const fn set_break_(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
}
impl Default for Errorsrc {
#[inline(always)]
fn default() -> Errorsrc {
Errorsrc(0)
}
}
impl core::fmt::Debug for Errorsrc {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Errorsrc")
.field("overrun", &self.overrun())
.field("parity", &self.parity())
.field("framing", &self.framing())
.field("break_", &self.break_())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Errorsrc {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Errorsrc {{ overrun: {=bool:?}, parity: {=bool:?}, framing: {=bool:?}, break_: {=bool:?} }}" , self . overrun () , self . parity () , self . framing () , self . break_ ())
}
}
#[doc = "Enable or disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Enable or disable interrupt for event CTS."]
#[must_use]
#[inline(always)]
pub const fn cts(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event CTS."]
#[inline(always)]
pub const fn set_cts(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Enable or disable interrupt for event NCTS."]
#[must_use]
#[inline(always)]
pub const fn ncts(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event NCTS."]
#[inline(always)]
pub const fn set_ncts(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enable or disable interrupt for event RXDRDY."]
#[must_use]
#[inline(always)]
pub const fn rxdrdy(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RXDRDY."]
#[inline(always)]
pub const fn set_rxdrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Enable or disable interrupt for event ENDRX."]
#[must_use]
#[inline(always)]
pub const fn dmarxend(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event ENDRX."]
#[inline(always)]
pub const fn set_dmarxend(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Enable or disable interrupt for event TXDRDY."]
#[must_use]
#[inline(always)]
pub const fn txdrdy(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event TXDRDY."]
#[inline(always)]
pub const fn set_txdrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Enable or disable interrupt for event ENDTX."]
#[must_use]
#[inline(always)]
pub const fn dmatxend(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event ENDTX."]
#[inline(always)]
pub const fn set_dmatxend(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "Enable or disable interrupt for event ERROR."]
#[must_use]
#[inline(always)]
pub const fn error(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event ERROR."]
#[inline(always)]
pub const fn set_error(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Enable or disable interrupt for event RXTO."]
#[must_use]
#[inline(always)]
pub const fn rxto(&self) -> bool {
let val = (self.0 >> 17usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RXTO."]
#[inline(always)]
pub const fn set_rxto(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
}
#[doc = "Enable or disable interrupt for event RXSTARTED."]
#[must_use]
#[inline(always)]
pub const fn dmarxready(&self) -> bool {
let val = (self.0 >> 19usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event RXSTARTED."]
#[inline(always)]
pub const fn set_dmarxready(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
}
#[doc = "Enable or disable interrupt for event TXSTARTED."]
#[must_use]
#[inline(always)]
pub const fn dmatxready(&self) -> bool {
let val = (self.0 >> 20usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event TXSTARTED."]
#[inline(always)]
pub const fn set_dmatxready(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
}
#[doc = "Enable or disable interrupt for event TXSTOPPED."]
#[must_use]
#[inline(always)]
pub const fn txstopped(&self) -> bool {
let val = (self.0 >> 22usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event TXSTOPPED."]
#[inline(always)]
pub const fn set_txstopped(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 22usize)) | (((val as u32) & 0x01) << 22usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("cts", &self.cts())
.field("ncts", &self.ncts())
.field("rxdrdy", &self.rxdrdy())
.field("dmarxend", &self.dmarxend())
.field("txdrdy", &self.txdrdy())
.field("dmatxend", &self.dmatxend())
.field("error", &self.error())
.field("rxto", &self.rxto())
.field("dmarxready", &self.dmarxready())
.field("dmatxready", &self.dmatxready())
.field("txstopped", &self.txstopped())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Int {{ cts: {=bool:?}, ncts: {=bool:?}, rxdrdy: {=bool:?}, dmarxend: {=bool:?}, txdrdy: {=bool:?}, dmatxend: {=bool:?}, error: {=bool:?}, rxto: {=bool:?}, dmarxready: {=bool:?}, dmatxready: {=bool:?}, txstopped: {=bool:?} }}" , self . cts () , self . ncts () , self . rxdrdy () , self . dmarxend () , self . txdrdy () , self . dmatxend () , self . error () , self . rxto () , self . dmarxready () , self . dmatxready () , self . txstopped ())
}
}
#[doc = "Number of bytes transferred in the last transaction."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RxdAmount(pub u32);
impl RxdAmount {
#[doc = "Number of bytes transferred in the last transaction."]
#[must_use]
#[inline(always)]
pub const fn amount(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Number of bytes transferred in the last transaction."]
#[inline(always)]
pub const fn set_amount(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for RxdAmount {
#[inline(always)]
fn default() -> RxdAmount {
RxdAmount(0)
}
}
impl core::fmt::Debug for RxdAmount {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RxdAmount")
.field("amount", &self.amount())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RxdAmount {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "RxdAmount {{ amount: {=u16:?} }}", self.amount())
}
}
#[doc = "Maximum number of bytes in receive buffer."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RxdMaxcnt(pub u32);
impl RxdMaxcnt {
#[doc = "Maximum number of bytes in receive buffer."]
#[must_use]
#[inline(always)]
pub const fn maxcnt(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Maximum number of bytes in receive buffer."]
#[inline(always)]
pub const fn set_maxcnt(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for RxdMaxcnt {
#[inline(always)]
fn default() -> RxdMaxcnt {
RxdMaxcnt(0)
}
}
impl core::fmt::Debug for RxdMaxcnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RxdMaxcnt")
.field("maxcnt", &self.maxcnt())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for RxdMaxcnt {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "RxdMaxcnt {{ maxcnt: {=u16:?} }}", self.maxcnt())
}
}
#[doc = "Shortcuts between local events and tasks."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Shorts(pub u32);
impl Shorts {
#[doc = "Shortcut between event ENDRX and task STARTRX."]
#[must_use]
#[inline(always)]
pub const fn endrx_startrx(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event ENDRX and task STARTRX."]
#[inline(always)]
pub const fn set_endrx_startrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Shortcut between event ENDRX and task STOPRX."]
#[must_use]
#[inline(always)]
pub const fn endrx_stoprx(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event ENDRX and task STOPRX."]
#[inline(always)]
pub const fn set_endrx_stoprx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
}
impl Default for Shorts {
#[inline(always)]
fn default() -> Shorts {
Shorts(0)
}
}
impl core::fmt::Debug for Shorts {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Shorts")
.field("endrx_startrx", &self.endrx_startrx())
.field("endrx_stoprx", &self.endrx_stoprx())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Shorts {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Shorts {{ endrx_startrx: {=bool:?}, endrx_stoprx: {=bool:?} }}",
self.endrx_startrx(),
self.endrx_stoprx()
)
}
}
#[doc = "Number of bytes transferred in the last transaction."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TxdAmount(pub u32);
impl TxdAmount {
#[doc = "Number of bytes transferred in the last transaction."]
#[must_use]
#[inline(always)]
pub const fn amount(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Number of bytes transferred in the last transaction."]
#[inline(always)]
pub const fn set_amount(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for TxdAmount {
#[inline(always)]
fn default() -> TxdAmount {
TxdAmount(0)
}
}
impl core::fmt::Debug for TxdAmount {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TxdAmount")
.field("amount", &self.amount())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for TxdAmount {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "TxdAmount {{ amount: {=u16:?} }}", self.amount())
}
}
#[doc = "Maximum number of bytes in transmit buffer."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct TxdMaxcnt(pub u32);
impl TxdMaxcnt {
#[doc = "Maximum number of bytes in transmit buffer."]
#[must_use]
#[inline(always)]
pub const fn maxcnt(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Maximum number of bytes in transmit buffer."]
#[inline(always)]
pub const fn set_maxcnt(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for TxdMaxcnt {
#[inline(always)]
fn default() -> TxdMaxcnt {
TxdMaxcnt(0)
}
}
impl core::fmt::Debug for TxdMaxcnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TxdMaxcnt")
.field("maxcnt", &self.maxcnt())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for TxdMaxcnt {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "TxdMaxcnt {{ maxcnt: {=u16:?} }}", self.maxcnt())
}
}
}
pub mod vals {
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Baudrate(u32);
impl Baudrate {
#[doc = "1200 baud (actual rate: 1205)."]
pub const Baud1200: Self = Self(0x0004_f000);
#[doc = "2400 baud (actual rate: 2396)."]
pub const Baud2400: Self = Self(0x0009_d000);
#[doc = "4800 baud (actual rate: 4808)."]
pub const Baud4800: Self = Self(0x0013_b000);
#[doc = "9600 baud (actual rate: 9598)."]
pub const Baud9600: Self = Self(0x0027_5000);
#[doc = "14400 baud (actual rate: 14401)."]
pub const Baud14400: Self = Self(0x003a_f000);
#[doc = "19200 baud (actual rate: 19208)."]
pub const Baud19200: Self = Self(0x004e_a000);
#[doc = "28800 baud (actual rate: 28777)."]
pub const Baud28800: Self = Self(0x0075_c000);
#[doc = "31250 baud."]
pub const Baud31250: Self = Self(0x0080_0000);
#[doc = "38400 baud (actual rate: 38369)."]
pub const Baud38400: Self = Self(0x009d_0000);
#[doc = "56000 baud (actual rate: 55944)."]
pub const Baud56000: Self = Self(0x00e5_0000);
#[doc = "57600 baud (actual rate: 57554)."]
pub const Baud57600: Self = Self(0x00eb_0000);
#[doc = "76800 baud (actual rate: 76923)."]
pub const Baud76800: Self = Self(0x013a_9000);
#[doc = "115200 baud (actual rate: 115108)."]
pub const Baud115200: Self = Self(0x01d6_0000);
#[doc = "230400 baud (actual rate: 231884)."]
pub const Baud230400: Self = Self(0x03b0_0000);
#[doc = "250000 baud."]
pub const Baud250000: Self = Self(0x0400_0000);
#[doc = "460800 baud (actual rate: 457143)."]
pub const Baud460800: Self = Self(0x0740_0000);
#[doc = "921600 baud (actual rate: 941176)."]
pub const Baud921600: Self = Self(0x0f00_0000);
#[doc = "1 megabaud."]
pub const Baud1m: Self = Self(0x1000_0000);
}
impl Baudrate {
pub const fn from_bits(val: u32) -> Baudrate {
Self(val & 0xffff_ffff)
}
pub const fn to_bits(self) -> u32 {
self.0
}
}
impl core::fmt::Debug for Baudrate {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x0004_f000 => f.write_str("Baud1200"),
0x0009_d000 => f.write_str("Baud2400"),
0x0013_b000 => f.write_str("Baud4800"),
0x0027_5000 => f.write_str("Baud9600"),
0x003a_f000 => f.write_str("Baud14400"),
0x004e_a000 => f.write_str("Baud19200"),
0x0075_c000 => f.write_str("Baud28800"),
0x0080_0000 => f.write_str("Baud31250"),
0x009d_0000 => f.write_str("Baud38400"),
0x00e5_0000 => f.write_str("Baud56000"),
0x00eb_0000 => f.write_str("Baud57600"),
0x013a_9000 => f.write_str("Baud76800"),
0x01d6_0000 => f.write_str("Baud115200"),
0x03b0_0000 => f.write_str("Baud230400"),
0x0400_0000 => f.write_str("Baud250000"),
0x0740_0000 => f.write_str("Baud460800"),
0x0f00_0000 => f.write_str("Baud921600"),
0x1000_0000 => f.write_str("Baud1m"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Baudrate {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x0004_f000 => defmt::write!(f, "Baud1200"),
0x0009_d000 => defmt::write!(f, "Baud2400"),
0x0013_b000 => defmt::write!(f, "Baud4800"),
0x0027_5000 => defmt::write!(f, "Baud9600"),
0x003a_f000 => defmt::write!(f, "Baud14400"),
0x004e_a000 => defmt::write!(f, "Baud19200"),
0x0075_c000 => defmt::write!(f, "Baud28800"),
0x0080_0000 => defmt::write!(f, "Baud31250"),
0x009d_0000 => defmt::write!(f, "Baud38400"),
0x00e5_0000 => defmt::write!(f, "Baud56000"),
0x00eb_0000 => defmt::write!(f, "Baud57600"),
0x013a_9000 => defmt::write!(f, "Baud76800"),
0x01d6_0000 => defmt::write!(f, "Baud115200"),
0x03b0_0000 => defmt::write!(f, "Baud230400"),
0x0400_0000 => defmt::write!(f, "Baud250000"),
0x0740_0000 => defmt::write!(f, "Baud460800"),
0x0f00_0000 => defmt::write!(f, "Baud921600"),
0x1000_0000 => defmt::write!(f, "Baud1m"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u32> for Baudrate {
#[inline(always)]
fn from(val: u32) -> Baudrate {
Baudrate::from_bits(val)
}
}
impl From<Baudrate> for u32 {
#[inline(always)]
fn from(val: Baudrate) -> u32 {
Baudrate::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum ConfigParity {
#[doc = "Exclude parity bit."]
Excluded = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
#[doc = "Include even parity bit."]
Included = 0x07,
}
impl ConfigParity {
#[inline(always)]
pub const fn from_bits(val: u8) -> ConfigParity {
unsafe { core::mem::transmute(val & 0x07) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for ConfigParity {
#[inline(always)]
fn from(val: u8) -> ConfigParity {
ConfigParity::from_bits(val)
}
}
impl From<ConfigParity> for u8 {
#[inline(always)]
fn from(val: ConfigParity) -> u8 {
ConfigParity::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Enable {
#[doc = "Disable UARTE."]
Disabled = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
#[doc = "Enable UARTE."]
Enabled = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
}
impl Enable {
#[inline(always)]
pub const fn from_bits(val: u8) -> Enable {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Enable {
#[inline(always)]
fn from(val: u8) -> Enable {
Enable::from_bits(val)
}
}
impl From<Enable> for u8 {
#[inline(always)]
fn from(val: Enable) -> u8 {
Enable::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Paritytype {
#[doc = "Even parity."]
Even = 0x0,
#[doc = "Odd parity."]
Odd = 0x01,
}
impl Paritytype {
#[inline(always)]
pub const fn from_bits(val: u8) -> Paritytype {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Paritytype {
#[inline(always)]
fn from(val: u8) -> Paritytype {
Paritytype::from_bits(val)
}
}
impl From<Paritytype> for u8 {
#[inline(always)]
fn from(val: Paritytype) -> u8 {
Paritytype::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Stop {
#[doc = "One stop bit."]
One = 0x0,
#[doc = "Two stop bits."]
Two = 0x01,
}
impl Stop {
#[inline(always)]
pub const fn from_bits(val: u8) -> Stop {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Stop {
#[inline(always)]
fn from(val: u8) -> Stop {
Stop::from_bits(val)
}
}
impl From<Stop> for u8 {
#[inline(always)]
fn from(val: Stop) -> u8 {
Stop::to_bits(val)
}
}
}
}
pub mod uicr {
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Config {
ptr: *mut u8,
}
unsafe impl Send for Config {}
unsafe impl Sync for Config {}
impl Config {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: Destination address where content of the key value registers (KEYSLOT.KEYn.VALUE\\[0-3\\]) will be pushed by KMU. Note that this address must match that of a peripherals APB mapped write-only key registers, else the KMU can push this key value into an address range which the CPU can potentially read."]
#[inline(always)]
pub const fn dest(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Description cluster: Define permissions for the key slot. Bits 0-15 and 16-31 can only be written when equal to 0xFFFF."]
#[inline(always)]
pub const fn perm(self) -> crate::common::Reg<regs::Perm, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Key {
ptr: *mut u8,
}
unsafe impl Send for Key {}
unsafe impl Sync for Key {}
impl Key {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description collection: Define bits \\[31+o*32:0+o*32\\] of value assigned to KMU key slot."]
#[inline(always)]
pub const fn value(self, n: usize) -> crate::common::Reg<u32, crate::common::RW> {
assert!(n < 4usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize + n * 4usize) as _)
}
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Keyslot {
ptr: *mut u8,
}
unsafe impl Send for Keyslot {}
unsafe impl Sync for Keyslot {}
impl Keyslot {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn config(self, n: usize) -> Config {
assert!(n < 128usize);
unsafe { Config::from_ptr(self.ptr.wrapping_add(0x0usize + n * 8usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn key(self, n: usize) -> Key {
assert!(n < 128usize);
unsafe { Key::from_ptr(self.ptr.wrapping_add(0x0400usize + n * 16usize) as _) }
}
}
#[doc = "User Information Configuration Registers User information configuration registers."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Uicr {
ptr: *mut u8,
}
unsafe impl Send for Uicr {}
unsafe impl Sync for Uicr {}
impl Uicr {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Access port protection."]
#[inline(always)]
pub const fn approtect(self) -> crate::common::Reg<regs::Approtect, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Output voltage from the high voltage (VREGH) regulator stage. The maximum output voltage from this stage is given as VDDH - VREGHDROP."]
#[inline(always)]
pub const fn vreghvout(self) -> crate::common::Reg<regs::Vreghvout, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x10usize) as _) }
}
#[doc = "HFXO startup counter."]
#[inline(always)]
pub const fn hfxocnt(self) -> crate::common::Reg<regs::Hfxocnt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x14usize) as _) }
}
#[doc = "Secure access port protection."]
#[inline(always)]
pub const fn secureapprotect(
self,
) -> crate::common::Reg<regs::Secureapprotect, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x1cusize) as _) }
}
#[doc = "Erase protection."]
#[inline(always)]
pub const fn eraseprotect(
self,
) -> crate::common::Reg<regs::Eraseprotect, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x20usize) as _) }
}
#[doc = "SW-DP Target instance."]
#[inline(always)]
pub const fn tinstance(self) -> crate::common::Reg<regs::Tinstance, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x24usize) as _) }
}
#[doc = "Setting of pins dedicated to NFC functionality: NFC antenna or GPIO."]
#[inline(always)]
pub const fn nfcpins(self) -> crate::common::Reg<regs::Nfcpins, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x28usize) as _) }
}
#[doc = "Description collection: One time programmable memory."]
#[inline(always)]
pub const fn otp(self, n: usize) -> crate::common::Reg<regs::Otp, crate::common::RW> {
assert!(n < 192usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0100usize + n * 4usize) as _)
}
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn keyslot(self) -> Keyslot {
unsafe { Keyslot::from_ptr(self.ptr.wrapping_add(0x0400usize) as _) }
}
}
pub mod regs {
#[doc = "Access port protection."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Approtect(pub u32);
impl Approtect {
#[doc = "Blocks debugger read/write access to all CPU registers and memory mapped addresses."]
#[must_use]
#[inline(always)]
pub const fn pall(&self) -> super::vals::ApprotectPall {
let val = (self.0 >> 0usize) & 0xffff_ffff;
super::vals::ApprotectPall::from_bits(val as u32)
}
#[doc = "Blocks debugger read/write access to all CPU registers and memory mapped addresses."]
#[inline(always)]
pub const fn set_pall(&mut self, val: super::vals::ApprotectPall) {
self.0 = (self.0 & !(0xffff_ffff << 0usize))
| (((val.to_bits() as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Approtect {
#[inline(always)]
fn default() -> Approtect {
Approtect(0)
}
}
impl core::fmt::Debug for Approtect {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Approtect")
.field("pall", &self.pall())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Approtect {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Approtect {{ pall: {:?} }}", self.pall())
}
}
#[doc = "Erase protection."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Eraseprotect(pub u32);
impl Eraseprotect {
#[doc = "Blocks NVMC ERASEALL and CTRLAP ERASEALL functionality. Using any value except Unprotected will lead to the protection being enabled."]
#[must_use]
#[inline(always)]
pub const fn pall(&self) -> super::vals::EraseprotectPall {
let val = (self.0 >> 0usize) & 0xffff_ffff;
super::vals::EraseprotectPall::from_bits(val as u32)
}
#[doc = "Blocks NVMC ERASEALL and CTRLAP ERASEALL functionality. Using any value except Unprotected will lead to the protection being enabled."]
#[inline(always)]
pub const fn set_pall(&mut self, val: super::vals::EraseprotectPall) {
self.0 = (self.0 & !(0xffff_ffff << 0usize))
| (((val.to_bits() as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Eraseprotect {
#[inline(always)]
fn default() -> Eraseprotect {
Eraseprotect(0)
}
}
impl core::fmt::Debug for Eraseprotect {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Eraseprotect")
.field("pall", &self.pall())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Eraseprotect {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Eraseprotect {{ pall: {:?} }}", self.pall())
}
}
#[doc = "HFXO startup counter."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Hfxocnt(pub u32);
impl Hfxocnt {
#[doc = "HFXO startup counter. Total debounce time = HFXOCNT*64 us + 0.5 us."]
#[must_use]
#[inline(always)]
pub const fn hfxocnt(&self) -> super::vals::Hfxocnt {
let val = (self.0 >> 0usize) & 0xff;
super::vals::Hfxocnt::from_bits(val as u8)
}
#[doc = "HFXO startup counter. Total debounce time = HFXOCNT*64 us + 0.5 us."]
#[inline(always)]
pub const fn set_hfxocnt(&mut self, val: super::vals::Hfxocnt) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val.to_bits() as u32) & 0xff) << 0usize);
}
}
impl Default for Hfxocnt {
#[inline(always)]
fn default() -> Hfxocnt {
Hfxocnt(0)
}
}
impl core::fmt::Debug for Hfxocnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Hfxocnt")
.field("hfxocnt", &self.hfxocnt())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Hfxocnt {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Hfxocnt {{ hfxocnt: {:?} }}", self.hfxocnt())
}
}
#[doc = "Setting of pins dedicated to NFC functionality: NFC antenna or GPIO."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Nfcpins(pub u32);
impl Nfcpins {
#[doc = "Setting of pins dedicated to NFC functionality."]
#[must_use]
#[inline(always)]
pub const fn protect(&self) -> super::vals::Protect {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Protect::from_bits(val as u8)
}
#[doc = "Setting of pins dedicated to NFC functionality."]
#[inline(always)]
pub const fn set_protect(&mut self, val: super::vals::Protect) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Nfcpins {
#[inline(always)]
fn default() -> Nfcpins {
Nfcpins(0)
}
}
impl core::fmt::Debug for Nfcpins {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Nfcpins")
.field("protect", &self.protect())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Nfcpins {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Nfcpins {{ protect: {:?} }}", self.protect())
}
}
#[doc = "Description collection: One time programmable memory."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Otp(pub u32);
impl Otp {
#[doc = "Lower half word."]
#[must_use]
#[inline(always)]
pub const fn lower(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Lower half word."]
#[inline(always)]
pub const fn set_lower(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
#[doc = "Upper half word."]
#[must_use]
#[inline(always)]
pub const fn upper(&self) -> u16 {
let val = (self.0 >> 16usize) & 0xffff;
val as u16
}
#[doc = "Upper half word."]
#[inline(always)]
pub const fn set_upper(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 16usize)) | (((val as u32) & 0xffff) << 16usize);
}
}
impl Default for Otp {
#[inline(always)]
fn default() -> Otp {
Otp(0)
}
}
impl core::fmt::Debug for Otp {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Otp")
.field("lower", &self.lower())
.field("upper", &self.upper())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Otp {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Otp {{ lower: {=u16:?}, upper: {=u16:?} }}",
self.lower(),
self.upper()
)
}
}
#[doc = "Description cluster: Define permissions for the key slot. Bits 0-15 and 16-31 can only be written when equal to 0xFFFF."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Perm(pub u32);
impl Perm {
#[doc = "Write permission for key slot."]
#[must_use]
#[inline(always)]
pub const fn write(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Write permission for key slot."]
#[inline(always)]
pub const fn set_write(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Read permission for key slot."]
#[must_use]
#[inline(always)]
pub const fn read(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Read permission for key slot."]
#[inline(always)]
pub const fn set_read(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Push permission for key slot."]
#[must_use]
#[inline(always)]
pub const fn push(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Push permission for key slot."]
#[inline(always)]
pub const fn set_push(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Revocation state for the key slot."]
#[must_use]
#[inline(always)]
pub const fn state(&self) -> super::vals::State {
let val = (self.0 >> 16usize) & 0x01;
super::vals::State::from_bits(val as u8)
}
#[doc = "Revocation state for the key slot."]
#[inline(always)]
pub const fn set_state(&mut self, val: super::vals::State) {
self.0 =
(self.0 & !(0x01 << 16usize)) | (((val.to_bits() as u32) & 0x01) << 16usize);
}
}
impl Default for Perm {
#[inline(always)]
fn default() -> Perm {
Perm(0)
}
}
impl core::fmt::Debug for Perm {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Perm")
.field("write", &self.write())
.field("read", &self.read())
.field("push", &self.push())
.field("state", &self.state())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Perm {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Perm {{ write: {=bool:?}, read: {=bool:?}, push: {=bool:?}, state: {:?} }}",
self.write(),
self.read(),
self.push(),
self.state()
)
}
}
#[doc = "Secure access port protection."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Secureapprotect(pub u32);
impl Secureapprotect {
#[doc = "Blocks debugger read/write access to all secure CPU registers and secure memory mapped addresses."]
#[must_use]
#[inline(always)]
pub const fn pall(&self) -> super::vals::SecureapprotectPall {
let val = (self.0 >> 0usize) & 0xffff_ffff;
super::vals::SecureapprotectPall::from_bits(val as u32)
}
#[doc = "Blocks debugger read/write access to all secure CPU registers and secure memory mapped addresses."]
#[inline(always)]
pub const fn set_pall(&mut self, val: super::vals::SecureapprotectPall) {
self.0 = (self.0 & !(0xffff_ffff << 0usize))
| (((val.to_bits() as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Secureapprotect {
#[inline(always)]
fn default() -> Secureapprotect {
Secureapprotect(0)
}
}
impl core::fmt::Debug for Secureapprotect {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Secureapprotect")
.field("pall", &self.pall())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Secureapprotect {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Secureapprotect {{ pall: {:?} }}", self.pall())
}
}
#[doc = "SW-DP Target instance."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Tinstance(pub u32);
impl Tinstance {
#[doc = "TINSTANCE bits are negated and used in the SW-DP DLPIDR.TINSTANCE field. E.g. 0xF in this field is translated to 0x0 in DLPIDR.TINSTANCE field."]
#[must_use]
#[inline(always)]
pub const fn tinstance(&self) -> u8 {
let val = (self.0 >> 28usize) & 0x0f;
val as u8
}
#[doc = "TINSTANCE bits are negated and used in the SW-DP DLPIDR.TINSTANCE field. E.g. 0xF in this field is translated to 0x0 in DLPIDR.TINSTANCE field."]
#[inline(always)]
pub const fn set_tinstance(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 28usize)) | (((val as u32) & 0x0f) << 28usize);
}
}
impl Default for Tinstance {
#[inline(always)]
fn default() -> Tinstance {
Tinstance(0)
}
}
impl core::fmt::Debug for Tinstance {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Tinstance")
.field("tinstance", &self.tinstance())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Tinstance {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Tinstance {{ tinstance: {=u8:?} }}", self.tinstance())
}
}
#[doc = "Output voltage from the high voltage (VREGH) regulator stage. The maximum output voltage from this stage is given as VDDH - VREGHDROP."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Vreghvout(pub u32);
impl Vreghvout {
#[doc = "VREGH regulator output voltage."]
#[must_use]
#[inline(always)]
pub const fn vreghvout(&self) -> super::vals::Vreghvout {
let val = (self.0 >> 0usize) & 0x07;
super::vals::Vreghvout::from_bits(val as u8)
}
#[doc = "VREGH regulator output voltage."]
#[inline(always)]
pub const fn set_vreghvout(&mut self, val: super::vals::Vreghvout) {
self.0 = (self.0 & !(0x07 << 0usize)) | (((val.to_bits() as u32) & 0x07) << 0usize);
}
}
impl Default for Vreghvout {
#[inline(always)]
fn default() -> Vreghvout {
Vreghvout(0)
}
}
impl core::fmt::Debug for Vreghvout {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Vreghvout")
.field("vreghvout", &self.vreghvout())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Vreghvout {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Vreghvout {{ vreghvout: {:?} }}", self.vreghvout())
}
}
}
pub mod vals {
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct ApprotectPall(u32);
impl ApprotectPall {
#[doc = "Protected."]
pub const Protected: Self = Self(0x0);
#[doc = "Unprotected."]
pub const Unprotected: Self = Self(0x50fa_50fa);
}
impl ApprotectPall {
pub const fn from_bits(val: u32) -> ApprotectPall {
Self(val & 0xffff_ffff)
}
pub const fn to_bits(self) -> u32 {
self.0
}
}
impl core::fmt::Debug for ApprotectPall {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x0 => f.write_str("Protected"),
0x50fa_50fa => f.write_str("Unprotected"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for ApprotectPall {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x0 => defmt::write!(f, "Protected"),
0x50fa_50fa => defmt::write!(f, "Unprotected"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u32> for ApprotectPall {
#[inline(always)]
fn from(val: u32) -> ApprotectPall {
ApprotectPall::from_bits(val)
}
}
impl From<ApprotectPall> for u32 {
#[inline(always)]
fn from(val: ApprotectPall) -> u32 {
ApprotectPall::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct EraseprotectPall(u32);
impl EraseprotectPall {
#[doc = "Protected."]
pub const Protected: Self = Self(0x0);
#[doc = "Unprotected."]
pub const Unprotected: Self = Self(0xffff_ffff);
}
impl EraseprotectPall {
pub const fn from_bits(val: u32) -> EraseprotectPall {
Self(val & 0xffff_ffff)
}
pub const fn to_bits(self) -> u32 {
self.0
}
}
impl core::fmt::Debug for EraseprotectPall {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x0 => f.write_str("Protected"),
0xffff_ffff => f.write_str("Unprotected"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for EraseprotectPall {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x0 => defmt::write!(f, "Protected"),
0xffff_ffff => defmt::write!(f, "Unprotected"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u32> for EraseprotectPall {
#[inline(always)]
fn from(val: u32) -> EraseprotectPall {
EraseprotectPall::from_bits(val)
}
}
impl From<EraseprotectPall> for u32 {
#[inline(always)]
fn from(val: EraseprotectPall) -> u32 {
EraseprotectPall::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Hfxocnt(u8);
impl Hfxocnt {
#[doc = "Min debounce time = (0*64 us + 0.5 us)."]
pub const MinDebounceTime: Self = Self(0x0);
#[doc = "Max debounce time = (254*64 us + 0.5 us)."]
pub const MaxDebounceTime: Self = Self(0xfe);
#[doc = "Default debounce time for erased UICR = 4*64 us + 0.5 us."]
pub const DefaultDebounceTime: Self = Self(0xff);
}
impl Hfxocnt {
pub const fn from_bits(val: u8) -> Hfxocnt {
Self(val & 0xff)
}
pub const fn to_bits(self) -> u8 {
self.0
}
}
impl core::fmt::Debug for Hfxocnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x0 => f.write_str("MinDebounceTime"),
0xfe => f.write_str("MaxDebounceTime"),
0xff => f.write_str("DefaultDebounceTime"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Hfxocnt {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x0 => defmt::write!(f, "MinDebounceTime"),
0xfe => defmt::write!(f, "MaxDebounceTime"),
0xff => defmt::write!(f, "DefaultDebounceTime"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u8> for Hfxocnt {
#[inline(always)]
fn from(val: u8) -> Hfxocnt {
Hfxocnt::from_bits(val)
}
}
impl From<Hfxocnt> for u8 {
#[inline(always)]
fn from(val: Hfxocnt) -> u8 {
Hfxocnt::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Protect {
#[doc = "Operation as GPIO pins. Same protection as normal GPIO pins."]
Disabled = 0x0,
#[doc = "Operation as NFC antenna pins. Configures the protection for NFC operation."]
Nfc = 0x01,
}
impl Protect {
#[inline(always)]
pub const fn from_bits(val: u8) -> Protect {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Protect {
#[inline(always)]
fn from(val: u8) -> Protect {
Protect::from_bits(val)
}
}
impl From<Protect> for u8 {
#[inline(always)]
fn from(val: Protect) -> u8 {
Protect::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct SecureapprotectPall(u32);
impl SecureapprotectPall {
#[doc = "Protected."]
pub const Protected: Self = Self(0x0);
#[doc = "Unprotected."]
pub const Unprotected: Self = Self(0x50fa_50fa);
}
impl SecureapprotectPall {
pub const fn from_bits(val: u32) -> SecureapprotectPall {
Self(val & 0xffff_ffff)
}
pub const fn to_bits(self) -> u32 {
self.0
}
}
impl core::fmt::Debug for SecureapprotectPall {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x0 => f.write_str("Protected"),
0x50fa_50fa => f.write_str("Unprotected"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for SecureapprotectPall {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x0 => defmt::write!(f, "Protected"),
0x50fa_50fa => defmt::write!(f, "Unprotected"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u32> for SecureapprotectPall {
#[inline(always)]
fn from(val: u32) -> SecureapprotectPall {
SecureapprotectPall::from_bits(val)
}
}
impl From<SecureapprotectPall> for u32 {
#[inline(always)]
fn from(val: SecureapprotectPall) -> u32 {
SecureapprotectPall::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum State {
#[doc = "Key value registers can no longer be read or pushed."]
Revoked = 0x0,
#[doc = "Key value registers are readable (if enabled) and can be pushed (if enabled)."]
Active = 0x01,
}
impl State {
#[inline(always)]
pub const fn from_bits(val: u8) -> State {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for State {
#[inline(always)]
fn from(val: u8) -> State {
State::from_bits(val)
}
}
impl From<State> for u8 {
#[inline(always)]
fn from(val: State) -> u8 {
State::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Vreghvout {
#[doc = "1.8 V."]
_1v8 = 0x0,
#[doc = "2.1 V."]
_2v1 = 0x01,
#[doc = "2.4 V."]
_2v4 = 0x02,
#[doc = "2.7 V."]
_2v7 = 0x03,
#[doc = "3.0 V."]
_3v0 = 0x04,
#[doc = "3.3 V."]
_3v3 = 0x05,
_RESERVED_6 = 0x06,
#[doc = "Default voltage: 1.8 V."]
Default = 0x07,
}
impl Vreghvout {
#[inline(always)]
pub const fn from_bits(val: u8) -> Vreghvout {
unsafe { core::mem::transmute(val & 0x07) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Vreghvout {
#[inline(always)]
fn from(val: u8) -> Vreghvout {
Vreghvout::from_bits(val)
}
}
impl From<Vreghvout> for u8 {
#[inline(always)]
fn from(val: Vreghvout) -> u8 {
Vreghvout::to_bits(val)
}
}
}
}
pub mod usbd {
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Epin {
ptr: *mut u8,
}
unsafe impl Send for Epin {}
unsafe impl Sync for Epin {}
impl Epin {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: Data pointer."]
#[inline(always)]
pub const fn ptr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Description cluster: Maximum number of bytes to transfer."]
#[inline(always)]
pub const fn maxcnt(self) -> crate::common::Reg<regs::EpinMaxcnt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Description cluster: Number of bytes transferred in the last transaction."]
#[inline(always)]
pub const fn amount(self) -> crate::common::Reg<regs::EpinAmount, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Epout {
ptr: *mut u8,
}
unsafe impl Send for Epout {}
unsafe impl Sync for Epout {}
impl Epout {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: Data pointer."]
#[inline(always)]
pub const fn ptr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Description cluster: Maximum number of bytes to transfer."]
#[inline(always)]
pub const fn maxcnt(self) -> crate::common::Reg<regs::EpoutMaxcnt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Description cluster: Number of bytes transferred in the last transaction."]
#[inline(always)]
pub const fn amount(self) -> crate::common::Reg<regs::EpoutAmount, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Halted {
ptr: *mut u8,
}
unsafe impl Send for Halted {}
unsafe impl Sync for Halted {}
impl Halted {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description collection: IN endpoint halted status. Can be used as is as response to a GetStatus() request to endpoint."]
#[inline(always)]
pub const fn epin(self, n: usize) -> crate::common::Reg<regs::Epin, crate::common::R> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize + n * 4usize) as _)
}
}
#[doc = "Description collection: OUT endpoint halted status. Can be used as is as response to a GetStatus() request to endpoint."]
#[inline(always)]
pub const fn epout(
self,
n: usize,
) -> crate::common::Reg<regs::HaltedEpout, crate::common::R> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x24usize + n * 4usize) as _)
}
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Isoin {
ptr: *mut u8,
}
unsafe impl Send for Isoin {}
unsafe impl Sync for Isoin {}
impl Isoin {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Data pointer."]
#[inline(always)]
pub const fn ptr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Maximum number of bytes to transfer."]
#[inline(always)]
pub const fn maxcnt(self) -> crate::common::Reg<regs::IsoinMaxcnt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Number of bytes transferred in the last transaction."]
#[inline(always)]
pub const fn amount(self) -> crate::common::Reg<regs::IsoinAmount, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Isoout {
ptr: *mut u8,
}
unsafe impl Send for Isoout {}
unsafe impl Sync for Isoout {}
impl Isoout {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Data pointer."]
#[inline(always)]
pub const fn ptr(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Maximum number of bytes to transfer."]
#[inline(always)]
pub const fn maxcnt(self) -> crate::common::Reg<regs::IsooutMaxcnt, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Number of bytes transferred in the last transaction."]
#[inline(always)]
pub const fn amount(self) -> crate::common::Reg<regs::IsooutAmount, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
}
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Size {
ptr: *mut u8,
}
unsafe impl Send for Size {}
unsafe impl Sync for Size {}
impl Size {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description collection: Number of bytes received last in the data stage of this OUT endpoint."]
#[inline(always)]
pub const fn epout(
self,
n: usize,
) -> crate::common::Reg<regs::SizeEpout, crate::common::RW> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize + n * 4usize) as _)
}
}
#[doc = "Number of bytes received last on this ISO OUT data endpoint."]
#[inline(always)]
pub const fn isoout(self) -> crate::common::Reg<regs::Isoout, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x20usize) as _) }
}
}
#[doc = "Universal serial bus device 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Usbd {
ptr: *mut u8,
}
unsafe impl Send for Usbd {}
unsafe impl Sync for Usbd {}
impl Usbd {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description collection: Captures the EPIN\\[n\\].PTR and EPIN\\[n\\].MAXCNT registers values, and enables endpoint IN n to respond to traffic from host."]
#[inline(always)]
pub const fn tasks_startepin(self, n: usize) -> crate::common::Reg<u32, crate::common::W> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize + n * 4usize) as _)
}
}
#[doc = "Captures the ISOIN.PTR and ISOIN.MAXCNT registers values, and enables sending data on ISO endpoint."]
#[inline(always)]
pub const fn tasks_startisoin(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x24usize) as _) }
}
#[doc = "Description collection: Captures the EPOUT\\[n\\].PTR and EPOUT\\[n\\].MAXCNT registers values, and enables endpoint n to respond to traffic from host."]
#[inline(always)]
pub const fn tasks_startepout(self, n: usize) -> crate::common::Reg<u32, crate::common::W> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x28usize + n * 4usize) as _)
}
}
#[doc = "Captures the ISOOUT.PTR and ISOOUT.MAXCNT registers values, and enables receiving of data on ISO endpoint."]
#[inline(always)]
pub const fn tasks_startisoout(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x48usize) as _) }
}
#[doc = "Allows OUT data stage on control endpoint 0."]
#[inline(always)]
pub const fn tasks_ep0rcvout(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x4cusize) as _) }
}
#[doc = "Allows status stage on control endpoint 0."]
#[inline(always)]
pub const fn tasks_ep0status(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x50usize) as _) }
}
#[doc = "Stalls data and status stage on control endpoint 0."]
#[inline(always)]
pub const fn tasks_ep0stall(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x54usize) as _) }
}
#[doc = "Forces D+ and D- lines into the state defined in the DPDMVALUE register."]
#[inline(always)]
pub const fn tasks_dpdmdrive(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x58usize) as _) }
}
#[doc = "Stops forcing D+ and D- lines into any state (USB engine takes control)."]
#[inline(always)]
pub const fn tasks_dpdmnodrive(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x5cusize) as _) }
}
#[doc = "Description collection: Subscribe configuration for task STARTEPIN\\[n\\]."]
#[inline(always)]
pub const fn subscribe_startepin(
self,
n: usize,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x84usize + n * 4usize) as _)
}
}
#[doc = "Subscribe configuration for task STARTISOIN."]
#[inline(always)]
pub const fn subscribe_startisoin(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xa4usize) as _) }
}
#[doc = "Description collection: Subscribe configuration for task STARTEPOUT\\[n\\]."]
#[inline(always)]
pub const fn subscribe_startepout(
self,
n: usize,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xa8usize + n * 4usize) as _)
}
}
#[doc = "Subscribe configuration for task STARTISOOUT."]
#[inline(always)]
pub const fn subscribe_startisoout(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xc8usize) as _) }
}
#[doc = "Subscribe configuration for task EP0RCVOUT."]
#[inline(always)]
pub const fn subscribe_ep0rcvout(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xccusize) as _) }
}
#[doc = "Subscribe configuration for task EP0STATUS."]
#[inline(always)]
pub const fn subscribe_ep0status(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xd0usize) as _) }
}
#[doc = "Subscribe configuration for task EP0STALL."]
#[inline(always)]
pub const fn subscribe_ep0stall(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xd4usize) as _) }
}
#[doc = "Subscribe configuration for task DPDMDRIVE."]
#[inline(always)]
pub const fn subscribe_dpdmdrive(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xd8usize) as _) }
}
#[doc = "Subscribe configuration for task DPDMNODRIVE."]
#[inline(always)]
pub const fn subscribe_dpdmnodrive(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0xdcusize) as _) }
}
#[doc = "Signals that a USB reset condition has been detected on USB lines."]
#[inline(always)]
pub const fn events_usbreset(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0100usize) as _) }
}
#[doc = "Confirms that the EPIN\\[n\\].PTR and EPIN\\[n\\].MAXCNT, or EPOUT\\[n\\].PTR and EPOUT\\[n\\].MAXCNT registers have been captured on all endpoints reported in the EPSTATUS register."]
#[inline(always)]
pub const fn events_started(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0104usize) as _) }
}
#[doc = "Description collection: The whole EPIN\\[n\\] buffer has been consumed. The buffer can be accessed safely by software."]
#[inline(always)]
pub const fn events_endepin(self, n: usize) -> crate::common::Reg<u32, crate::common::RW> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0108usize + n * 4usize) as _)
}
}
#[doc = "An acknowledged data transfer has taken place on the control endpoint."]
#[inline(always)]
pub const fn events_ep0datadone(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0128usize) as _) }
}
#[doc = "The whole ISOIN buffer has been consumed. The buffer can be accessed safely by software."]
#[inline(always)]
pub const fn events_endisoin(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x012cusize) as _) }
}
#[doc = "Description collection: The whole EPOUT\\[n\\] buffer has been consumed. The buffer can be accessed safely by software."]
#[inline(always)]
pub const fn events_endepout(self, n: usize) -> crate::common::Reg<u32, crate::common::RW> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0130usize + n * 4usize) as _)
}
}
#[doc = "The whole ISOOUT buffer has been consumed. The buffer can be accessed safely by software."]
#[inline(always)]
pub const fn events_endisoout(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0150usize) as _) }
}
#[doc = "Signals that a SOF (start of frame) condition has been detected on USB lines."]
#[inline(always)]
pub const fn events_sof(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0154usize) as _) }
}
#[doc = "An event or an error not covered by specific events has occurred. Check EVENTCAUSE register to find the cause."]
#[inline(always)]
pub const fn events_usbevent(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0158usize) as _) }
}
#[doc = "A valid SETUP token has been received (and acknowledged) on the control endpoint."]
#[inline(always)]
pub const fn events_ep0setup(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x015cusize) as _) }
}
#[doc = "A data transfer has occurred on a data endpoint, indicated by the EPDATASTATUS register."]
#[inline(always)]
pub const fn events_epdata(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0160usize) as _) }
}
#[doc = "Publish configuration for event USBRESET."]
#[inline(always)]
pub const fn publish_usbreset(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0180usize) as _) }
}
#[doc = "Publish configuration for event STARTED."]
#[inline(always)]
pub const fn publish_started(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0184usize) as _) }
}
#[doc = "Description collection: Publish configuration for event ENDEPIN\\[n\\]."]
#[inline(always)]
pub const fn publish_endepin(
self,
n: usize,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0188usize + n * 4usize) as _)
}
}
#[doc = "Publish configuration for event EP0DATADONE."]
#[inline(always)]
pub const fn publish_ep0datadone(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01a8usize) as _) }
}
#[doc = "Publish configuration for event ENDISOIN."]
#[inline(always)]
pub const fn publish_endisoin(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01acusize) as _) }
}
#[doc = "Description collection: Publish configuration for event ENDEPOUT\\[n\\]."]
#[inline(always)]
pub const fn publish_endepout(
self,
n: usize,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01b0usize + n * 4usize) as _)
}
}
#[doc = "Publish configuration for event ENDISOOUT."]
#[inline(always)]
pub const fn publish_endisoout(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01d0usize) as _) }
}
#[doc = "Publish configuration for event SOF."]
#[inline(always)]
pub const fn publish_sof(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01d4usize) as _) }
}
#[doc = "Publish configuration for event USBEVENT."]
#[inline(always)]
pub const fn publish_usbevent(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01d8usize) as _) }
}
#[doc = "Publish configuration for event EP0SETUP."]
#[inline(always)]
pub const fn publish_ep0setup(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01dcusize) as _) }
}
#[doc = "Publish configuration for event EPDATA."]
#[inline(always)]
pub const fn publish_epdata(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x01e0usize) as _) }
}
#[doc = "Shortcuts between local events and tasks."]
#[inline(always)]
pub const fn shorts(self) -> crate::common::Reg<regs::Shorts, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0200usize) as _) }
}
#[doc = "Enable or disable interrupt."]
#[inline(always)]
pub const fn inten(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0300usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "Details on what caused the USBEVENT event."]
#[inline(always)]
pub const fn eventcause(self) -> crate::common::Reg<regs::Eventcause, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0400usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn halted(self) -> Halted {
unsafe { Halted::from_ptr(self.ptr.wrapping_add(0x0420usize) as _) }
}
#[doc = "Provides information on which endpoint's EasyDMA registers have been captured."]
#[inline(always)]
pub const fn epstatus(self) -> crate::common::Reg<regs::Epstatus, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0468usize) as _) }
}
#[doc = "Provides information on which endpoint(s) an acknowledged data transfer has occurred (EPDATA event)."]
#[inline(always)]
pub const fn epdatastatus(
self,
) -> crate::common::Reg<regs::Epdatastatus, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x046cusize) as _) }
}
#[doc = "Device USB address."]
#[inline(always)]
pub const fn usbaddr(self) -> crate::common::Reg<regs::Usbaddr, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0470usize) as _) }
}
#[doc = "SETUP data, byte 0, bmRequestType."]
#[inline(always)]
pub const fn bmrequesttype(
self,
) -> crate::common::Reg<regs::Bmrequesttype, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0480usize) as _) }
}
#[doc = "SETUP data, byte 1, bRequest."]
#[inline(always)]
pub const fn brequest(self) -> crate::common::Reg<regs::Brequest, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0484usize) as _) }
}
#[doc = "SETUP data, byte 2, LSB of wValue."]
#[inline(always)]
pub const fn wvaluel(self) -> crate::common::Reg<regs::Wvaluel, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0488usize) as _) }
}
#[doc = "SETUP data, byte 3, MSB of wValue."]
#[inline(always)]
pub const fn wvalueh(self) -> crate::common::Reg<regs::Wvalueh, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x048cusize) as _) }
}
#[doc = "SETUP data, byte 4, LSB of wIndex."]
#[inline(always)]
pub const fn windexl(self) -> crate::common::Reg<regs::Windexl, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0490usize) as _) }
}
#[doc = "SETUP data, byte 5, MSB of wIndex."]
#[inline(always)]
pub const fn windexh(self) -> crate::common::Reg<regs::Windexh, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0494usize) as _) }
}
#[doc = "SETUP data, byte 6, LSB of wLength."]
#[inline(always)]
pub const fn wlengthl(self) -> crate::common::Reg<regs::Wlengthl, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0498usize) as _) }
}
#[doc = "SETUP data, byte 7, MSB of wLength."]
#[inline(always)]
pub const fn wlengthh(self) -> crate::common::Reg<regs::Wlengthh, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x049cusize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn size(self) -> Size {
unsafe { Size::from_ptr(self.ptr.wrapping_add(0x04a0usize) as _) }
}
#[doc = "Enable USB."]
#[inline(always)]
pub const fn enable(self) -> crate::common::Reg<regs::Enable, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0500usize) as _) }
}
#[doc = "Control of the USB pull-up."]
#[inline(always)]
pub const fn usbpullup(self) -> crate::common::Reg<regs::Usbpullup, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0504usize) as _) }
}
#[doc = "State D+ and D- lines will be forced into by the DPDMDRIVE task. The DPDMNODRIVE task reverts the control of the lines to MAC IP (no forcing)."]
#[inline(always)]
pub const fn dpdmvalue(self) -> crate::common::Reg<regs::Dpdmvalue, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0508usize) as _) }
}
#[doc = "Data toggle control and status."]
#[inline(always)]
pub const fn dtoggle(self) -> crate::common::Reg<regs::Dtoggle, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x050cusize) as _) }
}
#[doc = "Endpoint IN enable."]
#[inline(always)]
pub const fn epinen(self) -> crate::common::Reg<regs::Epinen, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0510usize) as _) }
}
#[doc = "Endpoint OUT enable."]
#[inline(always)]
pub const fn epouten(self) -> crate::common::Reg<regs::Epouten, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0514usize) as _) }
}
#[doc = "STALL endpoints."]
#[inline(always)]
pub const fn epstall(self) -> crate::common::Reg<regs::Epstall, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0518usize) as _) }
}
#[doc = "Controls the split of ISO buffers."]
#[inline(always)]
pub const fn isosplit(self) -> crate::common::Reg<regs::Isosplit, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x051cusize) as _) }
}
#[doc = "Returns the current value of the start of frame counter."]
#[inline(always)]
pub const fn framecntr(self) -> crate::common::Reg<regs::Framecntr, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0520usize) as _) }
}
#[doc = "Controls USBD peripheral Low-power mode during USB suspend."]
#[inline(always)]
pub const fn lowpower(self) -> crate::common::Reg<regs::Lowpower, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x052cusize) as _) }
}
#[doc = "Controls the response of the ISO IN endpoint to an IN token when no data is ready to be sent."]
#[inline(always)]
pub const fn isoinconfig(self) -> crate::common::Reg<regs::Isoinconfig, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0530usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn epin(self, n: usize) -> Epin {
assert!(n < 8usize);
unsafe { Epin::from_ptr(self.ptr.wrapping_add(0x0600usize + n * 20usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn isoin(self) -> Isoin {
unsafe { Isoin::from_ptr(self.ptr.wrapping_add(0x06a0usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn epout(self, n: usize) -> Epout {
assert!(n < 8usize);
unsafe { Epout::from_ptr(self.ptr.wrapping_add(0x0700usize + n * 20usize) as _) }
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn isoout(self) -> Isoout {
unsafe { Isoout::from_ptr(self.ptr.wrapping_add(0x07a0usize) as _) }
}
}
pub mod regs {
#[doc = "SETUP data, byte 0, bmRequestType."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Bmrequesttype(pub u32);
impl Bmrequesttype {
#[doc = "Data transfer type."]
#[must_use]
#[inline(always)]
pub const fn recipient(&self) -> super::vals::Recipient {
let val = (self.0 >> 0usize) & 0x1f;
super::vals::Recipient::from_bits(val as u8)
}
#[doc = "Data transfer type."]
#[inline(always)]
pub const fn set_recipient(&mut self, val: super::vals::Recipient) {
self.0 = (self.0 & !(0x1f << 0usize)) | (((val.to_bits() as u32) & 0x1f) << 0usize);
}
#[doc = "Data transfer type."]
#[must_use]
#[inline(always)]
pub const fn type_(&self) -> super::vals::Type {
let val = (self.0 >> 5usize) & 0x03;
super::vals::Type::from_bits(val as u8)
}
#[doc = "Data transfer type."]
#[inline(always)]
pub const fn set_type_(&mut self, val: super::vals::Type) {
self.0 = (self.0 & !(0x03 << 5usize)) | (((val.to_bits() as u32) & 0x03) << 5usize);
}
#[doc = "Data transfer direction."]
#[must_use]
#[inline(always)]
pub const fn direction(&self) -> super::vals::Io {
let val = (self.0 >> 7usize) & 0x01;
super::vals::Io::from_bits(val as u8)
}
#[doc = "Data transfer direction."]
#[inline(always)]
pub const fn set_direction(&mut self, val: super::vals::Io) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val.to_bits() as u32) & 0x01) << 7usize);
}
}
impl Default for Bmrequesttype {
#[inline(always)]
fn default() -> Bmrequesttype {
Bmrequesttype(0)
}
}
impl core::fmt::Debug for Bmrequesttype {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Bmrequesttype")
.field("recipient", &self.recipient())
.field("type_", &self.type_())
.field("direction", &self.direction())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Bmrequesttype {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Bmrequesttype {{ recipient: {:?}, type_: {:?}, direction: {:?} }}",
self.recipient(),
self.type_(),
self.direction()
)
}
}
#[doc = "SETUP data, byte 1, bRequest."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Brequest(pub u32);
impl Brequest {
#[doc = "SETUP data, byte 1, bRequest. Values provided for standard requests only, user must implement class and vendor values."]
#[must_use]
#[inline(always)]
pub const fn brequest(&self) -> super::vals::Brequest {
let val = (self.0 >> 0usize) & 0xff;
super::vals::Brequest::from_bits(val as u8)
}
#[doc = "SETUP data, byte 1, bRequest. Values provided for standard requests only, user must implement class and vendor values."]
#[inline(always)]
pub const fn set_brequest(&mut self, val: super::vals::Brequest) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val.to_bits() as u32) & 0xff) << 0usize);
}
}
impl Default for Brequest {
#[inline(always)]
fn default() -> Brequest {
Brequest(0)
}
}
impl core::fmt::Debug for Brequest {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Brequest")
.field("brequest", &self.brequest())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Brequest {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Brequest {{ brequest: {:?} }}", self.brequest())
}
}
#[doc = "State D+ and D- lines will be forced into by the DPDMDRIVE task. The DPDMNODRIVE task reverts the control of the lines to MAC IP (no forcing)."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Dpdmvalue(pub u32);
impl Dpdmvalue {
#[doc = "State D+ and D- lines will be forced into by the DPDMDRIVE task."]
#[must_use]
#[inline(always)]
pub const fn state(&self) -> super::vals::State {
let val = (self.0 >> 0usize) & 0x1f;
super::vals::State::from_bits(val as u8)
}
#[doc = "State D+ and D- lines will be forced into by the DPDMDRIVE task."]
#[inline(always)]
pub const fn set_state(&mut self, val: super::vals::State) {
self.0 = (self.0 & !(0x1f << 0usize)) | (((val.to_bits() as u32) & 0x1f) << 0usize);
}
}
impl Default for Dpdmvalue {
#[inline(always)]
fn default() -> Dpdmvalue {
Dpdmvalue(0)
}
}
impl core::fmt::Debug for Dpdmvalue {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Dpdmvalue")
.field("state", &self.state())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Dpdmvalue {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Dpdmvalue {{ state: {:?} }}", self.state())
}
}
#[doc = "Data toggle control and status."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Dtoggle(pub u32);
impl Dtoggle {
#[doc = "Select bulk endpoint number."]
#[must_use]
#[inline(always)]
pub const fn ep(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x07;
val as u8
}
#[doc = "Select bulk endpoint number."]
#[inline(always)]
pub const fn set_ep(&mut self, val: u8) {
self.0 = (self.0 & !(0x07 << 0usize)) | (((val as u32) & 0x07) << 0usize);
}
#[doc = "Selects IN or OUT endpoint."]
#[must_use]
#[inline(always)]
pub const fn io(&self) -> super::vals::Io {
let val = (self.0 >> 7usize) & 0x01;
super::vals::Io::from_bits(val as u8)
}
#[doc = "Selects IN or OUT endpoint."]
#[inline(always)]
pub const fn set_io(&mut self, val: super::vals::Io) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val.to_bits() as u32) & 0x01) << 7usize);
}
#[doc = "Data toggle value."]
#[must_use]
#[inline(always)]
pub const fn value(&self) -> super::vals::Value {
let val = (self.0 >> 8usize) & 0x03;
super::vals::Value::from_bits(val as u8)
}
#[doc = "Data toggle value."]
#[inline(always)]
pub const fn set_value(&mut self, val: super::vals::Value) {
self.0 = (self.0 & !(0x03 << 8usize)) | (((val.to_bits() as u32) & 0x03) << 8usize);
}
}
impl Default for Dtoggle {
#[inline(always)]
fn default() -> Dtoggle {
Dtoggle(0)
}
}
impl core::fmt::Debug for Dtoggle {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Dtoggle")
.field("ep", &self.ep())
.field("io", &self.io())
.field("value", &self.value())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Dtoggle {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Dtoggle {{ ep: {=u8:?}, io: {:?}, value: {:?} }}",
self.ep(),
self.io(),
self.value()
)
}
}
#[doc = "Enable USB."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Enable(pub u32);
impl Enable {
#[doc = "Enable USB."]
#[must_use]
#[inline(always)]
pub const fn enable(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable USB."]
#[inline(always)]
pub const fn set_enable(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Enable {
#[inline(always)]
fn default() -> Enable {
Enable(0)
}
}
impl core::fmt::Debug for Enable {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Enable")
.field("enable", &self.enable())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Enable {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Enable {{ enable: {=bool:?} }}", self.enable())
}
}
#[doc = "Provides information on which endpoint(s) an acknowledged data transfer has occurred (EPDATA event)."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Epdatastatus(pub u32);
impl Epdatastatus {
#[doc = "Acknowledged data transfer on this IN endpoint. Write '1' to clear."]
#[must_use]
#[inline(always)]
pub const fn epin(&self, n: usize) -> bool {
assert!(n < 7usize);
let offs = 1usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Acknowledged data transfer on this IN endpoint. Write '1' to clear."]
#[inline(always)]
pub const fn set_epin(&mut self, n: usize, val: bool) {
assert!(n < 7usize);
let offs = 1usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "Acknowledged data transfer on this OUT endpoint. Write '1' to clear."]
#[must_use]
#[inline(always)]
pub const fn epout(&self, n: usize) -> bool {
assert!(n < 7usize);
let offs = 17usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Acknowledged data transfer on this OUT endpoint. Write '1' to clear."]
#[inline(always)]
pub const fn set_epout(&mut self, n: usize, val: bool) {
assert!(n < 7usize);
let offs = 17usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Epdatastatus {
#[inline(always)]
fn default() -> Epdatastatus {
Epdatastatus(0)
}
}
impl core::fmt::Debug for Epdatastatus {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Epdatastatus")
.field("epin[0]", &self.epin(0usize))
.field("epin[1]", &self.epin(1usize))
.field("epin[2]", &self.epin(2usize))
.field("epin[3]", &self.epin(3usize))
.field("epin[4]", &self.epin(4usize))
.field("epin[5]", &self.epin(5usize))
.field("epin[6]", &self.epin(6usize))
.field("epout[0]", &self.epout(0usize))
.field("epout[1]", &self.epout(1usize))
.field("epout[2]", &self.epout(2usize))
.field("epout[3]", &self.epout(3usize))
.field("epout[4]", &self.epout(4usize))
.field("epout[5]", &self.epout(5usize))
.field("epout[6]", &self.epout(6usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Epdatastatus {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Epdatastatus {{ epin[0]: {=bool:?}, epin[1]: {=bool:?}, epin[2]: {=bool:?}, epin[3]: {=bool:?}, epin[4]: {=bool:?}, epin[5]: {=bool:?}, epin[6]: {=bool:?}, epout[0]: {=bool:?}, epout[1]: {=bool:?}, epout[2]: {=bool:?}, epout[3]: {=bool:?}, epout[4]: {=bool:?}, epout[5]: {=bool:?}, epout[6]: {=bool:?} }}" , self . epin (0usize) , self . epin (1usize) , self . epin (2usize) , self . epin (3usize) , self . epin (4usize) , self . epin (5usize) , self . epin (6usize) , self . epout (0usize) , self . epout (1usize) , self . epout (2usize) , self . epout (3usize) , self . epout (4usize) , self . epout (5usize) , self . epout (6usize))
}
}
#[doc = "Description collection: IN endpoint halted status. Can be used as is as response to a GetStatus() request to endpoint."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Epin(pub u32);
impl Epin {
#[doc = "IN endpoint halted status. Can be used as is as response to a GetStatus() request to endpoint."]
#[must_use]
#[inline(always)]
pub const fn getstatus(&self) -> super::vals::Getstatus {
let val = (self.0 >> 0usize) & 0xffff;
super::vals::Getstatus::from_bits(val as u16)
}
#[doc = "IN endpoint halted status. Can be used as is as response to a GetStatus() request to endpoint."]
#[inline(always)]
pub const fn set_getstatus(&mut self, val: super::vals::Getstatus) {
self.0 =
(self.0 & !(0xffff << 0usize)) | (((val.to_bits() as u32) & 0xffff) << 0usize);
}
}
impl Default for Epin {
#[inline(always)]
fn default() -> Epin {
Epin(0)
}
}
impl core::fmt::Debug for Epin {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Epin")
.field("getstatus", &self.getstatus())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Epin {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Epin {{ getstatus: {:?} }}", self.getstatus())
}
}
#[doc = "Description cluster: Number of bytes transferred in the last transaction."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct EpinAmount(pub u32);
impl EpinAmount {
#[doc = "Number of bytes transferred in the last transaction."]
#[must_use]
#[inline(always)]
pub const fn amount(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x7f;
val as u8
}
#[doc = "Number of bytes transferred in the last transaction."]
#[inline(always)]
pub const fn set_amount(&mut self, val: u8) {
self.0 = (self.0 & !(0x7f << 0usize)) | (((val as u32) & 0x7f) << 0usize);
}
}
impl Default for EpinAmount {
#[inline(always)]
fn default() -> EpinAmount {
EpinAmount(0)
}
}
impl core::fmt::Debug for EpinAmount {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("EpinAmount")
.field("amount", &self.amount())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for EpinAmount {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "EpinAmount {{ amount: {=u8:?} }}", self.amount())
}
}
#[doc = "Description cluster: Maximum number of bytes to transfer."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct EpinMaxcnt(pub u32);
impl EpinMaxcnt {
#[doc = "Maximum number of bytes to transfer."]
#[must_use]
#[inline(always)]
pub const fn maxcnt(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x7f;
val as u8
}
#[doc = "Maximum number of bytes to transfer."]
#[inline(always)]
pub const fn set_maxcnt(&mut self, val: u8) {
self.0 = (self.0 & !(0x7f << 0usize)) | (((val as u32) & 0x7f) << 0usize);
}
}
impl Default for EpinMaxcnt {
#[inline(always)]
fn default() -> EpinMaxcnt {
EpinMaxcnt(0)
}
}
impl core::fmt::Debug for EpinMaxcnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("EpinMaxcnt")
.field("maxcnt", &self.maxcnt())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for EpinMaxcnt {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "EpinMaxcnt {{ maxcnt: {=u8:?} }}", self.maxcnt())
}
}
#[doc = "Endpoint IN enable."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Epinen(pub u32);
impl Epinen {
#[doc = "Enable IN endpoint 0."]
#[must_use]
#[inline(always)]
pub const fn in_(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Enable IN endpoint 0."]
#[inline(always)]
pub const fn set_in_(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "Enable ISO IN endpoint."]
#[must_use]
#[inline(always)]
pub const fn isoin(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Enable ISO IN endpoint."]
#[inline(always)]
pub const fn set_isoin(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
}
impl Default for Epinen {
#[inline(always)]
fn default() -> Epinen {
Epinen(0)
}
}
impl core::fmt::Debug for Epinen {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Epinen")
.field("in_[0]", &self.in_(0usize))
.field("in_[1]", &self.in_(1usize))
.field("in_[2]", &self.in_(2usize))
.field("in_[3]", &self.in_(3usize))
.field("in_[4]", &self.in_(4usize))
.field("in_[5]", &self.in_(5usize))
.field("in_[6]", &self.in_(6usize))
.field("in_[7]", &self.in_(7usize))
.field("isoin", &self.isoin())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Epinen {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Epinen {{ in_[0]: {=bool:?}, in_[1]: {=bool:?}, in_[2]: {=bool:?}, in_[3]: {=bool:?}, in_[4]: {=bool:?}, in_[5]: {=bool:?}, in_[6]: {=bool:?}, in_[7]: {=bool:?}, isoin: {=bool:?} }}" , self . in_ (0usize) , self . in_ (1usize) , self . in_ (2usize) , self . in_ (3usize) , self . in_ (4usize) , self . in_ (5usize) , self . in_ (6usize) , self . in_ (7usize) , self . isoin ())
}
}
#[doc = "Description cluster: Number of bytes transferred in the last transaction."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct EpoutAmount(pub u32);
impl EpoutAmount {
#[doc = "Number of bytes transferred in the last transaction."]
#[must_use]
#[inline(always)]
pub const fn amount(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x7f;
val as u8
}
#[doc = "Number of bytes transferred in the last transaction."]
#[inline(always)]
pub const fn set_amount(&mut self, val: u8) {
self.0 = (self.0 & !(0x7f << 0usize)) | (((val as u32) & 0x7f) << 0usize);
}
}
impl Default for EpoutAmount {
#[inline(always)]
fn default() -> EpoutAmount {
EpoutAmount(0)
}
}
impl core::fmt::Debug for EpoutAmount {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("EpoutAmount")
.field("amount", &self.amount())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for EpoutAmount {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "EpoutAmount {{ amount: {=u8:?} }}", self.amount())
}
}
#[doc = "Description cluster: Maximum number of bytes to transfer."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct EpoutMaxcnt(pub u32);
impl EpoutMaxcnt {
#[doc = "Maximum number of bytes to transfer."]
#[must_use]
#[inline(always)]
pub const fn maxcnt(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x7f;
val as u8
}
#[doc = "Maximum number of bytes to transfer."]
#[inline(always)]
pub const fn set_maxcnt(&mut self, val: u8) {
self.0 = (self.0 & !(0x7f << 0usize)) | (((val as u32) & 0x7f) << 0usize);
}
}
impl Default for EpoutMaxcnt {
#[inline(always)]
fn default() -> EpoutMaxcnt {
EpoutMaxcnt(0)
}
}
impl core::fmt::Debug for EpoutMaxcnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("EpoutMaxcnt")
.field("maxcnt", &self.maxcnt())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for EpoutMaxcnt {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "EpoutMaxcnt {{ maxcnt: {=u8:?} }}", self.maxcnt())
}
}
#[doc = "Endpoint OUT enable."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Epouten(pub u32);
impl Epouten {
#[doc = "Enable OUT endpoint 0."]
#[must_use]
#[inline(always)]
pub const fn out(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Enable OUT endpoint 0."]
#[inline(always)]
pub const fn set_out(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "Enable ISO OUT endpoint 8."]
#[must_use]
#[inline(always)]
pub const fn isoout(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Enable ISO OUT endpoint 8."]
#[inline(always)]
pub const fn set_isoout(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
}
impl Default for Epouten {
#[inline(always)]
fn default() -> Epouten {
Epouten(0)
}
}
impl core::fmt::Debug for Epouten {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Epouten")
.field("out[0]", &self.out(0usize))
.field("out[1]", &self.out(1usize))
.field("out[2]", &self.out(2usize))
.field("out[3]", &self.out(3usize))
.field("out[4]", &self.out(4usize))
.field("out[5]", &self.out(5usize))
.field("out[6]", &self.out(6usize))
.field("out[7]", &self.out(7usize))
.field("isoout", &self.isoout())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Epouten {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Epouten {{ out[0]: {=bool:?}, out[1]: {=bool:?}, out[2]: {=bool:?}, out[3]: {=bool:?}, out[4]: {=bool:?}, out[5]: {=bool:?}, out[6]: {=bool:?}, out[7]: {=bool:?}, isoout: {=bool:?} }}" , self . out (0usize) , self . out (1usize) , self . out (2usize) , self . out (3usize) , self . out (4usize) , self . out (5usize) , self . out (6usize) , self . out (7usize) , self . isoout ())
}
}
#[doc = "STALL endpoints."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Epstall(pub u32);
impl Epstall {
#[doc = "Select endpoint number."]
#[must_use]
#[inline(always)]
pub const fn ep(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x07;
val as u8
}
#[doc = "Select endpoint number."]
#[inline(always)]
pub const fn set_ep(&mut self, val: u8) {
self.0 = (self.0 & !(0x07 << 0usize)) | (((val as u32) & 0x07) << 0usize);
}
#[doc = "Selects IN or OUT endpoint."]
#[must_use]
#[inline(always)]
pub const fn io(&self) -> super::vals::Io {
let val = (self.0 >> 7usize) & 0x01;
super::vals::Io::from_bits(val as u8)
}
#[doc = "Selects IN or OUT endpoint."]
#[inline(always)]
pub const fn set_io(&mut self, val: super::vals::Io) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val.to_bits() as u32) & 0x01) << 7usize);
}
#[doc = "Stall selected endpoint."]
#[must_use]
#[inline(always)]
pub const fn stall(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Stall selected endpoint."]
#[inline(always)]
pub const fn set_stall(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
}
impl Default for Epstall {
#[inline(always)]
fn default() -> Epstall {
Epstall(0)
}
}
impl core::fmt::Debug for Epstall {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Epstall")
.field("ep", &self.ep())
.field("io", &self.io())
.field("stall", &self.stall())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Epstall {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Epstall {{ ep: {=u8:?}, io: {:?}, stall: {=bool:?} }}",
self.ep(),
self.io(),
self.stall()
)
}
}
#[doc = "Provides information on which endpoint's EasyDMA registers have been captured."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Epstatus(pub u32);
impl Epstatus {
#[doc = "Captured state of endpoint's EasyDMA registers. Write '1' to clear."]
#[must_use]
#[inline(always)]
pub const fn epin(&self, n: usize) -> bool {
assert!(n < 9usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Captured state of endpoint's EasyDMA registers. Write '1' to clear."]
#[inline(always)]
pub const fn set_epin(&mut self, n: usize, val: bool) {
assert!(n < 9usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "Captured state of endpoint's EasyDMA registers. Write '1' to clear."]
#[must_use]
#[inline(always)]
pub const fn epout(&self, n: usize) -> bool {
assert!(n < 9usize);
let offs = 16usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Captured state of endpoint's EasyDMA registers. Write '1' to clear."]
#[inline(always)]
pub const fn set_epout(&mut self, n: usize, val: bool) {
assert!(n < 9usize);
let offs = 16usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Epstatus {
#[inline(always)]
fn default() -> Epstatus {
Epstatus(0)
}
}
impl core::fmt::Debug for Epstatus {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Epstatus")
.field("epin[0]", &self.epin(0usize))
.field("epin[1]", &self.epin(1usize))
.field("epin[2]", &self.epin(2usize))
.field("epin[3]", &self.epin(3usize))
.field("epin[4]", &self.epin(4usize))
.field("epin[5]", &self.epin(5usize))
.field("epin[6]", &self.epin(6usize))
.field("epin[7]", &self.epin(7usize))
.field("epin[8]", &self.epin(8usize))
.field("epout[0]", &self.epout(0usize))
.field("epout[1]", &self.epout(1usize))
.field("epout[2]", &self.epout(2usize))
.field("epout[3]", &self.epout(3usize))
.field("epout[4]", &self.epout(4usize))
.field("epout[5]", &self.epout(5usize))
.field("epout[6]", &self.epout(6usize))
.field("epout[7]", &self.epout(7usize))
.field("epout[8]", &self.epout(8usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Epstatus {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Epstatus {{ epin[0]: {=bool:?}, epin[1]: {=bool:?}, epin[2]: {=bool:?}, epin[3]: {=bool:?}, epin[4]: {=bool:?}, epin[5]: {=bool:?}, epin[6]: {=bool:?}, epin[7]: {=bool:?}, epin[8]: {=bool:?}, epout[0]: {=bool:?}, epout[1]: {=bool:?}, epout[2]: {=bool:?}, epout[3]: {=bool:?}, epout[4]: {=bool:?}, epout[5]: {=bool:?}, epout[6]: {=bool:?}, epout[7]: {=bool:?}, epout[8]: {=bool:?} }}" , self . epin (0usize) , self . epin (1usize) , self . epin (2usize) , self . epin (3usize) , self . epin (4usize) , self . epin (5usize) , self . epin (6usize) , self . epin (7usize) , self . epin (8usize) , self . epout (0usize) , self . epout (1usize) , self . epout (2usize) , self . epout (3usize) , self . epout (4usize) , self . epout (5usize) , self . epout (6usize) , self . epout (7usize) , self . epout (8usize))
}
}
#[doc = "Details on what caused the USBEVENT event."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Eventcause(pub u32);
impl Eventcause {
#[doc = "CRC error was detected on isochronous OUT endpoint 8. Write '1' to clear."]
#[must_use]
#[inline(always)]
pub const fn isooutcrc(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "CRC error was detected on isochronous OUT endpoint 8. Write '1' to clear."]
#[inline(always)]
pub const fn set_isooutcrc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Signals that USB lines have been idle long enough for the device to enter suspend. Write '1' to clear."]
#[must_use]
#[inline(always)]
pub const fn suspend(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Signals that USB lines have been idle long enough for the device to enter suspend. Write '1' to clear."]
#[inline(always)]
pub const fn set_suspend(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "Signals that a RESUME condition (K state or activity restart) has been detected on USB lines. Write '1' to clear."]
#[must_use]
#[inline(always)]
pub const fn resume(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Signals that a RESUME condition (K state or activity restart) has been detected on USB lines. Write '1' to clear."]
#[inline(always)]
pub const fn set_resume(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "USB MAC has been woken up and operational. Write '1' to clear."]
#[must_use]
#[inline(always)]
pub const fn usbwuallowed(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "USB MAC has been woken up and operational. Write '1' to clear."]
#[inline(always)]
pub const fn set_usbwuallowed(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[doc = "USB device is ready for normal operation. Write '1' to clear."]
#[must_use]
#[inline(always)]
pub const fn ready(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "USB device is ready for normal operation. Write '1' to clear."]
#[inline(always)]
pub const fn set_ready(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
}
impl Default for Eventcause {
#[inline(always)]
fn default() -> Eventcause {
Eventcause(0)
}
}
impl core::fmt::Debug for Eventcause {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Eventcause")
.field("isooutcrc", &self.isooutcrc())
.field("suspend", &self.suspend())
.field("resume", &self.resume())
.field("usbwuallowed", &self.usbwuallowed())
.field("ready", &self.ready())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Eventcause {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Eventcause {{ isooutcrc: {=bool:?}, suspend: {=bool:?}, resume: {=bool:?}, usbwuallowed: {=bool:?}, ready: {=bool:?} }}" , self . isooutcrc () , self . suspend () , self . resume () , self . usbwuallowed () , self . ready ())
}
}
#[doc = "Returns the current value of the start of frame counter."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Framecntr(pub u32);
impl Framecntr {
#[doc = "Returns the current value of the start of frame counter."]
#[must_use]
#[inline(always)]
pub const fn framecntr(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x07ff;
val as u16
}
#[doc = "Returns the current value of the start of frame counter."]
#[inline(always)]
pub const fn set_framecntr(&mut self, val: u16) {
self.0 = (self.0 & !(0x07ff << 0usize)) | (((val as u32) & 0x07ff) << 0usize);
}
}
impl Default for Framecntr {
#[inline(always)]
fn default() -> Framecntr {
Framecntr(0)
}
}
impl core::fmt::Debug for Framecntr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Framecntr")
.field("framecntr", &self.framecntr())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Framecntr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Framecntr {{ framecntr: {=u16:?} }}", self.framecntr())
}
}
#[doc = "Description collection: OUT endpoint halted status. Can be used as is as response to a GetStatus() request to endpoint."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct HaltedEpout(pub u32);
impl HaltedEpout {
#[doc = "OUT endpoint halted status. Can be used as is as response to a GetStatus() request to endpoint."]
#[must_use]
#[inline(always)]
pub const fn getstatus(&self) -> super::vals::Getstatus {
let val = (self.0 >> 0usize) & 0xffff;
super::vals::Getstatus::from_bits(val as u16)
}
#[doc = "OUT endpoint halted status. Can be used as is as response to a GetStatus() request to endpoint."]
#[inline(always)]
pub const fn set_getstatus(&mut self, val: super::vals::Getstatus) {
self.0 =
(self.0 & !(0xffff << 0usize)) | (((val.to_bits() as u32) & 0xffff) << 0usize);
}
}
impl Default for HaltedEpout {
#[inline(always)]
fn default() -> HaltedEpout {
HaltedEpout(0)
}
}
impl core::fmt::Debug for HaltedEpout {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("HaltedEpout")
.field("getstatus", &self.getstatus())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for HaltedEpout {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "HaltedEpout {{ getstatus: {:?} }}", self.getstatus())
}
}
#[doc = "Enable or disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Enable or disable interrupt for event USBRESET."]
#[must_use]
#[inline(always)]
pub const fn usbreset(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event USBRESET."]
#[inline(always)]
pub const fn set_usbreset(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Enable or disable interrupt for event STARTED."]
#[must_use]
#[inline(always)]
pub const fn started(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event STARTED."]
#[inline(always)]
pub const fn set_started(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enable or disable interrupt for event ENDEPIN\\[0\\]."]
#[must_use]
#[inline(always)]
pub const fn endepin(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 2usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event ENDEPIN\\[0\\]."]
#[inline(always)]
pub const fn set_endepin(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 2usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "Enable or disable interrupt for event EP0DATADONE."]
#[must_use]
#[inline(always)]
pub const fn ep0datadone(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event EP0DATADONE."]
#[inline(always)]
pub const fn set_ep0datadone(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[doc = "Enable or disable interrupt for event ENDISOIN."]
#[must_use]
#[inline(always)]
pub const fn endisoin(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event ENDISOIN."]
#[inline(always)]
pub const fn set_endisoin(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "Enable or disable interrupt for event ENDEPOUT\\[0\\]."]
#[must_use]
#[inline(always)]
pub const fn endepout(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 12usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event ENDEPOUT\\[0\\]."]
#[inline(always)]
pub const fn set_endepout(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 12usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "Enable or disable interrupt for event ENDISOOUT."]
#[must_use]
#[inline(always)]
pub const fn endisoout(&self) -> bool {
let val = (self.0 >> 20usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event ENDISOOUT."]
#[inline(always)]
pub const fn set_endisoout(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
}
#[doc = "Enable or disable interrupt for event SOF."]
#[must_use]
#[inline(always)]
pub const fn sof(&self) -> bool {
let val = (self.0 >> 21usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event SOF."]
#[inline(always)]
pub const fn set_sof(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize);
}
#[doc = "Enable or disable interrupt for event USBEVENT."]
#[must_use]
#[inline(always)]
pub const fn usbevent(&self) -> bool {
let val = (self.0 >> 22usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event USBEVENT."]
#[inline(always)]
pub const fn set_usbevent(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 22usize)) | (((val as u32) & 0x01) << 22usize);
}
#[doc = "Enable or disable interrupt for event EP0SETUP."]
#[must_use]
#[inline(always)]
pub const fn ep0setup(&self) -> bool {
let val = (self.0 >> 23usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event EP0SETUP."]
#[inline(always)]
pub const fn set_ep0setup(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize);
}
#[doc = "Enable or disable interrupt for event EPDATA."]
#[must_use]
#[inline(always)]
pub const fn epdata(&self) -> bool {
let val = (self.0 >> 24usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event EPDATA."]
#[inline(always)]
pub const fn set_epdata(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("usbreset", &self.usbreset())
.field("started", &self.started())
.field("endepin[0]", &self.endepin(0usize))
.field("endepin[1]", &self.endepin(1usize))
.field("endepin[2]", &self.endepin(2usize))
.field("endepin[3]", &self.endepin(3usize))
.field("endepin[4]", &self.endepin(4usize))
.field("endepin[5]", &self.endepin(5usize))
.field("endepin[6]", &self.endepin(6usize))
.field("endepin[7]", &self.endepin(7usize))
.field("ep0datadone", &self.ep0datadone())
.field("endisoin", &self.endisoin())
.field("endepout[0]", &self.endepout(0usize))
.field("endepout[1]", &self.endepout(1usize))
.field("endepout[2]", &self.endepout(2usize))
.field("endepout[3]", &self.endepout(3usize))
.field("endepout[4]", &self.endepout(4usize))
.field("endepout[5]", &self.endepout(5usize))
.field("endepout[6]", &self.endepout(6usize))
.field("endepout[7]", &self.endepout(7usize))
.field("endisoout", &self.endisoout())
.field("sof", &self.sof())
.field("usbevent", &self.usbevent())
.field("ep0setup", &self.ep0setup())
.field("epdata", &self.epdata())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Int {{ usbreset: {=bool:?}, started: {=bool:?}, endepin[0]: {=bool:?}, endepin[1]: {=bool:?}, endepin[2]: {=bool:?}, endepin[3]: {=bool:?}, endepin[4]: {=bool:?}, endepin[5]: {=bool:?}, endepin[6]: {=bool:?}, endepin[7]: {=bool:?}, ep0datadone: {=bool:?}, endisoin: {=bool:?}, endepout[0]: {=bool:?}, endepout[1]: {=bool:?}, endepout[2]: {=bool:?}, endepout[3]: {=bool:?}, endepout[4]: {=bool:?}, endepout[5]: {=bool:?}, endepout[6]: {=bool:?}, endepout[7]: {=bool:?}, endisoout: {=bool:?}, sof: {=bool:?}, usbevent: {=bool:?}, ep0setup: {=bool:?}, epdata: {=bool:?} }}" , self . usbreset () , self . started () , self . endepin (0usize) , self . endepin (1usize) , self . endepin (2usize) , self . endepin (3usize) , self . endepin (4usize) , self . endepin (5usize) , self . endepin (6usize) , self . endepin (7usize) , self . ep0datadone () , self . endisoin () , self . endepout (0usize) , self . endepout (1usize) , self . endepout (2usize) , self . endepout (3usize) , self . endepout (4usize) , self . endepout (5usize) , self . endepout (6usize) , self . endepout (7usize) , self . endisoout () , self . sof () , self . usbevent () , self . ep0setup () , self . epdata ())
}
}
#[doc = "Number of bytes transferred in the last transaction."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct IsoinAmount(pub u32);
impl IsoinAmount {
#[doc = "Number of bytes transferred in the last transaction."]
#[must_use]
#[inline(always)]
pub const fn amount(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x03ff;
val as u16
}
#[doc = "Number of bytes transferred in the last transaction."]
#[inline(always)]
pub const fn set_amount(&mut self, val: u16) {
self.0 = (self.0 & !(0x03ff << 0usize)) | (((val as u32) & 0x03ff) << 0usize);
}
}
impl Default for IsoinAmount {
#[inline(always)]
fn default() -> IsoinAmount {
IsoinAmount(0)
}
}
impl core::fmt::Debug for IsoinAmount {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("IsoinAmount")
.field("amount", &self.amount())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for IsoinAmount {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "IsoinAmount {{ amount: {=u16:?} }}", self.amount())
}
}
#[doc = "Maximum number of bytes to transfer."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct IsoinMaxcnt(pub u32);
impl IsoinMaxcnt {
#[doc = "Maximum number of bytes to transfer."]
#[must_use]
#[inline(always)]
pub const fn maxcnt(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x03ff;
val as u16
}
#[doc = "Maximum number of bytes to transfer."]
#[inline(always)]
pub const fn set_maxcnt(&mut self, val: u16) {
self.0 = (self.0 & !(0x03ff << 0usize)) | (((val as u32) & 0x03ff) << 0usize);
}
}
impl Default for IsoinMaxcnt {
#[inline(always)]
fn default() -> IsoinMaxcnt {
IsoinMaxcnt(0)
}
}
impl core::fmt::Debug for IsoinMaxcnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("IsoinMaxcnt")
.field("maxcnt", &self.maxcnt())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for IsoinMaxcnt {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "IsoinMaxcnt {{ maxcnt: {=u16:?} }}", self.maxcnt())
}
}
#[doc = "Controls the response of the ISO IN endpoint to an IN token when no data is ready to be sent."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Isoinconfig(pub u32);
impl Isoinconfig {
#[doc = "Controls the response of the ISO IN endpoint to an IN token when no data is ready to be sent."]
#[must_use]
#[inline(always)]
pub const fn response(&self) -> super::vals::Response {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Response::from_bits(val as u8)
}
#[doc = "Controls the response of the ISO IN endpoint to an IN token when no data is ready to be sent."]
#[inline(always)]
pub const fn set_response(&mut self, val: super::vals::Response) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Isoinconfig {
#[inline(always)]
fn default() -> Isoinconfig {
Isoinconfig(0)
}
}
impl core::fmt::Debug for Isoinconfig {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Isoinconfig")
.field("response", &self.response())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Isoinconfig {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Isoinconfig {{ response: {:?} }}", self.response())
}
}
#[doc = "Number of bytes received last on this ISO OUT data endpoint."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Isoout(pub u32);
impl Isoout {
#[doc = "Number of bytes received last on this ISO OUT data endpoint."]
#[must_use]
#[inline(always)]
pub const fn size(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x03ff;
val as u16
}
#[doc = "Number of bytes received last on this ISO OUT data endpoint."]
#[inline(always)]
pub const fn set_size(&mut self, val: u16) {
self.0 = (self.0 & !(0x03ff << 0usize)) | (((val as u32) & 0x03ff) << 0usize);
}
#[doc = "Zero-length data packet received."]
#[must_use]
#[inline(always)]
pub const fn zero(&self) -> super::vals::Zero {
let val = (self.0 >> 16usize) & 0x01;
super::vals::Zero::from_bits(val as u8)
}
#[doc = "Zero-length data packet received."]
#[inline(always)]
pub const fn set_zero(&mut self, val: super::vals::Zero) {
self.0 =
(self.0 & !(0x01 << 16usize)) | (((val.to_bits() as u32) & 0x01) << 16usize);
}
}
impl Default for Isoout {
#[inline(always)]
fn default() -> Isoout {
Isoout(0)
}
}
impl core::fmt::Debug for Isoout {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Isoout")
.field("size", &self.size())
.field("zero", &self.zero())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Isoout {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Isoout {{ size: {=u16:?}, zero: {:?} }}",
self.size(),
self.zero()
)
}
}
#[doc = "Number of bytes transferred in the last transaction."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct IsooutAmount(pub u32);
impl IsooutAmount {
#[doc = "Number of bytes transferred in the last transaction."]
#[must_use]
#[inline(always)]
pub const fn amount(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x03ff;
val as u16
}
#[doc = "Number of bytes transferred in the last transaction."]
#[inline(always)]
pub const fn set_amount(&mut self, val: u16) {
self.0 = (self.0 & !(0x03ff << 0usize)) | (((val as u32) & 0x03ff) << 0usize);
}
}
impl Default for IsooutAmount {
#[inline(always)]
fn default() -> IsooutAmount {
IsooutAmount(0)
}
}
impl core::fmt::Debug for IsooutAmount {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("IsooutAmount")
.field("amount", &self.amount())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for IsooutAmount {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "IsooutAmount {{ amount: {=u16:?} }}", self.amount())
}
}
#[doc = "Maximum number of bytes to transfer."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct IsooutMaxcnt(pub u32);
impl IsooutMaxcnt {
#[doc = "Maximum number of bytes to transfer."]
#[must_use]
#[inline(always)]
pub const fn maxcnt(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x03ff;
val as u16
}
#[doc = "Maximum number of bytes to transfer."]
#[inline(always)]
pub const fn set_maxcnt(&mut self, val: u16) {
self.0 = (self.0 & !(0x03ff << 0usize)) | (((val as u32) & 0x03ff) << 0usize);
}
}
impl Default for IsooutMaxcnt {
#[inline(always)]
fn default() -> IsooutMaxcnt {
IsooutMaxcnt(0)
}
}
impl core::fmt::Debug for IsooutMaxcnt {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("IsooutMaxcnt")
.field("maxcnt", &self.maxcnt())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for IsooutMaxcnt {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "IsooutMaxcnt {{ maxcnt: {=u16:?} }}", self.maxcnt())
}
}
#[doc = "Controls the split of ISO buffers."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Isosplit(pub u32);
impl Isosplit {
#[doc = "Controls the split of ISO buffers."]
#[must_use]
#[inline(always)]
pub const fn split(&self) -> super::vals::Split {
let val = (self.0 >> 0usize) & 0xffff;
super::vals::Split::from_bits(val as u16)
}
#[doc = "Controls the split of ISO buffers."]
#[inline(always)]
pub const fn set_split(&mut self, val: super::vals::Split) {
self.0 =
(self.0 & !(0xffff << 0usize)) | (((val.to_bits() as u32) & 0xffff) << 0usize);
}
}
impl Default for Isosplit {
#[inline(always)]
fn default() -> Isosplit {
Isosplit(0)
}
}
impl core::fmt::Debug for Isosplit {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Isosplit")
.field("split", &self.split())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Isosplit {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Isosplit {{ split: {:?} }}", self.split())
}
}
#[doc = "Controls USBD peripheral Low-power mode during USB suspend."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Lowpower(pub u32);
impl Lowpower {
#[doc = "Controls USBD peripheral Low-power mode during USB suspend."]
#[must_use]
#[inline(always)]
pub const fn lowpower(&self) -> super::vals::Lowpower {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Lowpower::from_bits(val as u8)
}
#[doc = "Controls USBD peripheral Low-power mode during USB suspend."]
#[inline(always)]
pub const fn set_lowpower(&mut self, val: super::vals::Lowpower) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
}
impl Default for Lowpower {
#[inline(always)]
fn default() -> Lowpower {
Lowpower(0)
}
}
impl core::fmt::Debug for Lowpower {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Lowpower")
.field("lowpower", &self.lowpower())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Lowpower {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Lowpower {{ lowpower: {:?} }}", self.lowpower())
}
}
#[doc = "Shortcuts between local events and tasks."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Shorts(pub u32);
impl Shorts {
#[doc = "Shortcut between event EP0DATADONE and task STARTEPIN\\[0\\]."]
#[must_use]
#[inline(always)]
pub const fn ep0datadone_startepin0(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event EP0DATADONE and task STARTEPIN\\[0\\]."]
#[inline(always)]
pub const fn set_ep0datadone_startepin0(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Shortcut between event EP0DATADONE and task STARTEPOUT\\[0\\]."]
#[must_use]
#[inline(always)]
pub const fn ep0datadone_startepout0(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event EP0DATADONE and task STARTEPOUT\\[0\\]."]
#[inline(always)]
pub const fn set_ep0datadone_startepout0(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Shortcut between event EP0DATADONE and task EP0STATUS."]
#[must_use]
#[inline(always)]
pub const fn ep0datadone_ep0status(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event EP0DATADONE and task EP0STATUS."]
#[inline(always)]
pub const fn set_ep0datadone_ep0status(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Shortcut between event ENDEPOUT\\[0\\] and task EP0STATUS."]
#[must_use]
#[inline(always)]
pub const fn endepout0_ep0status(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event ENDEPOUT\\[0\\] and task EP0STATUS."]
#[inline(always)]
pub const fn set_endepout0_ep0status(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Shortcut between event ENDEPOUT\\[0\\] and task EP0RCVOUT."]
#[must_use]
#[inline(always)]
pub const fn endepout0_ep0rcvout(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Shortcut between event ENDEPOUT\\[0\\] and task EP0RCVOUT."]
#[inline(always)]
pub const fn set_endepout0_ep0rcvout(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
}
impl Default for Shorts {
#[inline(always)]
fn default() -> Shorts {
Shorts(0)
}
}
impl core::fmt::Debug for Shorts {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Shorts")
.field("ep0datadone_startepin0", &self.ep0datadone_startepin0())
.field("ep0datadone_startepout0", &self.ep0datadone_startepout0())
.field("ep0datadone_ep0status", &self.ep0datadone_ep0status())
.field("endepout0_ep0status", &self.endepout0_ep0status())
.field("endepout0_ep0rcvout", &self.endepout0_ep0rcvout())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Shorts {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Shorts {{ ep0datadone_startepin0: {=bool:?}, ep0datadone_startepout0: {=bool:?}, ep0datadone_ep0status: {=bool:?}, endepout0_ep0status: {=bool:?}, endepout0_ep0rcvout: {=bool:?} }}" , self . ep0datadone_startepin0 () , self . ep0datadone_startepout0 () , self . ep0datadone_ep0status () , self . endepout0_ep0status () , self . endepout0_ep0rcvout ())
}
}
#[doc = "Description collection: Number of bytes received last in the data stage of this OUT endpoint."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct SizeEpout(pub u32);
impl SizeEpout {
#[doc = "Number of bytes received last in the data stage of this OUT endpoint."]
#[must_use]
#[inline(always)]
pub const fn size(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x7f;
val as u8
}
#[doc = "Number of bytes received last in the data stage of this OUT endpoint."]
#[inline(always)]
pub const fn set_size(&mut self, val: u8) {
self.0 = (self.0 & !(0x7f << 0usize)) | (((val as u32) & 0x7f) << 0usize);
}
}
impl Default for SizeEpout {
#[inline(always)]
fn default() -> SizeEpout {
SizeEpout(0)
}
}
impl core::fmt::Debug for SizeEpout {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("SizeEpout")
.field("size", &self.size())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for SizeEpout {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "SizeEpout {{ size: {=u8:?} }}", self.size())
}
}
#[doc = "Device USB address."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Usbaddr(pub u32);
impl Usbaddr {
#[doc = "Device USB address."]
#[must_use]
#[inline(always)]
pub const fn addr(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x7f;
val as u8
}
#[doc = "Device USB address."]
#[inline(always)]
pub const fn set_addr(&mut self, val: u8) {
self.0 = (self.0 & !(0x7f << 0usize)) | (((val as u32) & 0x7f) << 0usize);
}
}
impl Default for Usbaddr {
#[inline(always)]
fn default() -> Usbaddr {
Usbaddr(0)
}
}
impl core::fmt::Debug for Usbaddr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Usbaddr")
.field("addr", &self.addr())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Usbaddr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Usbaddr {{ addr: {=u8:?} }}", self.addr())
}
}
#[doc = "Control of the USB pull-up."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Usbpullup(pub u32);
impl Usbpullup {
#[doc = "Control of the USB pull-up on the D+ line."]
#[must_use]
#[inline(always)]
pub const fn connect(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Control of the USB pull-up on the D+ line."]
#[inline(always)]
pub const fn set_connect(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Usbpullup {
#[inline(always)]
fn default() -> Usbpullup {
Usbpullup(0)
}
}
impl core::fmt::Debug for Usbpullup {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Usbpullup")
.field("connect", &self.connect())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Usbpullup {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Usbpullup {{ connect: {=bool:?} }}", self.connect())
}
}
#[doc = "SETUP data, byte 5, MSB of wIndex."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Windexh(pub u32);
impl Windexh {
#[doc = "SETUP data, byte 5, MSB of wIndex."]
#[must_use]
#[inline(always)]
pub const fn windexh(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "SETUP data, byte 5, MSB of wIndex."]
#[inline(always)]
pub const fn set_windexh(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for Windexh {
#[inline(always)]
fn default() -> Windexh {
Windexh(0)
}
}
impl core::fmt::Debug for Windexh {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Windexh")
.field("windexh", &self.windexh())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Windexh {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Windexh {{ windexh: {=u8:?} }}", self.windexh())
}
}
#[doc = "SETUP data, byte 4, LSB of wIndex."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Windexl(pub u32);
impl Windexl {
#[doc = "SETUP data, byte 4, LSB of wIndex."]
#[must_use]
#[inline(always)]
pub const fn windexl(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "SETUP data, byte 4, LSB of wIndex."]
#[inline(always)]
pub const fn set_windexl(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for Windexl {
#[inline(always)]
fn default() -> Windexl {
Windexl(0)
}
}
impl core::fmt::Debug for Windexl {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Windexl")
.field("windexl", &self.windexl())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Windexl {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Windexl {{ windexl: {=u8:?} }}", self.windexl())
}
}
#[doc = "SETUP data, byte 7, MSB of wLength."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Wlengthh(pub u32);
impl Wlengthh {
#[doc = "SETUP data, byte 7, MSB of wLength."]
#[must_use]
#[inline(always)]
pub const fn wlengthh(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "SETUP data, byte 7, MSB of wLength."]
#[inline(always)]
pub const fn set_wlengthh(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for Wlengthh {
#[inline(always)]
fn default() -> Wlengthh {
Wlengthh(0)
}
}
impl core::fmt::Debug for Wlengthh {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Wlengthh")
.field("wlengthh", &self.wlengthh())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Wlengthh {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Wlengthh {{ wlengthh: {=u8:?} }}", self.wlengthh())
}
}
#[doc = "SETUP data, byte 6, LSB of wLength."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Wlengthl(pub u32);
impl Wlengthl {
#[doc = "SETUP data, byte 6, LSB of wLength."]
#[must_use]
#[inline(always)]
pub const fn wlengthl(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "SETUP data, byte 6, LSB of wLength."]
#[inline(always)]
pub const fn set_wlengthl(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for Wlengthl {
#[inline(always)]
fn default() -> Wlengthl {
Wlengthl(0)
}
}
impl core::fmt::Debug for Wlengthl {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Wlengthl")
.field("wlengthl", &self.wlengthl())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Wlengthl {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Wlengthl {{ wlengthl: {=u8:?} }}", self.wlengthl())
}
}
#[doc = "SETUP data, byte 3, MSB of wValue."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Wvalueh(pub u32);
impl Wvalueh {
#[doc = "SETUP data, byte 3, MSB of wValue."]
#[must_use]
#[inline(always)]
pub const fn wvalueh(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "SETUP data, byte 3, MSB of wValue."]
#[inline(always)]
pub const fn set_wvalueh(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for Wvalueh {
#[inline(always)]
fn default() -> Wvalueh {
Wvalueh(0)
}
}
impl core::fmt::Debug for Wvalueh {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Wvalueh")
.field("wvalueh", &self.wvalueh())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Wvalueh {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Wvalueh {{ wvalueh: {=u8:?} }}", self.wvalueh())
}
}
#[doc = "SETUP data, byte 2, LSB of wValue."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Wvaluel(pub u32);
impl Wvaluel {
#[doc = "SETUP data, byte 2, LSB of wValue."]
#[must_use]
#[inline(always)]
pub const fn wvaluel(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "SETUP data, byte 2, LSB of wValue."]
#[inline(always)]
pub const fn set_wvaluel(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for Wvaluel {
#[inline(always)]
fn default() -> Wvaluel {
Wvaluel(0)
}
}
impl core::fmt::Debug for Wvaluel {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Wvaluel")
.field("wvaluel", &self.wvaluel())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Wvaluel {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Wvaluel {{ wvaluel: {=u8:?} }}", self.wvaluel())
}
}
}
pub mod vals {
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Brequest(u8);
impl Brequest {
#[doc = "Standard request GET_STATUS."]
pub const StdGetStatus: Self = Self(0x0);
#[doc = "Standard request CLEAR_FEATURE."]
pub const StdClearFeature: Self = Self(0x01);
#[doc = "Standard request SET_FEATURE."]
pub const StdSetFeature: Self = Self(0x03);
#[doc = "Standard request SET_ADDRESS."]
pub const StdSetAddress: Self = Self(0x05);
#[doc = "Standard request GET_DESCRIPTOR."]
pub const StdGetDescriptor: Self = Self(0x06);
#[doc = "Standard request SET_DESCRIPTOR."]
pub const StdSetDescriptor: Self = Self(0x07);
#[doc = "Standard request GET_CONFIGURATION."]
pub const StdGetConfiguration: Self = Self(0x08);
#[doc = "Standard request SET_CONFIGURATION."]
pub const StdSetConfiguration: Self = Self(0x09);
#[doc = "Standard request GET_INTERFACE."]
pub const StdGetInterface: Self = Self(0x0a);
#[doc = "Standard request SET_INTERFACE."]
pub const StdSetInterface: Self = Self(0x0b);
#[doc = "Standard request SYNCH_FRAME."]
pub const StdSynchFrame: Self = Self(0x0c);
}
impl Brequest {
pub const fn from_bits(val: u8) -> Brequest {
Self(val & 0xff)
}
pub const fn to_bits(self) -> u8 {
self.0
}
}
impl core::fmt::Debug for Brequest {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x0 => f.write_str("StdGetStatus"),
0x01 => f.write_str("StdClearFeature"),
0x03 => f.write_str("StdSetFeature"),
0x05 => f.write_str("StdSetAddress"),
0x06 => f.write_str("StdGetDescriptor"),
0x07 => f.write_str("StdSetDescriptor"),
0x08 => f.write_str("StdGetConfiguration"),
0x09 => f.write_str("StdSetConfiguration"),
0x0a => f.write_str("StdGetInterface"),
0x0b => f.write_str("StdSetInterface"),
0x0c => f.write_str("StdSynchFrame"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Brequest {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x0 => defmt::write!(f, "StdGetStatus"),
0x01 => defmt::write!(f, "StdClearFeature"),
0x03 => defmt::write!(f, "StdSetFeature"),
0x05 => defmt::write!(f, "StdSetAddress"),
0x06 => defmt::write!(f, "StdGetDescriptor"),
0x07 => defmt::write!(f, "StdSetDescriptor"),
0x08 => defmt::write!(f, "StdGetConfiguration"),
0x09 => defmt::write!(f, "StdSetConfiguration"),
0x0a => defmt::write!(f, "StdGetInterface"),
0x0b => defmt::write!(f, "StdSetInterface"),
0x0c => defmt::write!(f, "StdSynchFrame"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u8> for Brequest {
#[inline(always)]
fn from(val: u8) -> Brequest {
Brequest::from_bits(val)
}
}
impl From<Brequest> for u8 {
#[inline(always)]
fn from(val: Brequest) -> u8 {
Brequest::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Getstatus(u16);
impl Getstatus {
#[doc = "Endpoint is not halted."]
pub const NotHalted: Self = Self(0x0);
#[doc = "Endpoint is halted."]
pub const Halted: Self = Self(0x01);
}
impl Getstatus {
pub const fn from_bits(val: u16) -> Getstatus {
Self(val & 0xffff)
}
pub const fn to_bits(self) -> u16 {
self.0
}
}
impl core::fmt::Debug for Getstatus {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x0 => f.write_str("NotHalted"),
0x01 => f.write_str("Halted"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Getstatus {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x0 => defmt::write!(f, "NotHalted"),
0x01 => defmt::write!(f, "Halted"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u16> for Getstatus {
#[inline(always)]
fn from(val: u16) -> Getstatus {
Getstatus::from_bits(val)
}
}
impl From<Getstatus> for u16 {
#[inline(always)]
fn from(val: Getstatus) -> u16 {
Getstatus::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Io {
#[doc = "Selects OUT endpoint."]
Out = 0x0,
#[doc = "Selects IN endpoint."]
In = 0x01,
}
impl Io {
#[inline(always)]
pub const fn from_bits(val: u8) -> Io {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Io {
#[inline(always)]
fn from(val: u8) -> Io {
Io::from_bits(val)
}
}
impl From<Io> for u8 {
#[inline(always)]
fn from(val: Io) -> u8 {
Io::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Lowpower {
#[doc = "Software must write this value to exit Low-power mode and before performing a remote wake-up."]
ForceNormal = 0x0,
#[doc = "Software must write this value to enter Low-power mode after DMA and software have finished interacting with the USB peripheral."]
LowPower = 0x01,
}
impl Lowpower {
#[inline(always)]
pub const fn from_bits(val: u8) -> Lowpower {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Lowpower {
#[inline(always)]
fn from(val: u8) -> Lowpower {
Lowpower::from_bits(val)
}
}
impl From<Lowpower> for u8 {
#[inline(always)]
fn from(val: Lowpower) -> u8 {
Lowpower::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Recipient {
#[doc = "Device."]
Device = 0x0,
#[doc = "Interface."]
Interface = 0x01,
#[doc = "Endpoint."]
Endpoint = 0x02,
#[doc = "Other."]
Other = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
_RESERVED_10 = 0x10,
_RESERVED_11 = 0x11,
_RESERVED_12 = 0x12,
_RESERVED_13 = 0x13,
_RESERVED_14 = 0x14,
_RESERVED_15 = 0x15,
_RESERVED_16 = 0x16,
_RESERVED_17 = 0x17,
_RESERVED_18 = 0x18,
_RESERVED_19 = 0x19,
_RESERVED_1a = 0x1a,
_RESERVED_1b = 0x1b,
_RESERVED_1c = 0x1c,
_RESERVED_1d = 0x1d,
_RESERVED_1e = 0x1e,
_RESERVED_1f = 0x1f,
}
impl Recipient {
#[inline(always)]
pub const fn from_bits(val: u8) -> Recipient {
unsafe { core::mem::transmute(val & 0x1f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Recipient {
#[inline(always)]
fn from(val: u8) -> Recipient {
Recipient::from_bits(val)
}
}
impl From<Recipient> for u8 {
#[inline(always)]
fn from(val: Recipient) -> u8 {
Recipient::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Response {
#[doc = "Endpoint does not respond in that case."]
NoResp = 0x0,
#[doc = "Endpoint responds with a zero-length data packet in that case."]
ZeroData = 0x01,
}
impl Response {
#[inline(always)]
pub const fn from_bits(val: u8) -> Response {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Response {
#[inline(always)]
fn from(val: u8) -> Response {
Response::from_bits(val)
}
}
impl From<Response> for u8 {
#[inline(always)]
fn from(val: Response) -> u8 {
Response::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Split(u16);
impl Split {
#[doc = "Full buffer dedicated to either ISO IN or OUT."]
pub const OneDir: Self = Self(0x0);
#[doc = "Lower half for IN, upper half for OUT."]
pub const HalfIn: Self = Self(0x80);
}
impl Split {
pub const fn from_bits(val: u16) -> Split {
Self(val & 0xffff)
}
pub const fn to_bits(self) -> u16 {
self.0
}
}
impl core::fmt::Debug for Split {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x0 => f.write_str("OneDir"),
0x80 => f.write_str("HalfIn"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Split {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x0 => defmt::write!(f, "OneDir"),
0x80 => defmt::write!(f, "HalfIn"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u16> for Split {
#[inline(always)]
fn from(val: u16) -> Split {
Split::from_bits(val)
}
}
impl From<Split> for u16 {
#[inline(always)]
fn from(val: Split) -> u16 {
Split::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum State {
_RESERVED_0 = 0x0,
#[doc = "D+ forced low, D- forced high (K state) for a timing preset in hardware (50 us or 5 ms, depending on bus state)."]
Resume = 0x01,
#[doc = "D+ forced high, D- forced low (J state)."]
J = 0x02,
_RESERVED_3 = 0x03,
#[doc = "D+ forced low, D- forced high (K state)."]
K = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
_RESERVED_e = 0x0e,
_RESERVED_f = 0x0f,
_RESERVED_10 = 0x10,
_RESERVED_11 = 0x11,
_RESERVED_12 = 0x12,
_RESERVED_13 = 0x13,
_RESERVED_14 = 0x14,
_RESERVED_15 = 0x15,
_RESERVED_16 = 0x16,
_RESERVED_17 = 0x17,
_RESERVED_18 = 0x18,
_RESERVED_19 = 0x19,
_RESERVED_1a = 0x1a,
_RESERVED_1b = 0x1b,
_RESERVED_1c = 0x1c,
_RESERVED_1d = 0x1d,
_RESERVED_1e = 0x1e,
_RESERVED_1f = 0x1f,
}
impl State {
#[inline(always)]
pub const fn from_bits(val: u8) -> State {
unsafe { core::mem::transmute(val & 0x1f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for State {
#[inline(always)]
fn from(val: u8) -> State {
State::from_bits(val)
}
}
impl From<State> for u8 {
#[inline(always)]
fn from(val: State) -> u8 {
State::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Type {
#[doc = "Standard."]
Standard = 0x0,
#[doc = "Class."]
Class = 0x01,
#[doc = "Vendor."]
Vendor = 0x02,
_RESERVED_3 = 0x03,
}
impl Type {
#[inline(always)]
pub const fn from_bits(val: u8) -> Type {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Type {
#[inline(always)]
fn from(val: u8) -> Type {
Type::from_bits(val)
}
}
impl From<Type> for u8 {
#[inline(always)]
fn from(val: Type) -> u8 {
Type::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Value {
#[doc = "No action on data toggle when writing the register with this value."]
Nop = 0x0,
#[doc = "Data toggle is DATA0 on endpoint set by EP and IO."]
Data0 = 0x01,
#[doc = "Data toggle is DATA1 on endpoint set by EP and IO."]
Data1 = 0x02,
_RESERVED_3 = 0x03,
}
impl Value {
#[inline(always)]
pub const fn from_bits(val: u8) -> Value {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Value {
#[inline(always)]
fn from(val: u8) -> Value {
Value::from_bits(val)
}
}
impl From<Value> for u8 {
#[inline(always)]
fn from(val: Value) -> u8 {
Value::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Zero {
#[doc = "No zero-length data received, use value in SIZE."]
Normal = 0x0,
#[doc = "Zero-length data received, ignore value in SIZE."]
ZeroData = 0x01,
}
impl Zero {
#[inline(always)]
pub const fn from_bits(val: u8) -> Zero {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Zero {
#[inline(always)]
fn from(val: u8) -> Zero {
Zero::from_bits(val)
}
}
impl From<Zero> for u8 {
#[inline(always)]
fn from(val: Zero) -> u8 {
Zero::to_bits(val)
}
}
}
}
pub mod usbreg {
#[doc = "USB Regulator 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Usbreg {
ptr: *mut u8,
}
unsafe impl Send for Usbreg {}
unsafe impl Sync for Usbreg {}
impl Usbreg {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Voltage supply detected on VBUS."]
#[inline(always)]
pub const fn events_usbdetected(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0100usize) as _) }
}
#[doc = "Voltage supply removed from VBUS."]
#[inline(always)]
pub const fn events_usbremoved(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0104usize) as _) }
}
#[doc = "USB 3.3 V supply ready."]
#[inline(always)]
pub const fn events_usbpwrrdy(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0108usize) as _) }
}
#[doc = "Publish configuration for event USBDETECTED."]
#[inline(always)]
pub const fn publish_usbdetected(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0180usize) as _) }
}
#[doc = "Publish configuration for event USBREMOVED."]
#[inline(always)]
pub const fn publish_usbremoved(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0184usize) as _) }
}
#[doc = "Publish configuration for event USBPWRRDY."]
#[inline(always)]
pub const fn publish_usbpwrrdy(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0188usize) as _) }
}
#[doc = "Enable or disable interrupt."]
#[inline(always)]
pub const fn inten(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0300usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "USB supply status."]
#[inline(always)]
pub const fn usbregstatus(
self,
) -> crate::common::Reg<regs::Usbregstatus, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0400usize) as _) }
}
}
pub mod regs {
#[doc = "Enable or disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Enable or disable interrupt for event USBDETECTED."]
#[must_use]
#[inline(always)]
pub const fn usbdetected(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event USBDETECTED."]
#[inline(always)]
pub const fn set_usbdetected(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Enable or disable interrupt for event USBREMOVED."]
#[must_use]
#[inline(always)]
pub const fn usbremoved(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event USBREMOVED."]
#[inline(always)]
pub const fn set_usbremoved(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enable or disable interrupt for event USBPWRRDY."]
#[must_use]
#[inline(always)]
pub const fn usbpwrrdy(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Enable or disable interrupt for event USBPWRRDY."]
#[inline(always)]
pub const fn set_usbpwrrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("usbdetected", &self.usbdetected())
.field("usbremoved", &self.usbremoved())
.field("usbpwrrdy", &self.usbpwrrdy())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Int {{ usbdetected: {=bool:?}, usbremoved: {=bool:?}, usbpwrrdy: {=bool:?} }}",
self.usbdetected(),
self.usbremoved(),
self.usbpwrrdy()
)
}
}
#[doc = "USB supply status."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Usbregstatus(pub u32);
impl Usbregstatus {
#[doc = "VBUS input detection status (USBDETECTED and USBREMOVED events are derived from this information)."]
#[must_use]
#[inline(always)]
pub const fn vbusdetect(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "VBUS input detection status (USBDETECTED and USBREMOVED events are derived from this information)."]
#[inline(always)]
pub const fn set_vbusdetect(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "USB supply output settling time elapsed."]
#[must_use]
#[inline(always)]
pub const fn outputrdy(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "USB supply output settling time elapsed."]
#[inline(always)]
pub const fn set_outputrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
}
impl Default for Usbregstatus {
#[inline(always)]
fn default() -> Usbregstatus {
Usbregstatus(0)
}
}
impl core::fmt::Debug for Usbregstatus {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Usbregstatus")
.field("vbusdetect", &self.vbusdetect())
.field("outputrdy", &self.outputrdy())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Usbregstatus {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Usbregstatus {{ vbusdetect: {=bool:?}, outputrdy: {=bool:?} }}",
self.vbusdetect(),
self.outputrdy()
)
}
}
}
}
pub mod vmc {
#[doc = "Unspecified."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ram {
ptr: *mut u8,
}
unsafe impl Send for Ram {}
unsafe impl Sync for Ram {}
impl Ram {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Description cluster: RAM\\[n\\] power control register."]
#[inline(always)]
pub const fn power(self) -> crate::common::Reg<regs::Power, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Description cluster: RAM\\[n\\] power control set register."]
#[inline(always)]
pub const fn powerset(self) -> crate::common::Reg<regs::Power, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Description cluster: RAM\\[n\\] power control clear register."]
#[inline(always)]
pub const fn powerclr(self) -> crate::common::Reg<regs::Power, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x08usize) as _) }
}
}
#[doc = "Volatile Memory controller 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Vmc {
ptr: *mut u8,
}
unsafe impl Send for Vmc {}
unsafe impl Sync for Vmc {}
impl Vmc {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Unspecified."]
#[inline(always)]
pub const fn ram(self, n: usize) -> Ram {
assert!(n < 8usize);
unsafe { Ram::from_ptr(self.ptr.wrapping_add(0x0600usize + n * 16usize) as _) }
}
}
pub mod regs {
#[doc = "Description cluster: RAM\\[n\\] power control register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Power(pub u32);
impl Power {
#[doc = "Keep RAM section S0 of RAM\\[n\\] on or off in System ON mode."]
#[must_use]
#[inline(always)]
pub const fn spower(&self, n: usize) -> bool {
assert!(n < 16usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Keep RAM section S0 of RAM\\[n\\] on or off in System ON mode."]
#[inline(always)]
pub const fn set_spower(&mut self, n: usize, val: bool) {
assert!(n < 16usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "Keep retention on RAM section S0 of RAM\\[n\\] when RAM section is switched off."]
#[must_use]
#[inline(always)]
pub const fn sretention(&self, n: usize) -> bool {
assert!(n < 16usize);
let offs = 16usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Keep retention on RAM section S0 of RAM\\[n\\] when RAM section is switched off."]
#[inline(always)]
pub const fn set_sretention(&mut self, n: usize, val: bool) {
assert!(n < 16usize);
let offs = 16usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Power {
#[inline(always)]
fn default() -> Power {
Power(0)
}
}
impl core::fmt::Debug for Power {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Power")
.field("spower[0]", &self.spower(0usize))
.field("spower[1]", &self.spower(1usize))
.field("spower[2]", &self.spower(2usize))
.field("spower[3]", &self.spower(3usize))
.field("spower[4]", &self.spower(4usize))
.field("spower[5]", &self.spower(5usize))
.field("spower[6]", &self.spower(6usize))
.field("spower[7]", &self.spower(7usize))
.field("spower[8]", &self.spower(8usize))
.field("spower[9]", &self.spower(9usize))
.field("spower[10]", &self.spower(10usize))
.field("spower[11]", &self.spower(11usize))
.field("spower[12]", &self.spower(12usize))
.field("spower[13]", &self.spower(13usize))
.field("spower[14]", &self.spower(14usize))
.field("spower[15]", &self.spower(15usize))
.field("sretention[0]", &self.sretention(0usize))
.field("sretention[1]", &self.sretention(1usize))
.field("sretention[2]", &self.sretention(2usize))
.field("sretention[3]", &self.sretention(3usize))
.field("sretention[4]", &self.sretention(4usize))
.field("sretention[5]", &self.sretention(5usize))
.field("sretention[6]", &self.sretention(6usize))
.field("sretention[7]", &self.sretention(7usize))
.field("sretention[8]", &self.sretention(8usize))
.field("sretention[9]", &self.sretention(9usize))
.field("sretention[10]", &self.sretention(10usize))
.field("sretention[11]", &self.sretention(11usize))
.field("sretention[12]", &self.sretention(12usize))
.field("sretention[13]", &self.sretention(13usize))
.field("sretention[14]", &self.sretention(14usize))
.field("sretention[15]", &self.sretention(15usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Power {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Power {{ spower[0]: {=bool:?}, spower[1]: {=bool:?}, spower[2]: {=bool:?}, spower[3]: {=bool:?}, spower[4]: {=bool:?}, spower[5]: {=bool:?}, spower[6]: {=bool:?}, spower[7]: {=bool:?}, spower[8]: {=bool:?}, spower[9]: {=bool:?}, spower[10]: {=bool:?}, spower[11]: {=bool:?}, spower[12]: {=bool:?}, spower[13]: {=bool:?}, spower[14]: {=bool:?}, spower[15]: {=bool:?}, sretention[0]: {=bool:?}, sretention[1]: {=bool:?}, sretention[2]: {=bool:?}, sretention[3]: {=bool:?}, sretention[4]: {=bool:?}, sretention[5]: {=bool:?}, sretention[6]: {=bool:?}, sretention[7]: {=bool:?}, sretention[8]: {=bool:?}, sretention[9]: {=bool:?}, sretention[10]: {=bool:?}, sretention[11]: {=bool:?}, sretention[12]: {=bool:?}, sretention[13]: {=bool:?}, sretention[14]: {=bool:?}, sretention[15]: {=bool:?} }}" , self . spower (0usize) , self . spower (1usize) , self . spower (2usize) , self . spower (3usize) , self . spower (4usize) , self . spower (5usize) , self . spower (6usize) , self . spower (7usize) , self . spower (8usize) , self . spower (9usize) , self . spower (10usize) , self . spower (11usize) , self . spower (12usize) , self . spower (13usize) , self . spower (14usize) , self . spower (15usize) , self . sretention (0usize) , self . sretention (1usize) , self . sretention (2usize) , self . sretention (3usize) , self . sretention (4usize) , self . sretention (5usize) , self . sretention (6usize) , self . sretention (7usize) , self . sretention (8usize) , self . sretention (9usize) , self . sretention (10usize) , self . sretention (11usize) , self . sretention (12usize) , self . sretention (13usize) , self . sretention (14usize) , self . sretention (15usize))
}
}
}
}
pub mod wdt {
#[doc = "Watchdog Timer 0."]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Wdt {
ptr: *mut u8,
}
unsafe impl Send for Wdt {}
unsafe impl Sync for Wdt {}
impl Wdt {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "Start WDT."]
#[inline(always)]
pub const fn tasks_start(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0usize) as _) }
}
#[doc = "Stop WDT."]
#[inline(always)]
pub const fn tasks_stop(self) -> crate::common::Reg<u32, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x04usize) as _) }
}
#[doc = "Subscribe configuration for task START."]
#[inline(always)]
pub const fn subscribe_start(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x80usize) as _) }
}
#[doc = "Subscribe configuration for task STOP."]
#[inline(always)]
pub const fn subscribe_stop(
self,
) -> crate::common::Reg<super::shared::regs::Subscribe, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x84usize) as _) }
}
#[doc = "Watchdog timeout."]
#[inline(always)]
pub const fn events_timeout(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0100usize) as _) }
}
#[doc = "Watchdog stopped."]
#[inline(always)]
pub const fn events_stopped(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0104usize) as _) }
}
#[doc = "Publish configuration for event TIMEOUT."]
#[inline(always)]
pub const fn publish_timeout(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0180usize) as _) }
}
#[doc = "Publish configuration for event STOPPED."]
#[inline(always)]
pub const fn publish_stopped(
self,
) -> crate::common::Reg<super::shared::regs::Publish, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0184usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn intenset(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0304usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn intenclr(self) -> crate::common::Reg<regs::Int, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0308usize) as _) }
}
#[doc = "Enable interrupt."]
#[inline(always)]
pub const fn nmienset(self) -> crate::common::Reg<regs::Nmi, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0324usize) as _) }
}
#[doc = "Disable interrupt."]
#[inline(always)]
pub const fn nmienclr(self) -> crate::common::Reg<regs::Nmi, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0328usize) as _) }
}
#[doc = "Run status."]
#[inline(always)]
pub const fn runstatus(self) -> crate::common::Reg<regs::Runstatus, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0400usize) as _) }
}
#[doc = "Request status."]
#[inline(always)]
pub const fn reqstatus(self) -> crate::common::Reg<regs::Reqstatus, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0404usize) as _) }
}
#[doc = "Counter reload value."]
#[inline(always)]
pub const fn crv(self) -> crate::common::Reg<u32, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0504usize) as _) }
}
#[doc = "Enable register for reload request registers."]
#[inline(always)]
pub const fn rren(self) -> crate::common::Reg<regs::Rren, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0508usize) as _) }
}
#[doc = "Configuration register."]
#[inline(always)]
pub const fn config(self) -> crate::common::Reg<regs::Config, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x050cusize) as _) }
}
#[doc = "Task stop enable."]
#[inline(always)]
pub const fn tsen(self) -> crate::common::Reg<regs::Tsen, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0520usize) as _) }
}
#[doc = "Description collection: Reload request n."]
#[inline(always)]
pub const fn rr(self, n: usize) -> crate::common::Reg<regs::Rr, crate::common::W> {
assert!(n < 8usize);
unsafe {
crate::common::Reg::from_ptr(self.ptr.wrapping_add(0x0600usize + n * 4usize) as _)
}
}
}
pub mod regs {
#[doc = "Configuration register."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Config(pub u32);
impl Config {
#[doc = "Configure WDT to either be paused, or kept running, while the CPU is sleeping."]
#[must_use]
#[inline(always)]
pub const fn sleep(&self) -> super::vals::Sleep {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Sleep::from_bits(val as u8)
}
#[doc = "Configure WDT to either be paused, or kept running, while the CPU is sleeping."]
#[inline(always)]
pub const fn set_sleep(&mut self, val: super::vals::Sleep) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "Configure WDT to either be paused, or kept running, while the CPU is halted by the debugger."]
#[must_use]
#[inline(always)]
pub const fn halt(&self) -> super::vals::Halt {
let val = (self.0 >> 3usize) & 0x01;
super::vals::Halt::from_bits(val as u8)
}
#[doc = "Configure WDT to either be paused, or kept running, while the CPU is halted by the debugger."]
#[inline(always)]
pub const fn set_halt(&mut self, val: super::vals::Halt) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val.to_bits() as u32) & 0x01) << 3usize);
}
#[doc = "Allow stopping WDT."]
#[must_use]
#[inline(always)]
pub const fn stopen(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Allow stopping WDT."]
#[inline(always)]
pub const fn set_stopen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
}
impl Default for Config {
#[inline(always)]
fn default() -> Config {
Config(0)
}
}
impl core::fmt::Debug for Config {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Config")
.field("sleep", &self.sleep())
.field("halt", &self.halt())
.field("stopen", &self.stopen())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Config {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Config {{ sleep: {:?}, halt: {:?}, stopen: {=bool:?} }}",
self.sleep(),
self.halt(),
self.stopen()
)
}
}
#[doc = "Disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Int(pub u32);
impl Int {
#[doc = "Write '1' to disable interrupt for event TIMEOUT."]
#[must_use]
#[inline(always)]
pub const fn timeout(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event TIMEOUT."]
#[inline(always)]
pub const fn set_timeout(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Write '1' to disable interrupt for event STOPPED."]
#[must_use]
#[inline(always)]
pub const fn stopped(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event STOPPED."]
#[inline(always)]
pub const fn set_stopped(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
}
impl Default for Int {
#[inline(always)]
fn default() -> Int {
Int(0)
}
}
impl core::fmt::Debug for Int {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Int")
.field("timeout", &self.timeout())
.field("stopped", &self.stopped())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Int {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Int {{ timeout: {=bool:?}, stopped: {=bool:?} }}",
self.timeout(),
self.stopped()
)
}
}
#[doc = "Disable interrupt."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Nmi(pub u32);
impl Nmi {
#[doc = "Write '1' to disable interrupt for event TIMEOUT."]
#[must_use]
#[inline(always)]
pub const fn timeout(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event TIMEOUT."]
#[inline(always)]
pub const fn set_timeout(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Write '1' to disable interrupt for event STOPPED."]
#[must_use]
#[inline(always)]
pub const fn stopped(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Write '1' to disable interrupt for event STOPPED."]
#[inline(always)]
pub const fn set_stopped(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
}
impl Default for Nmi {
#[inline(always)]
fn default() -> Nmi {
Nmi(0)
}
}
impl core::fmt::Debug for Nmi {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Nmi")
.field("timeout", &self.timeout())
.field("stopped", &self.stopped())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Nmi {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Nmi {{ timeout: {=bool:?}, stopped: {=bool:?} }}",
self.timeout(),
self.stopped()
)
}
}
#[doc = "Request status."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Reqstatus(pub u32);
impl Reqstatus {
#[doc = "Request status for RR\\[0\\] register."]
#[must_use]
#[inline(always)]
pub const fn rr(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Request status for RR\\[0\\] register."]
#[inline(always)]
pub const fn set_rr(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Reqstatus {
#[inline(always)]
fn default() -> Reqstatus {
Reqstatus(0)
}
}
impl core::fmt::Debug for Reqstatus {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Reqstatus")
.field("rr[0]", &self.rr(0usize))
.field("rr[1]", &self.rr(1usize))
.field("rr[2]", &self.rr(2usize))
.field("rr[3]", &self.rr(3usize))
.field("rr[4]", &self.rr(4usize))
.field("rr[5]", &self.rr(5usize))
.field("rr[6]", &self.rr(6usize))
.field("rr[7]", &self.rr(7usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Reqstatus {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Reqstatus {{ rr[0]: {=bool:?}, rr[1]: {=bool:?}, rr[2]: {=bool:?}, rr[3]: {=bool:?}, rr[4]: {=bool:?}, rr[5]: {=bool:?}, rr[6]: {=bool:?}, rr[7]: {=bool:?} }}" , self . rr (0usize) , self . rr (1usize) , self . rr (2usize) , self . rr (3usize) , self . rr (4usize) , self . rr (5usize) , self . rr (6usize) , self . rr (7usize))
}
}
#[doc = "Description collection: Reload request n."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Rr(pub u32);
impl Rr {
#[doc = "Reload request register."]
#[must_use]
#[inline(always)]
pub const fn rr(&self) -> super::vals::Rr {
let val = (self.0 >> 0usize) & 0xffff_ffff;
super::vals::Rr::from_bits(val as u32)
}
#[doc = "Reload request register."]
#[inline(always)]
pub const fn set_rr(&mut self, val: super::vals::Rr) {
self.0 = (self.0 & !(0xffff_ffff << 0usize))
| (((val.to_bits() as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Rr {
#[inline(always)]
fn default() -> Rr {
Rr(0)
}
}
impl core::fmt::Debug for Rr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Rr").field("rr", &self.rr()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Rr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Rr {{ rr: {:?} }}", self.rr())
}
}
#[doc = "Enable register for reload request registers."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Rren(pub u32);
impl Rren {
#[doc = "Enable or disable RR\\[0\\] register."]
#[must_use]
#[inline(always)]
pub const fn rr(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Enable or disable RR\\[0\\] register."]
#[inline(always)]
pub const fn set_rr(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Rren {
#[inline(always)]
fn default() -> Rren {
Rren(0)
}
}
impl core::fmt::Debug for Rren {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Rren")
.field("rr[0]", &self.rr(0usize))
.field("rr[1]", &self.rr(1usize))
.field("rr[2]", &self.rr(2usize))
.field("rr[3]", &self.rr(3usize))
.field("rr[4]", &self.rr(4usize))
.field("rr[5]", &self.rr(5usize))
.field("rr[6]", &self.rr(6usize))
.field("rr[7]", &self.rr(7usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Rren {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Rren {{ rr[0]: {=bool:?}, rr[1]: {=bool:?}, rr[2]: {=bool:?}, rr[3]: {=bool:?}, rr[4]: {=bool:?}, rr[5]: {=bool:?}, rr[6]: {=bool:?}, rr[7]: {=bool:?} }}" , self . rr (0usize) , self . rr (1usize) , self . rr (2usize) , self . rr (3usize) , self . rr (4usize) , self . rr (5usize) , self . rr (6usize) , self . rr (7usize))
}
}
#[doc = "Run status."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Runstatus(pub u32);
impl Runstatus {
#[doc = "Indicates whether or not WDT is running."]
#[must_use]
#[inline(always)]
pub const fn runstatuswdt(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Indicates whether or not WDT is running."]
#[inline(always)]
pub const fn set_runstatuswdt(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Runstatus {
#[inline(always)]
fn default() -> Runstatus {
Runstatus(0)
}
}
impl core::fmt::Debug for Runstatus {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Runstatus")
.field("runstatuswdt", &self.runstatuswdt())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Runstatus {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Runstatus {{ runstatuswdt: {=bool:?} }}",
self.runstatuswdt()
)
}
}
#[doc = "Task stop enable."]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Tsen(pub u32);
impl Tsen {
#[doc = "Allow stopping WDT."]
#[must_use]
#[inline(always)]
pub const fn tsen(&self) -> super::vals::Tsen {
let val = (self.0 >> 0usize) & 0xffff_ffff;
super::vals::Tsen::from_bits(val as u32)
}
#[doc = "Allow stopping WDT."]
#[inline(always)]
pub const fn set_tsen(&mut self, val: super::vals::Tsen) {
self.0 = (self.0 & !(0xffff_ffff << 0usize))
| (((val.to_bits() as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Tsen {
#[inline(always)]
fn default() -> Tsen {
Tsen(0)
}
}
impl core::fmt::Debug for Tsen {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Tsen").field("tsen", &self.tsen()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Tsen {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Tsen {{ tsen: {:?} }}", self.tsen())
}
}
}
pub mod vals {
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Halt {
#[doc = "Pause WDT while the CPU is halted by the debugger."]
Pause = 0x0,
#[doc = "Keep WDT running while the CPU is halted by the debugger."]
Run = 0x01,
}
impl Halt {
#[inline(always)]
pub const fn from_bits(val: u8) -> Halt {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Halt {
#[inline(always)]
fn from(val: u8) -> Halt {
Halt::from_bits(val)
}
}
impl From<Halt> for u8 {
#[inline(always)]
fn from(val: Halt) -> u8 {
Halt::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Rr(u32);
impl Rr {
#[doc = "Value to request a reload of the watchdog timer."]
pub const Reload: Self = Self(0x6e52_4635);
}
impl Rr {
pub const fn from_bits(val: u32) -> Rr {
Self(val & 0xffff_ffff)
}
pub const fn to_bits(self) -> u32 {
self.0
}
}
impl core::fmt::Debug for Rr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x6e52_4635 => f.write_str("Reload"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Rr {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x6e52_4635 => defmt::write!(f, "Reload"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u32> for Rr {
#[inline(always)]
fn from(val: u32) -> Rr {
Rr::from_bits(val)
}
}
impl From<Rr> for u32 {
#[inline(always)]
fn from(val: Rr) -> u32 {
Rr::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Sleep {
#[doc = "Pause WDT while the CPU is sleeping."]
Pause = 0x0,
#[doc = "Keep WDT running while the CPU is sleeping."]
Run = 0x01,
}
impl Sleep {
#[inline(always)]
pub const fn from_bits(val: u8) -> Sleep {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Sleep {
#[inline(always)]
fn from(val: u8) -> Sleep {
Sleep::from_bits(val)
}
}
impl From<Sleep> for u8 {
#[inline(always)]
fn from(val: Sleep) -> u8 {
Sleep::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Tsen(u32);
impl Tsen {
#[doc = "Value to allow stopping WDT."]
pub const Enable: Self = Self(0x6e52_4635);
}
impl Tsen {
pub const fn from_bits(val: u32) -> Tsen {
Self(val & 0xffff_ffff)
}
pub const fn to_bits(self) -> u32 {
self.0
}
}
impl core::fmt::Debug for Tsen {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x6e52_4635 => f.write_str("Enable"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Tsen {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x6e52_4635 => defmt::write!(f, "Enable"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u32> for Tsen {
#[inline(always)]
fn from(val: u32) -> Tsen {
Tsen::from_bits(val)
}
}
impl From<Tsen> for u32 {
#[inline(always)]
fn from(val: Tsen) -> u32 {
Tsen::to_bits(val)
}
}
}
}