OXYGENHUB
◆ main openmsx / src / ide / SCSIDevice.hh
1.5 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
e8555c89 Andy McCall 1
#ifndef SCSIDEVICE_HH
2
#define SCSIDEVICE_HH
3
4
#include "SCSI.hh"
5
#include <span>
6
7
namespace openmsx {
8
9
class SCSIDevice
10
{
11
public:
12
	static constexpr unsigned BIT_SCSI2          = 0x0001;
13
	static constexpr unsigned BIT_SCSI2_ONLY     = 0x0002;
14
	static constexpr unsigned BIT_SCSI3          = 0x0004;
15
16
	static constexpr unsigned MODE_SCSI1         = 0x0000;
17
	static constexpr unsigned MODE_SCSI2         = 0x0003;
18
	static constexpr unsigned MODE_SCSI3         = 0x0005;
19
	static constexpr unsigned MODE_UNITATTENTION = 0x0008; // report unit attention
20
	static constexpr unsigned MODE_MEGASCSI      = 0x0010; // report disk change when call of
21
	                                              // 'test unit ready'
22
	static constexpr unsigned MODE_NOVAXIS       = 0x0100;
23
24
	static constexpr unsigned BUFFER_SIZE   = 0x10000; // 64KB
25
26
	virtual ~SCSIDevice() = default;
27
28
	virtual void reset() = 0;
29
	virtual bool isSelected() = 0;
30
	[[nodiscard]] virtual unsigned executeCmd(std::span<const uint8_t, 12> cdb, SCSI::Phase& phase,
31
	                                          unsigned& blocks) = 0;
32
	[[nodiscard]] virtual unsigned executingCmd(SCSI::Phase& phase, unsigned& blocks) = 0;
33
	[[nodiscard]] virtual uint8_t getStatusCode() = 0;
34
	virtual int msgOut(uint8_t value) = 0;
35
	virtual uint8_t msgIn() = 0;
36
	virtual void disconnect() = 0;
37
	virtual void busReset() = 0; // only used in MB89352 controller
38
39
	[[nodiscard]] virtual unsigned dataIn(unsigned& blocks) = 0;
40
	[[nodiscard]] virtual unsigned dataOut(unsigned& blocks) = 0;
41
};
42
43
} // namespace openmsx
44
45
#endif