Files
Horizon-OC/Source/sys-clk-OC/sysmodule/src/clock_manager.h
KazushiM b52bef3c31 Updated: Sys-clk-OC, Loader, System_settings
- Sys-clk-OC

  - Major cleanup in clock_manager, preparing to add basic Erista support.

  - Added an experimental CPU & GPU frequency governor.

    - Known issue:

      - Occasional stuttering is expected: GPU load% metric PMU_GET_GPU_LOAD does not reflect real utilization precisely. Use another metric, some interpolation algo or add min frequency option for improvement.

- Loader

  - Addressed an issue for Erista variants: Boot with unmodified Fusee or Hekate, nn::pcv::EmcDvfsPeriodicCompHandler will fail with rc 0x8C5. Fixed by removing 40.8 MHz while retaining 1600.0 MHz MEM table -- however, this means user has to use modified sys-clk.
2022-10-23 23:36:52 +08:00

59 lines
1.4 KiB
C++

/*
* --------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <p-sam@d3vs.net>, <natinusala@gmail.com>, <m4x@m4xw.net>
* wrote this file. As long as you retain this notice you can do whatever you
* want with this stuff. If you meet any of us some day, and you think this
* stuff is worth it, you can buy us a beer in return. - The sys-clk authors
* --------------------------------------------------------------------------
*/
#pragma once
#include <atomic>
#include <sysclk.h>
#include "config.h"
#include "clocks.h"
#include <nxExt/cpp/lockable_mutex.h>
#include "oc_extra.h"
class ClockManager
{
public:
static ClockManager* GetInstance();
static void Initialize();
static void Exit();
void SetRunning(bool running);
bool Running();
void Tick();
void WaitForNextTick();
SysClkContext GetCurrentContext();
Config* GetConfig();
protected:
ClockManager();
virtual ~ClockManager();
bool RefreshContext();
static ClockManager *instance;
std::atomic_bool running;
LockableMutex contextMutex;
Config *config;
SysClkContext *context;
std::uint64_t lastTempLogNs;
std::uint64_t lastCsvWriteNs;
SysClkOcExtra *oc;
ReverseNXSync *rnxSync;
Governor *governor;
bool IsCpuBoostMode();
uint32_t GetHz(SysClkModule);
};