Specifications
Writing a User-Level Device Drive
r
17-
7
int register_id; /* IPC id for register region */
unsigned int register_offset;/* register offset into shared memory */
unsigned short ivct; /* interrupt vector for interrupt
routine */
unsigned short initial_ivct; /* old interrupt vector */
unsigned short vme_modifier; /* vme modifier */
unsigned short initial_vme_modifier; /* old vme modifier */
int device_spl; /* spl level requested for interrupts */
int spl_level; /* spl level to use for spin-locks */
dr11w_modes_t modes; /* the dma mode to use for I/O */
struct spin_mutex device_lock;/* the driver lock */
int intr_pid; /* the pid of the interrupt routine */
int intr_status; /* error value for interrupt status */
int intr_function; /* driver specific error status */
int intr_errno; /* errno associated with interrupt
status */
struct dr11w_waitdatadma; /* DMA status structures */
struct dr11w_waitdataattn; /* ATTN interrupt status
structures */
unsigned int tmp_int; /* temporary storage for the
interrupt routine */
unsigned short tmp_short1; /* temporary storage for the
interrupt routine */
unsigned short tmp_short2; /* temporary storage for the
interrupt routine */
int filler[4];
} DR11W_SHARED;
The user-level driver’s open routine should attach both the device register region and the
driver status region to the program’s virtual address space and if necessary, lock the
regions in physical memory. These regions must be locked in physical memory if they
shall be accessed under the protection of a spin lock or if a user-level interrupt-handling
routine is used.
An overview of the device configuration program is provided in “Overview of the Device
Configuration Program” on page 17-14, and procedures for developing it are explained in
“Developing the Device Configuration Program” on page 17-38. Procedures for
developing the driver’s open routines are explained in “The open Routine” on page
17-23.
User I/O Buffer Descriptor 17
The user-level driver library routines that are used to perform I/O operations to and from a
buffer in the user’s virtual address space often require physical addresses to describe the
buffer. Although the I/O buffer seems to be a contiguous stream of bytes to the user, it can
actually be scattered among areas of physical memory that are not contiguous.
Some devices are not capable of performing DMA transfers to memory that is not
contiguous. If the application’s I/O buffer is larger than a page, it is recommended that
you ensure that the I/O buffer is bound to a contiguous section of physical memory by
performing the following steps: