- supported.conf: Added sparse_keymap (eeepc_laptop depends on it)
[linux-flexiantxendom0-3.2.10.git] / drivers / staging / rt3090 / spectrum_def.h
1 /*
2  *************************************************************************
3  * Ralink Tech Inc.
4  * 5F., No.36, Taiyuan St., Jhubei City,
5  * Hsinchu County 302,
6  * Taiwan, R.O.C.
7  *
8  * (c) Copyright 2002-2007, Ralink Technology, Inc.
9  *
10  * This program is free software; you can redistribute it and/or modify  *
11  * it under the terms of the GNU General Public License as published by  *
12  * the Free Software Foundation; either version 2 of the License, or     *
13  * (at your option) any later version.                                   *
14  *                                                                       *
15  * This program is distributed in the hope that it will be useful,       *
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
18  * GNU General Public License for more details.                          *
19  *                                                                       *
20  * You should have received a copy of the GNU General Public License     *
21  * along with this program; if not, write to the                         *
22  * Free Software Foundation, Inc.,                                       *
23  * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
24  *                                                                       *
25  *************************************************************************
26
27     Module Name:
28         spectrum_def.h
29
30     Abstract:
31     Handle association related requests either from WSTA or from local MLME
32
33     Revision History:
34     Who          When          What
35     ---------    ----------    ----------------------------------------------
36         Fonchi Wu    2008                  created for 802.11h
37  */
38
39 #ifndef __SPECTRUM_DEF_H__
40 #define __SPECTRUM_DEF_H__
41
42
43 #define MAX_MEASURE_REQ_TAB_SIZE                32
44 #define MAX_HASH_MEASURE_REQ_TAB_SIZE   MAX_MEASURE_REQ_TAB_SIZE
45
46 #define MAX_TPC_REQ_TAB_SIZE                    32
47 #define MAX_HASH_TPC_REQ_TAB_SIZE               MAX_TPC_REQ_TAB_SIZE
48
49 #define MIN_RCV_PWR                             100             /* Negative value ((dBm) */
50
51 #define TPC_REQ_AGE_OUT                 500             /* ms */
52 #define MQ_REQ_AGE_OUT                  500             /* ms */
53
54 #define TPC_DIALOGTOKEN_HASH_INDEX(_DialogToken)        ((_DialogToken) % MAX_HASH_TPC_REQ_TAB_SIZE)
55 #define MQ_DIALOGTOKEN_HASH_INDEX(_DialogToken)         ((_DialogToken) % MAX_MEASURE_REQ_TAB_SIZE)
56
57 typedef struct _MEASURE_REQ_ENTRY
58 {
59         struct _MEASURE_REQ_ENTRY *pNext;
60         ULONG lastTime;
61         BOOLEAN Valid;
62         UINT8 DialogToken;
63         UINT8 MeasureDialogToken[3];    // 0:basic measure, 1: CCA measure, 2: RPI_Histogram measure.
64 } MEASURE_REQ_ENTRY, *PMEASURE_REQ_ENTRY;
65
66 typedef struct _MEASURE_REQ_TAB
67 {
68         UCHAR Size;
69         PMEASURE_REQ_ENTRY Hash[MAX_HASH_MEASURE_REQ_TAB_SIZE];
70         MEASURE_REQ_ENTRY Content[MAX_MEASURE_REQ_TAB_SIZE];
71 } MEASURE_REQ_TAB, *PMEASURE_REQ_TAB;
72
73 typedef struct _TPC_REQ_ENTRY
74 {
75         struct _TPC_REQ_ENTRY *pNext;
76         ULONG lastTime;
77         BOOLEAN Valid;
78         UINT8 DialogToken;
79 } TPC_REQ_ENTRY, *PTPC_REQ_ENTRY;
80
81 typedef struct _TPC_REQ_TAB
82 {
83         UCHAR Size;
84         PTPC_REQ_ENTRY Hash[MAX_HASH_TPC_REQ_TAB_SIZE];
85         TPC_REQ_ENTRY Content[MAX_TPC_REQ_TAB_SIZE];
86 } TPC_REQ_TAB, *PTPC_REQ_TAB;
87
88
89 /* The regulatory information */
90 typedef struct _DOT11_CHANNEL_SET
91 {
92         UCHAR NumberOfChannels;
93         UINT8 MaxTxPwr;
94         UCHAR ChannelList[16];
95 } DOT11_CHANNEL_SET, *PDOT11_CHANNEL_SET;
96
97 typedef struct _DOT11_REGULATORY_INFORMATION
98 {
99         UCHAR RegulatoryClass;
100         DOT11_CHANNEL_SET ChannelSet;
101 } DOT11_REGULATORY_INFORMATION, *PDOT11_REGULATORY_INFORMATION;
102
103
104
105 #define RM_TPC_REQ                              0
106 #define RM_MEASURE_REQ                  1
107
108 #define RM_BASIC                                0
109 #define RM_CCA                                  1
110 #define RM_RPI_HISTOGRAM                2
111 #define RM_CH_LOAD                              3
112 #define RM_NOISE_HISTOGRAM              4
113
114
115 typedef struct PACKED _TPC_REPORT_INFO
116 {
117         UINT8 TxPwr;
118         UINT8 LinkMargin;
119 } TPC_REPORT_INFO, *PTPC_REPORT_INFO;
120
121 typedef struct PACKED _CH_SW_ANN_INFO
122 {
123         UINT8 ChSwMode;
124         UINT8 Channel;
125         UINT8 ChSwCnt;
126 } CH_SW_ANN_INFO, *PCH_SW_ANN_INFO;
127
128 typedef union PACKED _MEASURE_REQ_MODE
129 {
130 #ifdef RT_BIG_ENDIAN
131         struct PACKED
132         {
133
134                 UINT8 :3;
135                 UINT8 DurationMandatory:1;
136                 UINT8 Report:1;
137                 UINT8 Request:1;
138                 UINT8 Enable:1;
139                 UINT8 Parallel:1;
140         } field;
141 #else
142         struct PACKED
143         {
144                 UINT8 Parallel:1;
145                 UINT8 Enable:1;
146                 UINT8 Request:1;
147                 UINT8 Report:1;
148                 UINT8 DurationMandatory:1;
149                 UINT8 :3;
150         } field;
151 #endif // RT_BIG_ENDIAN //
152         UINT8 word;
153 } MEASURE_REQ_MODE, *PMEASURE_REQ_MODE;
154
155 typedef struct PACKED _MEASURE_REQ
156 {
157         UINT8 ChNum;
158         UINT64 MeasureStartTime;
159         UINT16 MeasureDuration;
160 } MEASURE_REQ, *PMEASURE_REQ;
161
162 typedef struct PACKED _MEASURE_REQ_INFO
163 {
164         UINT8 Token;
165         MEASURE_REQ_MODE ReqMode;
166         UINT8 ReqType;
167         UINT8 Oct[0];
168 } MEASURE_REQ_INFO, *PMEASURE_REQ_INFO;
169
170 typedef union PACKED _MEASURE_BASIC_REPORT_MAP
171 {
172 #ifdef RT_BIG_ENDIAN
173         struct PACKED
174         {
175                 UINT8 Rev:3;
176
177                 UINT8 Unmeasure:1;
178                 UINT8 Radar:1;
179                 UINT8 UnidentifiedSignal:1;
180                 UINT8 OfdmPreamble:1;
181                 UINT8 BSS:1;
182         } field;
183 #else
184         struct PACKED
185         {
186                 UINT8 BSS:1;
187
188                 UINT8 OfdmPreamble:1;
189                 UINT8 UnidentifiedSignal:1;
190                 UINT8 Radar:1;
191                 UINT8 Unmeasure:1;
192                 UINT8 Rev:3;
193         } field;
194 #endif // RT_BIG_ENDIAN //
195         UINT8 word;
196 } MEASURE_BASIC_REPORT_MAP, *PMEASURE_BASIC_REPORT_MAP;
197
198 typedef struct PACKED _MEASURE_BASIC_REPORT
199 {
200         UINT8 ChNum;
201         UINT64 MeasureStartTime;
202         UINT16 MeasureDuration;
203         MEASURE_BASIC_REPORT_MAP Map;
204 } MEASURE_BASIC_REPORT, *PMEASURE_BASIC_REPORT;
205
206 typedef struct PACKED _MEASURE_CCA_REPORT
207 {
208         UINT8 ChNum;
209         UINT64 MeasureStartTime;
210         UINT16 MeasureDuration;
211         UINT8 CCA_Busy_Fraction;
212 } MEASURE_CCA_REPORT, *PMEASURE_CCA_REPORT;
213
214 typedef struct PACKED _MEASURE_RPI_REPORT
215 {
216         UINT8 ChNum;
217         UINT64 MeasureStartTime;
218         UINT16 MeasureDuration;
219         UINT8 RPI_Density[8];
220 } MEASURE_RPI_REPORT, *PMEASURE_RPI_REPORT;
221
222 typedef union PACKED _MEASURE_REPORT_MODE
223 {
224         struct PACKED
225         {
226 #ifdef RT_BIG_ENDIAN
227                 UINT8 Rev:5;
228                 UINT8 Refused:1;
229                 UINT8 Incapable:1;
230                 UINT8 Late:1;
231 #else
232                 UINT8 Late:1;
233                 UINT8 Incapable:1;
234                 UINT8 Refused:1;
235                 UINT8 Rev:5;
236 #endif // RT_BIG_ENDIAN //
237         } field;
238         UINT8 word;
239 } MEASURE_REPORT_MODE, *PMEASURE_REPORT_MODE;
240
241 typedef struct PACKED _MEASURE_REPORT_INFO
242 {
243         UINT8 Token;
244         UINT8 ReportMode;
245         UINT8 ReportType;
246         UINT8 Octect[0];
247 } MEASURE_REPORT_INFO, *PMEASURE_REPORT_INFO;
248
249 typedef struct PACKED _QUIET_INFO
250 {
251         UINT8 QuietCnt;
252         UINT8 QuietPeriod;
253         UINT16 QuietDuration;
254         UINT16 QuietOffset;
255 } QUIET_INFO, *PQUIET_INFO;
256
257 #endif // __SPECTRUM_DEF_H__ //