2 * Copyright (c) 2000-2005 ZyDAS Technology Corporation
3 * Copyright (c) 2007-2008 Atheros Communications Inc.
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 /* Module Name : ud.c */
21 /* This module contains USB descriptor functions. */
26 /************************************************************************/
27 #include "../80211core/cprecomp.h"
31 extern void zfwUsbCmd(zdev_t* dev, u8_t endpt, u32_t* cmd, u16_t cmdLen);
33 extern void zfIdlRsp(zdev_t* dev, u32_t* rsp, u16_t rspLen);
34 extern u16_t zfDelayWriteInternalReg(zdev_t* dev, u32_t addr, u32_t val);
35 extern u16_t zfFlushDelayWrite(zdev_t* dev);
38 #define USB_ENDPOINT_TX_INDEX 1
39 #define USB_ENDPOINT_RX_INDEX 2
40 #define USB_ENDPOINT_INT_INDEX 3
41 #define USB_ENDPOINT_CMD_INDEX 4
43 void zfIdlCmd(zdev_t* dev, u32_t* cmd, u16_t cmdLen)
45 #if ZM_SW_LOOP_BACK != 1
46 zfwUsbCmd(dev, USB_ENDPOINT_CMD_INDEX, cmd, cmdLen);
53 /* zfAdjustCtrlSetting: fit OUTS format */
54 /* convert MIMO2 to OUTS */
55 void zfAdjustCtrlSetting(zdev_t* dev, u16_t* header, zbuf_t* buf)
57 /* MIMO2 => OUTS FB-50 */
58 /* length not change, only modify format */
68 zmw_get_wlan_dev(dev);
69 struct zsHpPriv* hpPriv=wd->hpPrivate;
74 oldPhyCtrl = zmw_buf_readh(dev, buf, 4) | ((u32_t)zmw_buf_readh(dev, buf, 6) << 16);
78 oldPhyCtrl = header[2] | ((u32_t)header[3] <<16);
85 oldMT = oldPhyCtrl&0x3;
87 if ( oldMT == 0x3 ) /* DL-OFDM (Duplicate Legacy OFDM) */
91 /* PT : Bit[2] HT PT: 0 Mixed mode 1 Green field */
92 phyCtrl |= (oldPhyCtrl&0x4);
94 /* Bandwidth control : Bit[4~3] */
95 if ( oldPhyCtrl&0x800000 ) /* Bit23 : 40M */
98 if (oldMT == 0x3) /* DL-OFDM */
99 phyCtrl |= (0x3<<3); /* 40M duplicate */
101 phyCtrl |= (0x2<<3); /* 40M shared */
103 if (oldMT == 0x2 && ((struct zsHpPriv*)wd->hpPrivate)->hwBw40)
105 phyCtrl |= (0x2<<3); /* 40M shared */
110 oldPhyCtrl &= ~0x80000000;
113 /* MCS : Bit[24~18] */
114 oldMCS = (oldPhyCtrl&0x7f0000)>>16; /* Bit[22~16] */
115 phyCtrl |= (oldMCS<<18);
117 /* Short GI : Bit[31]*/
118 phyCtrl |= (oldPhyCtrl&0x80000000);
120 /* AM : Antenna mask */
121 //if ((oldMT == 2) && (oldMCS > 7))
122 if (hpPriv->halCapability & ZM_HP_CAP_11N_ONE_TX_STREAM)
124 phyCtrl |= (0x1<<15);
129 /* OFDM 6M/9M/12M/18M/24M Tx 2 chain */
130 /* OFDM 36M/48M/54M/ Tx 1 chain */
132 if ((oldMT == 2) || (oldMT == 3))
134 phyCtrl |= (0x5<<15);
138 if ((oldMCS == 0xb) || (oldMCS == 0xf) ||
139 (oldMCS == 0xa) || (oldMCS == 0xe) ||
140 (oldMCS == 0x9)) //6M/9M/12M/18M/24M
142 phyCtrl |= (0x5<<15);
146 phyCtrl |= (0x1<<15);
151 phyCtrl |= (0x5<<15);
155 // phyCtrl |= (0x1<<15);
158 /* TODO : accelerating these code */
159 if (hpPriv->hwFrequency < 3000)
164 tpc = (hpPriv->tPow2xCck[oldMCS]&0x3f);
171 tpc = (hpPriv->tPow2x2g[3]&0x3f);
173 else if (oldMCS == 0x8)
175 tpc = (hpPriv->tPow2x2g[2]&0x3f);
177 else if (oldMCS == 0xd)
179 tpc = (hpPriv->tPow2x2g[1]&0x3f);
181 else if (oldMCS == 0x9)
183 tpc = ((hpPriv->tPow2x2g[0]-hpPriv->tPow2x2g24HeavyClipOffset)&0x3f);
187 tpc = (hpPriv->tPow2x2g[0]&0x3f);
192 if ( oldPhyCtrl&0x800000 ) /* Bit23 : 40M */
195 tpc = (hpPriv->tPow2x2gHt40[oldMCS&0x7]&0x3f);
200 tpc = (hpPriv->tPow2x2gHt20[oldMCS&0x7]&0x3f);
211 tpc = (hpPriv->tPow2x5g[3]&0x3f);
213 else if (oldMCS == 0x8)
215 tpc = (hpPriv->tPow2x5g[2]&0x3f);
217 else if (oldMCS == 0xd)
219 tpc = (hpPriv->tPow2x5g[1]&0x3f);
223 tpc = (hpPriv->tPow2x5g[0]&0x3f);
228 if ( oldPhyCtrl&0x800000 ) /* Bit23 : 40M */
231 tpc = (hpPriv->tPow2x5gHt40[oldMCS&0x7]&0x3f);
236 tpc = (hpPriv->tPow2x5gHt20[oldMCS&0x7]&0x3f);
241 /* Tx power adjust for HT40 */
243 if ((oldMT==2) && (oldPhyCtrl&0x800000) )
249 /* Evl force tx TPC */
252 tpc = (u16_t)(wd->forceTxTPC & 0x3f);
255 if (hpPriv->hwFrequency < 3000) {
256 wd->maxTxPower2 &= 0x3f;
257 tpc = (tpc > wd->maxTxPower2)? wd->maxTxPower2 : tpc;
259 wd->maxTxPower5 &= 0x3f;
260 tpc = (tpc > wd->maxTxPower5)? wd->maxTxPower5 : tpc;
265 #define ZM_TPC_OFFSET 5
266 #define ZM_SIGNAL_THRESHOLD 56
267 if ((wd->sta.bScheduleScan == FALSE) && (wd->sta.bChannelScan == FALSE))
269 if (( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
270 && (zfStaIsConnected(dev))
271 && (wd->SignalStrength > ZM_SIGNAL_THRESHOLD))
273 if (tpc > ((ZM_MIN_TPC+ZM_TPC_OFFSET)*2))
275 tpc -= (ZM_TPC_OFFSET*2);
277 else if (tpc > (ZM_MIN_TPC*2))
279 tpc = (ZM_MIN_TPC*2);
285 #undef ZM_SIGNAL_THRESHOLD
287 #ifndef ZM_OTUS_LINUX_PHASE_2
288 phyCtrl |= (tpc & 0x3f) << 9;
291 /* Set bits[8:6]BF-MCS for heavy clip */
292 if ((phyCtrl&0x3) == 2)
294 phyCtrl |= ((phyCtrl >> 12) & 0x1c0);
300 zmw_buf_writeh(dev, buf, 4, (u16_t) (phyCtrl&0xffff));
301 zmw_buf_writeh(dev, buf, 6, (u16_t) (phyCtrl>>16));
306 header[2] = (u16_t) (phyCtrl&0xffff);
308 header[3] = (u16_t) (phyCtrl>>16);
311 zm_msg2_tx(ZM_LV_2, "old phy ctrl = ", oldPhyCtrl);
312 zm_msg2_tx(ZM_LV_2, "new phy ctrl = ", phyCtrl);
313 //DbgPrint("old phy ctrl =%08x \n", oldPhyCtrl);
314 //DbgPrint("new phy ctrl =%08x \n", phyCtrl);
318 #define EXTRA_INFO_LEN 24 //RSSI(7) + EVM(12) + PHY(1) + MACStatus(4)
319 u16_t zfHpSend(zdev_t* dev, u16_t* header, u16_t headerLen,
320 u16_t* snap, u16_t snapLen,
321 u16_t* tail, u16_t tailLen, zbuf_t* buf, u16_t offset,
322 u16_t bufType, u8_t ac, u8_t keyIdx)
324 #if ZM_SW_LOOP_BACK == 1
332 #endif /* #if ZM_SW_LOOP_BACK == 1 */
333 zmw_get_wlan_dev(dev);
334 struct zsHpPriv* hpPriv=wd->hpPrivate;
336 zm_msg1_tx(ZM_LV_1, "zfHpSend(), len = ", 12 + headerLen-8 + snapLen + zfwBufGetSize(dev, buf) + 4 + 8);
338 /* Adjust ctrl setting : 6N14 yjsung */
339 zfAdjustCtrlSetting(dev, header, buf);
341 #if ZM_SW_LOOP_BACK != 1
342 hpPriv->usbSendBytes += zfwBufGetSize(dev, buf);
343 hpPriv->usbAcSendBytes[ac&0x3] += zfwBufGetSize(dev, buf);
345 /* Submit USB Out Urb */
346 zfwUsbSend(dev, USB_ENDPOINT_TX_INDEX, (u8_t *)header, headerLen,
347 (u8_t *)snap, snapLen, (u8_t *)tail, tailLen, buf, offset);
350 #if ZM_SW_LOOP_BACK == 1
352 rxbuf = zfwBufAllocate(dev, plcplen + headerLen-8 + snapLen + (zfwBufGetSize(dev, buf)-offset) + 4 + EXTRA_INFO_LEN);
353 pHdr = (u8_t *) header+8;
354 psnap = (u8_t *) snap;
356 zmw_enter_critical_section(dev);
357 /* software loop back */
358 /* Copy WLAN header and packet buffer */
359 swlpOffset = plcplen;
361 for(i = 0; i < headerLen-8; i++)
363 zmw_rx_buf_writeb(dev, rxbuf, swlpOffset+i, pHdr[i]);
366 swlpOffset += headerLen-8;
368 /* Copy SNAP header */
369 for(i = 0; i < snapLen; i++)
371 zmw_rx_buf_writeb(dev, rxbuf, swlpOffset+i, psnap[i]);
374 swlpOffset += snapLen;
376 /* Copy body from tx buf to rxbuf */
377 for(i = 0; i < (zfwBufGetSize(dev, buf)-offset); i++)
379 u8_t value = zmw_rx_buf_readb(dev, buf, i+offset);
380 zmw_rx_buf_writeb(dev, rxbuf, swlpOffset+i, value);
383 /* total length = PLCP + MacHeader + Payload + FCS + RXstatus */
384 /* 12 + headerLen-8 + snapLen + buf length + 4 + 8 */
385 zfwSetBufSetSize(dev, rxbuf, swlpOffset + (zfwBufGetSize(dev, buf)-offset) + 4 + EXTRA_INFO_LEN );
387 zmw_leave_critical_section(dev);
389 zfwBufFree(dev, buf, 0);
391 //zfwDumpBuf(dev, rxbuf);
392 //-------------------------------------------------
394 //zfCoreRecv(dev, rxbuf);
396 #endif /* #if ZM_SW_LOOP_BACK */
401 /* Report moniter Hal rx information about rssi, evm, bandwidth, SG etc */
402 void zfHpQueryMonHalRxInfo(zdev_t* dev, u8_t *monHalRxInfo)
404 zmw_get_wlan_dev(dev);
405 zfMemoryCopy(monHalRxInfo,
406 (u8_t*)&(((struct zsHpPriv*)wd->hpPrivate)->halRxInfo),
407 sizeof(struct zsHalRxInfo));
411 u8_t zfIsDataFrame(zdev_t* dev, zbuf_t* buf)
416 mpduInd = zmw_rx_buf_readb(dev, buf, zfwBufGetSize(dev, buf)-1);
418 /* sinlge or First */
419 if ((mpduInd & 0x30) == 0x00 || (mpduInd & 0x30) == 0x20)
421 frameType = zmw_rx_buf_readb(dev, buf, 12);
425 frameType = zmw_rx_buf_readb(dev, buf, 0);
428 if((frameType & 0xf) == ZM_WLAN_DATA_FRAME)
434 u32_t zfcConvertRateOFDM(zdev_t* dev, zbuf_t* buf)
436 // What's the default value??
439 switch(zmw_rx_buf_readb(dev, buf, 0)& 0xf)
469 u16_t zfHpGetPayloadLen(zdev_t* dev,
479 u8_t modulation,mpduInd;
480 u16_t low, high, msb;
481 s16_t payloadLen = 0;
483 zmw_get_wlan_dev(dev);
485 mpduInd = zmw_rx_buf_readb(dev, buf, len-1);
486 modulation = zmw_rx_buf_readb(dev, buf, (len-1)) & 0x3;
489 //zm_debug_msg1(" modulation= ", modulation);
490 switch (modulation) {
491 case 0: /* CCK Mode */
492 low = zmw_rx_buf_readb(dev, buf, 2);
493 high = zmw_rx_buf_readb(dev, buf, 3);
494 payloadLen = (low | high << 8) - 4;
495 if (wd->enableHALDbgInfo)
497 *rxMCS = zmw_rx_buf_readb(dev, buf, 0);
502 case 1: /* Legacy-OFDM mode */
503 low = zmw_rx_buf_readb(dev, buf, 0) >> 5;
504 high = zmw_rx_buf_readb(dev, buf, 1);
505 msb = zmw_rx_buf_readb(dev, buf, 2) & 0x1;
506 payloadLen = (low | (high << 3) | (msb << 11)) - 4;
507 if (wd->enableHALDbgInfo)
509 *rxMCS = zfcConvertRateOFDM(dev, buf);
514 case 2: /* HT OFDM mode */
515 //zm_debug_msg1("aggregation= ", (zmw_rx_buf_readb(dev, buf, 6) >> 3) &0x1 );
516 if ((mpduInd & 0x30) == 0x00 || (mpduInd & 0x30) == 0x10) //single or last mpdu
517 payloadLen = len - 24 - 4 - plcpHdrLen; // - rxStatus - fcs
519 payloadLen = len - 4 - 4 - plcpHdrLen; // - rxStatus - fcs
520 //zm_debug_msg1("first or middle mpdu, plcpHdrLen= ", plcpHdrLen);
522 if (wd->enableHALDbgInfo)
524 *rxMCS = zmw_rx_buf_readb(dev, buf, 3) & 0x7f;
525 *rxBW = (zmw_rx_buf_readb(dev, buf, 3) >> 7) & 0x1;
526 *rxSG = (zmw_rx_buf_readb(dev, buf, 6) >> 7) & 0x1;
533 /* return the payload length - FCS */
534 if (payloadLen < 0) payloadLen = 0;
538 /************************************************************************/
540 /* FUNCTION DESCRIPTION zfiUsbRecv */
541 /* Callback function for USB IN Transfer. */
544 /* dev: device pointer */
550 /* Yuan-Gu Wei ZyDAS Technology Corporation 2005.10 */
552 /************************************************************************/
553 #define ZM_INT_USE_EP2 1
554 #define ZM_INT_USE_EP2_HEADER_SIZE 12
556 #if ZM_INT_USE_EP2 == 1
557 void zfiUsbRegIn(zdev_t* dev, u32_t* rsp, u16_t rspLen);
560 #ifdef ZM_OTUS_RX_STREAM_MODE
561 void zfiUsbRecvPerPkt(zdev_t *dev, zbuf_t *buf)
563 void zfiUsbRecv(zdev_t *dev, zbuf_t *buf)
568 #if ZM_FW_LOOP_BACK != 1
571 u16_t crcPlusRxStatusLen;
572 u16_t len, payloadLen=0;
574 struct zsAdditionInfo addInfo;
579 zmw_get_wlan_dev(dev);
580 struct zsHpPriv* hpPriv=wd->hpPrivate;
582 //zm_msg0_rx(ZM_LV_0, "zfiUsbRecv()");
584 #if ZM_INT_USE_EP2 == 1
586 for (i=0; i<(ZM_INT_USE_EP2_HEADER_SIZE>>1); i++)
588 if (zmw_rx_buf_readh(dev, buf, i*2) != 0xffff)
592 if (i==(ZM_INT_USE_EP2_HEADER_SIZE>>1))
594 u32_t rsp[ZM_USB_MAX_EPINT_BUFFER/4];
597 u8_t* pdst = (u8_t*)rsp;
600 rspLen = (u16_t) zfwBufGetSize(dev, buf)-ZM_INT_USE_EP2_HEADER_SIZE;
604 zm_debug_msg1("Get error len by EP2 = \n", rspLen);
606 zfwBufFree(dev, buf, 0);
610 for (rspi=0; rspi<rspLen; rspi++)
612 *pdst = zmw_rx_buf_readb(dev, buf, rspi+ZM_INT_USE_EP2_HEADER_SIZE);
616 //if (adapter->zfcbUsbRegIn)
617 // adapter->zfcbUsbRegIn(adapter, rsp, rspLen);
618 zfiUsbRegIn(dev, rsp, rspLen);
621 zfwBufFree(dev, buf, 0);
624 #endif /* end of #if ZM_INT_USE_EP2 == 1 */
626 ZM_PERFORMANCE_RX_MPDU(dev, buf);
630 /* airopeek: Report everything up */
631 if (wd->zfcbRecv80211 != NULL)
633 wd->zfcbRecv80211(dev, buf, NULL);
637 /* Read the last byte */
638 len = zfwBufGetSize(dev, buf);
639 mpduInd = zmw_rx_buf_readb(dev, buf, len-1);
642 if((mpduInd & 0x30) == 0x20)
645 if (zmw_rx_buf_readb(dev, buf, 36) == 0) //AC = BE
647 duration = zmw_rx_buf_readh(dev, buf, 14);
648 if (duration > hpPriv->aggMaxDurationBE)
650 hpPriv->aggMaxDurationBE = duration;
654 if (hpPriv->aggMaxDurationBE > 10)
656 hpPriv->aggMaxDurationBE--;
659 //DbgPrint("aggMaxDurationBE=%d", hpPriv->aggMaxDurationBE);
664 /* First MPDU or Single MPDU */
665 if(((mpduInd & 0x30) == 0x00) || ((mpduInd & 0x30) == 0x20))
666 //if ((mpduInd & 0x10) == 0x00)
668 plcpHdrLen = 12; // PLCP header length
672 if (zmw_rx_buf_readh(dev, buf, 4) == wd->macAddr[0] &&
673 zmw_rx_buf_readh(dev, buf, 6) == wd->macAddr[1] &&
674 zmw_rx_buf_readh(dev, buf, 8) == wd->macAddr[2]) {
677 else if (zmw_rx_buf_readh(dev, buf, 16) == wd->macAddr[0] &&
678 zmw_rx_buf_readh(dev, buf, 18) == wd->macAddr[1] &&
679 zmw_rx_buf_readh(dev, buf, 20) == wd->macAddr[2]){
687 /* Last MPDU or Single MPDU */
688 if ((mpduInd & 0x30) == 0x00 || (mpduInd & 0x30) == 0x10)
690 crcPlusRxStatusLen = EXTRA_INFO_LEN + 4; // Extra bytes + FCS
694 crcPlusRxStatusLen = 4 + 4; // Extra 4 bytes + FCS
698 crcPlusRxStatusLen = EXTRA_INFO_LEN + 4; // Extra bytes + FCS
701 if (len < (plcpHdrLen+10+crcPlusRxStatusLen))
703 zm_msg1_rx(ZM_LV_0, "Invalid Rx length=", len);
704 //zfwDumpBuf(dev, buf);
706 zfwBufFree(dev, buf, 0);
710 /* display RSSI combined */
712 * ¢z¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢s¢w¢w¢w¢w¢w¢w¢w¢w¢s¢w¢w¢w¢w¢w¢w¢s¢w¢w¢w¢w¢w¢w¢s¢w¢w¢w¢w¢w¢w¢w¢w¢w¢s¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢{
713 * ¢x PLCP Header ¢x MPDU ¢x RSSI ¢x EVM ¢x PHY Err ¢x MAC Status ¢x
714 * ¢u¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢q¢w¢w¢w¢w¢w¢w¢w¢w¢q¢w¢w¢w¢w¢w¢w¢q¢w¢w¢w¢w¢w¢w¢q¢w¢w¢w¢w¢w¢w¢w¢w¢w¢q¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢t
715 * ¢x 12 ¢x n ¢x 7 ¢x 12 ¢x 1 ¢x 4 ¢x
716 * ¢|¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢r¢w¢w¢w¢w¢w¢w¢w¢w¢r¢w¢w¢w¢w¢w¢w¢r¢w¢w¢w¢w¢w¢w¢r¢w¢w¢w¢w¢w¢w¢w¢w¢w¢r¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢}
717 * RSSI filed (From BB and MAC just pass them to host)
718 * Byte1: RSSI for antenna 0.
719 * Byte2: RSSI for antenna 1.
720 * Byte3: RSSI for antenna 2.
721 * Byte4: RSSI for antenna 0 extension.
722 * Byte5: RSSI for antenna 1 extension.
723 * Byte6: RSSI for antenna 2 extension.
724 * Byte7: RSSI for antenna combined.
727 //zm_debug_msg1(" recv RSSI = ", zmw_rx_buf_readb(dev, buf, (len-1)-17));
729 payloadLen = zfHpGetPayloadLen(dev, buf, len, plcpHdrLen, &rxMT, &rxMCS, &rxBW, &rxSG);
732 /* First MPDU or Single MPDU */
733 if(((mpduInd & 0x30) == 0x00) || ((mpduInd & 0x30) == 0x20))
735 if (wd->enableHALDbgInfo && zfIsDataFrame(dev, buf))
737 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxDataMT = rxMT;
738 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxDataMCS = rxMCS;
739 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxDataBW = rxBW;
740 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxDataSG = rxSG;
744 if ((plcpHdrLen + payloadLen) > len) {
745 zm_msg1_rx(ZM_LV_0, "Invalid payload length=", payloadLen);
746 zfwBufFree(dev, buf, 0);
750 //Store Rx Tail Infomation before Remove--CWYang(+)
753 for (i = 0; i < crcPlusRxStatusLen-4; i++)
755 addInfo.Tail.Byte[i] =
756 zmw_rx_buf_readb(dev, buf, len - crcPlusRxStatusLen + 4 + i);
760 * Brief format of OUTS chip
761 * ¢z¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢s¢w¢w¢w¢w¢w¢w¢w¢w¢s¢w¢w¢w¢w¢w¢w¢s¢w¢w¢w¢w¢w¢w¢s¢w¢w¢w¢w¢w¢w¢w¢w¢w¢s¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢{
762 * ¢x PLCP Header ¢x MPDU ¢x RSSI ¢x EVM ¢x PHY Err ¢x MAC Status ¢x
763 * ¢u¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢q¢w¢w¢w¢w¢w¢w¢w¢w¢q¢w¢w¢w¢w¢w¢w¢q¢w¢w¢w¢w¢w¢w¢q¢w¢w¢w¢w¢w¢w¢w¢w¢w¢q¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢t
764 * ¢x 12 ¢x n ¢x 7 ¢x 12 ¢x 1 ¢x 4 ¢x
765 * ¢|¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢r¢w¢w¢w¢w¢w¢w¢w¢w¢r¢w¢w¢w¢w¢w¢w¢r¢w¢w¢w¢w¢w¢w¢r¢w¢w¢w¢w¢w¢w¢w¢w¢w¢r¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢}
770 * Byte 4 antenna 0 extension
771 * Byte 5 antenna 1 extension
772 * Byte 6 antenna 2 extension
773 * Byte 7 antenna combined
775 * Byte 1 Stream 0 pilot 0
776 * Byte 2 Stream 0 pilot 1
777 * Byte 3 Stream 0 pilot 2
778 * Byte 4 Stream 0 pilot 3
779 * Byte 5 Stream 0 pilot 4
780 * Byte 6 Stream 0 pilot 5
781 * Byte 7 Stream 1 pilot 0
782 * Byte 8 Stream 1 pilot 1
783 * Byte 9 Stream 1 pilot 2
784 * Byte 10 Stream 1 pilot 3
785 * Byte 11 Stream 1 pilot 4
786 * Byte 12 Stream 1 pilot 5
789 /* Fill the Tail information */
790 /* Last MPDU or Single MPDU */
791 if ((mpduInd & 0x30) == 0x00 || (mpduInd & 0x30) == 0x10)
793 #define ZM_RX_RSSI_COMPENSATION 27
794 u8_t zm_rx_rssi_compensation = ZM_RX_RSSI_COMPENSATION;
796 /* RSSI information */
797 addInfo.Tail.Data.SignalStrength1 = zmw_rx_buf_readb(dev, buf,
798 (len-1) - 17) + ((hpPriv->rxStrongRSSI == 1)?zm_rx_rssi_compensation:0);
799 #undef ZM_RX_RSSI_COMPENSATION
803 /* TODO: for RD/BB debug message */
804 /* save current rx hw infomration, report to DrvCore/Application */
805 if (wd->enableHALDbgInfo && zfIsDataFrame(dev, buf))
810 trssi = zmw_rx_buf_readb(dev, buf, (len-1) - 23 + i);
813 trssi = ((~((u8_t)trssi) & 0x7f) + 1) & 0x7f;
815 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRSSI[i] = trssi;
823 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[i] =
824 zmw_rx_buf_readb(dev, buf, (len-1) - 16 + i);
828 // for (i=0; i<4; i++)
829 // ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[i] =
830 // zmw_rx_buf_readb(dev, buf, (len-1) - 16 + i);
836 zm_dbg(("MT(%d) MCS(%d) BW(%d) SG(%d) RSSI:%d,%d,%d,%d,%d,%d,%d EVM:(%d,%d,%d,%d,%d,%d)(%d,%d,%d,%d,%d,%d)\n",
841 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRSSI[0],
842 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRSSI[1],
843 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRSSI[2],
844 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRSSI[3],
845 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRSSI[4],
846 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRSSI[5],
847 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRSSI[6],
848 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[0],
849 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[1],
850 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[2],
851 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[3],
852 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[4],
853 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[5],
854 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[6],
855 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[7],
856 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[8],
857 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[9],
858 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[10],
859 ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[11]
862 } /* if (wd->enableHALDbgInfo && zfIsDataFrame(dev, buf)) */
867 /* Mid or First aggregate frame without phy rx information */
868 addInfo.Tail.Data.SignalStrength1 = 0;
871 addInfo.Tail.Data.SignalStrength2 = 0;
872 addInfo.Tail.Data.SignalStrength3 = 0;
873 addInfo.Tail.Data.SignalQuality = 0;
875 addInfo.Tail.Data.SAIndex = zmw_rx_buf_readb(dev, buf, len - 4);
876 addInfo.Tail.Data.DAIndex = zmw_rx_buf_readb(dev, buf, len - 3);
877 addInfo.Tail.Data.ErrorIndication = zmw_rx_buf_readb(dev, buf, len - 2);
878 addInfo.Tail.Data.RxMacStatus = zmw_rx_buf_readb(dev, buf, len - 1);
881 /* Remove CRC and Rx Status */
882 zfwBufSetSize(dev, buf, (len-crcPlusRxStatusLen));
883 //zfwBufSetSize(dev, buf, payloadLen + plcpHdrLen); /* payloadLen + PLCP 12 - FCS 4*/
885 //Store PLCP Header Infomation before Remove--CWYang(+)
888 for (i = 0; i < plcpHdrLen; i++)
890 addInfo.PlcpHeader[i] = zmw_rx_buf_readb(dev, buf, i);
895 addInfo.PlcpHeader[0] = 0;
897 /* Remove PLCP header */
898 zfwBufRemoveHead(dev, buf, plcpHdrLen);
900 /* handle 802.11 frame */
901 zfCoreRecv(dev, buf, &addInfo);
904 /* Firmware loopback: Rx frame = Tx frame */
905 /* convert Rx frame to fit receive frame format */
907 u8_t ctrl_offset = 8;
913 /* Tx: | ctrl_setting | Mac hdr | data | */
916 /* Rx: | PLCP | Mac hdr | data | FCS | Rxstatus | */
919 /* new allocate a rx format size buf */
920 new_buf = zfwBufAllocate(dev, zfwBufGetSize(dev, buf)-8+12+4+EXTRA_INFO_LEN);
922 for (i=0; i<zfwBufGetSize(dev, buf)-ctrl_offset; i++)
924 data = zmw_rx_buf_readb(dev, buf, ctrl_offset+i);
925 zmw_rx_buf_writeb(dev, new_buf, PLCP_Len+i, data);
928 zfwBufSetSize(dev, new_buf, zfwBufGetSize(dev, buf)-8+12+4+EXTRA_INFO_LEN);
930 zfwBufFree(dev, buf, 0);
932 /* receive the new_buf */
933 //zfCoreRecv(dev, new_buf);
939 #ifdef ZM_OTUS_RX_STREAM_MODE
940 void zfiUsbRecv(zdev_t *dev, zbuf_t *buf)
947 zbuf_t *rxBufPool[8];
948 u16_t rxBufPoolIndex = 0;
949 struct zsHpPriv *halPriv;
952 u16_t usbRxRemainLen;
955 zmw_get_wlan_dev(dev);
957 halPriv = (struct zsHpPriv*)wd->hpPrivate;
958 srcBufPtr = zmw_buf_get_buffer(dev, buf);
960 bufferLength = zfwBufGetSize(dev, buf);
962 /* Zero Length Transfer */
965 zfwBufFree(dev, buf, 0);
969 usbRxRemainLen = halPriv->usbRxRemainLen;
970 usbRxPktLen = halPriv->usbRxTransferLen;
972 /* Check whether there is any data in the last transfer */
973 if (usbRxRemainLen != 0 )
975 zbuf_t *remainBufPtr = halPriv->remainBuf;
978 if ( remainBufPtr != NULL )
980 BufPtr = zmw_buf_get_buffer(dev, remainBufPtr);
983 index = usbRxRemainLen;
984 usbRxRemainLen -= halPriv->usbRxPadLen;
987 if ( BufPtr != NULL )
989 zfwMemoryCopy(&(BufPtr[usbRxPktLen]), srcBufPtr, usbRxRemainLen);
992 usbRxPktLen += usbRxRemainLen;
993 halPriv->usbRxRemainLen = 0;
995 if ( remainBufPtr != NULL )
997 zfwBufSetSize(dev, remainBufPtr, usbRxPktLen);
998 rxBufPool[rxBufPoolIndex++] = remainBufPtr;
1000 halPriv->remainBuf = NULL;
1003 //zm_debug_msg1("length: %d\n", (int)pUsbRxTransfer->pRxUrb->UrbBulkOrInterruptTransfer.TransferBufferLength);
1005 bufferLength = zfwBufGetSize(dev, buf);
1006 //printk("bufferLength %d\n", bufferLength);
1007 while(index < bufferLength)
1011 //u8_t *ptr = (u8_t*)((struct zsBuffer*)pUsbRxTransfer->buf)->data;
1012 u8_t *ptr = srcBufPtr;
1014 /* Retrieve packet length and tag */
1015 pktLen = ptr[index] + (ptr[index+1] << 8);
1016 pktTag = ptr[index+2] + (ptr[index+3] << 8);
1018 if (pktTag == ZM_USB_STREAM_MODE_TAG)
1022 zm_assert(pktLen < ZM_WLAN_MAX_RX_SIZE);
1024 //printk("Get a packet, pktLen: 0x%04x\n", pktLen);
1027 for (ii = index; ii < pkt_len+4;)
1030 (zmw_rx_buf_readb(adapter, pUsbRxTransfer->buf, ii) & 0xff));
1032 if ((++ii % 16) == 0)
1039 /* Calcuate the padding length, in the current design,
1040 the length should be padded to 4 byte boundray. */
1041 padLen = ZM_USB_STREAM_MODE_TAG_LEN - (pktLen & 0x3);
1043 if(padLen == ZM_USB_STREAM_MODE_TAG_LEN)
1047 index = index + ZM_USB_STREAM_MODE_TAG_LEN + pktLen + padLen;
1049 if (chkIdx > ZM_MAX_USB_IN_TRANSFER_SIZE)
1051 zm_debug_msg1("chkIdx is too large, chkIdx: %d\n", chkIdx);
1057 if (index > ZM_MAX_USB_IN_TRANSFER_SIZE)
1059 //struct zsBuffer* BufPtr;
1060 //struct zsBuffer* UsbBufPtr;
1064 halPriv->usbRxRemainLen = index - ZM_MAX_USB_IN_TRANSFER_SIZE; // - padLen;
1065 halPriv->usbRxTransferLen = ZM_MAX_USB_IN_TRANSFER_SIZE -
1066 chkIdx - ZM_USB_STREAM_MODE_TAG_LEN;
1067 halPriv->usbRxPadLen = padLen;
1068 //check_index = index;
1070 if (halPriv->usbRxTransferLen > ZM_WLAN_MAX_RX_SIZE)
1072 zm_debug_msg1("check_len is too large, chk_len: %d\n",
1073 halPriv->usbRxTransferLen);
1078 /* Allocate a skb buffer */
1079 newBuf = zfwBufAllocate(dev, ZM_WLAN_MAX_RX_SIZE);
1081 if ( newBuf != NULL )
1083 BufPtr = zmw_buf_get_buffer(dev, newBuf);
1084 UsbBufPtr = srcBufPtr;
1086 /* Copy the buffer */
1087 zfwMemoryCopy(BufPtr, &(UsbBufPtr[chkIdx+ZM_USB_STREAM_MODE_TAG_LEN]), halPriv->usbRxTransferLen);
1089 /* Record the buffer pointer */
1090 halPriv->remainBuf = newBuf;
1098 /* Allocate a skb buffer */
1099 newBuf = zfwBufAllocate(dev, ZM_WLAN_MAX_RX_SIZE);
1100 if ( newBuf != NULL )
1102 BufPtr = zmw_buf_get_buffer(dev, newBuf);
1103 UsbBufPtr = srcBufPtr;
1105 /* Copy the buffer */
1106 zfwMemoryCopy(BufPtr, &(UsbBufPtr[chkIdx+ZM_USB_STREAM_MODE_TAG_LEN]), pktLen);
1108 zfwBufSetSize(dev, newBuf, pktLen);
1109 rxBufPool[rxBufPoolIndex++] = newBuf;
1117 DbgPrint("Can't find tag, pkt_len: 0x%04x, tag: 0x%04x\n",
1121 for(i = 0; i < 32; i++)
1123 DbgPrint("%02x ", buf->data[index-16+i]);
1125 if ((i & 0xf) == 0xf)
1135 //zfwBufFree(adapter, pUsbRxTransfer->buf, 0);
1136 zfwBufFree(dev, buf, 0);
1138 for(ii = 0; ii < rxBufPoolIndex; ii++)
1140 zfiUsbRecvPerPkt(dev, rxBufPool[ii]);
1145 /************************************************************************/
1147 /* FUNCTION DESCRIPTION zfUsbInit */
1148 /* Initialize USB resource. */
1151 /* dev : device pointer */
1157 /* Stephen Chen ZyDAS Technology Corporation 2005.12 */
1159 /************************************************************************/
1160 void zfUsbInit(zdev_t* dev)
1162 /* Initialize Rx & INT endpoint for receiving data & interrupt */
1163 zfwUsbEnableRxEpt(dev, USB_ENDPOINT_RX_INDEX);
1164 zfwUsbEnableIntEpt(dev, USB_ENDPOINT_INT_INDEX);
1170 /************************************************************************/
1172 /* FUNCTION DESCRIPTION zfUsbFree */
1173 /* Free PCI resource. */
1176 /* dev : device pointer */
1182 /* Stephen Chen ZyDAS Technology Corporation 2005.12 */
1184 /************************************************************************/
1185 void zfUsbFree(zdev_t* dev)
1187 struct zsHpPriv *halPriv;
1189 zmw_get_wlan_dev(dev);
1191 halPriv = (struct zsHpPriv*)wd->hpPrivate;
1193 #ifdef ZM_OTUS_RX_STREAM_MODE
1194 if ( halPriv->remainBuf != NULL )
1196 zfwBufFree(dev, halPriv->remainBuf, 0);
1203 void zfHpSendBeacon(zdev_t* dev, zbuf_t* buf, u16_t len)
1207 zmw_get_wlan_dev(dev);
1209 /* Write to beacon buffer (ZM_BEACON_BUFFER_ADDRESS) */
1210 for (i = 0; i<len; i+=4)
1212 lw = zmw_tx_buf_readh(dev, buf, i);
1213 hw = zmw_tx_buf_readh(dev, buf, i+2);
1215 zfDelayWriteInternalReg(dev, ZM_BEACON_BUFFER_ADDRESS+i, (hw<<16)+lw);
1218 /* Beacon PCLP header */
1219 if (((struct zsHpPriv*)wd->hpPrivate)->hwFrequency < 3000)
1221 zfDelayWriteInternalReg(dev, ZM_MAC_REG_BCN_PLCP, ((len+4)<<(3+16))+0x0400);
1225 zfDelayWriteInternalReg(dev, ZM_MAC_REG_BCN_PLCP, ((len+4)<<(16))+0x001b);
1228 /* Beacon length (include CRC32) */
1229 zfDelayWriteInternalReg(dev, ZM_MAC_REG_BCN_LENGTH, len+4);
1232 zfDelayWriteInternalReg(dev, ZM_MAC_REG_BCN_CTRL, 1);
1233 zfFlushDelayWrite(dev);
1235 /* Free beacon buf */
1236 zfwBufFree(dev, buf, 0);
1242 #define ZM_STATUS_TX_COMP 0x00
1243 #define ZM_STATUS_RETRY_COMP 0x01
1244 #define ZM_STATUS_TX_FAILED 0x02
1245 void zfiUsbRegIn(zdev_t* dev, u32_t* rsp, u16_t rspLen)
1247 //u8_t len, type, i;
1252 zmw_get_wlan_dev(dev);
1254 zm_msg0_mm(ZM_LV_3, "zfiUsbRegIn()");
1256 u8rsp = (u8_t *)rsp;
1263 /* Interrupt event */
1264 if ((type & 0xC0) == 0xC0)
1268 zfCoreEvent(dev, 0, u8rsp);
1271 else if (type == 0xC1)
1276 DbgPrint("rspLen=%d\n", rspLen);
1277 for (i=0; i<(rspLen/4); i++)
1279 DbgPrint("rsp[%d]=0x%lx\n", i, rsp[i]);
1283 status = (u16_t)(rsp[3] >> 16);
1286 rsp[8] = rsp[8] >> 2 | (rsp[9] & 0x1) << 6;
1289 case ZM_STATUS_RETRY_COMP :
1290 zfCoreEvent(dev, 1, u8rsp);
1292 case ZM_STATUS_TX_FAILED :
1293 zfCoreEvent(dev, 2, u8rsp);
1295 case ZM_STATUS_TX_COMP :
1296 zfCoreEvent(dev, 3, u8rsp);
1300 else if (type == 0xC2)
1302 zfBeaconCfgInterrupt(dev, u8rsp);
1304 else if (type == 0xC3)
1306 zfEndOfAtimWindowInterrupt(dev);
1308 else if (type == 0xC4)
1313 DbgPrint("0xC2:rspLen=%d\n", rspLen);
1314 for (i=0; i<(rspLen/4); i++)
1316 DbgPrint("0xC2:rsp[%d]=0x%lx\n", i, rsp[i]);
1320 bitmap = (rsp[1] >> 16) + ((rsp[2] & 0xFFFF) << 16 );
1321 //zfBawCore(dev, (u16_t)rsp[1] & 0xFFFF, bitmap, (u16_t)(rsp[2] >> 16) & 0xFF);
1323 else if (type == 0xC5)
1328 for (i=0; i<(rspLen/4); i++) {
1329 DbgPrint("0xC5:rsp[%d]=0x%lx\n", i, rsp[i]);
1332 for (i=1; i<(rspLen/4); i++) {
1333 u8rsp = (u8_t *)(rsp+i);
1334 //DbgPrint("0xC5:rsp[%d]=0x%lx\n", i, ((u32_t*)u8rsp)[0]);
1335 zfCoreEvent(dev, 4, u8rsp);
1338 else if (type == 0xC6)
1340 zm_debug_msg0("\n\n WatchDog interrupt!!! : 0xC6 \n\n");
1341 if (wd->zfcbHwWatchDogNotify != NULL)
1343 wd->zfcbHwWatchDogNotify(dev);
1346 else if (type == 0xC8)
1348 //PZSW_ADAPTER adapter;
1350 // for SPI flash program chk Flag
1351 zfwDbgProgrameFlashChkDone(dev);
1353 else if (type == 0xC9)
1355 struct zsHpPriv* hpPriv=wd->hpPrivate;
1357 zm_debug_msg0("##### Tx retransmission 5 times event #####");
1359 /* correct tx retransmission issue */
1360 hpPriv->retransmissionEvent = 1;
1365 zfIdlRsp(dev, rsp, rspLen);
1370 #define ZM_PROGRAM_RAM_ADDR 0x200000 //0x1000 //0x700000
1371 #define FIRMWARE_DOWNLOAD 0x30
1372 #define FIRMWARE_DOWNLOAD_COMP 0x31
1373 #define FIRMWARE_CONFIRM 0x32
1375 u16_t zfFirmwareDownload(zdev_t* dev, u32_t* fw, u32_t len, u32_t offset)
1377 u16_t ret = ZM_SUCCESS;
1378 u32_t uCodeOfst = offset;
1387 u32_t translen = (len > 4096) ? 4096 : len;
1389 result = zfwUsbSubmitControl(dev, FIRMWARE_DOWNLOAD,
1390 (u16_t) (uCodeOfst >> 8),
1391 0, image, translen);
1393 if (result != ZM_SUCCESS)
1395 zm_msg0_init(ZM_LV_0, "FIRMWARE_DOWNLOAD failed");
1402 uCodeOfst += translen; // in Word (16 bit)
1407 /* If download firmware success, issue a command to firmware */
1410 result = zfwUsbSubmitControl(dev, FIRMWARE_DOWNLOAD_COMP,
1413 if (result != ZM_SUCCESS)
1415 zm_msg0_init(ZM_LV_0, "FIRMWARE_DOWNLOAD_COMP failed");
1423 /* Wait for firmware ready */
1424 result = zfwUsbSubmitControl(dev, FIRMWARE_CONFIRM, USB_DIR_IN | 0x40,
1425 0, 0, &ret_value, sizeof(ret_value), HZ);
1429 zm_msg0_init(ZM_LV_0, "Can't receive firmware ready: ", result);
1440 u16_t zfFirmwareDownloadNotJump(zdev_t* dev, u32_t* fw, u32_t len, u32_t offset)
1442 u16_t ret = ZM_SUCCESS;
1443 u32_t uCodeOfst = offset;
1452 u32_t translen = (len > 4096) ? 4096 : len;
1454 result = zfwUsbSubmitControl(dev, FIRMWARE_DOWNLOAD,
1455 (u16_t) (uCodeOfst >> 8),
1456 0, image, translen);
1458 if (result != ZM_SUCCESS)
1460 zm_msg0_init(ZM_LV_0, "FIRMWARE_DOWNLOAD failed");
1467 uCodeOfst += translen; // in Word (16 bit)
1478 /************************************************************************/
1480 /* FUNCTION DESCRIPTION zfIdlGetFreeTxdCount */
1481 /* Get free PCI PCI TxD count. */
1484 /* dev : device pointer */
1490 /* Stephen ZyDAS Technology Corporation 2006.6 */
1492 /************************************************************************/
1493 u32_t zfHpGetFreeTxdCount(zdev_t* dev)
1495 return zfwUsbGetFreeTxQSize(dev);
1498 u32_t zfHpGetMaxTxdCount(zdev_t* dev)
1501 return zfwUsbGetMaxTxQSize(dev);
1504 void zfiUsbRegOutComplete(zdev_t* dev)
1509 extern void zfPushVtxq(zdev_t* dev);
1511 void zfiUsbOutComplete(zdev_t* dev, zbuf_t *buf, u8_t status, u8_t *hdr) {
1512 #ifndef ZM_ENABLE_AGGREGATION
1514 zfwBufFree(dev, buf, 0);
1517 #ifdef ZM_BYPASS_AGGR_SCHEDULING
1518 //Simply free the buf since BA retransmission is done in the firmware
1521 zfwBufFree(dev, buf, 0);
1525 zmw_get_wlan_dev(dev);
1527 #ifdef ZM_ENABLE_FW_BA_RETRANSMISSION
1528 //Simply free the buf since BA retransmission is done in the firmware
1531 zfwBufFree(dev, buf, 0);
1538 zfwBufFree(dev, buf, 0);
1539 //zm_debug_msg0("buf Free due to hdr == NULL");
1544 frameType = hdr[8] & 0xf;
1545 agg = (u8_t)(hdr[2] >> 5 ) & 0x1;
1546 //zm_debug_msg1("AGG=", agg);
1550 //delete buf in ba fail queue??
1554 zfwBufFree(dev, buf, 0);
1560 //zfwBufFree(dev, buf, 0);
1563 zfwBufFree(dev, buf, 0);
1569 if (wd->state != ZM_WLAN_STATE_ENABLED) {
1573 if( (wd->wlanMode == ZM_MODE_AP) ||
1574 (wd->wlanMode == ZM_MODE_INFRASTRUCTURE && wd->sta.EnableHT) ||
1575 (wd->wlanMode == ZM_MODE_PSEUDO) ) {
1576 zfAggTxScheduler(dev, 0);