mirror of
https://github.com/akuker/RASCSI.git
synced 2026-10-25 12:02:59 +00:00
Move GPIO mappings into a single module and select a board profile at process startup instead of at compile time: Build every GPIO-facing utility for every supported profile. At the same time, we remove support for the historical AIBOM board type since it's the only one using positive logic, the other three variants share the same electrical behavior. Run piscsi, scsimon, scsiloop, scsidump, or sasidump with -C=STANDARD, FULLSPEC, or GAMERNIUM. FULLSPEC remains the default. To select a profile for the systemd service, set PISCSI_CONNECTION_TYPE and restart the service.
95 lines
2.7 KiB
C++
95 lines
2.7 KiB
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator PiSCSI
|
|
// for Raspberry Pi
|
|
//
|
|
// Copyright (C) 2022 akuker
|
|
//
|
|
// [ Logical representation of a single data sample ]
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "hal/data_sample.h"
|
|
#include "hal/connection_profile.h"
|
|
#include "shared/scsi.h"
|
|
|
|
class DataSample_Raspberry final : public DataSample
|
|
{
|
|
public:
|
|
bool GetSignal(int pin) const override
|
|
{
|
|
return (bool)((data >> pin) & 1);
|
|
};
|
|
|
|
bool GetBSY() const override
|
|
{
|
|
return GetSignal(PIN_BSY);
|
|
}
|
|
bool GetSEL() const override
|
|
{
|
|
return GetSignal(PIN_SEL);
|
|
}
|
|
bool GetATN() const override
|
|
{
|
|
return GetSignal(PIN_ATN);
|
|
}
|
|
bool GetACK() const override
|
|
{
|
|
return GetSignal(PIN_ACK);
|
|
}
|
|
bool GetRST() const override
|
|
{
|
|
return GetSignal(PIN_RST);
|
|
}
|
|
bool GetMSG() const override
|
|
{
|
|
return GetSignal(PIN_MSG);
|
|
}
|
|
bool GetCD() const override
|
|
{
|
|
return GetSignal(PIN_CD);
|
|
}
|
|
bool GetIO() const override
|
|
{
|
|
return GetSignal(PIN_IO);
|
|
}
|
|
bool GetREQ() const override
|
|
{
|
|
return GetSignal(PIN_REQ);
|
|
}
|
|
bool GetACT() const override
|
|
{
|
|
return GetSignal(PIN_ACT);
|
|
}
|
|
uint8_t GetDAT() const override
|
|
{
|
|
uint8_t ret_val = 0;
|
|
ret_val |= (data >> (PIN_DT0 - 0)) & 0x01; // NOSONAR: GCC 10 doesn't support shift operations on std::byte
|
|
ret_val |= (data >> (PIN_DT1 - 1)) & 0x02; // NOSONAR: GCC 10 doesn't support shift operations on std::byte
|
|
ret_val |= (data >> (PIN_DT2 - 2)) & 0x04; // NOSONAR: GCC 10 doesn't support shift operations on std::byte
|
|
ret_val |= (data >> (PIN_DT3 - 3)) & 0x08; // NOSONAR: GCC 10 doesn't support shift operations on std::byte
|
|
ret_val |= (data >> (PIN_DT4 - 4)) & 0x10; // NOSONAR: GCC 10 doesn't support shift operations on std::byte
|
|
ret_val |= (data >> (PIN_DT5 - 5)) & 0x20; // NOSONAR: GCC 10 doesn't support shift operations on std::byte
|
|
ret_val |= (data >> (PIN_DT6 - 6)) & 0x40; // NOSONAR: GCC 10 doesn't support shift operations on std::byte
|
|
ret_val |= (data >> (PIN_DT7 - 7)) & 0x80; // NOSONAR: GCC 10 doesn't support shift operations on std::byte
|
|
return ret_val;
|
|
}
|
|
|
|
uint32_t GetRawCapture() const override
|
|
{
|
|
return data;
|
|
}
|
|
|
|
DataSample_Raspberry(const uint32_t in_data, const uint64_t in_timestamp) : DataSample{in_timestamp}, data{in_data}
|
|
{
|
|
}
|
|
DataSample_Raspberry() = default;
|
|
|
|
~DataSample_Raspberry() override = default;
|
|
|
|
private:
|
|
uint32_t data = 0;
|
|
};
|