atsam4n8a_pac/
lib.rs

1#![doc = "Peripheral access API for ATSAM4N8A 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, 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 UART1();
45    fn UART2();
46    fn PIOA();
47    fn PIOB();
48    fn USART0();
49    fn UART3();
50    fn TWI0();
51    fn TWI1();
52    fn SPI();
53    fn TWI2();
54    fn TC0();
55    fn TC1();
56    fn TC2();
57    fn ADC();
58    fn PWM();
59}
60#[doc(hidden)]
61pub union Vector {
62    _handler: unsafe extern "C" fn(),
63    _reserved: u32,
64}
65#[cfg(feature = "rt")]
66#[doc(hidden)]
67#[link_section = ".vector_table.interrupts"]
68#[no_mangle]
69pub static __INTERRUPTS: [Vector; 32] = [
70    Vector { _handler: SUPC },
71    Vector { _handler: RSTC },
72    Vector { _handler: RTC },
73    Vector { _handler: RTT },
74    Vector { _handler: WDT },
75    Vector { _handler: PMC },
76    Vector { _handler: EFC },
77    Vector { _reserved: 0 },
78    Vector { _handler: UART0 },
79    Vector { _handler: UART1 },
80    Vector { _handler: UART2 },
81    Vector { _handler: PIOA },
82    Vector { _handler: PIOB },
83    Vector { _reserved: 0 },
84    Vector { _handler: USART0 },
85    Vector { _reserved: 0 },
86    Vector { _handler: UART3 },
87    Vector { _reserved: 0 },
88    Vector { _reserved: 0 },
89    Vector { _handler: TWI0 },
90    Vector { _handler: TWI1 },
91    Vector { _handler: SPI },
92    Vector { _handler: TWI2 },
93    Vector { _handler: TC0 },
94    Vector { _handler: TC1 },
95    Vector { _handler: TC2 },
96    Vector { _reserved: 0 },
97    Vector { _reserved: 0 },
98    Vector { _reserved: 0 },
99    Vector { _handler: ADC },
100    Vector { _reserved: 0 },
101    Vector { _handler: PWM },
102];
103#[doc = r"Enumeration of all the interrupts."]
104#[derive(Copy, Clone, Debug, PartialEq, Eq)]
105#[repr(u16)]
106pub enum Interrupt {
107    #[doc = "0 - SUPC"]
108    SUPC = 0,
109    #[doc = "1 - RSTC"]
110    RSTC = 1,
111    #[doc = "2 - RTC"]
112    RTC = 2,
113    #[doc = "3 - RTT"]
114    RTT = 3,
115    #[doc = "4 - WDT"]
116    WDT = 4,
117    #[doc = "5 - PMC"]
118    PMC = 5,
119    #[doc = "6 - EFC"]
120    EFC = 6,
121    #[doc = "8 - UART0"]
122    UART0 = 8,
123    #[doc = "9 - UART1"]
124    UART1 = 9,
125    #[doc = "10 - UART2"]
126    UART2 = 10,
127    #[doc = "11 - PIOA"]
128    PIOA = 11,
129    #[doc = "12 - PIOB"]
130    PIOB = 12,
131    #[doc = "14 - USART0"]
132    USART0 = 14,
133    #[doc = "16 - UART3"]
134    UART3 = 16,
135    #[doc = "19 - TWI0"]
136    TWI0 = 19,
137    #[doc = "20 - TWI1"]
138    TWI1 = 20,
139    #[doc = "21 - SPI"]
140    SPI = 21,
141    #[doc = "22 - TWI2"]
142    TWI2 = 22,
143    #[doc = "23 - TC0"]
144    TC0 = 23,
145    #[doc = "24 - TC1"]
146    TC1 = 24,
147    #[doc = "25 - TC2"]
148    TC2 = 25,
149    #[doc = "29 - ADC"]
150    ADC = 29,
151    #[doc = "31 - PWM"]
152    PWM = 31,
153}
154unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
155    #[inline(always)]
156    fn number(self) -> u16 {
157        self as u16
158    }
159}
160#[doc = "Serial Peripheral Interface"]
161pub struct SPI {
162    _marker: PhantomData<*const ()>,
163}
164unsafe impl Send for SPI {}
165impl SPI {
166    #[doc = r"Pointer to the register block"]
167    pub const PTR: *const spi::RegisterBlock = 0x4000_8000 as *const _;
168    #[doc = r"Return the pointer to the register block"]
169    #[inline(always)]
170    pub const fn ptr() -> *const spi::RegisterBlock {
171        Self::PTR
172    }
173}
174impl Deref for SPI {
175    type Target = spi::RegisterBlock;
176    #[inline(always)]
177    fn deref(&self) -> &Self::Target {
178        unsafe { &*Self::PTR }
179    }
180}
181impl core::fmt::Debug for SPI {
182    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
183        f.debug_struct("SPI").finish()
184    }
185}
186#[doc = "Serial Peripheral Interface"]
187pub mod spi;
188#[doc = "Timer Counter 0"]
189pub struct TC0 {
190    _marker: PhantomData<*const ()>,
191}
192unsafe impl Send for TC0 {}
193impl TC0 {
194    #[doc = r"Pointer to the register block"]
195    pub const PTR: *const tc0::RegisterBlock = 0x4001_0000 as *const _;
196    #[doc = r"Return the pointer to the register block"]
197    #[inline(always)]
198    pub const fn ptr() -> *const tc0::RegisterBlock {
199        Self::PTR
200    }
201}
202impl Deref for TC0 {
203    type Target = tc0::RegisterBlock;
204    #[inline(always)]
205    fn deref(&self) -> &Self::Target {
206        unsafe { &*Self::PTR }
207    }
208}
209impl core::fmt::Debug for TC0 {
210    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
211        f.debug_struct("TC0").finish()
212    }
213}
214#[doc = "Timer Counter 0"]
215pub mod tc0;
216#[doc = "Two-wire Interface 0"]
217pub struct TWI0 {
218    _marker: PhantomData<*const ()>,
219}
220unsafe impl Send for TWI0 {}
221impl TWI0 {
222    #[doc = r"Pointer to the register block"]
223    pub const PTR: *const twi0::RegisterBlock = 0x4001_8000 as *const _;
224    #[doc = r"Return the pointer to the register block"]
225    #[inline(always)]
226    pub const fn ptr() -> *const twi0::RegisterBlock {
227        Self::PTR
228    }
229}
230impl Deref for TWI0 {
231    type Target = twi0::RegisterBlock;
232    #[inline(always)]
233    fn deref(&self) -> &Self::Target {
234        unsafe { &*Self::PTR }
235    }
236}
237impl core::fmt::Debug for TWI0 {
238    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
239        f.debug_struct("TWI0").finish()
240    }
241}
242#[doc = "Two-wire Interface 0"]
243pub mod twi0;
244#[doc = "Two-wire Interface 1"]
245pub struct TWI1 {
246    _marker: PhantomData<*const ()>,
247}
248unsafe impl Send for TWI1 {}
249impl TWI1 {
250    #[doc = r"Pointer to the register block"]
251    pub const PTR: *const twi1::RegisterBlock = 0x4001_c000 as *const _;
252    #[doc = r"Return the pointer to the register block"]
253    #[inline(always)]
254    pub const fn ptr() -> *const twi1::RegisterBlock {
255        Self::PTR
256    }
257}
258impl Deref for TWI1 {
259    type Target = twi1::RegisterBlock;
260    #[inline(always)]
261    fn deref(&self) -> &Self::Target {
262        unsafe { &*Self::PTR }
263    }
264}
265impl core::fmt::Debug for TWI1 {
266    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
267        f.debug_struct("TWI1").finish()
268    }
269}
270#[doc = "Two-wire Interface 1"]
271pub mod twi1;
272#[doc = "Pulse Width Modulation Controller"]
273pub struct PWM {
274    _marker: PhantomData<*const ()>,
275}
276unsafe impl Send for PWM {}
277impl PWM {
278    #[doc = r"Pointer to the register block"]
279    pub const PTR: *const pwm::RegisterBlock = 0x4002_0000 as *const _;
280    #[doc = r"Return the pointer to the register block"]
281    #[inline(always)]
282    pub const fn ptr() -> *const pwm::RegisterBlock {
283        Self::PTR
284    }
285}
286impl Deref for PWM {
287    type Target = pwm::RegisterBlock;
288    #[inline(always)]
289    fn deref(&self) -> &Self::Target {
290        unsafe { &*Self::PTR }
291    }
292}
293impl core::fmt::Debug for PWM {
294    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
295        f.debug_struct("PWM").finish()
296    }
297}
298#[doc = "Pulse Width Modulation Controller"]
299pub mod pwm;
300#[doc = "Universal Synchronous Asynchronous Receiver Transmitter 0"]
301pub struct USART0 {
302    _marker: PhantomData<*const ()>,
303}
304unsafe impl Send for USART0 {}
305impl USART0 {
306    #[doc = r"Pointer to the register block"]
307    pub const PTR: *const usart0::RegisterBlock = 0x4002_4000 as *const _;
308    #[doc = r"Return the pointer to the register block"]
309    #[inline(always)]
310    pub const fn ptr() -> *const usart0::RegisterBlock {
311        Self::PTR
312    }
313}
314impl Deref for USART0 {
315    type Target = usart0::RegisterBlock;
316    #[inline(always)]
317    fn deref(&self) -> &Self::Target {
318        unsafe { &*Self::PTR }
319    }
320}
321impl core::fmt::Debug for USART0 {
322    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
323        f.debug_struct("USART0").finish()
324    }
325}
326#[doc = "Universal Synchronous Asynchronous Receiver Transmitter 0"]
327pub mod usart0;
328#[doc = "Analog-to-Digital Converter"]
329pub struct ADC {
330    _marker: PhantomData<*const ()>,
331}
332unsafe impl Send for ADC {}
333impl ADC {
334    #[doc = r"Pointer to the register block"]
335    pub const PTR: *const adc::RegisterBlock = 0x4003_8000 as *const _;
336    #[doc = r"Return the pointer to the register block"]
337    #[inline(always)]
338    pub const fn ptr() -> *const adc::RegisterBlock {
339        Self::PTR
340    }
341}
342impl Deref for ADC {
343    type Target = adc::RegisterBlock;
344    #[inline(always)]
345    fn deref(&self) -> &Self::Target {
346        unsafe { &*Self::PTR }
347    }
348}
349impl core::fmt::Debug for ADC {
350    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
351        f.debug_struct("ADC").finish()
352    }
353}
354#[doc = "Analog-to-Digital Converter"]
355pub mod adc;
356#[doc = "Two-wire Interface 2"]
357pub struct TWI2 {
358    _marker: PhantomData<*const ()>,
359}
360unsafe impl Send for TWI2 {}
361impl TWI2 {
362    #[doc = r"Pointer to the register block"]
363    pub const PTR: *const twi2::RegisterBlock = 0x4004_0000 as *const _;
364    #[doc = r"Return the pointer to the register block"]
365    #[inline(always)]
366    pub const fn ptr() -> *const twi2::RegisterBlock {
367        Self::PTR
368    }
369}
370impl Deref for TWI2 {
371    type Target = twi2::RegisterBlock;
372    #[inline(always)]
373    fn deref(&self) -> &Self::Target {
374        unsafe { &*Self::PTR }
375    }
376}
377impl core::fmt::Debug for TWI2 {
378    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
379        f.debug_struct("TWI2").finish()
380    }
381}
382#[doc = "Two-wire Interface 2"]
383pub mod twi2;
384#[doc = "Universal Asynchronous Receiver Transmitter 2"]
385pub struct UART2 {
386    _marker: PhantomData<*const ()>,
387}
388unsafe impl Send for UART2 {}
389impl UART2 {
390    #[doc = r"Pointer to the register block"]
391    pub const PTR: *const uart2::RegisterBlock = 0x4004_4000 as *const _;
392    #[doc = r"Return the pointer to the register block"]
393    #[inline(always)]
394    pub const fn ptr() -> *const uart2::RegisterBlock {
395        Self::PTR
396    }
397}
398impl Deref for UART2 {
399    type Target = uart2::RegisterBlock;
400    #[inline(always)]
401    fn deref(&self) -> &Self::Target {
402        unsafe { &*Self::PTR }
403    }
404}
405impl core::fmt::Debug for UART2 {
406    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
407        f.debug_struct("UART2").finish()
408    }
409}
410#[doc = "Universal Asynchronous Receiver Transmitter 2"]
411pub mod uart2;
412#[doc = "Universal Asynchronous Receiver Transmitter 3"]
413pub struct UART3 {
414    _marker: PhantomData<*const ()>,
415}
416unsafe impl Send for UART3 {}
417impl UART3 {
418    #[doc = r"Pointer to the register block"]
419    pub const PTR: *const uart3::RegisterBlock = 0x4004_8000 as *const _;
420    #[doc = r"Return the pointer to the register block"]
421    #[inline(always)]
422    pub const fn ptr() -> *const uart3::RegisterBlock {
423        Self::PTR
424    }
425}
426impl Deref for UART3 {
427    type Target = uart3::RegisterBlock;
428    #[inline(always)]
429    fn deref(&self) -> &Self::Target {
430        unsafe { &*Self::PTR }
431    }
432}
433impl core::fmt::Debug for UART3 {
434    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
435        f.debug_struct("UART3").finish()
436    }
437}
438#[doc = "Universal Asynchronous Receiver Transmitter 3"]
439pub mod uart3;
440#[doc = "AHB Bus Matrix"]
441pub struct MATRIX {
442    _marker: PhantomData<*const ()>,
443}
444unsafe impl Send for MATRIX {}
445impl MATRIX {
446    #[doc = r"Pointer to the register block"]
447    pub const PTR: *const matrix::RegisterBlock = 0x400e_0200 as *const _;
448    #[doc = r"Return the pointer to the register block"]
449    #[inline(always)]
450    pub const fn ptr() -> *const matrix::RegisterBlock {
451        Self::PTR
452    }
453}
454impl Deref for MATRIX {
455    type Target = matrix::RegisterBlock;
456    #[inline(always)]
457    fn deref(&self) -> &Self::Target {
458        unsafe { &*Self::PTR }
459    }
460}
461impl core::fmt::Debug for MATRIX {
462    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
463        f.debug_struct("MATRIX").finish()
464    }
465}
466#[doc = "AHB Bus Matrix"]
467pub mod matrix;
468#[doc = "Power Management Controller"]
469pub struct PMC {
470    _marker: PhantomData<*const ()>,
471}
472unsafe impl Send for PMC {}
473impl PMC {
474    #[doc = r"Pointer to the register block"]
475    pub const PTR: *const pmc::RegisterBlock = 0x400e_0400 as *const _;
476    #[doc = r"Return the pointer to the register block"]
477    #[inline(always)]
478    pub const fn ptr() -> *const pmc::RegisterBlock {
479        Self::PTR
480    }
481}
482impl Deref for PMC {
483    type Target = pmc::RegisterBlock;
484    #[inline(always)]
485    fn deref(&self) -> &Self::Target {
486        unsafe { &*Self::PTR }
487    }
488}
489impl core::fmt::Debug for PMC {
490    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
491        f.debug_struct("PMC").finish()
492    }
493}
494#[doc = "Power Management Controller"]
495pub mod pmc;
496#[doc = "Universal Asynchronous Receiver Transmitter 0"]
497pub struct UART0 {
498    _marker: PhantomData<*const ()>,
499}
500unsafe impl Send for UART0 {}
501impl UART0 {
502    #[doc = r"Pointer to the register block"]
503    pub const PTR: *const uart0::RegisterBlock = 0x400e_0600 as *const _;
504    #[doc = r"Return the pointer to the register block"]
505    #[inline(always)]
506    pub const fn ptr() -> *const uart0::RegisterBlock {
507        Self::PTR
508    }
509}
510impl Deref for UART0 {
511    type Target = uart0::RegisterBlock;
512    #[inline(always)]
513    fn deref(&self) -> &Self::Target {
514        unsafe { &*Self::PTR }
515    }
516}
517impl core::fmt::Debug for UART0 {
518    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
519        f.debug_struct("UART0").finish()
520    }
521}
522#[doc = "Universal Asynchronous Receiver Transmitter 0"]
523pub mod uart0;
524#[doc = "Chip Identifier"]
525pub struct CHIPID {
526    _marker: PhantomData<*const ()>,
527}
528unsafe impl Send for CHIPID {}
529impl CHIPID {
530    #[doc = r"Pointer to the register block"]
531    pub const PTR: *const chipid::RegisterBlock = 0x400e_0740 as *const _;
532    #[doc = r"Return the pointer to the register block"]
533    #[inline(always)]
534    pub const fn ptr() -> *const chipid::RegisterBlock {
535        Self::PTR
536    }
537}
538impl Deref for CHIPID {
539    type Target = chipid::RegisterBlock;
540    #[inline(always)]
541    fn deref(&self) -> &Self::Target {
542        unsafe { &*Self::PTR }
543    }
544}
545impl core::fmt::Debug for CHIPID {
546    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
547        f.debug_struct("CHIPID").finish()
548    }
549}
550#[doc = "Chip Identifier"]
551pub mod chipid;
552#[doc = "Universal Asynchronous Receiver Transmitter 1"]
553pub struct UART1 {
554    _marker: PhantomData<*const ()>,
555}
556unsafe impl Send for UART1 {}
557impl UART1 {
558    #[doc = r"Pointer to the register block"]
559    pub const PTR: *const uart1::RegisterBlock = 0x400e_0800 as *const _;
560    #[doc = r"Return the pointer to the register block"]
561    #[inline(always)]
562    pub const fn ptr() -> *const uart1::RegisterBlock {
563        Self::PTR
564    }
565}
566impl Deref for UART1 {
567    type Target = uart1::RegisterBlock;
568    #[inline(always)]
569    fn deref(&self) -> &Self::Target {
570        unsafe { &*Self::PTR }
571    }
572}
573impl core::fmt::Debug for UART1 {
574    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
575        f.debug_struct("UART1").finish()
576    }
577}
578#[doc = "Universal Asynchronous Receiver Transmitter 1"]
579pub mod uart1;
580#[doc = "Embedded Flash Controller"]
581pub struct EFC {
582    _marker: PhantomData<*const ()>,
583}
584unsafe impl Send for EFC {}
585impl EFC {
586    #[doc = r"Pointer to the register block"]
587    pub const PTR: *const efc::RegisterBlock = 0x400e_0a00 as *const _;
588    #[doc = r"Return the pointer to the register block"]
589    #[inline(always)]
590    pub const fn ptr() -> *const efc::RegisterBlock {
591        Self::PTR
592    }
593}
594impl Deref for EFC {
595    type Target = efc::RegisterBlock;
596    #[inline(always)]
597    fn deref(&self) -> &Self::Target {
598        unsafe { &*Self::PTR }
599    }
600}
601impl core::fmt::Debug for EFC {
602    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
603        f.debug_struct("EFC").finish()
604    }
605}
606#[doc = "Embedded Flash Controller"]
607pub mod efc;
608#[doc = "Parallel Input/Output Controller A"]
609pub struct PIOA {
610    _marker: PhantomData<*const ()>,
611}
612unsafe impl Send for PIOA {}
613impl PIOA {
614    #[doc = r"Pointer to the register block"]
615    pub const PTR: *const pioa::RegisterBlock = 0x400e_0e00 as *const _;
616    #[doc = r"Return the pointer to the register block"]
617    #[inline(always)]
618    pub const fn ptr() -> *const pioa::RegisterBlock {
619        Self::PTR
620    }
621}
622impl Deref for PIOA {
623    type Target = pioa::RegisterBlock;
624    #[inline(always)]
625    fn deref(&self) -> &Self::Target {
626        unsafe { &*Self::PTR }
627    }
628}
629impl core::fmt::Debug for PIOA {
630    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
631        f.debug_struct("PIOA").finish()
632    }
633}
634#[doc = "Parallel Input/Output Controller A"]
635pub mod pioa;
636#[doc = "Parallel Input/Output Controller B"]
637pub struct PIOB {
638    _marker: PhantomData<*const ()>,
639}
640unsafe impl Send for PIOB {}
641impl PIOB {
642    #[doc = r"Pointer to the register block"]
643    pub const PTR: *const piob::RegisterBlock = 0x400e_1000 as *const _;
644    #[doc = r"Return the pointer to the register block"]
645    #[inline(always)]
646    pub const fn ptr() -> *const piob::RegisterBlock {
647        Self::PTR
648    }
649}
650impl Deref for PIOB {
651    type Target = piob::RegisterBlock;
652    #[inline(always)]
653    fn deref(&self) -> &Self::Target {
654        unsafe { &*Self::PTR }
655    }
656}
657impl core::fmt::Debug for PIOB {
658    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
659        f.debug_struct("PIOB").finish()
660    }
661}
662#[doc = "Parallel Input/Output Controller B"]
663pub mod piob;
664#[doc = "Reset Controller"]
665pub struct RSTC {
666    _marker: PhantomData<*const ()>,
667}
668unsafe impl Send for RSTC {}
669impl RSTC {
670    #[doc = r"Pointer to the register block"]
671    pub const PTR: *const rstc::RegisterBlock = 0x400e_1400 as *const _;
672    #[doc = r"Return the pointer to the register block"]
673    #[inline(always)]
674    pub const fn ptr() -> *const rstc::RegisterBlock {
675        Self::PTR
676    }
677}
678impl Deref for RSTC {
679    type Target = rstc::RegisterBlock;
680    #[inline(always)]
681    fn deref(&self) -> &Self::Target {
682        unsafe { &*Self::PTR }
683    }
684}
685impl core::fmt::Debug for RSTC {
686    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
687        f.debug_struct("RSTC").finish()
688    }
689}
690#[doc = "Reset Controller"]
691pub mod rstc;
692#[doc = "Supply Controller"]
693pub struct SUPC {
694    _marker: PhantomData<*const ()>,
695}
696unsafe impl Send for SUPC {}
697impl SUPC {
698    #[doc = r"Pointer to the register block"]
699    pub const PTR: *const supc::RegisterBlock = 0x400e_1410 as *const _;
700    #[doc = r"Return the pointer to the register block"]
701    #[inline(always)]
702    pub const fn ptr() -> *const supc::RegisterBlock {
703        Self::PTR
704    }
705}
706impl Deref for SUPC {
707    type Target = supc::RegisterBlock;
708    #[inline(always)]
709    fn deref(&self) -> &Self::Target {
710        unsafe { &*Self::PTR }
711    }
712}
713impl core::fmt::Debug for SUPC {
714    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
715        f.debug_struct("SUPC").finish()
716    }
717}
718#[doc = "Supply Controller"]
719pub mod supc;
720#[doc = "Real-time Timer"]
721pub struct RTT {
722    _marker: PhantomData<*const ()>,
723}
724unsafe impl Send for RTT {}
725impl RTT {
726    #[doc = r"Pointer to the register block"]
727    pub const PTR: *const rtt::RegisterBlock = 0x400e_1430 as *const _;
728    #[doc = r"Return the pointer to the register block"]
729    #[inline(always)]
730    pub const fn ptr() -> *const rtt::RegisterBlock {
731        Self::PTR
732    }
733}
734impl Deref for RTT {
735    type Target = rtt::RegisterBlock;
736    #[inline(always)]
737    fn deref(&self) -> &Self::Target {
738        unsafe { &*Self::PTR }
739    }
740}
741impl core::fmt::Debug for RTT {
742    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
743        f.debug_struct("RTT").finish()
744    }
745}
746#[doc = "Real-time Timer"]
747pub mod rtt;
748#[doc = "Watchdog Timer"]
749pub struct WDT {
750    _marker: PhantomData<*const ()>,
751}
752unsafe impl Send for WDT {}
753impl WDT {
754    #[doc = r"Pointer to the register block"]
755    pub const PTR: *const wdt::RegisterBlock = 0x400e_1450 as *const _;
756    #[doc = r"Return the pointer to the register block"]
757    #[inline(always)]
758    pub const fn ptr() -> *const wdt::RegisterBlock {
759        Self::PTR
760    }
761}
762impl Deref for WDT {
763    type Target = wdt::RegisterBlock;
764    #[inline(always)]
765    fn deref(&self) -> &Self::Target {
766        unsafe { &*Self::PTR }
767    }
768}
769impl core::fmt::Debug for WDT {
770    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
771        f.debug_struct("WDT").finish()
772    }
773}
774#[doc = "Watchdog Timer"]
775pub mod wdt;
776#[doc = "Real-time Clock"]
777pub struct RTC {
778    _marker: PhantomData<*const ()>,
779}
780unsafe impl Send for RTC {}
781impl RTC {
782    #[doc = r"Pointer to the register block"]
783    pub const PTR: *const rtc::RegisterBlock = 0x400e_1460 as *const _;
784    #[doc = r"Return the pointer to the register block"]
785    #[inline(always)]
786    pub const fn ptr() -> *const rtc::RegisterBlock {
787        Self::PTR
788    }
789}
790impl Deref for RTC {
791    type Target = rtc::RegisterBlock;
792    #[inline(always)]
793    fn deref(&self) -> &Self::Target {
794        unsafe { &*Self::PTR }
795    }
796}
797impl core::fmt::Debug for RTC {
798    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
799        f.debug_struct("RTC").finish()
800    }
801}
802#[doc = "Real-time Clock"]
803pub mod rtc;
804#[doc = "General Purpose Backup Registers"]
805pub struct GPBR {
806    _marker: PhantomData<*const ()>,
807}
808unsafe impl Send for GPBR {}
809impl GPBR {
810    #[doc = r"Pointer to the register block"]
811    pub const PTR: *const gpbr::RegisterBlock = 0x400e_1490 as *const _;
812    #[doc = r"Return the pointer to the register block"]
813    #[inline(always)]
814    pub const fn ptr() -> *const gpbr::RegisterBlock {
815        Self::PTR
816    }
817}
818impl Deref for GPBR {
819    type Target = gpbr::RegisterBlock;
820    #[inline(always)]
821    fn deref(&self) -> &Self::Target {
822        unsafe { &*Self::PTR }
823    }
824}
825impl core::fmt::Debug for GPBR {
826    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
827        f.debug_struct("GPBR").finish()
828    }
829}
830#[doc = "General Purpose Backup Registers"]
831pub mod gpbr;
832#[no_mangle]
833static mut DEVICE_PERIPHERALS: bool = false;
834#[doc = r" All the peripherals."]
835#[allow(non_snake_case)]
836pub struct Peripherals {
837    #[doc = "SPI"]
838    pub SPI: SPI,
839    #[doc = "TC0"]
840    pub TC0: TC0,
841    #[doc = "TWI0"]
842    pub TWI0: TWI0,
843    #[doc = "TWI1"]
844    pub TWI1: TWI1,
845    #[doc = "PWM"]
846    pub PWM: PWM,
847    #[doc = "USART0"]
848    pub USART0: USART0,
849    #[doc = "ADC"]
850    pub ADC: ADC,
851    #[doc = "TWI2"]
852    pub TWI2: TWI2,
853    #[doc = "UART2"]
854    pub UART2: UART2,
855    #[doc = "UART3"]
856    pub UART3: UART3,
857    #[doc = "MATRIX"]
858    pub MATRIX: MATRIX,
859    #[doc = "PMC"]
860    pub PMC: PMC,
861    #[doc = "UART0"]
862    pub UART0: UART0,
863    #[doc = "CHIPID"]
864    pub CHIPID: CHIPID,
865    #[doc = "UART1"]
866    pub UART1: UART1,
867    #[doc = "EFC"]
868    pub EFC: EFC,
869    #[doc = "PIOA"]
870    pub PIOA: PIOA,
871    #[doc = "PIOB"]
872    pub PIOB: PIOB,
873    #[doc = "RSTC"]
874    pub RSTC: RSTC,
875    #[doc = "SUPC"]
876    pub SUPC: SUPC,
877    #[doc = "RTT"]
878    pub RTT: RTT,
879    #[doc = "WDT"]
880    pub WDT: WDT,
881    #[doc = "RTC"]
882    pub RTC: RTC,
883    #[doc = "GPBR"]
884    pub GPBR: GPBR,
885}
886impl Peripherals {
887    #[doc = r" Returns all the peripherals *once*."]
888    #[cfg(feature = "critical-section")]
889    #[inline]
890    pub fn take() -> Option<Self> {
891        critical_section::with(|_| {
892            if unsafe { DEVICE_PERIPHERALS } {
893                return None;
894            }
895            Some(unsafe { Peripherals::steal() })
896        })
897    }
898    #[doc = r" Unchecked version of `Peripherals::take`."]
899    #[doc = r""]
900    #[doc = r" # Safety"]
901    #[doc = r""]
902    #[doc = r" Each of the returned peripherals must be used at most once."]
903    #[inline]
904    pub unsafe fn steal() -> Self {
905        DEVICE_PERIPHERALS = true;
906        Peripherals {
907            SPI: SPI {
908                _marker: PhantomData,
909            },
910            TC0: TC0 {
911                _marker: PhantomData,
912            },
913            TWI0: TWI0 {
914                _marker: PhantomData,
915            },
916            TWI1: TWI1 {
917                _marker: PhantomData,
918            },
919            PWM: PWM {
920                _marker: PhantomData,
921            },
922            USART0: USART0 {
923                _marker: PhantomData,
924            },
925            ADC: ADC {
926                _marker: PhantomData,
927            },
928            TWI2: TWI2 {
929                _marker: PhantomData,
930            },
931            UART2: UART2 {
932                _marker: PhantomData,
933            },
934            UART3: UART3 {
935                _marker: PhantomData,
936            },
937            MATRIX: MATRIX {
938                _marker: PhantomData,
939            },
940            PMC: PMC {
941                _marker: PhantomData,
942            },
943            UART0: UART0 {
944                _marker: PhantomData,
945            },
946            CHIPID: CHIPID {
947                _marker: PhantomData,
948            },
949            UART1: UART1 {
950                _marker: PhantomData,
951            },
952            EFC: EFC {
953                _marker: PhantomData,
954            },
955            PIOA: PIOA {
956                _marker: PhantomData,
957            },
958            PIOB: PIOB {
959                _marker: PhantomData,
960            },
961            RSTC: RSTC {
962                _marker: PhantomData,
963            },
964            SUPC: SUPC {
965                _marker: PhantomData,
966            },
967            RTT: RTT {
968                _marker: PhantomData,
969            },
970            WDT: WDT {
971                _marker: PhantomData,
972            },
973            RTC: RTC {
974                _marker: PhantomData,
975            },
976            GPBR: GPBR {
977                _marker: PhantomData,
978            },
979        }
980    }
981}