atsam4s2a_pac/
lib.rs

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