• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2017  Realtek Corporation.
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  * The full GNU General Public License is included in this distribution in the
15  * file called LICENSE.
16  *
17  * Contact Information:
18  * wlanfae <wlanfae@realtek.com>
19  * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20  * Hsinchu 300, Taiwan.
21  *
22  * Larry Finger <Larry.Finger@lwfinger.net>
23  *
24  *****************************************************************************/
25 
26 #ifndef __PHYDMCFOTRACK_H__
27 #define __PHYDMCFOTRACK_H__
28 
29 /* 2019.03.28 fix 8197G crystal_cap register address*/
30 #define CFO_TRACKING_VERSION "2.4"
31 
32 #define		CFO_TRK_ENABLE_TH	20 /* @kHz enable CFO_Track threshold*/
33 #define		CFO_TRK_STOP_TH		10 /* @kHz disable CFO_Track threshold*/
34 #define		CFO_TH_ATC		80 /* @kHz */
35 
36 struct phydm_cfo_track_struct {
37 	boolean		is_atc_status;
38 	boolean		is_adjust;	/*@already modify crystal cap*/
39 	u8		crystal_cap;
40 	u8		crystal_cap_default;
41 	u8		def_x_cap;
42 	s32		CFO_tail[4];
43 	u32		CFO_cnt[4];
44 	s32		CFO_ave_pre;
45 	u32		packet_count;
46 	u32		packet_count_pre;
47 };
48 
49 struct phydm_cfo_rpt {
50 	s32 cfo_rpt_s[PHYDM_MAX_RF_PATH];
51 	s32 cfo_rpt_l[PHYDM_MAX_RF_PATH];
52 	s32 cfo_rpt_acq[PHYDM_MAX_RF_PATH];
53 	s32 cfo_rpt_sec[PHYDM_MAX_RF_PATH];
54 	s32 cfo_rpt_end[PHYDM_MAX_RF_PATH];
55 };
56 
57 void phydm_get_cfo_info(void *dm_void, struct phydm_cfo_rpt *cfo);
58 
59 boolean phydm_set_crystal_cap_reg(void *dm_void, u8 crystal_cap);
60 
61 void phydm_set_crystal_cap(void *dm_void, u8 crystal_cap);
62 
63 void phydm_cfo_tracking_init(void *dm_void);
64 
65 void phydm_cfo_tracking(void *dm_void);
66 
67 void phydm_parsing_cfo(void *dm_void, void *pktinfo_void, s8 *pcfotail,
68 		       u8 num_ss);
69 void phydm_cfo_tracking_debug(void *dm_void, char input[][16], u32 *_used,
70 			      char *output, u32 *_out_len);
71 #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
72 void phy_Init_crystal_capacity(void *dm_void, u8 crystal_cap);
73 #endif
74 #endif
75