esp_hal::dma

Struct Mem2Mem

Source
pub struct Mem2Mem<'d, M>
where M: Mode,
{ /* private fields */ }
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, DM>( channel: Channel<'d, DM, CH>, peripheral: impl DmaEligible, rx_descriptors: &'static mut [DmaDescriptor], tx_descriptors: &'static mut [DmaDescriptor], ) -> Result<Self, DmaError>
where CH: DmaChannelConvert<AnyGdmaChannel>, DM: Mode, Channel<'d, Blocking, CH>: From<Channel<'d, DM, CH>>,

Create a new Mem2Mem instance.

Source

pub fn new_with_chunk_size<CH, DM>( channel: Channel<'d, DM, CH>, peripheral: impl DmaEligible, rx_descriptors: &'static mut [DmaDescriptor], tx_descriptors: &'static mut [DmaDescriptor], chunk_size: usize, ) -> Result<Self, DmaError>
where CH: DmaChannelConvert<AnyGdmaChannel>, DM: Mode, Channel<'d, Blocking, CH>: From<Channel<'d, DM, CH>>,

Create a new Mem2Mem instance with specific chunk size.

Source

pub unsafe fn new_unsafe<CH, DM>( channel: Channel<'d, DM, CH>, peripheral: DmaPeripheral, rx_descriptors: &'static mut [DmaDescriptor], tx_descriptors: &'static mut [DmaDescriptor], chunk_size: usize, ) -> Result<Self, DmaError>
where CH: DmaChannelConvert<AnyGdmaChannel>, DM: Mode, Channel<'d, Blocking, CH>: From<Channel<'d, DM, CH>>,

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<M> Mem2Mem<'_, M>
where M: Mode,

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, M> Freeze for Mem2Mem<'d, M>

§

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

§

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

§

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

§

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

§

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

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.