pub trait FifoInterface<T: NativeFpgaType> {
// Required methods
fn read_fifo(
&self,
fifo: u32,
buffer: &mut [T],
timeout: Option<Duration>,
) -> Result<usize, FPGAError>;
fn write_fifo(
&self,
fifo: u32,
data: &[T],
timeout: Option<Duration>,
) -> Result<usize, FPGAError>;
fn zero_copy_read(
&self,
fifo: u32,
elements: usize,
timeout: Option<Duration>,
) -> Result<(FifoReadRegion<'_, '_, T>, usize), FPGAError>;
fn zero_copy_write(
&self,
fifo: u32,
elements: usize,
timeout: Option<Duration>,
) -> Result<(FifoWriteRegion<'_, '_, T>, usize), FPGAError>;
}
Required Methods§
Sourcefn read_fifo(
&self,
fifo: u32,
buffer: &mut [T],
timeout: Option<Duration>,
) -> Result<usize, FPGAError>
fn read_fifo( &self, fifo: u32, buffer: &mut [T], timeout: Option<Duration>, ) -> Result<usize, FPGAError>
Reads the elements into the provided buffer up to the size of the buffer.
returns the number of elements left in the buffer to read.
Sourcefn write_fifo(
&self,
fifo: u32,
data: &[T],
timeout: Option<Duration>,
) -> Result<usize, FPGAError>
fn write_fifo( &self, fifo: u32, data: &[T], timeout: Option<Duration>, ) -> Result<usize, FPGAError>
Writes the elements to the FPGA from the data slice.
Returns the amount of free space in the FIFO.
Sourcefn zero_copy_read(
&self,
fifo: u32,
elements: usize,
timeout: Option<Duration>,
) -> Result<(FifoReadRegion<'_, '_, T>, usize), FPGAError>
fn zero_copy_read( &self, fifo: u32, elements: usize, timeout: Option<Duration>, ) -> Result<(FifoReadRegion<'_, '_, T>, usize), FPGAError>
Provides a region of memory to read from the FIFO.
Sourcefn zero_copy_write(
&self,
fifo: u32,
elements: usize,
timeout: Option<Duration>,
) -> Result<(FifoWriteRegion<'_, '_, T>, usize), FPGAError>
fn zero_copy_write( &self, fifo: u32, elements: usize, timeout: Option<Duration>, ) -> Result<(FifoWriteRegion<'_, '_, T>, usize), FPGAError>
Provides a region of memory to write to the FIFO.