home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v5.zip / DDKX86 / SRC / DEV / PCMCIA / CLSAMPLE / CLSAMPLE.H < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-14  |  7.7 KB  |  196 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. /*****************************************************************************/
  13. /*                                                                           */
  14. /*                                                                           */
  15. /*    The following IBM OS/2 2.1 source code is provided to you solely for   */
  16. /*    the purpose of assisting you in your development of OS/2 2.x device    */
  17. /*    drivers. You may use this code in accordance with the IBM License      */
  18. /*    Agreement provided in the IBM Device Driver Source Kit for OS/2. This  */
  19. /*    Copyright statement may not be removed.                                */
  20. /*                                                                           */
  21. /*****************************************************************************/
  22. /**************************************************************************
  23.  *
  24.  * SOURCE FILE NAME = CLSAMPLE.H
  25.  *
  26.  * DESCRIPTIVE NAME = PCMCIA Client Services sample code header file
  27.  *
  28.  *
  29.  *
  30.  *
  31.  * The following IBM OS/2 2.1 source code is provided to you solely for
  32.  * the purpose of assisting you in your development of OS/2 2.x device
  33.  * drivers. You may use this code in accordance with the IBM License
  34.  * Agreement provided in the IBM Device Driver Source Kit for OS/2. This
  35.  * Copyright statement may not be removed.
  36.  *
  37.  *
  38.  *
  39.  * VERSION =
  40.  *
  41.  * DATE        06/22/93
  42.  *
  43.  * DESCRIPTION
  44.  *
  45.  *
  46.  * FUNCTIONS
  47.  *
  48.  * ENTRY POINTS:
  49.  *
  50.  * DEPENDENCIES:
  51.  *
  52.  * NOTES
  53.  *
  54.  *
  55.  * STRUCTURES
  56.  *
  57.  * EXTERNAL REFERENCES
  58.  *
  59.  * EXTERNAL FUNCTIONS
  60.  *
  61.  ***************************************************************************/
  62.  
  63.  
  64.  
  65. /*
  66. ** strategy commands definition  B=block, C=character
  67. */
  68. #define RPINIT            0x00      /*  BC                                  */
  69. #define RPOPEN            0x0d      /*  BC                                  */
  70. #define RPCLOSE           0x0e      /*  BC                                  */
  71. #define RPIOCTL           0x10      /*  BC                                  */
  72. #define RPDEINSTALL       0x14      /*   C                                  */
  73. #define RPINITCOMP        0x1F      /*                                      */
  74.  
  75.  
  76. /*
  77. ** RPstatus bit values
  78. */
  79. #define RPERR             0x8000    /*  error occurred, err in RPstatus     */
  80. #define RPDEV             0x4000    /*  error code defined by driver        */
  81. #define RPBUSY            0x0200    /*  device is busy                      */
  82. #define RPDONE            0x0100    /*  driver done with request packet     */
  83.  
  84. /*
  85. ** client code status
  86. */
  87. #define CODE_LOCKED       0x0001    /*  code is locked                      */
  88. #define TIMER_START       0x0002    /*  timer is started                    */
  89. #define ARGPKT_BUSY       0x0004    /*  ArgPacket buffer is not available    */
  90. #define INIT_FAILURE      0x0008    /*  this driver's initialization fails  */
  91.  
  92. /*
  93. ** timer default tick count
  94. */
  95. #define TIMERCOUNT        0x0002
  96.  
  97. /*
  98. ** Card Service level
  99. */
  100. #define CS_LEVEL          0x0200
  101. /*define CS_REVISION       0x0200 */
  102. #define CS_REVISION       0x0100   /* modified for MR1,0x105 for WARP */
  103.  
  104. /*
  105. ** Clear ArgPacket buffer
  106. */
  107. #define CLEAR_ARGPACKET   for(i=0; i<100; i++) ArgPacket[i]=0
  108.  
  109. #ifdef WAT
  110.  
  111.     void cliasm();                  /* Watcom does not support In Line Assembly */
  112.     #pragma aux cliasm = "cli"    ;
  113.     #define DISABLE cliasm()
  114.  
  115.     void stiasm();
  116.     #pragma aux stiasm = "sti"    ;
  117.     #define ENABLE  stiasm()
  118.  
  119. #else
  120.  
  121.     #define DISABLE _asm {cli}
  122.     #define ENABLE  _asm {sti}
  123.  
  124. #endif
  125.  
  126. /*
  127. **  the driver device header
  128. */
  129. typedef struct DeviceHdr {
  130.    struct  DeviceHdr far *DHnext;   /* pointer to next header, or FFFF      */
  131.    USHORT  DHattribute;             /* device attribute word                */
  132.    USHORT *DHstrategy;              /* offset of strategy routine           */
  133.    USHORT  DHidc;                   /* offset of IDC routine                */
  134.    UCHAR   DHname[8];               /* dev name (char) or #units (blk)      */
  135.    UCHAR   reserved[8];
  136.    ULONG   bit_strip;               /* bit 0 DevIOCtl2, bit 1 32 bit addr   */
  137. } DEVICEHDR;
  138.  
  139.  
  140. /*
  141. ** request packet definition
  142. */
  143. typedef struct ReqPacket {
  144.    UCHAR   RPlength;                /* request packet length                */
  145.    UCHAR   RPunit;                  /* unit code for block DD only          */
  146.    UCHAR   RPcommand;               /* command code                         */
  147.    USHORT  RPstatus;                /* status word                          */
  148.    UCHAR   RPreserved[4];           /* reserved bytes                       */
  149.    ULONG   RPqlink;                 /* queue linkage                        */
  150.    union {                          /* command-specific data                */
  151.    UCHAR   avail[19];
  152.     struct {                        /* init                                 */
  153.       UCHAR      units;             /* number of units                      */
  154.       PFN        DevHlp;            /* &DevHlp                              */
  155.       PBYTE      pArgs;             /* &args                                */
  156.       UCHAR      drive;             /* drive #                              */
  157.       }Init;
  158.  
  159.     struct {
  160.       UCHAR      units;             /* same as input                        */
  161.       USHORT     finalCS;           /* final offset, 1st code segment       */
  162.       USHORT     finalDS;           /* final offset, 1st data segment       */
  163.       PBYTE      BPBarray;          /* &BPB                                 */
  164.       } InitExit;
  165.  
  166.     struct {                        /* open/close                           */
  167.       USHORT     sysfilenum;        /* system file number                   */
  168.       } OpenClose;
  169.  
  170.     struct {                        /* IOCtl                                */
  171.       UCHAR      category;          /* category code                        */
  172.       UCHAR      function;          /* function code                        */
  173.       PBYTE      parameters;        /* ¶meters                          */
  174.       PBYTE      buffer;            /* &buffer                              */
  175.       } IOCtl;
  176.  
  177.    } s;                             /* command info                         */
  178. } REQPACKET;
  179. typedef REQPACKET far *PREQPACKET;                                  /* PKS */
  180.  
  181.  
  182.  
  183. /*
  184. ** AttachDD inter device driver communication data area
  185. */
  186. typedef struct AttachArea {
  187.    USHORT  offEPReal;               /* real-mode offset of idc entry point  */
  188.    USHORT  segEPReal;               /* real-mode CS of IDC entry point      */
  189.    USHORT  segDSRead;               /* real-mode DS of IDC DD               */
  190.    USHORT  offEPProt;               /* protect-mode offset of entry point   */
  191.    USHORT  selEPProt;               /* protect-mode CS of entry point       */
  192.    USHORT  selDSProt;               /* protect-mode DS of other DD          */
  193. } ATTACHAREA;
  194. typedef ATTACHAREA near *NPATTACHAREA;
  195.  
  196.