openMSX
SCSIHD.hh
Go to the documentation of this file.
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 
13 #include "HD.hh"
14 #include "SCSIDevice.hh"
15 
16 namespace openmsx {
17 
18 class DeviceConfig;
19 
20 class SCSIHD final : public HD, public SCSIDevice
21 {
22 public:
23  SCSIHD(const SCSIHD&) = delete;
24  SCSIHD& operator=(const SCSIHD&) = delete;
25 
26  SCSIHD(const DeviceConfig& targetconfig,
27  AlignedBuffer& buf, unsigned mode);
28 
29  template<typename Archive>
30  void serialize(Archive& ar, unsigned version);
31 
32 private:
33  // SCSI Device
34  void reset() override;
35  bool isSelected() override;
36  unsigned executeCmd(const byte* cdb, SCSI::Phase& phase,
37  unsigned& blocks) override;
38  unsigned executingCmd(SCSI::Phase& phase, unsigned& blocks) override;
39  byte getStatusCode() override;
40  int msgOut(byte value) override;
41  byte msgIn() override;
42  void disconnect() override;
43  void busReset() override;
44 
45  unsigned dataIn(unsigned& blocks) override;
46  unsigned dataOut(unsigned& blocks) override;
47 
48  unsigned inquiry();
49  unsigned modeSense();
50  unsigned requestSense();
51  bool checkReadOnly();
52  unsigned readCapacity();
53  bool checkAddress();
54  unsigned readSectors(unsigned& blocks);
55  unsigned writeSectors(unsigned& blocks);
56  void formatUnit();
57 
58  AlignedBuffer& buffer;
59 
60  const unsigned mode;
61 
62  unsigned keycode; // Sense key, ASC, ASCQ
63  unsigned currentSector;
64  unsigned currentLength;
65 
66  const byte scsiId; // SCSI ID 0..7
67  bool unitAttention; // Unit Attention (was: reset)
68  byte message;
69  byte lun;
70  byte cdb[12]; // Command Descriptor Block
71 };
72 
73 } // namespace openmsx
74 
75 #endif
void serialize(Archive &ar, unsigned version)
Definition: SCSIHD.cc:567
SCSIHD & operator=(const SCSIHD &)=delete
SCSIHD(const SCSIHD &)=delete
uint8_t byte
8 bit unsigned integer
Definition: openmsx.hh:26
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5