Struct mnemos_d1_core::dmac::descriptor::DescriptorBuilder

source ·
pub struct DescriptorBuilder<S = (), D = ()> {
    cfg: Cfg,
    param: Param,
    link: u32,
    source: S,
    dest: D,
}
Expand description

A builder for constructing DMA Descriptors.

Fields§

§cfg: Cfg§param: Param§link: u32§source: S§dest: D

Implementations§

source§

impl DescriptorBuilder

source

pub const fn new() -> Self

source§

impl<S, D> DescriptorBuilder<S, D>

source

pub fn src_block_size(self, val: BlockSize) -> Self

source

pub fn src_data_width(self, val: DataWidth) -> Self

source

pub fn dest_block_size(self, val: BlockSize) -> Self

source

pub fn dest_data_width(self, val: DataWidth) -> Self

source

pub fn bmode_sel(self, val: BModeSel) -> Self

source

pub fn wait_clock_cycles(self, wait_clock_cycles: u8) -> Self

source

pub fn source_slice( self, source: &[u8], ) -> Result<DescriptorBuilder<&[u8], D>, InvalidOperand>

Sets the provided slice as the source for the DMA transfer. Bytes will be copied out of this slice to the destination operand of the transfer.

Since the slice is in memory, this automatically sets the source address mode to AddressMode::LinearMode and the source DRQ type to SrcDrqType::Dram.

§Returns
source

pub fn dest_slice( self, dest: &'_ mut [MaybeUninit<u8>], ) -> Result<DescriptorBuilder<S, &'_ mut [MaybeUninit<u8>]>, InvalidOperand>

Sets the provided slice as the destination of the DMA transfer. Bytes will be copied from the source operand of the transfer into this slice.

Since the slice is in memory, this automatically sets the destination address mode to AddressMode::LinearMode, and the destination DRQ type to `DestDrqType::Dram.

§Returns
source

pub fn source_reg<R: RegisterSpec>( self, source: &Reg<R>, drq_type: SrcDrqType, ) -> Result<DescriptorBuilder<*const (), D>, InvalidOperand>

Sets the provided pointer to a memory-mapped IO register as the source for the DMA transfer. Bytes will be copied from this register to the destination operand of the transfer.

Since the source is a memory-mapped IO register, this automatically sets the source address mode to AddressMode::IoMode. The provided SrcDrqType describes the type of DRQ signal that should be used when transferring from this register. Note that if this is not the correct DRQ for this register, the DMA transfer may never complete.

§Safety

source MUST point to a memory-mapped IO register which is a valid source for a DMA transfer. Otherwise, you will have a bad time.

§Returns
source

pub fn dest_reg<R: RegisterSpec>( self, dest: &Reg<R>, drq_type: DestDrqType, ) -> Result<DescriptorBuilder<S, *mut ()>, InvalidOperand>

Sets the provided memory-mapped IO register as the destination for the DMA transfer. Bytes will be copied from the source operand to the pointed MMIO register.

Since the destination is a memory-mapped IO register, this automatically sets the destination address mode to AddressMode::IoMode. The provided DestDrqType describes the type of DRQ signal that should be used when transferring to this register. Note that if this is not the correct DRQ for this register, the DMA transfer may never complete.

§Returns
source

fn high_bits(addr: *const (), kind: Operand) -> Result<u32, InvalidOperand>

source

fn build_inner( self, source_addr: usize, dest_addr: usize, byte_counter: u32, ) -> Descriptor

This method assumes that the value of byte_counter, as well as the source, destination, and link addresses, have already been validated.

source§

impl DescriptorBuilder<&[u8], &'_ mut [MaybeUninit<u8>]>

source

pub fn build(self) -> Descriptor

source§

impl DescriptorBuilder<*const (), &'_ mut [MaybeUninit<u8>]>

source

pub fn build(self) -> Descriptor

source§

impl DescriptorBuilder<&[u8], *mut ()>

source

pub fn build(self) -> Descriptor

source§

impl DescriptorBuilder<*const (), *mut ()>

Trait Implementations§

source§

impl<S: Clone, D: Clone> Clone for DescriptorBuilder<S, D>

source§

fn clone(&self) -> DescriptorBuilder<S, D>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<S: Debug, D: Debug> Debug for DescriptorBuilder<S, D>

source§

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

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

impl Default for DescriptorBuilder

source§

fn default() -> Self

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

impl<S: Copy, D: Copy> Copy for DescriptorBuilder<S, D>

Auto Trait Implementations§

§

impl<S, D> Freeze for DescriptorBuilder<S, D>
where S: Freeze, D: Freeze,

§

impl<S, D> RefUnwindSafe for DescriptorBuilder<S, D>

§

impl<S, D> Send for DescriptorBuilder<S, D>
where S: Send, D: Send,

§

impl<S, D> Sync for DescriptorBuilder<S, D>
where S: Sync, D: Sync,

§

impl<S, D> Unpin for DescriptorBuilder<S, D>
where S: Unpin, D: Unpin,

§

impl<S, D> UnwindSafe for DescriptorBuilder<S, D>
where S: UnwindSafe, D: UnwindSafe,

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> Az for T

source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.