OXYGENHUB
◆ main openmsx / src / ide / WD33C93.hh
1.2 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
e8555c89 Andy McCall 1
/* Ported from:
2
** Source: /cvsroot/bluemsx/blueMSX/Src/IoDevice/wd33c93.h,v
3
** Revision: 1.6
4
** Date: 2007/03/22 10:55:08
5
**
6
** More info: http://www.bluemsx.com
7
**
8
** Copyright (C) 2003-2007 Daniel Vik, Ricardo Bittencourt, white cat
9
*/
10
11
#ifndef WD33C93_HH
12
#define WD33C93_HH
13
14
#include "SCSI.hh"
15
#include "SCSIDevice.hh"
16
17
#include "AlignedBuffer.hh"
18
19
#include <array>
20
#include <memory>
21
22
namespace openmsx {
23
24
class DeviceConfig;
25
26
class WD33C93
27
{
28
public:
29
	explicit WD33C93(DeviceConfig& config);
30
31
	void reset(bool scsiReset);
32
33
	[[nodiscard]] uint8_t readAuxStatus();
34
	[[nodiscard]] uint8_t readCtrl();
35
	[[nodiscard]] uint8_t peekAuxStatus() const;
36
	[[nodiscard]] uint8_t peekCtrl() const;
37
	void writeAdr(uint8_t value);
38
	void writeCtrl(uint8_t value);
39
40
	template<typename Archive>
41
	void serialize(Archive& ar, unsigned version);
42
43
private:
44
	void disconnect();
45
	void execCmd(uint8_t value);
46
47
private:
48
	AlignedByteArray<SCSIDevice::BUFFER_SIZE> buffer;
49
	std::array<std::unique_ptr<SCSIDevice>, 8> dev;
50
	unsigned bufIdx;
51
	unsigned counter = 0;
52
	unsigned blockCounter = 0;
53
	int tc;
54
	SCSI::Phase phase;
55
	uint8_t myId;
56
	uint8_t targetId = 0;
57
	std::array<uint8_t, 32> regs;
58
	uint8_t latch;
59
	bool devBusy = false;
60
};
61
62
} // namespace openmsx
63
64
#endif