6 releases (3 breaking)

Uses old Rust 2015

0.4.0 Oct 8, 2024
0.3.0 Sep 6, 2024
0.2.1 Jul 7, 2023
0.2.0 Mar 7, 2019
0.1.0 May 27, 2016

#206 in Hardware support

Download history 417/week @ 2024-08-19 495/week @ 2024-08-26 587/week @ 2024-09-02 698/week @ 2024-09-09 729/week @ 2024-09-16 633/week @ 2024-09-23 817/week @ 2024-09-30 1019/week @ 2024-10-07 883/week @ 2024-10-14 848/week @ 2024-10-21 819/week @ 2024-10-28 1208/week @ 2024-11-04 1284/week @ 2024-11-11 1466/week @ 2024-11-18 1098/week @ 2024-11-25 1363/week @ 2024-12-02

5,236 downloads per month

MIT license

16KB
305 lines

Linux UIO library for Rust

A thin abstraction library for writing user-space drivers in Linux by using the UIO facility (https://www.kernel.org/doc/html/latest/driver-api/uio-howto.html).

In order to use this library, you'll need to make sure your device uses the Linux UIO driver module. For example, the following sample commands unload the ahci driver in Linux and use the uio_pci_generic module for the SSD disk for the PCI device with vendor 0x8086 and device id 0x1d02. (Note: Dangerous, don't do this if you don't know what you're doing).

$ modprobe -r ahci
$ sudo modprobe uio
$ sudo modprobe uio_pci_generic
$ echo "0x8086 0x1d02" > /sys/bus/pci/drivers/uio_pci_generic/new_id
$ lspci -v -d :0x1d02 | grep "Kernel driver in use"

Afterwards you should have one or more uio devices available in /dev/uio* which you can use to instantiate the UioDevice struct:

extern crate uio;
use uio::*;

pub fn main() {
    let uio_num = 1; // /dev/uio1
    let dev = UioDevice::new(uio_num).unwrap();
    let bar = dev.map_resource(5).unwrap();
}

Resources

For more information about UIO check the following links:

Dependencies

~2MB
~36K SLoC