• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  */
18 
19 #ifndef __WAL_HIPRIV_H__
20 #define __WAL_HIPRIV_H__
21 
22 /* ****************************************************************************
23   1 其他头文件包含
24 **************************************************************************** */
25 #include "oal_ext_if.h"
26 #include "hmac_ext_if.h"
27 #include "wal_main.h"
28 #include "mac_device.h"
29 
30 #ifdef __cplusplus
31 #if __cplusplus
32 extern "C" {
33 #endif
34 #endif
35 
36 /* ****************************************************************************
37   2 宏定义
38 **************************************************************************** */
39 /* 私有配置命令字符串最大长度,对应本地内存池一级大小 */
40 #define WAL_HIPRIV_CMD_MAX_LEN       (WLAN_MEM_LOCAL_SIZE3 - 4)
41 
42 #define WAL_HIPRIV_CMD_NAME_MAX_LEN  36                             /* 字符串中每个单词的最大长度 */
43 #if (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION)
44 #define WAL_HIPRIV_PROC_ENTRY_NAME   "hipriv"
45 #endif
46 #ifdef _PRE_WLAN_FEATURE_BW_HIEX
47 #define WAL_HIPRIV_SELFCTS_DURATION_MAX      32
48 #define WAL_HIPRIV_SELFCTS_PER_MAX           1000
49 #endif
50 
51 #define WAL_HIPRIV_HT_MCS_MIN           0
52 #define WAL_HIPRIV_HT_MCS_MAX           7
53 #define WAL_HIPRIV_VHT_MCS_MIN          0
54 #define WAL_HIPRIV_VHT_MCS_MAX          9
55 #define WAL_HIPRIV_NSS_MIN              1
56 #define WAL_HIPRIV_NSS_MAX              4
57 #define WAL_HIPRIV_CH_NUM               4
58 #define WAL_HIPRIV_SNPRINTF_DST         10
59 
60 #define WAL_HIPRIV_BOOL_NIM             0
61 #define WAL_HIPRIV_BOOL_MAX             1
62 #define WAL_HIPRIV_FREQ_SKEW_ARG_NUM    8
63 
64 #define WAL_HIPRIV_MS_TO_S                   1000   /* ms和s之间倍数差 */
65 #define WAL_HIPRIV_KEEPALIVE_INTERVAL_MIN    5000   /* 受默认老化计数器出发时间所限制 */
66 #define WAL_HIPRIV_KEEPALIVE_INTERVAL_MAX    0xffff /* timer间隔时间限制所致(oal_uin16) */
67 
68 #define CAL_BAND_POWER_OFFSET_MAX            60
69 #define CAL_BAND_POWER_OFFSET_MIN            -60
70 #define CAL_RATE_POWER_OFFSET_MAX            7
71 #define CAL_RATE_POWER_OFFSET_MIN            -8
72 #define CAL_FREP_OFFSET_MAX                  127
73 #define CAL_FREP_OFFSET_MIN                  -128
74 #ifdef _PRE_WLAN_FEATURE_MFG_TEST
75 #define HI_WIFI_MODE_11BGN                  0
76 #define HI_WIFI_MODE_11BG                   1
77 #define HI_WIFI_MODE_11B                    2
78 #endif
79 
80 #define HI_CCA_THRESHOLD_LO (-128)
81 #define HI_CCA_THRESHOLD_HI 127
82 
83 typedef hi_u32 (*wal_hipriv_cmd_func)(oal_net_device_stru *netdev, hi_char *pc_param);
84 
85 /* ****************************************************************************
86   3 枚举定义
87 **************************************************************************** */
88 /* 性能测试相关 */
89 typedef enum {
90     WAL_ALWAYS_TX_DISABLE,      /* 禁用常发 */
91     WAL_ALWAYS_TX_RF,           /* 保留给RF测试广播报文 */
92     WAL_ALWAYS_TX_AMPDU_ENABLE, /* 使能AMPDU聚合包常发 */
93     WAL_ALWAYS_TX_MPDU,         /* 使能非聚合包常发 */
94     WAL_ALWAYS_TX_DC,           /* 使能DC常发,用于CE认证测频偏 */
95     WAL_ALWAYS_TX_BUTT
96 } wal_device_always_tx_state_enum;
97 
98 /* ****************************************************************************
99   4 全局变量声明
100 **************************************************************************** */
101 /* ****************************************************************************
102   5 消息头定义
103 **************************************************************************** */
104 /* ****************************************************************************
105   6 消息定义
106 **************************************************************************** */
107 /* ****************************************************************************
108   7 STRUCT定义
109 **************************************************************************** */
110 /* 私有命令入口结构定义 */
111 typedef struct {
112     hi_char *pc_cmd_name;     /* 命令字符串 */
113     wal_hipriv_cmd_func func; /* 命令对应处理函数 */
114 } wal_hipriv_cmd_entry_stru;
115 
116 /* 算法参数配置结构体 */
117 typedef struct {
118     hi_char *pc_name;               /* 配置命令字符串 */
119     mac_alg_cfg_enum_uint8 alg_cfg; /* 配置命令对应的枚举值 */
120     hi_u8 auc_resv[3];              /* 3: 字节对齐 */
121 } wal_ioctl_alg_cfg_stru;
122 
123 /* TPC工作模式 */
124 typedef enum {
125     ALG_TPC_MODE_DISABLE = 0, /* 禁用TPC模式: 直接采用RF配置的功率增益 */
126     ALG_TPC_MODE_FIX_POWER = 1, /* 固定功率模式: 数据帧的Data0采用配置的, Data1~3以及管理帧、控制帧都用最大功率 */
127     /* 自适应功率模式: 数据帧的Data0采用自适应功率, Data1~3以及管理帧、控制帧都用最大功率 */
128     ALG_TPC_MODE_ADAPT_POWER = 2,
129 
130     ALG_TPC_MODE_BUTT
131 } alg_tpc_mode_enum;
132 typedef hi_u8 alg_tpc_mode_enum_uint8;
133 
134 /* ****************************************************************************
135   8 UNION定义
136 **************************************************************************** */
137 /* ****************************************************************************
138   9 OTHERS定义
139 **************************************************************************** */
140 /* ****************************************************************************
141   10 函数声明
142 **************************************************************************** */
143 hi_u32 wal_hipriv_set_rate(oal_net_device_stru *netdev, hi_char *pc_param);
144 hi_u32 wal_hipriv_set_mcs(oal_net_device_stru *netdev, hi_char *pc_param);
145 #if (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION)
146 #ifdef _PRE_CONFIG_CONN_HISI_SYSFS_SUPPORT
147 hi_u32 wal_hipriv_create_proc(hi_void *proc_arg);
148 #endif
149 #endif
150 hi_u32 wal_hipriv_del_vap(oal_net_device_stru *netdev);
151 #ifdef _PRE_WLAN_FEATURE_HIPRIV
152 hi_u32 wal_hipriv_vap_info(oal_net_device_stru *netdev, hi_char *pc_param);
153 #endif
154 #if (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION)
155 #ifdef _PRE_CONFIG_CONN_HISI_SYSFS_SUPPORT
156 hi_u32 wal_hipriv_remove_proc(hi_void);
157 #endif
158 #endif
159 hi_u32 wal_hipriv_get_mac_addr(const hi_char *pc_param, hi_u8 mac_addr[], hi_u8 addr_len, hi_u32 *pul_total_offset);
160 hi_u32 wal_hipriv_get_bw(oal_net_device_stru *netdev, hal_channel_assemble_enum_uint8 *pen_bw_index);
161 hi_u32 wal_hipriv_set_bw(oal_net_device_stru *netdev, hi_char *pc_param);
162 #ifdef _PRE_WLAN_FEATURE_HIPRIV
163 hi_u32 wal_hipriv_reg_write(oal_net_device_stru *netdev, hi_char *pc_param);
164 #endif
165 hi_u32 wal_hipriv_getcountry(oal_net_device_stru *netdev, hi_char *pc_param);
166 hi_u32 wal_hipriv_set_vap_state(oal_net_device_stru *netdev, hi_char *pc_param);
167 #ifdef _PRE_WLAN_FEATURE_MESH
168 hi_u32 wal_hipriv_get_mesh_node_info(oal_net_device_stru *netdev, hi_char *pc_param);
169 #endif
170 #ifdef _PRE_WLAN_FEATURE_STA_PM
171 hi_u32 wal_hipriv_sta_pm_on(oal_net_device_stru *netdev, const hi_char *pc_param);
172 #if defined(_PRE_WLAN_FEATURE_HIPRIV) || defined(_PRE_WLAN_FEATURE_SIGMA)
173 hi_u32 wal_hipriv_set_uapsd_cap(oal_net_device_stru *netdev, hi_char *pc_param);
174 hi_u32 wal_hipriv_set_uapsd_para(oal_net_device_stru *netdev, hi_char *pc_param);
175 hi_u32 wal_hipriv_set_uapsd_cap(oal_net_device_stru *netdev, hi_char *pc_param);
176 #endif
177 #ifdef _PRE_WLAN_FEATURE_HIPRIV
178 hi_u32 wal_hipriv_sta_set_psm_offset(oal_net_device_stru *netdev, hi_char *param);
179 hi_u32 wal_hipriv_sta_set_offload_param(oal_net_device_stru *netdev, hi_char *param);
180 hi_u32 wal_hipriv_sta_set_hw_ps_mode(oal_net_device_stru *netdev, hi_char *param);
181 hi_u32 wal_hipriv_set_pm_switch(oal_net_device_stru *netdev, hi_char *pc_param);
182 #endif
183 #endif
184 #if defined _PRE_WLAN_FEATURE_SIGMA
185 hi_u32 wal_hipriv_rts_threshold(oal_net_device_stru *netdev, hi_char *pc_param);
186 #endif
187 #if defined(_PRE_WLAN_FEATURE_HIPRIV) || defined(_PRE_WLAN_FEATURE_SIGMA)
188 hi_u32 wal_hipriv_frag_threshold(oal_net_device_stru *netdev, hi_char *pc_param);
189 #endif
190 hi_u32 wal_hipriv_setcountry(oal_net_device_stru *netdev, hi_char *pc_param);
191 #if defined(_PRE_WLAN_FEATURE_HIPRIV) || defined(_PRE_WLAN_FEATURE_SIGMA)
192 hi_u32 wal_hipriv_ampdu_tx_on(oal_net_device_stru *netdev, hi_char *pc_param);
193 #endif
194 #if defined(_PRE_WLAN_FEATURE_HIPRIV) || defined(_PRE_WLAN_FEATURE_SIGMA)
195 hi_u32 wal_hipriv_set_shortgi20(oal_net_device_stru *netdev, hi_char *pc_param);
196 #endif
197 #if defined _PRE_WLAN_FEATURE_SIGMA
198 hi_u32 wal_hipriv_set_stbc_cap(oal_net_device_stru *netdev, hi_char *pc_param);
199 hi_u32 wal_hipriv_addba_req(oal_net_device_stru *netdev, hi_char *pc_param);
200 #endif
201 #if defined(_PRE_WLAN_FEATURE_HIPRIV) || defined(_PRE_WLAN_FEATURE_SIGMA)
202 hi_u32 wal_hipriv_entry(const hi_char *pc_buffer, hi_u32 count);
203 #endif
204 hi_u32 wal_hipriv_tx_proc(oal_net_device_stru *netdev, hi_char *pc_param);
205 hi_u32 wal_hipriv_rx_proc(oal_net_device_stru *netdev, hi_char *pc_param);
206 hi_u32 wal_hipriv_rx_fcs_info(oal_net_device_stru *netdev, hi_char *pc_param);
207 #ifdef _PRE_WLAN_FEATURE_HIPRIV
208 hi_u32 wal_hipriv_user_info(oal_net_device_stru *netdev, hi_char *pc_param);
209 #endif
210 hi_u32 wal_hipriv_get_netdev(const hi_char *pc_cmd, oal_net_device_stru **netdev, hi_u32 *pul_off_set);
211 hi_u32 wal_hipriv_always_tx(oal_net_device_stru *netdev, hi_u8 tx_flag);
212 hi_u32 wal_hipriv_always_rx(oal_net_device_stru *netdev, hi_u8 rx_flag, hi_u8 mac_filter_flag);
213 #ifdef _PRE_WLAN_FEATURE_HIPRIV
214 hi_u32 wal_hipriv_get_cal_data(oal_net_device_stru *netdev, hi_char *pc_param);
215 hi_u32 wal_hipriv_set_cal_band_power(oal_net_device_stru *netdev, hi_char *pc_param);
216 hi_u32 wal_hipriv_set_cal_rate_power(oal_net_device_stru *netdev, hi_char *pc_param);
217 hi_u32 wal_hipriv_set_rate_power(oal_net_device_stru *netdev, hi_char *pc_param);
218 hi_u32 wal_hipriv_set_cal_freq_power(oal_net_device_stru *netdev, hi_char *pc_param);
219 hi_u32 wal_hipriv_set_dataefuse(oal_net_device_stru *netdev, hi_char *pc_param);
220 hi_u32 wal_hipriv_set_customer_mac(oal_net_device_stru *netdev, hi_char *pc_param);
221 hi_u32 wal_hipriv_get_customer_mac(oal_net_device_stru *netdev, hi_char *pc_param);
222 #endif
223 hi_u32 hi_hipriv_set_tx_pwr_offset(oal_net_device_stru *netdev, hi_char *pc_param);
224 #ifdef _PRE_WLAN_FEATURE_WOW
225 hi_u32 wal_get_add_wow_pattern_param(hi_u8 index, hi_char *pattern, hmac_cfg_wow_pattern_param_stru *cfg_wow_param);
226 #endif
227 hi_bool is_under_ps(hi_void);
228 hi_void set_under_ps(hi_bool under_ps);
229 hi_void set_under_mfg(hi_u32 under_mfg);
230 
231 #ifdef __cplusplus
232 #if __cplusplus
233 }
234 #endif
235 #endif
236 
237 #endif /* end of wal_hipriv.h */
238