No empty .Rs/.Re
[netbsd-mini2440.git] / sys / external / isc / atheros_hal / dist / ar5416 / ar5416_phy.c
blobd3368ea0471a574875dbbd8c763857ef7111b749
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: ar5416_phy.c,v 1.2 2008/12/11 05:30:29 alc Exp $
19 #include "opt_ah.h"
21 #include "ah.h"
22 #include "ah_internal.h"
24 #include "ar5416/ar5416.h"
26 /* shorthands to compact tables for readability */
27 #define OFDM IEEE80211_T_OFDM
28 #define CCK IEEE80211_T_CCK
29 #define HT IEEE80211_T_HT
31 HAL_RATE_TABLE ar5416_11ng_table = {
32 28, /* number of rates */
33 { 0 },
35 /* short ctrl */
36 /* valid rateCode Preamble dot11Rate Rate */
37 /* 1 Mb */ { AH_TRUE, CCK, 1000, 0x1b, 0x00, (0x80| 2), 0, 0, 0 },
38 /* 2 Mb */ { AH_TRUE, CCK, 2000, 0x1a, 0x04, (0x80| 4), 1, 0, 0 },
39 /* 5.5 Mb */ { AH_TRUE, CCK, 5500, 0x19, 0x04, (0x80|11), 2, 0, 0 },
40 /* 11 Mb */ { AH_TRUE, CCK, 11000, 0x18, 0x04, (0x80|22), 3, 0, 0 },
41 /* Remove rates 6, 9 from rate ctrl */
42 /* 6 Mb */ { AH_FALSE, OFDM, 6000, 0x0b, 0x00, 12, 4, 0, 0 },
43 /* 9 Mb */ { AH_FALSE, OFDM, 9000, 0x0f, 0x00, 18, 4, 0, 0 },
44 /* 12 Mb */ { AH_TRUE, OFDM, 12000, 0x0a, 0x00, 24, 6, 0, 0 },
45 /* 18 Mb */ { AH_TRUE, OFDM, 18000, 0x0e, 0x00, 36, 6, 0, 0 },
46 /* 24 Mb */ { AH_TRUE, OFDM, 24000, 0x09, 0x00, 48, 8, 0, 0 },
47 /* 36 Mb */ { AH_TRUE, OFDM, 36000, 0x0d, 0x00, 72, 8, 0, 0 },
48 /* 48 Mb */ { AH_TRUE, OFDM, 48000, 0x08, 0x00, 96, 8, 0, 0 },
49 /* 54 Mb */ { AH_TRUE, OFDM, 54000, 0x0c, 0x00, 108, 8, 0, 0 },
50 /* 6.5 Mb */ { AH_TRUE, HT, 6500, 0x80, 0x00, 0, 8, 0, 0 },
51 /* 13 Mb */ { AH_TRUE, HT, 13000, 0x81, 0x00, 1, 8, 0, 0 },
52 /*19.5 Mb */ { AH_TRUE, HT, 19500, 0x82, 0x00, 2, 8, 0, 0 },
53 /* 26 Mb */ { AH_TRUE, HT, 26000, 0x83, 0x00, 3, 8, 0, 0 },
54 /* 39 Mb */ { AH_TRUE, HT, 39000, 0x84, 0x00, 4, 8, 0, 0 },
55 /* 52 Mb */ { AH_TRUE, HT, 52000, 0x85, 0x00, 5, 8, 0, 0 },
56 /*58.5 Mb */ { AH_TRUE, HT, 58500, 0x86, 0x00, 6, 8, 0, 0 },
57 /* 65 Mb */ { AH_TRUE, HT, 65000, 0x87, 0x00, 7, 8, 0, 0 },
58 /* 13 Mb */ { AH_TRUE, HT, 13000, 0x88, 0x00, 8, 8, 0, 0 },
59 /* 26 Mb */ { AH_TRUE, HT, 26000, 0x89, 0x00, 9, 8, 0, 0 },
60 /* 39 Mb */ { AH_TRUE, HT, 39000, 0x8a, 0x00, 10, 8, 0, 0 },
61 /* 52 Mb */ { AH_TRUE, HT, 52000, 0x8b, 0x00, 11, 8, 0, 0 },
62 /* 78 Mb */ { AH_TRUE, HT, 78000, 0x8c, 0x00, 12, 8, 0, 0 },
63 /* 104 Mb */ { AH_TRUE, HT, 104000, 0x8d, 0x00, 13, 8, 0, 0 },
64 /* 117 Mb */ { AH_TRUE, HT, 117000, 0x8e, 0x00, 14, 8, 0, 0 },
65 /* 130 Mb */ { AH_TRUE, HT, 130000, 0x8f, 0x00, 15, 8, 0, 0 },
69 static HAL_RATE_TABLE ar5416_11na_table = {
70 24, /* number of rates */
71 { 0 },
73 /* short ctrl */
74 /* valid rateCode Preamble dot11Rate Rate */
75 /* 6 Mb */ { AH_TRUE, OFDM, 6000, 0x0b, 0x00, (0x80|12), 0, 0, 0 },
76 /* 9 Mb */ { AH_TRUE, OFDM, 9000, 0x0f, 0x00, 18, 0, 0, 0 },
77 /* 12 Mb */ { AH_TRUE, OFDM, 12000, 0x0a, 0x00, (0x80|24), 2, 0, 0 },
78 /* 18 Mb */ { AH_TRUE, OFDM, 18000, 0x0e, 0x00, 36, 2, 0, 0 },
79 /* 24 Mb */ { AH_TRUE, OFDM, 24000, 0x09, 0x00, (0x80|48), 4, 0, 0 },
80 /* 36 Mb */ { AH_TRUE, OFDM, 36000, 0x0d, 0x00, 72, 8, 0, 0 },
81 /* 48 Mb */ { AH_TRUE, OFDM, 48000, 0x08, 0x00, 96, 8, 0, 0 },
82 /* 54 Mb */ { AH_TRUE, OFDM, 54000, 0x0c, 0x00, 108, 8, 0, 0 },
83 /* 6.5 Mb */ { AH_TRUE, HT, 6500, 0x80, 0x00, 0, 8, 0, 0 },
84 /* 13 Mb */ { AH_TRUE, HT, 13000, 0x81, 0x00, 1, 8, 0, 0 },
85 /*19.5 Mb */ { AH_TRUE, HT, 19500, 0x82, 0x00, 2, 8, 0, 0 },
86 /* 26 Mb */ { AH_TRUE, HT, 26000, 0x83, 0x00, 3, 8, 0, 0 },
87 /* 39 Mb */ { AH_TRUE, HT, 39000, 0x84, 0x00, 4, 8, 0, 0 },
88 /* 52 Mb */ { AH_TRUE, HT, 52000, 0x85, 0x00, 5, 8, 0, 0 },
89 /*58.5 Mb */ { AH_TRUE, HT, 58500, 0x86, 0x00, 6, 8, 0, 0 },
90 /* 65 Mb */ { AH_TRUE, HT, 65000, 0x87, 0x00, 7, 8, 0, 0 },
91 /* 13 Mb */ { AH_TRUE, HT, 13000, 0x88, 0x00, 8, 8, 0, 0 },
92 /* 26 Mb */ { AH_TRUE, HT, 26000, 0x89, 0x00, 9, 8, 0, 0 },
93 /* 39 Mb */ { AH_TRUE, HT, 39000, 0x8a, 0x00, 10, 8, 0, 0 },
94 /* 52 Mb */ { AH_TRUE, HT, 52000, 0x8b, 0x00, 11, 8, 0, 0 },
95 /* 78 Mb */ { AH_TRUE, HT, 78000, 0x8c, 0x00, 12, 8, 0, 0 },
96 /* 104 Mb */ { AH_TRUE, HT, 104000, 0x8d, 0x00, 13, 8, 0, 0 },
97 /* 117 Mb */ { AH_TRUE, HT, 117000, 0x8e, 0x00, 14, 8, 0, 0 },
98 /* 130 Mb */ { AH_TRUE, HT, 130000, 0x8f, 0x00, 15, 8, 0, 0 },
102 #undef OFDM
103 #undef CCK
104 #undef HT
106 const HAL_RATE_TABLE *
107 ar5416GetRateTable(struct ath_hal *ah, u_int mode)
109 HAL_RATE_TABLE *rt;
110 switch (mode) {
111 case HAL_MODE_11NG_HT20:
112 case HAL_MODE_11NG_HT40PLUS:
113 case HAL_MODE_11NG_HT40MINUS:
114 rt = &ar5416_11ng_table;
115 break;
116 case HAL_MODE_11NA_HT20:
117 case HAL_MODE_11NA_HT40PLUS:
118 case HAL_MODE_11NA_HT40MINUS:
119 rt = &ar5416_11na_table;
120 break;
121 default:
122 return ar5212GetRateTable(ah, mode);
124 ath_hal_setupratetable(ah, rt);
125 return rt;