2022-02-10 18:54:48 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
2022-12-05 17:58:23 +00:00
|
|
|
// SCSI Target Emulator PiSCSI
|
2022-02-10 18:54:48 +00:00
|
|
|
// for Raspberry Pi
|
|
|
|
//
|
2023-10-15 06:38:15 +00:00
|
|
|
// Copyright (C) 2022-2023 Uwe Seimet
|
2022-02-10 18:54:48 +00:00
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "primary_device.h"
|
|
|
|
#include <string>
|
2023-10-15 06:38:15 +00:00
|
|
|
#include <span>
|
2022-02-27 21:58:01 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
2022-02-10 18:54:48 +00:00
|
|
|
|
2022-11-02 14:36:19 +00:00
|
|
|
class ModePageDevice : public PrimaryDevice
|
2022-02-10 18:54:48 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2022-11-02 14:36:19 +00:00
|
|
|
using PrimaryDevice::PrimaryDevice;
|
2022-02-10 18:54:48 +00:00
|
|
|
|
2023-10-15 06:38:15 +00:00
|
|
|
bool Init(const param_map&) override;
|
2022-09-07 14:38:42 +00:00
|
|
|
|
2023-10-15 06:38:15 +00:00
|
|
|
virtual void ModeSelect(scsi_defs::scsi_command, cdb_t, span<const uint8_t>, int) const;
|
2022-02-10 18:54:48 +00:00
|
|
|
|
2022-02-27 21:58:01 +00:00
|
|
|
protected:
|
|
|
|
|
2022-10-23 19:51:39 +00:00
|
|
|
bool SupportsSaveParameters() const { return supports_save_parameters; }
|
|
|
|
void SupportsSaveParameters(bool b) { supports_save_parameters = b; }
|
2023-10-15 06:38:15 +00:00
|
|
|
int AddModePages(cdb_t, vector<uint8_t>&, int, int, int) const;
|
2022-09-25 21:49:24 +00:00
|
|
|
virtual void SetUpModePages(map<int, vector<byte>>&, int, bool) const = 0;
|
2022-10-23 19:51:39 +00:00
|
|
|
virtual void AddVendorPage(map<int, vector<byte>>&, int, bool) const {
|
|
|
|
// Nothing to add by default
|
|
|
|
}
|
2022-02-27 21:58:01 +00:00
|
|
|
|
2022-02-10 18:54:48 +00:00
|
|
|
private:
|
|
|
|
|
2022-10-23 19:51:39 +00:00
|
|
|
bool supports_save_parameters = false;
|
|
|
|
|
2023-10-15 06:38:15 +00:00
|
|
|
virtual int ModeSense6(cdb_t, vector<uint8_t>&) const = 0;
|
|
|
|
virtual int ModeSense10(cdb_t, vector<uint8_t>&) const = 0;
|
2022-02-10 18:54:48 +00:00
|
|
|
|
2022-11-04 07:22:32 +00:00
|
|
|
void ModeSense6() const;
|
|
|
|
void ModeSense10() const;
|
|
|
|
void ModeSelect6() const;
|
|
|
|
void ModeSelect10() const;
|
2022-02-10 18:54:48 +00:00
|
|
|
|
2022-11-04 07:22:32 +00:00
|
|
|
void SaveParametersCheck(int) const;
|
2022-02-10 18:54:48 +00:00
|
|
|
};
|