stm32: update stm32-metapac.
This commit is contained in:
@ -107,7 +107,7 @@ pub(crate) unsafe fn on_irq_inner(dma: pac::bdma::Dma, channel_num: usize, index
|
||||
let cr = dma.ch(channel_num).cr();
|
||||
|
||||
if isr.teif(channel_num) {
|
||||
panic!("DMA: error on BDMA@{:08x} channel {}", dma.0 as u32, channel_num);
|
||||
panic!("DMA: error on BDMA@{:08x} channel {}", dma.as_ptr() as u32, channel_num);
|
||||
}
|
||||
|
||||
if isr.htif(channel_num) && cr.read().htie() {
|
||||
@ -291,29 +291,25 @@ impl<'a, C: Channel> Transfer<'a, C> {
|
||||
}
|
||||
|
||||
fn clear_irqs(&mut self) {
|
||||
unsafe {
|
||||
self.channel.regs().ifcr().write(|w| {
|
||||
w.set_tcif(self.channel.num(), true);
|
||||
w.set_teif(self.channel.num(), true);
|
||||
})
|
||||
}
|
||||
self.channel.regs().ifcr().write(|w| {
|
||||
w.set_tcif(self.channel.num(), true);
|
||||
w.set_teif(self.channel.num(), true);
|
||||
});
|
||||
}
|
||||
|
||||
pub fn request_stop(&mut self) {
|
||||
let ch = self.channel.regs().ch(self.channel.num());
|
||||
|
||||
// Disable the channel. Keep the IEs enabled so the irqs still fire.
|
||||
unsafe {
|
||||
ch.cr().write(|w| {
|
||||
w.set_teie(true);
|
||||
w.set_tcie(true);
|
||||
})
|
||||
}
|
||||
ch.cr().write(|w| {
|
||||
w.set_teie(true);
|
||||
w.set_tcie(true);
|
||||
});
|
||||
}
|
||||
|
||||
pub fn is_running(&mut self) -> bool {
|
||||
let ch = self.channel.regs().ch(self.channel.num());
|
||||
let en = unsafe { ch.cr().read() }.en();
|
||||
let en = ch.cr().read().en();
|
||||
let tcif = STATE.complete_count[self.channel.index()].load(Ordering::Acquire) != 0;
|
||||
en && !tcif
|
||||
}
|
||||
@ -322,7 +318,7 @@ impl<'a, C: Channel> Transfer<'a, C> {
|
||||
/// Note: this will be zero for transfers that completed without cancellation.
|
||||
pub fn get_remaining_transfers(&self) -> u16 {
|
||||
let ch = self.channel.regs().ch(self.channel.num());
|
||||
unsafe { ch.ndtr().read() }.ndt()
|
||||
ch.ndtr().read().ndt()
|
||||
}
|
||||
|
||||
pub fn blocking_wait(mut self) {
|
||||
@ -366,7 +362,7 @@ struct DmaCtrlImpl<'a, C: Channel>(PeripheralRef<'a, C>);
|
||||
impl<'a, C: Channel> DmaCtrl for DmaCtrlImpl<'a, C> {
|
||||
fn get_remaining_transfers(&self) -> usize {
|
||||
let ch = self.0.regs().ch(self.0.num());
|
||||
unsafe { ch.ndtr().read() }.ndt() as usize
|
||||
ch.ndtr().read().ndt() as usize
|
||||
}
|
||||
|
||||
fn get_complete_count(&self) -> usize {
|
||||
@ -442,7 +438,7 @@ impl<'a, C: Channel, W: Word> RingBuffer<'a, C, W> {
|
||||
|
||||
pub fn start(&mut self) {
|
||||
let ch = self.channel.regs().ch(self.channel.num());
|
||||
unsafe { ch.cr().write_value(self.cr) }
|
||||
ch.cr().write_value(self.cr)
|
||||
}
|
||||
|
||||
pub fn clear(&mut self) {
|
||||
@ -469,31 +465,27 @@ impl<'a, C: Channel, W: Word> RingBuffer<'a, C, W> {
|
||||
|
||||
fn clear_irqs(&mut self) {
|
||||
let dma = self.channel.regs();
|
||||
unsafe {
|
||||
dma.ifcr().write(|w| {
|
||||
w.set_htif(self.channel.num(), true);
|
||||
w.set_tcif(self.channel.num(), true);
|
||||
w.set_teif(self.channel.num(), true);
|
||||
})
|
||||
}
|
||||
dma.ifcr().write(|w| {
|
||||
w.set_htif(self.channel.num(), true);
|
||||
w.set_tcif(self.channel.num(), true);
|
||||
w.set_teif(self.channel.num(), true);
|
||||
});
|
||||
}
|
||||
|
||||
pub fn request_stop(&mut self) {
|
||||
let ch = self.channel.regs().ch(self.channel.num());
|
||||
|
||||
// Disable the channel. Keep the IEs enabled so the irqs still fire.
|
||||
unsafe {
|
||||
ch.cr().write(|w| {
|
||||
w.set_teie(true);
|
||||
w.set_htie(true);
|
||||
w.set_tcie(true);
|
||||
})
|
||||
}
|
||||
ch.cr().write(|w| {
|
||||
w.set_teie(true);
|
||||
w.set_htie(true);
|
||||
w.set_tcie(true);
|
||||
});
|
||||
}
|
||||
|
||||
pub fn is_running(&mut self) -> bool {
|
||||
let ch = self.channel.regs().ch(self.channel.num());
|
||||
unsafe { ch.cr().read() }.en()
|
||||
ch.cr().read().en()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ pub(crate) unsafe fn on_irq_inner(dma: pac::dma::Dma, channel_num: usize, index:
|
||||
let isr = dma.isr(channel_num / 4).read();
|
||||
|
||||
if isr.teif(channel_num % 4) {
|
||||
panic!("DMA: error on DMA@{:08x} channel {}", dma.0 as u32, channel_num);
|
||||
panic!("DMA: error on DMA@{:08x} channel {}", dma.as_ptr() as u32, channel_num);
|
||||
}
|
||||
|
||||
if isr.htif(channel_num % 4) && cr.read().htie() {
|
||||
@ -387,36 +387,32 @@ impl<'a, C: Channel> Transfer<'a, C> {
|
||||
let isrn = self.channel.num() / 4;
|
||||
let isrbit = self.channel.num() % 4;
|
||||
|
||||
unsafe {
|
||||
self.channel.regs().ifcr(isrn).write(|w| {
|
||||
w.set_tcif(isrbit, true);
|
||||
w.set_teif(isrbit, true);
|
||||
})
|
||||
}
|
||||
self.channel.regs().ifcr(isrn).write(|w| {
|
||||
w.set_tcif(isrbit, true);
|
||||
w.set_teif(isrbit, true);
|
||||
});
|
||||
}
|
||||
|
||||
pub fn request_stop(&mut self) {
|
||||
let ch = self.channel.regs().st(self.channel.num());
|
||||
|
||||
// Disable the channel. Keep the IEs enabled so the irqs still fire.
|
||||
unsafe {
|
||||
ch.cr().write(|w| {
|
||||
w.set_teie(true);
|
||||
w.set_tcie(true);
|
||||
})
|
||||
}
|
||||
ch.cr().write(|w| {
|
||||
w.set_teie(true);
|
||||
w.set_tcie(true);
|
||||
});
|
||||
}
|
||||
|
||||
pub fn is_running(&mut self) -> bool {
|
||||
let ch = self.channel.regs().st(self.channel.num());
|
||||
unsafe { ch.cr().read() }.en()
|
||||
ch.cr().read().en()
|
||||
}
|
||||
|
||||
/// Gets the total remaining transfers for the channel
|
||||
/// Note: this will be zero for transfers that completed without cancellation.
|
||||
pub fn get_remaining_transfers(&self) -> u16 {
|
||||
let ch = self.channel.regs().st(self.channel.num());
|
||||
unsafe { ch.ndtr().read() }.ndt()
|
||||
ch.ndtr().read().ndt()
|
||||
}
|
||||
|
||||
pub fn blocking_wait(mut self) {
|
||||
@ -537,13 +533,11 @@ impl<'a, C: Channel, W: Word> DoubleBuffered<'a, C, W> {
|
||||
let isrn = channel_number / 4;
|
||||
let isrbit = channel_number % 4;
|
||||
|
||||
unsafe {
|
||||
dma.ifcr(isrn).write(|w| {
|
||||
w.set_htif(isrbit, true);
|
||||
w.set_tcif(isrbit, true);
|
||||
w.set_teif(isrbit, true);
|
||||
})
|
||||
}
|
||||
dma.ifcr(isrn).write(|w| {
|
||||
w.set_htif(isrbit, true);
|
||||
w.set_tcif(isrbit, true);
|
||||
w.set_teif(isrbit, true);
|
||||
});
|
||||
}
|
||||
|
||||
pub unsafe fn set_buffer0(&mut self, buffer: *mut W) {
|
||||
@ -558,7 +552,7 @@ impl<'a, C: Channel, W: Word> DoubleBuffered<'a, C, W> {
|
||||
|
||||
pub fn is_buffer0_accessible(&mut self) -> bool {
|
||||
let ch = self.channel.regs().st(self.channel.num());
|
||||
unsafe { ch.cr().read() }.ct() == vals::Ct::MEMORY1
|
||||
ch.cr().read().ct() == vals::Ct::MEMORY1
|
||||
}
|
||||
|
||||
pub fn set_waker(&mut self, waker: &Waker) {
|
||||
@ -569,24 +563,22 @@ impl<'a, C: Channel, W: Word> DoubleBuffered<'a, C, W> {
|
||||
let ch = self.channel.regs().st(self.channel.num());
|
||||
|
||||
// Disable the channel. Keep the IEs enabled so the irqs still fire.
|
||||
unsafe {
|
||||
ch.cr().write(|w| {
|
||||
w.set_teie(true);
|
||||
w.set_tcie(true);
|
||||
})
|
||||
}
|
||||
ch.cr().write(|w| {
|
||||
w.set_teie(true);
|
||||
w.set_tcie(true);
|
||||
});
|
||||
}
|
||||
|
||||
pub fn is_running(&mut self) -> bool {
|
||||
let ch = self.channel.regs().st(self.channel.num());
|
||||
unsafe { ch.cr().read() }.en()
|
||||
ch.cr().read().en()
|
||||
}
|
||||
|
||||
/// Gets the total remaining transfers for the channel
|
||||
/// Note: this will be zero for transfers that completed without cancellation.
|
||||
pub fn get_remaining_transfers(&self) -> u16 {
|
||||
let ch = self.channel.regs().st(self.channel.num());
|
||||
unsafe { ch.ndtr().read() }.ndt()
|
||||
ch.ndtr().read().ndt()
|
||||
}
|
||||
}
|
||||
|
||||
@ -607,7 +599,7 @@ struct DmaCtrlImpl<'a, C: Channel>(PeripheralRef<'a, C>);
|
||||
impl<'a, C: Channel> DmaCtrl for DmaCtrlImpl<'a, C> {
|
||||
fn get_remaining_transfers(&self) -> usize {
|
||||
let ch = self.0.regs().st(self.0.num());
|
||||
unsafe { ch.ndtr().read() }.ndt() as usize
|
||||
ch.ndtr().read().ndt() as usize
|
||||
}
|
||||
|
||||
fn get_complete_count(&self) -> usize {
|
||||
@ -698,7 +690,7 @@ impl<'a, C: Channel, W: Word> RingBuffer<'a, C, W> {
|
||||
|
||||
pub fn start(&mut self) {
|
||||
let ch = self.channel.regs().st(self.channel.num());
|
||||
unsafe { ch.cr().write_value(self.cr) }
|
||||
ch.cr().write_value(self.cr);
|
||||
}
|
||||
|
||||
pub fn clear(&mut self) {
|
||||
@ -729,31 +721,27 @@ impl<'a, C: Channel, W: Word> RingBuffer<'a, C, W> {
|
||||
let isrn = channel_number / 4;
|
||||
let isrbit = channel_number % 4;
|
||||
|
||||
unsafe {
|
||||
dma.ifcr(isrn).write(|w| {
|
||||
w.set_htif(isrbit, true);
|
||||
w.set_tcif(isrbit, true);
|
||||
w.set_teif(isrbit, true);
|
||||
})
|
||||
}
|
||||
dma.ifcr(isrn).write(|w| {
|
||||
w.set_htif(isrbit, true);
|
||||
w.set_tcif(isrbit, true);
|
||||
w.set_teif(isrbit, true);
|
||||
});
|
||||
}
|
||||
|
||||
pub fn request_stop(&mut self) {
|
||||
let ch = self.channel.regs().st(self.channel.num());
|
||||
|
||||
// Disable the channel. Keep the IEs enabled so the irqs still fire.
|
||||
unsafe {
|
||||
ch.cr().write(|w| {
|
||||
w.set_teie(true);
|
||||
w.set_htie(true);
|
||||
w.set_tcie(true);
|
||||
})
|
||||
}
|
||||
ch.cr().write(|w| {
|
||||
w.set_teie(true);
|
||||
w.set_htie(true);
|
||||
w.set_tcie(true);
|
||||
});
|
||||
}
|
||||
|
||||
pub fn is_running(&mut self) -> bool {
|
||||
let ch = self.channel.regs().st(self.channel.num());
|
||||
unsafe { ch.cr().read() }.en()
|
||||
ch.cr().read().en()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
use crate::{pac, peripherals};
|
||||
|
||||
pub(crate) unsafe fn configure_dmamux<M: MuxChannel>(channel: &mut M, request: u8) {
|
||||
pub(crate) fn configure_dmamux<M: MuxChannel>(channel: &mut M, request: u8) {
|
||||
let ch_mux_regs = channel.mux_regs().ccr(channel.mux_num());
|
||||
ch_mux_regs.write(|reg| {
|
||||
reg.set_nbreq(0);
|
||||
|
@ -92,13 +92,15 @@ pub(crate) unsafe fn on_irq_inner(dma: pac::gpdma::Gpdma, channel_num: usize, in
|
||||
if sr.dtef() {
|
||||
panic!(
|
||||
"DMA: data transfer error on DMA@{:08x} channel {}",
|
||||
dma.0 as u32, channel_num
|
||||
dma.as_ptr() as u32,
|
||||
channel_num
|
||||
);
|
||||
}
|
||||
if sr.usef() {
|
||||
panic!(
|
||||
"DMA: user settings error on DMA@{:08x} channel {}",
|
||||
dma.0 as u32, channel_num
|
||||
dma.as_ptr() as u32,
|
||||
channel_num
|
||||
);
|
||||
}
|
||||
|
||||
@ -298,26 +300,24 @@ impl<'a, C: Channel> Transfer<'a, C> {
|
||||
let ch = self.channel.regs().ch(self.channel.num());
|
||||
|
||||
// Disable the channel. Keep the IEs enabled so the irqs still fire.
|
||||
unsafe {
|
||||
ch.cr().write(|w| {
|
||||
w.set_tcie(true);
|
||||
w.set_useie(true);
|
||||
w.set_dteie(true);
|
||||
w.set_suspie(true);
|
||||
})
|
||||
}
|
||||
ch.cr().write(|w| {
|
||||
w.set_tcie(true);
|
||||
w.set_useie(true);
|
||||
w.set_dteie(true);
|
||||
w.set_suspie(true);
|
||||
})
|
||||
}
|
||||
|
||||
pub fn is_running(&mut self) -> bool {
|
||||
let ch = self.channel.regs().ch(self.channel.num());
|
||||
!unsafe { ch.sr().read() }.tcf()
|
||||
!ch.sr().read().tcf()
|
||||
}
|
||||
|
||||
/// Gets the total remaining transfers for the channel
|
||||
/// Note: this will be zero for transfers that completed without cancellation.
|
||||
pub fn get_remaining_transfers(&self) -> u16 {
|
||||
let ch = self.channel.regs().ch(self.channel.num());
|
||||
unsafe { ch.br1().read() }.bndt()
|
||||
ch.br1().read().bndt()
|
||||
}
|
||||
|
||||
pub fn blocking_wait(mut self) {
|
||||
|
Reference in New Issue
Block a user