xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8821cs/include/Hal8812PhyCfg.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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  *****************************************************************************/
15 #ifndef __INC_HAL8812PHYCFG_H__
16 #define __INC_HAL8812PHYCFG_H__
17 
18 
19 /*--------------------------Define Parameters-------------------------------*/
20 #define LOOP_LIMIT				5
21 #define MAX_STALL_TIME			50		/* us */
22 #define AntennaDiversityValue	0x80	/* (Adapter->bSoftwareAntennaDiversity ? 0x00 : 0x80) */
23 #define MAX_TXPWR_IDX_NMODE_92S	63
24 #define Reset_Cnt_Limit			3
25 
26 
27 #ifdef CONFIG_PCI_HCI
28 	#define MAX_AGGR_NUM	0x0B
29 #else
30 	#define MAX_AGGR_NUM	0x07
31 #endif /* CONFIG_PCI_HCI */
32 
33 
34 /*--------------------------Define Parameters-------------------------------*/
35 
36 /*------------------------------Define structure----------------------------*/
37 
38 
39 /* BB/RF related */
40 
41 /*------------------------------Define structure----------------------------*/
42 
43 
44 /*------------------------Export global variable----------------------------*/
45 /*------------------------Export global variable----------------------------*/
46 
47 
48 /*------------------------Export Marco Definition---------------------------*/
49 /*------------------------Export Marco Definition---------------------------*/
50 
51 
52 /*--------------------------Exported Function prototype---------------------*/
53 /*
54  * BB and RF register read/write
55  *   */
56 u32	PHY_QueryBBReg8812(PADAPTER	Adapter,
57 				u32			RegAddr,
58 				u32			BitMask);
59 void	PHY_SetBBReg8812(PADAPTER		Adapter,
60 				u32			RegAddr,
61 				u32			BitMask,
62 				u32			Data);
63 u32	PHY_QueryRFReg8812(PADAPTER	Adapter,
64 				enum rf_path	eRFPath,
65 				u32			RegAddr,
66 				u32			BitMask);
67 void	PHY_SetRFReg8812(PADAPTER		Adapter,
68 				enum rf_path	eRFPath,
69 				u32			RegAddr,
70 				u32			BitMask,
71 				u32			Data);
72 
73 /*
74  * Initialization related function
75  *
76  * MAC/BB/RF HAL config */
77 int	PHY_MACConfig8812(PADAPTER	Adapter);
78 int	PHY_BBConfig8812(PADAPTER	Adapter);
79 void	PHY_BB8812_Config_1T(PADAPTER	Adapter);
80 int	PHY_RFConfig8812(PADAPTER	Adapter);
81 
82 /* RF config */
83 
84 s32
85 PHY_SwitchWirelessBand8812(
86 		PADAPTER		Adapter,
87 		u8			Band
88 );
89 
90 /*
91  * BB TX Power R/W
92  *   */
93 void	PHY_SetTxPowerLevel8812(PADAPTER	Adapter, u8	Channel);
94 
95 bool phy_get_txpwr_target_skip_by_rate_8812a(_adapter *adapter, enum MGN_RATE rate);
96 
97 u32 phy_get_tx_bb_swing_8812a(
98 		PADAPTER	Adapter,
99 		BAND_TYPE	Band,
100 		enum rf_path	RFPath
101 );
102 
103 void
104 PHY_SetTxPowerIndex_8812A(
105 		PADAPTER		Adapter,
106 		u32				PowerIndex,
107 		enum rf_path		RFPath,
108 		u8				Rate
109 );
110 
111 /*
112  * channel switch related funciton
113  *   */
114 void
115 PHY_SetSwChnlBWMode8812(
116 		PADAPTER			Adapter,
117 		u8					channel,
118 		enum channel_width	Bandwidth,
119 		u8					Offset40,
120 		u8					Offset80
121 );
122 
123 /*
124  * BB/MAC/RF other monitor API
125  *   */
126 
127 void
128 phy_set_rf_path_switch_8812a(
129 		struct dm_struct		*phydm,
130 		bool		bMain
131 );
132 
133 /*--------------------------Exported Function prototype---------------------*/
134 #endif /* __INC_HAL8192CPHYCFG_H */
135