Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / devs / networks / atheros5000 / hal / ar5210 / ar5210_xmit.c
blob399d9492235dab5bfce6c5a8561b7b2ede71ff80
1 /*
2 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3 * Copyright (c) 2002-2004 Atheros Communications, Inc.
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 * $Id$
19 #include "opt_ah.h"
21 #ifdef AH_SUPPORT_AR5210
23 #include "ah.h"
24 #include "ah_internal.h"
25 #include "ah_desc.h"
27 #include "ar5210/ar5210.h"
28 #include "ar5210/ar5210reg.h"
29 #include "ar5210/ar5210phy.h"
30 #include "ar5210/ar5210desc.h"
33 * Set the properties of the tx queue with the parameters
34 * from qInfo. The queue must previously have been setup
35 * with a call to ar5210SetupTxQueue.
37 HAL_BOOL
38 ar5210SetTxQueueProps(struct ath_hal *ah, int q, const HAL_TXQ_INFO *qInfo)
40 struct ath_hal_5210 *ahp = AH5210(ah);
42 if (q >= HAL_NUM_TX_QUEUES) {
43 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: invalid queue num %u\n",
44 __func__, q);
45 return AH_FALSE;
47 return ath_hal_setTxQProps(ah, &ahp->ah_txq[q], qInfo);
51 * Return the properties for the specified tx queue.
53 HAL_BOOL
54 ar5210GetTxQueueProps(struct ath_hal *ah, int q, HAL_TXQ_INFO *qInfo)
56 struct ath_hal_5210 *ahp = AH5210(ah);
58 if (q >= HAL_NUM_TX_QUEUES) {
59 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: invalid queue num %u\n",
60 __func__, q);
61 return AH_FALSE;
63 return ath_hal_getTxQProps(ah, qInfo, &ahp->ah_txq[q]);
67 * Allocate and initialize a tx DCU/QCU combination.
69 int
70 ar5210SetupTxQueue(struct ath_hal *ah, HAL_TX_QUEUE type,
71 const HAL_TXQ_INFO *qInfo)
73 struct ath_hal_5210 *ahp = AH5210(ah);
74 HAL_TX_QUEUE_INFO *qi;
75 int q;
77 switch (type) {
78 case HAL_TX_QUEUE_BEACON:
79 q = 2;
80 break;
81 case HAL_TX_QUEUE_CAB:
82 q = 1;
83 break;
84 case HAL_TX_QUEUE_DATA:
85 q = 0;
86 break;
87 default:
88 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: bad tx queue type %u\n",
89 __func__, type);
90 return -1;
93 HALDEBUG(ah, HAL_DEBUG_TXQUEUE, "%s: queue %u\n", __func__, q);
95 qi = &ahp->ah_txq[q];
96 if (qi->tqi_type != HAL_TX_QUEUE_INACTIVE) {
97 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: tx queue %u already active\n",
98 __func__, q);
99 return -1;
101 OS_MEMZERO(qi, sizeof(HAL_TX_QUEUE_INFO));
102 qi->tqi_type = type;
103 if (qInfo == AH_NULL) {
104 /* by default enable OK+ERR+DESC+URN interrupts */
105 qi->tqi_qflags =
106 HAL_TXQ_TXOKINT_ENABLE
107 | HAL_TXQ_TXERRINT_ENABLE
108 | HAL_TXQ_TXDESCINT_ENABLE
109 | HAL_TXQ_TXURNINT_ENABLE
111 qi->tqi_aifs = INIT_AIFS;
112 qi->tqi_cwmin = HAL_TXQ_USEDEFAULT; /* NB: do at reset */
113 qi->tqi_shretry = INIT_SH_RETRY;
114 qi->tqi_lgretry = INIT_LG_RETRY;
115 } else
116 (void) ar5210SetTxQueueProps(ah, q, qInfo);
117 /* NB: must be followed by ar5210ResetTxQueue */
118 return q;
122 * Free a tx DCU/QCU combination.
124 HAL_BOOL
125 ar5210ReleaseTxQueue(struct ath_hal *ah, u_int q)
127 struct ath_hal_5210 *ahp = AH5210(ah);
128 HAL_TX_QUEUE_INFO *qi;
130 if (q >= HAL_NUM_TX_QUEUES) {
131 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: invalid queue num %u\n",
132 __func__, q);
133 return AH_FALSE;
135 qi = &ahp->ah_txq[q];
136 if (qi->tqi_type == HAL_TX_QUEUE_INACTIVE) {
137 HALDEBUG(ah, HAL_DEBUG_TXQUEUE, "%s: inactive queue %u\n",
138 __func__, q);
139 return AH_FALSE;
142 HALDEBUG(ah, HAL_DEBUG_TXQUEUE, "%s: release queue %u\n", __func__, q);
144 qi->tqi_type = HAL_TX_QUEUE_INACTIVE;
145 ahp->ah_txOkInterruptMask &= ~(1 << q);
146 ahp->ah_txErrInterruptMask &= ~(1 << q);
147 ahp->ah_txDescInterruptMask &= ~(1 << q);
148 ahp->ah_txEolInterruptMask &= ~(1 << q);
149 ahp->ah_txUrnInterruptMask &= ~(1 << q);
151 return AH_TRUE;
152 #undef N
155 HAL_BOOL
156 ar5210ResetTxQueue(struct ath_hal *ah, u_int q)
158 struct ath_hal_5210 *ahp = AH5210(ah);
159 HAL_CHANNEL_INTERNAL *chan = AH_PRIVATE(ah)->ah_curchan;
160 HAL_TX_QUEUE_INFO *qi;
161 uint32_t cwMin;
163 if (q >= HAL_NUM_TX_QUEUES) {
164 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: invalid queue num %u\n",
165 __func__, q);
166 return AH_FALSE;
168 qi = &ahp->ah_txq[q];
169 if (qi->tqi_type == HAL_TX_QUEUE_INACTIVE) {
170 HALDEBUG(ah, HAL_DEBUG_TXQUEUE, "%s: inactive queue %u\n",
171 __func__, q);
172 return AH_FALSE;
176 * Ignore any non-data queue(s).
178 if (qi->tqi_type != HAL_TX_QUEUE_DATA)
179 return AH_TRUE;
181 /* Set turbo mode / base mode parameters on or off */
182 if (IS_CHAN_TURBO(chan)) {
183 OS_REG_WRITE(ah, AR_SLOT_TIME, INIT_SLOT_TIME_TURBO);
184 OS_REG_WRITE(ah, AR_TIME_OUT, INIT_ACK_CTS_TIMEOUT_TURBO);
185 OS_REG_WRITE(ah, AR_USEC, INIT_TRANSMIT_LATENCY_TURBO);
186 OS_REG_WRITE(ah, AR_IFS0,
187 ((INIT_SIFS_TURBO + qi->tqi_aifs * INIT_SLOT_TIME_TURBO)
188 << AR_IFS0_DIFS_S)
189 | INIT_SIFS_TURBO);
190 OS_REG_WRITE(ah, AR_IFS1, INIT_PROTO_TIME_CNTRL_TURBO);
191 OS_REG_WRITE(ah, AR_PHY(17),
192 (OS_REG_READ(ah, AR_PHY(17)) & ~0x7F) | 0x38);
193 OS_REG_WRITE(ah, AR_PHY_FRCTL,
194 AR_PHY_SERVICE_ERR | AR_PHY_TXURN_ERR |
195 AR_PHY_ILLLEN_ERR | AR_PHY_ILLRATE_ERR |
196 AR_PHY_PARITY_ERR | AR_PHY_TIMING_ERR |
197 0x2020 |
198 AR_PHY_TURBO_MODE | AR_PHY_TURBO_SHORT);
199 } else {
200 OS_REG_WRITE(ah, AR_SLOT_TIME, INIT_SLOT_TIME);
201 OS_REG_WRITE(ah, AR_TIME_OUT, INIT_ACK_CTS_TIMEOUT);
202 OS_REG_WRITE(ah, AR_USEC, INIT_TRANSMIT_LATENCY);
203 OS_REG_WRITE(ah, AR_IFS0,
204 ((INIT_SIFS + qi->tqi_aifs * INIT_SLOT_TIME)
205 << AR_IFS0_DIFS_S)
206 | INIT_SIFS);
207 OS_REG_WRITE(ah, AR_IFS1, INIT_PROTO_TIME_CNTRL);
208 OS_REG_WRITE(ah, AR_PHY(17),
209 (OS_REG_READ(ah, AR_PHY(17)) & ~0x7F) | 0x1C);
210 OS_REG_WRITE(ah, AR_PHY_FRCTL,
211 AR_PHY_SERVICE_ERR | AR_PHY_TXURN_ERR |
212 AR_PHY_ILLLEN_ERR | AR_PHY_ILLRATE_ERR |
213 AR_PHY_PARITY_ERR | AR_PHY_TIMING_ERR | 0x1020);
216 if (qi->tqi_cwmin == HAL_TXQ_USEDEFAULT)
217 cwMin = INIT_CWMIN;
218 else
219 cwMin = qi->tqi_cwmin;
221 /* Set cwmin and retry limit values */
222 OS_REG_WRITE(ah, AR_RETRY_LMT,
223 (cwMin << AR_RETRY_LMT_CW_MIN_S)
224 | SM(INIT_SLG_RETRY, AR_RETRY_LMT_SLG_RETRY)
225 | SM(INIT_SSH_RETRY, AR_RETRY_LMT_SSH_RETRY)
226 | SM(qi->tqi_lgretry, AR_RETRY_LMT_LG_RETRY)
227 | SM(qi->tqi_shretry, AR_RETRY_LMT_SH_RETRY)
230 if (qi->tqi_qflags & HAL_TXQ_TXOKINT_ENABLE)
231 ahp->ah_txOkInterruptMask |= 1 << q;
232 else
233 ahp->ah_txOkInterruptMask &= ~(1 << q);
234 if (qi->tqi_qflags & HAL_TXQ_TXERRINT_ENABLE)
235 ahp->ah_txErrInterruptMask |= 1 << q;
236 else
237 ahp->ah_txErrInterruptMask &= ~(1 << q);
238 if (qi->tqi_qflags & HAL_TXQ_TXDESCINT_ENABLE)
239 ahp->ah_txDescInterruptMask |= 1 << q;
240 else
241 ahp->ah_txDescInterruptMask &= ~(1 << q);
242 if (qi->tqi_qflags & HAL_TXQ_TXEOLINT_ENABLE)
243 ahp->ah_txEolInterruptMask |= 1 << q;
244 else
245 ahp->ah_txEolInterruptMask &= ~(1 << q);
246 if (qi->tqi_qflags & HAL_TXQ_TXURNINT_ENABLE)
247 ahp->ah_txUrnInterruptMask |= 1 << q;
248 else
249 ahp->ah_txUrnInterruptMask &= ~(1 << q);
251 return AH_TRUE;
255 * Get the TXDP for the "main" data queue. Needs to be extended
256 * for multiple Q functionality
258 uint32_t
259 ar5210GetTxDP(struct ath_hal *ah, u_int q)
261 struct ath_hal_5210 *ahp = AH5210(ah);
262 HAL_TX_QUEUE_INFO *qi;
264 HALASSERT(q < HAL_NUM_TX_QUEUES);
266 qi = &ahp->ah_txq[q];
267 switch (qi->tqi_type) {
268 case HAL_TX_QUEUE_DATA:
269 return OS_REG_READ(ah, AR_TXDP0);
270 case HAL_TX_QUEUE_INACTIVE:
271 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: inactive queue %u\n",
272 __func__, q);
273 /* fall thru... */
274 default:
275 break;
277 return 0xffffffff;
281 * Set the TxDP for the "main" data queue.
283 HAL_BOOL
284 ar5210SetTxDP(struct ath_hal *ah, u_int q, uint32_t txdp)
286 struct ath_hal_5210 *ahp = AH5210(ah);
287 HAL_TX_QUEUE_INFO *qi;
289 HALASSERT(q < HAL_NUM_TX_QUEUES);
291 HALDEBUG(ah, HAL_DEBUG_TXQUEUE, "%s: queue %u 0x%x\n",
292 __func__, q, txdp);
293 qi = &ahp->ah_txq[q];
294 switch (qi->tqi_type) {
295 case HAL_TX_QUEUE_DATA:
296 #ifdef AH_DEBUG
298 * Make sure that TXE is deasserted before setting the
299 * TXDP. If TXE is still asserted, setting TXDP will
300 * have no effect.
302 if (OS_REG_READ(ah, AR_CR) & AR_CR_TXE0)
303 ath_hal_printf(ah, "%s: TXE asserted; AR_CR=0x%x\n",
304 __func__, OS_REG_READ(ah, AR_CR));
305 #endif
306 OS_REG_WRITE(ah, AR_TXDP0, txdp);
307 break;
308 case HAL_TX_QUEUE_BEACON:
309 case HAL_TX_QUEUE_CAB:
310 OS_REG_WRITE(ah, AR_TXDP1, txdp);
311 break;
312 case HAL_TX_QUEUE_INACTIVE:
313 HALDEBUG(ah, HAL_DEBUG_TXQUEUE, "%s: inactive queue %u\n",
314 __func__, q);
315 /* fall thru... */
316 default:
317 return AH_FALSE;
319 return AH_TRUE;
323 * Update Tx FIFO trigger level.
325 * Set bIncTrigLevel to TRUE to increase the trigger level.
326 * Set bIncTrigLevel to FALSE to decrease the trigger level.
328 * Returns TRUE if the trigger level was updated
330 HAL_BOOL
331 ar5210UpdateTxTrigLevel(struct ath_hal *ah, HAL_BOOL bIncTrigLevel)
333 uint32_t curTrigLevel;
334 HAL_INT ints = ar5210GetInterrupts(ah);
337 * Disable chip interrupts. This is because halUpdateTxTrigLevel
338 * is called from both ISR and non-ISR contexts.
340 (void) ar5210SetInterrupts(ah, ints &~ HAL_INT_GLOBAL);
341 curTrigLevel = OS_REG_READ(ah, AR_TRIG_LEV);
342 if (bIncTrigLevel){
343 /* increase the trigger level */
344 curTrigLevel = curTrigLevel +
345 ((MAX_TX_FIFO_THRESHOLD - curTrigLevel) / 2);
346 } else {
347 /* decrease the trigger level if not already at the minimum */
348 if (curTrigLevel > MIN_TX_FIFO_THRESHOLD) {
349 /* decrease the trigger level */
350 curTrigLevel--;
351 } else {
352 /* no update to the trigger level */
353 /* re-enable chip interrupts */
354 ar5210SetInterrupts(ah, ints);
355 return AH_FALSE;
358 /* Update the trigger level */
359 OS_REG_WRITE(ah, AR_TRIG_LEV, curTrigLevel);
360 /* re-enable chip interrupts */
361 ar5210SetInterrupts(ah, ints);
362 return AH_TRUE;
366 * Set Transmit Enable bits for the specified queues.
368 HAL_BOOL
369 ar5210StartTxDma(struct ath_hal *ah, u_int q)
371 struct ath_hal_5210 *ahp = AH5210(ah);
372 HAL_TX_QUEUE_INFO *qi;
374 HALASSERT(q < HAL_NUM_TX_QUEUES);
376 HALDEBUG(ah, HAL_DEBUG_TXQUEUE, "%s: queue %u\n", __func__, q);
377 qi = &ahp->ah_txq[q];
378 switch (qi->tqi_type) {
379 case HAL_TX_QUEUE_DATA:
380 OS_REG_WRITE(ah, AR_CR, AR_CR_TXE0);
381 break;
382 case HAL_TX_QUEUE_CAB:
383 OS_REG_WRITE(ah, AR_CR, AR_CR_TXE1); /* enable altq xmit */
384 OS_REG_WRITE(ah, AR_BCR,
385 AR_BCR_TQ1V | AR_BCR_BDMAE | AR_BCR_TQ1FV);
386 break;
387 case HAL_TX_QUEUE_BEACON:
388 /* XXX add CR_BCR_BCMD if IBSS mode */
389 OS_REG_WRITE(ah, AR_BCR, AR_BCR_TQ1V | AR_BCR_BDMAE);
390 break;
391 case HAL_TX_QUEUE_INACTIVE:
392 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: inactive queue %u\n",
393 __func__, q);
394 /* fal thru... */
395 default:
396 return AH_FALSE;
398 return AH_TRUE;
401 uint32_t
402 ar5210NumTxPending(struct ath_hal *ah, u_int q)
404 struct ath_hal_5210 *ahp = AH5210(ah);
405 HAL_TX_QUEUE_INFO *qi;
406 uint32_t v;
408 HALASSERT(q < HAL_NUM_TX_QUEUES);
410 HALDEBUG(ah, HAL_DEBUG_TXQUEUE, "%s: queue %u\n", __func__, q);
411 qi = &ahp->ah_txq[q];
412 switch (qi->tqi_type) {
413 case HAL_TX_QUEUE_DATA:
414 v = OS_REG_READ(ah, AR_CFG);
415 return MS(v, AR_CFG_TXCNT);
416 case HAL_TX_QUEUE_INACTIVE:
417 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: inactive queue %u\n",
418 __func__, q);
419 /* fall thru... */
420 default:
421 break;
423 return 0;
427 * Stop transmit on the specified queue
429 HAL_BOOL
430 ar5210StopTxDma(struct ath_hal *ah, u_int q)
432 struct ath_hal_5210 *ahp = AH5210(ah);
433 HAL_TX_QUEUE_INFO *qi;
435 HALASSERT(q < HAL_NUM_TX_QUEUES);
437 HALDEBUG(ah, HAL_DEBUG_TXQUEUE, "%s: queue %u\n", __func__, q);
438 qi = &ahp->ah_txq[q];
439 switch (qi->tqi_type) {
440 case HAL_TX_QUEUE_DATA: {
441 int i;
442 OS_REG_WRITE(ah, AR_CR, AR_CR_TXD0);
443 for (i = 0; i < 1000; i++) {
444 if ((OS_REG_READ(ah, AR_CFG) & AR_CFG_TXCNT) == 0)
445 break;
446 OS_DELAY(10);
448 OS_REG_WRITE(ah, AR_CR, 0);
449 return (i < 1000);
451 case HAL_TX_QUEUE_BEACON:
452 return ath_hal_wait(ah, AR_BSR, AR_BSR_TXQ1F, 0);
453 case HAL_TX_QUEUE_INACTIVE:
454 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: inactive queue %u\n",
455 __func__, q);
456 /* fall thru... */
457 default:
458 break;
460 return AH_FALSE;
464 * Descriptor Access Functions
467 #define VALID_PKT_TYPES \
468 ((1<<HAL_PKT_TYPE_NORMAL)|(1<<HAL_PKT_TYPE_ATIM)|\
469 (1<<HAL_PKT_TYPE_PSPOLL)|(1<<HAL_PKT_TYPE_PROBE_RESP)|\
470 (1<<HAL_PKT_TYPE_BEACON))
471 #define isValidPktType(_t) ((1<<(_t)) & VALID_PKT_TYPES)
472 #define VALID_TX_RATES \
473 ((1<<0x0b)|(1<<0x0f)|(1<<0x0a)|(1<<0x0e)|(1<<0x09)|(1<<0x0d)|\
474 (1<<0x08)|(1<<0x0c)|(1<<0x1b)|(1<<0x1a)|(1<<0x1e)|(1<<0x19)|\
475 (1<<0x1d)|(1<<0x18)|(1<<0x1c))
476 #define isValidTxRate(_r) ((1<<(_r)) & VALID_TX_RATES)
478 HAL_BOOL
479 ar5210SetupTxDesc(struct ath_hal *ah, struct ath_desc *ds,
480 u_int pktLen,
481 u_int hdrLen,
482 HAL_PKT_TYPE type,
483 u_int txPower,
484 u_int txRate0, u_int txTries0,
485 u_int keyIx,
486 u_int antMode,
487 u_int flags,
488 u_int rtsctsRate,
489 u_int rtsctsDuration,
490 u_int compicvLen,
491 u_int compivLen,
492 u_int comp)
494 struct ar5210_desc *ads = AR5210DESC(ds);
495 uint32_t frtype;
497 (void) txPower;
498 (void) rtsctsDuration;
500 HALASSERT(txTries0 != 0);
501 HALASSERT(isValidPktType(type));
502 HALASSERT(isValidTxRate(txRate0));
504 if (type == HAL_PKT_TYPE_BEACON || type == HAL_PKT_TYPE_PROBE_RESP)
505 frtype = AR_Frm_NoDelay;
506 else
507 frtype = type << 26;
508 ads->ds_ctl0 = (pktLen & AR_FrameLen)
509 | (txRate0 << AR_XmitRate_S)
510 | ((hdrLen << AR_HdrLen_S) & AR_HdrLen)
511 | frtype
512 | (flags & HAL_TXDESC_CLRDMASK ? AR_ClearDestMask : 0)
513 | (flags & HAL_TXDESC_INTREQ ? AR_TxInterReq : 0)
514 | (antMode ? AR_AntModeXmit : 0)
516 if (keyIx != HAL_TXKEYIX_INVALID) {
517 ads->ds_ctl1 = (keyIx << AR_EncryptKeyIdx_S) & AR_EncryptKeyIdx;
518 ads->ds_ctl0 |= AR_EncryptKeyValid;
519 } else
520 ads->ds_ctl1 = 0;
521 if (flags & HAL_TXDESC_RTSENA) {
522 ads->ds_ctl0 |= AR_RTSCTSEnable;
523 ads->ds_ctl1 |= rtsctsDuration & AR_RTSDuration;
525 return AH_TRUE;
528 HAL_BOOL
529 ar5210SetupXTxDesc(struct ath_hal *ah, struct ath_desc *ds,
530 u_int txRate1, u_int txTries1,
531 u_int txRate2, u_int txTries2,
532 u_int txRate3, u_int txTries3)
534 (void) ah; (void) ds;
535 (void) txRate1; (void) txTries1;
536 (void) txRate2; (void) txTries2;
537 (void) txRate3; (void) txTries3;
538 return AH_FALSE;
541 void
542 ar5210IntrReqTxDesc(struct ath_hal *ah, struct ath_desc *ds)
544 struct ar5210_desc *ads = AR5210DESC(ds);
546 ads->ds_ctl0 |= AR_TxInterReq;
549 HAL_BOOL
550 ar5210FillTxDesc(struct ath_hal *ah, struct ath_desc *ds,
551 u_int segLen, HAL_BOOL firstSeg, HAL_BOOL lastSeg,
552 const struct ath_desc *ds0)
554 struct ar5210_desc *ads = AR5210DESC(ds);
556 HALASSERT((segLen &~ AR_BufLen) == 0);
558 if (firstSeg) {
560 * First descriptor, don't clobber xmit control data
561 * setup by ar5210SetupTxDesc.
563 ads->ds_ctl1 |= segLen | (lastSeg ? 0 : AR_More);
564 } else if (lastSeg) { /* !firstSeg && lastSeg */
566 * Last descriptor in a multi-descriptor frame,
567 * copy the transmit parameters from the first
568 * frame for processing on completion.
570 ads->ds_ctl0 = AR5210DESC_CONST(ds0)->ds_ctl0;
571 ads->ds_ctl1 = segLen;
572 } else { /* !firstSeg && !lastSeg */
574 * Intermediate descriptor in a multi-descriptor frame.
576 ads->ds_ctl0 = 0;
577 ads->ds_ctl1 = segLen | AR_More;
579 ads->ds_status0 = ads->ds_status1 = 0;
580 return AH_TRUE;
584 * Processing of HW TX descriptor.
586 HAL_STATUS
587 ar5210ProcTxDesc(struct ath_hal *ah,
588 struct ath_desc *ds, struct ath_tx_status *ts)
590 struct ar5210_desc *ads = AR5210DESC(ds);
592 if ((ads->ds_status1 & AR_Done) == 0)
593 return HAL_EINPROGRESS;
595 /* Update software copies of the HW status */
596 ts->ts_seqnum = ads->ds_status1 & AR_SeqNum;
597 ts->ts_tstamp = MS(ads->ds_status0, AR_SendTimestamp);
598 ts->ts_status = 0;
599 if ((ads->ds_status0 & AR_FrmXmitOK) == 0) {
600 if (ads->ds_status0 & AR_ExcessiveRetries)
601 ts->ts_status |= HAL_TXERR_XRETRY;
602 if (ads->ds_status0 & AR_Filtered)
603 ts->ts_status |= HAL_TXERR_FILT;
604 if (ads->ds_status0 & AR_FIFOUnderrun)
605 ts->ts_status |= HAL_TXERR_FIFO;
607 ts->ts_rate = MS(ads->ds_ctl0, AR_XmitRate);
608 ts->ts_rssi = MS(ads->ds_status1, AR_AckSigStrength);
609 ts->ts_shortretry = MS(ads->ds_status0, AR_ShortRetryCnt);
610 ts->ts_longretry = MS(ads->ds_status0, AR_LongRetryCnt);
611 ts->ts_antenna = 0; /* NB: don't know */
612 ts->ts_finaltsi = 0;
614 return HAL_OK;
618 * Determine which tx queues need interrupt servicing.
619 * STUB.
621 void
622 ar5210GetTxIntrQueue(struct ath_hal *ah, uint32_t *txqs)
624 return;
626 #endif /* AH_SUPPORT_AR5210 */