aboutsummaryrefslogtreecommitdiff
path: root/embassy-rp/src/lib.rs
diff options
context:
space:
mode:
author1-rafael-1 <[email protected]>2025-09-15 20:07:18 +0200
committer1-rafael-1 <[email protected]>2025-09-15 20:07:18 +0200
commit6bb3d2c0720fa082f27d3cdb70f516058497ec87 (patch)
tree5a1e255cff999b00800f203b91a759c720c973e5 /embassy-rp/src/lib.rs
parenteb685574601d98c44faed9a3534d056199b46e20 (diff)
parent92a6fd2946f2cbb15359290f68aa360953da2ff7 (diff)
Merge branch 'main' into rp2040-rtc-alarm
Diffstat (limited to 'embassy-rp/src/lib.rs')
-rw-r--r--embassy-rp/src/lib.rs30
1 files changed, 21 insertions, 9 deletions
diff --git a/embassy-rp/src/lib.rs b/embassy-rp/src/lib.rs
index f549446bc..6fb680b34 100644
--- a/embassy-rp/src/lib.rs
+++ b/embassy-rp/src/lib.rs
@@ -35,7 +35,11 @@ pub mod multicore;
35#[cfg(feature = "_rp235x")] 35#[cfg(feature = "_rp235x")]
36pub mod otp; 36pub mod otp;
37pub mod pio_programs; 37pub mod pio_programs;
38#[cfg(feature = "_rp235x")]
39pub mod psram;
38pub mod pwm; 40pub mod pwm;
41#[cfg(feature = "_rp235x")]
42pub mod qmi_cs1;
39mod reset; 43mod reset;
40pub mod rom_data; 44pub mod rom_data;
41#[cfg(feature = "rp2040")] 45#[cfg(feature = "rp2040")]
@@ -160,15 +164,18 @@ embassy_hal_internal::interrupt_mod!(
160/// ```rust,ignore 164/// ```rust,ignore
161/// use embassy_rp::{bind_interrupts, usb, peripherals}; 165/// use embassy_rp::{bind_interrupts, usb, peripherals};
162/// 166///
163/// bind_interrupts!(struct Irqs { 167/// bind_interrupts!(
164/// USBCTRL_IRQ => usb::InterruptHandler<peripherals::USB>; 168/// /// Binds the USB Interrupts.
165/// }); 169/// struct Irqs {
170/// USBCTRL_IRQ => usb::InterruptHandler<peripherals::USB>;
171/// }
172/// );
166/// ``` 173/// ```
167/// 174///
168// developer note: this macro can't be in `embassy-hal-internal` due to the use of `$crate`. 175// developer note: this macro can't be in `embassy-hal-internal` due to the use of `$crate`.
169#[macro_export] 176#[macro_export]
170macro_rules! bind_interrupts { 177macro_rules! bind_interrupts {
171 ($vis:vis struct $name:ident { 178 ($(#[$attr:meta])* $vis:vis struct $name:ident {
172 $( 179 $(
173 $(#[cfg($cond_irq:meta)])? 180 $(#[cfg($cond_irq:meta)])?
174 $irq:ident => $( 181 $irq:ident => $(
@@ -178,6 +185,7 @@ macro_rules! bind_interrupts {
178 )* 185 )*
179 }) => { 186 }) => {
180 #[derive(Copy, Clone)] 187 #[derive(Copy, Clone)]
188 $(#[$attr])*
181 $vis struct $name; 189 $vis struct $name;
182 190
183 $( 191 $(
@@ -185,11 +193,13 @@ macro_rules! bind_interrupts {
185 #[no_mangle] 193 #[no_mangle]
186 $(#[cfg($cond_irq)])? 194 $(#[cfg($cond_irq)])?
187 unsafe extern "C" fn $irq() { 195 unsafe extern "C" fn $irq() {
188 $( 196 unsafe {
189 $(#[cfg($cond_handler)])? 197 $(
190 <$handler as $crate::interrupt::typelevel::Handler<$crate::interrupt::typelevel::$irq>>::on_interrupt(); 198 $(#[cfg($cond_handler)])?
199 <$handler as $crate::interrupt::typelevel::Handler<$crate::interrupt::typelevel::$irq>>::on_interrupt();
191 200
192 )* 201 )*
202 }
193 } 203 }
194 204
195 $(#[cfg($cond_irq)])? 205 $(#[cfg($cond_irq)])?
@@ -375,6 +385,8 @@ embassy_hal_internal::peripherals! {
375 SPI0, 385 SPI0,
376 SPI1, 386 SPI1,
377 387
388 QMI_CS1,
389
378 I2C0, 390 I2C0,
379 I2C1, 391 I2C1,
380 392
@@ -563,7 +575,7 @@ unsafe fn install_stack_guard(stack_bottom: *mut usize) -> Result<(), ()> {
563 unsafe { 575 unsafe {
564 core.MPU.ctrl.write(5); // enable mpu with background default map 576 core.MPU.ctrl.write(5); // enable mpu with background default map
565 core.MPU.rbar.write(stack_bottom as u32 & !0xff); // set address 577 core.MPU.rbar.write(stack_bottom as u32 & !0xff); // set address
566 core.MPU.rlar.write(1); // enable region 578 core.MPU.rlar.write(((stack_bottom as usize + 255) as u32) | 1);
567 } 579 }
568 Ok(()) 580 Ok(())
569} 581}