pub struct DmaRxTxBuf { /* private fields */ }
unstable
only.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.