SCSIHD.hh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* Ported from:
  2. ** Source: /cvsroot/bluemsx/blueMSX/Src/IoDevice/ScsiDevice.h,v
  3. ** Revision: 1.6
  4. ** Date: 2007-05-22 20:05:38 +0200 (Tue, 22 May 2007)
  5. **
  6. ** More info: http://www.bluemsx.com
  7. **
  8. ** Copyright (C) 2003-2007 Daniel Vik, white cat
  9. */
  10. #ifndef SCSIHD_HH
  11. #define SCSIHD_HH
  12. #include "HD.hh"
  13. #include "SCSIDevice.hh"
  14. namespace openmsx {
  15. class DeviceConfig;
  16. class SCSIHD final : public HD, public SCSIDevice
  17. {
  18. public:
  19. SCSIHD(const SCSIHD&) = delete;
  20. SCSIHD& operator=(const SCSIHD&) = delete;
  21. SCSIHD(const DeviceConfig& targetconfig,
  22. AlignedBuffer& buf, unsigned mode);
  23. template<typename Archive>
  24. void serialize(Archive& ar, unsigned version);
  25. private:
  26. // SCSI Device
  27. void reset() override;
  28. bool isSelected() override;
  29. unsigned executeCmd(const byte* cdb, SCSI::Phase& phase,
  30. unsigned& blocks) override;
  31. unsigned executingCmd(SCSI::Phase& phase, unsigned& blocks) override;
  32. byte getStatusCode() override;
  33. int msgOut(byte value) override;
  34. byte msgIn() override;
  35. void disconnect() override;
  36. void busReset() override;
  37. unsigned dataIn(unsigned& blocks) override;
  38. unsigned dataOut(unsigned& blocks) override;
  39. unsigned inquiry();
  40. unsigned modeSense();
  41. unsigned requestSense();
  42. bool checkReadOnly();
  43. unsigned readCapacity();
  44. bool checkAddress();
  45. unsigned readSectors(unsigned& blocks);
  46. unsigned writeSectors(unsigned& blocks);
  47. void formatUnit();
  48. AlignedBuffer& buffer;
  49. const unsigned mode;
  50. unsigned keycode; // Sense key, ASC, ASCQ
  51. unsigned currentSector;
  52. unsigned currentLength;
  53. const byte scsiId; // SCSI ID 0..7
  54. bool unitAttention; // Unit Attention (was: reset)
  55. byte message;
  56. byte lun;
  57. byte cdb[12]; // Command Descriptor Block
  58. };
  59. } // namespace openmsx
  60. #endif