Struct Mem2Mem

Source
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>

Source

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.

Source

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.

Source

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.

Source

pub fn into_async(self) -> Mem2Mem<'d, Async>

Convert Mem2Mem to an async Mem2Mem.

Source§

impl<Dm> Mem2Mem<'_, Dm>
where Dm: DriverMode,

Source

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.

Auto Trait Implementations§

§

impl<'d, Dm> Freeze for Mem2Mem<'d, Dm>

§

impl<'d, Dm> RefUnwindSafe for Mem2Mem<'d, Dm>
where Dm: RefUnwindSafe,

§

impl<'d, Dm> Send for Mem2Mem<'d, Dm>
where Dm: Send,

§

impl<'d, Dm> !Sync for Mem2Mem<'d, Dm>

§

impl<'d, Dm> Unpin for Mem2Mem<'d, Dm>
where Dm: Unpin,

§

impl<'d, Dm> !UnwindSafe for Mem2Mem<'d, Dm>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.