- supported.conf: Added sparse_keymap (eeepc_laptop depends on it)
[linux-flexiantxendom0-3.2.10.git] / drivers / staging / rt3090 / chlist.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     chlist.h
29
30     Abstract:
31     Miniport generic portion header file
32
33     Revision History:
34     Who         When          What
35     --------    ----------    ----------------------------------------------
36         Fonchi Wu   2007-12-19    created
37 */
38
39 #ifndef __CHLIST_H__
40 #define __CHLIST_H__
41
42 #include "rtmp_type.h"
43 #include "rtmp_def.h"
44
45
46 #define ODOR                    0
47 #define IDOR                    1
48 #define BOTH                    2
49
50 #define BAND_5G         0
51 #define BAND_24G        1
52 #define BAND_BOTH       2
53
54 typedef struct _CH_DESP {
55         UCHAR FirstChannel;
56         UCHAR NumOfCh;
57         CHAR MaxTxPwr;                  // dBm
58         UCHAR Geography;                        // 0:out door, 1:in door, 2:both
59         BOOLEAN DfsReq;                 // Dfs require, 0: No, 1: yes.
60 } CH_DESP, *PCH_DESP;
61
62 typedef struct _CH_REGION {
63         UCHAR CountReg[3];
64         UCHAR DfsType;                  // 0: CE, 1: FCC, 2: JAP, 3:JAP_W53, JAP_W56
65         CH_DESP ChDesp[10];
66 } CH_REGION, *PCH_REGION;
67
68 extern CH_REGION ChRegion[];
69
70 typedef struct _CH_FREQ_MAP_{
71         UINT16          channel;
72         UINT16          freqKHz;
73 }CH_FREQ_MAP;
74
75 extern CH_FREQ_MAP CH_HZ_ID_MAP[];
76 extern int CH_HZ_ID_MAP_NUM;
77
78
79 #define     MAP_CHANNEL_ID_TO_KHZ(_ch, _khz)                                    \
80                 do{                                                                                                     \
81                         int _chIdx;                                                                                     \
82                         for (_chIdx = 0; _chIdx < CH_HZ_ID_MAP_NUM; _chIdx++)\
83                         {                                                                                                       \
84                                 if ((_ch) == CH_HZ_ID_MAP[_chIdx].channel)                      \
85                                 {                                                                                               \
86                                         (_khz) = CH_HZ_ID_MAP[_chIdx].freqKHz * 1000;   \
87                                         break;                                                                          \
88                                 }                                                                                               \
89                         }                                                                                                       \
90                         if (_chIdx == CH_HZ_ID_MAP_NUM)                                 \
91                                 (_khz) = 2412000;                                                                       \
92             }while(0)
93
94 #define     MAP_KHZ_TO_CHANNEL_ID(_khz, _ch)                 \
95                 do{                                                                                                     \
96                         int _chIdx;                                                                                     \
97                         for (_chIdx = 0; _chIdx < CH_HZ_ID_MAP_NUM; _chIdx++)\
98                         {                                                                                                       \
99                                 if ((_khz) == CH_HZ_ID_MAP[_chIdx].freqKHz)                     \
100                                 {                                                                                               \
101                                         (_ch) = CH_HZ_ID_MAP[_chIdx].channel;                   \
102                                         break;                                                                          \
103                                 }                                                                                               \
104                         }                                                                                                       \
105                         if (_chIdx == CH_HZ_ID_MAP_NUM)                                 \
106                                 (_ch) = 1;                                                                                      \
107                 }while(0)
108
109
110 VOID BuildChannelListEx(
111         IN PRTMP_ADAPTER pAd);
112
113 VOID BuildBeaconChList(
114         IN PRTMP_ADAPTER pAd,
115         OUT PUCHAR pBuf,
116         OUT     PULONG pBufLen);
117
118 #ifdef DOT11_N_SUPPORT
119 VOID N_ChannelCheck(
120         IN PRTMP_ADAPTER pAd);
121
122 VOID N_SetCenCh(
123         IN PRTMP_ADAPTER pAd);
124 #endif // DOT11_N_SUPPORT //
125
126 UINT8 GetCuntryMaxTxPwr(
127         IN PRTMP_ADAPTER pAd,
128         IN UINT8 channel);
129
130 #endif // __CHLIST_H__