[−][src]Struct samd_dma::Channel
DMA channel.
This structure represents a DMA channel. Using the start_transfer
method, you can
setup a DMA transfer transaction. You can also configure the DMA channel properties.
Methods
impl Channel
[src]
pub fn id(&self) -> u8
[src]
Return the channel ID.
pub fn set_trigger_action(&mut self, trig_act: TriggerAction)
[src]
Set the trigger action for the channel.
pub fn get_trigger_action(&self) -> TriggerAction
[src]
Get the trigger action for the channel.
pub fn set_source(&mut self, source: TriggerSource)
[src]
Set the source trigger for the DMA Channel.
pub fn get_source(&self) -> TriggerSource
[src]
Get the trigger source for the channel.
pub fn set_priority(&mut self, priority: Priority)
[src]
Set the priority level of the channel.
pub fn get_priority(&self) -> Priority
[src]
Get channel priority level.
pub fn get_first_descriptor(&self) -> &mut TransferDescriptor
[src]
Get a mutable reference to the first descriptor for the channel.
pub fn get_interrupt_flags(&self) -> Interrupts
[src]
Get the channel's interrupt flags.
pub fn clear_interrupt_flags(&mut self)
[src]
Reset the channel's interrupt flags.
pub fn enable_interrupts(&mut self, interrupts: Interrupts)
[src]
Enable interrupts for the channel. Any interrupts that are not set will be disabled.
pub fn get_enabled_interrupts(&self) -> Interrupts
[src]
Get the set of enabled channel interrupts.
pub fn get_writeback_descriptor(&mut self) -> *mut TransferDescriptor
[src]
Read descriptor from the Write-back Address of this channel.
Safety
The write-back address of a DMA channel is volatile, as the DMA engine can change it at any time. As such, reading and writing to this descriptor is unsafe. Act cautiously.
pub fn enable(&mut self)
[src]
Enable the DMA channel.
After this call, this channel will be a part of the DMA arbitration scheme (if its corresponding priority level is active), and trigger events will cause the transaction to start from the first descriptor.
pub fn is_enabled(&self) -> bool
[src]
Return whether the channel is enabled or not.
pub fn reset(&mut self)
[src]
Reset the DMA channel. This will set all channel registers to their reset values.
If the channel is still enabled (or is in the process of being disabled), this command will be ignored.
pub fn trigger(&mut self)
[src]
Manually trigger the channel.
Interrupt Safety
This method is not interrupt-safe, and could lead to lost updates.
It is the responsibility of the caller to ensure that the call-site is in an interrupt-free section.
pub fn suspend(&mut self) -> bool
[src]
Suspend the ongoing transaction. Returns true
if the command was successfully written, false
if another
command is ongoing.
This call returns immediately, but the suspend operation won't complete until the ongoing burst transfer completes.
pub fn resume(&mut self) -> bool
[src]
Resume the ongoing transaction. Returns true
if command was successfully written, false
if another command
is ongoing.
pub fn disable(&mut self)
[src]
Disable the channel. This aborts any ongoing transaction.
This call returns immediately, but the transaction will not be aborted until the ongoing burst transfer completes.
pub fn is_pending(&self) -> bool
[src]
Returns true
if a transfer is pending on the channel.
Returns false
if a channel trigger action is completed, a bus error is detected, or the channel is disabled.
pub fn is_busy(&self) -> bool
[src]
Returns true
if the channel has started a transfer.
Returns false
if a channel trigger action is started, a bus error is detected, or the channel is disabled.
pub fn poll_status(&mut self) -> Result<WaitResult, TransactionError>
[src]
Poll the channel to determine the status of the transaction.
This will read and reset the interrupt flag registers of the channel to determine the status of the channel. Therefore it is expected to be called in the appropriate interrupt vector.
Any non-error state will return Ok(WaitResult)
.
Any errors will be returned as Err(TransactionError)
.
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,