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
Data Structures


Device Control Entry

The device control entry structure, defined by the AuxDCE data type, stores information about each device driver in memory. The AuxDCE data type supersedes the original DCtlEntry data type, and provides additional fields for drivers that serve slot devices. See the chapter "Slot Manager" in this book for information about slot device drivers.

typedef struct AuxDCE {
   Ptr         dCtlDriver;    /* pointer or handle to driver */
   short       dCtlFlags;     /* flags */
   QHdr        dCtlQHdr;      /* I/O queue header */
   long        dCtlPosition;  /* current R/W byte position */
   Handle      dCtlStorage;   /* handle to private storage */
   short       dCtlRefNum;    /* driver reference number */
   long        dCtlCurTicks;  /* used internally */
   GrafPtr     dCtlWindow;    /* pointer to driver's window */
   short       dCtlDelay;     /* ticks between periodic actions */
   short       dCtlEMask;     /* desk accessory event mask */
   short       dCtlMenu;      /* desk accessory menu ID */
   char        dCtlSlot;      /* slot */
   char        dCtlSlotId;    /* sResource directory ID */
   long        dCtlDevBase;   /* slot device base address */
   Ptr         dCtlOwner;     /* reserved; must be 0 */
   char        dCtlExtDev;    /* external device ID */
   char        fillByte;      /* reserved */
} AuxDCE;
typedef AuxDCE *AuxDCEPtr, **AuxDCEHandle;
Field Description
dCtlDriver
A pointer or handle to the driver, as determined by the dRAMBased flag (bit 6) of the dCtlFlags field.
dCtlFlags
Flags describing the abilities and state of the driver. The high-order byte contains flags copied from the drvrFlags word of the driver resource. These flags are described in "Creating a Driver Resource," beginning on page 1-24.
The low-order byte of the dCtlFlags field contains the following run-time flags:
NameBitMeaning
 dOpenedXSet by the Device Manager when the driver is opened, and cleared when it is closed.
 dRAMBased6Set if the dCtlDriver field contains a handle.
 drvrActive7Set by the Device Manager when the driver is executing a request, and cleared when the driver is inactive.
You can use the following constants to test or set the value of these flags:
enum {
	/*run-time flags in the devicecontrolentry*/
	dOpenedMask    = 0x0020,
	dRAMBasedMask  = 0x0040,
	drvrActiveMask = 0x0080
};
dCtlQHdr
A pointer to the header of the driver I/O queue, which is a standard Operating System queue. See the chapter "Queue Utilities" in Inside Macintosh: Operating System Utilities for more information about the QHdr data type.
dCtlPosition
The current source or destination position for reading or writing. This field is used only by drivers of block devices. The value in this field is the number of bytes beyond the physical beginning of the medium used by the device, and must be a multiple of 512. For example, immediately after the Disk Driver reads the first block of data from a 3.5-inch disk, this field contains the value 512.
dCtlStorage
A handle to a driver's private storage. A driver may allocate a relocatable block of memory and keep a handle to it in this field.
dCtlRefNum
The driver reference number.
dCtlCurTicks
Used internally.
dCtlWindow
A pointer to the desk accessory window. See "Writing a Desk Accessory" on page 1-49 for more information.
dCtlDelay
The number of ticks to wait between periodic actions.
dCtlEMask
The desk accessory event mask. See "Writing a Desk Accessory" on page 1-49 for more information.
dCtlMenu
The menu ID of a desk accessory's menu, if any. See "Writing a Desk Accessory" on page 1-49 for more information.
dCtlSlot
The slot number of the slot device.
dCtlSlotId
The sResource directory ID of the slot device.
dCtlDevBase
The base address of the slot device. For a video card this field contains the address of the pixel map for the card's GDevice record.
dCtlOwner
Reserved. This field must be 0.
dCtlExtDev
The external device ID of the slot device.
fillByte
Reserved.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996