Struct maia_httpd::uio::Uio
source · pub struct Uio { /* private fields */ }
Expand description
UIO device.
This struct represents an UIO device.
Implementations§
source§impl Uio
impl Uio
sourcepub async fn from_num(num: usize) -> Result<Uio>
pub async fn from_num(num: usize) -> Result<Uio>
Opens an UIO using its number.
This function opens the UIO device /dev/uio<num>
, where num
is the
parameter indicating the UIO device number.
sourcepub async fn from_name(name: &str) -> Result<Uio>
pub async fn from_name(name: &str) -> Result<Uio>
Opens an UIO using its name.
This function searches in /sys/class/uio
an UIO device whose name
matches the indicated one and opens it.
sourcepub async fn map_mapping(&self, mapping: usize) -> Result<Mapping>
pub async fn map_mapping(&self, mapping: usize) -> Result<Mapping>
Maps a memory mapping of an UIO device.
The mapping
number is the number that corresponds to the mapping, as
listed in /sys/class/uio/uio*/maps/map<mapping>
. Mappings are numbered
sequentially for each device, so devices that only support one mapping
use 0
as the value for mapping
.
sourcepub async fn map_size(&self, mapping: usize) -> Result<usize>
pub async fn map_size(&self, mapping: usize) -> Result<usize>
Gives the size of a UIO mapping.
The map size is obtained from the file
/sys/class/uio/uio*/maps/map*/size
.
sourcepub async fn map_offset(&self, mapping: usize) -> Result<usize>
pub async fn map_offset(&self, mapping: usize) -> Result<usize>
Gives the offset of a UIO mapping.
The offset is obtained from the file
/sys/class/uio/uio*/maps/map*/offset
.
sourcepub async fn map_addr(&self, mapping: usize) -> Result<usize>
pub async fn map_addr(&self, mapping: usize) -> Result<usize>
Gives the address of a UIO mapping.
The address is obtained from the file
/sys/class/uio/uio*/maps/map*/address
.
sourcepub async fn irq_enable(&mut self) -> Result<()>
pub async fn irq_enable(&mut self) -> Result<()>
Enables interrupts.
This function enables the interrupts for an UIO device by writing a 1
to the corresponding character device.
sourcepub async fn irq_disable(&mut self) -> Result<()>
pub async fn irq_disable(&mut self) -> Result<()>
Disables interrupts.
This function disables the interrupts for an UIO device by writing a 0
to the corresponding character device.