/*
 * Copyright (C) 2020-2021 Aloysius Indrayanto
 *
 * This file is part of the eCxx library, see LICENSE file for the license details.
 */


#ifndef ECXX_PLATFORM_COMMON_HW_INFO_H
#define ECXX_PLATFORM_COMMON_HW_INFO_H


#include <eCxx/CTL/Foundation.h>

#ifdef ECXX_BUILDING_ECXX_LIBRARY
    #include <eCxx/CTL/HaveMemberCheck.h>
#endif


//
// Include the platform-specific's implementation
//
#define INCLUDE_ECXX_PLATFORM_SPECIFIC_HW_INFO_H

// AVR
#ifdef __AVR_ARCH__
    #include "../AVRCommon/HWInfo.h"
#endif

// NodeMCU-ESP8266
#ifdef __XTENSA__
    #include "../NodeMCU/HWInfo.h"
#endif

// Dummy (for testing the eCxx library in the host PC)
#ifdef INCLUDE_ECXX_PLATFORM_SPECIFIC_HW_INFO_H
    #include "../Dummy/HWInfo.h"
#endif


//
// Check if the platform-specific's implementation provides the necessary member types/constants/variables/functions/etc.
//
#ifdef ECXX_BUILDING_ECXX_LIBRARY

namespace eCxx {

    namespace internal_hwinfo_check {

        // Member constants/variables/functions
        ECXX_CHECK_HAVE_MEMBER(HWInfo, eCxxVersion);
        ECXX_CHECK_HAVE_MEMBER(HWInfo, compilerVersion);

        ECXX_CHECK_HAVE_MEMBER(HWInfo, deviceName);

        ECXX_CHECK_HAVE_MEMBER(HWInfo, chipSignature);
        ECXX_CHECK_HAVE_MEMBER(HWInfo, chipId);

        ECXX_CHECK_HAVE_MEMBER(HWInfo, cpuFrequency);
        ECXX_CHECK_HAVE_MEMBER(HWInfo, cpuFrequency_kHz);
        ECXX_CHECK_HAVE_MEMBER(HWInfo, cpuFrequency_MHz);

        ECXX_CHECK_HAVE_MEMBER(HWInfo, totalRAMSize);
        ECXX_CHECK_HAVE_MEMBER(HWInfo, totalFlashSize);
        ECXX_CHECK_HAVE_MEMBER(HWInfo, totalEEPROMSize);

        ECXX_CHECK_HAVE_MEMBER(HWInfo, rawNVStorageSize);
        ECXX_CHECK_HAVE_MEMBER(HWInfo, eepromIsEmulated);

    } // namespace internal

} // namespace eCxx

#endif


#endif
