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