mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-18 01:46:47 +00:00
fatal: Implement AdjustClockTask
This commit is contained in:
parent
aa86d1abfa
commit
e96eaa3d7c
4 changed files with 84 additions and 1 deletions
|
@ -77,6 +77,11 @@ void __appInit(void) {
|
||||||
std::abort();
|
std::abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rc = pcvInitialize();
|
||||||
|
if (R_FAILED(rc)) {
|
||||||
|
std::abort();
|
||||||
|
}
|
||||||
|
|
||||||
rc = psmInitialize();
|
rc = psmInitialize();
|
||||||
if (R_FAILED(rc)) {
|
if (R_FAILED(rc)) {
|
||||||
std::abort();
|
std::abort();
|
||||||
|
@ -94,6 +99,7 @@ void __appExit(void) {
|
||||||
/* Cleanup services. */
|
/* Cleanup services. */
|
||||||
spsmExit();
|
spsmExit();
|
||||||
psmExit();
|
psmExit();
|
||||||
|
pcvExit();
|
||||||
bpcExit();
|
bpcExit();
|
||||||
pminfoExit();
|
pminfoExit();
|
||||||
setsysExit();
|
setsysExit();
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "fatal_task.hpp"
|
#include "fatal_task.hpp"
|
||||||
|
|
||||||
#include "fatal_task_error_report.hpp"
|
#include "fatal_task_error_report.hpp"
|
||||||
|
#include "fatal_task_clock.hpp"
|
||||||
#include "fatal_task_power.hpp"
|
#include "fatal_task_power.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,7 +57,7 @@ void RunFatalTasks(FatalContext *ctx, u64 title_id, bool error_report, Event *er
|
||||||
/* TODO: RunTask(new ShowFatalTask(ctx, title_id, battery_event)); */
|
/* TODO: RunTask(new ShowFatalTask(ctx, title_id, battery_event)); */
|
||||||
/* TODO: RunTask(new StopSoundTask(ctx, title_id)); */
|
/* TODO: RunTask(new StopSoundTask(ctx, title_id)); */
|
||||||
/* TODO: RunTask(new BacklightControlTask(ctx, title_id)); */
|
/* TODO: RunTask(new BacklightControlTask(ctx, title_id)); */
|
||||||
/* TODO: RunTask(new AdjustClockTask(ctx, title_id)); */
|
RunTask(new AdjustClockTask(ctx, title_id));
|
||||||
RunTask(new PowerButtonObserveTask(ctx, title_id, erpt_event));
|
RunTask(new PowerButtonObserveTask(ctx, title_id, erpt_event));
|
||||||
RunTask(new StateTransitionStopTask(ctx, title_id));
|
RunTask(new StateTransitionStopTask(ctx, title_id));
|
||||||
}
|
}
|
||||||
|
|
45
stratosphere/fatal/source/fatal_task_clock.cpp
Normal file
45
stratosphere/fatal/source/fatal_task_clock.cpp
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <switch.h>
|
||||||
|
#include "fatal_task_clock.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
Result AdjustClockTask::AdjustClock() {
|
||||||
|
/* Fatal sets the CPU to 1020MHz, the GPU to 307 MHz, and the EMC to 1331MHz. */
|
||||||
|
constexpr u32 CPU_CLOCK_1020MHZ = 0x3CCBF700L;
|
||||||
|
constexpr u32 GPU_CLOCK_307MHZ = 0x124F8000L;
|
||||||
|
constexpr u32 EMC_CLOCK_1331MHZ = 0x4F588000L;
|
||||||
|
Result rc = 0;
|
||||||
|
|
||||||
|
if (R_FAILED((rc = pcvSetClockRate(PcvModule_Cpu, CPU_CLOCK_1020MHZ)))) {
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (R_FAILED((rc = pcvSetClockRate(PcvModule_Gpu, GPU_CLOCK_307MHZ)))) {
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (R_FAILED((rc = pcvSetClockRate(PcvModule_Emc, EMC_CLOCK_1331MHZ)))) {
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result AdjustClockTask::Run() {
|
||||||
|
return AdjustClock();
|
||||||
|
}
|
31
stratosphere/fatal/source/fatal_task_clock.hpp
Normal file
31
stratosphere/fatal/source/fatal_task_clock.hpp
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <switch.h>
|
||||||
|
#include <stratosphere.hpp>
|
||||||
|
#include "fatal_task.hpp"
|
||||||
|
|
||||||
|
class AdjustClockTask : public IFatalTask {
|
||||||
|
private:
|
||||||
|
Result AdjustClock();
|
||||||
|
public:
|
||||||
|
AdjustClockTask(FatalContext *ctx, u64 title_id) : IFatalTask(ctx, title_id) { }
|
||||||
|
virtual Result Run() override;
|
||||||
|
virtual const char *GetName() const override {
|
||||||
|
return "AdjustClockTask";
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in a new issue