1#![doc = "Peripheral access API for ESP32-S3-ULP microcontrollers (generated using svd2rust v0.33.4 ( ))\n\nYou can find an overview of the generated API [here].\n\nAPI features to be included in the [next] svd2rust 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.4/svd2rust/#peripheral-api\n[next]: https://github.com/rust-embedded/svd2rust/blob/master/CHANGELOG.md#unreleased\n[repository]: https://github.com/rust-embedded/svd2rust"]
2#![allow(non_camel_case_types)]
3#![allow(non_snake_case)]
4#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/46717278")]
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 = 4;
10#[allow(unused_imports)]
11use generic::*;
12#[doc = r"Common register and bit access and modify traits"]
13pub mod generic;
14#[cfg(feature = "rt")]
15extern "C" {
16 fn TOUCH_DONE_INT();
17 fn TOUCH_INACTIVE_INT();
18 fn TOUCH_ACTIVE_INT();
19 fn SARADC1_DONE_INT();
20 fn SARADC2_DONE_INT();
21 fn TSENS_DONE_INT();
22 fn RISCV_START_INT();
23 fn SW_INT();
24 fn SWD_INT();
25 fn TOUCH_TIME_OUT_INT();
26 fn TOUCH_APPROACH_LOOP_DONE_INT();
27 fn TOUCH_SCAN_DONE_INT();
28}
29#[doc(hidden)]
30#[repr(C)]
31pub union Vector {
32 pub _handler: unsafe extern "C" fn(),
33 pub _reserved: usize,
34}
35#[cfg(feature = "rt")]
36#[doc(hidden)]
37#[link_section = ".rwtext"]
38#[no_mangle]
39pub static __EXTERNAL_INTERRUPTS: [Vector; 12] = [
40 Vector {
41 _handler: TOUCH_DONE_INT,
42 },
43 Vector {
44 _handler: TOUCH_INACTIVE_INT,
45 },
46 Vector {
47 _handler: TOUCH_ACTIVE_INT,
48 },
49 Vector {
50 _handler: SARADC1_DONE_INT,
51 },
52 Vector {
53 _handler: SARADC2_DONE_INT,
54 },
55 Vector {
56 _handler: TSENS_DONE_INT,
57 },
58 Vector {
59 _handler: RISCV_START_INT,
60 },
61 Vector { _handler: SW_INT },
62 Vector { _handler: SWD_INT },
63 Vector {
64 _handler: TOUCH_TIME_OUT_INT,
65 },
66 Vector {
67 _handler: TOUCH_APPROACH_LOOP_DONE_INT,
68 },
69 Vector {
70 _handler: TOUCH_SCAN_DONE_INT,
71 },
72];
73#[doc(hidden)]
74pub mod interrupt;
75pub use self::interrupt::Interrupt;
76#[doc = "Real-Time Clock Control"]
77pub struct RTC_CNTL {
78 _marker: PhantomData<*const ()>,
79}
80unsafe impl Send for RTC_CNTL {}
81impl RTC_CNTL {
82 #[doc = r"Pointer to the register block"]
83 pub const PTR: *const rtc_cntl::RegisterBlock = 0x8000 as *const _;
84 #[doc = r"Return the pointer to the register block"]
85 #[inline(always)]
86 pub const fn ptr() -> *const rtc_cntl::RegisterBlock {
87 Self::PTR
88 }
89 #[doc = r" Steal an instance of this peripheral"]
90 #[doc = r""]
91 #[doc = r" # Safety"]
92 #[doc = r""]
93 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
94 #[doc = r" that may race with any existing instances, for example by only"]
95 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
96 #[doc = r" original peripheral and using critical sections to coordinate"]
97 #[doc = r" access between multiple new instances."]
98 #[doc = r""]
99 #[doc = r" Additionally, other software such as HALs may rely on only one"]
100 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
101 #[doc = r" no stolen instances are passed to such software."]
102 pub unsafe fn steal() -> Self {
103 Self {
104 _marker: PhantomData,
105 }
106 }
107}
108impl Deref for RTC_CNTL {
109 type Target = rtc_cntl::RegisterBlock;
110 #[inline(always)]
111 fn deref(&self) -> &Self::Target {
112 unsafe { &*Self::PTR }
113 }
114}
115impl core::fmt::Debug for RTC_CNTL {
116 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
117 f.debug_struct("RTC_CNTL").finish()
118 }
119}
120#[doc = "Real-Time Clock Control"]
121pub mod rtc_cntl;
122#[doc = "Low-power I2C (Inter-Integrated Circuit) Controller"]
123pub struct RTC_I2C {
124 _marker: PhantomData<*const ()>,
125}
126unsafe impl Send for RTC_I2C {}
127impl RTC_I2C {
128 #[doc = r"Pointer to the register block"]
129 pub const PTR: *const rtc_i2c::RegisterBlock = 0xec00 as *const _;
130 #[doc = r"Return the pointer to the register block"]
131 #[inline(always)]
132 pub const fn ptr() -> *const rtc_i2c::RegisterBlock {
133 Self::PTR
134 }
135 #[doc = r" Steal an instance of this peripheral"]
136 #[doc = r""]
137 #[doc = r" # Safety"]
138 #[doc = r""]
139 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
140 #[doc = r" that may race with any existing instances, for example by only"]
141 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
142 #[doc = r" original peripheral and using critical sections to coordinate"]
143 #[doc = r" access between multiple new instances."]
144 #[doc = r""]
145 #[doc = r" Additionally, other software such as HALs may rely on only one"]
146 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
147 #[doc = r" no stolen instances are passed to such software."]
148 pub unsafe fn steal() -> Self {
149 Self {
150 _marker: PhantomData,
151 }
152 }
153}
154impl Deref for RTC_I2C {
155 type Target = rtc_i2c::RegisterBlock;
156 #[inline(always)]
157 fn deref(&self) -> &Self::Target {
158 unsafe { &*Self::PTR }
159 }
160}
161impl core::fmt::Debug for RTC_I2C {
162 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
163 f.debug_struct("RTC_I2C").finish()
164 }
165}
166#[doc = "Low-power I2C (Inter-Integrated Circuit) Controller"]
167pub mod rtc_i2c;
168#[doc = "Low-power Input/Output"]
169pub struct RTC_IO {
170 _marker: PhantomData<*const ()>,
171}
172unsafe impl Send for RTC_IO {}
173impl RTC_IO {
174 #[doc = r"Pointer to the register block"]
175 pub const PTR: *const rtc_io::RegisterBlock = 0xa400 as *const _;
176 #[doc = r"Return the pointer to the register block"]
177 #[inline(always)]
178 pub const fn ptr() -> *const rtc_io::RegisterBlock {
179 Self::PTR
180 }
181 #[doc = r" Steal an instance of this peripheral"]
182 #[doc = r""]
183 #[doc = r" # Safety"]
184 #[doc = r""]
185 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
186 #[doc = r" that may race with any existing instances, for example by only"]
187 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
188 #[doc = r" original peripheral and using critical sections to coordinate"]
189 #[doc = r" access between multiple new instances."]
190 #[doc = r""]
191 #[doc = r" Additionally, other software such as HALs may rely on only one"]
192 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
193 #[doc = r" no stolen instances are passed to such software."]
194 pub unsafe fn steal() -> Self {
195 Self {
196 _marker: PhantomData,
197 }
198 }
199}
200impl Deref for RTC_IO {
201 type Target = rtc_io::RegisterBlock;
202 #[inline(always)]
203 fn deref(&self) -> &Self::Target {
204 unsafe { &*Self::PTR }
205 }
206}
207impl core::fmt::Debug for RTC_IO {
208 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
209 f.debug_struct("RTC_IO").finish()
210 }
211}
212#[doc = "Low-power Input/Output"]
213pub mod rtc_io;
214#[doc = "SENS Peripheral"]
215pub struct SENS {
216 _marker: PhantomData<*const ()>,
217}
218unsafe impl Send for SENS {}
219impl SENS {
220 #[doc = r"Pointer to the register block"]
221 pub const PTR: *const sens::RegisterBlock = 0xc800 as *const _;
222 #[doc = r"Return the pointer to the register block"]
223 #[inline(always)]
224 pub const fn ptr() -> *const sens::RegisterBlock {
225 Self::PTR
226 }
227 #[doc = r" Steal an instance of this peripheral"]
228 #[doc = r""]
229 #[doc = r" # Safety"]
230 #[doc = r""]
231 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
232 #[doc = r" that may race with any existing instances, for example by only"]
233 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
234 #[doc = r" original peripheral and using critical sections to coordinate"]
235 #[doc = r" access between multiple new instances."]
236 #[doc = r""]
237 #[doc = r" Additionally, other software such as HALs may rely on only one"]
238 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
239 #[doc = r" no stolen instances are passed to such software."]
240 pub unsafe fn steal() -> Self {
241 Self {
242 _marker: PhantomData,
243 }
244 }
245}
246impl Deref for SENS {
247 type Target = sens::RegisterBlock;
248 #[inline(always)]
249 fn deref(&self) -> &Self::Target {
250 unsafe { &*Self::PTR }
251 }
252}
253impl core::fmt::Debug for SENS {
254 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
255 f.debug_struct("SENS").finish()
256 }
257}
258#[doc = "SENS Peripheral"]
259pub mod sens;
260#[no_mangle]
261static mut DEVICE_PERIPHERALS: bool = false;
262#[doc = r" All the peripherals."]
263#[allow(non_snake_case)]
264pub struct Peripherals {
265 #[doc = "RTC_CNTL"]
266 pub RTC_CNTL: RTC_CNTL,
267 #[doc = "RTC_I2C"]
268 pub RTC_I2C: RTC_I2C,
269 #[doc = "RTC_IO"]
270 pub RTC_IO: RTC_IO,
271 #[doc = "SENS"]
272 pub SENS: SENS,
273}
274impl Peripherals {
275 #[doc = r" Returns all the peripherals *once*."]
276 #[cfg(feature = "critical-section")]
277 #[inline]
278 pub fn take() -> Option<Self> {
279 critical_section::with(|_| {
280 if unsafe { DEVICE_PERIPHERALS } {
281 return None;
282 }
283 Some(unsafe { Peripherals::steal() })
284 })
285 }
286 #[doc = r" Unchecked version of `Peripherals::take`."]
287 #[doc = r""]
288 #[doc = r" # Safety"]
289 #[doc = r""]
290 #[doc = r" Each of the returned peripherals must be used at most once."]
291 #[inline]
292 pub unsafe fn steal() -> Self {
293 DEVICE_PERIPHERALS = true;
294 Peripherals {
295 RTC_CNTL: RTC_CNTL::steal(),
296 RTC_I2C: RTC_I2C::steal(),
297 RTC_IO: RTC_IO::steal(),
298 SENS: SENS::steal(),
299 }
300 }
301}