These hardware device drivers are done:
There are also these 'software' drivers:
There are two methods I have for borrowing drivers from other OS's.
Initialization Drivers can be initialized in any way suited to the task. These ways are currently implemented in one or more drivers:
Shutdown This routine is called when the system is being shut down. It can flush caches out and hardware reset controllers.
Create clone device This routine is called when a clone device is about to be created. Clone devices are used for such things as pseudo-terminals, ie, where the device exists only when it is being used.
Delete clone device This routine is called when the clone device is no longer being used. The driver aborts and closes all processing being performed on the device.
New I/O channel being assigned This routine is called when a new channel has been assigned to the device. The driver initializes the per-channel device struct.
I/O channel being deassigned The driver closes anything opened on the channel.
Abort I/O request The driver makes an attempt to abort the indicated I/O operations as soon as it can. Usually, it marks them for abort then tells the controller to stop processing them.
Start I/O request This is used to initiate an I/O request. It returns as soon as it can. The I/O is performed either as a series of interrupt routines or as a kernel thread. When the requested operation has completed, a callback is made to the os to inform it of such and of the completion status.
The entrypoints (all except the initialization routine) are located in the driver's function table. The elements of the function table are:
size of Devex
size of Chnex
size of Iopex
int (*shutdown) (OZ_Devunit *devunit,
void *devex)
uLong (*clonecre) (OZ_Devunit *template_devunit,
void *template_devex,
int template_cloned,
OZ_Procmode procmode,
OZ_Devunit **cloned_devunit)
int (*clonedel) (OZ_Devunit *cloned_devunit,
void *devexv,
int cloned)
uLong (*assign) (OZ_Devunit *devunit,
void *devexv,
OZ_Iochan *iochan,
void *chnexv,
OZ_Procmode procmode)
int (*deassign) (OZ_Devunit *devunit,
void *devexv,
OZ_Iochan *iochan,
void *chnexv)
void (*abort) (OZ_Devunit *devunit,
void *devexv,
OZ_Iochan *iochan,
void *chnexv,
OZ_Ioop *ioop,
void *iopexv,
OZ_Procmode procmode)
uLong (*start) (OZ_Devunit *devunit,
void *devexv,
OZ_Iochan *iochan,
void *chnexv,
OZ_Procmode procmode,
OZ_Ioop *ioop,
void *iopexv,
uLong funcode,
uLong as,
void *ap)
The drivers are interfaced to by module oz_knl_devio.c.