pub struct DmaRxTxBuf { /* private fields */ }Available on crate feature
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: DmaAlignedMut<'static, [DmaDescriptor]>,
tx_descriptors: DmaAlignedMut<'static, [DmaDescriptor]>,
buffer: DmaAlignedMut<'static, [u8]>,
) -> Result<Self, DmaBufError>
pub fn new( rx_descriptors: DmaAlignedMut<'static, [DmaDescriptor]>, tx_descriptors: DmaAlignedMut<'static, [DmaDescriptor]>, buffer: DmaAlignedMut<'static, [u8]>, ) -> Result<Self, DmaBufError>
Creates a new DmaRxTxBuf from some descriptors and a buffer.
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,
) -> (DmaAlignedMut<'static, [DmaDescriptor]>, DmaAlignedMut<'static, [DmaDescriptor]>, DmaAlignedMut<'static, [u8]>)
pub fn split( self, ) -> (DmaAlignedMut<'static, [DmaDescriptor]>, DmaAlignedMut<'static, [DmaDescriptor]>, DmaAlignedMut<'static, [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
impl Debug for DmaRxTxBuf
Source§impl DmaRxBuffer for DmaRxTxBuf
impl DmaRxBuffer for DmaRxTxBuf
Source§type View = BufView<DmaRxTxBuf>
type View = BufView<DmaRxTxBuf>
A type providing operations that are safe to perform on the buffer
whilst the DMA is actively using it.
Source§type Final = DmaRxTxBuf
type Final = DmaRxTxBuf
The type returned to the user when a transfer finishes. Read more
Source§fn prepare(&mut self) -> Preparation
fn prepare(&mut self) -> Preparation
Prepares the buffer for an imminent transfer and returns
information required to use this buffer. Read more
Source§fn into_view(self) -> BufView<DmaRxTxBuf>
fn into_view(self) -> BufView<DmaRxTxBuf>
This is called before the DMA starts using the buffer.
Source§impl DmaTxBuffer for DmaRxTxBuf
impl DmaTxBuffer for DmaRxTxBuf
Source§type View = BufView<DmaRxTxBuf>
type View = BufView<DmaRxTxBuf>
A type providing operations that are safe to perform on the buffer
whilst the DMA is actively using it.
Source§type Final = DmaRxTxBuf
type Final = DmaRxTxBuf
The type returned to the user when a transfer finishes. Read more
Source§fn prepare(&mut self) -> Preparation
fn prepare(&mut self) -> Preparation
Prepares the buffer for an imminent transfer and returns
information required to use this buffer. Read more
Source§fn into_view(self) -> BufView<DmaRxTxBuf>
fn into_view(self) -> BufView<DmaRxTxBuf>
This is called before the DMA starts using the buffer.