Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Devices /
Chapter 1 - Device Manager / Device Manager Reference
Device Manager Functions


Writing and Installing Device Drivers

The Device Manager includes a number of functions that provide low-level support for device drivers.

The DriverInstall and DriverInstallReserveMem functions create a device control entry and install it in the unit table. The DriverInstallReserveMem function is preferred because it allocates the device control entry as low as possible in the system heap. The DriverRemove 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 call IODone when the current request is completed and ready to be removed from the I/O queue.

The Fetch and Stash 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 error dsIOCoreErr.

In the interest of speed, you invoke the Fetch, Stash, and IODone routines with jump vectors, stored in the global variables JFetch, JStash, and JIODone, rather than macros. You can use a jump vector by moving its address onto the stack and executing an RTS instruction. An example is:

MOVE.L   JIODone,-(SP)
RTS
The Fetch and Stash 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

Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996