stop ticking during intermittent sleep
This commit is contained in:
1 parent
85bfed0604
commit
cbdd35b0be
3 files changed
+19
No files matched your search
@@ -15,6 +15,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <atomic>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
|
|
||||||
@@ -79,6 +80,8 @@ namespace bpmp {
|
|||||||
Thread s_pscThread;
|
Thread s_pscThread;
|
||||||
bool s_pscExit = false;
|
bool s_pscExit = false;
|
||||||
|
|
||||||
|
std::atomic_bool s_isAwake = true;
|
||||||
|
|
||||||
void PscThreadFunc(void *) {
|
void PscThreadFunc(void *) {
|
||||||
while (!s_pscExit) {
|
while (!s_pscExit) {
|
||||||
Result rc = eventWait(&s_pscModule.event, 1'000'000'000ULL);
|
Result rc = eventWait(&s_pscModule.event, 1'000'000'000ULL);
|
||||||
@@ -95,6 +98,10 @@ namespace bpmp {
|
|||||||
if (R_FAILED(wrc)) {
|
if (R_FAILED(wrc)) {
|
||||||
fileUtils::LogLine("[bpmp] restart after wake failed: 0x%x", wrc);
|
fileUtils::LogLine("[bpmp] restart after wake failed: 0x%x", wrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s_isAwake = true;
|
||||||
|
} else if (state == PscPmState_ReadySleep) {
|
||||||
|
s_isAwake = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pscPmModuleAcknowledge(&s_pscModule, state);
|
pscPmModuleAcknowledge(&s_pscModule, state);
|
||||||
@@ -221,4 +228,8 @@ namespace bpmp {
|
|||||||
return &s_sharedInfo;
|
return &s_sharedInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsAwake() {
|
||||||
|
return s_isAwake;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace bpmp
|
} // namespace bpmp
|
||||||
@@ -27,4 +27,7 @@ namespace bpmp {
|
|||||||
void StopSleepMonitorThread();
|
void StopSleepMonitorThread();
|
||||||
|
|
||||||
const HocClkBpmpSharedInfo *GetSharedInfo();
|
const HocClkBpmpSharedInfo *GetSharedInfo();
|
||||||
|
|
||||||
|
// Always true on stock exosphere
|
||||||
|
bool IsAwake();
|
||||||
}
|
}
|
||||||
@@ -879,6 +879,11 @@ namespace clockManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WaitForNextTick() {
|
void WaitForNextTick() {
|
||||||
|
if (!bpmp::IsAwake()) {
|
||||||
|
svcSleepThread(250 * 1000000ULL); // 250ms
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (board::GetHz(HocClkModule_MEM) > 665000000)
|
if (board::GetHz(HocClkModule_MEM) > 665000000)
|
||||||
svcSleepThread(config::GetConfigValue(HocClkConfigValue_PollingIntervalMs) * 1000000ULL);
|
svcSleepThread(config::GetConfigValue(HocClkConfigValue_PollingIntervalMs) * 1000000ULL);
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in new issue
Block a user