GNU Linux-libre 4.14.290-gnu1
[releases.git] / drivers / staging / rtl8723bs / include / hal_phy.h
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 #ifndef __HAL_PHY_H__
16 #define __HAL_PHY_H__
17
18
19 #if DISABLE_BB_RF
20 #define HAL_FW_ENABLE                           0
21 #define HAL_MAC_ENABLE                  0
22 #define HAL_BB_ENABLE                           0
23 #define HAL_RF_ENABLE                           0
24 #else /*  FPGA_PHY and ASIC */
25 #define         HAL_FW_ENABLE                           1
26 #define HAL_MAC_ENABLE                  1
27 #define HAL_BB_ENABLE                           1
28 #define HAL_RF_ENABLE                           1
29 #endif
30
31 #define RF6052_MAX_TX_PWR                       0x3F
32 #define RF6052_MAX_REG_88E                      0xFF
33 #define RF6052_MAX_REG_92C                      0x7F
34
35 #define RF6052_MAX_REG  \
36                 (RF6052_MAX_REG_88E > RF6052_MAX_REG_92C) ? RF6052_MAX_REG_88E: RF6052_MAX_REG_92C
37
38 #define GET_RF6052_REAL_MAX_REG(_Adapter)       RF6052_MAX_REG_92C
39
40 #define RF6052_MAX_PATH                         2
41
42 /*  */
43 /*  Antenna detection method, i.e., using single tone detection or RSSI reported from each antenna detected. */
44 /*  Added by Roger, 2013.05.22. */
45 /*  */
46 #define ANT_DETECT_BY_SINGLE_TONE       BIT0
47 #define ANT_DETECT_BY_RSSI                              BIT1
48 #define IS_ANT_DETECT_SUPPORT_SINGLE_TONE(__Adapter)            ((GET_HAL_DATA(__Adapter)->AntDetection) & ANT_DETECT_BY_SINGLE_TONE)
49 #define IS_ANT_DETECT_SUPPORT_RSSI(__Adapter)           ((GET_HAL_DATA(__Adapter)->AntDetection) & ANT_DETECT_BY_RSSI)
50
51
52 /*--------------------------Define Parameters-------------------------------*/
53 enum BAND_TYPE {
54         BAND_ON_2_4G = 0,
55         BAND_ON_5G,
56         BAND_ON_BOTH,
57         BANDMAX
58 };
59
60 enum RF_TYPE {
61         RF_TYPE_MIN = 0,        /*  0 */
62         RF_8225 = 1,            /*  1 11b/g RF for verification only */
63         RF_8256 = 2,            /*  2 11b/g/n */
64         RF_8258 = 3,            /*  3 11a/b/g/n RF */
65         RF_6052 = 4,            /*  4 11b/g/n RF */
66         RF_PSEUDO_11N = 5,      /*  5, It is a temporality RF. */
67         RF_TYPE_MAX
68 };
69
70 enum RF_PATH {
71         RF_PATH_A = 0,
72         RF_PATH_B,
73         RF_PATH_C,
74         RF_PATH_D
75 };
76
77 #define TX_1S                   0
78 #define TX_2S                   1
79 #define TX_3S                   2
80 #define TX_4S                   3
81
82 #define RF_PATH_MAX_92C_88E             2
83 #define RF_PATH_MAX_90_8812             4       /* Max RF number 90 support */
84
85 enum ANTENNA_PATH {
86        ANTENNA_NONE     = 0,
87         ANTENNA_D       = 1,
88         ANTENNA_C       = 2,
89         ANTENNA_CD      = 3,
90         ANTENNA_B       = 4,
91         ANTENNA_BD      = 5,
92         ANTENNA_BC      = 6,
93         ANTENNA_BCD     = 7,
94         ANTENNA_A       = 8,
95         ANTENNA_AD      = 9,
96         ANTENNA_AC      = 10,
97         ANTENNA_ACD     = 11,
98         ANTENNA_AB      = 12,
99         ANTENNA_ABD     = 13,
100         ANTENNA_ABC     = 14,
101         ANTENNA_ABCD    = 15
102 };
103
104 enum RF_CONTENT {
105         radioa_txt = 0x1000,
106         radiob_txt = 0x1001,
107         radioc_txt = 0x1002,
108         radiod_txt = 0x1003
109 };
110
111 enum BaseBand_Config_Type {
112         BaseBand_Config_PHY_REG = 0,                    /* Radio Path A */
113         BaseBand_Config_AGC_TAB = 1,                    /* Radio Path B */
114         BaseBand_Config_AGC_TAB_2G = 2,
115         BaseBand_Config_AGC_TAB_5G = 3,
116         BaseBand_Config_PHY_REG_PG
117 };
118
119 enum HW_BLOCK {
120         HW_BLOCK_MAC = 0,
121         HW_BLOCK_PHY0 = 1,
122         HW_BLOCK_PHY1 = 2,
123         HW_BLOCK_RF = 3,
124         HW_BLOCK_MAXIMUM = 4, /*  Never use this */
125 };
126
127 enum WIRELESS_MODE {
128         WIRELESS_MODE_UNKNOWN = 0x00,
129         WIRELESS_MODE_A = 0x01,
130         WIRELESS_MODE_B = 0x02,
131         WIRELESS_MODE_G = 0x04,
132         WIRELESS_MODE_AUTO = 0x08,
133         WIRELESS_MODE_N_24G = 0x10,
134         WIRELESS_MODE_N_5G = 0x20,
135         WIRELESS_MODE_AC_5G = 0x40,
136         WIRELESS_MODE_AC_24G  = 0x80,
137         WIRELESS_MODE_AC_ONLY  = 0x100,
138 };
139
140 enum SwChnlCmdID {
141         CmdID_End,
142         CmdID_SetTxPowerLevel,
143         CmdID_BBRegWrite10,
144         CmdID_WritePortUlong,
145         CmdID_WritePortUshort,
146         CmdID_WritePortUchar,
147         CmdID_RF_WriteReg,
148 };
149
150 struct SwChnlCmd {
151         enum SwChnlCmdID        CmdID;
152         u32                     Para1;
153         u32                     Para2;
154         u32                     msDelay;
155 };
156
157 struct R_ANTENNA_SELECT_OFDM {
158 #ifdef __LITTLE_ENDIAN
159         u32             r_tx_antenna:4;
160         u32             r_ant_l:4;
161         u32             r_ant_non_ht:4;
162         u32             r_ant_ht1:4;
163         u32             r_ant_ht2:4;
164         u32             r_ant_ht_s1:4;
165         u32             r_ant_non_ht_s1:4;
166         u32             OFDM_TXSC:2;
167         u32             Reserved:2;
168 #else
169         u32             Reserved:2;
170         u32             OFDM_TXSC:2;
171         u32             r_ant_non_ht_s1:4;
172         u32             r_ant_ht_s1:4;
173         u32             r_ant_ht2:4;
174         u32             r_ant_ht1:4;
175         u32             r_ant_non_ht:4;
176         u32             r_ant_l:4;
177         u32             r_tx_antenna:4;
178 #endif
179 };
180
181 /*--------------------------Exported Function prototype---------------------*/
182
183 #endif /* __HAL_COMMON_H__ */