aboutsummaryrefslogtreecommitdiff
path: root/embassy-rp/src
diff options
context:
space:
mode:
authorCaleb Jamison <[email protected]>2024-08-12 04:32:31 -0400
committerCaleb Jamison <[email protected]>2024-08-12 04:32:31 -0400
commit778241fd71b8a0cb541d23b69c3f9e47ec2753ff (patch)
tree101e75f936463a8d3dc6a6f123d4484210717be4 /embassy-rp/src
parent9dc4375f185d5098d9b61116bb5c5279e7298222 (diff)
Fix CI, rename private feature, address comments from dirbaio.
Diffstat (limited to 'embassy-rp/src')
-rw-r--r--embassy-rp/src/adc.rs4
-rw-r--r--embassy-rp/src/binary_info/mod.rs12
-rw-r--r--embassy-rp/src/clocks.rs21
-rw-r--r--embassy-rp/src/dma.rs13
-rw-r--r--embassy-rp/src/flash.rs14
-rw-r--r--embassy-rp/src/gpio.rs17
-rw-r--r--embassy-rp/src/i2c.rs2
-rw-r--r--embassy-rp/src/lib.rs18
-rw-r--r--embassy-rp/src/multicore.rs4
-rw-r--r--embassy-rp/src/pio/mod.rs16
-rw-r--r--embassy-rp/src/pwm.rs10
-rw-r--r--embassy-rp/src/spi.rs8
-rw-r--r--embassy-rp/src/time_driver.rs12
-rw-r--r--embassy-rp/src/uart/mod.rs36
14 files changed, 103 insertions, 84 deletions
diff --git a/embassy-rp/src/adc.rs b/embassy-rp/src/adc.rs
index 9768f480d..9582e43c8 100644
--- a/embassy-rp/src/adc.rs
+++ b/embassy-rp/src/adc.rs
@@ -35,7 +35,7 @@ impl<'p> Channel<'p> {
35 pub fn new_pin(pin: impl Peripheral<P = impl AdcPin + 'p> + 'p, pull: Pull) -> Self { 35 pub fn new_pin(pin: impl Peripheral<P = impl AdcPin + 'p> + 'p, pull: Pull) -> Self {
36 into_ref!(pin); 36 into_ref!(pin);
37 pin.pad_ctrl().modify(|w| { 37 pin.pad_ctrl().modify(|w| {
38 #[cfg(feature = "rp235x")] 38 #[cfg(feature = "_rp235x")]
39 w.set_iso(false); 39 w.set_iso(false);
40 // manual says: 40 // manual says:
41 // 41 //
@@ -234,7 +234,7 @@ impl<'d> Adc<'d, Async> {
234 ) -> Result<(), Error> { 234 ) -> Result<(), Error> {
235 #[cfg(feature = "rp2040")] 235 #[cfg(feature = "rp2040")]
236 let mut rrobin = 0_u8; 236 let mut rrobin = 0_u8;
237 #[cfg(feature = "rp235x")] 237 #[cfg(feature = "_rp235x")]
238 let mut rrobin = 0_u16; 238 let mut rrobin = 0_u16;
239 for c in channels { 239 for c in channels {
240 rrobin |= 1 << c; 240 rrobin |= 1 << c;
diff --git a/embassy-rp/src/binary_info/mod.rs b/embassy-rp/src/binary_info/mod.rs
index ce3829a7c..213565cdf 100644
--- a/embassy-rp/src/binary_info/mod.rs
+++ b/embassy-rp/src/binary_info/mod.rs
@@ -4,13 +4,12 @@
4//! and "rt" features: 4//! and "rt" features:
5//! 5//!
6//! ``` 6//! ```
7//! # use rp235x_hal as hal;
8//! #[link_section = ".bi_entries"] 7//! #[link_section = ".bi_entries"]
9//! #[used] 8//! #[used]
10//! pub static PICOTOOL_ENTRIES: [hal::binary_info::EntryAddr; 3] = [ 9//! pub static PICOTOOL_ENTRIES: [embassy_rp::binary_info::EntryAddr; 3] = [
11//! hal::binary_info_rp_program_name!(c"Program Name Here"), 10//! embassy_rp::binary_info_rp_program_name!(c"Program Name Here"),
12//! hal::binary_info_rp_cargo_version!(), 11//! embassy_rp::binary_info_rp_cargo_version!(),
13//! hal::binary_info_int!(hal::binary_info::make_tag(b"JP"), 0x0000_0001, 0x12345678), 12//! embassy_rp::binary_info_int!(embassy_rp::binary_info::make_tag(b"JP"), 0x0000_0001, 0x12345678),
14//! ]; 13//! ];
15//! ``` 14//! ```
16 15
@@ -163,8 +162,7 @@ pub const fn rp_boot2_name(value: &'static core::ffi::CStr) -> StringEntry {
163/// Create a tag from two ASCII letters. 162/// Create a tag from two ASCII letters.
164/// 163///
165/// ``` 164/// ```
166/// # use rp235x_hal as hal; 165/// let tag = embassy_rp::binary_info::make_tag(b"RP");
167/// let tag = hal::binary_info::make_tag(b"RP");
168/// assert_eq!(tag, 0x5052); 166/// assert_eq!(tag, 0x5052);
169/// ``` 167/// ```
170pub const fn make_tag(c: &[u8; 2]) -> u16 { 168pub const fn make_tag(c: &[u8; 2]) -> u16 {
diff --git a/embassy-rp/src/clocks.rs b/embassy-rp/src/clocks.rs
index 9f387b70f..0084707f5 100644
--- a/embassy-rp/src/clocks.rs
+++ b/embassy-rp/src/clocks.rs
@@ -311,10 +311,10 @@ pub struct SysClkConfig {
311 #[cfg(feature = "rp2040")] 311 #[cfg(feature = "rp2040")]
312 pub div_frac: u8, 312 pub div_frac: u8,
313 /// SYS clock divider. 313 /// SYS clock divider.
314 #[cfg(feature = "rp235x")] 314 #[cfg(feature = "_rp235x")]
315 pub div_int: u16, 315 pub div_int: u16,
316 /// SYS clock fraction. 316 /// SYS clock fraction.
317 #[cfg(feature = "rp235x")] 317 #[cfg(feature = "_rp235x")]
318 pub div_frac: u16, 318 pub div_frac: u16,
319} 319}
320 320
@@ -430,12 +430,12 @@ pub(crate) unsafe fn init(config: ClockConfig) {
430 c.clk_sys_ctrl().modify(|w| w.set_src(ClkSysCtrlSrc::CLK_REF)); 430 c.clk_sys_ctrl().modify(|w| w.set_src(ClkSysCtrlSrc::CLK_REF));
431 #[cfg(feature = "rp2040")] 431 #[cfg(feature = "rp2040")]
432 while c.clk_sys_selected().read() != 1 {} 432 while c.clk_sys_selected().read() != 1 {}
433 #[cfg(feature = "rp235x")] 433 #[cfg(feature = "_rp235x")]
434 while c.clk_sys_selected().read() != pac::clocks::regs::ClkSysSelected(1) {} 434 while c.clk_sys_selected().read() != pac::clocks::regs::ClkSysSelected(1) {}
435 c.clk_ref_ctrl().modify(|w| w.set_src(ClkRefCtrlSrc::ROSC_CLKSRC_PH)); 435 c.clk_ref_ctrl().modify(|w| w.set_src(ClkRefCtrlSrc::ROSC_CLKSRC_PH));
436 #[cfg(feature = "rp2040")] 436 #[cfg(feature = "rp2040")]
437 while c.clk_ref_selected().read() != 1 {} 437 while c.clk_ref_selected().read() != 1 {}
438 #[cfg(feature = "rp235x")] 438 #[cfg(feature = "_rp235x")]
439 while c.clk_ref_selected().read() != pac::clocks::regs::ClkRefSelected(1) {} 439 while c.clk_ref_selected().read() != pac::clocks::regs::ClkRefSelected(1) {}
440 440
441 // Reset the PLLs 441 // Reset the PLLs
@@ -506,7 +506,7 @@ pub(crate) unsafe fn init(config: ClockConfig) {
506 }); 506 });
507 #[cfg(feature = "rp2040")] 507 #[cfg(feature = "rp2040")]
508 while c.clk_ref_selected().read() != (1 << ref_src as u32) {} 508 while c.clk_ref_selected().read() != (1 << ref_src as u32) {}
509 #[cfg(feature = "rp235x")] 509 #[cfg(feature = "_rp235x")]
510 while c.clk_ref_selected().read() != pac::clocks::regs::ClkRefSelected(1 << ref_src as u32) {} 510 while c.clk_ref_selected().read() != pac::clocks::regs::ClkRefSelected(1 << ref_src as u32) {}
511 c.clk_ref_div().write(|w| { 511 c.clk_ref_div().write(|w| {
512 w.set_int(config.ref_clk.div); 512 w.set_int(config.ref_clk.div);
@@ -539,7 +539,7 @@ pub(crate) unsafe fn init(config: ClockConfig) {
539 c.clk_sys_ctrl().write(|w| w.set_src(ClkSysCtrlSrc::CLK_REF)); 539 c.clk_sys_ctrl().write(|w| w.set_src(ClkSysCtrlSrc::CLK_REF));
540 #[cfg(feature = "rp2040")] 540 #[cfg(feature = "rp2040")]
541 while c.clk_sys_selected().read() != (1 << ClkSysCtrlSrc::CLK_REF as u32) {} 541 while c.clk_sys_selected().read() != (1 << ClkSysCtrlSrc::CLK_REF as u32) {}
542 #[cfg(feature = "rp235x")] 542 #[cfg(feature = "_rp235x")]
543 while c.clk_sys_selected().read() != pac::clocks::regs::ClkSysSelected(1 << ClkSysCtrlSrc::CLK_REF as u32) {} 543 while c.clk_sys_selected().read() != pac::clocks::regs::ClkSysSelected(1 << ClkSysCtrlSrc::CLK_REF as u32) {}
544 } 544 }
545 c.clk_sys_ctrl().write(|w| { 545 c.clk_sys_ctrl().write(|w| {
@@ -549,7 +549,7 @@ pub(crate) unsafe fn init(config: ClockConfig) {
549 549
550 #[cfg(feature = "rp2040")] 550 #[cfg(feature = "rp2040")]
551 while c.clk_sys_selected().read() != (1 << sys_src as u32) {} 551 while c.clk_sys_selected().read() != (1 << sys_src as u32) {}
552 #[cfg(feature = "rp235x")] 552 #[cfg(feature = "_rp235x")]
553 while c.clk_sys_selected().read() != pac::clocks::regs::ClkSysSelected(1 << sys_src as u32) {} 553 while c.clk_sys_selected().read() != pac::clocks::regs::ClkSysSelected(1 << sys_src as u32) {}
554 554
555 c.clk_sys_div().write(|w| { 555 c.clk_sys_div().write(|w| {
@@ -661,7 +661,7 @@ pub(crate) unsafe fn init(config: ClockConfig) {
661 } 661 }
662 662
663 // rp235x specific clocks 663 // rp235x specific clocks
664 #[cfg(feature = "rp235x")] 664 #[cfg(feature = "_rp235x")]
665 { 665 {
666 // TODO hstx clock 666 // TODO hstx clock
667 peris.set_hstx(false); 667 peris.set_hstx(false);
@@ -903,7 +903,8 @@ pub enum GpoutSrc {
903 /// ADC. 903 /// ADC.
904 Adc = ClkGpoutCtrlAuxsrc::CLK_ADC as _, 904 Adc = ClkGpoutCtrlAuxsrc::CLK_ADC as _,
905 // RTC. 905 // RTC.
906 //Rtc = ClkGpoutCtrlAuxsrc::CLK_RTC as _, 906 #[cfg(feature = "rp2040")]
907 Rtc = ClkGpoutCtrlAuxsrc::CLK_RTC as _,
907 /// REF. 908 /// REF.
908 Ref = ClkGpoutCtrlAuxsrc::CLK_REF as _, 909 Ref = ClkGpoutCtrlAuxsrc::CLK_REF as _,
909} 910}
@@ -934,7 +935,7 @@ impl<'d, T: GpoutPin> Gpout<'d, T> {
934 } 935 }
935 936
936 /// Set clock divider. 937 /// Set clock divider.
937 #[cfg(feature = "rp235x")] 938 #[cfg(feature = "_rp235x")]
938 pub fn set_div(&self, int: u16, frac: u16) { 939 pub fn set_div(&self, int: u16, frac: u16) {
939 let c = pac::CLOCKS; 940 let c = pac::CLOCKS;
940 c.clk_gpout_div(self.gpout.number()).write(|w| { 941 c.clk_gpout_div(self.gpout.number()).write(|w| {
diff --git a/embassy-rp/src/dma.rs b/embassy-rp/src/dma.rs
index b00ab3f3b..34abe3e2d 100644
--- a/embassy-rp/src/dma.rs
+++ b/embassy-rp/src/dma.rs
@@ -147,7 +147,7 @@ fn copy_inner<'a, C: Channel>(
147 p.trans_count().write(|w| { 147 p.trans_count().write(|w| {
148 *w = len as u32; 148 *w = len as u32;
149 }); 149 });
150 #[cfg(feature = "rp235x")] 150 #[cfg(feature = "_rp235x")]
151 p.trans_count().write(|w| { 151 p.trans_count().write(|w| {
152 w.set_mode(0.into()); 152 w.set_mode(0.into());
153 w.set_count(len as u32); 153 w.set_count(len as u32);
@@ -208,7 +208,10 @@ impl<'a, C: Channel> Future for Transfer<'a, C> {
208 } 208 }
209} 209}
210 210
211#[cfg(feature = "rp2040")]
211pub(crate) const CHANNEL_COUNT: usize = 12; 212pub(crate) const CHANNEL_COUNT: usize = 12;
213#[cfg(feature = "_rp235x")]
214pub(crate) const CHANNEL_COUNT: usize = 16;
212const NEW_AW: AtomicWaker = AtomicWaker::new(); 215const NEW_AW: AtomicWaker = AtomicWaker::new();
213static CHANNEL_WAKERS: [AtomicWaker; CHANNEL_COUNT] = [NEW_AW; CHANNEL_COUNT]; 216static CHANNEL_WAKERS: [AtomicWaker; CHANNEL_COUNT] = [NEW_AW; CHANNEL_COUNT];
214 217
@@ -303,11 +306,11 @@ channel!(DMA_CH8, 8);
303channel!(DMA_CH9, 9); 306channel!(DMA_CH9, 9);
304channel!(DMA_CH10, 10); 307channel!(DMA_CH10, 10);
305channel!(DMA_CH11, 11); 308channel!(DMA_CH11, 11);
306#[cfg(feature = "rp235x")] 309#[cfg(feature = "_rp235x")]
307channel!(DMA_CH12, 12); 310channel!(DMA_CH12, 12);
308#[cfg(feature = "rp235x")] 311#[cfg(feature = "_rp235x")]
309channel!(DMA_CH13, 13); 312channel!(DMA_CH13, 13);
310#[cfg(feature = "rp235x")] 313#[cfg(feature = "_rp235x")]
311channel!(DMA_CH14, 14); 314channel!(DMA_CH14, 14);
312#[cfg(feature = "rp235x")] 315#[cfg(feature = "_rp235x")]
313channel!(DMA_CH15, 15); 316channel!(DMA_CH15, 15);
diff --git a/embassy-rp/src/flash.rs b/embassy-rp/src/flash.rs
index cc84bb12d..9991c3ac0 100644
--- a/embassy-rp/src/flash.rs
+++ b/embassy-rp/src/flash.rs
@@ -669,8 +669,10 @@ mod ram_helpers {
669 669
670 #[inline(never)] 670 #[inline(never)]
671 #[link_section = ".data.ram_func"] 671 #[link_section = ".data.ram_func"]
672 #[cfg(feature = "rp235x")] 672 #[cfg(feature = "_rp235x")]
673 unsafe fn write_flash_inner(_addr: u32, _len: u32, _data: Option<&[u8]>, _ptrs: *const FlashFunctionPointers) {} 673 unsafe fn write_flash_inner(_addr: u32, _len: u32, _data: Option<&[u8]>, _ptrs: *const FlashFunctionPointers) {
674 todo!();
675 }
674 676
675 #[repr(C)] 677 #[repr(C)]
676 struct FlashCommand { 678 struct FlashCommand {
@@ -891,8 +893,10 @@ mod ram_helpers {
891 893
892 #[inline(never)] 894 #[inline(never)]
893 #[link_section = ".data.ram_func"] 895 #[link_section = ".data.ram_func"]
894 #[cfg(feature = "rp235x")] 896 #[cfg(feature = "_rp235x")]
895 unsafe fn read_flash_inner(_cmd: FlashCommand, _ptrs: *const FlashFunctionPointers) {} 897 unsafe fn read_flash_inner(_cmd: FlashCommand, _ptrs: *const FlashFunctionPointers) {
898 todo!();
899 }
896} 900}
897 901
898/// Make sure to uphold the contract points with rp2040-flash. 902/// Make sure to uphold the contract points with rp2040-flash.
@@ -906,7 +910,7 @@ pub(crate) unsafe fn in_ram(operation: impl FnOnce()) -> Result<(), Error> {
906 } 910 }
907 911
908 // Make sure CORE1 is paused during the entire duration of the RAM function 912 // Make sure CORE1 is paused during the entire duration of the RAM function
909 //crate::multicore::pause_core1(); 913 crate::multicore::pause_core1();
910 914
911 critical_section::with(|_| { 915 critical_section::with(|_| {
912 // Wait for all DMA channels in flash to finish before ram operation 916 // Wait for all DMA channels in flash to finish before ram operation
diff --git a/embassy-rp/src/gpio.rs b/embassy-rp/src/gpio.rs
index 24208b82e..d0bb7e574 100644
--- a/embassy-rp/src/gpio.rs
+++ b/embassy-rp/src/gpio.rs
@@ -14,7 +14,12 @@ use crate::pac::SIO;
14use crate::{interrupt, pac, peripherals, Peripheral, RegExt}; 14use crate::{interrupt, pac, peripherals, Peripheral, RegExt};
15 15
16const NEW_AW: AtomicWaker = AtomicWaker::new(); 16const NEW_AW: AtomicWaker = AtomicWaker::new();
17
18#[cfg(any(feature = "rp2040", feature = "rp235xa"))]
17const BANK0_PIN_COUNT: usize = 30; 19const BANK0_PIN_COUNT: usize = 30;
20#[cfg(feature = "rp235xb")]
21const BANK0_PIN_COUNT: usize = 48;
22
18static BANK0_WAKERS: [AtomicWaker; BANK0_PIN_COUNT] = [NEW_AW; BANK0_PIN_COUNT]; 23static BANK0_WAKERS: [AtomicWaker; BANK0_PIN_COUNT] = [NEW_AW; BANK0_PIN_COUNT];
19#[cfg(feature = "qspi-as-gpio")] 24#[cfg(feature = "qspi-as-gpio")]
20const QSPI_PIN_COUNT: usize = 6; 25const QSPI_PIN_COUNT: usize = 6;
@@ -180,7 +185,7 @@ impl<'d> Input<'d> {
180 } 185 }
181 186
182 /// Set the pin's pad isolation 187 /// Set the pin's pad isolation
183 #[cfg(feature = "rp235x")] 188 #[cfg(feature = "_rp235x")]
184 #[inline] 189 #[inline]
185 pub fn set_pad_isolation(&mut self, isolate: bool) { 190 pub fn set_pad_isolation(&mut self, isolate: bool) {
186 self.pin.set_pad_isolation(isolate) 191 self.pin.set_pad_isolation(isolate)
@@ -422,7 +427,7 @@ impl<'d> Output<'d> {
422 } 427 }
423 428
424 /// Set the pin's pad isolation 429 /// Set the pin's pad isolation
425 #[cfg(feature = "rp235x")] 430 #[cfg(feature = "_rp235x")]
426 #[inline] 431 #[inline]
427 pub fn set_pad_isolation(&mut self, isolate: bool) { 432 pub fn set_pad_isolation(&mut self, isolate: bool) {
428 self.pin.set_pad_isolation(isolate) 433 self.pin.set_pad_isolation(isolate)
@@ -555,7 +560,7 @@ impl<'d> OutputOpenDrain<'d> {
555 } 560 }
556 561
557 /// Set the pin's pad isolation 562 /// Set the pin's pad isolation
558 #[cfg(feature = "rp235x")] 563 #[cfg(feature = "_rp235x")]
559 #[inline] 564 #[inline]
560 pub fn set_pad_isolation(&mut self, isolate: bool) { 565 pub fn set_pad_isolation(&mut self, isolate: bool) {
561 self.pin.set_pad_isolation(isolate) 566 self.pin.set_pad_isolation(isolate)
@@ -581,7 +586,7 @@ impl<'d> Flex<'d> {
581 into_ref!(pin); 586 into_ref!(pin);
582 587
583 pin.pad_ctrl().write(|w| { 588 pin.pad_ctrl().write(|w| {
584 #[cfg(feature = "rp235x")] 589 #[cfg(feature = "_rp235x")]
585 w.set_iso(false); 590 w.set_iso(false);
586 w.set_ie(true); 591 w.set_ie(true);
587 }); 592 });
@@ -589,7 +594,7 @@ impl<'d> Flex<'d> {
589 pin.gpio().ctrl().write(|w| { 594 pin.gpio().ctrl().write(|w| {
590 #[cfg(feature = "rp2040")] 595 #[cfg(feature = "rp2040")]
591 w.set_funcsel(pac::io::vals::Gpio0ctrlFuncsel::SIO_0 as _); 596 w.set_funcsel(pac::io::vals::Gpio0ctrlFuncsel::SIO_0 as _);
592 #[cfg(feature = "rp235x")] 597 #[cfg(feature = "_rp235x")]
593 w.set_funcsel(pac::io::vals::Gpio0ctrlFuncsel::SIOB_PROC_0 as _); 598 w.set_funcsel(pac::io::vals::Gpio0ctrlFuncsel::SIOB_PROC_0 as _);
594 }); 599 });
595 600
@@ -788,7 +793,7 @@ impl<'d> Flex<'d> {
788 } 793 }
789 794
790 /// Set the pin's pad isolation 795 /// Set the pin's pad isolation
791 #[cfg(feature = "rp235x")] 796 #[cfg(feature = "_rp235x")]
792 #[inline] 797 #[inline]
793 pub fn set_pad_isolation(&mut self, isolate: bool) { 798 pub fn set_pad_isolation(&mut self, isolate: bool) {
794 self.pin.pad_ctrl().modify(|w| { 799 self.pin.pad_ctrl().modify(|w| {
diff --git a/embassy-rp/src/i2c.rs b/embassy-rp/src/i2c.rs
index 82189d29a..32778215f 100644
--- a/embassy-rp/src/i2c.rs
+++ b/embassy-rp/src/i2c.rs
@@ -363,7 +363,7 @@ where
363{ 363{
364 pin.gpio().ctrl().write(|w| w.set_funcsel(3)); 364 pin.gpio().ctrl().write(|w| w.set_funcsel(3));
365 pin.pad_ctrl().write(|w| { 365 pin.pad_ctrl().write(|w| {
366 #[cfg(feature = "rp235x")] 366 #[cfg(feature = "_rp235x")]
367 w.set_iso(false); 367 w.set_iso(false);
368 w.set_schmitt(true); 368 w.set_schmitt(true);
369 w.set_slewfast(false); 369 w.set_slewfast(false);
diff --git a/embassy-rp/src/lib.rs b/embassy-rp/src/lib.rs
index 0bcc58b86..dc54c1bfe 100644
--- a/embassy-rp/src/lib.rs
+++ b/embassy-rp/src/lib.rs
@@ -15,9 +15,9 @@ mod critical_section_impl;
15mod intrinsics; 15mod intrinsics;
16 16
17pub mod adc; 17pub mod adc;
18#[cfg(feature = "rp235x")] 18#[cfg(feature = "_rp235x")]
19pub mod binary_info; 19pub mod binary_info;
20#[cfg(feature = "rp235x")] 20#[cfg(feature = "_rp235x")]
21pub mod block; 21pub mod block;
22#[cfg(feature = "rp2040")] 22#[cfg(feature = "rp2040")]
23pub mod bootsel; 23pub mod bootsel;
@@ -92,7 +92,7 @@ embassy_hal_internal::interrupt_mod!(
92 SWI_IRQ_5, 92 SWI_IRQ_5,
93); 93);
94 94
95#[cfg(feature = "rp235x")] 95#[cfg(feature = "_rp235x")]
96embassy_hal_internal::interrupt_mod!( 96embassy_hal_internal::interrupt_mod!(
97 TIMER0_IRQ_0, 97 TIMER0_IRQ_0,
98 TIMER0_IRQ_1, 98 TIMER0_IRQ_1,
@@ -267,7 +267,7 @@ embassy_hal_internal::peripherals! {
267 BOOTSEL, 267 BOOTSEL,
268} 268}
269 269
270#[cfg(feature = "rp235x")] 270#[cfg(feature = "_rp235x")]
271embassy_hal_internal::peripherals! { 271embassy_hal_internal::peripherals! {
272 PIN_0, 272 PIN_0,
273 PIN_1, 273 PIN_1,
@@ -497,7 +497,7 @@ fn install_stack_guard(stack_bottom: *mut usize) -> Result<(), ()> {
497 Ok(()) 497 Ok(())
498} 498}
499 499
500#[cfg(feature = "rp235x")] 500#[cfg(all(feature = "_rp235x", armv8m))]
501#[inline(always)] 501#[inline(always)]
502fn install_stack_guard(stack_bottom: *mut usize) -> Result<(), ()> { 502fn install_stack_guard(stack_bottom: *mut usize) -> Result<(), ()> {
503 let core = unsafe { cortex_m::Peripherals::steal() }; 503 let core = unsafe { cortex_m::Peripherals::steal() };
@@ -515,6 +515,14 @@ fn install_stack_guard(stack_bottom: *mut usize) -> Result<(), ()> {
515 Ok(()) 515 Ok(())
516} 516}
517 517
518// This is to hack around cortex_m defaulting to ARMv7 when building tests,
519// so the compile fails when we try to use ARMv8 peripherals.
520#[cfg(all(feature = "_rp235x", not(armv8m)))]
521#[inline(always)]
522fn install_stack_guard(stack_bottom: *mut usize) -> Result<(), ()> {
523 Ok(())
524}
525
518/// HAL configuration for RP. 526/// HAL configuration for RP.
519pub mod config { 527pub mod config {
520 use crate::clocks::ClockConfig; 528 use crate::clocks::ClockConfig;
diff --git a/embassy-rp/src/multicore.rs b/embassy-rp/src/multicore.rs
index d1ce688ce..9f7d77bf5 100644
--- a/embassy-rp/src/multicore.rs
+++ b/embassy-rp/src/multicore.rs
@@ -109,7 +109,7 @@ unsafe fn SIO_IRQ_PROC1() {
109 } 109 }
110} 110}
111 111
112#[cfg(all(feature = "rt", feature = "rp235x"))] 112#[cfg(all(feature = "rt", feature = "_rp235x"))]
113#[interrupt] 113#[interrupt]
114#[link_section = ".data.ram_func"] 114#[link_section = ".data.ram_func"]
115unsafe fn SIO_IRQ_FIFO() { 115unsafe fn SIO_IRQ_FIFO() {
@@ -164,7 +164,7 @@ where
164 unsafe { 164 unsafe {
165 interrupt::SIO_IRQ_PROC1.enable() 165 interrupt::SIO_IRQ_PROC1.enable()
166 }; 166 };
167 #[cfg(feature = "rp235x")] 167 #[cfg(feature = "_rp235x")]
168 unsafe { 168 unsafe {
169 interrupt::SIO_IRQ_FIFO.enable() 169 interrupt::SIO_IRQ_FIFO.enable()
170 }; 170 };
diff --git a/embassy-rp/src/pio/mod.rs b/embassy-rp/src/pio/mod.rs
index 89313086b..68b1d6849 100644
--- a/embassy-rp/src/pio/mod.rs
+++ b/embassy-rp/src/pio/mod.rs
@@ -354,7 +354,7 @@ impl<'d, PIO: Instance, const SM: usize> StateMachineRx<'d, PIO, SM> {
354 p.read_addr().write_value(PIO::PIO.rxf(SM).as_ptr() as u32); 354 p.read_addr().write_value(PIO::PIO.rxf(SM).as_ptr() as u32);
355 #[cfg(feature = "rp2040")] 355 #[cfg(feature = "rp2040")]
356 p.trans_count().write(|w| *w = data.len() as u32); 356 p.trans_count().write(|w| *w = data.len() as u32);
357 #[cfg(feature = "rp235x")] 357 #[cfg(feature = "_rp235x")]
358 p.trans_count().write(|w| w.set_count(data.len() as u32)); 358 p.trans_count().write(|w| w.set_count(data.len() as u32));
359 compiler_fence(Ordering::SeqCst); 359 compiler_fence(Ordering::SeqCst);
360 p.ctrl_trig().write(|w| { 360 p.ctrl_trig().write(|w| {
@@ -439,7 +439,7 @@ impl<'d, PIO: Instance, const SM: usize> StateMachineTx<'d, PIO, SM> {
439 p.write_addr().write_value(PIO::PIO.txf(SM).as_ptr() as u32); 439 p.write_addr().write_value(PIO::PIO.txf(SM).as_ptr() as u32);
440 #[cfg(feature = "rp2040")] 440 #[cfg(feature = "rp2040")]
441 p.trans_count().write(|w| *w = data.len() as u32); 441 p.trans_count().write(|w| *w = data.len() as u32);
442 #[cfg(feature = "rp235x")] 442 #[cfg(feature = "_rp235x")]
443 p.trans_count().write(|w| w.set_count(data.len() as u32)); 443 p.trans_count().write(|w| w.set_count(data.len() as u32));
444 compiler_fence(Ordering::SeqCst); 444 compiler_fence(Ordering::SeqCst);
445 p.ctrl_trig().write(|w| { 445 p.ctrl_trig().write(|w| {
@@ -529,7 +529,7 @@ pub struct PinConfig {
529/// Comparison level or IRQ index for the MOV x, STATUS instruction. 529/// Comparison level or IRQ index for the MOV x, STATUS instruction.
530#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 530#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
531#[cfg_attr(feature = "defmt", derive(defmt::Format))] 531#[cfg_attr(feature = "defmt", derive(defmt::Format))]
532#[cfg(feature = "rp235x")] 532#[cfg(feature = "_rp235x")]
533pub enum StatusN { 533pub enum StatusN {
534 /// IRQ flag in this PIO block 534 /// IRQ flag in this PIO block
535 This(u8), 535 This(u8),
@@ -539,14 +539,14 @@ pub enum StatusN {
539 Higher(u8), 539 Higher(u8),
540} 540}
541 541
542#[cfg(feature = "rp235x")] 542#[cfg(feature = "_rp235x")]
543impl Default for StatusN { 543impl Default for StatusN {
544 fn default() -> Self { 544 fn default() -> Self {
545 Self::This(0) 545 Self::This(0)
546 } 546 }
547} 547}
548 548
549#[cfg(feature = "rp235x")] 549#[cfg(feature = "_rp235x")]
550impl Into<crate::pac::pio::vals::ExecctrlStatusN> for StatusN { 550impl Into<crate::pac::pio::vals::ExecctrlStatusN> for StatusN {
551 fn into(self) -> crate::pac::pio::vals::ExecctrlStatusN { 551 fn into(self) -> crate::pac::pio::vals::ExecctrlStatusN {
552 let x = match self { 552 let x = match self {
@@ -576,7 +576,7 @@ pub struct Config<'d, PIO: Instance> {
576 #[cfg(feature = "rp2040")] 576 #[cfg(feature = "rp2040")]
577 pub status_n: u8, 577 pub status_n: u8,
578 // This cfg probably shouldn't be required, but the SVD for the 2040 doesn't have the enum 578 // This cfg probably shouldn't be required, but the SVD for the 2040 doesn't have the enum
579 #[cfg(feature = "rp235x")] 579 #[cfg(feature = "_rp235x")]
580 /// Status comparison level. 580 /// Status comparison level.
581 pub status_n: StatusN, 581 pub status_n: StatusN,
582 exec: ExecConfig, 582 exec: ExecConfig,
@@ -709,7 +709,7 @@ impl<'d, PIO: Instance + 'd, const SM: usize> StateMachine<'d, PIO, SM> {
709 w.set_out_sticky(config.out_sticky); 709 w.set_out_sticky(config.out_sticky);
710 w.set_wrap_top(config.exec.wrap_top); 710 w.set_wrap_top(config.exec.wrap_top);
711 w.set_wrap_bottom(config.exec.wrap_bottom); 711 w.set_wrap_bottom(config.exec.wrap_bottom);
712 #[cfg(feature = "rp235x")] 712 #[cfg(feature = "_rp235x")]
713 w.set_status_sel(match config.status_sel { 713 w.set_status_sel(match config.status_sel {
714 StatusSource::TxFifoLevel => pac::pio::vals::ExecctrlStatusSel::TXLEVEL, 714 StatusSource::TxFifoLevel => pac::pio::vals::ExecctrlStatusSel::TXLEVEL,
715 StatusSource::RxFifoLevel => pac::pio::vals::ExecctrlStatusSel::RXLEVEL, 715 StatusSource::RxFifoLevel => pac::pio::vals::ExecctrlStatusSel::RXLEVEL,
@@ -1250,7 +1250,7 @@ macro_rules! impl_pio {
1250 1250
1251impl_pio!(PIO0, 0, PIO0, PIO0_0, PIO0_IRQ_0); 1251impl_pio!(PIO0, 0, PIO0, PIO0_0, PIO0_IRQ_0);
1252impl_pio!(PIO1, 1, PIO1, PIO1_0, PIO1_IRQ_0); 1252impl_pio!(PIO1, 1, PIO1, PIO1_0, PIO1_IRQ_0);
1253#[cfg(feature = "rp235x")] 1253#[cfg(feature = "_rp235x")]
1254impl_pio!(PIO2, 2, PIO2, PIO2_0, PIO2_IRQ_0); 1254impl_pio!(PIO2, 2, PIO2, PIO2_0, PIO2_IRQ_0);
1255 1255
1256/// PIO pin. 1256/// PIO pin.
diff --git a/embassy-rp/src/pwm.rs b/embassy-rp/src/pwm.rs
index b50337ad1..7da3dccb0 100644
--- a/embassy-rp/src/pwm.rs
+++ b/embassy-rp/src/pwm.rs
@@ -110,7 +110,7 @@ impl<'d> Pwm<'d> {
110 if let Some(pin) = &b { 110 if let Some(pin) = &b {
111 pin.gpio().ctrl().write(|w| w.set_funcsel(4)); 111 pin.gpio().ctrl().write(|w| w.set_funcsel(4));
112 pin.pad_ctrl().modify(|w| { 112 pin.pad_ctrl().modify(|w| {
113 #[cfg(feature = "rp235x")] 113 #[cfg(feature = "_rp235x")]
114 w.set_iso(false); 114 w.set_iso(false);
115 w.set_pue(b_pull == Pull::Up); 115 w.set_pue(b_pull == Pull::Up);
116 w.set_pde(b_pull == Pull::Down); 116 w.set_pde(b_pull == Pull::Down);
@@ -365,13 +365,13 @@ slice!(PWM_SLICE5, 5);
365slice!(PWM_SLICE6, 6); 365slice!(PWM_SLICE6, 6);
366slice!(PWM_SLICE7, 7); 366slice!(PWM_SLICE7, 7);
367 367
368#[cfg(feature = "rp235x")] 368#[cfg(feature = "_rp235x")]
369slice!(PWM_SLICE8, 8); 369slice!(PWM_SLICE8, 8);
370#[cfg(feature = "rp235x")] 370#[cfg(feature = "_rp235x")]
371slice!(PWM_SLICE9, 9); 371slice!(PWM_SLICE9, 9);
372#[cfg(feature = "rp235x")] 372#[cfg(feature = "_rp235x")]
373slice!(PWM_SLICE10, 10); 373slice!(PWM_SLICE10, 10);
374#[cfg(feature = "rp235x")] 374#[cfg(feature = "_rp235x")]
375slice!(PWM_SLICE11, 11); 375slice!(PWM_SLICE11, 11);
376 376
377/// PWM Channel A. 377/// PWM Channel A.
diff --git a/embassy-rp/src/spi.rs b/embassy-rp/src/spi.rs
index bc852ff7b..b89df74a2 100644
--- a/embassy-rp/src/spi.rs
+++ b/embassy-rp/src/spi.rs
@@ -107,7 +107,7 @@ impl<'d, T: Instance, M: Mode> Spi<'d, T, M> {
107 if let Some(pin) = &clk { 107 if let Some(pin) = &clk {
108 pin.gpio().ctrl().write(|w| w.set_funcsel(1)); 108 pin.gpio().ctrl().write(|w| w.set_funcsel(1));
109 pin.pad_ctrl().write(|w| { 109 pin.pad_ctrl().write(|w| {
110 #[cfg(feature = "rp235x")] 110 #[cfg(feature = "_rp235x")]
111 w.set_iso(false); 111 w.set_iso(false);
112 w.set_schmitt(true); 112 w.set_schmitt(true);
113 w.set_slewfast(false); 113 w.set_slewfast(false);
@@ -120,7 +120,7 @@ impl<'d, T: Instance, M: Mode> Spi<'d, T, M> {
120 if let Some(pin) = &mosi { 120 if let Some(pin) = &mosi {
121 pin.gpio().ctrl().write(|w| w.set_funcsel(1)); 121 pin.gpio().ctrl().write(|w| w.set_funcsel(1));
122 pin.pad_ctrl().write(|w| { 122 pin.pad_ctrl().write(|w| {
123 #[cfg(feature = "rp235x")] 123 #[cfg(feature = "_rp235x")]
124 w.set_iso(false); 124 w.set_iso(false);
125 w.set_schmitt(true); 125 w.set_schmitt(true);
126 w.set_slewfast(false); 126 w.set_slewfast(false);
@@ -133,7 +133,7 @@ impl<'d, T: Instance, M: Mode> Spi<'d, T, M> {
133 if let Some(pin) = &miso { 133 if let Some(pin) = &miso {
134 pin.gpio().ctrl().write(|w| w.set_funcsel(1)); 134 pin.gpio().ctrl().write(|w| w.set_funcsel(1));
135 pin.pad_ctrl().write(|w| { 135 pin.pad_ctrl().write(|w| {
136 #[cfg(feature = "rp235x")] 136 #[cfg(feature = "_rp235x")]
137 w.set_iso(false); 137 w.set_iso(false);
138 w.set_schmitt(true); 138 w.set_schmitt(true);
139 w.set_slewfast(false); 139 w.set_slewfast(false);
@@ -146,7 +146,7 @@ impl<'d, T: Instance, M: Mode> Spi<'d, T, M> {
146 if let Some(pin) = &cs { 146 if let Some(pin) = &cs {
147 pin.gpio().ctrl().write(|w| w.set_funcsel(1)); 147 pin.gpio().ctrl().write(|w| w.set_funcsel(1));
148 pin.pad_ctrl().write(|w| { 148 pin.pad_ctrl().write(|w| {
149 #[cfg(feature = "rp235x")] 149 #[cfg(feature = "_rp235x")]
150 w.set_iso(false); 150 w.set_iso(false);
151 w.set_schmitt(true); 151 w.set_schmitt(true);
152 w.set_slewfast(false); 152 w.set_slewfast(false);
diff --git a/embassy-rp/src/time_driver.rs b/embassy-rp/src/time_driver.rs
index ba5a91c29..e5b407a29 100644
--- a/embassy-rp/src/time_driver.rs
+++ b/embassy-rp/src/time_driver.rs
@@ -8,7 +8,7 @@ use embassy_sync::blocking_mutex::Mutex;
8use embassy_time_driver::{AlarmHandle, Driver}; 8use embassy_time_driver::{AlarmHandle, Driver};
9#[cfg(feature = "rp2040")] 9#[cfg(feature = "rp2040")]
10use pac::TIMER; 10use pac::TIMER;
11#[cfg(feature = "rp235x")] 11#[cfg(feature = "_rp235x")]
12use pac::TIMER0 as TIMER; 12use pac::TIMER0 as TIMER;
13 13
14use crate::interrupt::InterruptExt; 14use crate::interrupt::InterruptExt;
@@ -155,7 +155,7 @@ pub unsafe fn init() {
155 interrupt::TIMER_IRQ_2.enable(); 155 interrupt::TIMER_IRQ_2.enable();
156 interrupt::TIMER_IRQ_3.enable(); 156 interrupt::TIMER_IRQ_3.enable();
157 } 157 }
158 #[cfg(feature = "rp235x")] 158 #[cfg(feature = "_rp235x")]
159 { 159 {
160 interrupt::TIMER0_IRQ_0.enable(); 160 interrupt::TIMER0_IRQ_0.enable();
161 interrupt::TIMER0_IRQ_1.enable(); 161 interrupt::TIMER0_IRQ_1.enable();
@@ -188,25 +188,25 @@ fn TIMER_IRQ_3() {
188 DRIVER.check_alarm(3) 188 DRIVER.check_alarm(3)
189} 189}
190 190
191#[cfg(all(feature = "rt", feature = "rp235x"))] 191#[cfg(all(feature = "rt", feature = "_rp235x"))]
192#[interrupt] 192#[interrupt]
193fn TIMER0_IRQ_0() { 193fn TIMER0_IRQ_0() {
194 DRIVER.check_alarm(0) 194 DRIVER.check_alarm(0)
195} 195}
196 196
197#[cfg(all(feature = "rt", feature = "rp235x"))] 197#[cfg(all(feature = "rt", feature = "_rp235x"))]
198#[interrupt] 198#[interrupt]
199fn TIMER0_IRQ_1() { 199fn TIMER0_IRQ_1() {
200 DRIVER.check_alarm(1) 200 DRIVER.check_alarm(1)
201} 201}
202 202
203#[cfg(all(feature = "rt", feature = "rp235x"))] 203#[cfg(all(feature = "rt", feature = "_rp235x"))]
204#[interrupt] 204#[interrupt]
205fn TIMER0_IRQ_2() { 205fn TIMER0_IRQ_2() {
206 DRIVER.check_alarm(2) 206 DRIVER.check_alarm(2)
207} 207}
208 208
209#[cfg(all(feature = "rt", feature = "rp235x"))] 209#[cfg(all(feature = "rt", feature = "_rp235x"))]
210#[interrupt] 210#[interrupt]
211fn TIMER0_IRQ_3() { 211fn TIMER0_IRQ_3() {
212 DRIVER.check_alarm(3) 212 DRIVER.check_alarm(3)
diff --git a/embassy-rp/src/uart/mod.rs b/embassy-rp/src/uart/mod.rs
index 9fc2ad89f..aba4b792a 100644
--- a/embassy-rp/src/uart/mod.rs
+++ b/embassy-rp/src/uart/mod.rs
@@ -852,7 +852,7 @@ impl<'d, T: Instance + 'd, M: Mode> Uart<'d, T, M> {
852 }); 852 });
853 }); 853 });
854 pin.pad_ctrl().write(|w| { 854 pin.pad_ctrl().write(|w| {
855 #[cfg(feature = "rp235x")] 855 #[cfg(feature = "_rp235x")]
856 w.set_iso(false); 856 w.set_iso(false);
857 w.set_ie(true); 857 w.set_ie(true);
858 }); 858 });
@@ -875,7 +875,7 @@ impl<'d, T: Instance + 'd, M: Mode> Uart<'d, T, M> {
875 }); 875 });
876 }); 876 });
877 pin.pad_ctrl().write(|w| { 877 pin.pad_ctrl().write(|w| {
878 #[cfg(feature = "rp235x")] 878 #[cfg(feature = "_rp235x")]
879 w.set_iso(false); 879 w.set_iso(false);
880 w.set_ie(true); 880 w.set_ie(true);
881 }); 881 });
@@ -890,7 +890,7 @@ impl<'d, T: Instance + 'd, M: Mode> Uart<'d, T, M> {
890 }); 890 });
891 }); 891 });
892 pin.pad_ctrl().write(|w| { 892 pin.pad_ctrl().write(|w| {
893 #[cfg(feature = "rp235x")] 893 #[cfg(feature = "_rp235x")]
894 w.set_iso(false); 894 w.set_iso(false);
895 w.set_ie(true); 895 w.set_ie(true);
896 }); 896 });
@@ -905,7 +905,7 @@ impl<'d, T: Instance + 'd, M: Mode> Uart<'d, T, M> {
905 }); 905 });
906 }); 906 });
907 pin.pad_ctrl().write(|w| { 907 pin.pad_ctrl().write(|w| {
908 #[cfg(feature = "rp235x")] 908 #[cfg(feature = "_rp235x")]
909 w.set_iso(false); 909 w.set_iso(false);
910 w.set_ie(true); 910 w.set_ie(true);
911 }); 911 });
@@ -1371,33 +1371,33 @@ impl_pin!(PIN_28, UART0, TxPin);
1371impl_pin!(PIN_29, UART0, RxPin); 1371impl_pin!(PIN_29, UART0, RxPin);
1372 1372
1373// Additional functions added by all 2350s 1373// Additional functions added by all 2350s
1374#[cfg(feature = "rp235x")] 1374#[cfg(feature = "_rp235x")]
1375impl_pin!(PIN_2, UART0, TxPin); 1375impl_pin!(PIN_2, UART0, TxPin);
1376#[cfg(feature = "rp235x")] 1376#[cfg(feature = "_rp235x")]
1377impl_pin!(PIN_3, UART0, RxPin); 1377impl_pin!(PIN_3, UART0, RxPin);
1378#[cfg(feature = "rp235x")] 1378#[cfg(feature = "_rp235x")]
1379impl_pin!(PIN_6, UART1, TxPin); 1379impl_pin!(PIN_6, UART1, TxPin);
1380#[cfg(feature = "rp235x")] 1380#[cfg(feature = "_rp235x")]
1381impl_pin!(PIN_7, UART1, RxPin); 1381impl_pin!(PIN_7, UART1, RxPin);
1382#[cfg(feature = "rp235x")] 1382#[cfg(feature = "_rp235x")]
1383impl_pin!(PIN_10, UART1, TxPin); 1383impl_pin!(PIN_10, UART1, TxPin);
1384#[cfg(feature = "rp235x")] 1384#[cfg(feature = "_rp235x")]
1385impl_pin!(PIN_11, UART1, RxPin); 1385impl_pin!(PIN_11, UART1, RxPin);
1386#[cfg(feature = "rp235x")] 1386#[cfg(feature = "_rp235x")]
1387impl_pin!(PIN_14, UART0, TxPin); 1387impl_pin!(PIN_14, UART0, TxPin);
1388#[cfg(feature = "rp235x")] 1388#[cfg(feature = "_rp235x")]
1389impl_pin!(PIN_15, UART0, RxPin); 1389impl_pin!(PIN_15, UART0, RxPin);
1390#[cfg(feature = "rp235x")] 1390#[cfg(feature = "_rp235x")]
1391impl_pin!(PIN_18, UART0, TxPin); 1391impl_pin!(PIN_18, UART0, TxPin);
1392#[cfg(feature = "rp235x")] 1392#[cfg(feature = "_rp235x")]
1393impl_pin!(PIN_19, UART0, RxPin); 1393impl_pin!(PIN_19, UART0, RxPin);
1394#[cfg(feature = "rp235x")] 1394#[cfg(feature = "_rp235x")]
1395impl_pin!(PIN_22, UART1, TxPin); 1395impl_pin!(PIN_22, UART1, TxPin);
1396#[cfg(feature = "rp235x")] 1396#[cfg(feature = "_rp235x")]
1397impl_pin!(PIN_23, UART1, RxPin); 1397impl_pin!(PIN_23, UART1, RxPin);
1398#[cfg(feature = "rp235x")] 1398#[cfg(feature = "_rp235x")]
1399impl_pin!(PIN_26, UART1, TxPin); 1399impl_pin!(PIN_26, UART1, TxPin);
1400#[cfg(feature = "rp235x")] 1400#[cfg(feature = "_rp235x")]
1401impl_pin!(PIN_27, UART1, RxPin); 1401impl_pin!(PIN_27, UART1, RxPin);
1402 1402
1403// Additional pins added by larger 2350 packages. 1403// Additional pins added by larger 2350 packages.