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  [[nodiscard]] unsigned executeCmd(const byte* cdb, SCSI::Phase& phase,
37  unsigned& blocks) override;
38  [[nodiscard]] unsigned executingCmd(SCSI::Phase& phase, unsigned& blocks) override;
39  [[nodiscard]] byte getStatusCode() override;
40  int msgOut(byte value) override;
41  byte msgIn() override;
42  void disconnect() override;
43  void busReset() override;
44 
45  [[nodiscard]] unsigned dataIn(unsigned& blocks) override;
46  [[nodiscard]] unsigned dataOut(unsigned& blocks) override;
47 
48  [[nodiscard]] unsigned inquiry();
49  [[nodiscard]] unsigned modeSense();
50  [[nodiscard]] unsigned requestSense();
51  [[nodiscard]] bool checkReadOnly();
52  [[nodiscard]] unsigned readCapacity();
53  [[nodiscard]] bool checkAddress();
54  [[nodiscard]] unsigned readSectors(unsigned& blocks);
55  [[nodiscard]] unsigned writeSectors(unsigned& blocks);
56  void formatUnit();
57 
58 private:
59  AlignedBuffer& buffer;
60 
61  const unsigned mode;
62 
63  unsigned keycode; // Sense key, ASC, ASCQ
64  unsigned currentSector;
65  unsigned currentLength;
66 
67  const byte scsiId; // SCSI ID 0..7
68  bool unitAttention; // Unit Attention (was: reset)
69  byte message;
70  byte lun;
71  byte cdb[12]; // Command Descriptor Block
72 };
73 
74 } // namespace openmsx
75 
76 #endif
void serialize(Archive &ar, unsigned version)
Definition: SCSIHD.cc:571
SCSIHD(const SCSIHD &)=delete
SCSIHD & operator=(const SCSIHD &)=delete
This file implemented 3 utility functions:
Definition: Autofire.cc:9