xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8723bs/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(IN	PADAPTER	Adapter,
57 			   IN	u32			RegAddr,
58 			   IN	u32			BitMask);
59 void	PHY_SetBBReg8812(IN	PADAPTER		Adapter,
60 			 IN	u32			RegAddr,
61 			 IN	u32			BitMask,
62 			 IN	u32			Data);
63 u32	PHY_QueryRFReg8812(IN	PADAPTER	Adapter,
64 			   IN	enum rf_path	eRFPath,
65 			   IN	u32			RegAddr,
66 			   IN	u32			BitMask);
67 void	PHY_SetRFReg8812(IN	PADAPTER		Adapter,
68 			 IN	enum rf_path	eRFPath,
69 			 IN	u32			RegAddr,
70 			 IN	u32			BitMask,
71 			 IN	u32			Data);
72 
73 /*
74  * Initialization related function
75  *
76  * MAC/BB/RF HAL config */
77 int	PHY_MACConfig8812(IN PADAPTER	Adapter);
78 int	PHY_BBConfig8812(IN PADAPTER	Adapter);
79 void	PHY_BB8812_Config_1T(IN PADAPTER	Adapter);
80 int	PHY_RFConfig8812(IN PADAPTER	Adapter);
81 
82 /* RF config */
83 
84 s32
85 PHY_SwitchWirelessBand8812(
86 	IN PADAPTER		Adapter,
87 	IN u8			Band
88 );
89 
90 /*
91  * BB TX Power R/W
92  *   */
93 void	PHY_GetTxPowerLevel8812(IN PADAPTER	Adapter, OUT s32	*powerlevel);
94 void	PHY_SetTxPowerLevel8812(IN PADAPTER	Adapter, IN u8	Channel);
95 
96 BOOLEAN	PHY_UpdateTxPowerDbm8812(IN PADAPTER	Adapter, IN int	powerInDbm);
97 u8 PHY_GetTxPowerIndex_8812A(
98 	IN	PADAPTER			pAdapter,
99 	IN	enum rf_path			RFPath,
100 	IN	u8					Rate,
101 	IN	u8					BandWidth,
102 	IN	u8					Channel,
103 	struct txpwr_idx_comp *tic
104 );
105 
106 u32 phy_get_tx_bb_swing_8812a(
107 	IN	PADAPTER	Adapter,
108 	IN	BAND_TYPE	Band,
109 	IN	enum rf_path	RFPath
110 );
111 
112 VOID
113 PHY_SetTxPowerIndex_8812A(
114 	IN	PADAPTER		Adapter,
115 	IN	u32				PowerIndex,
116 	IN	enum rf_path		RFPath,
117 	IN	u8				Rate
118 );
119 
120 /*
121  * channel switch related funciton
122  *   */
123 VOID
124 PHY_SetSwChnlBWMode8812(
125 	IN	PADAPTER			Adapter,
126 	IN	u8					channel,
127 	IN	enum channel_width	Bandwidth,
128 	IN	u8					Offset40,
129 	IN	u8					Offset80
130 );
131 
132 /*
133  * BB/MAC/RF other monitor API
134  *   */
135 
136 VOID
137 phy_set_rf_path_switch_8812a(
138 	IN	PADAPTER	pAdapter,
139 	IN	bool		bMain
140 );
141 
142 /*--------------------------Exported Function prototype---------------------*/
143 #endif /* __INC_HAL8192CPHYCFG_H */
144