1#![doc = "Peripheral access API for ATSAMD21E18A microcontrollers (generated using svd2rust v0.17.0 (2bbb605 2020-05-16))\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.17.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#![deny(const_err)]
4#![deny(dead_code)]
5#![deny(improper_ctypes)]
6#![deny(missing_docs)]
7#![deny(no_mangle_generic_items)]
8#![deny(non_shorthand_field_patterns)]
9#![deny(overflowing_literals)]
10#![deny(path_statements)]
11#![deny(patterns_in_fns_without_body)]
12#![deny(private_in_public)]
13#![deny(unconditional_recursion)]
14#![deny(unused_allocation)]
15#![deny(unused_comparisons)]
16#![deny(unused_parens)]
17#![deny(while_true)]
18#![allow(non_camel_case_types)]
19#![allow(non_snake_case)]
20#![no_std]
21extern crate bare_metal;
22extern crate cortex_m;
23#[cfg(feature = "rt")]
24extern crate cortex_m_rt;
25extern crate vcell;
26use core::marker::PhantomData;
27use core::ops::Deref;
28#[doc = r"Number available in the NVIC for configuring priority"]
29pub const NVIC_PRIO_BITS: u8 = 2;
30#[cfg(feature = "rt")]
31extern "C" {
32 fn PM();
33 fn SYSCTRL();
34 fn WDT();
35 fn RTC();
36 fn EIC();
37 fn NVMCTRL();
38 fn DMAC();
39 fn USB();
40 fn EVSYS();
41 fn SERCOM0();
42 fn SERCOM1();
43 fn SERCOM2();
44 fn SERCOM3();
45 fn TCC0();
46 fn TCC1();
47 fn TCC2();
48 fn TC3();
49 fn TC4();
50 fn TC5();
51 fn ADC();
52 fn AC();
53 fn DAC();
54 fn I2S();
55}
56#[doc(hidden)]
57pub union Vector {
58 _handler: unsafe extern "C" fn(),
59 _reserved: u32,
60}
61#[cfg(feature = "rt")]
62#[doc(hidden)]
63#[link_section = ".vector_table.interrupts"]
64#[no_mangle]
65pub static __INTERRUPTS: [Vector; 28] = [
66 Vector { _handler: PM },
67 Vector { _handler: SYSCTRL },
68 Vector { _handler: WDT },
69 Vector { _handler: RTC },
70 Vector { _handler: EIC },
71 Vector { _handler: NVMCTRL },
72 Vector { _handler: DMAC },
73 Vector { _handler: USB },
74 Vector { _handler: EVSYS },
75 Vector { _handler: SERCOM0 },
76 Vector { _handler: SERCOM1 },
77 Vector { _handler: SERCOM2 },
78 Vector { _handler: SERCOM3 },
79 Vector { _reserved: 0 },
80 Vector { _reserved: 0 },
81 Vector { _handler: TCC0 },
82 Vector { _handler: TCC1 },
83 Vector { _handler: TCC2 },
84 Vector { _handler: TC3 },
85 Vector { _handler: TC4 },
86 Vector { _handler: TC5 },
87 Vector { _reserved: 0 },
88 Vector { _reserved: 0 },
89 Vector { _handler: ADC },
90 Vector { _handler: AC },
91 Vector { _handler: DAC },
92 Vector { _reserved: 0 },
93 Vector { _handler: I2S },
94];
95#[doc = r"Enumeration of all the interrupts"]
96#[derive(Copy, Clone, Debug)]
97#[repr(u8)]
98pub enum Interrupt {
99 #[doc = "0 - PM"]
100 PM = 0,
101 #[doc = "1 - SYSCTRL"]
102 SYSCTRL = 1,
103 #[doc = "2 - WDT"]
104 WDT = 2,
105 #[doc = "3 - RTC"]
106 RTC = 3,
107 #[doc = "4 - EIC"]
108 EIC = 4,
109 #[doc = "5 - NVMCTRL"]
110 NVMCTRL = 5,
111 #[doc = "6 - DMAC"]
112 DMAC = 6,
113 #[doc = "7 - USB"]
114 USB = 7,
115 #[doc = "8 - EVSYS"]
116 EVSYS = 8,
117 #[doc = "9 - SERCOM0"]
118 SERCOM0 = 9,
119 #[doc = "10 - SERCOM1"]
120 SERCOM1 = 10,
121 #[doc = "11 - SERCOM2"]
122 SERCOM2 = 11,
123 #[doc = "12 - SERCOM3"]
124 SERCOM3 = 12,
125 #[doc = "15 - TCC0"]
126 TCC0 = 15,
127 #[doc = "16 - TCC1"]
128 TCC1 = 16,
129 #[doc = "17 - TCC2"]
130 TCC2 = 17,
131 #[doc = "18 - TC3"]
132 TC3 = 18,
133 #[doc = "19 - TC4"]
134 TC4 = 19,
135 #[doc = "20 - TC5"]
136 TC5 = 20,
137 #[doc = "23 - ADC"]
138 ADC = 23,
139 #[doc = "24 - AC"]
140 AC = 24,
141 #[doc = "25 - DAC"]
142 DAC = 25,
143 #[doc = "27 - I2S"]
144 I2S = 27,
145}
146unsafe impl bare_metal::Nr for Interrupt {
147 #[inline(always)]
148 fn nr(&self) -> u8 {
149 *self as u8
150 }
151}
152#[cfg(feature = "rt")]
153pub use self::Interrupt as interrupt;
154pub use cortex_m::peripheral::Peripherals as CorePeripherals;
155pub use cortex_m::peripheral::{CBP, CPUID, DCB, DWT, FPB, ITM, MPU, NVIC, SCB, SYST, TPIU};
156#[cfg(feature = "rt")]
157pub use cortex_m_rt::interrupt;
158#[allow(unused_imports)]
159use generic::*;
160#[doc = r"Common register and bit access and modify traits"]
161pub mod generic;
162#[doc = "Analog Comparators"]
163pub struct AC {
164 _marker: PhantomData<*const ()>,
165}
166unsafe impl Send for AC {}
167impl AC {
168 #[doc = r"Returns a pointer to the register block"]
169 #[inline(always)]
170 pub const fn ptr() -> *const ac::RegisterBlock {
171 0x4200_4400 as *const _
172 }
173}
174impl Deref for AC {
175 type Target = ac::RegisterBlock;
176 #[inline(always)]
177 fn deref(&self) -> &Self::Target {
178 unsafe { &*AC::ptr() }
179 }
180}
181#[doc = "Analog Comparators"]
182pub mod ac;
183#[doc = "Analog Digital Converter"]
184pub struct ADC {
185 _marker: PhantomData<*const ()>,
186}
187unsafe impl Send for ADC {}
188impl ADC {
189 #[doc = r"Returns a pointer to the register block"]
190 #[inline(always)]
191 pub const fn ptr() -> *const adc::RegisterBlock {
192 0x4200_4000 as *const _
193 }
194}
195impl Deref for ADC {
196 type Target = adc::RegisterBlock;
197 #[inline(always)]
198 fn deref(&self) -> &Self::Target {
199 unsafe { &*ADC::ptr() }
200 }
201}
202#[doc = "Analog Digital Converter"]
203pub mod adc;
204#[doc = "Digital Analog Converter"]
205pub struct DAC {
206 _marker: PhantomData<*const ()>,
207}
208unsafe impl Send for DAC {}
209impl DAC {
210 #[doc = r"Returns a pointer to the register block"]
211 #[inline(always)]
212 pub const fn ptr() -> *const dac::RegisterBlock {
213 0x4200_4800 as *const _
214 }
215}
216impl Deref for DAC {
217 type Target = dac::RegisterBlock;
218 #[inline(always)]
219 fn deref(&self) -> &Self::Target {
220 unsafe { &*DAC::ptr() }
221 }
222}
223#[doc = "Digital Analog Converter"]
224pub mod dac;
225#[doc = "Direct Memory Access Controller"]
226pub struct DMAC {
227 _marker: PhantomData<*const ()>,
228}
229unsafe impl Send for DMAC {}
230impl DMAC {
231 #[doc = r"Returns a pointer to the register block"]
232 #[inline(always)]
233 pub const fn ptr() -> *const dmac::RegisterBlock {
234 0x4100_4800 as *const _
235 }
236}
237impl Deref for DMAC {
238 type Target = dmac::RegisterBlock;
239 #[inline(always)]
240 fn deref(&self) -> &Self::Target {
241 unsafe { &*DMAC::ptr() }
242 }
243}
244#[doc = "Direct Memory Access Controller"]
245pub mod dmac;
246#[doc = "Device Service Unit"]
247pub struct DSU {
248 _marker: PhantomData<*const ()>,
249}
250unsafe impl Send for DSU {}
251impl DSU {
252 #[doc = r"Returns a pointer to the register block"]
253 #[inline(always)]
254 pub const fn ptr() -> *const dsu::RegisterBlock {
255 0x4100_2000 as *const _
256 }
257}
258impl Deref for DSU {
259 type Target = dsu::RegisterBlock;
260 #[inline(always)]
261 fn deref(&self) -> &Self::Target {
262 unsafe { &*DSU::ptr() }
263 }
264}
265#[doc = "Device Service Unit"]
266pub mod dsu;
267#[doc = "External Interrupt Controller"]
268pub struct EIC {
269 _marker: PhantomData<*const ()>,
270}
271unsafe impl Send for EIC {}
272impl EIC {
273 #[doc = r"Returns a pointer to the register block"]
274 #[inline(always)]
275 pub const fn ptr() -> *const eic::RegisterBlock {
276 0x4000_1800 as *const _
277 }
278}
279impl Deref for EIC {
280 type Target = eic::RegisterBlock;
281 #[inline(always)]
282 fn deref(&self) -> &Self::Target {
283 unsafe { &*EIC::ptr() }
284 }
285}
286#[doc = "External Interrupt Controller"]
287pub mod eic;
288#[doc = "Event System Interface"]
289pub struct EVSYS {
290 _marker: PhantomData<*const ()>,
291}
292unsafe impl Send for EVSYS {}
293impl EVSYS {
294 #[doc = r"Returns a pointer to the register block"]
295 #[inline(always)]
296 pub const fn ptr() -> *const evsys::RegisterBlock {
297 0x4200_0400 as *const _
298 }
299}
300impl Deref for EVSYS {
301 type Target = evsys::RegisterBlock;
302 #[inline(always)]
303 fn deref(&self) -> &Self::Target {
304 unsafe { &*EVSYS::ptr() }
305 }
306}
307#[doc = "Event System Interface"]
308pub mod evsys;
309#[doc = "Generic Clock Generator"]
310pub struct GCLK {
311 _marker: PhantomData<*const ()>,
312}
313unsafe impl Send for GCLK {}
314impl GCLK {
315 #[doc = r"Returns a pointer to the register block"]
316 #[inline(always)]
317 pub const fn ptr() -> *const gclk::RegisterBlock {
318 0x4000_0c00 as *const _
319 }
320}
321impl Deref for GCLK {
322 type Target = gclk::RegisterBlock;
323 #[inline(always)]
324 fn deref(&self) -> &Self::Target {
325 unsafe { &*GCLK::ptr() }
326 }
327}
328#[doc = "Generic Clock Generator"]
329pub mod gclk;
330#[doc = "HSB Matrix"]
331pub struct HMATRIX {
332 _marker: PhantomData<*const ()>,
333}
334unsafe impl Send for HMATRIX {}
335impl HMATRIX {
336 #[doc = r"Returns a pointer to the register block"]
337 #[inline(always)]
338 pub const fn ptr() -> *const hmatrix::RegisterBlock {
339 0x4100_7000 as *const _
340 }
341}
342impl Deref for HMATRIX {
343 type Target = hmatrix::RegisterBlock;
344 #[inline(always)]
345 fn deref(&self) -> &Self::Target {
346 unsafe { &*HMATRIX::ptr() }
347 }
348}
349#[doc = "HSB Matrix"]
350pub mod hmatrix;
351#[doc = "Inter-IC Sound Interface"]
352pub struct I2S {
353 _marker: PhantomData<*const ()>,
354}
355unsafe impl Send for I2S {}
356impl I2S {
357 #[doc = r"Returns a pointer to the register block"]
358 #[inline(always)]
359 pub const fn ptr() -> *const i2s::RegisterBlock {
360 0x4200_5000 as *const _
361 }
362}
363impl Deref for I2S {
364 type Target = i2s::RegisterBlock;
365 #[inline(always)]
366 fn deref(&self) -> &Self::Target {
367 unsafe { &*I2S::ptr() }
368 }
369}
370#[doc = "Inter-IC Sound Interface"]
371pub mod i2s;
372#[doc = "Cortex-M0+ Micro-Trace Buffer"]
373pub struct MTB {
374 _marker: PhantomData<*const ()>,
375}
376unsafe impl Send for MTB {}
377impl MTB {
378 #[doc = r"Returns a pointer to the register block"]
379 #[inline(always)]
380 pub const fn ptr() -> *const mtb::RegisterBlock {
381 0x4100_6000 as *const _
382 }
383}
384impl Deref for MTB {
385 type Target = mtb::RegisterBlock;
386 #[inline(always)]
387 fn deref(&self) -> &Self::Target {
388 unsafe { &*MTB::ptr() }
389 }
390}
391#[doc = "Cortex-M0+ Micro-Trace Buffer"]
392pub mod mtb;
393#[doc = "Non-Volatile Memory Controller"]
394pub struct NVMCTRL {
395 _marker: PhantomData<*const ()>,
396}
397unsafe impl Send for NVMCTRL {}
398impl NVMCTRL {
399 #[doc = r"Returns a pointer to the register block"]
400 #[inline(always)]
401 pub const fn ptr() -> *const nvmctrl::RegisterBlock {
402 0x4100_4000 as *const _
403 }
404}
405impl Deref for NVMCTRL {
406 type Target = nvmctrl::RegisterBlock;
407 #[inline(always)]
408 fn deref(&self) -> &Self::Target {
409 unsafe { &*NVMCTRL::ptr() }
410 }
411}
412#[doc = "Non-Volatile Memory Controller"]
413pub mod nvmctrl;
414#[doc = "Peripheral Access Controller 0"]
415pub struct PAC0 {
416 _marker: PhantomData<*const ()>,
417}
418unsafe impl Send for PAC0 {}
419impl PAC0 {
420 #[doc = r"Returns a pointer to the register block"]
421 #[inline(always)]
422 pub const fn ptr() -> *const pac0::RegisterBlock {
423 0x4000_0000 as *const _
424 }
425}
426impl Deref for PAC0 {
427 type Target = pac0::RegisterBlock;
428 #[inline(always)]
429 fn deref(&self) -> &Self::Target {
430 unsafe { &*PAC0::ptr() }
431 }
432}
433#[doc = "Peripheral Access Controller 0"]
434pub mod pac0;
435#[doc = "Peripheral Access Controller 1"]
436pub struct PAC1 {
437 _marker: PhantomData<*const ()>,
438}
439unsafe impl Send for PAC1 {}
440impl PAC1 {
441 #[doc = r"Returns a pointer to the register block"]
442 #[inline(always)]
443 pub const fn ptr() -> *const pac0::RegisterBlock {
444 0x4100_0000 as *const _
445 }
446}
447impl Deref for PAC1 {
448 type Target = pac0::RegisterBlock;
449 #[inline(always)]
450 fn deref(&self) -> &Self::Target {
451 unsafe { &*PAC1::ptr() }
452 }
453}
454#[doc = "Peripheral Access Controller 2"]
455pub struct PAC2 {
456 _marker: PhantomData<*const ()>,
457}
458unsafe impl Send for PAC2 {}
459impl PAC2 {
460 #[doc = r"Returns a pointer to the register block"]
461 #[inline(always)]
462 pub const fn ptr() -> *const pac0::RegisterBlock {
463 0x4200_0000 as *const _
464 }
465}
466impl Deref for PAC2 {
467 type Target = pac0::RegisterBlock;
468 #[inline(always)]
469 fn deref(&self) -> &Self::Target {
470 unsafe { &*PAC2::ptr() }
471 }
472}
473#[doc = "Power Manager"]
474pub struct PM {
475 _marker: PhantomData<*const ()>,
476}
477unsafe impl Send for PM {}
478impl PM {
479 #[doc = r"Returns a pointer to the register block"]
480 #[inline(always)]
481 pub const fn ptr() -> *const pm::RegisterBlock {
482 0x4000_0400 as *const _
483 }
484}
485impl Deref for PM {
486 type Target = pm::RegisterBlock;
487 #[inline(always)]
488 fn deref(&self) -> &Self::Target {
489 unsafe { &*PM::ptr() }
490 }
491}
492#[doc = "Power Manager"]
493pub mod pm;
494#[doc = "Port Module"]
495pub struct PORT {
496 _marker: PhantomData<*const ()>,
497}
498unsafe impl Send for PORT {}
499impl PORT {
500 #[doc = r"Returns a pointer to the register block"]
501 #[inline(always)]
502 pub const fn ptr() -> *const port::RegisterBlock {
503 0x4100_4400 as *const _
504 }
505}
506impl Deref for PORT {
507 type Target = port::RegisterBlock;
508 #[inline(always)]
509 fn deref(&self) -> &Self::Target {
510 unsafe { &*PORT::ptr() }
511 }
512}
513#[doc = "Port Module"]
514pub mod port;
515#[doc = "Port Module (IOBUS)"]
516pub struct PORT_IOBUS {
517 _marker: PhantomData<*const ()>,
518}
519unsafe impl Send for PORT_IOBUS {}
520impl PORT_IOBUS {
521 #[doc = r"Returns a pointer to the register block"]
522 #[inline(always)]
523 pub const fn ptr() -> *const port::RegisterBlock {
524 0x6000_0000 as *const _
525 }
526}
527impl Deref for PORT_IOBUS {
528 type Target = port::RegisterBlock;
529 #[inline(always)]
530 fn deref(&self) -> &Self::Target {
531 unsafe { &*PORT_IOBUS::ptr() }
532 }
533}
534#[doc = "Real-Time Counter"]
535pub struct RTC {
536 _marker: PhantomData<*const ()>,
537}
538unsafe impl Send for RTC {}
539impl RTC {
540 #[doc = r"Returns a pointer to the register block"]
541 #[inline(always)]
542 pub const fn ptr() -> *const rtc::RegisterBlock {
543 0x4000_1400 as *const _
544 }
545}
546impl Deref for RTC {
547 type Target = rtc::RegisterBlock;
548 #[inline(always)]
549 fn deref(&self) -> &Self::Target {
550 unsafe { &*RTC::ptr() }
551 }
552}
553#[doc = "Real-Time Counter"]
554pub mod rtc;
555#[doc = "Serial Communication Interface 0"]
556pub struct SERCOM0 {
557 _marker: PhantomData<*const ()>,
558}
559unsafe impl Send for SERCOM0 {}
560impl SERCOM0 {
561 #[doc = r"Returns a pointer to the register block"]
562 #[inline(always)]
563 pub const fn ptr() -> *const sercom0::RegisterBlock {
564 0x4200_0800 as *const _
565 }
566}
567impl Deref for SERCOM0 {
568 type Target = sercom0::RegisterBlock;
569 #[inline(always)]
570 fn deref(&self) -> &Self::Target {
571 unsafe { &*SERCOM0::ptr() }
572 }
573}
574#[doc = "Serial Communication Interface 0"]
575pub mod sercom0;
576#[doc = "Serial Communication Interface 1"]
577pub struct SERCOM1 {
578 _marker: PhantomData<*const ()>,
579}
580unsafe impl Send for SERCOM1 {}
581impl SERCOM1 {
582 #[doc = r"Returns a pointer to the register block"]
583 #[inline(always)]
584 pub const fn ptr() -> *const sercom0::RegisterBlock {
585 0x4200_0c00 as *const _
586 }
587}
588impl Deref for SERCOM1 {
589 type Target = sercom0::RegisterBlock;
590 #[inline(always)]
591 fn deref(&self) -> &Self::Target {
592 unsafe { &*SERCOM1::ptr() }
593 }
594}
595#[doc = "Serial Communication Interface 2"]
596pub struct SERCOM2 {
597 _marker: PhantomData<*const ()>,
598}
599unsafe impl Send for SERCOM2 {}
600impl SERCOM2 {
601 #[doc = r"Returns a pointer to the register block"]
602 #[inline(always)]
603 pub const fn ptr() -> *const sercom0::RegisterBlock {
604 0x4200_1000 as *const _
605 }
606}
607impl Deref for SERCOM2 {
608 type Target = sercom0::RegisterBlock;
609 #[inline(always)]
610 fn deref(&self) -> &Self::Target {
611 unsafe { &*SERCOM2::ptr() }
612 }
613}
614#[doc = "Serial Communication Interface 3"]
615pub struct SERCOM3 {
616 _marker: PhantomData<*const ()>,
617}
618unsafe impl Send for SERCOM3 {}
619impl SERCOM3 {
620 #[doc = r"Returns a pointer to the register block"]
621 #[inline(always)]
622 pub const fn ptr() -> *const sercom0::RegisterBlock {
623 0x4200_1400 as *const _
624 }
625}
626impl Deref for SERCOM3 {
627 type Target = sercom0::RegisterBlock;
628 #[inline(always)]
629 fn deref(&self) -> &Self::Target {
630 unsafe { &*SERCOM3::ptr() }
631 }
632}
633#[doc = "System Control"]
634pub struct SYSCTRL {
635 _marker: PhantomData<*const ()>,
636}
637unsafe impl Send for SYSCTRL {}
638impl SYSCTRL {
639 #[doc = r"Returns a pointer to the register block"]
640 #[inline(always)]
641 pub const fn ptr() -> *const sysctrl::RegisterBlock {
642 0x4000_0800 as *const _
643 }
644}
645impl Deref for SYSCTRL {
646 type Target = sysctrl::RegisterBlock;
647 #[inline(always)]
648 fn deref(&self) -> &Self::Target {
649 unsafe { &*SYSCTRL::ptr() }
650 }
651}
652#[doc = "System Control"]
653pub mod sysctrl;
654#[doc = "Basic Timer Counter 3"]
655pub struct TC3 {
656 _marker: PhantomData<*const ()>,
657}
658unsafe impl Send for TC3 {}
659impl TC3 {
660 #[doc = r"Returns a pointer to the register block"]
661 #[inline(always)]
662 pub const fn ptr() -> *const tc3::RegisterBlock {
663 0x4200_2c00 as *const _
664 }
665}
666impl Deref for TC3 {
667 type Target = tc3::RegisterBlock;
668 #[inline(always)]
669 fn deref(&self) -> &Self::Target {
670 unsafe { &*TC3::ptr() }
671 }
672}
673#[doc = "Basic Timer Counter 3"]
674pub mod tc3;
675#[doc = "Basic Timer Counter 4"]
676pub struct TC4 {
677 _marker: PhantomData<*const ()>,
678}
679unsafe impl Send for TC4 {}
680impl TC4 {
681 #[doc = r"Returns a pointer to the register block"]
682 #[inline(always)]
683 pub const fn ptr() -> *const tc3::RegisterBlock {
684 0x4200_3000 as *const _
685 }
686}
687impl Deref for TC4 {
688 type Target = tc3::RegisterBlock;
689 #[inline(always)]
690 fn deref(&self) -> &Self::Target {
691 unsafe { &*TC4::ptr() }
692 }
693}
694#[doc = "Basic Timer Counter 5"]
695pub struct TC5 {
696 _marker: PhantomData<*const ()>,
697}
698unsafe impl Send for TC5 {}
699impl TC5 {
700 #[doc = r"Returns a pointer to the register block"]
701 #[inline(always)]
702 pub const fn ptr() -> *const tc3::RegisterBlock {
703 0x4200_3400 as *const _
704 }
705}
706impl Deref for TC5 {
707 type Target = tc3::RegisterBlock;
708 #[inline(always)]
709 fn deref(&self) -> &Self::Target {
710 unsafe { &*TC5::ptr() }
711 }
712}
713#[doc = "Timer Counter Control 0"]
714pub struct TCC0 {
715 _marker: PhantomData<*const ()>,
716}
717unsafe impl Send for TCC0 {}
718impl TCC0 {
719 #[doc = r"Returns a pointer to the register block"]
720 #[inline(always)]
721 pub const fn ptr() -> *const tcc0::RegisterBlock {
722 0x4200_2000 as *const _
723 }
724}
725impl Deref for TCC0 {
726 type Target = tcc0::RegisterBlock;
727 #[inline(always)]
728 fn deref(&self) -> &Self::Target {
729 unsafe { &*TCC0::ptr() }
730 }
731}
732#[doc = "Timer Counter Control 0"]
733pub mod tcc0;
734#[doc = "Timer Counter Control 1"]
735pub struct TCC1 {
736 _marker: PhantomData<*const ()>,
737}
738unsafe impl Send for TCC1 {}
739impl TCC1 {
740 #[doc = r"Returns a pointer to the register block"]
741 #[inline(always)]
742 pub const fn ptr() -> *const tcc0::RegisterBlock {
743 0x4200_2400 as *const _
744 }
745}
746impl Deref for TCC1 {
747 type Target = tcc0::RegisterBlock;
748 #[inline(always)]
749 fn deref(&self) -> &Self::Target {
750 unsafe { &*TCC1::ptr() }
751 }
752}
753#[doc = "Timer Counter Control 2"]
754pub struct TCC2 {
755 _marker: PhantomData<*const ()>,
756}
757unsafe impl Send for TCC2 {}
758impl TCC2 {
759 #[doc = r"Returns a pointer to the register block"]
760 #[inline(always)]
761 pub const fn ptr() -> *const tcc0::RegisterBlock {
762 0x4200_2800 as *const _
763 }
764}
765impl Deref for TCC2 {
766 type Target = tcc0::RegisterBlock;
767 #[inline(always)]
768 fn deref(&self) -> &Self::Target {
769 unsafe { &*TCC2::ptr() }
770 }
771}
772#[doc = "Universal Serial Bus"]
773pub struct USB {
774 _marker: PhantomData<*const ()>,
775}
776unsafe impl Send for USB {}
777impl USB {
778 #[doc = r"Returns a pointer to the register block"]
779 #[inline(always)]
780 pub const fn ptr() -> *const usb::RegisterBlock {
781 0x4100_5000 as *const _
782 }
783}
784impl Deref for USB {
785 type Target = usb::RegisterBlock;
786 #[inline(always)]
787 fn deref(&self) -> &Self::Target {
788 unsafe { &*USB::ptr() }
789 }
790}
791#[doc = "Universal Serial Bus"]
792pub mod usb;
793#[doc = "Watchdog Timer"]
794pub struct WDT {
795 _marker: PhantomData<*const ()>,
796}
797unsafe impl Send for WDT {}
798impl WDT {
799 #[doc = r"Returns a pointer to the register block"]
800 #[inline(always)]
801 pub const fn ptr() -> *const wdt::RegisterBlock {
802 0x4000_1000 as *const _
803 }
804}
805impl Deref for WDT {
806 type Target = wdt::RegisterBlock;
807 #[inline(always)]
808 fn deref(&self) -> &Self::Target {
809 unsafe { &*WDT::ptr() }
810 }
811}
812#[doc = "Watchdog Timer"]
813pub mod wdt;
814#[no_mangle]
815static mut DEVICE_PERIPHERALS: bool = false;
816#[doc = r"All the peripherals"]
817#[allow(non_snake_case)]
818pub struct Peripherals {
819 #[doc = "AC"]
820 pub AC: AC,
821 #[doc = "ADC"]
822 pub ADC: ADC,
823 #[doc = "DAC"]
824 pub DAC: DAC,
825 #[doc = "DMAC"]
826 pub DMAC: DMAC,
827 #[doc = "DSU"]
828 pub DSU: DSU,
829 #[doc = "EIC"]
830 pub EIC: EIC,
831 #[doc = "EVSYS"]
832 pub EVSYS: EVSYS,
833 #[doc = "GCLK"]
834 pub GCLK: GCLK,
835 #[doc = "HMATRIX"]
836 pub HMATRIX: HMATRIX,
837 #[doc = "I2S"]
838 pub I2S: I2S,
839 #[doc = "MTB"]
840 pub MTB: MTB,
841 #[doc = "NVMCTRL"]
842 pub NVMCTRL: NVMCTRL,
843 #[doc = "PAC0"]
844 pub PAC0: PAC0,
845 #[doc = "PAC1"]
846 pub PAC1: PAC1,
847 #[doc = "PAC2"]
848 pub PAC2: PAC2,
849 #[doc = "PM"]
850 pub PM: PM,
851 #[doc = "PORT"]
852 pub PORT: PORT,
853 #[doc = "PORT_IOBUS"]
854 pub PORT_IOBUS: PORT_IOBUS,
855 #[doc = "RTC"]
856 pub RTC: RTC,
857 #[doc = "SERCOM0"]
858 pub SERCOM0: SERCOM0,
859 #[doc = "SERCOM1"]
860 pub SERCOM1: SERCOM1,
861 #[doc = "SERCOM2"]
862 pub SERCOM2: SERCOM2,
863 #[doc = "SERCOM3"]
864 pub SERCOM3: SERCOM3,
865 #[doc = "SYSCTRL"]
866 pub SYSCTRL: SYSCTRL,
867 #[doc = "TC3"]
868 pub TC3: TC3,
869 #[doc = "TC4"]
870 pub TC4: TC4,
871 #[doc = "TC5"]
872 pub TC5: TC5,
873 #[doc = "TCC0"]
874 pub TCC0: TCC0,
875 #[doc = "TCC1"]
876 pub TCC1: TCC1,
877 #[doc = "TCC2"]
878 pub TCC2: TCC2,
879 #[doc = "USB"]
880 pub USB: USB,
881 #[doc = "WDT"]
882 pub WDT: WDT,
883}
884impl Peripherals {
885 #[doc = r"Returns all the peripherals *once*"]
886 #[inline]
887 pub fn take() -> Option<Self> {
888 cortex_m::interrupt::free(|_| {
889 if unsafe { DEVICE_PERIPHERALS } {
890 None
891 } else {
892 Some(unsafe { Peripherals::steal() })
893 }
894 })
895 }
896 #[doc = r"Unchecked version of `Peripherals::take`"]
897 #[inline]
898 pub unsafe fn steal() -> Self {
899 DEVICE_PERIPHERALS = true;
900 Peripherals {
901 AC: AC {
902 _marker: PhantomData,
903 },
904 ADC: ADC {
905 _marker: PhantomData,
906 },
907 DAC: DAC {
908 _marker: PhantomData,
909 },
910 DMAC: DMAC {
911 _marker: PhantomData,
912 },
913 DSU: DSU {
914 _marker: PhantomData,
915 },
916 EIC: EIC {
917 _marker: PhantomData,
918 },
919 EVSYS: EVSYS {
920 _marker: PhantomData,
921 },
922 GCLK: GCLK {
923 _marker: PhantomData,
924 },
925 HMATRIX: HMATRIX {
926 _marker: PhantomData,
927 },
928 I2S: I2S {
929 _marker: PhantomData,
930 },
931 MTB: MTB {
932 _marker: PhantomData,
933 },
934 NVMCTRL: NVMCTRL {
935 _marker: PhantomData,
936 },
937 PAC0: PAC0 {
938 _marker: PhantomData,
939 },
940 PAC1: PAC1 {
941 _marker: PhantomData,
942 },
943 PAC2: PAC2 {
944 _marker: PhantomData,
945 },
946 PM: PM {
947 _marker: PhantomData,
948 },
949 PORT: PORT {
950 _marker: PhantomData,
951 },
952 PORT_IOBUS: PORT_IOBUS {
953 _marker: PhantomData,
954 },
955 RTC: RTC {
956 _marker: PhantomData,
957 },
958 SERCOM0: SERCOM0 {
959 _marker: PhantomData,
960 },
961 SERCOM1: SERCOM1 {
962 _marker: PhantomData,
963 },
964 SERCOM2: SERCOM2 {
965 _marker: PhantomData,
966 },
967 SERCOM3: SERCOM3 {
968 _marker: PhantomData,
969 },
970 SYSCTRL: SYSCTRL {
971 _marker: PhantomData,
972 },
973 TC3: TC3 {
974 _marker: PhantomData,
975 },
976 TC4: TC4 {
977 _marker: PhantomData,
978 },
979 TC5: TC5 {
980 _marker: PhantomData,
981 },
982 TCC0: TCC0 {
983 _marker: PhantomData,
984 },
985 TCC1: TCC1 {
986 _marker: PhantomData,
987 },
988 TCC2: TCC2 {
989 _marker: PhantomData,
990 },
991 USB: USB {
992 _marker: PhantomData,
993 },
994 WDT: WDT {
995 _marker: PhantomData,
996 },
997 }
998 }
999}