mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-05-01 04:16:30 -04:00
Change CPU clock into separate clock domain We can control the CPU frequency independently of the peripherals.
50 lines
964 B
C++
50 lines
964 B
C++
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
|
|
|
|
#ifndef PUREPHONE_POWERMANAGER_HPP
|
|
#define PUREPHONE_POWERMANAGER_HPP
|
|
|
|
#include <functional>
|
|
|
|
#include "bsp/lpm/bsp_lpm.hpp"
|
|
|
|
namespace sys
|
|
{
|
|
|
|
class PowerManager
|
|
{
|
|
|
|
public:
|
|
enum class Mode
|
|
{
|
|
FullSpeed,
|
|
LowPowerRun,
|
|
LowPowerIdle,
|
|
Suspend
|
|
|
|
};
|
|
|
|
PowerManager();
|
|
~PowerManager();
|
|
|
|
int32_t Switch(const Mode mode);
|
|
int32_t PowerOff();
|
|
int32_t Reboot();
|
|
|
|
void SetCpuFrequency(const bsp::LowPowerMode::CpuFrequency freq);
|
|
|
|
Mode GetCurrentMode()
|
|
{
|
|
return currentPowerMode;
|
|
}
|
|
|
|
private:
|
|
std::unique_ptr<bsp::LowPowerMode> lowPowerControl;
|
|
|
|
Mode currentPowerMode = Mode ::FullSpeed;
|
|
};
|
|
|
|
} // namespace sys
|
|
|
|
#endif // PUREPHONE_POWERMANAGER_HPP
|