Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / devs / networks / atheros5000 / hal / ar5211 / ar5211_phy.c
blob4222d50d779a87c1337334d086883f86e11ed30e
1 /*
2 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3 * Copyright (c) 2002-2006 Atheros Communications, Inc.
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 * $Id$
19 #include "opt_ah.h"
21 #ifdef AH_SUPPORT_AR5211
23 #include "ah.h"
24 #include "ah_internal.h"
26 #include "ar5211/ar5211.h"
28 /* shorthands to compact tables for readability */
29 #define OFDM IEEE80211_T_OFDM
30 #define CCK IEEE80211_T_CCK
31 #define TURBO IEEE80211_T_TURBO
33 HAL_RATE_TABLE ar5211_11a_table = {
34 8, /* number of rates */
35 { 0 },
37 /* short ctrl */
38 /* valid rateCode Preamble dot11Rate Rate */
39 /* 6 Mb */ { AH_TRUE, OFDM, 6000, 0x0b, 0x00, (0x80|12), 0 },
40 /* 9 Mb */ { AH_TRUE, OFDM, 9000, 0x0f, 0x00, 18, 0 },
41 /* 12 Mb */ { AH_TRUE, OFDM, 12000, 0x0a, 0x00, (0x80|24), 2 },
42 /* 18 Mb */ { AH_TRUE, OFDM, 18000, 0x0e, 0x00, 36, 2 },
43 /* 24 Mb */ { AH_TRUE, OFDM, 24000, 0x09, 0x00, (0x80|48), 4 },
44 /* 36 Mb */ { AH_TRUE, OFDM, 36000, 0x0d, 0x00, 72, 4 },
45 /* 48 Mb */ { AH_TRUE, OFDM, 48000, 0x08, 0x00, 96, 4 },
46 /* 54 Mb */ { AH_TRUE, OFDM, 54000, 0x0c, 0x00, 108, 4 }
50 HAL_RATE_TABLE ar5211_turbo_table = {
51 8, /* number of rates */
52 { 0 },
54 /* short ctrl */
55 /* valid rateCode Preamble dot11Rate Rate */
56 /* 6 Mb */ { AH_TRUE, TURBO, 6000, 0x0b, 0x00, (0x80|12), 0 },
57 /* 9 Mb */ { AH_TRUE, TURBO, 9000, 0x0f, 0x00, 18, 0 },
58 /* 12 Mb */ { AH_TRUE, TURBO, 12000, 0x0a, 0x00, (0x80|24), 2 },
59 /* 18 Mb */ { AH_TRUE, TURBO, 18000, 0x0e, 0x00, 36, 2 },
60 /* 24 Mb */ { AH_TRUE, TURBO, 24000, 0x09, 0x00, (0x80|48), 4 },
61 /* 36 Mb */ { AH_TRUE, TURBO, 36000, 0x0d, 0x00, 72, 4 },
62 /* 48 Mb */ { AH_TRUE, TURBO, 48000, 0x08, 0x00, 96, 4 },
63 /* 54 Mb */ { AH_TRUE, TURBO, 54000, 0x0c, 0x00, 108, 4 }
67 HAL_RATE_TABLE ar5211_11b_table = {
68 4, /* number of rates */
69 { 0 },
71 /* short ctrl */
72 /* valid rateCode Preamble dot11Rate Rate */
73 /* 1 Mb */ { AH_TRUE, CCK, 1000, 0x0b, 0x00, (0x80| 2), 0 },
74 /* 2 Mb */ { AH_TRUE, CCK, 2000, 0x0a, 0x04, (0x80| 4), 1 },
75 /* 5.5 Mb */ { AH_TRUE, CCK, 5500, 0x09, 0x04, (0x80|11), 1 },
76 /* 11 Mb */ { AH_TRUE, CCK, 11000, 0x08, 0x04, (0x80|22), 1 }
80 #undef OFDM
81 #undef CCK
82 #undef TURBO
85 const HAL_RATE_TABLE *
86 ar5211GetRateTable(struct ath_hal *ah, u_int mode)
88 HAL_RATE_TABLE *rt;
89 switch (mode) {
90 case HAL_MODE_11A:
91 rt = &ar5211_11a_table;
92 break;
93 case HAL_MODE_11B:
94 rt = &ar5211_11b_table;
95 break;
96 case HAL_MODE_TURBO:
97 rt = &ar5211_turbo_table;
98 break;
99 default:
100 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: invalid mode 0x%x\n",
101 __func__, mode);
102 return AH_NULL;
104 ath_hal_setupratetable(ah, rt);
105 return rt;
107 #endif /* AH_SUPPORT_AR5211 */