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
DriverInstallandDriverInstallReserveMemfunctions create a device control entry and install it in the unit table. TheDriverInstallReserveMemfunction is preferred because it allocates the device control entry as low as possible in the system heap. TheDriverRemovefunction removes an existing device control entry.The
GetDCtlEntryfunction returns a handle to a driver's device control entry.The
IODoneroutine notifies the Device Manager that an I/O operation is done. Driver routines callIODonewhen the current request is completed and ready to be removed from the I/O queue.The
FetchandStashroutines 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, andIODoneroutines 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 anRTSinstruction. An example is:
MOVE.L JIODone,-(SP) RTSTheFetchandStashroutines do not return a result code; if an error occurs, the System Error Handler is invoked.
Subtopics
- DriverInstall
- DriverInstallReserveMem
- DriverRemove
- GetDCtlEntry
- IODone
- Fetch
- Stash