2022-12-03 04:20:27 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
2022-12-05 17:58:23 +00:00
|
|
|
// SCSI Target Emulator PiSCSI
|
2022-12-03 04:20:27 +00:00
|
|
|
// for Raspberry Pi
|
|
|
|
//
|
|
|
|
// Copyright (C) 2022 akuker
|
|
|
|
//
|
|
|
|
// [ Hardware version detection routines ]
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2023-10-15 06:38:15 +00:00
|
|
|
#include <cstdint>
|
2022-12-03 04:20:27 +00:00
|
|
|
#include <map>
|
|
|
|
#include <string>
|
|
|
|
|
2023-10-22 15:29:26 +00:00
|
|
|
using namespace std;
|
|
|
|
|
2022-12-03 04:20:27 +00:00
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// Single Board Computer Versions
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
class SBC_Version
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Type of Single Board Computer
|
|
|
|
enum class sbc_version_type : uint8_t {
|
|
|
|
sbc_unknown = 0,
|
|
|
|
sbc_raspberry_pi_1,
|
|
|
|
sbc_raspberry_pi_2_3,
|
2023-10-22 15:29:26 +00:00
|
|
|
sbc_raspberry_pi_4
|
2022-12-03 04:20:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
SBC_Version() = delete;
|
|
|
|
~SBC_Version() = delete;
|
|
|
|
|
|
|
|
static void Init();
|
|
|
|
|
|
|
|
static sbc_version_type GetSbcVersion();
|
|
|
|
|
|
|
|
static bool IsRaspberryPi();
|
|
|
|
|
2023-10-22 15:29:26 +00:00
|
|
|
static string GetAsString();
|
2022-12-03 04:20:27 +00:00
|
|
|
|
|
|
|
static uint32_t GetPeripheralAddress();
|
|
|
|
|
|
|
|
private:
|
2023-10-22 15:29:26 +00:00
|
|
|
static sbc_version_type sbc_version;
|
2022-12-03 04:20:27 +00:00
|
|
|
|
2023-10-22 15:29:26 +00:00
|
|
|
static const string str_raspberry_pi_1;
|
|
|
|
static const string str_raspberry_pi_2_3;
|
|
|
|
static const string str_raspberry_pi_4;
|
|
|
|
static const string str_unknown_sbc;
|
2022-12-03 04:20:27 +00:00
|
|
|
|
2023-10-22 15:29:26 +00:00
|
|
|
static const map<std::string, sbc_version_type, less<>> proc_device_tree_mapping;
|
2022-12-03 04:20:27 +00:00
|
|
|
|
2023-10-22 15:29:26 +00:00
|
|
|
static const string m_device_tree_model_path;
|
2022-12-03 04:20:27 +00:00
|
|
|
|
|
|
|
static uint32_t GetDeviceTreeRanges(const char *filename, uint32_t offset);
|
|
|
|
};
|