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