e310x/
lib.rs

1#![doc = "Peripheral access API for FE310 microcontrollers (generated using svd2rust v0.34.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.34.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#![allow(non_camel_case_types)]
4#![allow(non_snake_case)]
5#![no_std]
6use core::marker::PhantomData;
7use core::ops::Deref;
8#[allow(unused_imports)]
9use generic::*;
10#[doc = "Common register and bit access and modify traits"]
11pub mod generic;
12#[doc = r" Interrupt numbers, priority levels, and HART IDs."]
13pub mod interrupt;
14riscv_peripheral :: clint_codegen ! (base 0x2000000 , freq 32768 , mtimecmps [mtimecmp0 = (crate :: interrupt :: Hart :: H0 , "[0](crate::interrupt::Hart::H0)")] , msips [msip0 = (crate :: interrupt :: Hart :: H0 , "[0](crate::interrupt::Hart::H0)")] ,);
15riscv_peripheral :: plic_codegen ! (base 0xC000000 , ctxs [ctx0 = (crate :: interrupt :: Hart :: H0 , "[0](crate::interrupt::Hart::H0)")] ,);
16#[doc = "Watchdog"]
17pub struct Wdog {
18    _marker: PhantomData<*const ()>,
19}
20unsafe impl Send for Wdog {}
21impl Wdog {
22    #[doc = r"Pointer to the register block"]
23    pub const PTR: *const wdog::RegisterBlock = 0x1000_0000 as *const _;
24    #[doc = r"Return the pointer to the register block"]
25    #[inline(always)]
26    pub const fn ptr() -> *const wdog::RegisterBlock {
27        Self::PTR
28    }
29    #[doc = r" Steal an instance of this peripheral"]
30    #[doc = r""]
31    #[doc = r" # Safety"]
32    #[doc = r""]
33    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
34    #[doc = r" that may race with any existing instances, for example by only"]
35    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
36    #[doc = r" original peripheral and using critical sections to coordinate"]
37    #[doc = r" access between multiple new instances."]
38    #[doc = r""]
39    #[doc = r" Additionally, other software such as HALs may rely on only one"]
40    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
41    #[doc = r" no stolen instances are passed to such software."]
42    pub unsafe fn steal() -> Self {
43        Self {
44            _marker: PhantomData,
45        }
46    }
47}
48impl Deref for Wdog {
49    type Target = wdog::RegisterBlock;
50    #[inline(always)]
51    fn deref(&self) -> &Self::Target {
52        unsafe { &*Self::PTR }
53    }
54}
55impl core::fmt::Debug for Wdog {
56    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
57        f.debug_struct("Wdog").finish()
58    }
59}
60#[doc = "Watchdog"]
61pub mod wdog;
62#[doc = "Watchdog"]
63pub struct Rtc {
64    _marker: PhantomData<*const ()>,
65}
66unsafe impl Send for Rtc {}
67impl Rtc {
68    #[doc = r"Pointer to the register block"]
69    pub const PTR: *const rtc::RegisterBlock = 0x1000_0000 as *const _;
70    #[doc = r"Return the pointer to the register block"]
71    #[inline(always)]
72    pub const fn ptr() -> *const rtc::RegisterBlock {
73        Self::PTR
74    }
75    #[doc = r" Steal an instance of this peripheral"]
76    #[doc = r""]
77    #[doc = r" # Safety"]
78    #[doc = r""]
79    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
80    #[doc = r" that may race with any existing instances, for example by only"]
81    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
82    #[doc = r" original peripheral and using critical sections to coordinate"]
83    #[doc = r" access between multiple new instances."]
84    #[doc = r""]
85    #[doc = r" Additionally, other software such as HALs may rely on only one"]
86    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
87    #[doc = r" no stolen instances are passed to such software."]
88    pub unsafe fn steal() -> Self {
89        Self {
90            _marker: PhantomData,
91        }
92    }
93}
94impl Deref for Rtc {
95    type Target = rtc::RegisterBlock;
96    #[inline(always)]
97    fn deref(&self) -> &Self::Target {
98        unsafe { &*Self::PTR }
99    }
100}
101impl core::fmt::Debug for Rtc {
102    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
103        f.debug_struct("Rtc").finish()
104    }
105}
106#[doc = "Watchdog"]
107pub mod rtc;
108#[doc = "Always-On Clock Configuration"]
109pub struct Aonclk {
110    _marker: PhantomData<*const ()>,
111}
112unsafe impl Send for Aonclk {}
113impl Aonclk {
114    #[doc = r"Pointer to the register block"]
115    pub const PTR: *const aonclk::RegisterBlock = 0x1000_0000 as *const _;
116    #[doc = r"Return the pointer to the register block"]
117    #[inline(always)]
118    pub const fn ptr() -> *const aonclk::RegisterBlock {
119        Self::PTR
120    }
121    #[doc = r" Steal an instance of this peripheral"]
122    #[doc = r""]
123    #[doc = r" # Safety"]
124    #[doc = r""]
125    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
126    #[doc = r" that may race with any existing instances, for example by only"]
127    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
128    #[doc = r" original peripheral and using critical sections to coordinate"]
129    #[doc = r" access between multiple new instances."]
130    #[doc = r""]
131    #[doc = r" Additionally, other software such as HALs may rely on only one"]
132    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
133    #[doc = r" no stolen instances are passed to such software."]
134    pub unsafe fn steal() -> Self {
135        Self {
136            _marker: PhantomData,
137        }
138    }
139}
140impl Deref for Aonclk {
141    type Target = aonclk::RegisterBlock;
142    #[inline(always)]
143    fn deref(&self) -> &Self::Target {
144        unsafe { &*Self::PTR }
145    }
146}
147impl core::fmt::Debug for Aonclk {
148    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
149        f.debug_struct("Aonclk").finish()
150    }
151}
152#[doc = "Always-On Clock Configuration"]
153pub mod aonclk;
154#[doc = "Backup Registers"]
155pub struct Backup {
156    _marker: PhantomData<*const ()>,
157}
158unsafe impl Send for Backup {}
159impl Backup {
160    #[doc = r"Pointer to the register block"]
161    pub const PTR: *const backup::RegisterBlock = 0x1000_0000 as *const _;
162    #[doc = r"Return the pointer to the register block"]
163    #[inline(always)]
164    pub const fn ptr() -> *const backup::RegisterBlock {
165        Self::PTR
166    }
167    #[doc = r" Steal an instance of this peripheral"]
168    #[doc = r""]
169    #[doc = r" # Safety"]
170    #[doc = r""]
171    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
172    #[doc = r" that may race with any existing instances, for example by only"]
173    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
174    #[doc = r" original peripheral and using critical sections to coordinate"]
175    #[doc = r" access between multiple new instances."]
176    #[doc = r""]
177    #[doc = r" Additionally, other software such as HALs may rely on only one"]
178    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
179    #[doc = r" no stolen instances are passed to such software."]
180    pub unsafe fn steal() -> Self {
181        Self {
182            _marker: PhantomData,
183        }
184    }
185}
186impl Deref for Backup {
187    type Target = backup::RegisterBlock;
188    #[inline(always)]
189    fn deref(&self) -> &Self::Target {
190        unsafe { &*Self::PTR }
191    }
192}
193impl core::fmt::Debug for Backup {
194    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
195        f.debug_struct("Backup").finish()
196    }
197}
198#[doc = "Backup Registers"]
199pub mod backup;
200#[doc = "PMU"]
201pub struct Pmu {
202    _marker: PhantomData<*const ()>,
203}
204unsafe impl Send for Pmu {}
205impl Pmu {
206    #[doc = r"Pointer to the register block"]
207    pub const PTR: *const pmu::RegisterBlock = 0x1000_0000 as *const _;
208    #[doc = r"Return the pointer to the register block"]
209    #[inline(always)]
210    pub const fn ptr() -> *const pmu::RegisterBlock {
211        Self::PTR
212    }
213    #[doc = r" Steal an instance of this peripheral"]
214    #[doc = r""]
215    #[doc = r" # Safety"]
216    #[doc = r""]
217    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
218    #[doc = r" that may race with any existing instances, for example by only"]
219    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
220    #[doc = r" original peripheral and using critical sections to coordinate"]
221    #[doc = r" access between multiple new instances."]
222    #[doc = r""]
223    #[doc = r" Additionally, other software such as HALs may rely on only one"]
224    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
225    #[doc = r" no stolen instances are passed to such software."]
226    pub unsafe fn steal() -> Self {
227        Self {
228            _marker: PhantomData,
229        }
230    }
231}
232impl Deref for Pmu {
233    type Target = pmu::RegisterBlock;
234    #[inline(always)]
235    fn deref(&self) -> &Self::Target {
236        unsafe { &*Self::PTR }
237    }
238}
239impl core::fmt::Debug for Pmu {
240    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
241        f.debug_struct("Pmu").finish()
242    }
243}
244#[doc = "PMU"]
245pub mod pmu;
246#[doc = "Power Reset Clock Interrupts"]
247pub struct Prci {
248    _marker: PhantomData<*const ()>,
249}
250unsafe impl Send for Prci {}
251impl Prci {
252    #[doc = r"Pointer to the register block"]
253    pub const PTR: *const prci::RegisterBlock = 0x1000_8000 as *const _;
254    #[doc = r"Return the pointer to the register block"]
255    #[inline(always)]
256    pub const fn ptr() -> *const prci::RegisterBlock {
257        Self::PTR
258    }
259    #[doc = r" Steal an instance of this peripheral"]
260    #[doc = r""]
261    #[doc = r" # Safety"]
262    #[doc = r""]
263    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
264    #[doc = r" that may race with any existing instances, for example by only"]
265    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
266    #[doc = r" original peripheral and using critical sections to coordinate"]
267    #[doc = r" access between multiple new instances."]
268    #[doc = r""]
269    #[doc = r" Additionally, other software such as HALs may rely on only one"]
270    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
271    #[doc = r" no stolen instances are passed to such software."]
272    pub unsafe fn steal() -> Self {
273        Self {
274            _marker: PhantomData,
275        }
276    }
277}
278impl Deref for Prci {
279    type Target = prci::RegisterBlock;
280    #[inline(always)]
281    fn deref(&self) -> &Self::Target {
282        unsafe { &*Self::PTR }
283    }
284}
285impl core::fmt::Debug for Prci {
286    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
287        f.debug_struct("Prci").finish()
288    }
289}
290#[doc = "Power Reset Clock Interrupts"]
291pub mod prci;
292#[doc = "One Time Programmable Memory"]
293pub struct Otp {
294    _marker: PhantomData<*const ()>,
295}
296unsafe impl Send for Otp {}
297impl Otp {
298    #[doc = r"Pointer to the register block"]
299    pub const PTR: *const otp::RegisterBlock = 0x1001_0000 as *const _;
300    #[doc = r"Return the pointer to the register block"]
301    #[inline(always)]
302    pub const fn ptr() -> *const otp::RegisterBlock {
303        Self::PTR
304    }
305    #[doc = r" Steal an instance of this peripheral"]
306    #[doc = r""]
307    #[doc = r" # Safety"]
308    #[doc = r""]
309    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
310    #[doc = r" that may race with any existing instances, for example by only"]
311    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
312    #[doc = r" original peripheral and using critical sections to coordinate"]
313    #[doc = r" access between multiple new instances."]
314    #[doc = r""]
315    #[doc = r" Additionally, other software such as HALs may rely on only one"]
316    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
317    #[doc = r" no stolen instances are passed to such software."]
318    pub unsafe fn steal() -> Self {
319        Self {
320            _marker: PhantomData,
321        }
322    }
323}
324impl Deref for Otp {
325    type Target = otp::RegisterBlock;
326    #[inline(always)]
327    fn deref(&self) -> &Self::Target {
328        unsafe { &*Self::PTR }
329    }
330}
331impl core::fmt::Debug for Otp {
332    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
333        f.debug_struct("Otp").finish()
334    }
335}
336#[doc = "One Time Programmable Memory"]
337pub mod otp;
338#[doc = "General Purpose Input Output"]
339pub struct Gpio0 {
340    _marker: PhantomData<*const ()>,
341}
342unsafe impl Send for Gpio0 {}
343impl Gpio0 {
344    #[doc = r"Pointer to the register block"]
345    pub const PTR: *const gpio0::RegisterBlock = 0x1001_2000 as *const _;
346    #[doc = r"Return the pointer to the register block"]
347    #[inline(always)]
348    pub const fn ptr() -> *const gpio0::RegisterBlock {
349        Self::PTR
350    }
351    #[doc = r" Steal an instance of this peripheral"]
352    #[doc = r""]
353    #[doc = r" # Safety"]
354    #[doc = r""]
355    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
356    #[doc = r" that may race with any existing instances, for example by only"]
357    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
358    #[doc = r" original peripheral and using critical sections to coordinate"]
359    #[doc = r" access between multiple new instances."]
360    #[doc = r""]
361    #[doc = r" Additionally, other software such as HALs may rely on only one"]
362    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
363    #[doc = r" no stolen instances are passed to such software."]
364    pub unsafe fn steal() -> Self {
365        Self {
366            _marker: PhantomData,
367        }
368    }
369}
370impl Deref for Gpio0 {
371    type Target = gpio0::RegisterBlock;
372    #[inline(always)]
373    fn deref(&self) -> &Self::Target {
374        unsafe { &*Self::PTR }
375    }
376}
377impl core::fmt::Debug for Gpio0 {
378    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
379        f.debug_struct("Gpio0").finish()
380    }
381}
382#[doc = "General Purpose Input Output"]
383pub mod gpio0;
384#[doc = "Universal Asynchronous Receiver Transmitter"]
385pub struct Uart0 {
386    _marker: PhantomData<*const ()>,
387}
388unsafe impl Send for Uart0 {}
389impl Uart0 {
390    #[doc = r"Pointer to the register block"]
391    pub const PTR: *const uart0::RegisterBlock = 0x1001_3000 as *const _;
392    #[doc = r"Return the pointer to the register block"]
393    #[inline(always)]
394    pub const fn ptr() -> *const uart0::RegisterBlock {
395        Self::PTR
396    }
397    #[doc = r" Steal an instance of this peripheral"]
398    #[doc = r""]
399    #[doc = r" # Safety"]
400    #[doc = r""]
401    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
402    #[doc = r" that may race with any existing instances, for example by only"]
403    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
404    #[doc = r" original peripheral and using critical sections to coordinate"]
405    #[doc = r" access between multiple new instances."]
406    #[doc = r""]
407    #[doc = r" Additionally, other software such as HALs may rely on only one"]
408    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
409    #[doc = r" no stolen instances are passed to such software."]
410    pub unsafe fn steal() -> Self {
411        Self {
412            _marker: PhantomData,
413        }
414    }
415}
416impl Deref for Uart0 {
417    type Target = uart0::RegisterBlock;
418    #[inline(always)]
419    fn deref(&self) -> &Self::Target {
420        unsafe { &*Self::PTR }
421    }
422}
423impl core::fmt::Debug for Uart0 {
424    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
425        f.debug_struct("Uart0").finish()
426    }
427}
428#[doc = "Universal Asynchronous Receiver Transmitter"]
429pub mod uart0;
430#[doc = "Quad Serial Peripheral Interface"]
431pub struct Qspi0 {
432    _marker: PhantomData<*const ()>,
433}
434unsafe impl Send for Qspi0 {}
435impl Qspi0 {
436    #[doc = r"Pointer to the register block"]
437    pub const PTR: *const qspi0::RegisterBlock = 0x1001_4000 as *const _;
438    #[doc = r"Return the pointer to the register block"]
439    #[inline(always)]
440    pub const fn ptr() -> *const qspi0::RegisterBlock {
441        Self::PTR
442    }
443    #[doc = r" Steal an instance of this peripheral"]
444    #[doc = r""]
445    #[doc = r" # Safety"]
446    #[doc = r""]
447    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
448    #[doc = r" that may race with any existing instances, for example by only"]
449    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
450    #[doc = r" original peripheral and using critical sections to coordinate"]
451    #[doc = r" access between multiple new instances."]
452    #[doc = r""]
453    #[doc = r" Additionally, other software such as HALs may rely on only one"]
454    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
455    #[doc = r" no stolen instances are passed to such software."]
456    pub unsafe fn steal() -> Self {
457        Self {
458            _marker: PhantomData,
459        }
460    }
461}
462impl Deref for Qspi0 {
463    type Target = qspi0::RegisterBlock;
464    #[inline(always)]
465    fn deref(&self) -> &Self::Target {
466        unsafe { &*Self::PTR }
467    }
468}
469impl core::fmt::Debug for Qspi0 {
470    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
471        f.debug_struct("Qspi0").finish()
472    }
473}
474#[doc = "Quad Serial Peripheral Interface"]
475pub mod qspi0;
476#[doc = "8-bit timer with 4 cmp"]
477pub struct Pwm0 {
478    _marker: PhantomData<*const ()>,
479}
480unsafe impl Send for Pwm0 {}
481impl Pwm0 {
482    #[doc = r"Pointer to the register block"]
483    pub const PTR: *const pwm0::RegisterBlock = 0x1001_5000 as *const _;
484    #[doc = r"Return the pointer to the register block"]
485    #[inline(always)]
486    pub const fn ptr() -> *const pwm0::RegisterBlock {
487        Self::PTR
488    }
489    #[doc = r" Steal an instance of this peripheral"]
490    #[doc = r""]
491    #[doc = r" # Safety"]
492    #[doc = r""]
493    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
494    #[doc = r" that may race with any existing instances, for example by only"]
495    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
496    #[doc = r" original peripheral and using critical sections to coordinate"]
497    #[doc = r" access between multiple new instances."]
498    #[doc = r""]
499    #[doc = r" Additionally, other software such as HALs may rely on only one"]
500    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
501    #[doc = r" no stolen instances are passed to such software."]
502    pub unsafe fn steal() -> Self {
503        Self {
504            _marker: PhantomData,
505        }
506    }
507}
508impl Deref for Pwm0 {
509    type Target = pwm0::RegisterBlock;
510    #[inline(always)]
511    fn deref(&self) -> &Self::Target {
512        unsafe { &*Self::PTR }
513    }
514}
515impl core::fmt::Debug for Pwm0 {
516    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
517        f.debug_struct("Pwm0").finish()
518    }
519}
520#[doc = "8-bit timer with 4 cmp"]
521pub mod pwm0;
522#[doc = "Inter-Integrated Circuit Master Interface (FE310-G002 only)"]
523pub struct I2c0 {
524    _marker: PhantomData<*const ()>,
525}
526unsafe impl Send for I2c0 {}
527impl I2c0 {
528    #[doc = r"Pointer to the register block"]
529    pub const PTR: *const i2c0::RegisterBlock = 0x1001_6000 as *const _;
530    #[doc = r"Return the pointer to the register block"]
531    #[inline(always)]
532    pub const fn ptr() -> *const i2c0::RegisterBlock {
533        Self::PTR
534    }
535    #[doc = r" Steal an instance of this peripheral"]
536    #[doc = r""]
537    #[doc = r" # Safety"]
538    #[doc = r""]
539    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
540    #[doc = r" that may race with any existing instances, for example by only"]
541    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
542    #[doc = r" original peripheral and using critical sections to coordinate"]
543    #[doc = r" access between multiple new instances."]
544    #[doc = r""]
545    #[doc = r" Additionally, other software such as HALs may rely on only one"]
546    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
547    #[doc = r" no stolen instances are passed to such software."]
548    pub unsafe fn steal() -> Self {
549        Self {
550            _marker: PhantomData,
551        }
552    }
553}
554impl Deref for I2c0 {
555    type Target = i2c0::RegisterBlock;
556    #[inline(always)]
557    fn deref(&self) -> &Self::Target {
558        unsafe { &*Self::PTR }
559    }
560}
561impl core::fmt::Debug for I2c0 {
562    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
563        f.debug_struct("I2c0").finish()
564    }
565}
566#[doc = "Inter-Integrated Circuit Master Interface (FE310-G002 only)"]
567pub mod i2c0;
568#[doc = "Universal Asynchronous Receiver Transmitter"]
569pub struct Uart1 {
570    _marker: PhantomData<*const ()>,
571}
572unsafe impl Send for Uart1 {}
573impl Uart1 {
574    #[doc = r"Pointer to the register block"]
575    pub const PTR: *const uart0::RegisterBlock = 0x1002_3000 as *const _;
576    #[doc = r"Return the pointer to the register block"]
577    #[inline(always)]
578    pub const fn ptr() -> *const uart0::RegisterBlock {
579        Self::PTR
580    }
581    #[doc = r" Steal an instance of this peripheral"]
582    #[doc = r""]
583    #[doc = r" # Safety"]
584    #[doc = r""]
585    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
586    #[doc = r" that may race with any existing instances, for example by only"]
587    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
588    #[doc = r" original peripheral and using critical sections to coordinate"]
589    #[doc = r" access between multiple new instances."]
590    #[doc = r""]
591    #[doc = r" Additionally, other software such as HALs may rely on only one"]
592    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
593    #[doc = r" no stolen instances are passed to such software."]
594    pub unsafe fn steal() -> Self {
595        Self {
596            _marker: PhantomData,
597        }
598    }
599}
600impl Deref for Uart1 {
601    type Target = uart0::RegisterBlock;
602    #[inline(always)]
603    fn deref(&self) -> &Self::Target {
604        unsafe { &*Self::PTR }
605    }
606}
607impl core::fmt::Debug for Uart1 {
608    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
609        f.debug_struct("Uart1").finish()
610    }
611}
612#[doc = "Universal Asynchronous Receiver Transmitter"]
613pub use self::uart0 as uart1;
614#[doc = "Quad Serial Peripheral Interface"]
615pub struct Qspi1 {
616    _marker: PhantomData<*const ()>,
617}
618unsafe impl Send for Qspi1 {}
619impl Qspi1 {
620    #[doc = r"Pointer to the register block"]
621    pub const PTR: *const qspi0::RegisterBlock = 0x1002_4000 as *const _;
622    #[doc = r"Return the pointer to the register block"]
623    #[inline(always)]
624    pub const fn ptr() -> *const qspi0::RegisterBlock {
625        Self::PTR
626    }
627    #[doc = r" Steal an instance of this peripheral"]
628    #[doc = r""]
629    #[doc = r" # Safety"]
630    #[doc = r""]
631    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
632    #[doc = r" that may race with any existing instances, for example by only"]
633    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
634    #[doc = r" original peripheral and using critical sections to coordinate"]
635    #[doc = r" access between multiple new instances."]
636    #[doc = r""]
637    #[doc = r" Additionally, other software such as HALs may rely on only one"]
638    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
639    #[doc = r" no stolen instances are passed to such software."]
640    pub unsafe fn steal() -> Self {
641        Self {
642            _marker: PhantomData,
643        }
644    }
645}
646impl Deref for Qspi1 {
647    type Target = qspi0::RegisterBlock;
648    #[inline(always)]
649    fn deref(&self) -> &Self::Target {
650        unsafe { &*Self::PTR }
651    }
652}
653impl core::fmt::Debug for Qspi1 {
654    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
655        f.debug_struct("Qspi1").finish()
656    }
657}
658#[doc = "Quad Serial Peripheral Interface"]
659pub use self::qspi0 as qspi1;
660#[doc = "8-bit timer with 4 cmp"]
661pub struct Pwm1 {
662    _marker: PhantomData<*const ()>,
663}
664unsafe impl Send for Pwm1 {}
665impl Pwm1 {
666    #[doc = r"Pointer to the register block"]
667    pub const PTR: *const pwm0::RegisterBlock = 0x1002_5000 as *const _;
668    #[doc = r"Return the pointer to the register block"]
669    #[inline(always)]
670    pub const fn ptr() -> *const pwm0::RegisterBlock {
671        Self::PTR
672    }
673    #[doc = r" Steal an instance of this peripheral"]
674    #[doc = r""]
675    #[doc = r" # Safety"]
676    #[doc = r""]
677    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
678    #[doc = r" that may race with any existing instances, for example by only"]
679    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
680    #[doc = r" original peripheral and using critical sections to coordinate"]
681    #[doc = r" access between multiple new instances."]
682    #[doc = r""]
683    #[doc = r" Additionally, other software such as HALs may rely on only one"]
684    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
685    #[doc = r" no stolen instances are passed to such software."]
686    pub unsafe fn steal() -> Self {
687        Self {
688            _marker: PhantomData,
689        }
690    }
691}
692impl Deref for Pwm1 {
693    type Target = pwm0::RegisterBlock;
694    #[inline(always)]
695    fn deref(&self) -> &Self::Target {
696        unsafe { &*Self::PTR }
697    }
698}
699impl core::fmt::Debug for Pwm1 {
700    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
701        f.debug_struct("Pwm1").finish()
702    }
703}
704#[doc = "8-bit timer with 4 cmp"]
705pub use self::pwm0 as pwm1;
706#[doc = "Quad Serial Peripheral Interface"]
707pub struct Qspi2 {
708    _marker: PhantomData<*const ()>,
709}
710unsafe impl Send for Qspi2 {}
711impl Qspi2 {
712    #[doc = r"Pointer to the register block"]
713    pub const PTR: *const qspi0::RegisterBlock = 0x1003_4000 as *const _;
714    #[doc = r"Return the pointer to the register block"]
715    #[inline(always)]
716    pub const fn ptr() -> *const qspi0::RegisterBlock {
717        Self::PTR
718    }
719    #[doc = r" Steal an instance of this peripheral"]
720    #[doc = r""]
721    #[doc = r" # Safety"]
722    #[doc = r""]
723    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
724    #[doc = r" that may race with any existing instances, for example by only"]
725    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
726    #[doc = r" original peripheral and using critical sections to coordinate"]
727    #[doc = r" access between multiple new instances."]
728    #[doc = r""]
729    #[doc = r" Additionally, other software such as HALs may rely on only one"]
730    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
731    #[doc = r" no stolen instances are passed to such software."]
732    pub unsafe fn steal() -> Self {
733        Self {
734            _marker: PhantomData,
735        }
736    }
737}
738impl Deref for Qspi2 {
739    type Target = qspi0::RegisterBlock;
740    #[inline(always)]
741    fn deref(&self) -> &Self::Target {
742        unsafe { &*Self::PTR }
743    }
744}
745impl core::fmt::Debug for Qspi2 {
746    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
747        f.debug_struct("Qspi2").finish()
748    }
749}
750#[doc = "Quad Serial Peripheral Interface"]
751pub use self::qspi0 as qspi2;
752#[doc = "8-bit timer with 4 cmp"]
753pub struct Pwm2 {
754    _marker: PhantomData<*const ()>,
755}
756unsafe impl Send for Pwm2 {}
757impl Pwm2 {
758    #[doc = r"Pointer to the register block"]
759    pub const PTR: *const pwm0::RegisterBlock = 0x1003_5000 as *const _;
760    #[doc = r"Return the pointer to the register block"]
761    #[inline(always)]
762    pub const fn ptr() -> *const pwm0::RegisterBlock {
763        Self::PTR
764    }
765    #[doc = r" Steal an instance of this peripheral"]
766    #[doc = r""]
767    #[doc = r" # Safety"]
768    #[doc = r""]
769    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
770    #[doc = r" that may race with any existing instances, for example by only"]
771    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
772    #[doc = r" original peripheral and using critical sections to coordinate"]
773    #[doc = r" access between multiple new instances."]
774    #[doc = r""]
775    #[doc = r" Additionally, other software such as HALs may rely on only one"]
776    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
777    #[doc = r" no stolen instances are passed to such software."]
778    pub unsafe fn steal() -> Self {
779        Self {
780            _marker: PhantomData,
781        }
782    }
783}
784impl Deref for Pwm2 {
785    type Target = pwm0::RegisterBlock;
786    #[inline(always)]
787    fn deref(&self) -> &Self::Target {
788        unsafe { &*Self::PTR }
789    }
790}
791impl core::fmt::Debug for Pwm2 {
792    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
793        f.debug_struct("Pwm2").finish()
794    }
795}
796#[doc = "8-bit timer with 4 cmp"]
797pub use self::pwm0 as pwm2;
798#[no_mangle]
799static mut DEVICE_PERIPHERALS: bool = false;
800#[doc = r" All the peripherals."]
801#[allow(non_snake_case)]
802pub struct Peripherals {
803    #[doc = "WDOG"]
804    pub wdog: Wdog,
805    #[doc = "RTC"]
806    pub rtc: Rtc,
807    #[doc = "AONCLK"]
808    pub aonclk: Aonclk,
809    #[doc = "BACKUP"]
810    pub backup: Backup,
811    #[doc = "PMU"]
812    pub pmu: Pmu,
813    #[doc = "PRCI"]
814    pub prci: Prci,
815    #[doc = "OTP"]
816    pub otp: Otp,
817    #[doc = "GPIO0"]
818    pub gpio0: Gpio0,
819    #[doc = "UART0"]
820    pub uart0: Uart0,
821    #[doc = "QSPI0"]
822    pub qspi0: Qspi0,
823    #[doc = "PWM0"]
824    pub pwm0: Pwm0,
825    #[doc = "I2C0"]
826    pub i2c0: I2c0,
827    #[doc = "UART1"]
828    pub uart1: Uart1,
829    #[doc = "QSPI1"]
830    pub qspi1: Qspi1,
831    #[doc = "PWM1"]
832    pub pwm1: Pwm1,
833    #[doc = "QSPI2"]
834    pub qspi2: Qspi2,
835    #[doc = "PWM2"]
836    pub pwm2: Pwm2,
837}
838impl Peripherals {
839    #[doc = r" Returns all the peripherals *once*."]
840    #[cfg(feature = "critical-section")]
841    #[inline]
842    pub fn take() -> Option<Self> {
843        critical_section::with(|_| {
844            if unsafe { DEVICE_PERIPHERALS } {
845                return None;
846            }
847            Some(unsafe { Peripherals::steal() })
848        })
849    }
850    #[doc = r" Unchecked version of `Peripherals::take`."]
851    #[doc = r""]
852    #[doc = r" # Safety"]
853    #[doc = r""]
854    #[doc = r" Each of the returned peripherals must be used at most once."]
855    #[inline]
856    pub unsafe fn steal() -> Self {
857        DEVICE_PERIPHERALS = true;
858        Peripherals {
859            wdog: Wdog::steal(),
860            rtc: Rtc::steal(),
861            aonclk: Aonclk::steal(),
862            backup: Backup::steal(),
863            pmu: Pmu::steal(),
864            prci: Prci::steal(),
865            otp: Otp::steal(),
866            gpio0: Gpio0::steal(),
867            uart0: Uart0::steal(),
868            qspi0: Qspi0::steal(),
869            pwm0: Pwm0::steal(),
870            i2c0: I2c0::steal(),
871            uart1: Uart1::steal(),
872            qspi1: Qspi1::steal(),
873            pwm1: Pwm1::steal(),
874            qspi2: Qspi2::steal(),
875            pwm2: Pwm2::steal(),
876        }
877    }
878}