xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8822be/include/Hal8812PhyCfg.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17  *
18  *
19  ******************************************************************************/
20 #ifndef __INC_HAL8812PHYCFG_H__
21 #define __INC_HAL8812PHYCFG_H__
22 
23 
24 /*--------------------------Define Parameters-------------------------------*/
25 #define LOOP_LIMIT				5
26 #define MAX_STALL_TIME			50		/* us */
27 #define AntennaDiversityValue	0x80	/* (Adapter->bSoftwareAntennaDiversity ? 0x00 : 0x80) */
28 #define MAX_TXPWR_IDX_NMODE_92S	63
29 #define Reset_Cnt_Limit			3
30 
31 
32 #ifdef CONFIG_PCI_HCI
33 	#define MAX_AGGR_NUM	0x0B
34 #else
35 	#define MAX_AGGR_NUM	0x07
36 #endif /* CONFIG_PCI_HCI */
37 
38 
39 /*--------------------------Define Parameters-------------------------------*/
40 
41 /*------------------------------Define structure----------------------------*/
42 
43 
44 /* BB/RF related */
45 
46 /*------------------------------Define structure----------------------------*/
47 
48 
49 /*------------------------Export global variable----------------------------*/
50 /*------------------------Export global variable----------------------------*/
51 
52 
53 /*------------------------Export Marco Definition---------------------------*/
54 /*------------------------Export Marco Definition---------------------------*/
55 
56 
57 /*--------------------------Exported Function prototype---------------------*/
58 /*
59  * BB and RF register read/write
60  *   */
61 u32	PHY_QueryBBReg8812(IN	PADAPTER	Adapter,
62 			   IN	u32			RegAddr,
63 			   IN	u32			BitMask);
64 void	PHY_SetBBReg8812(IN	PADAPTER		Adapter,
65 			 IN	u32			RegAddr,
66 			 IN	u32			BitMask,
67 			 IN	u32			Data);
68 u32	PHY_QueryRFReg8812(IN	PADAPTER	Adapter,
69 			   IN	u8			eRFPath,
70 			   IN	u32			RegAddr,
71 			   IN	u32			BitMask);
72 void	PHY_SetRFReg8812(IN	PADAPTER		Adapter,
73 			 IN	u8			eRFPath,
74 			 IN	u32			RegAddr,
75 			 IN	u32			BitMask,
76 			 IN	u32			Data);
77 
78 /*
79  * Initialization related function
80  *
81  * MAC/BB/RF HAL config */
82 int	PHY_MACConfig8812(IN PADAPTER	Adapter);
83 int	PHY_BBConfig8812(IN PADAPTER	Adapter);
84 void	PHY_BB8812_Config_1T(IN PADAPTER	Adapter);
85 int	PHY_RFConfig8812(IN PADAPTER	Adapter);
86 
87 /* RF config */
88 
89 s32
90 PHY_SwitchWirelessBand8812(
91 	IN PADAPTER		Adapter,
92 	IN u8			Band
93 );
94 
95 /*
96  * BB TX Power R/W
97  *   */
98 void	PHY_GetTxPowerLevel8812(IN PADAPTER	Adapter, OUT s32	*powerlevel);
99 void	PHY_SetTxPowerLevel8812(IN PADAPTER	Adapter, IN u8	Channel);
100 
101 BOOLEAN	PHY_UpdateTxPowerDbm8812(IN PADAPTER	Adapter, IN int	powerInDbm);
102 u8 PHY_GetTxPowerIndex_8812A(
103 	IN	PADAPTER			pAdapter,
104 	IN	u8					RFPath,
105 	IN	u8					Rate,
106 	IN	CHANNEL_WIDTH		BandWidth,
107 	IN	u8					Channel
108 );
109 
110 u32 PHY_GetTxBBSwing_8812A(
111 	IN	PADAPTER	Adapter,
112 	IN	BAND_TYPE	Band,
113 	IN	u8			RFPath
114 );
115 
116 VOID
117 PHY_SetTxPowerIndex_8812A(
118 	IN	PADAPTER			Adapter,
119 	IN	u4Byte				PowerIndex,
120 	IN	u1Byte				RFPath,
121 	IN	u1Byte				Rate
122 );
123 
124 /*
125  * Switch bandwidth for 8192S
126  *   */
127 VOID
128 PHY_SetBWMode8812(
129 	IN	PADAPTER			pAdapter,
130 	IN	CHANNEL_WIDTH		Bandwidth,
131 	IN	u8					Offset
132 );
133 
134 /*
135  * channel switch related funciton
136  *   */
137 VOID
138 PHY_SwChnl8812(
139 	IN	PADAPTER	Adapter,
140 	IN	u8			channel
141 );
142 
143 
144 VOID
145 PHY_SetSwChnlBWMode8812(
146 	IN	PADAPTER			Adapter,
147 	IN	u8					channel,
148 	IN	CHANNEL_WIDTH		Bandwidth,
149 	IN	u8					Offset40,
150 	IN	u8					Offset80
151 );
152 
153 /*
154  * BB/MAC/RF other monitor API
155  *   */
156 
157 VOID
158 PHY_SetRFPathSwitch_8812A(
159 	IN	PADAPTER	pAdapter,
160 	IN	BOOLEAN		bMain
161 );
162 
163 /*--------------------------Exported Function prototype---------------------*/
164 #endif /* __INC_HAL8192CPHYCFG_H */
165