Specifications

Sample Driver Written in C
B.1 LRDRIVER Example
* ucb Pointer to the unit control block that is to be initialized.
*
* Output parameters:
*
* None.
*
* Return value:
*
* None.
*
* Environment:
*
* Kernel mode, system context, IPL may be as high as 31 and may not be
* altered.
*
*/
void lr$struc_reinit (CRB *crb, DDB *ddb, IDB *idb, ORB *orb, LR_UCB *ucb) {
extern DDT driver$ddt;
/* Setup the pointer from our DDB in the I/O database to the driver
* dispatch table that’s within this driver image.
*/
ddb->ddb$ps_ddt = &driver$ddt;
/* Setup the procedure descriptor and code entry addresses in the VEC
* portion of the CRB in the I/O database to point to the interrupt
* service routine that’s within this driver image.
*/
dpt_store_isr (crb, lr$interrupt);
return;
}
/*
* LR$UNIT_INIT - Unit Initialization Routine
*
* Functional description:
*
* This routine is called once for each unit by the $LOAD_DRIVER service
* after a new unit control block has been created, initialized, and
* fully integrated into the I/O database.
*
* This routine is also called for each unit during power fail recovery.
*
* It is the responsibility of this routine to bring unit "on line" and
* to make it ready to accept I/O requests.
*
* Calling convention:
*
* status = lr$unit_init (idb, ucb)
*
* Input parameters:
*
* idb Pointer to associated interrupt dispatch block.
* ucb Pointer to the unit control block that is to be initialized.
*
* Output parameters:
*
* None.
*
* Return value:
*
* status SS$_NORMAL indicates that the unit was initialized successfully.
* SS$_IVADDR indicates that an unexpected ISA I/O address or IRQ
* level was detected.
B–8