Specifications
Sample Driver Written in C
B.1 LRDRIVER Example
/* If there are characters left and the I/O has not been cancelled
* then attempt to send the next character. There is no need to check
* the status since the interrupt timeout will expire if the device is
* not ready. Otherwise, queue the I/O done fork routine that was
* setup via wfikpch.
*/
if (ucb->ucb$r_ucb.ucb$l_bcnt > 0 && ! ucb->ucb$r_ucb.ucb$v_cancel) {
lr$send_char_dev (ucb);
} else {
ucb->ucb$r_ucb.ucb$v_int = 0;
ucb->ucb$r_ucb.ucb$v_tim = 0;
exe_std$queue_fork( (FKB *)ucb );
}
}
/* Restore the device lock, stay at device IPL */
device_unlock (ucb->ucb$r_ucb.ucb$l_dlck, NOLOWER_IPL, SMP_RESTORE);
/* return back to interrupt dispatcher */
return;
}
/*
* LR$IODONE_FORK - I/O Completion Fork Routine
*
* Functional description:
*
* This is the fork routine which passes the current I/O request on to
* I/O postprocessing. This routine is queued by the interrupt service
* routine when the I/O request has been completed. This routine can also
* be called directly from lr$check_ready_fork if the I/O request is
* cancelled while it is stalled due to an offline condition.
*
* Calling convention:
*
* lr$iodone_fork (irp, not_used, ucb)
*
* Input parameters:
*
* irp Pointer to I/O request packet
* not_used Unused fork routine parameter fr4
* ucb Pointer to unit control block
*
* Output parameters:
*
* None.
*
* Return value:
*
* None.
*
* Environment:
*
* Kernel mode, system context, fork IPL, fork lock held.
*/
void lr$iodone_fork (IRP *irp, void *not_used, LR_UCB *ucb) {
int status = SS$_NORMAL; /* Assume everything went ok */
B–19










