max32660/
lib.rs

1#![allow(clippy::all)]
2#![doc = "Peripheral access API for MAX32660 microcontrollers (generated using svd2rust v0.30.1 ( ))\n\nYou can find an overview of the generated API [here].\n\nAPI features to be included in the [next]
3svd2rust 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.30.1/svd2rust/#peripheral-api\n[next]: https://github.com/rust-embedded/svd2rust/blob/master/CHANGELOG.md#unreleased\n[repository]: https://github.com/rust-embedded/svd2rust"]
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_bounds)]
13#![deny(private_interfaces)]
14#![deny(unconditional_recursion)]
15#![deny(unused_allocation)]
16#![deny(unused_comparisons)]
17#![deny(unused_parens)]
18#![deny(while_true)]
19#![allow(non_camel_case_types)]
20#![allow(non_snake_case)]
21#![no_std]
22use core::marker::PhantomData;
23use core::ops::Deref;
24#[doc = r"Number available in the NVIC for configuring priority"]
25pub const NVIC_PRIO_BITS: u8 = 3;
26#[cfg(feature = "rt")]
27pub use self::Interrupt as interrupt;
28pub use cortex_m::peripheral::Peripherals as CorePeripherals;
29pub use cortex_m::peripheral::{CBP, CPUID, DCB, DWT, FPB, FPU, ITM, MPU, NVIC, SCB, SYST, TPIU};
30#[cfg(feature = "rt")]
31pub use cortex_m_rt::interrupt;
32#[allow(unused_imports)]
33use generic::*;
34#[doc = r"Common register and bit access and modify traits"]
35pub mod generic;
36#[cfg(feature = "rt")]
37extern "C" {
38    fn PF();
39    fn WDT0();
40    fn RTC();
41    fn TMR0();
42    fn TMR1();
43    fn TMR2();
44    fn I2C0();
45    fn UART0();
46    fn UART1();
47    fn SPI0();
48    fn SPI1();
49    fn FLC();
50    fn GPIO0();
51    fn DMA0();
52    fn DMA1();
53    fn DMA2();
54    fn DMA3();
55    fn I2C1();
56    fn GPIOWAKE();
57}
58#[doc(hidden)]
59pub union Vector {
60    _handler: unsafe extern "C" fn(),
61    _reserved: u32,
62}
63#[cfg(feature = "rt")]
64#[doc(hidden)]
65#[link_section = ".vector_table.interrupts"]
66#[no_mangle]
67pub static __INTERRUPTS: [Vector; 55] = [
68    Vector { _handler: PF },
69    Vector { _handler: WDT0 },
70    Vector { _reserved: 0 },
71    Vector { _handler: RTC },
72    Vector { _reserved: 0 },
73    Vector { _handler: TMR0 },
74    Vector { _handler: TMR1 },
75    Vector { _handler: TMR2 },
76    Vector { _reserved: 0 },
77    Vector { _reserved: 0 },
78    Vector { _reserved: 0 },
79    Vector { _reserved: 0 },
80    Vector { _reserved: 0 },
81    Vector { _handler: I2C0 },
82    Vector { _handler: UART0 },
83    Vector { _handler: UART1 },
84    Vector { _handler: SPI0 },
85    Vector { _handler: SPI1 },
86    Vector { _reserved: 0 },
87    Vector { _reserved: 0 },
88    Vector { _reserved: 0 },
89    Vector { _reserved: 0 },
90    Vector { _reserved: 0 },
91    Vector { _handler: FLC },
92    Vector { _handler: GPIO0 },
93    Vector { _reserved: 0 },
94    Vector { _reserved: 0 },
95    Vector { _reserved: 0 },
96    Vector { _handler: DMA0 },
97    Vector { _handler: DMA1 },
98    Vector { _handler: DMA2 },
99    Vector { _handler: DMA3 },
100    Vector { _reserved: 0 },
101    Vector { _reserved: 0 },
102    Vector { _reserved: 0 },
103    Vector { _reserved: 0 },
104    Vector { _handler: I2C1 },
105    Vector { _reserved: 0 },
106    Vector { _reserved: 0 },
107    Vector { _reserved: 0 },
108    Vector { _reserved: 0 },
109    Vector { _reserved: 0 },
110    Vector { _reserved: 0 },
111    Vector { _reserved: 0 },
112    Vector { _reserved: 0 },
113    Vector { _reserved: 0 },
114    Vector { _reserved: 0 },
115    Vector { _reserved: 0 },
116    Vector { _reserved: 0 },
117    Vector { _reserved: 0 },
118    Vector { _reserved: 0 },
119    Vector { _reserved: 0 },
120    Vector { _reserved: 0 },
121    Vector { _reserved: 0 },
122    Vector { _handler: GPIOWAKE },
123];
124#[doc = r"Enumeration of all the interrupts."]
125#[derive(Copy, Clone, Debug, PartialEq, Eq)]
126#[repr(u16)]
127pub enum Interrupt {
128    #[doc = "0 - PF"]
129    PF = 0,
130    #[doc = "1 - WDT0"]
131    WDT0 = 1,
132    #[doc = "3 - RTC"]
133    RTC = 3,
134    #[doc = "5 - TMR0"]
135    TMR0 = 5,
136    #[doc = "6 - TMR1"]
137    TMR1 = 6,
138    #[doc = "7 - TMR2"]
139    TMR2 = 7,
140    #[doc = "13 - I2C0"]
141    I2C0 = 13,
142    #[doc = "14 - UART0"]
143    UART0 = 14,
144    #[doc = "15 - UART1"]
145    UART1 = 15,
146    #[doc = "16 - SPI0"]
147    SPI0 = 16,
148    #[doc = "17 - SPI1"]
149    SPI1 = 17,
150    #[doc = "23 - FLC"]
151    FLC = 23,
152    #[doc = "24 - GPIO0"]
153    GPIO0 = 24,
154    #[doc = "28 - DMA0"]
155    DMA0 = 28,
156    #[doc = "29 - DMA1"]
157    DMA1 = 29,
158    #[doc = "30 - DMA2"]
159    DMA2 = 30,
160    #[doc = "31 - DMA3"]
161    DMA3 = 31,
162    #[doc = "36 - I2C1"]
163    I2C1 = 36,
164    #[doc = "54 - GPIOWAKE"]
165    GPIOWAKE = 54,
166}
167unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
168    #[inline(always)]
169    fn number(self) -> u16 {
170        self as u16
171    }
172}
173#[doc = "Direct Memory Access Controller."]
174pub struct DMA {
175    _marker: PhantomData<*const ()>,
176}
177unsafe impl Send for DMA {}
178impl DMA {
179    #[doc = r"Pointer to the register block"]
180    pub const PTR: *const dma::RegisterBlock = 0x4002_8000 as *const _;
181    #[doc = r"Return the pointer to the register block"]
182    #[inline(always)]
183    pub const fn ptr() -> *const dma::RegisterBlock {
184        Self::PTR
185    }
186    #[doc = r" Steal an instance of this peripheral"]
187    #[doc = r""]
188    #[doc = r" # Safety"]
189    #[doc = r""]
190    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
191    #[doc = r" that may race with any existing instances, for example by only"]
192    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
193    #[doc = r" original peripheral and using critical sections to coordinate"]
194    #[doc = r" access between multiple new instances."]
195    #[doc = r""]
196    #[doc = r" Additionally, other software such as HALs may rely on only one"]
197    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
198    #[doc = r" no stolen instances are passed to such software."]
199    pub unsafe fn steal() -> Self {
200        Self {
201            _marker: PhantomData,
202        }
203    }
204}
205impl Deref for DMA {
206    type Target = dma::RegisterBlock;
207    #[inline(always)]
208    fn deref(&self) -> &Self::Target {
209        unsafe { &*Self::PTR }
210    }
211}
212impl core::fmt::Debug for DMA {
213    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
214        f.debug_struct("DMA").finish()
215    }
216}
217#[doc = "Direct Memory Access Controller."]
218pub mod dma;
219#[doc = "Function Control."]
220pub struct FCR {
221    _marker: PhantomData<*const ()>,
222}
223unsafe impl Send for FCR {}
224impl FCR {
225    #[doc = r"Pointer to the register block"]
226    pub const PTR: *const fcr::RegisterBlock = 0x4000_0800 as *const _;
227    #[doc = r"Return the pointer to the register block"]
228    #[inline(always)]
229    pub const fn ptr() -> *const fcr::RegisterBlock {
230        Self::PTR
231    }
232    #[doc = r" Steal an instance of this peripheral"]
233    #[doc = r""]
234    #[doc = r" # Safety"]
235    #[doc = r""]
236    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
237    #[doc = r" that may race with any existing instances, for example by only"]
238    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
239    #[doc = r" original peripheral and using critical sections to coordinate"]
240    #[doc = r" access between multiple new instances."]
241    #[doc = r""]
242    #[doc = r" Additionally, other software such as HALs may rely on only one"]
243    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
244    #[doc = r" no stolen instances are passed to such software."]
245    pub unsafe fn steal() -> Self {
246        Self {
247            _marker: PhantomData,
248        }
249    }
250}
251impl Deref for FCR {
252    type Target = fcr::RegisterBlock;
253    #[inline(always)]
254    fn deref(&self) -> &Self::Target {
255        unsafe { &*Self::PTR }
256    }
257}
258impl core::fmt::Debug for FCR {
259    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
260        f.debug_struct("FCR").finish()
261    }
262}
263#[doc = "Function Control."]
264pub mod fcr;
265#[doc = "Flash Memory Control."]
266pub struct FLC {
267    _marker: PhantomData<*const ()>,
268}
269unsafe impl Send for FLC {}
270impl FLC {
271    #[doc = r"Pointer to the register block"]
272    pub const PTR: *const flc::RegisterBlock = 0x4002_9000 as *const _;
273    #[doc = r"Return the pointer to the register block"]
274    #[inline(always)]
275    pub const fn ptr() -> *const flc::RegisterBlock {
276        Self::PTR
277    }
278    #[doc = r" Steal an instance of this peripheral"]
279    #[doc = r""]
280    #[doc = r" # Safety"]
281    #[doc = r""]
282    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
283    #[doc = r" that may race with any existing instances, for example by only"]
284    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
285    #[doc = r" original peripheral and using critical sections to coordinate"]
286    #[doc = r" access between multiple new instances."]
287    #[doc = r""]
288    #[doc = r" Additionally, other software such as HALs may rely on only one"]
289    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
290    #[doc = r" no stolen instances are passed to such software."]
291    pub unsafe fn steal() -> Self {
292        Self {
293            _marker: PhantomData,
294        }
295    }
296}
297impl Deref for FLC {
298    type Target = flc::RegisterBlock;
299    #[inline(always)]
300    fn deref(&self) -> &Self::Target {
301        unsafe { &*Self::PTR }
302    }
303}
304impl core::fmt::Debug for FLC {
305    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
306        f.debug_struct("FLC").finish()
307    }
308}
309#[doc = "Flash Memory Control."]
310pub mod flc;
311#[doc = "Global Control Registers."]
312pub struct GCR {
313    _marker: PhantomData<*const ()>,
314}
315unsafe impl Send for GCR {}
316impl GCR {
317    #[doc = r"Pointer to the register block"]
318    pub const PTR: *const gcr::RegisterBlock = 0x4000_0000 as *const _;
319    #[doc = r"Return the pointer to the register block"]
320    #[inline(always)]
321    pub const fn ptr() -> *const gcr::RegisterBlock {
322        Self::PTR
323    }
324    #[doc = r" Steal an instance of this peripheral"]
325    #[doc = r""]
326    #[doc = r" # Safety"]
327    #[doc = r""]
328    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
329    #[doc = r" that may race with any existing instances, for example by only"]
330    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
331    #[doc = r" original peripheral and using critical sections to coordinate"]
332    #[doc = r" access between multiple new instances."]
333    #[doc = r""]
334    #[doc = r" Additionally, other software such as HALs may rely on only one"]
335    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
336    #[doc = r" no stolen instances are passed to such software."]
337    pub unsafe fn steal() -> Self {
338        Self {
339            _marker: PhantomData,
340        }
341    }
342}
343impl Deref for GCR {
344    type Target = gcr::RegisterBlock;
345    #[inline(always)]
346    fn deref(&self) -> &Self::Target {
347        unsafe { &*Self::PTR }
348    }
349}
350impl core::fmt::Debug for GCR {
351    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
352        f.debug_struct("GCR").finish()
353    }
354}
355#[doc = "Global Control Registers."]
356pub mod gcr;
357#[doc = "General Purpose I/O."]
358pub struct GPIO0 {
359    _marker: PhantomData<*const ()>,
360}
361unsafe impl Send for GPIO0 {}
362impl GPIO0 {
363    #[doc = r"Pointer to the register block"]
364    pub const PTR: *const gpio0::RegisterBlock = 0x4000_8000 as *const _;
365    #[doc = r"Return the pointer to the register block"]
366    #[inline(always)]
367    pub const fn ptr() -> *const gpio0::RegisterBlock {
368        Self::PTR
369    }
370    #[doc = r" Steal an instance of this peripheral"]
371    #[doc = r""]
372    #[doc = r" # Safety"]
373    #[doc = r""]
374    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
375    #[doc = r" that may race with any existing instances, for example by only"]
376    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
377    #[doc = r" original peripheral and using critical sections to coordinate"]
378    #[doc = r" access between multiple new instances."]
379    #[doc = r""]
380    #[doc = r" Additionally, other software such as HALs may rely on only one"]
381    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
382    #[doc = r" no stolen instances are passed to such software."]
383    pub unsafe fn steal() -> Self {
384        Self {
385            _marker: PhantomData,
386        }
387    }
388}
389impl Deref for GPIO0 {
390    type Target = gpio0::RegisterBlock;
391    #[inline(always)]
392    fn deref(&self) -> &Self::Target {
393        unsafe { &*Self::PTR }
394    }
395}
396impl core::fmt::Debug for GPIO0 {
397    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
398        f.debug_struct("GPIO0").finish()
399    }
400}
401#[doc = "General Purpose I/O."]
402pub mod gpio0;
403#[doc = "Inter-Integrated Circuit 0."]
404pub struct I2C0 {
405    _marker: PhantomData<*const ()>,
406}
407unsafe impl Send for I2C0 {}
408impl I2C0 {
409    #[doc = r"Pointer to the register block"]
410    pub const PTR: *const i2c0::RegisterBlock = 0x4001_d000 as *const _;
411    #[doc = r"Return the pointer to the register block"]
412    #[inline(always)]
413    pub const fn ptr() -> *const i2c0::RegisterBlock {
414        Self::PTR
415    }
416    #[doc = r" Steal an instance of this peripheral"]
417    #[doc = r""]
418    #[doc = r" # Safety"]
419    #[doc = r""]
420    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
421    #[doc = r" that may race with any existing instances, for example by only"]
422    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
423    #[doc = r" original peripheral and using critical sections to coordinate"]
424    #[doc = r" access between multiple new instances."]
425    #[doc = r""]
426    #[doc = r" Additionally, other software such as HALs may rely on only one"]
427    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
428    #[doc = r" no stolen instances are passed to such software."]
429    pub unsafe fn steal() -> Self {
430        Self {
431            _marker: PhantomData,
432        }
433    }
434}
435impl Deref for I2C0 {
436    type Target = i2c0::RegisterBlock;
437    #[inline(always)]
438    fn deref(&self) -> &Self::Target {
439        unsafe { &*Self::PTR }
440    }
441}
442impl core::fmt::Debug for I2C0 {
443    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
444        f.debug_struct("I2C0").finish()
445    }
446}
447#[doc = "Inter-Integrated Circuit 0."]
448pub mod i2c0;
449#[doc = "Inter-Integrated Circuit 1."]
450pub struct I2C1 {
451    _marker: PhantomData<*const ()>,
452}
453unsafe impl Send for I2C1 {}
454impl I2C1 {
455    #[doc = r"Pointer to the register block"]
456    pub const PTR: *const i2c0::RegisterBlock = 0x4001_e000 as *const _;
457    #[doc = r"Return the pointer to the register block"]
458    #[inline(always)]
459    pub const fn ptr() -> *const i2c0::RegisterBlock {
460        Self::PTR
461    }
462    #[doc = r" Steal an instance of this peripheral"]
463    #[doc = r""]
464    #[doc = r" # Safety"]
465    #[doc = r""]
466    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
467    #[doc = r" that may race with any existing instances, for example by only"]
468    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
469    #[doc = r" original peripheral and using critical sections to coordinate"]
470    #[doc = r" access between multiple new instances."]
471    #[doc = r""]
472    #[doc = r" Additionally, other software such as HALs may rely on only one"]
473    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
474    #[doc = r" no stolen instances are passed to such software."]
475    pub unsafe fn steal() -> Self {
476        Self {
477            _marker: PhantomData,
478        }
479    }
480}
481impl Deref for I2C1 {
482    type Target = i2c0::RegisterBlock;
483    #[inline(always)]
484    fn deref(&self) -> &Self::Target {
485        unsafe { &*Self::PTR }
486    }
487}
488impl core::fmt::Debug for I2C1 {
489    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
490        f.debug_struct("I2C1").finish()
491    }
492}
493#[doc = "Inter-Integrated Circuit 1."]
494pub use self::i2c0 as i2c1;
495#[doc = "Instruction Cache Controller."]
496pub struct ICC {
497    _marker: PhantomData<*const ()>,
498}
499unsafe impl Send for ICC {}
500impl ICC {
501    #[doc = r"Pointer to the register block"]
502    pub const PTR: *const icc::RegisterBlock = 0x4002_a000 as *const _;
503    #[doc = r"Return the pointer to the register block"]
504    #[inline(always)]
505    pub const fn ptr() -> *const icc::RegisterBlock {
506        Self::PTR
507    }
508    #[doc = r" Steal an instance of this peripheral"]
509    #[doc = r""]
510    #[doc = r" # Safety"]
511    #[doc = r""]
512    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
513    #[doc = r" that may race with any existing instances, for example by only"]
514    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
515    #[doc = r" original peripheral and using critical sections to coordinate"]
516    #[doc = r" access between multiple new instances."]
517    #[doc = r""]
518    #[doc = r" Additionally, other software such as HALs may rely on only one"]
519    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
520    #[doc = r" no stolen instances are passed to such software."]
521    pub unsafe fn steal() -> Self {
522        Self {
523            _marker: PhantomData,
524        }
525    }
526}
527impl Deref for ICC {
528    type Target = icc::RegisterBlock;
529    #[inline(always)]
530    fn deref(&self) -> &Self::Target {
531        unsafe { &*Self::PTR }
532    }
533}
534impl core::fmt::Debug for ICC {
535    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
536        f.debug_struct("ICC").finish()
537    }
538}
539#[doc = "Instruction Cache Controller."]
540pub mod icc;
541#[doc = "Power Sequencer."]
542pub struct PWRSEQ {
543    _marker: PhantomData<*const ()>,
544}
545unsafe impl Send for PWRSEQ {}
546impl PWRSEQ {
547    #[doc = r"Pointer to the register block"]
548    pub const PTR: *const pwrseq::RegisterBlock = 0x4000_6800 as *const _;
549    #[doc = r"Return the pointer to the register block"]
550    #[inline(always)]
551    pub const fn ptr() -> *const pwrseq::RegisterBlock {
552        Self::PTR
553    }
554    #[doc = r" Steal an instance of this peripheral"]
555    #[doc = r""]
556    #[doc = r" # Safety"]
557    #[doc = r""]
558    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
559    #[doc = r" that may race with any existing instances, for example by only"]
560    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
561    #[doc = r" original peripheral and using critical sections to coordinate"]
562    #[doc = r" access between multiple new instances."]
563    #[doc = r""]
564    #[doc = r" Additionally, other software such as HALs may rely on only one"]
565    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
566    #[doc = r" no stolen instances are passed to such software."]
567    pub unsafe fn steal() -> Self {
568        Self {
569            _marker: PhantomData,
570        }
571    }
572}
573impl Deref for PWRSEQ {
574    type Target = pwrseq::RegisterBlock;
575    #[inline(always)]
576    fn deref(&self) -> &Self::Target {
577        unsafe { &*Self::PTR }
578    }
579}
580impl core::fmt::Debug for PWRSEQ {
581    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
582        f.debug_struct("PWRSEQ").finish()
583    }
584}
585#[doc = "Power Sequencer."]
586pub mod pwrseq;
587#[doc = "Real Time Clock."]
588pub struct RTC {
589    _marker: PhantomData<*const ()>,
590}
591unsafe impl Send for RTC {}
592impl RTC {
593    #[doc = r"Pointer to the register block"]
594    pub const PTR: *const rtc::RegisterBlock = 0x4000_6000 as *const _;
595    #[doc = r"Return the pointer to the register block"]
596    #[inline(always)]
597    pub const fn ptr() -> *const rtc::RegisterBlock {
598        Self::PTR
599    }
600    #[doc = r" Steal an instance of this peripheral"]
601    #[doc = r""]
602    #[doc = r" # Safety"]
603    #[doc = r""]
604    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
605    #[doc = r" that may race with any existing instances, for example by only"]
606    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
607    #[doc = r" original peripheral and using critical sections to coordinate"]
608    #[doc = r" access between multiple new instances."]
609    #[doc = r""]
610    #[doc = r" Additionally, other software such as HALs may rely on only one"]
611    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
612    #[doc = r" no stolen instances are passed to such software."]
613    pub unsafe fn steal() -> Self {
614        Self {
615            _marker: PhantomData,
616        }
617    }
618}
619impl Deref for RTC {
620    type Target = rtc::RegisterBlock;
621    #[inline(always)]
622    fn deref(&self) -> &Self::Target {
623        unsafe { &*Self::PTR }
624    }
625}
626impl core::fmt::Debug for RTC {
627    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
628        f.debug_struct("RTC").finish()
629    }
630}
631#[doc = "Real Time Clock."]
632pub mod rtc;
633#[doc = "System Initialization."]
634pub struct SIR {
635    _marker: PhantomData<*const ()>,
636}
637unsafe impl Send for SIR {}
638impl SIR {
639    #[doc = r"Pointer to the register block"]
640    pub const PTR: *const sir::RegisterBlock = 0x4000_0400 as *const _;
641    #[doc = r"Return the pointer to the register block"]
642    #[inline(always)]
643    pub const fn ptr() -> *const sir::RegisterBlock {
644        Self::PTR
645    }
646    #[doc = r" Steal an instance of this peripheral"]
647    #[doc = r""]
648    #[doc = r" # Safety"]
649    #[doc = r""]
650    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
651    #[doc = r" that may race with any existing instances, for example by only"]
652    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
653    #[doc = r" original peripheral and using critical sections to coordinate"]
654    #[doc = r" access between multiple new instances."]
655    #[doc = r""]
656    #[doc = r" Additionally, other software such as HALs may rely on only one"]
657    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
658    #[doc = r" no stolen instances are passed to such software."]
659    pub unsafe fn steal() -> Self {
660        Self {
661            _marker: PhantomData,
662        }
663    }
664}
665impl Deref for SIR {
666    type Target = sir::RegisterBlock;
667    #[inline(always)]
668    fn deref(&self) -> &Self::Target {
669        unsafe { &*Self::PTR }
670    }
671}
672impl core::fmt::Debug for SIR {
673    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
674        f.debug_struct("SIR").finish()
675    }
676}
677#[doc = "System Initialization."]
678pub mod sir;
679#[doc = "Serial Peripheral Interface 0."]
680pub struct SPI0 {
681    _marker: PhantomData<*const ()>,
682}
683unsafe impl Send for SPI0 {}
684impl SPI0 {
685    #[doc = r"Pointer to the register block"]
686    pub const PTR: *const spi0::RegisterBlock = 0x4004_6000 as *const _;
687    #[doc = r"Return the pointer to the register block"]
688    #[inline(always)]
689    pub const fn ptr() -> *const spi0::RegisterBlock {
690        Self::PTR
691    }
692    #[doc = r" Steal an instance of this peripheral"]
693    #[doc = r""]
694    #[doc = r" # Safety"]
695    #[doc = r""]
696    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
697    #[doc = r" that may race with any existing instances, for example by only"]
698    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
699    #[doc = r" original peripheral and using critical sections to coordinate"]
700    #[doc = r" access between multiple new instances."]
701    #[doc = r""]
702    #[doc = r" Additionally, other software such as HALs may rely on only one"]
703    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
704    #[doc = r" no stolen instances are passed to such software."]
705    pub unsafe fn steal() -> Self {
706        Self {
707            _marker: PhantomData,
708        }
709    }
710}
711impl Deref for SPI0 {
712    type Target = spi0::RegisterBlock;
713    #[inline(always)]
714    fn deref(&self) -> &Self::Target {
715        unsafe { &*Self::PTR }
716    }
717}
718impl core::fmt::Debug for SPI0 {
719    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
720        f.debug_struct("SPI0").finish()
721    }
722}
723#[doc = "Serial Peripheral Interface 0."]
724pub mod spi0;
725#[doc = "Serial Peripheral Interface 1."]
726pub struct SPI1 {
727    _marker: PhantomData<*const ()>,
728}
729unsafe impl Send for SPI1 {}
730impl SPI1 {
731    #[doc = r"Pointer to the register block"]
732    pub const PTR: *const spi1::RegisterBlock = 0x4001_9000 as *const _;
733    #[doc = r"Return the pointer to the register block"]
734    #[inline(always)]
735    pub const fn ptr() -> *const spi1::RegisterBlock {
736        Self::PTR
737    }
738    #[doc = r" Steal an instance of this peripheral"]
739    #[doc = r""]
740    #[doc = r" # Safety"]
741    #[doc = r""]
742    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
743    #[doc = r" that may race with any existing instances, for example by only"]
744    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
745    #[doc = r" original peripheral and using critical sections to coordinate"]
746    #[doc = r" access between multiple new instances."]
747    #[doc = r""]
748    #[doc = r" Additionally, other software such as HALs may rely on only one"]
749    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
750    #[doc = r" no stolen instances are passed to such software."]
751    pub unsafe fn steal() -> Self {
752        Self {
753            _marker: PhantomData,
754        }
755    }
756}
757impl Deref for SPI1 {
758    type Target = spi1::RegisterBlock;
759    #[inline(always)]
760    fn deref(&self) -> &Self::Target {
761        unsafe { &*Self::PTR }
762    }
763}
764impl core::fmt::Debug for SPI1 {
765    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
766        f.debug_struct("SPI1").finish()
767    }
768}
769#[doc = "Serial Peripheral Interface 1."]
770pub mod spi1;
771#[doc = "Low-Power Configurable Timer 0."]
772pub struct TMR0 {
773    _marker: PhantomData<*const ()>,
774}
775unsafe impl Send for TMR0 {}
776impl TMR0 {
777    #[doc = r"Pointer to the register block"]
778    pub const PTR: *const tmr0::RegisterBlock = 0x4001_0000 as *const _;
779    #[doc = r"Return the pointer to the register block"]
780    #[inline(always)]
781    pub const fn ptr() -> *const tmr0::RegisterBlock {
782        Self::PTR
783    }
784    #[doc = r" Steal an instance of this peripheral"]
785    #[doc = r""]
786    #[doc = r" # Safety"]
787    #[doc = r""]
788    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
789    #[doc = r" that may race with any existing instances, for example by only"]
790    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
791    #[doc = r" original peripheral and using critical sections to coordinate"]
792    #[doc = r" access between multiple new instances."]
793    #[doc = r""]
794    #[doc = r" Additionally, other software such as HALs may rely on only one"]
795    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
796    #[doc = r" no stolen instances are passed to such software."]
797    pub unsafe fn steal() -> Self {
798        Self {
799            _marker: PhantomData,
800        }
801    }
802}
803impl Deref for TMR0 {
804    type Target = tmr0::RegisterBlock;
805    #[inline(always)]
806    fn deref(&self) -> &Self::Target {
807        unsafe { &*Self::PTR }
808    }
809}
810impl core::fmt::Debug for TMR0 {
811    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
812        f.debug_struct("TMR0").finish()
813    }
814}
815#[doc = "Low-Power Configurable Timer 0."]
816pub mod tmr0;
817#[doc = "Low-Power Configurable Timer 1."]
818pub struct TMR1 {
819    _marker: PhantomData<*const ()>,
820}
821unsafe impl Send for TMR1 {}
822impl TMR1 {
823    #[doc = r"Pointer to the register block"]
824    pub const PTR: *const tmr0::RegisterBlock = 0x4001_1000 as *const _;
825    #[doc = r"Return the pointer to the register block"]
826    #[inline(always)]
827    pub const fn ptr() -> *const tmr0::RegisterBlock {
828        Self::PTR
829    }
830    #[doc = r" Steal an instance of this peripheral"]
831    #[doc = r""]
832    #[doc = r" # Safety"]
833    #[doc = r""]
834    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
835    #[doc = r" that may race with any existing instances, for example by only"]
836    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
837    #[doc = r" original peripheral and using critical sections to coordinate"]
838    #[doc = r" access between multiple new instances."]
839    #[doc = r""]
840    #[doc = r" Additionally, other software such as HALs may rely on only one"]
841    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
842    #[doc = r" no stolen instances are passed to such software."]
843    pub unsafe fn steal() -> Self {
844        Self {
845            _marker: PhantomData,
846        }
847    }
848}
849impl Deref for TMR1 {
850    type Target = tmr0::RegisterBlock;
851    #[inline(always)]
852    fn deref(&self) -> &Self::Target {
853        unsafe { &*Self::PTR }
854    }
855}
856impl core::fmt::Debug for TMR1 {
857    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
858        f.debug_struct("TMR1").finish()
859    }
860}
861#[doc = "Low-Power Configurable Timer 1."]
862pub use self::tmr0 as tmr1;
863#[doc = "Low-Power Configurable Timer 2."]
864pub struct TMR2 {
865    _marker: PhantomData<*const ()>,
866}
867unsafe impl Send for TMR2 {}
868impl TMR2 {
869    #[doc = r"Pointer to the register block"]
870    pub const PTR: *const tmr0::RegisterBlock = 0x4001_2000 as *const _;
871    #[doc = r"Return the pointer to the register block"]
872    #[inline(always)]
873    pub const fn ptr() -> *const tmr0::RegisterBlock {
874        Self::PTR
875    }
876    #[doc = r" Steal an instance of this peripheral"]
877    #[doc = r""]
878    #[doc = r" # Safety"]
879    #[doc = r""]
880    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
881    #[doc = r" that may race with any existing instances, for example by only"]
882    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
883    #[doc = r" original peripheral and using critical sections to coordinate"]
884    #[doc = r" access between multiple new instances."]
885    #[doc = r""]
886    #[doc = r" Additionally, other software such as HALs may rely on only one"]
887    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
888    #[doc = r" no stolen instances are passed to such software."]
889    pub unsafe fn steal() -> Self {
890        Self {
891            _marker: PhantomData,
892        }
893    }
894}
895impl Deref for TMR2 {
896    type Target = tmr0::RegisterBlock;
897    #[inline(always)]
898    fn deref(&self) -> &Self::Target {
899        unsafe { &*Self::PTR }
900    }
901}
902impl core::fmt::Debug for TMR2 {
903    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
904        f.debug_struct("TMR2").finish()
905    }
906}
907#[doc = "Low-Power Configurable Timer 2."]
908pub use self::tmr0 as tmr2;
909#[doc = "Universal Asynchronous Receiver/Transmitter 0."]
910pub struct UART0 {
911    _marker: PhantomData<*const ()>,
912}
913unsafe impl Send for UART0 {}
914impl UART0 {
915    #[doc = r"Pointer to the register block"]
916    pub const PTR: *const uart0::RegisterBlock = 0x4004_2000 as *const _;
917    #[doc = r"Return the pointer to the register block"]
918    #[inline(always)]
919    pub const fn ptr() -> *const uart0::RegisterBlock {
920        Self::PTR
921    }
922    #[doc = r" Steal an instance of this peripheral"]
923    #[doc = r""]
924    #[doc = r" # Safety"]
925    #[doc = r""]
926    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
927    #[doc = r" that may race with any existing instances, for example by only"]
928    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
929    #[doc = r" original peripheral and using critical sections to coordinate"]
930    #[doc = r" access between multiple new instances."]
931    #[doc = r""]
932    #[doc = r" Additionally, other software such as HALs may rely on only one"]
933    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
934    #[doc = r" no stolen instances are passed to such software."]
935    pub unsafe fn steal() -> Self {
936        Self {
937            _marker: PhantomData,
938        }
939    }
940}
941impl Deref for UART0 {
942    type Target = uart0::RegisterBlock;
943    #[inline(always)]
944    fn deref(&self) -> &Self::Target {
945        unsafe { &*Self::PTR }
946    }
947}
948impl core::fmt::Debug for UART0 {
949    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
950        f.debug_struct("UART0").finish()
951    }
952}
953#[doc = "Universal Asynchronous Receiver/Transmitter 0."]
954pub mod uart0;
955#[doc = "Universal Asynchronous Receiver/Transmitter 1."]
956pub struct UART1 {
957    _marker: PhantomData<*const ()>,
958}
959unsafe impl Send for UART1 {}
960impl UART1 {
961    #[doc = r"Pointer to the register block"]
962    pub const PTR: *const uart0::RegisterBlock = 0x4004_3000 as *const _;
963    #[doc = r"Return the pointer to the register block"]
964    #[inline(always)]
965    pub const fn ptr() -> *const uart0::RegisterBlock {
966        Self::PTR
967    }
968    #[doc = r" Steal an instance of this peripheral"]
969    #[doc = r""]
970    #[doc = r" # Safety"]
971    #[doc = r""]
972    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
973    #[doc = r" that may race with any existing instances, for example by only"]
974    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
975    #[doc = r" original peripheral and using critical sections to coordinate"]
976    #[doc = r" access between multiple new instances."]
977    #[doc = r""]
978    #[doc = r" Additionally, other software such as HALs may rely on only one"]
979    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
980    #[doc = r" no stolen instances are passed to such software."]
981    pub unsafe fn steal() -> Self {
982        Self {
983            _marker: PhantomData,
984        }
985    }
986}
987impl Deref for UART1 {
988    type Target = uart0::RegisterBlock;
989    #[inline(always)]
990    fn deref(&self) -> &Self::Target {
991        unsafe { &*Self::PTR }
992    }
993}
994impl core::fmt::Debug for UART1 {
995    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
996        f.debug_struct("UART1").finish()
997    }
998}
999#[doc = "Universal Asynchronous Receiver/Transmitter 1."]
1000pub use self::uart0 as uart1;
1001#[doc = "Watchdog Timer 0."]
1002pub struct WDT0 {
1003    _marker: PhantomData<*const ()>,
1004}
1005unsafe impl Send for WDT0 {}
1006impl WDT0 {
1007    #[doc = r"Pointer to the register block"]
1008    pub const PTR: *const wdt0::RegisterBlock = 0x4000_3000 as *const _;
1009    #[doc = r"Return the pointer to the register block"]
1010    #[inline(always)]
1011    pub const fn ptr() -> *const wdt0::RegisterBlock {
1012        Self::PTR
1013    }
1014    #[doc = r" Steal an instance of this peripheral"]
1015    #[doc = r""]
1016    #[doc = r" # Safety"]
1017    #[doc = r""]
1018    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1019    #[doc = r" that may race with any existing instances, for example by only"]
1020    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1021    #[doc = r" original peripheral and using critical sections to coordinate"]
1022    #[doc = r" access between multiple new instances."]
1023    #[doc = r""]
1024    #[doc = r" Additionally, other software such as HALs may rely on only one"]
1025    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1026    #[doc = r" no stolen instances are passed to such software."]
1027    pub unsafe fn steal() -> Self {
1028        Self {
1029            _marker: PhantomData,
1030        }
1031    }
1032}
1033impl Deref for WDT0 {
1034    type Target = wdt0::RegisterBlock;
1035    #[inline(always)]
1036    fn deref(&self) -> &Self::Target {
1037        unsafe { &*Self::PTR }
1038    }
1039}
1040impl core::fmt::Debug for WDT0 {
1041    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1042        f.debug_struct("WDT0").finish()
1043    }
1044}
1045#[doc = "Watchdog Timer 0."]
1046pub mod wdt0;
1047#[no_mangle]
1048static mut DEVICE_PERIPHERALS: bool = false;
1049#[doc = r" All the peripherals."]
1050#[allow(non_snake_case)]
1051pub struct Peripherals {
1052    #[doc = "DMA"]
1053    pub DMA: DMA,
1054    #[doc = "FCR"]
1055    pub FCR: FCR,
1056    #[doc = "FLC"]
1057    pub FLC: FLC,
1058    #[doc = "GCR"]
1059    pub GCR: GCR,
1060    #[doc = "GPIO0"]
1061    pub GPIO0: GPIO0,
1062    #[doc = "I2C0"]
1063    pub I2C0: I2C0,
1064    #[doc = "I2C1"]
1065    pub I2C1: I2C1,
1066    #[doc = "ICC"]
1067    pub ICC: ICC,
1068    #[doc = "PWRSEQ"]
1069    pub PWRSEQ: PWRSEQ,
1070    #[doc = "RTC"]
1071    pub RTC: RTC,
1072    #[doc = "SIR"]
1073    pub SIR: SIR,
1074    #[doc = "SPI0"]
1075    pub SPI0: SPI0,
1076    #[doc = "SPI1"]
1077    pub SPI1: SPI1,
1078    #[doc = "TMR0"]
1079    pub TMR0: TMR0,
1080    #[doc = "TMR1"]
1081    pub TMR1: TMR1,
1082    #[doc = "TMR2"]
1083    pub TMR2: TMR2,
1084    #[doc = "UART0"]
1085    pub UART0: UART0,
1086    #[doc = "UART1"]
1087    pub UART1: UART1,
1088    #[doc = "WDT0"]
1089    pub WDT0: WDT0,
1090}
1091impl Peripherals {
1092    #[doc = r" Returns all the peripherals *once*."]
1093    #[cfg(feature = "critical-section")]
1094    #[inline]
1095    pub fn take() -> Option<Self> {
1096        critical_section::with(|_| {
1097            if unsafe { DEVICE_PERIPHERALS } {
1098                return None;
1099            }
1100            Some(unsafe { Peripherals::steal() })
1101        })
1102    }
1103    #[doc = r" Unchecked version of `Peripherals::take`."]
1104    #[doc = r""]
1105    #[doc = r" # Safety"]
1106    #[doc = r""]
1107    #[doc = r" Each of the returned peripherals must be used at most once."]
1108    #[inline]
1109    pub unsafe fn steal() -> Self {
1110        DEVICE_PERIPHERALS = true;
1111        Peripherals {
1112            DMA: DMA {
1113                _marker: PhantomData,
1114            },
1115            FCR: FCR {
1116                _marker: PhantomData,
1117            },
1118            FLC: FLC {
1119                _marker: PhantomData,
1120            },
1121            GCR: GCR {
1122                _marker: PhantomData,
1123            },
1124            GPIO0: GPIO0 {
1125                _marker: PhantomData,
1126            },
1127            I2C0: I2C0 {
1128                _marker: PhantomData,
1129            },
1130            I2C1: I2C1 {
1131                _marker: PhantomData,
1132            },
1133            ICC: ICC {
1134                _marker: PhantomData,
1135            },
1136            PWRSEQ: PWRSEQ {
1137                _marker: PhantomData,
1138            },
1139            RTC: RTC {
1140                _marker: PhantomData,
1141            },
1142            SIR: SIR {
1143                _marker: PhantomData,
1144            },
1145            SPI0: SPI0 {
1146                _marker: PhantomData,
1147            },
1148            SPI1: SPI1 {
1149                _marker: PhantomData,
1150            },
1151            TMR0: TMR0 {
1152                _marker: PhantomData,
1153            },
1154            TMR1: TMR1 {
1155                _marker: PhantomData,
1156            },
1157            TMR2: TMR2 {
1158                _marker: PhantomData,
1159            },
1160            UART0: UART0 {
1161                _marker: PhantomData,
1162            },
1163            UART1: UART1 {
1164                _marker: PhantomData,
1165            },
1166            WDT0: WDT0 {
1167                _marker: PhantomData,
1168            },
1169        }
1170    }
1171}