home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / os2 / gtak212b.zip / SOURCE.ZIP / OS2-ST01 / devsym.inc < prev    next >
Text File  |  1991-06-01  |  8KB  |  249 lines

  1. ;
  2. ; copyright (C) Microsoft, 1988
  3. ;
  4. BREAK <Device table and Standard Request Header definition>
  5. page ,132
  6.  
  7. include devhdr.inc
  8.  
  9. ;**    Static Request Header
  10. ;
  11. ;    This structure defines the fixed first part of a device request
  12. ;    record.  Depending upon the request there may be other fields
  13. ;    which follow this header.
  14. ;
  15.  
  16. SrHead    STRUC
  17. ReqLen    DB    ?        ; Length in bytes of request block
  18. ReqUnit DB    ?        ; Device unit number
  19. ReqFunc DB    ?        ; Type of request
  20. ReqStat DW    ?        ; Status Word
  21.     DD    ?        ; RESERVED
  22. DevLink DD    ?        ; link field for use by driver to chain
  23.                 ;   requests.  (A service in DevHelp)
  24. SrHead    ENDS
  25.  
  26.  
  27. ;*    Other fields beyond the standard 13 byte header
  28.  
  29.  
  30. ; Status word masks
  31. STERR    EQU    08000H        ; Bit 15 - Error
  32. STDVERR EQU    0C000H        ; Bit 14 - Device error
  33. STINTER EQU    00400H        ; Bit 10 - Interim character
  34. STBUSY    EQU    00200H        ; Bit  9 - Busy
  35. STDONE    EQU    00100H        ; Bit  8 - Done
  36. STECODE EQU    000FFH        ; Error code
  37. WRECODE EQU    0
  38.  
  39. ;
  40. ;    Replacement definitions for existing device driver definitions.
  41. ;    NOTE:    These are provided for completeness - In order to
  42. ;        keep modular integrity, we define these here (the
  43. ;        volume ID code wants to know if a driver supports
  44. ;        volume ID stuff, not that it is DEVLEV_3.
  45. ;
  46.  
  47. DEV_40        EQU    DEVLEV_3
  48. DEV_HASVID    EQU    DEVLEV_3
  49. DEV_320     EQU    DEVLEV_2      ; For block devices, this
  50.                       ; device supports Set/Get Map of
  51.                       ; logical drives, and supports
  52.                       ; Generic IOCTL calls.
  53.                       ; For character devices, this
  54.                       ; device supports Generic IOCTL.
  55.                       ; This is a DOS 3.2 device driver.
  56.  
  57. ;**    Device Driver Request Packet Defintions
  58. ;
  59.  
  60.  
  61. PktMax        equ    18
  62. PktHead     equ    13
  63.  
  64. Packet        struc
  65. PktLen        db    ?        ; length in bytes of packet
  66. PktUnit     db    ?        ; subunit number of block device
  67. PktCmd        db    ?        ; command code
  68. PktStatus    dw    ?        ; status word
  69. PktDOSLink    dd    ?        ; reserved
  70. PktDevLink    dd    ?        ; device multiple-request link
  71. PktData     db    PktMax dup (?)    ; data pertaing to specific packet
  72. Packet        ends
  73.  
  74. CMDInit     equ    0            ; INIT command
  75. InitcUnit    equ    byte ptr PktData    ; number of units returned
  76. InitpEnd    equ    dword ptr PktData+1    ; pointer to free mem after dev
  77. InitDevHlp    equ    dword ptr PktData+1    ; address of Device Helper router
  78. InitEcode    equ    word ptr PktData+1    ; size of code segment
  79. InitEdata    equ    word ptr PktData+3    ; size of data segment
  80. InitParms    equ    dword ptr PktData+5    ; pointer parameters
  81. InitpBPB    equ    dword ptr PktData+5    ; pointer to BPBs
  82. Initdrv     equ    byte ptr PktData+9    ; drive no. assigned to unit 0
  83.                         ; for resident drivers only:
  84. InitSysiData    equ    byte ptr PktData+11    ; SysInit's DGROUP selector
  85.  
  86. LENInit     equ    10            ; non-resident drivers
  87. LENInitRes    equ    (LENInit + 2)        ; resident drivers
  88. ERRNZ        <PktMax LT LENInit>
  89. ERRNZ        <PktMax LT LENInitRes>
  90.  
  91. CMDMedChk    equ    1            ; Media Check
  92. MedChkmedia    equ    byte ptr PktData    ; last media byte seen
  93. MedChkflag    equ    byte ptr PktData+1    ; -1=change 0=dont know 1=no change
  94. MedChkpVID    equ    dword ptr PktData+2    ; pointer to VID
  95. LENMedChk    equ    6
  96. ERRNZ        <PktMax LT LENMedChk>
  97.  
  98. CMDBldBPB    equ    2            ; build BPB
  99. BldBPBmedia    equ    byte ptr PktData    ; media byte
  100. BldBPBbuffer    equ    dword ptr PktData+1    ; scratch buffer
  101. BldBPBpBPB    equ    dword ptr PktData+5    ; returned pointer to BPB
  102. LENBldBPB    equ    9
  103. ERRNZ        <PktMax LT LENBldBPB>
  104.  
  105. CMDIOCTLR    equ    3            ; reserved for 3.x compatability
  106. CMDINPUT    equ    4            ; read data from device
  107. CMDOUTPUT    equ    8            ; write data to device
  108. CMDOUTPUTV    equ    9            ; write data and verify
  109. CMDInputBypass         EQU    24            ; cache bypass read data    ?? Needed any more ??
  110. CMDOutputBypass      EQU    25            ; cache bypass write data    ?? Needed any more ??
  111. CMDOutputBypassV     EQU    26            ; cache bypass write data and verify  ?? Needed any more ??
  112. CMDIOCTLW    equ    12            ; reserved for 3.x compatability
  113. IOmedia     equ    byte ptr PktData    ; media byte
  114. IOpData     equ    dword ptr PktData+1    ; transfer address
  115. IOcount     equ    word ptr PktData+5    ; count of bytes/sectors
  116. IOstart     equ    word ptr PktData+7    ; starting sector (block)
  117.                         ; starting sector is a DD
  118. IOSFN        equ    word ptr PktData+11
  119. IOPhysRBA    equ    dword ptr PktData+13    ; physical starting sector -
  120.                         ; Used by disk device driver
  121. LENIO        equ    13
  122. ERRNZ        <PktMax LT LENIO>
  123.  
  124. ReadBypassAdj    equ    CMDInputBypass-CMDInput ; used internally by kernel
  125. WriteBypassAdj    equ    CMDOutputBypass-CMDOutput ; used internally by kernel
  126.  
  127. CMDNDR        equ    5            ; non-destructive read
  128. NDRbyte     equ    byte ptr PktData    ; byte read from device
  129. LENNDR        equ    1
  130. ERRNZ        <PktMax LT LENNDR>
  131.  
  132. CMDInputS    equ    6            ; input status
  133. CMDOutputS    equ    10            ; output status
  134. LENStatus    equ    0
  135. ERRNZ        <PktMax LT LENStatus>
  136.  
  137. CMDInputF    equ    7            ; input flush
  138. CMDOutputF    equ    11            ; output flush
  139. LENFlush    equ    0
  140. ERRNZ        <PktMax LT LENFlush>
  141.  
  142. CMDOpen     equ    13            ; device open
  143. CMDClose    equ    14            ; device close
  144. OCSFN        equ    word ptr PktData    ; sfn of open instance for virtualization
  145. OCLastRef    equ    word ptr PktData+2    ; flag indicating last close
  146. LENOpnCls    equ    4
  147. ERRNZ        <PktMax LT LENOpnCls>
  148.  
  149. CMDRemMed    equ    15            ; is media removable
  150. LENRemMed    equ    0
  151. ERRNZ        <PktMax LT LENRemMed>
  152.  
  153. CMDStart EQU    98                ; start console output
  154. CMDStop EQU    99                ; stop console output
  155. CStpSKG EQU    BYTE PTR PktData+0        ; Screen/Keyboard number
  156. LenStp    EQU    1                ; Size of request additions.
  157. ERRNZ        <PktMax LT LenStp>
  158.  
  159. CMDGenIOCTL    EQU    16            ; Generic IOCTL
  160. GIOCategory    EQU    BYTE PTR PktData    ; Category Code
  161. GIOFunction    EQU    BYTE PTR PktData+1    ; Function code
  162. GIOParaPack    EQU    DWORD PTR PktData+2    ; pointer to parameter packet
  163. GIODataPack    EQU    DWORD PTR PktData+6    ; pointer to data packet
  164. GIOSFN        EQU    WORD PTR PktData+10
  165. GIOParaLength    EQU    WORD PTR PktData+12    ; Ioctl2: ParmPack length (or 0)
  166. GIODataLength    EQU    WORD PTR PktData+14    ; Ioctl2: DataPack length (or 0)
  167. LENGenIOCTL    EQU    12
  168. LENGenIOCTL2    EQU    16
  169. ERRNZ        <PktMax LT LENGenIOCTL>
  170.  
  171.  
  172. CMDDeInstall    EQU    20            ; De-Install driver
  173. LENDeIn     EQU    0
  174. ERRNZ        <PktMax LT LENDeIn>
  175.  
  176. CMDResMed    EQU    17            ; reset media uncertain
  177. LENResMed    equ    0
  178. ERRNZ        <PktMax LT LENResMed>
  179.  
  180. CMDAddOnPrep    EQU    97            ; Prepare for add on
  181. Add_On_NewDD    EQU    DWORD PTR PktData
  182. Add_On_SrvRout    EQU    DWORD PTR PktData
  183. LenAddOn    EQU    4
  184.  
  185. CMDGetLogMap    EQU    18
  186. CMDSetLogMap    EQU    19
  187. Logical_Drive    EQU    BYTE PTR PktData; logical drive number
  188. LenGetSetLog    EQU    1
  189.  
  190. CMDPartfixeddisks    EQU  22        ; Partitionable Fixed Disks
  191. CMDGetfd_logunitsmap    EQU  23        ; Get Fixed Disk/Logical Unit Map
  192.  
  193. STDDERROR         EQU     4000H         ; Equate for Device Driver Defined Error
  194. ERROR_DEVICEDRIVER_DEFINED_BASE EQU 0FE00H     ; Equate for Device Driver Defined Error High Byte
  195.  
  196. ;
  197. ; The next three symbols are used in the files DEV.ASM and SPROC.ASM to
  198. ; set up and verify the set of request packets that the kernel keeps in
  199. ; a tiled segment, and to control req pkt allocation and initialization.
  200. ;
  201. ; SwapPackets sets the number of request packets reserved for the swapper
  202. ; pool.  Need one for the swapper operation, one for kernel use at volume
  203. ; switch time, one for DD use at volume switch time.
  204. ;
  205. ; StaticPackets sets the number of packets that we always allocate.  We
  206. ; currently allocate one pkt per thread + StaticPackets.  This is mostly
  207. ; to cover our butts, because maximum system pkt use is non-deterministic,
  208. ; and in the worst case unbounded.  We use 16 because it's a power-of-two
  209. ; and seems to be enough.  16 is arbitrary rather than magic.
  210. ;
  211. ; The one pkt per thread allocation is based on the fact that most threads
  212. ; will never use more than one packet.    (And we have StaticPackets extra
  213. ; for the ones that do.)
  214. ;
  215. ; See: dev.asm, sproc.asm
  216. ;
  217. StaticPackets     EQU    16
  218. SwapPackets     EQU    3
  219.  
  220. ReqPktSize    EQU    32        ; size for packet (power of 2)
  221. .ERRNZ    (SIZE Packet - 31)        ; Device Driver packet size has changed
  222. ;
  223.  
  224.  
  225. ;  *****************************************
  226. ;  Equates used with PhysDiskTbl structure *
  227. ;  *****************************************
  228.  
  229. physdisk_entry     EQU  0200h           ;@@ Equate for a Physical Disk Entry in
  230.                        ;@@  in the SFT
  231.  
  232. ;  ***********************************************
  233. ;   PhysDiskTbl - Physical Disk Entry Structure  *
  234. ;  ***********************************************
  235.  
  236.  diskentry  STRUC         ; 
  237.  
  238.  ddheader    DD  0         ; Pointer to Device Driver Header
  239.  ereserved    DB  0         ; Reserved
  240.  reldisknum    DB  0         ; Relative Physical Disk # for Device Driver
  241.  devpid     DW  0         ; PID
  242.  deveflags    DW  0         ; Flags for the physical disk
  243.  logunitbitmap    DD  0         ; Logical Unit Bit Map
  244.  
  245.  diskentry  ends         ; 
  246.  
  247. SUBTTL
  248.  
  249.