pub struct DmaDriver<'d, T: DmaInstance> { /* private fields */ }Expand description
DMA controller driver.
Implementations§
Source§impl<'d, T: DmaInstance> DmaDriver<'d, T>
impl<'d, T: DmaInstance> DmaDriver<'d, T>
Sourcepub fn new(_dma: impl Into<PhantomData<&'d T>>) -> Self
pub fn new(_dma: impl Into<PhantomData<&'d T>>) -> Self
Create a new DMA driver from a DMA peripheral.
Sourcepub fn enable_controller(&mut self)
pub fn enable_controller(&mut self)
Enable the DMA controller.
Sourcepub fn disable_controller(&mut self)
pub fn disable_controller(&mut self)
Disable the DMA controller.
Sourcepub fn configure_channel(
&mut self,
channel: u8,
src_addr: u32,
dst_addr: u32,
transfer_size: u16,
config: &DmaChannelConfig,
)
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.
Sourcepub fn enable_channel(&mut self, channel: u8)
pub fn enable_channel(&mut self, channel: u8)
Enable a specific DMA channel.
Sourcepub fn disable_channel(&mut self, channel: u8)
pub fn disable_channel(&mut self, channel: u8)
Disable a specific DMA channel.
Sourcepub fn channel_enabled(&self, channel: u8) -> bool
pub fn channel_enabled(&self, channel: u8) -> bool
Check if a DMA channel is enabled.
Sourcepub fn channel_active(&self, channel: u8) -> bool
pub fn channel_active(&self, channel: u8) -> bool
Check if a channel has data in its FIFO (active transfer).
Sourcepub fn halt_channel(&mut self, channel: u8)
pub fn halt_channel(&mut self, channel: u8)
Halt a DMA channel (ignore further DMA requests).
Sourcepub fn resume_channel(&mut self, channel: u8)
pub fn resume_channel(&mut self, channel: u8)
Resume a halted DMA channel.
Sourcepub fn burst_request(&mut self, channel: u8)
pub fn burst_request(&mut self, channel: u8)
Issue a software burst request for a channel.
Sourcepub fn single_request(&mut self, channel: u8)
pub fn single_request(&mut self, channel: u8)
Issue a software single request for a channel.
Sourcepub fn raw_interrupt_status(&self) -> (u8, u8)
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).
Sourcepub fn interrupt_status(&self) -> (u8, u8)
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).
Sourcepub fn clear_transfer_interrupt(&mut self, channel: u8)
pub fn clear_transfer_interrupt(&mut self, channel: u8)
Clear transfer complete interrupt for a channel.
Sourcepub fn clear_error_interrupt(&mut self, channel: u8)
pub fn clear_error_interrupt(&mut self, channel: u8)
Clear error interrupt for a channel.