You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
3.0 KiB
62 lines
3.0 KiB
#ifndef __DFSL_HARDWARE_MANAGER_HEADER__
|
|
#define __DFSL_HARDWARE_MANAGER_HEADER__
|
|
|
|
#include "../components/base/basicLogCollection.h"
|
|
#include "../components/base/basicMutex.h"
|
|
#include "hardwareResource.h"
|
|
|
|
//#define MEMORY_CONSUMPTION_LIMIT (524288000UL) //500 MB ~ 1 Hour
|
|
//#define MEMORY_CONSUMPTION_LIMIT (2147483648UL) // 2GB
|
|
//#define MEMORY_CONSUMPTION_LIMIT (4294967296UL) // 4GB
|
|
|
|
class hardwareManager{
|
|
private:
|
|
basicLogCollection * m_pLog;
|
|
VECTOR_HW_RESOURCES m_vResources;
|
|
basicMutex m_mVectorProtector;
|
|
dataBinder * m_pDBC;
|
|
DBC_SYS_INFO m_sSYS_INFO;
|
|
uint32_t m_nServerNodeID;
|
|
uint32_t m_nServerID; // Prop of DBC
|
|
uint32_t m_nSiteID; // Prop of Kernel
|
|
#ifdef MEMORY_CONSUMPTION_LIMIT
|
|
size_t m_nMemoryLimitHeapSize;
|
|
uint8_t m_bCacheCleanCounter;
|
|
#endif
|
|
//bool m_bHardwareEnumerated;
|
|
void loadResources( void );
|
|
void unloadResources( void );
|
|
|
|
uint32_t createResourceUART( CSTR devName );
|
|
uint32_t createResourceVIDEO( CSTR devName );
|
|
uint32_t createResourceUDCB( CSTR devName );
|
|
uint32_t createResourceNETWORK( CSTR devName );
|
|
void enumerateNIFS( void );
|
|
void getMAC( CSTR if_name, CSTR buf );
|
|
void getGW( CSTR if_name, CSTR buf );
|
|
void getTTyDesc( CSTR dev_name, CSTR buf );
|
|
/* Linux System Parsers */
|
|
PARSE_RESULT_NET_INTERFACES * parse_neconfig( CSTR if_name );
|
|
PARSE_RESULT_WIFI_SETTINGS * parse_wifi( CSTR if_name );
|
|
|
|
void clearAllResources( void );
|
|
public:
|
|
virtual ~hardwareManager();
|
|
static hardwareManager * getInstance( bool cold_start = true );
|
|
bool validate( void );
|
|
hardwareResource * requestResource( HARDWARE_PROVIDERS type, uint32_t id );
|
|
DBC_INT_LIST * requestResourcesByType( HARDWARE_PROVIDERS type );
|
|
DBC_SYS_INFO * getSysInfo(){ return &m_sSYS_INFO;};
|
|
void enumerateHardware( void );
|
|
bool assignResource( hardwareResource *ptr, bool protected_mode = true );
|
|
bool resignResource( hardwareResource *ptr, bool protected_mode = true );
|
|
bool updateSysInfo( DBC_SYS_LOAD_INFO *ptr );
|
|
private:
|
|
static hardwareManager * _instance;
|
|
explicit hardwareManager( bool cold_start );
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|