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  *                             delete member u16ExBusHold of PM_SLEEP_DEEP_CFG
11  */
12 
13 #ifndef __PM_CONFIG_H__
14 #define __PM_CONFIG_H__
15 
16 #include <rtthread.h>
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 #ifdef BSP_USING_PM
23 extern void rt_hw_board_pm_sysclk_cfg(uint8_t run_mode);
24 
25 #ifndef PM_TICKLESS_TIMER_ENABLE_MASK
26 #define PM_TICKLESS_TIMER_ENABLE_MASK           (0UL)
27 #endif
28 
29 /**
30  * @brief  run mode config @ref pm_run_mode_config structure
31  */
32 #ifndef PM_RUN_MODE_CFG
33 #define PM_RUN_MODE_CFG                                                        \
34     {                                                                          \
35        .sys_clk_cfg = rt_hw_board_pm_sysclk_cfg                                \
36     }
37 #endif /* PM_RUN_MODE_CFG */
38 
39 /**
40  * @brief  sleep idle config @ref pm_sleep_mode_idle_config structure
41  */
42 #ifndef PM_SLEEP_IDLE_CFG
43 #define PM_SLEEP_IDLE_CFG                                                      \
44 {                                                                              \
45     .pwc_sleep_type = PWC_SLEEP_WFE_INT,                                       \
46 }
47 #endif /*PM_SLEEP_IDLE_CFG*/
48 
49 /**
50  * @brief  sleep deep config @ref pm_sleep_mode_deep_config structure
51  */
52 #ifndef PM_SLEEP_DEEP_CFG
53 #define PM_SLEEP_DEEP_CFG                                                      \
54 {                                                                              \
55     {                                                                          \
56         .u16Clock = PWC_STOP_CLK_KEEP,                                         \
57         .u8StopDrv = PWC_STOP_DRV_HIGH,                                        \
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