Struct Preparation

Source
pub struct Preparation {
    pub start: *mut DmaDescriptor,
    pub direction: TransferDirection,
    pub burst_transfer: BurstConfig,
    pub check_owner: Option<bool>,
    pub auto_write_back: bool,
}
Available on crate feature unstable only.
Expand description

Holds all the information needed to configure a DMA channel for a transfer.

Fields§

§start: *mut DmaDescriptor

The descriptor the DMA will start from.

§direction: TransferDirection

The direction of the DMA transfer.

§burst_transfer: BurstConfig

Configures the DMA to transfer data in bursts.

The implementation of the buffer must ensure that buffer size and alignment in each descriptor is compatible with the burst transfer configuration.

For details on alignment requirements, refer to your chip’s Technical Reference Manual

§check_owner: Option<bool>

Configures the “check owner” feature of the DMA channel.

Most DMA channels allow software to configure whether the hardware checks that DmaDescriptor::owner is set to Owner::Dma before consuming the descriptor. If this check fails, the channel stops operating and fires DmaRxInterrupt::DescriptorError/DmaTxInterrupt::DescriptorError.

This field allows buffer implementation to configure this behaviour.

  • Some(true): DMA channel must check the owner bit.
  • Some(false): DMA channel must NOT check the owner bit.
  • None: DMA channel should check the owner bit if it is supported.

Some buffer implementations may require that the DMA channel performs this check before consuming the descriptor to ensure correct behaviour. e.g. To prevent wrap-around in a circular transfer.

Some buffer implementations may require that the DMA channel does NOT perform this check as the ownership bit will not be set before the channel tries to consume the descriptor.

Most implementations won’t have any such requirements and will work correctly regardless of whether the DMA channel checks or not.

Note: If the DMA channel doesn’t support the provided option, preparation will fail.

§auto_write_back: bool

Configures whether the DMA channel automatically clears the DmaDescriptor::owner bit after it is done with the buffer pointed to by a descriptor.

For RX transfers, this is always true and the value specified here is ignored.

Note: SPI_DMA on the ESP32 does not support this and will panic if set to true.

Trait Implementations§

Source§

impl Debug for Preparation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Format for Preparation

Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
Source§

impl PartialEq for Preparation

Source§

fn eq(&self, other: &Preparation) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Preparation

Source§

impl StructuralPartialEq for Preparation

Auto Trait Implementations§

§

impl Freeze for Preparation

§

impl RefUnwindSafe for Preparation

§

impl !Send for Preparation

§

impl !Sync for Preparation

§

impl Unpin for Preparation

§

impl UnwindSafe for Preparation

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.