openMSX
SCSI.hh
Go to the documentation of this file.
1 /* Ported from:
2 ** Source: /cvsroot/bluemsx/blueMSX/Src/IoDevice/ScsiDefs.h,v
3 ** Revision: 1.2
4 ** Date: 2007/03/24 08:01:48
5 **
6 ** More info: http://www.bluemsx.com
7 **
8 ** Copyright (C) 2003-2007 Daniel Vik, white cat
9 */
10 #ifndef SCSI_HH
11 #define SCSI_HH
12 
13 #include "openmsx.hh"
14 
15 namespace openmsx {
16 namespace SCSI {
17 
18 // Group 0: 6bytes cdb
19 static const byte OP_TEST_UNIT_READY = 0x00;
20 static const byte OP_REZERO_UNIT = 0x01;
21 static const byte OP_REQUEST_SENSE = 0x03;
22 static const byte OP_FORMAT_UNIT = 0x04;
23 static const byte OP_REASSIGN_BLOCKS = 0x07;
24 static const byte OP_READ6 = 0x08;
25 static const byte OP_WRITE6 = 0x0A;
26 static const byte OP_SEEK6 = 0x0B;
27 static const byte OP_INQUIRY = 0x12;
28 static const byte OP_RESERVE_UNIT = 0x16;
29 static const byte OP_RELEASE_UNIT = 0x17;
30 static const byte OP_MODE_SENSE = 0x1A;
31 static const byte OP_START_STOP_UNIT = 0x1B;
32 static const byte OP_SEND_DIAGNOSTIC = 0x1D;
33 
34 // Group 1: 10bytes cdb
35 static const byte OP_GROUP1 = 0x20;
36 static const byte OP_READ_CAPACITY = 0x25;
37 static const byte OP_READ10 = 0x28;
38 static const byte OP_WRITE10 = 0x2A;
39 static const byte OP_SEEK10 = 0x2B;
40 
41 static const byte OP_GROUP2 = 0x40;
42 static const byte OP_CHANGE_DEFINITION = 0x40;
43 static const byte OP_READ_SUB_CHANNEL = 0x42;
44 static const byte OP_READ_TOC = 0x43;
45 static const byte OP_READ_HEADER = 0x44;
46 static const byte OP_PLAY_AUDIO = 0x45;
47 static const byte OP_PLAY_AUDIO_MSF = 0x47;
48 static const byte OP_PLAY_TRACK_INDEX = 0x48;
49 static const byte OP_PLAY_TRACK_RELATIVE = 0x49;
50 static const byte OP_PAUSE_RESUME = 0x4B;
51 
52 static const byte OP_PLAY_AUDIO12 = 0xA5;
53 static const byte OP_READ12 = 0xA8;
54 static const byte OP_PLAY_TRACK_RELATIVE12 = 0xA9;
55 static const byte OP_READ_CD_MSF = 0xB9;
56 static const byte OP_READ_CD = 0xBE;
57 
58 // Sense data KEY | ASC | ASCQ
59 static const unsigned SENSE_NO_SENSE = 0x000000;
60 static const unsigned SENSE_NOT_READY = 0x020400;
61 static const unsigned SENSE_MEDIUM_NOT_PRESENT = 0x023a00;
62 static const unsigned SENSE_UNRECOVERED_READ_ERROR = 0x031100;
63 static const unsigned SENSE_WRITE_FAULT = 0x040300;
64 static const unsigned SENSE_INVALID_COMMAND_CODE = 0x052000;
65 static const unsigned SENSE_ILLEGAL_BLOCK_ADDRESS = 0x052100;
66 static const unsigned SENSE_INVALID_LUN = 0x052500;
67 static const unsigned SENSE_POWER_ON = 0x062900;
68 static const unsigned SENSE_WRITE_PROTECT = 0x072700;
69 static const unsigned SENSE_MESSAGE_REJECT_ERROR = 0x0b4300;
70 static const unsigned SENSE_INITIATOR_DETECTED_ERR = 0x0b4800;
71 static const unsigned SENSE_ILLEGAL_MESSAGE = 0x0b4900;
72 
73 // Message
74 static const byte MSG_COMMAND_COMPLETE = 0x00;
75 static const byte MSG_INITIATOR_DETECT_ERROR = 0x05;
76 static const byte MSG_ABORT = 0x06;
77 static const byte MSG_REJECT = 0x07;
78 static const byte MSG_NO_OPERATION = 0x08;
79 static const byte MSG_PARITY_ERROR = 0x09;
80 static const byte MSG_BUS_DEVICE_RESET = 0x0c;
81 
82 // Status
83 static const byte ST_GOOD = 0;
84 static const byte ST_CHECK_CONDITION = 2;
85 static const byte ST_BUSY = 8;
86 
87 // Device type
88 static const byte DT_DirectAccess = 0x00;
89 static const byte DT_SequencialAccess = 0x01;
90 static const byte DT_Printer = 0x02;
91 static const byte DT_Processor = 0x03;
92 static const byte DT_WriteOnce = 0x04;
93 static const byte DT_CDROM = 0x05;
94 static const byte DT_Scanner = 0x06;
95 static const byte DT_OpticalMemory = 0x07;
96 static const byte DT_MediaChanger = 0x08;
97 static const byte DT_Communications = 0x09;
98 static const byte DT_Undefined = 0x1f;
99 
100 enum Phase {
101  UNDEFINED, // used in MB89532
113 };
114 
115 } // namespace SCSI
116 } // namespace openmsx
117 
118 #endif
unsigned char byte
8 bit unsigned integer
Definition: openmsx.hh:33
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:7