home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v1.zip / DDKX86 / H / DEVHDR.H < prev    next >
C/C++ Source or Header  |  1995-04-14  |  5KB  |  120 lines

  1. /*DDK*************************************************************************/
  2. /*                                                                           */
  3. /* COPYRIGHT    Copyright (C) 1995 IBM Corporation                           */
  4. /*                                                                           */
  5. /*    The following IBM OS/2 WARP source code is provided to you solely for  */
  6. /*    the purpose of assisting you in your development of OS/2 WARP device   */
  7. /*    drivers. You may use this code in accordance with the IBM License      */
  8. /*    Agreement provided in the IBM Device Driver Source Kit for OS/2. This  */
  9. /*    Copyright statement may not be removed.                                */
  10. /*                                                                           */
  11. /*****************************************************************************/
  12. /*static char *SCCSID = "@(#)devhdr.h   6.5 91/11/09";*/
  13.  
  14. /*
  15.  * Device Table Record
  16.  *
  17.  * Devices are described by a chain of these records
  18.  */
  19.  
  20.  /* If someone ever changes the following define of DEV_CBNAME, the
  21.   * length of the string in the ASM block within the SysDev struct
  22.   * should be changed to the same length.
  23.   */
  24. #define DEV_CBNAME      8
  25.  
  26. struct SysDev {
  27.     unsigned long SDevNext;     /* Pointer to next device header */
  28.     unsigned short SDevAtt;     /* Attributes of the device */
  29.     unsigned short SDevStrat;   /* Strategy entry point */
  30.     unsigned short SDevInt;     /* Interrupt entry point */
  31. /* XLATOFF */
  32.     unsigned char  SDevName[DEV_CBNAME]; /* name (block uses only 1st byte) */
  33. /* XLATON */
  34. /* ASM
  35. SDevName        DB      "        "
  36. */
  37.     unsigned short SDevProtCS;  /* Protect-mode CS of strategy entry pt */
  38.     unsigned short SDevProtDS;  /* Protect-mode DS */
  39.     unsigned short SDevRealCS;  /* Real-mode CS of strategy entry pt */
  40.     unsigned short SDevRealDS;  /* Real-mode DS */
  41. };
  42.  
  43. /*
  44.  * Device driver header for OS/2 2.0 drivers ; these are at level 3 or above
  45.  * These drivers have an extra DWORD (bitmap) of capabilities
  46.  * Pre-OS/2 2.0 drivers are assumed to have a bitmap of value 0
  47.  */
  48. struct  SysDev3 {
  49.     struct SysDev SysDevBef3;
  50.     unsigned long  SDevCaps;    /* bit map of DD /MM restrictions */
  51. };
  52.  
  53. /*
  54.  * SDevCaps bitmap definitions
  55.  */
  56. #define DEV_IOCTL2       0x0001 /* DD can handle dev ioctl2           */
  57. #define DEV_16MB         0x0002 /* DD can handle phys.addresses >16MB */
  58. #define DEV_PARALLEL     0x0004 /* DD handles parallel port           */
  59. #define DEV_ADAPTER_DD   0x0008 /* DD supports Adapter Dev Driver Intf*/
  60. #define DEV_INITCOMPLETE 0x0010 /* DD can handle CMDInitComplete      */
  61. /*
  62.  * Device Driver Type defininitions
  63.  */
  64.  
  65. #define DEV_CIN         0x0001  /*  0  2 5 Device is console in */
  66. #define DEV_COUT        0x0002  /*  1  2 5 Device is console out */
  67. #define DEV_NULL        0x0004  /*  2  2 5 Device is the Null device */
  68. #define DEV_CLOCK       0x0008  /*  3  2 5 Device is the clock device */
  69. #define DEV_SPEC        0x0010  /*  4  2   Devices can support INT 29h */
  70. #define DEV_ADD_ON      0x0020  /*  5      Device is add-on driver (BWS) */
  71. #define DEV_GIOCTL      0x0040  /*  6  3   Device supports generic ioctl */
  72. #define DEV_FCNLEV      0x0380  /*  9-7  5 Device function level */
  73. /*                      0x0400  /* 10 */
  74. #define DEV_30          0x0800  /* 11  2 5 Accepts Open/Close/Removable Media */
  75. #define DEV_SHARE       0x1000  /* 12      Device wants FS sharing checking */
  76. #define DEV_NON_IBM     0x2000  /* 13  2 5 Device is a non IBM device. */
  77. #define DEV_IOCTL       0x4000  /* 14  2   Device accepts IOCTL request */
  78. #define DEV_CHAR_DEV    0x8000  /* 15  2 5 Device is a character device */
  79.  
  80.  
  81. /*
  82.  * ***** BUGBUG *****
  83.  *
  84.  * DOS 3.2 Screws us as it uses bit 6 to indicate generic ioctl support
  85.  * for the time being those device drivers are SOL.
  86.  */
  87.  
  88. /* Level definitions for devices */
  89.  
  90. #define DEVLEV_0    0x0000      /* DOS 3.0 and before (NEEDS TO BE FIXED) */
  91. #define DEVLEV_1    0x0080      /* DOS 5.0 */
  92. #define DEVLEV_2    0x0100      /* OS/2 v1.2 (new gen ioctl iface) */
  93. #define DEVLEV_3    0x0180      /* OS/2 v2.0 (support of memory above 16MB) */
  94.  
  95. /***    Dev_FuncLev - Compare device driver level to specified level
  96.  *
  97.  *      Dev_FuncLev masks off extra bits of the device driver attribute word
  98.  *      and compares the driver level to the specified level
  99.  *
  100.  *      ENTRY   ReqLev  = Requested Level (register or value)
  101.  *              DevAttr = Register with Device Driver Attribute word
  102.  *
  103.  *      EXIT    'C' if level is less than the specified level
  104.  *                  (DevAttr < ReqLev)
  105.  *
  106.  *              'NC'if driver level is equal or greater to specified level
  107.  *                  (DevAttr >= ReqLev)
  108.  *
  109.  *              (Use JC  or JB  to jump if DevAttr <  ReqLev)
  110.  *              (Use JNC or JAE to jump if DevAttr >= ReqLev)
  111.  */
  112.  
  113. /* ASM
  114. Dev_FuncLev     macro   ReqLev, DevAttr
  115.         and     DevAttr,DEV_FCNLEV          ; mask off extra bits of dev attributes
  116.         cmp     DevAttr,ReqLev              ; compare with specified level
  117.                                             ; carry -> level < specified
  118. endm
  119. */
  120.