hocclk: format code

use clang format file provided for optimal formatting
This commit is contained in:
souldbminersmwc committed 2026-06-04 19:52:11 -04:00
1 parent c6a8884c14
commit 88bfa9a4ec
118 files changed
+7111 -9615

No files matched your search

+68 -63
View File
@@ -24,29 +24,30 @@
* --------------------------------------------------------------------------
*/
#include "config.hpp"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sstream>
#include <algorithm>
#include <atomic>
#include <cstring>
#include <ctime>
#include <map>
#include <string>
#include <atomic>
#include <initializer_list>
#include <minIni.h>
#include "../hos/apm_ext.h"
#include <i2c.h>
#include <t210.h>
#include <map>
#include <max17050.h>
#include <minIni.h>
#include <sstream>
#include <string>
#include <t210.h>
#include <tmp451.h>
#include <ipc_server.h>
#include <lockable_mutex.h>
#include <unistd.h>
#include "../board/board.hpp"
#include "../hos/apm_ext.h"
#include "config.hpp"
#include "errors.hpp"
#include "file_utils.hpp"
#include <initializer_list>
#include <ipc_server.h>
#include <lockable_mutex.h>
#include <sys/stat.h>
#include <sys/types.h>
namespace config {
@@ -57,7 +58,7 @@ namespace config {
bool gLoaded = false;
std::string gPath;
time_t gMtime = 0;
std::atomic_bool gEnabled{false};
std::atomic_bool gEnabled{ false };
std::uint32_t gOverrideFreqs[HocClkModule_EnumMax];
std::map<std::tuple<std::uint64_t, HocClkProfile, HocClkModule>, std::uint32_t> gProfileMHzMap;
std::map<std::uint64_t, std::uint8_t> gProfileCountMap;
@@ -83,11 +84,12 @@ namespace config {
return 0;
}
std::uint32_t FindClockHzFromProfiles(std::uint64_t tid, HocClkModule module, std::initializer_list<HocClkProfile> profiles, u32 mhzMultiplier = 1000000) {
std::uint32_t FindClockHzFromProfiles(std::uint64_t tid, HocClkModule module, std::initializer_list<HocClkProfile> profiles,
u32 mhzMultiplier = 1000000) {
std::uint32_t mhz = 0;
if (gLoaded) {
for (auto profile: profiles) {
for (auto profile : profiles) {
mhz = FindClockMHz(tid, module, profile);
if (mhz) {
break;
@@ -98,7 +100,7 @@ namespace config {
return std::max((std::uint32_t)0, mhz * mhzMultiplier);
}
int BrowseIniFunc(const char* section, const char* key, const char* value, void* userdata) {
int BrowseIniFunc(const char *section, const char *key, const char *value, void *userdata) {
(void)userdata;
std::uint64_t input;
if (!strcmp(section, CONFIG_VAL_SECTION)) {
@@ -129,14 +131,14 @@ namespace config {
HocClkModule parsedModule = HocClkModule_EnumMax;
for (unsigned int profile = 0; profile < HocClkProfile_EnumMax; profile++) {
const char* profileCode = board::GetProfileName((HocClkProfile)profile, false);
const char *profileCode = board::GetProfileName((HocClkProfile)profile, false);
size_t profileCodeLen = strlen(profileCode);
if (!strncmp(key, profileCode, profileCodeLen) && key[profileCodeLen] == '_') {
const char* subkey = key + profileCodeLen + 1;
const char *subkey = key + profileCodeLen + 1;
for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
const char* moduleCode = board::GetModuleName((HocClkModule)module, false);
const char *moduleCode = board::GetModuleName((HocClkModule)module, false);
size_t moduleCodeLen = strlen(moduleCode);
if (!strncmp(subkey, moduleCode, moduleCodeLen) && subkey[moduleCodeLen] == '\0') {
parsedProfile = (HocClkProfile)profile;
@@ -191,7 +193,7 @@ namespace config {
gLoaded = true;
}
}
} // namespace
void Initialize() {
gPath = FILE_CONFIG_DIR "/config.ini";
@@ -209,12 +211,12 @@ namespace config {
}
void Exit() {
std::scoped_lock lock{gConfigMutex};
std::scoped_lock lock{ gConfigMutex };
Close();
}
bool Refresh() {
std::scoped_lock lock{gConfigMutex};
std::scoped_lock lock{ gConfigMutex };
if (!gLoaded || gMtime != CheckModificationTime()) {
Load();
return true;
@@ -223,30 +225,34 @@ namespace config {
}
bool HasProfilesLoaded() {
std::scoped_lock lock{gConfigMutex};
std::scoped_lock lock{ gConfigMutex };
return gLoaded;
}
std::uint32_t GetAutoClockHz(std::uint64_t tid, HocClkModule module, HocClkProfile profile, bool returnRaw) {
std::scoped_lock lock{gConfigMutex};
std::scoped_lock lock{ gConfigMutex };
switch (profile) {
case HocClkProfile_Handheld:
return FindClockHzFromProfiles(tid, module, {HocClkProfile_Handheld}, returnRaw ? 1 : 1000000);
return FindClockHzFromProfiles(tid, module, { HocClkProfile_Handheld }, returnRaw ? 1 : 1000000);
case HocClkProfile_HandheldCharging:
case HocClkProfile_HandheldChargingUSB:
return FindClockHzFromProfiles(tid, module, {HocClkProfile_HandheldChargingUSB, HocClkProfile_HandheldCharging, HocClkProfile_Handheld}, returnRaw ? 1 : 1000000);
return FindClockHzFromProfiles(tid, module,
{ HocClkProfile_HandheldChargingUSB, HocClkProfile_HandheldCharging, HocClkProfile_Handheld },
returnRaw ? 1 : 1000000);
case HocClkProfile_HandheldChargingOfficial:
return FindClockHzFromProfiles(tid, module, {HocClkProfile_HandheldChargingOfficial, HocClkProfile_HandheldCharging, HocClkProfile_Handheld}, returnRaw ? 1 : 1000000);
return FindClockHzFromProfiles(tid, module,
{ HocClkProfile_HandheldChargingOfficial, HocClkProfile_HandheldCharging, HocClkProfile_Handheld },
returnRaw ? 1 : 1000000);
case HocClkProfile_Docked:
return FindClockHzFromProfiles(tid, module, {HocClkProfile_Docked}, returnRaw ? 1 : 1000000);
return FindClockHzFromProfiles(tid, module, { HocClkProfile_Docked }, returnRaw ? 1 : 1000000);
default:
ERROR_THROW("Unhandled HocClkProfile: %u", profile);
}
return 0;
}
void GetProfiles(std::uint64_t tid, HocClkTitleProfileList* out_profiles) {
std::scoped_lock lock{gConfigMutex};
void GetProfiles(std::uint64_t tid, HocClkTitleProfileList *out_profiles) {
std::scoped_lock lock{ gConfigMutex };
for (unsigned int profile = 0; profile < HocClkProfile_EnumMax; profile++) {
for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
out_profiles->mhzMap[profile][module] = FindClockMHz(tid, (HocClkModule)module, (HocClkProfile)profile);
@@ -254,11 +260,11 @@ namespace config {
}
}
bool SetProfiles(std::uint64_t tid, HocClkTitleProfileList* profiles, bool immediate) {
std::scoped_lock lock{gConfigMutex};
bool SetProfiles(std::uint64_t tid, HocClkTitleProfileList *profiles, bool immediate) {
std::scoped_lock lock{ gConfigMutex };
uint8_t numProfiles = 0;
char section[17] = {0};
char section[17] = { 0 };
snprintf(section, sizeof(section), "%016lX", tid);
std::vector<std::string> keys;
@@ -266,16 +272,15 @@ namespace config {
keys.reserve(+HocClkProfile_EnumMax * +HocClkModule_EnumMax);
values.reserve(+HocClkProfile_EnumMax * +HocClkModule_EnumMax);
std::uint32_t* mhz = &profiles->mhz[0];
std::uint32_t *mhz = &profiles->mhz[0];
for (unsigned int profile = 0; profile < HocClkProfile_EnumMax; profile++) {
for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
if (*mhz) {
numProfiles++;
std::string key = std::string(board::GetProfileName((HocClkProfile)profile, false)) +
"_" +
board::GetModuleName((HocClkModule)module, false);
std::string key =
std::string(board::GetProfileName((HocClkProfile)profile, false)) + "_" + board::GetModuleName((HocClkModule)module, false);
std::string value = std::to_string(*mhz);
keys.push_back(key);
@@ -285,8 +290,8 @@ namespace config {
}
}
std::vector<const char*> keyPointers;
std::vector<const char*> valuePointers;
std::vector<const char *> keyPointers;
std::vector<const char *> valuePointers;
keyPointers.reserve(keys.size() + 1);
valuePointers.reserve(values.size() + 1);
@@ -337,45 +342,45 @@ namespace config {
void SetOverrideHz(HocClkModule module, std::uint32_t hz) {
ASSERT_ENUM_VALID(HocClkModule, module);
std::scoped_lock lock{gOverrideMutex};
std::scoped_lock lock{ gOverrideMutex };
gOverrideFreqs[module] = hz;
}
std::uint32_t GetOverrideHz(HocClkModule module) {
ASSERT_ENUM_VALID(HocClkModule, module);
std::scoped_lock lock{gOverrideMutex};
std::scoped_lock lock{ gOverrideMutex };
return gOverrideFreqs[module];
}
std::uint64_t GetConfigValue(HocClkConfigValue kval) {
ASSERT_ENUM_VALID(HocClkConfigValue, kval);
std::scoped_lock lock{gConfigMutex};
std::scoped_lock lock{ gConfigMutex };
return configValues[kval];
}
const char* GetConfigValueName(HocClkConfigValue kval, bool pretty) {
const char *GetConfigValueName(HocClkConfigValue kval, bool pretty) {
ASSERT_ENUM_VALID(HocClkConfigValue, kval);
return hocclkFormatConfigValue(kval, pretty);
}
void GetConfigValues(HocClkConfigValueList* out_configValues) {
std::scoped_lock lock{gConfigMutex};
void GetConfigValues(HocClkConfigValueList *out_configValues) {
std::scoped_lock lock{ gConfigMutex };
for (unsigned int kval = 0; kval < HocClkConfigValue_EnumMax; kval++) {
out_configValues->values[kval] = configValues[kval];
}
}
bool SetConfigValues(HocClkConfigValueList* configValues, bool immediate) {
std::scoped_lock lock{gConfigMutex};
bool SetConfigValues(HocClkConfigValueList *configValues, bool immediate) {
std::scoped_lock lock{ gConfigMutex };
std::vector<const char*> iniKeys;
std::vector<const char *> iniKeys;
std::vector<std::string> iniValues;
iniKeys.reserve(HocClkConfigValue_EnumMax + 1);
iniValues.reserve(HocClkConfigValue_EnumMax);
for (unsigned int kval = 0; kval < HocClkConfigValue_EnumMax; kval++) {
if (!hocclkValidConfigValue((HocClkConfigValue)kval, configValues->values[kval]) ||
configValues->values[kval] == hocclkDefaultConfigValue((HocClkConfigValue)kval)) {
configValues->values[kval] == hocclkDefaultConfigValue((HocClkConfigValue)kval)) {
continue;
}
iniValues.push_back(std::to_string(configValues->values[kval]));
@@ -384,9 +389,9 @@ namespace config {
iniKeys.push_back(NULL);
std::vector<const char*> valuePointers;
std::vector<const char *> valuePointers;
valuePointers.reserve(iniValues.size() + 1);
for (const auto& val : iniValues) {
for (const auto &val : iniValues) {
valuePointers.push_back(val.c_str());
}
valuePointers.push_back(NULL);
@@ -414,11 +419,11 @@ namespace config {
return false;
}
std::scoped_lock lock{gConfigMutex};
std::scoped_lock lock{ gConfigMutex };
std::uint64_t defaultValue = hocclkDefaultConfigValue(kval);
std::vector<const char*> iniKeys;
std::vector<const char *> iniKeys;
std::vector<std::string> iniValues;
iniKeys.reserve(2);
iniValues.reserve(1);
@@ -427,9 +432,9 @@ namespace config {
iniValues.push_back("");
iniKeys.push_back(NULL);
std::vector<const char*> valuePointers;
std::vector<const char *> valuePointers;
valuePointers.reserve(iniValues.size() + 1);
for (const auto& val : iniValues) {
for (const auto &val : iniValues) {
valuePointers.push_back(val.c_str());
}
valuePointers.push_back(NULL);
@@ -453,9 +458,9 @@ namespace config {
return false;
}
std::scoped_lock lock{gConfigMutex};
std::scoped_lock lock{ gConfigMutex };
std::vector<const char*> iniKeys;
std::vector<const char *> iniKeys;
std::vector<std::string> iniValues;
iniKeys.reserve(2);
iniValues.reserve(1);
@@ -464,7 +469,7 @@ namespace config {
iniValues.push_back(std::to_string(value));
iniKeys.push_back(NULL);
std::vector<const char*> valuePointers;
std::vector<const char *> valuePointers;
valuePointers.reserve(2);
valuePointers.push_back(iniValues[0].c_str());
valuePointers.push_back(NULL);
@@ -480,8 +485,8 @@ namespace config {
return true;
}
void DeleteKey(const char* section, const char* key) {
std::scoped_lock lock{gConfigMutex};
void DeleteKey(const char *section, const char *key) {
std::scoped_lock lock{ gConfigMutex };
ini_puts(section, key, NULL, gPath.c_str());
}
}
} // namespace config
+8 -8
View File
@@ -40,8 +40,8 @@ namespace config {
bool HasProfilesLoaded();
std::uint8_t GetProfileCount(std::uint64_t tid);
void GetProfiles(std::uint64_t tid, HocClkTitleProfileList* out_profiles);
bool SetProfiles(std::uint64_t tid, HocClkTitleProfileList* profiles, bool immediate);
void GetProfiles(std::uint64_t tid, HocClkTitleProfileList *out_profiles);
bool SetProfiles(std::uint64_t tid, HocClkTitleProfileList *profiles, bool immediate);
std::uint32_t GetAutoClockHz(std::uint64_t tid, HocClkModule module, HocClkProfile profile, bool returnRaw);
void SetEnabled(bool enabled);
@@ -50,13 +50,13 @@ namespace config {
std::uint32_t GetOverrideHz(HocClkModule module);
std::uint64_t GetConfigValue(HocClkConfigValue val);
const char* GetConfigValueName(HocClkConfigValue val, bool pretty);
void GetConfigValues(HocClkConfigValueList* out_configValues);
bool SetConfigValues(HocClkConfigValueList* configValues, bool immediate);
const char *GetConfigValueName(HocClkConfigValue val, bool pretty);
void GetConfigValues(HocClkConfigValueList *out_configValues);
bool SetConfigValues(HocClkConfigValueList *configValues, bool immediate);
bool ResetConfigValue(HocClkConfigValue kval);
bool SetConfigValue(HocClkConfigValue kval, std::uint64_t value, bool immediate = true);
void DeleteKey(const char* section, const char* key);
void DeleteKey(const char *section, const char *key);
extern uint64_t configValues[HocClkConfigValue_EnumMax];
}
} // namespace config
+5 -4
View File
@@ -24,13 +24,14 @@
* --------------------------------------------------------------------------
*/
#include "errors.hpp"
#include "file_utils.hpp"
#include <cstdarg>
#include <cstring>
#include "errors.hpp"
#include "file_utils.hpp"
namespace errors {
void ThrowException(const char* format, ...) {
void ThrowException(const char *format, ...) {
va_list args;
va_start(args, format);
fileUtils::LogLine(format, args);
@@ -38,4 +39,4 @@ namespace errors {
diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_ShouldNotHappen));
// throw std::runtime_error(msg);
}
}
} // namespace errors
+4 -5
View File
@@ -26,14 +26,13 @@
#pragma once
#include <switch.h>
#include <stdexcept>
#include <switch.h>
#define ERROR_THROW(format, ...) errors::ThrowException(format "\n in %s:%u", ##__VA_ARGS__, __FILE__, __LINE__)
#define ERROR_RESULT_THROW(rc, format, ...) ERROR_THROW(format "\n RC: [0x%x] %04d-%04d", ##__VA_ARGS__, rc, R_MODULE(rc), R_DESCRIPTION(rc))
#define ASSERT_RESULT_OK(rc, format, ...) \
if (R_FAILED(rc)) \
{ \
#define ASSERT_RESULT_OK(rc, format, ...) \
if (R_FAILED(rc)) { \
ERROR_RESULT_THROW(rc, "ASSERT_RESULT_OK: " format, ##__VA_ARGS__); \
}
#define ASSERT_ENUM_VALID(n, v) \
@@ -43,6 +42,6 @@
namespace errors {
void ThrowException(const char* format, ...);
void ThrowException(const char *format, ...);
}
@@ -24,12 +24,13 @@
* --------------------------------------------------------------------------
*/
#include "file_utils.hpp"
#include "../hos/apm_ext.h"
#include <i2c.h>
#include <t210.h>
#include <max17050.h>
#include <t210.h>
#include <tmp451.h>
#include "../hos/apm_ext.h"
#include "file_utils.hpp"
#include <ipc_server.h>
#include <lockable_mutex.h>
@@ -52,7 +53,7 @@ namespace fileUtils {
return;
}
FILE* file = fopen(FILE_LOG_FLAG_PATH, "r");
FILE *file = fopen(FILE_LOG_FLAG_PATH, "r");
if (file) {
g_log_enabled = true;
fclose(file);
@@ -63,11 +64,11 @@ namespace fileUtils {
g_last_flag_check = now;
}
void InitializeThreadFunc(void* args) {
void InitializeThreadFunc(void *args) {
Initialize();
}
}
} // namespace
bool IsInitialized() {
return g_has_initialized;
@@ -77,8 +78,8 @@ namespace fileUtils {
return g_log_enabled;
}
void LogLine(const char* format, ...) {
std::scoped_lock lock{g_log_mutex};
void LogLine(const char *format, ...) {
std::scoped_lock lock{ g_log_mutex };
va_list args;
va_start(args, format);
@@ -86,7 +87,7 @@ namespace fileUtils {
RefreshFlags(false);
if (g_log_enabled) {
FILE* file = fopen(FILE_LOG_FILE_PATH, "a");
FILE *file = fopen(FILE_LOG_FILE_PATH, "a");
if (file) {
timespec now = {};
@@ -102,10 +103,10 @@ namespace fileUtils {
va_end(args);
}
void WriteContextToCsv(const HocClkContext* context) {
std::scoped_lock lock{g_csv_mutex};
void WriteContextToCsv(const HocClkContext *context) {
std::scoped_lock lock{ g_csv_mutex };
FILE* file = fopen(FILE_CONTEXT_CSV_PATH, "a");
FILE *file = fopen(FILE_CONTEXT_CSV_PATH, "a");
if (file) {
// Print header
@@ -134,7 +135,8 @@ namespace fileUtils {
struct timespec now;
clock_gettime(CLOCK_REALTIME, &now);
fprintf(file, "%ld%03ld,%s,%016lx", now.tv_sec, now.tv_nsec / 1000000UL, hocclkFormatProfile(context->profile, false), context->applicationId);
fprintf(file, "%ld%03ld,%s,%016lx", now.tv_sec, now.tv_nsec / 1000000UL, hocclkFormatProfile(context->profile, false),
context->applicationId);
for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
fprintf(file, ",%d", context->freqs[module]);
@@ -164,7 +166,7 @@ namespace fileUtils {
}
void InitializeAsync() {
Thread initThread = {0};
Thread initThread = { 0 };
threadCreate(&initThread, InitializeThreadFunc, NULL, NULL, 0x4000, 0x15, 0);
threadStart(&initThread);
}
@@ -210,4 +212,4 @@ namespace fileUtils {
fsExit();
}
}
} // namespace fileUtils
@@ -26,13 +26,13 @@
#pragma once
#include <switch.h>
#include <time.h>
#include <vector>
#include <string>
#include <atomic>
#include <cstdarg>
#include <hocclk.h>
#include <string>
#include <switch.h>
#include <time.h>
#include <vector>
#define FILE_CONFIG_DIR "/config/" CONFIG_DIR
#define FILE_FLAG_CHECK_INTERVAL_NS (10000ULL * 1000000000ULL)
@@ -47,7 +47,7 @@ namespace fileUtils {
bool IsInitialized();
bool IsLogEnabled();
void InitializeAsync();
void LogLine(const char* format, ...);
void WriteContextToCsv(const HocClkContext* context);
void LogLine(const char *format, ...);
void WriteContextToCsv(const HocClkContext *context);
}
} // namespace fileUtils
+27 -25
View File
@@ -15,17 +15,17 @@
*
*/
#include "kip.hpp"
#include "../i2c/i2cDrv.h"
#include "../board/board.hpp"
#include "file_utils.hpp"
#include "../i2c/i2cDrv.h"
#include "../mgr/clock_manager.hpp"
#include "file_utils.hpp"
#include "kip.hpp"
namespace kip {
bool kipAvailable = false;
void SetKipData()
{
void SetKipData() {
// TODO: figure out if this REALLY causes issues (i doubt it)
// if(board::GetSocType() == HocClkSocType_Mariko) {
// if(R_FAILED(I2c_BuckConverter_SetMvOut(&I2c_Mariko_DRAM_VDDQ, config::GetConfigValue(KipConfigValue_marikoEmcVddqVolt) / 1000))) {
@@ -34,7 +34,7 @@ namespace kip {
// }
// }
CustomizeTable table;
FILE* fp = fopen("sdmc:/atmosphere/kips/hoc.kip", "r+b");
FILE *fp = fopen("sdmc:/atmosphere/kips/hoc.kip", "r+b");
if (fp == NULL) {
notification::writeNotification("Horizon OC\nKip opening failed");
@@ -50,7 +50,7 @@ namespace kip {
return;
}
u32 custRev = cust_get_cust_rev(&table);
u32 custRev = cust_get_cust_rev(&table);
u32 kipVersion = cust_get_kip_version(&table);
if (custRev < CUST_REV || kipVersion < KIP_VERSION) {
fclose(fp);
@@ -149,10 +149,11 @@ namespace kip {
HocClkConfigValueList configValues;
config::GetConfigValues(&configValues);
configValues.values[KipCrc32] = (u64)crc32::checksum_file("sdmc:/atmosphere/kips/hoc.kip"); // write checksum
configValues.values[KipCrc32] = (u64)crc32::checksum_file("sdmc:/atmosphere/kips/hoc.kip"); // write checksum
if (config::SetConfigValues(&configValues, true)) {
fileUtils::LogLine("[kip] KIP data set. CRC32: %ld (Cust Rev %ld)", configValues.values[KipCrc32], configValues.values[KipConfigValue_custRev]);
fileUtils::LogLine("[kip] KIP data set. CRC32: %ld (Cust Rev %ld)", configValues.values[KipCrc32],
configValues.values[KipConfigValue_custRev]);
for (u64 i = KipConfigValue_hpMode; i < HocClkConfigValue_EnumMax; i++) {
fileUtils::LogLine("%s: %ld", hocclkFormatConfigValue((HocClkConfigValue)i, false), configValues.values[i]);
}
@@ -164,9 +165,8 @@ namespace kip {
// I know this is very hacky, but the config system in the sysmodule doesn't really support writing
void GetKipData()
{
FILE* fp = fopen("sdmc:/atmosphere/kips/hoc.kip", "rb");
void GetKipData() {
FILE *fp = fopen("sdmc:/atmosphere/kips/hoc.kip", "rb");
if (fp == NULL) {
notification::writeNotification("Horizon OC\nKip opening failed");
@@ -192,22 +192,23 @@ namespace kip {
// return;
// }
if ((u64)crc32::checksum_file("sdmc:/atmosphere/kips/hoc.kip") != config::GetConfigValue(KipCrc32) && !config::GetConfigValue(HocClkConfigValue_IsFirstLoad)) {
if ((u64)crc32::checksum_file("sdmc:/atmosphere/kips/hoc.kip") != config::GetConfigValue(KipCrc32) &&
!config::GetConfigValue(HocClkConfigValue_IsFirstLoad)) {
MigrateKipData(cust_get_cust_rev(&table), cust_get_kip_version(&table));
SetKipData();
notification::writeNotification("Horizon OC\nKIP has been updated\nPlease reboot your console");
return;
}
if (config::GetConfigValue(HocClkConfigValue_IsFirstLoad) == true) {
configValues.values[HocClkConfigValue_IsFirstLoad] = (u64)false;
configValues.values[HocClkConfigValue_IsFirstLoad] = (u64) false;
notification::writeNotification("Horizon OC has been installed");
}
configValues.values[KipCrc32] = (u64)crc32::checksum_file("sdmc:/atmosphere/kips/hoc.kip"); // write checksum
configValues.values[KipCrc32] = (u64)crc32::checksum_file("sdmc:/atmosphere/kips/hoc.kip"); // write checksum
// configValues.values[KipConfigValue_mtcConf] = cust_get_mtc_conf(&table);
clockManager::gContext.custRev = cust_get_cust_rev(&table);
clockManager::gContext.custRev = cust_get_cust_rev(&table);
u32 custRev = cust_get_cust_rev(&table);
u32 custRev = cust_get_cust_rev(&table);
u32 kipVersion = cust_get_kip_version(&table);
if (custRev < CUST_REV || kipVersion < KIP_VERSION) {
notification::writeNotification("Horizon OC\nOutdated kip detected!\nPlease update Horizon OC");
@@ -223,7 +224,7 @@ namespace kip {
clockManager::gContext.kipVersion = kipVersion;
configValues.values[KipConfigValue_custRev] = cust_get_cust_rev(&table);
configValues.values[KipConfigValue_KipVersion] = cust_get_kip_version(&table); // Run this after the check so we can do migration process
configValues.values[KipConfigValue_KipVersion] = cust_get_kip_version(&table); // Run this after the check so we can do migration process
configValues.values[KipConfigValue_hpMode] = cust_get_hp_mode(&table);
configValues.values[KipConfigValue_commonEmcMemVolt] = cust_get_common_emc_volt(&table);
@@ -294,7 +295,8 @@ namespace kip {
if (sizeof(HocClkConfigValueList) <= sizeof(configValues)) {
if (config::SetConfigValues(&configValues, true)) {
fileUtils::LogLine("[kip] KIP loaded. CRC32: %ld (Cust Rev %ld)", configValues.values[KipCrc32], configValues.values[KipConfigValue_custRev]);
fileUtils::LogLine("[kip] KIP loaded. CRC32: %ld (Cust Rev %ld)", configValues.values[KipCrc32],
configValues.values[KipConfigValue_custRev]);
for (u64 i = KipConfigValue_hpMode; i < HocClkConfigValue_EnumMax; i++) {
fileUtils::LogLine("%s: %ld", hocclkFormatConfigValue((HocClkConfigValue)i, false), configValues.values[i]);
}
@@ -312,16 +314,17 @@ namespace kip {
HocClkConfigValueList configValues;
config::GetConfigValues(&configValues);
u32 previousVersion = configValues.values[KipConfigValue_KipVersion];
if(previousVersion < 240 && version >= 240) {
if (previousVersion < 240 && version >= 240) {
// <2.4.0 -> 2.4.0 migration
// add marikoGpuBootVolt with default value of 800mV
configValues.values[KipConfigValue_marikoGpuBootVolt] = 800;
configValues.values[KipConfigValue_marikoGpuUV] += 2; // Raise UV levels
configValues.values[KipConfigValue_commonGpuVoltOffset] = (u32)(-(s64)(configValues.values[KipConfigValue_commonGpuVoltOffset])); // Migrate GPU Volt Offset
configValues.values[KipConfigValue_marikoGpuUV] += 2; // Raise UV levels
configValues.values[KipConfigValue_commonGpuVoltOffset] =
(u32)(-(s64)(configValues.values[KipConfigValue_commonGpuVoltOffset])); // Migrate GPU Volt Offset
// Raise min cpu vmin
if(configValues.values[KipConfigValue_eristaCpuVmin] < 750) {
if (configValues.values[KipConfigValue_eristaCpuVmin] < 750) {
configValues.values[KipConfigValue_eristaCpuVmin] = 750;
}
@@ -332,5 +335,4 @@ namespace kip {
}
config::SetConfigValues(&configValues, true);
}
}
} // namespace kip
+471 -249
View File
@@ -16,21 +16,23 @@
*/
#pragma once
#include <switch.h>
#include <stdio.h>
#include <string.h>
#include <crc32.h>
#include <notification.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <switch.h>
#include "config.hpp"
#include "file_utils.hpp"
#include <notification.h>
#include <crc32.h>
namespace kip {
extern bool kipAvailable;
typedef struct {
u8 cust[4];
u8 cust[4];
u32 custRev;
u32 kipVersion;
u32 hpMode;
@@ -97,24 +99,25 @@ namespace kip {
u32 reserved[60];
} CustomizeTable;
#define CUST_MAGIC "CUST"
#define CUST_MAGIC_LEN 4
#define CUST_MAGIC "CUST"
#define CUST_MAGIC_LEN 4
typedef struct {
FILE* file;
FILE *file;
long offset;
CustomizeTable cached_table;
bool has_cache;
} CustHandle;
static inline bool cust_find_offset(FILE* f, long* out_offset) {
static inline bool cust_find_offset(FILE *f, long *out_offset) {
u8 buf[512];
long pos = 0;
fseek(f, 0, SEEK_SET);
while (1) {
size_t r = fread(buf, 1, sizeof(buf), f);
if (r < CUST_MAGIC_LEN) break;
if (r < CUST_MAGIC_LEN)
break;
for (size_t i = 0; i <= r - CUST_MAGIC_LEN; i++) {
if (memcmp(&buf[i], CUST_MAGIC, CUST_MAGIC_LEN) == 0) {
@@ -130,23 +133,28 @@ namespace kip {
static long cachedCustOffset = -1;
static inline long cust_get_offset(FILE* f) {
if (cachedCustOffset >= 0) return cachedCustOffset;
static inline long cust_get_offset(FILE *f) {
if (cachedCustOffset >= 0)
return cachedCustOffset;
long off;
if (!cust_find_offset(f, &off)) return -1;
if (!cust_find_offset(f, &off))
return -1;
cachedCustOffset = off;
return off;
}
static inline bool cust_read_table_f(FILE* f, CustomizeTable* out) {
static inline bool cust_read_table_f(FILE *f, CustomizeTable *out) {
long off = cust_get_offset(f);
if (off < 0) return false;
if (off < 0)
return false;
fseek(f, 0, SEEK_END);
if (off + (long)sizeof(CustomizeTable) > ftell(f)) return false;
if (off + (long)sizeof(CustomizeTable) > ftell(f))
return false;
fseek(f, off, SEEK_SET);
if (fread(out, 1, sizeof(CustomizeTable), f) != sizeof(CustomizeTable)) return false;
if (fread(out, 1, sizeof(CustomizeTable), f) != sizeof(CustomizeTable))
return false;
if (memcmp(out->cust, CUST_MAGIC, CUST_MAGIC_LEN) != 0) {
cachedCustOffset = -1;
@@ -155,12 +163,14 @@ namespace kip {
return true;
}
static inline bool cust_write_table_f(FILE* f, const CustomizeTable* in) {
static inline bool cust_write_table_f(FILE *f, const CustomizeTable *in) {
long off = cust_get_offset(f);
if (off < 0) return false;
if (off < 0)
return false;
fseek(f, 0, SEEK_END);
if (off + (long)sizeof(CustomizeTable) > ftell(f)) return false;
if (off + (long)sizeof(CustomizeTable) > ftell(f))
return false;
fseek(f, off, SEEK_SET);
bool ok = fwrite(in, 1, sizeof(CustomizeTable), f) == sizeof(CustomizeTable);
@@ -168,246 +178,456 @@ namespace kip {
return ok;
}
static inline bool cust_read_table(const char* path, CustomizeTable* out) {
FILE* f = fopen(path, "rb");
if (!f) return false;
static inline bool cust_read_table(const char *path, CustomizeTable *out) {
FILE *f = fopen(path, "rb");
if (!f)
return false;
bool ok = cust_read_table_f(f, out);
fclose(f);
return ok;
}
static inline bool cust_write_table(const char* path, const CustomizeTable* in) {
FILE* f = fopen(path, "r+b");
if (!f) return false;
static inline bool cust_write_table(const char *path, const CustomizeTable *in) {
FILE *f = fopen(path, "r+b");
if (!f)
return false;
bool ok = cust_write_table_f(f, in);
fclose(f);
return ok;
}
static inline bool cust_read_and_cache(const char* path, CustomizeTable* out) {
static inline bool cust_read_and_cache(const char *path, CustomizeTable *out) {
return cust_read_table(path, out);
}
#define CUST_WRITE_FIELD_BATCH(table, field, val) \
do { \
(table)->field = (val); \
} while (0)
#define CUST_WRITE_FIELD_BATCH(table, field, val) \
do { \
(table)->field = (val); \
} while (0)
#define CUST_WRITE_FIELD(path, field, val) \
do { \
CustomizeTable t; \
if (!cust_read_table(path, &t)) return false; \
t.field = (val); \
return cust_write_table(path, &t); \
} while (0)
#define CUST_WRITE_FIELD(path, field, val) \
do { \
CustomizeTable t; \
if (!cust_read_table(path, &t)) \
return false; \
t.field = (val); \
return cust_write_table(path, &t); \
} while (0)
// static inline bool cust_set_cust_rev(const char* p, u32 v) { CUST_WRITE_FIELD(p, custRev, v); }
// static inline bool cust_set_mtc_conf(const char* p, u32 v) { CUST_WRITE_FIELD(p, mtcConf, v); }
static inline bool cust_set_hp_mode(const char* p, u32 v) { CUST_WRITE_FIELD(p, hpMode, v); }
static inline bool cust_set_hp_mode(const char *p, u32 v) {
CUST_WRITE_FIELD(p, hpMode, v);
}
static inline bool cust_set_common_emc_volt(const char* p, u32 v) { CUST_WRITE_FIELD(p, commonEmcMemVolt, v); }
static inline bool cust_set_erista_emc_max(const char* p, u32 v) { CUST_WRITE_FIELD(p, eristaEmcMaxClock, v); }
static inline bool cust_set_step_mode(const char* p, u32 v) { CUST_WRITE_FIELD(p, stepMode, v); }
static inline bool cust_set_mariko_emc_max(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoEmcMaxClock, v); }
static inline bool cust_set_mariko_emc_vddq(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoEmcVddqVolt, v); }
static inline bool cust_set_emc_dvb_shift(const char* p, u32 v) { CUST_WRITE_FIELD(p, emcDvbShift, v); }
static inline bool cust_set_common_emc_volt(const char *p, u32 v) {
CUST_WRITE_FIELD(p, commonEmcMemVolt, v);
}
static inline bool cust_set_erista_emc_max(const char *p, u32 v) {
CUST_WRITE_FIELD(p, eristaEmcMaxClock, v);
}
static inline bool cust_set_step_mode(const char *p, u32 v) {
CUST_WRITE_FIELD(p, stepMode, v);
}
static inline bool cust_set_mariko_emc_max(const char *p, u32 v) {
CUST_WRITE_FIELD(p, marikoEmcMaxClock, v);
}
static inline bool cust_set_mariko_emc_vddq(const char *p, u32 v) {
CUST_WRITE_FIELD(p, marikoEmcVddqVolt, v);
}
static inline bool cust_set_emc_dvb_shift(const char *p, u32 v) {
CUST_WRITE_FIELD(p, emcDvbShift, v);
}
static inline bool cust_set_tRCD(const char* p, u32 v) { CUST_WRITE_FIELD(p, t1_tRCD, v); }
static inline bool cust_set_tRP(const char* p, u32 v) { CUST_WRITE_FIELD(p, t2_tRP, v); }
static inline bool cust_set_tRAS(const char* p, u32 v) { CUST_WRITE_FIELD(p, t3_tRAS, v); }
static inline bool cust_set_tRRD(const char* p, u32 v) { CUST_WRITE_FIELD(p, t4_tRRD, v); }
static inline bool cust_set_tRFC(const char* p, u32 v) { CUST_WRITE_FIELD(p, t5_tRFC, v); }
static inline bool cust_set_tRTW(const char* p, u32 v) { CUST_WRITE_FIELD(p, t6_tRTW, v); }
static inline bool cust_set_tWTR(const char* p, u32 v) { CUST_WRITE_FIELD(p, t7_tWTR, v); }
static inline bool cust_set_tREFI(const char* p, u32 v) { CUST_WRITE_FIELD(p, t8_tREFI, v); }
static inline bool cust_set_tRP_cap(const char* p, u32 v) { CUST_WRITE_FIELD(p, t2_tRP_cap, v); }
static inline bool cust_set_timing_emc_tbreak(const char* p, u32 v) { CUST_WRITE_FIELD(p, timingEmcTbreak, v); }
static inline bool cust_set_low_tRTW(const char* p, u32 v) { CUST_WRITE_FIELD(p, low_t6_tRTW, v); }
static inline bool cust_set_low_tWTR(const char* p, u32 v) { CUST_WRITE_FIELD(p, low_t7_tWTR, v); }
static inline bool cust_set_tRTW_fine_tune(const char* p, u32 v) { CUST_WRITE_FIELD(p, t6_tRTW_fine_tune, v); }
static inline bool cust_set_tWTR_fine_tune(const char* p, u32 v) { CUST_WRITE_FIELD(p, t7_tWTR_fine_tune, v); }
static inline bool cust_set_tRCD(const char *p, u32 v) {
CUST_WRITE_FIELD(p, t1_tRCD, v);
}
static inline bool cust_set_tRP(const char *p, u32 v) {
CUST_WRITE_FIELD(p, t2_tRP, v);
}
static inline bool cust_set_tRAS(const char *p, u32 v) {
CUST_WRITE_FIELD(p, t3_tRAS, v);
}
static inline bool cust_set_tRRD(const char *p, u32 v) {
CUST_WRITE_FIELD(p, t4_tRRD, v);
}
static inline bool cust_set_tRFC(const char *p, u32 v) {
CUST_WRITE_FIELD(p, t5_tRFC, v);
}
static inline bool cust_set_tRTW(const char *p, u32 v) {
CUST_WRITE_FIELD(p, t6_tRTW, v);
}
static inline bool cust_set_tWTR(const char *p, u32 v) {
CUST_WRITE_FIELD(p, t7_tWTR, v);
}
static inline bool cust_set_tREFI(const char *p, u32 v) {
CUST_WRITE_FIELD(p, t8_tREFI, v);
}
static inline bool cust_set_tRP_cap(const char *p, u32 v) {
CUST_WRITE_FIELD(p, t2_tRP_cap, v);
}
static inline bool cust_set_timing_emc_tbreak(const char *p, u32 v) {
CUST_WRITE_FIELD(p, timingEmcTbreak, v);
}
static inline bool cust_set_low_tRTW(const char *p, u32 v) {
CUST_WRITE_FIELD(p, low_t6_tRTW, v);
}
static inline bool cust_set_low_tWTR(const char *p, u32 v) {
CUST_WRITE_FIELD(p, low_t7_tWTR, v);
}
static inline bool cust_set_tRTW_fine_tune(const char *p, u32 v) {
CUST_WRITE_FIELD(p, t6_tRTW_fine_tune, v);
}
static inline bool cust_set_tWTR_fine_tune(const char *p, u32 v) {
CUST_WRITE_FIELD(p, t7_tWTR_fine_tune, v);
}
static inline bool cust_set_read_latency_1333(const char* p, u32 v) { CUST_WRITE_FIELD(p, readLatency1333, v); }
static inline bool cust_set_read_latency_1600(const char* p, u32 v) { CUST_WRITE_FIELD(p, readLatency1600, v); }
static inline bool cust_set_read_latency_1866(const char* p, u32 v) { CUST_WRITE_FIELD(p, readLatency1866, v); }
static inline bool cust_set_read_latency_2133(const char* p, u32 v) { CUST_WRITE_FIELD(p, readLatency2133, v); }
static inline bool cust_set_read_latency_1333(const char *p, u32 v) {
CUST_WRITE_FIELD(p, readLatency1333, v);
}
static inline bool cust_set_read_latency_1600(const char *p, u32 v) {
CUST_WRITE_FIELD(p, readLatency1600, v);
}
static inline bool cust_set_read_latency_1866(const char *p, u32 v) {
CUST_WRITE_FIELD(p, readLatency1866, v);
}
static inline bool cust_set_read_latency_2133(const char *p, u32 v) {
CUST_WRITE_FIELD(p, readLatency2133, v);
}
static inline bool cust_set_write_latency_1333(const char* p, u32 v) { CUST_WRITE_FIELD(p, writeLatency1333, v); }
static inline bool cust_set_write_latency_1600(const char* p, u32 v) { CUST_WRITE_FIELD(p, writeLatency1600, v); }
static inline bool cust_set_write_latency_1866(const char* p, u32 v) { CUST_WRITE_FIELD(p, writeLatency1866, v); }
static inline bool cust_set_write_latency_2133(const char* p, u32 v) { CUST_WRITE_FIELD(p, writeLatency2133, v); }
static inline bool cust_set_write_latency_1333(const char *p, u32 v) {
CUST_WRITE_FIELD(p, writeLatency1333, v);
}
static inline bool cust_set_write_latency_1600(const char *p, u32 v) {
CUST_WRITE_FIELD(p, writeLatency1600, v);
}
static inline bool cust_set_write_latency_1866(const char *p, u32 v) {
CUST_WRITE_FIELD(p, writeLatency1866, v);
}
static inline bool cust_set_write_latency_2133(const char *p, u32 v) {
CUST_WRITE_FIELD(p, writeLatency2133, v);
}
static inline bool cust_set_erista_cpu_uv(const char* p, u32 v) { CUST_WRITE_FIELD(p, eristaCpuUV, v); }
static inline bool cust_set_eristaCpuVmin(const char* p, u32 v) { CUST_WRITE_FIELD(p, eristaCpuVmin, v); }
static inline bool cust_set_erista_cpu_max_volt(const char* p, u32 v) { CUST_WRITE_FIELD(p, eristaCpuMaxVolt, v); }
static inline bool cust_set_eristaCpuUnlock(const char* p, u32 v) { CUST_WRITE_FIELD(p, eristaCpuUnlock, v); }
static inline bool cust_set_erista_cpu_uv(const char *p, u32 v) {
CUST_WRITE_FIELD(p, eristaCpuUV, v);
}
static inline bool cust_set_eristaCpuVmin(const char *p, u32 v) {
CUST_WRITE_FIELD(p, eristaCpuVmin, v);
}
static inline bool cust_set_erista_cpu_max_volt(const char *p, u32 v) {
CUST_WRITE_FIELD(p, eristaCpuMaxVolt, v);
}
static inline bool cust_set_eristaCpuUnlock(const char *p, u32 v) {
CUST_WRITE_FIELD(p, eristaCpuUnlock, v);
}
static inline bool cust_set_mariko_cpu_uv_low(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoCpuUVLow, v); }
static inline bool cust_set_mariko_cpu_uv_high(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoCpuUVHigh, v); }
static inline bool cust_set_mariko_cpu_low_vmin(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoCpuLowVmin, v); }
static inline bool cust_set_mariko_cpu_high_vmin(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoCpuHighVmin, v); }
static inline bool cust_set_mariko_cpu_max_volt(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoCpuMaxVolt, v); }
static inline bool cust_set_erista_cpu_boost(const char* p, u32 v) { CUST_WRITE_FIELD(p, eristaCpuBoostClock, v); }
static inline bool cust_set_mariko_cpu_boost(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoCpuBoostClock, v); }
static inline bool cust_set_mariko_cpu_uv_low(const char *p, u32 v) {
CUST_WRITE_FIELD(p, marikoCpuUVLow, v);
}
static inline bool cust_set_mariko_cpu_uv_high(const char *p, u32 v) {
CUST_WRITE_FIELD(p, marikoCpuUVHigh, v);
}
static inline bool cust_set_mariko_cpu_low_vmin(const char *p, u32 v) {
CUST_WRITE_FIELD(p, marikoCpuLowVmin, v);
}
static inline bool cust_set_mariko_cpu_high_vmin(const char *p, u32 v) {
CUST_WRITE_FIELD(p, marikoCpuHighVmin, v);
}
static inline bool cust_set_mariko_cpu_max_volt(const char *p, u32 v) {
CUST_WRITE_FIELD(p, marikoCpuMaxVolt, v);
}
static inline bool cust_set_erista_cpu_boost(const char *p, u32 v) {
CUST_WRITE_FIELD(p, eristaCpuBoostClock, v);
}
static inline bool cust_set_mariko_cpu_boost(const char *p, u32 v) {
CUST_WRITE_FIELD(p, marikoCpuBoostClock, v);
}
static inline bool cust_set_erista_gpu_uv(const char* p, u32 v) { CUST_WRITE_FIELD(p, eristaGpuUV, v); }
static inline bool cust_set_erista_gpu_vmin(const char* p, u32 v) { CUST_WRITE_FIELD(p, eristaGpuVmin, v); }
static inline bool cust_set_mariko_gpu_uv(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoGpuUV, v); }
static inline bool cust_set_mariko_gpu_vmin(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoGpuVmin, v); }
static inline bool cust_set_mariko_gpu_boot_volt(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoGpuBootVolt, v); }
static inline bool cust_set_mariko_gpu_vmax(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoGpuVmax, v); }
static inline bool cust_set_common_gpu_offset(const char* p, u32 v) { CUST_WRITE_FIELD(p, commonGpuVoltOffset, v); }
static inline bool cust_set_marikoCpuMaxClock(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoCpuMaxClock, v); }
static inline bool cust_set_marikoSocVmax(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoSocVmax, v); }
static inline bool cust_set_erista_gpu_uv(const char *p, u32 v) {
CUST_WRITE_FIELD(p, eristaGpuUV, v);
}
static inline bool cust_set_erista_gpu_vmin(const char *p, u32 v) {
CUST_WRITE_FIELD(p, eristaGpuVmin, v);
}
static inline bool cust_set_mariko_gpu_uv(const char *p, u32 v) {
CUST_WRITE_FIELD(p, marikoGpuUV, v);
}
static inline bool cust_set_mariko_gpu_vmin(const char *p, u32 v) {
CUST_WRITE_FIELD(p, marikoGpuVmin, v);
}
static inline bool cust_set_mariko_gpu_boot_volt(const char *p, u32 v) {
CUST_WRITE_FIELD(p, marikoGpuBootVolt, v);
}
static inline bool cust_set_mariko_gpu_vmax(const char *p, u32 v) {
CUST_WRITE_FIELD(p, marikoGpuVmax, v);
}
static inline bool cust_set_common_gpu_offset(const char *p, u32 v) {
CUST_WRITE_FIELD(p, commonGpuVoltOffset, v);
}
static inline bool cust_set_marikoCpuMaxClock(const char *p, u32 v) {
CUST_WRITE_FIELD(p, marikoCpuMaxClock, v);
}
static inline bool cust_set_marikoSocVmax(const char *p, u32 v) {
CUST_WRITE_FIELD(p, marikoSocVmax, v);
}
/* GPU VOLT ARRAY HELPERS */
static inline bool cust_set_erista_gpu_volt(const char* p, int idx, u32 v) {
if (idx < 0 || idx >= 27) return false;
static inline bool cust_set_erista_gpu_volt(const char *p, int idx, u32 v) {
if (idx < 0 || idx >= 27)
return false;
CustomizeTable t;
if (!cust_read_table(p, &t)) return false;
if (!cust_read_table(p, &t))
return false;
t.eristaGpuVoltArray[idx] = v;
return cust_write_table(p, &t);
}
static inline bool cust_set_mariko_gpu_volt(const char* p, int idx, u32 v) {
if (idx < 0 || idx >= 24) return false;
static inline bool cust_set_mariko_gpu_volt(const char *p, int idx, u32 v) {
if (idx < 0 || idx >= 24)
return false;
CustomizeTable t;
if (!cust_read_table(p, &t)) return false;
if (!cust_read_table(p, &t))
return false;
t.marikoGpuVoltArray[idx] = v;
return cust_write_table(p, &t);
}
static inline u32 cust_get_field(const CustomizeTable* t, u32 offset) {
if (!t) return 0;
return *(u32*)((u8*)t + offset);
static inline u32 cust_get_field(const CustomizeTable *t, u32 offset) {
if (!t)
return 0;
return *(u32 *)((u8 *)t + offset);
}
#define CUST_GET_FIELD(table, field) ((table) ? (table)->field : 0)
#define CUST_GET_FIELD(table, field) ((table) ? (table)->field : 0)
static inline u32 cust_get_cust_rev(const CustomizeTable* t) { return CUST_GET_FIELD(t, custRev); }
static inline u32 cust_get_kip_version(const CustomizeTable* t) { return CUST_GET_FIELD(t, kipVersion); }
static inline u32 cust_get_cust_rev(const CustomizeTable *t) {
return CUST_GET_FIELD(t, custRev);
}
static inline u32 cust_get_kip_version(const CustomizeTable *t) {
return CUST_GET_FIELD(t, kipVersion);
}
// static inline u32 cust_get_mtc_conf(const CustomizeTable* t) { return CUST_GET_FIELD(t, mtcConf); }
static inline u32 cust_get_hp_mode(const CustomizeTable* t) { return CUST_GET_FIELD(t, hpMode); }
static inline u32 cust_get_hp_mode(const CustomizeTable *t) {
return CUST_GET_FIELD(t, hpMode);
}
static inline u32 cust_get_common_emc_volt(const CustomizeTable* t) { return CUST_GET_FIELD(t, commonEmcMemVolt); }
static inline u32 cust_get_erista_emc_max(const CustomizeTable* t) { return CUST_GET_FIELD(t, eristaEmcMaxClock); }
static inline u32 cust_get_step_mode(const CustomizeTable* t) { return CUST_GET_FIELD(t, stepMode); }
static inline u32 cust_get_mariko_emc_max(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoEmcMaxClock); }
static inline u32 cust_get_mariko_emc_vddq(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoEmcVddqVolt); }
static inline u32 cust_get_emc_dvb_shift(const CustomizeTable* t) { return CUST_GET_FIELD(t, emcDvbShift); }
static inline u32 cust_get_common_emc_volt(const CustomizeTable *t) {
return CUST_GET_FIELD(t, commonEmcMemVolt);
}
static inline u32 cust_get_erista_emc_max(const CustomizeTable *t) {
return CUST_GET_FIELD(t, eristaEmcMaxClock);
}
static inline u32 cust_get_step_mode(const CustomizeTable *t) {
return CUST_GET_FIELD(t, stepMode);
}
static inline u32 cust_get_mariko_emc_max(const CustomizeTable *t) {
return CUST_GET_FIELD(t, marikoEmcMaxClock);
}
static inline u32 cust_get_mariko_emc_vddq(const CustomizeTable *t) {
return CUST_GET_FIELD(t, marikoEmcVddqVolt);
}
static inline u32 cust_get_emc_dvb_shift(const CustomizeTable *t) {
return CUST_GET_FIELD(t, emcDvbShift);
}
static inline u32 cust_get_tRCD(const CustomizeTable* t) { return CUST_GET_FIELD(t, t1_tRCD); }
static inline u32 cust_get_tRP(const CustomizeTable* t) { return CUST_GET_FIELD(t, t2_tRP); }
static inline u32 cust_get_tRAS(const CustomizeTable* t) { return CUST_GET_FIELD(t, t3_tRAS); }
static inline u32 cust_get_tRRD(const CustomizeTable* t) { return CUST_GET_FIELD(t, t4_tRRD); }
static inline u32 cust_get_tRFC(const CustomizeTable* t) { return CUST_GET_FIELD(t, t5_tRFC); }
static inline u32 cust_get_tRTW(const CustomizeTable* t) { return CUST_GET_FIELD(t, t6_tRTW); }
static inline u32 cust_get_tWTR(const CustomizeTable* t) { return CUST_GET_FIELD(t, t7_tWTR); }
static inline u32 cust_get_tREFI(const CustomizeTable* t) { return CUST_GET_FIELD(t, t8_tREFI); }
static inline u32 cust_get_tRP_cap(const CustomizeTable* t) { return CUST_GET_FIELD(t, t2_tRP_cap); }
static inline u32 cust_get_timing_emc_tbreak(const CustomizeTable* t) { return CUST_GET_FIELD(t, timingEmcTbreak); }
static inline u32 cust_get_low_t6_tRTW(const CustomizeTable* t) { return CUST_GET_FIELD(t, low_t6_tRTW); }
static inline u32 cust_get_low_t7_tWTR(const CustomizeTable* t) { return CUST_GET_FIELD(t, low_t7_tWTR); }
static inline u32 cust_get_tRTW_fine_tune(const CustomizeTable* t) { return CUST_GET_FIELD(t, t6_tRTW_fine_tune); }
static inline u32 cust_get_tWTR_fine_tune(const CustomizeTable* t) { return CUST_GET_FIELD(t, t7_tWTR_fine_tune); }
static inline u32 cust_get_tRCD(const CustomizeTable *t) {
return CUST_GET_FIELD(t, t1_tRCD);
}
static inline u32 cust_get_tRP(const CustomizeTable *t) {
return CUST_GET_FIELD(t, t2_tRP);
}
static inline u32 cust_get_tRAS(const CustomizeTable *t) {
return CUST_GET_FIELD(t, t3_tRAS);
}
static inline u32 cust_get_tRRD(const CustomizeTable *t) {
return CUST_GET_FIELD(t, t4_tRRD);
}
static inline u32 cust_get_tRFC(const CustomizeTable *t) {
return CUST_GET_FIELD(t, t5_tRFC);
}
static inline u32 cust_get_tRTW(const CustomizeTable *t) {
return CUST_GET_FIELD(t, t6_tRTW);
}
static inline u32 cust_get_tWTR(const CustomizeTable *t) {
return CUST_GET_FIELD(t, t7_tWTR);
}
static inline u32 cust_get_tREFI(const CustomizeTable *t) {
return CUST_GET_FIELD(t, t8_tREFI);
}
static inline u32 cust_get_tRP_cap(const CustomizeTable *t) {
return CUST_GET_FIELD(t, t2_tRP_cap);
}
static inline u32 cust_get_timing_emc_tbreak(const CustomizeTable *t) {
return CUST_GET_FIELD(t, timingEmcTbreak);
}
static inline u32 cust_get_low_t6_tRTW(const CustomizeTable *t) {
return CUST_GET_FIELD(t, low_t6_tRTW);
}
static inline u32 cust_get_low_t7_tWTR(const CustomizeTable *t) {
return CUST_GET_FIELD(t, low_t7_tWTR);
}
static inline u32 cust_get_tRTW_fine_tune(const CustomizeTable *t) {
return CUST_GET_FIELD(t, t6_tRTW_fine_tune);
}
static inline u32 cust_get_tWTR_fine_tune(const CustomizeTable *t) {
return CUST_GET_FIELD(t, t7_tWTR_fine_tune);
}
static inline u32 cust_get_read_latency_1333(const CustomizeTable* t) { return CUST_GET_FIELD(t, readLatency1333); }
static inline u32 cust_get_read_latency_1600(const CustomizeTable* t) { return CUST_GET_FIELD(t, readLatency1600); }
static inline u32 cust_get_read_latency_1866(const CustomizeTable* t) { return CUST_GET_FIELD(t, readLatency1866); }
static inline u32 cust_get_read_latency_2133(const CustomizeTable* t) { return CUST_GET_FIELD(t, readLatency2133); }
static inline u32 cust_get_read_latency_1333(const CustomizeTable *t) {
return CUST_GET_FIELD(t, readLatency1333);
}
static inline u32 cust_get_read_latency_1600(const CustomizeTable *t) {
return CUST_GET_FIELD(t, readLatency1600);
}
static inline u32 cust_get_read_latency_1866(const CustomizeTable *t) {
return CUST_GET_FIELD(t, readLatency1866);
}
static inline u32 cust_get_read_latency_2133(const CustomizeTable *t) {
return CUST_GET_FIELD(t, readLatency2133);
}
static inline u32 cust_get_write_latency_1333(const CustomizeTable* t) { return CUST_GET_FIELD(t, writeLatency1333); }
static inline u32 cust_get_write_latency_1600(const CustomizeTable* t) { return CUST_GET_FIELD(t, writeLatency1600); }
static inline u32 cust_get_write_latency_1866(const CustomizeTable* t) { return CUST_GET_FIELD(t, writeLatency1866); }
static inline u32 cust_get_write_latency_2133(const CustomizeTable* t) { return CUST_GET_FIELD(t, writeLatency2133); }
static inline u32 cust_get_write_latency_1333(const CustomizeTable *t) {
return CUST_GET_FIELD(t, writeLatency1333);
}
static inline u32 cust_get_write_latency_1600(const CustomizeTable *t) {
return CUST_GET_FIELD(t, writeLatency1600);
}
static inline u32 cust_get_write_latency_1866(const CustomizeTable *t) {
return CUST_GET_FIELD(t, writeLatency1866);
}
static inline u32 cust_get_write_latency_2133(const CustomizeTable *t) {
return CUST_GET_FIELD(t, writeLatency2133);
}
static inline u32 cust_get_erista_cpu_uv(const CustomizeTable* t) { return CUST_GET_FIELD(t, eristaCpuUV); }
static inline u32 cust_get_eristaCpuVmin(const CustomizeTable* t) { return CUST_GET_FIELD(t, eristaCpuVmin); }
static inline u32 cust_get_erista_cpu_max_volt(const CustomizeTable* t) { return CUST_GET_FIELD(t, eristaCpuMaxVolt); }
static inline u32 cust_get_eristaCpuUnlock(const CustomizeTable* t) { return CUST_GET_FIELD(t, eristaCpuUnlock); }
static inline u32 cust_get_erista_cpu_uv(const CustomizeTable *t) {
return CUST_GET_FIELD(t, eristaCpuUV);
}
static inline u32 cust_get_eristaCpuVmin(const CustomizeTable *t) {
return CUST_GET_FIELD(t, eristaCpuVmin);
}
static inline u32 cust_get_erista_cpu_max_volt(const CustomizeTable *t) {
return CUST_GET_FIELD(t, eristaCpuMaxVolt);
}
static inline u32 cust_get_eristaCpuUnlock(const CustomizeTable *t) {
return CUST_GET_FIELD(t, eristaCpuUnlock);
}
static inline u32 cust_get_mariko_cpu_uv_low(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoCpuUVLow); }
static inline u32 cust_get_mariko_cpu_uv_high(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoCpuUVHigh); }
static inline u32 cust_get_mariko_cpu_low_vmin(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoCpuLowVmin); }
static inline u32 cust_get_mariko_cpu_high_vmin(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoCpuHighVmin); }
static inline u32 cust_get_mariko_cpu_max_volt(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoCpuMaxVolt); }
static inline u32 cust_get_erista_cpu_boost(const CustomizeTable* t) { return CUST_GET_FIELD(t, eristaCpuBoostClock); }
static inline u32 cust_get_mariko_cpu_boost(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoCpuBoostClock); }
static inline u32 cust_get_table_conf(const CustomizeTable* t) { return CUST_GET_FIELD(t, tableConf); }
static inline u32 cust_get_mariko_cpu_uv_low(const CustomizeTable *t) {
return CUST_GET_FIELD(t, marikoCpuUVLow);
}
static inline u32 cust_get_mariko_cpu_uv_high(const CustomizeTable *t) {
return CUST_GET_FIELD(t, marikoCpuUVHigh);
}
static inline u32 cust_get_mariko_cpu_low_vmin(const CustomizeTable *t) {
return CUST_GET_FIELD(t, marikoCpuLowVmin);
}
static inline u32 cust_get_mariko_cpu_high_vmin(const CustomizeTable *t) {
return CUST_GET_FIELD(t, marikoCpuHighVmin);
}
static inline u32 cust_get_mariko_cpu_max_volt(const CustomizeTable *t) {
return CUST_GET_FIELD(t, marikoCpuMaxVolt);
}
static inline u32 cust_get_erista_cpu_boost(const CustomizeTable *t) {
return CUST_GET_FIELD(t, eristaCpuBoostClock);
}
static inline u32 cust_get_mariko_cpu_boost(const CustomizeTable *t) {
return CUST_GET_FIELD(t, marikoCpuBoostClock);
}
static inline u32 cust_get_table_conf(const CustomizeTable *t) {
return CUST_GET_FIELD(t, tableConf);
}
static inline u32 cust_get_erista_gpu_uv(const CustomizeTable* t) { return CUST_GET_FIELD(t, eristaGpuUV); }
static inline u32 cust_get_erista_gpu_vmin(const CustomizeTable* t) { return CUST_GET_FIELD(t, eristaGpuVmin); }
static inline u32 cust_get_mariko_gpu_uv(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoGpuUV); }
static inline u32 cust_get_mariko_gpu_vmin(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoGpuVmin); }
static inline u32 cust_get_mariko_gpu_boot_volt(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoGpuBootVolt); }
static inline u32 cust_get_mariko_gpu_vmax(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoGpuVmax); }
static inline u32 cust_get_common_gpu_offset(const CustomizeTable* t) { return CUST_GET_FIELD(t, commonGpuVoltOffset); }
static inline u32 cust_get_marikoCpuMaxClock(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoCpuMaxClock); }
static inline u32 cust_get_marikoSocVmax(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoSocVmax); }
static inline u32 cust_get_erista_gpu_uv(const CustomizeTable *t) {
return CUST_GET_FIELD(t, eristaGpuUV);
}
static inline u32 cust_get_erista_gpu_vmin(const CustomizeTable *t) {
return CUST_GET_FIELD(t, eristaGpuVmin);
}
static inline u32 cust_get_mariko_gpu_uv(const CustomizeTable *t) {
return CUST_GET_FIELD(t, marikoGpuUV);
}
static inline u32 cust_get_mariko_gpu_vmin(const CustomizeTable *t) {
return CUST_GET_FIELD(t, marikoGpuVmin);
}
static inline u32 cust_get_mariko_gpu_boot_volt(const CustomizeTable *t) {
return CUST_GET_FIELD(t, marikoGpuBootVolt);
}
static inline u32 cust_get_mariko_gpu_vmax(const CustomizeTable *t) {
return CUST_GET_FIELD(t, marikoGpuVmax);
}
static inline u32 cust_get_common_gpu_offset(const CustomizeTable *t) {
return CUST_GET_FIELD(t, commonGpuVoltOffset);
}
static inline u32 cust_get_marikoCpuMaxClock(const CustomizeTable *t) {
return CUST_GET_FIELD(t, marikoCpuMaxClock);
}
static inline u32 cust_get_marikoSocVmax(const CustomizeTable *t) {
return CUST_GET_FIELD(t, marikoSocVmax);
}
static inline u32 cust_get_erista_gpu_volt(const CustomizeTable* t, int idx) {
if (!t || idx < 0 || idx >= 27) return 0;
static inline u32 cust_get_erista_gpu_volt(const CustomizeTable *t, int idx) {
if (!t || idx < 0 || idx >= 27)
return 0;
return t->eristaGpuVoltArray[idx];
}
static inline u32 cust_get_mariko_gpu_volt(const CustomizeTable* t, int idx) {
if (!t || idx < 0 || idx >= 24) return 0;
static inline u32 cust_get_mariko_gpu_volt(const CustomizeTable *t, int idx) {
if (!t || idx < 0 || idx >= 24)
return 0;
return t->marikoGpuVoltArray[idx];
}
#define DECL_ERISTA_GPU_VOLT_HELPER(freq, idx) \
static inline bool cust_set_erista_gpu_volt_##freq( \
const char* p, u32 v) { \
return cust_set_erista_gpu_volt(p, idx, v); \
#define DECL_ERISTA_GPU_VOLT_HELPER(freq, idx) \
static inline bool cust_set_erista_gpu_volt_##freq(const char *p, u32 v) { \
return cust_set_erista_gpu_volt(p, idx, v); \
}
#define DECL_MARIKO_GPU_VOLT_HELPER(freq, idx) \
static inline bool cust_set_mariko_gpu_volt_##freq( \
const char* p, u32 v) { \
return cust_set_mariko_gpu_volt(p, idx, v); \
#define DECL_MARIKO_GPU_VOLT_HELPER(freq, idx) \
static inline bool cust_set_mariko_gpu_volt_##freq(const char *p, u32 v) { \
return cust_set_mariko_gpu_volt(p, idx, v); \
}
DECL_ERISTA_GPU_VOLT_HELPER(76800, 0)
DECL_ERISTA_GPU_VOLT_HELPER(115200, 1)
DECL_ERISTA_GPU_VOLT_HELPER(153600, 2)
DECL_ERISTA_GPU_VOLT_HELPER(192000, 3)
DECL_ERISTA_GPU_VOLT_HELPER(230400, 4)
DECL_ERISTA_GPU_VOLT_HELPER(268800, 5)
DECL_ERISTA_GPU_VOLT_HELPER(307200, 6)
DECL_ERISTA_GPU_VOLT_HELPER(345600, 7)
DECL_ERISTA_GPU_VOLT_HELPER(384000, 8)
DECL_ERISTA_GPU_VOLT_HELPER(422400, 9)
DECL_ERISTA_GPU_VOLT_HELPER(460800, 10)
DECL_ERISTA_GPU_VOLT_HELPER(499200, 11)
DECL_ERISTA_GPU_VOLT_HELPER(537600, 12)
DECL_ERISTA_GPU_VOLT_HELPER(576000, 13)
DECL_ERISTA_GPU_VOLT_HELPER(614400, 14)
DECL_ERISTA_GPU_VOLT_HELPER(652800, 15)
DECL_ERISTA_GPU_VOLT_HELPER(691200, 16)
DECL_ERISTA_GPU_VOLT_HELPER(729600, 17)
DECL_ERISTA_GPU_VOLT_HELPER(768000, 18)
DECL_ERISTA_GPU_VOLT_HELPER(806400, 19)
DECL_ERISTA_GPU_VOLT_HELPER(844800, 20)
DECL_ERISTA_GPU_VOLT_HELPER(883200, 21)
DECL_ERISTA_GPU_VOLT_HELPER(921600, 22)
DECL_ERISTA_GPU_VOLT_HELPER(960000, 23)
DECL_ERISTA_GPU_VOLT_HELPER(998400, 24)
DECL_ERISTA_GPU_VOLT_HELPER(76800, 0)
DECL_ERISTA_GPU_VOLT_HELPER(115200, 1)
DECL_ERISTA_GPU_VOLT_HELPER(153600, 2)
DECL_ERISTA_GPU_VOLT_HELPER(192000, 3)
DECL_ERISTA_GPU_VOLT_HELPER(230400, 4)
DECL_ERISTA_GPU_VOLT_HELPER(268800, 5)
DECL_ERISTA_GPU_VOLT_HELPER(307200, 6)
DECL_ERISTA_GPU_VOLT_HELPER(345600, 7)
DECL_ERISTA_GPU_VOLT_HELPER(384000, 8)
DECL_ERISTA_GPU_VOLT_HELPER(422400, 9)
DECL_ERISTA_GPU_VOLT_HELPER(460800, 10)
DECL_ERISTA_GPU_VOLT_HELPER(499200, 11)
DECL_ERISTA_GPU_VOLT_HELPER(537600, 12)
DECL_ERISTA_GPU_VOLT_HELPER(576000, 13)
DECL_ERISTA_GPU_VOLT_HELPER(614400, 14)
DECL_ERISTA_GPU_VOLT_HELPER(652800, 15)
DECL_ERISTA_GPU_VOLT_HELPER(691200, 16)
DECL_ERISTA_GPU_VOLT_HELPER(729600, 17)
DECL_ERISTA_GPU_VOLT_HELPER(768000, 18)
DECL_ERISTA_GPU_VOLT_HELPER(806400, 19)
DECL_ERISTA_GPU_VOLT_HELPER(844800, 20)
DECL_ERISTA_GPU_VOLT_HELPER(883200, 21)
DECL_ERISTA_GPU_VOLT_HELPER(921600, 22)
DECL_ERISTA_GPU_VOLT_HELPER(960000, 23)
DECL_ERISTA_GPU_VOLT_HELPER(998400, 24)
DECL_ERISTA_GPU_VOLT_HELPER(1036800, 25)
DECL_ERISTA_GPU_VOLT_HELPER(1075200, 26)
DECL_MARIKO_GPU_VOLT_HELPER(76800, 0)
DECL_MARIKO_GPU_VOLT_HELPER(153600, 1)
DECL_MARIKO_GPU_VOLT_HELPER(230400, 2)
DECL_MARIKO_GPU_VOLT_HELPER(307200, 3)
DECL_MARIKO_GPU_VOLT_HELPER(384000, 4)
DECL_MARIKO_GPU_VOLT_HELPER(460800, 5)
DECL_MARIKO_GPU_VOLT_HELPER(537600, 6)
DECL_MARIKO_GPU_VOLT_HELPER(614400, 7)
DECL_MARIKO_GPU_VOLT_HELPER(691200, 8)
DECL_MARIKO_GPU_VOLT_HELPER(768000, 9)
DECL_MARIKO_GPU_VOLT_HELPER(844800, 10)
DECL_MARIKO_GPU_VOLT_HELPER(921600, 11)
DECL_MARIKO_GPU_VOLT_HELPER(998400, 12)
DECL_MARIKO_GPU_VOLT_HELPER(76800, 0)
DECL_MARIKO_GPU_VOLT_HELPER(153600, 1)
DECL_MARIKO_GPU_VOLT_HELPER(230400, 2)
DECL_MARIKO_GPU_VOLT_HELPER(307200, 3)
DECL_MARIKO_GPU_VOLT_HELPER(384000, 4)
DECL_MARIKO_GPU_VOLT_HELPER(460800, 5)
DECL_MARIKO_GPU_VOLT_HELPER(537600, 6)
DECL_MARIKO_GPU_VOLT_HELPER(614400, 7)
DECL_MARIKO_GPU_VOLT_HELPER(691200, 8)
DECL_MARIKO_GPU_VOLT_HELPER(768000, 9)
DECL_MARIKO_GPU_VOLT_HELPER(844800, 10)
DECL_MARIKO_GPU_VOLT_HELPER(921600, 11)
DECL_MARIKO_GPU_VOLT_HELPER(998400, 12)
DECL_MARIKO_GPU_VOLT_HELPER(1075200, 13)
DECL_MARIKO_GPU_VOLT_HELPER(1152000, 14)
DECL_MARIKO_GPU_VOLT_HELPER(1228800, 15)
@@ -420,60 +640,62 @@ namespace kip {
DECL_MARIKO_GPU_VOLT_HELPER(1497600, 22)
DECL_MARIKO_GPU_VOLT_HELPER(1536000, 23)
#define DECL_ERISTA_GPU_VOLT_GET(freq, idx) \
static inline u32 cust_get_erista_gpu_volt_##freq##_val(const char* p) { \
CustomizeTable t; \
if (!cust_read_table(p, &t)) return 0; \
return cust_get_erista_gpu_volt(&t, idx); \
#define DECL_ERISTA_GPU_VOLT_GET(freq, idx) \
static inline u32 cust_get_erista_gpu_volt_##freq##_val(const char *p) { \
CustomizeTable t; \
if (!cust_read_table(p, &t)) \
return 0; \
return cust_get_erista_gpu_volt(&t, idx); \
}
#define DECL_MARIKO_GPU_VOLT_GET(freq, idx) \
static inline u32 cust_get_mariko_gpu_volt_##freq##_val(const char* p) { \
CustomizeTable t; \
if (!cust_read_table(p, &t)) return 0; \
return cust_get_mariko_gpu_volt(&t, idx); \
#define DECL_MARIKO_GPU_VOLT_GET(freq, idx) \
static inline u32 cust_get_mariko_gpu_volt_##freq##_val(const char *p) { \
CustomizeTable t; \
if (!cust_read_table(p, &t)) \
return 0; \
return cust_get_mariko_gpu_volt(&t, idx); \
}
DECL_ERISTA_GPU_VOLT_GET(76800, 0)
DECL_ERISTA_GPU_VOLT_GET(115200, 1)
DECL_ERISTA_GPU_VOLT_GET(153600, 2)
DECL_ERISTA_GPU_VOLT_GET(192000, 3)
DECL_ERISTA_GPU_VOLT_GET(230400, 4)
DECL_ERISTA_GPU_VOLT_GET(268800, 5)
DECL_ERISTA_GPU_VOLT_GET(307200, 6)
DECL_ERISTA_GPU_VOLT_GET(345600, 7)
DECL_ERISTA_GPU_VOLT_GET(384000, 8)
DECL_ERISTA_GPU_VOLT_GET(422400, 9)
DECL_ERISTA_GPU_VOLT_GET(460800, 10)
DECL_ERISTA_GPU_VOLT_GET(499200, 11)
DECL_ERISTA_GPU_VOLT_GET(537600, 12)
DECL_ERISTA_GPU_VOLT_GET(576000, 13)
DECL_ERISTA_GPU_VOLT_GET(614400, 14)
DECL_ERISTA_GPU_VOLT_GET(652800, 15)
DECL_ERISTA_GPU_VOLT_GET(691200, 16)
DECL_ERISTA_GPU_VOLT_GET(729600, 17)
DECL_ERISTA_GPU_VOLT_GET(768000, 18)
DECL_ERISTA_GPU_VOLT_GET(806400, 19)
DECL_ERISTA_GPU_VOLT_GET(844800, 20)
DECL_ERISTA_GPU_VOLT_GET(883200, 21)
DECL_ERISTA_GPU_VOLT_GET(921600, 22)
DECL_ERISTA_GPU_VOLT_GET(960000, 23)
DECL_ERISTA_GPU_VOLT_GET(998400, 24)
DECL_ERISTA_GPU_VOLT_GET(76800, 0)
DECL_ERISTA_GPU_VOLT_GET(115200, 1)
DECL_ERISTA_GPU_VOLT_GET(153600, 2)
DECL_ERISTA_GPU_VOLT_GET(192000, 3)
DECL_ERISTA_GPU_VOLT_GET(230400, 4)
DECL_ERISTA_GPU_VOLT_GET(268800, 5)
DECL_ERISTA_GPU_VOLT_GET(307200, 6)
DECL_ERISTA_GPU_VOLT_GET(345600, 7)
DECL_ERISTA_GPU_VOLT_GET(384000, 8)
DECL_ERISTA_GPU_VOLT_GET(422400, 9)
DECL_ERISTA_GPU_VOLT_GET(460800, 10)
DECL_ERISTA_GPU_VOLT_GET(499200, 11)
DECL_ERISTA_GPU_VOLT_GET(537600, 12)
DECL_ERISTA_GPU_VOLT_GET(576000, 13)
DECL_ERISTA_GPU_VOLT_GET(614400, 14)
DECL_ERISTA_GPU_VOLT_GET(652800, 15)
DECL_ERISTA_GPU_VOLT_GET(691200, 16)
DECL_ERISTA_GPU_VOLT_GET(729600, 17)
DECL_ERISTA_GPU_VOLT_GET(768000, 18)
DECL_ERISTA_GPU_VOLT_GET(806400, 19)
DECL_ERISTA_GPU_VOLT_GET(844800, 20)
DECL_ERISTA_GPU_VOLT_GET(883200, 21)
DECL_ERISTA_GPU_VOLT_GET(921600, 22)
DECL_ERISTA_GPU_VOLT_GET(960000, 23)
DECL_ERISTA_GPU_VOLT_GET(998400, 24)
DECL_ERISTA_GPU_VOLT_GET(1036800, 25)
DECL_ERISTA_GPU_VOLT_GET(1075200, 26)
DECL_MARIKO_GPU_VOLT_GET(76800, 0)
DECL_MARIKO_GPU_VOLT_GET(153600, 1)
DECL_MARIKO_GPU_VOLT_GET(230400, 2)
DECL_MARIKO_GPU_VOLT_GET(307200, 3)
DECL_MARIKO_GPU_VOLT_GET(384000, 4)
DECL_MARIKO_GPU_VOLT_GET(460800, 5)
DECL_MARIKO_GPU_VOLT_GET(537600, 6)
DECL_MARIKO_GPU_VOLT_GET(614400, 7)
DECL_MARIKO_GPU_VOLT_GET(691200, 8)
DECL_MARIKO_GPU_VOLT_GET(768000, 9)
DECL_MARIKO_GPU_VOLT_GET(844800, 10)
DECL_MARIKO_GPU_VOLT_GET(921600, 11)
DECL_MARIKO_GPU_VOLT_GET(998400, 12)
DECL_MARIKO_GPU_VOLT_GET(76800, 0)
DECL_MARIKO_GPU_VOLT_GET(153600, 1)
DECL_MARIKO_GPU_VOLT_GET(230400, 2)
DECL_MARIKO_GPU_VOLT_GET(307200, 3)
DECL_MARIKO_GPU_VOLT_GET(384000, 4)
DECL_MARIKO_GPU_VOLT_GET(460800, 5)
DECL_MARIKO_GPU_VOLT_GET(537600, 6)
DECL_MARIKO_GPU_VOLT_GET(614400, 7)
DECL_MARIKO_GPU_VOLT_GET(691200, 8)
DECL_MARIKO_GPU_VOLT_GET(768000, 9)
DECL_MARIKO_GPU_VOLT_GET(844800, 10)
DECL_MARIKO_GPU_VOLT_GET(921600, 11)
DECL_MARIKO_GPU_VOLT_GET(998400, 12)
DECL_MARIKO_GPU_VOLT_GET(1075200, 13)
DECL_MARIKO_GPU_VOLT_GET(1152000, 14)
DECL_MARIKO_GPU_VOLT_GET(1228800, 15)
@@ -488,4 +710,4 @@ namespace kip {
void MigrateKipData(u32 custRev, u32 version);
void SetKipData();
void GetKipData();
}
} // namespace kip