1#![doc = "Peripheral access API for K1921VK035 microcontrollers (generated using svd2rust v0.33.1 (untracked))\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.33.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#![allow(non_camel_case_types)]
4#![allow(non_snake_case)]
5#![no_std]
6use core::marker::PhantomData;
7use core::ops::Deref;
8#[doc = r"Number available in the NVIC for configuring priority"]
9pub const NVIC_PRIO_BITS: u8 = 3;
10#[cfg(feature = "rt")]
11pub use self::Interrupt as interrupt;
12#[cfg(feature = "rt")]
13pub use cortex_m_rt::interrupt;
14#[allow(unused_imports)]
15use generic::*;
16#[doc = r"Common register and bit access and modify traits"]
17pub mod generic;
18#[cfg(feature = "rt")]
19extern "C" {
20 fn WDT();
21 fn RCU();
22 fn MFLASH();
23 fn GPIOA();
24 fn GPIOB();
25 fn DMA_CH0();
26 fn DMA_CH1();
27 fn DMA_CH2();
28 fn DMA_CH3();
29 fn DMA_CH4();
30 fn DMA_CH5();
31 fn DMA_CH6();
32 fn DMA_CH7();
33 fn DMA_CH8();
34 fn DMA_CH9();
35 fn DMA_CH10();
36 fn DMA_CH11();
37 fn DMA_CH12();
38 fn DMA_CH13();
39 fn DMA_CH14();
40 fn DMA_CH15();
41 fn TMR0();
42 fn TMR1();
43 fn TMR2();
44 fn TMR3();
45 fn UART0_TD();
46 fn UART0_RX();
47 fn UART0_TX();
48 fn UART0_E_RT();
49 fn UART1_TD();
50 fn UART1_RX();
51 fn UART1_TX();
52 fn UART1_E_RT();
53 fn SPI_RO_RT();
54 fn SPI_RX();
55 fn SPI_TX();
56 fn I2C();
57 fn ECAP0();
58 fn ECAP1();
59 fn ECAP2();
60 fn PWM0();
61 fn PWM0_HD();
62 fn PWM0_TZ();
63 fn PWM1();
64 fn PWM1_HD();
65 fn PWM1_TZ();
66 fn PWM2();
67 fn PWM2_HD();
68 fn PWM2_TZ();
69 fn QEP();
70 fn ADC_SEQ0();
71 fn ADC_SEQ1();
72 fn ADC_DC();
73 fn CAN0();
74 fn CAN1();
75 fn CAN2();
76 fn CAN3();
77 fn CAN4();
78 fn CAN5();
79 fn CAN6();
80 fn CAN7();
81 fn CAN8();
82 fn CAN9();
83 fn CAN10();
84 fn CAN11();
85 fn CAN12();
86 fn CAN13();
87 fn CAN14();
88 fn CAN15();
89 fn FPU();
90}
91#[doc(hidden)]
92#[repr(C)]
93pub union Vector {
94 _handler: unsafe extern "C" fn(),
95 _reserved: u32,
96}
97#[cfg(feature = "rt")]
98#[doc(hidden)]
99#[link_section = ".vector_table.interrupts"]
100#[no_mangle]
101pub static __INTERRUPTS: [Vector; 70] = [
102 Vector { _handler: WDT },
103 Vector { _handler: RCU },
104 Vector { _handler: MFLASH },
105 Vector { _handler: GPIOA },
106 Vector { _handler: GPIOB },
107 Vector { _handler: DMA_CH0 },
108 Vector { _handler: DMA_CH1 },
109 Vector { _handler: DMA_CH2 },
110 Vector { _handler: DMA_CH3 },
111 Vector { _handler: DMA_CH4 },
112 Vector { _handler: DMA_CH5 },
113 Vector { _handler: DMA_CH6 },
114 Vector { _handler: DMA_CH7 },
115 Vector { _handler: DMA_CH8 },
116 Vector { _handler: DMA_CH9 },
117 Vector { _handler: DMA_CH10 },
118 Vector { _handler: DMA_CH11 },
119 Vector { _handler: DMA_CH12 },
120 Vector { _handler: DMA_CH13 },
121 Vector { _handler: DMA_CH14 },
122 Vector { _handler: DMA_CH15 },
123 Vector { _handler: TMR0 },
124 Vector { _handler: TMR1 },
125 Vector { _handler: TMR2 },
126 Vector { _handler: TMR3 },
127 Vector { _handler: UART0_TD },
128 Vector { _handler: UART0_RX },
129 Vector { _handler: UART0_TX },
130 Vector {
131 _handler: UART0_E_RT,
132 },
133 Vector { _handler: UART1_TD },
134 Vector { _handler: UART1_RX },
135 Vector { _handler: UART1_TX },
136 Vector {
137 _handler: UART1_E_RT,
138 },
139 Vector {
140 _handler: SPI_RO_RT,
141 },
142 Vector { _handler: SPI_RX },
143 Vector { _handler: SPI_TX },
144 Vector { _handler: I2C },
145 Vector { _handler: ECAP0 },
146 Vector { _handler: ECAP1 },
147 Vector { _handler: ECAP2 },
148 Vector { _handler: PWM0 },
149 Vector { _handler: PWM0_HD },
150 Vector { _handler: PWM0_TZ },
151 Vector { _handler: PWM1 },
152 Vector { _handler: PWM1_HD },
153 Vector { _handler: PWM1_TZ },
154 Vector { _handler: PWM2 },
155 Vector { _handler: PWM2_HD },
156 Vector { _handler: PWM2_TZ },
157 Vector { _handler: QEP },
158 Vector { _handler: ADC_SEQ0 },
159 Vector { _handler: ADC_SEQ1 },
160 Vector { _handler: ADC_DC },
161 Vector { _handler: CAN0 },
162 Vector { _handler: CAN1 },
163 Vector { _handler: CAN2 },
164 Vector { _handler: CAN3 },
165 Vector { _handler: CAN4 },
166 Vector { _handler: CAN5 },
167 Vector { _handler: CAN6 },
168 Vector { _handler: CAN7 },
169 Vector { _handler: CAN8 },
170 Vector { _handler: CAN9 },
171 Vector { _handler: CAN10 },
172 Vector { _handler: CAN11 },
173 Vector { _handler: CAN12 },
174 Vector { _handler: CAN13 },
175 Vector { _handler: CAN14 },
176 Vector { _handler: CAN15 },
177 Vector { _handler: FPU },
178];
179#[doc = r"Enumeration of all the interrupts."]
180#[derive(Copy, Clone, Debug, PartialEq, Eq)]
181#[repr(u16)]
182pub enum Interrupt {
183 #[doc = "0 - Watchdog timer interrupt"]
184 WDT = 0,
185 #[doc = "1 - Reset and clock unit interrupt"]
186 RCU = 1,
187 #[doc = "2 - MFLASH interrupt"]
188 MFLASH = 2,
189 #[doc = "3 - GPIO A interrupt"]
190 GPIOA = 3,
191 #[doc = "4 - GPIO B interrupt"]
192 GPIOB = 4,
193 #[doc = "5 - DMA channel 0 interrupt"]
194 DMA_CH0 = 5,
195 #[doc = "6 - DMA channel 1 interrupt"]
196 DMA_CH1 = 6,
197 #[doc = "7 - DMA channel 2 interrupt"]
198 DMA_CH2 = 7,
199 #[doc = "8 - DMA channel 3 interrupt"]
200 DMA_CH3 = 8,
201 #[doc = "9 - DMA channel 4 interrupt"]
202 DMA_CH4 = 9,
203 #[doc = "10 - DMA channel 5 interrupt"]
204 DMA_CH5 = 10,
205 #[doc = "11 - DMA channel 6 interrupt"]
206 DMA_CH6 = 11,
207 #[doc = "12 - DMA channel 7 interrupt"]
208 DMA_CH7 = 12,
209 #[doc = "13 - DMA channel 8 interrupt"]
210 DMA_CH8 = 13,
211 #[doc = "14 - DMA channel 9 interrupt"]
212 DMA_CH9 = 14,
213 #[doc = "15 - DMA channel 10 interrupt"]
214 DMA_CH10 = 15,
215 #[doc = "16 - DMA channel 11 interrupt"]
216 DMA_CH11 = 16,
217 #[doc = "17 - DMA channel 12 interrupt"]
218 DMA_CH12 = 17,
219 #[doc = "18 - DMA channel 13 interrupt"]
220 DMA_CH13 = 18,
221 #[doc = "19 - DMA channel 14 interrupt"]
222 DMA_CH14 = 19,
223 #[doc = "20 - DMA channel 15 interrupt"]
224 DMA_CH15 = 20,
225 #[doc = "21 - Timer 0 interrupt"]
226 TMR0 = 21,
227 #[doc = "22 - Timer 1 interrupt"]
228 TMR1 = 22,
229 #[doc = "23 - Timer 2 interrupt"]
230 TMR2 = 23,
231 #[doc = "24 - Timer 3 interrupt"]
232 TMR3 = 24,
233 #[doc = "25 - UART0 Transmit Done interrupt"]
234 UART0_TD = 25,
235 #[doc = "26 - UART0 Recieve interrupt"]
236 UART0_RX = 26,
237 #[doc = "27 - UART0 Transmit interrupt"]
238 UART0_TX = 27,
239 #[doc = "28 - UART0 Error and Receive Timeout interrupt"]
240 UART0_E_RT = 28,
241 #[doc = "29 - UART1 Transmit Done interrupt"]
242 UART1_TD = 29,
243 #[doc = "30 - UART1 Recieve interrupt"]
244 UART1_RX = 30,
245 #[doc = "31 - UART1 Transmit interrupt"]
246 UART1_TX = 31,
247 #[doc = "32 - UART1 Error and Receive Timeout interrupt"]
248 UART1_E_RT = 32,
249 #[doc = "33 - SPI RX FIFO overrun and Receive Timeout interrupt"]
250 SPI_RO_RT = 33,
251 #[doc = "34 - SPI Receive interrupt"]
252 SPI_RX = 34,
253 #[doc = "35 - SPI Transmit interrupt"]
254 SPI_TX = 35,
255 #[doc = "36 - I2C interrupt"]
256 I2C = 36,
257 #[doc = "37 - ECAP0 interrupt"]
258 ECAP0 = 37,
259 #[doc = "38 - ECAP1 interrupt"]
260 ECAP1 = 38,
261 #[doc = "39 - ECAP2 interrupt"]
262 ECAP2 = 39,
263 #[doc = "40 - PWM0 interrupt"]
264 PWM0 = 40,
265 #[doc = "41 - PWM0 HD interrupt"]
266 PWM0_HD = 41,
267 #[doc = "42 - PWM0 TZ interrupt"]
268 PWM0_TZ = 42,
269 #[doc = "43 - PWM1 interrupt"]
270 PWM1 = 43,
271 #[doc = "44 - PWM1 HD interrupt"]
272 PWM1_HD = 44,
273 #[doc = "45 - PWM1 TZ interrupt"]
274 PWM1_TZ = 45,
275 #[doc = "46 - PWM2 interrupt"]
276 PWM2 = 46,
277 #[doc = "47 - PWM2 HD interrupt"]
278 PWM2_HD = 47,
279 #[doc = "48 - PWM2 TZ interrupt"]
280 PWM2_TZ = 48,
281 #[doc = "49 - QEP interrupt"]
282 QEP = 49,
283 #[doc = "50 - ADC Sequencer 0 interrupt"]
284 ADC_SEQ0 = 50,
285 #[doc = "51 - ADC Sequencer 1 interrupt"]
286 ADC_SEQ1 = 51,
287 #[doc = "52 - ADC Digital Comparator interrupt"]
288 ADC_DC = 52,
289 #[doc = "53 - CAN0 interrupt"]
290 CAN0 = 53,
291 #[doc = "54 - CAN1 interrupt"]
292 CAN1 = 54,
293 #[doc = "55 - CAN2 interrupt"]
294 CAN2 = 55,
295 #[doc = "56 - CAN3 interrupt"]
296 CAN3 = 56,
297 #[doc = "57 - CAN4 interrupt"]
298 CAN4 = 57,
299 #[doc = "58 - CAN5 interrupt"]
300 CAN5 = 58,
301 #[doc = "59 - CAN6 interrupt"]
302 CAN6 = 59,
303 #[doc = "60 - CAN7 interrupt"]
304 CAN7 = 60,
305 #[doc = "61 - CAN8 interrupt"]
306 CAN8 = 61,
307 #[doc = "62 - CAN9 interrupt"]
308 CAN9 = 62,
309 #[doc = "63 - CAN10 interrupt"]
310 CAN10 = 63,
311 #[doc = "64 - CAN11 interrupt"]
312 CAN11 = 64,
313 #[doc = "65 - CAN12 interrupt"]
314 CAN12 = 65,
315 #[doc = "66 - CAN13 interrupt"]
316 CAN13 = 66,
317 #[doc = "67 - CAN14 interrupt"]
318 CAN14 = 67,
319 #[doc = "68 - CAN15 interrupt"]
320 CAN15 = 68,
321 #[doc = "69 - FPU exception interrupt"]
322 FPU = 69,
323}
324unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
325 #[inline(always)]
326 fn number(self) -> u16 {
327 self as u16
328 }
329}
330#[doc = "System integration unit registers"]
331pub struct Siu {
332 _marker: PhantomData<*const ()>,
333}
334unsafe impl Send for Siu {}
335impl Siu {
336 #[doc = r"Pointer to the register block"]
337 pub const PTR: *const siu::RegisterBlock = 0x4004_0000 as *const _;
338 #[doc = r"Return the pointer to the register block"]
339 #[inline(always)]
340 pub const fn ptr() -> *const siu::RegisterBlock {
341 Self::PTR
342 }
343 #[doc = r" Steal an instance of this peripheral"]
344 #[doc = r""]
345 #[doc = r" # Safety"]
346 #[doc = r""]
347 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
348 #[doc = r" that may race with any existing instances, for example by only"]
349 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
350 #[doc = r" original peripheral and using critical sections to coordinate"]
351 #[doc = r" access between multiple new instances."]
352 #[doc = r""]
353 #[doc = r" Additionally, other software such as HALs may rely on only one"]
354 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
355 #[doc = r" no stolen instances are passed to such software."]
356 pub unsafe fn steal() -> Self {
357 Self {
358 _marker: PhantomData,
359 }
360 }
361}
362impl Deref for Siu {
363 type Target = siu::RegisterBlock;
364 #[inline(always)]
365 fn deref(&self) -> &Self::Target {
366 unsafe { &*Self::PTR }
367 }
368}
369impl core::fmt::Debug for Siu {
370 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
371 f.debug_struct("Siu").finish()
372 }
373}
374#[doc = "System integration unit registers"]
375pub mod siu;
376#[doc = "Reset and clock unit registers"]
377pub struct Rcu {
378 _marker: PhantomData<*const ()>,
379}
380unsafe impl Send for Rcu {}
381impl Rcu {
382 #[doc = r"Pointer to the register block"]
383 pub const PTR: *const rcu::RegisterBlock = 0x4004_1000 as *const _;
384 #[doc = r"Return the pointer to the register block"]
385 #[inline(always)]
386 pub const fn ptr() -> *const rcu::RegisterBlock {
387 Self::PTR
388 }
389 #[doc = r" Steal an instance of this peripheral"]
390 #[doc = r""]
391 #[doc = r" # Safety"]
392 #[doc = r""]
393 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
394 #[doc = r" that may race with any existing instances, for example by only"]
395 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
396 #[doc = r" original peripheral and using critical sections to coordinate"]
397 #[doc = r" access between multiple new instances."]
398 #[doc = r""]
399 #[doc = r" Additionally, other software such as HALs may rely on only one"]
400 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
401 #[doc = r" no stolen instances are passed to such software."]
402 pub unsafe fn steal() -> Self {
403 Self {
404 _marker: PhantomData,
405 }
406 }
407}
408impl Deref for Rcu {
409 type Target = rcu::RegisterBlock;
410 #[inline(always)]
411 fn deref(&self) -> &Self::Target {
412 unsafe { &*Self::PTR }
413 }
414}
415impl core::fmt::Debug for Rcu {
416 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
417 f.debug_struct("Rcu").finish()
418 }
419}
420#[doc = "Reset and clock unit registers"]
421pub mod rcu;
422#[doc = "Power management unit registers"]
423pub struct Pmu {
424 _marker: PhantomData<*const ()>,
425}
426unsafe impl Send for Pmu {}
427impl Pmu {
428 #[doc = r"Pointer to the register block"]
429 pub const PTR: *const pmu::RegisterBlock = 0x4004_2000 as *const _;
430 #[doc = r"Return the pointer to the register block"]
431 #[inline(always)]
432 pub const fn ptr() -> *const pmu::RegisterBlock {
433 Self::PTR
434 }
435 #[doc = r" Steal an instance of this peripheral"]
436 #[doc = r""]
437 #[doc = r" # Safety"]
438 #[doc = r""]
439 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
440 #[doc = r" that may race with any existing instances, for example by only"]
441 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
442 #[doc = r" original peripheral and using critical sections to coordinate"]
443 #[doc = r" access between multiple new instances."]
444 #[doc = r""]
445 #[doc = r" Additionally, other software such as HALs may rely on only one"]
446 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
447 #[doc = r" no stolen instances are passed to such software."]
448 pub unsafe fn steal() -> Self {
449 Self {
450 _marker: PhantomData,
451 }
452 }
453}
454impl Deref for Pmu {
455 type Target = pmu::RegisterBlock;
456 #[inline(always)]
457 fn deref(&self) -> &Self::Target {
458 unsafe { &*Self::PTR }
459 }
460}
461impl core::fmt::Debug for Pmu {
462 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
463 f.debug_struct("Pmu").finish()
464 }
465}
466#[doc = "Power management unit registers"]
467pub mod pmu;
468#[doc = "Watchdog control registers"]
469pub struct Wdt {
470 _marker: PhantomData<*const ()>,
471}
472unsafe impl Send for Wdt {}
473impl Wdt {
474 #[doc = r"Pointer to the register block"]
475 pub const PTR: *const wdt::RegisterBlock = 0x4004_3000 as *const _;
476 #[doc = r"Return the pointer to the register block"]
477 #[inline(always)]
478 pub const fn ptr() -> *const wdt::RegisterBlock {
479 Self::PTR
480 }
481 #[doc = r" Steal an instance of this peripheral"]
482 #[doc = r""]
483 #[doc = r" # Safety"]
484 #[doc = r""]
485 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
486 #[doc = r" that may race with any existing instances, for example by only"]
487 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
488 #[doc = r" original peripheral and using critical sections to coordinate"]
489 #[doc = r" access between multiple new instances."]
490 #[doc = r""]
491 #[doc = r" Additionally, other software such as HALs may rely on only one"]
492 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
493 #[doc = r" no stolen instances are passed to such software."]
494 pub unsafe fn steal() -> Self {
495 Self {
496 _marker: PhantomData,
497 }
498 }
499}
500impl Deref for Wdt {
501 type Target = wdt::RegisterBlock;
502 #[inline(always)]
503 fn deref(&self) -> &Self::Target {
504 unsafe { &*Self::PTR }
505 }
506}
507impl core::fmt::Debug for Wdt {
508 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
509 f.debug_struct("Wdt").finish()
510 }
511}
512#[doc = "Watchdog control registers"]
513pub mod wdt;
514#[doc = "TMR controller registers"]
515pub struct Tmr0 {
516 _marker: PhantomData<*const ()>,
517}
518unsafe impl Send for Tmr0 {}
519impl Tmr0 {
520 #[doc = r"Pointer to the register block"]
521 pub const PTR: *const tmr0::RegisterBlock = 0x4004_8000 as *const _;
522 #[doc = r"Return the pointer to the register block"]
523 #[inline(always)]
524 pub const fn ptr() -> *const tmr0::RegisterBlock {
525 Self::PTR
526 }
527 #[doc = r" Steal an instance of this peripheral"]
528 #[doc = r""]
529 #[doc = r" # Safety"]
530 #[doc = r""]
531 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
532 #[doc = r" that may race with any existing instances, for example by only"]
533 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
534 #[doc = r" original peripheral and using critical sections to coordinate"]
535 #[doc = r" access between multiple new instances."]
536 #[doc = r""]
537 #[doc = r" Additionally, other software such as HALs may rely on only one"]
538 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
539 #[doc = r" no stolen instances are passed to such software."]
540 pub unsafe fn steal() -> Self {
541 Self {
542 _marker: PhantomData,
543 }
544 }
545}
546impl Deref for Tmr0 {
547 type Target = tmr0::RegisterBlock;
548 #[inline(always)]
549 fn deref(&self) -> &Self::Target {
550 unsafe { &*Self::PTR }
551 }
552}
553impl core::fmt::Debug for Tmr0 {
554 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
555 f.debug_struct("Tmr0").finish()
556 }
557}
558#[doc = "TMR controller registers"]
559pub mod tmr0;
560#[doc = "TMR controller registers"]
561pub struct Tmr1 {
562 _marker: PhantomData<*const ()>,
563}
564unsafe impl Send for Tmr1 {}
565impl Tmr1 {
566 #[doc = r"Pointer to the register block"]
567 pub const PTR: *const tmr0::RegisterBlock = 0x4004_9000 as *const _;
568 #[doc = r"Return the pointer to the register block"]
569 #[inline(always)]
570 pub const fn ptr() -> *const tmr0::RegisterBlock {
571 Self::PTR
572 }
573 #[doc = r" Steal an instance of this peripheral"]
574 #[doc = r""]
575 #[doc = r" # Safety"]
576 #[doc = r""]
577 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
578 #[doc = r" that may race with any existing instances, for example by only"]
579 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
580 #[doc = r" original peripheral and using critical sections to coordinate"]
581 #[doc = r" access between multiple new instances."]
582 #[doc = r""]
583 #[doc = r" Additionally, other software such as HALs may rely on only one"]
584 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
585 #[doc = r" no stolen instances are passed to such software."]
586 pub unsafe fn steal() -> Self {
587 Self {
588 _marker: PhantomData,
589 }
590 }
591}
592impl Deref for Tmr1 {
593 type Target = tmr0::RegisterBlock;
594 #[inline(always)]
595 fn deref(&self) -> &Self::Target {
596 unsafe { &*Self::PTR }
597 }
598}
599impl core::fmt::Debug for Tmr1 {
600 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
601 f.debug_struct("Tmr1").finish()
602 }
603}
604#[doc = "TMR controller registers"]
605pub use self::tmr0 as tmr1;
606#[doc = "TMR controller registers"]
607pub struct Tmr2 {
608 _marker: PhantomData<*const ()>,
609}
610unsafe impl Send for Tmr2 {}
611impl Tmr2 {
612 #[doc = r"Pointer to the register block"]
613 pub const PTR: *const tmr0::RegisterBlock = 0x4004_a000 as *const _;
614 #[doc = r"Return the pointer to the register block"]
615 #[inline(always)]
616 pub const fn ptr() -> *const tmr0::RegisterBlock {
617 Self::PTR
618 }
619 #[doc = r" Steal an instance of this peripheral"]
620 #[doc = r""]
621 #[doc = r" # Safety"]
622 #[doc = r""]
623 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
624 #[doc = r" that may race with any existing instances, for example by only"]
625 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
626 #[doc = r" original peripheral and using critical sections to coordinate"]
627 #[doc = r" access between multiple new instances."]
628 #[doc = r""]
629 #[doc = r" Additionally, other software such as HALs may rely on only one"]
630 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
631 #[doc = r" no stolen instances are passed to such software."]
632 pub unsafe fn steal() -> Self {
633 Self {
634 _marker: PhantomData,
635 }
636 }
637}
638impl Deref for Tmr2 {
639 type Target = tmr0::RegisterBlock;
640 #[inline(always)]
641 fn deref(&self) -> &Self::Target {
642 unsafe { &*Self::PTR }
643 }
644}
645impl core::fmt::Debug for Tmr2 {
646 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
647 f.debug_struct("Tmr2").finish()
648 }
649}
650#[doc = "TMR controller registers"]
651pub use self::tmr0 as tmr2;
652#[doc = "TMR controller registers"]
653pub struct Tmr3 {
654 _marker: PhantomData<*const ()>,
655}
656unsafe impl Send for Tmr3 {}
657impl Tmr3 {
658 #[doc = r"Pointer to the register block"]
659 pub const PTR: *const tmr0::RegisterBlock = 0x4004_b000 as *const _;
660 #[doc = r"Return the pointer to the register block"]
661 #[inline(always)]
662 pub const fn ptr() -> *const tmr0::RegisterBlock {
663 Self::PTR
664 }
665 #[doc = r" Steal an instance of this peripheral"]
666 #[doc = r""]
667 #[doc = r" # Safety"]
668 #[doc = r""]
669 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
670 #[doc = r" that may race with any existing instances, for example by only"]
671 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
672 #[doc = r" original peripheral and using critical sections to coordinate"]
673 #[doc = r" access between multiple new instances."]
674 #[doc = r""]
675 #[doc = r" Additionally, other software such as HALs may rely on only one"]
676 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
677 #[doc = r" no stolen instances are passed to such software."]
678 pub unsafe fn steal() -> Self {
679 Self {
680 _marker: PhantomData,
681 }
682 }
683}
684impl Deref for Tmr3 {
685 type Target = tmr0::RegisterBlock;
686 #[inline(always)]
687 fn deref(&self) -> &Self::Target {
688 unsafe { &*Self::PTR }
689 }
690}
691impl core::fmt::Debug for Tmr3 {
692 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
693 f.debug_struct("Tmr3").finish()
694 }
695}
696#[doc = "TMR controller registers"]
697pub use self::tmr0 as tmr3;
698#[doc = "ADC control registers"]
699pub struct Adc {
700 _marker: PhantomData<*const ()>,
701}
702unsafe impl Send for Adc {}
703impl Adc {
704 #[doc = r"Pointer to the register block"]
705 pub const PTR: *const adc::RegisterBlock = 0x4000_0000 as *const _;
706 #[doc = r"Return the pointer to the register block"]
707 #[inline(always)]
708 pub const fn ptr() -> *const adc::RegisterBlock {
709 Self::PTR
710 }
711 #[doc = r" Steal an instance of this peripheral"]
712 #[doc = r""]
713 #[doc = r" # Safety"]
714 #[doc = r""]
715 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
716 #[doc = r" that may race with any existing instances, for example by only"]
717 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
718 #[doc = r" original peripheral and using critical sections to coordinate"]
719 #[doc = r" access between multiple new instances."]
720 #[doc = r""]
721 #[doc = r" Additionally, other software such as HALs may rely on only one"]
722 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
723 #[doc = r" no stolen instances are passed to such software."]
724 pub unsafe fn steal() -> Self {
725 Self {
726 _marker: PhantomData,
727 }
728 }
729}
730impl Deref for Adc {
731 type Target = adc::RegisterBlock;
732 #[inline(always)]
733 fn deref(&self) -> &Self::Target {
734 unsafe { &*Self::PTR }
735 }
736}
737impl core::fmt::Debug for Adc {
738 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
739 f.debug_struct("Adc").finish()
740 }
741}
742#[doc = "ADC control registers"]
743pub mod adc;
744#[doc = "GPIO control registers"]
745pub struct Gpioa {
746 _marker: PhantomData<*const ()>,
747}
748unsafe impl Send for Gpioa {}
749impl Gpioa {
750 #[doc = r"Pointer to the register block"]
751 pub const PTR: *const gpioa::RegisterBlock = 0x4001_0000 as *const _;
752 #[doc = r"Return the pointer to the register block"]
753 #[inline(always)]
754 pub const fn ptr() -> *const gpioa::RegisterBlock {
755 Self::PTR
756 }
757 #[doc = r" Steal an instance of this peripheral"]
758 #[doc = r""]
759 #[doc = r" # Safety"]
760 #[doc = r""]
761 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
762 #[doc = r" that may race with any existing instances, for example by only"]
763 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
764 #[doc = r" original peripheral and using critical sections to coordinate"]
765 #[doc = r" access between multiple new instances."]
766 #[doc = r""]
767 #[doc = r" Additionally, other software such as HALs may rely on only one"]
768 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
769 #[doc = r" no stolen instances are passed to such software."]
770 pub unsafe fn steal() -> Self {
771 Self {
772 _marker: PhantomData,
773 }
774 }
775}
776impl Deref for Gpioa {
777 type Target = gpioa::RegisterBlock;
778 #[inline(always)]
779 fn deref(&self) -> &Self::Target {
780 unsafe { &*Self::PTR }
781 }
782}
783impl core::fmt::Debug for Gpioa {
784 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
785 f.debug_struct("Gpioa").finish()
786 }
787}
788#[doc = "GPIO control registers"]
789pub mod gpioa;
790#[doc = "GPIO control registers"]
791pub struct Gpiob {
792 _marker: PhantomData<*const ()>,
793}
794unsafe impl Send for Gpiob {}
795impl Gpiob {
796 #[doc = r"Pointer to the register block"]
797 pub const PTR: *const gpioa::RegisterBlock = 0x4001_1000 as *const _;
798 #[doc = r"Return the pointer to the register block"]
799 #[inline(always)]
800 pub const fn ptr() -> *const gpioa::RegisterBlock {
801 Self::PTR
802 }
803 #[doc = r" Steal an instance of this peripheral"]
804 #[doc = r""]
805 #[doc = r" # Safety"]
806 #[doc = r""]
807 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
808 #[doc = r" that may race with any existing instances, for example by only"]
809 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
810 #[doc = r" original peripheral and using critical sections to coordinate"]
811 #[doc = r" access between multiple new instances."]
812 #[doc = r""]
813 #[doc = r" Additionally, other software such as HALs may rely on only one"]
814 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
815 #[doc = r" no stolen instances are passed to such software."]
816 pub unsafe fn steal() -> Self {
817 Self {
818 _marker: PhantomData,
819 }
820 }
821}
822impl Deref for Gpiob {
823 type Target = gpioa::RegisterBlock;
824 #[inline(always)]
825 fn deref(&self) -> &Self::Target {
826 unsafe { &*Self::PTR }
827 }
828}
829impl core::fmt::Debug for Gpiob {
830 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
831 f.debug_struct("Gpiob").finish()
832 }
833}
834#[doc = "GPIO control registers"]
835pub use self::gpioa as gpiob;
836#[doc = "UART control registers"]
837pub struct Uart0 {
838 _marker: PhantomData<*const ()>,
839}
840unsafe impl Send for Uart0 {}
841impl Uart0 {
842 #[doc = r"Pointer to the register block"]
843 pub const PTR: *const uart0::RegisterBlock = 0x4004_5000 as *const _;
844 #[doc = r"Return the pointer to the register block"]
845 #[inline(always)]
846 pub const fn ptr() -> *const uart0::RegisterBlock {
847 Self::PTR
848 }
849 #[doc = r" Steal an instance of this peripheral"]
850 #[doc = r""]
851 #[doc = r" # Safety"]
852 #[doc = r""]
853 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
854 #[doc = r" that may race with any existing instances, for example by only"]
855 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
856 #[doc = r" original peripheral and using critical sections to coordinate"]
857 #[doc = r" access between multiple new instances."]
858 #[doc = r""]
859 #[doc = r" Additionally, other software such as HALs may rely on only one"]
860 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
861 #[doc = r" no stolen instances are passed to such software."]
862 pub unsafe fn steal() -> Self {
863 Self {
864 _marker: PhantomData,
865 }
866 }
867}
868impl Deref for Uart0 {
869 type Target = uart0::RegisterBlock;
870 #[inline(always)]
871 fn deref(&self) -> &Self::Target {
872 unsafe { &*Self::PTR }
873 }
874}
875impl core::fmt::Debug for Uart0 {
876 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
877 f.debug_struct("Uart0").finish()
878 }
879}
880#[doc = "UART control registers"]
881pub mod uart0;
882#[doc = "UART control registers"]
883pub struct Uart1 {
884 _marker: PhantomData<*const ()>,
885}
886unsafe impl Send for Uart1 {}
887impl Uart1 {
888 #[doc = r"Pointer to the register block"]
889 pub const PTR: *const uart0::RegisterBlock = 0x4004_6000 as *const _;
890 #[doc = r"Return the pointer to the register block"]
891 #[inline(always)]
892 pub const fn ptr() -> *const uart0::RegisterBlock {
893 Self::PTR
894 }
895 #[doc = r" Steal an instance of this peripheral"]
896 #[doc = r""]
897 #[doc = r" # Safety"]
898 #[doc = r""]
899 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
900 #[doc = r" that may race with any existing instances, for example by only"]
901 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
902 #[doc = r" original peripheral and using critical sections to coordinate"]
903 #[doc = r" access between multiple new instances."]
904 #[doc = r""]
905 #[doc = r" Additionally, other software such as HALs may rely on only one"]
906 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
907 #[doc = r" no stolen instances are passed to such software."]
908 pub unsafe fn steal() -> Self {
909 Self {
910 _marker: PhantomData,
911 }
912 }
913}
914impl Deref for Uart1 {
915 type Target = uart0::RegisterBlock;
916 #[inline(always)]
917 fn deref(&self) -> &Self::Target {
918 unsafe { &*Self::PTR }
919 }
920}
921impl core::fmt::Debug for Uart1 {
922 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
923 f.debug_struct("Uart1").finish()
924 }
925}
926#[doc = "UART control registers"]
927pub use self::uart0 as uart1;
928#[doc = "DMA control registers"]
929pub struct Dma {
930 _marker: PhantomData<*const ()>,
931}
932unsafe impl Send for Dma {}
933impl Dma {
934 #[doc = r"Pointer to the register block"]
935 pub const PTR: *const dma::RegisterBlock = 0x4004_4000 as *const _;
936 #[doc = r"Return the pointer to the register block"]
937 #[inline(always)]
938 pub const fn ptr() -> *const dma::RegisterBlock {
939 Self::PTR
940 }
941 #[doc = r" Steal an instance of this peripheral"]
942 #[doc = r""]
943 #[doc = r" # Safety"]
944 #[doc = r""]
945 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
946 #[doc = r" that may race with any existing instances, for example by only"]
947 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
948 #[doc = r" original peripheral and using critical sections to coordinate"]
949 #[doc = r" access between multiple new instances."]
950 #[doc = r""]
951 #[doc = r" Additionally, other software such as HALs may rely on only one"]
952 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
953 #[doc = r" no stolen instances are passed to such software."]
954 pub unsafe fn steal() -> Self {
955 Self {
956 _marker: PhantomData,
957 }
958 }
959}
960impl Deref for Dma {
961 type Target = dma::RegisterBlock;
962 #[inline(always)]
963 fn deref(&self) -> &Self::Target {
964 unsafe { &*Self::PTR }
965 }
966}
967impl core::fmt::Debug for Dma {
968 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
969 f.debug_struct("Dma").finish()
970 }
971}
972#[doc = "DMA control registers"]
973pub mod dma;
974#[doc = "Mainflash control registers"]
975pub struct Mflash {
976 _marker: PhantomData<*const ()>,
977}
978unsafe impl Send for Mflash {}
979impl Mflash {
980 #[doc = r"Pointer to the register block"]
981 pub const PTR: *const mflash::RegisterBlock = 0x4003_0000 as *const _;
982 #[doc = r"Return the pointer to the register block"]
983 #[inline(always)]
984 pub const fn ptr() -> *const mflash::RegisterBlock {
985 Self::PTR
986 }
987 #[doc = r" Steal an instance of this peripheral"]
988 #[doc = r""]
989 #[doc = r" # Safety"]
990 #[doc = r""]
991 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
992 #[doc = r" that may race with any existing instances, for example by only"]
993 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
994 #[doc = r" original peripheral and using critical sections to coordinate"]
995 #[doc = r" access between multiple new instances."]
996 #[doc = r""]
997 #[doc = r" Additionally, other software such as HALs may rely on only one"]
998 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
999 #[doc = r" no stolen instances are passed to such software."]
1000 pub unsafe fn steal() -> Self {
1001 Self {
1002 _marker: PhantomData,
1003 }
1004 }
1005}
1006impl Deref for Mflash {
1007 type Target = mflash::RegisterBlock;
1008 #[inline(always)]
1009 fn deref(&self) -> &Self::Target {
1010 unsafe { &*Self::PTR }
1011 }
1012}
1013impl core::fmt::Debug for Mflash {
1014 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1015 f.debug_struct("Mflash").finish()
1016 }
1017}
1018#[doc = "Mainflash control registers"]
1019pub mod mflash;
1020#[doc = "QEP controller registers"]
1021pub struct Qep {
1022 _marker: PhantomData<*const ()>,
1023}
1024unsafe impl Send for Qep {}
1025impl Qep {
1026 #[doc = r"Pointer to the register block"]
1027 pub const PTR: *const qep::RegisterBlock = 0x4004_f000 as *const _;
1028 #[doc = r"Return the pointer to the register block"]
1029 #[inline(always)]
1030 pub const fn ptr() -> *const qep::RegisterBlock {
1031 Self::PTR
1032 }
1033 #[doc = r" Steal an instance of this peripheral"]
1034 #[doc = r""]
1035 #[doc = r" # Safety"]
1036 #[doc = r""]
1037 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1038 #[doc = r" that may race with any existing instances, for example by only"]
1039 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1040 #[doc = r" original peripheral and using critical sections to coordinate"]
1041 #[doc = r" access between multiple new instances."]
1042 #[doc = r""]
1043 #[doc = r" Additionally, other software such as HALs may rely on only one"]
1044 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1045 #[doc = r" no stolen instances are passed to such software."]
1046 pub unsafe fn steal() -> Self {
1047 Self {
1048 _marker: PhantomData,
1049 }
1050 }
1051}
1052impl Deref for Qep {
1053 type Target = qep::RegisterBlock;
1054 #[inline(always)]
1055 fn deref(&self) -> &Self::Target {
1056 unsafe { &*Self::PTR }
1057 }
1058}
1059impl core::fmt::Debug for Qep {
1060 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1061 f.debug_struct("Qep").finish()
1062 }
1063}
1064#[doc = "QEP controller registers"]
1065pub mod qep;
1066#[doc = "ECAP controller registers"]
1067pub struct Ecap0 {
1068 _marker: PhantomData<*const ()>,
1069}
1070unsafe impl Send for Ecap0 {}
1071impl Ecap0 {
1072 #[doc = r"Pointer to the register block"]
1073 pub const PTR: *const ecap0::RegisterBlock = 0x4005_1000 as *const _;
1074 #[doc = r"Return the pointer to the register block"]
1075 #[inline(always)]
1076 pub const fn ptr() -> *const ecap0::RegisterBlock {
1077 Self::PTR
1078 }
1079 #[doc = r" Steal an instance of this peripheral"]
1080 #[doc = r""]
1081 #[doc = r" # Safety"]
1082 #[doc = r""]
1083 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1084 #[doc = r" that may race with any existing instances, for example by only"]
1085 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1086 #[doc = r" original peripheral and using critical sections to coordinate"]
1087 #[doc = r" access between multiple new instances."]
1088 #[doc = r""]
1089 #[doc = r" Additionally, other software such as HALs may rely on only one"]
1090 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1091 #[doc = r" no stolen instances are passed to such software."]
1092 pub unsafe fn steal() -> Self {
1093 Self {
1094 _marker: PhantomData,
1095 }
1096 }
1097}
1098impl Deref for Ecap0 {
1099 type Target = ecap0::RegisterBlock;
1100 #[inline(always)]
1101 fn deref(&self) -> &Self::Target {
1102 unsafe { &*Self::PTR }
1103 }
1104}
1105impl core::fmt::Debug for Ecap0 {
1106 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1107 f.debug_struct("Ecap0").finish()
1108 }
1109}
1110#[doc = "ECAP controller registers"]
1111pub mod ecap0;
1112#[doc = "ECAP controller registers"]
1113pub struct Ecap1 {
1114 _marker: PhantomData<*const ()>,
1115}
1116unsafe impl Send for Ecap1 {}
1117impl Ecap1 {
1118 #[doc = r"Pointer to the register block"]
1119 pub const PTR: *const ecap0::RegisterBlock = 0x4005_2000 as *const _;
1120 #[doc = r"Return the pointer to the register block"]
1121 #[inline(always)]
1122 pub const fn ptr() -> *const ecap0::RegisterBlock {
1123 Self::PTR
1124 }
1125 #[doc = r" Steal an instance of this peripheral"]
1126 #[doc = r""]
1127 #[doc = r" # Safety"]
1128 #[doc = r""]
1129 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1130 #[doc = r" that may race with any existing instances, for example by only"]
1131 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1132 #[doc = r" original peripheral and using critical sections to coordinate"]
1133 #[doc = r" access between multiple new instances."]
1134 #[doc = r""]
1135 #[doc = r" Additionally, other software such as HALs may rely on only one"]
1136 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1137 #[doc = r" no stolen instances are passed to such software."]
1138 pub unsafe fn steal() -> Self {
1139 Self {
1140 _marker: PhantomData,
1141 }
1142 }
1143}
1144impl Deref for Ecap1 {
1145 type Target = ecap0::RegisterBlock;
1146 #[inline(always)]
1147 fn deref(&self) -> &Self::Target {
1148 unsafe { &*Self::PTR }
1149 }
1150}
1151impl core::fmt::Debug for Ecap1 {
1152 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1153 f.debug_struct("Ecap1").finish()
1154 }
1155}
1156#[doc = "ECAP controller registers"]
1157pub use self::ecap0 as ecap1;
1158#[doc = "ECAP controller registers"]
1159pub struct Ecap2 {
1160 _marker: PhantomData<*const ()>,
1161}
1162unsafe impl Send for Ecap2 {}
1163impl Ecap2 {
1164 #[doc = r"Pointer to the register block"]
1165 pub const PTR: *const ecap0::RegisterBlock = 0x4005_3000 as *const _;
1166 #[doc = r"Return the pointer to the register block"]
1167 #[inline(always)]
1168 pub const fn ptr() -> *const ecap0::RegisterBlock {
1169 Self::PTR
1170 }
1171 #[doc = r" Steal an instance of this peripheral"]
1172 #[doc = r""]
1173 #[doc = r" # Safety"]
1174 #[doc = r""]
1175 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1176 #[doc = r" that may race with any existing instances, for example by only"]
1177 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1178 #[doc = r" original peripheral and using critical sections to coordinate"]
1179 #[doc = r" access between multiple new instances."]
1180 #[doc = r""]
1181 #[doc = r" Additionally, other software such as HALs may rely on only one"]
1182 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1183 #[doc = r" no stolen instances are passed to such software."]
1184 pub unsafe fn steal() -> Self {
1185 Self {
1186 _marker: PhantomData,
1187 }
1188 }
1189}
1190impl Deref for Ecap2 {
1191 type Target = ecap0::RegisterBlock;
1192 #[inline(always)]
1193 fn deref(&self) -> &Self::Target {
1194 unsafe { &*Self::PTR }
1195 }
1196}
1197impl core::fmt::Debug for Ecap2 {
1198 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1199 f.debug_struct("Ecap2").finish()
1200 }
1201}
1202#[doc = "ECAP controller registers"]
1203pub use self::ecap0 as ecap2;
1204#[doc = "PWM controller registers"]
1205pub struct Pwm0 {
1206 _marker: PhantomData<*const ()>,
1207}
1208unsafe impl Send for Pwm0 {}
1209impl Pwm0 {
1210 #[doc = r"Pointer to the register block"]
1211 pub const PTR: *const pwm0::RegisterBlock = 0x4004_c000 as *const _;
1212 #[doc = r"Return the pointer to the register block"]
1213 #[inline(always)]
1214 pub const fn ptr() -> *const pwm0::RegisterBlock {
1215 Self::PTR
1216 }
1217 #[doc = r" Steal an instance of this peripheral"]
1218 #[doc = r""]
1219 #[doc = r" # Safety"]
1220 #[doc = r""]
1221 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1222 #[doc = r" that may race with any existing instances, for example by only"]
1223 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1224 #[doc = r" original peripheral and using critical sections to coordinate"]
1225 #[doc = r" access between multiple new instances."]
1226 #[doc = r""]
1227 #[doc = r" Additionally, other software such as HALs may rely on only one"]
1228 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1229 #[doc = r" no stolen instances are passed to such software."]
1230 pub unsafe fn steal() -> Self {
1231 Self {
1232 _marker: PhantomData,
1233 }
1234 }
1235}
1236impl Deref for Pwm0 {
1237 type Target = pwm0::RegisterBlock;
1238 #[inline(always)]
1239 fn deref(&self) -> &Self::Target {
1240 unsafe { &*Self::PTR }
1241 }
1242}
1243impl core::fmt::Debug for Pwm0 {
1244 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1245 f.debug_struct("Pwm0").finish()
1246 }
1247}
1248#[doc = "PWM controller registers"]
1249pub mod pwm0;
1250#[doc = "PWM controller registers"]
1251pub struct Pwm1 {
1252 _marker: PhantomData<*const ()>,
1253}
1254unsafe impl Send for Pwm1 {}
1255impl Pwm1 {
1256 #[doc = r"Pointer to the register block"]
1257 pub const PTR: *const pwm0::RegisterBlock = 0x4004_d000 as *const _;
1258 #[doc = r"Return the pointer to the register block"]
1259 #[inline(always)]
1260 pub const fn ptr() -> *const pwm0::RegisterBlock {
1261 Self::PTR
1262 }
1263 #[doc = r" Steal an instance of this peripheral"]
1264 #[doc = r""]
1265 #[doc = r" # Safety"]
1266 #[doc = r""]
1267 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1268 #[doc = r" that may race with any existing instances, for example by only"]
1269 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1270 #[doc = r" original peripheral and using critical sections to coordinate"]
1271 #[doc = r" access between multiple new instances."]
1272 #[doc = r""]
1273 #[doc = r" Additionally, other software such as HALs may rely on only one"]
1274 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1275 #[doc = r" no stolen instances are passed to such software."]
1276 pub unsafe fn steal() -> Self {
1277 Self {
1278 _marker: PhantomData,
1279 }
1280 }
1281}
1282impl Deref for Pwm1 {
1283 type Target = pwm0::RegisterBlock;
1284 #[inline(always)]
1285 fn deref(&self) -> &Self::Target {
1286 unsafe { &*Self::PTR }
1287 }
1288}
1289impl core::fmt::Debug for Pwm1 {
1290 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1291 f.debug_struct("Pwm1").finish()
1292 }
1293}
1294#[doc = "PWM controller registers"]
1295pub use self::pwm0 as pwm1;
1296#[doc = "PWM controller registers"]
1297pub struct Pwm2 {
1298 _marker: PhantomData<*const ()>,
1299}
1300unsafe impl Send for Pwm2 {}
1301impl Pwm2 {
1302 #[doc = r"Pointer to the register block"]
1303 pub const PTR: *const pwm0::RegisterBlock = 0x4004_e000 as *const _;
1304 #[doc = r"Return the pointer to the register block"]
1305 #[inline(always)]
1306 pub const fn ptr() -> *const pwm0::RegisterBlock {
1307 Self::PTR
1308 }
1309 #[doc = r" Steal an instance of this peripheral"]
1310 #[doc = r""]
1311 #[doc = r" # Safety"]
1312 #[doc = r""]
1313 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1314 #[doc = r" that may race with any existing instances, for example by only"]
1315 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1316 #[doc = r" original peripheral and using critical sections to coordinate"]
1317 #[doc = r" access between multiple new instances."]
1318 #[doc = r""]
1319 #[doc = r" Additionally, other software such as HALs may rely on only one"]
1320 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1321 #[doc = r" no stolen instances are passed to such software."]
1322 pub unsafe fn steal() -> Self {
1323 Self {
1324 _marker: PhantomData,
1325 }
1326 }
1327}
1328impl Deref for Pwm2 {
1329 type Target = pwm0::RegisterBlock;
1330 #[inline(always)]
1331 fn deref(&self) -> &Self::Target {
1332 unsafe { &*Self::PTR }
1333 }
1334}
1335impl core::fmt::Debug for Pwm2 {
1336 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1337 f.debug_struct("Pwm2").finish()
1338 }
1339}
1340#[doc = "PWM controller registers"]
1341pub use self::pwm0 as pwm2;
1342#[doc = "SPI control registers"]
1343pub struct Spi {
1344 _marker: PhantomData<*const ()>,
1345}
1346unsafe impl Send for Spi {}
1347impl Spi {
1348 #[doc = r"Pointer to the register block"]
1349 pub const PTR: *const spi::RegisterBlock = 0x4004_7000 as *const _;
1350 #[doc = r"Return the pointer to the register block"]
1351 #[inline(always)]
1352 pub const fn ptr() -> *const spi::RegisterBlock {
1353 Self::PTR
1354 }
1355 #[doc = r" Steal an instance of this peripheral"]
1356 #[doc = r""]
1357 #[doc = r" # Safety"]
1358 #[doc = r""]
1359 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1360 #[doc = r" that may race with any existing instances, for example by only"]
1361 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1362 #[doc = r" original peripheral and using critical sections to coordinate"]
1363 #[doc = r" access between multiple new instances."]
1364 #[doc = r""]
1365 #[doc = r" Additionally, other software such as HALs may rely on only one"]
1366 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1367 #[doc = r" no stolen instances are passed to such software."]
1368 pub unsafe fn steal() -> Self {
1369 Self {
1370 _marker: PhantomData,
1371 }
1372 }
1373}
1374impl Deref for Spi {
1375 type Target = spi::RegisterBlock;
1376 #[inline(always)]
1377 fn deref(&self) -> &Self::Target {
1378 unsafe { &*Self::PTR }
1379 }
1380}
1381impl core::fmt::Debug for Spi {
1382 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1383 f.debug_struct("Spi").finish()
1384 }
1385}
1386#[doc = "SPI control registers"]
1387pub mod spi;
1388#[doc = "I2C controller registers"]
1389pub struct I2c {
1390 _marker: PhantomData<*const ()>,
1391}
1392unsafe impl Send for I2c {}
1393impl I2c {
1394 #[doc = r"Pointer to the register block"]
1395 pub const PTR: *const i2c::RegisterBlock = 0x4005_0000 as *const _;
1396 #[doc = r"Return the pointer to the register block"]
1397 #[inline(always)]
1398 pub const fn ptr() -> *const i2c::RegisterBlock {
1399 Self::PTR
1400 }
1401 #[doc = r" Steal an instance of this peripheral"]
1402 #[doc = r""]
1403 #[doc = r" # Safety"]
1404 #[doc = r""]
1405 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1406 #[doc = r" that may race with any existing instances, for example by only"]
1407 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1408 #[doc = r" original peripheral and using critical sections to coordinate"]
1409 #[doc = r" access between multiple new instances."]
1410 #[doc = r""]
1411 #[doc = r" Additionally, other software such as HALs may rely on only one"]
1412 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1413 #[doc = r" no stolen instances are passed to such software."]
1414 pub unsafe fn steal() -> Self {
1415 Self {
1416 _marker: PhantomData,
1417 }
1418 }
1419}
1420impl Deref for I2c {
1421 type Target = i2c::RegisterBlock;
1422 #[inline(always)]
1423 fn deref(&self) -> &Self::Target {
1424 unsafe { &*Self::PTR }
1425 }
1426}
1427impl core::fmt::Debug for I2c {
1428 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1429 f.debug_struct("I2c").finish()
1430 }
1431}
1432#[doc = "I2C controller registers"]
1433pub mod i2c;
1434#[doc = "CAN controller registers"]
1435pub struct Can {
1436 _marker: PhantomData<*const ()>,
1437}
1438unsafe impl Send for Can {}
1439impl Can {
1440 #[doc = r"Pointer to the register block"]
1441 pub const PTR: *const can::RegisterBlock = 0x4002_0000 as *const _;
1442 #[doc = r"Return the pointer to the register block"]
1443 #[inline(always)]
1444 pub const fn ptr() -> *const can::RegisterBlock {
1445 Self::PTR
1446 }
1447 #[doc = r" Steal an instance of this peripheral"]
1448 #[doc = r""]
1449 #[doc = r" # Safety"]
1450 #[doc = r""]
1451 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1452 #[doc = r" that may race with any existing instances, for example by only"]
1453 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1454 #[doc = r" original peripheral and using critical sections to coordinate"]
1455 #[doc = r" access between multiple new instances."]
1456 #[doc = r""]
1457 #[doc = r" Additionally, other software such as HALs may rely on only one"]
1458 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1459 #[doc = r" no stolen instances are passed to such software."]
1460 pub unsafe fn steal() -> Self {
1461 Self {
1462 _marker: PhantomData,
1463 }
1464 }
1465}
1466impl Deref for Can {
1467 type Target = can::RegisterBlock;
1468 #[inline(always)]
1469 fn deref(&self) -> &Self::Target {
1470 unsafe { &*Self::PTR }
1471 }
1472}
1473impl core::fmt::Debug for Can {
1474 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1475 f.debug_struct("Can").finish()
1476 }
1477}
1478#[doc = "CAN controller registers"]
1479pub mod can;
1480#[doc = "CAN Msg registers"]
1481pub struct Canmsg {
1482 _marker: PhantomData<*const ()>,
1483}
1484unsafe impl Send for Canmsg {}
1485impl Canmsg {
1486 #[doc = r"Pointer to the register block"]
1487 pub const PTR: *const canmsg::RegisterBlock = 0x4002_1000 as *const _;
1488 #[doc = r"Return the pointer to the register block"]
1489 #[inline(always)]
1490 pub const fn ptr() -> *const canmsg::RegisterBlock {
1491 Self::PTR
1492 }
1493 #[doc = r" Steal an instance of this peripheral"]
1494 #[doc = r""]
1495 #[doc = r" # Safety"]
1496 #[doc = r""]
1497 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1498 #[doc = r" that may race with any existing instances, for example by only"]
1499 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1500 #[doc = r" original peripheral and using critical sections to coordinate"]
1501 #[doc = r" access between multiple new instances."]
1502 #[doc = r""]
1503 #[doc = r" Additionally, other software such as HALs may rely on only one"]
1504 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1505 #[doc = r" no stolen instances are passed to such software."]
1506 pub unsafe fn steal() -> Self {
1507 Self {
1508 _marker: PhantomData,
1509 }
1510 }
1511}
1512impl Deref for Canmsg {
1513 type Target = canmsg::RegisterBlock;
1514 #[inline(always)]
1515 fn deref(&self) -> &Self::Target {
1516 unsafe { &*Self::PTR }
1517 }
1518}
1519impl core::fmt::Debug for Canmsg {
1520 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1521 f.debug_struct("Canmsg").finish()
1522 }
1523}
1524#[doc = "CAN Msg registers"]
1525pub mod canmsg;
1526#[no_mangle]
1527static mut DEVICE_PERIPHERALS: bool = false;
1528#[doc = r" All the peripherals."]
1529#[allow(non_snake_case)]
1530pub struct Peripherals {
1531 #[doc = "SIU"]
1532 pub siu: Siu,
1533 #[doc = "RCU"]
1534 pub rcu: Rcu,
1535 #[doc = "PMU"]
1536 pub pmu: Pmu,
1537 #[doc = "WDT"]
1538 pub wdt: Wdt,
1539 #[doc = "TMR0"]
1540 pub tmr0: Tmr0,
1541 #[doc = "TMR1"]
1542 pub tmr1: Tmr1,
1543 #[doc = "TMR2"]
1544 pub tmr2: Tmr2,
1545 #[doc = "TMR3"]
1546 pub tmr3: Tmr3,
1547 #[doc = "ADC"]
1548 pub adc: Adc,
1549 #[doc = "GPIOA"]
1550 pub gpioa: Gpioa,
1551 #[doc = "GPIOB"]
1552 pub gpiob: Gpiob,
1553 #[doc = "UART0"]
1554 pub uart0: Uart0,
1555 #[doc = "UART1"]
1556 pub uart1: Uart1,
1557 #[doc = "DMA"]
1558 pub dma: Dma,
1559 #[doc = "MFLASH"]
1560 pub mflash: Mflash,
1561 #[doc = "QEP"]
1562 pub qep: Qep,
1563 #[doc = "ECAP0"]
1564 pub ecap0: Ecap0,
1565 #[doc = "ECAP1"]
1566 pub ecap1: Ecap1,
1567 #[doc = "ECAP2"]
1568 pub ecap2: Ecap2,
1569 #[doc = "PWM0"]
1570 pub pwm0: Pwm0,
1571 #[doc = "PWM1"]
1572 pub pwm1: Pwm1,
1573 #[doc = "PWM2"]
1574 pub pwm2: Pwm2,
1575 #[doc = "SPI"]
1576 pub spi: Spi,
1577 #[doc = "I2C"]
1578 pub i2c: I2c,
1579 #[doc = "CAN"]
1580 pub can: Can,
1581 #[doc = "CANMSG"]
1582 pub canmsg: Canmsg,
1583}
1584impl Peripherals {
1585 #[doc = r" Returns all the peripherals *once*."]
1586 #[cfg(feature = "critical-section")]
1587 #[inline]
1588 pub fn take() -> Option<Self> {
1589 critical_section::with(|_| {
1590 if unsafe { DEVICE_PERIPHERALS } {
1591 return None;
1592 }
1593 Some(unsafe { Peripherals::steal() })
1594 })
1595 }
1596 #[doc = r" Unchecked version of `Peripherals::take`."]
1597 #[doc = r""]
1598 #[doc = r" # Safety"]
1599 #[doc = r""]
1600 #[doc = r" Each of the returned peripherals must be used at most once."]
1601 #[inline]
1602 pub unsafe fn steal() -> Self {
1603 DEVICE_PERIPHERALS = true;
1604 Peripherals {
1605 siu: Siu {
1606 _marker: PhantomData,
1607 },
1608 rcu: Rcu {
1609 _marker: PhantomData,
1610 },
1611 pmu: Pmu {
1612 _marker: PhantomData,
1613 },
1614 wdt: Wdt {
1615 _marker: PhantomData,
1616 },
1617 tmr0: Tmr0 {
1618 _marker: PhantomData,
1619 },
1620 tmr1: Tmr1 {
1621 _marker: PhantomData,
1622 },
1623 tmr2: Tmr2 {
1624 _marker: PhantomData,
1625 },
1626 tmr3: Tmr3 {
1627 _marker: PhantomData,
1628 },
1629 adc: Adc {
1630 _marker: PhantomData,
1631 },
1632 gpioa: Gpioa {
1633 _marker: PhantomData,
1634 },
1635 gpiob: Gpiob {
1636 _marker: PhantomData,
1637 },
1638 uart0: Uart0 {
1639 _marker: PhantomData,
1640 },
1641 uart1: Uart1 {
1642 _marker: PhantomData,
1643 },
1644 dma: Dma {
1645 _marker: PhantomData,
1646 },
1647 mflash: Mflash {
1648 _marker: PhantomData,
1649 },
1650 qep: Qep {
1651 _marker: PhantomData,
1652 },
1653 ecap0: Ecap0 {
1654 _marker: PhantomData,
1655 },
1656 ecap1: Ecap1 {
1657 _marker: PhantomData,
1658 },
1659 ecap2: Ecap2 {
1660 _marker: PhantomData,
1661 },
1662 pwm0: Pwm0 {
1663 _marker: PhantomData,
1664 },
1665 pwm1: Pwm1 {
1666 _marker: PhantomData,
1667 },
1668 pwm2: Pwm2 {
1669 _marker: PhantomData,
1670 },
1671 spi: Spi {
1672 _marker: PhantomData,
1673 },
1674 i2c: I2c {
1675 _marker: PhantomData,
1676 },
1677 can: Can {
1678 _marker: PhantomData,
1679 },
1680 canmsg: Canmsg {
1681 _marker: PhantomData,
1682 },
1683 }
1684 }
1685}