2023-01-29 03:52:13 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SCSI Target Emulator PiSCSI
|
|
|
|
// for Raspberry Pi
|
|
|
|
//
|
|
|
|
// Copyright (C) 2023 akuker
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "shared/shared_memory.h"
|
2023-02-03 02:35:54 +00:00
|
|
|
#include "hal/data_sample.h"
|
2023-01-29 03:52:13 +00:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
class ScsiSim
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ScsiSim() = default;
|
|
|
|
~ScsiSim() = default;
|
|
|
|
|
|
|
|
int run(const vector<char*>& args);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void Banner(const vector<char*>&) const;
|
|
|
|
static void TerminationHandler(int signum);
|
|
|
|
bool ParseArgument(const vector<char*>&);
|
|
|
|
|
|
|
|
int InitSharedMemory();
|
|
|
|
void TeardownSharedMemory();
|
|
|
|
|
2023-02-03 02:35:54 +00:00
|
|
|
void PrintDifferences(const DataSample ¤t, const DataSample &previous);
|
|
|
|
void TestClient();
|
|
|
|
|
2023-01-29 03:52:13 +00:00
|
|
|
bool enable_debug = false;
|
|
|
|
|
|
|
|
unique_ptr<SharedMemory> signals;
|
|
|
|
|
2023-02-03 02:35:54 +00:00
|
|
|
uint32_t prev_data;
|
|
|
|
|
2023-01-29 03:52:13 +00:00
|
|
|
bool running;
|
2023-02-03 02:35:54 +00:00
|
|
|
|
|
|
|
bool test_mode = false;
|
2023-01-29 03:52:13 +00:00
|
|
|
};
|