atsam4e8c_pac/
lib.rs

1#![doc = "Peripheral access API for ATSAM4E8C microcontrollers (generated using svd2rust v0.27.2 ( ))\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.27.2/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(dead_code)]
4#![deny(improper_ctypes)]
5#![deny(missing_docs)]
6#![deny(no_mangle_generic_items)]
7#![deny(non_shorthand_field_patterns)]
8#![deny(overflowing_literals)]
9#![deny(path_statements)]
10#![deny(patterns_in_fns_without_body)]
11#![deny(private_in_public)]
12#![deny(unconditional_recursion)]
13#![deny(unused_allocation)]
14#![deny(unused_comparisons)]
15#![deny(unused_parens)]
16#![deny(while_true)]
17#![allow(non_camel_case_types)]
18#![allow(non_snake_case)]
19#![no_std]
20use core::marker::PhantomData;
21use core::ops::Deref;
22#[doc = r"Number available in the NVIC for configuring priority"]
23pub const NVIC_PRIO_BITS: u8 = 4;
24#[cfg(feature = "rt")]
25pub use self::Interrupt as interrupt;
26pub use cortex_m::peripheral::Peripherals as CorePeripherals;
27pub use cortex_m::peripheral::{CBP, CPUID, DCB, DWT, FPB, FPU, ITM, MPU, NVIC, SCB, SYST, TPIU};
28#[cfg(feature = "rt")]
29pub use cortex_m_rt::interrupt;
30#[allow(unused_imports)]
31use generic::*;
32#[doc = r"Common register and bit access and modify traits"]
33pub mod generic;
34#[cfg(feature = "rt")]
35extern "C" {
36    fn SUPC();
37    fn RSTC();
38    fn RTC();
39    fn RTT();
40    fn WDT();
41    fn PMC();
42    fn EFC();
43    fn UART0();
44    fn PIOA();
45    fn PIOB();
46    fn PIOD();
47    fn USART0();
48    fn USART1();
49    fn HSMCI();
50    fn TWI0();
51    fn TWI1();
52    fn SPI();
53    fn DMAC();
54    fn TC0();
55    fn TC1();
56    fn TC2();
57    fn AFEC0();
58    fn AFEC1();
59    fn DACC();
60    fn ACC();
61    fn UDP();
62    fn PWM();
63    fn CAN0();
64    fn AES();
65    fn GMAC();
66    fn UART1();
67}
68#[doc(hidden)]
69pub union Vector {
70    _handler: unsafe extern "C" fn(),
71    _reserved: u32,
72}
73#[cfg(feature = "rt")]
74#[doc(hidden)]
75#[link_section = ".vector_table.interrupts"]
76#[no_mangle]
77pub static __INTERRUPTS: [Vector; 46] = [
78    Vector { _handler: SUPC },
79    Vector { _handler: RSTC },
80    Vector { _handler: RTC },
81    Vector { _handler: RTT },
82    Vector { _handler: WDT },
83    Vector { _handler: PMC },
84    Vector { _handler: EFC },
85    Vector { _handler: UART0 },
86    Vector { _reserved: 0 },
87    Vector { _handler: PIOA },
88    Vector { _handler: PIOB },
89    Vector { _reserved: 0 },
90    Vector { _handler: PIOD },
91    Vector { _reserved: 0 },
92    Vector { _handler: USART0 },
93    Vector { _handler: USART1 },
94    Vector { _handler: HSMCI },
95    Vector { _handler: TWI0 },
96    Vector { _handler: TWI1 },
97    Vector { _handler: SPI },
98    Vector { _handler: DMAC },
99    Vector { _handler: TC0 },
100    Vector { _handler: TC1 },
101    Vector { _handler: TC2 },
102    Vector { _reserved: 0 },
103    Vector { _reserved: 0 },
104    Vector { _reserved: 0 },
105    Vector { _reserved: 0 },
106    Vector { _reserved: 0 },
107    Vector { _reserved: 0 },
108    Vector { _handler: AFEC0 },
109    Vector { _handler: AFEC1 },
110    Vector { _handler: DACC },
111    Vector { _handler: ACC },
112    Vector { _reserved: 0 },
113    Vector { _handler: UDP },
114    Vector { _handler: PWM },
115    Vector { _handler: CAN0 },
116    Vector { _reserved: 0 },
117    Vector { _handler: AES },
118    Vector { _reserved: 0 },
119    Vector { _reserved: 0 },
120    Vector { _reserved: 0 },
121    Vector { _reserved: 0 },
122    Vector { _handler: GMAC },
123    Vector { _handler: UART1 },
124];
125#[doc = r"Enumeration of all the interrupts."]
126#[derive(Copy, Clone, Debug, PartialEq, Eq)]
127#[repr(u16)]
128pub enum Interrupt {
129    #[doc = "0 - SUPC"]
130    SUPC = 0,
131    #[doc = "1 - RSTC"]
132    RSTC = 1,
133    #[doc = "2 - RTC"]
134    RTC = 2,
135    #[doc = "3 - RTT"]
136    RTT = 3,
137    #[doc = "4 - WDT"]
138    WDT = 4,
139    #[doc = "5 - PMC"]
140    PMC = 5,
141    #[doc = "6 - EFC"]
142    EFC = 6,
143    #[doc = "7 - UART0"]
144    UART0 = 7,
145    #[doc = "9 - PIOA"]
146    PIOA = 9,
147    #[doc = "10 - PIOB"]
148    PIOB = 10,
149    #[doc = "12 - PIOD"]
150    PIOD = 12,
151    #[doc = "14 - USART0"]
152    USART0 = 14,
153    #[doc = "15 - USART1"]
154    USART1 = 15,
155    #[doc = "16 - HSMCI"]
156    HSMCI = 16,
157    #[doc = "17 - TWI0"]
158    TWI0 = 17,
159    #[doc = "18 - TWI1"]
160    TWI1 = 18,
161    #[doc = "19 - SPI"]
162    SPI = 19,
163    #[doc = "20 - DMAC"]
164    DMAC = 20,
165    #[doc = "21 - TC0"]
166    TC0 = 21,
167    #[doc = "22 - TC1"]
168    TC1 = 22,
169    #[doc = "23 - TC2"]
170    TC2 = 23,
171    #[doc = "30 - AFEC0"]
172    AFEC0 = 30,
173    #[doc = "31 - AFEC1"]
174    AFEC1 = 31,
175    #[doc = "32 - DACC"]
176    DACC = 32,
177    #[doc = "33 - ACC"]
178    ACC = 33,
179    #[doc = "35 - UDP"]
180    UDP = 35,
181    #[doc = "36 - PWM"]
182    PWM = 36,
183    #[doc = "37 - CAN0"]
184    CAN0 = 37,
185    #[doc = "39 - AES"]
186    AES = 39,
187    #[doc = "44 - GMAC"]
188    GMAC = 44,
189    #[doc = "45 - UART1"]
190    UART1 = 45,
191}
192unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
193    #[inline(always)]
194    fn number(self) -> u16 {
195        self as u16
196    }
197}
198#[doc = "Pulse Width Modulation Controller"]
199pub struct PWM {
200    _marker: PhantomData<*const ()>,
201}
202unsafe impl Send for PWM {}
203impl PWM {
204    #[doc = r"Pointer to the register block"]
205    pub const PTR: *const pwm::RegisterBlock = 0x4000_0000 as *const _;
206    #[doc = r"Return the pointer to the register block"]
207    #[inline(always)]
208    pub const fn ptr() -> *const pwm::RegisterBlock {
209        Self::PTR
210    }
211}
212impl Deref for PWM {
213    type Target = pwm::RegisterBlock;
214    #[inline(always)]
215    fn deref(&self) -> &Self::Target {
216        unsafe { &*Self::PTR }
217    }
218}
219impl core::fmt::Debug for PWM {
220    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
221        f.debug_struct("PWM").finish()
222    }
223}
224#[doc = "Pulse Width Modulation Controller"]
225pub mod pwm;
226#[doc = "Advanced Encryption Standard"]
227pub struct AES {
228    _marker: PhantomData<*const ()>,
229}
230unsafe impl Send for AES {}
231impl AES {
232    #[doc = r"Pointer to the register block"]
233    pub const PTR: *const aes::RegisterBlock = 0x4000_4000 as *const _;
234    #[doc = r"Return the pointer to the register block"]
235    #[inline(always)]
236    pub const fn ptr() -> *const aes::RegisterBlock {
237        Self::PTR
238    }
239}
240impl Deref for AES {
241    type Target = aes::RegisterBlock;
242    #[inline(always)]
243    fn deref(&self) -> &Self::Target {
244        unsafe { &*Self::PTR }
245    }
246}
247impl core::fmt::Debug for AES {
248    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
249        f.debug_struct("AES").finish()
250    }
251}
252#[doc = "Advanced Encryption Standard"]
253pub mod aes;
254#[doc = "Controller Area Network 0"]
255pub struct CAN0 {
256    _marker: PhantomData<*const ()>,
257}
258unsafe impl Send for CAN0 {}
259impl CAN0 {
260    #[doc = r"Pointer to the register block"]
261    pub const PTR: *const can0::RegisterBlock = 0x4001_0000 as *const _;
262    #[doc = r"Return the pointer to the register block"]
263    #[inline(always)]
264    pub const fn ptr() -> *const can0::RegisterBlock {
265        Self::PTR
266    }
267}
268impl Deref for CAN0 {
269    type Target = can0::RegisterBlock;
270    #[inline(always)]
271    fn deref(&self) -> &Self::Target {
272        unsafe { &*Self::PTR }
273    }
274}
275impl core::fmt::Debug for CAN0 {
276    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
277        f.debug_struct("CAN0").finish()
278    }
279}
280#[doc = "Controller Area Network 0"]
281pub mod can0;
282#[doc = "Gigabit Ethernet MAC"]
283pub struct GMAC {
284    _marker: PhantomData<*const ()>,
285}
286unsafe impl Send for GMAC {}
287impl GMAC {
288    #[doc = r"Pointer to the register block"]
289    pub const PTR: *const gmac::RegisterBlock = 0x4003_4000 as *const _;
290    #[doc = r"Return the pointer to the register block"]
291    #[inline(always)]
292    pub const fn ptr() -> *const gmac::RegisterBlock {
293        Self::PTR
294    }
295}
296impl Deref for GMAC {
297    type Target = gmac::RegisterBlock;
298    #[inline(always)]
299    fn deref(&self) -> &Self::Target {
300        unsafe { &*Self::PTR }
301    }
302}
303impl core::fmt::Debug for GMAC {
304    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
305        f.debug_struct("GMAC").finish()
306    }
307}
308#[doc = "Gigabit Ethernet MAC"]
309pub mod gmac;
310#[doc = "Universal Asynchronous Receiver Transmitter 1"]
311pub struct UART1 {
312    _marker: PhantomData<*const ()>,
313}
314unsafe impl Send for UART1 {}
315impl UART1 {
316    #[doc = r"Pointer to the register block"]
317    pub const PTR: *const uart1::RegisterBlock = 0x4006_0600 as *const _;
318    #[doc = r"Return the pointer to the register block"]
319    #[inline(always)]
320    pub const fn ptr() -> *const uart1::RegisterBlock {
321        Self::PTR
322    }
323}
324impl Deref for UART1 {
325    type Target = uart1::RegisterBlock;
326    #[inline(always)]
327    fn deref(&self) -> &Self::Target {
328        unsafe { &*Self::PTR }
329    }
330}
331impl core::fmt::Debug for UART1 {
332    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
333        f.debug_struct("UART1").finish()
334    }
335}
336#[doc = "Universal Asynchronous Receiver Transmitter 1"]
337pub mod uart1;
338#[doc = "High Speed MultiMedia Card Interface"]
339pub struct HSMCI {
340    _marker: PhantomData<*const ()>,
341}
342unsafe impl Send for HSMCI {}
343impl HSMCI {
344    #[doc = r"Pointer to the register block"]
345    pub const PTR: *const hsmci::RegisterBlock = 0x4008_0000 as *const _;
346    #[doc = r"Return the pointer to the register block"]
347    #[inline(always)]
348    pub const fn ptr() -> *const hsmci::RegisterBlock {
349        Self::PTR
350    }
351}
352impl Deref for HSMCI {
353    type Target = hsmci::RegisterBlock;
354    #[inline(always)]
355    fn deref(&self) -> &Self::Target {
356        unsafe { &*Self::PTR }
357    }
358}
359impl core::fmt::Debug for HSMCI {
360    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
361        f.debug_struct("HSMCI").finish()
362    }
363}
364#[doc = "High Speed MultiMedia Card Interface"]
365pub mod hsmci;
366#[doc = "USB Device Port"]
367pub struct UDP {
368    _marker: PhantomData<*const ()>,
369}
370unsafe impl Send for UDP {}
371impl UDP {
372    #[doc = r"Pointer to the register block"]
373    pub const PTR: *const udp::RegisterBlock = 0x4008_4000 as *const _;
374    #[doc = r"Return the pointer to the register block"]
375    #[inline(always)]
376    pub const fn ptr() -> *const udp::RegisterBlock {
377        Self::PTR
378    }
379}
380impl Deref for UDP {
381    type Target = udp::RegisterBlock;
382    #[inline(always)]
383    fn deref(&self) -> &Self::Target {
384        unsafe { &*Self::PTR }
385    }
386}
387impl core::fmt::Debug for UDP {
388    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
389        f.debug_struct("UDP").finish()
390    }
391}
392#[doc = "USB Device Port"]
393pub mod udp;
394#[doc = "Serial Peripheral Interface"]
395pub struct SPI {
396    _marker: PhantomData<*const ()>,
397}
398unsafe impl Send for SPI {}
399impl SPI {
400    #[doc = r"Pointer to the register block"]
401    pub const PTR: *const spi::RegisterBlock = 0x4008_8000 as *const _;
402    #[doc = r"Return the pointer to the register block"]
403    #[inline(always)]
404    pub const fn ptr() -> *const spi::RegisterBlock {
405        Self::PTR
406    }
407}
408impl Deref for SPI {
409    type Target = spi::RegisterBlock;
410    #[inline(always)]
411    fn deref(&self) -> &Self::Target {
412        unsafe { &*Self::PTR }
413    }
414}
415impl core::fmt::Debug for SPI {
416    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
417        f.debug_struct("SPI").finish()
418    }
419}
420#[doc = "Serial Peripheral Interface"]
421pub mod spi;
422#[doc = "Timer Counter 0"]
423pub struct TC0 {
424    _marker: PhantomData<*const ()>,
425}
426unsafe impl Send for TC0 {}
427impl TC0 {
428    #[doc = r"Pointer to the register block"]
429    pub const PTR: *const tc0::RegisterBlock = 0x4009_0000 as *const _;
430    #[doc = r"Return the pointer to the register block"]
431    #[inline(always)]
432    pub const fn ptr() -> *const tc0::RegisterBlock {
433        Self::PTR
434    }
435}
436impl Deref for TC0 {
437    type Target = tc0::RegisterBlock;
438    #[inline(always)]
439    fn deref(&self) -> &Self::Target {
440        unsafe { &*Self::PTR }
441    }
442}
443impl core::fmt::Debug for TC0 {
444    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
445        f.debug_struct("TC0").finish()
446    }
447}
448#[doc = "Timer Counter 0"]
449pub mod tc0;
450#[doc = "Universal Synchronous Asynchronous Receiver Transmitter 0"]
451pub struct USART0 {
452    _marker: PhantomData<*const ()>,
453}
454unsafe impl Send for USART0 {}
455impl USART0 {
456    #[doc = r"Pointer to the register block"]
457    pub const PTR: *const usart0::RegisterBlock = 0x400a_0000 as *const _;
458    #[doc = r"Return the pointer to the register block"]
459    #[inline(always)]
460    pub const fn ptr() -> *const usart0::RegisterBlock {
461        Self::PTR
462    }
463}
464impl Deref for USART0 {
465    type Target = usart0::RegisterBlock;
466    #[inline(always)]
467    fn deref(&self) -> &Self::Target {
468        unsafe { &*Self::PTR }
469    }
470}
471impl core::fmt::Debug for USART0 {
472    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
473        f.debug_struct("USART0").finish()
474    }
475}
476#[doc = "Universal Synchronous Asynchronous Receiver Transmitter 0"]
477pub mod usart0;
478#[doc = "Universal Synchronous Asynchronous Receiver Transmitter 1"]
479pub struct USART1 {
480    _marker: PhantomData<*const ()>,
481}
482unsafe impl Send for USART1 {}
483impl USART1 {
484    #[doc = r"Pointer to the register block"]
485    pub const PTR: *const usart1::RegisterBlock = 0x400a_4000 as *const _;
486    #[doc = r"Return the pointer to the register block"]
487    #[inline(always)]
488    pub const fn ptr() -> *const usart1::RegisterBlock {
489        Self::PTR
490    }
491}
492impl Deref for USART1 {
493    type Target = usart1::RegisterBlock;
494    #[inline(always)]
495    fn deref(&self) -> &Self::Target {
496        unsafe { &*Self::PTR }
497    }
498}
499impl core::fmt::Debug for USART1 {
500    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
501        f.debug_struct("USART1").finish()
502    }
503}
504#[doc = "Universal Synchronous Asynchronous Receiver Transmitter 1"]
505pub mod usart1;
506#[doc = "Two-wire Interface 0"]
507pub struct TWI0 {
508    _marker: PhantomData<*const ()>,
509}
510unsafe impl Send for TWI0 {}
511impl TWI0 {
512    #[doc = r"Pointer to the register block"]
513    pub const PTR: *const twi0::RegisterBlock = 0x400a_8000 as *const _;
514    #[doc = r"Return the pointer to the register block"]
515    #[inline(always)]
516    pub const fn ptr() -> *const twi0::RegisterBlock {
517        Self::PTR
518    }
519}
520impl Deref for TWI0 {
521    type Target = twi0::RegisterBlock;
522    #[inline(always)]
523    fn deref(&self) -> &Self::Target {
524        unsafe { &*Self::PTR }
525    }
526}
527impl core::fmt::Debug for TWI0 {
528    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
529        f.debug_struct("TWI0").finish()
530    }
531}
532#[doc = "Two-wire Interface 0"]
533pub mod twi0;
534#[doc = "Two-wire Interface 1"]
535pub struct TWI1 {
536    _marker: PhantomData<*const ()>,
537}
538unsafe impl Send for TWI1 {}
539impl TWI1 {
540    #[doc = r"Pointer to the register block"]
541    pub const PTR: *const twi1::RegisterBlock = 0x400a_c000 as *const _;
542    #[doc = r"Return the pointer to the register block"]
543    #[inline(always)]
544    pub const fn ptr() -> *const twi1::RegisterBlock {
545        Self::PTR
546    }
547}
548impl Deref for TWI1 {
549    type Target = twi1::RegisterBlock;
550    #[inline(always)]
551    fn deref(&self) -> &Self::Target {
552        unsafe { &*Self::PTR }
553    }
554}
555impl core::fmt::Debug for TWI1 {
556    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
557        f.debug_struct("TWI1").finish()
558    }
559}
560#[doc = "Two-wire Interface 1"]
561pub mod twi1;
562#[doc = "Analog-Front-End Controller 0"]
563pub struct AFEC0 {
564    _marker: PhantomData<*const ()>,
565}
566unsafe impl Send for AFEC0 {}
567impl AFEC0 {
568    #[doc = r"Pointer to the register block"]
569    pub const PTR: *const afec0::RegisterBlock = 0x400b_0000 as *const _;
570    #[doc = r"Return the pointer to the register block"]
571    #[inline(always)]
572    pub const fn ptr() -> *const afec0::RegisterBlock {
573        Self::PTR
574    }
575}
576impl Deref for AFEC0 {
577    type Target = afec0::RegisterBlock;
578    #[inline(always)]
579    fn deref(&self) -> &Self::Target {
580        unsafe { &*Self::PTR }
581    }
582}
583impl core::fmt::Debug for AFEC0 {
584    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
585        f.debug_struct("AFEC0").finish()
586    }
587}
588#[doc = "Analog-Front-End Controller 0"]
589pub mod afec0;
590#[doc = "Analog-Front-End Controller 1"]
591pub struct AFEC1 {
592    _marker: PhantomData<*const ()>,
593}
594unsafe impl Send for AFEC1 {}
595impl AFEC1 {
596    #[doc = r"Pointer to the register block"]
597    pub const PTR: *const afec1::RegisterBlock = 0x400b_4000 as *const _;
598    #[doc = r"Return the pointer to the register block"]
599    #[inline(always)]
600    pub const fn ptr() -> *const afec1::RegisterBlock {
601        Self::PTR
602    }
603}
604impl Deref for AFEC1 {
605    type Target = afec1::RegisterBlock;
606    #[inline(always)]
607    fn deref(&self) -> &Self::Target {
608        unsafe { &*Self::PTR }
609    }
610}
611impl core::fmt::Debug for AFEC1 {
612    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
613        f.debug_struct("AFEC1").finish()
614    }
615}
616#[doc = "Analog-Front-End Controller 1"]
617pub mod afec1;
618#[doc = "Digital-to-Analog Converter Controller"]
619pub struct DACC {
620    _marker: PhantomData<*const ()>,
621}
622unsafe impl Send for DACC {}
623impl DACC {
624    #[doc = r"Pointer to the register block"]
625    pub const PTR: *const dacc::RegisterBlock = 0x400b_8000 as *const _;
626    #[doc = r"Return the pointer to the register block"]
627    #[inline(always)]
628    pub const fn ptr() -> *const dacc::RegisterBlock {
629        Self::PTR
630    }
631}
632impl Deref for DACC {
633    type Target = dacc::RegisterBlock;
634    #[inline(always)]
635    fn deref(&self) -> &Self::Target {
636        unsafe { &*Self::PTR }
637    }
638}
639impl core::fmt::Debug for DACC {
640    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
641        f.debug_struct("DACC").finish()
642    }
643}
644#[doc = "Digital-to-Analog Converter Controller"]
645pub mod dacc;
646#[doc = "Analog Comparator Controller"]
647pub struct ACC {
648    _marker: PhantomData<*const ()>,
649}
650unsafe impl Send for ACC {}
651impl ACC {
652    #[doc = r"Pointer to the register block"]
653    pub const PTR: *const acc::RegisterBlock = 0x400b_c000 as *const _;
654    #[doc = r"Return the pointer to the register block"]
655    #[inline(always)]
656    pub const fn ptr() -> *const acc::RegisterBlock {
657        Self::PTR
658    }
659}
660impl Deref for ACC {
661    type Target = acc::RegisterBlock;
662    #[inline(always)]
663    fn deref(&self) -> &Self::Target {
664        unsafe { &*Self::PTR }
665    }
666}
667impl core::fmt::Debug for ACC {
668    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
669        f.debug_struct("ACC").finish()
670    }
671}
672#[doc = "Analog Comparator Controller"]
673pub mod acc;
674#[doc = "DMA Controller"]
675pub struct DMAC {
676    _marker: PhantomData<*const ()>,
677}
678unsafe impl Send for DMAC {}
679impl DMAC {
680    #[doc = r"Pointer to the register block"]
681    pub const PTR: *const dmac::RegisterBlock = 0x400c_0000 as *const _;
682    #[doc = r"Return the pointer to the register block"]
683    #[inline(always)]
684    pub const fn ptr() -> *const dmac::RegisterBlock {
685        Self::PTR
686    }
687}
688impl Deref for DMAC {
689    type Target = dmac::RegisterBlock;
690    #[inline(always)]
691    fn deref(&self) -> &Self::Target {
692        unsafe { &*Self::PTR }
693    }
694}
695impl core::fmt::Debug for DMAC {
696    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
697        f.debug_struct("DMAC").finish()
698    }
699}
700#[doc = "DMA Controller"]
701pub mod dmac;
702#[doc = "Cortex M Cache Controller"]
703pub struct CMCC {
704    _marker: PhantomData<*const ()>,
705}
706unsafe impl Send for CMCC {}
707impl CMCC {
708    #[doc = r"Pointer to the register block"]
709    pub const PTR: *const cmcc::RegisterBlock = 0x400c_4000 as *const _;
710    #[doc = r"Return the pointer to the register block"]
711    #[inline(always)]
712    pub const fn ptr() -> *const cmcc::RegisterBlock {
713        Self::PTR
714    }
715}
716impl Deref for CMCC {
717    type Target = cmcc::RegisterBlock;
718    #[inline(always)]
719    fn deref(&self) -> &Self::Target {
720        unsafe { &*Self::PTR }
721    }
722}
723impl core::fmt::Debug for CMCC {
724    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
725        f.debug_struct("CMCC").finish()
726    }
727}
728#[doc = "Cortex M Cache Controller"]
729pub mod cmcc;
730#[doc = "AHB Bus Matrix"]
731pub struct MATRIX {
732    _marker: PhantomData<*const ()>,
733}
734unsafe impl Send for MATRIX {}
735impl MATRIX {
736    #[doc = r"Pointer to the register block"]
737    pub const PTR: *const matrix::RegisterBlock = 0x400e_0200 as *const _;
738    #[doc = r"Return the pointer to the register block"]
739    #[inline(always)]
740    pub const fn ptr() -> *const matrix::RegisterBlock {
741        Self::PTR
742    }
743}
744impl Deref for MATRIX {
745    type Target = matrix::RegisterBlock;
746    #[inline(always)]
747    fn deref(&self) -> &Self::Target {
748        unsafe { &*Self::PTR }
749    }
750}
751impl core::fmt::Debug for MATRIX {
752    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
753        f.debug_struct("MATRIX").finish()
754    }
755}
756#[doc = "AHB Bus Matrix"]
757pub mod matrix;
758#[doc = "Power Management Controller"]
759pub struct PMC {
760    _marker: PhantomData<*const ()>,
761}
762unsafe impl Send for PMC {}
763impl PMC {
764    #[doc = r"Pointer to the register block"]
765    pub const PTR: *const pmc::RegisterBlock = 0x400e_0400 as *const _;
766    #[doc = r"Return the pointer to the register block"]
767    #[inline(always)]
768    pub const fn ptr() -> *const pmc::RegisterBlock {
769        Self::PTR
770    }
771}
772impl Deref for PMC {
773    type Target = pmc::RegisterBlock;
774    #[inline(always)]
775    fn deref(&self) -> &Self::Target {
776        unsafe { &*Self::PTR }
777    }
778}
779impl core::fmt::Debug for PMC {
780    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
781        f.debug_struct("PMC").finish()
782    }
783}
784#[doc = "Power Management Controller"]
785pub mod pmc;
786#[doc = "Universal Asynchronous Receiver Transmitter 0"]
787pub struct UART0 {
788    _marker: PhantomData<*const ()>,
789}
790unsafe impl Send for UART0 {}
791impl UART0 {
792    #[doc = r"Pointer to the register block"]
793    pub const PTR: *const uart0::RegisterBlock = 0x400e_0600 as *const _;
794    #[doc = r"Return the pointer to the register block"]
795    #[inline(always)]
796    pub const fn ptr() -> *const uart0::RegisterBlock {
797        Self::PTR
798    }
799}
800impl Deref for UART0 {
801    type Target = uart0::RegisterBlock;
802    #[inline(always)]
803    fn deref(&self) -> &Self::Target {
804        unsafe { &*Self::PTR }
805    }
806}
807impl core::fmt::Debug for UART0 {
808    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
809        f.debug_struct("UART0").finish()
810    }
811}
812#[doc = "Universal Asynchronous Receiver Transmitter 0"]
813pub mod uart0;
814#[doc = "Chip Identifier"]
815pub struct CHIPID {
816    _marker: PhantomData<*const ()>,
817}
818unsafe impl Send for CHIPID {}
819impl CHIPID {
820    #[doc = r"Pointer to the register block"]
821    pub const PTR: *const chipid::RegisterBlock = 0x400e_0740 as *const _;
822    #[doc = r"Return the pointer to the register block"]
823    #[inline(always)]
824    pub const fn ptr() -> *const chipid::RegisterBlock {
825        Self::PTR
826    }
827}
828impl Deref for CHIPID {
829    type Target = chipid::RegisterBlock;
830    #[inline(always)]
831    fn deref(&self) -> &Self::Target {
832        unsafe { &*Self::PTR }
833    }
834}
835impl core::fmt::Debug for CHIPID {
836    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
837        f.debug_struct("CHIPID").finish()
838    }
839}
840#[doc = "Chip Identifier"]
841pub mod chipid;
842#[doc = "Embedded Flash Controller"]
843pub struct EFC {
844    _marker: PhantomData<*const ()>,
845}
846unsafe impl Send for EFC {}
847impl EFC {
848    #[doc = r"Pointer to the register block"]
849    pub const PTR: *const efc::RegisterBlock = 0x400e_0a00 as *const _;
850    #[doc = r"Return the pointer to the register block"]
851    #[inline(always)]
852    pub const fn ptr() -> *const efc::RegisterBlock {
853        Self::PTR
854    }
855}
856impl Deref for EFC {
857    type Target = efc::RegisterBlock;
858    #[inline(always)]
859    fn deref(&self) -> &Self::Target {
860        unsafe { &*Self::PTR }
861    }
862}
863impl core::fmt::Debug for EFC {
864    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
865        f.debug_struct("EFC").finish()
866    }
867}
868#[doc = "Embedded Flash Controller"]
869pub mod efc;
870#[doc = "Parallel Input/Output Controller A"]
871pub struct PIOA {
872    _marker: PhantomData<*const ()>,
873}
874unsafe impl Send for PIOA {}
875impl PIOA {
876    #[doc = r"Pointer to the register block"]
877    pub const PTR: *const pioa::RegisterBlock = 0x400e_0e00 as *const _;
878    #[doc = r"Return the pointer to the register block"]
879    #[inline(always)]
880    pub const fn ptr() -> *const pioa::RegisterBlock {
881        Self::PTR
882    }
883}
884impl Deref for PIOA {
885    type Target = pioa::RegisterBlock;
886    #[inline(always)]
887    fn deref(&self) -> &Self::Target {
888        unsafe { &*Self::PTR }
889    }
890}
891impl core::fmt::Debug for PIOA {
892    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
893        f.debug_struct("PIOA").finish()
894    }
895}
896#[doc = "Parallel Input/Output Controller A"]
897pub mod pioa;
898#[doc = "Parallel Input/Output Controller B"]
899pub struct PIOB {
900    _marker: PhantomData<*const ()>,
901}
902unsafe impl Send for PIOB {}
903impl PIOB {
904    #[doc = r"Pointer to the register block"]
905    pub const PTR: *const piob::RegisterBlock = 0x400e_1000 as *const _;
906    #[doc = r"Return the pointer to the register block"]
907    #[inline(always)]
908    pub const fn ptr() -> *const piob::RegisterBlock {
909        Self::PTR
910    }
911}
912impl Deref for PIOB {
913    type Target = piob::RegisterBlock;
914    #[inline(always)]
915    fn deref(&self) -> &Self::Target {
916        unsafe { &*Self::PTR }
917    }
918}
919impl core::fmt::Debug for PIOB {
920    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
921        f.debug_struct("PIOB").finish()
922    }
923}
924#[doc = "Parallel Input/Output Controller B"]
925pub mod piob;
926#[doc = "Parallel Input/Output Controller D"]
927pub struct PIOD {
928    _marker: PhantomData<*const ()>,
929}
930unsafe impl Send for PIOD {}
931impl PIOD {
932    #[doc = r"Pointer to the register block"]
933    pub const PTR: *const piod::RegisterBlock = 0x400e_1400 as *const _;
934    #[doc = r"Return the pointer to the register block"]
935    #[inline(always)]
936    pub const fn ptr() -> *const piod::RegisterBlock {
937        Self::PTR
938    }
939}
940impl Deref for PIOD {
941    type Target = piod::RegisterBlock;
942    #[inline(always)]
943    fn deref(&self) -> &Self::Target {
944        unsafe { &*Self::PTR }
945    }
946}
947impl core::fmt::Debug for PIOD {
948    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
949        f.debug_struct("PIOD").finish()
950    }
951}
952#[doc = "Parallel Input/Output Controller D"]
953pub mod piod;
954#[doc = "Reset Controller"]
955pub struct RSTC {
956    _marker: PhantomData<*const ()>,
957}
958unsafe impl Send for RSTC {}
959impl RSTC {
960    #[doc = r"Pointer to the register block"]
961    pub const PTR: *const rstc::RegisterBlock = 0x400e_1800 as *const _;
962    #[doc = r"Return the pointer to the register block"]
963    #[inline(always)]
964    pub const fn ptr() -> *const rstc::RegisterBlock {
965        Self::PTR
966    }
967}
968impl Deref for RSTC {
969    type Target = rstc::RegisterBlock;
970    #[inline(always)]
971    fn deref(&self) -> &Self::Target {
972        unsafe { &*Self::PTR }
973    }
974}
975impl core::fmt::Debug for RSTC {
976    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
977        f.debug_struct("RSTC").finish()
978    }
979}
980#[doc = "Reset Controller"]
981pub mod rstc;
982#[doc = "Supply Controller"]
983pub struct SUPC {
984    _marker: PhantomData<*const ()>,
985}
986unsafe impl Send for SUPC {}
987impl SUPC {
988    #[doc = r"Pointer to the register block"]
989    pub const PTR: *const supc::RegisterBlock = 0x400e_1810 as *const _;
990    #[doc = r"Return the pointer to the register block"]
991    #[inline(always)]
992    pub const fn ptr() -> *const supc::RegisterBlock {
993        Self::PTR
994    }
995}
996impl Deref for SUPC {
997    type Target = supc::RegisterBlock;
998    #[inline(always)]
999    fn deref(&self) -> &Self::Target {
1000        unsafe { &*Self::PTR }
1001    }
1002}
1003impl core::fmt::Debug for SUPC {
1004    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1005        f.debug_struct("SUPC").finish()
1006    }
1007}
1008#[doc = "Supply Controller"]
1009pub mod supc;
1010#[doc = "Real-time Timer"]
1011pub struct RTT {
1012    _marker: PhantomData<*const ()>,
1013}
1014unsafe impl Send for RTT {}
1015impl RTT {
1016    #[doc = r"Pointer to the register block"]
1017    pub const PTR: *const rtt::RegisterBlock = 0x400e_1830 as *const _;
1018    #[doc = r"Return the pointer to the register block"]
1019    #[inline(always)]
1020    pub const fn ptr() -> *const rtt::RegisterBlock {
1021        Self::PTR
1022    }
1023}
1024impl Deref for RTT {
1025    type Target = rtt::RegisterBlock;
1026    #[inline(always)]
1027    fn deref(&self) -> &Self::Target {
1028        unsafe { &*Self::PTR }
1029    }
1030}
1031impl core::fmt::Debug for RTT {
1032    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1033        f.debug_struct("RTT").finish()
1034    }
1035}
1036#[doc = "Real-time Timer"]
1037pub mod rtt;
1038#[doc = "Watchdog Timer"]
1039pub struct WDT {
1040    _marker: PhantomData<*const ()>,
1041}
1042unsafe impl Send for WDT {}
1043impl WDT {
1044    #[doc = r"Pointer to the register block"]
1045    pub const PTR: *const wdt::RegisterBlock = 0x400e_1850 as *const _;
1046    #[doc = r"Return the pointer to the register block"]
1047    #[inline(always)]
1048    pub const fn ptr() -> *const wdt::RegisterBlock {
1049        Self::PTR
1050    }
1051}
1052impl Deref for WDT {
1053    type Target = wdt::RegisterBlock;
1054    #[inline(always)]
1055    fn deref(&self) -> &Self::Target {
1056        unsafe { &*Self::PTR }
1057    }
1058}
1059impl core::fmt::Debug for WDT {
1060    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1061        f.debug_struct("WDT").finish()
1062    }
1063}
1064#[doc = "Watchdog Timer"]
1065pub mod wdt;
1066#[doc = "Real-time Clock"]
1067pub struct RTC {
1068    _marker: PhantomData<*const ()>,
1069}
1070unsafe impl Send for RTC {}
1071impl RTC {
1072    #[doc = r"Pointer to the register block"]
1073    pub const PTR: *const rtc::RegisterBlock = 0x400e_1860 as *const _;
1074    #[doc = r"Return the pointer to the register block"]
1075    #[inline(always)]
1076    pub const fn ptr() -> *const rtc::RegisterBlock {
1077        Self::PTR
1078    }
1079}
1080impl Deref for RTC {
1081    type Target = rtc::RegisterBlock;
1082    #[inline(always)]
1083    fn deref(&self) -> &Self::Target {
1084        unsafe { &*Self::PTR }
1085    }
1086}
1087impl core::fmt::Debug for RTC {
1088    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1089        f.debug_struct("RTC").finish()
1090    }
1091}
1092#[doc = "Real-time Clock"]
1093pub mod rtc;
1094#[doc = "General Purpose Backup Registers"]
1095pub struct GPBR {
1096    _marker: PhantomData<*const ()>,
1097}
1098unsafe impl Send for GPBR {}
1099impl GPBR {
1100    #[doc = r"Pointer to the register block"]
1101    pub const PTR: *const gpbr::RegisterBlock = 0x400e_1890 as *const _;
1102    #[doc = r"Return the pointer to the register block"]
1103    #[inline(always)]
1104    pub const fn ptr() -> *const gpbr::RegisterBlock {
1105        Self::PTR
1106    }
1107}
1108impl Deref for GPBR {
1109    type Target = gpbr::RegisterBlock;
1110    #[inline(always)]
1111    fn deref(&self) -> &Self::Target {
1112        unsafe { &*Self::PTR }
1113    }
1114}
1115impl core::fmt::Debug for GPBR {
1116    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1117        f.debug_struct("GPBR").finish()
1118    }
1119}
1120#[doc = "General Purpose Backup Registers"]
1121pub mod gpbr;
1122#[doc = "Reinforced Safety Watchdog Timer"]
1123pub struct RSWDT {
1124    _marker: PhantomData<*const ()>,
1125}
1126unsafe impl Send for RSWDT {}
1127impl RSWDT {
1128    #[doc = r"Pointer to the register block"]
1129    pub const PTR: *const rswdt::RegisterBlock = 0x400e_1900 as *const _;
1130    #[doc = r"Return the pointer to the register block"]
1131    #[inline(always)]
1132    pub const fn ptr() -> *const rswdt::RegisterBlock {
1133        Self::PTR
1134    }
1135}
1136impl Deref for RSWDT {
1137    type Target = rswdt::RegisterBlock;
1138    #[inline(always)]
1139    fn deref(&self) -> &Self::Target {
1140        unsafe { &*Self::PTR }
1141    }
1142}
1143impl core::fmt::Debug for RSWDT {
1144    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1145        f.debug_struct("RSWDT").finish()
1146    }
1147}
1148#[doc = "Reinforced Safety Watchdog Timer"]
1149pub mod rswdt;
1150#[no_mangle]
1151static mut DEVICE_PERIPHERALS: bool = false;
1152#[doc = r" All the peripherals."]
1153#[allow(non_snake_case)]
1154pub struct Peripherals {
1155    #[doc = "PWM"]
1156    pub PWM: PWM,
1157    #[doc = "AES"]
1158    pub AES: AES,
1159    #[doc = "CAN0"]
1160    pub CAN0: CAN0,
1161    #[doc = "GMAC"]
1162    pub GMAC: GMAC,
1163    #[doc = "UART1"]
1164    pub UART1: UART1,
1165    #[doc = "HSMCI"]
1166    pub HSMCI: HSMCI,
1167    #[doc = "UDP"]
1168    pub UDP: UDP,
1169    #[doc = "SPI"]
1170    pub SPI: SPI,
1171    #[doc = "TC0"]
1172    pub TC0: TC0,
1173    #[doc = "USART0"]
1174    pub USART0: USART0,
1175    #[doc = "USART1"]
1176    pub USART1: USART1,
1177    #[doc = "TWI0"]
1178    pub TWI0: TWI0,
1179    #[doc = "TWI1"]
1180    pub TWI1: TWI1,
1181    #[doc = "AFEC0"]
1182    pub AFEC0: AFEC0,
1183    #[doc = "AFEC1"]
1184    pub AFEC1: AFEC1,
1185    #[doc = "DACC"]
1186    pub DACC: DACC,
1187    #[doc = "ACC"]
1188    pub ACC: ACC,
1189    #[doc = "DMAC"]
1190    pub DMAC: DMAC,
1191    #[doc = "CMCC"]
1192    pub CMCC: CMCC,
1193    #[doc = "MATRIX"]
1194    pub MATRIX: MATRIX,
1195    #[doc = "PMC"]
1196    pub PMC: PMC,
1197    #[doc = "UART0"]
1198    pub UART0: UART0,
1199    #[doc = "CHIPID"]
1200    pub CHIPID: CHIPID,
1201    #[doc = "EFC"]
1202    pub EFC: EFC,
1203    #[doc = "PIOA"]
1204    pub PIOA: PIOA,
1205    #[doc = "PIOB"]
1206    pub PIOB: PIOB,
1207    #[doc = "PIOD"]
1208    pub PIOD: PIOD,
1209    #[doc = "RSTC"]
1210    pub RSTC: RSTC,
1211    #[doc = "SUPC"]
1212    pub SUPC: SUPC,
1213    #[doc = "RTT"]
1214    pub RTT: RTT,
1215    #[doc = "WDT"]
1216    pub WDT: WDT,
1217    #[doc = "RTC"]
1218    pub RTC: RTC,
1219    #[doc = "GPBR"]
1220    pub GPBR: GPBR,
1221    #[doc = "RSWDT"]
1222    pub RSWDT: RSWDT,
1223}
1224impl Peripherals {
1225    #[doc = r" Returns all the peripherals *once*."]
1226    #[cfg(feature = "critical-section")]
1227    #[inline]
1228    pub fn take() -> Option<Self> {
1229        critical_section::with(|_| {
1230            if unsafe { DEVICE_PERIPHERALS } {
1231                return None;
1232            }
1233            Some(unsafe { Peripherals::steal() })
1234        })
1235    }
1236    #[doc = r" Unchecked version of `Peripherals::take`."]
1237    #[doc = r""]
1238    #[doc = r" # Safety"]
1239    #[doc = r""]
1240    #[doc = r" Each of the returned peripherals must be used at most once."]
1241    #[inline]
1242    pub unsafe fn steal() -> Self {
1243        DEVICE_PERIPHERALS = true;
1244        Peripherals {
1245            PWM: PWM {
1246                _marker: PhantomData,
1247            },
1248            AES: AES {
1249                _marker: PhantomData,
1250            },
1251            CAN0: CAN0 {
1252                _marker: PhantomData,
1253            },
1254            GMAC: GMAC {
1255                _marker: PhantomData,
1256            },
1257            UART1: UART1 {
1258                _marker: PhantomData,
1259            },
1260            HSMCI: HSMCI {
1261                _marker: PhantomData,
1262            },
1263            UDP: UDP {
1264                _marker: PhantomData,
1265            },
1266            SPI: SPI {
1267                _marker: PhantomData,
1268            },
1269            TC0: TC0 {
1270                _marker: PhantomData,
1271            },
1272            USART0: USART0 {
1273                _marker: PhantomData,
1274            },
1275            USART1: USART1 {
1276                _marker: PhantomData,
1277            },
1278            TWI0: TWI0 {
1279                _marker: PhantomData,
1280            },
1281            TWI1: TWI1 {
1282                _marker: PhantomData,
1283            },
1284            AFEC0: AFEC0 {
1285                _marker: PhantomData,
1286            },
1287            AFEC1: AFEC1 {
1288                _marker: PhantomData,
1289            },
1290            DACC: DACC {
1291                _marker: PhantomData,
1292            },
1293            ACC: ACC {
1294                _marker: PhantomData,
1295            },
1296            DMAC: DMAC {
1297                _marker: PhantomData,
1298            },
1299            CMCC: CMCC {
1300                _marker: PhantomData,
1301            },
1302            MATRIX: MATRIX {
1303                _marker: PhantomData,
1304            },
1305            PMC: PMC {
1306                _marker: PhantomData,
1307            },
1308            UART0: UART0 {
1309                _marker: PhantomData,
1310            },
1311            CHIPID: CHIPID {
1312                _marker: PhantomData,
1313            },
1314            EFC: EFC {
1315                _marker: PhantomData,
1316            },
1317            PIOA: PIOA {
1318                _marker: PhantomData,
1319            },
1320            PIOB: PIOB {
1321                _marker: PhantomData,
1322            },
1323            PIOD: PIOD {
1324                _marker: PhantomData,
1325            },
1326            RSTC: RSTC {
1327                _marker: PhantomData,
1328            },
1329            SUPC: SUPC {
1330                _marker: PhantomData,
1331            },
1332            RTT: RTT {
1333                _marker: PhantomData,
1334            },
1335            WDT: WDT {
1336                _marker: PhantomData,
1337            },
1338            RTC: RTC {
1339                _marker: PhantomData,
1340            },
1341            GPBR: GPBR {
1342                _marker: PhantomData,
1343            },
1344            RSWDT: RSWDT {
1345                _marker: PhantomData,
1346            },
1347        }
1348    }
1349}