SCSI.hh 3.9 KB

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