Specifications
Sample Driver Written in C
B.1 LRDRIVER Example
/* Finish initialization of the Driver Dispatch Table (DDT) */
ini_ddt_unitinit (&driver$ddt, lr$unit_init);
ini_ddt_start (&driver$ddt, lr$startio);
ini_ddt_cancel (&driver$ddt, ioc_std$cancelio);
ini_ddt_end (&driver$ddt);
/* Finish initialization of the Function Decision Table (FDT) */
ini_fdt_act (&driver$fdt, IO$_WRITELBLK, lr$write, BUFFERED);
ini_fdt_act (&driver$fdt, IO$_WRITEPBLK, lr$write, BUFFERED);
ini_fdt_act (&driver$fdt, IO$_WRITEVBLK, lr$write, BUFFERED);
ini_fdt_act (&driver$fdt, IO$_SETMODE, lr$setmode, BUFFERED);
ini_fdt_act (&driver$fdt, IO$_SETCHAR, lr$setmode, BUFFERED);
ini_fdt_act (&driver$fdt, IO$_SENSEMODE, exe_std$sensemode, BUFFERED);
ini_fdt_act (&driver$fdt, IO$_SENSECHAR, exe_std$sensemode, BUFFERED);
ini_fdt_end (&driver$fdt);
/* If we got this far then everything worked, so return success. */
return SS$_NORMAL;
}
/*
* LR$STRUC_INIT - Device Data Structure Initialization Routine
*
* Functional description:
*
* This routine is called once for each unit by the $LOAD_DRIVER service
* after that UCB is created. At the point of this call the UCB has not
* yet been fully linked into the I/O database. This routine is responsible
* for filling in driver specific fields that in the I/O database structures
* that are passed as parameters to this routine.
*
* This routine is responsible for filling in the fields that are not
* affected by a RELOAD of the driver image. In contrast, the structure
* reinitialization routine is responsible for filling in the fields that
* need to be corrected when (and if) this driver image is reloaded.
*
* After this routine is called for a new unit, then the reinitialization
* routine is called as well. Then the $LOAD_DRIVER service completes the
* integration of these device specific structures into the I/O database.
*
* Note that this routine must confine its actions to filling in these I/O
* database structures and may not attempt to initialize the hardware device.
* Initialization of the hardware device is the responsibility of the
* controller and unit initialization routines which are called some time
* later.
*
* Calling convention:
*
* lr$struc_init (crb, ddb, idb, orb, ucb)
*
* Input parameters:
*
* crb Pointer to associated controller request block.
* ddb Pointer to associated device data block.
* idb Pointer to associated interrupt dispatch block.
* orb Pointer to associated object rights block.
* ucb Pointer to the unit control block that is to be initialized.
*
* Output parameters:
*
* None.
*
* Return value:
*
B–6