32 #define PM_LONG_SUSPEND_EN 1 34 #ifndef PM_TIM_RECOVER_MODE 35 #define PM_TIM_RECOVER_MODE 0 40 #define PM_XTAL_DELAY_DURATION 500 41 #define EARLYWAKEUP_TIME_US_DEEP 1100 42 #define EARLYWAKEUP_TIME_US_SUSPEND 1250 43 #define EMPTYRUN_TIME_US 1500 45 #define PM_DCDC_DELAY_DURATION 1000 49 #define PM_LONG_SLEEP_WAKEUP_EN 0 //if user need to make MCU sleep for a long time that is more than 268s, this macro need to be enabled and use "pm_long_sleep_wakeup" function 50 #define SYS_CLK_48MRC_EN 0 //if user take 48M RC as system clock, this macro need to be enabled 59 #define DEEP_ANA_REG0 0x3a //initial value =0x00 60 #define DEEP_ANA_REG1 0x3b //initial value =0x00 61 #define DEEP_ANA_REG2 0x3c //initial value =0x00 68 #define DEEP_ANA_REG6 0x35 //initial value =0x00 69 #define DEEP_ANA_REG7 0x36 //initial value =0x00 70 #define DEEP_ANA_REG8 0x37 //initial value =0x00 71 #define DEEP_ANA_REG9 0x38 //initial value =0x00 72 #define DEEP_ANA_REG10 0x39 //initial value =0x00 75 #define SYS_NEED_REINIT_EXT32K BIT(0) 79 #define SYS_DEEP_ANA_REG DEEP_ANA_REG2 80 #define WAKEUP_STATUS_TIMER_CORE ( WAKEUP_STATUS_TIMER | WAKEUP_STATUS_CORE) 81 #define WAKEUP_STATUS_TIMER_PAD ( WAKEUP_STATUS_TIMER | WAKEUP_STATUS_PAD) 156 #if (PM_TIM_RECOVER_MODE) 159 unsigned int tick_sysClk;
160 unsigned int tick_32k;
161 unsigned char recover_flag;
164 extern pm_tim_recover_t pm_timRecover;
232 unsigned int cpu_stall(
int WakeupSrc,
unsigned int IntervalUs,
unsigned int sysclktick);
354 #if PM_LONG_SLEEP_WAKEUP_EN static int pm_get_wakeup_src(void)
This function serves to get the source of wake-up.
Definition: pm.h:199
unsigned char pm_enter_en
Definition: pm.h:140
unsigned char is_pad_wakeup
Definition: pm.h:150
suspend_handler_t func_before_suspend
unsigned int pm_get_32k_tick(void)
This function serves to get the 32k tick.
void cpu_stall_wakeup_by_timer2(unsigned int tick)
This function serves to wake up cpu from stall mode by timer2.
static void blc_pm_select_internal_32k_crystal(void)
This function serves to determine whether wake up source is internal 32k RC.
Definition: pm.h:314
void cpu_stall_wakeup_by_timer1(unsigned int tick)
This function serves to wake up cpu from stall mode by timer1.
unsigned char is_deepretn_back
Definition: pm.h:149
unsigned int tick_32k_cur
unsigned char tl_24mrc_cal
void cpu_stall_wakeup_by_timer0(unsigned int tick)
This function serves to wake up cpu from stall mode by timer0.
static void blc_pm_select_external_32k_crystal(void)
This function serves to determine whether wake up source is external 32k RC.
Definition: pm.h:327
pm_tim_recover_handler_t pm_tim_recover
unsigned char wakeup_src
Definition: pm.h:151
int cpu_sleep_wakeup_32k_rc(SleepMode_TypeDef sleep_mode, SleepWakeupSrc_TypeDef wakeup_src, unsigned int wakeup_tick)
This function serves to set the working mode of MCU based on 32k crystal,e.g. suspend mode...
int(* suspend_handler_t)(void)
Definition: pm.h:168
static int pm_is_deepPadWakeup(void)
This function serves to determine whether mcu is waked up by pad.
Definition: pm.h:189
SleepWakeupSrc_TypeDef
wakeup source
Definition: pm.h:107
unsigned int pm_get_info1(void)
misc_para_t blt_miscParam
#define BIT(n)
Definition: bsp.h:33
unsigned int pm_get_info0(void)
unsigned int pm_tim_recover_32k_rc(unsigned int now_tick_32k)
This function serves to recover system timer from tick of internal 32k RC.
unsigned short tick_32k_calib
unsigned int cpu_get_32k_tick(void)
void cpu_set_gpio_wakeup(GPIO_PinTypeDef pin, GPIO_LevelTypeDef pol, int en)
This function configures a GPIO pin as the wakeup pin.
static int pm_is_MCU_deepRetentionWakeup(void)
This function serves to determine whether mcu is waked up from deep retention.
Definition: pm.h:179
void bls_pm_registerFuncBeforeSuspend(suspend_handler_t func)
void soft_reboot_dly13ms_use24mRC(void)
void check_32k_clk_stable(void)
unsigned int pm_tim_recover_32k_xtal(unsigned int now_tick_32k)
This function serves to recover system timer from tick of external 32k crystal.
SleepMode_TypeDef
sleep mode.
Definition: pm.h:87
void start_reboot(void)
This function serves to reboot chip.
unsigned int(* pm_tim_recover_handler_t)(unsigned int)
Definition: pm.h:282
unsigned char ext_cap_en
Definition: pm.h:138
deepsleep wakeup status
Definition: pm.h:148
unsigned char pad32k_en
Definition: pm.h:139
GPIO_PinTypeDef
Define GPIO types.
Definition: gpio_8258.h:38
void cpu_wakeup_init(void)
This function serves to initialize MCU.
unsigned char tl_multi_addr
unsigned int cpu_stall(int WakeupSrc, unsigned int IntervalUs, unsigned int sysclktick)
This function serves to wake up cpu from stall mode by timer1 or RF TX done irq.
deepsleep wakeup by external xtal
Definition: pm.h:137
int cpu_sleep_wakeup_32k_xtal(SleepMode_TypeDef sleep_mode, SleepWakeupSrc_TypeDef wakeup_src, unsigned int wakeup_tick)
This function serves to set the working mode of MCU based on 32k crystal,e.g. suspend mode...
cpu_pm_handler_t cpu_sleep_wakeup
int(* cpu_pm_handler_t)(SleepMode_TypeDef sleep_mode, SleepWakeupSrc_TypeDef wakeup_src, unsigned int wakeup_tick)
Definition: pm.h:305
GPIO_LevelTypeDef
Definition: gpio_8258.h:125