From 9f169ced230317cb9a9dc84eef0ee81b3359bba5 Mon Sep 17 00:00:00 2001 From: "HuYingzhuo(hugo/hyzboy)" Date: Fri, 28 Jul 2023 18:13:32 +0800 Subject: [PATCH] added to the SOC GPU parse --- inc/hgl/platform/SOC.h | 64 ++++++++++++++++++++++++++++++++++++++---- src/SOC/SOC.cpp | 30 +++++++++++++++++--- 2 files changed, 84 insertions(+), 10 deletions(-) diff --git a/inc/hgl/platform/SOC.h b/inc/hgl/platform/SOC.h index 8dad08c..615f064 100644 --- a/inc/hgl/platform/SOC.h +++ b/inc/hgl/platform/SOC.h @@ -29,7 +29,7 @@ namespace hgl ENUM_CLASS_RANGE(Unknow,JLQ) }; - constexpr const char *SOCVendorName[16]= + constexpr const char *SOCVendorName[]= { "Unknow", "Qualcomm", @@ -41,6 +41,8 @@ namespace hgl "JLQ", }; + const SOCVendor ParseSOCVendor(const char *str); + enum class CpuArch { Unknow=0, @@ -142,11 +144,61 @@ namespace hgl */ bool ParseSOCInfo(SOCInfo &,const char *); - struct SOCCpuInfo + enum class SOCGPUVendor { - SOCInfo soc_info; + Unknow=0, - uint cluster_count; ///(int(SOCVendor::RANGE_SIZE),(const char **)SOCVendorName,str); + + if(index<0||index>=int(SOCVendor::RANGE_SIZE)) + return(SOCVendor::Unknow); + + return SOCVendor(index); + } + + const SOCGPUVendor ParseSOCGPUVendor(const char *str) + { + if(!str||!*str)return(SOCGPUVendor::Unknow); + + int index=hgl::find_str_in_array(int(SOCGPUVendor::RANGE_SIZE),(const char **)SOCGPUVendorName,str); + + if(index<0||index>=int(SOCGPUVendor::RANGE_SIZE)) + return(SOCGPUVendor::Unknow); + + return SOCGPUVendor(index); + } + bool ParseSOCInfo(SOCInfo &soc,const char *soc_name) { hgl_zero(soc);