File uio.h¶
FileList > docs > sw > include > opae > uio.h
Go to the source code of this file.
APIs to manage a PCIe device via UIO. More...
#include <stdio.h>
#include <stdint.h>
Classes¶
Type | Name |
---|---|
struct | opae_uio OPAE UIO device abstraction. |
struct | opae_uio_device_region MMIO region info. |
Public Functions¶
Type | Name |
---|---|
void | opae_uio_close (struct opae_uio * u) Release and close a UIO device. |
int | opae_uio_open (struct opae_uio * u, const char * dfl_device) Open and populate a UIO device. |
int | opae_uio_region_get (struct opae_uio * u, uint32_t index, uint8_t ** ptr, size_t * size) Query device MMIO region. |
Macros¶
Type | Name |
---|---|
define | OPAE_UIO_PATH_MAX 256 |
Detailed Description¶
Presents a simple interface for interacting with a DFL device that is bound to its UIO driver. See https://kernel.org/doc/html/v4.14/driver-api/uio-howto.html for a description of UIO.
Provides APIs for opening/closing the device and for querying info about the MMIO regions of the device.
Public Functions Documentation¶
function opae_uio_close¶
Release and close a UIO device.
The given device pointer must have been previously initialized by opae_uio_open. Releases all data structures.
Parameters:
u
Storage for the device info. May be stack-resident.
Example struct opae_uio u;
if (opae_uio_open(&u, "dfl_dev.10")) { // handle error } else { // interact with the device ... // free the device opae_uio_close(&u); }
Example $ sudo opaeuio -r dfl_dev.10
function opae_uio_open¶
Open and populate a UIO device.
Opens the Device Feature List device corresponding to the device name given in dfl_device, eg "dfl_dev.10". The device must be bound to the dfl-uio-pdev driver prior to opening it. The data structures corresponding to the MMIO regions are initialized.
Parameters:
u
Storage for the device. May be stack-resident.dfl_device
The name of the desired DFL device.
Returns:
Non-zero on error. Zero on success.
Example $ sudo opaeuio -i -u lab -g lab dfl_dev.10
Example struct opae_uio u;
if (opae_uio_open(&u, "dfl_dev.10")) { // handle error }
function opae_uio_region_get¶
Query device MMIO region.
Retrieves info describing the MMIO region with the given region index. The device structure u must have been previously opened by a call to opae_uio_open.
Parameters:
u
The open OPAE UIO device.index
The zero-based index of the desired MMIO region.ptr
Optional pointer to receive the virtual address for the region. Pass NULL to ignore.size
Optional pointer to receive the size of the MMIO region. Pass NULL to ignore.
Returns:
Non-zero on error (including index out-of-range). Zero on success.
Example struct opae_uio u;
uint8_t *virt = NULL; size_t size = 0;
if (opae_uio_open(&u, "dfl_dev.10")) { // handle error } else { opae_uio_region_get(&u, 0, &virt, &size); }
Macro Definition Documentation¶
define OPAE_UIO_PATH_MAX¶
The documentation for this class was generated from the following file docs/sw/include/opae/uio.h