scsidefs.pp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. unit scsidefs;
  2. interface
  3. const
  4. { ---------------------------------------------------------------------
  5. TARGET STATUS VALUES
  6. ---------------------------------------------------------------------}
  7. STATUS_GOOD = $00; // Status Good
  8. STATUS_CHKCOND = $02; // Check Condition
  9. STATUS_CONDMET = $04; // Condition Met
  10. STATUS_BUSY = $08; // Busy
  11. STATUS_INTERM = $10; // Intermediate
  12. STATUS_INTCDMET = $14; // Intermediate-condition met
  13. STATUS_RESCONF = $18; // Reservation conflict
  14. STATUS_COMTERM = $22; // Command Terminated
  15. STATUS_QFULL = $28; // Queue full
  16. { ---------------------------------------------------------------------
  17. SCSI MISCELLANEOUS EQUATES
  18. ---------------------------------------------------------------------}
  19. MAXLUN = 7; // Maximum Logical Unit Id
  20. MAXTARG = 7; // Maximum Target Id
  21. MAX_SCSI_LUNS = 64; // Maximum Number of SCSI LUNs
  22. MAX_NUM_HA = 8; // Maximum Number of SCSI HA's
  23. { ---------------------------------------------------------------------
  24. SCSI COMMAND OPCODES
  25. ---------------------------------------------------------------------}
  26. { ---------------------------------------------------------------------
  27. Commands for all Device Types
  28. ---------------------------------------------------------------------}
  29. SCSI_CHANGE_DEF = $40; // Change Definition (Optional)
  30. SCSI_COMPARE = $39; // Compare (O)
  31. SCSI_COPY = $18; // Copy (O)
  32. SCSI_COP_VERIFY = $3A; // Copy and Verify (O)
  33. SCSI_INQUIRY = $12; // Inquiry (MANDATORY)
  34. SCSI_LOG_SELECT = $4C; // Log Select (O)
  35. SCSI_LOG_SENSE = $4D; // Log Sense (O)
  36. SCSI_MODE_SEL6 = $15; // Mode Select 6-byte (Device Specific)
  37. SCSI_MODE_SEL10 = $55; // Mode Select 10-byte (Device Specific)
  38. SCSI_MODE_SEN6 = $1A; // Mode Sense 6-byte (Device Specific)
  39. SCSI_MODE_SEN10 = $5A; // Mode Sense 10-byte (Device Specific)
  40. SCSI_READ_BUFF = $3C; // Read Buffer (O)
  41. SCSI_REQ_SENSE = $03; // Request Sense (MANDATORY)
  42. SCSI_SEND_DIAG = $1D; // Send Diagnostic (O)
  43. SCSI_TST_U_RDY = $00; // Test Unit Ready (MANDATORY)
  44. SCSI_WRITE_BUFF = $3B; // Write Buffer (O)
  45. { ---------------------------------------------------------------------
  46. Commands Unique to Direct Access Devices
  47. ---------------------------------------------------------------------}
  48. SCSI_FORMAT = $04; // Format Unit (MANDATORY)
  49. SCSI_LCK_UN_CAC = $36; // Lock Unlock Cache (O)
  50. SCSI_PREFETCH = $34; // Prefetch (O)
  51. SCSI_MED_REMOVL = $1E; // Prevent/Allow medium Removal (O)
  52. SCSI_READ6 = $08; // Read 6-byte (MANDATORY)
  53. SCSI_READ10 = $28; // Read 10-byte (MANDATORY)
  54. SCSI_RD_CAPAC = $25; // Read Capacity (MANDATORY)
  55. SCSI_RD_DEFECT = $37; // Read Defect Data (O)
  56. SCSI_READ_LONG = $3E; // Read Long (O)
  57. SCSI_REASS_BLK = $07; // Reassign Blocks (O)
  58. SCSI_RCV_DIAG = $1C; // Receive Diagnostic Results (O)
  59. SCSI_RELEASE = $17; // Release Unit (MANDATORY)
  60. SCSI_REZERO = $01; // Rezero Unit (O)
  61. SCSI_SRCH_DAT_E = $31; // Search Data Equal (O)
  62. SCSI_SRCH_DAT_H = $30; // Search Data High (O)
  63. SCSI_SRCH_DAT_L = $32; // Search Data Low (O)
  64. SCSI_SEEK6 = $0B; // Seek 6-Byte (O)
  65. SCSI_SEEK10 = $2B; // Seek 10-Byte (O)
  66. SCSI_SET_LIMIT = $33; // Set Limits (O)
  67. SCSI_START_STP = $1B; // Start/Stop Unit (O)
  68. SCSI_SYNC_CACHE = $35; // Synchronize Cache (O)
  69. SCSI_VERIFY = $2F; // Verify (O)
  70. SCSI_WRITE6 = $0A; // Write 6-Byte (MANDATORY)
  71. SCSI_WRITE10 = $2A; // Write 10-Byte (MANDATORY)
  72. SCSI_WRT_VERIFY = $2E; // Write and Verify (O)
  73. SCSI_WRITE_LONG = $3F; // Write Long (O)
  74. SCSI_WRITE_SAME = $41; // Write Same (O)
  75. { ---------------------------------------------------------------------
  76. Commands Unique to Sequential Access Devices
  77. ---------------------------------------------------------------------}
  78. SCSI_ERASE = $19; // Erase (MANDATORY)
  79. SCSI_LOAD_UN = $1B; // Load/Unload (O)
  80. SCSI_LOCATE = $2B; // Locate (O)
  81. SCSI_RD_BLK_LIM = $05; // Read Block Limits (MANDATORY)
  82. SCSI_READ_POS = $34; // Read Position (O)
  83. SCSI_READ_REV = $0F; // Read Reverse (O)
  84. SCSI_REC_BF_DAT = $14; // Recover Buffer Data (O)
  85. SCSI_RESERVE = $16; // Reserve Unit (MANDATORY)
  86. SCSI_REWIND = $01; // Rewind (MANDATORY)
  87. SCSI_SPACE = $11; // Space (MANDATORY)
  88. SCSI_VERIFY_T = $13; // Verify (Tape) (O)
  89. SCSI_WRT_FILE = $10; // Write Filemarks (MANDATORY)
  90. { ---------------------------------------------------------------------
  91. Commands Unique to Printer Devices
  92. ---------------------------------------------------------------------}
  93. SCSI_PRINT = $0A; // Print (MANDATORY)
  94. SCSI_SLEW_PNT = $0B; // Slew and Print (O)
  95. SCSI_STOP_PNT = $1B; // Stop Print (O)
  96. SCSI_SYNC_BUFF = $10; // Synchronize Buffer (O)
  97. { ---------------------------------------------------------------------
  98. Commands Unique to Processor Devices
  99. ---------------------------------------------------------------------}
  100. SCSI_RECEIVE = $08; // Receive (O)
  101. SCSI_SEND = $0A; // Send (O)
  102. { ---------------------------------------------------------------------
  103. Commands Unique to Write-Once Devices
  104. ---------------------------------------------------------------------}
  105. SCSI_MEDIUM_SCN = $38; // Medium Scan (O)
  106. SCSI_SRCHDATE10 = $31; // Search Data Equal 10-Byte (O)
  107. SCSI_SRCHDATE12 = $B1; // Search Data Equal 12-Byte (O)
  108. SCSI_SRCHDATH10 = $30; // Search Data High 10-Byte (O)
  109. SCSI_SRCHDATH12 = $B0; // Search Data High 12-Byte (O)
  110. SCSI_SRCHDATL10 = $32; // Search Data Low 10-Byte (O)
  111. SCSI_SRCHDATL12 = $B2; // Search Data Low 12-Byte (O)
  112. SCSI_SET_LIM_10 = $33; // Set Limits 10-Byte (O)
  113. SCSI_SET_LIM_12 = $B3; // Set Limits 10-Byte (O)
  114. SCSI_VERIFY10 = $2F; // Verify 10-Byte (O)
  115. SCSI_VERIFY12 = $AF; // Verify 12-Byte (O)
  116. SCSI_WRITE12 = $AA; // Write 12-Byte (O)
  117. SCSI_WRT_VER10 = $2E; // Write and Verify 10-Byte (O)
  118. SCSI_WRT_VER12 = $AE; // Write and Verify 12-Byte (O)
  119. { ---------------------------------------------------------------------
  120. Commands Unique to CD-ROM Devices
  121. ---------------------------------------------------------------------}
  122. SCSI_PLAYAUD_10 = $45; // Play Audio 10-Byte (O)
  123. SCSI_PLAYAUD_12 = $A5; // Play Audio 12-Byte 12-Byte (O)
  124. SCSI_PLAYAUDMSF = $47; // Play Audio MSF (O)
  125. SCSI_PLAYA_TKIN = $48; // Play Audio Track/Index (O)
  126. SCSI_PLYTKREL10 = $49; // Play Track Relative 10-Byte (O)
  127. SCSI_PLYTKREL12 = $A9; // Play Track Relative 12-Byte (O)
  128. SCSI_READCDCAP = $25; // Read CD-ROM Capacity (MANDATORY)
  129. SCSI_READHEADER = $44; // Read Header (O)
  130. SCSI_SUBCHANNEL = $42; // Read Subchannel (O)
  131. SCSI_READ_TOC = $43; // Read TOC (O)
  132. SCSI_STOP = $4E;
  133. SCSI_PAUSERESUME = $4B;
  134. { ---------------------------------------------------------------------
  135. Commands Unique to Scanner Devices
  136. ---------------------------------------------------------------------}
  137. SCSI_GETDBSTAT = $34; // Get Data Buffer Status (O)
  138. SCSI_GETWINDOW = $25; // Get Window (O)
  139. SCSI_OBJECTPOS = $31; // Object Postion (O)
  140. SCSI_SCAN = $1B; // Scan (O)
  141. SCSI_SETWINDOW = $24; // Set Window (MANDATORY)
  142. { ---------------------------------------------------------------------
  143. Commands Unique to Optical Memory Devices
  144. ---------------------------------------------------------------------}
  145. SCSI_UpdateBlk = $3D; // Update Block (O)
  146. { ---------------------------------------------------------------------
  147. Commands Unique to Optical Medium Changer Devices
  148. ---------------------------------------------------------------------}
  149. SCSI_EXCHMEDIUM = $A6; // Exchange Medium (O)
  150. SCSI_INITELSTAT = $07; // Initialize Element Status (O)
  151. SCSI_POSTOELEM = $2B; // Position to Element (O)
  152. SCSI_REQ_VE_ADD = $B5; // Request Volume Element Address (O)
  153. SCSI_SENDVOLTAG = $B6; // Send Volume Tag (O)
  154. { ---------------------------------------------------------------------
  155. Commands Unique to Optical Communication Devices
  156. ---------------------------------------------------------------------}
  157. SCSI_GET_MSG_6 = $08; // Get Message 6-Byte (MANDATORY)
  158. SCSI_GET_MSG_10 = $28; // Get Message 10-Byte (O)
  159. SCSI_GET_MSG_12 = $A8; // Get Message 12-Byte (O)
  160. SCSI_SND_MSG_6 = $0A; // Send Message 6-Byte (MANDATORY)
  161. SCSI_SND_MSG_10 = $2A; // Send Message 10-Byte (O)
  162. SCSI_SND_MSG_12 = $AA; // Send Message 12-Byte (O)
  163. { ---------------------------------------------------------------------
  164. Request Sense Data Format
  165. ---------------------------------------------------------------------}
  166. type
  167. SENSE_DATA_FMT = record
  168. ErrorCode, // Error Code (70H or 71H)
  169. SegmentNum, // Number of current segment descriptor
  170. SenseKey, // Sense Key(See bit definitions too)
  171. InfoByte0, // Information MSB
  172. InfoByte1, // Information MID
  173. InfoByte2, // Information MID
  174. InfoByte3, // Information LSB
  175. AddSenLen, // Additional Sense Length
  176. ComSpecInf0, // Command Specific Information MSB
  177. ComSpecInf1, // Command Specific Information MID
  178. ComSpecInf2, // Command Specific Information MID
  179. ComSpecInf3, // Command Specific Information LSB
  180. AddSenseCode, // Additional Sense Code
  181. AddSenQual, // Additional Sense Code Qualifier
  182. FieldRepUCode, // Field Replaceable Unit Code
  183. SenKeySpec15, // Sense Key Specific 15th byte
  184. SenKeySpec16, // Sense Key Specific 16th byte
  185. SenKeySpec17, // Sense Key Specific 17th byte
  186. AddSenseBytes : BYTE; // Additional Sense Bytes
  187. end;
  188. TSENSE_DATA_FMT = SENSE_DATA_FMT;
  189. PSENSE_DATA_FMT = ^SENSE_DATA_FMT;
  190. { ---------------------------------------------------------------------
  191. REQUEST SENSE ERROR CODE
  192. ---------------------------------------------------------------------}
  193. const
  194. SERROR_CURRENT = $70; // Current Errors
  195. SERROR_DEFERED = $71; // Deferred Errors
  196. { ---------------------------------------------------------------------
  197. REQUEST SENSE BIT DEFINITIONS
  198. ---------------------------------------------------------------------}
  199. SENSE_VALID = $80; // Byte 0 Bit 7
  200. SENSE_FILEMRK = $80; // Byte 2 Bit 7
  201. SENSE_EOM = $40; // Byte 2 Bit 6
  202. SENSE_ILI = $20; // Byte 2 Bit 5
  203. { ---------------------------------------------------------------------
  204. REQUEST SENSE SENSE KEY DEFINITIONS
  205. ---------------------------------------------------------------------}
  206. KEY_NOSENSE = $00; // No Sense
  207. KEY_RECERROR = $01; // Recovered Error
  208. KEY_NOTREADY = $02; // Not Ready
  209. KEY_MEDIUMERR = $03; // Medium Error
  210. KEY_HARDERROR = $04; // Hardware Error
  211. KEY_ILLGLREQ = $05; // Illegal Request
  212. KEY_UNITATT = $06; // Unit Attention
  213. KEY_DATAPROT = $07; // Data Protect
  214. KEY_BLANKCHK = $08; // Blank Check
  215. KEY_VENDSPEC = $09; // Vendor Specific
  216. KEY_COPYABORT = $0A; // Copy Abort
  217. KEY_EQUAL = $0C; // Equal (Search)
  218. KEY_VOLOVRFLW = $0D; // Volume Overflow
  219. KEY_MISCOMP = $0E; // Miscompare (Search)
  220. KEY_RESERVED = $0F; // Reserved
  221. { ---------------------------------------------------------------------
  222. PERIPHERAL DEVICE TYPE DEFINITIONS
  223. ---------------------------------------------------------------------}
  224. DTYPE_DASD = $00; // Disk Device
  225. DTYPE_SEQD = $01; // Tape Device
  226. DTYPE_PRNT = $02; // Printer
  227. DTYPE_PROC = $03; // Processor
  228. DTYPE_WORM = $04; // Write-once read-multiple
  229. DTYPE_CROM = $05; // CD-ROM device
  230. DTYPE_CDROM = DTYPE_CROM;
  231. DTYPE_SCAN = $06; // Scanner device
  232. DTYPE_OPTI = $07; // Optical memory device
  233. DTYPE_JUKE = $08; // Medium Changer device
  234. DTYPE_COMM = $09; // Communications device
  235. DTYPE_RESL = $0A; // Reserved (low)
  236. DTYPE_RESH = $1E; // Reserved (high)
  237. DTYPE_UNKNOWN = $1F; // Unknown or no device type
  238. { ---------------------------------------------------------------------
  239. ANSI APPROVED VERSION DEFINITIONS
  240. ---------------------------------------------------------------------}
  241. ANSI_MAYBE = $0; // Device may or may not be ANSI approved stand
  242. ANSI_SCSI1 = $1; // Device complies to ANSI X3.131-1986 (SCSI-1)
  243. ANSI_SCSI2 = $2; // Device complies to SCSI-2
  244. ANSI_RESLO = $3; // Reserved (low)
  245. ANSI_RESHI = $7; // Reserved (high)
  246. implementation
  247. end.