aboutsummaryrefslogtreecommitdiff
path: root/embassy-rp
diff options
context:
space:
mode:
authormaor1993 <[email protected]>2025-10-07 15:05:09 +0300
committerGitHub <[email protected]>2025-10-07 15:05:09 +0300
commit04a36e9f62385fb4338908de66045f36fec664ea (patch)
tree714fcc21114946e33b2be8eb6037bdc3dd9bb596 /embassy-rp
parentcd91fe3b30dbb3d5b3c9c7d9e7cb151d721fb8d5 (diff)
parent07016a4ffbe0b0ea689b83a6ddf19ab1b6a9a79a (diff)
Merge branch 'embassy-rs:main' into main
Diffstat (limited to 'embassy-rp')
-rw-r--r--embassy-rp/Cargo.toml6
-rw-r--r--embassy-rp/src/adc.rs8
-rw-r--r--embassy-rp/src/bootsel.rs4
-rw-r--r--embassy-rp/src/clocks.rs4
-rw-r--r--embassy-rp/src/dma.rs4
-rw-r--r--embassy-rp/src/flash.rs10
-rw-r--r--embassy-rp/src/float/cmp.rs12
-rw-r--r--embassy-rp/src/float/functions.rs12
-rw-r--r--embassy-rp/src/gpio.rs6
-rw-r--r--embassy-rp/src/i2c_slave.rs4
-rw-r--r--embassy-rp/src/intrinsics.rs6
-rw-r--r--embassy-rp/src/lib.rs14
-rw-r--r--embassy-rp/src/multicore.rs9
-rw-r--r--embassy-rp/src/pio/mod.rs14
-rw-r--r--embassy-rp/src/pio_programs/hd44780.rs2
-rw-r--r--embassy-rp/src/pio_programs/i2s.rs2
-rw-r--r--embassy-rp/src/pio_programs/onewire.rs8
-rw-r--r--embassy-rp/src/pio_programs/pwm.rs2
-rw-r--r--embassy-rp/src/pio_programs/rotary_encoder.rs2
-rw-r--r--embassy-rp/src/pio_programs/stepper.rs2
-rw-r--r--embassy-rp/src/pio_programs/uart.rs2
-rw-r--r--embassy-rp/src/pio_programs/ws2812.rs2
-rw-r--r--embassy-rp/src/psram.rs10
-rw-r--r--embassy-rp/src/pwm.rs4
-rw-r--r--embassy-rp/src/rtc/mod.rs2
-rw-r--r--embassy-rp/src/time_driver.rs2
-rw-r--r--embassy-rp/src/uart/mod.rs16
-rw-r--r--embassy-rp/src/usb.rs16
-rw-r--r--embassy-rp/src/watchdog.rs2
29 files changed, 74 insertions, 113 deletions
diff --git a/embassy-rp/Cargo.toml b/embassy-rp/Cargo.toml
index f6b0900f2..9ad4b47a3 100644
--- a/embassy-rp/Cargo.toml
+++ b/embassy-rp/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2name = "embassy-rp" 2name = "embassy-rp"
3version = "0.8.0" 3version = "0.8.0"
4edition = "2021" 4edition = "2024"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "Embassy Hardware Abstraction Layer (HAL) for the Raspberry Pi RP2040 or RP235x microcontroller" 6description = "Embassy Hardware Abstraction Layer (HAL) for the Raspberry Pi RP2040 or RP235x microcontroller"
7keywords = ["embedded", "async", "rp235x", "rp2040", "embedded-hal"] 7keywords = ["embedded", "async", "rp235x", "rp2040", "embedded-hal"]
@@ -104,7 +104,7 @@ boot2-w25x10cl = []
104## Have embassy-rp not provide the boot2 so you can use your own. 104## Have embassy-rp not provide the boot2 so you can use your own.
105## Place your own in the ".boot2" section like: 105## Place your own in the ".boot2" section like:
106## ``` 106## ```
107## #[link_section = ".boot2"] 107## #[unsafe(link_section = ".boot2")]
108## #[used] 108## #[used]
109## static BOOT2: [u8; 256] = [0; 256]; // Provide your own with e.g. include_bytes! 109## static BOOT2: [u8; 256] = [0; 256]; // Provide your own with e.g. include_bytes!
110## ``` 110## ```
@@ -127,7 +127,7 @@ imagedef-nonsecure-exe = []
127## ```ignore 127## ```ignore
128## use embassy_rp::block::ImageDef; 128## use embassy_rp::block::ImageDef;
129## 129##
130## #[link_section = ".start_block"] 130## #[unsafe(link_section = ".start_block")]
131## #[used] 131## #[used]
132## static IMAGE_DEF: ImageDef = ImageDef::secure_exe(); // Update this with your own implementation. 132## static IMAGE_DEF: ImageDef = ImageDef::secure_exe(); // Update this with your own implementation.
133## ``` 133## ```
diff --git a/embassy-rp/src/adc.rs b/embassy-rp/src/adc.rs
index 2db8e63d7..d16779e01 100644
--- a/embassy-rp/src/adc.rs
+++ b/embassy-rp/src/adc.rs
@@ -1,18 +1,18 @@
1//! ADC driver. 1//! ADC driver.
2use core::future::{poll_fn, Future}; 2use core::future::{Future, poll_fn};
3use core::marker::PhantomData; 3use core::marker::PhantomData;
4use core::mem; 4use core::mem;
5use core::sync::atomic::{compiler_fence, Ordering}; 5use core::sync::atomic::{Ordering, compiler_fence};
6use core::task::Poll; 6use core::task::Poll;
7 7
8use embassy_sync::waitqueue::AtomicWaker; 8use embassy_sync::waitqueue::AtomicWaker;
9 9
10use crate::gpio::{self, AnyPin, Pull, SealedPin as GpioPin}; 10use crate::gpio::{self, AnyPin, Pull, SealedPin as GpioPin};
11use crate::interrupt::typelevel::Binding;
12use crate::interrupt::InterruptExt; 11use crate::interrupt::InterruptExt;
12use crate::interrupt::typelevel::Binding;
13use crate::pac::dma::vals::TreqSel; 13use crate::pac::dma::vals::TreqSel;
14use crate::peripherals::{ADC, ADC_TEMP_SENSOR}; 14use crate::peripherals::{ADC, ADC_TEMP_SENSOR};
15use crate::{dma, interrupt, pac, peripherals, Peri, RegExt}; 15use crate::{Peri, RegExt, dma, interrupt, pac, peripherals};
16 16
17static WAKER: AtomicWaker = AtomicWaker::new(); 17static WAKER: AtomicWaker = AtomicWaker::new();
18 18
diff --git a/embassy-rp/src/bootsel.rs b/embassy-rp/src/bootsel.rs
index 14f9e46aa..b24b98cd5 100644
--- a/embassy-rp/src/bootsel.rs
+++ b/embassy-rp/src/bootsel.rs
@@ -7,8 +7,8 @@
7//! 7//!
8//! This module provides functionality to poll BOOTSEL from an embassy application. 8//! This module provides functionality to poll BOOTSEL from an embassy application.
9 9
10use crate::flash::in_ram;
11use crate::Peri; 10use crate::Peri;
11use crate::flash::in_ram;
12 12
13/// Reads the BOOTSEL button. Returns true if the button is pressed. 13/// Reads the BOOTSEL button. Returns true if the button is pressed.
14/// 14///
@@ -36,7 +36,7 @@ mod ram_helpers {
36 /// This function must live in ram. It uses inline asm to avoid any 36 /// This function must live in ram. It uses inline asm to avoid any
37 /// potential calls to ABI functions that might be in flash. 37 /// potential calls to ABI functions that might be in flash.
38 #[inline(never)] 38 #[inline(never)]
39 #[link_section = ".data.ram_func"] 39 #[unsafe(link_section = ".data.ram_func")]
40 #[cfg(target_arch = "arm")] 40 #[cfg(target_arch = "arm")]
41 pub unsafe fn read_cs_status() -> GpioStatus { 41 pub unsafe fn read_cs_status() -> GpioStatus {
42 let result: u32; 42 let result: u32;
diff --git a/embassy-rp/src/clocks.rs b/embassy-rp/src/clocks.rs
index 2eddc0bcc..56892d7a2 100644
--- a/embassy-rp/src/clocks.rs
+++ b/embassy-rp/src/clocks.rs
@@ -72,8 +72,8 @@ use core::sync::atomic::{AtomicU32, Ordering};
72use pac::clocks::vals::*; 72use pac::clocks::vals::*;
73 73
74use crate::gpio::{AnyPin, SealedPin}; 74use crate::gpio::{AnyPin, SealedPin};
75use crate::pac::common::{Reg, RW}; 75use crate::pac::common::{RW, Reg};
76use crate::{pac, reset, Peri}; 76use crate::{Peri, pac, reset};
77 77
78// NOTE: all gpin handling is commented out for future reference. 78// NOTE: all gpin handling is commented out for future reference.
79// gpin is not usually safe to use during the boot init() call, so it won't 79// gpin is not usually safe to use during the boot init() call, so it won't
diff --git a/embassy-rp/src/dma.rs b/embassy-rp/src/dma.rs
index d31d1e159..18aec60a5 100644
--- a/embassy-rp/src/dma.rs
+++ b/embassy-rp/src/dma.rs
@@ -1,10 +1,10 @@
1//! Direct Memory Access (DMA) 1//! Direct Memory Access (DMA)
2use core::future::Future; 2use core::future::Future;
3use core::pin::Pin; 3use core::pin::Pin;
4use core::sync::atomic::{compiler_fence, Ordering}; 4use core::sync::atomic::{Ordering, compiler_fence};
5use core::task::{Context, Poll}; 5use core::task::{Context, Poll};
6 6
7use embassy_hal_internal::{impl_peripheral, Peri, PeripheralType}; 7use embassy_hal_internal::{Peri, PeripheralType, impl_peripheral};
8use embassy_sync::waitqueue::AtomicWaker; 8use embassy_sync::waitqueue::AtomicWaker;
9use pac::dma::vals::DataSize; 9use pac::dma::vals::DataSize;
10 10
diff --git a/embassy-rp/src/flash.rs b/embassy-rp/src/flash.rs
index 8c809090e..7cc8f0c1d 100644
--- a/embassy-rp/src/flash.rs
+++ b/embassy-rp/src/flash.rs
@@ -6,8 +6,8 @@ use core::task::{Context, Poll};
6 6
7use embassy_hal_internal::{Peri, PeripheralType}; 7use embassy_hal_internal::{Peri, PeripheralType};
8use embedded_storage::nor_flash::{ 8use embedded_storage::nor_flash::{
9 check_erase, check_read, check_write, ErrorType, MultiwriteNorFlash, NorFlash, NorFlashError, NorFlashErrorKind, 9 ErrorType, MultiwriteNorFlash, NorFlash, NorFlashError, NorFlashErrorKind, ReadNorFlash, check_erase, check_read,
10 ReadNorFlash, 10 check_write,
11}; 11};
12 12
13use crate::dma::{AnyChannel, Channel, Transfer}; 13use crate::dma::{AnyChannel, Channel, Transfer};
@@ -627,7 +627,7 @@ mod ram_helpers {
627 /// Length of data must be a multiple of 4096 627 /// Length of data must be a multiple of 4096
628 /// addr must be aligned to 4096 628 /// addr must be aligned to 4096
629 #[inline(never)] 629 #[inline(never)]
630 #[link_section = ".data.ram_func"] 630 #[unsafe(link_section = ".data.ram_func")]
631 #[cfg(feature = "rp2040")] 631 #[cfg(feature = "rp2040")]
632 unsafe fn write_flash_inner(addr: u32, len: u32, data: Option<&[u8]>, ptrs: *const FlashFunctionPointers) { 632 unsafe fn write_flash_inner(addr: u32, len: u32, data: Option<&[u8]>, ptrs: *const FlashFunctionPointers) {
633 #[cfg(target_arch = "arm")] 633 #[cfg(target_arch = "arm")]
@@ -692,7 +692,7 @@ mod ram_helpers {
692 /// Length of data must be a multiple of 4096 692 /// Length of data must be a multiple of 4096
693 /// addr must be aligned to 4096 693 /// addr must be aligned to 4096
694 #[inline(never)] 694 #[inline(never)]
695 #[link_section = ".data.ram_func"] 695 #[unsafe(link_section = ".data.ram_func")]
696 #[cfg(feature = "_rp235x")] 696 #[cfg(feature = "_rp235x")]
697 unsafe fn write_flash_inner(addr: u32, len: u32, data: Option<&[u8]>, ptrs: *const FlashFunctionPointers) { 697 unsafe fn write_flash_inner(addr: u32, len: u32, data: Option<&[u8]>, ptrs: *const FlashFunctionPointers) {
698 let data = data.map(|d| d.as_ptr()).unwrap_or(core::ptr::null()); 698 let data = data.map(|d| d.as_ptr()).unwrap_or(core::ptr::null());
@@ -811,7 +811,7 @@ mod ram_helpers {
811 /// 811 ///
812 /// Credit: taken from `rp2040-flash` (also licensed Apache+MIT) 812 /// Credit: taken from `rp2040-flash` (also licensed Apache+MIT)
813 #[inline(never)] 813 #[inline(never)]
814 #[link_section = ".data.ram_func"] 814 #[unsafe(link_section = ".data.ram_func")]
815 #[cfg(feature = "rp2040")] 815 #[cfg(feature = "rp2040")]
816 unsafe fn read_flash_inner(cmd: FlashCommand, ptrs: *const FlashFunctionPointers) { 816 unsafe fn read_flash_inner(cmd: FlashCommand, ptrs: *const FlashFunctionPointers) {
817 #[cfg(target_arch = "arm")] 817 #[cfg(target_arch = "arm")]
diff --git a/embassy-rp/src/float/cmp.rs b/embassy-rp/src/float/cmp.rs
index e540e3918..f917eb9b3 100644
--- a/embassy-rp/src/float/cmp.rs
+++ b/embassy-rp/src/float/cmp.rs
@@ -21,19 +21,11 @@ impl ROMCmp for f64 {
21} 21}
22 22
23fn le_abi<F: Float + ROMCmp>(a: F, b: F) -> i32 { 23fn le_abi<F: Float + ROMCmp>(a: F, b: F) -> i32 {
24 if a.is_nan() || b.is_nan() { 24 if a.is_nan() || b.is_nan() { 1 } else { a.rom_cmp(b) }
25 1
26 } else {
27 a.rom_cmp(b)
28 }
29} 25}
30 26
31fn ge_abi<F: Float + ROMCmp>(a: F, b: F) -> i32 { 27fn ge_abi<F: Float + ROMCmp>(a: F, b: F) -> i32 {
32 if a.is_nan() || b.is_nan() { 28 if a.is_nan() || b.is_nan() { -1 } else { a.rom_cmp(b) }
33 -1
34 } else {
35 a.rom_cmp(b)
36 }
37} 29}
38 30
39intrinsics! { 31intrinsics! {
diff --git a/embassy-rp/src/float/functions.rs b/embassy-rp/src/float/functions.rs
index de29ce336..170168237 100644
--- a/embassy-rp/src/float/functions.rs
+++ b/embassy-rp/src/float/functions.rs
@@ -114,19 +114,11 @@ fn sqrt<F: Float + ROMFunctions>(f: F) -> F {
114} 114}
115 115
116fn ln<F: Float + ROMFunctions>(f: F) -> F { 116fn ln<F: Float + ROMFunctions>(f: F) -> F {
117 if is_negative_nonzero_or_nan(f) { 117 if is_negative_nonzero_or_nan(f) { F::NAN } else { f.ln() }
118 F::NAN
119 } else {
120 f.ln()
121 }
122} 118}
123 119
124fn exp<F: Float + ROMFunctions>(f: F) -> F { 120fn exp<F: Float + ROMFunctions>(f: F) -> F {
125 if f.is_nan() { 121 if f.is_nan() { F::NAN } else { f.exp() }
126 F::NAN
127 } else {
128 f.exp()
129 }
130} 122}
131 123
132fn sin<F: Float + ROMFunctions>(f: F) -> F { 124fn sin<F: Float + ROMFunctions>(f: F) -> F {
diff --git a/embassy-rp/src/gpio.rs b/embassy-rp/src/gpio.rs
index f79bf8948..c15e0e41b 100644
--- a/embassy-rp/src/gpio.rs
+++ b/embassy-rp/src/gpio.rs
@@ -5,13 +5,13 @@ use core::future::Future;
5use core::pin::Pin as FuturePin; 5use core::pin::Pin as FuturePin;
6use core::task::{Context, Poll}; 6use core::task::{Context, Poll};
7 7
8use embassy_hal_internal::{impl_peripheral, Peri, PeripheralType}; 8use embassy_hal_internal::{Peri, PeripheralType, impl_peripheral};
9use embassy_sync::waitqueue::AtomicWaker; 9use embassy_sync::waitqueue::AtomicWaker;
10 10
11use crate::interrupt::InterruptExt; 11use crate::interrupt::InterruptExt;
12use crate::pac::common::{Reg, RW};
13use crate::pac::SIO; 12use crate::pac::SIO;
14use crate::{interrupt, pac, peripherals, RegExt}; 13use crate::pac::common::{RW, Reg};
14use crate::{RegExt, interrupt, pac, peripherals};
15 15
16#[cfg(any(feature = "rp2040", feature = "rp235xa"))] 16#[cfg(any(feature = "rp2040", feature = "rp235xa"))]
17pub(crate) const BANK0_PIN_COUNT: usize = 30; 17pub(crate) const BANK0_PIN_COUNT: usize = 30;
diff --git a/embassy-rp/src/i2c_slave.rs b/embassy-rp/src/i2c_slave.rs
index c263047ad..770087bc8 100644
--- a/embassy-rp/src/i2c_slave.rs
+++ b/embassy-rp/src/i2c_slave.rs
@@ -5,9 +5,9 @@ use core::task::Poll;
5 5
6use pac::i2c; 6use pac::i2c;
7 7
8use crate::i2c::{set_up_i2c_pin, AbortReason, Instance, InterruptHandler, SclPin, SdaPin, FIFO_SIZE}; 8use crate::i2c::{AbortReason, FIFO_SIZE, Instance, InterruptHandler, SclPin, SdaPin, set_up_i2c_pin};
9use crate::interrupt::typelevel::{Binding, Interrupt}; 9use crate::interrupt::typelevel::{Binding, Interrupt};
10use crate::{pac, Peri}; 10use crate::{Peri, pac};
11 11
12/// I2C error 12/// I2C error
13#[derive(Debug, PartialEq, Eq, Clone, Copy)] 13#[derive(Debug, PartialEq, Eq, Clone, Copy)]
diff --git a/embassy-rp/src/intrinsics.rs b/embassy-rp/src/intrinsics.rs
index 69d5d92de..aed8a3227 100644
--- a/embassy-rp/src/intrinsics.rs
+++ b/embassy-rp/src/intrinsics.rs
@@ -223,7 +223,7 @@ macro_rules! intrinsics {
223 223
224 #[cfg(all(target_arch = "arm", feature = "intrinsics"))] 224 #[cfg(all(target_arch = "arm", feature = "intrinsics"))]
225 mod $name { 225 mod $name {
226 #[no_mangle] 226 #[unsafe(no_mangle)]
227 $(#[$($attr)*])* 227 $(#[$($attr)*])*
228 pub extern $abi fn $name( $($argname: $ty),* ) -> $ret { 228 pub extern $abi fn $name( $($argname: $ty),* ) -> $ret {
229 super::$name($($argname),*) 229 super::$name($($argname),*)
@@ -257,7 +257,7 @@ macro_rules! intrinsics {
257 257
258 #[cfg(all(target_arch = "arm", feature = "intrinsics"))] 258 #[cfg(all(target_arch = "arm", feature = "intrinsics"))]
259 mod $name { 259 mod $name {
260 #[no_mangle] 260 #[unsafe(no_mangle)]
261 $(#[$($attr)*])* 261 $(#[$($attr)*])*
262 pub unsafe extern $abi fn $name( $($argname: $ty),* ) -> $ret { 262 pub unsafe extern $abi fn $name( $($argname: $ty),* ) -> $ret {
263 super::$name($($argname),*) 263 super::$name($($argname),*)
@@ -392,7 +392,7 @@ macro_rules! division_function {
392 ); 392 );
393 393
394 #[cfg(target_arch = "arm")] 394 #[cfg(target_arch = "arm")]
395 extern "aapcs" { 395 unsafe extern "aapcs" {
396 // Connect a local name to global symbol above through FFI. 396 // Connect a local name to global symbol above through FFI.
397 #[link_name = concat!("_erphal_", stringify!($name)) ] 397 #[link_name = concat!("_erphal_", stringify!($name)) ]
398 fn $name(n: $argty, d: $argty) -> u64; 398 fn $name(n: $argty, d: $argty) -> u64;
diff --git a/embassy-rp/src/lib.rs b/embassy-rp/src/lib.rs
index d03ba1fef..4cb1a0912 100644
--- a/embassy-rp/src/lib.rs
+++ b/embassy-rp/src/lib.rs
@@ -1,5 +1,7 @@
1#![no_std] 1#![no_std]
2#![allow(async_fn_in_trait)] 2#![allow(async_fn_in_trait)]
3#![allow(unsafe_op_in_unsafe_fn)]
4#![allow(unused_unsafe)]
3#![doc = include_str!("../README.md")] 5#![doc = include_str!("../README.md")]
4#![warn(missing_docs)] 6#![warn(missing_docs)]
5 7
@@ -190,7 +192,7 @@ macro_rules! bind_interrupts {
190 192
191 $( 193 $(
192 #[allow(non_snake_case)] 194 #[allow(non_snake_case)]
193 #[no_mangle] 195 #[unsafe(no_mangle)]
194 $(#[cfg($cond_irq)])? 196 $(#[cfg($cond_irq)])?
195 unsafe extern "C" fn $irq() { 197 unsafe extern "C" fn $irq() {
196 unsafe { 198 unsafe {
@@ -446,13 +448,13 @@ macro_rules! select_bootloader {
446 ( $( $feature:literal => $loader:ident, )+ default => $default:ident ) => { 448 ( $( $feature:literal => $loader:ident, )+ default => $default:ident ) => {
447 $( 449 $(
448 #[cfg(feature = $feature)] 450 #[cfg(feature = $feature)]
449 #[link_section = ".boot2"] 451 #[unsafe(link_section = ".boot2")]
450 #[used] 452 #[used]
451 static BOOT2: [u8; 256] = rp2040_boot2::$loader; 453 static BOOT2: [u8; 256] = rp2040_boot2::$loader;
452 )* 454 )*
453 455
454 #[cfg(not(any( $( feature = $feature),* )))] 456 #[cfg(not(any( $( feature = $feature),* )))]
455 #[link_section = ".boot2"] 457 #[unsafe(link_section = ".boot2")]
456 #[used] 458 #[used]
457 static BOOT2: [u8; 256] = rp2040_boot2::$default; 459 static BOOT2: [u8; 256] = rp2040_boot2::$default;
458 } 460 }
@@ -475,13 +477,13 @@ macro_rules! select_imagedef {
475 ( $( $feature:literal => $imagedef:ident, )+ default => $default:ident ) => { 477 ( $( $feature:literal => $imagedef:ident, )+ default => $default:ident ) => {
476 $( 478 $(
477 #[cfg(feature = $feature)] 479 #[cfg(feature = $feature)]
478 #[link_section = ".start_block"] 480 #[unsafe(link_section = ".start_block")]
479 #[used] 481 #[used]
480 static IMAGE_DEF: crate::block::ImageDef = crate::block::ImageDef::$imagedef(); 482 static IMAGE_DEF: crate::block::ImageDef = crate::block::ImageDef::$imagedef();
481 )* 483 )*
482 484
483 #[cfg(not(any( $( feature = $feature),* )))] 485 #[cfg(not(any( $( feature = $feature),* )))]
484 #[link_section = ".start_block"] 486 #[unsafe(link_section = ".start_block")]
485 #[used] 487 #[used]
486 static IMAGE_DEF: crate::block::ImageDef = crate::block::ImageDef::$default(); 488 static IMAGE_DEF: crate::block::ImageDef = crate::block::ImageDef::$default();
487 } 489 }
@@ -528,7 +530,7 @@ select_imagedef! {
528/// } 530/// }
529/// ``` 531/// ```
530pub fn install_core0_stack_guard() -> Result<(), ()> { 532pub fn install_core0_stack_guard() -> Result<(), ()> {
531 extern "C" { 533 unsafe extern "C" {
532 static mut _stack_end: usize; 534 static mut _stack_end: usize;
533 } 535 }
534 unsafe { install_stack_guard(core::ptr::addr_of_mut!(_stack_end)) } 536 unsafe { install_stack_guard(core::ptr::addr_of_mut!(_stack_end)) }
diff --git a/embassy-rp/src/multicore.rs b/embassy-rp/src/multicore.rs
index adedc98ad..3b120e349 100644
--- a/embassy-rp/src/multicore.rs
+++ b/embassy-rp/src/multicore.rs
@@ -14,6 +14,7 @@
14//! use embassy_rp::multicore::Stack; 14//! use embassy_rp::multicore::Stack;
15//! use static_cell::StaticCell; 15//! use static_cell::StaticCell;
16//! use embassy_executor::Executor; 16//! use embassy_executor::Executor;
17//! use core::ptr::addr_of_mut;
17//! 18//!
18//! static mut CORE1_STACK: Stack<4096> = Stack::new(); 19//! static mut CORE1_STACK: Stack<4096> = Stack::new();
19//! static EXECUTOR0: StaticCell<Executor> = StaticCell::new(); 20//! static EXECUTOR0: StaticCell<Executor> = StaticCell::new();
@@ -36,7 +37,7 @@
36//! fn main() -> ! { 37//! fn main() -> ! {
37//! let p = embassy_rp::init(Default::default()); 38//! let p = embassy_rp::init(Default::default());
38//! 39//!
39//! embassy_rp::multicore::spawn_core1(p.CORE1, unsafe { &mut CORE1_STACK }, move || { 40//! embassy_rp::multicore::spawn_core1(p.CORE1, unsafe { &mut *addr_of_mut!(CORE1_STACK) }, move || {
40//! let executor1 = EXECUTOR1.init(Executor::new()); 41//! let executor1 = EXECUTOR1.init(Executor::new());
41//! executor1.run(|spawner| spawner.spawn(core1_task().unwrap())); 42//! executor1.run(|spawner| spawner.spawn(core1_task().unwrap()));
42//! }); 43//! });
@@ -47,11 +48,11 @@
47//! ``` 48//! ```
48 49
49use core::mem::ManuallyDrop; 50use core::mem::ManuallyDrop;
50use core::sync::atomic::{compiler_fence, AtomicBool, Ordering}; 51use core::sync::atomic::{AtomicBool, Ordering, compiler_fence};
51 52
52use crate::interrupt::InterruptExt; 53use crate::interrupt::InterruptExt;
53use crate::peripherals::CORE1; 54use crate::peripherals::CORE1;
54use crate::{gpio, install_stack_guard, interrupt, pac, Peri}; 55use crate::{Peri, gpio, install_stack_guard, interrupt, pac};
55 56
56const PAUSE_TOKEN: u32 = 0xDEADBEEF; 57const PAUSE_TOKEN: u32 = 0xDEADBEEF;
57const RESUME_TOKEN: u32 = !0xDEADBEEF; 58const RESUME_TOKEN: u32 = !0xDEADBEEF;
@@ -110,7 +111,6 @@ impl<const SIZE: usize> Stack<SIZE> {
110 111
111#[cfg(all(feature = "rt", feature = "rp2040"))] 112#[cfg(all(feature = "rt", feature = "rp2040"))]
112#[interrupt] 113#[interrupt]
113#[link_section = ".data.ram_func"]
114unsafe fn SIO_IRQ_PROC1() { 114unsafe fn SIO_IRQ_PROC1() {
115 let sio = pac::SIO; 115 let sio = pac::SIO;
116 // Clear IRQ 116 // Clear IRQ
@@ -135,7 +135,6 @@ unsafe fn SIO_IRQ_PROC1() {
135 135
136#[cfg(all(feature = "rt", feature = "_rp235x"))] 136#[cfg(all(feature = "rt", feature = "_rp235x"))]
137#[interrupt] 137#[interrupt]
138#[link_section = ".data.ram_func"]
139unsafe fn SIO_IRQ_FIFO() { 138unsafe fn SIO_IRQ_FIFO() {
140 let sio = pac::SIO; 139 let sio = pac::SIO;
141 // Clear IRQ 140 // Clear IRQ
diff --git a/embassy-rp/src/pio/mod.rs b/embassy-rp/src/pio/mod.rs
index 5f554dfe3..38ee1f97c 100644
--- a/embassy-rp/src/pio/mod.rs
+++ b/embassy-rp/src/pio/mod.rs
@@ -2,21 +2,21 @@
2use core::future::Future; 2use core::future::Future;
3use core::marker::PhantomData; 3use core::marker::PhantomData;
4use core::pin::Pin as FuturePin; 4use core::pin::Pin as FuturePin;
5use core::sync::atomic::{compiler_fence, Ordering}; 5use core::sync::atomic::{Ordering, compiler_fence};
6use core::task::{Context, Poll}; 6use core::task::{Context, Poll};
7 7
8use atomic_polyfill::{AtomicU64, AtomicU8}; 8use atomic_polyfill::{AtomicU8, AtomicU64};
9use embassy_hal_internal::{Peri, PeripheralType}; 9use embassy_hal_internal::{Peri, PeripheralType};
10use embassy_sync::waitqueue::AtomicWaker; 10use embassy_sync::waitqueue::AtomicWaker;
11use fixed::types::extra::U8;
12use fixed::FixedU32; 11use fixed::FixedU32;
12use fixed::types::extra::U8;
13use pio::{Program, SideSet, Wrap}; 13use pio::{Program, SideSet, Wrap};
14 14
15use crate::dma::{self, Channel, Transfer, Word}; 15use crate::dma::{self, Channel, Transfer, Word};
16use crate::gpio::{self, AnyPin, Drive, Level, Pull, SealedPin, SlewRate}; 16use crate::gpio::{self, AnyPin, Drive, Level, Pull, SealedPin, SlewRate};
17use crate::interrupt::typelevel::{Binding, Handler, Interrupt}; 17use crate::interrupt::typelevel::{Binding, Handler, Interrupt};
18use crate::relocate::RelocatedProgram; 18use crate::relocate::RelocatedProgram;
19use crate::{pac, peripherals, RegExt}; 19use crate::{RegExt, pac, peripherals};
20 20
21mod instr; 21mod instr;
22 22
@@ -984,11 +984,7 @@ impl<'d, PIO: Instance + 'd, const SM: usize> StateMachine<'d, PIO, SM> {
984 984
985 #[cfg(feature = "_rp235x")] 985 #[cfg(feature = "_rp235x")]
986 fn pin_base() -> u8 { 986 fn pin_base() -> u8 {
987 if PIO::PIO.gpiobase().read().gpiobase() { 987 if PIO::PIO.gpiobase().read().gpiobase() { 16 } else { 0 }
988 16
989 } else {
990 0
991 }
992 } 988 }
993 989
994 /// Sets pin directions. This pauses the current state machine to run `SET` commands 990 /// Sets pin directions. This pauses the current state machine to run `SET` commands
diff --git a/embassy-rp/src/pio_programs/hd44780.rs b/embassy-rp/src/pio_programs/hd44780.rs
index 546c85a89..78281ddd4 100644
--- a/embassy-rp/src/pio_programs/hd44780.rs
+++ b/embassy-rp/src/pio_programs/hd44780.rs
@@ -1,12 +1,12 @@
1//! [HD44780 display driver](https://www.sparkfun.com/datasheets/LCD/HD44780.pdf) 1//! [HD44780 display driver](https://www.sparkfun.com/datasheets/LCD/HD44780.pdf)
2 2
3use crate::Peri;
3use crate::dma::{AnyChannel, Channel}; 4use crate::dma::{AnyChannel, Channel};
4use crate::pio::{ 5use crate::pio::{
5 Common, Config, Direction, FifoJoin, Instance, Irq, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, 6 Common, Config, Direction, FifoJoin, Instance, Irq, LoadedProgram, PioPin, ShiftConfig, ShiftDirection,
6 StateMachine, 7 StateMachine,
7}; 8};
8use crate::pio_programs::clock_divider::calculate_pio_clock_divider; 9use crate::pio_programs::clock_divider::calculate_pio_clock_divider;
9use crate::Peri;
10 10
11/// This struct represents a HD44780 program that takes command words (<wait:24> <command:4> <0:4>) 11/// This struct represents a HD44780 program that takes command words (<wait:24> <command:4> <0:4>)
12pub struct PioHD44780CommandWordProgram<'a, PIO: Instance> { 12pub struct PioHD44780CommandWordProgram<'a, PIO: Instance> {
diff --git a/embassy-rp/src/pio_programs/i2s.rs b/embassy-rp/src/pio_programs/i2s.rs
index 2382a3f9f..7e5f68ad6 100644
--- a/embassy-rp/src/pio_programs/i2s.rs
+++ b/embassy-rp/src/pio_programs/i2s.rs
@@ -2,12 +2,12 @@
2 2
3use fixed::traits::ToFixed; 3use fixed::traits::ToFixed;
4 4
5use crate::Peri;
5use crate::dma::{AnyChannel, Channel, Transfer}; 6use crate::dma::{AnyChannel, Channel, Transfer};
6use crate::gpio::Pull; 7use crate::gpio::Pull;
7use crate::pio::{ 8use crate::pio::{
8 Common, Config, Direction, FifoJoin, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine, 9 Common, Config, Direction, FifoJoin, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine,
9}; 10};
10use crate::Peri;
11 11
12/// This struct represents an i2s receiver & controller driver program 12/// This struct represents an i2s receiver & controller driver program
13pub struct PioI2sInProgram<'d, PIO: Instance> { 13pub struct PioI2sInProgram<'d, PIO: Instance> {
diff --git a/embassy-rp/src/pio_programs/onewire.rs b/embassy-rp/src/pio_programs/onewire.rs
index 980d0fe5f..09babc229 100644
--- a/embassy-rp/src/pio_programs/onewire.rs
+++ b/embassy-rp/src/pio_programs/onewire.rs
@@ -1,11 +1,11 @@
1//! OneWire pio driver 1//! OneWire pio driver
2 2
3use crate::Peri;
3use crate::clocks::clk_sys_freq; 4use crate::clocks::clk_sys_freq;
4use crate::gpio::Level; 5use crate::gpio::Level;
5use crate::pio::{ 6use crate::pio::{
6 Common, Config, Direction, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine, 7 Common, Config, Direction, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine,
7}; 8};
8use crate::Peri;
9 9
10/// This struct represents a onewire driver program 10/// This struct represents a onewire driver program
11pub struct PioOneWireProgram<'a, PIO: Instance> { 11pub struct PioOneWireProgram<'a, PIO: Instance> {
@@ -321,11 +321,7 @@ impl PioOneWireSearch {
321 321
322 /// Search for the next address on the bus 322 /// Search for the next address on the bus
323 pub async fn next<PIO: Instance, const SM: usize>(&mut self, pio: &mut PioOneWire<'_, PIO, SM>) -> Option<u64> { 323 pub async fn next<PIO: Instance, const SM: usize>(&mut self, pio: &mut PioOneWire<'_, PIO, SM>) -> Option<u64> {
324 if self.finished { 324 if self.finished { None } else { pio.search(self).await }
325 None
326 } else {
327 pio.search(self).await
328 }
329 } 325 }
330 326
331 /// Is finished when all devices have been found 327 /// Is finished when all devices have been found
diff --git a/embassy-rp/src/pio_programs/pwm.rs b/embassy-rp/src/pio_programs/pwm.rs
index f0f837bc5..ba06bb3c1 100644
--- a/embassy-rp/src/pio_programs/pwm.rs
+++ b/embassy-rp/src/pio_programs/pwm.rs
@@ -6,7 +6,7 @@ use pio::InstructionOperands;
6 6
7use crate::gpio::Level; 7use crate::gpio::Level;
8use crate::pio::{Common, Config, Direction, Instance, LoadedProgram, Pin, PioPin, StateMachine}; 8use crate::pio::{Common, Config, Direction, Instance, LoadedProgram, Pin, PioPin, StateMachine};
9use crate::{clocks, Peri}; 9use crate::{Peri, clocks};
10 10
11/// This converts the duration provided into the number of cycles the PIO needs to run to make it take the same time 11/// This converts the duration provided into the number of cycles the PIO needs to run to make it take the same time
12fn to_pio_cycles(duration: Duration) -> u32 { 12fn to_pio_cycles(duration: Duration) -> u32 {
diff --git a/embassy-rp/src/pio_programs/rotary_encoder.rs b/embassy-rp/src/pio_programs/rotary_encoder.rs
index 70b3795e9..6347527e6 100644
--- a/embassy-rp/src/pio_programs/rotary_encoder.rs
+++ b/embassy-rp/src/pio_programs/rotary_encoder.rs
@@ -1,11 +1,11 @@
1//! PIO backed quadrature encoder 1//! PIO backed quadrature encoder
2 2
3use crate::Peri;
3use crate::gpio::Pull; 4use crate::gpio::Pull;
4use crate::pio::{ 5use crate::pio::{
5 Common, Config, Direction as PioDirection, FifoJoin, Instance, LoadedProgram, PioPin, ShiftDirection, StateMachine, 6 Common, Config, Direction as PioDirection, FifoJoin, Instance, LoadedProgram, PioPin, ShiftDirection, StateMachine,
6}; 7};
7use crate::pio_programs::clock_divider::calculate_pio_clock_divider; 8use crate::pio_programs::clock_divider::calculate_pio_clock_divider;
8use crate::Peri;
9 9
10/// This struct represents an Encoder program loaded into pio instruction memory. 10/// This struct represents an Encoder program loaded into pio instruction memory.
11pub struct PioEncoderProgram<'a, PIO: Instance> { 11pub struct PioEncoderProgram<'a, PIO: Instance> {
diff --git a/embassy-rp/src/pio_programs/stepper.rs b/embassy-rp/src/pio_programs/stepper.rs
index 0e9a8daf9..5762ee189 100644
--- a/embassy-rp/src/pio_programs/stepper.rs
+++ b/embassy-rp/src/pio_programs/stepper.rs
@@ -2,9 +2,9 @@
2 2
3use core::mem::{self, MaybeUninit}; 3use core::mem::{self, MaybeUninit};
4 4
5use crate::Peri;
5use crate::pio::{Common, Config, Direction, Instance, Irq, LoadedProgram, PioPin, StateMachine}; 6use crate::pio::{Common, Config, Direction, Instance, Irq, LoadedProgram, PioPin, StateMachine};
6use crate::pio_programs::clock_divider::calculate_pio_clock_divider; 7use crate::pio_programs::clock_divider::calculate_pio_clock_divider;
7use crate::Peri;
8 8
9/// This struct represents a Stepper driver program loaded into pio instruction memory. 9/// This struct represents a Stepper driver program loaded into pio instruction memory.
10pub struct PioStepperProgram<'a, PIO: Instance> { 10pub struct PioStepperProgram<'a, PIO: Instance> {
diff --git a/embassy-rp/src/pio_programs/uart.rs b/embassy-rp/src/pio_programs/uart.rs
index 04e39a571..444efb5db 100644
--- a/embassy-rp/src/pio_programs/uart.rs
+++ b/embassy-rp/src/pio_programs/uart.rs
@@ -5,12 +5,12 @@ use core::convert::Infallible;
5use embedded_io_async::{ErrorType, Read, Write}; 5use embedded_io_async::{ErrorType, Read, Write};
6use fixed::traits::ToFixed; 6use fixed::traits::ToFixed;
7 7
8use crate::Peri;
8use crate::clocks::clk_sys_freq; 9use crate::clocks::clk_sys_freq;
9use crate::gpio::Level; 10use crate::gpio::Level;
10use crate::pio::{ 11use crate::pio::{
11 Common, Config, Direction as PioDirection, FifoJoin, Instance, LoadedProgram, PioPin, ShiftDirection, StateMachine, 12 Common, Config, Direction as PioDirection, FifoJoin, Instance, LoadedProgram, PioPin, ShiftDirection, StateMachine,
12}; 13};
13use crate::Peri;
14 14
15/// This struct represents a uart tx program loaded into pio instruction memory. 15/// This struct represents a uart tx program loaded into pio instruction memory.
16pub struct PioUartTxProgram<'d, PIO: Instance> { 16pub struct PioUartTxProgram<'d, PIO: Instance> {
diff --git a/embassy-rp/src/pio_programs/ws2812.rs b/embassy-rp/src/pio_programs/ws2812.rs
index 37dd1c4e0..e6851b1a6 100644
--- a/embassy-rp/src/pio_programs/ws2812.rs
+++ b/embassy-rp/src/pio_programs/ws2812.rs
@@ -4,12 +4,12 @@ use embassy_time::Timer;
4use fixed::types::U24F8; 4use fixed::types::U24F8;
5use smart_leds::{RGB8, RGBW}; 5use smart_leds::{RGB8, RGBW};
6 6
7use crate::Peri;
7use crate::clocks::clk_sys_freq; 8use crate::clocks::clk_sys_freq;
8use crate::dma::{AnyChannel, Channel}; 9use crate::dma::{AnyChannel, Channel};
9use crate::pio::{ 10use crate::pio::{
10 Common, Config, FifoJoin, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine, 11 Common, Config, FifoJoin, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine,
11}; 12};
12use crate::Peri;
13 13
14const T1: u8 = 2; // start bit 14const T1: u8 = 2; // start bit
15const T2: u8 = 5; // data bit 15const T2: u8 = 5; // data bit
diff --git a/embassy-rp/src/psram.rs b/embassy-rp/src/psram.rs
index ae43dd5aa..25185ead2 100644
--- a/embassy-rp/src/psram.rs
+++ b/embassy-rp/src/psram.rs
@@ -10,7 +10,7 @@
10 10
11#![cfg(feature = "_rp235x")] 11#![cfg(feature = "_rp235x")]
12 12
13use critical_section::{acquire, release, CriticalSection, RestoreState}; 13use critical_section::{CriticalSection, RestoreState, acquire, release};
14 14
15use crate::pac; 15use crate::pac;
16use crate::qmi_cs1::QmiCs1; 16use crate::qmi_cs1::QmiCs1;
@@ -251,7 +251,7 @@ impl<'d> Psram<'d> {
251 } 251 }
252 252
253 /// Verify APS6404L PSRAM device matches expected configuration. 253 /// Verify APS6404L PSRAM device matches expected configuration.
254 #[link_section = ".data.ram_func"] 254 #[unsafe(link_section = ".data.ram_func")]
255 #[inline(never)] 255 #[inline(never)]
256 fn verify_aps6404l(qmi: &pac::qmi::Qmi, expected_size: usize) -> Result<(), Error> { 256 fn verify_aps6404l(qmi: &pac::qmi::Qmi, expected_size: usize) -> Result<(), Error> {
257 // APS6404L-specific constants 257 // APS6404L-specific constants
@@ -306,7 +306,7 @@ impl<'d> Psram<'d> {
306 Ok(()) 306 Ok(())
307 } 307 }
308 308
309 #[link_section = ".data.ram_func"] 309 #[unsafe(link_section = ".data.ram_func")]
310 #[inline(never)] 310 #[inline(never)]
311 unsafe fn read_aps6404l_kgd_eid(qmi: &pac::qmi::Qmi) -> (u32, u32) { 311 unsafe fn read_aps6404l_kgd_eid(qmi: &pac::qmi::Qmi) -> (u32, u32) {
312 const RESET_ENABLE_CMD: u8 = 0xf5; 312 const RESET_ENABLE_CMD: u8 = 0xf5;
@@ -435,7 +435,7 @@ impl<'d> Psram<'d> {
435 } 435 }
436 436
437 /// Initialize PSRAM with proper timing. 437 /// Initialize PSRAM with proper timing.
438 #[link_section = ".data.ram_func"] 438 #[unsafe(link_section = ".data.ram_func")]
439 #[inline(never)] 439 #[inline(never)]
440 fn init_psram(qmi: &pac::qmi::Qmi, xip_ctrl: &pac::xip_ctrl::XipCtrl, config: &Config) -> Result<(), Error> { 440 fn init_psram(qmi: &pac::qmi::Qmi, xip_ctrl: &pac::xip_ctrl::XipCtrl, config: &Config) -> Result<(), Error> {
441 // Set PSRAM timing for APS6404 441 // Set PSRAM timing for APS6404
@@ -610,7 +610,7 @@ impl<'d> Psram<'d> {
610 Ok(()) 610 Ok(())
611 } 611 }
612 612
613 #[link_section = ".data.ram_func"] 613 #[unsafe(link_section = ".data.ram_func")]
614 #[inline(never)] 614 #[inline(never)]
615 unsafe fn direct_csr_send_init_command(config: &Config, init_cmd: u8) { 615 unsafe fn direct_csr_send_init_command(config: &Config, init_cmd: u8) {
616 #[cfg(target_arch = "arm")] 616 #[cfg(target_arch = "arm")]
diff --git a/embassy-rp/src/pwm.rs b/embassy-rp/src/pwm.rs
index 1e1ccc4c6..59a3fc9a2 100644
--- a/embassy-rp/src/pwm.rs
+++ b/embassy-rp/src/pwm.rs
@@ -3,13 +3,13 @@
3use embassy_hal_internal::{Peri, PeripheralType}; 3use embassy_hal_internal::{Peri, PeripheralType};
4pub use embedded_hal_1::pwm::SetDutyCycle; 4pub use embedded_hal_1::pwm::SetDutyCycle;
5use embedded_hal_1::pwm::{Error, ErrorKind, ErrorType}; 5use embedded_hal_1::pwm::{Error, ErrorKind, ErrorType};
6use fixed::traits::ToFixed;
7use fixed::FixedU16; 6use fixed::FixedU16;
7use fixed::traits::ToFixed;
8use pac::pwm::regs::{ChDiv, Intr}; 8use pac::pwm::regs::{ChDiv, Intr};
9use pac::pwm::vals::Divmode; 9use pac::pwm::vals::Divmode;
10 10
11use crate::gpio::{AnyPin, Pin as GpioPin, Pull, SealedPin as _}; 11use crate::gpio::{AnyPin, Pin as GpioPin, Pull, SealedPin as _};
12use crate::{pac, peripherals, RegExt}; 12use crate::{RegExt, pac, peripherals};
13 13
14/// The configuration of a PWM slice. 14/// The configuration of a PWM slice.
15/// Note the period in clock cycles of a slice can be computed as: 15/// Note the period in clock cycles of a slice can be computed as:
diff --git a/embassy-rp/src/rtc/mod.rs b/embassy-rp/src/rtc/mod.rs
index 8b0deed21..68fb3b765 100644
--- a/embassy-rp/src/rtc/mod.rs
+++ b/embassy-rp/src/rtc/mod.rs
@@ -2,7 +2,7 @@
2mod filter; 2mod filter;
3 3
4use core::future::poll_fn; 4use core::future::poll_fn;
5use core::sync::atomic::{compiler_fence, AtomicBool, Ordering}; 5use core::sync::atomic::{AtomicBool, Ordering, compiler_fence};
6use core::task::Poll; 6use core::task::Poll;
7 7
8use embassy_hal_internal::{Peri, PeripheralType}; 8use embassy_hal_internal::{Peri, PeripheralType};
diff --git a/embassy-rp/src/time_driver.rs b/embassy-rp/src/time_driver.rs
index d598287a9..ec1c17ed5 100644
--- a/embassy-rp/src/time_driver.rs
+++ b/embassy-rp/src/time_driver.rs
@@ -2,8 +2,8 @@
2use core::cell::{Cell, RefCell}; 2use core::cell::{Cell, RefCell};
3 3
4use critical_section::CriticalSection; 4use critical_section::CriticalSection;
5use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
6use embassy_sync::blocking_mutex::Mutex; 5use embassy_sync::blocking_mutex::Mutex;
6use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
7use embassy_time_driver::Driver; 7use embassy_time_driver::Driver;
8use embassy_time_queue_utils::Queue; 8use embassy_time_queue_utils::Queue;
9#[cfg(feature = "rp2040")] 9#[cfg(feature = "rp2040")]
diff --git a/embassy-rp/src/uart/mod.rs b/embassy-rp/src/uart/mod.rs
index 6f4e2ee07..43187df2d 100644
--- a/embassy-rp/src/uart/mod.rs
+++ b/embassy-rp/src/uart/mod.rs
@@ -4,7 +4,7 @@ use core::marker::PhantomData;
4use core::task::Poll; 4use core::task::Poll;
5 5
6use atomic_polyfill::{AtomicU16, Ordering}; 6use atomic_polyfill::{AtomicU16, Ordering};
7use embassy_futures::select::{select, Either}; 7use embassy_futures::select::{Either, select};
8use embassy_hal_internal::{Peri, PeripheralType}; 8use embassy_hal_internal::{Peri, PeripheralType};
9use embassy_sync::waitqueue::AtomicWaker; 9use embassy_sync::waitqueue::AtomicWaker;
10use embassy_time::{Delay, Timer}; 10use embassy_time::{Delay, Timer};
@@ -16,7 +16,7 @@ use crate::gpio::{AnyPin, SealedPin};
16use crate::interrupt::typelevel::{Binding, Interrupt as _}; 16use crate::interrupt::typelevel::{Binding, Interrupt as _};
17use crate::interrupt::{Interrupt, InterruptExt}; 17use crate::interrupt::{Interrupt, InterruptExt};
18use crate::pac::io::vals::{Inover, Outover}; 18use crate::pac::io::vals::{Inover, Outover};
19use crate::{interrupt, pac, peripherals, RegExt}; 19use crate::{RegExt, interrupt, pac, peripherals};
20 20
21mod buffered; 21mod buffered;
22pub use buffered::{BufferedInterruptHandler, BufferedUart, BufferedUartRx, BufferedUartTx}; 22pub use buffered::{BufferedInterruptHandler, BufferedUart, BufferedUartRx, BufferedUartTx};
@@ -863,11 +863,7 @@ impl<'d, M: Mode> Uart<'d, M> {
863 if let Some(pin) = &tx { 863 if let Some(pin) = &tx {
864 let funcsel = { 864 let funcsel = {
865 let pin_number = ((pin.gpio().as_ptr() as u32) & 0x1FF) / 8; 865 let pin_number = ((pin.gpio().as_ptr() as u32) & 0x1FF) / 8;
866 if (pin_number % 4) == 0 { 866 if (pin_number % 4) == 0 { 2 } else { 11 }
867 2
868 } else {
869 11
870 }
871 }; 867 };
872 pin.gpio().ctrl().write(|w| { 868 pin.gpio().ctrl().write(|w| {
873 w.set_funcsel(funcsel); 869 w.set_funcsel(funcsel);
@@ -886,11 +882,7 @@ impl<'d, M: Mode> Uart<'d, M> {
886 if let Some(pin) = &rx { 882 if let Some(pin) = &rx {
887 let funcsel = { 883 let funcsel = {
888 let pin_number = ((pin.gpio().as_ptr() as u32) & 0x1FF) / 8; 884 let pin_number = ((pin.gpio().as_ptr() as u32) & 0x1FF) / 8;
889 if ((pin_number - 1) % 4) == 0 { 885 if ((pin_number - 1) % 4) == 0 { 2 } else { 11 }
890 2
891 } else {
892 11
893 }
894 }; 886 };
895 pin.gpio().ctrl().write(|w| { 887 pin.gpio().ctrl().write(|w| {
896 w.set_funcsel(funcsel); 888 w.set_funcsel(funcsel);
diff --git a/embassy-rp/src/usb.rs b/embassy-rp/src/usb.rs
index 671ecbd32..e8273c3f2 100644
--- a/embassy-rp/src/usb.rs
+++ b/embassy-rp/src/usb.rs
@@ -2,7 +2,7 @@
2use core::future::poll_fn; 2use core::future::poll_fn;
3use core::marker::PhantomData; 3use core::marker::PhantomData;
4use core::slice; 4use core::slice;
5use core::sync::atomic::{compiler_fence, Ordering}; 5use core::sync::atomic::{Ordering, compiler_fence};
6use core::task::Poll; 6use core::task::Poll;
7 7
8use embassy_hal_internal::PeripheralType; 8use embassy_hal_internal::PeripheralType;
@@ -13,7 +13,7 @@ use embassy_usb_driver::{
13}; 13};
14 14
15use crate::interrupt::typelevel::{Binding, Interrupt}; 15use crate::interrupt::typelevel::{Binding, Interrupt};
16use crate::{interrupt, pac, peripherals, Peri, RegExt}; 16use crate::{Peri, RegExt, interrupt, pac, peripherals};
17 17
18trait SealedInstance { 18trait SealedInstance {
19 fn regs() -> crate::pac::usb::Usb; 19 fn regs() -> crate::pac::usb::Usb;
@@ -545,11 +545,7 @@ impl<'d, T: Instance> driver::Endpoint for Endpoint<'d, T, In> {
545 poll_fn(|cx| { 545 poll_fn(|cx| {
546 EP_IN_WAKERS[index].register(cx.waker()); 546 EP_IN_WAKERS[index].register(cx.waker());
547 let val = T::dpram().ep_in_control(self.info.addr.index() - 1).read(); 547 let val = T::dpram().ep_in_control(self.info.addr.index() - 1).read();
548 if val.enable() { 548 if val.enable() { Poll::Ready(()) } else { Poll::Pending }
549 Poll::Ready(())
550 } else {
551 Poll::Pending
552 }
553 }) 549 })
554 .await; 550 .await;
555 trace!("wait_enabled IN OK"); 551 trace!("wait_enabled IN OK");
@@ -567,11 +563,7 @@ impl<'d, T: Instance> driver::Endpoint for Endpoint<'d, T, Out> {
567 poll_fn(|cx| { 563 poll_fn(|cx| {
568 EP_OUT_WAKERS[index].register(cx.waker()); 564 EP_OUT_WAKERS[index].register(cx.waker());
569 let val = T::dpram().ep_out_control(self.info.addr.index() - 1).read(); 565 let val = T::dpram().ep_out_control(self.info.addr.index() - 1).read();
570 if val.enable() { 566 if val.enable() { Poll::Ready(()) } else { Poll::Pending }
571 Poll::Ready(())
572 } else {
573 Poll::Pending
574 }
575 }) 567 })
576 .await; 568 .await;
577 trace!("wait_enabled OUT OK"); 569 trace!("wait_enabled OUT OK");
diff --git a/embassy-rp/src/watchdog.rs b/embassy-rp/src/watchdog.rs
index 49cf03850..d42601745 100644
--- a/embassy-rp/src/watchdog.rs
+++ b/embassy-rp/src/watchdog.rs
@@ -11,7 +11,7 @@ use core::marker::PhantomData;
11use embassy_time::Duration; 11use embassy_time::Duration;
12 12
13use crate::peripherals::WATCHDOG; 13use crate::peripherals::WATCHDOG;
14use crate::{pac, Peri}; 14use crate::{Peri, pac};
15 15
16/// The reason for a system reset from the watchdog. 16/// The reason for a system reset from the watchdog.
17#[derive(Debug, Copy, Clone, PartialEq, Eq)] 17#[derive(Debug, Copy, Clone, PartialEq, Eq)]