pub struct RxBuffer { /* private fields */ }
Expand description

Receive DMA buffer.

This struct corresponds to a rxbuffer device.

Implementations§

source§

impl RxBuffer

source

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.

source

pub fn buffer_size(&self) -> usize

Returns the size in bytes of each of the buffers in the ring.

source

pub fn num_buffers(&self) -> usize

Returns the number of buffers in the ring.

source

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.

source

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.

Trait Implementations§

source§

impl Debug for RxBuffer

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for RxBuffer

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Send for RxBuffer

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more