mirror of
https://github.com/akuker/RASCSI.git
synced 2024-05-29 01:41:27 +00:00
5622694701
* Initial RTC skeleton * Added device info * Added TEST UNIT READY * Fixed command dispatcher * First untested naive implementation * Comment update * Code cleanup * More code cleanup * Updated date/time encoding * Updated versioning * Use standard RaSCSI INQUIRY version for SCRT device * Manpage update * Added shortcut for SCRT type * Added support for rtc "filename" * RTC supports LUNs > 0 * Fixed LUN count * Renaming * Renaming * Manpage update * Initial naive implementation * SCRA is removable * Updated command list * Added controller field * Shut down works, bus free phase is not yet entered * Clear caches on shutdown * Expose BusFree() * Moved code * Logging update * Moved code * Moved code * Added comment * Logging update * Code cleanup * Service device is not removable anymore (was only needed for testing) * Manpage update * Added comment * Comment update * Version update * Renaming * Comment update * Comment update * Renaming * Fixed typo * Added convenience method * Property handling optimization * Code cleanup * Code cleanup * Code cleanup, introduced base class * Added TODO * More code cleanup * Removed unnecessary assignments * Moved code * Removed forward declaration * Added base class * INclude cleanup * Moved scsi_command enum * Fixed warnings * Addressing circular dependencies * Removed duplicate enum * include file cleanup * Include cleanup * Reduced dependencies to Disk class (replaced by Device), fixed TODO * Include cleanup * PrimaryDevice implements ReportLuns * Inheritance update * Removed duplicate code * Moved code to base class * Cleanup * Removed duplicate field * Updated command dispatchign * Comment update * Moved code * Updated method visibilities * Moved MODE SENSE/MODE SELECT base code
57 lines
1.3 KiB
C++
57 lines
1.3 KiB
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// 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
|
|
|
|
#include "controllers/sasidev_ctrl.h"
|
|
#include "interfaces/scsi_primary_commands.h"
|
|
#include "device.h"
|
|
#include <string>
|
|
#include <map>
|
|
|
|
using namespace std;
|
|
|
|
class PrimaryDevice: public Device, virtual public ScsiPrimaryCommands
|
|
{
|
|
public:
|
|
|
|
PrimaryDevice(const string);
|
|
virtual ~PrimaryDevice() {}
|
|
|
|
virtual bool Dispatch(SCSIDEV *) override;
|
|
|
|
void TestUnitReady(SASIDEV *);
|
|
void RequestSense(SASIDEV *);
|
|
|
|
bool CheckReady();
|
|
virtual int Inquiry(const DWORD *, BYTE *) = 0;
|
|
virtual int RequestSense(const DWORD *, BYTE *);
|
|
|
|
protected:
|
|
|
|
SASIDEV::ctrl_t *ctrl;
|
|
|
|
private:
|
|
|
|
typedef struct _command_t {
|
|
const char* name;
|
|
void (PrimaryDevice::*execute)(SASIDEV *);
|
|
|
|
_command_t(const char* _name, void (PrimaryDevice::*_execute)(SASIDEV *)) : name(_name), execute(_execute) { };
|
|
} command_t;
|
|
std::map<ScsiDefs::scsi_command, command_t*> commands;
|
|
|
|
void AddCommand(ScsiDefs::scsi_command, const char*, void (PrimaryDevice::*)(SASIDEV *));
|
|
|
|
void Inquiry(SASIDEV *);
|
|
void ReportLuns(SASIDEV *);
|
|
};
|