1#![doc = "Peripheral access API for FOMU microcontrollers (generated using svd2rust v0.16.1)\n\nYou can find an overview of the API [here].\n\n[here]: https://docs.rs/svd2rust/0.16.1/svd2rust/#peripheral-api"]
2#![deny(missing_docs)]
3#![deny(warnings)]
4#![allow(non_camel_case_types)]
5#![no_std]
6extern crate bare_metal;
7extern crate vexriscv as riscv;
8#[cfg(feature = "rt")]
9extern crate fomu_rt as riscv_rt;
10extern crate vcell;
11use core::marker::PhantomData;
12use core::ops::Deref;
13#[doc(hidden)]
14pub mod interrupt;
15pub use self::interrupt::Interrupt;
16#[allow(unused_imports)]
17use generic::*;
18#[doc = r"Common register and bit access and modify traits"]
19pub mod generic;
20#[doc = "CTRL"]
21pub struct CTRL {
22 _marker: PhantomData<*const ()>,
23}
24unsafe impl Send for CTRL {}
25impl CTRL {
26 #[doc = r"Returns a pointer to the register block"]
27 #[inline(always)]
28 pub const fn ptr() -> *const ctrl::RegisterBlock {
29 0xe000_0000 as *const _
30 }
31}
32impl Deref for CTRL {
33 type Target = ctrl::RegisterBlock;
34 fn deref(&self) -> &Self::Target {
35 unsafe { &*CTRL::ptr() }
36 }
37}
38#[doc = "CTRL"]
39pub mod ctrl;
40#[doc = "LXSPI"]
41pub struct LXSPI {
42 _marker: PhantomData<*const ()>,
43}
44unsafe impl Send for LXSPI {}
45impl LXSPI {
46 #[doc = r"Returns a pointer to the register block"]
47 #[inline(always)]
48 pub const fn ptr() -> *const lxspi::RegisterBlock {
49 0xe000_7800 as *const _
50 }
51}
52impl Deref for LXSPI {
53 type Target = lxspi::RegisterBlock;
54 fn deref(&self) -> &Self::Target {
55 unsafe { &*LXSPI::ptr() }
56 }
57}
58#[doc = "LXSPI"]
59pub mod lxspi;
60#[doc = "MESSIBLE"]
61pub struct MESSIBLE {
62 _marker: PhantomData<*const ()>,
63}
64unsafe impl Send for MESSIBLE {}
65impl MESSIBLE {
66 #[doc = r"Returns a pointer to the register block"]
67 #[inline(always)]
68 pub const fn ptr() -> *const messible::RegisterBlock {
69 0xe000_8000 as *const _
70 }
71}
72impl Deref for MESSIBLE {
73 type Target = messible::RegisterBlock;
74 fn deref(&self) -> &Self::Target {
75 unsafe { &*MESSIBLE::ptr() }
76 }
77}
78#[doc = "MESSIBLE"]
79pub mod messible;
80#[doc = "REBOOT"]
81pub struct REBOOT {
82 _marker: PhantomData<*const ()>,
83}
84unsafe impl Send for REBOOT {}
85impl REBOOT {
86 #[doc = r"Returns a pointer to the register block"]
87 #[inline(always)]
88 pub const fn ptr() -> *const reboot::RegisterBlock {
89 0xe000_6000 as *const _
90 }
91}
92impl Deref for REBOOT {
93 type Target = reboot::RegisterBlock;
94 fn deref(&self) -> &Self::Target {
95 unsafe { &*REBOOT::ptr() }
96 }
97}
98#[doc = "REBOOT"]
99pub mod reboot;
100#[doc = "RGB"]
101pub struct RGB {
102 _marker: PhantomData<*const ()>,
103}
104unsafe impl Send for RGB {}
105impl RGB {
106 #[doc = r"Returns a pointer to the register block"]
107 #[inline(always)]
108 pub const fn ptr() -> *const rgb::RegisterBlock {
109 0xe000_6800 as *const _
110 }
111}
112impl Deref for RGB {
113 type Target = rgb::RegisterBlock;
114 fn deref(&self) -> &Self::Target {
115 unsafe { &*RGB::ptr() }
116 }
117}
118#[doc = "RGB"]
119pub mod rgb;
120#[doc = "TIMER0"]
121pub struct TIMER0 {
122 _marker: PhantomData<*const ()>,
123}
124unsafe impl Send for TIMER0 {}
125impl TIMER0 {
126 #[doc = r"Returns a pointer to the register block"]
127 #[inline(always)]
128 pub const fn ptr() -> *const timer0::RegisterBlock {
129 0xe000_2800 as *const _
130 }
131}
132impl Deref for TIMER0 {
133 type Target = timer0::RegisterBlock;
134 fn deref(&self) -> &Self::Target {
135 unsafe { &*TIMER0::ptr() }
136 }
137}
138#[doc = "TIMER0"]
139pub mod timer0;
140#[doc = "TOUCH"]
141pub struct TOUCH {
142 _marker: PhantomData<*const ()>,
143}
144unsafe impl Send for TOUCH {}
145impl TOUCH {
146 #[doc = r"Returns a pointer to the register block"]
147 #[inline(always)]
148 pub const fn ptr() -> *const touch::RegisterBlock {
149 0xe000_5800 as *const _
150 }
151}
152impl Deref for TOUCH {
153 type Target = touch::RegisterBlock;
154 fn deref(&self) -> &Self::Target {
155 unsafe { &*TOUCH::ptr() }
156 }
157}
158#[doc = "TOUCH"]
159pub mod touch;
160#[doc = "USB"]
161pub struct USB {
162 _marker: PhantomData<*const ()>,
163}
164unsafe impl Send for USB {}
165impl USB {
166 #[doc = r"Returns a pointer to the register block"]
167 #[inline(always)]
168 pub const fn ptr() -> *const usb::RegisterBlock {
169 0xe000_4800 as *const _
170 }
171}
172impl Deref for USB {
173 type Target = usb::RegisterBlock;
174 fn deref(&self) -> &Self::Target {
175 unsafe { &*USB::ptr() }
176 }
177}
178#[doc = "USB"]
179pub mod usb;
180#[doc = "VERSION"]
181pub struct VERSION {
182 _marker: PhantomData<*const ()>,
183}
184unsafe impl Send for VERSION {}
185impl VERSION {
186 #[doc = r"Returns a pointer to the register block"]
187 #[inline(always)]
188 pub const fn ptr() -> *const version::RegisterBlock {
189 0xe000_7000 as *const _
190 }
191}
192impl Deref for VERSION {
193 type Target = version::RegisterBlock;
194 fn deref(&self) -> &Self::Target {
195 unsafe { &*VERSION::ptr() }
196 }
197}
198#[doc = "VERSION"]
199pub mod version;
200#[no_mangle]
201static mut DEVICE_PERIPHERALS: bool = false;
202#[doc = r"All the peripherals"]
203#[allow(non_snake_case)]
204pub struct Peripherals {
205 #[doc = "CTRL"]
206 pub CTRL: CTRL,
207 #[doc = "LXSPI"]
208 pub LXSPI: LXSPI,
209 #[doc = "MESSIBLE"]
210 pub MESSIBLE: MESSIBLE,
211 #[doc = "REBOOT"]
212 pub REBOOT: REBOOT,
213 #[doc = "RGB"]
214 pub RGB: RGB,
215 #[doc = "TIMER0"]
216 pub TIMER0: TIMER0,
217 #[doc = "TOUCH"]
218 pub TOUCH: TOUCH,
219 #[doc = "USB"]
220 pub USB: USB,
221 #[doc = "VERSION"]
222 pub VERSION: VERSION,
223}
224impl Peripherals {
225 #[doc = r"Returns all the peripherals *once*"]
226 #[inline]
227 pub fn take() -> Option<Self> {
228 riscv::interrupt::free(|_| {
229 if unsafe { DEVICE_PERIPHERALS } {
230 None
231 } else {
232 Some(unsafe { Peripherals::steal() })
233 }
234 })
235 }
236 #[doc = r"Unchecked version of `Peripherals::take`"]
237 pub unsafe fn steal() -> Self {
238 DEVICE_PERIPHERALS = true;
239 Peripherals {
240 CTRL: CTRL {
241 _marker: PhantomData,
242 },
243 LXSPI: LXSPI {
244 _marker: PhantomData,
245 },
246 MESSIBLE: MESSIBLE {
247 _marker: PhantomData,
248 },
249 REBOOT: REBOOT {
250 _marker: PhantomData,
251 },
252 RGB: RGB {
253 _marker: PhantomData,
254 },
255 TIMER0: TIMER0 {
256 _marker: PhantomData,
257 },
258 TOUCH: TOUCH {
259 _marker: PhantomData,
260 },
261 USB: USB {
262 _marker: PhantomData,
263 },
264 VERSION: VERSION {
265 _marker: PhantomData,
266 },
267 }
268 }
269}