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::SCSI {
16 
17 // Group 0: 6bytes cdb
18 constexpr byte OP_TEST_UNIT_READY = 0x00;
19 constexpr byte OP_REZERO_UNIT = 0x01;
20 constexpr byte OP_REQUEST_SENSE = 0x03;
21 constexpr byte OP_FORMAT_UNIT = 0x04;
22 constexpr byte OP_REASSIGN_BLOCKS = 0x07;
23 constexpr byte OP_READ6 = 0x08;
24 constexpr byte OP_WRITE6 = 0x0A;
25 constexpr byte OP_SEEK6 = 0x0B;
26 constexpr byte OP_INQUIRY = 0x12;
27 constexpr byte OP_RESERVE_UNIT = 0x16;
28 constexpr byte OP_RELEASE_UNIT = 0x17;
29 constexpr byte OP_MODE_SENSE = 0x1A;
30 constexpr byte OP_START_STOP_UNIT = 0x1B;
31 constexpr byte OP_SEND_DIAGNOSTIC = 0x1D;
32 
33 // Group 1: 10bytes cdb
34 constexpr byte OP_GROUP1 = 0x20;
35 constexpr byte OP_READ_CAPACITY = 0x25;
36 constexpr byte OP_READ10 = 0x28;
37 constexpr byte OP_WRITE10 = 0x2A;
38 constexpr byte OP_SEEK10 = 0x2B;
39 
40 constexpr byte OP_GROUP2 = 0x40;
41 constexpr byte OP_CHANGE_DEFINITION = 0x40;
42 constexpr byte OP_READ_SUB_CHANNEL = 0x42;
43 constexpr byte OP_READ_TOC = 0x43;
44 constexpr byte OP_READ_HEADER = 0x44;
45 constexpr byte OP_PLAY_AUDIO = 0x45;
46 constexpr byte OP_PLAY_AUDIO_MSF = 0x47;
47 constexpr byte OP_PLAY_TRACK_INDEX = 0x48;
48 constexpr byte OP_PLAY_TRACK_RELATIVE = 0x49;
49 constexpr byte OP_PAUSE_RESUME = 0x4B;
50 
51 constexpr byte OP_PLAY_AUDIO12 = 0xA5;
52 constexpr byte OP_READ12 = 0xA8;
53 constexpr byte OP_PLAY_TRACK_RELATIVE12 = 0xA9;
54 constexpr byte OP_READ_CD_MSF = 0xB9;
55 constexpr byte OP_READ_CD = 0xBE;
56 
57 // Sense data KEY | ASC | ASCQ
58 constexpr unsigned SENSE_NO_SENSE = 0x000000;
59 constexpr unsigned SENSE_NOT_READY = 0x020400;
60 constexpr unsigned SENSE_MEDIUM_NOT_PRESENT = 0x023a00;
61 constexpr unsigned SENSE_UNRECOVERED_READ_ERROR = 0x031100;
62 constexpr unsigned SENSE_WRITE_FAULT = 0x040300;
63 constexpr unsigned SENSE_INVALID_COMMAND_CODE = 0x052000;
64 constexpr unsigned SENSE_ILLEGAL_BLOCK_ADDRESS = 0x052100;
65 constexpr unsigned SENSE_INVALID_LUN = 0x052500;
66 constexpr unsigned SENSE_POWER_ON = 0x062900;
67 constexpr unsigned SENSE_WRITE_PROTECT = 0x072700;
68 constexpr unsigned SENSE_MESSAGE_REJECT_ERROR = 0x0b4300;
69 constexpr unsigned SENSE_INITIATOR_DETECTED_ERR = 0x0b4800;
70 constexpr unsigned SENSE_ILLEGAL_MESSAGE = 0x0b4900;
71 
72 // Message
73 constexpr byte MSG_COMMAND_COMPLETE = 0x00;
75 constexpr byte MSG_ABORT = 0x06;
76 constexpr byte MSG_REJECT = 0x07;
77 constexpr byte MSG_NO_OPERATION = 0x08;
78 constexpr byte MSG_PARITY_ERROR = 0x09;
79 constexpr byte MSG_BUS_DEVICE_RESET = 0x0c;
80 
81 // Status
82 constexpr byte ST_GOOD = 0;
83 constexpr byte ST_CHECK_CONDITION = 2;
84 constexpr byte ST_BUSY = 8;
85 
86 // Device type
87 constexpr byte DT_DirectAccess = 0x00;
88 constexpr byte DT_SequencialAccess = 0x01;
89 constexpr byte DT_Printer = 0x02;
90 constexpr byte DT_Processor = 0x03;
91 constexpr byte DT_WriteOnce = 0x04;
92 constexpr byte DT_CDROM = 0x05;
93 constexpr byte DT_Scanner = 0x06;
94 constexpr byte DT_OpticalMemory = 0x07;
95 constexpr byte DT_MediaChanger = 0x08;
96 constexpr byte DT_Communications = 0x09;
97 constexpr byte DT_Undefined = 0x1f;
98 
99 enum Phase {
100  UNDEFINED, // used in MB89532
112 };
113 
114 } // namespace openmsx::SCSI
115 
116 #endif
constexpr byte DT_DirectAccess
Definition: SCSI.hh:87
constexpr byte DT_CDROM
Definition: SCSI.hh:92
constexpr unsigned SENSE_MESSAGE_REJECT_ERROR
Definition: SCSI.hh:68
constexpr byte OP_RESERVE_UNIT
Definition: SCSI.hh:27
constexpr byte OP_READ_SUB_CHANNEL
Definition: SCSI.hh:42
constexpr byte OP_GROUP1
Definition: SCSI.hh:34
constexpr byte DT_OpticalMemory
Definition: SCSI.hh:94
constexpr byte DT_Undefined
Definition: SCSI.hh:97
constexpr byte DT_Printer
Definition: SCSI.hh:89
constexpr byte OP_INQUIRY
Definition: SCSI.hh:26
constexpr byte DT_MediaChanger
Definition: SCSI.hh:95
constexpr byte ST_CHECK_CONDITION
Definition: SCSI.hh:83
constexpr byte OP_CHANGE_DEFINITION
Definition: SCSI.hh:41
constexpr byte OP_PLAY_AUDIO_MSF
Definition: SCSI.hh:46
constexpr byte OP_PLAY_TRACK_INDEX
Definition: SCSI.hh:47
constexpr byte DT_SequencialAccess
Definition: SCSI.hh:88
constexpr byte OP_SEEK10
Definition: SCSI.hh:38
constexpr byte OP_READ6
Definition: SCSI.hh:23
constexpr byte OP_SEEK6
Definition: SCSI.hh:25
constexpr unsigned SENSE_INVALID_COMMAND_CODE
Definition: SCSI.hh:63
constexpr byte OP_READ_CD
Definition: SCSI.hh:55
uint8_t byte
8 bit unsigned integer
Definition: openmsx.hh:26
constexpr byte DT_Scanner
Definition: SCSI.hh:93
constexpr byte OP_RELEASE_UNIT
Definition: SCSI.hh:28
constexpr byte OP_WRITE10
Definition: SCSI.hh:37
constexpr byte OP_TEST_UNIT_READY
Definition: SCSI.hh:18
constexpr byte OP_PLAY_TRACK_RELATIVE12
Definition: SCSI.hh:53
constexpr byte ST_GOOD
Definition: SCSI.hh:82
constexpr byte OP_MODE_SENSE
Definition: SCSI.hh:29
constexpr byte OP_READ10
Definition: SCSI.hh:36
constexpr unsigned SENSE_WRITE_PROTECT
Definition: SCSI.hh:67
constexpr byte MSG_ABORT
Definition: SCSI.hh:75
constexpr byte DT_Communications
Definition: SCSI.hh:96
constexpr unsigned SENSE_UNRECOVERED_READ_ERROR
Definition: SCSI.hh:61
constexpr byte MSG_INITIATOR_DETECT_ERROR
Definition: SCSI.hh:74
constexpr byte OP_PLAY_AUDIO
Definition: SCSI.hh:45
constexpr unsigned SENSE_ILLEGAL_MESSAGE
Definition: SCSI.hh:70
constexpr byte OP_PLAY_AUDIO12
Definition: SCSI.hh:51
constexpr byte OP_PLAY_TRACK_RELATIVE
Definition: SCSI.hh:48
constexpr byte MSG_COMMAND_COMPLETE
Definition: SCSI.hh:73
constexpr unsigned SENSE_WRITE_FAULT
Definition: SCSI.hh:62
constexpr byte OP_READ_TOC
Definition: SCSI.hh:43
constexpr unsigned SENSE_INITIATOR_DETECTED_ERR
Definition: SCSI.hh:69
constexpr unsigned SENSE_NOT_READY
Definition: SCSI.hh:59
constexpr byte MSG_PARITY_ERROR
Definition: SCSI.hh:78
constexpr byte DT_WriteOnce
Definition: SCSI.hh:91
constexpr unsigned SENSE_MEDIUM_NOT_PRESENT
Definition: SCSI.hh:60
constexpr byte OP_FORMAT_UNIT
Definition: SCSI.hh:21
constexpr byte DT_Processor
Definition: SCSI.hh:90
constexpr unsigned SENSE_ILLEGAL_BLOCK_ADDRESS
Definition: SCSI.hh:64
constexpr byte OP_READ12
Definition: SCSI.hh:52
constexpr byte OP_READ_CAPACITY
Definition: SCSI.hh:35
constexpr byte OP_PAUSE_RESUME
Definition: SCSI.hh:49
constexpr byte OP_READ_HEADER
Definition: SCSI.hh:44
constexpr byte OP_REQUEST_SENSE
Definition: SCSI.hh:20
constexpr byte MSG_REJECT
Definition: SCSI.hh:76
constexpr byte OP_SEND_DIAGNOSTIC
Definition: SCSI.hh:31
constexpr byte OP_READ_CD_MSF
Definition: SCSI.hh:54
constexpr byte OP_REASSIGN_BLOCKS
Definition: SCSI.hh:22
constexpr byte MSG_BUS_DEVICE_RESET
Definition: SCSI.hh:79
constexpr byte OP_GROUP2
Definition: SCSI.hh:40
constexpr byte OP_REZERO_UNIT
Definition: SCSI.hh:19
constexpr unsigned SENSE_INVALID_LUN
Definition: SCSI.hh:65
constexpr byte MSG_NO_OPERATION
Definition: SCSI.hh:77
constexpr unsigned SENSE_POWER_ON
Definition: SCSI.hh:66
constexpr byte OP_START_STOP_UNIT
Definition: SCSI.hh:30
constexpr byte ST_BUSY
Definition: SCSI.hh:84
constexpr byte OP_WRITE6
Definition: SCSI.hh:24
constexpr unsigned SENSE_NO_SENSE
Definition: SCSI.hh:58