Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 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.c |
| 29 | |
| 30 | Abstract: |
| 31 | |
| 32 | Revision History: |
| 33 | Who When What |
| 34 | -------- ---------- ---------------------------------------------- |
| 35 | Fonchi Wu 2007-12-19 created |
| 36 | */ |
| 37 | |
| 38 | #ifndef __CHLIST_H__ |
| 39 | #define __CHLIST_H__ |
| 40 | |
| 41 | #include "rtmp_type.h" |
| 42 | #include "rtmp_def.h" |
| 43 | |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 44 | #define ODOR 0 |
| 45 | #define IDOR 1 |
| 46 | #define BOTH 2 |
| 47 | |
| 48 | #define BAND_5G 0 |
| 49 | #define BAND_24G 1 |
| 50 | #define BAND_BOTH 2 |
| 51 | |
Bartlomiej Zolnierkiewicz | 62eb734 | 2009-12-11 12:23:16 -0800 | [diff] [blame] | 52 | struct rt_ch_desp { |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 53 | u8 FirstChannel; |
| 54 | u8 NumOfCh; |
| 55 | char MaxTxPwr; /* dBm */ |
| 56 | u8 Geography; /* 0:out door, 1:in door, 2:both */ |
Bartlomiej Zolnierkiewicz | cc27706 | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 57 | BOOLEAN DfsReq; /* Dfs require, 0: No, 1: yes. */ |
Bartlomiej Zolnierkiewicz | 62eb734 | 2009-12-11 12:23:16 -0800 | [diff] [blame] | 58 | }; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 59 | |
Bartlomiej Zolnierkiewicz | 62eb734 | 2009-12-11 12:23:16 -0800 | [diff] [blame] | 60 | struct rt_ch_region { |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 61 | u8 CountReg[3]; |
| 62 | u8 DfsType; /* 0: CE, 1: FCC, 2: JAP, 3:JAP_W53, JAP_W56 */ |
Bartlomiej Zolnierkiewicz | 62eb734 | 2009-12-11 12:23:16 -0800 | [diff] [blame] | 63 | struct rt_ch_desp ChDesp[10]; |
| 64 | }; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 65 | |
Bartlomiej Zolnierkiewicz | 62eb734 | 2009-12-11 12:23:16 -0800 | [diff] [blame] | 66 | extern struct rt_ch_region ChRegion[]; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 67 | |
Bartlomiej Zolnierkiewicz | 62eb734 | 2009-12-11 12:23:16 -0800 | [diff] [blame] | 68 | struct rt_ch_freq_map { |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 69 | u16 channel; |
| 70 | u16 freqKHz; |
Bartlomiej Zolnierkiewicz | 62eb734 | 2009-12-11 12:23:16 -0800 | [diff] [blame] | 71 | }; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 72 | |
Bartlomiej Zolnierkiewicz | 62eb734 | 2009-12-11 12:23:16 -0800 | [diff] [blame] | 73 | extern struct rt_ch_freq_map CH_HZ_ID_MAP[]; |
Bartlomiej Zolnierkiewicz | ca97b83 | 2009-09-22 20:44:07 +0200 | [diff] [blame] | 74 | extern int CH_HZ_ID_MAP_NUM; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 75 | |
Bartlomiej Zolnierkiewicz | ca97b83 | 2009-09-22 20:44:07 +0200 | [diff] [blame] | 76 | #define MAP_CHANNEL_ID_TO_KHZ(_ch, _khz) \ |
| 77 | do{ \ |
| 78 | int _chIdx; \ |
| 79 | for (_chIdx = 0; _chIdx < CH_HZ_ID_MAP_NUM; _chIdx++)\ |
| 80 | { \ |
| 81 | if ((_ch) == CH_HZ_ID_MAP[_chIdx].channel) \ |
| 82 | { \ |
| 83 | (_khz) = CH_HZ_ID_MAP[_chIdx].freqKHz * 1000; \ |
| 84 | break; \ |
| 85 | } \ |
| 86 | } \ |
| 87 | if (_chIdx == CH_HZ_ID_MAP_NUM) \ |
| 88 | (_khz) = 2412000; \ |
| 89 | }while(0) |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 90 | |
Bartlomiej Zolnierkiewicz | ca97b83 | 2009-09-22 20:44:07 +0200 | [diff] [blame] | 91 | #define MAP_KHZ_TO_CHANNEL_ID(_khz, _ch) \ |
| 92 | do{ \ |
| 93 | int _chIdx; \ |
| 94 | for (_chIdx = 0; _chIdx < CH_HZ_ID_MAP_NUM; _chIdx++)\ |
| 95 | { \ |
| 96 | if ((_khz) == CH_HZ_ID_MAP[_chIdx].freqKHz) \ |
| 97 | { \ |
| 98 | (_ch) = CH_HZ_ID_MAP[_chIdx].channel; \ |
| 99 | break; \ |
| 100 | } \ |
| 101 | } \ |
| 102 | if (_chIdx == CH_HZ_ID_MAP_NUM) \ |
| 103 | (_ch) = 1; \ |
| 104 | }while(0) |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 105 | |
Bartlomiej Zolnierkiewicz | 62eb734 | 2009-12-11 12:23:16 -0800 | [diff] [blame] | 106 | void BuildChannelListEx(struct rt_rtmp_adapter *pAd); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 107 | |
Bartlomiej Zolnierkiewicz | 62eb734 | 2009-12-11 12:23:16 -0800 | [diff] [blame] | 108 | void BuildBeaconChList(struct rt_rtmp_adapter *pAd, |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 109 | u8 *pBuf, unsigned long *pBufLen); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 110 | |
Bartlomiej Zolnierkiewicz | 62eb734 | 2009-12-11 12:23:16 -0800 | [diff] [blame] | 111 | void N_ChannelCheck(struct rt_rtmp_adapter *pAd); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 112 | |
Bartlomiej Zolnierkiewicz | 62eb734 | 2009-12-11 12:23:16 -0800 | [diff] [blame] | 113 | void N_SetCenCh(struct rt_rtmp_adapter *pAd); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 114 | |
Bartlomiej Zolnierkiewicz | 62eb734 | 2009-12-11 12:23:16 -0800 | [diff] [blame] | 115 | u8 GetCuntryMaxTxPwr(struct rt_rtmp_adapter *pAd, u8 channel); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 116 | |
Bartlomiej Zolnierkiewicz | cc27706 | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 117 | #endif /* __CHLIST_H__ */ |