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