pub struct Mem2Mem<'d, Dm>where
Dm: DriverMode,{ /* private fields */ }
Available on crate feature
unstable
only.Expand description
DMA Memory to Memory pseudo-Peripheral
This is a pseudo-peripheral that allows for memory to memory transfers. It is not a real peripheral, but a way to use the DMA engine for memory to memory transfers.
Implementations§
Source§impl<'d> Mem2Mem<'d, Blocking>
impl<'d> Mem2Mem<'d, Blocking>
Sourcepub fn new<CH>(
channel: impl Peripheral<P = CH> + 'd,
peripheral: impl DmaEligible,
rx_descriptors: &'static mut [DmaDescriptor],
tx_descriptors: &'static mut [DmaDescriptor],
) -> Result<Self, DmaError>where
CH: DmaChannelConvert<AnyGdmaChannel>,
pub fn new<CH>(
channel: impl Peripheral<P = CH> + 'd,
peripheral: impl DmaEligible,
rx_descriptors: &'static mut [DmaDescriptor],
tx_descriptors: &'static mut [DmaDescriptor],
) -> Result<Self, DmaError>where
CH: DmaChannelConvert<AnyGdmaChannel>,
Create a new Mem2Mem instance.
Sourcepub fn new_with_chunk_size<CH>(
channel: impl Peripheral<P = CH> + 'd,
peripheral: impl DmaEligible,
rx_descriptors: &'static mut [DmaDescriptor],
tx_descriptors: &'static mut [DmaDescriptor],
chunk_size: usize,
) -> Result<Self, DmaError>where
CH: DmaChannelConvert<AnyGdmaChannel>,
pub fn new_with_chunk_size<CH>(
channel: impl Peripheral<P = CH> + 'd,
peripheral: impl DmaEligible,
rx_descriptors: &'static mut [DmaDescriptor],
tx_descriptors: &'static mut [DmaDescriptor],
chunk_size: usize,
) -> Result<Self, DmaError>where
CH: DmaChannelConvert<AnyGdmaChannel>,
Create a new Mem2Mem instance with specific chunk size.
Sourcepub unsafe fn new_unsafe<CH>(
channel: impl Peripheral<P = CH> + 'd,
peripheral: DmaPeripheral,
rx_descriptors: &'static mut [DmaDescriptor],
tx_descriptors: &'static mut [DmaDescriptor],
chunk_size: usize,
) -> Result<Self, DmaError>where
CH: DmaChannelConvert<AnyGdmaChannel>,
pub unsafe fn new_unsafe<CH>(
channel: impl Peripheral<P = CH> + 'd,
peripheral: DmaPeripheral,
rx_descriptors: &'static mut [DmaDescriptor],
tx_descriptors: &'static mut [DmaDescriptor],
chunk_size: usize,
) -> Result<Self, DmaError>where
CH: DmaChannelConvert<AnyGdmaChannel>,
Create a new Mem2Mem instance.
§Safety
You must ensure that your not using DMA for the same peripheral and that your the only one using the DmaPeripheral.
Sourcepub fn into_async(self) -> Mem2Mem<'d, Async>
pub fn into_async(self) -> Mem2Mem<'d, Async>
Convert Mem2Mem to an async Mem2Mem.
Source§impl<Dm> Mem2Mem<'_, Dm>where
Dm: DriverMode,
impl<Dm> Mem2Mem<'_, Dm>where
Dm: DriverMode,
Sourcepub fn start_transfer<'t, TXBUF, RXBUF>(
&mut self,
rx_buffer: &'t mut RXBUF,
tx_buffer: &'t TXBUF,
) -> Result<DmaTransferRx<'_, Self>, DmaError>where
TXBUF: ReadBuffer,
RXBUF: WriteBuffer,
pub fn start_transfer<'t, TXBUF, RXBUF>(
&mut self,
rx_buffer: &'t mut RXBUF,
tx_buffer: &'t TXBUF,
) -> Result<DmaTransferRx<'_, Self>, DmaError>where
TXBUF: ReadBuffer,
RXBUF: WriteBuffer,
Start a memory to memory transfer.