OLD | NEW |
(Empty) | |
| 1 //------------------------------------------------------------------------------ |
| 2 // <copyright file="wlan_utils.c" company="Atheros"> |
| 3 // Copyright (c) 2004-2008 Atheros Corporation. All rights reserved. |
| 4 // |
| 5 // This program is free software; you can redistribute it and/or modify |
| 6 // it under the terms of the GNU General Public License version 2 as |
| 7 // published by the Free Software Foundation; |
| 8 // |
| 9 // Software distributed under the License is distributed on an "AS |
| 10 // IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or |
| 11 // implied. See the License for the specific language governing |
| 12 // rights and limitations under the License. |
| 13 // |
| 14 // |
| 15 //------------------------------------------------------------------------------ |
| 16 //============================================================================== |
| 17 // This module implements frequently used wlan utilies |
| 18 // |
| 19 // Author(s): ="Atheros" |
| 20 //============================================================================== |
| 21 #include <a_config.h> |
| 22 #include <athdefs.h> |
| 23 #include <a_types.h> |
| 24 #include <a_osapi.h> |
| 25 |
| 26 /* |
| 27 * converts ieee channel number to frequency |
| 28 */ |
| 29 A_UINT16 |
| 30 wlan_ieee2freq(int chan) |
| 31 { |
| 32 if (chan == 14) { |
| 33 return 2484; |
| 34 } |
| 35 if (chan < 14) { /* 0-13 */ |
| 36 return (2407 + (chan*5)); |
| 37 } |
| 38 if (chan < 27) { /* 15-26 */ |
| 39 return (2512 + ((chan-15)*20)); |
| 40 } |
| 41 return (5000 + (chan*5)); |
| 42 } |
| 43 |
| 44 /* |
| 45 * Converts MHz frequency to IEEE channel number. |
| 46 */ |
| 47 A_UINT32 |
| 48 wlan_freq2ieee(A_UINT16 freq) |
| 49 { |
| 50 if (freq == 2484) |
| 51 return 14; |
| 52 if (freq < 2484) |
| 53 return (freq - 2407) / 5; |
| 54 if (freq < 5000) |
| 55 return 15 + ((freq - 2512) / 20); |
| 56 return (freq - 5000) / 5; |
| 57 } |
OLD | NEW |