Skip to content

Commit

Permalink
Sync up with clkrst libnx API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
p-sam committed Apr 24, 2019
1 parent f393d46 commit 9037d4c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/clocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,22 @@ PcvModule Clocks::GetPcvModule(ClockModule clockmodule) {
return (PcvModule)0;
}

PcvModuleId Clocks::GetPcvModuleId(ClockModule clockmodule) {
switch(clockmodule)
{
case ClockModule_CPU:
return PcvModuleId_CpuBus;
case ClockModule_GPU:
return PcvModuleId_GPU;
case ClockModule_MEM:
return PcvModuleId_EMC;
default:
ERROR_THROW("No such ClockModule: %u", clockmodule);
}

return (PcvModuleId)0;
}

std::uint32_t Clocks::ResetToStock() {
std::uint32_t mode = 0;
Result rc = apmExtGetPerformanceMode(&mode);
Expand Down Expand Up @@ -163,7 +179,7 @@ void Clocks::SetHz(ClockModule module, std::uint32_t hz)
if(hosversionAtLeast(8,0,0)) {
ClkrstSession session = {0};

rc = clkrstOpenSession(&session, Clocks::GetPcvModule(module));
rc = clkrstOpenSession(&session, Clocks::GetPcvModuleId(module), 3);
ASSERT_RESULT_OK(rc, "clkrstOpenSession");

rc = clkrstSetClockRate(&session, hz);
Expand All @@ -184,7 +200,7 @@ std::uint32_t Clocks::GetCurrentHz(ClockModule module)
if(hosversionAtLeast(8,0,0)) {
ClkrstSession session = {0};

rc = clkrstOpenSession(&session, Clocks::GetPcvModule(module));
rc = clkrstOpenSession(&session, Clocks::GetPcvModuleId(module), 3);
ASSERT_RESULT_OK(rc, "clkrstOpenSession");

rc = clkrstGetClockRate(&session, &hz);
Expand Down
1 change: 1 addition & 0 deletions src/clocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Clocks

protected:
static PcvModule GetPcvModule(ClockModule clockmodule);
static PcvModuleId GetPcvModuleId(ClockModule clockmodule);
static std::uint32_t GetNearestHz(ClockModule module, std::uint32_t inHz);
static void GetList(ClockModule module, std::uint32_t **outClocks, size_t *outClockCount);
static std::uint32_t GetMaxAllowedHz(ClockModule module, ClockProfile profile);
Expand Down

0 comments on commit 9037d4c

Please sign in to comment.