| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
#ifndef SCSIHD_HH |
| 11 |
#define SCSIHD_HH |
| 12 |
|
| 13 |
#include "HD.hh" |
| 14 |
#include "SCSIDevice.hh" |
| 15 |
#include <array> |
| 16 |
|
| 17 |
namespace openmsx { |
| 18 |
|
| 19 |
class DeviceConfig; |
| 20 |
|
| 21 |
class SCSIHD final : public HD, public SCSIDevice |
| 22 |
{ |
| 23 |
public: |
| 24 |
SCSIHD(const DeviceConfig& targetConfig, |
| 25 |
AlignedBuffer& buf, unsigned mode); |
| 26 |
SCSIHD(const SCSIHD&) = delete; |
| 27 |
SCSIHD(SCSIHD&&) = delete; |
| 28 |
SCSIHD& operator=(const SCSIHD&) = delete; |
| 29 |
SCSIHD& operator=(SCSIHD&&) = delete; |
| 30 |
~SCSIHD() override = default; |
| 31 |
|
| 32 |
template<typename Archive> |
| 33 |
void serialize(Archive& ar, unsigned version); |
| 34 |
|
| 35 |
private: |
| 36 |
|
| 37 |
void reset() override; |
| 38 |
bool isSelected() override; |
| 39 |
[[nodiscard]] unsigned executeCmd(std::span<const uint8_t, 12> cdb, SCSI::Phase& phase, |
| 40 |
unsigned& blocks) override; |
| 41 |
[[nodiscard]] unsigned executingCmd(SCSI::Phase& phase, unsigned& blocks) override; |
| 42 |
[[nodiscard]] uint8_t getStatusCode() override; |
| 43 |
int msgOut(uint8_t value) override; |
| 44 |
uint8_t msgIn() override; |
| 45 |
void disconnect() override; |
| 46 |
void busReset() override; |
| 47 |
|
| 48 |
[[nodiscard]] unsigned dataIn(unsigned& blocks) override; |
| 49 |
[[nodiscard]] unsigned dataOut(unsigned& blocks) override; |
| 50 |
|
| 51 |
[[nodiscard]] unsigned inquiry(); |
| 52 |
[[nodiscard]] unsigned modeSense(); |
| 53 |
[[nodiscard]] unsigned requestSense(); |
| 54 |
[[nodiscard]] bool checkReadOnly(); |
| 55 |
[[nodiscard]] unsigned readCapacity(); |
| 56 |
[[nodiscard]] bool checkAddress(); |
| 57 |
[[nodiscard]] unsigned readSectors(unsigned& blocks); |
| 58 |
[[nodiscard]] unsigned writeSectors(unsigned& blocks); |
| 59 |
void formatUnit(); |
| 60 |
|
| 61 |
private: |
| 62 |
AlignedBuffer& buffer; |
| 63 |
|
| 64 |
const unsigned mode; |
| 65 |
|
| 66 |
unsigned keycode; |
| 67 |
unsigned currentSector; |
| 68 |
unsigned currentLength; |
| 69 |
|
| 70 |
const uint8_t scsiId; |
| 71 |
bool unitAttention; |
| 72 |
uint8_t message = 0; |
| 73 |
uint8_t lun = 0; |
| 74 |
std::array<uint8_t, 12> cdb; |
| 75 |
}; |
| 76 |
|
| 77 |
} |
| 78 |
|
| 79 |
#endif |