1 /*
2  * Copyright (C) 2022-2024, Xiaohua Semiconductor Co., Ltd.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2023-05-12     CDT          first version
9  * 2024-06-13     CDT          disable pm tickless timer
10  */
11 
12 #ifndef __PM_CONFIG_H__
13 #define __PM_CONFIG_H__
14 
15 #include <rtthread.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 #ifdef BSP_USING_PM
22 extern void rt_hw_board_pm_sysclk_cfg(uint8_t run_mode);
23 
24 #ifndef PM_TICKLESS_TIMER_ENABLE_MASK
25 #define PM_TICKLESS_TIMER_ENABLE_MASK           (0UL)
26 #endif
27 
28 /**
29  * @brief  run mode config @ref pm_run_mode_config structure
30  */
31 #ifndef PM_RUN_MODE_CFG
32 #define PM_RUN_MODE_CFG                                                        \
33     {                                                                          \
34        .sys_clk_cfg = rt_hw_board_pm_sysclk_cfg                                \
35     }
36 #endif /* PM_RUN_MODE_CFG */
37 
38 /**
39  * @brief  sleep idle config @ref pm_sleep_mode_idle_config structure
40  */
41 #ifndef PM_SLEEP_IDLE_CFG
42 #define PM_SLEEP_IDLE_CFG                                                      \
43 {                                                                              \
44     .pwc_sleep_type = PWC_SLEEP_WFE_INT,                                       \
45 }
46 #endif /*PM_SLEEP_IDLE_CFG*/
47 
48 /**
49  * @brief  sleep deep config @ref pm_sleep_mode_deep_config structure
50  */
51 #ifndef PM_SLEEP_DEEP_CFG
52 #define PM_SLEEP_DEEP_CFG                                                      \
53 {                                                                              \
54     {                                                                          \
55         .u16Clock = PWC_STOP_CLK_KEEP,                                         \
56         .u8StopDrv = PWC_STOP_DRV_HIGH,                                        \
57         .u16ExBusHold = PWC_STOP_EXBUS_HIZ,                                    \
58         .u16FlashWait = PWC_STOP_FLASH_WAIT_ON,                                \
59     },                                                                         \
60     .pwc_stop_type = PWC_STOP_WFE_INT,                                         \
61 }
62 #endif /*PM_SLEEP_DEEP_CFG*/
63 
64 /**
65  * @brief  sleep standby config @ref pm_sleep_mode_standby_config structure
66  */
67 #ifndef PM_SLEEP_STANDBY_CFG
68 #define PM_SLEEP_STANDBY_CFG                                                   \
69 {                                                                              \
70     {                                                                          \
71         .u8Mode = PWC_PD_MD1,                                                  \
72         .u8IOState = PWC_PD_IO_KEEP1,                                          \
73         .u8VcapCtrl = PWC_PD_VCAP_0P047UF,                                     \
74     },                                                                         \
75 }
76 #endif /*PM_SLEEP_STANDBY_CFG*/
77 
78 /**
79  * @brief  sleep shutdown config @ref pm_sleep_mode_shutdown_config structure
80  */
81 #ifndef PM_SLEEP_SHUTDOWN_CFG
82 #define PM_SLEEP_SHUTDOWN_CFG                                                  \
83 {                                                                              \
84     {                                                                          \
85         .u8Mode = PWC_PD_MD3,                                                  \
86         .u8IOState = PWC_PD_IO_KEEP1,                                          \
87         .u8VcapCtrl = PWC_PD_VCAP_0P047UF,                                     \
88     },                                                                         \
89 }
90 #endif /*PM_SLEEP_SHUTDOWN_CFG*/
91 
92 #endif /* BSP_USING_PM */
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif /* __PM_CONFIG_H__ */
99