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