mirror of
https://github.com/akuker/RASCSI.git
synced 2025-01-11 09:29:53 +00:00
Updated inheritance hierarchy, added mmc_device.h
This commit is contained in:
parent
54d4d13dea
commit
4c0ff2b421
@ -11,22 +11,19 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "primary_device.h"
|
|
||||||
|
|
||||||
class SASIDEV;
|
class SASIDEV;
|
||||||
|
|
||||||
// TODO There should also be MMCDevice, and scsicd should be derived from MMCDevice, not from BlockDevice
|
class BlockDevice
|
||||||
class BlockDevice : public PrimaryDevice
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
BlockDevice(const string& id) : PrimaryDevice(id) {};
|
BlockDevice() {};
|
||||||
virtual ~BlockDevice() {};
|
virtual ~BlockDevice() {};
|
||||||
|
|
||||||
// Mandatory commands
|
// Mandatory commands
|
||||||
virtual void TestUnitReady(SASIDEV *) override = 0;
|
virtual void TestUnitReady(SASIDEV *) = 0;
|
||||||
virtual void Inquiry(SASIDEV *) override = 0;
|
virtual void Inquiry(SASIDEV *) = 0;
|
||||||
virtual void ReportLuns(SASIDEV *) override = 0;
|
virtual void ReportLuns(SASIDEV *) = 0;
|
||||||
virtual void FormatUnit(SASIDEV *) = 0;
|
virtual void FormatUnit(SASIDEV *) = 0;
|
||||||
virtual void ReadCapacity10(SASIDEV *) = 0;
|
virtual void ReadCapacity10(SASIDEV *) = 0;
|
||||||
virtual void ReadCapacity16(SASIDEV *) = 0;
|
virtual void ReadCapacity16(SASIDEV *) = 0;
|
||||||
@ -34,15 +31,15 @@ public:
|
|||||||
virtual void Read16(SASIDEV *) = 0;
|
virtual void Read16(SASIDEV *) = 0;
|
||||||
virtual void Write10(SASIDEV *) = 0;
|
virtual void Write10(SASIDEV *) = 0;
|
||||||
virtual void Write16(SASIDEV *) = 0;
|
virtual void Write16(SASIDEV *) = 0;
|
||||||
virtual void RequestSense(SASIDEV *) override = 0;
|
virtual void RequestSense(SASIDEV *) = 0;
|
||||||
|
|
||||||
// Implemented optional commands
|
// Implemented optional commands
|
||||||
virtual void Verify10(SASIDEV *) = 0;
|
virtual void Verify10(SASIDEV *) = 0;
|
||||||
virtual void Verify16(SASIDEV *) = 0;
|
virtual void Verify16(SASIDEV *) = 0;
|
||||||
virtual void ModeSense(SASIDEV *) override = 0;
|
virtual void ModeSense(SASIDEV *) = 0;
|
||||||
virtual void ModeSense10(SASIDEV *) override = 0;
|
virtual void ModeSense10(SASIDEV *) = 0;
|
||||||
virtual void ModeSelect(SASIDEV *) override = 0;
|
virtual void ModeSelect(SASIDEV *) = 0;
|
||||||
virtual void ModeSelect10(SASIDEV *) override = 0;
|
virtual void ModeSelect10(SASIDEV *) = 0;
|
||||||
virtual void ReassignBlocks(SASIDEV *) = 0;
|
virtual void ReassignBlocks(SASIDEV *) = 0;
|
||||||
virtual void SendDiagnostic(SASIDEV *) = 0;
|
virtual void SendDiagnostic(SASIDEV *) = 0;
|
||||||
virtual void StartStopUnit(SASIDEV *) = 0;
|
virtual void StartStopUnit(SASIDEV *) = 0;
|
||||||
|
@ -1076,7 +1076,7 @@ void DiskCache::Update()
|
|||||||
// Constructor
|
// Constructor
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
Disk::Disk(const std::string id) : BlockDevice(id)
|
Disk::Disk(const std::string id) : Device(id), PrimaryDevice(), BlockDevice()
|
||||||
{
|
{
|
||||||
// Work initialization
|
// Work initialization
|
||||||
sector_size_configurable = false;
|
sector_size_configurable = false;
|
||||||
@ -1211,7 +1211,7 @@ void Disk::Open(const Filepath& path)
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool Disk::Eject(bool force)
|
bool Disk::Eject(bool force)
|
||||||
{
|
{
|
||||||
bool status = BlockDevice::Eject(force);
|
bool status = Device::Eject(force);
|
||||||
if (status) {
|
if (status) {
|
||||||
// Remove disk cache
|
// Remove disk cache
|
||||||
disk.dcache->Save();
|
disk.dcache->Save();
|
||||||
|
@ -21,7 +21,9 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "scsi.h"
|
#include "scsi.h"
|
||||||
#include "controllers/scsidev_ctrl.h"
|
#include "controllers/scsidev_ctrl.h"
|
||||||
|
#include "primary_device.h"
|
||||||
#include "block_device.h"
|
#include "block_device.h"
|
||||||
|
#include "device.h"
|
||||||
#include "file_support.h"
|
#include "file_support.h"
|
||||||
#include "filepath.h"
|
#include "filepath.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -124,7 +126,7 @@ private:
|
|||||||
// Disk
|
// Disk
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
class Disk : public BlockDevice
|
class Disk : public Device, public PrimaryDevice, public BlockDevice
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
enum access_mode { RW6, RW10, RW16 };
|
enum access_mode { RW6, RW10, RW16 };
|
||||||
|
25
src/raspberrypi/devices/mmc_device.h
Normal file
25
src/raspberrypi/devices/mmc_device.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// SCSI Target Emulator RaSCSI (*^..^*)
|
||||||
|
// for Raspberry Pi
|
||||||
|
//
|
||||||
|
// Copyright (C) 2021 Uwe Seimet
|
||||||
|
//
|
||||||
|
// An MmcDevice supports SCSI MMC commands (see https://www.t10.org/drafts.htm, MMC-6)
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
class SASIDEV;
|
||||||
|
|
||||||
|
class MmcDevice
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
MmcDevice() {};
|
||||||
|
virtual ~MmcDevice() {};
|
||||||
|
|
||||||
|
virtual void ReadToc(SASIDEV *) = 0;
|
||||||
|
virtual void GetEventStatusNotification(SASIDEV *) = 0;
|
||||||
|
};
|
@ -11,15 +11,13 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "device.h"
|
|
||||||
|
|
||||||
class SASIDEV;
|
class SASIDEV;
|
||||||
|
|
||||||
class PrimaryDevice : public Device
|
class PrimaryDevice
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PrimaryDevice(const string& id) : Device(id) {};
|
PrimaryDevice() {};
|
||||||
virtual ~PrimaryDevice() {};
|
virtual ~PrimaryDevice() {};
|
||||||
|
|
||||||
// Mandatory commands
|
// Mandatory commands
|
||||||
|
@ -224,7 +224,7 @@ bool CDTrack::IsAudio() const
|
|||||||
// Constructor
|
// Constructor
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
SCSICD::SCSICD() : Disk("SCCD")
|
SCSICD::SCSICD() : Disk("SCCD"), MmcDevice(), FileSupport()
|
||||||
{
|
{
|
||||||
SetRemovable(true);
|
SetRemovable(true);
|
||||||
SetReadOnly(true);
|
SetReadOnly(true);
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
#include "primary_device.h"
|
||||||
|
#include "mmc_device.h"
|
||||||
#include "disk.h"
|
#include "disk.h"
|
||||||
#include "filepath.h"
|
#include "filepath.h"
|
||||||
|
|
||||||
@ -67,7 +69,7 @@ private:
|
|||||||
// SCSI CD-ROM
|
// SCSI CD-ROM
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
class SCSICD : public Disk, public FileSupport
|
class SCSICD : public Disk, public MmcDevice, public FileSupport
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
typedef struct _command_t {
|
typedef struct _command_t {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user