• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  ******************************************************************************/
15 #define _RTL8723A_REDESC_C_
16 
17 #include <osdep_service.h>
18 #include <drv_types.h>
19 #include <rtl8723a_hal.h>
20 
process_rssi(struct rtw_adapter * padapter,struct recv_frame * prframe)21 static void process_rssi(struct rtw_adapter *padapter,
22 			 struct recv_frame *prframe)
23 {
24 	struct rx_pkt_attrib *pattrib = &prframe->attrib;
25 	struct signal_stat *signal_stat = &padapter->recvpriv.signal_strength_data;
26 
27 	if (signal_stat->update_req) {
28 		signal_stat->total_num = 0;
29 		signal_stat->total_val = 0;
30 		signal_stat->update_req = 0;
31 	}
32 
33 	signal_stat->total_num++;
34 	signal_stat->total_val  += pattrib->phy_info.SignalStrength;
35 	signal_stat->avg_val = signal_stat->total_val / signal_stat->total_num;
36 }
37 
process_link_qual(struct rtw_adapter * padapter,struct recv_frame * prframe)38 static void process_link_qual(struct rtw_adapter *padapter,
39 			      struct recv_frame *prframe)
40 {
41 	struct rx_pkt_attrib *pattrib;
42 	struct signal_stat *signal_stat;
43 
44 	if (prframe == NULL || padapter == NULL)
45 		return;
46 
47 	pattrib = &prframe->attrib;
48 	signal_stat = &padapter->recvpriv.signal_qual_data;
49 
50 	if (signal_stat->update_req) {
51 		signal_stat->total_num = 0;
52 		signal_stat->total_val = 0;
53 		signal_stat->update_req = 0;
54 	}
55 
56 	signal_stat->total_num++;
57 	signal_stat->total_val  += pattrib->phy_info.SignalQuality;
58 	signal_stat->avg_val = signal_stat->total_val / signal_stat->total_num;
59 }
60 
61 /* void rtl8723a_process_phy_info(struct rtw_adapter *padapter, union recv_frame *prframe) */
rtl8723a_process_phy_info(struct rtw_adapter * padapter,void * prframe)62 void rtl8723a_process_phy_info(struct rtw_adapter *padapter, void *prframe)
63 {
64 	struct recv_frame *precvframe = prframe;
65 	/*  Check RSSI */
66 	process_rssi(padapter, precvframe);
67 	/*  Check EVM */
68 	process_link_qual(padapter,  precvframe);
69 }
70