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