pub struct DmaTxBuf { /* private fields */ }
unstable
only.Expand description
DMA transmit buffer
This is a contiguous buffer linked together by DMA descriptors of length 4095 at most. It can only be used for transmitting data to a peripheral’s FIFO. See DmaRxBuf for receiving data.
Implementations§
Source§impl DmaTxBuf
impl DmaTxBuf
Sourcepub fn new(
descriptors: &'static mut [DmaDescriptor],
buffer: &'static mut [u8],
) -> Result<Self, DmaBufError>
pub fn new( descriptors: &'static mut [DmaDescriptor], buffer: &'static mut [u8], ) -> Result<Self, DmaBufError>
Creates a new DmaTxBuf from some descriptors and a buffer.
There must be enough descriptors for the provided buffer. Depending on alignment requirements, each descriptor can handle at most 4095 bytes worth of buffer.
Both the descriptors and buffer must be in DMA-capable memory. Only DRAM is supported for descriptors.
Sourcepub fn new_with_config(
descriptors: &'static mut [DmaDescriptor],
buffer: &'static mut [u8],
config: impl Into<BurstConfig>,
) -> Result<Self, DmaBufError>
pub fn new_with_config( descriptors: &'static mut [DmaDescriptor], buffer: &'static mut [u8], config: impl Into<BurstConfig>, ) -> Result<Self, DmaBufError>
Creates a new DmaTxBuf from some descriptors and a buffer.
There must be enough descriptors for the provided buffer. Depending on alignment requirements, each descriptor can handle at most 4095 bytes worth of buffer.
Both the descriptors and buffer must be in DMA-capable memory. Only DRAM is supported for descriptors.
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 [u8])
pub fn split(self) -> (&'static mut [DmaDescriptor], &'static mut [u8])
Consume the buf, returning the descriptors and buffer.
Sourcepub fn set_length(&mut self, len: usize)
pub fn set_length(&mut self, len: usize)
Reset the descriptors to only transmit len
amount of bytes from this
buf.
The number of bytes in data must be less than or equal to the buffer size.
Sourcepub fn fill(&mut self, data: &[u8])
pub fn fill(&mut self, data: &[u8])
Fills the TX buffer with the bytes provided in data
and reset the
descriptors to only cover the filled section.
The number of bytes in data must be less than or equal to the buffer size.
Sourcepub fn as_mut_slice(&mut self) -> &mut [u8]
pub fn as_mut_slice(&mut self) -> &mut [u8]
Returns the buf as a mutable slice than can be written.