Specifications
Writing a User-Level Device Drive
r
17-15
Understanding Operating System Support for a User-Level
Driver 17
Operating system support for writing and using a user-level device driver consists of
system calls, library routines, and process synchronization tools. This section describes
these forms of support and explains how they are used.
The userdma(2) system call allows you to prepare a buffer for DMA transfers; it is
described in “The userdma(2) System Call” on page 17-15. The udbufalloc(3X) and
the udbuffree(3X) library routines are the interface to userdma; they enable you to
create and remove a user-level buffer descriptor. Use of these routines is explained in
“The udbufalloc(3X) Library Routine” on page 17-16 and “The udbuffree(3X) Library
Routine” on page 17-17, respectively.
The atexit(3C) library routine allows you to register a function to be executed by
exit(). Use of this routine is explained in “The atexit(3C) Library Routine” on page
17-17.
The uderror(3X) library routine allows you to print user-level device driver error
messages. Use of this routine is explained in “The uderror(3X) Library Routine” on page
17-18.
The spl support routines enable you to raise and lower a processor’s interrupt priority
level from user level. They are described in “The spl Support Routines” on page 17-19.
Process synchronization tools provide solutions to the problems associated with
synchronizing processes’ access to data in shared memory. They are described in “Process
Synchronization Tools” on page 17-19.
The user-level interrupt library routines, iconnect(3C) and ienable(3C), allow
you to define a connection between a user-level interrupt process and an interrupt vector
and to enable that connection. The uistat(1) utility allows you to display information
about interrupt vector connections, disconnect a connected interrupt process, and free an
interrupt vector. The library routines and the utility are described in “The User-Level
Interrupt Library Routines and Utility” on page 17-22.
The vme_address(3C) library routine allows you to obtain a 32-bit physical address
for a specified device’s A16 or A24 VME address. It is described in “The
vme_address(3C) Library Routine” on page 17-23.
The userdma(2) System Call 17
The userdma system call allows you to use an I/O controller’s DMA capabilities directly
from user mode. It prepares an I/O buffer located in a user process’s virtual address space
for DMA transfers.
Standard DMA hardware operates at the physical memory level; it bypasses memory
management units and sometimes data caches. To be able to perform DMA transfers to or
from the virtual address space of an application program, the following requirements must
be met: