mirror of
https://github.com/akuker/RASCSI.git
synced 2024-11-29 01:49:19 +00:00
41bdcd4aed
* Update logging * Remove duplicate code * Update unit tests * Clean up includes * Merge ProtobufSerializer into protobuf_util namespace * Precompile regex * Add const * Add Split() convenience method, update log level/ID parsing * Move log.h to legacy folder * Elimininate gotos * Fixes for gcc 13 * Update compiler flags * Update default folder handling * Use references instead of pointers * Move code for better encapsulation * Move code * Remove unused method argument * Move device logger * Remove redundant to_string * Rename for consistency * Update handling of protobuf pointers * Simplify protobuf usage * Memory handling update * Add hasher
52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator PiSCSI
|
|
// for Raspberry Pi
|
|
//
|
|
// Copyright (C) 2022-2023 Uwe Seimet
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "primary_device.h"
|
|
#include <string>
|
|
#include <span>
|
|
#include <vector>
|
|
#include <map>
|
|
|
|
class ModePageDevice : public PrimaryDevice
|
|
{
|
|
public:
|
|
|
|
using PrimaryDevice::PrimaryDevice;
|
|
|
|
bool Init(const param_map&) override;
|
|
|
|
virtual void ModeSelect(scsi_defs::scsi_command, cdb_t, span<const uint8_t>, int) const;
|
|
|
|
protected:
|
|
|
|
bool SupportsSaveParameters() const { return supports_save_parameters; }
|
|
void SupportsSaveParameters(bool b) { supports_save_parameters = b; }
|
|
int AddModePages(cdb_t, 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:
|
|
|
|
bool supports_save_parameters = false;
|
|
|
|
virtual int ModeSense6(cdb_t, vector<uint8_t>&) const = 0;
|
|
virtual int ModeSense10(cdb_t, vector<uint8_t>&) const = 0;
|
|
|
|
void ModeSense6() const;
|
|
void ModeSense10() const;
|
|
void ModeSelect6() const;
|
|
void ModeSelect10() const;
|
|
|
|
void SaveParametersCheck(int) const;
|
|
};
|