11bd4fe43Sopenharmony_ci/**
21bd4fe43Sopenharmony_ci * @file hi_lowpower.h
31bd4fe43Sopenharmony_ci *
41bd4fe43Sopenharmony_ci * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
51bd4fe43Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
61bd4fe43Sopenharmony_ci * you may not use this file except in compliance with the License.
71bd4fe43Sopenharmony_ci * You may obtain a copy of the License at
81bd4fe43Sopenharmony_ci *
91bd4fe43Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
101bd4fe43Sopenharmony_ci *
111bd4fe43Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
121bd4fe43Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
131bd4fe43Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
141bd4fe43Sopenharmony_ci * See the License for the specific language governing permissions and
151bd4fe43Sopenharmony_ci * limitations under the License.
161bd4fe43Sopenharmony_ci */
171bd4fe43Sopenharmony_ci
181bd4fe43Sopenharmony_ci/**
191bd4fe43Sopenharmony_ci * @defgroup iot_lp Power consumption management
201bd4fe43Sopenharmony_ci * @ingroup  system
211bd4fe43Sopenharmony_ci */
221bd4fe43Sopenharmony_ci
231bd4fe43Sopenharmony_ci#ifndef __HI_LOWPOWER_H__
241bd4fe43Sopenharmony_ci#define __HI_LOWPOWER_H__
251bd4fe43Sopenharmony_ci
261bd4fe43Sopenharmony_ci#include <hi_types.h>
271bd4fe43Sopenharmony_ci#include <hi_gpio.h>
281bd4fe43Sopenharmony_ci
291bd4fe43Sopenharmony_ci/**
301bd4fe43Sopenharmony_ci * @ingroup iot_lp
311bd4fe43Sopenharmony_ci * UDP wakes up source enumeration.
321bd4fe43Sopenharmony_ci */
331bd4fe43Sopenharmony_citypedef enum {
341bd4fe43Sopenharmony_ci    HI_UDS_GPIO3 = 1 << 0,  /**< ultra sleep wakeup source GPIO3.CNcomment:超深睡唤醒源GPIO3 CNend */
351bd4fe43Sopenharmony_ci    HI_UDS_GPIO5 = 1 << 1,  /**< ultra sleep wakeup source GPIO5.CNcomment:超深睡唤醒源GPIO5 CNend */
361bd4fe43Sopenharmony_ci    HI_UDS_GPIO7 = 1 << 2,  /**< ultra sleep wakeup source GPIO7.CNcomment:超深睡唤醒源GPIO7 CNend */
371bd4fe43Sopenharmony_ci    HI_UDS_GPIO14 = 1 << 3, /**< ultra sleep wakeup source GPIO14.CNcomment:超深睡唤醒源GPIO14 CNend */
381bd4fe43Sopenharmony_ci} hi_udsleep_src;
391bd4fe43Sopenharmony_ci
401bd4fe43Sopenharmony_ci/**
411bd4fe43Sopenharmony_ci * @ingroup iot_lp
421bd4fe43Sopenharmony_ci * Sleep level enumeration.
431bd4fe43Sopenharmony_ci */
441bd4fe43Sopenharmony_citypedef enum {
451bd4fe43Sopenharmony_ci    HI_NO_SLEEP,    /**< no sleep type.CNcomment:不睡模式 CNend */
461bd4fe43Sopenharmony_ci    HI_LIGHT_SLEEP, /**< light sleep type.CNcomment:浅睡模式 CNend */
471bd4fe43Sopenharmony_ci    HI_DEEP_SLEEP,  /**< deep sleep type.CNcomment:深睡模式 CNend */
481bd4fe43Sopenharmony_ci} hi_lpc_type;
491bd4fe43Sopenharmony_ci
501bd4fe43Sopenharmony_ci/**
511bd4fe43Sopenharmony_ci * @ingroup hct_lp
521bd4fe43Sopenharmony_ci *
531bd4fe43Sopenharmony_ci * 睡眠模块ID 枚举,每个id占用1个bit,继续扩展时要注意最大为(1 << 31)。
541bd4fe43Sopenharmony_ci */
551bd4fe43Sopenharmony_citypedef enum {
561bd4fe43Sopenharmony_ci    HI_LPC_ID_DIAG  = 1 << 0, /**< diag uart Id.CNcomment:diag模块 Id */
571bd4fe43Sopenharmony_ci    HI_LPC_ID_SHELL = 1 << 1, /**< shell Id.CNcomment:shell模块 Id CNend */
581bd4fe43Sopenharmony_ci    HI_LPC_ID_RSV   = 1 << 15, /**< 之前均为内部预留id.CNcomment:内部预留 Id CNend */
591bd4fe43Sopenharmony_ci    HI_LPC_ID_DEMO  = 1 << 16, /**< demo Id.CNcomment:低功耗管理id样例,之后为客户预留Id CNend */
601bd4fe43Sopenharmony_ci}hi_lpc_id;
611bd4fe43Sopenharmony_ci
621bd4fe43Sopenharmony_ci/**
631bd4fe43Sopenharmony_ci * @ingroup iot_lp
641bd4fe43Sopenharmony_ci * Low power management structure.
651bd4fe43Sopenharmony_ci */
661bd4fe43Sopenharmony_citypedef struct {
671bd4fe43Sopenharmony_ci    hi_u32  wakeup_times;                   /**< wakeup times.CNcomment:唤醒次数统计 CNend */
681bd4fe43Sopenharmony_ci    hi_u32  sleep_threshold_refuse_times;  /**< sleep threshold refuse times.CNcomment:
691bd4fe43Sopenharmony_ci                                                可睡时间小于设定门限次数统计 CNend */
701bd4fe43Sopenharmony_ci    hi_u32  sleep_check_refuse_times;       /**< sleep check refuse times.CNcomment:
711bd4fe43Sopenharmony_ci                                                入睡投票睡眠失败次数统计 CNend */
721bd4fe43Sopenharmony_ci    hi_u32  sleep_times;                   /**< sleep times.CNcomment:入睡次数统计 CNend */
731bd4fe43Sopenharmony_ci    hi_u32  sleep_threshold;               /**< sleep threshold, unit is ms, only when
741bd4fe43Sopenharmony_ci                                                the system' Remaining idle time is bigger than the threshold,
751bd4fe43Sopenharmony_ci                                                system can enter deep sleep state.CNcomment:深睡眠门限,单位
761bd4fe43Sopenharmony_ci                                                为ms,当系统剩余空闲时间大于该门限时,方可进入深睡 CNend */
771bd4fe43Sopenharmony_ci    hi_u32  dsleep_fail_times; /**< the times of power off fail during deepsleep.CNcomment:深睡下电失败次数统计 CNend */
781bd4fe43Sopenharmony_ci    hi_u8   type;                  /**< hi_lpc_type type, enable low power management.
791bd4fe43Sopenharmony_ci                                         CNcomment:hi_lp_type类型,低功耗类型 CNend */
801bd4fe43Sopenharmony_ci    hi_u8   evt_sts;                 /**< wakeup event state, bit0:gpio wkup, bit1:rtc wkup, bit2:sdio wkup, bit4:
811bd4fe43Sopenharmony_ci                                        sta0 wkup, bit5:sta1 wkup, bit6:ap0 wkup.CNcomment:唤醒事件状态,bit0:gpio 唤醒,
821bd4fe43Sopenharmony_ci                                        bit1:rtc 唤醒,bit2:sdio 唤醒,bit4:sta0 唤醒, bit5:sta1 唤醒,
831bd4fe43Sopenharmony_ci                                        bit6:ap0 唤醒。 CNend */
841bd4fe43Sopenharmony_ci    hi_u8   int_sts;                 /**< wakeup interrupt state, bit0:gpio wkup, bit1:rtc wkup, bit2:sdio wkup, bit4:
851bd4fe43Sopenharmony_ci                                        sta0 wkup, bit5:sta1 wkup, bit6:ap0 wkup.CNcomment:唤醒中断状态,bit0:gpio 唤醒,
861bd4fe43Sopenharmony_ci                                        bit1:rtc 唤醒,bit2:sdio 唤醒,bit4:sta0 唤醒, bit5:sta1 唤醒,
871bd4fe43Sopenharmony_ci                                        bit6:ap0 唤醒 CNend */
881bd4fe43Sopenharmony_ci    hi_u8   last_time_vote_state;    /**< last time vote state, 0:no sleep, 1: light sleep, 2: deep sleep.
891bd4fe43Sopenharmony_ci                                        CNcomment:最近一次睡眠状态,0:没有入睡,1:浅睡,2:深睡。 CNend */
901bd4fe43Sopenharmony_ci    hi_u32  timer_ticks; /**< the time ticks is about to expire, unit is 10 ms, if the value is 0xffffffff, there is
911bd4fe43Sopenharmony_ci                                no timer that is about to expire.
921bd4fe43Sopenharmony_ci                            CNcomment:定时器即将到期的时间,单位为10ms;如果是0xffffffff,表示没有即将到期的
931bd4fe43Sopenharmony_ci                            定时器 CNend */
941bd4fe43Sopenharmony_ci    hi_u32  timer_handle; /**< the callback function address of the timer that is about to expire. if the value is
951bd4fe43Sopenharmony_ci                                0xffffffff, it means that there is no timer that is about to expire.
961bd4fe43Sopenharmony_ci                            CNcomment:即将到期定时器回调函数的地址,如果是0xffffffff,表示没有即将到期的定时器 CNend */
971bd4fe43Sopenharmony_ci    hi_u32  timer_handle_arg; /**< the parameter of the timer callback function, if the value is 0xffffffff, it means
981bd4fe43Sopenharmony_ci                                there is no timer to expire.CNcomment:定时器回调函数的参数,如果是0xffffffff,
991bd4fe43Sopenharmony_ci                                表示没有即将到期的定时器 CNend */
1001bd4fe43Sopenharmony_ci    hi_u32  task_ticks;  /**< the task ticks is about to expire, unit is 10 ms.CNcomment:任务即将到期的时间,
1011bd4fe43Sopenharmony_ci                            单位为10ms。CNend */
1021bd4fe43Sopenharmony_ci    hi_u32  task_id; /**< the task id that is about to expire.CNcomment:即将到期任务的ID。CNend */
1031bd4fe43Sopenharmony_ci    hi_u32  sleep_ticks; /**< last sleep time ticks, unit is 10 ms.CNcomment:最近一次睡眠的tick时间,
1041bd4fe43Sopenharmony_ci                            单位为10ms。CNend */
1051bd4fe43Sopenharmony_ci    hi_u32  veto_info;   /**< veto_info.CNcomment:投票否决睡眠信息,详见hi_lpc_id。CNend */
1061bd4fe43Sopenharmony_ci    hi_u16  dsleep_wk_gpio; /**< wakeup gpio for deep sleep.CNcomment:唤醒的GPIO,该值(1<<x)为1表示GPIOx使能。CNend */
1071bd4fe43Sopenharmony_ci    hi_u16  reserve;   /**< reserve.CNcomment:预留。CNend */
1081bd4fe43Sopenharmony_ci    hi_u32  refuse_vote_handle; /**< Address of voting funcfion refusing to vote for sleep.CNcomment:
1091bd4fe43Sopenharmony_ci                                    拒绝投睡眠票的投票函数地址。CNend */
1101bd4fe43Sopenharmony_ci} hi_lpc_info;
1111bd4fe43Sopenharmony_ci
1121bd4fe43Sopenharmony_ci/**
1131bd4fe43Sopenharmony_ci * @ingroup  iot_lp
1141bd4fe43Sopenharmony_ci * @brief  Low power initialization.
1151bd4fe43Sopenharmony_ci *
1161bd4fe43Sopenharmony_ci * @par Description:
1171bd4fe43Sopenharmony_ci *           Initializes power saving management. CNcomment:低功耗初始化CNend
1181bd4fe43Sopenharmony_ci *
1191bd4fe43Sopenharmony_ci * @attention This is an initialization API and does not support multi-task calling or repeated calling.
1201bd4fe43Sopenharmony_ci must call after hi_sal_init.
1211bd4fe43Sopenharmony_ci CNcomment:初始化操作是非多任务安全的,并且不支持重复调用。
1221bd4fe43Sopenharmony_ci 必须在hi_sal_init之后调用。CNend
1231bd4fe43Sopenharmony_ci * @param  None
1241bd4fe43Sopenharmony_ci *
1251bd4fe43Sopenharmony_ci * @retval #0                Success.
1261bd4fe43Sopenharmony_ci * @retval #Other            Failure. For details, see hi_errno.h.
1271bd4fe43Sopenharmony_ci * @par Dependency:
1281bd4fe43Sopenharmony_ci *            @li hi_lowpower.h: Describes power saving management APIs.
1291bd4fe43Sopenharmony_ci * @see  None
1301bd4fe43Sopenharmony_ci */
1311bd4fe43Sopenharmony_cihi_u32 hi_lpc_init(hi_void);
1321bd4fe43Sopenharmony_ci
1331bd4fe43Sopenharmony_ci/**
1341bd4fe43Sopenharmony_ci * @ingroup  iot_lp
1351bd4fe43Sopenharmony_ci * @brief  Set current lowpower type.
1361bd4fe43Sopenharmony_ci *
1371bd4fe43Sopenharmony_ci * @par Description:
1381bd4fe43Sopenharmony_ci *           Set current lowpower sleep mode. CNcomment:设置低功耗模式CNend
1391bd4fe43Sopenharmony_ci *
1401bd4fe43Sopenharmony_ci * @param  type  [IN] type #hi_lpc_type type.
1411bd4fe43Sopenharmony_ci CNcomment:低功耗模式CNend
1421bd4fe43Sopenharmony_ci *
1431bd4fe43Sopenharmony_ci * @retval #HI_ERR_SUCCESS   Success.
1441bd4fe43Sopenharmony_ci * @retval #Other    Failure. For details, see hi_errno.h.
1451bd4fe43Sopenharmony_ci * @par Dependency:
1461bd4fe43Sopenharmony_ci *            @li hi_lowpower.h: Describes power saving management APIs.
1471bd4fe43Sopenharmony_ci * @see  None
1481bd4fe43Sopenharmony_ci */
1491bd4fe43Sopenharmony_cihi_u32 hi_lpc_set_type(hi_lpc_type type);
1501bd4fe43Sopenharmony_ci
1511bd4fe43Sopenharmony_ci/**
1521bd4fe43Sopenharmony_ci * @ingroup  iot_lp
1531bd4fe43Sopenharmony_ci * @brief  Get current lowpower type.
1541bd4fe43Sopenharmony_ci *
1551bd4fe43Sopenharmony_ci * @par Description:
1561bd4fe43Sopenharmony_ci *           Get current lowpower type.CNcomment:获取当前低功耗模式。CNend
1571bd4fe43Sopenharmony_ci *
1581bd4fe43Sopenharmony_ci * @param  None
1591bd4fe43Sopenharmony_ci *
1601bd4fe43Sopenharmony_ci * @retval #hi_lpc_type current lowpower type.
1611bd4fe43Sopenharmony_ci * @par Dependency:
1621bd4fe43Sopenharmony_ci *            @li hi_lowpower.h: Describes power saving management APIs.
1631bd4fe43Sopenharmony_ci * @see  None
1641bd4fe43Sopenharmony_ci */
1651bd4fe43Sopenharmony_cihi_lpc_type hi_lpc_get_type(hi_void);
1661bd4fe43Sopenharmony_ci
1671bd4fe43Sopenharmony_ci/**
1681bd4fe43Sopenharmony_ci * @ingroup  iot_lp
1691bd4fe43Sopenharmony_ci * @brief  Register check callback fucntion.
1701bd4fe43Sopenharmony_ci *
1711bd4fe43Sopenharmony_ci * @par Description:
1721bd4fe43Sopenharmony_ci *           Register check callback function.CNComment:注册检查是否允许睡眠接口CNend
1731bd4fe43Sopenharmony_ci *
1741bd4fe43Sopenharmony_ci * @param  check_allowed [IN] type #hi_u32_void_callback
1751bd4fe43Sopenharmony_ci *         If the return value is 0 means to disable sleep,others means enable.
1761bd4fe43Sopenharmony_ci *         CNcomment:返回值为0禁止睡眠,其他值为允许.CNend
1771bd4fe43Sopenharmony_ci *
1781bd4fe43Sopenharmony_ci * @retval #hi_pvoid Hanlder.CNcomment:句柄CNend
1791bd4fe43Sopenharmony_ci * @par Dependency:
1801bd4fe43Sopenharmony_ci *            @li hi_lowpower.h: Describes power saving management APIs.
1811bd4fe43Sopenharmony_ci * @see  hi_lowpower_unregister_vote
1821bd4fe43Sopenharmony_ci */
1831bd4fe43Sopenharmony_cihi_pvoid hi_lpc_register_check_handler(hi_u32_void_callback check_allowed);
1841bd4fe43Sopenharmony_ci
1851bd4fe43Sopenharmony_ci/**
1861bd4fe43Sopenharmony_ci * @ingroup  iot_lp
1871bd4fe43Sopenharmony_ci * @brief  Cancel registation of check callback fucntion.
1881bd4fe43Sopenharmony_ci *
1891bd4fe43Sopenharmony_ci * @par Description:
1901bd4fe43Sopenharmony_ci *            Cancel registation of check callback fucntion.CNcomment:取消检查接口注册CNend
1911bd4fe43Sopenharmony_ci *
1921bd4fe43Sopenharmony_ci * @param  handle [IN] type #hi_pvoid Low power handler.CNcomment:低功耗句柄CNend
1931bd4fe43Sopenharmony_ci *
1941bd4fe43Sopenharmony_ci * @retval #0   Success.
1951bd4fe43Sopenharmony_ci * @retval #Other    Failure. For details, see hi_errno.h.
1961bd4fe43Sopenharmony_ci * @par Dependency:
1971bd4fe43Sopenharmony_ci *            @li hi_lowpower.h: Describes power saving management APIs.
1981bd4fe43Sopenharmony_ci * @see  hi_lowpower_register_vote
1991bd4fe43Sopenharmony_ci */
2001bd4fe43Sopenharmony_cihi_u32 hi_lpc_unregister_check_handler(hi_pvoid handle);
2011bd4fe43Sopenharmony_ci
2021bd4fe43Sopenharmony_ci/**
2031bd4fe43Sopenharmony_ci * @ingroup  iot_lp
2041bd4fe43Sopenharmony_ci * @brief  Add low power sleep veto.
2051bd4fe43Sopenharmony_ci *
2061bd4fe43Sopenharmony_ci * @par Description:
2071bd4fe43Sopenharmony_ci *           Add low power sleep veto. CNcomment:禁止进入睡眠模式CNend
2081bd4fe43Sopenharmony_ci *
2091bd4fe43Sopenharmony_ci * @param  id  [IN] type #hi_lpc_id module id.
2101bd4fe43Sopenharmony_ci CNcomment:模块idCNend
2111bd4fe43Sopenharmony_ci *
2121bd4fe43Sopenharmony_ci * @retval #HI_ERR_SUCCESS   Success.
2131bd4fe43Sopenharmony_ci * @retval #Other    Failure. For details, see hi_errno.h.
2141bd4fe43Sopenharmony_ci * @par Dependency:
2151bd4fe43Sopenharmony_ci *            @li hi_lowpower.h: Describes power saving management APIs.
2161bd4fe43Sopenharmony_ci * @see  None
2171bd4fe43Sopenharmony_ci */
2181bd4fe43Sopenharmony_cihi_u32 hi_lpc_add_veto(hi_lpc_id id);
2191bd4fe43Sopenharmony_ci
2201bd4fe43Sopenharmony_ci/**
2211bd4fe43Sopenharmony_ci * @ingroup  iot_lp
2221bd4fe43Sopenharmony_ci * @brief  Remove low power sleep veto.
2231bd4fe43Sopenharmony_ci *
2241bd4fe43Sopenharmony_ci * @par Description:
2251bd4fe43Sopenharmony_ci *           Set low power sleep mode. CNcomment:解除对应id的禁止进入睡眠模式状态CNend
2261bd4fe43Sopenharmony_ci *
2271bd4fe43Sopenharmony_ci * @param  id  [IN] type #hi_lpc_id module id.
2281bd4fe43Sopenharmony_ci CNcomment:模块idCNend
2291bd4fe43Sopenharmony_ci *
2301bd4fe43Sopenharmony_ci * @retval #HI_ERR_SUCCESS   Success.
2311bd4fe43Sopenharmony_ci * @retval #Other    Failure. For details, see hi_errno.h.
2321bd4fe43Sopenharmony_ci * @par Dependency:
2331bd4fe43Sopenharmony_ci *            @li hi_lowpower.h: Describes power saving management APIs.
2341bd4fe43Sopenharmony_ci * @see  None
2351bd4fe43Sopenharmony_ci */
2361bd4fe43Sopenharmony_cihi_u32 hi_lpc_remove_veto(hi_lpc_id id);
2371bd4fe43Sopenharmony_ci
2381bd4fe43Sopenharmony_ci/**
2391bd4fe43Sopenharmony_ci * @ingroup  iot_lp
2401bd4fe43Sopenharmony_ci * @brief  Statistics related to power saving.
2411bd4fe43Sopenharmony_ci *
2421bd4fe43Sopenharmony_ci * @par Description:
2431bd4fe43Sopenharmony_ci *           Statistics related to power saving.CNcomment:低功耗相关维测统计CNend
2441bd4fe43Sopenharmony_ci *
2451bd4fe43Sopenharmony_ci * @param  None
2461bd4fe43Sopenharmony_ci *
2471bd4fe43Sopenharmony_ci * @retval hi_lp_stat Pointer to the status sturcture. CNcomment:统计量指针CNend
2481bd4fe43Sopenharmony_ci * @par Dependency:
2491bd4fe43Sopenharmony_ci *            @li hi_lowpower.h: Describes power saving management APIs.
2501bd4fe43Sopenharmony_ci * @see  None
2511bd4fe43Sopenharmony_ci */
2521bd4fe43Sopenharmony_cihi_lpc_info* hi_lpc_get_info(hi_void);
2531bd4fe43Sopenharmony_ci
2541bd4fe43Sopenharmony_ci/**
2551bd4fe43Sopenharmony_ci * @ingroup  iot_lp
2561bd4fe43Sopenharmony_ci * @brief  enable ultra deep sleep wakeup source.
2571bd4fe43Sopenharmony_ci *
2581bd4fe43Sopenharmony_ci * @par Description:
2591bd4fe43Sopenharmony_ci *            enable ultra deep sleep wakeup source to low power module.CNcomment:使能低功耗超深睡唤醒源CNend
2601bd4fe43Sopenharmony_ci *
2611bd4fe43Sopenharmony_ci * @param  src  [IN] type #hi_udsleep_src Type of ultra deep sleep wakeup source enumeration.
2621bd4fe43Sopenharmony_ci CNcomment:超深睡唤醒源CNend
2631bd4fe43Sopenharmony_ci *
2641bd4fe43Sopenharmony_ci * @retval #0   Success.
2651bd4fe43Sopenharmony_ci * @retval #Other    Failure. For details, see hi_errno.h.
2661bd4fe43Sopenharmony_ci *
2671bd4fe43Sopenharmony_ci * @par Dependency:
2681bd4fe43Sopenharmony_ci *            @li hi_lowpower.h: Describes power saving management APIs.
2691bd4fe43Sopenharmony_ci * @see  None
2701bd4fe43Sopenharmony_ci */
2711bd4fe43Sopenharmony_cihi_u32 hi_lpc_enable_udsleep(hi_udsleep_src src);
2721bd4fe43Sopenharmony_ci
2731bd4fe43Sopenharmony_ci/**
2741bd4fe43Sopenharmony_ci * @ingroup  iot_lp
2751bd4fe43Sopenharmony_ci * @brief  get ultra deep sleep wakeup source.
2761bd4fe43Sopenharmony_ci *
2771bd4fe43Sopenharmony_ci * @par Description:
2781bd4fe43Sopenharmony_ci *            get the  wakeup source of ultra deep sleep.CNcomment:获取低功耗超深睡唤醒的触发源CNend
2791bd4fe43Sopenharmony_ci *
2801bd4fe43Sopenharmony_ci * @param  src  [OUT] type #hi_u16 * Type of ultra deep sleep wakeup source enumeration.
2811bd4fe43Sopenharmony_ci CNcomment:超深睡唤醒源CNend
2821bd4fe43Sopenharmony_ci *
2831bd4fe43Sopenharmony_ci * @retval #0   Success.
2841bd4fe43Sopenharmony_ci * @retval #Other    Failure. For details, see hi_errno.h.
2851bd4fe43Sopenharmony_ci *
2861bd4fe43Sopenharmony_ci * @par Dependency:
2871bd4fe43Sopenharmony_ci *            @li hi_lowpower.h: Describes power saving management APIs.
2881bd4fe43Sopenharmony_ci * @see  None
2891bd4fe43Sopenharmony_ci */
2901bd4fe43Sopenharmony_cihi_u32 hi_lpc_get_udsleep_wakeup_src(hi_u16 *src);
2911bd4fe43Sopenharmony_ci
2921bd4fe43Sopenharmony_ci/**
2931bd4fe43Sopenharmony_ci * @ingroup  iot_lp
2941bd4fe43Sopenharmony_ci * @brief  Register hardware callback func of light_sleep or deep_sleep.
2951bd4fe43Sopenharmony_ci *
2961bd4fe43Sopenharmony_ci * @par Description:
2971bd4fe43Sopenharmony_ci *         Register hardware callback func of light_sleep or deep_sleep.CNcomment:设置睡眠阶段硬件相关回调函数CNend
2981bd4fe43Sopenharmony_ci *
2991bd4fe43Sopenharmony_ci * @attention The save function is called after voting success and befor sleep, and the restore function is called
3001bd4fe43Sopenharmony_ci * when waking up.
3011bd4fe43Sopenharmony_ci CNcomment:prepare函数在芯片实际休眠前执行,resume函数在睡醒时执行。CNend
3021bd4fe43Sopenharmony_ci * @param  prepare     [IN] type #hi_u32_void_callback Callback func of sleep.CNcomment:睡眠准备阶段回调函数CNend
3031bd4fe43Sopenharmony_ci * @param  resume  [IN] type #hi_u32_void_callback Callback func of wake up.CNcomment:唤醒阶段回调函数CNend
3041bd4fe43Sopenharmony_ci *
3051bd4fe43Sopenharmony_ci * @retval #0   Success.
3061bd4fe43Sopenharmony_ci * @retval #Other    Failure. For details, see hi_errno.h.
3071bd4fe43Sopenharmony_ci *
3081bd4fe43Sopenharmony_ci * @par Dependency:
3091bd4fe43Sopenharmony_ci *            @li hi_lowpower.h: Describes power saving management APIs.
3101bd4fe43Sopenharmony_ci * @see  None
3111bd4fe43Sopenharmony_ci */
3121bd4fe43Sopenharmony_cihi_u32 hi_lpc_register_hw_handler(hi_u32_void_callback prepare, hi_u32_void_callback resume);
3131bd4fe43Sopenharmony_ci
3141bd4fe43Sopenharmony_ci/**
3151bd4fe43Sopenharmony_ci * @ingroup  iot_lp
3161bd4fe43Sopenharmony_ci * @brief  Register software callback func of light_sleep or deep_sleep.
3171bd4fe43Sopenharmony_ci *
3181bd4fe43Sopenharmony_ci * @par Description:
3191bd4fe43Sopenharmony_ci *         Register software callback func of light_sleep or deep_sleep.CNcomment:设置睡眠阶段软件相关回调函数CNend
3201bd4fe43Sopenharmony_ci *
3211bd4fe43Sopenharmony_ci * @attention The save function is called before voting for sleep, and the restore function is called when waking up or
3221bd4fe43Sopenharmony_ci * vote fail.
3231bd4fe43Sopenharmony_ci CNcomment:prepare函数在系统判断是否可休眠前执行,resume函数在睡醒时或投票失败后执行。CNend
3241bd4fe43Sopenharmony_ci * @param  prepare     [IN] type #hi_u32_void_callback Callback func of sleep.CNcomment:睡眠准备阶段回调函数CNend
3251bd4fe43Sopenharmony_ci * @param  resume  [IN] type #hi_u32_void_callback Callback func of wake up.CNcomment:唤醒阶段回调函数CNend
3261bd4fe43Sopenharmony_ci *
3271bd4fe43Sopenharmony_ci * @retval #0   Success.
3281bd4fe43Sopenharmony_ci * @retval #Other    Failure. For details, see hi_errno.h.
3291bd4fe43Sopenharmony_ci *
3301bd4fe43Sopenharmony_ci * @par Dependency:
3311bd4fe43Sopenharmony_ci *            @li hi_lowpower.h: Describes power saving management APIs.
3321bd4fe43Sopenharmony_ci * @see  None
3331bd4fe43Sopenharmony_ci */
3341bd4fe43Sopenharmony_cihi_u32 hi_lpc_register_sw_handler(hi_u32_void_callback prepare, hi_u32_void_callback resume);
3351bd4fe43Sopenharmony_ci
3361bd4fe43Sopenharmony_ci/**
3371bd4fe43Sopenharmony_ci * @ingroup  iot_lp
3381bd4fe43Sopenharmony_ci * @brief  Register callback func of peripheral init entry.
3391bd4fe43Sopenharmony_ci *
3401bd4fe43Sopenharmony_ci * @par Description:
3411bd4fe43Sopenharmony_ci *            Register callback func of peripheral init entry.CNcomment:设置深睡唤醒时入口函数,一般用作外设初始化CNend
3421bd4fe43Sopenharmony_ci *
3431bd4fe43Sopenharmony_ci * @param  handler  [IN] type #hi_void_callback_f Callback func of wake up.CNcomment:唤醒回调函数CNend
3441bd4fe43Sopenharmony_ci *
3451bd4fe43Sopenharmony_ci * @retval #0   Success.
3461bd4fe43Sopenharmony_ci * @retval #Other    Failure. For details, see hi_errno.h.
3471bd4fe43Sopenharmony_ci *
3481bd4fe43Sopenharmony_ci * @par Dependency:
3491bd4fe43Sopenharmony_ci *            @li hi_lowpower.h: Describes power saving management APIs.
3501bd4fe43Sopenharmony_ci * @see  None
3511bd4fe43Sopenharmony_ci */
3521bd4fe43Sopenharmony_cihi_u32 hi_lpc_register_wakeup_entry(hi_void_callback_f handler);
3531bd4fe43Sopenharmony_ci
3541bd4fe43Sopenharmony_ci/**
3551bd4fe43Sopenharmony_ci * @ingroup  iot_lp
3561bd4fe43Sopenharmony_ci * @brief  Config deep sleep gpio wakeup IO.
3571bd4fe43Sopenharmony_ci *
3581bd4fe43Sopenharmony_ci * @par Description:
3591bd4fe43Sopenharmony_ci *            Config deep sleep wakeup IO.CNcomment:深睡眠唤醒IO设置CNend
3601bd4fe43Sopenharmony_ci *
3611bd4fe43Sopenharmony_ci * @param  id  [IN] type #hi_gpio_idx Wake up source IO.CNcomment:唤醒IOCNend
3621bd4fe43Sopenharmony_ci * @param  enable  [IN] type #hi_bool whether enable the source IO.CNcomment:唤醒IOCNend
3631bd4fe43Sopenharmony_ci *
3641bd4fe43Sopenharmony_ci * @retval #0   Success.
3651bd4fe43Sopenharmony_ci * @retval #Other    Failure. For details, see hi_errno.h.
3661bd4fe43Sopenharmony_ci *
3671bd4fe43Sopenharmony_ci * @par Dependency:
3681bd4fe43Sopenharmony_ci *            @li hi_lowpower.h: Describes power saving management APIs.
3691bd4fe43Sopenharmony_ci * @see  None
3701bd4fe43Sopenharmony_ci */
3711bd4fe43Sopenharmony_cihi_u32 hi_lpc_config_dsleep_wakeup_io(hi_gpio_idx id, hi_bool enable);
3721bd4fe43Sopenharmony_ci
3731bd4fe43Sopenharmony_ci
3741bd4fe43Sopenharmony_ci#endif /* __HI_LOWPOWER_H__ */
375