ah_internal.h revision 1.1 1 1.1 alc /*
2 1.1 alc * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3 1.1 alc * Copyright (c) 2002-2008 Atheros Communications, Inc.
4 1.1 alc *
5 1.1 alc * Permission to use, copy, modify, and/or distribute this software for any
6 1.1 alc * purpose with or without fee is hereby granted, provided that the above
7 1.1 alc * copyright notice and this permission notice appear in all copies.
8 1.1 alc *
9 1.1 alc * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 1.1 alc * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 1.1 alc * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 1.1 alc * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 1.1 alc * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 1.1 alc * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 1.1 alc * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 1.1 alc *
17 1.1 alc * $Id: ah_internal.h,v 1.1 2008/12/11 04:46:25 alc Exp $
18 1.1 alc */
19 1.1 alc #ifndef _ATH_AH_INTERAL_H_
20 1.1 alc #define _ATH_AH_INTERAL_H_
21 1.1 alc /*
22 1.1 alc * Atheros Device Hardware Access Layer (HAL).
23 1.1 alc *
24 1.1 alc * Internal definitions.
25 1.1 alc */
26 1.1 alc #define AH_NULL 0
27 1.1 alc #define AH_MIN(a,b) ((a)<(b)?(a):(b))
28 1.1 alc #define AH_MAX(a,b) ((a)>(b)?(a):(b))
29 1.1 alc
30 1.1 alc #ifndef NBBY
31 1.1 alc #define NBBY 8 /* number of bits/byte */
32 1.1 alc #endif
33 1.1 alc
34 1.1 alc #ifndef roundup
35 1.1 alc #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */
36 1.1 alc #endif
37 1.1 alc #ifndef howmany
38 1.1 alc #define howmany(x, y) (((x)+((y)-1))/(y))
39 1.1 alc #endif
40 1.1 alc
41 1.1 alc #ifndef offsetof
42 1.1 alc #define offsetof(type, field) ((size_t)(&((type *)0)->field))
43 1.1 alc #endif
44 1.1 alc
45 1.1 alc /*
46 1.1 alc * Remove const in a way that keeps the compiler happy.
47 1.1 alc * This works for gcc but may require other magic for
48 1.1 alc * other compilers (not sure where this should reside).
49 1.1 alc * Note that uintptr_t is C99.
50 1.1 alc */
51 1.1 alc #ifndef __DECONST
52 1.1 alc #ifndef _UINTPTR_T
53 1.1 alc #if AH_WORDSIZE == 64
54 1.1 alc typedef unsigned long int uintptr_t;
55 1.1 alc #else
56 1.1 alc typedef unsigned int uintptr_t;
57 1.1 alc #endif
58 1.1 alc #endif
59 1.1 alc #define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
60 1.1 alc #endif
61 1.1 alc
62 1.1 alc typedef struct {
63 1.1 alc uint16_t start; /* first register */
64 1.1 alc uint16_t end; /* ending register or zero */
65 1.1 alc } HAL_REGRANGE;
66 1.1 alc
67 1.1 alc /*
68 1.1 alc * Transmit power scale factor.
69 1.1 alc *
70 1.1 alc * NB: This is not public because we want to discourage the use of
71 1.1 alc * scaling; folks should use the tx power limit interface.
72 1.1 alc */
73 1.1 alc typedef enum {
74 1.1 alc HAL_TP_SCALE_MAX = 0, /* no scaling (default) */
75 1.1 alc HAL_TP_SCALE_50 = 1, /* 50% of max (-3 dBm) */
76 1.1 alc HAL_TP_SCALE_25 = 2, /* 25% of max (-6 dBm) */
77 1.1 alc HAL_TP_SCALE_12 = 3, /* 12% of max (-9 dBm) */
78 1.1 alc HAL_TP_SCALE_MIN = 4, /* min, but still on */
79 1.1 alc } HAL_TP_SCALE;
80 1.1 alc
81 1.1 alc typedef enum {
82 1.1 alc HAL_CAP_RADAR = 0, /* Radar capability */
83 1.1 alc HAL_CAP_AR = 1, /* AR capability */
84 1.1 alc } HAL_PHYDIAG_CAPS;
85 1.1 alc
86 1.1 alc /*
87 1.1 alc * Each chip or class of chips registers to offer support.
88 1.1 alc */
89 1.1 alc struct ath_hal_chip {
90 1.1 alc const char *name;
91 1.1 alc const char *(*probe)(uint16_t vendorid, uint16_t devid);
92 1.1 alc struct ath_hal *(*attach)(uint16_t devid, HAL_SOFTC,
93 1.1 alc HAL_BUS_TAG, HAL_BUS_HANDLE, HAL_STATUS *error);
94 1.1 alc };
95 1.1 alc #ifndef AH_CHIP
96 1.1 alc #define AH_CHIP(_name, _probe, _attach) \
97 1.1 alc static struct ath_hal_chip name##_chip = { \
98 1.1 alc .name = #_name, \
99 1.1 alc .probe = _probe, \
100 1.1 alc .attach = _attach \
101 1.1 alc }; \
102 1.1 alc OS_DATA_SET(ah_chips, name##_chip)
103 1.1 alc #endif
104 1.1 alc
105 1.1 alc /*
106 1.1 alc * Each RF backend registers to offer support; this is mostly
107 1.1 alc * used by multi-chip 5212 solutions. Single-chip solutions
108 1.1 alc * have a fixed idea about which RF to use.
109 1.1 alc */
110 1.1 alc struct ath_hal_rf {
111 1.1 alc const char *name;
112 1.1 alc HAL_BOOL (*probe)(struct ath_hal *ah);
113 1.1 alc HAL_BOOL (*attach)(struct ath_hal *ah, HAL_STATUS *ecode);
114 1.1 alc };
115 1.1 alc #ifndef AH_RF
116 1.1 alc #define AH_RF(_name, _probe, _attach) \
117 1.1 alc static struct ath_hal_rf name##_rf = { \
118 1.1 alc .name = #_name, \
119 1.1 alc .probe = _probe, \
120 1.1 alc .attach = _attach \
121 1.1 alc }; \
122 1.1 alc OS_DATA_SET(ah_rfs, name##_rf)
123 1.1 alc #endif
124 1.1 alc
125 1.1 alc struct ath_hal_rf *ath_hal_rfprobe(struct ath_hal *ah, HAL_STATUS *ecode);
126 1.1 alc
127 1.1 alc /*
128 1.1 alc * Internal form of a HAL_CHANNEL. Note that the structure
129 1.1 alc * must be defined such that you can cast references to a
130 1.1 alc * HAL_CHANNEL so don't shuffle the first two members.
131 1.1 alc */
132 1.1 alc typedef struct {
133 1.1 alc uint32_t channelFlags;
134 1.1 alc uint16_t channel; /* NB: must be first for casting */
135 1.1 alc uint8_t privFlags;
136 1.1 alc int8_t maxRegTxPower;
137 1.1 alc int8_t maxTxPower;
138 1.1 alc int8_t minTxPower; /* as above... */
139 1.1 alc
140 1.1 alc HAL_BOOL bssSendHere;
141 1.1 alc uint8_t gainI;
142 1.1 alc HAL_BOOL iqCalValid;
143 1.1 alc uint8_t calValid; /* bitmask of cal types */
144 1.1 alc int8_t iCoff;
145 1.1 alc int8_t qCoff;
146 1.1 alc int16_t rawNoiseFloor;
147 1.1 alc int16_t noiseFloorAdjust;
148 1.1 alc int8_t antennaMax;
149 1.1 alc uint32_t regDmnFlags; /* Flags for channel use in reg */
150 1.1 alc uint32_t conformanceTestLimit; /* conformance test limit from reg domain */
151 1.1 alc uint16_t mainSpur; /* cached spur value for this cahnnel */
152 1.1 alc } HAL_CHANNEL_INTERNAL;
153 1.1 alc
154 1.1 alc typedef struct {
155 1.1 alc uint32_t halChanSpreadSupport : 1,
156 1.1 alc halSleepAfterBeaconBroken : 1,
157 1.1 alc halCompressSupport : 1,
158 1.1 alc halBurstSupport : 1,
159 1.1 alc halFastFramesSupport : 1,
160 1.1 alc halChapTuningSupport : 1,
161 1.1 alc halTurboGSupport : 1,
162 1.1 alc halTurboPrimeSupport : 1,
163 1.1 alc halMicAesCcmSupport : 1,
164 1.1 alc halMicCkipSupport : 1,
165 1.1 alc halMicTkipSupport : 1,
166 1.1 alc halTkipMicTxRxKeySupport : 1,
167 1.1 alc halCipherAesCcmSupport : 1,
168 1.1 alc halCipherCkipSupport : 1,
169 1.1 alc halCipherTkipSupport : 1,
170 1.1 alc halPSPollBroken : 1,
171 1.1 alc halVEOLSupport : 1,
172 1.1 alc halBssIdMaskSupport : 1,
173 1.1 alc halMcastKeySrchSupport : 1,
174 1.1 alc halTsfAddSupport : 1,
175 1.1 alc halChanHalfRate : 1,
176 1.1 alc halChanQuarterRate : 1,
177 1.1 alc halHTSupport : 1,
178 1.1 alc halRfSilentSupport : 1,
179 1.1 alc halHwPhyCounterSupport : 1,
180 1.1 alc halWowSupport : 1,
181 1.1 alc halWowMatchPatternExact : 1,
182 1.1 alc halAutoSleepSupport : 1,
183 1.1 alc halFastCCSupport : 1,
184 1.1 alc halBtCoexSupport : 1;
185 1.1 alc uint32_t halRxStbcSupport : 1,
186 1.1 alc halTxStbcSupport : 1,
187 1.1 alc halGTTSupport : 1,
188 1.1 alc halCSTSupport : 1,
189 1.1 alc halRifsRxSupport : 1,
190 1.1 alc halRifsTxSupport : 1,
191 1.1 alc halExtChanDfsSupport : 1,
192 1.1 alc halForcePpmSupport : 1,
193 1.1 alc halEnhancedPmSupport : 1,
194 1.1 alc halMbssidAggrSupport : 1;
195 1.1 alc uint32_t halWirelessModes;
196 1.1 alc uint16_t halTotalQueues;
197 1.1 alc uint16_t halKeyCacheSize;
198 1.1 alc uint16_t halLow5GhzChan, halHigh5GhzChan;
199 1.1 alc uint16_t halLow2GhzChan, halHigh2GhzChan;
200 1.1 alc int halTstampPrecision;
201 1.1 alc int halRtsAggrLimit;
202 1.1 alc uint8_t halTxChainMask;
203 1.1 alc uint8_t halRxChainMask;
204 1.1 alc uint8_t halNumGpioPins;
205 1.1 alc uint8_t halNumAntCfg2GHz;
206 1.1 alc uint8_t halNumAntCfg5GHz;
207 1.1 alc } HAL_CAPABILITIES;
208 1.1 alc
209 1.1 alc /*
210 1.1 alc * The ``private area'' follows immediately after the ``public area''
211 1.1 alc * in the data structure returned by ath_hal_attach. Private data are
212 1.1 alc * used by device-independent code such as the regulatory domain support.
213 1.1 alc * In general, code within the HAL should never depend on data in the
214 1.1 alc * public area. Instead any public data needed internally should be
215 1.1 alc * shadowed here.
216 1.1 alc *
217 1.1 alc * When declaring a device-specific ath_hal data structure this structure
218 1.1 alc * is assumed to at the front; e.g.
219 1.1 alc *
220 1.1 alc * struct ath_hal_5212 {
221 1.1 alc * struct ath_hal_private ah_priv;
222 1.1 alc * ...
223 1.1 alc * };
224 1.1 alc *
225 1.1 alc * It might be better to manage the method pointers in this structure
226 1.1 alc * using an indirect pointer to a read-only data structure but this would
227 1.1 alc * disallow class-style method overriding.
228 1.1 alc */
229 1.1 alc struct ath_hal_private {
230 1.1 alc struct ath_hal h; /* public area */
231 1.1 alc
232 1.1 alc /* NB: all methods go first to simplify initialization */
233 1.1 alc HAL_BOOL (*ah_getChannelEdges)(struct ath_hal*,
234 1.1 alc uint16_t channelFlags,
235 1.1 alc uint16_t *lowChannel, uint16_t *highChannel);
236 1.1 alc u_int (*ah_getWirelessModes)(struct ath_hal*);
237 1.1 alc HAL_BOOL (*ah_eepromRead)(struct ath_hal *, u_int off,
238 1.1 alc uint16_t *data);
239 1.1 alc HAL_BOOL (*ah_eepromWrite)(struct ath_hal *, u_int off,
240 1.1 alc uint16_t data);
241 1.1 alc HAL_BOOL (*ah_gpioCfgOutput)(struct ath_hal *, uint32_t gpio);
242 1.1 alc HAL_BOOL (*ah_gpioCfgInput)(struct ath_hal *, uint32_t gpio);
243 1.1 alc uint32_t (*ah_gpioGet)(struct ath_hal *, uint32_t gpio);
244 1.1 alc HAL_BOOL (*ah_gpioSet)(struct ath_hal *,
245 1.1 alc uint32_t gpio, uint32_t val);
246 1.1 alc void (*ah_gpioSetIntr)(struct ath_hal*, u_int, uint32_t);
247 1.1 alc HAL_BOOL (*ah_getChipPowerLimits)(struct ath_hal *,
248 1.1 alc HAL_CHANNEL *, uint32_t);
249 1.1 alc int16_t (*ah_getNfAdjust)(struct ath_hal *,
250 1.1 alc const HAL_CHANNEL_INTERNAL*);
251 1.1 alc void (*ah_getNoiseFloor)(struct ath_hal *,
252 1.1 alc int16_t nfarray[]);
253 1.1 alc
254 1.1 alc void *ah_eeprom; /* opaque EEPROM state */
255 1.1 alc uint16_t ah_eeversion; /* EEPROM version */
256 1.1 alc void (*ah_eepromDetach)(struct ath_hal *);
257 1.1 alc HAL_STATUS (*ah_eepromGet)(struct ath_hal *, int, void *);
258 1.1 alc HAL_BOOL (*ah_eepromSet)(struct ath_hal *, int, int);
259 1.1 alc uint16_t (*ah_getSpurChan)(struct ath_hal *, int, HAL_BOOL);
260 1.1 alc HAL_BOOL (*ah_eepromDiag)(struct ath_hal *, int request,
261 1.1 alc const void *args, uint32_t argsize,
262 1.1 alc void **result, uint32_t *resultsize);
263 1.1 alc
264 1.1 alc /*
265 1.1 alc * Device revision information.
266 1.1 alc */
267 1.1 alc uint16_t ah_devid; /* PCI device ID */
268 1.1 alc uint16_t ah_subvendorid; /* PCI subvendor ID */
269 1.1 alc uint32_t ah_macVersion; /* MAC version id */
270 1.1 alc uint16_t ah_macRev; /* MAC revision */
271 1.1 alc uint16_t ah_phyRev; /* PHY revision */
272 1.1 alc uint16_t ah_analog5GhzRev; /* 2GHz radio revision */
273 1.1 alc uint16_t ah_analog2GhzRev; /* 5GHz radio revision */
274 1.1 alc
275 1.1 alc
276 1.1 alc HAL_OPMODE ah_opmode; /* operating mode from reset */
277 1.1 alc HAL_CAPABILITIES ah_caps; /* device capabilities */
278 1.1 alc uint32_t ah_diagreg; /* user-specified AR_DIAG_SW */
279 1.1 alc int16_t ah_powerLimit; /* tx power cap */
280 1.1 alc uint16_t ah_maxPowerLevel; /* calculated max tx power */
281 1.1 alc u_int ah_tpScale; /* tx power scale factor */
282 1.1 alc uint32_t ah_11nCompat; /* 11n compat controls */
283 1.1 alc
284 1.1 alc /*
285 1.1 alc * State for regulatory domain handling.
286 1.1 alc */
287 1.1 alc HAL_REG_DOMAIN ah_currentRD; /* Current regulatory domain */
288 1.1 alc HAL_CTRY_CODE ah_countryCode; /* current country code */
289 1.1 alc HAL_CHANNEL_INTERNAL ah_channels[256]; /* calculated channel list */
290 1.1 alc u_int ah_nchan; /* valid channels in list */
291 1.1 alc HAL_CHANNEL_INTERNAL *ah_curchan; /* current channel */
292 1.1 alc
293 1.1 alc uint8_t ah_coverageClass; /* coverage class */
294 1.1 alc HAL_BOOL ah_regdomainUpdate; /* regdomain is updated? */
295 1.1 alc /*
296 1.1 alc * RF Silent handling; setup according to the EEPROM.
297 1.1 alc */
298 1.1 alc uint16_t ah_rfsilent; /* GPIO pin + polarity */
299 1.1 alc HAL_BOOL ah_rfkillEnabled; /* enable/disable RfKill */
300 1.1 alc /*
301 1.1 alc * Diagnostic support for discriminating HIUERR reports.
302 1.1 alc */
303 1.1 alc uint32_t ah_fatalState[6]; /* AR_ISR+shadow regs */
304 1.1 alc int ah_rxornIsFatal; /* how to treat HAL_INT_RXORN */
305 1.1 alc };
306 1.1 alc
307 1.1 alc #define AH_PRIVATE(_ah) ((struct ath_hal_private *)(_ah))
308 1.1 alc
309 1.1 alc #define ath_hal_getChannelEdges(_ah, _cf, _lc, _hc) \
310 1.1 alc AH_PRIVATE(_ah)->ah_getChannelEdges(_ah, _cf, _lc, _hc)
311 1.1 alc #define ath_hal_getWirelessModes(_ah) \
312 1.1 alc AH_PRIVATE(_ah)->ah_getWirelessModes(_ah)
313 1.1 alc #define ath_hal_eepromRead(_ah, _off, _data) \
314 1.1 alc AH_PRIVATE(_ah)->ah_eepromRead(_ah, _off, _data)
315 1.1 alc #define ath_hal_eepromWrite(_ah, _off, _data) \
316 1.1 alc AH_PRIVATE(_ah)->ah_eepromWrite(_ah, _off, _data)
317 1.1 alc #define ath_hal_gpioCfgOutput(_ah, _gpio) \
318 1.1 alc AH_PRIVATE(_ah)->ah_gpioCfgOutput(_ah, _gpio)
319 1.1 alc #define ath_hal_gpioCfgInput(_ah, _gpio) \
320 1.1 alc AH_PRIVATE(_ah)->ah_gpioCfgInput(_ah, _gpio)
321 1.1 alc #define ath_hal_gpioGet(_ah, _gpio) \
322 1.1 alc AH_PRIVATE(_ah)->ah_gpioGet(_ah, _gpio)
323 1.1 alc #define ath_hal_gpioSet(_ah, _gpio, _val) \
324 1.1 alc AH_PRIVATE(_ah)->ah_gpioGet(_ah, _gpio, _val)
325 1.1 alc #define ath_hal_gpioSetIntr(_ah, _gpio, _ilevel) \
326 1.1 alc AH_PRIVATE(_ah)->ah_gpioSetIntr(_ah, _gpio, _ilevel)
327 1.1 alc #define ath_hal_getpowerlimits(_ah, _chans, _nchan) \
328 1.1 alc AH_PRIVATE(_ah)->ah_getChipPowerLimits(_ah, _chans, _nchan)
329 1.1 alc #define ath_hal_getNfAdjust(_ah, _c) \
330 1.1 alc AH_PRIVATE(_ah)->ah_getNfAdjust(_ah, _c)
331 1.1 alc #define ath_hal_getNoiseFloor(_ah, _nfArray) \
332 1.1 alc AH_PRIVATE(_ah)->ah_getNoiseFloor(_ah, _nfArray)
333 1.1 alc
334 1.1 alc #define ath_hal_eepromDetach(_ah) \
335 1.1 alc AH_PRIVATE(_ah)->ah_eepromDetach(_ah)
336 1.1 alc #define ath_hal_eepromGet(_ah, _param, _val) \
337 1.1 alc AH_PRIVATE(_ah)->ah_eepromGet(_ah, _param, _val)
338 1.1 alc #define ath_hal_eepromSet(_ah, _param, _val) \
339 1.1 alc AH_PRIVATE(_ah)->ah_eepromSet(_ah, _param, _val)
340 1.1 alc #define ath_hal_eepromGetFlag(_ah, _param) \
341 1.1 alc (AH_PRIVATE(_ah)->ah_eepromGet(_ah, _param, AH_NULL) == HAL_OK)
342 1.1 alc #define ath_hal_getSpurChan(_ah, _ix, _is2G) \
343 1.1 alc AH_PRIVATE(_ah)->ah_getSpurChan(_ah, _ix, _is2G)
344 1.1 alc #define ath_hal_eepromDiag(_ah, _request, _a, _asize, _r, _rsize) \
345 1.1 alc AH_PRIVATE(_ah)->ah_eepromDiag(_ah, _request, _a, _asize, _r, _rsize)
346 1.1 alc
347 1.1 alc #if !defined(_NET_IF_IEEE80211_H_) && !defined(_NET80211__IEEE80211_H_)
348 1.1 alc /*
349 1.1 alc * Stuff that would naturally come from _ieee80211.h
350 1.1 alc */
351 1.1 alc #define IEEE80211_ADDR_LEN 6
352 1.1 alc
353 1.1 alc #define IEEE80211_WEP_KEYLEN 5 /* 40bit */
354 1.1 alc #define IEEE80211_WEP_IVLEN 3 /* 24bit */
355 1.1 alc #define IEEE80211_WEP_KIDLEN 1 /* 1 octet */
356 1.1 alc #define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */
357 1.1 alc
358 1.1 alc #define IEEE80211_CRC_LEN 4
359 1.1 alc
360 1.1 alc #define IEEE80211_MTU 1500
361 1.1 alc #define IEEE80211_MAX_LEN (2300 + IEEE80211_CRC_LEN + \
362 1.1 alc (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN))
363 1.1 alc
364 1.1 alc enum {
365 1.1 alc IEEE80211_T_DS, /* direct sequence spread spectrum */
366 1.1 alc IEEE80211_T_FH, /* frequency hopping */
367 1.1 alc IEEE80211_T_OFDM, /* frequency division multiplexing */
368 1.1 alc IEEE80211_T_TURBO, /* high rate DS */
369 1.1 alc IEEE80211_T_HT, /* HT - full GI */
370 1.1 alc };
371 1.1 alc #define IEEE80211_T_CCK IEEE80211_T_DS /* more common nomenclatur */
372 1.1 alc #endif /* _NET_IF_IEEE80211_H_ */
373 1.1 alc
374 1.1 alc /* NB: these are defined privately until XR support is announced */
375 1.1 alc enum {
376 1.1 alc ATHEROS_T_XR = IEEE80211_T_HT+1, /* extended range */
377 1.1 alc };
378 1.1 alc
379 1.1 alc #define HAL_TXQ_USE_LOCKOUT_BKOFF_DIS 0x00000001
380 1.1 alc
381 1.1 alc #define INIT_AIFS 2
382 1.1 alc #define INIT_CWMIN 15
383 1.1 alc #define INIT_CWMIN_11B 31
384 1.1 alc #define INIT_CWMAX 1023
385 1.1 alc #define INIT_SH_RETRY 10
386 1.1 alc #define INIT_LG_RETRY 10
387 1.1 alc #define INIT_SSH_RETRY 32
388 1.1 alc #define INIT_SLG_RETRY 32
389 1.1 alc
390 1.1 alc typedef struct {
391 1.1 alc uint32_t tqi_ver; /* HAL TXQ verson */
392 1.1 alc HAL_TX_QUEUE tqi_type; /* hw queue type*/
393 1.1 alc HAL_TX_QUEUE_SUBTYPE tqi_subtype; /* queue subtype, if applicable */
394 1.1 alc HAL_TX_QUEUE_FLAGS tqi_qflags; /* queue flags */
395 1.1 alc uint32_t tqi_priority;
396 1.1 alc uint32_t tqi_aifs; /* aifs */
397 1.1 alc uint32_t tqi_cwmin; /* cwMin */
398 1.1 alc uint32_t tqi_cwmax; /* cwMax */
399 1.1 alc uint16_t tqi_shretry; /* frame short retry limit */
400 1.1 alc uint16_t tqi_lgretry; /* frame long retry limit */
401 1.1 alc uint32_t tqi_cbrPeriod;
402 1.1 alc uint32_t tqi_cbrOverflowLimit;
403 1.1 alc uint32_t tqi_burstTime;
404 1.1 alc uint32_t tqi_readyTime;
405 1.1 alc uint32_t tqi_physCompBuf;
406 1.1 alc uint32_t tqi_intFlags; /* flags for internal use */
407 1.1 alc } HAL_TX_QUEUE_INFO;
408 1.1 alc
409 1.1 alc extern HAL_BOOL ath_hal_setTxQProps(struct ath_hal *ah,
410 1.1 alc HAL_TX_QUEUE_INFO *qi, const HAL_TXQ_INFO *qInfo);
411 1.1 alc extern HAL_BOOL ath_hal_getTxQProps(struct ath_hal *ah,
412 1.1 alc HAL_TXQ_INFO *qInfo, const HAL_TX_QUEUE_INFO *qi);
413 1.1 alc
414 1.1 alc typedef enum {
415 1.1 alc HAL_ANI_PRESENT, /* is ANI support present */
416 1.1 alc HAL_ANI_NOISE_IMMUNITY_LEVEL, /* set level */
417 1.1 alc HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION, /* enable/disable */
418 1.1 alc HAL_ANI_CCK_WEAK_SIGNAL_THR, /* enable/disable */
419 1.1 alc HAL_ANI_FIRSTEP_LEVEL, /* set level */
420 1.1 alc HAL_ANI_SPUR_IMMUNITY_LEVEL, /* set level */
421 1.1 alc HAL_ANI_MODE = 6, /* 0 => manual, 1 => auto (XXX do not change) */
422 1.1 alc HAL_ANI_PHYERR_RESET, /* reset phy error stats */
423 1.1 alc } HAL_ANI_CMD;
424 1.1 alc
425 1.1 alc #define HAL_SPUR_VAL_MASK 0x3FFF
426 1.1 alc #define HAL_SPUR_CHAN_WIDTH 87
427 1.1 alc #define HAL_BIN_WIDTH_BASE_100HZ 3125
428 1.1 alc #define HAL_BIN_WIDTH_TURBO_100HZ 6250
429 1.1 alc #define HAL_MAX_BINS_ALLOWED 28
430 1.1 alc
431 1.1 alc /*
432 1.1 alc * A = 5GHZ|OFDM
433 1.1 alc * T = 5GHZ|OFDM|TURBO
434 1.1 alc *
435 1.1 alc * IS_CHAN_A(T) will return TRUE. This is probably
436 1.1 alc * not the default behavior we want. We should migrate to a better mask --
437 1.1 alc * perhaps CHANNEL_ALL.
438 1.1 alc *
439 1.1 alc * For now, IS_CHAN_G() masks itself with CHANNEL_108G.
440 1.1 alc *
441 1.1 alc */
442 1.1 alc
443 1.1 alc #define IS_CHAN_A(_c) (((_c)->channelFlags & CHANNEL_A) == CHANNEL_A)
444 1.1 alc #define IS_CHAN_B(_c) (((_c)->channelFlags & CHANNEL_B) == CHANNEL_B)
445 1.1 alc #define IS_CHAN_G(_c) (((_c)->channelFlags & (CHANNEL_108G|CHANNEL_G)) == CHANNEL_G)
446 1.1 alc #define IS_CHAN_108G(_c)(((_c)->channelFlags & CHANNEL_108G) == CHANNEL_108G)
447 1.1 alc #define IS_CHAN_T(_c) (((_c)->channelFlags & CHANNEL_T) == CHANNEL_T)
448 1.1 alc #define IS_CHAN_PUREG(_c) \
449 1.1 alc (((_c)->channelFlags & CHANNEL_PUREG) == CHANNEL_PUREG)
450 1.1 alc
451 1.1 alc #define IS_CHAN_TURBO(_c) (((_c)->channelFlags & CHANNEL_TURBO) != 0)
452 1.1 alc #define IS_CHAN_CCK(_c) (((_c)->channelFlags & CHANNEL_CCK) != 0)
453 1.1 alc #define IS_CHAN_OFDM(_c) (((_c)->channelFlags & CHANNEL_OFDM) != 0)
454 1.1 alc #define IS_CHAN_5GHZ(_c) (((_c)->channelFlags & CHANNEL_5GHZ) != 0)
455 1.1 alc #define IS_CHAN_2GHZ(_c) (((_c)->channelFlags & CHANNEL_2GHZ) != 0)
456 1.1 alc #define IS_CHAN_PASSIVE(_c) (((_c)->channelFlags & CHANNEL_PASSIVE) != 0)
457 1.1 alc #define IS_CHAN_HALF_RATE(_c) (((_c)->channelFlags & CHANNEL_HALF) != 0)
458 1.1 alc #define IS_CHAN_QUARTER_RATE(_c) (((_c)->channelFlags & CHANNEL_QUARTER) != 0)
459 1.1 alc
460 1.1 alc #define IS_CHAN_IN_PUBLIC_SAFETY_BAND(_c) ((_c) > 4940 && (_c) < 4990)
461 1.1 alc
462 1.1 alc #define CHANNEL_HT40 (CHANNEL_HT40PLUS | CHANNEL_HT40MINUS)
463 1.1 alc #define CHANNEL_HT (CHANNEL_HT20 | CHANNEL_HT40)
464 1.1 alc #define IS_CHAN_HT(_c) (((_c)->channelFlags & CHANNEL_HT) != 0)
465 1.1 alc #define IS_CHAN_HT20(_c) (((_c)->channelFlags & CHANNEL_HT) == CHANNEL_HT20)
466 1.1 alc #define IS_CHAN_HT40(_c) (((_c)->channelFlags & CHANNEL_HT40) != 0)
467 1.1 alc
468 1.1 alc /*
469 1.1 alc * Deduce if the host cpu has big- or litt-endian byte order.
470 1.1 alc */
471 1.1 alc static __inline__ int
472 1.1 alc isBigEndian(void)
473 1.1 alc {
474 1.1 alc union {
475 1.1 alc int32_t i;
476 1.1 alc char c[4];
477 1.1 alc } u;
478 1.1 alc u.i = 1;
479 1.1 alc return (u.c[0] == 0);
480 1.1 alc }
481 1.1 alc
482 1.1 alc /* unalligned little endian access */
483 1.1 alc #define LE_READ_2(p) \
484 1.1 alc ((uint16_t) \
485 1.1 alc ((((const uint8_t *)(p))[0] ) | (((const uint8_t *)(p))[1]<< 8)))
486 1.1 alc #define LE_READ_4(p) \
487 1.1 alc ((uint32_t) \
488 1.1 alc ((((const uint8_t *)(p))[0] ) | (((const uint8_t *)(p))[1]<< 8) |\
489 1.1 alc (((const uint8_t *)(p))[2]<<16) | (((const uint8_t *)(p))[3]<<24)))
490 1.1 alc
491 1.1 alc /*
492 1.1 alc * Register manipulation macros that expect bit field defines
493 1.1 alc * to follow the convention that an _S suffix is appended for
494 1.1 alc * a shift count, while the field mask has no suffix.
495 1.1 alc */
496 1.1 alc #define SM(_v, _f) (((_v) << _f##_S) & (_f))
497 1.1 alc #define MS(_v, _f) (((_v) & (_f)) >> _f##_S)
498 1.1 alc #define OS_REG_RMW_FIELD(_a, _r, _f, _v) \
499 1.1 alc OS_REG_WRITE(_a, _r, \
500 1.1 alc (OS_REG_READ(_a, _r) &~ (_f)) | (((_v) << _f##_S) & (_f)))
501 1.1 alc #define OS_REG_SET_BIT(_a, _r, _f) \
502 1.1 alc OS_REG_WRITE(_a, _r, OS_REG_READ(_a, _r) | (_f))
503 1.1 alc #define OS_REG_CLR_BIT(_a, _r, _f) \
504 1.1 alc OS_REG_WRITE(_a, _r, OS_REG_READ(_a, _r) &~ (_f))
505 1.1 alc
506 1.1 alc /*
507 1.1 alc * Regulatory domain support.
508 1.1 alc */
509 1.1 alc
510 1.1 alc /*
511 1.1 alc * Return the max allowed antenna gain based on the current
512 1.1 alc * regulatory domain.
513 1.1 alc */
514 1.1 alc extern u_int ath_hal_getantennareduction(struct ath_hal *,
515 1.1 alc HAL_CHANNEL *, u_int twiceGain);
516 1.1 alc /*
517 1.1 alc * Return the test group for the specific channel based on
518 1.1 alc * the current regulator domain.
519 1.1 alc */
520 1.1 alc extern u_int ath_hal_getctl(struct ath_hal *, HAL_CHANNEL *);
521 1.1 alc /*
522 1.1 alc * Return whether or not a noise floor check is required
523 1.1 alc * based on the current regulatory domain for the specified
524 1.1 alc * channel.
525 1.1 alc */
526 1.1 alc extern u_int ath_hal_getnfcheckrequired(struct ath_hal *, HAL_CHANNEL *);
527 1.1 alc
528 1.1 alc /*
529 1.1 alc * Map a public channel definition to the corresponding
530 1.1 alc * internal data structure. This implicitly specifies
531 1.1 alc * whether or not the specified channel is ok to use
532 1.1 alc * based on the current regulatory domain constraints.
533 1.1 alc */
534 1.1 alc extern HAL_CHANNEL_INTERNAL *ath_hal_checkchannel(struct ath_hal *,
535 1.1 alc const HAL_CHANNEL *);
536 1.1 alc
537 1.1 alc /* system-configurable parameters */
538 1.1 alc extern int ath_hal_dma_beacon_response_time; /* in TU's */
539 1.1 alc extern int ath_hal_sw_beacon_response_time; /* in TU's */
540 1.1 alc extern int ath_hal_additional_swba_backoff; /* in TU's */
541 1.1 alc
542 1.1 alc /* wait for the register contents to have the specified value */
543 1.1 alc extern HAL_BOOL ath_hal_wait(struct ath_hal *, u_int reg,
544 1.1 alc uint32_t mask, uint32_t val);
545 1.1 alc
546 1.1 alc /* return the first n bits in val reversed */
547 1.1 alc extern uint32_t ath_hal_reverseBits(uint32_t val, uint32_t n);
548 1.1 alc
549 1.1 alc /* printf interfaces */
550 1.1 alc extern void ath_hal_printf(struct ath_hal *, const char*, ...)
551 1.1 alc __printflike(2,3);
552 1.1 alc extern void ath_hal_vprintf(struct ath_hal *, const char*, __va_list)
553 1.1 alc __printflike(2, 0);
554 1.1 alc extern const char* ath_hal_ether_sprintf(const uint8_t *mac);
555 1.1 alc
556 1.1 alc /* allocate and free memory */
557 1.1 alc extern void *ath_hal_malloc(size_t);
558 1.1 alc extern void ath_hal_free(void *);
559 1.1 alc
560 1.1 alc /* common debugging interfaces */
561 1.1 alc #ifdef AH_DEBUG
562 1.1 alc #include "ah_debug.h"
563 1.1 alc extern int ath_hal_debug;
564 1.1 alc extern void HALDEBUG(struct ath_hal *ah, u_int mask, const char* fmt, ...)
565 1.1 alc __printflike(3,4);
566 1.1 alc #else
567 1.1 alc #define HALDEBUG(_ah, __m, _fmt, ...)
568 1.1 alc #endif /* AH_DEBUG */
569 1.1 alc
570 1.1 alc /*
571 1.1 alc * Register logging definitions shared with ardecode.
572 1.1 alc */
573 1.1 alc #include "ah_decode.h"
574 1.1 alc
575 1.1 alc /*
576 1.1 alc * Common assertion interface. Note: it is a bad idea to generate
577 1.1 alc * an assertion failure for any recoverable event. Instead catch
578 1.1 alc * the violation and, if possible, fix it up or recover from it; either
579 1.1 alc * with an error return value or a diagnostic messages. System software
580 1.1 alc * does not panic unless the situation is hopeless.
581 1.1 alc */
582 1.1 alc #ifdef AH_ASSERT
583 1.1 alc extern void ath_hal_assert_failed(const char* filename,
584 1.1 alc int lineno, const char* msg);
585 1.1 alc
586 1.1 alc #define HALASSERT(_x) do { \
587 1.1 alc if (!(_x)) { \
588 1.1 alc ath_hal_assert_failed(__FILE__, __LINE__, #_x); \
589 1.1 alc } \
590 1.1 alc } while (0)
591 1.1 alc #else
592 1.1 alc #define HALASSERT(_x)
593 1.1 alc #endif /* AH_ASSERT */
594 1.1 alc
595 1.1 alc /*
596 1.1 alc * Convert between microseconds and core system clocks.
597 1.1 alc */
598 1.1 alc extern u_int ath_hal_mac_clks(struct ath_hal *ah, u_int usecs);
599 1.1 alc extern u_int ath_hal_mac_usec(struct ath_hal *ah, u_int clks);
600 1.1 alc
601 1.1 alc /*
602 1.1 alc * Generic get/set capability support. Each chip overrides
603 1.1 alc * this routine to support chip-specific capabilities.
604 1.1 alc */
605 1.1 alc extern HAL_STATUS ath_hal_getcapability(struct ath_hal *ah,
606 1.1 alc HAL_CAPABILITY_TYPE type, uint32_t capability,
607 1.1 alc uint32_t *result);
608 1.1 alc extern HAL_BOOL ath_hal_setcapability(struct ath_hal *ah,
609 1.1 alc HAL_CAPABILITY_TYPE type, uint32_t capability,
610 1.1 alc uint32_t setting, HAL_STATUS *status);
611 1.1 alc
612 1.1 alc /*
613 1.1 alc * Diagnostic interface. This is an open-ended interface that
614 1.1 alc * is opaque to applications. Diagnostic programs use this to
615 1.1 alc * retrieve internal data structures, etc. There is no guarantee
616 1.1 alc * that calling conventions for calls other than HAL_DIAG_REVS
617 1.1 alc * are stable between HAL releases; a diagnostic application must
618 1.1 alc * use the HAL revision information to deal with ABI/API differences.
619 1.1 alc *
620 1.1 alc * NB: do not renumber these, certain codes are publicly used.
621 1.1 alc */
622 1.1 alc enum {
623 1.1 alc HAL_DIAG_REVS = 0, /* MAC/PHY/Radio revs */
624 1.1 alc HAL_DIAG_EEPROM = 1, /* EEPROM contents */
625 1.1 alc HAL_DIAG_EEPROM_EXP_11A = 2, /* EEPROM 5112 power exp for 11a */
626 1.1 alc HAL_DIAG_EEPROM_EXP_11B = 3, /* EEPROM 5112 power exp for 11b */
627 1.1 alc HAL_DIAG_EEPROM_EXP_11G = 4, /* EEPROM 5112 power exp for 11g */
628 1.1 alc HAL_DIAG_ANI_CURRENT = 5, /* ANI current channel state */
629 1.1 alc HAL_DIAG_ANI_OFDM = 6, /* ANI OFDM timing error stats */
630 1.1 alc HAL_DIAG_ANI_CCK = 7, /* ANI CCK timing error stats */
631 1.1 alc HAL_DIAG_ANI_STATS = 8, /* ANI statistics */
632 1.1 alc HAL_DIAG_RFGAIN = 9, /* RfGain GAIN_VALUES */
633 1.1 alc HAL_DIAG_RFGAIN_CURSTEP = 10, /* RfGain GAIN_OPTIMIZATION_STEP */
634 1.1 alc HAL_DIAG_PCDAC = 11, /* PCDAC table */
635 1.1 alc HAL_DIAG_TXRATES = 12, /* Transmit rate table */
636 1.1 alc HAL_DIAG_REGS = 13, /* Registers */
637 1.1 alc HAL_DIAG_ANI_CMD = 14, /* ANI issue command (XXX do not change!) */
638 1.1 alc HAL_DIAG_SETKEY = 15, /* Set keycache backdoor */
639 1.1 alc HAL_DIAG_RESETKEY = 16, /* Reset keycache backdoor */
640 1.1 alc HAL_DIAG_EEREAD = 17, /* Read EEPROM word */
641 1.1 alc HAL_DIAG_EEWRITE = 18, /* Write EEPROM word */
642 1.1 alc /* 19 was HAL_DIAG_TXCONT, 20-23 were for radar */
643 1.1 alc HAL_DIAG_REGREAD = 24, /* Reg reads */
644 1.1 alc HAL_DIAG_REGWRITE = 25, /* Reg writes */
645 1.1 alc HAL_DIAG_GET_REGBASE = 26, /* Get register base */
646 1.1 alc HAL_DIAG_RDWRITE = 27, /* Write regulatory domain */
647 1.1 alc HAL_DIAG_RDREAD = 28, /* Get regulatory domain */
648 1.1 alc HAL_DIAG_FATALERR = 29, /* Read cached interrupt state */
649 1.1 alc HAL_DIAG_11NCOMPAT = 30, /* 11n compatibility tweaks */
650 1.1 alc HAL_DIAG_ANI_PARAMS = 31, /* ANI noise immunity parameters */
651 1.1 alc HAL_DIAG_CHECK_HANGS = 32, /* check h/w hangs */
652 1.1 alc };
653 1.1 alc
654 1.1 alc enum {
655 1.1 alc HAL_BB_HANG_DFS = 0x0001,
656 1.1 alc HAL_BB_HANG_RIFS = 0x0002,
657 1.1 alc HAL_BB_HANG_RX_CLEAR = 0x0004,
658 1.1 alc HAL_BB_HANG_UNKNOWN = 0x0080,
659 1.1 alc
660 1.1 alc HAL_MAC_HANG_SIG1 = 0x0100,
661 1.1 alc HAL_MAC_HANG_SIG2 = 0x0200,
662 1.1 alc HAL_MAC_HANG_UNKNOWN = 0x8000,
663 1.1 alc
664 1.1 alc HAL_BB_HANGS = HAL_BB_HANG_DFS
665 1.1 alc | HAL_BB_HANG_RIFS
666 1.1 alc | HAL_BB_HANG_RX_CLEAR
667 1.1 alc | HAL_BB_HANG_UNKNOWN,
668 1.1 alc HAL_MAC_HANGS = HAL_MAC_HANG_SIG1
669 1.1 alc | HAL_MAC_HANG_SIG2
670 1.1 alc | HAL_MAC_HANG_UNKNOWN,
671 1.1 alc };
672 1.1 alc
673 1.1 alc /*
674 1.1 alc * Device revision information.
675 1.1 alc */
676 1.1 alc typedef struct {
677 1.1 alc uint16_t ah_devid; /* PCI device ID */
678 1.1 alc uint16_t ah_subvendorid; /* PCI subvendor ID */
679 1.1 alc uint32_t ah_macVersion; /* MAC version id */
680 1.1 alc uint16_t ah_macRev; /* MAC revision */
681 1.1 alc uint16_t ah_phyRev; /* PHY revision */
682 1.1 alc uint16_t ah_analog5GhzRev; /* 2GHz radio revision */
683 1.1 alc uint16_t ah_analog2GhzRev; /* 5GHz radio revision */
684 1.1 alc } HAL_REVS;
685 1.1 alc
686 1.1 alc /*
687 1.1 alc * Argument payload for HAL_DIAG_SETKEY.
688 1.1 alc */
689 1.1 alc typedef struct {
690 1.1 alc HAL_KEYVAL dk_keyval;
691 1.1 alc uint16_t dk_keyix; /* key index */
692 1.1 alc uint8_t dk_mac[IEEE80211_ADDR_LEN];
693 1.1 alc int dk_xor; /* XOR key data */
694 1.1 alc } HAL_DIAG_KEYVAL;
695 1.1 alc
696 1.1 alc /*
697 1.1 alc * Argument payload for HAL_DIAG_EEWRITE.
698 1.1 alc */
699 1.1 alc typedef struct {
700 1.1 alc uint16_t ee_off; /* eeprom offset */
701 1.1 alc uint16_t ee_data; /* write data */
702 1.1 alc } HAL_DIAG_EEVAL;
703 1.1 alc
704 1.1 alc
705 1.1 alc typedef struct {
706 1.1 alc u_int offset; /* reg offset */
707 1.1 alc uint32_t val; /* reg value */
708 1.1 alc } HAL_DIAG_REGVAL;
709 1.1 alc
710 1.1 alc /*
711 1.1 alc * 11n compatibility tweaks.
712 1.1 alc */
713 1.1 alc #define HAL_DIAG_11N_SERVICES 0x00000003
714 1.1 alc #define HAL_DIAG_11N_SERVICES_S 0
715 1.1 alc #define HAL_DIAG_11N_TXSTOMP 0x0000000c
716 1.1 alc #define HAL_DIAG_11N_TXSTOMP_S 2
717 1.1 alc
718 1.1 alc typedef struct {
719 1.1 alc int maxNoiseImmunityLevel; /* [0..4] */
720 1.1 alc int totalSizeDesired[5];
721 1.1 alc int coarseHigh[5];
722 1.1 alc int coarseLow[5];
723 1.1 alc int firpwr[5];
724 1.1 alc
725 1.1 alc int maxSpurImmunityLevel; /* [0..7] */
726 1.1 alc int cycPwrThr1[8];
727 1.1 alc
728 1.1 alc int maxFirstepLevel; /* [0..2] */
729 1.1 alc int firstep[3];
730 1.1 alc
731 1.1 alc uint32_t ofdmTrigHigh;
732 1.1 alc uint32_t ofdmTrigLow;
733 1.1 alc int32_t cckTrigHigh;
734 1.1 alc int32_t cckTrigLow;
735 1.1 alc int32_t rssiThrLow;
736 1.1 alc int32_t rssiThrHigh;
737 1.1 alc
738 1.1 alc int period; /* update listen period */
739 1.1 alc } HAL_ANI_PARAMS;
740 1.1 alc
741 1.1 alc extern HAL_BOOL ath_hal_getdiagstate(struct ath_hal *ah, int request,
742 1.1 alc const void *args, uint32_t argsize,
743 1.1 alc void **result, uint32_t *resultsize);
744 1.1 alc
745 1.1 alc /*
746 1.1 alc * Setup a h/w rate table for use.
747 1.1 alc */
748 1.1 alc extern void ath_hal_setupratetable(struct ath_hal *ah, HAL_RATE_TABLE *rt);
749 1.1 alc
750 1.1 alc /*
751 1.1 alc * Common routine for implementing getChanNoise api.
752 1.1 alc */
753 1.1 alc extern int16_t ath_hal_getChanNoise(struct ath_hal *ah, HAL_CHANNEL *chan);
754 1.1 alc
755 1.1 alc /*
756 1.1 alc * Initialization support.
757 1.1 alc */
758 1.1 alc typedef struct {
759 1.1 alc const uint32_t *data;
760 1.1 alc int rows, cols;
761 1.1 alc } HAL_INI_ARRAY;
762 1.1 alc
763 1.1 alc #define HAL_INI_INIT(_ia, _data, _cols) do { \
764 1.1 alc (_ia)->data = (const uint32_t *)(_data); \
765 1.1 alc (_ia)->rows = sizeof(_data) / sizeof((_data)[0]); \
766 1.1 alc (_ia)->cols = (_cols); \
767 1.1 alc } while (0)
768 1.1 alc #define HAL_INI_VAL(_ia, _r, _c) \
769 1.1 alc ((_ia)->data[((_r)*(_ia)->cols) + (_c)])
770 1.1 alc
771 1.1 alc /*
772 1.1 alc * OS_DELAY() does a PIO READ on the PCI bus which allows
773 1.1 alc * other cards' DMA reads to complete in the middle of our reset.
774 1.1 alc */
775 1.1 alc #define DMA_YIELD(x) do { \
776 1.1 alc if ((++(x) % 64) == 0) \
777 1.1 alc OS_DELAY(1); \
778 1.1 alc } while (0)
779 1.1 alc
780 1.1 alc #define HAL_INI_WRITE_ARRAY(ah, regArray, col, regWr) do { \
781 1.1 alc int r; \
782 1.1 alc for (r = 0; r < N(regArray); r++) { \
783 1.1 alc OS_REG_WRITE(ah, (regArray)[r][0], (regArray)[r][col]); \
784 1.1 alc DMA_YIELD(regWr); \
785 1.1 alc } \
786 1.1 alc } while (0)
787 1.1 alc
788 1.1 alc #define HAL_INI_WRITE_BANK(ah, regArray, bankData, regWr) do { \
789 1.1 alc int r; \
790 1.1 alc for (r = 0; r < N(regArray); r++) { \
791 1.1 alc OS_REG_WRITE(ah, (regArray)[r][0], (bankData)[r]); \
792 1.1 alc DMA_YIELD(regWr); \
793 1.1 alc } \
794 1.1 alc } while (0)
795 1.1 alc
796 1.1 alc extern int ath_hal_ini_write(struct ath_hal *ah, const HAL_INI_ARRAY *ia,
797 1.1 alc int col, int regWr);
798 1.1 alc extern void ath_hal_ini_bank_setup(uint32_t data[], const HAL_INI_ARRAY *ia,
799 1.1 alc int col);
800 1.1 alc extern int ath_hal_ini_bank_write(struct ath_hal *ah, const HAL_INI_ARRAY *ia,
801 1.1 alc const uint32_t data[], int regWr);
802 1.1 alc
803 1.1 alc #define WLAN_CTRL_FRAME_SIZE (2+2+6+4) /* ACK+FCS */
804 1.1 alc #endif /* _ATH_AH_INTERAL_H_ */
805