WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
los_lowpower_pri.h
浏览该文件的文档.
1/* ----------------------------------------------------------------------------
2 * Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. 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
29#ifndef _LOS_LOWPOWER_IMPL_PRI_H
30#define _LOS_LOWPOWER_IMPL_PRI_H
31
32#include "los_spinlock.h"
33#include "los_task.h"
34#include "los_hwi.h"
35#include "los_lowpower.h"
36
37#ifdef LOSCFG_KERNEL_RUNSTOP
38#include "los_runstop_pri.h"
39#endif
40
41#ifdef LOSCFG_KERNEL_TICKLESS
42#include "los_tickless_pri.h"
43#endif
44
45#ifdef LOSCFG_KERNEL_DEEPSLEEP
46#include "los_deepsleep_pri.h"
47#endif
48
49#ifdef LOSCFG_KERNEL_RAM_SAVE
50extern VOID OsContextRestore(VOID);
51#endif
52
53#ifdef LOSCFG_KERNEL_DEEPSLEEP
54extern VOID OsTickHandler(VOID);
55#endif
56
57#ifdef LOSCFG_KERNEL_LOWPOWER
58#define CALL_FUNC_NO_RETURN(ops, func, ...) do { \
59 if (((ops).func != NULL)) { \
60 (ops).func(__VA_ARGS__); \
61 } \
62 } while (0)
63
64#define CALL_FUNC_WITH_RETURN(ops, ret, func, ...) do { \
65 if (((ops).func != NULL)) { \
66 (ret) = (ops).func(__VA_ARGS__); \
67 } \
68 } while (0)
69#else
70#define CALL_FUNC_NO_RETURN(ops, func, ...)
71#define CALL_FUNC_WITH_RETURN(ops, ret, func, ...)
72
73#endif
74
75#define PANIC_TICK_ADJUST_RET(ret, retcode) do { \
76 if ((ret) != (retcode)) { \
77 LOS_PANIC("[%s, %d] tick adjust fail, max sleep time too big\n", __FUNCTION__, __LINE__); \
78 } \
79 } while (0)
80
81#ifdef LOSCFG_LOWPOWER_SLEEP_VETO
82#define MAX_SLEEP_VETO_SRC 32
83#endif
84
85typedef struct {
86#ifdef LOSCFG_LOWPOWER_SLEEP_VETO
87 SPIN_LOCK_S requestSleepLock;
88 UINT32 requestSleepMode[LOS_SLEEP_MAX];
89#ifdef LOSCFG_LOWPOWER_SLEEP_DEBUG
90 UINT32 requestSleepTbl[LOS_SLEEP_MAX][MAX_SLEEP_VETO_SRC];
91#endif
92#endif
94#ifdef LOSCFG_KERNEL_LIGHTSLEEP
95 UINT32 minLightSleepTicks;
96#endif
97#ifdef LOSCFG_KERNEL_DEEPSLEEP
98 UINT32 minDeepSleepTicks;
99 UINT32 extTimerFreq;
100 UINT32 deltaTicks;
101#endif
102#if defined(LOSCFG_LOWPOWER_SLEEP_DEBUG) || defined(LOSCFG_KERNEL_DEEPSLEEP)
104#endif
105#if defined(LOSCFG_KERNEL_SMP) || defined(LOSCFG_KERNEL_DEEPSLEEP)
106 Atomic deepSleepCores;
107 Atomic resumeSleepCores;
108#endif
109#ifdef LOSCFG_KERNEL_DYN_FREQ
110 Atomic freq;
111 Atomic freqPending;
112 Atomic freeLock;
113#endif
114} PowerMgr;
115extern PowerMgr g_pmMgr;
116
117
118#ifdef LOSCFG_KERNEL_DEEPSLEEP
119extern VOID OsLowpowerWakeupFromReset(VOID);
120#endif
121
122#if defined (LOSCFG_KERNEL_DEEPSLEEP) || defined (LOSCFG_KERNEL_TICKLESS)
123extern VOID OsSysTimeUpdate(UINT32 sleepTicks);
124#endif
125
126#ifdef LOSCFG_KERNEL_DYN_FREQ
127STATIC INLINE BOOL FreqHigher(LosFreqMode freq1, LosFreqMode freq2)
128{
129 return freq1 < freq2;
130}
131#endif
132
133#ifdef __cplusplus
134extern "C" {
135#endif /* __cplusplus */
136
137#ifdef __cplusplus
138}
139#endif /* __cplusplus */
140
141#endif // _LOS_LOWPOWER_IMPL_PRI_H
#define STATIC
Definition common_def.h:57
#define INLINE
Definition common_def.h:65
#define LOSCFG_KERNEL_CORE_NUM
Definition los_config.h:258
@ LOS_SLEEP_MAX
Definition los_lowpower.h:54
PowerMgr g_pmMgr
VOID OsTickHandler(VOID)
#define VOID
Definition los_typedef.h:88
volatile INT32 Atomic
Definition los_typedef.h:85
unsigned int UINT32
Definition los_typedef.h:52
size_t BOOL
Definition los_typedef.h:83
Definition los_lowpower_pri.h:85
UINT32 maxSleepTicks
Definition los_lowpower_pri.h:93
Definition los_spinlock.h:78