Struct uio::UioDevice

source ·
pub struct UioDevice { /* private fields */ }

Implementations§

source§

impl UioDevice

source

pub fn new(uio_num: usize) -> Result<UioDevice>

Creates a new UIO device for Linux.

Arguments
  • uio_num - UIO index of device (i.e., 1 for /dev/uio1)
source

pub fn get_resource_info(&mut self) -> Result<Vec<(String, u64)>, UioError>

Return a vector of mappable resources (i.e., PCI bars) including their size.

source

pub fn map_resource(&self, bar_nr: usize) -> Result<*mut c_void, UioError>

Maps a given resource into the virtual address space of the process.

Arguments
  • bar_nr: The index to the given resource (i.e., 1 for /sys/class/uio/uioX/device/resource1)
source

pub fn get_event_count(&self) -> Result<u32, UioError>

The amount of events.

source

pub fn get_name(&self) -> Result<String, UioError>

The name of the UIO device.

source

pub fn get_version(&self) -> Result<String, UioError>

The version of the UIO driver.

source

pub fn map_size(&self, mapping: usize) -> Result<usize, UioError>

The size of a given mapping.

Arguments
  • mapping: The given index of the mapping (i.e., 1 for /sys/class/uio/uioX/maps/map1)
source

pub fn map_addr(&self, mapping: usize) -> Result<usize, UioError>

The address of a given mapping.

Arguments
  • mapping: The given index of the mapping (i.e., 1 for /sys/class/uio/uioX/maps/map1)
source

pub fn get_map_info(&mut self) -> Result<Vec<String>, UioError>

Return a list of all possible memory mappings.

source

pub fn map_mapping(&self, mapping: usize) -> Result<*mut c_void, UioError>

Map an available memory mapping.

Arguments
  • mapping: The given index of the mapping (i.e., 1 for /sys/class/uio/uioX/maps/map1)
source

pub fn irq_enable(&mut self) -> Result<()>

Enable interrupt

source

pub fn irq_disable(&mut self) -> Result<()>

Disable interrupt

source

pub fn irq_wait(&mut self) -> Result<u32>

Wait for interrupt

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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, U> Into<U> for Twhere 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, U> TryFrom<U> for Twhere 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 Twhere 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.