Important: The information in this document is obsolete and should not be used for new development.
Writing and Installing Device Drivers
The Device Manager includes a number of functions that provide low-level support for device drivers.The
DriverInstall
andDriverInstallReserveMem
functions create a device control entry and install it in the unit table. TheDriverInstallReserveMem
function is preferred because it allocates the device control entry as low as possible in the system heap. TheDriverRemove
function removes an existing device control entry.The
GetDCtlEntry
function returns a handle to a driver's device control entry.The
IODone
routine notifies the Device Manager that an I/O operation is done. Driver routines callIODone
when the current request is completed and ready to be removed from the I/O queue.The
Fetch
andStash
routines can be used to move characters into and out of data buffers. You pass a pointer to the device control entry in the A1 register to each of these three routines. The Device Manager uses the device control entry to locate the active request. If no such request exists, these routines generate system errordsIOCoreErr
.In the interest of speed, you invoke the
Fetch
,Stash
, andIODone
routines with jump vectors, stored in the global variablesJFetch
,JStash
, andJIODone
, rather than macros. You can use a jump vector by moving its address onto the stack and executing anRTS
instruction. An example is:
MOVE.L JIODone,-(SP) RTSTheFetch
andStash
routines do not return a result code; if an error occurs, the System Error Handler is invoked.
Subtopics
- DriverInstall
- DriverInstallReserveMem
- DriverRemove
- GetDCtlEntry
- IODone
- Fetch
- Stash