fbdev: move FBIO_WAITFORVSYNC to linux/fb.h
[safe/jmp/linux-2.6] / drivers / staging / rt2860 / 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 #define MAX_MEASURE_REQ_TAB_SIZE                32
43 #define MAX_HASH_MEASURE_REQ_TAB_SIZE   MAX_MEASURE_REQ_TAB_SIZE
44
45 #define MAX_TPC_REQ_TAB_SIZE                    32
46 #define MAX_HASH_TPC_REQ_TAB_SIZE               MAX_TPC_REQ_TAB_SIZE
47
48 #define MIN_RCV_PWR                             100     /* Negative value ((dBm) */
49
50 #define TPC_REQ_AGE_OUT                 500     /* ms */
51 #define MQ_REQ_AGE_OUT                  500     /* ms */
52
53 #define TPC_DIALOGTOKEN_HASH_INDEX(_DialogToken)        ((_DialogToken) % MAX_HASH_TPC_REQ_TAB_SIZE)
54 #define MQ_DIALOGTOKEN_HASH_INDEX(_DialogToken)         ((_DialogToken) % MAX_MEASURE_REQ_TAB_SIZE)
55
56 struct rt_measure_req_entry;
57
58 struct rt_measure_req_entry {
59         struct rt_measure_req_entry *pNext;
60         unsigned long lastTime;
61         BOOLEAN Valid;
62         u8 DialogToken;
63         u8 MeasureDialogToken[3];       /* 0:basic measure, 1: CCA measure, 2: RPI_Histogram measure. */
64 };
65
66 struct rt_measure_req_tab {
67         u8 Size;
68         struct rt_measure_req_entry *Hash[MAX_HASH_MEASURE_REQ_TAB_SIZE];
69         struct rt_measure_req_entry Content[MAX_MEASURE_REQ_TAB_SIZE];
70 };
71
72 struct rt_tpc_req_entry;
73
74 struct rt_tpc_req_entry {
75         struct rt_tpc_req_entry *pNext;
76         unsigned long lastTime;
77         BOOLEAN Valid;
78         u8 DialogToken;
79 };
80
81 struct rt_tpc_req_tab {
82         u8 Size;
83         struct rt_tpc_req_entry *Hash[MAX_HASH_TPC_REQ_TAB_SIZE];
84         struct rt_tpc_req_entry Content[MAX_TPC_REQ_TAB_SIZE];
85 };
86
87 /* The regulatory information */
88 struct rt_dot11_channel_set {
89         u8 NumberOfChannels;
90         u8 MaxTxPwr;
91         u8 ChannelList[16];
92 };
93
94 struct rt_dot11_regulatory_information {
95         u8 RegulatoryClass;
96         struct rt_dot11_channel_set ChannelSet;
97 };
98
99 #define RM_TPC_REQ                              0
100 #define RM_MEASURE_REQ                  1
101
102 #define RM_BASIC                                0
103 #define RM_CCA                                  1
104 #define RM_RPI_HISTOGRAM                2
105 #define RM_CH_LOAD                              3
106 #define RM_NOISE_HISTOGRAM              4
107
108 struct PACKED rt_tpc_report_info {
109         u8 TxPwr;
110         u8 LinkMargin;
111 };
112
113 struct PACKED rt_ch_sw_ann_info {
114         u8 ChSwMode;
115         u8 Channel;
116         u8 ChSwCnt;
117 };
118
119 typedef union PACKED _MEASURE_REQ_MODE {
120         struct PACKED {
121                 u8 Parallel:1;
122                 u8 Enable:1;
123                 u8 Request:1;
124                 u8 Report:1;
125                 u8 DurationMandatory:1;
126                  u8:3;
127         } field;
128         u8 word;
129 } MEASURE_REQ_MODE, *PMEASURE_REQ_MODE;
130
131 struct PACKED rt_measure_req {
132         u8 ChNum;
133         u64 MeasureStartTime;
134         u16 MeasureDuration;
135 };
136
137 struct PACKED rt_measure_req_info {
138         u8 Token;
139         MEASURE_REQ_MODE ReqMode;
140         u8 ReqType;
141         u8 Oct[0];
142 };
143
144 typedef union PACKED _MEASURE_BASIC_REPORT_MAP {
145         struct PACKED {
146                 u8 BSS:1;
147
148                 u8 OfdmPreamble:1;
149                 u8 UnidentifiedSignal:1;
150                 u8 Radar:1;
151                 u8 Unmeasure:1;
152                 u8 Rev:3;
153         } field;
154         u8 word;
155 } MEASURE_BASIC_REPORT_MAP, *PMEASURE_BASIC_REPORT_MAP;
156
157 struct PACKED rt_measure_basic_report {
158         u8 ChNum;
159         u64 MeasureStartTime;
160         u16 MeasureDuration;
161         MEASURE_BASIC_REPORT_MAP Map;
162 };
163
164 struct PACKED rt_measure_cca_report {
165         u8 ChNum;
166         u64 MeasureStartTime;
167         u16 MeasureDuration;
168         u8 CCA_Busy_Fraction;
169 };
170
171 struct PACKED rt_measure_rpi_report {
172         u8 ChNum;
173         u64 MeasureStartTime;
174         u16 MeasureDuration;
175         u8 RPI_Density[8];
176 };
177
178 typedef union PACKED _MEASURE_REPORT_MODE {
179         struct PACKED {
180                 u8 Late:1;
181                 u8 Incapable:1;
182                 u8 Refused:1;
183                 u8 Rev:5;
184         } field;
185         u8 word;
186 } MEASURE_REPORT_MODE, *PMEASURE_REPORT_MODE;
187
188 struct PACKED rt_measure_report_info {
189         u8 Token;
190         u8 ReportMode;
191         u8 ReportType;
192         u8 Octect[0];
193 };
194
195 struct PACKED rt_quiet_info {
196         u8 QuietCnt;
197         u8 QuietPeriod;
198         u16 QuietDuration;
199         u16 QuietOffset;
200 };
201
202 #endif /* __SPECTRUM_DEF_H__ // */