cargo fmt
This commit is contained in:
parent
3411039cb9
commit
93e047ede2
2 changed files with 8 additions and 11 deletions
|
@ -58,7 +58,7 @@ pub(crate) unsafe fn do_transfer(
|
||||||
});
|
});
|
||||||
|
|
||||||
let on_drop = OnDrop::new(move || unsafe {
|
let on_drop = OnDrop::new(move || unsafe {
|
||||||
_stop(dma , channel_number);
|
_stop(dma, channel_number);
|
||||||
});
|
});
|
||||||
|
|
||||||
#[cfg(dmamux)]
|
#[cfg(dmamux)]
|
||||||
|
@ -111,7 +111,7 @@ pub(crate) unsafe fn do_transfer(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn _stop(dma:pac::bdma::Dma, ch: u8) {
|
unsafe fn _stop(dma: pac::bdma::Dma, ch: u8) {
|
||||||
let ch = dma.ch(ch as _);
|
let ch = dma.ch(ch as _);
|
||||||
|
|
||||||
// Disable the channel and interrupts with the default value.
|
// Disable the channel and interrupts with the default value.
|
||||||
|
@ -124,14 +124,14 @@ unsafe fn _stop(dma:pac::bdma::Dma, ch: u8) {
|
||||||
fence(Ordering::Acquire);
|
fence(Ordering::Acquire);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn _is_stopped(dma:pac::bdma::Dma, ch: u8) -> bool {
|
unsafe fn _is_stopped(dma: pac::bdma::Dma, ch: u8) -> bool {
|
||||||
let ch = dma.ch(ch as _);
|
let ch = dma.ch(ch as _);
|
||||||
ch.cr().read().en()
|
ch.cr().read().en()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the total remaining transfers for the channel
|
/// Gets the total remaining transfers for the channel
|
||||||
/// Note: this will be zero for transfers that completed without cancellation.
|
/// Note: this will be zero for transfers that completed without cancellation.
|
||||||
unsafe fn _get_remaining_transfers(dma: pac::bdma::Dma, ch: u8) -> u16{
|
unsafe fn _get_remaining_transfers(dma: pac::bdma::Dma, ch: u8) -> u16 {
|
||||||
// get a handle on the channel itself
|
// get a handle on the channel itself
|
||||||
let ch = dma.ch(ch as _);
|
let ch = dma.ch(ch as _);
|
||||||
// read the remaining transfer count. If this is zero, the transfer completed fully.
|
// read the remaining transfer count. If this is zero, the transfer completed fully.
|
||||||
|
@ -139,10 +139,9 @@ unsafe fn _get_remaining_transfers(dma: pac::bdma::Dma, ch: u8) -> u16{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the waker for the specified DMA channel
|
/// Sets the waker for the specified DMA channel
|
||||||
unsafe fn _set_waker(dma: pac::bdma::Dma, state_number: u8, waker: &Waker){
|
unsafe fn _set_waker(dma: pac::bdma::Dma, state_number: u8, waker: &Waker) {
|
||||||
let n = state_number as usize;
|
let n = state_number as usize;
|
||||||
STATE.ch_wakers[n].register(waker);
|
STATE.ch_wakers[n].register(waker);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! dma_num {
|
macro_rules! dma_num {
|
||||||
|
|
|
@ -134,7 +134,7 @@ unsafe fn _stop(dma: &pac::dma::Dma, ch: u8) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the running status of the channel
|
/// Gets the running status of the channel
|
||||||
unsafe fn _is_stopped(dma: &pac::dma::Dma, ch: u8) -> bool{
|
unsafe fn _is_stopped(dma: &pac::dma::Dma, ch: u8) -> bool {
|
||||||
// get a handle on the channel itself
|
// get a handle on the channel itself
|
||||||
let ch = dma.st(ch as _);
|
let ch = dma.st(ch as _);
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ unsafe fn _is_stopped(dma: &pac::dma::Dma, ch: u8) -> bool{
|
||||||
|
|
||||||
/// Gets the total remaining transfers for the channel
|
/// Gets the total remaining transfers for the channel
|
||||||
/// Note: this will be zero for transfers that completed without cancellation.
|
/// Note: this will be zero for transfers that completed without cancellation.
|
||||||
unsafe fn _get_remaining_transfers(dma: &pac::dma::Dma, ch: u8) -> u16{
|
unsafe fn _get_remaining_transfers(dma: &pac::dma::Dma, ch: u8) -> u16 {
|
||||||
// get a handle on the channel itself
|
// get a handle on the channel itself
|
||||||
let ch = dma.st(ch as _);
|
let ch = dma.st(ch as _);
|
||||||
// read the remaining transfer count. If this is zero, the transfer completed fully.
|
// read the remaining transfer count. If this is zero, the transfer completed fully.
|
||||||
|
@ -152,13 +152,11 @@ unsafe fn _get_remaining_transfers(dma: &pac::dma::Dma, ch: u8) -> u16{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the waker for the specified DMA channel
|
/// Sets the waker for the specified DMA channel
|
||||||
unsafe fn _set_waker(dma: &pac::dma::Dma, state_number: u8, waker: &Waker){
|
unsafe fn _set_waker(dma: &pac::dma::Dma, state_number: u8, waker: &Waker) {
|
||||||
let n = state_number as usize;
|
let n = state_number as usize;
|
||||||
STATE.ch_wakers[n].register(waker);
|
STATE.ch_wakers[n].register(waker);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
macro_rules! dma_num {
|
macro_rules! dma_num {
|
||||||
(DMA1) => {
|
(DMA1) => {
|
||||||
0
|
0
|
||||||
|
|
Loading…
Reference in a new issue