Specifications
Sample Driver Written in C
B.1 LRDRIVER Example
/*
* LR$INTERRUPT - Interrupt Service Routine
*
* Functional description:
*
* This is the interrupt service routine for the parallel line printer
* port. This routine is called by the system interrupt dispatcher.
*
* This routine will attempt to send the next character to the device
* until either there are no more characters left or the I/O is canceled.
* At which point, this routine will queue the lr$iodone_fork routine
* which was set up either in lr$startio or lr$check_ready_fork.
*
* If the interrupt is not expected by an active I/O on this device then
* it is simply dismissed.
*
*
* Calling convention:
*
* lr$interrupt (idb)
*
* Input parameters:
*
* idb Pointer to interrupt dispatch block
*
* Output parameters:
*
* None.
*
* Return value:
*
* None.
*
* Environment:
*
* Kernel mode, system context, device IPL.
*
*/
void lr$interrupt (IDB *idb) {
LR_UCB *ucb;
int device_data; /* Data from or for CRAM */
int status;
/* Get the UCB from the IDB owner field which was set up by the lr$unit_init
* routine.
*/
ucb = (LR_UCB *) idb->idb$ps_owner;
/* Acquire the device lock. We are already at device IPL */
device_lock (ucb->ucb$r_ucb.ucb$l_dlck, NORAISE_IPL, NOSAVE_IPL);
/* If interrupt is expected, then process it, otherwise ignore it */
if (ucb->ucb$r_ucb.ucb$v_int) {
B–18










