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