Specifications
Writing a User-Level Device Drive
r
17-1
7
buffer a pointer to an I/O buffer in the user’s virtual address space
size the size of the I/O buffer in bytes
userdma_flags the control flags that specify the types of I/O operations to be
performed using the buffer. The flags that can be specified are as
follows:
USERDMA_READ indicates that the buffer is to be used to
read from the device
USERDMA_WRITE indicates that the buffer is to be used to
write to the device
These flags are used to maintain cache coherence in an
architecture-independent fashion; they are the same as those
specified on a USERDMA_LOCK userdma(2) system call. Refer
to the PowerUX Programming Guide or the userdma(2) sys-
tem manual page for additional information.
If no errors occur, the udbufalloc routine returns a pointer to a udbuf_t structure. It
returns the null pointer if the amount of memory available is not sufficient to allocate the
buffer descriptor or if the attempt to lock the user’s I/O buffer in memory fails; errno is
set to indicate the error. Refer to the udbufalloc(3X) system manual page for a listing
of the types of errors that can occur.
The udbuffree(3X) Library Routine 17
The udbuffree library routine allows a user process to remove the udbuf_t structure
that has been allocated on a call to udbufalloc(3X), remove the binding of the user’s
I/O buffer to physical memory, and restore the original cache modes.
The specifications required for using the udbufalloc routine are as follows:
void *udbuffree(udbuf)
udbuf_t
*
udbuf
;
The argument is defined as follows:
udbuf a pointer to a udbuf_t structure, which has been returned on a previous call
to the udbufalloc(3X) routine
The udbuffree(3X) routine does not return a value. For reference information on this
routine, refer to the udbufalloc(3X) system manual page.
The atexit(3C) Library Routine 17
The atexit library routine allows you to register a pointer to a function that you want to
be executed by the exit(3C) routine. You can use atexit to register up to 32