Move to copying regs instead of &'static referencing.
Remove unneeded stuff from the DMAMUX end of the stick.
This commit is contained in:
parent
f01ddd5f5c
commit
30a1d9bf93
2 changed files with 9 additions and 25 deletions
|
@ -92,7 +92,7 @@ pub(crate) async unsafe fn transfer_m2p(
|
||||||
state_number: usize,
|
state_number: usize,
|
||||||
src: &[u8],
|
src: &[u8],
|
||||||
dst: *mut u8,
|
dst: *mut u8,
|
||||||
#[cfg(dmamux)] dmamux_regs: &'static pac::dmamux::Dmamux,
|
#[cfg(dmamux)] dmamux_regs: pac::dmamux::Dmamux,
|
||||||
#[cfg(dmamux)] dmamux_ch_num: u8,
|
#[cfg(dmamux)] dmamux_ch_num: u8,
|
||||||
#[cfg(dmamux)] request: u8,
|
#[cfg(dmamux)] request: u8,
|
||||||
) {
|
) {
|
||||||
|
@ -272,7 +272,7 @@ macro_rules! impl_dma_channel {
|
||||||
use crate::dmamux::sealed::Channel as _MuxChannel;
|
use crate::dmamux::sealed::Channel as _MuxChannel;
|
||||||
use crate::dmamux::sealed::PeripheralChannel;
|
use crate::dmamux::sealed::PeripheralChannel;
|
||||||
let dmamux_regs = self.dmamux_regs();
|
let dmamux_regs = self.dmamux_regs();
|
||||||
let dmamux_ch_num = self.dma_ch_num();
|
let dmamux_ch_num = self.dmamux_ch_num();
|
||||||
let request = PeripheralChannel::<T, crate::dmamux::M2P>::request(self);
|
let request = PeripheralChannel::<T, crate::dmamux::M2P>::request(self);
|
||||||
unsafe {
|
unsafe {
|
||||||
transfer_m2p(
|
transfer_m2p(
|
||||||
|
|
|
@ -101,7 +101,7 @@ pub(crate) async unsafe fn transfer_m2p(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pub(crate) unsafe fn configure_dmamux(
|
pub(crate) unsafe fn configure_dmamux(
|
||||||
dmamux_regs: &pac::dmamux::Dmamux,
|
dmamux_regs: pac::dmamux::Dmamux,
|
||||||
dmamux_ch_num: u8,
|
dmamux_ch_num: u8,
|
||||||
request: u8,
|
request: u8,
|
||||||
) {
|
) {
|
||||||
|
@ -123,15 +123,11 @@ pub(crate) mod sealed {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
pub trait DmaMux {
|
pub trait DmaMux {
|
||||||
fn regs() -> &'static pac::dmamux::Dmamux;
|
fn regs() -> pac::dmamux::Dmamux;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Channel {
|
pub trait Channel {
|
||||||
fn num(&self) -> usize;
|
fn dmamux_regs(&self) -> pac::dmamux::Dmamux;
|
||||||
fn dma_regs() -> &'static pac::bdma::Dma;
|
|
||||||
fn dma_ch_num(&self) -> u8;
|
|
||||||
|
|
||||||
fn dmamux_regs(&self) -> &'static pac::dmamux::Dmamux;
|
|
||||||
fn dmamux_ch_num(&self) -> u8;
|
fn dmamux_ch_num(&self) -> u8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,20 +147,8 @@ macro_rules! impl_dma_channel {
|
||||||
($channel_peri:ident, $dmamux_peri:ident, $channel_num:expr, $dma_peri: ident, $dma_num:expr) => {
|
($channel_peri:ident, $dmamux_peri:ident, $channel_num:expr, $dma_peri: ident, $dma_num:expr) => {
|
||||||
impl Channel for peripherals::$channel_peri {}
|
impl Channel for peripherals::$channel_peri {}
|
||||||
impl sealed::Channel for peripherals::$channel_peri {
|
impl sealed::Channel for peripherals::$channel_peri {
|
||||||
fn num(&self) -> usize {
|
fn dmamux_regs(&self) -> pac::dmamux::Dmamux {
|
||||||
($dma_num * 8) + $channel_num
|
crate::pac::$dmamux_peri
|
||||||
}
|
|
||||||
|
|
||||||
fn dma_regs() -> &'static pac::bdma::Dma {
|
|
||||||
&crate::pac::$dma_peri
|
|
||||||
}
|
|
||||||
|
|
||||||
fn dma_ch_num(&self) -> u8 {
|
|
||||||
$channel_num
|
|
||||||
}
|
|
||||||
|
|
||||||
fn dmamux_regs(&self) -> &'static pac::dmamux::Dmamux {
|
|
||||||
&crate::pac::$dmamux_peri
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dmamux_ch_num(&self) -> u8 {
|
fn dmamux_ch_num(&self) -> u8 {
|
||||||
|
@ -177,8 +161,8 @@ macro_rules! impl_dma_channel {
|
||||||
macro_rules! impl_dmamux {
|
macro_rules! impl_dmamux {
|
||||||
($peri:ident) => {
|
($peri:ident) => {
|
||||||
impl sealed::DmaMux for peripherals::$peri {
|
impl sealed::DmaMux for peripherals::$peri {
|
||||||
fn regs() -> &'static pac::dmamux::Dmamux {
|
fn regs() -> pac::dmamux::Dmamux {
|
||||||
&pac::$peri
|
pac::$peri
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl DmaMux for peripherals::$peri {}
|
impl DmaMux for peripherals::$peri {}
|
||||||
|
|
Loading…
Reference in a new issue