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#include <array>
16
17namespace openmsx {
18
19class DeviceConfig;
20
21class SCSIHD final : public HD, public SCSIDevice
22{
23public:
24 SCSIHD(const SCSIHD&) = delete;
25 SCSIHD& operator=(const SCSIHD&) = delete;
26
27 SCSIHD(const DeviceConfig& targetConfig,
28 AlignedBuffer& buf, unsigned mode);
29
30 template<typename Archive>
31 void serialize(Archive& ar, unsigned version);
32
33private:
34 // SCSI Device
35 void reset() override;
36 bool isSelected() override;
37 [[nodiscard]] unsigned executeCmd(std::span<const uint8_t, 12> cdb, SCSI::Phase& phase,
38 unsigned& blocks) override;
39 [[nodiscard]] unsigned executingCmd(SCSI::Phase& phase, unsigned& blocks) override;
40 [[nodiscard]] uint8_t getStatusCode() override;
41 int msgOut(uint8_t value) override;
42 uint8_t msgIn() override;
43 void disconnect() override;
44 void busReset() override;
45
46 [[nodiscard]] unsigned dataIn(unsigned& blocks) override;
47 [[nodiscard]] unsigned dataOut(unsigned& blocks) override;
48
49 [[nodiscard]] unsigned inquiry();
50 [[nodiscard]] unsigned modeSense();
51 [[nodiscard]] unsigned requestSense();
52 [[nodiscard]] bool checkReadOnly();
53 [[nodiscard]] unsigned readCapacity();
54 [[nodiscard]] bool checkAddress();
55 [[nodiscard]] unsigned readSectors(unsigned& blocks);
56 [[nodiscard]] unsigned writeSectors(unsigned& blocks);
57 void formatUnit();
58
59private:
60 AlignedBuffer& buffer;
61
62 const unsigned mode;
63
64 unsigned keycode; // Sense key, ASC, ASCQ
65 unsigned currentSector;
66 unsigned currentLength;
67
68 const uint8_t scsiId; // SCSI ID 0..7
69 bool unitAttention; // Unit Attention (was: reset)
70 uint8_t message;
71 uint8_t lun;
72 std::array<uint8_t, 12> cdb; // Command Descriptor Block
73};
74
75} // namespace openmsx
76
77#endif
void serialize(Archive &ar, unsigned version)
Definition SCSIHD.cc:571
SCSIHD & operator=(const SCSIHD &)=delete
SCSIHD(const SCSIHD &)=delete
This file implemented 3 utility functions:
Definition Autofire.cc:11