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