Skip to main content

DmaDriver

Struct DmaDriver 

Source
pub struct DmaDriver<'d, T: DmaInstance> { /* private fields */ }
Expand description

DMA controller driver.

Implementations§

Source§

impl<'d, T: DmaInstance> DmaDriver<'d, T>

Source

pub fn new(_dma: impl Into<PhantomData<&'d T>>) -> Self

Create a new DMA driver from a DMA peripheral.

Source

pub fn enable_controller(&mut self)

Enable the DMA controller.

Source

pub fn disable_controller(&mut self)

Disable the DMA controller.

Source

pub fn configure_channel( &mut self, channel: u8, src_addr: u32, dst_addr: u32, transfer_size: u16, config: &DmaChannelConfig, )

Configure a DMA channel.

  • channel — Logical channel number (0-3 for MDMA, 8-11 for SDMA).
  • src_addr — Source address.
  • dst_addr — Destination address.
  • transfer_size — Number of source-width beats to transfer.
  • config — Channel configuration.
Source

pub fn enable_channel(&mut self, channel: u8)

Enable a specific DMA channel.

Source

pub fn disable_channel(&mut self, channel: u8)

Disable a specific DMA channel.

Source

pub fn channel_enabled(&self, channel: u8) -> bool

Check if a DMA channel is enabled.

Source

pub fn channel_active(&self, channel: u8) -> bool

Check if a channel has data in its FIFO (active transfer).

Source

pub fn halt_channel(&mut self, channel: u8)

Halt a DMA channel (ignore further DMA requests).

Source

pub fn resume_channel(&mut self, channel: u8)

Resume a halted DMA channel.

Source

pub fn burst_request(&mut self, channel: u8)

Issue a software burst request for a channel.

Source

pub fn single_request(&mut self, channel: u8)

Issue a software single request for a channel.

Source

pub fn raw_interrupt_status(&self) -> (u8, u8)

Get the raw interrupt status.

Returns (transfer_done_mask, error_mask). Bit n of each mask is the physical channel n of this controller — i.e. logical channel CHANNEL_BASE + n. For SDMA, logical channel 8 is bit 0, channel 9 is bit 1, etc. (the controller’s per-channel status registers are local).

Source

pub fn interrupt_status(&self) -> (u8, u8)

Get the masked interrupt status.

Returns (transfer_done_mask, error_mask), with the same physical channel bit indexing as raw_interrupt_status (bit n = physical channel n = logical CHANNEL_BASE + n).

Source

pub fn clear_transfer_interrupt(&mut self, channel: u8)

Clear transfer complete interrupt for a channel.

Source

pub fn clear_error_interrupt(&mut self, channel: u8)

Clear error interrupt for a channel.

Source

pub fn set_sync(&mut self, sync_mask: u16)

Set DMA sync configuration.

Each bit controls sync for the corresponding channel (0 = enable sync logic, 1 = disable sync logic).

Source§

impl<'d> DmaDriver<'d, Dma0>

Source

pub fn new_dma(_dma: Dma<'d>) -> Self

Create a new primary DMA driver.

Source§

impl<'d> DmaDriver<'d, Sdma0>

Source

pub fn new_sdma(_sdma: Sdma<'d>) -> Self

Create a new secure DMA driver.

Auto Trait Implementations§

§

impl<'d, T> Freeze for DmaDriver<'d, T>

§

impl<'d, T> RefUnwindSafe for DmaDriver<'d, T>
where T: RefUnwindSafe,

§

impl<'d, T> Send for DmaDriver<'d, T>
where T: Sync,

§

impl<'d, T> Sync for DmaDriver<'d, T>
where T: Sync,

§

impl<'d, T> Unpin for DmaDriver<'d, T>

§

impl<'d, T> UnsafeUnpin for DmaDriver<'d, T>

§

impl<'d, T> UnwindSafe for DmaDriver<'d, T>
where T: RefUnwindSafe,

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.