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