home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / odtlktv4.zip / ODTLKT / TOOLKIT / INC / DEVSYM.INC < prev    next >
Text File  |  1995-11-22  |  11KB  |  320 lines

  1. ;       SCCSID = @(#)devsym.inc    6.1 90/11/16
  2. ;      SCCSID = @(#)devsym.inc    13.12 90/06/14
  3.  
  4. page ,132
  5.  
  6. include devhdr.inc
  7. include devcmd.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. ; Zibo notes that we should STOP using this weird stuff and use one set of
  16. ; structures and equates rather than lots of casting.  After this section is
  17. ; the new stuff we should use.
  18. ;
  19.  
  20. SrHead    STRUC
  21. ReqLen    DB    ?        ; Length in bytes of request block
  22. ReqUnit DB    ?        ; Device unit number
  23. ReqFunc DB    ?        ; Type of request
  24. ReqStat DW    ?        ; Status Word
  25.     DD    ?        ; RESERVED
  26. DevLink DD    ?        ; link field for use by driver to chain
  27.                 ;   requests.  (A service in DevHelp)
  28. SrHead    ENDS
  29.  
  30.  
  31. ;*    Other fields beyond the standard 13 byte header
  32.  
  33.  
  34. ; Status word masks
  35. STERR    EQU    8000H        ; Bit 15 - Error
  36. STINTER EQU    0400H        ; Bit 10 - Interim character
  37. STBUI    EQU    0200H        ; Bit  9 - Busy
  38. STDON    EQU    0100H        ; Bit  8 - Done
  39. STECODE EQU    00FFH        ; Error code
  40. WRECODE EQU    0
  41.  
  42. ;**    Device Driver Request Packet Defintions
  43. ;
  44.  
  45.  
  46. PktMax        equ    18
  47. PktHeadSize    equ    13
  48.  
  49. Packet        struc
  50. PktLen        db    ?        ; length in bytes of packet
  51. PktUnit        db    ?        ; subunit number of block device
  52. PktCmd        db    ?        ; command code
  53. PktStatus    dw    ?        ; status word
  54. PktFlag         db      ?        ; disk driver internal flags
  55.         db    3 dup(?)        ; reserved
  56. PktDevLink    dd    ?        ; device multiple-request link
  57. PktData        db    PktMax dup (?)    ; data pertaining to specific packet
  58. Packet        ends
  59.  
  60. PktDOSLink    equ    (dword ptr PktFlag)
  61.  
  62. ;**    Device Driver Request Packet Equates
  63. ;
  64.  
  65.  
  66. fPktInt13RP    equ    01H        ; Int 13 Request Packet 
  67. fPktCallOutDone equ    02H        ; Int 13 Callout completed
  68. fPktDiskIOTchd  equ    04H        ; Disk_IO has touched this packet
  69.  
  70.  
  71. ;CMDInit        equ    0            ; INIT command
  72. ;CMDInitBase    equ    27            ; INIT command for base DDs
  73. InitcUnit    equ    byte ptr PktData    ; number of units returned
  74. InitpEnd    equ    dword ptr PktData+1    ; pointer to free mem after dev
  75. InitDevHlp    equ    dword ptr PktData+1    ; address of Device Helper router
  76. InitEcode    equ    word ptr PktData+1    ; size of code segment
  77. InitEdata    equ    word ptr PktData+3    ; size of data segment
  78. InitParms    equ    dword ptr PktData+5    ; pointer parameters
  79. InitpBPB    equ    dword ptr PktData+5    ; pointer to BPBs
  80. Initdrv        equ    byte ptr PktData+9    ; drive no. assigned to unit 0
  81.                         ; for resident drivers only:
  82. InitSysiData    equ    byte ptr PktData+11    ; SysInit's DOSALIAS selector
  83.  
  84. LENInit        equ    10            ; non-resident drivers
  85. LENInitRes    equ    (LENInit + 2)        ; resident drivers
  86. .errnz        (PktMax LT LENInit)
  87. .errnz        (PktMax LT LENInitRes)
  88.  
  89. ;CMDGetDevSupport equ    1dh            ; query for extended capability    
  90. DCS_Addr    equ    dword ptr PktData+3    ; 16:16 of driver caps struc
  91. VCS_Addr    equ    dword ptr PktData+7    ; 16:16 of volume char struc
  92. LENGetDevSpprt    equ    11
  93.  
  94. ;CMDMedChk    equ    1            ; Media Check
  95. MedChkmedia    equ    byte ptr PktData    ; last media byte seen
  96. MedChkflag    equ    byte ptr PktData+1    ; -1=change 0=dont know 1=no change
  97. MedChkpVID    equ    dword ptr PktData+2    ; pointer to VID
  98. LENMedChk    equ    6
  99. .errnz        (PktMax LT LENMedChk)
  100.  
  101. ;CMDBldBPB    equ    2            ; build BPB
  102. BldBPBmedia    equ    byte ptr PktData    ; media byte
  103. BldBPBbuffer    equ    dword ptr PktData+1    ; scratch buffer
  104. BldBPBpBPB    equ    dword ptr PktData+5    ; returned pointer to BPB
  105. LENBldBPB    equ    9
  106. .errnz        (PktMax LT LENBldBPB)
  107.  
  108. ;CMDIOCTLR    equ    3            ; reserved for 3.x compatability
  109. ;CMDINPUT    equ    4            ; read data from device
  110. ;CMDOUTPUT    equ    8            ; write data to device
  111. ;CMDOUTPUTV    equ    9            ; write data and verify
  112. ;CMDInputBypass         EQU    24            ; cache bypass read data    ?? Needed any more ??
  113. ;CMDOutputBypass         EQU    25            ; cache bypass write data   ?? Needed any more ??
  114. ;CMDOutputBypassV     EQU    26            ; cache bypass write data and verify  ?? Needed any more ??
  115. ;CMDIOCTLW    equ    12            ; reserved for 3.x compatability
  116. IOmedia        equ    byte ptr PktData    ; media byte
  117. IOpData        equ    dword ptr PktData+1    ; transfer address
  118. IOcount        equ    word ptr PktData+5    ; count of bytes/sectors
  119. IOstart        equ    word ptr PktData+7    ; starting sector (block)
  120.                         ; starting sector is a DD
  121. IOPhysRBA    equ    dword ptr PktData+7    ; physical starting sector
  122.  
  123. ; IOSFN allows char device to virtualize based on open instance. E.g. if user
  124. ; opens LPT twice the spooler can use IOSFN field to tell one from another.
  125. ; IOSFN is mapped as follows (let N = RESIOSFN):
  126. ;         0    to     MAXSFN-1: real SFN    [MAXSFN <= 65536-512-N]
  127. ;  65536-512-N    to  65536-256-N-1: fake SFN
  128. ;  65536-256-N    to    65536-N-1: FCB SFN
  129. ;      65536-N    to      65536-1: unknown
  130. ;
  131. ; Note for multiple 3xbox the range for fake SFN will have to be expanded by
  132. ; 256 per 3xbox. Either that or choose a different mapping scheme.
  133.  
  134. IOSFN        equ    word ptr PktData+11    ; for device only
  135. LENIO        equ    13
  136. PktAdvise    equ    word ptr PktData+13    ; for >= v12 only
  137. .errnz        (PktMax LT LENIO)
  138.  
  139. ReadBypassAdj    equ    CMDInputBypass-CMDINPUT ; used internally by kernel
  140. WriteBypassAdj    equ    CMDOutputBypass-CMDOUTPUT ; used internally by kernel
  141.  
  142. ;CMDNDR        equ    5            ; non-destructive read
  143. NDRbyte        equ    byte ptr PktData    ; byte read from device
  144. LENNDR        equ    1
  145. .errnz        (PktMax LT LENNDR)
  146.  
  147. ;CMDInputS    equ    6            ; input status
  148. ;CMDOutputS    equ    10            ; output status
  149. LENStatus    equ    0
  150. .errnz        (PktMax LT LENStatus)
  151.  
  152. ;CMDInputF    equ    7            ; input flush
  153. ;CMDOutputF    equ    11            ; output flush
  154. LENFlush    equ    0
  155. .errnz        (PktMax LT LENFlush)
  156.  
  157. ;CMDOpen        equ    13            ; device open
  158. ;CMDClose    equ    14            ; device close
  159. OCSFN        equ    word ptr PktData    ; sfn of open instance for virtualization
  160. OCLastRef    equ    word ptr PktData+2    ; flag indicating last close
  161. LENOpnCls    equ    4
  162. .errnz        (PktMax LT LENOpnCls)
  163.  
  164. ;CMDRemMed    equ    15            ; is media removable
  165. LENRemMed    equ    0
  166. .errnz        (PktMax LT LENRemMed)
  167.  
  168. ;CMDStart EQU    98                ; start console output
  169. ;CMDStop EQU    99                ; stop console output
  170. CStpSKG EQU    BYTE PTR PktData+0        ; Screen/Keyboard number
  171. LenStp    EQU    1                ; Size of request additions.
  172. .errnz        (PktMax LT LenStp)
  173.  
  174. ;CMDGenIOCTL    EQU    16            ; Generic IOCTL
  175. GIOCategory    EQU    BYTE PTR PktData    ; Category Code
  176. GIOFunction    EQU    BYTE PTR PktData+1    ; Function code
  177. GIOParaPack    EQU    DWORD PTR PktData+2    ; pointer to parameter packet
  178. GIODataPack    EQU    DWORD PTR PktData+6    ; pointer to data packet
  179. GIOSFN        EQU    WORD PTR PktData+10    ; (used by Spooler?)
  180. LENGenIOCTL    EQU    12            ; length w/o new parameters
  181. .errnz        (PktMax LT LENGenIOCTL)
  182.                         ; new parameters
  183. GIOParaLen    EQU    WORD PTR PktData+12    ; length of parameter packet
  184. GIODataLen    EQU    WORD PTR PktData+14    ; length of data packet
  185. LENGenIOCTL2    EQU    16            ; length w/ new parameters
  186. .errnz        (PktMax LT LENGenIOCTL2)
  187.  
  188.  
  189. ;CMDDeInstall    EQU    20            ; De-Install driver
  190. ; DINEndLocn    EQU    DWORD PTR PktData
  191. ; DINLength    EQU    WORD PTR PktData+5
  192. LENDeIn        EQU    0
  193. .errnz        (PktMax LT LENDeIn)
  194.  
  195. ;CMDResMed    EQU    17            ; reset media uncertain
  196. LENResMed    equ    0
  197. .errnz        (PktMax LT LENResMed)
  198.  
  199. ;CMDAddOnPrep    EQU    97            ; Prepare for add on
  200. Add_On_NewDD    EQU    DWORD PTR PktData
  201. Add_On_SrvRout    EQU    DWORD PTR PktData
  202. LenAddOn    EQU    4
  203.  
  204. ;CMDGetLogMap    EQU    18
  205. ;CMDSetLogMap    EQU    19
  206. Logical_Drive    EQU    BYTE PTR PktData; logical drive number
  207. LenGetSetLog    EQU    1
  208.  
  209. ;CMDPartfixeddisks    EQU  22           ; Partitionable Fixed Disks
  210. ;CMDGetfd_logunitsmap    EQU  23           ; Get Fixed Disk/Logical Unit Map
  211.  
  212. LENShutdown    equ    5
  213. SDFuncCode    equ    byte ptr PktData
  214. SDReserveLow    equ    word ptr PktData+1
  215. SDReserveHigh    equ    word ptr PktData+3
  216. ;CMDShutdown    equ    28
  217.  
  218. STDDERROR         EQU     4000H         ; Equate for Device Driver Defined Error
  219. ERROR_DEVICEDRIVER_DEFINED_BASE EQU 0FE00H     ; Equate for Device Driver Defined Error High Byte
  220.  
  221. ;
  222. ; The next two symbols are used in the files DEV.ASM and SPROC.ASM to
  223. ; set up and verify the set of request packets that the kernel keeps in
  224. ; a segment, and to control req pkt allocation and initialization.
  225. ;
  226. ; See: dev.asm, sproc.asm
  227. ;
  228. StaticPackets     EQU    128        ; 128 * 32 = 4k
  229.  
  230. ReqPktSize    EQU    32        ; "Nice" size for packet (power of 2)
  231. .ERRNZ    (SIZE Packet - 31)        ; Device Driver packet size has changed
  232. ;
  233.  
  234. ; ***********************************************
  235. ;  PhysDiskTbl - Physical Disk Entry Structure    *
  236. ; ***********************************************
  237.  
  238.  diskentry  STRUC
  239.  
  240.  ddheader    DD  0         ; Pointer to Device Driver Header
  241.  ereserved    DB  0         ; Reserved
  242.  reldisknum    DB  0         ; Relative Physical Disk # for Device Driver
  243.  devpid        DW  0         ; PID
  244.  deveflags    DW  0         ; Flags for the physical disk
  245.  logunitbitmap    DD  0         ; Logical Unit Bit Map
  246.  
  247.  diskentry  ends
  248.  
  249. SUBTTL
  250.  
  251. ;*    Obsolete information - use for background info only
  252. ;
  253. ;
  254. ; Attribute bit masks
  255. ;
  256. ;   Character devices:
  257. ;
  258. ;   Bit 15 -> must be 1
  259. ;    14 -> 1 if the device understands IOCTL control strings
  260. ;    13 -> 1 if the device supports output-until-busy
  261. ;    12 -> unused
  262. ;    11 -> 1 if the device understands Open/Close
  263. ;    10 -> must be 0
  264. ;     9 -> must be 0
  265. ;     8 -> 1 if the device understands Pause/Restart/Gen. IOCTL
  266. ;     7 -> unused
  267. ;     6 -> unused
  268. ;     5 -> unused
  269. ;     4 -> 1 if device is recipient of INT 29h
  270. ;     3 -> 1 if device is clock device
  271. ;     2 -> 1 if device is null device
  272. ;     1 -> 1 if device is console output
  273. ;     0 -> 1 if device is console input
  274. ;
  275. ;   Block devices:
  276. ;
  277. ;   Bit 15 -> must be 0
  278. ;    14 -> 1 if the device understands IOCTL control strings
  279. ;    13 -> 1 if the device determines media by examining the FAT ID byte.
  280. ;        This requires the first sector of the fat to *always* reside in
  281. ;        the same place.
  282. ;    12 -> unused
  283. ;    11 -> 1 if the device understands Open/Close/removable media
  284. ;    10 -> must be 0
  285. ;     9 -> must be 0
  286. ;     8 -> 1 if the device understands Pause/Restart/Gen. IOCTL
  287. ;     7 -> unused
  288. ;     6 -> unused
  289. ;     5 -> unused
  290. ;     4 -> unused
  291. ;     3 -> unused
  292. ;     2 -> unused
  293. ;     1 -> unused
  294. ;     0 -> unused
  295. ;
  296. ;DevTyp         EQU     8000H         ; Bit 15 - 1  if Char, 0 if block
  297. ;DevIOCtl    EQU     4000H         ; Bit 14 - CONTROL mode bit
  298. ;ISFATBYDEV  EQU     2000H         ; Bit 13 - Device uses FAT ID bytes,
  299. ;                    ;  comp media.
  300. ;ISNET         EQU     1000H         ; Bit 12 - 1 if a NET device, 0 if
  301. ;                    ;  not.  Currently block only.
  302. ;DEVOPCL     EQU     0800H         ; Bit 11 - 1 if this device has
  303. ;                    ;  OPEN,CLOSE and REMOVABLE MEDIA
  304. ;                    ;  entry points, 0 if not
  305. ;
  306. ; NOTE Bit 9 is currently used on IBM systems to indicate "drive is shared".
  307. ;    See IOCTL function 9.  THIS USE IS NOT DOCUMENTED, it is used by some
  308. ;    of the utilities which are supposed to FAIL on shared drives on server
  309. ;    machines (FORMAT,CHKDSK,RECOVER,..).
  310. ;
  311. ;IsVID         equ     0080h         ; bit 7 - 1 if device issues UNCERTAIN MEDIA
  312. ;;ISSPEC     EQU     0010H         ; Bit 4 - This is special UNUSED
  313. ;ISCLOCK     EQU     0008H         ; Bit 3 - This is the clock device.
  314. ;ISNULL         EQU     0004H         ; Bit 2 - This is the null device.
  315. ;ISCOUT         EQU     0002H         ; Bit 1 - This is the console output.
  316. ;ISCIN         EQU     0001H         ; Bit 0 - This is the console input.
  317.  
  318. OutTilBusy  EQU     2000h         ; Output until busy is enabled
  319. DEV320        EQU     0040H         ; Bit 6 - If Device supports Dos 3.2
  320.