Struct imxrt_hal::dma::Transfer

source ·
pub struct Transfer<'a> { /* private fields */ }
Expand description

The core DMA transfer future

Transfer is a future that drives the DMA transfer. Transfer will initiate a DMA transfer when it is first polled. You may then poll it to understand when the transfer completes.

To cancel a transfer, drop the Transfer.

If you’ve enabled DMA interrupts, consider using on_interrupt to wake an executor when the DMA transfer completes, The interrupt interface assumes that you’ve

  • configured your channel to generate interrupts
  • registered a DMA ISR with your embedded runtime
  • unmasked the DMA interrupt in the NVIC

Transfer calls the unsafe enable method to enable a DMA transfer. To properly use Transfer, make sure that you’ve configured your DMA channel for a valid transfer.

Transfer is the core DMA future used in imxrt_dma. For safe DMA transfers, consider using

  • Memcpy for buffer-to-buffer DMA transfers
  • Read for peripheral-to-memory DMA transfers
  • Write for memory-to-peripheral DMA transfers

Transfer is designed to the DMA Channel public interface. If you need to implement your own transfer future, you may do so.

use imxrt_dma::{channel::Channel, Transfer};

let my_channel: Channel = // Acquire your channel...
// Properly prepare your transfer...
// Safety: transfer properly prepared
unsafe { Transfer::new(&my_channel) }.await?;

Implementations§

source§

impl<'a> Transfer<'a>

source

pub unsafe fn new(channel: &'a Channel) -> Transfer<'a>

Create a new Transfer that performs the DMA transfer described by channel

Safety

Assumes that the transfer is correctly defined in the DMA channel memory. The transfer enables after the first call to poll().

Trait Implementations§

source§

impl Drop for Transfer<'_>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Future for Transfer<'_>

§

type Output = Result<(), Error>

The type of value produced on completion.
source§

fn poll( self: Pin<&mut Transfer<'_>>, cx: &mut Context<'_> ) -> Poll<<Transfer<'_> as Future>::Output>

Attempt to resolve the future to a final value, registering the current task for wakeup if the value is not yet available. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Transfer<'a>

§

impl<'a> !Send for Transfer<'a>

§

impl<'a> !Sync for Transfer<'a>

§

impl<'a> !Unpin for Transfer<'a>

§

impl<'a> !UnwindSafe for Transfer<'a>

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<F> IntoFuture for F
where F: Future,

§

type Output = <F as Future>::Output

The output that the future will produce on completion.
§

type IntoFuture = F

Which kind of future are we turning this into?
source§

fn into_future(self) -> <F as IntoFuture>::IntoFuture

Creates a future from a value. Read more
source§

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

§

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

§

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.