FIRMLOAD(9F) | Kernel Functions for Drivers | FIRMLOAD(9F) |
firmload
—
Firmware loader API for device drivers
#include
<sys/firmload.h>
int
firmware_open
(const char
*drvname, const char *imgname,
firmware_handle_t *fhp);
int
firmware_close
(firmware_handle_t
fh);
off_t
firmware_get_size
(firmware_handle_t
fh);
int
firmware_read
(firmware_handle_t
fh, off_t offset, void
*buf, size_t size);
firmload
. This is
used as the subdirectory holding the firmware images.firmload
provides a simple and convenient
API for device drivers to load firmware images from files residing in the
file system that are necessary for the devices that they control. It is
primarily intended for devices without non-volatile firmware memory, which
usually require the driver to load a firmware image at attach time. Firmware
images reside in sub-directories, one for each driver, in the namespace
"firmware" in the system default module search path as described
in system(5).
The following functions are provided by the
firmload
API:
firmware_open
()firmware_close
()firmware_get_size
()firmware_read
()firmware_read
() will either read as much data as
requested or fail, there are no short reads.These functions can be called from user and kernel context.
Upon successful completion, the
firmware_open
() function returns zero and stores a
firmware handle in fhp. Otherwise a non-zero error
code is returned.
The function firmware_read
() will return
zero on success and buf will be filled with
size bytes of data. On failure -1 is returned.
The function firmware_get_size
() returns
the size of a firmware image.
firmware_close
() will always return
zero.
January 22, 2016 | OmniOS |