hong.liu | cd37079 | 2025-05-28 06:29:19 -0700 | [diff] [blame] | 1 | /**
|
| 2 | * @file : gsw_pm_interface.h
|
| 3 | * @brief : sleep and wakeup
|
| 4 | * @date :
|
| 5 | * @author : wind
|
| 6 | * @version : v1.0
|
| 7 | * @copyright
|
| 8 | */
|
| 9 | #ifndef _GSW_PMYKSDK_H
|
| 10 | #define _GSW_PMYKSDK_H
|
| 11 |
|
| 12 | #include "gsw_hal_errcode.h"
|
| 13 |
|
| 14 | #define GSW_PM_SUCCESS GSW_HAL_SUCCESS
|
| 15 | #define GSW_PM_FAIL GSW_HAL_NORMAL_FAIL
|
| 16 |
|
| 17 | typedef enum
|
| 18 | {
|
| 19 | GSW_PM_LPM_FALLING = 0, /**< falling edge,modem go to sleep*/
|
| 20 | GSW_PM_LPM_RISING = 1, /**< rising edge,modem exit sleep*/
|
| 21 | }GSW_PM_WAKEUP_IN_STATUS_T;
|
| 22 |
|
| 23 | /**
|
| 24 | * @brief when modem wakeup callback
|
| 25 | * @param [in] int wakeup_in IO state, 0:sleep,1:exit sleep
|
| 26 | * @retval 0: success
|
| 27 | * @retval other: fail
|
| 28 | */
|
| 29 | typedef void (* gsw_pm_wakeup_handler)(int);
|
| 30 |
|
| 31 | /**
|
| 32 | * @brief lpm sdk init
|
| 33 | * @param [in] gswPmCallBack modem wakeup callback
|
| 34 | * @retval 0: success
|
| 35 | * @retval other: fail
|
| 36 | */
|
| 37 | int gswPmSDKInit(gsw_pm_wakeup_handler gswPmCallBack);
|
| 38 |
|
| 39 | /**
|
| 40 | * @brief enable system autosleep
|
| 41 | * @details E02 and E06 unused
|
| 42 | *
|
| 43 | * @param
|
| 44 | * @retval 0: success
|
| 45 | * @retval other: fail
|
| 46 | */
|
| 47 | int gswAutoSleepEnable(void);
|
| 48 |
|
| 49 | /**
|
| 50 | * @brief disable system autosleep
|
| 51 | * @details E02 and E06 unused
|
| 52 | *
|
| 53 | * @param
|
| 54 | * @retval 0: success
|
| 55 | * @retval other: fail
|
| 56 | */
|
| 57 | int gswAutoSleepDisable(void);
|
| 58 |
|
| 59 | /**
|
| 60 | * @brief release system sleeplock then canbe sleep
|
| 61 | * @param
|
| 62 | * @retval void
|
| 63 | */
|
| 64 | void gswPMStartSleep(void);
|
| 65 |
|
| 66 | /**
|
| 67 | * @brief keep system sleeplock to avoid sleep
|
| 68 | * @param
|
| 69 | * @retval 0: success
|
| 70 | * @retval other: fail
|
| 71 | */
|
| 72 | int gswPMStopSleep(void);
|
| 73 |
|
| 74 | #endif
|
| 75 |
|