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