ah.h revision 1.3 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.3 cegger * $Id: ah.h,v 1.3 2011/02/21 11:06:38 cegger Exp $
18 1.1 alc */
19 1.1 alc
20 1.1 alc #ifndef _ATH_AH_H_
21 1.1 alc #define _ATH_AH_H_
22 1.1 alc /*
23 1.1 alc * Atheros Hardware Access Layer
24 1.1 alc *
25 1.1 alc * Clients of the HAL call ath_hal_attach to obtain a reference to an ath_hal
26 1.1 alc * structure for use with the device. Hardware-related operations that
27 1.1 alc * follow must call back into the HAL through interface, supplying the
28 1.1 alc * reference as the first parameter.
29 1.1 alc */
30 1.1 alc
31 1.1 alc #include "ah_osdep.h"
32 1.1 alc
33 1.1 alc /*
34 1.1 alc * __ahdecl is analogous to _cdecl; it defines the calling
35 1.1 alc * convention used within the HAL. For most systems this
36 1.1 alc * can just default to be empty and the compiler will (should)
37 1.1 alc * use _cdecl. For systems where _cdecl is not compatible this
38 1.1 alc * must be defined. See linux/ah_osdep.h for an example.
39 1.1 alc */
40 1.1 alc #ifndef __ahdecl
41 1.1 alc #define __ahdecl
42 1.1 alc #endif
43 1.1 alc
44 1.1 alc /*
45 1.1 alc * Status codes that may be returned by the HAL. Note that
46 1.1 alc * interfaces that return a status code set it only when an
47 1.1 alc * error occurs--i.e. you cannot check it for success.
48 1.1 alc */
49 1.1 alc typedef enum {
50 1.1 alc HAL_OK = 0, /* No error */
51 1.1 alc HAL_ENXIO = 1, /* No hardware present */
52 1.1 alc HAL_ENOMEM = 2, /* Memory allocation failed */
53 1.1 alc HAL_EIO = 3, /* Hardware didn't respond as expected */
54 1.1 alc HAL_EEMAGIC = 4, /* EEPROM magic number invalid */
55 1.1 alc HAL_EEVERSION = 5, /* EEPROM version invalid */
56 1.1 alc HAL_EELOCKED = 6, /* EEPROM unreadable */
57 1.1 alc HAL_EEBADSUM = 7, /* EEPROM checksum invalid */
58 1.1 alc HAL_EEREAD = 8, /* EEPROM read problem */
59 1.1 alc HAL_EEBADMAC = 9, /* EEPROM mac address invalid */
60 1.1 alc HAL_EESIZE = 10, /* EEPROM size not supported */
61 1.1 alc HAL_EEWRITE = 11, /* Attempt to change write-locked EEPROM */
62 1.1 alc HAL_EINVAL = 12, /* Invalid parameter to function */
63 1.1 alc HAL_ENOTSUPP = 13, /* Hardware revision not supported */
64 1.1 alc HAL_ESELFTEST = 14, /* Hardware self-test failed */
65 1.1 alc HAL_EINPROGRESS = 15, /* Operation incomplete */
66 1.1 alc } HAL_STATUS;
67 1.1 alc
68 1.1 alc typedef enum {
69 1.1 alc AH_FALSE = 0, /* NB: lots of code assumes false is zero */
70 1.1 alc AH_TRUE = 1,
71 1.1 alc } HAL_BOOL;
72 1.1 alc
73 1.1 alc typedef enum {
74 1.1 alc HAL_CAP_REG_DMN = 0, /* current regulatory domain */
75 1.1 alc HAL_CAP_CIPHER = 1, /* hardware supports cipher */
76 1.1 alc HAL_CAP_TKIP_MIC = 2, /* handle TKIP MIC in hardware */
77 1.1 alc HAL_CAP_TKIP_SPLIT = 3, /* hardware TKIP uses split keys */
78 1.1 alc HAL_CAP_PHYCOUNTERS = 4, /* hardware PHY error counters */
79 1.1 alc HAL_CAP_DIVERSITY = 5, /* hardware supports fast diversity */
80 1.1 alc HAL_CAP_KEYCACHE_SIZE = 6, /* number of entries in key cache */
81 1.1 alc HAL_CAP_NUM_TXQUEUES = 7, /* number of hardware xmit queues */
82 1.1 alc HAL_CAP_VEOL = 9, /* hardware supports virtual EOL */
83 1.1 alc HAL_CAP_PSPOLL = 10, /* hardware has working PS-Poll support */
84 1.1 alc HAL_CAP_DIAG = 11, /* hardware diagnostic support */
85 1.1 alc HAL_CAP_COMPRESSION = 12, /* hardware supports compression */
86 1.1 alc HAL_CAP_BURST = 13, /* hardware supports packet bursting */
87 1.1 alc HAL_CAP_FASTFRAME = 14, /* hardware supoprts fast frames */
88 1.1 alc HAL_CAP_TXPOW = 15, /* global tx power limit */
89 1.1 alc HAL_CAP_TPC = 16, /* per-packet tx power control */
90 1.1 alc HAL_CAP_PHYDIAG = 17, /* hardware phy error diagnostic */
91 1.1 alc HAL_CAP_BSSIDMASK = 18, /* hardware supports bssid mask */
92 1.1 alc HAL_CAP_MCAST_KEYSRCH = 19, /* hardware has multicast key search */
93 1.1 alc HAL_CAP_TSF_ADJUST = 20, /* hardware has beacon tsf adjust */
94 1.1 alc /* 21 was HAL_CAP_XR */
95 1.1 alc HAL_CAP_WME_TKIPMIC = 22, /* hardware can support TKIP MIC when WMM is turned on */
96 1.1 alc /* 23 was HAL_CAP_CHAN_HALFRATE */
97 1.1 alc /* 24 was HAL_CAP_CHAN_QUARTERRATE */
98 1.1 alc HAL_CAP_RFSILENT = 25, /* hardware has rfsilent support */
99 1.1 alc HAL_CAP_TPC_ACK = 26, /* ack txpower with per-packet tpc */
100 1.1 alc HAL_CAP_TPC_CTS = 27, /* cts txpower with per-packet tpc */
101 1.1 alc HAL_CAP_11D = 28, /* 11d beacon support for changing cc */
102 1.1 alc HAL_CAP_INTMIT = 29, /* interference mitigation */
103 1.1 alc HAL_CAP_RXORN_FATAL = 30, /* HAL_INT_RXORN treated as fatal */
104 1.1 alc HAL_CAP_HT = 31, /* hardware can support HT */
105 1.1 alc HAL_CAP_TX_CHAINMASK = 32, /* mask of TX chains supported */
106 1.1 alc HAL_CAP_RX_CHAINMASK = 33, /* mask of RX chains supported */
107 1.1 alc HAL_CAP_RXTSTAMP_PREC = 34, /* rx desc tstamp precision (bits) */
108 1.1 alc HAL_CAP_BB_HANG = 35, /* can baseband hang */
109 1.1 alc HAL_CAP_MAC_HANG = 36, /* can MAC hang */
110 1.1 alc } HAL_CAPABILITY_TYPE;
111 1.1 alc
112 1.1 alc /*
113 1.1 alc * "States" for setting the LED. These correspond to
114 1.1 alc * the possible 802.11 operational states and there may
115 1.1 alc * be a many-to-one mapping between these states and the
116 1.1 alc * actual hardware state for the LED's (i.e. the hardware
117 1.1 alc * may have fewer states).
118 1.1 alc */
119 1.1 alc typedef enum {
120 1.1 alc HAL_LED_INIT = 0,
121 1.1 alc HAL_LED_SCAN = 1,
122 1.1 alc HAL_LED_AUTH = 2,
123 1.1 alc HAL_LED_ASSOC = 3,
124 1.1 alc HAL_LED_RUN = 4
125 1.1 alc } HAL_LED_STATE;
126 1.1 alc
127 1.1 alc /*
128 1.1 alc * Transmit queue types/numbers. These are used to tag
129 1.1 alc * each transmit queue in the hardware and to identify a set
130 1.1 alc * of transmit queues for operations such as start/stop dma.
131 1.1 alc */
132 1.1 alc typedef enum {
133 1.1 alc HAL_TX_QUEUE_INACTIVE = 0, /* queue is inactive/unused */
134 1.1 alc HAL_TX_QUEUE_DATA = 1, /* data xmit q's */
135 1.1 alc HAL_TX_QUEUE_BEACON = 2, /* beacon xmit q */
136 1.1 alc HAL_TX_QUEUE_CAB = 3, /* "crap after beacon" xmit q */
137 1.1 alc HAL_TX_QUEUE_UAPSD = 4, /* u-apsd power save xmit q */
138 1.1 alc } HAL_TX_QUEUE;
139 1.1 alc
140 1.1 alc #define HAL_NUM_TX_QUEUES 10 /* max possible # of queues */
141 1.1 alc
142 1.1 alc /*
143 1.1 alc * Transmit queue subtype. These map directly to
144 1.1 alc * WME Access Categories (except for UPSD). Refer
145 1.1 alc * to Table 5 of the WME spec.
146 1.1 alc */
147 1.1 alc typedef enum {
148 1.1 alc HAL_WME_AC_BK = 0, /* background access category */
149 1.1 alc HAL_WME_AC_BE = 1, /* best effort access category*/
150 1.1 alc HAL_WME_AC_VI = 2, /* video access category */
151 1.1 alc HAL_WME_AC_VO = 3, /* voice access category */
152 1.1 alc HAL_WME_UPSD = 4, /* uplink power save */
153 1.1 alc } HAL_TX_QUEUE_SUBTYPE;
154 1.1 alc
155 1.1 alc /*
156 1.1 alc * Transmit queue flags that control various
157 1.1 alc * operational parameters.
158 1.1 alc */
159 1.1 alc typedef enum {
160 1.1 alc /*
161 1.1 alc * Per queue interrupt enables. When set the associated
162 1.1 alc * interrupt may be delivered for packets sent through
163 1.1 alc * the queue. Without these enabled no interrupts will
164 1.1 alc * be delivered for transmits through the queue.
165 1.1 alc */
166 1.1 alc HAL_TXQ_TXOKINT_ENABLE = 0x0001, /* enable TXOK interrupt */
167 1.1 alc HAL_TXQ_TXERRINT_ENABLE = 0x0001, /* enable TXERR interrupt */
168 1.1 alc HAL_TXQ_TXDESCINT_ENABLE = 0x0002, /* enable TXDESC interrupt */
169 1.1 alc HAL_TXQ_TXEOLINT_ENABLE = 0x0004, /* enable TXEOL interrupt */
170 1.1 alc HAL_TXQ_TXURNINT_ENABLE = 0x0008, /* enable TXURN interrupt */
171 1.1 alc /*
172 1.1 alc * Enable hardware compression for packets sent through
173 1.1 alc * the queue. The compression buffer must be setup and
174 1.1 alc * packets must have a key entry marked in the tx descriptor.
175 1.1 alc */
176 1.1 alc HAL_TXQ_COMPRESSION_ENABLE = 0x0010, /* enable h/w compression */
177 1.1 alc /*
178 1.1 alc * Disable queue when veol is hit or ready time expires.
179 1.1 alc * By default the queue is disabled only on reaching the
180 1.1 alc * physical end of queue (i.e. a null link ptr in the
181 1.1 alc * descriptor chain).
182 1.1 alc */
183 1.1 alc HAL_TXQ_RDYTIME_EXP_POLICY_ENABLE = 0x0020,
184 1.1 alc /*
185 1.1 alc * Schedule frames on delivery of a DBA (DMA Beacon Alert)
186 1.1 alc * event. Frames will be transmitted only when this timer
187 1.1 alc * fires, e.g to transmit a beacon in ap or adhoc modes.
188 1.1 alc */
189 1.1 alc HAL_TXQ_DBA_GATED = 0x0040, /* schedule based on DBA */
190 1.1 alc /*
191 1.1 alc * Each transmit queue has a counter that is incremented
192 1.1 alc * each time the queue is enabled and decremented when
193 1.1 alc * the list of frames to transmit is traversed (or when
194 1.1 alc * the ready time for the queue expires). This counter
195 1.1 alc * must be non-zero for frames to be scheduled for
196 1.1 alc * transmission. The following controls disable bumping
197 1.1 alc * this counter under certain conditions. Typically this
198 1.1 alc * is used to gate frames based on the contents of another
199 1.1 alc * queue (e.g. CAB traffic may only follow a beacon frame).
200 1.1 alc * These are meaningful only when frames are scheduled
201 1.1 alc * with a non-ASAP policy (e.g. DBA-gated).
202 1.1 alc */
203 1.1 alc HAL_TXQ_CBR_DIS_QEMPTY = 0x0080, /* disable on this q empty */
204 1.1 alc HAL_TXQ_CBR_DIS_BEMPTY = 0x0100, /* disable on beacon q empty */
205 1.1 alc
206 1.1 alc /*
207 1.1 alc * Fragment burst backoff policy. Normally the no backoff
208 1.1 alc * is done after a successful transmission, the next fragment
209 1.1 alc * is sent at SIFS. If this flag is set backoff is done
210 1.1 alc * after each fragment, regardless whether it was ack'd or
211 1.1 alc * not, after the backoff count reaches zero a normal channel
212 1.1 alc * access procedure is done before the next transmit (i.e.
213 1.1 alc * wait AIFS instead of SIFS).
214 1.1 alc */
215 1.1 alc HAL_TXQ_FRAG_BURST_BACKOFF_ENABLE = 0x00800000,
216 1.1 alc /*
217 1.1 alc * Disable post-tx backoff following each frame.
218 1.1 alc */
219 1.1 alc HAL_TXQ_BACKOFF_DISABLE = 0x00010000, /* disable post backoff */
220 1.1 alc /*
221 1.1 alc * DCU arbiter lockout control. This controls how
222 1.1 alc * lower priority tx queues are handled with respect to
223 1.1 alc * to a specific queue when multiple queues have frames
224 1.1 alc * to send. No lockout means lower priority queues arbitrate
225 1.1 alc * concurrently with this queue. Intra-frame lockout
226 1.1 alc * means lower priority queues are locked out until the
227 1.1 alc * current frame transmits (e.g. including backoffs and bursting).
228 1.1 alc * Global lockout means nothing lower can arbitrary so
229 1.1 alc * long as there is traffic activity on this queue (frames,
230 1.1 alc * backoff, etc).
231 1.1 alc */
232 1.1 alc HAL_TXQ_ARB_LOCKOUT_INTRA = 0x00020000, /* intra-frame lockout */
233 1.1 alc HAL_TXQ_ARB_LOCKOUT_GLOBAL = 0x00040000, /* full lockout s */
234 1.1 alc
235 1.1 alc HAL_TXQ_IGNORE_VIRTCOL = 0x00080000, /* ignore virt collisions */
236 1.1 alc HAL_TXQ_SEQNUM_INC_DIS = 0x00100000, /* disable seqnum increment */
237 1.1 alc } HAL_TX_QUEUE_FLAGS;
238 1.1 alc
239 1.1 alc typedef struct {
240 1.1 alc uint32_t tqi_ver; /* hal TXQ version */
241 1.1 alc HAL_TX_QUEUE_SUBTYPE tqi_subtype; /* subtype if applicable */
242 1.1 alc HAL_TX_QUEUE_FLAGS tqi_qflags; /* flags (see above) */
243 1.1 alc uint32_t tqi_priority; /* (not used) */
244 1.1 alc uint32_t tqi_aifs; /* aifs */
245 1.1 alc uint32_t tqi_cwmin; /* cwMin */
246 1.1 alc uint32_t tqi_cwmax; /* cwMax */
247 1.1 alc uint16_t tqi_shretry; /* rts retry limit */
248 1.1 alc uint16_t tqi_lgretry; /* long retry limit (not used)*/
249 1.1 alc uint32_t tqi_cbrPeriod; /* CBR period (us) */
250 1.1 alc uint32_t tqi_cbrOverflowLimit; /* threshold for CBROVF int */
251 1.1 alc uint32_t tqi_burstTime; /* max burst duration (us) */
252 1.1 alc uint32_t tqi_readyTime; /* frame schedule time (us) */
253 1.1 alc uint32_t tqi_compBuf; /* comp buffer phys addr */
254 1.1 alc } HAL_TXQ_INFO;
255 1.1 alc
256 1.1 alc #define HAL_TQI_NONVAL 0xffff
257 1.1 alc
258 1.1 alc /* token to use for aifs, cwmin, cwmax */
259 1.1 alc #define HAL_TXQ_USEDEFAULT ((uint32_t) -1)
260 1.1 alc
261 1.1 alc /* compression definitions */
262 1.1 alc #define HAL_COMP_BUF_MAX_SIZE 9216 /* 9K */
263 1.1 alc #define HAL_COMP_BUF_ALIGN_SIZE 512
264 1.1 alc
265 1.1 alc /*
266 1.1 alc * Transmit packet types. This belongs in ah_desc.h, but
267 1.1 alc * is here so we can give a proper type to various parameters
268 1.1 alc * (and not require everyone include the file).
269 1.1 alc *
270 1.1 alc * NB: These values are intentionally assigned for
271 1.1 alc * direct use when setting up h/w descriptors.
272 1.1 alc */
273 1.1 alc typedef enum {
274 1.1 alc HAL_PKT_TYPE_NORMAL = 0,
275 1.1 alc HAL_PKT_TYPE_ATIM = 1,
276 1.1 alc HAL_PKT_TYPE_PSPOLL = 2,
277 1.1 alc HAL_PKT_TYPE_BEACON = 3,
278 1.1 alc HAL_PKT_TYPE_PROBE_RESP = 4,
279 1.1 alc HAL_PKT_TYPE_CHIRP = 5,
280 1.1 alc HAL_PKT_TYPE_GRP_POLL = 6,
281 1.1 alc HAL_PKT_TYPE_AMPDU = 7,
282 1.1 alc } HAL_PKT_TYPE;
283 1.1 alc
284 1.1 alc /* Rx Filter Frame Types */
285 1.1 alc typedef enum {
286 1.1 alc HAL_RX_FILTER_UCAST = 0x00000001, /* Allow unicast frames */
287 1.1 alc HAL_RX_FILTER_MCAST = 0x00000002, /* Allow multicast frames */
288 1.1 alc HAL_RX_FILTER_BCAST = 0x00000004, /* Allow broadcast frames */
289 1.1 alc HAL_RX_FILTER_CONTROL = 0x00000008, /* Allow control frames */
290 1.1 alc HAL_RX_FILTER_BEACON = 0x00000010, /* Allow beacon frames */
291 1.1 alc HAL_RX_FILTER_PROM = 0x00000020, /* Promiscuous mode */
292 1.1 alc HAL_RX_FILTER_PROBEREQ = 0x00000080, /* Allow probe request frames */
293 1.1 alc HAL_RX_FILTER_PHYERR = 0x00000100, /* Allow phy errors */
294 1.1 alc HAL_RX_FILTER_PHYRADAR = 0x00000200, /* Allow phy radar errors */
295 1.1 alc HAL_RX_FILTER_COMPBAR = 0x00000400, /* Allow compressed BAR */
296 1.1 alc } HAL_RX_FILTER;
297 1.1 alc
298 1.1 alc typedef enum {
299 1.1 alc HAL_PM_AWAKE = 0,
300 1.1 alc HAL_PM_FULL_SLEEP = 1,
301 1.1 alc HAL_PM_NETWORK_SLEEP = 2,
302 1.1 alc HAL_PM_UNDEFINED = 3
303 1.1 alc } HAL_POWER_MODE;
304 1.1 alc
305 1.1 alc /*
306 1.1 alc * NOTE WELL:
307 1.1 alc * These are mapped to take advantage of the common locations for many of
308 1.1 alc * the bits on all of the currently supported MAC chips. This is to make
309 1.1 alc * the ISR as efficient as possible, while still abstracting HW differences.
310 1.1 alc * When new hardware breaks this commonality this enumerated type, as well
311 1.1 alc * as the HAL functions using it, must be modified. All values are directly
312 1.1 alc * mapped unless commented otherwise.
313 1.1 alc */
314 1.1 alc typedef enum {
315 1.1 alc HAL_INT_RX = 0x00000001, /* Non-common mapping */
316 1.1 alc HAL_INT_RXDESC = 0x00000002,
317 1.1 alc HAL_INT_RXNOFRM = 0x00000008,
318 1.1 alc HAL_INT_RXEOL = 0x00000010,
319 1.1 alc HAL_INT_RXORN = 0x00000020,
320 1.1 alc HAL_INT_TX = 0x00000040, /* Non-common mapping */
321 1.1 alc HAL_INT_TXDESC = 0x00000080,
322 1.1 alc HAL_INT_TXURN = 0x00000800,
323 1.1 alc HAL_INT_MIB = 0x00001000,
324 1.1 alc HAL_INT_RXPHY = 0x00004000,
325 1.1 alc HAL_INT_RXKCM = 0x00008000,
326 1.1 alc HAL_INT_SWBA = 0x00010000,
327 1.1 alc HAL_INT_BMISS = 0x00040000,
328 1.1 alc HAL_INT_BNR = 0x00100000, /* Non-common mapping */
329 1.1 alc HAL_INT_TIM = 0x00200000, /* Non-common mapping */
330 1.1 alc HAL_INT_DTIM = 0x00400000, /* Non-common mapping */
331 1.1 alc HAL_INT_DTIMSYNC= 0x00800000, /* Non-common mapping */
332 1.1 alc HAL_INT_GPIO = 0x01000000,
333 1.1 alc HAL_INT_CABEND = 0x02000000, /* Non-common mapping */
334 1.1 alc HAL_INT_TSFOOR = 0x04000000, /* Non-common mapping */
335 1.1 alc HAL_INT_CST = 0x10000000, /* Non-common mapping */
336 1.1 alc HAL_INT_GTT = 0x20000000, /* Non-common mapping */
337 1.1 alc HAL_INT_FATAL = 0x40000000, /* Non-common mapping */
338 1.1 alc #define HAL_INT_GLOBAL 0x80000000 /* Set/clear IER */
339 1.1 alc HAL_INT_BMISC = HAL_INT_TIM
340 1.1 alc | HAL_INT_DTIM
341 1.1 alc | HAL_INT_DTIMSYNC
342 1.1 alc | HAL_INT_CABEND,
343 1.1 alc
344 1.1 alc /* Interrupt bits that map directly to ISR/IMR bits */
345 1.1 alc HAL_INT_COMMON = HAL_INT_RXNOFRM
346 1.1 alc | HAL_INT_RXDESC
347 1.1 alc | HAL_INT_RXEOL
348 1.1 alc | HAL_INT_RXORN
349 1.1 alc | HAL_INT_TXURN
350 1.1 alc | HAL_INT_TXDESC
351 1.1 alc | HAL_INT_MIB
352 1.1 alc | HAL_INT_RXPHY
353 1.1 alc | HAL_INT_RXKCM
354 1.1 alc | HAL_INT_SWBA
355 1.1 alc | HAL_INT_BMISS
356 1.1 alc | HAL_INT_GPIO,
357 1.1 alc } HAL_INT;
358 1.1 alc
359 1.1 alc typedef enum {
360 1.1 alc HAL_RFGAIN_INACTIVE = 0,
361 1.1 alc HAL_RFGAIN_READ_REQUESTED = 1,
362 1.1 alc HAL_RFGAIN_NEED_CHANGE = 2
363 1.1 alc } HAL_RFGAIN;
364 1.1 alc
365 1.1 alc /*
366 1.1 alc * Channels are specified by frequency.
367 1.1 alc */
368 1.1 alc typedef struct {
369 1.1 alc uint32_t channelFlags; /* see below */
370 1.1 alc uint16_t channel; /* setting in Mhz */
371 1.1 alc uint8_t privFlags;
372 1.1 alc int8_t maxRegTxPower; /* max regulatory tx power in dBm */
373 1.1 alc int8_t maxTxPower; /* max true tx power in 0.5 dBm */
374 1.1 alc int8_t minTxPower; /* min true tx power in 0.5 dBm */
375 1.1 alc } HAL_CHANNEL;
376 1.1 alc
377 1.1 alc /* channelFlags */
378 1.1 alc #define CHANNEL_CW_INT 0x00002 /* CW interference detected on channel */
379 1.1 alc #define CHANNEL_TURBO 0x00010 /* Turbo Channel */
380 1.1 alc #define CHANNEL_CCK 0x00020 /* CCK channel */
381 1.1 alc #define CHANNEL_OFDM 0x00040 /* OFDM channel */
382 1.1 alc #define CHANNEL_2GHZ 0x00080 /* 2 GHz spectrum channel */
383 1.1 alc #define CHANNEL_5GHZ 0x00100 /* 5 GHz spectrum channel */
384 1.1 alc #define CHANNEL_PASSIVE 0x00200 /* Only passive scan allowed in the channel */
385 1.1 alc #define CHANNEL_DYN 0x00400 /* dynamic CCK-OFDM channel */
386 1.1 alc #define CHANNEL_STURBO 0x02000 /* Static turbo, no 11a-only usage */
387 1.1 alc #define CHANNEL_HALF 0x04000 /* Half rate channel */
388 1.1 alc #define CHANNEL_QUARTER 0x08000 /* Quarter rate channel */
389 1.1 alc #define CHANNEL_HT20 0x10000 /* 11n 20MHZ channel */
390 1.1 alc #define CHANNEL_HT40PLUS 0x20000 /* 11n 40MHZ channel w/ ext chan above */
391 1.1 alc #define CHANNEL_HT40MINUS 0x40000 /* 11n 40MHZ channel w/ ext chan below */
392 1.1 alc
393 1.1 alc /* privFlags */
394 1.1 alc #define CHANNEL_INTERFERENCE 0x01 /* Software use: channel interference
395 1.1 alc used for as AR as well as RADAR
396 1.1 alc interference detection */
397 1.1 alc #define CHANNEL_DFS 0x02 /* DFS required on channel */
398 1.1 alc #define CHANNEL_4MS_LIMIT 0x04 /* 4msec packet limit on this channel */
399 1.1 alc #define CHANNEL_DFS_CLEAR 0x08 /* if channel has been checked for DFS */
400 1.1 alc
401 1.1 alc #define CHANNEL_A (CHANNEL_5GHZ|CHANNEL_OFDM)
402 1.1 alc #define CHANNEL_B (CHANNEL_2GHZ|CHANNEL_CCK)
403 1.1 alc #define CHANNEL_PUREG (CHANNEL_2GHZ|CHANNEL_OFDM)
404 1.1 alc #ifdef notdef
405 1.1 alc #define CHANNEL_G (CHANNEL_2GHZ|CHANNEL_DYN)
406 1.1 alc #else
407 1.1 alc #define CHANNEL_G (CHANNEL_2GHZ|CHANNEL_OFDM)
408 1.1 alc #endif
409 1.1 alc #define CHANNEL_T (CHANNEL_5GHZ|CHANNEL_OFDM|CHANNEL_TURBO)
410 1.1 alc #define CHANNEL_ST (CHANNEL_T|CHANNEL_STURBO)
411 1.1 alc #define CHANNEL_108G (CHANNEL_2GHZ|CHANNEL_OFDM|CHANNEL_TURBO)
412 1.1 alc #define CHANNEL_108A CHANNEL_T
413 1.1 alc #define CHANNEL_G_HT20 (CHANNEL_G|CHANNEL_HT20)
414 1.1 alc #define CHANNEL_A_HT20 (CHANNEL_A|CHANNEL_HT20)
415 1.1 alc #define CHANNEL_G_HT40PLUS (CHANNEL_G|CHANNEL_HT40PLUS)
416 1.1 alc #define CHANNEL_G_HT40MINUS (CHANNEL_G|CHANNEL_HT40MINUS)
417 1.1 alc #define CHANNEL_A_HT40PLUS (CHANNEL_A|CHANNEL_HT40PLUS)
418 1.1 alc #define CHANNEL_A_HT40MINUS (CHANNEL_A|CHANNEL_HT40MINUS)
419 1.1 alc #define CHANNEL_ALL \
420 1.1 alc (CHANNEL_OFDM | CHANNEL_CCK| CHANNEL_2GHZ | CHANNEL_5GHZ | \
421 1.1 alc CHANNEL_TURBO | CHANNEL_HT20 | CHANNEL_HT40PLUS | CHANNEL_HT40MINUS)
422 1.1 alc #define CHANNEL_ALL_NOTURBO (CHANNEL_ALL &~ CHANNEL_TURBO)
423 1.1 alc
424 1.1 alc #define HAL_ANTENNA_MIN_MODE 0
425 1.1 alc #define HAL_ANTENNA_FIXED_A 1
426 1.1 alc #define HAL_ANTENNA_FIXED_B 2
427 1.1 alc #define HAL_ANTENNA_MAX_MODE 3
428 1.1 alc
429 1.1 alc typedef struct {
430 1.1 alc uint32_t ackrcv_bad;
431 1.1 alc uint32_t rts_bad;
432 1.1 alc uint32_t rts_good;
433 1.1 alc uint32_t fcs_bad;
434 1.1 alc uint32_t beacons;
435 1.1 alc } HAL_MIB_STATS;
436 1.1 alc
437 1.1 alc typedef uint16_t HAL_CTRY_CODE; /* country code */
438 1.1 alc typedef uint16_t HAL_REG_DOMAIN; /* regulatory domain code */
439 1.1 alc
440 1.1 alc enum {
441 1.1 alc CTRY_DEBUG = 0x1ff, /* debug country code */
442 1.1 alc CTRY_DEFAULT = 0 /* default country code */
443 1.1 alc };
444 1.1 alc
445 1.1 alc enum {
446 1.1 alc HAL_MODE_11A = 0x001, /* 11a channels */
447 1.1 alc HAL_MODE_TURBO = 0x002, /* 11a turbo-only channels */
448 1.1 alc HAL_MODE_11B = 0x004, /* 11b channels */
449 1.1 alc HAL_MODE_PUREG = 0x008, /* 11g channels (OFDM only) */
450 1.1 alc #ifdef notdef
451 1.1 alc HAL_MODE_11G = 0x010, /* 11g channels (OFDM/CCK) */
452 1.1 alc #else
453 1.1 alc HAL_MODE_11G = 0x008, /* XXX historical */
454 1.1 alc #endif
455 1.1 alc HAL_MODE_108G = 0x020, /* 11g+Turbo channels */
456 1.1 alc HAL_MODE_108A = 0x040, /* 11a+Turbo channels */
457 1.1 alc HAL_MODE_11A_HALF_RATE = 0x200, /* 11a half width channels */
458 1.1 alc HAL_MODE_11A_QUARTER_RATE = 0x400, /* 11a quarter width channels */
459 1.1 alc HAL_MODE_11G_HALF_RATE = 0x800, /* 11g half width channels */
460 1.1 alc HAL_MODE_11G_QUARTER_RATE = 0x1000, /* 11g quarter width channels */
461 1.1 alc HAL_MODE_11NG_HT20 = 0x008000,
462 1.1 alc HAL_MODE_11NA_HT20 = 0x010000,
463 1.1 alc HAL_MODE_11NG_HT40PLUS = 0x020000,
464 1.1 alc HAL_MODE_11NG_HT40MINUS = 0x040000,
465 1.1 alc HAL_MODE_11NA_HT40PLUS = 0x080000,
466 1.1 alc HAL_MODE_11NA_HT40MINUS = 0x100000,
467 1.1 alc HAL_MODE_ALL = 0xffffff
468 1.1 alc };
469 1.1 alc
470 1.1 alc typedef struct {
471 1.1 alc int rateCount; /* NB: for proper padding */
472 1.1 alc uint8_t rateCodeToIndex[144]; /* back mapping */
473 1.1 alc struct {
474 1.1 alc uint8_t valid; /* valid for rate control use */
475 1.1 alc uint8_t phy; /* CCK/OFDM/XR */
476 1.1 alc uint32_t rateKbps; /* transfer rate in kbs */
477 1.1 alc uint8_t rateCode; /* rate for h/w descriptors */
478 1.1 alc uint8_t shortPreamble; /* mask for enabling short
479 1.1 alc * preamble in CCK rate code */
480 1.1 alc uint8_t dot11Rate; /* value for supported rates
481 1.1 alc * info element of MLME */
482 1.1 alc uint8_t controlRate; /* index of next lower basic
483 1.1 alc * rate; used for dur. calcs */
484 1.1 alc uint16_t lpAckDuration; /* long preamble ACK duration */
485 1.1 alc uint16_t spAckDuration; /* short preamble ACK duration*/
486 1.1 alc } info[32];
487 1.1 alc } HAL_RATE_TABLE;
488 1.1 alc
489 1.1 alc typedef struct {
490 1.1 alc u_int rs_count; /* number of valid entries */
491 1.1 alc uint8_t rs_rates[32]; /* rates */
492 1.1 alc } HAL_RATE_SET;
493 1.1 alc
494 1.1 alc /*
495 1.1 alc * 802.11n specific structures and enums
496 1.1 alc */
497 1.1 alc typedef enum {
498 1.1 alc HAL_CHAINTYPE_TX = 1, /* Tx chain type */
499 1.1 alc HAL_CHAINTYPE_RX = 2, /* RX chain type */
500 1.1 alc } HAL_CHAIN_TYPE;
501 1.1 alc
502 1.1 alc typedef struct {
503 1.1 alc u_int Tries;
504 1.1 alc u_int Rate;
505 1.1 alc u_int PktDuration;
506 1.1 alc u_int ChSel;
507 1.1 alc u_int RateFlags;
508 1.1 alc #define HAL_RATESERIES_RTS_CTS 0x0001 /* use rts/cts w/this series */
509 1.1 alc #define HAL_RATESERIES_2040 0x0002 /* use ext channel for series */
510 1.1 alc #define HAL_RATESERIES_HALFGI 0x0004 /* use half-gi for series */
511 1.1 alc } HAL_11N_RATE_SERIES;
512 1.1 alc
513 1.1 alc typedef enum {
514 1.1 alc HAL_HT_MACMODE_20 = 0, /* 20 MHz operation */
515 1.1 alc HAL_HT_MACMODE_2040 = 1, /* 20/40 MHz operation */
516 1.1 alc } HAL_HT_MACMODE;
517 1.1 alc
518 1.1 alc typedef enum {
519 1.1 alc HAL_HT_PHYMODE_20 = 0, /* 20 MHz operation */
520 1.1 alc HAL_HT_PHYMODE_2040 = 1, /* 20/40 MHz operation */
521 1.1 alc } HAL_HT_PHYMODE;
522 1.1 alc
523 1.1 alc typedef enum {
524 1.1 alc HAL_HT_EXTPROTSPACING_20 = 0, /* 20 MHz spacing */
525 1.1 alc HAL_HT_EXTPROTSPACING_25 = 1, /* 25 MHz spacing */
526 1.1 alc } HAL_HT_EXTPROTSPACING;
527 1.1 alc
528 1.1 alc
529 1.1 alc typedef enum {
530 1.1 alc HAL_RX_CLEAR_CTL_LOW = 0x1, /* force control channel to appear busy */
531 1.1 alc HAL_RX_CLEAR_EXT_LOW = 0x2, /* force extension channel to appear busy */
532 1.1 alc } HAL_HT_RXCLEAR;
533 1.1 alc
534 1.1 alc /*
535 1.1 alc * Antenna switch control. By default antenna selection
536 1.1 alc * enables multiple (2) antenna use. To force use of the
537 1.1 alc * A or B antenna only specify a fixed setting. Fixing
538 1.1 alc * the antenna will also disable any diversity support.
539 1.1 alc */
540 1.1 alc typedef enum {
541 1.1 alc HAL_ANT_VARIABLE = 0, /* variable by programming */
542 1.1 alc HAL_ANT_FIXED_A = 1, /* fixed antenna A */
543 1.1 alc HAL_ANT_FIXED_B = 2, /* fixed antenna B */
544 1.1 alc } HAL_ANT_SETTING;
545 1.1 alc
546 1.1 alc typedef enum {
547 1.1 alc HAL_M_STA = 1, /* infrastructure station */
548 1.1 alc HAL_M_IBSS = 0, /* IBSS (adhoc) station */
549 1.1 alc HAL_M_HOSTAP = 6, /* Software Access Point */
550 1.1 alc HAL_M_MONITOR = 8 /* Monitor mode */
551 1.1 alc } HAL_OPMODE;
552 1.1 alc
553 1.1 alc typedef struct {
554 1.1 alc uint8_t kv_type; /* one of HAL_CIPHER */
555 1.1 alc uint8_t kv_pad;
556 1.1 alc uint16_t kv_len; /* length in bits */
557 1.1 alc uint8_t kv_val[16]; /* enough for 128-bit keys */
558 1.1 alc uint8_t kv_mic[8]; /* TKIP MIC key */
559 1.1 alc uint8_t kv_txmic[8]; /* TKIP TX MIC key (optional) */
560 1.1 alc } HAL_KEYVAL;
561 1.1 alc
562 1.1 alc typedef enum {
563 1.1 alc HAL_CIPHER_WEP = 0,
564 1.1 alc HAL_CIPHER_AES_OCB = 1,
565 1.1 alc HAL_CIPHER_AES_CCM = 2,
566 1.1 alc HAL_CIPHER_CKIP = 3,
567 1.1 alc HAL_CIPHER_TKIP = 4,
568 1.1 alc HAL_CIPHER_CLR = 5, /* no encryption */
569 1.1 alc
570 1.1 alc HAL_CIPHER_MIC = 127 /* TKIP-MIC, not a cipher */
571 1.1 alc } HAL_CIPHER;
572 1.1 alc
573 1.1 alc enum {
574 1.1 alc HAL_SLOT_TIME_6 = 6, /* NB: for turbo mode */
575 1.1 alc HAL_SLOT_TIME_9 = 9,
576 1.1 alc HAL_SLOT_TIME_20 = 20,
577 1.1 alc };
578 1.1 alc
579 1.1 alc /*
580 1.1 alc * Per-station beacon timer state. Note that the specified
581 1.1 alc * beacon interval (given in TU's) can also include flags
582 1.1 alc * to force a TSF reset and to enable the beacon xmit logic.
583 1.1 alc * If bs_cfpmaxduration is non-zero the hardware is setup to
584 1.1 alc * coexist with a PCF-capable AP.
585 1.1 alc */
586 1.1 alc typedef struct {
587 1.1 alc uint32_t bs_nexttbtt; /* next beacon in TU */
588 1.1 alc uint32_t bs_nextdtim; /* next DTIM in TU */
589 1.1 alc uint32_t bs_intval; /* beacon interval+flags */
590 1.1 alc #define HAL_BEACON_PERIOD 0x0000ffff /* beacon interval period */
591 1.1 alc #define HAL_BEACON_ENA 0x00800000 /* beacon xmit enable */
592 1.1 alc #define HAL_BEACON_RESET_TSF 0x01000000 /* clear TSF */
593 1.1 alc uint32_t bs_dtimperiod;
594 1.1 alc uint16_t bs_cfpperiod; /* CFP period in TU */
595 1.1 alc uint16_t bs_cfpmaxduration; /* max CFP duration in TU */
596 1.1 alc uint32_t bs_cfpnext; /* next CFP in TU */
597 1.1 alc uint16_t bs_timoffset; /* byte offset to TIM bitmap */
598 1.1 alc uint16_t bs_bmissthreshold; /* beacon miss threshold */
599 1.1 alc uint32_t bs_sleepduration; /* max sleep duration */
600 1.1 alc } HAL_BEACON_STATE;
601 1.1 alc
602 1.1 alc /*
603 1.1 alc * Like HAL_BEACON_STATE but for non-station mode setup.
604 1.1 alc * NB: see above flag definitions for bt_intval.
605 1.1 alc */
606 1.1 alc typedef struct {
607 1.1 alc uint32_t bt_intval; /* beacon interval+flags */
608 1.1 alc uint32_t bt_nexttbtt; /* next beacon in TU */
609 1.1 alc uint32_t bt_nextatim; /* next ATIM in TU */
610 1.1 alc uint32_t bt_nextdba; /* next DBA in 1/8th TU */
611 1.1 alc uint32_t bt_nextswba; /* next SWBA in 1/8th TU */
612 1.1 alc uint32_t bt_flags; /* timer enables */
613 1.1 alc #define HAL_BEACON_TBTT_EN 0x00000001
614 1.1 alc #define HAL_BEACON_DBA_EN 0x00000002
615 1.1 alc #define HAL_BEACON_SWBA_EN 0x00000004
616 1.1 alc } HAL_BEACON_TIMERS;
617 1.1 alc
618 1.1 alc /*
619 1.1 alc * Per-node statistics maintained by the driver for use in
620 1.1 alc * optimizing signal quality and other operational aspects.
621 1.1 alc */
622 1.1 alc typedef struct {
623 1.1 alc uint32_t ns_avgbrssi; /* average beacon rssi */
624 1.1 alc uint32_t ns_avgrssi; /* average data rssi */
625 1.1 alc uint32_t ns_avgtxrssi; /* average tx rssi */
626 1.1 alc } HAL_NODE_STATS;
627 1.1 alc
628 1.1 alc #define HAL_RSSI_EP_MULTIPLIER (1<<7) /* pow2 to optimize out * and / */
629 1.1 alc
630 1.1 alc struct ath_desc;
631 1.1 alc struct ath_tx_status;
632 1.1 alc struct ath_rx_status;
633 1.1 alc
634 1.1 alc /*
635 1.1 alc * Hardware Access Layer (HAL) API.
636 1.1 alc *
637 1.1 alc * Clients of the HAL call ath_hal_attach to obtain a reference to an
638 1.1 alc * ath_hal structure for use with the device. Hardware-related operations
639 1.1 alc * that follow must call back into the HAL through interface, supplying
640 1.1 alc * the reference as the first parameter. Note that before using the
641 1.1 alc * reference returned by ath_hal_attach the caller should verify the
642 1.1 alc * ABI version number.
643 1.1 alc */
644 1.1 alc struct ath_hal {
645 1.1 alc uint32_t ah_magic; /* consistency check magic number */
646 1.1 alc uint32_t ah_abi; /* HAL ABI version */
647 1.1 alc #define HAL_ABI_VERSION 0x08112800 /* YYMMDDnn */
648 1.1 alc uint16_t ah_devid; /* PCI device ID */
649 1.1 alc uint16_t ah_subvendorid; /* PCI subvendor ID */
650 1.1 alc HAL_SOFTC ah_sc; /* back pointer to driver/os state */
651 1.1 alc HAL_BUS_TAG ah_st; /* params for register r+w */
652 1.1 alc HAL_BUS_HANDLE ah_sh;
653 1.1 alc HAL_CTRY_CODE ah_countryCode;
654 1.1 alc
655 1.1 alc uint32_t ah_macVersion; /* MAC version id */
656 1.1 alc uint16_t ah_macRev; /* MAC revision */
657 1.1 alc uint16_t ah_phyRev; /* PHY revision */
658 1.1 alc /* NB: when only one radio is present the rev is in 5Ghz */
659 1.1 alc uint16_t ah_analog5GhzRev;/* 5GHz radio revision */
660 1.1 alc uint16_t ah_analog2GhzRev;/* 2GHz radio revision */
661 1.1 alc
662 1.1 alc const HAL_RATE_TABLE *__ahdecl(*ah_getRateTable)(struct ath_hal *,
663 1.1 alc u_int mode);
664 1.1 alc void __ahdecl(*ah_detach)(struct ath_hal*);
665 1.1 alc
666 1.1 alc /* Reset functions */
667 1.1 alc HAL_BOOL __ahdecl(*ah_reset)(struct ath_hal *, HAL_OPMODE,
668 1.1 alc HAL_CHANNEL *, HAL_BOOL bChannelChange,
669 1.1 alc HAL_STATUS *status);
670 1.1 alc HAL_BOOL __ahdecl(*ah_phyDisable)(struct ath_hal *);
671 1.1 alc HAL_BOOL __ahdecl(*ah_disable)(struct ath_hal *);
672 1.2 jmcneill void __ahdecl(*ah_configPCIE)(struct ath_hal *, HAL_BOOL restore);
673 1.2 jmcneill void __ahdecl(*ah_disablePCIE)(struct ath_hal *);
674 1.1 alc void __ahdecl(*ah_setPCUConfig)(struct ath_hal *);
675 1.1 alc HAL_BOOL __ahdecl(*ah_perCalibration)(struct ath_hal*, HAL_CHANNEL *,
676 1.1 alc HAL_BOOL *);
677 1.1 alc HAL_BOOL __ahdecl(*ah_perCalibrationN)(struct ath_hal *, HAL_CHANNEL *,
678 1.1 alc u_int chainMask, HAL_BOOL longCal, HAL_BOOL *isCalDone);
679 1.1 alc HAL_BOOL __ahdecl(*ah_resetCalValid)(struct ath_hal *, HAL_CHANNEL *);
680 1.3 cegger HAL_BOOL __ahdecl(*ah_setTxPower)(struct ath_hal *,
681 1.3 cegger HAL_CHANNEL *, uint16_t *);
682 1.1 alc HAL_BOOL __ahdecl(*ah_setTxPowerLimit)(struct ath_hal *, uint32_t);
683 1.3 cegger HAL_BOOL __ahdecl(*ah_setBoardValues)(struct ath_hal *,
684 1.3 cegger HAL_CHANNEL *);
685 1.1 alc
686 1.1 alc /* Transmit functions */
687 1.1 alc HAL_BOOL __ahdecl(*ah_updateTxTrigLevel)(struct ath_hal*,
688 1.1 alc HAL_BOOL incTrigLevel);
689 1.1 alc int __ahdecl(*ah_setupTxQueue)(struct ath_hal *, HAL_TX_QUEUE,
690 1.1 alc const HAL_TXQ_INFO *qInfo);
691 1.1 alc HAL_BOOL __ahdecl(*ah_setTxQueueProps)(struct ath_hal *, int q,
692 1.1 alc const HAL_TXQ_INFO *qInfo);
693 1.1 alc HAL_BOOL __ahdecl(*ah_getTxQueueProps)(struct ath_hal *, int q,
694 1.1 alc HAL_TXQ_INFO *qInfo);
695 1.1 alc HAL_BOOL __ahdecl(*ah_releaseTxQueue)(struct ath_hal *ah, u_int q);
696 1.1 alc HAL_BOOL __ahdecl(*ah_resetTxQueue)(struct ath_hal *ah, u_int q);
697 1.1 alc uint32_t __ahdecl(*ah_getTxDP)(struct ath_hal*, u_int);
698 1.1 alc HAL_BOOL __ahdecl(*ah_setTxDP)(struct ath_hal*, u_int, uint32_t txdp);
699 1.1 alc uint32_t __ahdecl(*ah_numTxPending)(struct ath_hal *, u_int q);
700 1.1 alc HAL_BOOL __ahdecl(*ah_startTxDma)(struct ath_hal*, u_int);
701 1.1 alc HAL_BOOL __ahdecl(*ah_stopTxDma)(struct ath_hal*, u_int);
702 1.1 alc HAL_BOOL __ahdecl(*ah_setupTxDesc)(struct ath_hal *, struct ath_desc *,
703 1.1 alc u_int pktLen, u_int hdrLen,
704 1.1 alc HAL_PKT_TYPE type, u_int txPower,
705 1.1 alc u_int txRate0, u_int txTries0,
706 1.1 alc u_int keyIx, u_int antMode, u_int flags,
707 1.1 alc u_int rtsctsRate, u_int rtsctsDuration,
708 1.1 alc u_int compicvLen, u_int compivLen,
709 1.1 alc u_int comp);
710 1.1 alc HAL_BOOL __ahdecl(*ah_setupXTxDesc)(struct ath_hal *, struct ath_desc*,
711 1.1 alc u_int txRate1, u_int txTries1,
712 1.1 alc u_int txRate2, u_int txTries2,
713 1.1 alc u_int txRate3, u_int txTries3);
714 1.1 alc HAL_BOOL __ahdecl(*ah_fillTxDesc)(struct ath_hal *, struct ath_desc *,
715 1.1 alc u_int segLen, HAL_BOOL firstSeg,
716 1.1 alc HAL_BOOL lastSeg, const struct ath_desc *);
717 1.1 alc HAL_STATUS __ahdecl(*ah_procTxDesc)(struct ath_hal *,
718 1.1 alc struct ath_desc *, struct ath_tx_status *);
719 1.1 alc void __ahdecl(*ah_getTxIntrQueue)(struct ath_hal *, uint32_t *);
720 1.1 alc void __ahdecl(*ah_reqTxIntrDesc)(struct ath_hal *, struct ath_desc*);
721 1.1 alc
722 1.1 alc /* Receive Functions */
723 1.1 alc uint32_t __ahdecl(*ah_getRxDP)(struct ath_hal*);
724 1.1 alc void __ahdecl(*ah_setRxDP)(struct ath_hal*, uint32_t rxdp);
725 1.1 alc void __ahdecl(*ah_enableReceive)(struct ath_hal*);
726 1.1 alc HAL_BOOL __ahdecl(*ah_stopDmaReceive)(struct ath_hal*);
727 1.1 alc void __ahdecl(*ah_startPcuReceive)(struct ath_hal*);
728 1.1 alc void __ahdecl(*ah_stopPcuReceive)(struct ath_hal*);
729 1.1 alc void __ahdecl(*ah_setMulticastFilter)(struct ath_hal*,
730 1.1 alc uint32_t filter0, uint32_t filter1);
731 1.1 alc HAL_BOOL __ahdecl(*ah_setMulticastFilterIndex)(struct ath_hal*,
732 1.1 alc uint32_t index);
733 1.1 alc HAL_BOOL __ahdecl(*ah_clrMulticastFilterIndex)(struct ath_hal*,
734 1.1 alc uint32_t index);
735 1.1 alc uint32_t __ahdecl(*ah_getRxFilter)(struct ath_hal*);
736 1.1 alc void __ahdecl(*ah_setRxFilter)(struct ath_hal*, uint32_t);
737 1.1 alc HAL_BOOL __ahdecl(*ah_setupRxDesc)(struct ath_hal *, struct ath_desc *,
738 1.1 alc uint32_t size, u_int flags);
739 1.1 alc HAL_STATUS __ahdecl(*ah_procRxDesc)(struct ath_hal *,
740 1.1 alc struct ath_desc *, uint32_t phyAddr,
741 1.1 alc struct ath_desc *next, uint64_t tsf,
742 1.1 alc struct ath_rx_status *);
743 1.1 alc void __ahdecl(*ah_rxMonitor)(struct ath_hal *,
744 1.1 alc const HAL_NODE_STATS *, HAL_CHANNEL *);
745 1.1 alc void __ahdecl(*ah_procMibEvent)(struct ath_hal *,
746 1.1 alc const HAL_NODE_STATS *);
747 1.1 alc
748 1.1 alc /* Misc Functions */
749 1.1 alc HAL_STATUS __ahdecl(*ah_getCapability)(struct ath_hal *,
750 1.1 alc HAL_CAPABILITY_TYPE, uint32_t capability,
751 1.1 alc uint32_t *result);
752 1.1 alc HAL_BOOL __ahdecl(*ah_setCapability)(struct ath_hal *,
753 1.1 alc HAL_CAPABILITY_TYPE, uint32_t capability,
754 1.1 alc uint32_t setting, HAL_STATUS *);
755 1.1 alc HAL_BOOL __ahdecl(*ah_getDiagState)(struct ath_hal *, int request,
756 1.1 alc const void *args, uint32_t argsize,
757 1.1 alc void **result, uint32_t *resultsize);
758 1.1 alc void __ahdecl(*ah_getMacAddress)(struct ath_hal *, uint8_t *);
759 1.1 alc HAL_BOOL __ahdecl(*ah_setMacAddress)(struct ath_hal *, const uint8_t*);
760 1.1 alc void __ahdecl(*ah_getBssIdMask)(struct ath_hal *, uint8_t *);
761 1.1 alc HAL_BOOL __ahdecl(*ah_setBssIdMask)(struct ath_hal *, const uint8_t*);
762 1.1 alc HAL_BOOL __ahdecl(*ah_setRegulatoryDomain)(struct ath_hal*,
763 1.1 alc uint16_t, HAL_STATUS *);
764 1.1 alc void __ahdecl(*ah_setLedState)(struct ath_hal*, HAL_LED_STATE);
765 1.1 alc void __ahdecl(*ah_writeAssocid)(struct ath_hal*,
766 1.1 alc const uint8_t *bssid, uint16_t assocId);
767 1.1 alc HAL_BOOL __ahdecl(*ah_gpioCfgOutput)(struct ath_hal *, uint32_t gpio);
768 1.1 alc HAL_BOOL __ahdecl(*ah_gpioCfgInput)(struct ath_hal *, uint32_t gpio);
769 1.1 alc uint32_t __ahdecl(*ah_gpioGet)(struct ath_hal *, uint32_t gpio);
770 1.1 alc HAL_BOOL __ahdecl(*ah_gpioSet)(struct ath_hal *,
771 1.1 alc uint32_t gpio, uint32_t val);
772 1.1 alc void __ahdecl(*ah_gpioSetIntr)(struct ath_hal*, u_int, uint32_t);
773 1.1 alc uint32_t __ahdecl(*ah_getTsf32)(struct ath_hal*);
774 1.1 alc uint64_t __ahdecl(*ah_getTsf64)(struct ath_hal*);
775 1.1 alc void __ahdecl(*ah_resetTsf)(struct ath_hal*);
776 1.1 alc HAL_BOOL __ahdecl(*ah_detectCardPresent)(struct ath_hal*);
777 1.1 alc void __ahdecl(*ah_updateMibCounters)(struct ath_hal*,
778 1.1 alc HAL_MIB_STATS*);
779 1.1 alc HAL_RFGAIN __ahdecl(*ah_getRfGain)(struct ath_hal*);
780 1.1 alc u_int __ahdecl(*ah_getDefAntenna)(struct ath_hal*);
781 1.1 alc void __ahdecl(*ah_setDefAntenna)(struct ath_hal*, u_int);
782 1.1 alc HAL_ANT_SETTING __ahdecl(*ah_getAntennaSwitch)(struct ath_hal*);
783 1.1 alc HAL_BOOL __ahdecl(*ah_setAntennaSwitch)(struct ath_hal*,
784 1.1 alc HAL_ANT_SETTING);
785 1.1 alc HAL_BOOL __ahdecl(*ah_setSifsTime)(struct ath_hal*, u_int);
786 1.1 alc u_int __ahdecl(*ah_getSifsTime)(struct ath_hal*);
787 1.1 alc HAL_BOOL __ahdecl(*ah_setSlotTime)(struct ath_hal*, u_int);
788 1.1 alc u_int __ahdecl(*ah_getSlotTime)(struct ath_hal*);
789 1.1 alc HAL_BOOL __ahdecl(*ah_setAckTimeout)(struct ath_hal*, u_int);
790 1.1 alc u_int __ahdecl(*ah_getAckTimeout)(struct ath_hal*);
791 1.1 alc HAL_BOOL __ahdecl(*ah_setAckCTSRate)(struct ath_hal*, u_int);
792 1.1 alc u_int __ahdecl(*ah_getAckCTSRate)(struct ath_hal*);
793 1.1 alc HAL_BOOL __ahdecl(*ah_setCTSTimeout)(struct ath_hal*, u_int);
794 1.1 alc u_int __ahdecl(*ah_getCTSTimeout)(struct ath_hal*);
795 1.1 alc HAL_BOOL __ahdecl(*ah_setDecompMask)(struct ath_hal*, uint16_t, int);
796 1.1 alc void __ahdecl(*ah_setCoverageClass)(struct ath_hal*, uint8_t, int);
797 1.1 alc
798 1.1 alc /* Key Cache Functions */
799 1.1 alc uint32_t __ahdecl(*ah_getKeyCacheSize)(struct ath_hal*);
800 1.1 alc HAL_BOOL __ahdecl(*ah_resetKeyCacheEntry)(struct ath_hal*, uint16_t);
801 1.1 alc HAL_BOOL __ahdecl(*ah_isKeyCacheEntryValid)(struct ath_hal *,
802 1.1 alc uint16_t);
803 1.1 alc HAL_BOOL __ahdecl(*ah_setKeyCacheEntry)(struct ath_hal*,
804 1.1 alc uint16_t, const HAL_KEYVAL *,
805 1.1 alc const uint8_t *, int);
806 1.1 alc HAL_BOOL __ahdecl(*ah_setKeyCacheEntryMac)(struct ath_hal*,
807 1.1 alc uint16_t, const uint8_t *);
808 1.1 alc
809 1.1 alc /* Power Management Functions */
810 1.1 alc HAL_BOOL __ahdecl(*ah_setPowerMode)(struct ath_hal*,
811 1.1 alc HAL_POWER_MODE mode, int setChip);
812 1.1 alc HAL_POWER_MODE __ahdecl(*ah_getPowerMode)(struct ath_hal*);
813 1.1 alc int16_t __ahdecl(*ah_getChanNoise)(struct ath_hal *, HAL_CHANNEL *);
814 1.1 alc
815 1.1 alc /* Beacon Management Functions */
816 1.1 alc void __ahdecl(*ah_setBeaconTimers)(struct ath_hal*,
817 1.1 alc const HAL_BEACON_TIMERS *);
818 1.1 alc /* NB: deprecated, use ah_setBeaconTimers instead */
819 1.1 alc void __ahdecl(*ah_beaconInit)(struct ath_hal *,
820 1.1 alc uint32_t nexttbtt, uint32_t intval);
821 1.1 alc void __ahdecl(*ah_setStationBeaconTimers)(struct ath_hal*,
822 1.1 alc const HAL_BEACON_STATE *);
823 1.1 alc void __ahdecl(*ah_resetStationBeaconTimers)(struct ath_hal*);
824 1.1 alc
825 1.1 alc /* Interrupt functions */
826 1.1 alc HAL_BOOL __ahdecl(*ah_isInterruptPending)(struct ath_hal*);
827 1.1 alc HAL_BOOL __ahdecl(*ah_getPendingInterrupts)(struct ath_hal*, HAL_INT*);
828 1.1 alc HAL_INT __ahdecl(*ah_getInterrupts)(struct ath_hal*);
829 1.1 alc HAL_INT __ahdecl(*ah_setInterrupts)(struct ath_hal*, HAL_INT);
830 1.1 alc };
831 1.1 alc
832 1.1 alc /*
833 1.1 alc * Check the PCI vendor ID and device ID against Atheros' values
834 1.1 alc * and return a printable description for any Atheros hardware.
835 1.1 alc * AH_NULL is returned if the ID's do not describe Atheros hardware.
836 1.1 alc */
837 1.1 alc extern const char *__ahdecl ath_hal_probe(uint16_t vendorid, uint16_t devid);
838 1.1 alc
839 1.1 alc /*
840 1.1 alc * Attach the HAL for use with the specified device. The device is
841 1.1 alc * defined by the PCI device ID. The caller provides an opaque pointer
842 1.1 alc * to an upper-layer data structure (HAL_SOFTC) that is stored in the
843 1.1 alc * HAL state block for later use. Hardware register accesses are done
844 1.1 alc * using the specified bus tag and handle. On successful return a
845 1.1 alc * reference to a state block is returned that must be supplied in all
846 1.1 alc * subsequent HAL calls. Storage associated with this reference is
847 1.1 alc * dynamically allocated and must be freed by calling the ah_detach
848 1.1 alc * method when the client is done. If the attach operation fails a
849 1.1 alc * null (AH_NULL) reference will be returned and a status code will
850 1.1 alc * be returned if the status parameter is non-zero.
851 1.1 alc */
852 1.1 alc extern struct ath_hal * __ahdecl ath_hal_attach(uint16_t devid, HAL_SOFTC,
853 1.1 alc HAL_BUS_TAG, HAL_BUS_HANDLE, HAL_STATUS* status);
854 1.1 alc
855 1.1 alc /*
856 1.1 alc * Return a list of channels available for use with the hardware.
857 1.1 alc * The list is based on what the hardware is capable of, the specified
858 1.1 alc * country code, the modeSelect mask, and whether or not outdoor
859 1.1 alc * channels are to be permitted.
860 1.1 alc *
861 1.1 alc * The channel list is returned in the supplied array. maxchans
862 1.1 alc * defines the maximum size of this array. nchans contains the actual
863 1.1 alc * number of channels returned. If a problem occurred or there were
864 1.1 alc * no channels that met the criteria then AH_FALSE is returned.
865 1.1 alc */
866 1.1 alc extern HAL_BOOL __ahdecl ath_hal_init_channels(struct ath_hal *,
867 1.1 alc HAL_CHANNEL *chans, u_int maxchans, u_int *nchans,
868 1.1 alc uint8_t *regclassids, u_int maxregids, u_int *nregids,
869 1.1 alc HAL_CTRY_CODE cc, u_int modeSelect,
870 1.1 alc HAL_BOOL enableOutdoor, HAL_BOOL enableExtendedChannels);
871 1.1 alc
872 1.1 alc /*
873 1.1 alc * Calibrate noise floor data following a channel scan or similar.
874 1.1 alc * This must be called prior retrieving noise floor data.
875 1.1 alc */
876 1.1 alc extern void __ahdecl ath_hal_process_noisefloor(struct ath_hal *ah);
877 1.1 alc
878 1.1 alc /*
879 1.1 alc * Return bit mask of wireless modes supported by the hardware.
880 1.1 alc */
881 1.1 alc extern u_int __ahdecl ath_hal_getwirelessmodes(struct ath_hal*, HAL_CTRY_CODE);
882 1.1 alc
883 1.1 alc /*
884 1.1 alc * Calculate the transmit duration of a frame.
885 1.1 alc */
886 1.1 alc extern uint16_t __ahdecl ath_hal_computetxtime(struct ath_hal *,
887 1.1 alc const HAL_RATE_TABLE *rates, uint32_t frameLen,
888 1.1 alc uint16_t rateix, HAL_BOOL shortPreamble);
889 1.1 alc
890 1.1 alc /*
891 1.1 alc * Return if device is public safety.
892 1.1 alc */
893 1.1 alc extern HAL_BOOL __ahdecl ath_hal_ispublicsafetysku(struct ath_hal *);
894 1.1 alc
895 1.1 alc /*
896 1.1 alc * Return if device is operating in 900 MHz band.
897 1.1 alc */
898 1.1 alc extern HAL_BOOL ath_hal_isgsmsku(struct ath_hal *);
899 1.1 alc
900 1.1 alc /*
901 1.1 alc * Convert between IEEE channel number and channel frequency
902 1.1 alc * using the specified channel flags; e.g. CHANNEL_2GHZ.
903 1.1 alc */
904 1.1 alc extern int __ahdecl ath_hal_mhz2ieee(struct ath_hal *, u_int mhz, u_int flags);
905 1.1 alc #endif /* _ATH_AH_H_ */
906