net:wireless:Support eswin usb wifi ECR6600U
[platform/kernel/linux-starfive.git] / drivers / net / wireless / eswin / fullmac / ecrnx_debugfs_func.h
1 #ifndef __ECRNX_DEBUGFS_FUNC_H_
2 #define __ECRNX_DEBUGFS_FUNC_H_
3
4 #include "ecrnx_defs.h"
5 #include "ecrnx_utils.h"
6 #include "eswin_utils.h"
7 #include "fw_head_check.h"
8
9 #include <linux/etherdevice.h>
10
11
12
13 #define HOST_DRIVER_VERSION     "1.0.0"
14
15 #define NX_VIRT_STA_MAX         (NX_VIRT_DEV_MAX + NX_REMOTE_STA_MAX)
16
17 typedef enum {
18     IF_STA = 0,
19     IF_AP,
20     IF_P2P
21 } IF_TYPE_EN;
22
23 typedef struct {
24     u8 ch;
25     u8 bw;
26     u32 ch_offset;
27 } RF_INFO_ST;
28
29 typedef struct {
30     u8 name[48];
31     u32 addr;
32 }REG_MAP_ST;
33
34 struct ecrnx_debugfs_survey_info_tbl
35 {
36         struct list_head list;
37         u8              ssid[IEEE80211_MAX_SSID_LEN];
38         u8              bssid[ETH_ALEN];
39         u32             ch;
40         int             rssi;
41         s32             sdbm;
42         s16             noise;
43         u32             age;
44         char    flag[64];
45 };
46
47 struct ecrnx_debugfs_sta
48 {
49         u8 mac_addr[ETH_ALEN];
50     u16 aid;                /* association ID */
51     u8 sta_idx;             /* Identifier of the station */
52         enum nl80211_chan_width width; /* Channel width */
53         u8 ch_idx;              /* Identifier of the channel
54                                context the station belongs to */
55         bool qos;               /* Flag indicating if the station
56                                supports QoS */
57     bool ht;               /* Flag indicating if the station
58                                supports HT */
59     bool vht;               /* Flag indicating if the station
60                                supports VHT */
61
62         bool sgi_20m;
63         bool sgi_40m;
64
65         u8      ampdu_enable;/* for enable Tx A-MPDU */
66         
67         /* for processing Tx A-MPDU */
68         u8      agg_enable_bitmap;
69         /* u8   ADDBA_retry_count; */
70         u8      candidate_tid_bitmap;
71
72         u8      ldpc_cap;
73         u8      stbc_cap;
74         u8      beamform_cap;
75 };
76
77 #define MAX_ARGV                10
78
79 typedef int (*_cmd_func)(uint32_t index, uint8_t *param);
80
81 typedef struct{
82     uint32_t range_min;
83     uint32_t range_max;
84 }ECRNX_CLI_PARAM_RANGE_ST;
85
86 typedef struct {
87     char cmd[20];
88     char map_cmd[20];
89     uint32_t param_num;
90     ECRNX_CLI_PARAM_RANGE_ST param_range[MAX_ARGV];
91     _cmd_func cmd_func;
92 }ECRNX_CLI_TABLE_ST;
93
94 extern ECRNX_CLI_TABLE_ST ecrnx_cli_tab[];
95
96 enum debugfs_type
97 {
98     SLAVE_LOG_LEVEL = 1,
99     SLAVE_FW_INFO,
100     SLAVE_RF_INFO,
101     SLAVE_MAC_REG_DUMP,
102     SLAVE_RF_REG_DUMP,
103     SLAVE_BB_REG_DUMP,
104     SLAVE_COUNTRY_CODE,
105     SLAVE_EFUSE_MAP,
106     SLAVE_WOW_ENABLE,
107     SLAVE_WOW_WLAN_GOPI_INFO,
108     SLAVE_READ_REG,
109     SLAVE_WRITE_REG,
110     SLAVE_FUNC_INFO,
111     SLAVE_DEBUGFS_MAX,
112 };
113
114 typedef struct
115 {
116     uint32_t debugfs_type;
117
118     union
119     {
120         struct 
121         {
122             uint32_t debug_level;
123             uint32_t debug_dir;
124         }slave_log_level_t;
125
126         struct
127         {
128             uint32_t info;
129             uint32_t info_len;
130         }slave_fw_info_t;
131
132         struct
133         {
134             uint32_t reg;
135             uint32_t len;
136         }slave_read_reg_t;
137
138         struct
139         {
140             uint32_t reg;
141             uint32_t value;
142         }slave_write_reg_t;
143
144         struct
145         {
146             uint8_t func_and_param[56];
147         }slave_cli_func_info_t;
148
149     }u;
150 }debugfs_info_t;
151
152 typedef struct
153 {
154     uint32_t debugfs_type;
155     unsigned char   rxdata[ECRNX_RXSIZE];
156     int             rxlen;
157     wait_queue_head_t   rxdataq;
158     int                 rxdatas;
159 }debugfs_resp_t;
160
161 extern debugfs_info_t debugfs_info;
162 extern debugfs_resp_t debugfs_resp;
163
164 extern u32 reg_buf[512];
165
166 void ecrnx_debug_param_send(dbg_req_t *req);
167
168 struct ring_buffer *usb_dbg_buf_get(void);
169
170 int ecrnx_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
171                                       int idx, u8 *mac, struct station_info *sinfo);
172 int ecrnx_cfg80211_get_channel(struct wiphy *wiphy,
173                                      struct wireless_dev *wdev,
174                                      struct cfg80211_chan_def *chandef);
175 int ecrnx_log_level_get(LOG_CTL_ST *log);
176 int ecrnx_fw_log_level_set(u32 level, u32 dir);
177 bool ecrnx_log_host_enable(void);
178 int ecrnx_host_ver_get(u8 *ver);
179 int ecrnx_fw_ver_get(u8 *ver);
180 int ecrnx_build_time_get(u8 *build_time);
181 int ecrnx_rf_info_get(struct seq_file *seq, IF_TYPE_EN iftype,RF_INFO_ST *cur, RF_INFO_ST *oper);
182 int ecrnx_country_code_get(struct seq_file *seq, char *alpha2);
183 int ecrnx_mac_addr_get(struct seq_file *seq, IF_TYPE_EN iftype, u8 *mac_addr);
184 int ecrnx_mac_addr_get_ex(struct seq_file *seq, u8 *mac_addr_info);
185 int ecrnx_channel_get(struct seq_file *seq, IF_TYPE_EN iftype, struct cfg80211_chan_def *chandef);
186 int ecrnx_p2p_role_get(struct seq_file *seq, IF_TYPE_EN iftype);
187 int ecrnx_bssid_get(struct seq_file *seq, IF_TYPE_EN iftype, u8 *bssid);
188 int ecrnx_signal_level_get(struct seq_file *seq, IF_TYPE_EN iftype, s8 *noise_dbm);
189 int ecrnx_flags_get(struct seq_file *seq, IF_TYPE_EN iftype, u32 *flags);
190 int ecrnx_ssid_get(struct seq_file *seq, IF_TYPE_EN iftype, char *ssid);
191 int ecrnx_sta_mac_get(struct seq_file *seq, IF_TYPE_EN iftype, u8 sta_mac[][ETH_ALEN+1]);
192 int ecrnx_mac_reg_dump(struct seq_file *seq);
193 int ecrnx_rf_reg_dump(struct seq_file *seq);
194 int ecrnx_bb_reg_dump(struct seq_file *seq);
195 int ecrnx_efuse_map_dump(struct seq_file *seq);
196 int ecrnx_slave_reg_read(u32 addr, u32 *data, u32 len);
197 int ecrnx_slave_reg_write(u32 addr, u32 data, u32 len);
198 int ecrnx_slave_cli_send(u8 *cli, u8 *resp);
199 void ecrnx_debugfs_survey_info_update(struct ecrnx_hw *ecrnx_hw, struct cfg80211_bss *bss);
200 void ecrnx_debugfs_noise_of_survey_info_update(struct ecrnx_hw *ecrnx_hw,
201                                                                                 struct ecrnx_survey_info *ecrnx_survey, int chan_no);
202 void ecrnx_debugfs_add_station_in_ap_mode(struct ecrnx_hw *ecrnx_hw,
203                                                                                         struct ecrnx_sta *sta, struct station_parameters *params);
204 int cli_macbyp_start(uint32_t index, uint8_t *param);
205 int cli_macbyp_stop(uint32_t index, uint8_t *param);
206 int cli_rf_txgain(uint32_t index, uint8_t *param);
207 int cli_rf_rxgain(uint32_t index, uint8_t *param);
208 int cli_rf_chan(uint32_t index, uint8_t *param);
209 int cli_cmd_parse(uint8_t *cmd);
210
211 #endif