RASCSI/cpp/hal/sbc_version.h

66 lines
1.5 KiB
C++

//---------------------------------------------------------------------------
//
// SCSI Target Emulator PiSCSI
// for Raspberry Pi
//
// Copyright (C) 2022 akuker
//
// [ Hardware version detection routines ]
//
//---------------------------------------------------------------------------
#pragma once
#include <cstdint>
#include <map>
#include <string>
using namespace std;
//===========================================================================
//
// 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,
sbc_raspberry_pi_4,
sbc_raspberry_pi_5
};
SBC_Version() = delete;
~SBC_Version() = delete;
static void Init();
static sbc_version_type GetSbcVersion();
static bool IsRaspberryPi();
static string GetAsString();
static uint32_t GetPeripheralAddress();
private:
static sbc_version_type sbc_version;
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_raspberry_pi_5;
static const string str_unknown_sbc;
static const map<std::string, sbc_version_type, less<>> proc_device_tree_mapping;
static const string m_device_tree_model_path;
static uint32_t GetDeviceTreeRanges(const char *filename, uint32_t offset);
};