Struct maia_httpd::rxbuffer::RxBuffer
source · pub struct RxBuffer { /* private fields */ }
Expand description
Receive DMA buffer.
This struct corresponds to a rxbuffer device.
Implementations§
source§impl RxBuffer
impl RxBuffer
sourcepub async fn new(name: &str) -> Result<RxBuffer>
pub async fn new(name: &str) -> Result<RxBuffer>
Opens an rxbuffer device.
The name of the device corresponds to the filename of the character
device in /dev
.
sourcepub fn buffer_size(&self) -> usize
pub fn buffer_size(&self) -> usize
Returns the size in bytes of each of the buffers in the ring.
sourcepub fn num_buffers(&self) -> usize
pub fn num_buffers(&self) -> usize
Returns the number of buffers in the ring.
sourcepub fn buffer_as_slice(&self, num_buffer: usize) -> &[u8] ⓘ
pub fn buffer_as_slice(&self, num_buffer: usize) -> &[u8] ⓘ
Returns a slice that contains one of the buffers in the ring.
§Panics
This function panics if num_buffer
is greater or equal to the number
of buffers in the ring.
sourcepub fn cache_invalidate(&self, num_buffer: usize) -> Result<()>
pub fn cache_invalidate(&self, num_buffer: usize) -> Result<()>
Invalidates the cache of one of the buffers in the ring.
After calling this function, the contents of the CPU caches corresponding to the buffer have been invalidated, so changes in the buffer produced by non-coherent writes done by the FPGA can be observed by the CPU.
This function should be called before reading data from the buffer, unless we know that the FPGA has not written to that buffer since the last time that we invalidated its corresponding caches.