1 /** 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 * 15 * Description: Provide pm port header \n 16 * 17 * History: \n 18 * 2023-11-13, Create file. \n 19 */ 20 21 #ifndef PM_PORTING_H 22 #define PM_PORTING_H 23 24 #include "common_def.h" 25 #include "osal_types.h" 26 #include "errcode.h" 27 28 #ifdef __cplusplus 29 #if __cplusplus 30 extern "C" { 31 #endif /* __cplusplus */ 32 #endif /* __cplusplus */ 33 34 /* 本模块类型定义 */ 35 typedef enum { 36 PM_HOOK_ENTER_LOWPOWER_PREPARE = 0, 37 PM_HOOK_ENTER_LOWPOWER_FINISH, 38 PM_HOOK_EXIT_LOWPOWER_PREPARE, 39 PM_HOOK_EXIT_LOWPOWER_FINISH, 40 PM_HOOK_MAX_NUM 41 } pm_hook_t; 42 43 #ifdef CONFIG_PM_SUPPORT_SRV_DECOUPLING 44 typedef enum { 45 PM_MODE_INIT, 46 PM_MODE_SUSPEND, 47 PM_MODE_RESUME, 48 PM_MODE_WORK, 49 PM_MODE_MAX, 50 } pm_srv_mode; 51 52 typedef enum { 53 PM_SRV_WIFI, 54 PM_SRV_BLE, 55 PM_SRV_SLE, 56 PM_SRV_PLAT, // 必须是最后一个 57 PM_SRV_MAX, 58 } pm_srv_type; 59 60 errcode_t pm_porting_init(void); 61 errcode_t pm_set_srv_mode(pm_srv_type svr, pm_srv_mode mode); 62 #endif 63 64 typedef void (*pm_hook_cb_t)(void); 65 66 /* extern 引用其他模块函数 */ 67 extern void test_suite_uart_init(void); 68 extern void at_uart_init(void); 69 extern void set_efuse_period(void); 70 extern osal_void cali_set_cali_done_flag(osal_u8 is_done); 71 72 extern uint32_t bt_thread_open_btc(void); 73 extern uint32_t bt_thread_close_btc(void); 74 extern void bt_vendor_init(void); 75 extern errcode_t enable_ble(void); 76 extern errcode_t disable_ble(void); 77 78 /* 本模块函数接口声明 */ 79 void pm_port_open_rf(void); 80 void pm_port_close_rf(void); 81 void pm_port_open_wifi_sub(void); 82 void pm_port_close_wifi_sub(void); 83 void pm_port_open_bt_sub(void); 84 void pm_port_close_bt_sub(void); 85 86 void pm_port_open_wifi_hw(void); 87 void pm_port_close_wifi_hw(void); 88 void pm_port_open_bt_hw(void); 89 void pm_port_close_bt_hw(void); 90 91 int pm_port_flash_sem_down(void); 92 void pm_port_flash_sem_up(void); 93 int pm_port_dma_sem_down(void); 94 void pm_port_dma_sem_up(void); 95 96 void pm_port_exit_lowpower_finish_cb_default(void); 97 void pm_port_exit_lowpower_prepare_cb_default(void); 98 void pm_port_enter_lowpower_finish_cb_default(void); 99 void pm_port_enter_lowpower_prepare_cb_default(void); 100 101 void pm_port_pm_hook_cb_register(uint32_t hook, pm_hook_cb_t cb); 102 103 void pm_port_enter_lowpower(void); 104 void pm_port_exit_lowpower(void); 105 106 void pm_porting_wait_exit_lowpower(void); 107 108 #ifdef __cplusplus 109 #if __cplusplus 110 } 111 #endif /* __cplusplus */ 112 #endif /* __cplusplus */ 113 114 #endif