PATH 
ADC Home > Documentation > Hardware > Device Managers and Drivers > PCI Card Services > Designing PCI Cards and Drivers for Power Macintosh Computers


  

DoDriverIO Parameter Data Structures

The data types and structures that the DoDriverIO entry point uses have the following declarations:

typedef struct OpaqueRef *KernelID;
enum{
    kInvalidID = 0
    };
    typedef KernelID IOCommandID;

Type KernelID is a 32-bit opaque identifier used to identify various operating system resources. Mac OS I/O services that create or allocate a resource return an ID. The ID is later used to specify the resource to perform operations on it or delete it. With type OpaqueRef, the value of the ID tells you nothing--you can't tell which resource it identifies without calling Mac OS. You also can't tell what ID you'll get back the next time you create a resource, and you can't tell the relationship between any two resources by the relationship between their IDs. When a resource is deleted, its ID becomes invalid for a long time. If you accidentally use an ID for a resource that has been deleted, chances are you'll get an error instead of accessing a different resource.

union IOCommandContents { /* contents are command specific*/
    ParmBlkPtr                  pb;
    DriverInitInfoPtr           initialInfo;
    DriverFinalInfoPtr          finalInfo;
    DriverReplaceInfoPtr        replaceInfo;
    DriverSupersededInfoPtr     supersededInfo;
};

typedef union IOCommandContents IOCommandContents;

typedef UInt32 IOCommandCode;

enum{ /*'ndrv' driver services*/
    kOpenCommand,           /* open command */
    kCloseCommand,          /* close command */
    kReadCommand,           /* read command */
    kWriteCommand,          /* write command */
    kControlCommand,        /* control command */
    kStatusCommand,         /* status command */
    kKillIOCommand,         /* kill I/O command */
    kInitializeCommand,     /* initialize command */
    kFinalizeCommand,       /* finalize command */
    kReplaceCommand,        /* replace driver command */
    kSupersededCommand      /* driver superseded command */
};

typedef UInt32 IOCommandKind;

enum{
    kSynchronousIOCommandKind   = 1,
    kAsynchronousIOCommandKind  = 2,
    kImmediateIOCommandKind     = 4
};

struct DriverInitInfo {
    DriverRefNum    refNum;
    RegEntryID      deviceEntry;
};

struct DriverFinalInfo {
    DriverRefNum    refNum;
    RegEntryID      deviceEntry;
};

typedef struct DriverInitInfo DriverInitInfo, *DriverInitInfoPtr;

typedef struct DriverInitInfo DriverReplaceInfo,
*DriverReplaceInfoPtr;

typedef struct DriverFinalInfo DriverFinalInfo,
*DriverFinalInfoPtr;

typedef struct DriverFinalInfo DriverSupersededInfo,
*DriverSupersededInfoPtr;

struct InitializationInfo {
    refNum      refNum;
    RegEntryID  deviceEntry;
};

struct FinalizationInfo {
    refNum      refNum;
    RegEntryID  deviceEntry;
};

typedef struct InitializationInfo InitializationInfo;

typedef struct InitializationInfo *InitializationInfoPtr;

typedef struct FinalizationInfo FinalizationInfo;

typedef struct FinalizationInfo *FinalizationInfoPtr;

© 1999 Apple Computer, Inc. – (Last Updated 26 March 99)