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: Header file for hal_csi.c. 15 */ 16 17 #ifndef __HAL_CSI_H__ 18 #define __HAL_CSI_H__ 19 20 /***************************************************************************** 21 1 其他头文件包含 22 *****************************************************************************/ 23 #include "osal_types.h" 24 #include "wlan_types_common.h" 25 #include "hal_device.h" 26 #include "hal_common_ops.h" 27 #include "mac_vap_ext.h" 28 #include "hh503_phy_reg.h" 29 30 #include "hal_csi_rom.h" 31 #include "frw_dmac_rom.h" 32 #include "hal_main.h" 33 #ifdef __cplusplus 34 #if __cplusplus 35 extern "C" { 36 #endif 37 #endif 38 39 /***************************************************************************** 40 宏定义 41 *****************************************************************************/ 42 #undef THIS_FILE_ID 43 #define THIS_FILE_ID OAM_FILE_ID_HAL_CSI_H 44 45 #define HAL_CSI_MAX_USER_NUM 4 46 #define HAL_CSI_USR_0 0 47 #define HAL_CSI_USR_1 1 48 #define HAL_CSI_USR_2 2 49 #define HAL_CSI_USR_3 3 50 51 #define HAL_CSI_USR_ADDR_NUM 2 52 53 #define CSI_DATA_MAX_LEN 762 /* CSI内存块单个大小,默认值 762B */ 54 #define CSI_DATA_BLK_NUM 2 /* CSI内存块个数,默认值 2 */ 55 56 /* PPDU Format类型枚举值定义 */ 57 typedef enum { 58 HAL_CSI_PPDU_NONE_HT = 0, /* NONE HT */ 59 HAL_CSI_PPDU_HE_ER_SU = 1, /* HE(ER)SU */ 60 HAL_CSI_PPDU_HE_MU_MIMO = 2, /* HE_MU_MIMO */ 61 HAL_CSI_PPDU_HE_MU_OFDMA = 3, /* HE_MU_OFDMA */ 62 HAL_CSI_PPDU_HT = 4, /* HT 11n */ 63 HAL_CSI_PPDU_VHT = 5, /* VHT 11ac */ 64 HAL_CSI_PPDU_FORMAT_BUTT 65 } hal_csi_ppdu_format_enum; 66 67 /* CSI上报计算类型枚举值定义 */ 68 // note that hal_csi_rpt_cnt_enum is as same as bits.cfg_csi_rpt_cnt_clr[0~4] 69 typedef enum { 70 HAL_CSI_CNT_H_NUM_ERR = 0, /* PHY送来H子载波错误计数 */ 71 HAL_CSI_CNT_H_TIMMING_ERR = 1, /* H上报时序异常计数 */ 72 HAL_CSI_CNT_TIMEOUT_ERR = 2, /* CSI上报超时异常计数 */ 73 HAL_CSI_CNT_SW_BLK_ERR = 3, /* CSI软件处理太慢异常计数 */ 74 HAL_CSI_CNT_RPT_SUCC = 4, /* CSI上报成功计数 */ 75 HAL_CSI_RPT_CNT_BUTT 76 } hal_csi_rpt_cnt_enum; 77 78 /***************************************************************************** 79 STRUCT定义 80 *****************************************************************************/ 81 /* CSI白名单用户配置 */ 82 typedef struct { 83 /* Byte0~5: user TA address */ 84 osal_u8 usr_addr[WLAN_MAC_ADDR_LEN]; 85 86 /* Byte6: report configurations */ 87 osal_u8 cfg_csi_en : 1; 88 osal_u8 cfg_addr_match_bypass : 1; 89 osal_u8 cfg_match_ta_ra_sel : 1; 90 osal_u8 cfg_mgmt_frame_en : 1; 91 osal_u8 cfg_ctrl_frame_en : 1; 92 osal_u8 cfg_data_frame_en : 1; 93 osal_u8 cfg_rsv : 1; 94 osal_u8 frm_subtype_match_en : 1; 95 96 /* Byte7: report frame subtype */ 97 osal_u8 match_frame_subtype; 98 99 /* Byte8: report ppdu format */ 100 osal_u8 ppdu_non_ht_en : 1; 101 osal_u8 ppdu_he_er_su_en : 1; 102 osal_u8 ppdu_he_mu_mimo_en : 1; 103 osal_u8 ppdu_he_mu_ofdma_en : 1; 104 osal_u8 ppdu_ht_en : 1; 105 osal_u8 ppdu_vht_en : 1; 106 osal_u8 ppdu_rsv_en : 2; 107 108 /* Byte9: resv */ 109 osal_u8 cfg_rsv2; 110 111 /* Byte10~11: report period */ 112 osal_u16 sample_period_ms; 113 } hal_csi_usr_attr; 114 115 /* CSI buffer配置 */ 116 typedef struct { 117 osal_u8 csi_data_blk_num; 118 osal_u16 csi_data_max_len; 119 osal_u8 resv[1]; 120 } hal_csi_buffer_stru; 121 122 /* CSI全局配置 */ 123 typedef struct { 124 osal_u32 cfg_rsv31 : 1; 125 osal_u32 non_ht_bw_mismatch_center_freq_bypass_en : 1; /* 参考对应MAC寄存器设置该Bit位, 可写功能对外不开放 */ 126 osal_u32 non_ht_bw_mismatch_center_freq : 1; /* 参考对应MAC寄存器设置该Bit位, 可写功能对外不开放 */ 127 osal_u32 he_grouping_en : 1; 128 osal_u32 direct_resp_ctrl_flt_en : 1; /* Rx单播直接的响应控制帧时过滤CSI使能 */ 129 osal_u32 fcs_err_drop_en : 1; 130 osal_u32 buffer_step_block_size : 10; /* RO: this field is ReadOnly, 可写功能对外不开放 */ 131 osal_u32 buffer_block_total : 3; /* RO: this field is ReadOnly, 可写功能对外不开放 */ 132 osal_u32 timeout_thr_us_cnt : 5; /* 超时从rx_psdu_complete时刻开始计时 */ 133 osal_u32 cfg_rsv7_5 : 3; /* 保留调试读取csi_sw_buf_index时使用, 表示当前软件处理CSI的Buffer编号 */ 134 osal_u32 cfg_rsv4_0 : 5; /* 保留调试读取CSI计数清零使能值时使用 */ 135 } hal_csi_global_cfg; 136 137 /* CSI维测计数 */ 138 typedef struct { 139 osal_u8 h_num_err_cnt; 140 osal_u8 h_timing_err_cnt; 141 osal_u8 timeout_err_cnt; 142 osal_u8 sw_blk_err_cnt; 143 144 osal_u32 rpt_cnt_rsv31_19 : 13; 145 osal_u32 rpt_csi_blk_index : 3; /* 保留调试读取逻辑当前处理CSI的Buffer编号时使用 */ 146 osal_u32 rpt_csi_succ_cnt : 16; 147 } hal_csi_stat; 148 149 /***************************************************************************** 150 函数声明 151 *****************************************************************************/ 152 // csi使能禁用接口 153 osal_u32 hal_csi_enable(osal_u8 usr_id); 154 osal_u32 hal_csi_disable(osal_u8 usr_id); 155 osal_bool hal_csi_vap_is_close(osal_void); 156 osal_void hh503_csi_phy_open_channel(osal_void); 157 // csi用户配置接口 158 osal_u32 hal_csi_set_usr_attr(osal_u8 usr_id, const hal_csi_usr_attr *attr); 159 osal_u32 hal_csi_get_usr_attr(osal_u8 usr_id, hal_csi_usr_attr *attr); 160 161 // csi全局配置接口 162 163 osal_u32 hal_csi_set_buffer_config(hal_csi_buffer_stru *csi_buffer); 164 osal_u32 hal_csi_set_tsf(osal_u8 hal_vap_id); 165 osal_void hal_csi_set_ack_resp_flt(void); 166 167 // csi其他配置接口:统计计数 168 osal_u32 hal_csi_stat_clr(osal_void); 169 170 171 osal_u32 hal_csi_keep_mac_pa_open(void); 172 /***************************************************************************** 173 ROM回调函数类型定义 174 *****************************************************************************/ 175 176 #ifdef __cplusplus 177 #if __cplusplus 178 } 179 #endif 180 #endif 181 182 #endif /* end of hal_csi.h */ 183