pub struct DmaChannel { /* private fields */ }
Expand description
A DMA channel.
DmaChannel
can coordinate the transfer of data between buffers and
peripherals without processor intervention.
Implementations§
Source§impl DmaChannel
impl DmaChannel
Sourcepub fn trigger_manually(&self)
pub fn trigger_manually(&self)
Manually start the DMA transfer.
A manual trigger is useful for memory-to-memory DMA transfers. If you’re sending
or receiving data from a peripheral, use trigger_from_hardware()
.
Sourcepub fn is_hardware_signaling(&self) -> bool
pub fn is_hardware_signaling(&self) -> bool
Returns true
is this DMA channel is actively receiving a hardware signal.
A hardware signal comes from an associated peripheral, indicating a request for transfer. It’s important to deassert the hardware before disabling a DMA channel. This gives you an opportunity to check for hardware signal.
Returns false
if the DMA channel is disabled, or if there’s no associated
hardware (see trigger_from_hardware()
).
Sourcepub fn is_interrupt(&self) -> bool
pub fn is_interrupt(&self) -> bool
Returns true
if this DMA channel generated an interrupt.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Returns true
if this DMA channel has completed its transfer.
Sourcepub unsafe fn set_source_buffer<T: DmaElement>(&self, buffer: &[T])
pub unsafe fn set_source_buffer<T: DmaElement>(&self, buffer: &[T])
Set a buffer of data as the source of a DMA transfer.
Safety: caller is responsible for ensuring the buffer’s lifetime is valid for the life of the transfer.
Sourcepub unsafe fn set_destination_buffer<T: DmaElement>(&self, buffer: &mut [T])
pub unsafe fn set_destination_buffer<T: DmaElement>(&self, buffer: &mut [T])
Set a buffer of data as the destination of a DMA receive.
Safety: caller is responsible for ensuring the buffer’s lifetime is valid for the life of the transfer.
Sourcepub unsafe fn set_source<T: DmaElement>(&self, source: *const T)
pub unsafe fn set_source<T: DmaElement>(&self, source: *const T)
Set the source of a DMA transfer.
Use set_source
if the transfer source is a peripheral register.
Safety: caller responsible for ensuring pointer’s lifetime is valid for the transfer.
Sourcepub unsafe fn set_destination<T: DmaElement>(&self, dest: *const T)
pub unsafe fn set_destination<T: DmaElement>(&self, dest: *const T)
Set the destination of a DMA transfer.
Use set_destination
if the tranfer destination is a peripheral register.
Safety: caller responsible for ensuring pointer’s lifetime is valid for the transfer.
Sourcepub fn set_disable_on_completion(&self, dreq: bool)
pub fn set_disable_on_completion(&self, dreq: bool)
Configures the DMA channel to automatically disable when the transfer completes.
Sourcepub fn set_interrupt_on_completion(&self, intr: bool)
pub fn set_interrupt_on_completion(&self, intr: bool)
Configures the DMA channel to interrupt when complete, or when there is an error.
Sourcepub fn handle_interrupt(&self)
pub fn handle_interrupt(&self)
Handle an interrupt.
Assumes that the caller knows that this DMA channel was the source of the
interrupt, or the cause of a DMA error. See is_interrupt()
and is_error()
.
The implementation panics if there is neither an error, or an interrupt.