1*572ff6f6SMatthew Dillon /*
2*572ff6f6SMatthew Dillon * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3*572ff6f6SMatthew Dillon * Copyright (c) 2002-2004 Atheros Communications, Inc.
4*572ff6f6SMatthew Dillon *
5*572ff6f6SMatthew Dillon * Permission to use, copy, modify, and/or distribute this software for any
6*572ff6f6SMatthew Dillon * purpose with or without fee is hereby granted, provided that the above
7*572ff6f6SMatthew Dillon * copyright notice and this permission notice appear in all copies.
8*572ff6f6SMatthew Dillon *
9*572ff6f6SMatthew Dillon * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10*572ff6f6SMatthew Dillon * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11*572ff6f6SMatthew Dillon * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12*572ff6f6SMatthew Dillon * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13*572ff6f6SMatthew Dillon * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14*572ff6f6SMatthew Dillon * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15*572ff6f6SMatthew Dillon * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16*572ff6f6SMatthew Dillon *
17*572ff6f6SMatthew Dillon * $FreeBSD$
18*572ff6f6SMatthew Dillon */
19*572ff6f6SMatthew Dillon #include "opt_ah.h"
20*572ff6f6SMatthew Dillon
21*572ff6f6SMatthew Dillon #include "ah.h"
22*572ff6f6SMatthew Dillon #include "ah_internal.h"
23*572ff6f6SMatthew Dillon
24*572ff6f6SMatthew Dillon #include "ar5210/ar5210.h"
25*572ff6f6SMatthew Dillon
26*572ff6f6SMatthew Dillon /* shorthands to compact tables for readability */
27*572ff6f6SMatthew Dillon #define OFDM IEEE80211_T_OFDM
28*572ff6f6SMatthew Dillon #define TURBO IEEE80211_T_TURBO
29*572ff6f6SMatthew Dillon
30*572ff6f6SMatthew Dillon HAL_RATE_TABLE ar5210_11a_table = {
31*572ff6f6SMatthew Dillon 8, /* number of rates */
32*572ff6f6SMatthew Dillon { 0 },
33*572ff6f6SMatthew Dillon {
34*572ff6f6SMatthew Dillon /* short ctrl */
35*572ff6f6SMatthew Dillon /* valid rateCode Preamble dot11Rate Rate */
36*572ff6f6SMatthew Dillon /* 6 Mb */ { AH_TRUE, OFDM, 6000, 0x0b, 0x00, (0x80|12), 0 },
37*572ff6f6SMatthew Dillon /* 9 Mb */ { AH_TRUE, OFDM, 9000, 0x0f, 0x00, 18, 0 },
38*572ff6f6SMatthew Dillon /* 12 Mb */ { AH_TRUE, OFDM, 12000, 0x0a, 0x00, (0x80|24), 2 },
39*572ff6f6SMatthew Dillon /* 18 Mb */ { AH_TRUE, OFDM, 18000, 0x0e, 0x00, 36, 2 },
40*572ff6f6SMatthew Dillon /* 24 Mb */ { AH_TRUE, OFDM, 24000, 0x09, 0x00, (0x80|48), 4 },
41*572ff6f6SMatthew Dillon /* 36 Mb */ { AH_TRUE, OFDM, 36000, 0x0d, 0x00, 72, 4 },
42*572ff6f6SMatthew Dillon /* 48 Mb */ { AH_TRUE, OFDM, 48000, 0x08, 0x00, 96, 4 },
43*572ff6f6SMatthew Dillon /* 54 Mb */ { AH_TRUE, OFDM, 54000, 0x0c, 0x00, 108, 4 }
44*572ff6f6SMatthew Dillon },
45*572ff6f6SMatthew Dillon };
46*572ff6f6SMatthew Dillon
47*572ff6f6SMatthew Dillon HAL_RATE_TABLE ar5210_turbo_table = {
48*572ff6f6SMatthew Dillon 8, /* number of rates */
49*572ff6f6SMatthew Dillon { 0 },
50*572ff6f6SMatthew Dillon {
51*572ff6f6SMatthew Dillon /* short ctrl */
52*572ff6f6SMatthew Dillon /* valid rateCode Preamble dot11Rate Rate */
53*572ff6f6SMatthew Dillon /* 6 Mb */ { AH_TRUE, TURBO, 12000, 0x0b, 0x00, (0x80|12), 0 },
54*572ff6f6SMatthew Dillon /* 9 Mb */ { AH_TRUE, TURBO, 18000, 0x0f, 0x00, 18, 0 },
55*572ff6f6SMatthew Dillon /* 12 Mb */ { AH_TRUE, TURBO, 24000, 0x0a, 0x00, (0x80|24), 2 },
56*572ff6f6SMatthew Dillon /* 18 Mb */ { AH_TRUE, TURBO, 36000, 0x0e, 0x00, 36, 2 },
57*572ff6f6SMatthew Dillon /* 24 Mb */ { AH_TRUE, TURBO, 48000, 0x09, 0x00, (0x80|48), 4 },
58*572ff6f6SMatthew Dillon /* 36 Mb */ { AH_TRUE, TURBO, 72000, 0x0d, 0x00, 72, 4 },
59*572ff6f6SMatthew Dillon /* 48 Mb */ { AH_TRUE, TURBO, 96000, 0x08, 0x00, 96, 4 },
60*572ff6f6SMatthew Dillon /* 54 Mb */ { AH_TRUE, TURBO, 108000, 0x0c, 0x00, 108, 4 }
61*572ff6f6SMatthew Dillon },
62*572ff6f6SMatthew Dillon };
63*572ff6f6SMatthew Dillon
64*572ff6f6SMatthew Dillon #undef OFDM
65*572ff6f6SMatthew Dillon #undef TURBO
66*572ff6f6SMatthew Dillon
67*572ff6f6SMatthew Dillon const HAL_RATE_TABLE *
ar5210GetRateTable(struct ath_hal * ah,u_int mode)68*572ff6f6SMatthew Dillon ar5210GetRateTable(struct ath_hal *ah, u_int mode)
69*572ff6f6SMatthew Dillon {
70*572ff6f6SMatthew Dillon HAL_RATE_TABLE *rt;
71*572ff6f6SMatthew Dillon switch (mode) {
72*572ff6f6SMatthew Dillon case HAL_MODE_11A:
73*572ff6f6SMatthew Dillon rt = &ar5210_11a_table;
74*572ff6f6SMatthew Dillon break;
75*572ff6f6SMatthew Dillon case HAL_MODE_TURBO:
76*572ff6f6SMatthew Dillon rt = &ar5210_turbo_table;
77*572ff6f6SMatthew Dillon break;
78*572ff6f6SMatthew Dillon default:
79*572ff6f6SMatthew Dillon HALDEBUG(ah, HAL_DEBUG_ANY, "%s: invalid mode 0x%x\n",
80*572ff6f6SMatthew Dillon __func__, mode);
81*572ff6f6SMatthew Dillon return AH_NULL;
82*572ff6f6SMatthew Dillon }
83*572ff6f6SMatthew Dillon ath_hal_setupratetable(ah, rt);
84*572ff6f6SMatthew Dillon return rt;
85*572ff6f6SMatthew Dillon }
86