Merge branch 'linux-linaro-lsk-v4.4-android' of git://git.linaro.org/kernel/linux...
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rtl8723bs / include / rtw_rf.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  * 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 __RTW_RF_H_ 
21 #define __RTW_RF_H_
22
23
24 #define OFDM_PHY                1
25 #define MIXED_PHY               2
26 #define CCK_PHY         3
27
28 #define NumRates        (13)
29
30 // slot time for 11g
31 #define SHORT_SLOT_TIME                                 9
32 #define NON_SHORT_SLOT_TIME                             20
33
34 #define RTL8711_RF_MAX_SENS 6
35 #define RTL8711_RF_DEF_SENS 4
36
37 //
38 // We now define the following channels as the max channels in each channel plan.
39 // 2G, total 14 chnls
40 // {1,2,3,4,5,6,7,8,9,10,11,12,13,14}
41 // 5G, total 24 chnls
42 // {36,40,44,48,52,56,60,64,100,104,108,112,116,120,124,128,132,136,140,149,153,157,161,165}
43 #define MAX_CHANNEL_NUM_2G                              14
44 #define MAX_CHANNEL_NUM_5G                              24
45 #define MAX_CHANNEL_NUM                                 38//14+24
46
47 //#define NUM_REGULATORYS       21
48 #define NUM_REGULATORYS 1
49
50 //Country codes
51 #define USA                                                     0x555320
52 #define EUROPE                                          0x1 //temp, should be provided later    
53 #define JAPAN                                           0x2 //temp, should be provided later    
54
55 struct  regulatory_class {
56         u32     starting_freq;                                  //MHz, 
57         u8      channel_set[MAX_CHANNEL_NUM];
58         u8      channel_cck_power[MAX_CHANNEL_NUM];//dbm
59         u8      channel_ofdm_power[MAX_CHANNEL_NUM];//dbm
60         u8      txpower_limit;                                  //dbm
61         u8      channel_spacing;                                //MHz
62         u8      modem;
63 };
64
65 typedef enum _CAPABILITY{
66         cESS                    = 0x0001,
67         cIBSS                   = 0x0002,
68         cPollable               = 0x0004,
69         cPollReq                        = 0x0008,
70         cPrivacy                = 0x0010,
71         cShortPreamble  = 0x0020,
72         cPBCC                   = 0x0040,
73         cChannelAgility = 0x0080,
74         cSpectrumMgnt   = 0x0100,
75         cQos                    = 0x0200,       // For HCCA, use with CF-Pollable and CF-PollReq
76         cShortSlotTime  = 0x0400,
77         cAPSD                   = 0x0800,
78         cRM                             = 0x1000,       // RRM (Radio Request Measurement)
79         cDSSS_OFDM      = 0x2000,
80         cDelayedBA              = 0x4000,
81         cImmediateBA    = 0x8000,
82 }CAPABILITY, *PCAPABILITY;
83
84 enum    _REG_PREAMBLE_MODE{
85         PREAMBLE_LONG   = 1,
86         PREAMBLE_AUTO   = 2,
87         PREAMBLE_SHORT  = 3,
88 };
89
90
91 enum _RTL8712_RF_MIMO_CONFIG_{
92  RTL8712_RFCONFIG_1T=0x10,
93  RTL8712_RFCONFIG_2T=0x20,
94  RTL8712_RFCONFIG_1R=0x01,
95  RTL8712_RFCONFIG_2R=0x02,
96  RTL8712_RFCONFIG_1T1R=0x11,
97  RTL8712_RFCONFIG_1T2R=0x12,
98  RTL8712_RFCONFIG_TURBO=0x92,
99  RTL8712_RFCONFIG_2T2R=0x22
100 };
101
102
103 typedef enum _RF90_RADIO_PATH{
104         RF90_PATH_A = 0,                        //Radio Path A
105         RF90_PATH_B = 1,                        //Radio Path B
106         RF90_PATH_C = 2,                        //Radio Path C
107         RF90_PATH_D = 3                 //Radio Path D
108         //RF90_PATH_MAX                         //Max RF number 90 support
109 }RF90_RADIO_PATH_E, *PRF90_RADIO_PATH_E;
110
111 // Bandwidth Offset
112 #define HAL_PRIME_CHNL_OFFSET_DONT_CARE 0
113 #define HAL_PRIME_CHNL_OFFSET_LOWER     1
114 #define HAL_PRIME_CHNL_OFFSET_UPPER     2
115
116 // Represent Channel Width in HT Capabilities
117 //
118 typedef enum _CHANNEL_WIDTH{
119         CHANNEL_WIDTH_20 = 0,
120         CHANNEL_WIDTH_40 = 1,
121         CHANNEL_WIDTH_80 = 2,
122         CHANNEL_WIDTH_160 = 3,
123         CHANNEL_WIDTH_80_80 = 4,
124         CHANNEL_WIDTH_MAX = 5,
125 }CHANNEL_WIDTH, *PCHANNEL_WIDTH;
126
127 //
128 // Represent Extention Channel Offset in HT Capabilities
129 // This is available only in 40Mhz mode.
130 //
131 typedef enum _EXTCHNL_OFFSET{
132         EXTCHNL_OFFSET_NO_EXT = 0,
133         EXTCHNL_OFFSET_UPPER = 1,
134         EXTCHNL_OFFSET_NO_DEF = 2,
135         EXTCHNL_OFFSET_LOWER = 3,
136 }EXTCHNL_OFFSET, *PEXTCHNL_OFFSET;
137
138 typedef enum _VHT_DATA_SC{
139         VHT_DATA_SC_DONOT_CARE = 0,
140         VHT_DATA_SC_20_UPPER_OF_80MHZ = 1,
141         VHT_DATA_SC_20_LOWER_OF_80MHZ = 2,
142         VHT_DATA_SC_20_UPPERST_OF_80MHZ = 3,
143         VHT_DATA_SC_20_LOWEST_OF_80MHZ = 4,
144         VHT_DATA_SC_20_RECV1 = 5,
145         VHT_DATA_SC_20_RECV2 = 6,
146         VHT_DATA_SC_20_RECV3 = 7,
147         VHT_DATA_SC_20_RECV4 = 8,
148         VHT_DATA_SC_40_UPPER_OF_80MHZ = 9,
149         VHT_DATA_SC_40_LOWER_OF_80MHZ = 10,
150 }VHT_DATA_SC, *PVHT_DATA_SC_E;
151
152 typedef enum _PROTECTION_MODE{
153         PROTECTION_MODE_AUTO = 0,
154         PROTECTION_MODE_FORCE_ENABLE = 1,
155         PROTECTION_MODE_FORCE_DISABLE = 2,
156 }PROTECTION_MODE, *PPROTECTION_MODE;
157
158 /* 2007/11/15 MH Define different RF type. */
159 typedef enum _RT_RF_TYPE_DEFINITION
160 {
161         RF_1T2R = 0,
162         RF_2T4R = 1,
163         RF_2T2R = 2,
164         RF_1T1R = 3,
165         RF_2T2R_GREEN = 4,
166         RF_MAX_TYPE = 5,
167 }RT_RF_TYPE_DEF_E;
168
169
170 u32 rtw_ch2freq(u32 ch);
171 u32 rtw_freq2ch(u32 freq);
172
173
174 #endif //_RTL8711_RF_H_
175