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