1#![doc = "Peripheral access API for W7500X microcontrollers (generated using svd2rust v0.23.1 ( ))\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.23.1/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 = 2;
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 SSP0();
38 fn SSP1();
39 fn UART0();
40 fn UART1();
41 fn UART2();
42 fn PORT0();
43 fn PORT1();
44 fn PORT2();
45 fn PORT3();
46 fn DMA();
47 fn DUALTIMER0();
48 fn DUALTIMER1();
49 fn PWM0();
50 fn PWM1();
51 fn PWM2();
52 fn PWM3();
53 fn PWM4();
54 fn PWM5();
55 fn PWM6();
56 fn PWM7();
57 fn RTC();
58 fn ADC();
59}
60#[doc(hidden)]
61pub union Vector {
62 _handler: unsafe extern "C" fn(),
63 _reserved: u32,
64}
65#[cfg(feature = "rt")]
66#[doc(hidden)]
67#[link_section = ".vector_table.interrupts"]
68#[no_mangle]
69pub static __INTERRUPTS: [Vector; 24] = [
70 Vector { _handler: SSP0 },
71 Vector { _handler: SSP1 },
72 Vector { _handler: UART0 },
73 Vector { _handler: UART1 },
74 Vector { _handler: UART2 },
75 Vector { _reserved: 0 },
76 Vector { _reserved: 0 },
77 Vector { _handler: PORT0 },
78 Vector { _handler: PORT1 },
79 Vector { _handler: PORT2 },
80 Vector { _handler: PORT3 },
81 Vector { _handler: DMA },
82 Vector {
83 _handler: DUALTIMER0,
84 },
85 Vector {
86 _handler: DUALTIMER1,
87 },
88 Vector { _handler: PWM0 },
89 Vector { _handler: PWM1 },
90 Vector { _handler: PWM2 },
91 Vector { _handler: PWM3 },
92 Vector { _handler: PWM4 },
93 Vector { _handler: PWM5 },
94 Vector { _handler: PWM6 },
95 Vector { _handler: PWM7 },
96 Vector { _handler: RTC },
97 Vector { _handler: ADC },
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 - SSP 0 Interrupt"]
104 SSP0 = 0,
105 #[doc = "1 - SSP 1 Interrupt"]
106 SSP1 = 1,
107 #[doc = "2 - UART 0 Interrupt"]
108 UART0 = 2,
109 #[doc = "3 - UART 1 Interrupt"]
110 UART1 = 3,
111 #[doc = "4 - UART 2 Interrupt"]
112 UART2 = 4,
113 #[doc = "7 - Port 0 combined Interrupt"]
114 PORT0 = 7,
115 #[doc = "8 - Port 1 combined Interrupt"]
116 PORT1 = 8,
117 #[doc = "9 - Port 2 combined Interrupt"]
118 PORT2 = 9,
119 #[doc = "10 - Port 3 combined Interrupt"]
120 PORT3 = 10,
121 #[doc = "11 - DMA combined Interrupt"]
122 DMA = 11,
123 #[doc = "12 - Dual Timer 0 Interrupt"]
124 DUALTIMER0 = 12,
125 #[doc = "13 - Dual Timer 1 Interrupt"]
126 DUALTIMER1 = 13,
127 #[doc = "14 - PWM 0 Interrupt"]
128 PWM0 = 14,
129 #[doc = "15 - PWM 1 Interrupt"]
130 PWM1 = 15,
131 #[doc = "16 - PWM 2 Interrupt"]
132 PWM2 = 16,
133 #[doc = "17 - PWM 3 Interrupt"]
134 PWM3 = 17,
135 #[doc = "18 - PWM 4 Interrupt"]
136 PWM4 = 18,
137 #[doc = "19 - PWM 5 Interrupt"]
138 PWM5 = 19,
139 #[doc = "20 - PWM 6 Interrupt"]
140 PWM6 = 20,
141 #[doc = "21 - PWM 7 Interrupt"]
142 PWM7 = 21,
143 #[doc = "22 - RTC Interrupt"]
144 RTC = 22,
145 #[doc = "23 - ADC Interrupt"]
146 ADC = 23,
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 = "WDT"]
155pub struct WDT {
156 _marker: PhantomData<*const ()>,
157}
158unsafe impl Send for WDT {}
159impl WDT {
160 #[doc = r"Pointer to the register block"]
161 pub const PTR: *const wdt::RegisterBlock = 0x4000_0000 as *const _;
162 #[doc = r"Return the pointer to the register block"]
163 #[inline(always)]
164 pub const fn ptr() -> *const wdt::RegisterBlock {
165 Self::PTR
166 }
167}
168impl Deref for WDT {
169 type Target = wdt::RegisterBlock;
170 #[inline(always)]
171 fn deref(&self) -> &Self::Target {
172 unsafe { &*Self::PTR }
173 }
174}
175impl core::fmt::Debug for WDT {
176 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
177 f.debug_struct("WDT").finish()
178 }
179}
180#[doc = "WDT"]
181pub mod wdt;
182#[doc = "DUALTIMER0_0"]
183pub struct DUALTIMER0_0 {
184 _marker: PhantomData<*const ()>,
185}
186unsafe impl Send for DUALTIMER0_0 {}
187impl DUALTIMER0_0 {
188 #[doc = r"Pointer to the register block"]
189 pub const PTR: *const dualtimer0_0::RegisterBlock = 0x4000_1000 as *const _;
190 #[doc = r"Return the pointer to the register block"]
191 #[inline(always)]
192 pub const fn ptr() -> *const dualtimer0_0::RegisterBlock {
193 Self::PTR
194 }
195}
196impl Deref for DUALTIMER0_0 {
197 type Target = dualtimer0_0::RegisterBlock;
198 #[inline(always)]
199 fn deref(&self) -> &Self::Target {
200 unsafe { &*Self::PTR }
201 }
202}
203impl core::fmt::Debug for DUALTIMER0_0 {
204 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
205 f.debug_struct("DUALTIMER0_0").finish()
206 }
207}
208#[doc = "DUALTIMER0_0"]
209pub mod dualtimer0_0;
210#[doc = "DUALTIMER0_1"]
211pub struct DUALTIMER0_1 {
212 _marker: PhantomData<*const ()>,
213}
214unsafe impl Send for DUALTIMER0_1 {}
215impl DUALTIMER0_1 {
216 #[doc = r"Pointer to the register block"]
217 pub const PTR: *const dualtimer0_0::RegisterBlock = 0x4000_1020 as *const _;
218 #[doc = r"Return the pointer to the register block"]
219 #[inline(always)]
220 pub const fn ptr() -> *const dualtimer0_0::RegisterBlock {
221 Self::PTR
222 }
223}
224impl Deref for DUALTIMER0_1 {
225 type Target = dualtimer0_0::RegisterBlock;
226 #[inline(always)]
227 fn deref(&self) -> &Self::Target {
228 unsafe { &*Self::PTR }
229 }
230}
231impl core::fmt::Debug for DUALTIMER0_1 {
232 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
233 f.debug_struct("DUALTIMER0_1").finish()
234 }
235}
236#[doc = "DUALTIMER0_1"]
237pub use dualtimer0_0 as dualtimer0_1;
238#[doc = "DUALTIMER1_0"]
239pub struct DUALTIMER1_0 {
240 _marker: PhantomData<*const ()>,
241}
242unsafe impl Send for DUALTIMER1_0 {}
243impl DUALTIMER1_0 {
244 #[doc = r"Pointer to the register block"]
245 pub const PTR: *const dualtimer0_0::RegisterBlock = 0x4000_2000 as *const _;
246 #[doc = r"Return the pointer to the register block"]
247 #[inline(always)]
248 pub const fn ptr() -> *const dualtimer0_0::RegisterBlock {
249 Self::PTR
250 }
251}
252impl Deref for DUALTIMER1_0 {
253 type Target = dualtimer0_0::RegisterBlock;
254 #[inline(always)]
255 fn deref(&self) -> &Self::Target {
256 unsafe { &*Self::PTR }
257 }
258}
259impl core::fmt::Debug for DUALTIMER1_0 {
260 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
261 f.debug_struct("DUALTIMER1_0").finish()
262 }
263}
264#[doc = "DUALTIMER1_0"]
265pub use dualtimer0_0 as dualtimer1_0;
266#[doc = "DUALTIMER1_1"]
267pub struct DUALTIMER1_1 {
268 _marker: PhantomData<*const ()>,
269}
270unsafe impl Send for DUALTIMER1_1 {}
271impl DUALTIMER1_1 {
272 #[doc = r"Pointer to the register block"]
273 pub const PTR: *const dualtimer0_0::RegisterBlock = 0x4000_2020 as *const _;
274 #[doc = r"Return the pointer to the register block"]
275 #[inline(always)]
276 pub const fn ptr() -> *const dualtimer0_0::RegisterBlock {
277 Self::PTR
278 }
279}
280impl Deref for DUALTIMER1_1 {
281 type Target = dualtimer0_0::RegisterBlock;
282 #[inline(always)]
283 fn deref(&self) -> &Self::Target {
284 unsafe { &*Self::PTR }
285 }
286}
287impl core::fmt::Debug for DUALTIMER1_1 {
288 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
289 f.debug_struct("DUALTIMER1_1").finish()
290 }
291}
292#[doc = "DUALTIMER1_1"]
293pub use dualtimer0_0 as dualtimer1_1;
294#[doc = "PWM"]
295pub struct PWM {
296 _marker: PhantomData<*const ()>,
297}
298unsafe impl Send for PWM {}
299impl PWM {
300 #[doc = r"Pointer to the register block"]
301 pub const PTR: *const pwm::RegisterBlock = 0x4000_5800 as *const _;
302 #[doc = r"Return the pointer to the register block"]
303 #[inline(always)]
304 pub const fn ptr() -> *const pwm::RegisterBlock {
305 Self::PTR
306 }
307}
308impl Deref for PWM {
309 type Target = pwm::RegisterBlock;
310 #[inline(always)]
311 fn deref(&self) -> &Self::Target {
312 unsafe { &*Self::PTR }
313 }
314}
315impl core::fmt::Debug for PWM {
316 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
317 f.debug_struct("PWM").finish()
318 }
319}
320#[doc = "PWM"]
321pub mod pwm;
322#[doc = "PWM0"]
323pub struct PWM0 {
324 _marker: PhantomData<*const ()>,
325}
326unsafe impl Send for PWM0 {}
327impl PWM0 {
328 #[doc = r"Pointer to the register block"]
329 pub const PTR: *const pwm0::RegisterBlock = 0x4000_5000 as *const _;
330 #[doc = r"Return the pointer to the register block"]
331 #[inline(always)]
332 pub const fn ptr() -> *const pwm0::RegisterBlock {
333 Self::PTR
334 }
335}
336impl Deref for PWM0 {
337 type Target = pwm0::RegisterBlock;
338 #[inline(always)]
339 fn deref(&self) -> &Self::Target {
340 unsafe { &*Self::PTR }
341 }
342}
343impl core::fmt::Debug for PWM0 {
344 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
345 f.debug_struct("PWM0").finish()
346 }
347}
348#[doc = "PWM0"]
349pub mod pwm0;
350#[doc = "PWM1"]
351pub struct PWM1 {
352 _marker: PhantomData<*const ()>,
353}
354unsafe impl Send for PWM1 {}
355impl PWM1 {
356 #[doc = r"Pointer to the register block"]
357 pub const PTR: *const pwm0::RegisterBlock = 0x4000_5100 as *const _;
358 #[doc = r"Return the pointer to the register block"]
359 #[inline(always)]
360 pub const fn ptr() -> *const pwm0::RegisterBlock {
361 Self::PTR
362 }
363}
364impl Deref for PWM1 {
365 type Target = pwm0::RegisterBlock;
366 #[inline(always)]
367 fn deref(&self) -> &Self::Target {
368 unsafe { &*Self::PTR }
369 }
370}
371impl core::fmt::Debug for PWM1 {
372 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
373 f.debug_struct("PWM1").finish()
374 }
375}
376#[doc = "PWM1"]
377pub use pwm0 as pwm1;
378#[doc = "PWM2"]
379pub struct PWM2 {
380 _marker: PhantomData<*const ()>,
381}
382unsafe impl Send for PWM2 {}
383impl PWM2 {
384 #[doc = r"Pointer to the register block"]
385 pub const PTR: *const pwm0::RegisterBlock = 0x4000_5200 as *const _;
386 #[doc = r"Return the pointer to the register block"]
387 #[inline(always)]
388 pub const fn ptr() -> *const pwm0::RegisterBlock {
389 Self::PTR
390 }
391}
392impl Deref for PWM2 {
393 type Target = pwm0::RegisterBlock;
394 #[inline(always)]
395 fn deref(&self) -> &Self::Target {
396 unsafe { &*Self::PTR }
397 }
398}
399impl core::fmt::Debug for PWM2 {
400 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
401 f.debug_struct("PWM2").finish()
402 }
403}
404#[doc = "PWM2"]
405pub use pwm0 as pwm2;
406#[doc = "PWM3"]
407pub struct PWM3 {
408 _marker: PhantomData<*const ()>,
409}
410unsafe impl Send for PWM3 {}
411impl PWM3 {
412 #[doc = r"Pointer to the register block"]
413 pub const PTR: *const pwm0::RegisterBlock = 0x4000_5300 as *const _;
414 #[doc = r"Return the pointer to the register block"]
415 #[inline(always)]
416 pub const fn ptr() -> *const pwm0::RegisterBlock {
417 Self::PTR
418 }
419}
420impl Deref for PWM3 {
421 type Target = pwm0::RegisterBlock;
422 #[inline(always)]
423 fn deref(&self) -> &Self::Target {
424 unsafe { &*Self::PTR }
425 }
426}
427impl core::fmt::Debug for PWM3 {
428 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
429 f.debug_struct("PWM3").finish()
430 }
431}
432#[doc = "PWM3"]
433pub use pwm0 as pwm3;
434#[doc = "PWM4"]
435pub struct PWM4 {
436 _marker: PhantomData<*const ()>,
437}
438unsafe impl Send for PWM4 {}
439impl PWM4 {
440 #[doc = r"Pointer to the register block"]
441 pub const PTR: *const pwm0::RegisterBlock = 0x4000_5400 as *const _;
442 #[doc = r"Return the pointer to the register block"]
443 #[inline(always)]
444 pub const fn ptr() -> *const pwm0::RegisterBlock {
445 Self::PTR
446 }
447}
448impl Deref for PWM4 {
449 type Target = pwm0::RegisterBlock;
450 #[inline(always)]
451 fn deref(&self) -> &Self::Target {
452 unsafe { &*Self::PTR }
453 }
454}
455impl core::fmt::Debug for PWM4 {
456 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
457 f.debug_struct("PWM4").finish()
458 }
459}
460#[doc = "PWM4"]
461pub use pwm0 as pwm4;
462#[doc = "PWM5"]
463pub struct PWM5 {
464 _marker: PhantomData<*const ()>,
465}
466unsafe impl Send for PWM5 {}
467impl PWM5 {
468 #[doc = r"Pointer to the register block"]
469 pub const PTR: *const pwm0::RegisterBlock = 0x4000_5500 as *const _;
470 #[doc = r"Return the pointer to the register block"]
471 #[inline(always)]
472 pub const fn ptr() -> *const pwm0::RegisterBlock {
473 Self::PTR
474 }
475}
476impl Deref for PWM5 {
477 type Target = pwm0::RegisterBlock;
478 #[inline(always)]
479 fn deref(&self) -> &Self::Target {
480 unsafe { &*Self::PTR }
481 }
482}
483impl core::fmt::Debug for PWM5 {
484 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
485 f.debug_struct("PWM5").finish()
486 }
487}
488#[doc = "PWM5"]
489pub use pwm0 as pwm5;
490#[doc = "PWM6"]
491pub struct PWM6 {
492 _marker: PhantomData<*const ()>,
493}
494unsafe impl Send for PWM6 {}
495impl PWM6 {
496 #[doc = r"Pointer to the register block"]
497 pub const PTR: *const pwm0::RegisterBlock = 0x4000_5600 as *const _;
498 #[doc = r"Return the pointer to the register block"]
499 #[inline(always)]
500 pub const fn ptr() -> *const pwm0::RegisterBlock {
501 Self::PTR
502 }
503}
504impl Deref for PWM6 {
505 type Target = pwm0::RegisterBlock;
506 #[inline(always)]
507 fn deref(&self) -> &Self::Target {
508 unsafe { &*Self::PTR }
509 }
510}
511impl core::fmt::Debug for PWM6 {
512 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
513 f.debug_struct("PWM6").finish()
514 }
515}
516#[doc = "PWM6"]
517pub use pwm0 as pwm6;
518#[doc = "PWM7"]
519pub struct PWM7 {
520 _marker: PhantomData<*const ()>,
521}
522unsafe impl Send for PWM7 {}
523impl PWM7 {
524 #[doc = r"Pointer to the register block"]
525 pub const PTR: *const pwm0::RegisterBlock = 0x4000_5700 as *const _;
526 #[doc = r"Return the pointer to the register block"]
527 #[inline(always)]
528 pub const fn ptr() -> *const pwm0::RegisterBlock {
529 Self::PTR
530 }
531}
532impl Deref for PWM7 {
533 type Target = pwm0::RegisterBlock;
534 #[inline(always)]
535 fn deref(&self) -> &Self::Target {
536 unsafe { &*Self::PTR }
537 }
538}
539impl core::fmt::Debug for PWM7 {
540 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
541 f.debug_struct("PWM7").finish()
542 }
543}
544#[doc = "PWM7"]
545pub use pwm0 as pwm7;
546#[doc = "UART2"]
547pub struct UART2 {
548 _marker: PhantomData<*const ()>,
549}
550unsafe impl Send for UART2 {}
551impl UART2 {
552 #[doc = r"Pointer to the register block"]
553 pub const PTR: *const uart2::RegisterBlock = 0x4000_6000 as *const _;
554 #[doc = r"Return the pointer to the register block"]
555 #[inline(always)]
556 pub const fn ptr() -> *const uart2::RegisterBlock {
557 Self::PTR
558 }
559}
560impl Deref for UART2 {
561 type Target = uart2::RegisterBlock;
562 #[inline(always)]
563 fn deref(&self) -> &Self::Target {
564 unsafe { &*Self::PTR }
565 }
566}
567impl core::fmt::Debug for UART2 {
568 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
569 f.debug_struct("UART2").finish()
570 }
571}
572#[doc = "UART2"]
573pub mod uart2;
574#[doc = "RNG"]
575pub struct RNG {
576 _marker: PhantomData<*const ()>,
577}
578unsafe impl Send for RNG {}
579impl RNG {
580 #[doc = r"Pointer to the register block"]
581 pub const PTR: *const rng::RegisterBlock = 0x4000_7000 as *const _;
582 #[doc = r"Return the pointer to the register block"]
583 #[inline(always)]
584 pub const fn ptr() -> *const rng::RegisterBlock {
585 Self::PTR
586 }
587}
588impl Deref for RNG {
589 type Target = rng::RegisterBlock;
590 #[inline(always)]
591 fn deref(&self) -> &Self::Target {
592 unsafe { &*Self::PTR }
593 }
594}
595impl core::fmt::Debug for RNG {
596 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
597 f.debug_struct("RNG").finish()
598 }
599}
600#[doc = "RNG"]
601pub mod rng;
602#[doc = "SSP0"]
603pub struct SSP0 {
604 _marker: PhantomData<*const ()>,
605}
606unsafe impl Send for SSP0 {}
607impl SSP0 {
608 #[doc = r"Pointer to the register block"]
609 pub const PTR: *const ssp0::RegisterBlock = 0x4000_a000 as *const _;
610 #[doc = r"Return the pointer to the register block"]
611 #[inline(always)]
612 pub const fn ptr() -> *const ssp0::RegisterBlock {
613 Self::PTR
614 }
615}
616impl Deref for SSP0 {
617 type Target = ssp0::RegisterBlock;
618 #[inline(always)]
619 fn deref(&self) -> &Self::Target {
620 unsafe { &*Self::PTR }
621 }
622}
623impl core::fmt::Debug for SSP0 {
624 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
625 f.debug_struct("SSP0").finish()
626 }
627}
628#[doc = "SSP0"]
629pub mod ssp0;
630#[doc = "SSP1"]
631pub struct SSP1 {
632 _marker: PhantomData<*const ()>,
633}
634unsafe impl Send for SSP1 {}
635impl SSP1 {
636 #[doc = r"Pointer to the register block"]
637 pub const PTR: *const ssp0::RegisterBlock = 0x4000_b000 as *const _;
638 #[doc = r"Return the pointer to the register block"]
639 #[inline(always)]
640 pub const fn ptr() -> *const ssp0::RegisterBlock {
641 Self::PTR
642 }
643}
644impl Deref for SSP1 {
645 type Target = ssp0::RegisterBlock;
646 #[inline(always)]
647 fn deref(&self) -> &Self::Target {
648 unsafe { &*Self::PTR }
649 }
650}
651impl core::fmt::Debug for SSP1 {
652 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
653 f.debug_struct("SSP1").finish()
654 }
655}
656#[doc = "SSP1"]
657pub use ssp0 as ssp1;
658#[doc = "UART0"]
659pub struct UART0 {
660 _marker: PhantomData<*const ()>,
661}
662unsafe impl Send for UART0 {}
663impl UART0 {
664 #[doc = r"Pointer to the register block"]
665 pub const PTR: *const uart0::RegisterBlock = 0x4000_c000 as *const _;
666 #[doc = r"Return the pointer to the register block"]
667 #[inline(always)]
668 pub const fn ptr() -> *const uart0::RegisterBlock {
669 Self::PTR
670 }
671}
672impl Deref for UART0 {
673 type Target = uart0::RegisterBlock;
674 #[inline(always)]
675 fn deref(&self) -> &Self::Target {
676 unsafe { &*Self::PTR }
677 }
678}
679impl core::fmt::Debug for UART0 {
680 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
681 f.debug_struct("UART0").finish()
682 }
683}
684#[doc = "UART0"]
685pub mod uart0;
686#[doc = "UART1"]
687pub struct UART1 {
688 _marker: PhantomData<*const ()>,
689}
690unsafe impl Send for UART1 {}
691impl UART1 {
692 #[doc = r"Pointer to the register block"]
693 pub const PTR: *const uart0::RegisterBlock = 0x4000_d000 as *const _;
694 #[doc = r"Return the pointer to the register block"]
695 #[inline(always)]
696 pub const fn ptr() -> *const uart0::RegisterBlock {
697 Self::PTR
698 }
699}
700impl Deref for UART1 {
701 type Target = uart0::RegisterBlock;
702 #[inline(always)]
703 fn deref(&self) -> &Self::Target {
704 unsafe { &*Self::PTR }
705 }
706}
707impl core::fmt::Debug for UART1 {
708 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
709 f.debug_struct("UART1").finish()
710 }
711}
712#[doc = "UART1"]
713pub use uart0 as uart1;
714#[doc = "RTC"]
715pub struct RTC {
716 _marker: PhantomData<*const ()>,
717}
718unsafe impl Send for RTC {}
719impl RTC {
720 #[doc = r"Pointer to the register block"]
721 pub const PTR: *const rtc::RegisterBlock = 0x4000_e000 as *const _;
722 #[doc = r"Return the pointer to the register block"]
723 #[inline(always)]
724 pub const fn ptr() -> *const rtc::RegisterBlock {
725 Self::PTR
726 }
727}
728impl Deref for RTC {
729 type Target = rtc::RegisterBlock;
730 #[inline(always)]
731 fn deref(&self) -> &Self::Target {
732 unsafe { &*Self::PTR }
733 }
734}
735impl core::fmt::Debug for RTC {
736 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
737 f.debug_struct("RTC").finish()
738 }
739}
740#[doc = "RTC"]
741pub mod rtc;
742#[doc = "SYSCFG"]
743pub struct SYSCFG {
744 _marker: PhantomData<*const ()>,
745}
746unsafe impl Send for SYSCFG {}
747impl SYSCFG {
748 #[doc = r"Pointer to the register block"]
749 pub const PTR: *const syscfg::RegisterBlock = 0x4001_f000 as *const _;
750 #[doc = r"Return the pointer to the register block"]
751 #[inline(always)]
752 pub const fn ptr() -> *const syscfg::RegisterBlock {
753 Self::PTR
754 }
755}
756impl Deref for SYSCFG {
757 type Target = syscfg::RegisterBlock;
758 #[inline(always)]
759 fn deref(&self) -> &Self::Target {
760 unsafe { &*Self::PTR }
761 }
762}
763impl core::fmt::Debug for SYSCFG {
764 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
765 f.debug_struct("SYSCFG").finish()
766 }
767}
768#[doc = "SYSCFG"]
769pub mod syscfg;
770#[doc = "ADC"]
771pub struct ADC {
772 _marker: PhantomData<*const ()>,
773}
774unsafe impl Send for ADC {}
775impl ADC {
776 #[doc = r"Pointer to the register block"]
777 pub const PTR: *const adc::RegisterBlock = 0x4100_0000 as *const _;
778 #[doc = r"Return the pointer to the register block"]
779 #[inline(always)]
780 pub const fn ptr() -> *const adc::RegisterBlock {
781 Self::PTR
782 }
783}
784impl Deref for ADC {
785 type Target = adc::RegisterBlock;
786 #[inline(always)]
787 fn deref(&self) -> &Self::Target {
788 unsafe { &*Self::PTR }
789 }
790}
791impl core::fmt::Debug for ADC {
792 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
793 f.debug_struct("ADC").finish()
794 }
795}
796#[doc = "ADC"]
797pub mod adc;
798#[doc = "CRG"]
799pub struct CRG {
800 _marker: PhantomData<*const ()>,
801}
802unsafe impl Send for CRG {}
803impl CRG {
804 #[doc = r"Pointer to the register block"]
805 pub const PTR: *const crg::RegisterBlock = 0x4100_1000 as *const _;
806 #[doc = r"Return the pointer to the register block"]
807 #[inline(always)]
808 pub const fn ptr() -> *const crg::RegisterBlock {
809 Self::PTR
810 }
811}
812impl Deref for CRG {
813 type Target = crg::RegisterBlock;
814 #[inline(always)]
815 fn deref(&self) -> &Self::Target {
816 unsafe { &*Self::PTR }
817 }
818}
819impl core::fmt::Debug for CRG {
820 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
821 f.debug_struct("CRG").finish()
822 }
823}
824#[doc = "CRG"]
825pub mod crg;
826#[doc = "DMA"]
827pub struct DMA {
828 _marker: PhantomData<*const ()>,
829}
830unsafe impl Send for DMA {}
831impl DMA {
832 #[doc = r"Pointer to the register block"]
833 pub const PTR: *const dma::RegisterBlock = 0x4100_4000 as *const _;
834 #[doc = r"Return the pointer to the register block"]
835 #[inline(always)]
836 pub const fn ptr() -> *const dma::RegisterBlock {
837 Self::PTR
838 }
839}
840impl Deref for DMA {
841 type Target = dma::RegisterBlock;
842 #[inline(always)]
843 fn deref(&self) -> &Self::Target {
844 unsafe { &*Self::PTR }
845 }
846}
847impl core::fmt::Debug for DMA {
848 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
849 f.debug_struct("DMA").finish()
850 }
851}
852#[doc = "DMA"]
853pub mod dma;
854#[doc = "GPIOA"]
855pub struct GPIOA {
856 _marker: PhantomData<*const ()>,
857}
858unsafe impl Send for GPIOA {}
859impl GPIOA {
860 #[doc = r"Pointer to the register block"]
861 pub const PTR: *const gpioa::RegisterBlock = 0x4200_0000 as *const _;
862 #[doc = r"Return the pointer to the register block"]
863 #[inline(always)]
864 pub const fn ptr() -> *const gpioa::RegisterBlock {
865 Self::PTR
866 }
867}
868impl Deref for GPIOA {
869 type Target = gpioa::RegisterBlock;
870 #[inline(always)]
871 fn deref(&self) -> &Self::Target {
872 unsafe { &*Self::PTR }
873 }
874}
875impl core::fmt::Debug for GPIOA {
876 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
877 f.debug_struct("GPIOA").finish()
878 }
879}
880#[doc = "GPIOA"]
881pub mod gpioa;
882#[doc = "GPIOB"]
883pub struct GPIOB {
884 _marker: PhantomData<*const ()>,
885}
886unsafe impl Send for GPIOB {}
887impl GPIOB {
888 #[doc = r"Pointer to the register block"]
889 pub const PTR: *const gpioa::RegisterBlock = 0x4300_0000 as *const _;
890 #[doc = r"Return the pointer to the register block"]
891 #[inline(always)]
892 pub const fn ptr() -> *const gpioa::RegisterBlock {
893 Self::PTR
894 }
895}
896impl Deref for GPIOB {
897 type Target = gpioa::RegisterBlock;
898 #[inline(always)]
899 fn deref(&self) -> &Self::Target {
900 unsafe { &*Self::PTR }
901 }
902}
903impl core::fmt::Debug for GPIOB {
904 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
905 f.debug_struct("GPIOB").finish()
906 }
907}
908#[doc = "GPIOB"]
909pub use gpioa as gpiob;
910#[doc = "GPIOC"]
911pub struct GPIOC {
912 _marker: PhantomData<*const ()>,
913}
914unsafe impl Send for GPIOC {}
915impl GPIOC {
916 #[doc = r"Pointer to the register block"]
917 pub const PTR: *const gpioa::RegisterBlock = 0x4400_0000 as *const _;
918 #[doc = r"Return the pointer to the register block"]
919 #[inline(always)]
920 pub const fn ptr() -> *const gpioa::RegisterBlock {
921 Self::PTR
922 }
923}
924impl Deref for GPIOC {
925 type Target = gpioa::RegisterBlock;
926 #[inline(always)]
927 fn deref(&self) -> &Self::Target {
928 unsafe { &*Self::PTR }
929 }
930}
931impl core::fmt::Debug for GPIOC {
932 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
933 f.debug_struct("GPIOC").finish()
934 }
935}
936#[doc = "GPIOC"]
937pub use gpioa as gpioc;
938#[doc = "GPIOD"]
939pub struct GPIOD {
940 _marker: PhantomData<*const ()>,
941}
942unsafe impl Send for GPIOD {}
943impl GPIOD {
944 #[doc = r"Pointer to the register block"]
945 pub const PTR: *const gpioa::RegisterBlock = 0x4500_0000 as *const _;
946 #[doc = r"Return the pointer to the register block"]
947 #[inline(always)]
948 pub const fn ptr() -> *const gpioa::RegisterBlock {
949 Self::PTR
950 }
951}
952impl Deref for GPIOD {
953 type Target = gpioa::RegisterBlock;
954 #[inline(always)]
955 fn deref(&self) -> &Self::Target {
956 unsafe { &*Self::PTR }
957 }
958}
959impl core::fmt::Debug for GPIOD {
960 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
961 f.debug_struct("GPIOD").finish()
962 }
963}
964#[doc = "GPIOD"]
965pub use gpioa as gpiod;
966#[no_mangle]
967static mut DEVICE_PERIPHERALS: bool = false;
968#[doc = r"All the peripherals"]
969#[allow(non_snake_case)]
970pub struct Peripherals {
971 #[doc = "WDT"]
972 pub WDT: WDT,
973 #[doc = "DUALTIMER0_0"]
974 pub DUALTIMER0_0: DUALTIMER0_0,
975 #[doc = "DUALTIMER0_1"]
976 pub DUALTIMER0_1: DUALTIMER0_1,
977 #[doc = "DUALTIMER1_0"]
978 pub DUALTIMER1_0: DUALTIMER1_0,
979 #[doc = "DUALTIMER1_1"]
980 pub DUALTIMER1_1: DUALTIMER1_1,
981 #[doc = "PWM"]
982 pub PWM: PWM,
983 #[doc = "PWM0"]
984 pub PWM0: PWM0,
985 #[doc = "PWM1"]
986 pub PWM1: PWM1,
987 #[doc = "PWM2"]
988 pub PWM2: PWM2,
989 #[doc = "PWM3"]
990 pub PWM3: PWM3,
991 #[doc = "PWM4"]
992 pub PWM4: PWM4,
993 #[doc = "PWM5"]
994 pub PWM5: PWM5,
995 #[doc = "PWM6"]
996 pub PWM6: PWM6,
997 #[doc = "PWM7"]
998 pub PWM7: PWM7,
999 #[doc = "UART2"]
1000 pub UART2: UART2,
1001 #[doc = "RNG"]
1002 pub RNG: RNG,
1003 #[doc = "SSP0"]
1004 pub SSP0: SSP0,
1005 #[doc = "SSP1"]
1006 pub SSP1: SSP1,
1007 #[doc = "UART0"]
1008 pub UART0: UART0,
1009 #[doc = "UART1"]
1010 pub UART1: UART1,
1011 #[doc = "RTC"]
1012 pub RTC: RTC,
1013 #[doc = "SYSCFG"]
1014 pub SYSCFG: SYSCFG,
1015 #[doc = "ADC"]
1016 pub ADC: ADC,
1017 #[doc = "CRG"]
1018 pub CRG: CRG,
1019 #[doc = "DMA"]
1020 pub DMA: DMA,
1021 #[doc = "GPIOA"]
1022 pub GPIOA: GPIOA,
1023 #[doc = "GPIOB"]
1024 pub GPIOB: GPIOB,
1025 #[doc = "GPIOC"]
1026 pub GPIOC: GPIOC,
1027 #[doc = "GPIOD"]
1028 pub GPIOD: GPIOD,
1029}
1030impl Peripherals {
1031 #[doc = r"Returns all the peripherals *once*"]
1032 #[inline]
1033 pub fn take() -> Option<Self> {
1034 cortex_m::interrupt::free(|_| {
1035 if unsafe { DEVICE_PERIPHERALS } {
1036 None
1037 } else {
1038 Some(unsafe { Peripherals::steal() })
1039 }
1040 })
1041 }
1042 #[doc = r"Unchecked version of `Peripherals::take`"]
1043 #[inline]
1044 pub unsafe fn steal() -> Self {
1045 DEVICE_PERIPHERALS = true;
1046 Peripherals {
1047 WDT: WDT {
1048 _marker: PhantomData,
1049 },
1050 DUALTIMER0_0: DUALTIMER0_0 {
1051 _marker: PhantomData,
1052 },
1053 DUALTIMER0_1: DUALTIMER0_1 {
1054 _marker: PhantomData,
1055 },
1056 DUALTIMER1_0: DUALTIMER1_0 {
1057 _marker: PhantomData,
1058 },
1059 DUALTIMER1_1: DUALTIMER1_1 {
1060 _marker: PhantomData,
1061 },
1062 PWM: PWM {
1063 _marker: PhantomData,
1064 },
1065 PWM0: PWM0 {
1066 _marker: PhantomData,
1067 },
1068 PWM1: PWM1 {
1069 _marker: PhantomData,
1070 },
1071 PWM2: PWM2 {
1072 _marker: PhantomData,
1073 },
1074 PWM3: PWM3 {
1075 _marker: PhantomData,
1076 },
1077 PWM4: PWM4 {
1078 _marker: PhantomData,
1079 },
1080 PWM5: PWM5 {
1081 _marker: PhantomData,
1082 },
1083 PWM6: PWM6 {
1084 _marker: PhantomData,
1085 },
1086 PWM7: PWM7 {
1087 _marker: PhantomData,
1088 },
1089 UART2: UART2 {
1090 _marker: PhantomData,
1091 },
1092 RNG: RNG {
1093 _marker: PhantomData,
1094 },
1095 SSP0: SSP0 {
1096 _marker: PhantomData,
1097 },
1098 SSP1: SSP1 {
1099 _marker: PhantomData,
1100 },
1101 UART0: UART0 {
1102 _marker: PhantomData,
1103 },
1104 UART1: UART1 {
1105 _marker: PhantomData,
1106 },
1107 RTC: RTC {
1108 _marker: PhantomData,
1109 },
1110 SYSCFG: SYSCFG {
1111 _marker: PhantomData,
1112 },
1113 ADC: ADC {
1114 _marker: PhantomData,
1115 },
1116 CRG: CRG {
1117 _marker: PhantomData,
1118 },
1119 DMA: DMA {
1120 _marker: PhantomData,
1121 },
1122 GPIOA: GPIOA {
1123 _marker: PhantomData,
1124 },
1125 GPIOB: GPIOB {
1126 _marker: PhantomData,
1127 },
1128 GPIOC: GPIOC {
1129 _marker: PhantomData,
1130 },
1131 GPIOD: GPIOD {
1132 _marker: PhantomData,
1133 },
1134 }
1135 }
1136}