pub struct DmaRxTxBuf { /* private fields */ }Expand description
DMA transmit and receive buffer.
This is a (single) contiguous buffer linked together by two sets of DMA descriptors of length 4092 each. It can be used for simultaneously transmitting to and receiving from a peripheral’s FIFO. These are typically full-duplex transfers.
Implementations§
Source§impl DmaRxTxBuf
 
impl DmaRxTxBuf
Sourcepub fn new(
    rx_descriptors: &'static mut [DmaDescriptor],
    tx_descriptors: &'static mut [DmaDescriptor],
    buffer: &'static mut [u8],
) -> Result<Self, DmaBufError>
 
pub fn new( rx_descriptors: &'static mut [DmaDescriptor], tx_descriptors: &'static mut [DmaDescriptor], buffer: &'static mut [u8], ) -> Result<Self, DmaBufError>
Creates a new DmaRxTxBuf from some descriptors and a buffer.
There must be enough descriptors for the provided buffer. Each descriptor can handle 4092 bytes worth of buffer.
Both the descriptors and buffer must be in DMA-capable memory. Only DRAM is supported.
Sourcepub fn set_burst_config(
    &mut self,
    burst: BurstConfig,
) -> Result<(), DmaBufError>
 
pub fn set_burst_config( &mut self, burst: BurstConfig, ) -> Result<(), DmaBufError>
Configures the DMA to use burst transfers to access this buffer.
Sourcepub fn split(
    self,
) -> (&'static mut [DmaDescriptor], &'static mut [DmaDescriptor], &'static mut [u8])
 
pub fn split( self, ) -> (&'static mut [DmaDescriptor], &'static mut [DmaDescriptor], &'static mut [u8])
Consume the buf, returning the rx descriptors, tx descriptors and buffer.
Sourcepub fn as_mut_slice(&mut self) -> &mut [u8]
 
pub fn as_mut_slice(&mut self) -> &mut [u8]
Returns the entire buf as a slice than can be written.
Sourcepub fn set_length(&mut self, len: usize)
 
pub fn set_length(&mut self, len: usize)
Reset the descriptors to only transmit/receive len amount of bytes
with this buf.
len must be less than or equal to the buffer size.
Trait Implementations§
Source§impl Debug for DmaRxTxBuf
Available on crate feature unstable only. 
impl Debug for DmaRxTxBuf
unstable only.Source§impl DmaRxBuffer for DmaRxTxBuf
Available on crate feature unstable only. 
impl DmaRxBuffer for DmaRxTxBuf
unstable only.Source§type View = BufView<DmaRxTxBuf>
 
type View = BufView<DmaRxTxBuf>
Source§type Final = DmaRxTxBuf
 
type Final = DmaRxTxBuf
Source§fn prepare(&mut self) -> Preparation
 
fn prepare(&mut self) -> Preparation
Source§fn into_view(self) -> BufView<DmaRxTxBuf>
 
fn into_view(self) -> BufView<DmaRxTxBuf>
Source§impl DmaTxBuffer for DmaRxTxBuf
Available on crate feature unstable only. 
impl DmaTxBuffer for DmaRxTxBuf
unstable only.