mirror of
https://github.com/akuker/RASCSI.git
synced 2024-11-16 08:05:38 +00:00
621cc7d5a2
* Unit test updates * Lambda syntax cleanup * Use new-style casts * Use std::none_of when saving the cache * Use to_integer instead of casts * Use accessors for getting CDB data * Made ctrl_t private * Improved encapsulation * Replaced pointers by references * Removed all remaining occurrences of DWORD and BYTE, making os.h obsolete
56 lines
1.4 KiB
C++
56 lines
1.4 KiB
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator RaSCSI Reloaded
|
|
// for Raspberry Pi
|
|
//
|
|
// Copyright (C) 2022 Uwe Seimet
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "primary_device.h"
|
|
#include <string>
|
|
#include <vector>
|
|
#include <map>
|
|
|
|
class ModePageDevice: public PrimaryDevice
|
|
{
|
|
public:
|
|
|
|
ModePageDevice(PbDeviceType, int);
|
|
~ModePageDevice() override = default;
|
|
|
|
bool Dispatch(scsi_command) override;
|
|
|
|
virtual void ModeSelect(scsi_defs::scsi_command, const vector<int>&, const vector<uint8_t>&, int) const;
|
|
|
|
protected:
|
|
|
|
bool SupportsSaveParameters() const { return supports_save_parameters; }
|
|
void SupportsSaveParameters(bool b) { supports_save_parameters = b; }
|
|
int AddModePages(const vector<int>&, vector<uint8_t>&, int, int, int) const;
|
|
virtual void SetUpModePages(map<int, vector<byte>>&, int, bool) const = 0;
|
|
virtual void AddVendorPage(map<int, vector<byte>>&, int, bool) const {
|
|
// Nothing to add by default
|
|
}
|
|
|
|
private:
|
|
|
|
using super = PrimaryDevice;
|
|
|
|
Dispatcher<ModePageDevice> dispatcher;
|
|
|
|
bool supports_save_parameters = false;
|
|
|
|
virtual int ModeSense6(const vector<int>&, vector<uint8_t>&) const = 0;
|
|
virtual int ModeSense10(const vector<int>&, vector<uint8_t>&) const = 0;
|
|
|
|
void ModeSense6();
|
|
void ModeSense10();
|
|
void ModeSelect6();
|
|
void ModeSelect10();
|
|
|
|
int SaveParametersCheck(int) const;
|
|
};
|