• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
28 #ifndef __SPECTRUM_H__
29 #define __SPECTRUM_H__
30 
31 #include "rtmp_type.h"
32 #include "spectrum_def.h"
33 
34 typedef struct PACKED _TPC_REPORT_INFO
35 {
36 	UINT8 TxPwr;
37 	UINT8 LinkMargin;
38 } TPC_REPORT_INFO, *PTPC_REPORT_INFO;
39 
40 typedef struct PACKED _CH_SW_ANN_INFO
41 {
42 	UINT8 ChSwMode;
43 	UINT8 Channel;
44 	UINT8 ChSwCnt;
45 } CH_SW_ANN_INFO, *PCH_SW_ANN_INFO;
46 
47 typedef union PACKED _MEASURE_REQ_MODE
48 {
49 #ifdef RT_BIG_ENDIAN
50 	struct PACKED
51 	{
52 		UINT8 Rev1:4;
53 		UINT8 Report:1;
54 		UINT8 Request:1;
55 		UINT8 Enable:1;
56 		UINT8 Rev0:1;
57 	} field;
58 #else
59 	struct PACKED
60 	{
61 		UINT8 Rev0:1;
62 		UINT8 Enable:1;
63 		UINT8 Request:1;
64 		UINT8 Report:1;
65 		UINT8 Rev1:4;
66 	} field;
67 #endif // RT_BIG_ENDIAN //
68 	UINT8 word;
69 } MEASURE_REQ_MODE, *PMEASURE_REQ_MODE;
70 
71 typedef struct PACKED _MEASURE_REQ
72 {
73 	UINT8 ChNum;
74 	UINT64 MeasureStartTime;
75 	UINT16 MeasureDuration;
76 } MEASURE_REQ, *PMEASURE_REQ;
77 
78 typedef struct PACKED _MEASURE_REQ_INFO
79 {
80 	UINT8 Token;
81 	MEASURE_REQ_MODE ReqMode;
82 	UINT8 ReqType;
83 	MEASURE_REQ MeasureReq;
84 } MEASURE_REQ_INFO, *PMEASURE_REQ_INFO;
85 
86 typedef union PACKED _MEASURE_BASIC_REPORT_MAP
87 {
88 #ifdef RT_BIG_ENDIAN
89 	struct PACKED
90 	{
91 		UINT8 Rev:3;
92 		UINT8 Unmeasure:1;
93 		UINT8 Radar:1;
94 		UINT8 UnidentifiedSignal:1;
95 		UINT8 OfdmPreamble:1;
96 		UINT8 BSS:1;
97 	} field;
98 #else
99 	struct PACKED
100 	{
101 		UINT8 BSS:1;
102 		UINT8 OfdmPreamble:1;
103 		UINT8 UnidentifiedSignal:1;
104 		UINT8 Radar:1;
105 		UINT8 Unmeasure:1;
106 		UINT8 Rev:3;
107 	} field;
108 #endif // RT_BIG_ENDIAN //
109 	UINT8 word;
110 } MEASURE_BASIC_REPORT_MAP, *PMEASURE_BASIC_REPORT_MAP;
111 
112 typedef struct PACKED _MEASURE_BASIC_REPORT
113 {
114 	UINT8 ChNum;
115 	UINT64 MeasureStartTime;
116 	UINT16 MeasureDuration;
117 	MEASURE_BASIC_REPORT_MAP Map;
118 } MEASURE_BASIC_REPORT, *PMEASURE_BASIC_REPORT;
119 
120 typedef struct PACKED _MEASURE_CCA_REPORT
121 {
122 	UINT8 ChNum;
123 	UINT64 MeasureStartTime;
124 	UINT16 MeasureDuration;
125 	UINT8 CCA_Busy_Fraction;
126 } MEASURE_CCA_REPORT, *PMEASURE_CCA_REPORT;
127 
128 typedef struct PACKED _MEASURE_RPI_REPORT
129 {
130 	UINT8 ChNum;
131 	UINT64 MeasureStartTime;
132 	UINT16 MeasureDuration;
133 	UINT8 RPI_Density[8];
134 } MEASURE_RPI_REPORT, *PMEASURE_RPI_REPORT;
135 
136 typedef union PACKED _MEASURE_REPORT_MODE
137 {
138 	struct PACKED
139 	{
140 #ifdef RT_BIG_ENDIAN
141 		UINT8 Rev:5;
142 		UINT8 Refused:1;
143 		UINT8 Incapable:1;
144 		UINT8 Late:1;
145 #else
146 		UINT8 Late:1;
147 		UINT8 Incapable:1;
148 		UINT8 Refused:1;
149 		UINT8 Rev:5;
150 #endif // RT_BIG_ENDIAN //
151 	} field;
152 	UINT8 word;
153 } MEASURE_REPORT_MODE, *PMEASURE_REPORT_MODE;
154 
155 typedef struct PACKED _MEASURE_REPORT_INFO
156 {
157 	UINT8 Token;
158 	MEASURE_REPORT_MODE ReportMode;
159 	UINT8 ReportType;
160 	UINT8 Octect[0];
161 } MEASURE_REPORT_INFO, *PMEASURE_REPORT_INFO;
162 
163 typedef struct PACKED _QUIET_INFO
164 {
165 	UINT8 QuietCnt;
166 	UINT8 QuietPeriod;
167 	UINT8 QuietDuration;
168 	UINT8 QuietOffset;
169 } QUIET_INFO, *PQUIET_INFO;
170 
171 /*
172 	==========================================================================
173 	Description:
174 		Prepare Measurement request action frame and enqueue it into
175 		management queue waiting for transmition.
176 
177 	Parametrs:
178 		1. the destination mac address of the frame.
179 
180 	Return	: None.
181 	==========================================================================
182  */
183 VOID EnqueueMeasurementReq(
184 	IN PRTMP_ADAPTER pAd,
185 	IN PUCHAR pDA,
186 	IN UINT8 MeasureToken,
187 	IN UINT8 MeasureReqMode,
188 	IN UINT8 MeasureReqType,
189 	IN UINT8 MeasureCh,
190 	IN UINT16 MeasureDuration);
191 
192 /*
193 	==========================================================================
194 	Description:
195 		Prepare Measurement report action frame and enqueue it into
196 		management queue waiting for transmition.
197 
198 	Parametrs:
199 		1. the destination mac address of the frame.
200 
201 	Return	: None.
202 	==========================================================================
203  */
204 VOID EnqueueMeasurementRep(
205 	IN PRTMP_ADAPTER pAd,
206 	IN PUCHAR pDA,
207 	IN UINT8 DialogToken,
208 	IN UINT8 MeasureToken,
209 	IN UINT8 MeasureReqMode,
210 	IN UINT8 MeasureReqType,
211 	IN UINT8 ReportInfoLen,
212 	IN PUINT8 pReportInfo);
213 
214 /*
215 	==========================================================================
216 	Description:
217 		Prepare TPC Request action frame and enqueue it into
218 		management queue waiting for transmition.
219 
220 	Parametrs:
221 		1. the destination mac address of the frame.
222 
223 	Return	: None.
224 	==========================================================================
225  */
226 VOID EnqueueTPCReq(
227 	IN PRTMP_ADAPTER pAd,
228 	IN PUCHAR pDA,
229 	IN UCHAR DialogToken);
230 
231 /*
232 	==========================================================================
233 	Description:
234 		Prepare TPC Report action frame and enqueue it into
235 		management queue waiting for transmition.
236 
237 	Parametrs:
238 		1. the destination mac address of the frame.
239 
240 	Return	: None.
241 	==========================================================================
242  */
243 VOID EnqueueTPCRep(
244 	IN PRTMP_ADAPTER pAd,
245 	IN PUCHAR pDA,
246 	IN UINT8 DialogToken,
247 	IN UINT8 TxPwr,
248 	IN UINT8 LinkMargin);
249 
250 /*
251 	==========================================================================
252 	Description:
253 		Prepare Channel Switch Announcement action frame and enqueue it into
254 		management queue waiting for transmition.
255 
256 	Parametrs:
257 		1. the destination mac address of the frame.
258 		2. Channel switch announcement mode.
259 		2. a New selected channel.
260 
261 	Return	: None.
262 	==========================================================================
263  */
264 VOID EnqueueChSwAnn(
265 	IN PRTMP_ADAPTER pAd,
266 	IN PUCHAR pDA,
267 	IN UINT8 ChSwMode,
268 	IN UINT8 NewCh);
269 
270 /*
271 	==========================================================================
272 	Description:
273 		Spectrun action frames Handler such as channel switch annoucement,
274 		measurement report, measurement request actions frames.
275 
276 	Parametrs:
277 		Elme - MLME message containing the received frame
278 
279 	Return	: None.
280 	==========================================================================
281  */
282 VOID PeerSpectrumAction(
283     IN PRTMP_ADAPTER pAd,
284     IN MLME_QUEUE_ELEM *Elem);
285 
286 /*
287 	==========================================================================
288 	Description:
289 
290 	Parametrs:
291 
292 	Return	: None.
293 	==========================================================================
294  */
295 INT Set_MeasureReq_Proc(
296 	IN	PRTMP_ADAPTER	pAd,
297 	IN	PUCHAR			arg);
298 
299 INT Set_TpcReq_Proc(
300 	IN	PRTMP_ADAPTER	pAd,
301 	IN	PUCHAR			arg);
302 
303 VOID MeasureReqTabInit(
304 	IN PRTMP_ADAPTER pAd);
305 
306 VOID MeasureReqTabExit(
307 	IN PRTMP_ADAPTER pAd);
308 
309 VOID TpcReqTabInit(
310 	IN PRTMP_ADAPTER pAd);
311 
312 VOID TpcReqTabExit(
313 	IN PRTMP_ADAPTER pAd);
314 
315 VOID NotifyChSwAnnToPeerAPs(
316 	IN PRTMP_ADAPTER pAd,
317 	IN PUCHAR pRA,
318 	IN PUCHAR pTA,
319 	IN UINT8 ChSwMode,
320 	IN UINT8 Channel);
321 #endif // __SPECTRUM_H__ //
322 
323