2022-02-10 18:54:48 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SCSI Target Emulator RaSCSI (*^..^*)
|
|
|
|
// for Raspberry Pi
|
|
|
|
//
|
|
|
|
// Copyright (C) 2022 Uwe Seimet
|
|
|
|
//
|
|
|
|
// A device implementing mandatory SCSI primary commands, to be used for subclassing
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-02-13 19:30:02 +00:00
|
|
|
#include "controllers/scsidev_ctrl.h"
|
2022-02-10 18:54:48 +00:00
|
|
|
#include "interfaces/scsi_primary_commands.h"
|
|
|
|
#include "device.h"
|
2022-02-13 19:30:02 +00:00
|
|
|
#include "dispatcher.h"
|
2022-02-10 18:54:48 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
class PrimaryDevice: public Device, virtual public ScsiPrimaryCommands
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2022-02-13 19:30:02 +00:00
|
|
|
PrimaryDevice(const string&);
|
2022-02-10 18:54:48 +00:00
|
|
|
virtual ~PrimaryDevice() {}
|
|
|
|
|
2022-02-13 19:30:02 +00:00
|
|
|
virtual bool Dispatch(SCSIDEV *);
|
2022-02-10 18:54:48 +00:00
|
|
|
|
|
|
|
void TestUnitReady(SASIDEV *);
|
|
|
|
void RequestSense(SASIDEV *);
|
2022-03-06 15:17:23 +00:00
|
|
|
virtual void Inquiry(SASIDEV *);
|
2022-02-10 18:54:48 +00:00
|
|
|
|
2022-02-13 19:30:02 +00:00
|
|
|
void SetCtrl(SASIDEV::ctrl_t *ctrl) { this->ctrl = ctrl; }
|
|
|
|
|
2022-02-10 18:54:48 +00:00
|
|
|
bool CheckReady();
|
2022-03-02 02:25:22 +00:00
|
|
|
virtual vector<BYTE> Inquiry() const = 0;
|
|
|
|
virtual vector<BYTE> RequestSense(int);
|
2022-02-17 02:04:42 +00:00
|
|
|
virtual bool WriteBytes(BYTE *, uint32_t);
|
2022-03-02 02:25:22 +00:00
|
|
|
virtual int GetSendDelay() const { return BUS::SEND_NO_DELAY; }
|
2022-02-10 18:54:48 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2022-03-02 17:31:42 +00:00
|
|
|
vector<BYTE> Inquiry(scsi_defs::device_type, scsi_level, bool) const;
|
2022-02-13 19:30:02 +00:00
|
|
|
|
2022-02-10 18:54:48 +00:00
|
|
|
SASIDEV::ctrl_t *ctrl;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2022-02-17 02:04:42 +00:00
|
|
|
Dispatcher<PrimaryDevice, SASIDEV> dispatcher;
|
2022-02-10 18:54:48 +00:00
|
|
|
|
|
|
|
void ReportLuns(SASIDEV *);
|
|
|
|
};
|