home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / asm / aspiprog / scsidefs.inc < prev   
Encoding:
Text File  |  1991-06-05  |  15.0 KB  |  334 lines

  1. ;****************************************************************************;
  2. ;                                         ;
  3. ; Name:     SCSIDEFS.INC                             ;
  4. ;                                         ;
  5. ; Description:    SCSI definitions   (Assembly Language)                 ;
  6. ;                                         ;
  7. ; History  JMS    Version 1.0 4/26/91                         ;
  8. ;                                         ;
  9. ;****************************************************************************;
  10.  
  11. ;****************************************************************************;
  12. ;            %%% TARGET STATUS VALUES %%%                 ;
  13. ;****************************************************************************;
  14. STATUS_GOOD    equ    00h    ;Status Good
  15. STATUS_CHKCOND    equ    02h    ;Check Condition
  16. STATUS_CONDMET    equ    04h    ;Condition Met
  17. STATUS_BUSY    equ    08h    ;Busy
  18. STATUS_INTERM    equ    10h    ;Intermediate
  19. STATUS_INTCDMET equ    14h    ;Intermediate-condition met
  20. STATUS_RESCONF    equ    18h    ;Reservation conflict
  21. STATUS_COMTERM    equ    22h    ;Command Terminated
  22. STATUS_QFULL    equ    28h    ;Queue full
  23.  
  24.  
  25. ;****************************************************************************;
  26. ;         %%%  SCSI MISCELLANIOUS EQUATES   %%%                 ;
  27. ;****************************************************************************;
  28. MAXLUN        equ    7    ;Maximum Logical Unit Id
  29. MAXTARG     equ    7    ;Maximum Target Id
  30. MAX_SCSI_LUNS    equ    64    ;Maximum Number of SCSI LUNs
  31. MAX_NUM_HA    equ    8    ;Maximum Number of SCSI HA's
  32.  
  33. LF        equ    10    ;Linefeed
  34. CR        equ    13    ;Carriage Return
  35. ;/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\;
  36. ;                                         ;
  37. ;             %%% SCSI COMMAND OPCODES %%%                 ;
  38. ;                                         ;
  39. ;\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/;
  40.  
  41. ;****************************************************************************;
  42. ;           %%% Commands for all Device Types %%%             ;
  43. ;****************************************************************************;
  44. SCSI_Change_Def equ    040h    ;Change Definition (Optional)
  45. SCSI_Compare    equ    039h    ;Compare (O)
  46. SCSI_Copy    equ    018h    ;Copy (O)
  47. SCSI_Cop_Verify equ    03Ah    ;Copy and Verify (O)
  48. SCSI_Inquiry    equ    012h    ;Inquiry (MANDATORY)
  49. SCSI_Log_Select equ    04Ch    ;Log Select (O)
  50. SCSI_Log_Sense    equ    04Dh    ;Log Sense (O)
  51. SCSI_Mod_Sel_6    equ    015h    ;Mode Select 6-byte (Device Specific)
  52. SCSI_Mod_Sel_10 equ    055h    ;Mode Select 10-byte (Device Specific)
  53. SCSI_Mod_Sen_6    equ    015h    ;Mode Sense 6-byte (Device Specific)
  54. SCSI_Mod_Sen_10 equ    015h    ;Mode Sense 10-byte (Device Specific)
  55. SCSI_Read_Buff    equ    03Ch    ;Read Buffer (O)
  56. SCSI_Req_Sense    equ    003h    ;Request Sense (MANDATORY)
  57. SCSI_Send_Diag    equ    01Dh    ;Send Diagnostic (O)
  58. SCSI_Tst_U_Rdy    equ    000h    ;Test Unit Ready (MANDATORY)
  59. SCSI_Write_Buff equ    03Bh    ;Write Buffer (O)
  60.  
  61. ;****************************************************************************;
  62. ;           %%% Commands Unique to Direct Access Devices %%%          ;
  63. ;****************************************************************************;
  64. SCSI_Compare    equ    039h    ;Compare (O)
  65. SCSI_Format    equ    004h    ;Format Unit (MANDATORY)
  66. SCSI_Lck_Un_Cac equ    036h    ;Lock Unlock Cache (O)
  67. SCSI_Prefetch    equ    034h    ;Prefetch (O)
  68. SCSI_Med_Removl equ    01Eh    ;Prevent/Allow medium Removal (O)
  69. SCSI_Read_6    equ    008h    ;Read 6-byte (MANDATORY)
  70. SCSI_Read_10    equ    028h    ;Read 10-byte (MANDATORY)
  71. SCSI_Rd_Capac    equ    025h    ;Read Capacity (MANDATORY)
  72. SCSI_Rd_Defect    equ    037h    ;Read Defect Data (O)
  73. SCSI_Read_Long    equ    03Eh    ;Read Long (O)
  74. SCSI_Reass_Blk    equ    007h    :Reassign Blocks (O)
  75. SCSI_Rcv_Diag    equ    01Ch    ;Receive Diagnostic Results (O)
  76. SCSI_Release    equ    017h    ;Release Unit (MANDATORY)
  77. SCSI_Rezero    equ    001h    ;Rezero Unit (O)
  78. SCSI_Srch_Dat_E equ    01Dh    ;Search Data Equal (O)
  79. SCSI_Srch_Dat_H equ    01Dh    ;Search Data High (O)
  80. SCSI_Srch_Dat_L equ    01Dh    ;Search Data Low (O)
  81. SCSI_Seek_6    equ    00Bh    ;Seek 6-Byte (O)
  82. SCSI_Seek_10    equ    02Bh    ;Seek 10-Byte (O)
  83. SCSI_Send_Diag    equ    01Dh    ;Send Diagnostics (MANDATORY)
  84. SCSI_Set_Limit    equ    033h    ;Set Limits (O)
  85. SCSI_Start_Stp    equ    01Bh    ;Start/Stop Unit (O)
  86. SCSI_Sync_Cache equ    035h    ;Synchronize Cache (O)
  87. SCSI_Verify    equ    02Fh    ;Verify (O)
  88. SCSI_Write_6    equ    00Ah    ;Write 6-Byte (MANDATORY)
  89. SCSI_Write_10    equ    02Ah    ;Write 10-Byte (MANDATORY)
  90. SCSI_Wrt_Verify equ    02Eh    ;Write and Verify (O)
  91. SCSI_Write_Long equ    03Fh    ;Write Long (O)
  92. SCSI_Write_Same equ    041h    ;Write Same (O)
  93.  
  94. ;****************************************************************************;
  95. ;          %%% Commands Unique to Sequential Access Devices %%%         ;
  96. ;****************************************************************************;
  97. SCSI_Erase    equ    019h    ;Erase (MANDATORY)
  98. SCSI_Load_Un    equ    01Bh    ;Load/Unload (O)
  99. SCSI_Locate    equ    02Bh    ;Locate (O)
  100. SCSI_Rd_Blk_Lim equ    005h    ;Read Block Limits (MANDATORY)
  101. SCSI_Read_Pos    equ    034h    ;Read Position (O)
  102. SCSI_Read_Rev    equ    00Fh    ;Read Reverse (O)
  103. SCSI_Rec_Bf_Dat equ    014h    ;Recover Buffer Data (O)
  104. SCSI_Reserve    equ    016h    ;Reserve Unit (MANDATORY)
  105. SCSI_Rewind    equ    001h    ;Rewind (MANDATORY)
  106. SCSI_Space    equ    011h    ;Space (MANDATORY)
  107. SCSI_Verify_T    equ    013h    ;Verify (Tape) (O)
  108. SCSI_Wrt_File    equ    010h    ;Write Filemarks (MANDATORY)
  109.  
  110. ;****************************************************************************;
  111. ;          %%% Commands Unique to Printer Devices %%%             ;
  112. ;****************************************************************************;
  113. SCSI_Print    equ    00Ah    ;Print (MANDATORY)
  114. SCSI_Slew_Pnt    equ    00Bh    ;Slew and Print (O)
  115. SCSI_Stop_Pnt    equ    01Bh    ;Stop Print (O)
  116. SCSI_Sync_Buff    equ    010h    ;Synchronize Buffer (O)
  117.  
  118. ;****************************************************************************;
  119. ;         %%% Commands Unique to Processor Devices %%%             ;
  120. ;****************************************************************************;
  121. SCSI_Receive    equ    008h    ;Receive (O)
  122. SCSI_Send    equ    00Ah    ;Send (O)
  123.  
  124. ;****************************************************************************;
  125. ;         %%% Commands Unique to Write-Once Devices %%%             ;
  126. ;****************************************************************************;
  127. SCSI_Medium_Scn equ    038h    ;Medium Scan (O)
  128. SCSI_SrchDatE10 equ    031h    ;Search Data Equal 10-Byte (O)
  129. SCSI_SrchDatE12 equ    0B1h    ;Search Data Equal 12-Byte (O)
  130. SCSI_SrchDatH10 equ    030h    ;Search Data High 10-Byte (O)
  131. SCSI_SrchDatH12 equ    0B0h    ;Search Data High 12-Byte (O)
  132. SCSI_SrchDatL10 equ    032h    ;Search Data Low 10-Byte (O)
  133. SCSI_SrchDatL12 equ    0B2h    ;Search Data Low 12-Byte (O)
  134. SCSI_Set_Lim_10 equ    033h    ;Set Limits 10-Byte (O)
  135. SCSI_Set_Lim_12 equ    0B3h    ;Set Limits 10-Byte (O)
  136. SCSI_Verify_10    equ    02Fh    ;Verify 10-Byte (O)
  137. SCSI_Verify_12    equ    0AFh    ;Verify 12-Byte (O)
  138. SCSI_Write_12    equ    0AAh    ;Write 12-Byte (O)
  139. SCSI_Wrt_Ver_10 equ    02Eh    ;Write and Verify 10-Byte (O)
  140. SCSI_Wrt_Ver_12 equ    0AEh    ;Write and Verify 12-Byte (O)
  141.  
  142. ;****************************************************************************;
  143. ;          %%% Commands Unique to CD-ROM Devices %%%             ;
  144. ;****************************************************************************;
  145.  
  146. SCSI_PlayAud_10 equ    045h    ;Play Audio 10-Byte (O)
  147. SCSI_PlayAud_12 equ    0A5h    ;Play Audio 12-Byte 12-Byte (O)
  148. SCSI_PlayAudMsf equ    047h    ;Play Audio MSF (O)
  149. SCSI_PlayA_TkIn equ    048h    ;Play Audio Track/Index (O)
  150. SCSI_PlyTkRel10 equ    049h    ;Play Track Relative 10-Byte (O)
  151. SCSI_PlyTkRel12 equ    0A9h    ;Play Track Relative 12-Byte (O)
  152. SCSI_ReadCDCap    equ    025h    ;Read CD-ROM Capacity (MANDATORY)
  153. SCSI_ReadHeader equ    044h    ;Read Header (O)
  154. SCSI_SubChannel equ    042h    ;Read Subchannel (O)
  155. SCSI_Read_TOC    equ    043h    ;Read TOC (O)
  156.  
  157. ;****************************************************************************;
  158. ;          %%% Commands Unique to Scanner Devices %%%             ;
  159. ;****************************************************************************;
  160.  
  161. SCSI_GetDBStat    equ    034h    ;Get Data Buffer Status (O)
  162. SCSI_GetWindow    equ    025h    ;Get Window (O)
  163. SCSI_ObjectPos    equ    031h    ;Object Postion (O)
  164. SCSI_Scan    equ    01Bh    ;Scan (O)
  165. SCSI_SetWindow    equ    024h    ;Set Window (MANDATORY)
  166.  
  167. ;****************************************************************************;
  168. ;           %%% Commands Unique to Optical Memory Devices %%%         ;
  169. ;****************************************************************************;
  170.  
  171. SCSI_UpdateBlk    equ    3Dh    ;Update Block (O)
  172.  
  173. ;****************************************************************************;
  174. ;           %%% Commands Unique to Medium Changer Devices %%%         ;
  175. ;****************************************************************************;
  176.  
  177. SCSI_ExchMedium equ    0A6h    ;Exchange Medium (O)
  178. SCSI_InitElStat equ    007h    ;Initialize Element Status (O)
  179. SCSI_PosToElem    equ    02Bh    ;Position to Element (O)
  180. SCSI_Req_VE_Add equ    0B5h    ;Request Volume Element Address (O)
  181. SCSI_SendVolTag equ    0B6h    ;Send Volume Tag (O)
  182.  
  183. ;****************************************************************************;
  184. ;          %%% Commands Unique to Communication Devices %%%             ;
  185. ;****************************************************************************;
  186.  
  187. SCSI_Get_Msg_6    equ    008h    ;Get Message 6-Byte (MANDATORY)
  188. SCSI_Get_Msg_10 equ    028h    ;Get Message 10-Byte (O)
  189. SCSI_Get_Msg_12 equ    0A8h    ;Get Message 12-Byte (O)
  190. SCSI_Snd_Msg_6    equ    00Ah    ;Send Message 6-Byte (MANDATORY)
  191. SCSI_Snd_Msg_10 equ    02Ah    ;Send Message 10-Byte (O)
  192. SCSI_Snd_Msg_12 equ    0AAh    ;Send Message 12-Byte (O)
  193.  
  194. ;/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\;
  195. ;                                         ;
  196. ;          %%%  End Of SCSI Command Opcodes  %%%              ;
  197. ;                                         ;
  198. ;/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\;
  199.  
  200. ;****************************************************************************;
  201. ;        %%%    Request Sense Data Format   %%%                 ;
  202. ;****************************************************************************;
  203. SENSE_DATA_FMT        struc
  204.     ErrorCode    db    ?    ;Error Code (70H or 71H)
  205.     SegmentNum    db    ?    ;Number of current segment descriptor
  206.     SenseKey    db    ?    ;Sense Key(See bit definitions too)
  207.     InfoMSB     db    ?    ;Information MSB
  208.     InfoLSB     db    ?    ;Information LSB
  209.     AddSenLen    db    ?    ;Additional Sense Length
  210.     ComSpecInfMSB    db    ?    ;Command Specific Information MSB
  211.     ComSpecInfLSB    db    ?    ;Command Specific Information LSB
  212.     AddSenseCode    db    ?    ;Additional Sense Code
  213.     AddSenQual    db    ?    ;Additional Sense Code Qualifier
  214.     FieldRepUCode    db    ?    ;Field Replaceable Unit Code
  215.     SenKeySpec15    db    ?    ;Sense Key Specific 15th byte
  216.     SenKeySpec16    db    ?    ;Sense Key Specific 16th byte
  217.     SenKeySpec17    db    ?    ;Sense Key Specific 17th byte
  218.     AddSenseBytes    db    ?    ;Additional Sense Bytes
  219. SENSE_DATA_FMT        ends
  220.  
  221. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  222. ;            REQUEST SENSE ERROR CODE                  ;
  223. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  224. SERROR_CURRENT    equ    070H    ;Current Errors
  225. SERROR_DEFERED    equ    071H    ;Deferred Errors
  226.  
  227. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  228. ;            REQUEST SENSE BIT DEFINITIONS                  ;
  229. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  230. SENSE_VALID    equ    080H    ;Byte 0 Bit 7
  231. SENSE_FILEMRK    equ    080H    ;Byte 2 Bit 7
  232. SENSE_EOM    equ    040H    ;Byte 2 Bit 6
  233. SENSE_ILI    equ    020H    ;Byte 2 Bit 5
  234.  
  235. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  236. ;            REQUEST SENSE SENSE KEY DEFINITIONS             ;
  237. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  238.  
  239. KEY_NOSENSE    equ    00H    ;No Sense
  240. KEY_RECERROR    equ    01H    ;Recovered Error
  241. KEY_NOTREADY    equ    02H    ;Not Ready
  242. KEY_MEDIUMERR    equ    03H    ;Medium Error
  243. KEY_HARDERROR    equ    04H    ;Hardware Error
  244. KEY_ILLGLREQ    equ    05H    ;Illegal Request
  245. KEY_UNITATT    equ    06H    ;Unit Attention
  246. KEY_DATAPROT    equ    07H    ;Data Protect
  247. KEY_BLANKCHK    equ    08H    ;Blank Check
  248. KEY_VENDSPEC    equ    09H    ;Vendor Specific
  249. KEY_COPYABORT    equ    0AH    ;Copy Abort
  250. KEY_EQUAL    equ    0CH    ;Equal (Search)
  251. KEY_VOLOVRFLW    equ    0DH    ;Volume Overflow
  252. KEY_MISCOMP    equ    0EH    ;Miscompare (Search)
  253. KEY_RESERVED    equ    0FH    ;Reserved
  254.  
  255. ;****************************************************************************;
  256. ;             %%%    Inquiry Data Format   %%%                 ;
  257. ;****************************************************************************;
  258. INQRY_DATA_FMT        struc
  259.     PerQualTyp    db    ?    ;Peripheral Qualifier and Device Type
  260.             db    ?    ;Reserved except for bit 7 (RMB)
  261.     Versions    db    ?    ;ISO, ECMA and ANSI versions
  262.             db    ?    ;
  263.     AddLengh    db    ?    ;Additional Length
  264.     Reserved1    db    ?    ;Reserved
  265.     Reserved2    db    ?    ;Reserved
  266.     Flags        db    ?    ;RelAdr, WBus32, WBus16, Sync, ....
  267.     VendorId    db    8 dup (?) ;Command Specific Information LSB
  268.     ProdId        db     16 dup (?) ;Additional Sense Code
  269.     ProdRev     db    4 dup (?) ;Additional Sense Code Qualifier
  270. INQRY_DATA_FMT        ends
  271.  
  272. ;****************************************************************************;
  273. ;          %%% PERIPHERAL DEVICE TYPE DEFINITIONS %%%             ;
  274. ;****************************************************************************;
  275. DTYPE_DASD    equ    00H    ;Disk Device
  276. DTYPE_SEQD    equ    01H    ;Tape Device
  277. DTYPE_PRNT    equ    02H    ;Printer
  278. DTYPE_PROC    equ    03H    ;Processor
  279. DTYPE_WORM    equ    04H    ;Write-once read-multiple
  280. DTYPE_CROM    equ    05H    ;CD-ROM device
  281. DTYPE_SCAN    equ    06H    ;Scanner device
  282. DTYPE_OPTI    equ    07H    ;Optical memory device
  283. DTYPE_JUKE    equ    08H    ;Medium Changer device
  284. DTYPE_COMM    equ    09H    ;Communications device
  285. DTYPE_RESL    equ    0AH    ;Reserved (low)
  286. DTYPE_RESH    equ    1EH    ;Reserved (high)
  287. DTYPE_????    equ    1FH    ;Unknown or no device type
  288.  
  289. ;****************************************************************************;
  290. ;          %%% ANSI APPROVED VERSION DEFINITIONS %%%             ;
  291. ;****************************************************************************;
  292.  
  293. ANSI_MAYBE    equ    00H    ;Device may or may not be ANSI approved stand.
  294. ANSI_SCSI1    equ    01H    ;Device complies to ANSI X3.131-1986 (SCSI-1)
  295. ANSI_SCSI2    equ    02H    ;Device complies to SCSI-2
  296. ANSI_RESLO    equ    03H    ;Reserved (low)
  297. ANSI_RESHI    equ    07H    ;Reserved (high)
  298.  
  299. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  300. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  301. ;****************************************************************************;
  302. ;           %%%    6-Byte Data Transfer Command Format  %%%             ;
  303. ;****************************************************************************;
  304. DATA_XFER_6        struc
  305.             db    (SIZE SRBlock) dup (?)
  306.     _OpCode     db    ?    ;Opcode of SCSI Command
  307.     _LUNumber    db    ?    ;Logical Unit Number & LBA MSB
  308.     _LBAMiddl    db    ?    ;Logical Block Address Middle Byte
  309.     _LBALeast    db    ?    ;Logical Block Address Least Byte
  310.     _Length     db    ?    ;Transfer Length
  311.     _Control    db    ?    ;Control Byte
  312. DATA_XFER_6        ends
  313.  
  314. ;****************************************************************************;
  315. ;           %%%    10-Byte Data Transfer Command Format  %%%          ;
  316. ;****************************************************************************;
  317. _LBA_3rd    equ    _OpCode+3     ;Logical Block Address 3rd Byte
  318. _LBA_2nd    equ    _OpCode+4     ;Logical Block Address 2nd Byte
  319. _LBA_1st    equ    _OpCode+5     ;Logical Block Address 1st Byte
  320. _LBA_0th    equ    _OpCode+6     ;Logical Block Address 0th Byte
  321. _Length_Hi    equ    _OpCode+7     ;Transfer Length High
  322. _Length_Lo    equ    _OpCode+8     ;Transfer Length Low
  323. _Control10    equ    _OpCode+9     ;Control Byte
  324.  
  325. ;****************************************************************************;
  326. ;           %%%    12-Byte Data Transfer Command Format  %%%          ;
  327. ;****************************************************************************;
  328. _Length_3rd    equ    _OpCode+7      ;Transfer Length 3rd
  329. _Length_2nd    equ    _OpCode+8      ;Transfer Length 2nd
  330. _Length_1st    equ    _OpCode+9      ;Transfer Length 1st
  331. _Length_0th    equ    _OpCode+10     ;Transfer Length 0th
  332. _Control12    equ    _OpCode+11     ;Control Byte
  333.  
  334.