pub struct Session {
pub handle: u32,
/* private fields */
}
Fields§
§handle: u32
Implementations§
Source§impl Session
impl Session
Sourcepub fn create_irq_context(&self) -> Result<IrqContext<'_>, FPGAError>
pub fn create_irq_context(&self) -> Result<IrqContext<'_>, FPGAError>
Creates an IRQ Context for the session.
You can create multiple contexts but each context can only be used by one thread at a time.
The context is then used to wait on specific IRQs. See IrqContext
.
To minimize jitter when first waiting on IRQs, reserve as many contexts as the application requires.
Sourcepub fn acknowledge_irqs(&self, irqs: IrqSelection) -> Result<(), FPGAError>
pub fn acknowledge_irqs(&self, irqs: IrqSelection) -> Result<(), FPGAError>
Acknowledge the specified IRQs. See IrqSelection
for details on setting specific IRQs.
Source§impl Session
impl Session
Sourcepub fn configure_fifo(
&self,
fifo: u32,
requested_depth: usize,
) -> Result<usize, FPGAError>
pub fn configure_fifo( &self, fifo: u32, requested_depth: usize, ) -> Result<usize, FPGAError>
Specify the depth of the host memory part of the FIFO.
Returns the actual size configured which may be larger than the request.
Sourcepub fn start_fifo(&self, fifo: u32) -> Result<(), FPGAError>
pub fn start_fifo(&self, fifo: u32) -> Result<(), FPGAError>
Start the FIFO.
Sourcepub fn release_fifo_elements(
&self,
fifo: u32,
number_of_elements: usize,
) -> Result<(), FPGAError>
pub fn release_fifo_elements( &self, fifo: u32, number_of_elements: usize, ) -> Result<(), FPGAError>
Releases previously acquired FIFO elements. The FPGA target cannot read elements acquired by the host. Therefore, the host must release elements after acquiring them.
Always release all acquired elements before closing the session. Do not attempt to access FIFO elements after the elements are released or the session is closed.
Sourcepub fn get_peer_to_peer_fifo_endpoint(
&self,
fifo: u32,
) -> Result<u32, FPGAError>
pub fn get_peer_to_peer_fifo_endpoint( &self, fifo: u32, ) -> Result<u32, FPGAError>
Gets the endpoint number of a peer-to-peer FIFO.
Source§impl Session
impl Session
Sourcepub fn new(
context: &Arc<NiFpgaContext>,
bitfile: &str,
signature: &str,
resource: &str,
options: &SessionOptions,
) -> Result<Self, FPGAError>
pub fn new( context: &Arc<NiFpgaContext>, bitfile: &str, signature: &str, resource: &str, options: &SessionOptions, ) -> Result<Self, FPGAError>
Create a new session for the specified bitfile and resource.
You must have an open context to construct the session.
The bitfile is the compiled FPGA VI and can be provided as a relative or absolute path.
The session options specify run and reset behaviour for the session. You can use default to run on start and reset on end.
§Example
use ni_fpga_interface::session::{NiFpgaContext, Session};
let fpga_context = NiFpgaContext::new().unwrap();
let session = Session::new(
&fpga_context,
"./NiFpga_Main.lvbitx",
"signature",
"RIO0",
&Default::default(),
).unwrap();
Sourcepub fn set_options(&mut self, options: &SessionOptions)
pub fn set_options(&mut self, options: &SessionOptions)
Update the session options if you want to change the close behaviour.
§Example
use ni_fpga_interface::session::{NiFpgaContext, Session, SessionOptions};
session.set_options(&SessionOptions { reset_on_close: false, ..Default::default() });