ambiq_apollo3_pac2/
lib.rs

1#![doc = "Peripheral access API for APOLLO3 microcontrollers (generated using svd2rust v0.19.0 ( ))\n\nYou can find an overview of the generated API [here].\n\nAPI features to be included in the [next]
2svd2rust release can be generated by cloning the svd2rust [repository], checking out the above commit, and running `cargo doc --open`.\n\n[here]: https://docs.rs/svd2rust/0.19.0/svd2rust/#peripheral-api\n[next]: https://github.com/rust-embedded/svd2rust/blob/master/CHANGELOG.md#unreleased\n[repository]: https://github.com/rust-embedded/svd2rust"]
3#![deny(const_err)]
4#![deny(dead_code)]
5#![deny(improper_ctypes)]
6#![deny(missing_docs)]
7#![deny(no_mangle_generic_items)]
8#![deny(non_shorthand_field_patterns)]
9#![deny(overflowing_literals)]
10#![deny(path_statements)]
11#![deny(patterns_in_fns_without_body)]
12#![deny(private_in_public)]
13#![deny(unconditional_recursion)]
14#![deny(unused_allocation)]
15#![deny(unused_comparisons)]
16#![deny(unused_parens)]
17#![deny(while_true)]
18#![allow(non_camel_case_types)]
19#![allow(non_snake_case)]
20#![no_std]
21use core::marker::PhantomData;
22use core::ops::Deref;
23#[doc = r"Number available in the NVIC for configuring priority"]
24pub const NVIC_PRIO_BITS: u8 = 3;
25#[cfg(feature = "rt")]
26pub use self::Interrupt as interrupt;
27pub use cortex_m::peripheral::Peripherals as CorePeripherals;
28pub use cortex_m::peripheral::{CBP, CPUID, DCB, DWT, FPB, FPU, ITM, MPU, NVIC, SCB, SYST, TPIU};
29#[cfg(feature = "rt")]
30pub use cortex_m_rt::interrupt;
31#[allow(unused_imports)]
32use generic::*;
33#[doc = r"Common register and bit access and modify traits"]
34pub mod generic;
35#[cfg(feature = "rt")]
36extern "C" {
37    fn BROWNOUT();
38    fn WDT();
39    fn RTC();
40    fn VCOMP();
41    fn IOSLAVE();
42    fn IOSLAVEACC();
43    fn IOMSTR0();
44    fn IOMSTR1();
45    fn IOMSTR2();
46    fn IOMSTR3();
47    fn IOMSTR4();
48    fn IOMSTR5();
49    fn BLE();
50    fn GPIO();
51    fn CTIMER();
52    fn UART0();
53    fn UART1();
54    fn SCARD();
55    fn ADC();
56    fn PDM();
57    fn MSPI();
58    fn STIMER();
59    fn STIMER_CMPR0();
60    fn STIMER_CMPR1();
61    fn STIMER_CMPR2();
62    fn STIMER_CMPR3();
63    fn STIMER_CMPR4();
64    fn STIMER_CMPR5();
65    fn STIMER_CMPR6();
66    fn STIMER_CMPR7();
67    fn CLKGEN();
68}
69#[doc(hidden)]
70pub union Vector {
71    _handler: unsafe extern "C" fn(),
72    _reserved: u32,
73}
74#[cfg(feature = "rt")]
75#[doc(hidden)]
76#[link_section = ".vector_table.interrupts"]
77#[no_mangle]
78pub static __INTERRUPTS: [Vector; 32] = [
79    Vector { _handler: BROWNOUT },
80    Vector { _handler: WDT },
81    Vector { _handler: RTC },
82    Vector { _handler: VCOMP },
83    Vector { _handler: IOSLAVE },
84    Vector {
85        _handler: IOSLAVEACC,
86    },
87    Vector { _handler: IOMSTR0 },
88    Vector { _handler: IOMSTR1 },
89    Vector { _handler: IOMSTR2 },
90    Vector { _handler: IOMSTR3 },
91    Vector { _handler: IOMSTR4 },
92    Vector { _handler: IOMSTR5 },
93    Vector { _handler: BLE },
94    Vector { _handler: GPIO },
95    Vector { _handler: CTIMER },
96    Vector { _handler: UART0 },
97    Vector { _handler: UART1 },
98    Vector { _handler: SCARD },
99    Vector { _handler: ADC },
100    Vector { _handler: PDM },
101    Vector { _handler: MSPI },
102    Vector { _reserved: 0 },
103    Vector { _handler: STIMER },
104    Vector {
105        _handler: STIMER_CMPR0,
106    },
107    Vector {
108        _handler: STIMER_CMPR1,
109    },
110    Vector {
111        _handler: STIMER_CMPR2,
112    },
113    Vector {
114        _handler: STIMER_CMPR3,
115    },
116    Vector {
117        _handler: STIMER_CMPR4,
118    },
119    Vector {
120        _handler: STIMER_CMPR5,
121    },
122    Vector {
123        _handler: STIMER_CMPR6,
124    },
125    Vector {
126        _handler: STIMER_CMPR7,
127    },
128    Vector { _handler: CLKGEN },
129];
130#[doc = r"Enumeration of all the interrupts."]
131#[derive(Copy, Clone, Debug, PartialEq, Eq)]
132#[repr(u16)]
133pub enum Interrupt {
134    #[doc = "0 - BROWNOUT"]
135    BROWNOUT = 0,
136    #[doc = "1 - WDT"]
137    WDT = 1,
138    #[doc = "2 - RTC"]
139    RTC = 2,
140    #[doc = "3 - VCOMP"]
141    VCOMP = 3,
142    #[doc = "4 - IOSLAVE"]
143    IOSLAVE = 4,
144    #[doc = "5 - IOSLAVEACC"]
145    IOSLAVEACC = 5,
146    #[doc = "6 - IOMSTR0"]
147    IOMSTR0 = 6,
148    #[doc = "7 - IOMSTR1"]
149    IOMSTR1 = 7,
150    #[doc = "8 - IOMSTR2"]
151    IOMSTR2 = 8,
152    #[doc = "9 - IOMSTR3"]
153    IOMSTR3 = 9,
154    #[doc = "10 - IOMSTR4"]
155    IOMSTR4 = 10,
156    #[doc = "11 - IOMSTR5"]
157    IOMSTR5 = 11,
158    #[doc = "12 - BLE"]
159    BLE = 12,
160    #[doc = "13 - GPIO"]
161    GPIO = 13,
162    #[doc = "14 - CTIMER"]
163    CTIMER = 14,
164    #[doc = "15 - UART0"]
165    UART0 = 15,
166    #[doc = "16 - UART1"]
167    UART1 = 16,
168    #[doc = "17 - SCARD"]
169    SCARD = 17,
170    #[doc = "18 - ADC"]
171    ADC = 18,
172    #[doc = "19 - PDM"]
173    PDM = 19,
174    #[doc = "20 - MSPI"]
175    MSPI = 20,
176    #[doc = "22 - STIMER"]
177    STIMER = 22,
178    #[doc = "23 - STIMER_CMPR0"]
179    STIMER_CMPR0 = 23,
180    #[doc = "24 - STIMER_CMPR1"]
181    STIMER_CMPR1 = 24,
182    #[doc = "25 - STIMER_CMPR2"]
183    STIMER_CMPR2 = 25,
184    #[doc = "26 - STIMER_CMPR3"]
185    STIMER_CMPR3 = 26,
186    #[doc = "27 - STIMER_CMPR4"]
187    STIMER_CMPR4 = 27,
188    #[doc = "28 - STIMER_CMPR5"]
189    STIMER_CMPR5 = 28,
190    #[doc = "29 - STIMER_CMPR6"]
191    STIMER_CMPR6 = 29,
192    #[doc = "30 - STIMER_CMPR7"]
193    STIMER_CMPR7 = 30,
194    #[doc = "31 - CLKGEN"]
195    CLKGEN = 31,
196}
197unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
198    #[inline(always)]
199    fn number(self) -> u16 {
200        self as u16
201    }
202}
203#[doc = "Analog Digital Converter Control"]
204pub struct ADC {
205    _marker: PhantomData<*const ()>,
206}
207unsafe impl Send for ADC {}
208impl ADC {
209    #[doc = r"Pointer to the register block"]
210    pub const PTR: *const adc::RegisterBlock = 0x5001_0000 as *const _;
211    #[doc = r"Return the pointer to the register block"]
212    #[inline(always)]
213    pub const fn ptr() -> *const adc::RegisterBlock {
214        Self::PTR
215    }
216}
217impl Deref for ADC {
218    type Target = adc::RegisterBlock;
219    #[inline(always)]
220    fn deref(&self) -> &Self::Target {
221        unsafe { &*Self::PTR }
222    }
223}
224impl core::fmt::Debug for ADC {
225    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
226        f.debug_struct("ADC").finish()
227    }
228}
229#[doc = "Analog Digital Converter Control"]
230pub mod adc;
231#[doc = "APB DMA Register Interfaces"]
232pub struct APBDMA {
233    _marker: PhantomData<*const ()>,
234}
235unsafe impl Send for APBDMA {}
236impl APBDMA {
237    #[doc = r"Pointer to the register block"]
238    pub const PTR: *const apbdma::RegisterBlock = 0x4001_1000 as *const _;
239    #[doc = r"Return the pointer to the register block"]
240    #[inline(always)]
241    pub const fn ptr() -> *const apbdma::RegisterBlock {
242        Self::PTR
243    }
244}
245impl Deref for APBDMA {
246    type Target = apbdma::RegisterBlock;
247    #[inline(always)]
248    fn deref(&self) -> &Self::Target {
249        unsafe { &*Self::PTR }
250    }
251}
252impl core::fmt::Debug for APBDMA {
253    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
254        f.debug_struct("APBDMA").finish()
255    }
256}
257#[doc = "APB DMA Register Interfaces"]
258pub mod apbdma;
259#[doc = "BLE Interface"]
260pub struct BLEIF {
261    _marker: PhantomData<*const ()>,
262}
263unsafe impl Send for BLEIF {}
264impl BLEIF {
265    #[doc = r"Pointer to the register block"]
266    pub const PTR: *const bleif::RegisterBlock = 0x5000_c000 as *const _;
267    #[doc = r"Return the pointer to the register block"]
268    #[inline(always)]
269    pub const fn ptr() -> *const bleif::RegisterBlock {
270        Self::PTR
271    }
272}
273impl Deref for BLEIF {
274    type Target = bleif::RegisterBlock;
275    #[inline(always)]
276    fn deref(&self) -> &Self::Target {
277        unsafe { &*Self::PTR }
278    }
279}
280impl core::fmt::Debug for BLEIF {
281    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
282        f.debug_struct("BLEIF").finish()
283    }
284}
285#[doc = "BLE Interface"]
286pub mod bleif;
287#[doc = "Flash Cache Controller"]
288pub struct CACHECTRL {
289    _marker: PhantomData<*const ()>,
290}
291unsafe impl Send for CACHECTRL {}
292impl CACHECTRL {
293    #[doc = r"Pointer to the register block"]
294    pub const PTR: *const cachectrl::RegisterBlock = 0x4001_8000 as *const _;
295    #[doc = r"Return the pointer to the register block"]
296    #[inline(always)]
297    pub const fn ptr() -> *const cachectrl::RegisterBlock {
298        Self::PTR
299    }
300}
301impl Deref for CACHECTRL {
302    type Target = cachectrl::RegisterBlock;
303    #[inline(always)]
304    fn deref(&self) -> &Self::Target {
305        unsafe { &*Self::PTR }
306    }
307}
308impl core::fmt::Debug for CACHECTRL {
309    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
310        f.debug_struct("CACHECTRL").finish()
311    }
312}
313#[doc = "Flash Cache Controller"]
314pub mod cachectrl;
315#[doc = "Clock Generator"]
316pub struct CLKGEN {
317    _marker: PhantomData<*const ()>,
318}
319unsafe impl Send for CLKGEN {}
320impl CLKGEN {
321    #[doc = r"Pointer to the register block"]
322    pub const PTR: *const clkgen::RegisterBlock = 0x4000_4000 as *const _;
323    #[doc = r"Return the pointer to the register block"]
324    #[inline(always)]
325    pub const fn ptr() -> *const clkgen::RegisterBlock {
326        Self::PTR
327    }
328}
329impl Deref for CLKGEN {
330    type Target = clkgen::RegisterBlock;
331    #[inline(always)]
332    fn deref(&self) -> &Self::Target {
333        unsafe { &*Self::PTR }
334    }
335}
336impl core::fmt::Debug for CLKGEN {
337    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
338        f.debug_struct("CLKGEN").finish()
339    }
340}
341#[doc = "Clock Generator"]
342pub mod clkgen;
343#[doc = "Counter/Timer"]
344pub struct CTIMER {
345    _marker: PhantomData<*const ()>,
346}
347unsafe impl Send for CTIMER {}
348impl CTIMER {
349    #[doc = r"Pointer to the register block"]
350    pub const PTR: *const ctimer::RegisterBlock = 0x4000_8000 as *const _;
351    #[doc = r"Return the pointer to the register block"]
352    #[inline(always)]
353    pub const fn ptr() -> *const ctimer::RegisterBlock {
354        Self::PTR
355    }
356}
357impl Deref for CTIMER {
358    type Target = ctimer::RegisterBlock;
359    #[inline(always)]
360    fn deref(&self) -> &Self::Target {
361        unsafe { &*Self::PTR }
362    }
363}
364impl core::fmt::Debug for CTIMER {
365    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
366        f.debug_struct("CTIMER").finish()
367    }
368}
369#[doc = "Counter/Timer"]
370pub mod ctimer;
371#[doc = "General Purpose IO"]
372pub struct GPIO {
373    _marker: PhantomData<*const ()>,
374}
375unsafe impl Send for GPIO {}
376impl GPIO {
377    #[doc = r"Pointer to the register block"]
378    pub const PTR: *const gpio::RegisterBlock = 0x4001_0000 as *const _;
379    #[doc = r"Return the pointer to the register block"]
380    #[inline(always)]
381    pub const fn ptr() -> *const gpio::RegisterBlock {
382        Self::PTR
383    }
384}
385impl Deref for GPIO {
386    type Target = gpio::RegisterBlock;
387    #[inline(always)]
388    fn deref(&self) -> &Self::Target {
389        unsafe { &*Self::PTR }
390    }
391}
392impl core::fmt::Debug for GPIO {
393    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
394        f.debug_struct("GPIO").finish()
395    }
396}
397#[doc = "General Purpose IO"]
398pub mod gpio;
399#[doc = "IO Peripheral Master"]
400pub struct IOM0 {
401    _marker: PhantomData<*const ()>,
402}
403unsafe impl Send for IOM0 {}
404impl IOM0 {
405    #[doc = r"Pointer to the register block"]
406    pub const PTR: *const iom0::RegisterBlock = 0x5000_4000 as *const _;
407    #[doc = r"Return the pointer to the register block"]
408    #[inline(always)]
409    pub const fn ptr() -> *const iom0::RegisterBlock {
410        Self::PTR
411    }
412}
413impl Deref for IOM0 {
414    type Target = iom0::RegisterBlock;
415    #[inline(always)]
416    fn deref(&self) -> &Self::Target {
417        unsafe { &*Self::PTR }
418    }
419}
420impl core::fmt::Debug for IOM0 {
421    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
422        f.debug_struct("IOM0").finish()
423    }
424}
425#[doc = "IO Peripheral Master"]
426pub mod iom0;
427#[doc = "IO Peripheral Master"]
428pub struct IOM1 {
429    _marker: PhantomData<*const ()>,
430}
431unsafe impl Send for IOM1 {}
432impl IOM1 {
433    #[doc = r"Pointer to the register block"]
434    pub const PTR: *const iom0::RegisterBlock = 0x5000_5000 as *const _;
435    #[doc = r"Return the pointer to the register block"]
436    #[inline(always)]
437    pub const fn ptr() -> *const iom0::RegisterBlock {
438        Self::PTR
439    }
440}
441impl Deref for IOM1 {
442    type Target = iom0::RegisterBlock;
443    #[inline(always)]
444    fn deref(&self) -> &Self::Target {
445        unsafe { &*Self::PTR }
446    }
447}
448impl core::fmt::Debug for IOM1 {
449    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
450        f.debug_struct("IOM1").finish()
451    }
452}
453#[doc = "IO Peripheral Master"]
454pub struct IOM2 {
455    _marker: PhantomData<*const ()>,
456}
457unsafe impl Send for IOM2 {}
458impl IOM2 {
459    #[doc = r"Pointer to the register block"]
460    pub const PTR: *const iom0::RegisterBlock = 0x5000_6000 as *const _;
461    #[doc = r"Return the pointer to the register block"]
462    #[inline(always)]
463    pub const fn ptr() -> *const iom0::RegisterBlock {
464        Self::PTR
465    }
466}
467impl Deref for IOM2 {
468    type Target = iom0::RegisterBlock;
469    #[inline(always)]
470    fn deref(&self) -> &Self::Target {
471        unsafe { &*Self::PTR }
472    }
473}
474impl core::fmt::Debug for IOM2 {
475    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
476        f.debug_struct("IOM2").finish()
477    }
478}
479#[doc = "IO Peripheral Master"]
480pub struct IOM3 {
481    _marker: PhantomData<*const ()>,
482}
483unsafe impl Send for IOM3 {}
484impl IOM3 {
485    #[doc = r"Pointer to the register block"]
486    pub const PTR: *const iom0::RegisterBlock = 0x5000_7000 as *const _;
487    #[doc = r"Return the pointer to the register block"]
488    #[inline(always)]
489    pub const fn ptr() -> *const iom0::RegisterBlock {
490        Self::PTR
491    }
492}
493impl Deref for IOM3 {
494    type Target = iom0::RegisterBlock;
495    #[inline(always)]
496    fn deref(&self) -> &Self::Target {
497        unsafe { &*Self::PTR }
498    }
499}
500impl core::fmt::Debug for IOM3 {
501    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
502        f.debug_struct("IOM3").finish()
503    }
504}
505#[doc = "IO Peripheral Master"]
506pub struct IOM4 {
507    _marker: PhantomData<*const ()>,
508}
509unsafe impl Send for IOM4 {}
510impl IOM4 {
511    #[doc = r"Pointer to the register block"]
512    pub const PTR: *const iom0::RegisterBlock = 0x5000_8000 as *const _;
513    #[doc = r"Return the pointer to the register block"]
514    #[inline(always)]
515    pub const fn ptr() -> *const iom0::RegisterBlock {
516        Self::PTR
517    }
518}
519impl Deref for IOM4 {
520    type Target = iom0::RegisterBlock;
521    #[inline(always)]
522    fn deref(&self) -> &Self::Target {
523        unsafe { &*Self::PTR }
524    }
525}
526impl core::fmt::Debug for IOM4 {
527    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
528        f.debug_struct("IOM4").finish()
529    }
530}
531#[doc = "IO Peripheral Master"]
532pub struct IOM5 {
533    _marker: PhantomData<*const ()>,
534}
535unsafe impl Send for IOM5 {}
536impl IOM5 {
537    #[doc = r"Pointer to the register block"]
538    pub const PTR: *const iom0::RegisterBlock = 0x5000_9000 as *const _;
539    #[doc = r"Return the pointer to the register block"]
540    #[inline(always)]
541    pub const fn ptr() -> *const iom0::RegisterBlock {
542        Self::PTR
543    }
544}
545impl Deref for IOM5 {
546    type Target = iom0::RegisterBlock;
547    #[inline(always)]
548    fn deref(&self) -> &Self::Target {
549        unsafe { &*Self::PTR }
550    }
551}
552impl core::fmt::Debug for IOM5 {
553    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
554        f.debug_struct("IOM5").finish()
555    }
556}
557#[doc = "I2C/SPI Slave"]
558pub struct IOSLAVE {
559    _marker: PhantomData<*const ()>,
560}
561unsafe impl Send for IOSLAVE {}
562impl IOSLAVE {
563    #[doc = r"Pointer to the register block"]
564    pub const PTR: *const ioslave::RegisterBlock = 0x5000_0000 as *const _;
565    #[doc = r"Return the pointer to the register block"]
566    #[inline(always)]
567    pub const fn ptr() -> *const ioslave::RegisterBlock {
568        Self::PTR
569    }
570}
571impl Deref for IOSLAVE {
572    type Target = ioslave::RegisterBlock;
573    #[inline(always)]
574    fn deref(&self) -> &Self::Target {
575        unsafe { &*Self::PTR }
576    }
577}
578impl core::fmt::Debug for IOSLAVE {
579    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
580        f.debug_struct("IOSLAVE").finish()
581    }
582}
583#[doc = "I2C/SPI Slave"]
584pub mod ioslave;
585#[doc = "MCU Miscellaneous Control Logic"]
586pub struct MCUCTRL {
587    _marker: PhantomData<*const ()>,
588}
589unsafe impl Send for MCUCTRL {}
590impl MCUCTRL {
591    #[doc = r"Pointer to the register block"]
592    pub const PTR: *const mcuctrl::RegisterBlock = 0x4002_0000 as *const _;
593    #[doc = r"Return the pointer to the register block"]
594    #[inline(always)]
595    pub const fn ptr() -> *const mcuctrl::RegisterBlock {
596        Self::PTR
597    }
598}
599impl Deref for MCUCTRL {
600    type Target = mcuctrl::RegisterBlock;
601    #[inline(always)]
602    fn deref(&self) -> &Self::Target {
603        unsafe { &*Self::PTR }
604    }
605}
606impl core::fmt::Debug for MCUCTRL {
607    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
608        f.debug_struct("MCUCTRL").finish()
609    }
610}
611#[doc = "MCU Miscellaneous Control Logic"]
612pub mod mcuctrl;
613#[doc = "Multibit SPI Master"]
614pub struct MSPI {
615    _marker: PhantomData<*const ()>,
616}
617unsafe impl Send for MSPI {}
618impl MSPI {
619    #[doc = r"Pointer to the register block"]
620    pub const PTR: *const mspi::RegisterBlock = 0x5001_4000 as *const _;
621    #[doc = r"Return the pointer to the register block"]
622    #[inline(always)]
623    pub const fn ptr() -> *const mspi::RegisterBlock {
624        Self::PTR
625    }
626}
627impl Deref for MSPI {
628    type Target = mspi::RegisterBlock;
629    #[inline(always)]
630    fn deref(&self) -> &Self::Target {
631        unsafe { &*Self::PTR }
632    }
633}
634impl core::fmt::Debug for MSPI {
635    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
636        f.debug_struct("MSPI").finish()
637    }
638}
639#[doc = "Multibit SPI Master"]
640pub mod mspi;
641#[doc = "PDM Audio"]
642pub struct PDM {
643    _marker: PhantomData<*const ()>,
644}
645unsafe impl Send for PDM {}
646impl PDM {
647    #[doc = r"Pointer to the register block"]
648    pub const PTR: *const pdm::RegisterBlock = 0x5001_1000 as *const _;
649    #[doc = r"Return the pointer to the register block"]
650    #[inline(always)]
651    pub const fn ptr() -> *const pdm::RegisterBlock {
652        Self::PTR
653    }
654}
655impl Deref for PDM {
656    type Target = pdm::RegisterBlock;
657    #[inline(always)]
658    fn deref(&self) -> &Self::Target {
659        unsafe { &*Self::PTR }
660    }
661}
662impl core::fmt::Debug for PDM {
663    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
664        f.debug_struct("PDM").finish()
665    }
666}
667#[doc = "PDM Audio"]
668pub mod pdm;
669#[doc = "PWR Controller Register Bank"]
670pub struct PWRCTRL {
671    _marker: PhantomData<*const ()>,
672}
673unsafe impl Send for PWRCTRL {}
674impl PWRCTRL {
675    #[doc = r"Pointer to the register block"]
676    pub const PTR: *const pwrctrl::RegisterBlock = 0x4002_1000 as *const _;
677    #[doc = r"Return the pointer to the register block"]
678    #[inline(always)]
679    pub const fn ptr() -> *const pwrctrl::RegisterBlock {
680        Self::PTR
681    }
682}
683impl Deref for PWRCTRL {
684    type Target = pwrctrl::RegisterBlock;
685    #[inline(always)]
686    fn deref(&self) -> &Self::Target {
687        unsafe { &*Self::PTR }
688    }
689}
690impl core::fmt::Debug for PWRCTRL {
691    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
692        f.debug_struct("PWRCTRL").finish()
693    }
694}
695#[doc = "PWR Controller Register Bank"]
696pub mod pwrctrl;
697#[doc = "MCU Reset Generator"]
698pub struct RSTGEN {
699    _marker: PhantomData<*const ()>,
700}
701unsafe impl Send for RSTGEN {}
702impl RSTGEN {
703    #[doc = r"Pointer to the register block"]
704    pub const PTR: *const rstgen::RegisterBlock = 0x4000_0000 as *const _;
705    #[doc = r"Return the pointer to the register block"]
706    #[inline(always)]
707    pub const fn ptr() -> *const rstgen::RegisterBlock {
708        Self::PTR
709    }
710}
711impl Deref for RSTGEN {
712    type Target = rstgen::RegisterBlock;
713    #[inline(always)]
714    fn deref(&self) -> &Self::Target {
715        unsafe { &*Self::PTR }
716    }
717}
718impl core::fmt::Debug for RSTGEN {
719    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
720        f.debug_struct("RSTGEN").finish()
721    }
722}
723#[doc = "MCU Reset Generator"]
724pub mod rstgen;
725#[doc = "Real Time Clock"]
726pub struct RTC {
727    _marker: PhantomData<*const ()>,
728}
729unsafe impl Send for RTC {}
730impl RTC {
731    #[doc = r"Pointer to the register block"]
732    pub const PTR: *const rtc::RegisterBlock = 0x4000_4200 as *const _;
733    #[doc = r"Return the pointer to the register block"]
734    #[inline(always)]
735    pub const fn ptr() -> *const rtc::RegisterBlock {
736        Self::PTR
737    }
738}
739impl Deref for RTC {
740    type Target = rtc::RegisterBlock;
741    #[inline(always)]
742    fn deref(&self) -> &Self::Target {
743        unsafe { &*Self::PTR }
744    }
745}
746impl core::fmt::Debug for RTC {
747    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
748        f.debug_struct("RTC").finish()
749    }
750}
751#[doc = "Real Time Clock"]
752pub mod rtc;
753#[doc = "Serial ISO7816"]
754pub struct SCARD {
755    _marker: PhantomData<*const ()>,
756}
757unsafe impl Send for SCARD {}
758impl SCARD {
759    #[doc = r"Pointer to the register block"]
760    pub const PTR: *const scard::RegisterBlock = 0x4008_0000 as *const _;
761    #[doc = r"Return the pointer to the register block"]
762    #[inline(always)]
763    pub const fn ptr() -> *const scard::RegisterBlock {
764        Self::PTR
765    }
766}
767impl Deref for SCARD {
768    type Target = scard::RegisterBlock;
769    #[inline(always)]
770    fn deref(&self) -> &Self::Target {
771        unsafe { &*Self::PTR }
772    }
773}
774impl core::fmt::Debug for SCARD {
775    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
776        f.debug_struct("SCARD").finish()
777    }
778}
779#[doc = "Serial ISO7816"]
780pub mod scard;
781#[doc = "Security Interfaces"]
782pub struct SECURITY {
783    _marker: PhantomData<*const ()>,
784}
785unsafe impl Send for SECURITY {}
786impl SECURITY {
787    #[doc = r"Pointer to the register block"]
788    pub const PTR: *const security::RegisterBlock = 0x4003_0000 as *const _;
789    #[doc = r"Return the pointer to the register block"]
790    #[inline(always)]
791    pub const fn ptr() -> *const security::RegisterBlock {
792        Self::PTR
793    }
794}
795impl Deref for SECURITY {
796    type Target = security::RegisterBlock;
797    #[inline(always)]
798    fn deref(&self) -> &Self::Target {
799        unsafe { &*Self::PTR }
800    }
801}
802impl core::fmt::Debug for SECURITY {
803    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
804        f.debug_struct("SECURITY").finish()
805    }
806}
807#[doc = "Security Interfaces"]
808pub mod security;
809#[doc = "Serial UART"]
810pub struct UART0 {
811    _marker: PhantomData<*const ()>,
812}
813unsafe impl Send for UART0 {}
814impl UART0 {
815    #[doc = r"Pointer to the register block"]
816    pub const PTR: *const uart0::RegisterBlock = 0x4001_c000 as *const _;
817    #[doc = r"Return the pointer to the register block"]
818    #[inline(always)]
819    pub const fn ptr() -> *const uart0::RegisterBlock {
820        Self::PTR
821    }
822}
823impl Deref for UART0 {
824    type Target = uart0::RegisterBlock;
825    #[inline(always)]
826    fn deref(&self) -> &Self::Target {
827        unsafe { &*Self::PTR }
828    }
829}
830impl core::fmt::Debug for UART0 {
831    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
832        f.debug_struct("UART0").finish()
833    }
834}
835#[doc = "Serial UART"]
836pub mod uart0;
837#[doc = "Serial UART"]
838pub struct UART1 {
839    _marker: PhantomData<*const ()>,
840}
841unsafe impl Send for UART1 {}
842impl UART1 {
843    #[doc = r"Pointer to the register block"]
844    pub const PTR: *const uart0::RegisterBlock = 0x4001_d000 as *const _;
845    #[doc = r"Return the pointer to the register block"]
846    #[inline(always)]
847    pub const fn ptr() -> *const uart0::RegisterBlock {
848        Self::PTR
849    }
850}
851impl Deref for UART1 {
852    type Target = uart0::RegisterBlock;
853    #[inline(always)]
854    fn deref(&self) -> &Self::Target {
855        unsafe { &*Self::PTR }
856    }
857}
858impl core::fmt::Debug for UART1 {
859    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
860        f.debug_struct("UART1").finish()
861    }
862}
863#[doc = "Voltage Comparator"]
864pub struct VCOMP {
865    _marker: PhantomData<*const ()>,
866}
867unsafe impl Send for VCOMP {}
868impl VCOMP {
869    #[doc = r"Pointer to the register block"]
870    pub const PTR: *const vcomp::RegisterBlock = 0x4000_c000 as *const _;
871    #[doc = r"Return the pointer to the register block"]
872    #[inline(always)]
873    pub const fn ptr() -> *const vcomp::RegisterBlock {
874        Self::PTR
875    }
876}
877impl Deref for VCOMP {
878    type Target = vcomp::RegisterBlock;
879    #[inline(always)]
880    fn deref(&self) -> &Self::Target {
881        unsafe { &*Self::PTR }
882    }
883}
884impl core::fmt::Debug for VCOMP {
885    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
886        f.debug_struct("VCOMP").finish()
887    }
888}
889#[doc = "Voltage Comparator"]
890pub mod vcomp;
891#[doc = "Watchdog Timer"]
892pub struct WDT {
893    _marker: PhantomData<*const ()>,
894}
895unsafe impl Send for WDT {}
896impl WDT {
897    #[doc = r"Pointer to the register block"]
898    pub const PTR: *const wdt::RegisterBlock = 0x4002_4000 as *const _;
899    #[doc = r"Return the pointer to the register block"]
900    #[inline(always)]
901    pub const fn ptr() -> *const wdt::RegisterBlock {
902        Self::PTR
903    }
904}
905impl Deref for WDT {
906    type Target = wdt::RegisterBlock;
907    #[inline(always)]
908    fn deref(&self) -> &Self::Target {
909        unsafe { &*Self::PTR }
910    }
911}
912impl core::fmt::Debug for WDT {
913    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
914        f.debug_struct("WDT").finish()
915    }
916}
917#[doc = "Watchdog Timer"]
918pub mod wdt;
919#[no_mangle]
920static mut DEVICE_PERIPHERALS: bool = false;
921#[doc = r"All the peripherals"]
922#[allow(non_snake_case)]
923pub struct Peripherals {
924    #[doc = "ADC"]
925    pub ADC: ADC,
926    #[doc = "APBDMA"]
927    pub APBDMA: APBDMA,
928    #[doc = "BLEIF"]
929    pub BLEIF: BLEIF,
930    #[doc = "CACHECTRL"]
931    pub CACHECTRL: CACHECTRL,
932    #[doc = "CLKGEN"]
933    pub CLKGEN: CLKGEN,
934    #[doc = "CTIMER"]
935    pub CTIMER: CTIMER,
936    #[doc = "GPIO"]
937    pub GPIO: GPIO,
938    #[doc = "IOM0"]
939    pub IOM0: IOM0,
940    #[doc = "IOM1"]
941    pub IOM1: IOM1,
942    #[doc = "IOM2"]
943    pub IOM2: IOM2,
944    #[doc = "IOM3"]
945    pub IOM3: IOM3,
946    #[doc = "IOM4"]
947    pub IOM4: IOM4,
948    #[doc = "IOM5"]
949    pub IOM5: IOM5,
950    #[doc = "IOSLAVE"]
951    pub IOSLAVE: IOSLAVE,
952    #[doc = "MCUCTRL"]
953    pub MCUCTRL: MCUCTRL,
954    #[doc = "MSPI"]
955    pub MSPI: MSPI,
956    #[doc = "PDM"]
957    pub PDM: PDM,
958    #[doc = "PWRCTRL"]
959    pub PWRCTRL: PWRCTRL,
960    #[doc = "RSTGEN"]
961    pub RSTGEN: RSTGEN,
962    #[doc = "RTC"]
963    pub RTC: RTC,
964    #[doc = "SCARD"]
965    pub SCARD: SCARD,
966    #[doc = "SECURITY"]
967    pub SECURITY: SECURITY,
968    #[doc = "UART0"]
969    pub UART0: UART0,
970    #[doc = "UART1"]
971    pub UART1: UART1,
972    #[doc = "VCOMP"]
973    pub VCOMP: VCOMP,
974    #[doc = "WDT"]
975    pub WDT: WDT,
976}
977impl Peripherals {
978    #[doc = r"Returns all the peripherals *once*"]
979    #[inline]
980    pub fn take() -> Option<Self> {
981        cortex_m::interrupt::free(|_| {
982            if unsafe { DEVICE_PERIPHERALS } {
983                None
984            } else {
985                Some(unsafe { Peripherals::steal() })
986            }
987        })
988    }
989    #[doc = r"Unchecked version of `Peripherals::take`"]
990    #[inline]
991    pub unsafe fn steal() -> Self {
992        DEVICE_PERIPHERALS = true;
993        Peripherals {
994            ADC: ADC {
995                _marker: PhantomData,
996            },
997            APBDMA: APBDMA {
998                _marker: PhantomData,
999            },
1000            BLEIF: BLEIF {
1001                _marker: PhantomData,
1002            },
1003            CACHECTRL: CACHECTRL {
1004                _marker: PhantomData,
1005            },
1006            CLKGEN: CLKGEN {
1007                _marker: PhantomData,
1008            },
1009            CTIMER: CTIMER {
1010                _marker: PhantomData,
1011            },
1012            GPIO: GPIO {
1013                _marker: PhantomData,
1014            },
1015            IOM0: IOM0 {
1016                _marker: PhantomData,
1017            },
1018            IOM1: IOM1 {
1019                _marker: PhantomData,
1020            },
1021            IOM2: IOM2 {
1022                _marker: PhantomData,
1023            },
1024            IOM3: IOM3 {
1025                _marker: PhantomData,
1026            },
1027            IOM4: IOM4 {
1028                _marker: PhantomData,
1029            },
1030            IOM5: IOM5 {
1031                _marker: PhantomData,
1032            },
1033            IOSLAVE: IOSLAVE {
1034                _marker: PhantomData,
1035            },
1036            MCUCTRL: MCUCTRL {
1037                _marker: PhantomData,
1038            },
1039            MSPI: MSPI {
1040                _marker: PhantomData,
1041            },
1042            PDM: PDM {
1043                _marker: PhantomData,
1044            },
1045            PWRCTRL: PWRCTRL {
1046                _marker: PhantomData,
1047            },
1048            RSTGEN: RSTGEN {
1049                _marker: PhantomData,
1050            },
1051            RTC: RTC {
1052                _marker: PhantomData,
1053            },
1054            SCARD: SCARD {
1055                _marker: PhantomData,
1056            },
1057            SECURITY: SECURITY {
1058                _marker: PhantomData,
1059            },
1060            UART0: UART0 {
1061                _marker: PhantomData,
1062            },
1063            UART1: UART1 {
1064                _marker: PhantomData,
1065            },
1066            VCOMP: VCOMP {
1067                _marker: PhantomData,
1068            },
1069            WDT: WDT {
1070                _marker: PhantomData,
1071            },
1072        }
1073    }
1074}