stm32/dma: use the right waker slot number for DMA2 (must add 8)

This commit is contained in:
Dario Nieuwenhuis 2021-12-08 01:54:31 +01:00
parent fd2fe62b5f
commit 4e349d0f5d
2 changed files with 6 additions and 8 deletions

View file

@ -163,7 +163,7 @@ pac::dma_channels! {
}
fn set_waker(&mut self, waker: &Waker) {
unsafe {low_level_api::set_waker(crate::pac::$dma_peri, $channel_num, waker )}
unsafe {low_level_api::set_waker(dma_num!($dma_peri) * 8 + $channel_num, waker )}
}
}
@ -255,9 +255,8 @@ mod low_level_api {
}
/// Sets the waker for the specified DMA channel
pub unsafe fn set_waker(_dma: pac::bdma::Dma, state_number: u8, waker: &Waker) {
let n = state_number as usize;
STATE.ch_wakers[n].register(waker);
pub unsafe fn set_waker(state_number: usize, waker: &Waker) {
STATE.ch_wakers[state_number].register(waker);
}
pub unsafe fn reset_status(dma: pac::bdma::Dma, channel_number: u8) {

View file

@ -158,7 +158,7 @@ pac::dma_channels! {
}
fn set_waker(&mut self, waker: &Waker) {
unsafe {low_level_api::set_waker(&crate::pac::$dma_peri, $channel_num, waker )}
unsafe {low_level_api::set_waker(dma_num!($dma_peri) * 8 + $channel_num, waker )}
}
}
@ -258,9 +258,8 @@ mod low_level_api {
}
/// Sets the waker for the specified DMA channel
pub unsafe fn set_waker(_dma: &pac::dma::Dma, state_number: u8, waker: &Waker) {
let n = state_number as usize;
STATE.ch_wakers[n].register(waker);
pub unsafe fn set_waker(state_number: usize, waker: &Waker) {
STATE.ch_wakers[state_number].register(waker);
}
pub unsafe fn reset_status(dma: &crate::pac::dma::Dma, isrn: usize, isrbit: usize) {