XWOS API  4.0
XWOS C/C++ API参考手册
载入中...
搜索中...
未找到
Pm.hxx
浏览该文件的文档.
1
13#ifndef __xwos_cxx_Pm_hxx__
14#define __xwos_cxx_Pm_hxx__
15
16#include <xwos/osal/pm.hxx>
17
18namespace xwos {
19
45template<xwid_t TCpu = 0UL>
46class Pm
47{
48 public:
49 enum PmStage : xwsq_t {
56 };
57
58 protected:
60 virtual ~Pm() {}
61 virtual void resumePeriph() = 0;
62 virtual void suspendPeriph() = 0;
63 virtual void wakeupCpu() = 0;
64 virtual void sleepCpu() = 0;
71 public:
77 void resume() { xwos_pm_resume(); }
78 enum PmStage stage() { return (enum PmStage)xwos_pm_get_stage(); }
79
80 private:
81 static void sResumePeriph(void * obj)
82 {
83 Pm * mgr = reinterpret_cast<Pm *>(obj);
84 mgr->resumePeriph();
85 }
86 static void sSuspendPeriph(void * obj)
87 {
88 Pm * mgr = reinterpret_cast<Pm *>(obj);
89 mgr->suspendPeriph();
90 }
91 static void sWakeupCpu(void * obj)
92 {
93 Pm * mgr = reinterpret_cast<Pm *>(obj);
94 mgr->wakeupCpu();
95 }
96 static void sSleepCpu(void * obj)
97 {
98 Pm * mgr = reinterpret_cast<Pm *>(obj);
99 mgr->sleepCpu();
100 }
101};
102
107} // namespace xwos
108
109#endif /* xwos/cxx/Pm.hxx */
电源管理类
Definition Pm.hxx:47
virtual void suspendPeriph()=0
static void sSuspendPeriph(void *obj)
Definition Pm.hxx:86
enum PmStage stage()
Definition Pm.hxx:78
void resume()
从低功耗模式恢复
Definition Pm.hxx:77
Pm()
Definition Pm.hxx:59
void suspend()
进入低功耗模式
Definition Pm.hxx:70
virtual void sleepCpu()=0
PmStage
Definition Pm.hxx:49
@ PmStageThawing
Definition Pm.hxx:54
@ PmStageSuspended
Definition Pm.hxx:50
@ PmStageRunning
Definition Pm.hxx:55
@ PmStageResuming
Definition Pm.hxx:52
@ PmStageFreezing
Definition Pm.hxx:53
@ PmStageSuspending
Definition Pm.hxx:51
static void sSleepCpu(void *obj)
Definition Pm.hxx:96
static void sResumePeriph(void *obj)
Definition Pm.hxx:81
virtual void wakeupCpu()=0
virtual ~Pm()
Definition Pm.hxx:60
static void sWakeupCpu(void *obj)
Definition Pm.hxx:91
virtual void resumePeriph()=0
unsigned long xwsq_t
Definition type.h:445
#define XWOS_PM_STAGE_RESUMING
Definition pm.h:55
#define XWOS_PM_STAGE_SUSPENDING
Definition pm.h:54
#define XWOS_PM_STAGE_SUSPENDED
Definition pm.h:53
#define XWOS_PM_STAGE_THAWING
Definition pm.h:58
#define XWOS_PM_STAGE_RUNNING
Definition pm.h:59
#define XWOS_PM_STAGE_FREEZING
Definition pm.h:57
static xwsq_t xwos_pm_get_stage(void)
XWOS API:获取当前电源管理阶段
Definition pm.h:128
static void xwos_pm_set_op(xwid_t cpuid, xwos_pm_op_f resume_periph, xwos_pm_op_f suspend_periph, xwos_pm_op_f wakeup_cpu, xwos_pm_op_f sleep_cpu, void *arg)
XWOS API:设置电源管理的操作函数
Definition pm.h:76
static void xwos_pm_resume(void)
XWOS API:唤醒系统
Definition pm.h:112
static void xwos_pm_suspend(void)
XWOS API:将系统切换为低功耗状态
Definition pm.h:99
Definition Bmp.hxx:21
C++操作系统抽象层:电源管理