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