embassy-stm32

Crates

git

Versions

stm32f301k8

Flavors

Skip to main content

Channel

Struct Channel 

Source
pub struct Channel<'d> { /* private fields */ }
Expand description

DMA channel driver

Implementations§

Source§

impl<'d> Channel<'d>

Source

pub unsafe fn transfer<'a, MW: Word, PW: Word>( &'a mut self, request: Request, buf: *const [PW], dest_addr: *mut MW, options: TransferOptions, ) -> Transfer<'a>

Create a memory DMA transfer (memory to memory), using raw pointers.

Source

pub unsafe fn transfer_raw<'a, MW: Word, PW: Word>( &'a mut self, request: Request, src_addr: *const MW, src_size: usize, dest_addr: *mut PW, options: TransferOptions, ) -> Transfer<'a>

Create a memory DMA transfer (memory to memory), using raw pointers.

Source

pub unsafe fn read<'a, W: Word>( &'a mut self, request: Request, peri_addr: *mut W, buf: &'a mut [W], options: TransferOptions, ) -> Transfer<'a>

Create a read DMA transfer (peripheral to memory).

Source

pub unsafe fn read_raw<'a, MW: Word, PW: Word>( &'a mut self, request: Request, peri_addr: *mut PW, buf: *mut [MW], options: TransferOptions, ) -> Transfer<'a>

Create a read DMA transfer (peripheral to memory), using raw pointers.

Source

pub unsafe fn read_raw_repeated<'a, MW: Word, PW: Word>( &'a mut self, request: Request, repeated: *mut MW, count: usize, peri_addr: *mut PW, options: TransferOptions, ) -> Transfer<'a>

Create a read DMA transfer (peripheral to memory), writing the same value repeatedly.

Source

pub unsafe fn write<'a, MW: Word, PW: Word>( &'a mut self, request: Request, buf: &'a [MW], peri_addr: *mut PW, options: TransferOptions, ) -> Transfer<'a>

Create a write DMA transfer (memory to peripheral).

Source

pub unsafe fn write_raw<'a, MW: Word, PW: Word>( &'a mut self, request: Request, buf: *const [MW], peri_addr: *mut PW, options: TransferOptions, ) -> Transfer<'a>

Create a write DMA transfer (memory to peripheral), using raw pointers.

Source

pub unsafe fn write_repeated<'a, W: Word>( &'a mut self, request: Request, repeated: &'a W, count: usize, peri_addr: *mut W, options: TransferOptions, ) -> Transfer<'a>

Create a write DMA transfer (memory to peripheral), writing the same value repeatedly.

Source

pub unsafe fn write_mem2mem<'a, MW: Word, PW: Word>( &'a mut self, request: Request, buf: &'a [MW], dest_addr: *mut PW, options: TransferOptions, ) -> Transfer<'a>

Create a memory DMA transfer (memory to memory) to a fixed destination address.

This transfers data from a memory buffer (buf) to a fixed destination address (dest_addr).

This is specifically required for peripherals like the DFSDM, which need memory-to-memory DMA transfers to write data into their internal input registers (e.g., DATINR), rather than standard memory-to-peripheral transfers.

§Safety

The caller must ensure that the destination address is valid and that the DMA transfer does not violate Rust’s aliasing rules for the duration of the transfer.

Source

pub unsafe fn write_mem2mem_raw<'a, MW: Word, PW: Word>( &'a mut self, request: Request, buf: *const [MW], dest_addr: *mut PW, options: TransferOptions, ) -> Transfer<'a>

Create a memory DMA transfer (memory to memory) to a fixed destination address, using raw pointers.

This is the raw pointer variant of write_mem2mem. It transfers data from a raw source slice (buf) to a fixed destination address (dest_addr).

This is specifically used for peripherals like the DFSDM, which require memory-to-memory DMA to feed data into their internal registers.

Note: The arguments are ordered logically as (source, destination) to avoid the internal peri_addr/mem_addr ambiguity present in the underlying Dir::MemoryToMemory hardware configuration.

§Safety

The caller must ensure that the source and destination pointers are valid and properly aligned for the duration of the transfer.

Source§

impl<'d> Channel<'d>

Source

pub fn new<T: ChannelInstance>( _ch: Peri<'d, T>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, ) -> Self

Create a new DMA channel driver.

Source

pub fn reborrow(&mut self) -> Channel<'_>

Reborrow the channel, allowing it to be used in multiple places.

Auto Trait Implementations§

§

impl<'d> Freeze for Channel<'d>

§

impl<'d> RefUnwindSafe for Channel<'d>

§

impl<'d> Send for Channel<'d>

§

impl<'d> Sync for Channel<'d>

§

impl<'d> Unpin for Channel<'d>

§

impl<'d> UnsafeUnpin for Channel<'d>

§

impl<'d> UnwindSafe for Channel<'d>

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.