1#![doc = "Peripheral access API for EFM32HG308F32 microcontrollers (generated using svd2rust v0.24.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.24.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]
21use core::marker::PhantomData;
22use core::ops::Deref;
23#[doc = r"Number available in the NVIC for configuring priority"]
24pub const NVIC_PRIO_BITS: u8 = 3;
25#[cfg(feature = "rt")]
26pub use self::Interrupt as interrupt;
27pub use cortex_m::peripheral::Peripherals as CorePeripherals;
28pub use cortex_m::peripheral::{CBP, CPUID, DCB, DWT, FPB, ITM, MPU, NVIC, SCB, SYST, TPIU};
29#[cfg(feature = "rt")]
30pub use cortex_m_rt::interrupt;
31#[allow(unused_imports)]
32use generic::*;
33#[doc = r"Common register and bit access and modify traits"]
34pub mod generic;
35#[cfg(feature = "rt")]
36extern "C" {
37 fn DMA();
38 fn GPIO_EVEN();
39 fn TIMER0();
40 fn ACMP0();
41 fn I2C0();
42 fn GPIO_ODD();
43 fn TIMER1();
44 fn USART1_RX();
45 fn USART1_TX();
46 fn LEUART0();
47 fn PCNT0();
48 fn RTC();
49 fn CMU();
50 fn VCMP();
51 fn MSC();
52 fn USART0_RX();
53 fn USART0_TX();
54 fn USB();
55 fn TIMER2();
56}
57#[doc(hidden)]
58pub union Vector {
59 _handler: unsafe extern "C" fn(),
60 _reserved: u32,
61}
62#[cfg(feature = "rt")]
63#[doc(hidden)]
64#[link_section = ".vector_table.interrupts"]
65#[no_mangle]
66pub static __INTERRUPTS: [Vector; 21] = [
67 Vector { _handler: DMA },
68 Vector {
69 _handler: GPIO_EVEN,
70 },
71 Vector { _handler: TIMER0 },
72 Vector { _handler: ACMP0 },
73 Vector { _reserved: 0 },
74 Vector { _handler: I2C0 },
75 Vector { _handler: GPIO_ODD },
76 Vector { _handler: TIMER1 },
77 Vector {
78 _handler: USART1_RX,
79 },
80 Vector {
81 _handler: USART1_TX,
82 },
83 Vector { _handler: LEUART0 },
84 Vector { _handler: PCNT0 },
85 Vector { _handler: RTC },
86 Vector { _handler: CMU },
87 Vector { _handler: VCMP },
88 Vector { _handler: MSC },
89 Vector { _reserved: 0 },
90 Vector {
91 _handler: USART0_RX,
92 },
93 Vector {
94 _handler: USART0_TX,
95 },
96 Vector { _handler: USB },
97 Vector { _handler: TIMER2 },
98];
99#[doc = r"Enumeration of all the interrupts."]
100#[derive(Copy, Clone, Debug, PartialEq, Eq)]
101#[repr(u16)]
102pub enum Interrupt {
103 #[doc = "0 - DMA"]
104 DMA = 0,
105 #[doc = "1 - GPIO_EVEN"]
106 GPIO_EVEN = 1,
107 #[doc = "2 - TIMER0"]
108 TIMER0 = 2,
109 #[doc = "3 - ACMP0"]
110 ACMP0 = 3,
111 #[doc = "5 - I2C0"]
112 I2C0 = 5,
113 #[doc = "6 - GPIO_ODD"]
114 GPIO_ODD = 6,
115 #[doc = "7 - TIMER1"]
116 TIMER1 = 7,
117 #[doc = "8 - USART1_RX"]
118 USART1_RX = 8,
119 #[doc = "9 - USART1_TX"]
120 USART1_TX = 9,
121 #[doc = "10 - LEUART0"]
122 LEUART0 = 10,
123 #[doc = "11 - PCNT0"]
124 PCNT0 = 11,
125 #[doc = "12 - RTC"]
126 RTC = 12,
127 #[doc = "13 - CMU"]
128 CMU = 13,
129 #[doc = "14 - VCMP"]
130 VCMP = 14,
131 #[doc = "15 - MSC"]
132 MSC = 15,
133 #[doc = "17 - USART0_RX"]
134 USART0_RX = 17,
135 #[doc = "18 - USART0_TX"]
136 USART0_TX = 18,
137 #[doc = "19 - USB"]
138 USB = 19,
139 #[doc = "20 - TIMER2"]
140 TIMER2 = 20,
141}
142unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
143 #[inline(always)]
144 fn number(self) -> u16 {
145 self as u16
146 }
147}
148#[doc = "DMA"]
149pub struct DMA {
150 _marker: PhantomData<*const ()>,
151}
152unsafe impl Send for DMA {}
153impl DMA {
154 #[doc = r"Pointer to the register block"]
155 pub const PTR: *const dma::RegisterBlock = 0x400c_2000 as *const _;
156 #[doc = r"Return the pointer to the register block"]
157 #[inline(always)]
158 pub const fn ptr() -> *const dma::RegisterBlock {
159 Self::PTR
160 }
161}
162impl Deref for DMA {
163 type Target = dma::RegisterBlock;
164 #[inline(always)]
165 fn deref(&self) -> &Self::Target {
166 unsafe { &*Self::PTR }
167 }
168}
169impl core::fmt::Debug for DMA {
170 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
171 f.debug_struct("DMA").finish()
172 }
173}
174#[doc = "DMA"]
175pub mod dma;
176#[doc = "USB"]
177pub struct USB {
178 _marker: PhantomData<*const ()>,
179}
180unsafe impl Send for USB {}
181impl USB {
182 #[doc = r"Pointer to the register block"]
183 pub const PTR: *const usb::RegisterBlock = 0x400c_4000 as *const _;
184 #[doc = r"Return the pointer to the register block"]
185 #[inline(always)]
186 pub const fn ptr() -> *const usb::RegisterBlock {
187 Self::PTR
188 }
189}
190impl Deref for USB {
191 type Target = usb::RegisterBlock;
192 #[inline(always)]
193 fn deref(&self) -> &Self::Target {
194 unsafe { &*Self::PTR }
195 }
196}
197impl core::fmt::Debug for USB {
198 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
199 f.debug_struct("USB").finish()
200 }
201}
202#[doc = "USB"]
203pub mod usb;
204#[doc = "MSC"]
205pub struct MSC {
206 _marker: PhantomData<*const ()>,
207}
208unsafe impl Send for MSC {}
209impl MSC {
210 #[doc = r"Pointer to the register block"]
211 pub const PTR: *const msc::RegisterBlock = 0x400c_0000 as *const _;
212 #[doc = r"Return the pointer to the register block"]
213 #[inline(always)]
214 pub const fn ptr() -> *const msc::RegisterBlock {
215 Self::PTR
216 }
217}
218impl Deref for MSC {
219 type Target = msc::RegisterBlock;
220 #[inline(always)]
221 fn deref(&self) -> &Self::Target {
222 unsafe { &*Self::PTR }
223 }
224}
225impl core::fmt::Debug for MSC {
226 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
227 f.debug_struct("MSC").finish()
228 }
229}
230#[doc = "MSC"]
231pub mod msc;
232#[doc = "EMU"]
233pub struct EMU {
234 _marker: PhantomData<*const ()>,
235}
236unsafe impl Send for EMU {}
237impl EMU {
238 #[doc = r"Pointer to the register block"]
239 pub const PTR: *const emu::RegisterBlock = 0x400c_6000 as *const _;
240 #[doc = r"Return the pointer to the register block"]
241 #[inline(always)]
242 pub const fn ptr() -> *const emu::RegisterBlock {
243 Self::PTR
244 }
245}
246impl Deref for EMU {
247 type Target = emu::RegisterBlock;
248 #[inline(always)]
249 fn deref(&self) -> &Self::Target {
250 unsafe { &*Self::PTR }
251 }
252}
253impl core::fmt::Debug for EMU {
254 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
255 f.debug_struct("EMU").finish()
256 }
257}
258#[doc = "EMU"]
259pub mod emu;
260#[doc = "RMU"]
261pub struct RMU {
262 _marker: PhantomData<*const ()>,
263}
264unsafe impl Send for RMU {}
265impl RMU {
266 #[doc = r"Pointer to the register block"]
267 pub const PTR: *const rmu::RegisterBlock = 0x400c_a000 as *const _;
268 #[doc = r"Return the pointer to the register block"]
269 #[inline(always)]
270 pub const fn ptr() -> *const rmu::RegisterBlock {
271 Self::PTR
272 }
273}
274impl Deref for RMU {
275 type Target = rmu::RegisterBlock;
276 #[inline(always)]
277 fn deref(&self) -> &Self::Target {
278 unsafe { &*Self::PTR }
279 }
280}
281impl core::fmt::Debug for RMU {
282 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
283 f.debug_struct("RMU").finish()
284 }
285}
286#[doc = "RMU"]
287pub mod rmu;
288#[doc = "CMU"]
289pub struct CMU {
290 _marker: PhantomData<*const ()>,
291}
292unsafe impl Send for CMU {}
293impl CMU {
294 #[doc = r"Pointer to the register block"]
295 pub const PTR: *const cmu::RegisterBlock = 0x400c_8000 as *const _;
296 #[doc = r"Return the pointer to the register block"]
297 #[inline(always)]
298 pub const fn ptr() -> *const cmu::RegisterBlock {
299 Self::PTR
300 }
301}
302impl Deref for CMU {
303 type Target = cmu::RegisterBlock;
304 #[inline(always)]
305 fn deref(&self) -> &Self::Target {
306 unsafe { &*Self::PTR }
307 }
308}
309impl core::fmt::Debug for CMU {
310 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
311 f.debug_struct("CMU").finish()
312 }
313}
314#[doc = "CMU"]
315pub mod cmu;
316#[doc = "TIMER0"]
317pub struct TIMER0 {
318 _marker: PhantomData<*const ()>,
319}
320unsafe impl Send for TIMER0 {}
321impl TIMER0 {
322 #[doc = r"Pointer to the register block"]
323 pub const PTR: *const timer0::RegisterBlock = 0x4001_0000 as *const _;
324 #[doc = r"Return the pointer to the register block"]
325 #[inline(always)]
326 pub const fn ptr() -> *const timer0::RegisterBlock {
327 Self::PTR
328 }
329}
330impl Deref for TIMER0 {
331 type Target = timer0::RegisterBlock;
332 #[inline(always)]
333 fn deref(&self) -> &Self::Target {
334 unsafe { &*Self::PTR }
335 }
336}
337impl core::fmt::Debug for TIMER0 {
338 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
339 f.debug_struct("TIMER0").finish()
340 }
341}
342#[doc = "TIMER0"]
343pub mod timer0;
344#[doc = "TIMER1"]
345pub struct TIMER1 {
346 _marker: PhantomData<*const ()>,
347}
348unsafe impl Send for TIMER1 {}
349impl TIMER1 {
350 #[doc = r"Pointer to the register block"]
351 pub const PTR: *const timer1::RegisterBlock = 0x4001_0400 as *const _;
352 #[doc = r"Return the pointer to the register block"]
353 #[inline(always)]
354 pub const fn ptr() -> *const timer1::RegisterBlock {
355 Self::PTR
356 }
357}
358impl Deref for TIMER1 {
359 type Target = timer1::RegisterBlock;
360 #[inline(always)]
361 fn deref(&self) -> &Self::Target {
362 unsafe { &*Self::PTR }
363 }
364}
365impl core::fmt::Debug for TIMER1 {
366 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
367 f.debug_struct("TIMER1").finish()
368 }
369}
370#[doc = "TIMER1"]
371pub mod timer1;
372#[doc = "TIMER2"]
373pub struct TIMER2 {
374 _marker: PhantomData<*const ()>,
375}
376unsafe impl Send for TIMER2 {}
377impl TIMER2 {
378 #[doc = r"Pointer to the register block"]
379 pub const PTR: *const timer2::RegisterBlock = 0x4001_0800 as *const _;
380 #[doc = r"Return the pointer to the register block"]
381 #[inline(always)]
382 pub const fn ptr() -> *const timer2::RegisterBlock {
383 Self::PTR
384 }
385}
386impl Deref for TIMER2 {
387 type Target = timer2::RegisterBlock;
388 #[inline(always)]
389 fn deref(&self) -> &Self::Target {
390 unsafe { &*Self::PTR }
391 }
392}
393impl core::fmt::Debug for TIMER2 {
394 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
395 f.debug_struct("TIMER2").finish()
396 }
397}
398#[doc = "TIMER2"]
399pub mod timer2;
400#[doc = "ACMP0"]
401pub struct ACMP0 {
402 _marker: PhantomData<*const ()>,
403}
404unsafe impl Send for ACMP0 {}
405impl ACMP0 {
406 #[doc = r"Pointer to the register block"]
407 pub const PTR: *const acmp0::RegisterBlock = 0x4000_1000 as *const _;
408 #[doc = r"Return the pointer to the register block"]
409 #[inline(always)]
410 pub const fn ptr() -> *const acmp0::RegisterBlock {
411 Self::PTR
412 }
413}
414impl Deref for ACMP0 {
415 type Target = acmp0::RegisterBlock;
416 #[inline(always)]
417 fn deref(&self) -> &Self::Target {
418 unsafe { &*Self::PTR }
419 }
420}
421impl core::fmt::Debug for ACMP0 {
422 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
423 f.debug_struct("ACMP0").finish()
424 }
425}
426#[doc = "ACMP0"]
427pub mod acmp0;
428#[doc = "USART0"]
429pub struct USART0 {
430 _marker: PhantomData<*const ()>,
431}
432unsafe impl Send for USART0 {}
433impl USART0 {
434 #[doc = r"Pointer to the register block"]
435 pub const PTR: *const usart0::RegisterBlock = 0x4000_c000 as *const _;
436 #[doc = r"Return the pointer to the register block"]
437 #[inline(always)]
438 pub const fn ptr() -> *const usart0::RegisterBlock {
439 Self::PTR
440 }
441}
442impl Deref for USART0 {
443 type Target = usart0::RegisterBlock;
444 #[inline(always)]
445 fn deref(&self) -> &Self::Target {
446 unsafe { &*Self::PTR }
447 }
448}
449impl core::fmt::Debug for USART0 {
450 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
451 f.debug_struct("USART0").finish()
452 }
453}
454#[doc = "USART0"]
455pub mod usart0;
456#[doc = "USART1"]
457pub struct USART1 {
458 _marker: PhantomData<*const ()>,
459}
460unsafe impl Send for USART1 {}
461impl USART1 {
462 #[doc = r"Pointer to the register block"]
463 pub const PTR: *const usart1::RegisterBlock = 0x4000_c400 as *const _;
464 #[doc = r"Return the pointer to the register block"]
465 #[inline(always)]
466 pub const fn ptr() -> *const usart1::RegisterBlock {
467 Self::PTR
468 }
469}
470impl Deref for USART1 {
471 type Target = usart1::RegisterBlock;
472 #[inline(always)]
473 fn deref(&self) -> &Self::Target {
474 unsafe { &*Self::PTR }
475 }
476}
477impl core::fmt::Debug for USART1 {
478 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
479 f.debug_struct("USART1").finish()
480 }
481}
482#[doc = "USART1"]
483pub mod usart1;
484#[doc = "PRS"]
485pub struct PRS {
486 _marker: PhantomData<*const ()>,
487}
488unsafe impl Send for PRS {}
489impl PRS {
490 #[doc = r"Pointer to the register block"]
491 pub const PTR: *const prs::RegisterBlock = 0x400c_c000 as *const _;
492 #[doc = r"Return the pointer to the register block"]
493 #[inline(always)]
494 pub const fn ptr() -> *const prs::RegisterBlock {
495 Self::PTR
496 }
497}
498impl Deref for PRS {
499 type Target = prs::RegisterBlock;
500 #[inline(always)]
501 fn deref(&self) -> &Self::Target {
502 unsafe { &*Self::PTR }
503 }
504}
505impl core::fmt::Debug for PRS {
506 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
507 f.debug_struct("PRS").finish()
508 }
509}
510#[doc = "PRS"]
511pub mod prs;
512#[doc = "GPIO"]
513pub struct GPIO {
514 _marker: PhantomData<*const ()>,
515}
516unsafe impl Send for GPIO {}
517impl GPIO {
518 #[doc = r"Pointer to the register block"]
519 pub const PTR: *const gpio::RegisterBlock = 0x4000_6000 as *const _;
520 #[doc = r"Return the pointer to the register block"]
521 #[inline(always)]
522 pub const fn ptr() -> *const gpio::RegisterBlock {
523 Self::PTR
524 }
525}
526impl Deref for GPIO {
527 type Target = gpio::RegisterBlock;
528 #[inline(always)]
529 fn deref(&self) -> &Self::Target {
530 unsafe { &*Self::PTR }
531 }
532}
533impl core::fmt::Debug for GPIO {
534 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
535 f.debug_struct("GPIO").finish()
536 }
537}
538#[doc = "GPIO"]
539pub mod gpio;
540#[doc = "VCMP"]
541pub struct VCMP {
542 _marker: PhantomData<*const ()>,
543}
544unsafe impl Send for VCMP {}
545impl VCMP {
546 #[doc = r"Pointer to the register block"]
547 pub const PTR: *const vcmp::RegisterBlock = 0x4000_0000 as *const _;
548 #[doc = r"Return the pointer to the register block"]
549 #[inline(always)]
550 pub const fn ptr() -> *const vcmp::RegisterBlock {
551 Self::PTR
552 }
553}
554impl Deref for VCMP {
555 type Target = vcmp::RegisterBlock;
556 #[inline(always)]
557 fn deref(&self) -> &Self::Target {
558 unsafe { &*Self::PTR }
559 }
560}
561impl core::fmt::Debug for VCMP {
562 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
563 f.debug_struct("VCMP").finish()
564 }
565}
566#[doc = "VCMP"]
567pub mod vcmp;
568#[doc = "LEUART0"]
569pub struct LEUART0 {
570 _marker: PhantomData<*const ()>,
571}
572unsafe impl Send for LEUART0 {}
573impl LEUART0 {
574 #[doc = r"Pointer to the register block"]
575 pub const PTR: *const leuart0::RegisterBlock = 0x4008_4000 as *const _;
576 #[doc = r"Return the pointer to the register block"]
577 #[inline(always)]
578 pub const fn ptr() -> *const leuart0::RegisterBlock {
579 Self::PTR
580 }
581}
582impl Deref for LEUART0 {
583 type Target = leuart0::RegisterBlock;
584 #[inline(always)]
585 fn deref(&self) -> &Self::Target {
586 unsafe { &*Self::PTR }
587 }
588}
589impl core::fmt::Debug for LEUART0 {
590 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
591 f.debug_struct("LEUART0").finish()
592 }
593}
594#[doc = "LEUART0"]
595pub mod leuart0;
596#[doc = "PCNT0"]
597pub struct PCNT0 {
598 _marker: PhantomData<*const ()>,
599}
600unsafe impl Send for PCNT0 {}
601impl PCNT0 {
602 #[doc = r"Pointer to the register block"]
603 pub const PTR: *const pcnt0::RegisterBlock = 0x4008_6000 as *const _;
604 #[doc = r"Return the pointer to the register block"]
605 #[inline(always)]
606 pub const fn ptr() -> *const pcnt0::RegisterBlock {
607 Self::PTR
608 }
609}
610impl Deref for PCNT0 {
611 type Target = pcnt0::RegisterBlock;
612 #[inline(always)]
613 fn deref(&self) -> &Self::Target {
614 unsafe { &*Self::PTR }
615 }
616}
617impl core::fmt::Debug for PCNT0 {
618 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
619 f.debug_struct("PCNT0").finish()
620 }
621}
622#[doc = "PCNT0"]
623pub mod pcnt0;
624#[doc = "I2C0"]
625pub struct I2C0 {
626 _marker: PhantomData<*const ()>,
627}
628unsafe impl Send for I2C0 {}
629impl I2C0 {
630 #[doc = r"Pointer to the register block"]
631 pub const PTR: *const i2c0::RegisterBlock = 0x4000_a000 as *const _;
632 #[doc = r"Return the pointer to the register block"]
633 #[inline(always)]
634 pub const fn ptr() -> *const i2c0::RegisterBlock {
635 Self::PTR
636 }
637}
638impl Deref for I2C0 {
639 type Target = i2c0::RegisterBlock;
640 #[inline(always)]
641 fn deref(&self) -> &Self::Target {
642 unsafe { &*Self::PTR }
643 }
644}
645impl core::fmt::Debug for I2C0 {
646 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
647 f.debug_struct("I2C0").finish()
648 }
649}
650#[doc = "I2C0"]
651pub mod i2c0;
652#[doc = "RTC"]
653pub struct RTC {
654 _marker: PhantomData<*const ()>,
655}
656unsafe impl Send for RTC {}
657impl RTC {
658 #[doc = r"Pointer to the register block"]
659 pub const PTR: *const rtc::RegisterBlock = 0x4008_0000 as *const _;
660 #[doc = r"Return the pointer to the register block"]
661 #[inline(always)]
662 pub const fn ptr() -> *const rtc::RegisterBlock {
663 Self::PTR
664 }
665}
666impl Deref for RTC {
667 type Target = rtc::RegisterBlock;
668 #[inline(always)]
669 fn deref(&self) -> &Self::Target {
670 unsafe { &*Self::PTR }
671 }
672}
673impl core::fmt::Debug for RTC {
674 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
675 f.debug_struct("RTC").finish()
676 }
677}
678#[doc = "RTC"]
679pub mod rtc;
680#[doc = "WDOG"]
681pub struct WDOG {
682 _marker: PhantomData<*const ()>,
683}
684unsafe impl Send for WDOG {}
685impl WDOG {
686 #[doc = r"Pointer to the register block"]
687 pub const PTR: *const wdog::RegisterBlock = 0x4008_8000 as *const _;
688 #[doc = r"Return the pointer to the register block"]
689 #[inline(always)]
690 pub const fn ptr() -> *const wdog::RegisterBlock {
691 Self::PTR
692 }
693}
694impl Deref for WDOG {
695 type Target = wdog::RegisterBlock;
696 #[inline(always)]
697 fn deref(&self) -> &Self::Target {
698 unsafe { &*Self::PTR }
699 }
700}
701impl core::fmt::Debug for WDOG {
702 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
703 f.debug_struct("WDOG").finish()
704 }
705}
706#[doc = "WDOG"]
707pub mod wdog;
708#[doc = "MTB"]
709pub struct MTB {
710 _marker: PhantomData<*const ()>,
711}
712unsafe impl Send for MTB {}
713impl MTB {
714 #[doc = r"Pointer to the register block"]
715 pub const PTR: *const mtb::RegisterBlock = 0xf004_0000 as *const _;
716 #[doc = r"Return the pointer to the register block"]
717 #[inline(always)]
718 pub const fn ptr() -> *const mtb::RegisterBlock {
719 Self::PTR
720 }
721}
722impl Deref for MTB {
723 type Target = mtb::RegisterBlock;
724 #[inline(always)]
725 fn deref(&self) -> &Self::Target {
726 unsafe { &*Self::PTR }
727 }
728}
729impl core::fmt::Debug for MTB {
730 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
731 f.debug_struct("MTB").finish()
732 }
733}
734#[doc = "MTB"]
735pub mod mtb;
736#[no_mangle]
737static mut DEVICE_PERIPHERALS: bool = false;
738#[doc = r"All the peripherals"]
739#[allow(non_snake_case)]
740pub struct Peripherals {
741 #[doc = "DMA"]
742 pub DMA: DMA,
743 #[doc = "USB"]
744 pub USB: USB,
745 #[doc = "MSC"]
746 pub MSC: MSC,
747 #[doc = "EMU"]
748 pub EMU: EMU,
749 #[doc = "RMU"]
750 pub RMU: RMU,
751 #[doc = "CMU"]
752 pub CMU: CMU,
753 #[doc = "TIMER0"]
754 pub TIMER0: TIMER0,
755 #[doc = "TIMER1"]
756 pub TIMER1: TIMER1,
757 #[doc = "TIMER2"]
758 pub TIMER2: TIMER2,
759 #[doc = "ACMP0"]
760 pub ACMP0: ACMP0,
761 #[doc = "USART0"]
762 pub USART0: USART0,
763 #[doc = "USART1"]
764 pub USART1: USART1,
765 #[doc = "PRS"]
766 pub PRS: PRS,
767 #[doc = "GPIO"]
768 pub GPIO: GPIO,
769 #[doc = "VCMP"]
770 pub VCMP: VCMP,
771 #[doc = "LEUART0"]
772 pub LEUART0: LEUART0,
773 #[doc = "PCNT0"]
774 pub PCNT0: PCNT0,
775 #[doc = "I2C0"]
776 pub I2C0: I2C0,
777 #[doc = "RTC"]
778 pub RTC: RTC,
779 #[doc = "WDOG"]
780 pub WDOG: WDOG,
781 #[doc = "MTB"]
782 pub MTB: MTB,
783}
784impl Peripherals {
785 #[doc = r"Returns all the peripherals *once*"]
786 #[inline]
787 pub fn take() -> Option<Self> {
788 cortex_m::interrupt::free(|_| {
789 if unsafe { DEVICE_PERIPHERALS } {
790 None
791 } else {
792 Some(unsafe { Peripherals::steal() })
793 }
794 })
795 }
796 #[doc = r"Unchecked version of `Peripherals::take`"]
797 #[inline]
798 pub unsafe fn steal() -> Self {
799 DEVICE_PERIPHERALS = true;
800 Peripherals {
801 DMA: DMA {
802 _marker: PhantomData,
803 },
804 USB: USB {
805 _marker: PhantomData,
806 },
807 MSC: MSC {
808 _marker: PhantomData,
809 },
810 EMU: EMU {
811 _marker: PhantomData,
812 },
813 RMU: RMU {
814 _marker: PhantomData,
815 },
816 CMU: CMU {
817 _marker: PhantomData,
818 },
819 TIMER0: TIMER0 {
820 _marker: PhantomData,
821 },
822 TIMER1: TIMER1 {
823 _marker: PhantomData,
824 },
825 TIMER2: TIMER2 {
826 _marker: PhantomData,
827 },
828 ACMP0: ACMP0 {
829 _marker: PhantomData,
830 },
831 USART0: USART0 {
832 _marker: PhantomData,
833 },
834 USART1: USART1 {
835 _marker: PhantomData,
836 },
837 PRS: PRS {
838 _marker: PhantomData,
839 },
840 GPIO: GPIO {
841 _marker: PhantomData,
842 },
843 VCMP: VCMP {
844 _marker: PhantomData,
845 },
846 LEUART0: LEUART0 {
847 _marker: PhantomData,
848 },
849 PCNT0: PCNT0 {
850 _marker: PhantomData,
851 },
852 I2C0: I2C0 {
853 _marker: PhantomData,
854 },
855 RTC: RTC {
856 _marker: PhantomData,
857 },
858 WDOG: WDOG {
859 _marker: PhantomData,
860 },
861 MTB: MTB {
862 _marker: PhantomData,
863 },
864 }
865 }
866}