embassy-mcxa

Crates

git

Versions

mcx-a256

Flavors

ScatterGatherBuilder

Struct ScatterGatherBuilder 

Source
pub struct ScatterGatherBuilder<'a, W: Word> { /* private fields */ }
Expand description

A builder for constructing scatter-gather DMA transfer chains.

This provides a type-safe way to build TCD chains for scatter-gather transfers without manual TCD manipulation.

§Example

use embassy_mcxa::dma::{DmaChannel, ScatterGatherBuilder};

let mut builder = ScatterGatherBuilder::<u32>::new();

// Add transfer segments
builder.add_transfer(&src1, &mut dst1);
builder.add_transfer(&src2, &mut dst2);
builder.add_transfer(&src3, &mut dst3);

// Build and execute
let transfer = unsafe { builder.build(&dma_ch).unwrap() };
transfer.await;

Implementations§

Source§

impl<'a, W: Word> ScatterGatherBuilder<'a, W>

Source

pub fn new() -> Self

Create a new scatter-gather builder.

Source

pub fn add_transfer<'b: 'a>( &mut self, src: &'b [W], dst: &'b mut [W], ) -> &mut Self

Add a memory-to-memory transfer segment to the chain.

§Arguments
  • src - Source buffer for this segment
  • dst - Destination buffer for this segment
§Panics

Panics if the maximum number of segments (16) is exceeded.

Source

pub fn segment_count(&self) -> usize

Get the number of transfer segments added.

Source

pub fn build<C: Channel>( &mut self, channel: &DmaChannel<C>, ) -> Result<Transfer<'a>, Error>

Build the scatter-gather chain and start the transfer.

§Arguments
  • channel - The DMA channel to use for the transfer
§Returns

A Transfer future that completes when the entire chain has executed.

Source

pub fn clear(&mut self)

Reset the builder for reuse.

Trait Implementations§

Source§

impl<W: Word> Default for ScatterGatherBuilder<'_, W>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a, W> Freeze for ScatterGatherBuilder<'a, W>

§

impl<'a, W> RefUnwindSafe for ScatterGatherBuilder<'a, W>
where W: RefUnwindSafe,

§

impl<'a, W> Send for ScatterGatherBuilder<'a, W>
where W: Send,

§

impl<'a, W> Sync for ScatterGatherBuilder<'a, W>
where W: Sync,

§

impl<'a, W> Unpin for ScatterGatherBuilder<'a, W>
where W: Unpin,

§

impl<'a, W> !UnwindSafe for ScatterGatherBuilder<'a, W>

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.