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-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();
|
|
|
|
virtual int Inquiry(const DWORD *, BYTE *) = 0;
|
|
|
|
virtual int RequestSense(const DWORD *, BYTE *);
|
2022-02-17 02:04:42 +00:00
|
|
|
virtual bool WriteBytes(BYTE *, uint32_t);
|
2022-02-27 21:58:01 +00:00
|
|
|
virtual int GetSendDelay() { return BUS::SEND_NO_DELAY; }
|
2022-02-10 18:54:48 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2022-02-21 20:01:17 +00:00
|
|
|
int Inquiry(int, int, bool, const DWORD *, BYTE *);
|
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 Inquiry(SASIDEV *);
|
|
|
|
void ReportLuns(SASIDEV *);
|
|
|
|
};
|