Specifications
D
evice Driver Programming
10-20
the mmap routine returns NOPAGE. If the offset does exist, mmap returns the physical page
ID for the page at offset off in the device’s memory.
This physical page ID is a machine-specific token that uniquely identifies a page of physi-
cal memory in the system. A driver calls kvtoppid(D3) to get the physical page ID for
a particular virtual address. Drivers call phystoppid(D3) to get the physical page ID
for a physical address.
Interrupt Service Routines 10
Check your device technical reference manual to determine whether your device generates
interrupts. (Refer to Chapter 4 (“Series 6000 Hardware Environment”) for a description of
this hardware mechanism, interrupt vectors, and interrupt priority levels).
If your device does not generate interrupts, you need to specify this in the Sadapters
configuration file associated with the device driver. The driver has no interrupt service rou-
tine.
If your device generates interrupts, complete the following steps to prepare to code the
interrupt service routine:
1. Determine the level at which the device interrupts. This information is pro-
vided in the vendor documentation for the board.
2. Allocate an interrupt vector for the device. Refer to the vendor’s manual to
determine how to configure the interrupt vector(s) used by the device.
There are two possibilities.
• If your device uses a hard-coded interrupt vector, then you must edit
the file /etc/conf/cf.d/ivt.s and insert the following call in
the kernel interrupt vector table at the location that corresponds to the
interrupt vector used by the device
IS(myintrhandler)
Finally, you must rebuild the kernel as explained in Chapter 14
(“Driver Installation and Tuning”).
• If your device interrupt vector is programmable, be sure to allocate
the vector(s) in the start() or init() entry points, which are
called during system initialization. Use the kernel routines
ivec_alloc(D3) or ivec_alloc_group(D3) to perform
this task.
3. Register the interrupt handler for the device in either the start() or
init() entry point. Use the ivec_init(D3) kernel routine to perform
this task.