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 * Description: dmac auto adjust frequency head 15 * Create: 2020-7-5 16 */ 17 18 #ifndef __HMAC_AUTO_ADJUST_FREQ_H__ 19 #define __HMAC_AUTO_ADJUST_FREQ_H__ 20 21 #include "hmac_device.h" 22 23 #ifdef __cplusplus 24 #if __cplusplus 25 extern "C" { 26 #endif 27 #endif 28 29 /* pps统计结构体 */ 30 typedef struct { 31 osal_u32 last_timeout; 32 osal_u32 pps_rate; 33 osal_u32 hcc_rxtx_total; /* hcc slave 收发数据帧统计 */ 34 35 frw_timeout_stru timer; 36 } hmac_pps_statistics_stru; 37 38 /***************************************************************************** 39 2 宏定义 40 *****************************************************************************/ 41 42 /***************************************************************************** 43 3 枚举定义 44 *****************************************************************************/ 45 typedef enum { 46 WLAN_DEVICE_AUTO_FREQ_OFF = 0, 47 WLAN_DEVICE_AUTO_FREQ_ON, 48 WLAN_DEVICE_AUTO_FREQ_BUTT 49 } wlan_auto_freq_switch; 50 51 enum { 52 FREQ_IDLE = 0, 53 FREQ_MIDIUM = 1, 54 FREQ_HIGHEST = 2, 55 FREQ_BUTT = 3 56 }; 57 /***************************************************************************** 58 4 全局变量声明 59 *****************************************************************************/ 60 61 /***************************************************************************** 62 7 STRUCT定义 63 *****************************************************************************/ 64 typedef osal_u8 oal_device_freq_type_enum_uint8; 65 typedef struct { 66 oal_bool_enum_uint8 auto_freq_enable; /* 使能开关 */ 67 oal_bool_enum_uint8 pm_enable; /* 低功耗状态标志 */ 68 oal_device_freq_type_enum_uint8 curr_freq_level; /* 当前工作频率级别 */ 69 oal_device_freq_type_enum_uint8 req_freq_level; /* 根据netbuf判断需要的频率级别 */ 70 osal_u32 pps_loop_count; 71 } hmac_freq_control_stru; 72 73 typedef struct { 74 osal_u32 speed_level; /* 吞吐量门限 */ 75 osal_u32 cpu_freq_level; /* CPU主频下限 */ 76 } device_pps_freq_level_stru; 77 78 /***************************************************************************** 79 10 函数声明 80 *****************************************************************************/ 81 typedef osal_void (*hmac_auto_freq_pps_count_cb)(osal_u32 count); 82 typedef osal_void (*hmac_get_pps_handle_pps_rate_cb)(osal_u32 *pps_rate); 83 typedef osal_void (*hmac_auto_freq_btcoex_handle_cb)(osal_u8 bt_ldac); 84 85 static osal_u32 hmac_auto_freq_init_weakref(osal_void) 86 __attribute__ ((weakref("hmac_auto_adjust_freq_init"), used)); 87 static osal_void hmac_auto_freq_deinit_weakref(osal_void) 88 __attribute__ ((weakref("hmac_auto_adjust_freq_deinit"), used)); 89 90 #ifdef __cplusplus 91 #if __cplusplus 92 } 93 #endif 94 #endif 95 96 #endif /* end of hmac_auto_adjust_freq_rom.h */ 97