Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / devs / networks / atheros5000 / hal / ar5416 / ar5416_phy.c
blob02a96b096dd3548a55c34fc8a0e08ee6886baf2f
1 /*
2 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3 * Copyright (c) 2002-2008 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_AR5416
23 #include "ah.h"
24 #include "ah_internal.h"
26 #include "ar5416/ar5416.h"
28 /* shorthands to compact tables for readability */
29 #define OFDM IEEE80211_T_OFDM
30 #define CCK IEEE80211_T_CCK
31 #define HT IEEE80211_T_HT
33 HAL_RATE_TABLE ar5416_11ng_table = {
34 28, /* number of rates */
35 { 0 },
37 /* short ctrl */
38 /* valid rateCode Preamble dot11Rate Rate */
39 /* 1 Mb */ { AH_TRUE, CCK, 1000, 0x1b, 0x00, (0x80| 2), 0 },
40 /* 2 Mb */ { AH_TRUE, CCK, 2000, 0x1a, 0x04, (0x80| 4), 1 },
41 /* 5.5 Mb */ { AH_TRUE, CCK, 5500, 0x19, 0x04, (0x80|11), 2 },
42 /* 11 Mb */ { AH_TRUE, CCK, 11000, 0x18, 0x04, (0x80|22), 3 },
43 /* We remove rates 6, 9 from rate ctrl */
44 /* 6 Mb */ { AH_FALSE, OFDM, 6000, 0x0b, 0x00, 12, 4 },
45 /* 9 Mb */ { AH_FALSE, OFDM, 9000, 0x0f, 0x00, 18, 4 },
46 /* 12 Mb */ { AH_TRUE, OFDM, 12000, 0x0a, 0x00, 24, 6 },
47 /* 18 Mb */ { AH_TRUE, OFDM, 18000, 0x0e, 0x00, 36, 6 },
48 /* 24 Mb */ { AH_TRUE, OFDM, 24000, 0x09, 0x00, 48, 8 },
49 /* 36 Mb */ { AH_TRUE, OFDM, 36000, 0x0d, 0x00, 72, 8 },
50 /* 48 Mb */ { AH_TRUE, OFDM, 48000, 0x08, 0x00, 96, 8 },
51 /* 54 Mb */ { AH_TRUE, OFDM, 54000, 0x0c, 0x00, 108, 8 },
52 /* 6.5 Mb */ { AH_TRUE, HT, 6500, 0x80, 0x00, 0, 8 },
53 /* 13 Mb */ { AH_TRUE, HT, 13000, 0x81, 0x00, 1, 8 },
54 /*19.5 Mb */ { AH_TRUE, HT, 19500, 0x82, 0x00, 2, 8 },
55 /* 26 Mb */ { AH_TRUE, HT, 26000, 0x83, 0x00, 3, 8 },
56 /* 39 Mb */ { AH_TRUE, HT, 39000, 0x84, 0x00, 4, 8 },
57 /* 52 Mb */ { AH_TRUE, HT, 52000, 0x85, 0x00, 5, 8 },
58 /*58.5 Mb */ { AH_TRUE, HT, 58500, 0x86, 0x00, 6, 8 },
59 /* 65 Mb */ { AH_TRUE, HT, 65000, 0x87, 0x00, 7, 8 },
60 /* 13 Mb */ { AH_TRUE, HT, 13000, 0x88, 0x00, 8, 8 },
61 /* 26 Mb */ { AH_TRUE, HT, 26000, 0x89, 0x00, 9, 8 },
62 /* 39 Mb */ { AH_TRUE, HT, 39000, 0x8a, 0x00, 10, 8 },
63 /* 52 Mb */ { AH_TRUE, HT, 52000, 0x8b, 0x00, 11, 8 },
64 /* 78 Mb */ { AH_TRUE, HT, 78000, 0x8c, 0x00, 12, 8 },
65 /* 104 Mb */ { AH_TRUE, HT, 104000, 0x8d, 0x00, 13, 8 },
66 /* 117 Mb */ { AH_TRUE, HT, 117000, 0x8e, 0x00, 14, 8 },
67 /* 130 Mb */ { AH_TRUE, HT, 130000, 0x8f, 0x00, 15, 8 },
71 static HAL_RATE_TABLE ar5416_11na_table = {
72 24, /* number of rates */
73 { 0 },
75 /* short ctrl */
76 /* valid rateCode Preamble dot11Rate Rate */
77 /* 6 Mb */ { AH_TRUE, OFDM, 6000, 0x0b, 0x00, (0x80|12), 0 },
78 /* 9 Mb */ { AH_TRUE, OFDM, 9000, 0x0f, 0x00, 18, 0 },
79 /* 12 Mb */ { AH_TRUE, OFDM, 12000, 0x0a, 0x00, (0x80|24), 2 },
80 /* 18 Mb */ { AH_TRUE, OFDM, 18000, 0x0e, 0x00, 36, 2 },
81 /* 24 Mb */ { AH_TRUE, OFDM, 24000, 0x09, 0x00, (0x80|48), 4 },
82 /* 36 Mb */ { AH_TRUE, OFDM, 36000, 0x0d, 0x00, 72, 8 },
83 /* 48 Mb */ { AH_TRUE, OFDM, 48000, 0x08, 0x00, 96, 8 },
84 /* 54 Mb */ { AH_TRUE, OFDM, 54000, 0x0c, 0x00, 108, 8 },
85 /* 6.5 Mb */ { AH_TRUE, HT, 6500, 0x80, 0x00, 0, 8 },
86 /* 13 Mb */ { AH_TRUE, HT, 13000, 0x81, 0x00, 1, 8 },
87 /*19.5 Mb */ { AH_TRUE, HT, 19500, 0x82, 0x00, 2, 8 },
88 /* 26 Mb */ { AH_TRUE, HT, 26000, 0x83, 0x00, 3, 8 },
89 /* 39 Mb */ { AH_TRUE, HT, 39000, 0x84, 0x00, 4, 8 },
90 /* 52 Mb */ { AH_TRUE, HT, 52000, 0x85, 0x00, 5, 8 },
91 /*58.5 Mb */ { AH_TRUE, HT, 58500, 0x86, 0x00, 6, 8 },
92 /* 65 Mb */ { AH_TRUE, HT, 65000, 0x87, 0x00, 7, 8 },
93 /* 13 Mb */ { AH_TRUE, HT, 13000, 0x88, 0x00, 8, 8 },
94 /* 26 Mb */ { AH_TRUE, HT, 26000, 0x89, 0x00, 9, 8 },
95 /* 39 Mb */ { AH_TRUE, HT, 39000, 0x8a, 0x00, 10, 8 },
96 /* 52 Mb */ { AH_TRUE, HT, 52000, 0x8b, 0x00, 11, 8 },
97 /* 78 Mb */ { AH_TRUE, HT, 78000, 0x8c, 0x00, 12, 8 },
98 /* 104 Mb */ { AH_TRUE, HT, 104000, 0x8d, 0x00, 13, 8 },
99 /* 117 Mb */ { AH_TRUE, HT, 117000, 0x8e, 0x00, 14, 8 },
100 /* 130 Mb */ { AH_TRUE, HT, 130000, 0x8f, 0x00, 15, 8 },
104 #undef OFDM
105 #undef CCK
106 #undef HT
108 const HAL_RATE_TABLE *
109 ar5416GetRateTable(struct ath_hal *ah, u_int mode)
111 HAL_RATE_TABLE *rt;
112 switch (mode) {
113 case HAL_MODE_11NG_HT20:
114 case HAL_MODE_11NG_HT40PLUS:
115 case HAL_MODE_11NG_HT40MINUS:
116 rt = &ar5416_11ng_table;
117 break;
118 case HAL_MODE_11NA_HT20:
119 case HAL_MODE_11NA_HT40PLUS:
120 case HAL_MODE_11NA_HT40MINUS:
121 rt = &ar5416_11na_table;
122 break;
123 default:
124 return ar5212GetRateTable(ah, mode);
126 ath_hal_setupratetable(ah, rt);
127 return rt;
129 #endif /* AH_SUPPORT_AR5416 */