WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
los_lowpower.h
浏览该文件的文档.
1/* ----------------------------------------------------------------------------
2 * Copyright (c) Huawei Technologies Co., Ltd. 2020-2021. All rights reserved.
3 * Description: Low-power Framework.
4 * Author: Huawei LiteOS Team
5 * Create: 2020-09-19
6 * Redistribution and use in source and binary forms, with or without modification,
7 * are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice, this list of
9 * conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
14 * to endorse or promote products derived from this software without specific prior written
15 * permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
18 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
20 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * --------------------------------------------------------------------------- */
28
34#ifndef _LOS_LOWPOWER_H
35#define _LOS_LOWPOWER_H
36
37#include "los_base.h"
38#include "los_sys.h"
39#include "los_err.h"
40
41#ifdef __cplusplus
42extern "C" {
43#endif /* __cplusplus */
44
56
57#ifdef LOSCFG_KERNEL_DYN_FREQ
63typedef enum LOS_FREQ_MODE {
64 LOS_SYS_FREQ_SUPER = 0,
65 LOS_SYS_FREQ_HIGH,
66 LOS_SYS_FREQ_NORMAL,
67 LOS_SYS_FREQ_LOW,
68 LOS_SYS_FREQ_MAX,
69} LosFreqMode;
70
89extern VOID LOS_PowerMgrChangeFreq(LosFreqMode freq);
90#endif
91
97typedef struct {
98#ifdef LOSCFG_KERNEL_DYN_FREQ
99 UINT32 (*changeFreq)(LosFreqMode freq);
100#endif
101#if defined (LOSCFG_KERNEL_LIGHTSLEEP) || defined (LOSCFG_KERNEL_DEEPSLEEP)
102 LosSleepMode (*getSleepMode)(VOID);
103#endif
104#ifdef LOSCFG_KERNEL_LIGHTSLEEP
105 VOID (*enterLightSleep)(VOID);
106#endif
107#ifdef LOSCFG_KERNEL_DEEPSLEEP
108#ifdef LOSCFG_LOWPOWER_SLEEP_USERCONFIG
109 VOID (*userPreConfig)(VOID);
110 VOID (*userPostConfig)(VOID);
111#endif
112 VOID (*systemWakeup)(VOID);
113 VOID (*suspendConfig)(VOID);
114 VOID (*resumeConfig)(VOID);
115#ifdef LOSCFG_KERNEL_SMP
116 VOID (*otherCoreResume)(VOID);
117#endif
118 VOID (*enterDeepSleep)(VOID);
119 VOID (*setWakeUpTimer)(UINT32 timeout);
120 UINT32 (*withdrawWakeUpTimer)(VOID);
121#ifdef LOSCFG_KERNEL_RAM_SAVE
122 VOID (*contextSave)(VOID);
123 VOID (*contextRestore)(VOID);
124#endif
125#endif
126#ifdef LOSCFG_LOWPOWER_SLEEP_WFI
127 VOID (*enterWFI)(VOID);
128#endif
130
139
140#ifdef LOSCFG_KERNEL_DYN_FREQ
141 #define SET_RUNOPS_CHANGEFREQ(hook) .changeFreq = hook,
142#else
143 #define SET_RUNOPS_CHANGEFREQ(hook)
144#endif
145#if defined (LOSCFG_KERNEL_LIGHTSLEEP) || defined (LOSCFG_KERNEL_DEEPSLEEP)
146 #define SET_RUNOPS_GETSLEEPMODE(hook) .getSleepMode = hook,
147#else
148 #define SET_RUNOPS_GETSLEEPMODE(hook)
149#endif
150#ifdef LOSCFG_KERNEL_LIGHTSLEEP
151 #define SET_RUNOPS_ENTERLIGHTSLEEP(hook) .enterLightSleep = hook,
152#else
153 #define SET_RUNOPS_ENTERLIGHTSLEEP(hook)
154#endif
155#ifdef LOSCFG_KERNEL_DEEPSLEEP
156#ifdef LOSCFG_LOWPOWER_SLEEP_USERCONFIG
157 #define SET_RUNOPS_USERPRECONFIG(hook) .userPreConfig = hook,
158 #define SET_RUNOPS_USERPOSTCONFIG(hook) .userPostConfig = hook,
159#else
160 #define SET_RUNOPS_USERPRECONFIG(hook)
161 #define SET_RUNOPS_USERPOSTCONFIG(hook)
162#endif
163 #define SET_RUNOPS_SYSTEMWAKEUP(hook) .systemWakeup = hook,
164 #define SET_RUNOPS_SUSPENDCONFIG(hook) .suspendConfig = hook,
165 #define SET_RUNOPS_RESUMECONFIG(hook) .resumeConfig = hook,
166#ifdef LOSCFG_KERNEL_SMP
167 #define SET_RUNOPS_OTHERCORERESUME(hook) .otherCoreResume = hook,
168#else
169 #define SET_RUNOPS_OTHERCORERESUME(hook)
170#endif
171 #define SET_RUNOPS_ENTERDEEPSLEEP(hook) .enterDeepSleep = hook,
172 #define SET_RUNOPS_SETWAKEUPTIMER(hook) .setWakeUpTimer = hook,
173 #define SET_RUNOPS_WITHDRAWWAKEUPTIMER(hook) .withdrawWakeUpTimer = hook,
174#ifdef LOSCFG_KERNEL_RAM_SAVE
175 #define SET_RUNOPS_CONTEXTSAVE(hook) .contextSave = hook,
176 #define SET_RUNOPS_CONTEXTRESTORE(hook) .contextRestore = hook,
177#else
178 #define SET_RUNOPS_CONTEXTSAVE(hook)
179 #define SET_RUNOPS_CONTEXTRESTORE(hook)
180#endif
181#else
182 #define SET_RUNOPS_SYSTEMWAKEUP(hook)
183 #define SET_RUNOPS_SUSPENDCONFIG(hook)
184 #define SET_RUNOPS_RESUMECONFIG(hook)
185 #define SET_RUNOPS_ENTERDEEPSLEEP(hook)
186 #define SET_RUNOPS_SETWAKEUPTIMER(hook)
187 #define SET_RUNOPS_WITHDRAWWAKEUPTIMER(hook)
188#endif
189#ifdef LOSCFG_LOWPOWER_SLEEP_WFI
190 #define SET_RUNOPS_ENTERWFI(hook) .enterWFI = hook,
191#else
192 #define SET_RUNOPS_ENTERWFI(hook)
193#endif
194
213
222#define LOS_ERRNO_LPM_INIT_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x01)
223
224#ifdef LOSCFG_LOWPOWER_SLEEP_VETO
244extern UINT32 LOS_PowerMgrSleepLock(LosSleepMode mode, UINT32 requestId);
245
265extern UINT32 LOS_PowerMgrSleepUnLock(LosSleepMode mode, UINT32 requestId);
266#endif
267
268#ifdef LOSCFG_LOWPOWER_SLEEP_DEBUG
286extern VOID LOS_EnableLowPower(VOID);
287
305extern VOID LOS_DisableLowPower(VOID);
306
324extern UINT32 LOS_GetLowPowerStatus(VOID);
325#endif
326
345
346#ifdef __cplusplus
347}
348#endif /* __cplusplus */
349
350#endif /* _LOS_LOWPOWER_H */
enum LOS_SLEEP_MODE LosSleepMode
UINT32 LOS_PowerMgrInit(const PowerMgrParameter *para)
Init the power manager framework.
UINT32 LOS_SleepTicksGet(void)
Get predicted sleep ticks.
LOS_SLEEP_MODE
Definition los_lowpower.h:50
@ LOS_SLEEP_LIGHT
Definition los_lowpower.h:52
@ LOS_SLEEP_DEEP
Definition los_lowpower.h:53
@ LOS_SLEEP_MAX
Definition los_lowpower.h:54
@ LOS_SLEEP_NORMAL
Definition los_lowpower.h:51
#define VOID
Definition los_typedef.h:88
unsigned int UINT32
Definition los_typedef.h:52
Definition los_lowpower.h:136
PowerMgrRunOps runOps
Definition los_lowpower.h:137
Definition los_lowpower.h:97