aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpennae <[email protected]>2023-04-25 18:48:36 +0200
committerpennae <[email protected]>2023-05-01 12:58:57 +0200
commitdb16b6ff3f94e48f50c4212c164d018741b61b42 (patch)
tree486bd6e1c77f58f9506faad6ca1b2fac4d583b3b
parenta9074fd09bb2fa6265808f32e5cf303285fc0ec6 (diff)
rp/pio: don't call dma::init so much
this is already done during platform init. it wasn't even sound in the original implementation because futures would meddle with the nvic in critical sections, while another (interrupt) executor could meddle with the nvic without critical sections here. it is only accidentally sound now and only if irq1 of both pios isn't used by user code. luckily the worst we can expect to happen is interrupt priorities being set wrong, but wrong is wrong is wrong.
-rw-r--r--embassy-rp/src/pio.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/embassy-rp/src/pio.rs b/embassy-rp/src/pio.rs
index 00a7aa372..3775060f0 100644
--- a/embassy-rp/src/pio.rs
+++ b/embassy-rp/src/pio.rs
@@ -8,7 +8,7 @@ use embassy_cortex_m::interrupt::{Interrupt, InterruptExt};
8use embassy_hal_common::PeripheralRef; 8use embassy_hal_common::PeripheralRef;
9use embassy_sync::waitqueue::AtomicWaker; 9use embassy_sync::waitqueue::AtomicWaker;
10 10
11use crate::dma::{self, Channel, Transfer}; 11use crate::dma::{Channel, Transfer};
12use crate::gpio::sealed::Pin as SealedPin; 12use crate::gpio::sealed::Pin as SealedPin;
13use crate::gpio::{Drive, Pin, Pull, SlewRate}; 13use crate::gpio::{Drive, Pin, Pull, SlewRate};
14use crate::pac::dma::vals::{DataSize, TreqSel}; 14use crate::pac::dma::vals::{DataSize, TreqSel};
@@ -949,7 +949,6 @@ pub trait PioStateMachine: Sized + Unpin {
949 949
950 fn dma_push<'a, C: Channel>(&'a self, ch: PeripheralRef<'a, C>, data: &'a [u32]) -> Transfer<'a, C> { 950 fn dma_push<'a, C: Channel>(&'a self, ch: PeripheralRef<'a, C>, data: &'a [u32]) -> Transfer<'a, C> {
951 unsafe { 951 unsafe {
952 dma::init();
953 let pio_no = Self::Pio::PIO_NO; 952 let pio_no = Self::Pio::PIO_NO;
954 let sm_no = Self::Sm::SM_NO; 953 let sm_no = Self::Sm::SM_NO;
955 let p = ch.regs(); 954 let p = ch.regs();
@@ -973,7 +972,6 @@ pub trait PioStateMachine: Sized + Unpin {
973 972
974 fn dma_pull<'a, C: Channel>(&'a self, ch: PeripheralRef<'a, C>, data: &'a mut [u32]) -> Transfer<'a, C> { 973 fn dma_pull<'a, C: Channel>(&'a self, ch: PeripheralRef<'a, C>, data: &'a mut [u32]) -> Transfer<'a, C> {
975 unsafe { 974 unsafe {
976 dma::init();
977 let pio_no = Self::Pio::PIO_NO; 975 let pio_no = Self::Pio::PIO_NO;
978 let sm_no = Self::Sm::SM_NO; 976 let sm_no = Self::Sm::SM_NO;
979 let p = ch.regs(); 977 let p = ch.regs();