1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#ifndef __HALHWOUTSRC_H__
16#define __HALHWOUTSRC_H__
17
18
19#define CCK_RSSI_INIT_COUNT 5
20
21#define RA_RSSI_STATE_INIT 0
22#define RA_RSSI_STATE_SEND 1
23#define RA_RSSI_STATE_HOLD 2
24
25#define CFO_HW_RPT_2_MHZ(val) ((val << 1) + (val >> 1))
26
27
28#define AGC_DIFF_CONFIG_MP(ic, band) \
29 (odm_read_and_config_mp_##ic##_agc_tab_diff( \
30 dm, array_mp_##ic##_agc_tab_diff_##band, \
31 sizeof(array_mp_##ic##_agc_tab_diff_##band) / sizeof(u32)))
32#define AGC_DIFF_CONFIG_TC(ic, band) \
33 (odm_read_and_config_tc_##ic##_agc_tab_diff( \
34 dm, array_tc_##ic##_agc_tab_diff_##band, \
35 sizeof(array_tc_##ic##_agc_tab_diff_##band) / sizeof(u32)))
36
37#define AGC_DIFF_CONFIG(ic, band) \
38 do { \
39 if (dm->is_mp_chip) \
40 AGC_DIFF_CONFIG_MP(ic, band); \
41 else \
42 AGC_DIFF_CONFIG_TC(ic, band); \
43 } while (0)
44
45
46
47
48
49struct phy_rx_agc_info {
50#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
51 u8 gain : 7, trsw : 1;
52#else
53 u8 trsw : 1, gain : 7;
54#endif
55};
56
57struct phy_status_rpt_8192cd {
58 struct phy_rx_agc_info path_agc[2];
59 u8 ch_corr[2];
60 u8 cck_sig_qual_ofdm_pwdb_all;
61 u8 cck_agc_rpt_ofdm_cfosho_a;
62 u8 cck_rpt_b_ofdm_cfosho_b;
63 u8 rsvd_1;
64 u8 noise_power_db_msb;
65 s8 path_cfotail[2];
66 u8 pcts_mask[2];
67 s8 stream_rxevm[2];
68 u8 path_rxsnr[2];
69 u8 noise_power_db_lsb;
70 u8 rsvd_2[3];
71 u8 stream_csi[2];
72 u8 stream_target_csi[2];
73 s8 sig_evm;
74 u8 rsvd_3;
75
76#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
77 u8 antsel_rx_keep_2 : 1;
78 u8 sgi_en : 1;
79 u8 rxsc : 2;
80 u8 idle_long : 1;
81 u8 r_ant_train_en : 1;
82 u8 ant_sel_b : 1;
83 u8 ant_sel : 1;
84#else
85 u8 ant_sel : 1;
86 u8 ant_sel_b : 1;
87 u8 r_ant_train_en : 1;
88 u8 idle_long : 1;
89 u8 rxsc : 2;
90 u8 sgi_en : 1;
91 u8 antsel_rx_keep_2 : 1;
92#endif
93};
94
95struct phy_status_rpt_8812 {
96
97 u8 gain_trsw[2];
98 u8 chl_num_LSB;
99#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
100 u8 chl_num_MSB : 2;
101 u8 sub_chnl : 4;
102 u8 r_RFMOD : 2;
103#else
104 u8 r_RFMOD : 2;
105 u8 sub_chnl : 4;
106 u8 chl_num_MSB : 2;
107#endif
108
109
110 u8 pwdb_all;
111 s8 cfosho[2];
112
113#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
114
115
116
117 u8 resvd_0 : 6;
118 u8 bt_RF_ch_MSB : 2;
119#else
120 u8 bt_RF_ch_MSB : 2;
121 u8 resvd_0 : 6;
122#endif
123
124
125#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
126 u8 ant_div_sw_a : 1;
127 u8 ant_div_sw_b : 1;
128 u8 bt_RF_ch_LSB : 6;
129#else
130 u8 bt_RF_ch_LSB : 6;
131 u8 ant_div_sw_b : 1;
132 u8 ant_div_sw_a : 1;
133#endif
134 s8 cfotail[2];
135 u8 PCTS_MSK_RPT_0;
136 u8 PCTS_MSK_RPT_1;
137
138
139 s8 rxevm[2];
140 s8 rxsnr[2];
141
142
143 u8 PCTS_MSK_RPT_2;
144#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
145 u8 PCTS_MSK_RPT_3 : 6;
146 u8 pcts_rpt_valid : 1;
147 u8 resvd_1 : 1;
148#else
149 u8 resvd_1 : 1;
150 u8 pcts_rpt_valid : 1;
151 u8 PCTS_MSK_RPT_3 : 6;
152#endif
153 s8 rxevm_cd[2];
154
155
156
157 u8 csi_current[2];
158
159 u8 gain_trsw_cd[2];
160
161
162
163 s8 sigevm;
164#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
165 u8 antidx_antc : 3;
166 u8 antidx_antd : 3;
167 u8 dpdt_ctrl_keep : 1;
168 u8 GNT_BT_keep : 1;
169#else
170 u8 GNT_BT_keep : 1;
171 u8 dpdt_ctrl_keep : 1;
172 u8 antidx_antd : 3;
173 u8 antidx_antc : 3;
174#endif
175#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
176 u8 antidx_anta : 3;
177 u8 antidx_antb : 3;
178 u8 hw_antsw_occur : 2;
179#else
180 u8 hw_antsw_occur : 2;
181 u8 antidx_antb : 3;
182 u8 antidx_anta : 3;
183#endif
184};
185
186void phydm_reset_rssi_for_dm(struct phy_dm_struct *dm, u8 station_id);
187
188void odm_init_rssi_for_dm(struct phy_dm_struct *dm);
189
190void odm_phy_status_query(struct phy_dm_struct *dm,
191 struct dm_phy_status_info *phy_info, u8 *phy_status,
192 struct dm_per_pkt_info *pktinfo);
193
194void odm_mac_status_query(struct phy_dm_struct *dm, u8 *mac_status, u8 mac_id,
195 bool is_packet_match_bssid, bool is_packet_to_self,
196 bool is_packet_beacon);
197
198enum hal_status
199odm_config_rf_with_tx_pwr_track_header_file(struct phy_dm_struct *dm);
200
201enum hal_status
202odm_config_rf_with_header_file(struct phy_dm_struct *dm,
203 enum odm_rf_config_type config_type,
204 enum odm_rf_radio_path e_rf_path);
205
206enum hal_status
207odm_config_bb_with_header_file(struct phy_dm_struct *dm,
208 enum odm_bb_config_type config_type);
209
210enum hal_status odm_config_mac_with_header_file(struct phy_dm_struct *dm);
211
212enum hal_status
213odm_config_fw_with_header_file(struct phy_dm_struct *dm,
214 enum odm_fw_config_type config_type,
215 u8 *p_firmware, u32 *size);
216
217u32 odm_get_hw_img_version(struct phy_dm_struct *dm);
218
219s32 odm_signal_scale_mapping(struct phy_dm_struct *dm, s32 curr_sig);
220
221
222
223void phydm_rx_phy_status_new_type(struct phy_dm_struct *phydm, u8 *phy_status,
224 struct dm_per_pkt_info *pktinfo,
225 struct dm_phy_status_info *phy_info);
226
227bool phydm_query_is_mu_api(struct phy_dm_struct *phydm, u8 ppdu_idx,
228 u8 *p_data_rate, u8 *p_gid);
229
230struct phy_status_rpt_jaguar2_type0 {
231
232 u8 page_num;
233 u8 pwdb;
234#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
235 u8 gain : 6;
236 u8 rsvd_0 : 1;
237 u8 trsw : 1;
238#else
239 u8 trsw : 1;
240 u8 rsvd_0 : 1;
241 u8 gain : 6;
242#endif
243 u8 rsvd_1;
244
245
246 u8 rsvd_2;
247#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
248 u8 rxsc : 4;
249 u8 agc_table : 4;
250#else
251 u8 agc_table : 4;
252 u8 rxsc : 4;
253#endif
254 u8 channel;
255 u8 band;
256
257
258 u16 length;
259#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
260 u8 antidx_a : 3;
261 u8 antidx_b : 3;
262 u8 rsvd_3 : 2;
263 u8 antidx_c : 3;
264 u8 antidx_d : 3;
265 u8 rsvd_4 : 2;
266#else
267 u8 rsvd_3 : 2;
268 u8 antidx_b : 3;
269 u8 antidx_a : 3;
270 u8 rsvd_4 : 2;
271 u8 antidx_d : 3;
272 u8 antidx_c : 3;
273#endif
274
275
276 u8 signal_quality;
277#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
278 u8 vga : 5;
279 u8 lna_l : 3;
280 u8 bb_power : 6;
281 u8 rsvd_9 : 1;
282 u8 lna_h : 1;
283#else
284 u8 lna_l : 3;
285 u8 vga : 5;
286 u8 lna_h : 1;
287 u8 rsvd_9 : 1;
288 u8 bb_power : 6;
289#endif
290 u8 rsvd_5;
291
292
293 u32 rsvd_6;
294
295
296 u32 rsvd_7;
297
298
299 u32 rsvd_8;
300};
301
302struct phy_status_rpt_jaguar2_type1 {
303
304 u8 page_num;
305 u8 pwdb[4];
306#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
307 u8 l_rxsc : 4;
308 u8 ht_rxsc : 4;
309#else
310 u8 ht_rxsc : 4;
311 u8 l_rxsc : 4;
312#endif
313 u8 channel;
314#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
315 u8 band : 2;
316 u8 rsvd_0 : 1;
317 u8 hw_antsw_occu : 1;
318 u8 gnt_bt : 1;
319 u8 ldpc : 1;
320 u8 stbc : 1;
321 u8 beamformed : 1;
322#else
323 u8 beamformed : 1;
324 u8 stbc : 1;
325 u8 ldpc : 1;
326 u8 gnt_bt : 1;
327 u8 hw_antsw_occu : 1;
328 u8 rsvd_0 : 1;
329 u8 band : 2;
330#endif
331
332
333 u16 lsig_length;
334#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
335 u8 antidx_a : 3;
336 u8 antidx_b : 3;
337 u8 rsvd_1 : 2;
338 u8 antidx_c : 3;
339 u8 antidx_d : 3;
340 u8 rsvd_2 : 2;
341#else
342 u8 rsvd_1 : 2;
343 u8 antidx_b : 3;
344 u8 antidx_a : 3;
345 u8 rsvd_2 : 2;
346 u8 antidx_d : 3;
347 u8 antidx_c : 3;
348#endif
349
350
351 u8 paid;
352#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
353 u8 paid_msb : 1;
354 u8 gid : 6;
355 u8 rsvd_3 : 1;
356#else
357 u8 rsvd_3 : 1;
358 u8 gid : 6;
359 u8 paid_msb : 1;
360#endif
361 u8 intf_pos;
362#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
363 u8 intf_pos_msb : 1;
364 u8 rsvd_4 : 2;
365 u8 nb_intf_flag : 1;
366 u8 rf_mode : 2;
367 u8 rsvd_5 : 2;
368#else
369 u8 rsvd_5 : 2;
370 u8 rf_mode : 2;
371 u8 nb_intf_flag : 1;
372 u8 rsvd_4 : 2;
373 u8 intf_pos_msb : 1;
374#endif
375
376
377 s8 rxevm[4];
378
379
380 s8 cfo_tail[4];
381
382
383 s8 rxsnr[4];
384};
385
386struct phy_status_rpt_jaguar2_type2 {
387
388 u8 page_num;
389 u8 pwdb[4];
390#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
391 u8 l_rxsc : 4;
392 u8 ht_rxsc : 4;
393#else
394 u8 ht_rxsc : 4;
395 u8 l_rxsc : 4;
396#endif
397 u8 channel;
398#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
399 u8 band : 2;
400 u8 rsvd_0 : 1;
401 u8 hw_antsw_occu : 1;
402 u8 gnt_bt : 1;
403 u8 ldpc : 1;
404 u8 stbc : 1;
405 u8 beamformed : 1;
406#else
407 u8 beamformed : 1;
408 u8 stbc : 1;
409 u8 ldpc : 1;
410 u8 gnt_bt : 1;
411 u8 hw_antsw_occu : 1;
412 u8 rsvd_0 : 1;
413 u8 band : 2;
414#endif
415
416
417#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
418 u8 shift_l_map : 6;
419 u8 rsvd_1 : 2;
420#else
421 u8 rsvd_1 : 2;
422 u8 shift_l_map : 6;
423#endif
424 u8 cnt_pw2cca;
425#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
426 u8 agc_table_a : 4;
427 u8 agc_table_b : 4;
428 u8 agc_table_c : 4;
429 u8 agc_table_d : 4;
430#else
431 u8 agc_table_b : 4;
432 u8 agc_table_a : 4;
433 u8 agc_table_d : 4;
434 u8 agc_table_c : 4;
435#endif
436
437
438 u8 cnt_cca2agc_rdy;
439#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
440 u8 gain_a : 6;
441 u8 rsvd_2 : 1;
442 u8 trsw_a : 1;
443 u8 gain_b : 6;
444 u8 rsvd_3 : 1;
445 u8 trsw_b : 1;
446 u8 gain_c : 6;
447 u8 rsvd_4 : 1;
448 u8 trsw_c : 1;
449 u8 gain_d : 6;
450 u8 rsvd_5 : 1;
451 u8 trsw_d : 1;
452 u8 aagc_step_a : 2;
453 u8 aagc_step_b : 2;
454 u8 aagc_step_c : 2;
455 u8 aagc_step_d : 2;
456#else
457 u8 trsw_a : 1;
458 u8 rsvd_2 : 1;
459 u8 gain_a : 6;
460 u8 trsw_b : 1;
461 u8 rsvd_3 : 1;
462 u8 gain_b : 6;
463 u8 trsw_c : 1;
464 u8 rsvd_4 : 1;
465 u8 gain_c : 6;
466 u8 trsw_d : 1;
467 u8 rsvd_5 : 1;
468 u8 gain_d : 6;
469 u8 aagc_step_d : 2;
470 u8 aagc_step_c : 2;
471 u8 aagc_step_b : 2;
472 u8 aagc_step_a : 2;
473#endif
474 u8 ht_aagc_gain[4];
475 u8 dagc_gain[4];
476#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE)
477 u8 counter : 6;
478 u8 rsvd_6 : 2;
479 u8 syn_count : 5;
480 u8 rsvd_7 : 3;
481#else
482 u8 rsvd_6 : 2;
483 u8 counter : 6;
484 u8 rsvd_7 : 3;
485 u8 syn_count : 5;
486#endif
487};
488
489u32 query_phydm_trx_capability(struct phy_dm_struct *dm);
490
491u32 query_phydm_stbc_capability(struct phy_dm_struct *dm);
492
493u32 query_phydm_ldpc_capability(struct phy_dm_struct *dm);
494
495u32 query_phydm_txbf_parameters(struct phy_dm_struct *dm);
496
497u32 query_phydm_txbf_capability(struct phy_dm_struct *dm);
498
499#endif
500