summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/cdrom/src/scsidefs.pp
blob: 80d10ea04cc355cb920cafb4fe50c5fe8b39928e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
unit scsidefs;

interface

const

{ ---------------------------------------------------------------------
  TARGET STATUS VALUES
  ---------------------------------------------------------------------}

  STATUS_GOOD = $00;     // Status Good
  STATUS_CHKCOND = $02;  // Check Condition
  STATUS_CONDMET = $04;  // Condition Met
  STATUS_BUSY = $08;     // Busy
  STATUS_INTERM = $10;   // Intermediate
  STATUS_INTCDMET = $14; // Intermediate-condition met
  STATUS_RESCONF = $18;  // Reservation conflict
  STATUS_COMTERM = $22;  // Command Terminated
  STATUS_QFULL = $28;    // Queue full

{ ---------------------------------------------------------------------
  SCSI MISCELLANEOUS EQUATES
  ---------------------------------------------------------------------}

  MAXLUN = 7;         // Maximum Logical Unit Id
  MAXTARG = 7;        // Maximum Target Id
  MAX_SCSI_LUNS = 64; // Maximum Number of SCSI LUNs
  MAX_NUM_HA = 8;     // Maximum Number of SCSI HA's

{ ---------------------------------------------------------------------
  SCSI COMMAND OPCODES
  ---------------------------------------------------------------------}

{ ---------------------------------------------------------------------
  Commands for all Device Types
  ---------------------------------------------------------------------}

  SCSI_CHANGE_DEF = $40; // Change Definition (Optional)
  SCSI_COMPARE = $39;    // Compare (O)
  SCSI_COPY = $18;       // Copy (O)
  SCSI_COP_VERIFY = $3A; // Copy and Verify (O)
  SCSI_INQUIRY = $12;    // Inquiry (MANDATORY)
  SCSI_LOG_SELECT = $4C; // Log Select (O)
  SCSI_LOG_SENSE = $4D;  // Log Sense (O)
  SCSI_MODE_SEL6 = $15;  // Mode Select 6-byte (Device Specific)
  SCSI_MODE_SEL10 = $55; // Mode Select 10-byte (Device Specific)
  SCSI_MODE_SEN6 = $1A;  // Mode Sense 6-byte (Device Specific)
  SCSI_MODE_SEN10 = $5A; // Mode Sense 10-byte (Device Specific)
  SCSI_READ_BUFF = $3C;  // Read Buffer (O)
  SCSI_REQ_SENSE = $03;  // Request Sense (MANDATORY)
  SCSI_SEND_DIAG = $1D;  // Send Diagnostic (O)
  SCSI_TST_U_RDY = $00;  // Test Unit Ready (MANDATORY)
  SCSI_WRITE_BUFF = $3B; // Write Buffer (O)

{ ---------------------------------------------------------------------
  Commands Unique to Direct Access Devices
  ---------------------------------------------------------------------}

  SCSI_FORMAT = $04;     // Format Unit (MANDATORY)
  SCSI_LCK_UN_CAC = $36; // Lock Unlock Cache (O)
  SCSI_PREFETCH = $34;   // Prefetch (O)
  SCSI_MED_REMOVL = $1E; // Prevent/Allow medium Removal (O)
  SCSI_READ6 = $08;      // Read 6-byte (MANDATORY)
  SCSI_READ10 = $28;     // Read 10-byte (MANDATORY)
  SCSI_RD_CAPAC = $25;   // Read Capacity (MANDATORY)
  SCSI_RD_DEFECT = $37;  // Read Defect Data (O)
  SCSI_READ_LONG = $3E;  // Read Long (O)
  SCSI_REASS_BLK = $07;  // Reassign Blocks (O)
  SCSI_RCV_DIAG = $1C;   // Receive Diagnostic Results (O)
  SCSI_RELEASE = $17;    // Release Unit (MANDATORY)
  SCSI_REZERO = $01;     // Rezero Unit (O)
  SCSI_SRCH_DAT_E = $31; // Search Data Equal (O)
  SCSI_SRCH_DAT_H = $30; // Search Data High (O)
  SCSI_SRCH_DAT_L = $32; // Search Data Low (O)
  SCSI_SEEK6 = $0B;      // Seek 6-Byte (O)
  SCSI_SEEK10 = $2B;     // Seek 10-Byte (O)
  SCSI_SET_LIMIT = $33;  // Set Limits (O)
  SCSI_START_STP = $1B;  // Start/Stop Unit (O)
  SCSI_SYNC_CACHE = $35; // Synchronize Cache (O)
  SCSI_VERIFY = $2F;     // Verify (O)
  SCSI_WRITE6 = $0A;     // Write 6-Byte (MANDATORY)
  SCSI_WRITE10 = $2A;    // Write 10-Byte (MANDATORY)
  SCSI_WRT_VERIFY = $2E; // Write and Verify (O)
  SCSI_WRITE_LONG = $3F; // Write Long (O)
  SCSI_WRITE_SAME = $41; // Write Same (O)

{ ---------------------------------------------------------------------
  Commands Unique to Sequential Access Devices
  ---------------------------------------------------------------------}

  SCSI_ERASE = $19;      // Erase (MANDATORY)
  SCSI_LOAD_UN = $1B;    // Load/Unload (O)
  SCSI_LOCATE = $2B;     // Locate (O)
  SCSI_RD_BLK_LIM = $05; // Read Block Limits (MANDATORY)
  SCSI_READ_POS = $34;   // Read Position (O)
  SCSI_READ_REV = $0F;   // Read Reverse (O)
  SCSI_REC_BF_DAT = $14; // Recover Buffer Data (O)
  SCSI_RESERVE = $16;    // Reserve Unit (MANDATORY)
  SCSI_REWIND = $01;     // Rewind (MANDATORY)
  SCSI_SPACE = $11;      // Space (MANDATORY)
  SCSI_VERIFY_T = $13;   // Verify (Tape) (O)
  SCSI_WRT_FILE = $10;   // Write Filemarks (MANDATORY)

{ ---------------------------------------------------------------------
  Commands Unique to Printer Devices
  ---------------------------------------------------------------------}

  SCSI_PRINT = $0A;      // Print (MANDATORY)
  SCSI_SLEW_PNT = $0B;   // Slew and Print (O)
  SCSI_STOP_PNT = $1B;   // Stop Print (O)
  SCSI_SYNC_BUFF = $10;  // Synchronize Buffer (O)

{ ---------------------------------------------------------------------
  Commands Unique to Processor Devices
  ---------------------------------------------------------------------}

  SCSI_RECEIVE = $08;    // Receive (O)
  SCSI_SEND = $0A;       // Send (O)

{ ---------------------------------------------------------------------
  Commands Unique to Write-Once Devices
  ---------------------------------------------------------------------}

  SCSI_MEDIUM_SCN = $38; // Medium Scan (O)
  SCSI_SRCHDATE10 = $31; // Search Data Equal 10-Byte (O)
  SCSI_SRCHDATE12 = $B1; // Search Data Equal 12-Byte (O)
  SCSI_SRCHDATH10 = $30; // Search Data High 10-Byte (O)
  SCSI_SRCHDATH12 = $B0; // Search Data High 12-Byte (O)
  SCSI_SRCHDATL10 = $32; // Search Data Low 10-Byte (O)
  SCSI_SRCHDATL12 = $B2; // Search Data Low 12-Byte (O)
  SCSI_SET_LIM_10 = $33; // Set Limits 10-Byte (O)
  SCSI_SET_LIM_12 = $B3; // Set Limits 10-Byte (O)
  SCSI_VERIFY10 = $2F;   // Verify 10-Byte (O)
  SCSI_VERIFY12 = $AF;   // Verify 12-Byte (O)
  SCSI_WRITE12 = $AA;    // Write 12-Byte (O)
  SCSI_WRT_VER10 = $2E;  // Write and Verify 10-Byte (O)
  SCSI_WRT_VER12 = $AE;  // Write and Verify 12-Byte (O)

{ ---------------------------------------------------------------------
  Commands Unique to CD-ROM Devices
  ---------------------------------------------------------------------}

  SCSI_PLAYAUD_10  = $45; // Play Audio 10-Byte (O)
  SCSI_PLAYAUD_12  = $A5; // Play Audio 12-Byte 12-Byte (O)
  SCSI_PLAYAUDMSF  = $47; // Play Audio MSF (O)
  SCSI_PLAYA_TKIN  = $48; // Play Audio Track/Index (O)
  SCSI_PLYTKREL10  = $49; // Play Track Relative 10-Byte (O)
  SCSI_PLYTKREL12  = $A9; // Play Track Relative 12-Byte (O)
  SCSI_READCDCAP   = $25; // Read CD-ROM Capacity (MANDATORY)
  SCSI_READHEADER  = $44; // Read Header (O)
  SCSI_SUBCHANNEL  = $42; // Read Subchannel (O)
  SCSI_READ_TOC    = $43; // Read TOC (O)
  SCSI_STOP        = $4E;
  SCSI_PAUSERESUME = $4B;

{ ---------------------------------------------------------------------
  Commands Unique to Scanner Devices
  ---------------------------------------------------------------------}

  SCSI_GETDBSTAT  = $34; // Get Data Buffer Status (O)
  SCSI_GETWINDOW  = $25; // Get Window (O)
  SCSI_OBJECTPOS  = $31; // Object Postion (O)
  SCSI_SCAN       = $1B; // Scan (O)
  SCSI_SETWINDOW  = $24; // Set Window (MANDATORY)

{ ---------------------------------------------------------------------
  Commands Unique to Optical Memory Devices
  ---------------------------------------------------------------------}

  SCSI_UpdateBlk = $3D; // Update Block (O)

{ ---------------------------------------------------------------------
  Commands Unique to Optical Medium Changer Devices
  ---------------------------------------------------------------------}

  SCSI_EXCHMEDIUM = $A6; // Exchange Medium (O)
  SCSI_INITELSTAT = $07; // Initialize Element Status (O)
  SCSI_POSTOELEM  = $2B; // Position to Element (O)
  SCSI_REQ_VE_ADD = $B5; // Request Volume Element Address (O)
  SCSI_SENDVOLTAG = $B6; // Send Volume Tag (O)

{ ---------------------------------------------------------------------
  Commands Unique to Optical Communication Devices
  ---------------------------------------------------------------------}

  SCSI_GET_MSG_6 = $08;  // Get Message 6-Byte (MANDATORY)
  SCSI_GET_MSG_10 = $28; // Get Message 10-Byte (O)
  SCSI_GET_MSG_12 = $A8; // Get Message 12-Byte (O)
  SCSI_SND_MSG_6 = $0A;  // Send Message 6-Byte (MANDATORY)
  SCSI_SND_MSG_10 = $2A; // Send Message 10-Byte (O)
  SCSI_SND_MSG_12 = $AA; // Send Message 12-Byte (O)

{ ---------------------------------------------------------------------
  Request Sense Data Format
  ---------------------------------------------------------------------}

type

  SENSE_DATA_FMT = record
    ErrorCode, // Error Code (70H or 71H)
    SegmentNum, // Number of current segment descriptor
    SenseKey, // Sense Key(See bit definitions too)
    InfoByte0, // Information MSB
    InfoByte1, // Information MID
    InfoByte2, // Information MID
    InfoByte3, // Information LSB
    AddSenLen, // Additional Sense Length
    ComSpecInf0, // Command Specific Information MSB
    ComSpecInf1, // Command Specific Information MID
    ComSpecInf2, // Command Specific Information MID
    ComSpecInf3, // Command Specific Information LSB
    AddSenseCode, // Additional Sense Code
    AddSenQual, // Additional Sense Code Qualifier
    FieldRepUCode, // Field Replaceable Unit Code
    SenKeySpec15, // Sense Key Specific 15th byte
    SenKeySpec16, // Sense Key Specific 16th byte
    SenKeySpec17, // Sense Key Specific 17th byte
    AddSenseBytes : BYTE; // Additional Sense Bytes
  end;

  TSENSE_DATA_FMT = SENSE_DATA_FMT;
  PSENSE_DATA_FMT = ^SENSE_DATA_FMT;

{ ---------------------------------------------------------------------
  REQUEST SENSE ERROR CODE
  ---------------------------------------------------------------------}

const

  SERROR_CURRENT = $70; // Current Errors
  SERROR_DEFERED = $71; // Deferred Errors

{ ---------------------------------------------------------------------
  REQUEST SENSE BIT DEFINITIONS
  ---------------------------------------------------------------------}

  SENSE_VALID   = $80; // Byte 0 Bit 7
  SENSE_FILEMRK = $80; // Byte 2 Bit 7
  SENSE_EOM     = $40; // Byte 2 Bit 6
  SENSE_ILI     = $20; // Byte 2 Bit 5

{ ---------------------------------------------------------------------
  REQUEST SENSE SENSE KEY DEFINITIONS
  ---------------------------------------------------------------------}

  KEY_NOSENSE    = $00; // No Sense
  KEY_RECERROR   = $01; // Recovered Error
  KEY_NOTREADY   = $02; // Not Ready
  KEY_MEDIUMERR  = $03; // Medium Error
  KEY_HARDERROR  = $04; // Hardware Error
  KEY_ILLGLREQ   = $05; // Illegal Request
  KEY_UNITATT    = $06; // Unit Attention
  KEY_DATAPROT   = $07; // Data Protect
  KEY_BLANKCHK   = $08; // Blank Check
  KEY_VENDSPEC   = $09; // Vendor Specific
  KEY_COPYABORT  = $0A; // Copy Abort
  KEY_EQUAL      = $0C; // Equal (Search)
  KEY_VOLOVRFLW  = $0D; // Volume Overflow
  KEY_MISCOMP    = $0E; // Miscompare (Search)
  KEY_RESERVED   = $0F; // Reserved

{ ---------------------------------------------------------------------
  PERIPHERAL DEVICE TYPE DEFINITIONS
  ---------------------------------------------------------------------}

  DTYPE_DASD    = $00; // Disk Device
  DTYPE_SEQD    = $01; // Tape Device
  DTYPE_PRNT    = $02; // Printer
  DTYPE_PROC    = $03; // Processor
  DTYPE_WORM    = $04; // Write-once read-multiple
  DTYPE_CROM    = $05; // CD-ROM device
  DTYPE_CDROM   = DTYPE_CROM;
  DTYPE_SCAN    = $06; // Scanner device
  DTYPE_OPTI    = $07; // Optical memory device
  DTYPE_JUKE    = $08; // Medium Changer device
  DTYPE_COMM    = $09; // Communications device
  DTYPE_RESL    = $0A; // Reserved (low)
  DTYPE_RESH    = $1E; // Reserved (high)
  DTYPE_UNKNOWN = $1F; // Unknown or no device type

{ ---------------------------------------------------------------------
  ANSI APPROVED VERSION DEFINITIONS
  ---------------------------------------------------------------------}

  ANSI_MAYBE = $0; // Device may or may not be ANSI approved stand
  ANSI_SCSI1 = $1; // Device complies to ANSI X3.131-1986 (SCSI-1)
  ANSI_SCSI2 = $2; // Device complies to SCSI-2
  ANSI_RESLO = $3; // Reserved (low)
  ANSI_RESHI = $7; // Reserved (high)

implementation

end.