aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/otus
diff options
context:
space:
mode:
authormerge <null@invalid>2009-01-22 13:55:32 +0000
committerAndy Green <agreen@octopus.localdomain>2009-01-22 13:55:32 +0000
commitaa6f5ffbdba45aa8e19e5048648fc6c7b25376d3 (patch)
treefbb786d0ac6f8a774fd834e9ce951197e60fbffa /drivers/staging/otus
parentf2d78193eae5dccd3d588d2c8ea0866efc368332 (diff)
MERGE-via-pending-tracking-hist-MERGE-via-stable-tracking-MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040-1232632141
pending-tracking-hist top was MERGE-via-stable-tracking-MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040-1232632141 / fdf777a63bcb59e0dfd78bfe2c6242e01f6d4eb9 ... parent commitmessage: From: merge <null@invalid> MERGE-via-stable-tracking-hist-MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040 stable-tracking-hist top was MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040 / 90463bfd2d5a3c8b52f6e6d71024a00e052b0ced ... parent commitmessage: From: merge <null@invalid> MERGE-via-mokopatches-tracking-hist-fix-stray-endmenu-patch mokopatches-tracking-hist top was fix-stray-endmenu-patch / 3630e0be570de8057e7f8d2fe501ed353cdf34e6 ... parent commitmessage: From: Andy Green <andy@openmoko.com> fix-stray-endmenu.patch Signed-off-by: Andy Green <andy@openmoko.com>
Diffstat (limited to 'drivers/staging/otus')
-rw-r--r--drivers/staging/otus/80211core/amsdu.c134
-rw-r--r--drivers/staging/otus/80211core/cagg.c3611
-rw-r--r--drivers/staging/otus/80211core/cagg.h435
-rw-r--r--drivers/staging/otus/80211core/ccmd.c1861
-rw-r--r--drivers/staging/otus/80211core/cfunc.c1227
-rw-r--r--drivers/staging/otus/80211core/cfunc.h449
-rw-r--r--drivers/staging/otus/80211core/chb.c200
-rw-r--r--drivers/staging/otus/80211core/cic.c496
-rw-r--r--drivers/staging/otus/80211core/cinit.c1911
-rw-r--r--drivers/staging/otus/80211core/cmm.c2141
-rw-r--r--drivers/staging/otus/80211core/cmmap.c2402
-rw-r--r--drivers/staging/otus/80211core/cmmsta.c5782
-rw-r--r--drivers/staging/otus/80211core/coid.c2695
-rw-r--r--drivers/staging/otus/80211core/cprecomp.h32
-rw-r--r--drivers/staging/otus/80211core/cpsmgr.c731
-rw-r--r--drivers/staging/otus/80211core/cscanmgr.c535
-rw-r--r--drivers/staging/otus/80211core/ctkip.c598
-rw-r--r--drivers/staging/otus/80211core/ctxrx.c4096
-rw-r--r--drivers/staging/otus/80211core/cwep.c299
-rw-r--r--drivers/staging/otus/80211core/cwm.c131
-rw-r--r--drivers/staging/otus/80211core/cwm.h45
-rw-r--r--drivers/staging/otus/80211core/freqctrl.c259
-rw-r--r--drivers/staging/otus/80211core/ledmgr.c557
-rw-r--r--drivers/staging/otus/80211core/performance.c431
-rw-r--r--drivers/staging/otus/80211core/performance.h97
-rw-r--r--drivers/staging/otus/80211core/pub_usb.h102
-rw-r--r--drivers/staging/otus/80211core/pub_zfi.h821
-rw-r--r--drivers/staging/otus/80211core/pub_zfw.h93
-rw-r--r--drivers/staging/otus/80211core/queue.c303
-rw-r--r--drivers/staging/otus/80211core/queue.h37
-rw-r--r--drivers/staging/otus/80211core/ratectrl.c874
-rw-r--r--drivers/staging/otus/80211core/ratectrl.h37
-rw-r--r--drivers/staging/otus/80211core/struct.h1315
-rw-r--r--drivers/staging/otus/80211core/wlan.h595
-rw-r--r--drivers/staging/otus/Kconfig32
-rw-r--r--drivers/staging/otus/Makefile67
-rw-r--r--drivers/staging/otus/TODO9
-rw-r--r--drivers/staging/otus/apdbg.c457
-rw-r--r--drivers/staging/otus/athr_common.h141
-rw-r--r--drivers/staging/otus/hal/hpDKfwu.c832
-rw-r--r--drivers/staging/otus/hal/hpani.c732
-rw-r--r--drivers/staging/otus/hal/hpani.h420
-rw-r--r--drivers/staging/otus/hal/hpfw2.c1018
-rw-r--r--drivers/staging/otus/hal/hpfwbu.c5269
-rw-r--r--drivers/staging/otus/hal/hpfwspiu.c655
-rw-r--r--drivers/staging/otus/hal/hpfwu.c1017
-rw-r--r--drivers/staging/otus/hal/hpfwu.c.drv_ba_resend742
-rw-r--r--drivers/staging/otus/hal/hpfwu_2k.c1016
-rw-r--r--drivers/staging/otus/hal/hpfwu_BA.c874
-rw-r--r--drivers/staging/otus/hal/hpfwu_FB50_mdk.c721
-rw-r--r--drivers/staging/otus/hal/hpfwu_OTUS_RC.c715
-rw-r--r--drivers/staging/otus/hal/hpfwu_txstream.c1017
-rw-r--r--drivers/staging/otus/hal/hpfwuinit.c240
-rw-r--r--drivers/staging/otus/hal/hpmain.c4643
-rw-r--r--drivers/staging/otus/hal/hpreg.c2481
-rw-r--r--drivers/staging/otus/hal/hpreg.h524
-rw-r--r--drivers/staging/otus/hal/hprw.c1557
-rw-r--r--drivers/staging/otus/hal/hpusb.c1584
-rw-r--r--drivers/staging/otus/hal/hpusb.h437
-rw-r--r--drivers/staging/otus/hal/otus.ini414
-rw-r--r--drivers/staging/otus/ioctl.c2913
-rw-r--r--drivers/staging/otus/oal_dt.h60
-rw-r--r--drivers/staging/otus/oal_marc.h135
-rw-r--r--drivers/staging/otus/usbdrv.c1148
-rw-r--r--drivers/staging/otus/usbdrv.h252
-rw-r--r--drivers/staging/otus/wrap_buf.c114
-rw-r--r--drivers/staging/otus/wrap_dbg.c101
-rw-r--r--drivers/staging/otus/wrap_ev.c283
-rw-r--r--drivers/staging/otus/wrap_mem.c101
-rw-r--r--drivers/staging/otus/wrap_mis.c109
-rw-r--r--drivers/staging/otus/wrap_pkt.c173
-rw-r--r--drivers/staging/otus/wrap_sec.c127
-rw-r--r--drivers/staging/otus/wrap_usb.c191
-rw-r--r--drivers/staging/otus/wwrap.c1134
-rw-r--r--drivers/staging/otus/zdcompat.h62
-rw-r--r--drivers/staging/otus/zdusb.c239
-rw-r--r--drivers/staging/otus/zdusb.h43
77 files changed, 70131 insertions, 0 deletions
diff --git a/drivers/staging/otus/80211core/amsdu.c b/drivers/staging/otus/80211core/amsdu.c
new file mode 100644
index 00000000000..c9123d58b82
--- /dev/null
+++ b/drivers/staging/otus/80211core/amsdu.c
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "cprecomp.h"
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfGetAmsduSubFrame */
+/* Get a subframe from a-MSDU. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : A-MSDU frame buffer */
+/* offset : offset of subframe in the A-MSDU */
+/* */
+/* OUTPUTS */
+/* NULL or subframe */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2007.2 */
+/* */
+/************************************************************************/
+zbuf_t* zfGetAmsduSubFrame(zdev_t* dev, zbuf_t* buf, u16_t* offset)
+{
+ u16_t subframeLen;
+ u16_t amsduLen = zfwBufGetSize(dev, buf);
+ zbuf_t* newBuf;
+
+ ZM_PERFORMANCE_RX_AMSDU(dev, buf, amsduLen);
+
+ /* Verify A-MSDU length */
+ if (amsduLen < (*offset + 14))
+ {
+ return NULL;
+ }
+
+ /* Locate A-MSDU subframe by offset and verify subframe length */
+ subframeLen = (zmw_buf_readb(dev, buf, *offset + 12) << 8) +
+ zmw_buf_readb(dev, buf, *offset + 13);
+ if (subframeLen == 0)
+ {
+ return NULL;
+ }
+
+ /* Verify A-MSDU subframe length */
+ if ((*offset+14+subframeLen) <= amsduLen)
+ {
+ /* Allocate a new buffer */
+ if ((newBuf = zfwBufAllocate(dev, 24+2+subframeLen)) != NULL)
+ {
+#ifdef ZM_ENABLE_NATIVE_WIFI
+ /* Copy and convert subframe to wlan frame format */
+ /* SHALL NOT INCLUDE QOS and AMSDU header. Ray 20070807 For Vista */
+ zfRxBufferCopy(dev, newBuf, buf, 0, 0, 24);
+ zfRxBufferCopy(dev, newBuf, buf, 24, *offset+14, subframeLen);
+ zfwBufSetSize(dev, newBuf, 24+subframeLen);
+#else
+ /* Copy subframe to new buffer */
+ zfRxBufferCopy(dev, newBuf, buf, 0, *offset, 14+subframeLen);
+ zfwBufSetSize(dev, newBuf, 14+subframeLen);
+#endif
+ /* Update offset */
+ *offset += (((14+subframeLen)+3) & 0xfffc);
+
+ /* Return buffer pointer */
+ return newBuf;
+ }
+ }
+ return NULL;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfDeAmsdu */
+/* De-AMSDU. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : A-MSDU frame buffer */
+/* vap : VAP port */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2007.2 */
+/* */
+/************************************************************************/
+void zfDeAmsdu(zdev_t* dev, zbuf_t* buf, u16_t vap, u8_t encryMode)
+{
+ u16_t offset = ZM_SIZE_OF_WLAN_DATA_HEADER+ZM_SIZE_OF_QOS_CTRL;
+ zbuf_t* subframeBuf;
+ zmw_get_wlan_dev(dev);
+
+ ZM_BUFFER_TRACE(dev, buf)
+
+ if (encryMode == ZM_AES || encryMode == ZM_TKIP)
+ {
+ offset += (ZM_SIZE_OF_IV + ZM_SIZE_OF_EXT_IV);
+ }
+ else if (encryMode == ZM_WEP64 || encryMode == ZM_WEP128)
+ {
+ offset += ZM_SIZE_OF_IV;
+ }
+
+ /* Repeatly calling zfGetAmsduSubFrame() until NULL returned */
+ while ((subframeBuf = zfGetAmsduSubFrame(dev, buf, &offset)) != NULL)
+ {
+ wd->commTally.NotifyNDISRxFrmCnt++;
+ if (wd->zfcbRecvEth != NULL)
+ {
+ wd->zfcbRecvEth(dev, subframeBuf, (u8_t)vap);
+ ZM_PERFORMANCE_RX_MSDU(dev, wd->tick);
+ }
+ }
+ zfwBufFree(dev, buf, 0);
+
+ return;
+}
diff --git a/drivers/staging/otus/80211core/cagg.c b/drivers/staging/otus/80211core/cagg.c
new file mode 100644
index 00000000000..4942190747a
--- /dev/null
+++ b/drivers/staging/otus/80211core/cagg.c
@@ -0,0 +1,3611 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : cagg.c */
+/* */
+/* Abstract */
+/* This module contains A-MPDU aggregation related functions. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/************************************************************************/
+
+#include "cprecomp.h"
+
+extern u8_t zcUpToAc[8];
+const u8_t pri[] = {3,3,2,3,2,1,3,2,1,0};
+
+
+u16_t aggr_count;
+u32_t success_mpdu;
+u32_t total_mpdu;
+
+void zfAggInit(zdev_t* dev)
+{
+ u16_t i,j;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+ /*
+ * reset sta information
+ */
+
+ zmw_enter_critical_section(dev);
+ wd->aggInitiated = 0;
+ wd->addbaComplete = 0;
+ wd->addbaCount = 0;
+ wd->reorder = 1;
+ for (i=0; i<ZM_MAX_STA_SUPPORT; i++)
+ {
+ for (j=0; j<ZM_AC; j++)
+ {
+ //wd->aggSta[i].aggQNumber[j] = ZM_AGG_POOL_SIZE;
+ wd->aggSta[i].aggFlag[j] = wd->aggSta[i].count[j] = 0;
+ wd->aggSta[i].tid_tx[j] = NULL;
+ wd->aggSta[i].tid_tx[j+1] = NULL;
+
+ }
+ }
+
+ /*
+ * reset Tx/Rx aggregation queue information
+ */
+ wd->aggState = 0;
+ for (i=0; i<ZM_AGG_POOL_SIZE; i++)
+ {
+ /*
+ * reset tx aggregation queue
+ */
+ wd->aggQPool[i] = zfwMemAllocate(dev, sizeof(struct aggQueue));
+ if(!wd->aggQPool[i])
+ {
+ zmw_leave_critical_section(dev);
+ return;
+ }
+ wd->aggQPool[i]->aggHead = wd->aggQPool[i]->aggTail =
+ wd->aggQPool[i]->aggQEnabled = wd->aggQPool[i]->aggReady =
+ wd->aggQPool[i]->clearFlag = wd->aggQPool[i]->deleteFlag = 0;
+ //wd->aggQPool[i]->aggSize = 16;
+
+ /*
+ * reset rx aggregation queue
+ */
+ wd->tid_rx[i] = zfwMemAllocate(dev, sizeof(struct agg_tid_rx));
+ if (!wd->tid_rx[i])
+ {
+ zmw_leave_critical_section(dev);
+ return;
+ }
+ wd->tid_rx[i]->aid = ZM_MAX_STA_SUPPORT;
+ wd->tid_rx[i]->seq_start = wd->tid_rx[i]->baw_head = \
+ wd->tid_rx[i]->baw_tail = 0;
+ wd->tid_rx[i]->sq_exceed_count = wd->tid_rx[i]->sq_behind_count = 0;
+ for (j=0; j<=ZM_AGG_BAW_SIZE; j++)
+ wd->tid_rx[i]->frame[j].buf = 0;
+ /*
+ * reset ADDBA exchange status code
+ * 0: NULL
+ * 1: ADDBA Request sent/received
+ * 2: ACK for ADDBA Request sent/received
+ * 3: ADDBA Response sent/received
+ * 4: ACK for ADDBA Response sent/received
+ */
+ wd->tid_rx[i]->addBaExchangeStatusCode = 0;
+
+ }
+ zmw_leave_critical_section(dev);
+ zfAggTallyReset(dev);
+ DESTQ.init = zfAggDestInit;
+ DESTQ.init(dev);
+ wd->aggInitiated = 1;
+ aggr_count = 0;
+ success_mpdu = 0;
+ total_mpdu = 0;
+#ifdef ZM_ENABLE_AGGREGATION
+#ifndef ZM_ENABLE_FW_BA_RETRANSMISSION //disable BAW
+ BAW = zfwMemAllocate(dev, sizeof(struct baw_enabler));
+ if(!BAW)
+ {
+ return;
+ }
+ BAW->init = zfBawInit;
+ BAW->init(dev);
+#endif //disable BAW
+#endif
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfAggGetSta */
+/* return STA AID. */
+/* take buf as input, use the dest address of buf as index to */
+/* search STA AID. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : buffer for one particular packet */
+/* */
+/* OUTPUTS */
+/* AID */
+/* */
+/* AUTHOR */
+/* Honda ZyDAS Technology Corporation 2006.11 */
+/* */
+/************************************************************************/
+
+
+
+u16_t zfAggGetSta(zdev_t* dev, zbuf_t* buf)
+{
+ u16_t id;
+ u16_t dst[3];
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ dst[0] = zmw_rx_buf_readh(dev, buf, 0);
+ dst[1] = zmw_rx_buf_readh(dev, buf, 2);
+ dst[2] = zmw_rx_buf_readh(dev, buf, 4);
+
+ zmw_enter_critical_section(dev);
+
+ if(wd->wlanMode == ZM_MODE_AP) {
+ id = zfApFindSta(dev, dst);
+ }
+ else {
+ id = 0;
+ }
+ zmw_leave_critical_section(dev);
+
+#if ZM_AGG_FPGA_DEBUG
+ id = 0;
+#endif
+
+ return id;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfAggTxGetQueue */
+/* return Queue Pool index. */
+/* take aid as input, look for the queue index associated */
+/* with this aid. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* aid : associated id */
+/* */
+/* OUTPUTS */
+/* Queue number */
+/* */
+/* AUTHOR */
+/* Honda ZyDAS Technology Corporation 2006.11 */
+/* */
+/************************************************************************/
+TID_TX zfAggTxGetQueue(zdev_t* dev, u16_t aid, u16_t tid)
+{
+ //u16_t i;
+ TID_TX tid_tx;
+ zmw_get_wlan_dev(dev);
+
+ //zmw_declare_for_critical_section();
+
+ /*
+ * not a STA aid
+ */
+ if (0xffff == aid)
+ return NULL;
+
+ //zmw_enter_critical_section(dev);
+
+ tid_tx = wd->aggSta[aid].tid_tx[tid];
+ if (!tid_tx) return NULL;
+ if (0 == tid_tx->aggQEnabled)
+ return NULL;
+
+ //zmw_leave_critical_section(dev);
+
+ return tid_tx;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfAggTxNewQueue */
+/* return Queue Pool index. */
+/* take aid as input, find a new queue for this aid. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* aid : associated id */
+/* */
+/* OUTPUTS */
+/* Queue number */
+/* */
+/* AUTHOR */
+/* Honda ZyDAS Technology Corporation 2006.12 */
+/* */
+/************************************************************************/
+TID_TX zfAggTxNewQueue(zdev_t* dev, u16_t aid, u16_t tid, zbuf_t* buf)
+{
+ u16_t i;
+ TID_TX tid_tx=NULL;
+ u16_t ac = zcUpToAc[tid&0x7] & 0x3;
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ /*
+ * not a STA aid
+ */
+ if (0xffff == aid)
+ return NULL;
+
+ zmw_enter_critical_section(dev);
+
+ /*
+ * find one new queue for sta
+ */
+ for (i=0; i<ZM_AGG_POOL_SIZE; i++)
+ {
+ if (wd->aggQPool[i]->aggQEnabled)
+ {
+ /*
+ * this q is enabled
+ */
+ }
+ else
+ {
+ tid_tx = wd->aggQPool[i];
+ tid_tx->aggQEnabled = 1;
+ tid_tx->aggQSTA = aid;
+ tid_tx->ac = ac;
+ tid_tx->tid = tid;
+ tid_tx->aggHead = tid_tx->aggTail = tid_tx->size = 0;
+ tid_tx->aggReady = 0;
+ wd->aggSta[aid].tid_tx[tid] = tid_tx;
+ tid_tx->dst[0] = zmw_rx_buf_readh(dev, buf, 0);
+ tid_tx->dst[1] = zmw_rx_buf_readh(dev, buf, 2);
+ tid_tx->dst[2] = zmw_rx_buf_readh(dev, buf, 4);
+ break;
+ }
+ }
+
+ zmw_leave_critical_section(dev);
+
+ return tid_tx;
+}
+
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfAggTxEnqueue */
+/* return Status code ZM_SUCCESS or error code */
+/* take (aid,ac,qnum,buf) as input */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* aid : associated id */
+/* ac : access category */
+/* qnum: the queue number to which will be enqueued */
+/* buf : the packet to be queued */
+/* */
+/* OUTPUTS */
+/* status code */
+/* */
+/* AUTHOR */
+/* Honda Atheros Communications, INC. 2006.12 */
+/* */
+/************************************************************************/
+u16_t zfAggTxEnqueue(zdev_t* dev, zbuf_t* buf, u16_t aid, TID_TX tid_tx)
+{
+ //u16_t qlen, frameLen;
+ u32_t time;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ tid_tx->size = zm_agg_qlen(dev, tid_tx->aggHead, tid_tx->aggTail);
+
+ if (tid_tx->size < (ZM_AGGQ_SIZE - 2))
+ {
+ /* Queue not full */
+
+
+ /*
+ * buffer copy
+ * in zfwBufFree will return a ndismsendcomplete
+ * to resolve the synchronize problem in aggregate
+ */
+
+ u8_t sendComplete = 0;
+
+ tid_tx->aggvtxq[tid_tx->aggHead].buf = buf;
+ time = zm_agg_GetTime();
+ tid_tx->aggvtxq[tid_tx->aggHead].arrivalTime = time;
+ tid_tx->aggvtxq[tid_tx->aggHead].baw_retransmit = 0;
+
+ tid_tx->aggHead = ((tid_tx->aggHead + 1) & ZM_AGGQ_SIZE_MASK);
+ tid_tx->lastArrival = time;
+ tid_tx->size++;
+ tid_tx->size = zm_agg_qlen(dev, tid_tx->aggHead, tid_tx->aggTail);
+ if (buf && (tid_tx->size < (ZM_AGGQ_SIZE - 10))) {
+ tid_tx->complete = tid_tx->aggHead;
+ sendComplete = 1;
+ }
+ zmw_leave_critical_section(dev);
+
+ if (!DESTQ.exist(dev, 0, tid_tx->ac, tid_tx, NULL)) {
+ DESTQ.insert(dev, 0, tid_tx->ac, tid_tx, NULL);
+ }
+
+ zm_msg1_agg(ZM_LV_0, "tid_tx->size=", tid_tx->size);
+ //zm_debug_msg1("tid_tx->size=", tid_tx->size);
+
+ if (buf && sendComplete && wd->zfcbSendCompleteIndication) {
+ //zmw_leave_critical_section(dev);
+ wd->zfcbSendCompleteIndication(dev, buf);
+ }
+
+ /*if (tid_tx->size >= 16 && zfHpGetFreeTxdCount(dev) > 20)
+ zfAggTxSend(dev, zfHpGetFreeTxdCount(dev), tid_tx);
+ */
+ return ZM_SUCCESS;
+ }
+ else
+ {
+ zm_msg1_agg(ZM_LV_0, "can't enqueue, tid_tx->size=", tid_tx->size);
+ /*
+ * Queue Full
+ */
+
+ /*
+ * zm_msg1_agg(ZM_LV_0, "Queue full, qnum = ", qnum);
+ * wd->commTally.txQosDropCount[ac]++;
+ * zfwBufFree(dev, buf, ZM_SUCCESS);
+ * zm_msg1_agg(ZM_LV_1, "Packet discarded, VTXQ full, ac=", ac);
+ *
+ * return ZM_ERR_EXCEED_PRIORITY_THRESHOLD;
+ */
+ }
+
+ zmw_leave_critical_section(dev);
+
+ if (!DESTQ.exist(dev, 0, tid_tx->ac, tid_tx, NULL)) {
+ DESTQ.insert(dev, 0, tid_tx->ac, tid_tx, NULL);
+ }
+
+ return ZM_ERR_EXCEED_PRIORITY_THRESHOLD;
+}
+
+u16_t zfAggDestExist(zdev_t* dev, u16_t Qtype, u16_t ac, TID_TX tid_tx, void* vtxq) {
+ struct dest* dest;
+ u16_t exist = 0;
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ if (!DESTQ.Head[ac]) {
+ exist = 0;
+ }
+ else {
+ dest = DESTQ.Head[ac];
+ if (dest->tid_tx == tid_tx) {
+ exist = 1;
+ }
+ else {
+ while (dest->next != DESTQ.Head[ac]) {
+ dest = dest->next;
+ if (dest->tid_tx == tid_tx){
+ exist = 1;
+ break;
+ }
+ }
+ }
+ }
+
+ zmw_leave_critical_section(dev);
+
+ return exist;
+}
+
+void zfAggDestInsert(zdev_t* dev, u16_t Qtype, u16_t ac, TID_TX tid_tx, void* vtxq)
+{
+ struct dest* new_dest;
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ new_dest = zfwMemAllocate(dev, sizeof(struct dest));
+ if(!new_dest)
+ {
+ return;
+ }
+ new_dest->Qtype = Qtype;
+ new_dest->tid_tx = tid_tx;
+ if (0 == Qtype)
+ new_dest->tid_tx = tid_tx;
+ else
+ new_dest->vtxq = vtxq;
+ if (!DESTQ.Head[ac]) {
+
+ zmw_enter_critical_section(dev);
+ new_dest->next = new_dest;
+ DESTQ.Head[ac] = DESTQ.dest[ac] = new_dest;
+ zmw_leave_critical_section(dev);
+ }
+ else {
+
+ zmw_enter_critical_section(dev);
+ new_dest->next = DESTQ.dest[ac]->next;
+ DESTQ.dest[ac]->next = new_dest;
+ zmw_leave_critical_section(dev);
+ }
+
+
+ //DESTQ.size[ac]++;
+ return;
+}
+
+void zfAggDestDelete(zdev_t* dev, u16_t Qtype, TID_TX tid_tx, void* vtxq)
+{
+ struct dest* dest, *temp;
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ if (wd->destLock) {
+ zmw_leave_critical_section(dev);
+ return;
+ }
+
+
+ //zmw_declare_for_critical_section();
+ for (i=0; i<4; i++) {
+ if (!DESTQ.Head[i]) continue;
+ dest = DESTQ.Head[i];
+ if (!dest) continue;
+
+
+ while (dest && (dest->next != DESTQ.Head[i])) {
+ if (Qtype == 0 && dest->next->tid_tx == tid_tx){
+ break;
+ }
+ if (Qtype == 1 && dest->next->vtxq == vtxq) {
+ break;
+ }
+ dest = dest->next;
+ }
+
+ if ((Qtype == 0 && dest->next->tid_tx == tid_tx) || (Qtype == 1 && dest->next->vtxq == vtxq)) {
+
+ tid_tx->size = zm_agg_qlen(dev, tid_tx->aggHead, tid_tx->aggTail);
+ if (tid_tx->size) {
+ zmw_leave_critical_section(dev);
+ return;
+ }
+ if (!DESTQ.Head[i]) {
+ temp = NULL;
+ }
+ else {
+ temp = dest->next;
+ if (temp == dest) {
+ DESTQ.Head[i] = DESTQ.dest[i] = NULL;
+ //DESTQ.size[i] = 0;
+ }
+ else {
+ dest->next = dest->next->next;
+ }
+ }
+
+ if (temp == NULL)
+ {/* do nothing */} //zfwMemFree(dev, temp, sizeof(struct dest));
+ else
+ zfwMemFree(dev, temp, sizeof(struct dest));
+
+ /*zmw_enter_critical_section(dev);
+ if (DESTQ.size[i] > 0)
+ DESTQ.size[i]--;
+ zmw_leave_critical_section(dev);
+ */
+ }
+
+ }
+ zmw_leave_critical_section(dev);
+ return;
+}
+
+void zfAggDestInit(zdev_t* dev)
+{
+ u16_t i;
+ zmw_get_wlan_dev(dev);
+
+ //zmw_declare_for_critical_section();
+
+ for (i=0; i<4; i++) {
+ //wd->destQ.Head[i].next = wd->destQ.Head[i];
+ //wd->destQ.dest[i] = wd->destQ.Head[i];
+ //DESTQ.size[i] = 0;
+ DESTQ.Head[i] = NULL;
+ }
+ DESTQ.insert = zfAggDestInsert;
+ DESTQ.delete = zfAggDestDelete;
+ DESTQ.init = zfAggDestInit;
+ DESTQ.getNext = zfAggDestGetNext;
+ DESTQ.exist = zfAggDestExist;
+ DESTQ.ppri = 0;
+ return;
+}
+
+struct dest* zfAggDestGetNext(zdev_t* dev, u16_t ac)
+{
+ struct dest *dest = NULL;
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ if (DESTQ.dest[ac]) {
+ dest = DESTQ.dest[ac];
+ DESTQ.dest[ac] = DESTQ.dest[ac]->next;
+ }
+ else {
+ dest = NULL;
+ }
+ zmw_leave_critical_section(dev);
+
+ return dest;
+}
+
+#ifdef ZM_ENABLE_AGGREGATION
+#ifndef ZM_ENABLE_FW_BA_RETRANSMISSION //disable BAW
+u16_t zfAggTidTxInsertHead(zdev_t* dev, struct bufInfo *buf_info,TID_TX tid_tx)
+{
+ zbuf_t* buf;
+ u32_t time;
+ struct baw_header *baw_header;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+
+ buf = buf_info->buf;
+
+ zmw_enter_critical_section(dev);
+ tid_tx->size = zm_agg_qlen(dev, tid_tx->aggHead, tid_tx->aggTail);
+ zmw_leave_critical_section(dev);
+
+ if (tid_tx->size >= (ZM_AGGQ_SIZE - 2)) {
+ zfwBufFree(dev, buf, ZM_SUCCESS);
+ return 0;
+ }
+
+ zmw_enter_critical_section(dev);
+ tid_tx->aggTail = (tid_tx->aggTail == 0)? ZM_AGGQ_SIZE_MASK: tid_tx->aggTail - 1;
+ tid_tx->aggvtxq[tid_tx->aggTail].buf = buf;
+ //time = zm_agg_GetTime();
+ tid_tx->aggvtxq[tid_tx->aggTail].arrivalTime = buf_info->timestamp;
+ tid_tx->aggvtxq[tid_tx->aggTail].baw_retransmit = buf_info->baw_retransmit;
+
+ baw_header = &tid_tx->aggvtxq[tid_tx->aggTail].baw_header;
+ baw_header->headerLen = buf_info->baw_header->headerLen;
+ baw_header->micLen = buf_info->baw_header->micLen;
+ baw_header->snapLen = buf_info->baw_header->snapLen;
+ baw_header->removeLen = buf_info->baw_header->removeLen;
+ baw_header->keyIdx = buf_info->baw_header->keyIdx;
+ zfwMemoryCopy((u8_t *)baw_header->header, (u8_t *)buf_info->baw_header->header, 58);
+ zfwMemoryCopy((u8_t *)baw_header->mic , (u8_t *)buf_info->baw_header->mic , 8);
+ zfwMemoryCopy((u8_t *)baw_header->snap , (u8_t *)buf_info->baw_header->snap , 8);
+
+ tid_tx->size++;
+ tid_tx->size = zm_agg_qlen(dev, tid_tx->aggHead, tid_tx->aggTail);
+ zmw_leave_critical_section(dev);
+
+ //tid_tx->lastArrival = time;
+ if (1 == tid_tx->size) {
+ DESTQ.insert(dev, 0, tid_tx->ac, tid_tx, NULL);
+ }
+
+
+ zm_msg1_agg(ZM_LV_0, "0xC2:insertHead, tid_tx->size=", tid_tx->size);
+
+ return TRUE;
+}
+#endif //disable BAW
+#endif
+
+void zfiTxComplete(zdev_t* dev)
+{
+
+ zmw_get_wlan_dev(dev);
+
+ //zmw_declare_for_critical_section();
+
+ if( (wd->wlanMode == ZM_MODE_AP) ||
+ (wd->wlanMode == ZM_MODE_INFRASTRUCTURE && wd->sta.EnableHT) ||
+ (wd->wlanMode == ZM_MODE_PSEUDO) ) {
+ zfAggTxScheduler(dev, 0);
+ }
+
+ return;
+}
+
+TID_TX zfAggTxReady(zdev_t* dev) {
+ //struct dest* dest;
+ u16_t i;
+ TID_TX tid_tx = NULL;
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ for (i=0; i<ZM_AGG_POOL_SIZE; i++)
+ {
+ if (wd->aggQPool[i]->aggQEnabled)
+ {
+ if (wd->aggQPool[i]->size >= 16) {
+ tid_tx = wd->aggQPool[i];
+ break;
+ }
+ }
+ else {
+ }
+ }
+ zmw_leave_critical_section(dev);
+ return tid_tx;
+}
+
+u16_t zfAggValidTidTx(zdev_t* dev, TID_TX tid_tx) {
+ u16_t i, valid = 0;
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ for (i=0; i<ZM_AGG_POOL_SIZE; i++)
+ {
+ if (wd->aggQPool[i] == tid_tx)
+ {
+ valid = 1;
+ break;
+ }
+ else {
+ }
+ }
+ zmw_leave_critical_section(dev);
+
+ return valid;
+}
+
+void zfAggTxScheduler(zdev_t* dev, u8_t ScanAndClear)
+{
+ TID_TX tid_tx = NULL;
+ void* vtxq;
+ struct dest* dest;
+ zbuf_t* buf;
+ u32_t txql, min_txql;
+ //u16_t aggr_size = 1;
+ u16_t txq_threshold;
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ if (!wd->aggInitiated)
+ {
+ return;
+ }
+
+ /* debug */
+ txql = TXQL;
+ min_txql = AGG_MIN_TXQL;
+
+ if(wd->txq_threshold)
+ txq_threshold = wd->txq_threshold;
+ else
+ txq_threshold = AGG_MIN_TXQL;
+
+ tid_tx = zfAggTxReady(dev);
+ if (tid_tx) ScanAndClear = 0;
+ while (zfHpGetFreeTxdCount(dev) > 20 && (TXQL < txq_threshold || tid_tx)) {
+ //while (zfHpGetFreeTxdCount(dev) > 20 && (ScanAndClear || tid_tx)) {
+ //while (TXQL < txq_threshold) {
+ u16_t i;
+ u8_t ac;
+ s8_t destQ_count = 0;
+ //while ((zfHpGetFreeTxdCount(dev)) > 32) {
+
+ //DbgPrint("zfAggTxScheduler: in while loop");
+ for (i=0; i<4; i++) {
+ if (DESTQ.Head[i]) destQ_count++;
+ }
+ if (0 >= destQ_count) break;
+
+ zmw_enter_critical_section(dev);
+ ac = pri[DESTQ.ppri]; DESTQ.ppri = (DESTQ.ppri + 1) % 10;
+ zmw_leave_critical_section(dev);
+
+ for (i=0; i<10; i++){
+ if(DESTQ.Head[ac]) break;
+
+ zmw_enter_critical_section(dev);
+ ac = pri[DESTQ.ppri]; DESTQ.ppri = (DESTQ.ppri + 1) % 10;
+ zmw_leave_critical_section(dev);
+ }
+ if (i == 10) break;
+ //DbgPrint("zfAggTxScheduler: have dest Q");
+ zmw_enter_critical_section(dev);
+ wd->destLock = 1;
+ zmw_leave_critical_section(dev);
+
+ dest = DESTQ.getNext(dev, ac);
+ if (!dest) {
+ zmw_enter_critical_section(dev);
+ wd->destLock = 0;
+ zmw_leave_critical_section(dev);
+
+ DbgPrint("bug report! DESTQ.getNext got nothing!");
+ break;
+ }
+ if (dest->Qtype == 0) {
+ tid_tx = dest->tid_tx;
+
+ //DbgPrint("zfAggTxScheduler: have tid_tx Q");
+
+ if(tid_tx && zfAggValidTidTx(dev, tid_tx))
+ tid_tx->size = zm_agg_qlen(dev, tid_tx->aggHead, tid_tx->aggTail);
+ else {
+ zmw_enter_critical_section(dev);
+ wd->destLock = 0;
+ zmw_leave_critical_section(dev);
+
+ tid_tx = zfAggTxReady(dev);
+ continue;
+ }
+
+ zmw_enter_critical_section(dev);
+ wd->destLock = 0;
+ zmw_leave_critical_section(dev);
+ //zmw_enter_critical_section(dev);
+ if (tid_tx && !tid_tx->size) {
+
+ //zmw_leave_critical_section(dev);
+ //DESTQ.delete(dev, 0, tid_tx, NULL);
+ }
+ else if(wd->aggState == 0){
+ //wd->aggState = 1;
+ //zmw_leave_critical_section(dev);
+ zfAggTxSend(dev, zfHpGetFreeTxdCount(dev), tid_tx);
+ //wd->aggState = 0;
+ }
+ else {
+ //zmw_leave_critical_section(dev);
+ break;
+ }
+ }
+ else {
+ vtxq = dest->vtxq;
+ buf = zfGetVtxq(dev, ac);
+ zm_assert( buf != 0 );
+
+ zfTxSendEth(dev, buf, 0, ZM_EXTERNAL_ALLOC_BUF, 0);
+
+ }
+ /*flush all but < 16 frames in tid_tx to TXQ*/
+ tid_tx = zfAggTxReady(dev);
+ }
+
+ /*while ((zfHpGetFreeTxdCount(dev)) > 32) {
+ //while ((zfHpGetFreeTxdCount(dev)) > 32) {
+
+ destQ_count = 0;
+ for (i=0; i<4; i++) destQ_count += wd->destQ.size[i];
+ if (0 >= destQ_count) break;
+
+ ac = pri[wd->destQ.ppri]; wd->destQ.ppri = (wd->destQ.ppri + 1) % 10;
+ for (i=0; i<10; i++){
+ if(wd->destQ.size[ac]!=0) break;
+ ac = pri[wd->destQ.ppri]; wd->destQ.ppri = (wd->destQ.ppri + 1) % 10;
+ }
+ if (i == 10) break;
+ dest = wd->destQ.getNext(dev, ac);
+ if (dest->Qtype == 0) {
+ tid_tx = dest->tid_tx;
+ tid_tx->size = zm_agg_qlen(dev, tid_tx->aggHead, tid_tx->aggTail);
+ if (!tid_tx->size) {
+ wd->destQ.delete(dev, 0, tid_tx, NULL);
+ break;
+ }
+ else if((wd->aggState == 0) && (tid_tx->size >= 16)){
+ zfAggTxSend(dev, zfHpGetFreeTxdCount(dev), tid_tx);
+ }
+ else {
+ break;
+ }
+ }
+
+ }
+ */
+ return;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfAggTx */
+/* return Status code ZM_SUCCESS or error code */
+/* management A-MPDU aggregation function, */
+/* management aggregation queue, calculate arrivalrate, */
+/* add/delete an aggregation queue of a stream, */
+/* enqueue packets into responsible aggregate queue. */
+/* take (dev, buf, ac) as input */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : packet buff */
+/* ac : access category */
+/* */
+/* OUTPUTS */
+/* status code */
+/* */
+/* AUTHOR */
+/* Honda Atheros Communications, INC. 2006.12 */
+/* */
+/************************************************************************/
+u16_t zfAggTx(zdev_t* dev, zbuf_t* buf, u16_t tid)
+{
+ u16_t aid;
+ //u16_t qnum;
+ //u16_t aggflag = 0;
+ //u16_t arrivalrate = 0;
+ TID_TX tid_tx;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ if(!wd->aggInitiated)
+ {
+ return ZM_ERR_TX_BUFFER_UNAVAILABLE;
+ }
+
+ aid = zfAggGetSta(dev, buf);
+
+ //arrivalrate = zfAggTxArrivalRate(dev, aid, tid);
+
+ if (0xffff == aid)
+ {
+ /*
+ * STA not associated, this is a BC/MC or STA->AP packet
+ */
+
+ return ZM_ERR_TX_BUFFER_UNAVAILABLE;
+ }
+
+ /*
+ * STA associated, a unicast packet
+ */
+
+ tid_tx = zfAggTxGetQueue(dev, aid, tid);
+
+ /*tid_q.tid_tx = tid_tx;
+ wd->destQ.insert = zfAggDestInsert;
+ wd->destQ.insert(dev, 0, tid_q);
+ */
+ if (tid_tx != NULL)
+ {
+ /*
+ * this (aid, ac) is aggregated
+ */
+
+ //if (arrivalrate < ZM_AGG_LOW_THRESHOLD)
+ if (0)
+ {
+ /*
+ * arrival rate too low
+ * delete this aggregate queue
+ */
+
+ zmw_enter_critical_section(dev);
+
+ //wd->aggQPool[qnum]->clearFlag = wd->aggQPool[qnum]->deleteFlag =1;
+
+ zmw_leave_critical_section(dev);
+
+ }
+
+ return zfAggTxEnqueue(dev, buf, aid, tid_tx);
+
+ }
+ else
+ {
+ /*
+ * this (aid, ac) not yet aggregated
+ * queue not found
+ */
+
+ //if (arrivalrate > ZM_AGG_HIGH_THRESHOLD)
+ if (1)
+ {
+ /*
+ * arrivalrate high enough to get a new agg queue
+ */
+
+ tid_tx = zfAggTxNewQueue(dev, aid, tid, buf);
+
+ //zm_msg1_agg(ZM_LV_0, "get new AggQueue qnum = ", tid_tx->);
+
+ if (tid_tx)
+ {
+ /*
+ * got a new aggregate queue
+ */
+
+ //zmw_enter_critical_section(dev);
+
+ //wd->aggSta[aid].aggFlag[ac] = 1;
+
+ //zmw_leave_critical_section(dev);
+
+ /*
+ * add ADDBA functions here
+ * return ZM_ERR_TX_BUFFER_UNAVAILABLE;
+ */
+
+
+ //zfAggSendAddbaRequest(dev, tid_tx->dst, tid_tx->ac, tid_tx->tid);
+ //zmw_enter_critical_section(dev);
+
+ //wd->aggSta[aid].aggFlag[ac] = 0;
+
+ //zmw_leave_critical_section(dev);
+
+ return zfAggTxEnqueue(dev, buf, aid, tid_tx);
+
+ }
+ else
+ {
+ /*
+ * just can't get a new aggregate queue
+ */
+
+ return ZM_ERR_TX_BUFFER_UNAVAILABLE;
+ }
+ }
+ else
+ {
+ /*
+ * arrival rate is not high enough to get a new agg queue
+ */
+
+ return ZM_ERR_TX_BUFFER_UNAVAILABLE;
+ }
+ }
+
+
+
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfAggTxReadyCount */
+/* return counter of ready to aggregate queues. */
+/* take (dev, ac) as input, only calculate the ready to aggregate */
+/* queues of one particular ac. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* ac : access category */
+/* */
+/* OUTPUTS */
+/* counter of ready to aggregate queues */
+/* */
+/* AUTHOR */
+/* Honda Atheros Communications, INC. 2006.12 */
+/* */
+/************************************************************************/
+u16_t zfAggTxReadyCount(zdev_t* dev, u16_t ac)
+{
+ u16_t i;
+ u16_t readycount = 0;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ for (i=0 ; i<ZM_AGG_POOL_SIZE; i++)
+ {
+ if (wd->aggQPool[i]->aggQEnabled && (wd->aggQPool[i]->aggReady || \
+ wd->aggQPool[i]->clearFlag) && ac == wd->aggQPool[i]->ac)
+ readycount++;
+ }
+
+ zmw_leave_critical_section(dev);
+
+ return readycount;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfAggTxPartial */
+/* return the number that Vtxq has to send. */
+/* take (dev, ac, readycount) as input, calculate the ratio of */
+/* Vtxq length to (Vtxq length + readycount) of a particular ac, */
+/* and returns the Vtxq length * the ratio */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* ac : access category */
+/* readycount: the number of ready to aggregate queues of this ac */
+/* */
+/* OUTPUTS */
+/* Vtxq length * ratio */
+/* */
+/* AUTHOR */
+/* Honda Atheros Communications, INC. 2006.12 */
+/* */
+/************************************************************************/
+u16_t zfAggTxPartial(zdev_t* dev, u16_t ac, u16_t readycount)
+{
+ u16_t qlen;
+ u16_t partial;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ qlen = zm_agg_qlen(dev, wd->vtxqHead[ac], wd->vtxqTail[ac]);
+
+ if ((qlen + readycount) > 0)
+ {
+ partial = (u16_t)( zm_agg_weight(ac) * ((u16_t)qlen/(qlen + \
+ readycount)) );
+ }
+ else
+ {
+ partial = 0;
+ }
+
+ zmw_leave_critical_section(dev);
+
+ if (partial > qlen)
+ partial = qlen;
+
+ return partial;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfAggTxSend */
+/* return sentcount */
+/* take (dev, ac, n) as input, n is the number of scheduled agg */
+/* queues to be sent of the particular ac. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* ac : access category */
+/* n : the number of scheduled aggregation queues to be sent */
+/* */
+/* OUTPUTS */
+/* sentcount */
+/* */
+/* AUTHOR */
+/* Honda Atheros Communications, INC. 2006.12 */
+/* */
+/************************************************************************/
+u16_t zfAggTxSend(zdev_t* dev, u32_t freeTxd, TID_TX tid_tx)
+{
+ //u16_t qnum;
+ //u16_t qlen;
+ u16_t j;
+ //u16_t sentcount = 0;
+ zbuf_t* buf;
+ struct aggControl aggControl;
+ u16_t aggLen;
+ //zbuf_t* newBuf;
+ //u16_t bufLen;
+ //TID_BAW tid_baw = NULL;
+ //struct bufInfo *buf_info;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ //while (tid_tx->size > 0)
+
+ zmw_enter_critical_section(dev);
+ tid_tx->size = zm_agg_qlen(dev, tid_tx->aggHead, tid_tx->aggTail);
+ aggLen = zm_agg_min(16, zm_agg_min(tid_tx->size, (u16_t)(freeTxd - 2)));
+ zmw_leave_critical_section(dev);
+
+ /*
+ * why there have to be 2 free Txd?
+ */
+ if (aggLen <=0 )
+ return 0;
+
+
+ if (aggLen == 1) {
+ buf = zfAggTxGetVtxq(dev, tid_tx);
+ if (buf)
+ zfTxSendEth(dev, buf, 0, ZM_EXTERNAL_ALLOC_BUF, 0);
+ if (tid_tx->size == 0) {
+ //DESTQ.delete(dev, 0, tid_tx, NULL);
+ }
+
+ return 1;
+ }
+ /*
+ * Free Txd queue is big enough to put aggregation
+ */
+ zmw_enter_critical_section(dev);
+ if (wd->aggState == 1) {
+ zmw_leave_critical_section(dev);
+ return 0;
+ }
+ wd->aggState = 1;
+ zmw_leave_critical_section(dev);
+
+
+ zm_msg1_agg(ZM_LV_0, "aggLen=", aggLen);
+ tid_tx->aggFrameSize = 0;
+ for (j=0; j < aggLen; j++) {
+ buf = zfAggTxGetVtxq(dev, tid_tx);
+
+ zmw_enter_critical_section(dev);
+ tid_tx->size = zm_agg_qlen(dev, tid_tx->aggHead, tid_tx->aggTail);
+ zmw_leave_critical_section(dev);
+
+ if ( buf ) {
+ //struct aggTally *agg_tal;
+ u16_t completeIndex;
+
+ if (0 == j) {
+ aggControl.ampduIndication = ZM_AGG_FIRST_MPDU;
+
+ }
+ else if ((j == (aggLen - 1)) || tid_tx->size == 0)
+ {
+ aggControl.ampduIndication = ZM_AGG_LAST_MPDU;
+ //wd->aggState = 0;
+
+ }
+ else
+ {
+ aggControl.ampduIndication = ZM_AGG_MIDDLE_MPDU;
+ /* the packet is delayed more than 500 ms, drop it */
+
+ }
+ tid_tx->aggFrameSize += zfwBufGetSize(dev, buf);
+ aggControl.addbaIndication = 0;
+ aggControl.aggEnabled = 1;
+
+#ifdef ZM_AGG_TALLY
+ agg_tal = &wd->agg_tal;
+ agg_tal->sent_packets_sum++;
+
+#endif
+
+ zfAggTxSendEth(dev, buf, 0, ZM_EXTERNAL_ALLOC_BUF, 0, &aggControl, tid_tx);
+
+ zmw_enter_critical_section(dev);
+ completeIndex = tid_tx->complete;
+ if(zm_agg_inQ(tid_tx, tid_tx->complete))
+ zm_agg_plus(tid_tx->complete);
+ zmw_leave_critical_section(dev);
+
+ if(zm_agg_inQ(tid_tx, completeIndex) && wd->zfcbSendCompleteIndication
+ && tid_tx->aggvtxq[completeIndex].buf) {
+ wd->zfcbSendCompleteIndication(dev, tid_tx->aggvtxq[completeIndex].buf);
+ zm_debug_msg0("in queue complete worked!");
+ }
+
+ }
+ else {
+ /*
+ * this aggregation queue is empty
+ */
+ zm_msg1_agg(ZM_LV_0, "aggLen not reached, but no more frame, j=", j);
+
+ break;
+ }
+ }
+ zmw_enter_critical_section(dev);
+ wd->aggState = 0;
+ zmw_leave_critical_section(dev);
+
+ //zm_acquire_agg_spin_lock(Adapter);
+ tid_tx->size = zm_agg_qlen(dev, tid_tx->aggHead, tid_tx->aggTail);
+ //zm_release_agg_spin_lock(Adapter);
+
+ if (tid_tx->size == 0) {
+ //DESTQ.delete(dev, 0, tid_tx, NULL);
+ }
+
+
+
+ //zfAggInvokeBar(dev, tid_tx);
+ if(j>0) {
+ aggr_count++;
+ zm_msg1_agg(ZM_LV_0, "0xC2:sent 1 aggr, aggr_count=", aggr_count);
+ zm_msg1_agg(ZM_LV_0, "0xC2:sent 1 aggr, aggr_size=", j);
+ }
+ return j;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfAggTxGetReadyQueue */
+/* return the number of the aggregation queue */
+/* take (dev, ac) as input, find the agg queue with smallest */
+/* arrival time (waited longest) among those ready or clearFlag */
+/* set queues. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* ac : access category */
+/* */
+/* OUTPUTS */
+/* aggregation queue number */
+/* */
+/* AUTHOR */
+/* Honda Atheros Communications, INC. 2006.12 */
+/* */
+/************************************************************************/
+TID_TX zfAggTxGetReadyQueue(zdev_t* dev, u16_t ac)
+{
+ //u16_t qnum = ZM_AGG_POOL_SIZE;
+ u16_t i;
+ u32_t time = 0;
+ TID_TX tid_tx = NULL;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ for (i=0 ;i<ZM_AGG_POOL_SIZE; i++)
+ {
+ if (1 == wd->aggQPool[i]->aggQEnabled && ac == wd->aggQPool[i]->ac &&
+ (wd->aggQPool[i]->size > 0))
+ {
+ if (0 == time || time > wd->aggQPool[i]->aggvtxq[ \
+ wd->aggQPool[i]->aggHead ].arrivalTime)
+ {
+ tid_tx = wd->aggQPool[i];
+ time = tid_tx->aggvtxq[ tid_tx->aggHead ].arrivalTime;
+ }
+ }
+ }
+
+ zmw_leave_critical_section(dev);
+
+ return tid_tx;
+}
+
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfAggTxGetVtxq */
+/* return an MSDU */
+/* take (dev, qnum) as input, return an MSDU out of the agg queue. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* qnum: queue number */
+/* */
+/* OUTPUTS */
+/* a MSDU */
+/* */
+/* AUTHOR */
+/* Honda Atheros Communications, INC. 2006.12 */
+/* */
+/************************************************************************/
+zbuf_t* zfAggTxGetVtxq(zdev_t* dev, TID_TX tid_tx)
+{
+ zbuf_t* buf = NULL;
+
+ zmw_declare_for_critical_section();
+
+ if (tid_tx->aggHead != tid_tx->aggTail)
+ {
+ buf = tid_tx->aggvtxq[ tid_tx->aggTail ].buf;
+
+ tid_tx->aggvtxq[tid_tx->aggTail].buf = NULL;
+
+ zmw_enter_critical_section(dev);
+ tid_tx->aggTail = ((tid_tx->aggTail + 1) & ZM_AGGQ_SIZE_MASK);
+ if(tid_tx->size > 0) tid_tx->size--;
+ tid_tx->size = zm_agg_qlen(dev, tid_tx->aggHead, tid_tx->aggTail);
+ if (NULL == buf) {
+ //tid_tx->aggTail = tid_tx->aggHead = tid_tx->size = 0;
+ //zm_msg1_agg(ZM_LV_0, "GetVtxq buf == NULL, tid_tx->size=", tid_tx->size);
+ }
+ zmw_leave_critical_section(dev);
+ }
+ else
+ {
+ /*
+ * queue is empty
+ */
+ zm_msg1_agg(ZM_LV_0, "tid_tx->aggHead == tid_tx->aggTail, tid_tx->size=", tid_tx->size);
+
+ }
+
+ if (zm_agg_qlen(dev, tid_tx->aggHead, tid_tx->aggTail) != tid_tx->size)
+ zm_msg1_agg(ZM_LV_0, "qlen!=tid_tx->size! tid_tx->size=", tid_tx->size);
+ return buf;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfAggTxDeleteQueue */
+/* return ZM_SUCCESS (can't fail) */
+/* take (dev, qnum) as input, reset (delete) this aggregate queue, */
+/* this queue is virtually returned to the aggregate queue pool. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* qnum: queue number */
+/* */
+/* OUTPUTS */
+/* ZM_SUCCESS */
+/* */
+/* AUTHOR */
+/* Honda Atheros Communications, INC. 2006.12 */
+/* */
+/************************************************************************/
+u16_t zfAggTxDeleteQueue(zdev_t* dev, u16_t qnum)
+{
+ u16_t ac, tid;
+ struct aggQueue *tx_tid;
+ struct aggSta *agg_sta;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ tx_tid = wd->aggQPool[qnum];
+ agg_sta = &wd->aggSta[tx_tid->aggQSTA];
+ ac = tx_tid->ac;
+ tid = tx_tid->tid;
+
+ zmw_enter_critical_section(dev);
+
+ tx_tid->aggQEnabled = 0;
+ tx_tid->aggHead = tx_tid->aggTail = 0;
+ tx_tid->aggReady = 0;
+ tx_tid->clearFlag = tx_tid->deleteFlag = 0;
+ tx_tid->size = 0;
+ agg_sta->count[ac] = 0;
+
+ agg_sta->tid_tx[tid] = NULL;
+ agg_sta->aggFlag[ac] = 0;
+
+ zmw_leave_critical_section(dev);
+
+ zm_msg1_agg(ZM_LV_0, "queue deleted! qnum=", qnum);
+
+ return ZM_SUCCESS;
+}
+
+#ifdef ZM_ENABLE_AGGREGATION
+#ifndef ZM_ENABLE_FW_BA_RETRANSMISSION //disable BAW
+void zfBawCore(zdev_t* dev, u16_t baw_seq, u32_t bitmap, u16_t aggLen) {
+ TID_BAW tid_baw;
+ s16_t i;
+ zbuf_t* buf;
+ struct bufInfo *buf_info;
+
+ zmw_get_wlan_dev(dev);
+ //zmw_declare_for_critical_section();
+ tid_baw = BAW->getQ(dev, baw_seq);
+ //tid_baw = NULL;
+ if (NULL == tid_baw)
+ return;
+
+ total_mpdu += aggLen;
+ for (i = aggLen - 1; i>=0; i--) {
+ if (((bitmap >> i) & 0x1) == 0) {
+ buf_info = BAW->pop(dev, i, tid_baw);
+ buf = buf_info->buf;
+ if (buf) {
+ //wd->zfcbSetBawQ(dev, buf, 0);
+ zfAggTidTxInsertHead(dev, buf_info, tid_baw->tid_tx);
+ }
+ }
+ else {
+ success_mpdu++;
+ }
+ }
+ BAW->disable(dev, tid_baw);
+ zfAggTxScheduler(dev);
+ zm_debug_msg1("success_mpdu = ", success_mpdu);
+ zm_debug_msg1(" total_mpdu = ", total_mpdu);
+}
+
+void zfBawInit(zdev_t* dev) {
+ TID_BAW tid_baw;
+ u16_t i,j;
+ zmw_get_wlan_dev(dev);
+ //zmw_declare_for_critical_section();
+
+ for (i=0; i<ZM_BAW_POOL_SIZE; i++){
+ tid_baw = &BAW->tid_baw[i];
+ for (j=0; j<ZM_VTXQ_SIZE; j++) {
+ tid_baw->frame[j].buf = NULL;
+ }
+ tid_baw->enabled = tid_baw->head = tid_baw->tail = tid_baw->size = 0;
+ tid_baw->start_seq = 0;
+ }
+ BAW->delPoint = 0;
+ BAW->core = zfBawCore;
+ BAW->getNewQ = zfBawGetNewQ;
+ BAW->insert = zfBawInsert;
+ BAW->pop = zfBawPop;
+ BAW->enable = zfBawEnable;
+ BAW->disable = zfBawDisable;
+ BAW->getQ = zfBawGetQ;
+}
+
+
+
+TID_BAW zfBawGetNewQ(zdev_t* dev, u16_t start_seq, TID_TX tid_tx) {
+ TID_BAW tid_baw=NULL;
+ TID_BAW next_baw=NULL;
+ u16_t i;
+ zmw_get_wlan_dev(dev);
+ //zmw_declare_for_critical_section();
+
+ /*
+ for (i=0; i<ZM_BAW_POOL_SIZE; i++){
+ tid_baw = &BAW->tid_baw[i];
+ if (FALSE == tid_baw->enabled)
+ break;
+ }
+ */
+
+ tid_baw = &BAW->tid_baw[BAW->delPoint];
+ i = BAW->delPoint;
+ //if (ZM_BAW_POOL_SIZE == i) {
+ //return NULL;
+ // u8_t temp = BAW->delPoint;
+ // tid_baw = &BAW->tid_baw[BAW->delPoint];
+ // BAW->disable(dev, tid_baw);
+ // BAW->delPoint = (BAW->delPoint < (ZM_BAW_POOL_SIZE - 1))? (BAW->delPoint + 1): 0;
+ // temp = BAW->delPoint;
+ //}
+
+ zm_msg1_agg(ZM_LV_0, "get new tid_baw, index=", i);
+ BAW->delPoint = (i < (ZM_BAW_POOL_SIZE -1))? (i + 1): 0;
+ next_baw = &BAW->tid_baw[BAW->delPoint];
+ if (1 == next_baw->enabled) BAW->disable(dev, next_baw);
+
+ BAW->enable(dev, tid_baw, start_seq);
+ tid_baw->tid_tx = tid_tx;
+
+ return tid_baw;
+}
+
+u16_t zfBawInsert(zdev_t* dev, zbuf_t* buf, u16_t baw_seq, TID_BAW tid_baw, u8_t baw_retransmit, struct baw_header_r *header_r) {
+ //TID_BAW tid_baw;
+ //u16_t bufLen;
+
+ //zmw_get_wlan_dev(dev);
+ //zmw_declare_for_critical_section();
+
+ if(tid_baw->size < (ZM_VTXQ_SIZE - 1)) {
+ struct baw_header *baw_header = &tid_baw->frame[tid_baw->head].baw_header;
+
+ baw_header->headerLen = header_r->headerLen;
+ baw_header->micLen = header_r->micLen;
+ baw_header->snapLen = header_r->snapLen;
+ baw_header->removeLen = header_r->removeLen;
+ baw_header->keyIdx = header_r->keyIdx;
+ zfwMemoryCopy((u8_t *)baw_header->header, (u8_t *)header_r->header, 58);
+ zfwMemoryCopy((u8_t *)baw_header->mic , (u8_t *)header_r->mic , 8);
+ zfwMemoryCopy((u8_t *)baw_header->snap , (u8_t *)header_r->snap , 8);
+ //wd->zfcbSetBawQ(dev, buf, 1);
+ tid_baw->frame[tid_baw->head].buf = buf;
+ tid_baw->frame[tid_baw->head].baw_seq = baw_seq;
+ tid_baw->frame[tid_baw->head].baw_retransmit = baw_retransmit + 1;
+
+ //tid_baw->frame[tid_baw->head].data = pBuf->data;
+ tid_baw->head++;
+ tid_baw->size++;
+ }
+ else {
+ //wd->zfcbSetBawQ(dev, buf, 0);
+ zfwBufFree(dev, buf, ZM_SUCCESS);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+struct bufInfo* zfBawPop(zdev_t* dev, u16_t index, TID_BAW tid_baw) {
+ //TID_BAW tid_baw;
+ //zbuf_t* buf;
+ struct bufInfo *buf_info;
+ zmw_get_wlan_dev(dev);
+
+ buf_info = &wd->buf_info;
+ buf_info->baw_header = NULL;
+
+ if (NULL == (buf_info->buf = tid_baw->frame[index].buf))
+ return buf_info;
+
+ buf_info->baw_retransmit = tid_baw->frame[index].baw_retransmit;
+ buf_info->baw_header = &tid_baw->frame[index].baw_header;
+ buf_info->timestamp = tid_baw->frame[index].timestamp;
+ //pBuf->data = pBuf->buffer;
+ //wd->zfcbRestoreBufData(dev, buf);
+ tid_baw->frame[index].buf = NULL;
+
+ return buf_info;
+}
+
+void zfBawEnable(zdev_t* dev, TID_BAW tid_baw, u16_t start_seq) {
+ //TID_BAW tid_baw;
+
+ //zmw_get_wlan_dev(dev);
+ //zmw_declare_for_critical_section();
+
+ tid_baw->enabled = TRUE;
+ tid_baw->head = tid_baw->tail = tid_baw->size = 0;
+ tid_baw->start_seq = start_seq;
+}
+
+void zfBawDisable(zdev_t* dev, TID_BAW tid_baw) {
+ //TID_BAW tid_baw;
+ u16_t i;
+
+ //zmw_get_wlan_dev(dev);
+ //zmw_declare_for_critical_section();
+ for (i=0; i<ZM_VTXQ_SIZE; i++) {
+ if (tid_baw->frame[i].buf) {
+
+ //wd->zfcbSetBawQ(dev, tid_baw->frame[i].buf, 0);
+ zfwBufFree(dev, tid_baw->frame[i].buf, ZM_SUCCESS);
+ tid_baw->frame[i].buf = NULL;
+ }
+ }
+
+ tid_baw->enabled = FALSE;
+}
+
+TID_BAW zfBawGetQ(zdev_t* dev, u16_t baw_seq) {
+ TID_BAW tid_baw=NULL;
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+ //zmw_declare_for_critical_section();
+ for (i=0; i<ZM_BAW_POOL_SIZE; i++){
+ tid_baw = &BAW->tid_baw[i];
+ if (TRUE == tid_baw->enabled)
+ {
+ zm_msg1_agg(ZM_LV_0, "get an old tid_baw, baw_seq=", baw_seq);
+ zm_msg1_agg(ZM_LV_0, "check a tid_baw->start_seq=", tid_baw->start_seq);
+ if(baw_seq == tid_baw->start_seq)
+ break;
+ }
+
+ }
+ if (ZM_BAW_POOL_SIZE == i)
+ return NULL;
+ return tid_baw;
+}
+#endif //disable BAW
+#endif
+
+u16_t zfAggTallyReset(zdev_t* dev)
+{
+ struct aggTally* agg_tal;
+
+ zmw_get_wlan_dev(dev);
+
+ //zmw_declare_for_critical_section();
+
+ agg_tal = &wd->agg_tal;
+ agg_tal->got_packets_sum = 0;
+ agg_tal->got_bytes_sum = 0;
+ agg_tal->sent_bytes_sum = 0;
+ agg_tal->sent_packets_sum = 0;
+ agg_tal->avg_got_packets = 0;
+ agg_tal->avg_got_bytes = 0;
+ agg_tal->avg_sent_packets = 0;
+ agg_tal->avg_sent_bytes = 0;
+ agg_tal->time = 0;
+ return 0;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfAggScanAndClear */
+/* If the packets in a queue have waited for too long, clear and */
+/* delete this aggregation queue. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* time : current time */
+/* */
+/* OUTPUTS */
+/* ZM_SUCCESS */
+/* */
+/* AUTHOR */
+/* Honda Atheros Communications, INC. 2006.12 */
+/* */
+/************************************************************************/
+u16_t zfAggScanAndClear(zdev_t* dev, u32_t time)
+{
+ u16_t i;
+ u16_t head;
+ u16_t tail;
+ u32_t tick;
+ u32_t arrivalTime;
+ //u16_t aid, ac;
+ TID_TX tid_tx;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ if(!(wd->state == ZM_WLAN_STATE_ENABLED)) return 0;
+ zfAggTxScheduler(dev, 1);
+ tick = zm_agg_GetTime();
+ for (i=0; i<ZM_AGG_POOL_SIZE; i++)
+ {
+ if (!wd->aggQPool[i]) return 0;
+ if (1 == wd->aggQPool[i]->aggQEnabled)
+ {
+ tid_tx = wd->aggQPool[i];
+ zmw_enter_critical_section(dev);
+
+ head = tid_tx->aggHead;
+ tail = tid_tx->aggTail;
+
+ arrivalTime = (u32_t)tid_tx->aggvtxq[tid_tx->aggTail].arrivalTime;
+
+
+ if((tick - arrivalTime) <= ZM_AGG_CLEAR_TIME)
+ {
+
+ }
+ else if((tid_tx->size = zm_agg_qlen(dev, tid_tx->aggHead, tid_tx->aggTail)) > 0)
+ {
+
+ tid_tx->clearFlag = 1;
+
+ //zm_msg1_agg(ZM_LV_0, "clear queue tick =", tick);
+ //zm_msg1_agg(ZM_LV_0, "clear queue arrival =", arrivalTime);
+
+
+ //zmw_leave_critical_section(dev);
+ //zfAggTxScheduler(dev);
+ //zmw_enter_critical_section(dev);
+
+ }
+
+ if (tid_tx->size == 0)
+ {
+ /*
+ * queue empty
+ */
+ if (tick - tid_tx->lastArrival > ZM_AGG_DELETE_TIME)
+ {
+ zm_msg1_agg(ZM_LV_0, "delete queue, idle for n sec. n = ", \
+ ZM_AGG_DELETE_TIME/10);
+
+ zmw_leave_critical_section(dev);
+ zfAggTxDeleteQueue(dev, i);
+ zmw_enter_critical_section(dev);
+ }
+ }
+
+ zmw_leave_critical_section(dev);
+ }
+ }
+
+ zfAggRxClear(dev, time);
+
+#ifdef ZM_AGG_TALLY
+ if((wd->tick % 100) == 0) {
+ zfAggPrintTally(dev);
+ }
+#endif
+
+ return ZM_SUCCESS;
+}
+
+u16_t zfAggPrintTally(zdev_t* dev)
+{
+ struct aggTally* agg_tal;
+
+ zmw_get_wlan_dev(dev);
+
+ //zmw_declare_for_critical_section();
+
+ agg_tal = &wd->agg_tal;
+
+ if(agg_tal->got_packets_sum < 10)
+ {
+ zfAggTallyReset(dev);
+ return 0;
+ }
+
+ agg_tal->time++;
+ agg_tal->avg_got_packets = (agg_tal->avg_got_packets * (agg_tal->time - 1) +
+ agg_tal->got_packets_sum) / agg_tal->time;
+ agg_tal->avg_got_bytes = (agg_tal->avg_got_bytes * (agg_tal->time - 1) +
+ agg_tal->got_bytes_sum) / agg_tal->time;
+ agg_tal->avg_sent_packets = (agg_tal->avg_sent_packets * (agg_tal->time - 1)
+ + agg_tal->sent_packets_sum) / agg_tal->time;
+ agg_tal->avg_sent_bytes = (agg_tal->avg_sent_bytes * (agg_tal->time - 1) +
+ agg_tal->sent_bytes_sum) / agg_tal->time;
+ zm_msg1_agg(ZM_LV_0, "got_packets_sum =", agg_tal->got_packets_sum);
+ zm_msg1_agg(ZM_LV_0, " got_bytes_sum =", agg_tal->got_bytes_sum);
+ zm_msg1_agg(ZM_LV_0, "sent_packets_sum=", agg_tal->sent_packets_sum);
+ zm_msg1_agg(ZM_LV_0, " sent_bytes_sum =", agg_tal->sent_bytes_sum);
+ agg_tal->got_packets_sum = agg_tal->got_bytes_sum =agg_tal->sent_packets_sum
+ = agg_tal->sent_bytes_sum = 0;
+ zm_msg1_agg(ZM_LV_0, "avg_got_packets =", agg_tal->avg_got_packets);
+ zm_msg1_agg(ZM_LV_0, " avg_got_bytes =", agg_tal->avg_got_bytes);
+ zm_msg1_agg(ZM_LV_0, "avg_sent_packets=", agg_tal->avg_sent_packets);
+ zm_msg1_agg(ZM_LV_0, " avg_sent_bytes =", agg_tal->avg_sent_bytes);
+ if ((wd->commTally.BA_Fail == 0) || (wd->commTally.Hw_Tx_MPDU == 0))
+ {
+ zm_msg1_agg(ZM_LV_0, "Hardware Tx MPDU=", wd->commTally.Hw_Tx_MPDU);
+ zm_msg1_agg(ZM_LV_0, " BA Fail number=", wd->commTally.BA_Fail);
+ }
+ else
+ zm_msg1_agg(ZM_LV_0, "1/(BA fail rate)=", wd->commTally.Hw_Tx_MPDU/wd->commTally.BA_Fail);
+
+ return 0;
+}
+
+u16_t zfAggRxClear(zdev_t* dev, u32_t time)
+{
+ u16_t i;
+ struct agg_tid_rx *tid_rx;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ for (i=0; i<ZM_AGG_POOL_SIZE; i++)
+ {
+ zmw_enter_critical_section(dev);
+ tid_rx = wd->tid_rx[i];
+ if (tid_rx->baw_head != tid_rx->baw_tail)
+ {
+ u16_t j = tid_rx->baw_tail;
+ while ((j != tid_rx->baw_head) && !tid_rx->frame[j].buf) {
+ j = (j + 1) & ZM_AGG_BAW_MASK;
+ }
+ if ((j != tid_rx->baw_head) && (time - tid_rx->frame[j].arrivalTime) >
+ (ZM_AGG_CLEAR_TIME - 5))
+ {
+ zmw_leave_critical_section(dev);
+ zm_msg0_agg(ZM_LV_1, "queue RxFlush by RxClear");
+ zfAggRxFlush(dev, 0, tid_rx);
+ zmw_enter_critical_section(dev);
+ }
+ }
+ zmw_leave_critical_section(dev);
+ }
+
+ return ZM_SUCCESS;
+}
+
+struct agg_tid_rx* zfAggRxEnabled(zdev_t* dev, zbuf_t* buf)
+{
+ u16_t dst0, src[3], ac, aid, fragOff;
+ u8_t up;
+ u16_t offset = 0;
+ u16_t seq_no;
+ u16_t frameType;
+ u16_t frameCtrl;
+ u16_t frameSubtype;
+ u32_t tcp_seq;
+ //struct aggSta *agg_sta;
+#if ZM_AGG_FPGA_REORDERING
+ struct agg_tid_rx *tid_rx;
+#endif
+ zmw_get_wlan_dev(dev);
+
+ //zmw_declare_for_critical_section();
+ seq_no = zmw_rx_buf_readh(dev, buf, 22) >> 4;
+ //DbgPrint("Rx seq=%d\n", seq_no);
+ if (wd->sta.EnableHT == 0)
+ {
+ return NULL;
+ }
+
+ frameCtrl = zmw_rx_buf_readb(dev, buf, 0);
+ frameType = frameCtrl & 0xf;
+ frameSubtype = frameCtrl & 0xf0;
+
+
+ if (frameType != ZM_WLAN_DATA_FRAME) //non-Qos Data? (frameSubtype&0x80)
+ {
+ return NULL;
+ }
+#ifdef ZM_ENABLE_PERFORMANCE_EVALUATION
+ tcp_seq = zmw_rx_buf_readb(dev, buf, 22+36) << 24;
+ tcp_seq += zmw_rx_buf_readb(dev, buf, 22+37) << 16;
+ tcp_seq += zmw_rx_buf_readb(dev, buf, 22+38) << 8;
+ tcp_seq += zmw_rx_buf_readb(dev, buf, 22+39);
+#endif
+
+ ZM_SEQ_DEBUG("In %5d, %12u\n", seq_no, tcp_seq);
+ dst0 = zmw_rx_buf_readh(dev, buf, offset+4);
+
+ src[0] = zmw_rx_buf_readh(dev, buf, offset+10);
+ src[1] = zmw_rx_buf_readh(dev, buf, offset+12);
+ src[2] = zmw_rx_buf_readh(dev, buf, offset+14);
+
+#if ZM_AGG_FPGA_DEBUG
+ aid = 0;
+#else
+ aid = zfApFindSta(dev, src);
+#endif
+
+ //agg_sta = &wd->aggSta[aid];
+ //zfTxGetIpTosAndFrag(dev, buf, &up, &fragOff);
+ //ac = zcUpToAc[up&0x7] & 0x3;
+
+ /*
+ * Filter unicast frame only, aid == 0 is for debug only
+ */
+ if ((dst0 & 0x1) == 0 && aid == 0)
+ {
+#if ZM_AGG_FPGA_REORDERING
+ tid_rx = zfAggRxGetQueue(dev, buf) ;
+ if(!tid_rx)
+ return NULL;
+ else
+ {
+ //if (tid_rx->addBaExchangeStatusCode == ZM_AGG_ADDBA_RESPONSE)
+ return tid_rx;
+ }
+#else
+ return NULL;
+#endif
+ }
+
+ return NULL;
+}
+
+u16_t zfAggRx(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo *addInfo, struct agg_tid_rx *tid_rx)
+{
+ u16_t seq_no;
+ s16_t index;
+ u16_t offset = 0;
+ zbuf_t* pbuf;
+ u8_t frameSubType;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ ZM_BUFFER_TRACE(dev, buf)
+
+ ZM_PERFORMANCE_RX_REORDER(dev);
+
+ seq_no = zmw_rx_buf_readh(dev, buf, offset+22) >> 4;
+
+ index = seq_no - tid_rx->seq_start;
+ /*
+ * for debug
+ */
+
+ /* zm_msg2_agg(ZM_LV_0, "queue seq = ", seq_no);
+ * DbgPrint("%s:%s%lxh %s%lxh\n", __func__, "queue seq=", seq_no,
+ * "; seq_start=", tid_rx->seq_start);
+ */
+
+ //DbgPrint("seq_no=%d, seq_start=%d\n", seq_no, tid_rx->seq_start);
+
+ /* In some APs, we found that it might transmit NULL data whose sequence number
+ is out or order. In order to avoid this problem, we ignore these NULL data.
+ */
+
+ frameSubType = (zmw_rx_buf_readh(dev, buf, 0) & 0xF0) >> 4;
+
+ /* If this is a NULL data instead of Qos NULL data */
+ if ((frameSubType & 0x0C) == 0x04)
+ {
+ s16_t seq_diff;
+
+ seq_diff = (seq_no > tid_rx->seq_start) ?
+ seq_no - tid_rx->seq_start : tid_rx->seq_start - seq_no;
+
+ if (seq_diff > ZM_AGG_BAW_SIZE)
+ {
+ zm_debug_msg0("Free Rx NULL data in zfAggRx");
+
+ /* Free Rx buffer */
+ zfwBufFree(dev, buf, 0);
+ return ZM_ERR_OUT_OF_ORDER_NULL_DATA;
+ }
+ }
+
+ /*
+ * sequence number wrap at 4k
+ */
+ if (tid_rx->seq_start > seq_no)
+ {
+ //index += 4096;
+
+ zmw_enter_critical_section(dev);
+ if (tid_rx->seq_start >= 4096) {
+ tid_rx->seq_start = 0;
+ }
+ zmw_leave_critical_section(dev);
+
+ }
+
+ if (tid_rx->seq_start == seq_no) {
+ zmw_enter_critical_section(dev);
+ if (((tid_rx->baw_head - tid_rx->baw_tail) & ZM_AGG_BAW_MASK) > 0) {
+ //DbgPrint("head=%d, tail=%d", tid_rx->baw_head, tid_rx->baw_tail);
+ tid_rx->baw_tail = (tid_rx->baw_tail + 1) & ZM_AGG_BAW_MASK;
+ }
+ tid_rx->seq_start = (tid_rx->seq_start + 1) & (4096 - 1);
+ zmw_leave_critical_section(dev);
+
+ ZM_PERFORMANCE_RX_SEQ(dev, buf);
+
+ if (wd->zfcbRecv80211 != NULL) {
+ //seq_no = zmw_rx_buf_readh(dev, buf, offset+22) >> 4;
+ //DbgPrint("Recv indicate seq=%d\n", seq_no);
+ //DbgPrint("1. seq=%d\n", seq_no);
+
+ wd->zfcbRecv80211(dev, buf, addInfo);
+ }
+ else {
+ zfiRecv80211(dev, buf, addInfo);
+ }
+ }
+ else if (!zfAggRxEnqueue(dev, buf, tid_rx, addInfo))
+ {
+ /*
+ * duplicated packet
+ */
+ return 1;
+ }
+
+ while (tid_rx->baw_head != tid_rx->baw_tail) {// && tid_rx->frame[tid_rx->baw_tail].buf)
+ u16_t tailIndex;
+
+ zmw_enter_critical_section(dev);
+
+ tailIndex = tid_rx->baw_tail;
+ pbuf = tid_rx->frame[tailIndex].buf;
+ tid_rx->frame[tailIndex].buf = 0;
+ if (!pbuf)
+ {
+ zmw_leave_critical_section(dev);
+ break;
+ }
+
+ tid_rx->baw_tail = (tid_rx->baw_tail + 1) & ZM_AGG_BAW_MASK;
+ tid_rx->seq_start = (tid_rx->seq_start + 1) & (4096 - 1);
+
+
+ //if(pbuf && tid_rx->baw_size > 0)
+ // tid_rx->baw_size--;
+
+ zmw_leave_critical_section(dev);
+
+ ZM_PERFORMANCE_RX_SEQ(dev, pbuf);
+
+ if (wd->zfcbRecv80211 != NULL)
+ {
+ //seq_no = zmw_rx_buf_readh(dev, pbuf, offset+22) >> 4;
+ //DbgPrint("Recv indicate seq=%d\n", seq_no);
+ //DbgPrint("1. seq=%d\n", seq_no);
+ wd->zfcbRecv80211(dev, pbuf, addInfo);
+ }
+ else
+ {
+ //seq_no = zmw_rx_buf_readh(dev, pbuf, offset+22) >> 4;
+ //DbgPrint("Recv indicate seq=%d\n", seq_no);
+ zfiRecv80211(dev, pbuf, addInfo);
+ }
+ }
+
+ return 1;
+}
+
+struct agg_tid_rx *zfAggRxGetQueue(zdev_t* dev, zbuf_t* buf)
+{
+ u16_t src[3];
+ u16_t aid, ac, i;
+ u16_t offset = 0;
+ struct agg_tid_rx *tid_rx = NULL;
+
+ zmw_get_wlan_dev(dev);
+
+ //zmw_declare_for_critical_section();
+
+ src[0] = zmw_rx_buf_readh(dev, buf, offset+10);
+ src[1] = zmw_rx_buf_readh(dev, buf, offset+12);
+ src[2] = zmw_rx_buf_readh(dev, buf, offset+14);
+ aid = zfApFindSta(dev, src);
+
+ ac = (zmw_rx_buf_readh(dev, buf, 24) & 0xF);
+
+ // mark by spin lock debug
+ //zmw_enter_critical_section(dev);
+
+ for (i=0; i<ZM_AGG_POOL_SIZE ; i++)
+ {
+ if((wd->tid_rx[i]->aid == aid) && (wd->tid_rx[i]->ac == ac))
+ {
+ tid_rx = wd->tid_rx[i];
+ break;
+ }
+ }
+
+ // mark by spin lock debug
+ //zmw_leave_critical_section(dev);
+ return tid_rx;
+}
+
+
+u16_t zfAggRxEnqueue(zdev_t* dev, zbuf_t* buf, struct agg_tid_rx *tid_rx, struct zsAdditionInfo *addInfo)
+{
+ u16_t seq_no, offset = 0;
+ u16_t q_index;
+ s16_t index;
+ u8_t bdropframe = 0;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ ZM_BUFFER_TRACE(dev, buf)
+
+ seq_no = zmw_rx_buf_readh(dev, buf, offset+22) >> 4;
+ index = seq_no - tid_rx->seq_start;
+
+ /*
+ * sequence number wrap at 4k
+ * -1000: check for duplicate past packet
+ */
+ bdropframe = 0;
+ if (tid_rx->seq_start > seq_no) {
+ if ((tid_rx->seq_start > 3967) && (seq_no < 128)) {
+ index += 4096;
+ } else if (tid_rx->seq_start - seq_no > 70) {
+ zmw_enter_critical_section(dev);
+ tid_rx->sq_behind_count++;
+ if (tid_rx->sq_behind_count > 3) {
+ tid_rx->sq_behind_count = 0;
+ } else {
+ bdropframe = 1;
+ }
+ zmw_leave_critical_section(dev);
+ } else {
+ bdropframe = 1;
+ }
+ } else {
+ if (seq_no - tid_rx->seq_start > 70) {
+ zmw_enter_critical_section(dev);
+ tid_rx->sq_exceed_count++;
+ if (tid_rx->sq_exceed_count > 3) {
+ tid_rx->sq_exceed_count = 0;
+ } else {
+ bdropframe = 1;
+ }
+ zmw_leave_critical_section(dev);
+ }
+ }
+
+ if (bdropframe == 1) {
+ /*if (wd->zfcbRecv80211 != NULL) {
+ wd->zfcbRecv80211(dev, buf, addInfo);
+ }
+ else {
+ zfiRecv80211(dev, buf, addInfo);
+ }*/
+
+ ZM_PERFORMANCE_FREE(dev, buf);
+
+ zfwBufFree(dev, buf, 0);
+ /*zfAggRxFlush(dev, seq_no, tid_rx);
+ tid_rx->seq_start = seq_no;
+ index = seq_no - tid_rx->seq_start;
+ */
+
+ //DbgPrint("Free an old packet, seq_start=%d, seq_no=%d\n", tid_rx->seq_start, seq_no);
+
+ /*
+ * duplicate past packet
+ * happens only in simulated aggregation environment
+ */
+ return 0;
+ } else {
+ zmw_enter_critical_section(dev);
+ if (tid_rx->sq_exceed_count > 0){
+ tid_rx->sq_exceed_count--;
+ }
+
+ if (tid_rx->sq_behind_count > 0) {
+ tid_rx->sq_behind_count--;
+ }
+ zmw_leave_critical_section(dev);
+ }
+
+ if (index < 0) {
+ zfAggRxFlush(dev, seq_no, tid_rx);
+ tid_rx->seq_start = seq_no;
+ index = 0;
+ }
+
+ //if (index >= (ZM_AGG_BAW_SIZE - 1))
+ if (index >= (ZM_AGG_BAW_MASK))
+ {
+ /*
+ * queue full
+ */
+ //DbgPrint("index >= 64, seq_start=%d, seq_no=%d\n", tid_rx->seq_start, seq_no);
+ zfAggRxFlush(dev, seq_no, tid_rx);
+ //tid_rx->seq_start = seq_no;
+ index = seq_no - tid_rx->seq_start;
+ if ((tid_rx->seq_start > seq_no) && (tid_rx->seq_start > 1000) && (tid_rx->seq_start - 1000) > seq_no)
+ {
+ //index = seq_no - tid_rx->seq_start;
+ index += 4096;
+ }
+ //index = seq_no - tid_rx->seq_start;
+ while (index >= (ZM_AGG_BAW_MASK)) {
+ //DbgPrint("index >= 64, seq_start=%d, seq_no=%d\n", tid_rx->seq_start, seq_no);
+ tid_rx->seq_start = (tid_rx->seq_start + ZM_AGG_BAW_MASK) & (4096 - 1);
+ index = seq_no - tid_rx->seq_start;
+ if ((tid_rx->seq_start > seq_no) && (tid_rx->seq_start > 1000) && (tid_rx->seq_start - 1000) > seq_no)
+ {
+ index += 4096;
+ }
+ }
+ }
+
+
+ q_index = (tid_rx->baw_tail + index) & ZM_AGG_BAW_MASK;
+ if (tid_rx->frame[q_index].buf && (((tid_rx->baw_head - tid_rx->baw_tail) & ZM_AGG_BAW_MASK) >
+ (((q_index) - tid_rx->baw_tail) & ZM_AGG_BAW_MASK)))
+ {
+
+ ZM_PERFORMANCE_DUP(dev, tid_rx->frame[q_index].buf, buf);
+ zfwBufFree(dev, buf, 0);
+ //DbgPrint("Free a duplicate packet, seq_start=%d, seq_no=%d\n", tid_rx->seq_start, seq_no);
+ //DbgPrint("head=%d, tail=%d", tid_rx->baw_head, tid_rx->baw_tail);
+ /*
+ * duplicate packet
+ */
+ return 0;
+ }
+
+ zmw_enter_critical_section(dev);
+ if(tid_rx->frame[q_index].buf) {
+ zfwBufFree(dev, tid_rx->frame[q_index].buf, 0);
+ tid_rx->frame[q_index].buf = 0;
+ }
+
+ tid_rx->frame[q_index].buf = buf;
+ tid_rx->frame[q_index].arrivalTime = zm_agg_GetTime();
+ zfwMemoryCopy((void*)&tid_rx->frame[q_index].addInfo, (void*)addInfo, sizeof(struct zsAdditionInfo));
+
+ /*
+ * for debug simulated aggregation only,
+ * should be done in rx of ADDBA Request
+ */
+ //tid_rx->addInfo = addInfo;
+
+
+ if (((tid_rx->baw_head - tid_rx->baw_tail) & ZM_AGG_BAW_MASK) <= index)
+ {
+ //tid_rx->baw_size = index + 1;
+ if (((tid_rx->baw_head - tid_rx->baw_tail) & ZM_AGG_BAW_MASK) <=
+ //((q_index + 1) & ZM_AGG_BAW_MASK))
+ (((q_index) - tid_rx->baw_tail) & ZM_AGG_BAW_MASK))//tid_rx->baw_size )
+ tid_rx->baw_head = (q_index + 1) & ZM_AGG_BAW_MASK;
+ }
+ zmw_leave_critical_section(dev);
+
+ /*
+ * success
+ */
+ //DbgPrint("head=%d, tail=%d, start=%d", tid_rx->baw_head, tid_rx->baw_tail, tid_rx->seq_start);
+ return 1;
+}
+
+u16_t zfAggRxFlush(zdev_t* dev, u16_t seq_no, struct agg_tid_rx *tid_rx)
+{
+ zbuf_t* pbuf;
+ u16_t seq;
+ struct zsAdditionInfo addInfo;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ ZM_PERFORMANCE_RX_FLUSH(dev);
+
+ while (1)
+ {
+ zmw_enter_critical_section(dev);
+ if (tid_rx->baw_tail == tid_rx->baw_head) {
+ zmw_leave_critical_section(dev);
+ break;
+ }
+
+ pbuf = tid_rx->frame[tid_rx->baw_tail].buf;
+ zfwMemoryCopy((void*)&addInfo, (void*)&tid_rx->frame[tid_rx->baw_tail].addInfo, sizeof(struct zsAdditionInfo));
+ tid_rx->frame[tid_rx->baw_tail].buf = 0;
+ //if(pbuf && tid_rx->baw_size > 0) tid_rx->baw_size--;
+ tid_rx->baw_tail = (tid_rx->baw_tail + 1) & ZM_AGG_BAW_MASK;
+ tid_rx->seq_start = (tid_rx->seq_start + 1) & (4096 - 1);
+ zmw_leave_critical_section(dev);
+
+ if (pbuf)
+ {
+
+ ZM_PERFORMANCE_RX_SEQ(dev, pbuf);
+
+ if (wd->zfcbRecv80211 != NULL)
+ {
+ seq = zmw_rx_buf_readh(dev, pbuf, 22) >> 4;
+ //DbgPrint("Recv indicate seq=%d\n", seq);
+ //DbgPrint("2. seq=%d\n", seq);
+ wd->zfcbRecv80211(dev, pbuf, &addInfo);
+ }
+ else
+ {
+ seq = zmw_rx_buf_readh(dev, pbuf, 22) >> 4;
+ //DbgPrint("Recv indicate seq=%d\n", seq);
+ zfiRecv80211(dev, pbuf, &addInfo);
+ }
+ }
+ }
+
+ zmw_enter_critical_section(dev);
+ tid_rx->baw_head = tid_rx->baw_tail = 0;
+ zmw_leave_critical_section(dev);
+ return 1;
+}
+
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfAggRxFreeBuf */
+/* Frees all queued packets in buffer when the driver is down. */
+/* The zfFreeResource() will check if the buffer is all freed. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* ZM_SUCCESS */
+/* */
+/* AUTHOR */
+/* Honda Atheros Communications, INC. 2006.12 */
+/* */
+/************************************************************************/
+u16_t zfAggRxFreeBuf(zdev_t* dev, u16_t destroy)
+{
+ u16_t i;
+ zbuf_t* buf;
+ struct agg_tid_rx *tid_rx;
+
+ TID_TX tid_tx;
+ //struct bufInfo *buf_info;
+
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ for (i=0; i<ZM_AGG_POOL_SIZE; i++)
+ {
+ u16_t j;
+
+ tid_rx = wd->tid_rx[i];
+
+ for(j=0; j <= ZM_AGG_BAW_SIZE; j++)
+ {
+ zmw_enter_critical_section(dev);
+ buf = tid_rx->frame[j].buf;
+ tid_rx->frame[j].buf = 0;
+ zmw_leave_critical_section(dev);
+
+ if (buf)
+ {
+ zfwBufFree(dev, buf, 0);
+ }
+ }
+
+ #if 0
+ if ( tid_rx->baw_head != tid_rx->baw_tail )
+ {
+ while (tid_rx->baw_head != tid_rx->baw_tail)
+ {
+ buf = tid_rx->frame[tid_rx->baw_tail].buf;
+ tid_rx->frame[tid_rx->baw_tail].buf = 0;
+ if (buf)
+ {
+ zfwBufFree(dev, buf, 0);
+
+ zmw_enter_critical_section(dev);
+ tid_rx->frame[tid_rx->baw_tail].buf = 0;
+ zmw_leave_critical_section(dev);
+ }
+ zmw_enter_critical_section(dev);
+ //if (tid_rx->baw_size > 0)tid_rx->baw_size--;
+ tid_rx->baw_tail = (tid_rx->baw_tail + 1) & ZM_AGG_BAW_MASK;
+ tid_rx->seq_start++;
+ zmw_leave_critical_section(dev);
+ }
+ }
+ #endif
+
+ zmw_enter_critical_section(dev);
+ tid_rx->seq_start = 0;
+ tid_rx->baw_head = tid_rx->baw_tail = 0;
+ tid_rx->aid = ZM_MAX_STA_SUPPORT;
+ zmw_leave_critical_section(dev);
+
+ #ifdef ZM_ENABLE_AGGREGATION
+ #ifndef ZM_ENABLE_FW_BA_RETRANSMISSION //disable BAW
+ if (tid_baw->enabled) {
+ zm_msg1_agg(ZM_LV_0, "Device down, clear BAW queue:", i);
+ BAW->disable(dev, tid_baw);
+ }
+ #endif
+ #endif
+ if (1 == wd->aggQPool[i]->aggQEnabled) {
+ tid_tx = wd->aggQPool[i];
+ buf = zfAggTxGetVtxq(dev, tid_tx);
+ while (buf) {
+ zfwBufFree(dev, buf, 0);
+ buf = zfAggTxGetVtxq(dev, tid_tx);
+ }
+ }
+
+ if(destroy) {
+ zfwMemFree(dev, wd->aggQPool[i], sizeof(struct aggQueue));
+ zfwMemFree(dev, wd->tid_rx[i], sizeof(struct agg_tid_rx));
+ }
+ }
+ #ifdef ZM_ENABLE_AGGREGATION
+ #ifndef ZM_ENABLE_FW_BA_RETRANSMISSION //disable BAW
+ if(destroy) zfwMemFree(dev, BAW, sizeof(struct baw_enabler));
+ #endif
+ #endif
+ return ZM_SUCCESS;
+}
+
+
+void zfAggRecvBAR(zdev_t* dev, zbuf_t *buf) {
+ u16_t start_seq, len;
+ u8_t i, bitmap[8];
+ len = zfwBufGetSize(dev, buf);
+ start_seq = zmw_rx_buf_readh(dev, buf, len-2);
+ DbgPrint("Received a BAR Control frame, start_seq=%d", start_seq>>4);
+ /* todo: set the bitmap by reordering buffer! */
+ for (i=0; i<8; i++) bitmap[i]=0;
+ zfSendBA(dev, start_seq, bitmap);
+}
+
+#ifdef ZM_ENABLE_AGGREGATION
+#ifndef ZM_ENABLE_FW_BA_RETRANSMISSION //disable BAW
+void zfAggTxRetransmit(zdev_t* dev, struct bufInfo *buf_info, struct aggControl *aggControl, TID_TX tid_tx) {
+ u16_t removeLen;
+ u16_t err;
+
+ zmw_get_wlan_dev(dev);
+ if (aggControl && (ZM_AGG_FIRST_MPDU == aggControl->ampduIndication) ) {
+ tid_tx->bar_ssn = buf_info->baw_header->header[15];
+ aggControl->tid_baw->start_seq = tid_tx->bar_ssn >> 4;
+ zm_msg1_agg(ZM_LV_0, "start seq=", tid_tx->bar_ssn >> 4);
+ }
+ buf_info->baw_header->header[4] |= (1 << 11);
+ if (aggControl && aggControl->aggEnabled) {
+ //if (wd->enableAggregation==0 && !(buf_info->baw_header->header[6]&0x1))
+ //{
+ //if (((buf_info->baw_header->header[2] & 0x3) == 2))
+ //{
+ /* Enable aggregation */
+ buf_info->baw_header->header[1] |= 0x20;
+ if (ZM_AGG_LAST_MPDU == aggControl->ampduIndication) {
+ buf_info->baw_header->header[1] |= 0x4000;
+ }
+ else {
+ buf_info->baw_header->header[1] &= ~0x4000;
+ //zm_debug_msg0("ZM_AGG_LAST_MPDU");
+ }
+ //}
+ //else {
+ // zm_debug_msg1("no aggr, header[2]&0x3 = ",buf_info->baw_header->header[2] & 0x3)
+ // aggControl->aggEnabled = 0;
+ //}
+ //}
+ //else {
+ // zm_debug_msg1("no aggr, wd->enableAggregation = ", wd->enableAggregation);
+ // zm_debug_msg1("no aggr, !header[6]&0x1 = ",!(buf_info->baw_header->header[6]&0x1));
+ // aggControl->aggEnabled = 0;
+ //}
+ }
+
+ /*if (aggControl->tid_baw) {
+ struct baw_header_r header_r;
+
+ header_r.header = buf_info->baw_header->header;
+ header_r.mic = buf_info->baw_header->mic;
+ header_r.snap = buf_info->baw_header->snap;
+ header_r.headerLen = buf_info->baw_header->headerLen;
+ header_r.micLen = buf_info->baw_header->micLen;
+ header_r.snapLen = buf_info->baw_header->snapLen;
+ header_r.removeLen = buf_info->baw_header->removeLen;
+ header_r.keyIdx = buf_info->baw_header->keyIdx;
+
+ BAW->insert(dev, buf_info->buf, tid_tx->bar_ssn >> 4, aggControl->tid_baw, buf_info->baw_retransmit, &header_r);
+ }*/
+
+ if ((err = zfHpSend(dev,
+ buf_info->baw_header->header,
+ buf_info->baw_header->headerLen,
+ buf_info->baw_header->snap,
+ buf_info->baw_header->snapLen,
+ buf_info->baw_header->mic,
+ buf_info->baw_header->micLen,
+ buf_info->buf,
+ buf_info->baw_header->removeLen,
+ ZM_EXTERNAL_ALLOC_BUF,
+ (u8_t)tid_tx->ac,
+ buf_info->baw_header->keyIdx)) != ZM_SUCCESS)
+ {
+ goto zlError;
+ }
+
+ return;
+
+zlError:
+ zfwBufFree(dev, buf_info->buf, 0);
+ return;
+
+}
+#endif //disable BAW
+#endif
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfAggTxSendEth */
+/* Called to transmit Ethernet frame from upper elayer. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : buffer pointer */
+/* port : WLAN port, 0=>standard, 0x10-0x17=>VAP, 0x20-0x25=>WDS */
+/* */
+/* OUTPUTS */
+/* error code */
+/* */
+/* AUTHOR */
+/* Stephen, Honda Atheros Communications, Inc. 2006.12 */
+/* */
+/************************************************************************/
+u16_t zfAggTxSendEth(zdev_t* dev, zbuf_t* buf, u16_t port, u16_t bufType, u8_t flag, struct aggControl *aggControl, TID_TX tid_tx)
+{
+ u16_t err;
+ //u16_t addrTblSize;
+ //struct zsAddrTbl addrTbl;
+ u16_t removeLen;
+ u16_t header[(8+30+2+18)/2]; /* ctr+(4+a1+a2+a3+2+a4)+qos+iv */
+ u16_t headerLen;
+ u16_t mic[8/2];
+ u16_t micLen;
+ u16_t snap[8/2];
+ u16_t snapLen;
+ u16_t fragLen;
+ u16_t frameLen;
+ u16_t fragNum;
+ struct zsFrag frag;
+ u16_t i, id;
+ u16_t da[3];
+ u16_t sa[3];
+ u8_t up;
+ u8_t qosType, keyIdx = 0;
+ u16_t fragOff;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zm_msg1_tx(ZM_LV_2, "zfTxSendEth(), port=", port);
+
+ /* Get IP TOS for QoS AC and IP frag offset */
+ zfTxGetIpTosAndFrag(dev, buf, &up, &fragOff);
+
+#ifdef ZM_ENABLE_NATIVE_WIFI
+ if ( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ {
+ /* DA */
+ da[0] = zmw_tx_buf_readh(dev, buf, 16);
+ da[1] = zmw_tx_buf_readh(dev, buf, 18);
+ da[2] = zmw_tx_buf_readh(dev, buf, 20);
+ /* SA */
+ sa[0] = zmw_tx_buf_readh(dev, buf, 10);
+ sa[1] = zmw_tx_buf_readh(dev, buf, 12);
+ sa[2] = zmw_tx_buf_readh(dev, buf, 14);
+ }
+ else if ( wd->wlanMode == ZM_MODE_IBSS )
+ {
+ /* DA */
+ da[0] = zmw_tx_buf_readh(dev, buf, 4);
+ da[1] = zmw_tx_buf_readh(dev, buf, 6);
+ da[2] = zmw_tx_buf_readh(dev, buf, 8);
+ /* SA */
+ sa[0] = zmw_tx_buf_readh(dev, buf, 10);
+ sa[1] = zmw_tx_buf_readh(dev, buf, 12);
+ sa[2] = zmw_tx_buf_readh(dev, buf, 14);
+ }
+ else if ( wd->wlanMode == ZM_MODE_AP )
+ {
+ /* DA */
+ da[0] = zmw_tx_buf_readh(dev, buf, 4);
+ da[1] = zmw_tx_buf_readh(dev, buf, 6);
+ da[2] = zmw_tx_buf_readh(dev, buf, 8);
+ /* SA */
+ sa[0] = zmw_tx_buf_readh(dev, buf, 16);
+ sa[1] = zmw_tx_buf_readh(dev, buf, 18);
+ sa[2] = zmw_tx_buf_readh(dev, buf, 20);
+ }
+ else
+ {
+ //
+ }
+#else
+ /* DA */
+ da[0] = zmw_tx_buf_readh(dev, buf, 0);
+ da[1] = zmw_tx_buf_readh(dev, buf, 2);
+ da[2] = zmw_tx_buf_readh(dev, buf, 4);
+ /* SA */
+ sa[0] = zmw_tx_buf_readh(dev, buf, 6);
+ sa[1] = zmw_tx_buf_readh(dev, buf, 8);
+ sa[2] = zmw_tx_buf_readh(dev, buf, 10);
+#endif
+ //Decide Key Index in ATOM, No meaning in OTUS--CWYang(m)
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ keyIdx = wd->ap.bcHalKeyIdx[port];
+ id = zfApFindSta(dev, da);
+ if (id != 0xffff)
+ {
+ switch (wd->ap.staTable[id].encryMode)
+ {
+ case ZM_AES:
+ case ZM_TKIP:
+#ifdef ZM_ENABLE_CENC
+ case ZM_CENC:
+#endif //ZM_ENABLE_CENC
+ keyIdx = wd->ap.staTable[id].keyIdx;
+ break;
+ }
+ }
+ }
+ else
+ {
+ switch (wd->sta.encryMode)
+ {
+ case ZM_WEP64:
+ case ZM_WEP128:
+ case ZM_WEP256:
+ keyIdx = wd->sta.keyId;
+ break;
+ case ZM_AES:
+ case ZM_TKIP:
+ if ((da[0]& 0x1))
+ keyIdx = 5;
+ else
+ keyIdx = 4;
+ break;
+#ifdef ZM_ENABLE_CENC
+ case ZM_CENC:
+ keyIdx = wd->sta.cencKeyId;
+ break;
+#endif //ZM_ENABLE_CENC
+ }
+ }
+
+ /* Create SNAP */
+ removeLen = zfTxGenWlanSnap(dev, buf, snap, &snapLen);
+ //zm_msg1_tx(ZM_LV_0, "fragOff=", fragOff);
+
+ fragLen = wd->fragThreshold;
+ frameLen = zfwBufGetSize(dev, buf);
+ frameLen -= removeLen;
+
+#if 0
+ /* Create MIC */
+ if ( (wd->wlanMode == ZM_MODE_INFRASTRUCTURE)&&
+ (wd->sta.encryMode == ZM_TKIP) )
+ {
+ if ( frameLen > fragLen )
+ {
+ micLen = zfTxGenWlanTail(dev, buf, snap, snapLen, mic);
+ }
+ else
+ {
+ /* append MIC by HMAC */
+ micLen = 8;
+ }
+ }
+ else
+ {
+ micLen = 0;
+ }
+#else
+ if ( frameLen > fragLen )
+ {
+ micLen = zfTxGenWlanTail(dev, buf, snap, snapLen, mic);
+ }
+ else
+ {
+ /* append MIC by HMAC */
+ micLen = 0;
+ }
+#endif
+
+ /* Access Category */
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ zfApGetStaQosType(dev, da, &qosType);
+ if (qosType == 0)
+ {
+ up = 0;
+ }
+ }
+ else if (wd->wlanMode == ZM_MODE_INFRASTRUCTURE)
+ {
+ if (wd->sta.wmeConnected == 0)
+ {
+ up = 0;
+ }
+ }
+ else
+ {
+ /* TODO : STA QoS control field */
+ up = 0;
+ }
+
+ /* Assign sequence number */
+ zmw_enter_critical_section(dev);
+ frag.seq[0] = ((wd->seq[zcUpToAc[up&0x7]]++) << 4);
+ if (aggControl && (ZM_AGG_FIRST_MPDU == aggControl->ampduIndication) ) {
+ tid_tx->bar_ssn = frag.seq[0];
+
+ zm_msg1_agg(ZM_LV_0, "start seq=", tid_tx->bar_ssn >> 4);
+ }
+ //tid_tx->baw_buf[tid_tx->baw_head-1].baw_seq=frag.seq[0];
+ zmw_leave_critical_section(dev);
+
+
+ frag.buf[0] = buf;
+ frag.bufType[0] = bufType;
+ frag.flag[0] = flag;
+ fragNum = 1;
+
+ for (i=0; i<fragNum; i++)
+ {
+ /* Create WLAN header(Control Setting + 802.11 header + IV) */
+ if (up !=0 ) zm_debug_msg1("up not 0, up=",up);
+ headerLen = zfTxGenWlanHeader(dev, frag.buf[i], header, frag.seq[i],
+ frag.flag[i], snapLen+micLen, removeLen,
+ port, da, sa, up, &micLen, snap, snapLen,
+ aggControl);
+
+ /* Get buffer DMA address */
+ //if ((addrTblSize = zfwBufMapDma(dev, frag.buf[i], &addrTbl)) == 0)
+ //if ((addrTblSize = zfwMapTxDma(dev, frag.buf[i], &addrTbl)) == 0)
+ //{
+ // err = ZM_ERR_BUFFER_DMA_ADDR;
+ // goto zlError;
+ //}
+
+ /* Flush buffer on cache */
+ //zfwBufFlush(dev, frag.buf[i]);
+
+#if 0
+ zm_msg1_tx(ZM_LV_0, "headerLen=", headerLen);
+ zm_msg1_tx(ZM_LV_0, "snapLen=", snapLen);
+ zm_msg1_tx(ZM_LV_0, "micLen=", micLen);
+ zm_msg1_tx(ZM_LV_0, "removeLen=", removeLen);
+ zm_msg1_tx(ZM_LV_0, "addrTblSize=", addrTblSize);
+ zm_msg1_tx(ZM_LV_0, "frag.bufType[0]=", frag.bufType[0]);
+#endif
+
+ fragLen = zfwBufGetSize(dev, frag.buf[i]);
+ if ((da[0]&0x1) == 0)
+ {
+ wd->commTally.txUnicastFrm++;
+ wd->commTally.txUnicastOctets += (fragLen+snapLen);
+ }
+ else if ((da[0]& 0x1))
+ {
+ wd->commTally.txBroadcastFrm++;
+ wd->commTally.txBroadcastOctets += (fragLen+snapLen);
+ }
+ else
+ {
+ wd->commTally.txMulticastFrm++;
+ wd->commTally.txMulticastOctets += (fragLen+snapLen);
+ }
+ wd->ledStruct.txTraffic++;
+
+#if 0 //Who care this?
+ if ( (i)&&(i == (fragNum-1)) )
+ {
+ wd->trafTally.txDataByteCount -= micLen;
+ }
+#endif
+
+ /*if (aggControl->tid_baw && aggControl->aggEnabled) {
+ struct baw_header_r header_r;
+
+ header_r.header = header;
+ header_r.mic = mic;
+ header_r.snap = snap;
+ header_r.headerLen = headerLen;
+ header_r.micLen = micLen;
+ header_r.snapLen = snapLen;
+ header_r.removeLen = removeLen;
+ header_r.keyIdx = keyIdx;
+
+ BAW->insert(dev, buf, tid_tx->bar_ssn >> 4, aggControl->tid_baw, 0, &header_r);
+ }*/
+
+ if ((err = zfHpSend(dev, header, headerLen, snap, snapLen,
+ mic, micLen, frag.buf[i], removeLen,
+ frag.bufType[i], zcUpToAc[up&0x7], keyIdx)) != ZM_SUCCESS)
+ {
+ goto zlError;
+ }
+
+
+ continue;
+
+zlError:
+ if (frag.bufType[i] == ZM_EXTERNAL_ALLOC_BUF)
+ {
+ zfwBufFree(dev, frag.buf[i], err);
+ }
+ else if (frag.bufType[i] == ZM_INTERNAL_ALLOC_BUF)
+ {
+ zfwBufFree(dev, frag.buf[i], 0);
+ }
+ else
+ {
+ zm_assert(0);
+ }
+ } /* for (i=0; i<fragNum; i++) */
+
+ return ZM_SUCCESS;
+}
+
+/*
+ * zfAggSendADDBA() refers zfSendMmFrame() in cmm.c
+ */
+u16_t zfAggSendAddbaRequest(zdev_t* dev, u16_t *dst, u16_t ac, u16_t up)
+{
+ zbuf_t* buf;
+ //u16_t addrTblSize;
+ //struct zsAddrTbl addrTbl;
+ //u16_t err;
+ u16_t offset = 0;
+ u16_t hlen = 32;
+ u16_t header[(24+25+1)/2];
+ u16_t vap = 0;
+ u16_t i;
+ u8_t encrypt = 0;
+
+ //zmw_get_wlan_dev(dev);
+
+ //zmw_declare_for_critical_section();
+
+
+ /*
+ * TBD : Maximum size of managment frame
+ */
+ if ((buf = zfwBufAllocate(dev, 1024)) == NULL)
+ {
+ zm_msg0_mm(ZM_LV_0, "Alloc mm buf Fail!");
+ return ZM_SUCCESS;
+ }
+
+ /*
+ * Reserve room for wlan header
+ */
+ offset = hlen;
+
+ /*
+ * add addba frame body
+ */
+ offset = zfAggSetAddbaFrameBody(dev, buf, offset, ac, up);
+
+
+ zfwBufSetSize(dev, buf, offset);
+
+ /*
+ * Copy wlan header
+ */
+ zfAggGenAddbaHeader(dev, dst, header, offset-hlen, buf, vap, encrypt);
+ for (i=0; i<(hlen>>1); i++)
+ {
+ zmw_tx_buf_writeh(dev, buf, i*2, header[i]);
+ }
+
+ /* Get buffer DMA address */
+ //if ((addrTblSize = zfwBufMapDma(dev, buf, &addrTbl)) == 0)
+ //if ((addrTblSize = zfwMapTxDma(dev, buf, &addrTbl)) == 0)
+ //{
+ // goto zlError;
+ //}
+
+ //zm_msg2_mm(ZM_LV_2, "offset=", offset);
+ //zm_msg2_mm(ZM_LV_2, "hlen=", hlen);
+ //zm_msg2_mm(ZM_LV_2, "addrTblSize=", addrTblSize);
+ //zm_msg2_mm(ZM_LV_2, "addrTbl.len[0]=", addrTbl.len[0]);
+ //zm_msg2_mm(ZM_LV_2, "addrTbl.physAddrl[0]=", addrTbl.physAddrl[0]);
+ //zm_msg2_mm(ZM_LV_2, "buf->data=", buf->data);
+
+ #if 0
+ if ((err = zfHpSend(dev, NULL, 0, NULL, 0, NULL, 0, buf, 0,
+ ZM_INTERNAL_ALLOC_BUF, 0, 0xff)) != ZM_SUCCESS)
+ {
+ goto zlError;
+ }
+ #else
+ zfPutVmmq(dev, buf);
+ zfPushVtxq(dev);
+ #endif
+
+ return ZM_SUCCESS;
+
+}
+
+u16_t zfAggSetAddbaFrameBody(zdev_t* dev, zbuf_t* buf, u16_t offset, u16_t ac, u16_t up)
+{
+ u16_t ba_parameter, start_seq;
+
+ zmw_get_wlan_dev(dev);
+
+ //zmw_declare_for_critical_section();
+ /*
+ * ADDBA Request frame body
+ */
+
+ /*
+ * Category
+ */
+ zmw_tx_buf_writeb(dev, buf, offset++, 3);
+ /*
+ * Action details = 0
+ */
+ zmw_tx_buf_writeb(dev, buf, offset++, ZM_WLAN_ADDBA_REQUEST_FRAME);
+ /*
+ * Dialog Token = nonzero
+ * TBD: define how to get dialog token?
+ */
+ zmw_tx_buf_writeb(dev, buf, offset++, 2);
+ /*
+ * Block Ack parameter set
+ * BA policy = 1 for immediate BA, 0 for delayed BA
+ * TID(4bits) & buffer size(4bits) (TID=up & buffer size=0x80)
+ * TBD: how to get buffer size?
+ * 
+ *  B0  B1  B2 B5  B6 B15 
+ * 
+ *  Reserved  BA policy  TID  Buffer size 
+ * 
+ */
+ ba_parameter = 1 << 12; // buffer size = 0x40(64)
+ ba_parameter |= up << 2; // tid = up
+ ba_parameter |= 2; // ba policy = 1
+ zmw_tx_buf_writeh(dev, buf, offset, ba_parameter);
+ offset+=2;
+ /*
+ * BA timeout value
+ */
+ zmw_tx_buf_writeh(dev, buf, offset, 0);
+ offset+=2;
+ /*
+ * BA starting sequence number
+ * 
+ *  B0 B3  B4 B15 
+ * 
+ *  Frag num(0)  BA starting seq num 
+ * 
+ */
+ start_seq = ((wd->seq[ac]) << 4) & 0xFFF0;
+ zmw_tx_buf_writeh(dev, buf, offset, start_seq);
+ offset+=2;
+
+ return offset;
+}
+
+u16_t zfAggGenAddbaHeader(zdev_t* dev, u16_t* dst,
+ u16_t* header, u16_t len, zbuf_t* buf, u16_t vap, u8_t encrypt)
+{
+ u8_t hlen = 32; // MAC ctrl + PHY ctrl + 802.11 MM header
+ //u8_t frameType = ZM_WLAN_FRAME_TYPE_ACTION;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ /*
+ * Generate control setting
+ */
+ //bodyLen = zfwBufGetSize(dev, buf);
+ header[0] = 24+len+4; //Length
+ header[1] = 0x8; //MAC control, backoff + (ack)
+
+#if 0
+ /* CCK 1M */
+ header[2] = 0x0f00; //PHY control L
+ header[3] = 0x0000; //PHY control H
+#else
+ /* OFDM 6M */
+ header[2] = 0x0f01; //PHY control L
+ header[3] = 0x000B; //PHY control H
+#endif
+
+ /*
+ * Generate WLAN header
+ * Frame control frame type and subtype
+ */
+ header[4+0] = ZM_WLAN_FRAME_TYPE_ACTION;
+ /*
+ * Duration
+ */
+ header[4+1] = 0;
+
+ if (wd->wlanMode == ZM_MODE_INFRASTRUCTURE)
+ {
+ header[4+8] = wd->sta.bssid[0];
+ header[4+9] = wd->sta.bssid[1];
+ header[4+10] = wd->sta.bssid[2];
+ }
+ else if (wd->wlanMode == ZM_MODE_PSEUDO)
+ {
+ /* Address 3 = 00:00:00:00:00:00 */
+ header[4+8] = 0;
+ header[4+9] = 0;
+ header[4+10] = 0;
+ }
+ else if (wd->wlanMode == ZM_MODE_IBSS)
+ {
+ header[4+8] = wd->sta.bssid[0];
+ header[4+9] = wd->sta.bssid[1];
+ header[4+10] = wd->sta.bssid[2];
+ }
+ else if (wd->wlanMode == ZM_MODE_AP)
+ {
+ /* Address 3 = BSSID */
+ header[4+8] = wd->macAddr[0];
+ header[4+9] = wd->macAddr[1];
+ header[4+10] = wd->macAddr[2] + (vap<<8);
+ }
+
+ /* Address 1 = DA */
+ header[4+2] = dst[0];
+ header[4+3] = dst[1];
+ header[4+4] = dst[2];
+
+ /* Address 2 = SA */
+ header[4+5] = wd->macAddr[0];
+ header[4+6] = wd->macAddr[1];
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ header[4+7] = wd->macAddr[2] + (vap<<8);
+ }
+ else
+ {
+ header[4+7] = wd->macAddr[2];
+ }
+
+ /* Sequence Control */
+ zmw_enter_critical_section(dev);
+ header[4+11] = ((wd->mmseq++)<<4);
+ zmw_leave_critical_section(dev);
+
+
+ return hlen;
+}
+
+
+u16_t zfAggProcessAction(zdev_t* dev, zbuf_t* buf)
+{
+ u16_t category;
+
+ //zmw_get_wlan_dev(dev);
+
+ //zmw_declare_for_critical_section();
+
+ category = zmw_rx_buf_readb(dev, buf, 24);
+
+ switch (category)
+ {
+ case ZM_WLAN_BLOCK_ACK_ACTION_FRAME:
+ zfAggBlockAckActionFrame(dev, buf);
+ break;
+
+ }
+
+ return ZM_SUCCESS;
+}
+
+
+u16_t zfAggBlockAckActionFrame(zdev_t* dev, zbuf_t* buf)
+{
+ u8_t action;
+
+ //zmw_get_wlan_dev(dev);
+
+ //zmw_declare_for_critical_section();
+
+ action = zmw_rx_buf_readb(dev, buf, 25);
+#ifdef ZM_ENABLE_AGGREGATION
+ switch (action)
+ {
+ case ZM_WLAN_ADDBA_REQUEST_FRAME:
+ zm_msg0_agg(ZM_LV_0, "Received BA Action frame is ADDBA request");
+ zfAggRecvAddbaRequest(dev, buf);
+ break;
+ case ZM_WLAN_ADDBA_RESPONSE_FRAME:
+ zm_msg0_agg(ZM_LV_0, "Received BA Action frame is ADDBA response");
+ zfAggRecvAddbaResponse(dev, buf);
+ break;
+ case ZM_WLAN_DELBA_FRAME:
+ zfAggRecvDelba(dev, buf);
+ break;
+ }
+#endif
+ return ZM_SUCCESS;
+}
+
+u16_t zfAggRecvAddbaRequest(zdev_t* dev, zbuf_t* buf)
+{
+ //u16_t dialog;
+ struct aggBaFrameParameter bf;
+ u16_t i;
+ //zmw_get_wlan_dev(dev);
+
+ //zmw_declare_for_critical_section();
+
+ bf.buf = buf;
+ bf.dialog = zmw_rx_buf_readb(dev, buf, 26);
+ /*
+ * ba parameter set
+ */
+ bf.ba_parameter = zmw_rx_buf_readh(dev, buf, 27);
+ bf.ba_policy = (bf.ba_parameter >> 1) & 1;
+ bf.tid = (bf.ba_parameter >> 2) & 0xF;
+ bf.buffer_size = (bf.ba_parameter >> 6);
+ /*
+ * BA timeout value
+ */
+ bf.ba_timeout = zmw_rx_buf_readh(dev, buf, 29);
+ /*
+ * BA starting sequence number
+ */
+ bf.ba_start_seq = zmw_rx_buf_readh(dev, buf, 31) >> 4;
+
+ i=26;
+ while(i < 32) {
+ zm_debug_msg2("Recv ADDBA Req:", zmw_rx_buf_readb(dev,buf,i));
+ i++;
+ }
+
+ zfAggSendAddbaResponse(dev, &bf);
+
+ zfAggAddbaSetTidRx(dev, buf, &bf);
+
+ return ZM_SUCCESS;
+}
+
+u16_t zfAggAddbaSetTidRx(zdev_t* dev, zbuf_t* buf, struct aggBaFrameParameter *bf)
+{
+ u16_t i, ac, aid, fragOff;
+ u16_t src[3];
+ u16_t offset = 0;
+ u8_t up;
+ struct agg_tid_rx *tid_rx = NULL;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ src[0] = zmw_rx_buf_readh(dev, buf, offset+10);
+ src[1] = zmw_rx_buf_readh(dev, buf, offset+12);
+ src[2] = zmw_rx_buf_readh(dev, buf, offset+14);
+ aid = zfApFindSta(dev, src);
+
+ zfTxGetIpTosAndFrag(dev, buf, &up, &fragOff);
+ ac = zcUpToAc[up&0x7] & 0x3;
+
+ ac = bf->tid;
+
+ for (i=0; i<ZM_AGG_POOL_SIZE ; i++)
+ {
+ if((wd->tid_rx[i]->aid == aid) && (wd->tid_rx[i]->ac == ac))
+ {
+ tid_rx = wd->tid_rx[i];
+ break;
+ }
+ }
+
+ if (!tid_rx)
+ {
+ for (i=0; i<ZM_AGG_POOL_SIZE; i++)
+ {
+ if (wd->tid_rx[i]->aid == ZM_MAX_STA_SUPPORT)
+ {
+ tid_rx = wd->tid_rx[i];
+ break;
+ }
+ }
+ if (!tid_rx)
+ return 0;
+ }
+
+ zmw_enter_critical_section(dev);
+
+ tid_rx->aid = aid;
+ tid_rx->ac = ac;
+ tid_rx->addBaExchangeStatusCode = ZM_AGG_ADDBA_RESPONSE;
+ tid_rx->seq_start = bf->ba_start_seq;
+ tid_rx->baw_head = tid_rx->baw_tail = 0;
+ tid_rx->sq_exceed_count = tid_rx->sq_behind_count = 0;
+ zmw_leave_critical_section(dev);
+
+ return 0;
+}
+
+u16_t zfAggRecvAddbaResponse(zdev_t* dev, zbuf_t* buf)
+{
+ u16_t i,ac, aid=0;
+ u16_t src[3];
+ struct aggBaFrameParameter bf;
+
+ zmw_get_wlan_dev(dev);
+
+ //zmw_declare_for_critical_section();
+
+ src[0] = zmw_rx_buf_readh(dev, buf, 10);
+ src[1] = zmw_rx_buf_readh(dev, buf, 12);
+ src[2] = zmw_rx_buf_readh(dev, buf, 14);
+
+ if (wd->wlanMode == ZM_MODE_AP)
+ aid = zfApFindSta(dev, src);
+
+
+ bf.buf = buf;
+ bf.dialog = zmw_rx_buf_readb(dev, buf, 26);
+ bf.status_code = zmw_rx_buf_readh(dev, buf, 27);
+ if (!bf.status_code)
+ {
+ wd->addbaComplete=1;
+ }
+
+ /*
+ * ba parameter set
+ */
+ bf.ba_parameter = zmw_rx_buf_readh(dev, buf, 29);
+ bf.ba_policy = (bf.ba_parameter >> 1) & 1;
+ bf.tid = (bf.ba_parameter >> 2) & 0xF;
+ bf.buffer_size = (bf.ba_parameter >> 6);
+ /*
+ * BA timeout value
+ */
+ bf.ba_timeout = zmw_rx_buf_readh(dev, buf, 31);
+
+ i=26;
+ while(i < 32) {
+ zm_debug_msg2("Recv ADDBA Rsp:", zmw_rx_buf_readb(dev,buf,i));
+ i++;
+ }
+
+ ac = zcUpToAc[bf.tid&0x7] & 0x3;
+
+ //zmw_enter_critical_section(dev);
+
+ //wd->aggSta[aid].aggFlag[ac] = 0;
+
+ //zmw_leave_critical_section(dev);
+
+ return ZM_SUCCESS;
+}
+
+u16_t zfAggRecvDelba(zdev_t* dev, zbuf_t* buf)
+{
+ //zmw_get_wlan_dev(dev);
+
+ //zmw_declare_for_critical_section();
+ return ZM_SUCCESS;
+}
+
+u16_t zfAggSendAddbaResponse(zdev_t* dev, struct aggBaFrameParameter *bf)
+{
+ zbuf_t* buf;
+ //u16_t addrTblSize;
+ //struct zsAddrTbl addrTbl;
+ //u16_t err;
+ u16_t offset = 0;
+ u16_t hlen = 32;
+ u16_t header[(24+25+1)/2];
+ u16_t vap = 0;
+ u16_t i;
+ u8_t encrypt = 0;
+ u16_t dst[3];
+
+ //zmw_get_wlan_dev(dev);
+
+ //zmw_declare_for_critical_section();
+
+
+ /*
+ * TBD : Maximum size of managment frame
+ */
+ if ((buf = zfwBufAllocate(dev, 1024)) == NULL)
+ {
+ zm_msg0_mm(ZM_LV_0, "Alloc mm buf Fail!");
+ return ZM_SUCCESS;
+ }
+
+ /*
+ * Reserve room for wlan header
+ */
+ offset = hlen;
+
+ /*
+ * add addba frame body
+ */
+ offset = zfAggSetAddbaResponseFrameBody(dev, buf, bf, offset);
+
+
+ zfwBufSetSize(dev, buf, offset);
+
+ /*
+ * Copy wlan header
+ */
+
+ dst[0] = zmw_rx_buf_readh(dev, bf->buf, 10);
+ dst[1] = zmw_rx_buf_readh(dev, bf->buf, 12);
+ dst[2] = zmw_rx_buf_readh(dev, bf->buf, 14);
+ zfAggGenAddbaHeader(dev, dst, header, offset-hlen, buf, vap, encrypt);
+ for (i=0; i<(hlen>>1); i++)
+ {
+ zmw_tx_buf_writeh(dev, buf, i*2, header[i]);
+ }
+
+ /* Get buffer DMA address */
+ //if ((addrTblSize = zfwBufMapDma(dev, buf, &addrTbl)) == 0)
+ //if ((addrTblSize = zfwMapTxDma(dev, buf, &addrTbl)) == 0)
+ //{
+ // goto zlError;
+ //}
+
+ //zm_msg2_mm(ZM_LV_2, "offset=", offset);
+ //zm_msg2_mm(ZM_LV_2, "hlen=", hlen);
+ //zm_msg2_mm(ZM_LV_2, "addrTblSize=", addrTblSize);
+ //zm_msg2_mm(ZM_LV_2, "addrTbl.len[0]=", addrTbl.len[0]);
+ //zm_msg2_mm(ZM_LV_2, "addrTbl.physAddrl[0]=", addrTbl.physAddrl[0]);
+ //zm_msg2_mm(ZM_LV_2, "buf->data=", buf->data);
+
+ #if 0
+ if ((err = zfHpSend(dev, NULL, 0, NULL, 0, NULL, 0, buf, 0,
+ ZM_INTERNAL_ALLOC_BUF, 0, 0xff)) != ZM_SUCCESS)
+ {
+ goto zlError;
+ }
+ #else
+ zfPutVmmq(dev, buf);
+ zfPushVtxq(dev);
+ #endif
+
+ //zfAggSendAddbaRequest(dev, dst, zcUpToAc[bf->tid&0x7] & 0x3, bf->tid);
+ return ZM_SUCCESS;
+
+}
+
+u16_t zfAggSetAddbaResponseFrameBody(zdev_t* dev, zbuf_t* buf,
+ struct aggBaFrameParameter *bf, u16_t offset)
+{
+
+ //zmw_get_wlan_dev(dev);
+
+ //zmw_declare_for_critical_section();
+ /*
+ * ADDBA Request frame body
+ */
+
+ /*
+ * Category
+ */
+ zmw_tx_buf_writeb(dev, buf, offset++, 3);
+ /*
+ * Action details = 0
+ */
+ zmw_tx_buf_writeb(dev, buf, offset++, ZM_WLAN_ADDBA_RESPONSE_FRAME);
+ /*
+ * Dialog Token = nonzero
+ */
+ zmw_tx_buf_writeb(dev, buf, offset++, bf->dialog);
+ /*
+ * Status code
+ */
+ zmw_tx_buf_writeh(dev, buf, offset, 0);
+ offset+=2;
+ /*
+ * Block Ack parameter set
+ * BA policy = 1 for immediate BA, 0 for delayed BA
+ * TID(4bits) & buffer size(4bits) (TID=0x1 & buffer size=0x80)
+ * TBD: how to get TID number and buffer size?
+ * 
+ *  B0  B1  B2 B5  B6 B15 
+ * 
+ *  Reserved  BA policy  TID  Buffer size 
+ * 
+ */
+ zmw_tx_buf_writeh(dev, buf, offset, bf->ba_parameter);
+ offset+=2;
+ /*
+ * BA timeout value
+ */
+ zmw_tx_buf_writeh(dev, buf, offset, bf->ba_timeout);
+ offset+=2;
+
+ return offset;
+}
+
+void zfAggInvokeBar(zdev_t* dev, TID_TX tid_tx)
+{
+ struct aggBarControl aggBarControl;
+ //zmw_get_wlan_dev(dev);
+
+ //zmw_declare_for_critical_section();
+ //bar_control = aggBarControl->tid_info << 12 | aggBarControl->compressed_bitmap << 2
+ // | aggBarControl->multi_tid << 1 | aggBarControl->bar_ack_policy;
+ aggBarControl.bar_ack_policy = 0;
+ aggBarControl.multi_tid = 0;
+ aggBarControl.compressed_bitmap = 0;
+ aggBarControl.tid_info = tid_tx->tid;
+ zfAggSendBar(dev, tid_tx, &aggBarControl);
+
+ return;
+
+}
+/*
+ * zfAggSendBar() refers zfAggSendAddbaRequest()
+ */
+u16_t zfAggSendBar(zdev_t* dev, TID_TX tid_tx, struct aggBarControl *aggBarControl)
+{
+ zbuf_t* buf;
+ //u16_t addrTblSize;
+ //struct zsAddrTbl addrTbl;
+ //u16_t err;
+ u16_t offset = 0;
+ u16_t hlen = 16+8; /* mac header + control headers*/
+ u16_t header[(8+24+1)/2];
+ u16_t vap = 0;
+ u16_t i;
+ u8_t encrypt = 0;
+
+ //zmw_get_wlan_dev(dev);
+
+ //zmw_declare_for_critical_section();
+
+
+ /*
+ * TBD : Maximum size of managment frame
+ */
+ if ((buf = zfwBufAllocate(dev, 1024)) == NULL)
+ {
+ zm_msg0_mm(ZM_LV_0, "Alloc mm buf Fail!");
+ return ZM_SUCCESS;
+ }
+
+ /*
+ * Reserve room for wlan header
+ */
+ offset = hlen;
+
+ /*
+ * add addba frame body
+ */
+ offset = zfAggSetBarBody(dev, buf, offset, tid_tx, aggBarControl);
+
+
+ zfwBufSetSize(dev, buf, offset);
+
+ /*
+ * Copy wlan header
+ */
+ zfAggGenBarHeader(dev, tid_tx->dst, header, offset-hlen, buf, vap, encrypt);
+ for (i=0; i<(hlen>>1); i++)
+ {
+ zmw_tx_buf_writeh(dev, buf, i*2, header[i]);
+ }
+
+ /* Get buffer DMA address */
+ //if ((addrTblSize = zfwBufMapDma(dev, buf, &addrTbl)) == 0)
+ //if ((addrTblSize = zfwMapTxDma(dev, buf, &addrTbl)) == 0)
+ //{
+ // goto zlError;
+ //}
+
+ //zm_msg2_mm(ZM_LV_2, "offset=", offset);
+ //zm_msg2_mm(ZM_LV_2, "hlen=", hlen);
+ //zm_msg2_mm(ZM_LV_2, "addrTblSize=", addrTblSize);
+ //zm_msg2_mm(ZM_LV_2, "addrTbl.len[0]=", addrTbl.len[0]);
+ //zm_msg2_mm(ZM_LV_2, "addrTbl.physAddrl[0]=", addrTbl.physAddrl[0]);
+ //zm_msg2_mm(ZM_LV_2, "buf->data=", buf->data);
+
+ #if 0
+ if ((err = zfHpSend(dev, NULL, 0, NULL, 0, NULL, 0, buf, 0,
+ ZM_INTERNAL_ALLOC_BUF, 0, 0xff)) != ZM_SUCCESS)
+ {
+ goto zlError;
+ }
+ #else
+ zfPutVmmq(dev, buf);
+ zfPushVtxq(dev);
+ #endif
+
+ return ZM_SUCCESS;
+
+}
+
+u16_t zfAggSetBarBody(zdev_t* dev, zbuf_t* buf, u16_t offset, TID_TX tid_tx, struct aggBarControl *aggBarControl)
+{
+ u16_t bar_control, start_seq;
+
+ //zmw_get_wlan_dev(dev);
+
+ //zmw_declare_for_critical_section();
+ /*
+ * BAR Control frame body
+ */
+
+ /*
+ * BAR Control Field
+ * 
+ *  B0  B1  B2  B3 B11  B12 B15 
+ * 
+ *  BAR Ack  Multi-TID  Compressed  Reserved  TID_INFO 
+ *  Policy   Bitmap   
+ * 
+ */
+ bar_control = aggBarControl->tid_info << 12 | aggBarControl->compressed_bitmap << 2
+ | aggBarControl->multi_tid << 1 | aggBarControl->bar_ack_policy;
+
+ zmw_tx_buf_writeh(dev, buf, offset, bar_control);
+ offset+=2;
+ if (0 == aggBarControl->multi_tid) {
+ /*
+ * BA starting sequence number
+ * 
+ *  B0 B3  B4 B15 
+ * 
+ *  Frag num(0)  BA starting seq num 
+ * 
+ */
+ start_seq = (tid_tx->bar_ssn << 4) & 0xFFF0;
+ zmw_tx_buf_writeh(dev, buf, offset, start_seq);
+ offset+=2;
+ }
+ if (1 == aggBarControl->multi_tid && 1 == aggBarControl->compressed_bitmap) {
+ /* multi-tid BlockAckReq variant, not implemented*/
+ }
+
+ return offset;
+}
+
+u16_t zfAggGenBarHeader(zdev_t* dev, u16_t* dst,
+ u16_t* header, u16_t len, zbuf_t* buf, u16_t vap, u8_t encrypt)
+{
+ u8_t hlen = 16+8; // MAC ctrl + PHY ctrl + 802.11 MM header
+ //u8_t frameType = ZM_WLAN_FRAME_TYPE_ACTION;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ /*
+ * Generate control setting
+ */
+ //bodyLen = zfwBufGetSize(dev, buf);
+ header[0] = 16+len+4; //Length
+ header[1] = 0x8; //MAC control, backoff + (ack)
+
+#if 1
+ /* CCK 1M */
+ header[2] = 0x0f00; //PHY control L
+ header[3] = 0x0000; //PHY control H
+#else
+ /* CCK 6M */
+ header[2] = 0x0f01; //PHY control L
+ header[3] = 0x000B; //PHY control H
+
+#endif
+ /*
+ * Generate WLAN header
+ * Frame control frame type and subtype
+ */
+ header[4+0] = ZM_WLAN_FRAME_TYPE_BAR;
+ /*
+ * Duration
+ */
+ header[4+1] = 0;
+
+ /* Address 1 = DA */
+ header[4+2] = dst[0];
+ header[4+3] = dst[1];
+ header[4+4] = dst[2];
+
+ /* Address 2 = SA */
+ header[4+5] = wd->macAddr[0];
+ header[4+6] = wd->macAddr[1];
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+#ifdef ZM_VAPMODE_MULTILE_SSID
+ header[4+7] = wd->macAddr[2]; //Multiple SSID
+#else
+ header[4+7] = wd->macAddr[2] + (vap<<8); //VAP
+#endif
+ }
+ else
+ {
+ header[4+7] = wd->macAddr[2];
+ }
+
+ /* Sequence Control */
+ zmw_enter_critical_section(dev);
+ header[4+11] = ((wd->mmseq++)<<4);
+ zmw_leave_critical_section(dev);
+
+
+ return hlen;
+}
diff --git a/drivers/staging/otus/80211core/cagg.h b/drivers/staging/otus/80211core/cagg.h
new file mode 100644
index 00000000000..1d87a564162
--- /dev/null
+++ b/drivers/staging/otus/80211core/cagg.h
@@ -0,0 +1,435 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : cagg.h */
+/* */
+/* Abstract */
+/* This module contains A-MPDU aggregation relatived functions. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/****************************************************************************/
+/*Revision History: */
+/* Who When What */
+/* -------- -------- ----------------------------------------------*/
+/* */
+/* Honda 12-4-06 created */
+/* */
+/****************************************************************************/
+
+#ifndef _CAGG_H
+#define _CAGG_H
+
+
+/*
+ * the aggregation functions flag, 0 if don't do aggregate
+ */
+
+#define ZM_AGG_FPGA_DEBUG 1
+#define ZM_AGG_FPGA_REORDERING 1
+
+#ifndef ZM_AGG_TALLY
+//#define ZM_AGG_TALLY
+#endif
+/*
+ * Aggregate control
+ */
+
+
+#define ZM_AGG_POOL_SIZE 20
+#define ZM_BAW_POOL_SIZE 32
+#define ZM_AGGQ_SIZE 64
+#define ZM_AGGQ_SIZE_MASK (ZM_AGGQ_SIZE-1)
+#define ZM_AGG_LOW_THRESHOLD 1
+#define ZM_AGG_HIGH_THRESHOLD 5
+
+/*
+ * number of access categories (ac)
+ */
+#define ZM_AC 4
+/*
+ * the timer to clear aggregation queue, unit: 1 tick
+ * if the packet is too old (current time - arrival time)
+ * the packet and the aggregate queue will be cleared
+ */
+#define ZM_AGG_CLEAR_TIME 10
+/*
+ * delete the queue if idle for ZM_DELETE_TIME
+ * unit: 10ms
+ */
+#define ZM_AGG_DELETE_TIME 10000
+
+/*
+ * block ack window size
+ */
+#define ZM_AGG_BAW_SIZE 64
+#define ZM_AGG_BAW_MASK (ZM_AGG_BAW_SIZE-1)
+/*
+ * originator ADDBA Resquest receiver
+ * |----------------------------->|
+ * 1| ACK |1
+ * |<-----------------------------|
+ * 2| ADDBA Response |2
+ * |<-----------------------------|
+ * 3| ACK |3
+ * |----------------------------->|
+ * 4 4
+ */
+#define ZM_AGG_ADDBA_REQUEST 1
+#define ZM_AGG_ADDBA_REQUEST_ACK 2
+#define ZM_AGG_ADDBA_RESPONSE 3
+#define ZM_AGG_ADDBA_RESPONSE_ACK 4
+
+#define ZM_AGG_SINGLE_MPDU 00
+#define ZM_AGG_FIRST_MPDU 01
+#define ZM_AGG_MIDDLE_MPDU 11
+#define ZM_AGG_LAST_MPDU 10
+/*
+ * end of Aggregate control
+ */
+
+#define TID_TX struct aggQueue*
+#define TID_BAW struct baw_q*
+#define BAW wd->baw_enabler
+#define DESTQ wd->destQ
+
+/*
+ * Queue access
+ */
+#define zm_agg_qlen(dev, head, tail) ((head - tail) & ZM_AGGQ_SIZE_MASK)
+#define zm_agg_inQ(tid_tx, pt) ((((pt - tid_tx->aggTail) & ZM_AGGQ_SIZE_MASK) < \
+ ((tid_tx->aggHead - tid_tx->aggTail) & ZM_AGGQ_SIZE_MASK))? TRUE:FALSE)
+#define zm_agg_plus(pt) pt = (pt + 1) & ZM_AGGQ_SIZE_MASK
+#define zm_agg_min(A, B) ((A>B)? B:A)
+#define zm_agg_GetTime() wd->tick
+#define TXQL (zfHpGetMaxTxdCount(dev) - zfHpGetFreeTxdCount(dev))
+
+/* don't change AGG_MIN_TXQL easily, this might cause BAW BSOD */
+#define AGG_MIN_TXQL 2
+/*
+ * consider tcp,udp,ac(1234)
+ */
+#define zm_agg_dynamic_threshold(dev, ar) ((ar > 16)? 11: \
+ (ar > 12)? 8: \
+ (ar > 8)? 5: \
+ (ar > 4)? 2:1)
+#define zm_agg_weight(ac) ((3 == ac)? 4: \
+ (2 == ac)? 3: \
+ (0 == ac)? 2:1)
+/*
+ * the required free queue ratio per ac
+ */
+
+#define zm_agg_ratio(ac) ((3 == ac)? 3: \
+ (2 == ac)? (zfHpGetMaxTxdCount(dev)*1/4): \
+ (0 == ac)? (zfHpGetMaxTxdCount(dev)*2/4): \
+ (zfHpGetMaxTxdCount(dev)*3/4))
+
+//#define zm_agg_ratio(ac) 3
+/*
+ * end of Queue access
+ */
+
+#define ZM_AGGMSG_LEV ZM_LV_3
+#define zm_msg0_agg(lv, msg) if (ZM_AGGMSG_LEV >= lv) \
+ {zm_debug_msg0(msg);}
+#define zm_msg1_agg(lv, msg, val) if (ZM_AGGMSG_LEV >= lv) \
+ {zm_debug_msg1(msg, val);}
+#define zm_msg2_agg(lv, msg, val) if (ZM_AGGMSG_LEV >= lv) \
+ {zm_debug_msg2(msg, val);}
+
+#ifndef ZM_ENABLE_FW_BA_RETRANSMISSION //disable BAW
+struct baw_header_r {
+ u16_t *header;
+ u16_t *mic;
+ u16_t *snap;
+ u16_t headerLen;
+ u16_t micLen;
+ u16_t snapLen;
+ u16_t removeLen;
+ u8_t keyIdx;
+};
+
+struct baw_header {
+ u16_t header[29];//[(8+30+2+18)/2]; 58 bytes /* ctr+(4+a1+a2+a3+2+a4)+qos+iv */
+ u16_t headerLen;
+ u16_t mic[4]; //[8/2]; 8 bytes
+ u16_t micLen;
+ u16_t snap[4]; //[8/2]; 8 bytes
+ u16_t snapLen;
+ u16_t removeLen;
+ u8_t keyIdx;
+};
+
+struct bufInfo {
+ zbuf_t* buf;
+ u8_t baw_retransmit;
+ u32_t timestamp;
+ struct baw_header *baw_header;
+};
+#endif
+struct aggElement
+{
+ zbuf_t* buf;
+ u32_t arrivalTime;
+ u8_t baw_retransmit;
+ struct zsAdditionInfo addInfo;
+ //struct baw_header baw_header;
+};
+
+
+#ifndef ZM_ENABLE_FW_BA_RETRANSMISSION //disable BAW
+struct baw_buf
+{
+ zbuf_t* buf;
+ u16_t baw_seq;
+ u32_t timestamp;
+ u8_t baw_retransmit;
+ struct baw_header baw_header;
+};
+
+struct baw_q {
+ struct baw_buf frame[ZM_VTXQ_SIZE];
+ u16_t enabled;
+ u16_t start_seq;
+ u16_t head;
+ u16_t tail;
+ u16_t size;
+ TID_TX tid_tx;
+
+ //struct baw_header *baw_header;
+};
+
+struct baw_enabler
+{
+ struct baw_q tid_baw[ZM_BAW_POOL_SIZE];
+ u8_t delPoint;
+ void (*core)(zdev_t* dev, u16_t baw_seq, u32_t bitmap, u16_t aggLen);
+ //void (*core);
+ void (*init)(zdev_t* dev);
+ TID_BAW (*getNewQ)(zdev_t* dev, u16_t start_seq, TID_TX tid_tx);
+ TID_BAW (*getQ)(zdev_t* dev, u16_t baw_seq);
+ u16_t (*insert)(zdev_t* dev, zbuf_t* buf, u16_t baw_seq, TID_BAW tid_baw, u8_t baw_retransmit, struct baw_header_r *header_r);
+ struct bufInfo* (*pop)(zdev_t* dev, u16_t index, TID_BAW tid_baw);
+ void (*enable)(zdev_t* dev, TID_BAW tid_baw, u16_t start_seq);
+ void (*disable)(zdev_t* dev, TID_BAW tid_baw);
+
+};
+#endif
+struct aggQueue
+{
+ struct aggElement aggvtxq[ZM_AGGQ_SIZE];
+ u16_t aggHead;
+ u16_t aggTail;
+ s16_t size;
+ u16_t aggQSTA;
+ u16_t aggQEnabled;
+ u16_t ac;
+ u16_t tid;
+ u16_t aggReady;
+ u16_t clearFlag;
+ u16_t deleteFlag;
+ u32_t lastArrival;
+ u16_t aggFrameSize;
+ u16_t bar_ssn; /* starting sequence number in BAR */
+ u16_t dst[3];
+ u16_t complete; /* complete indication pointer */
+};
+
+struct aggSta
+{
+ u16_t count[ZM_AC];
+ TID_TX tid_tx[8];
+ u16_t aggFlag[ZM_AC];
+};
+
+struct agg_tid_rx
+{
+ u16_t aid;
+ u16_t ac;
+ u16_t addBaExchangeStatusCode;
+ //struct zsAdditionInfo *addInfo;
+ u16_t seq_start; /* first seq expected next */
+ u16_t baw_head; /* head of valid block ack window */
+ u16_t baw_tail; /* tail of valid block ack window */
+ //u16_t free_count; /* block ack window size */
+ u8_t sq_exceed_count;
+ u8_t sq_behind_count;
+ struct aggElement frame[ZM_AGG_BAW_SIZE + 1]; /* out-of-order rx frames */
+};
+
+struct aggControl
+{
+ u16_t aggEnabled;
+ u16_t ampduIndication;
+ u16_t addbaIndication;
+ //TID_BAW tid_baw;
+ u32_t timestamp;
+};
+
+struct aggBaFrameParameter
+{
+ zbuf_t* buf;
+ u16_t ba_parameter;
+ u8_t dialog;
+ u16_t ba_policy;
+ u16_t tid;
+ u16_t buffer_size;
+ u16_t ba_timeout;
+ u16_t ba_start_seq;
+ u16_t status_code;
+};
+
+struct aggBarControl
+{
+ u16_t bar_ack_policy ;
+ u16_t multi_tid ;
+ u16_t compressed_bitmap ;
+ u16_t tid_info ;
+};
+
+struct aggTally
+{
+ u32_t got_packets_sum;
+ u32_t got_bytes_sum;
+ u32_t sent_packets_sum;
+ u32_t sent_bytes_sum;
+ u32_t avg_got_packets;
+ u32_t avg_got_bytes;
+ u32_t avg_sent_packets;
+ u32_t avg_sent_bytes;
+ u16_t time;
+};
+
+
+struct destQ {
+ struct dest{
+ u16_t Qtype : 1; /* 0 aggr, 1 vtxq */
+ TID_TX tid_tx;
+ void* vtxq;
+
+ struct dest* next;
+ } *dest[4];
+ struct dest* Head[4];
+ //s16_t size[4];
+ u16_t ppri;
+ void (*insert)(zdev_t* dev, u16_t Qtype, u16_t ac, TID_TX tid_tx, void* vtxq);
+ void (*delete)(zdev_t* dev, u16_t Qtype, TID_TX tid_tx, void* vtxq);
+ void (*init)(zdev_t* dev);
+ struct dest* (*getNext)(zdev_t* dev, u16_t ac);
+ u16_t (*exist)(zdev_t* dev, u16_t Qtype, u16_t ac, TID_TX tid_tx, void* vtxq);
+ //void (*scan)(zdev_t* dev);
+};
+/*
+ * aggregation tx
+ */
+void zfAggInit(zdev_t* dev);
+u16_t zfApFindSta(zdev_t* dev, u16_t* addr);
+u16_t zfAggGetSta(zdev_t* dev, zbuf_t* buf);
+TID_TX zfAggTxGetQueue(zdev_t* dev, u16_t aid, u16_t tid);
+TID_TX zfAggTxNewQueue(zdev_t* dev, u16_t aid, u16_t tid, zbuf_t* buf);
+u16_t zfAggTxEnqueue(zdev_t* dev, zbuf_t* buf, u16_t aid, TID_TX tid_tx);
+u16_t zfAggTx(zdev_t* dev, zbuf_t* buf, u16_t tid);
+u16_t zfAggTxReadyCount(zdev_t* dev, u16_t ac);
+u16_t zfAggTxPartial(zdev_t* dev, u16_t ac, u16_t readycount);
+u16_t zfAggTxSend(zdev_t* dev, u32_t freeTxd, TID_TX tid_tx);
+TID_TX zfAggTxGetReadyQueue(zdev_t* dev, u16_t ac);
+zbuf_t* zfAggTxGetVtxq(zdev_t* dev, TID_TX tid_tx);
+u16_t zfAggTxDeleteQueue(zdev_t* dev, u16_t qnum);
+u16_t zfAggScanAndClear(zdev_t* dev, u32_t time);
+u16_t zfAggClearQueue(zdev_t* dev);
+void zfAggTxScheduler(zdev_t* dev, u8_t ScanAndClear);
+
+/* tid_tx manipulation */
+#ifndef ZM_ENABLE_FW_BA_RETRANSMISSION //disable BAW
+u16_t zfAggTidTxInsertHead(zdev_t* dev, struct bufInfo* buf_info, TID_TX tid_tx);
+#endif
+void zfAggDestInsert(zdev_t* dev, u16_t Qtype, u16_t ac, TID_TX tid_tx, void* vtxq);
+void zfAggDestDelete(zdev_t* dev, u16_t Qtype, TID_TX tid_tx, void* vtxq);
+void zfAggDestInit(zdev_t* dev);
+struct dest* zfAggDestGetNext(zdev_t* dev, u16_t ac);
+u16_t zfAggDestExist(zdev_t* dev, u16_t Qtype, u16_t ac, TID_TX tid_tx, void* vtxq);
+/*
+ * aggregation rx
+ */
+struct agg_tid_rx *zfAggRxEnabled(zdev_t* dev, zbuf_t* buf);
+u16_t zfAggRx(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo *addInfo, struct agg_tid_rx *tid_rx);
+struct agg_tid_rx *zfAggRxGetQueue(zdev_t* dev, zbuf_t* buf);
+u16_t zfAggRxEnqueue(zdev_t* dev, zbuf_t* buf, struct agg_tid_rx *tid_rx, struct zsAdditionInfo *addInfo);
+u16_t zfAggRxFlush(zdev_t* dev, u16_t seq_no, struct agg_tid_rx *tid_rx);
+u16_t zfAggRxFreeBuf(zdev_t* dev, u16_t destroy);
+u16_t zfAggRxClear(zdev_t* dev, u32_t time);
+void zfAggRecvBAR(zdev_t* dev, zbuf_t* buf);
+/*
+ * end of aggregation rx
+ */
+
+/*
+ * ADDBA
+ */
+u16_t zfAggSendAddbaRequest(zdev_t* dev, u16_t *dst, u16_t ac, u16_t up);
+u16_t zfAggSetAddbaFrameBody(zdev_t* dev,zbuf_t* buf, u16_t offset, u16_t ac, u16_t up);
+u16_t zfAggGenAddbaHeader(zdev_t* dev, u16_t* dst,
+ u16_t* header, u16_t len, zbuf_t* buf, u16_t vap, u8_t encrypt);
+u16_t zfAggProcessAction(zdev_t* dev, zbuf_t* buf);
+u16_t zfAggBlockAckActionFrame(zdev_t* dev, zbuf_t* buf);
+u16_t zfAggRecvAddbaRequest(zdev_t* dev, zbuf_t* buf);
+u16_t zfAggRecvAddbaResponse(zdev_t* dev, zbuf_t* buf);
+u16_t zfAggRecvDelba(zdev_t* dev, zbuf_t* buf);
+u16_t zfAggSendAddbaResponse(zdev_t* dev, struct aggBaFrameParameter *bf);
+u16_t zfAggSetAddbaResponseFrameBody(zdev_t* dev, zbuf_t* buf,
+ struct aggBaFrameParameter *bf, u16_t offset);
+u16_t zfAggAddbaSetTidRx(zdev_t* dev, zbuf_t* buf,
+ struct aggBaFrameParameter *bf);
+/*
+ * zfAggTxSendEth
+ */
+u16_t zfAggTxSendEth(zdev_t* dev, zbuf_t* buf, u16_t port, u16_t bufType, u8_t flag, struct aggControl *aggControl, TID_TX tid_tx);
+
+/*
+ * statistics functions
+ */
+u16_t zfAggTallyReset(zdev_t* dev);
+
+u16_t zfAggPrintTally(zdev_t* dev);
+
+/*
+ * BAR
+ */
+void zfAggInvokeBar(zdev_t* dev, TID_TX tid_tx);
+u16_t zfAggSendBar(zdev_t* dev, TID_TX tid_tx, struct aggBarControl *aggBarControl);
+u16_t zfAggSetBarBody(zdev_t* dev, zbuf_t* buf, u16_t offset, TID_TX tid_tx, struct aggBarControl *aggBarControl);
+u16_t zfAggGenBarHeader(zdev_t* dev, u16_t* dst,
+ u16_t* header, u16_t len, zbuf_t* buf, u16_t vap, u8_t encrypt);
+
+#ifndef ZM_ENABLE_FW_BA_RETRANSMISSION //disable BAW
+/* BAW BA retransmission */
+void zfBawCore(zdev_t* dev, u16_t baw_seq, u32_t bitmap, u16_t aggLen);
+void zfBawInit(zdev_t* dev);
+TID_BAW zfBawGetNewQ(zdev_t* dev, u16_t start_seq, TID_TX tid_tx);
+u16_t zfBawInsert(zdev_t* dev, zbuf_t* buf, u16_t baw_seq, TID_BAW tid_baw, u8_t baw_retransmit, struct baw_header_r *header_r);
+struct bufInfo* zfBawPop(zdev_t* dev, u16_t index, TID_BAW tid_baw);
+void zfBawEnable(zdev_t* dev, TID_BAW tid_baw, u16_t start_seq);
+void zfBawDisable(zdev_t* dev, TID_BAW tid_baw);
+TID_BAW zfBawGetQ(zdev_t* dev, u16_t baw_seq);
+void zfAggTxRetransmit(zdev_t* dev, struct bufInfo *buf_info, struct aggControl *aggControl, TID_TX tid_tx);
+#endif
+/* extern functions */
+extern zbuf_t* zfGetVtxq(zdev_t* dev, u8_t ac);
+
+#endif /* #ifndef _CAGG_H */
+
diff --git a/drivers/staging/otus/80211core/ccmd.c b/drivers/staging/otus/80211core/ccmd.c
new file mode 100644
index 00000000000..47997797367
--- /dev/null
+++ b/drivers/staging/otus/80211core/ccmd.c
@@ -0,0 +1,1861 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : cmd.c */
+/* */
+/* Abstract */
+/* This module contains command interface functions. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/************************************************************************/
+#include "cprecomp.h"
+#include "../hal/hpreg.h"
+
+
+u16_t zfWlanReset(zdev_t* dev);
+u32_t zfUpdateRxRate(zdev_t* dev);
+
+
+extern void zfiUsbRecv(zdev_t *dev, zbuf_t *buf);
+extern void zfiUsbRegIn(zdev_t* dev, u32_t* rsp, u16_t rspLen);
+extern void zfiUsbOutComplete(zdev_t* dev, zbuf_t *buf, u8_t status, u8_t *hdr);
+extern void zfiUsbRegOutComplete(zdev_t* dev);
+extern u16_t zfHpReinit(zdev_t* dev, u32_t frequency);
+
+/* Get size (byte) of driver core global data structure. */
+/* This size will be used by driver wrapper to allocate */
+/* a memory space for driver core to store global variables */
+u16_t zfiGlobalDataSize(zdev_t* dev)
+{
+ u32_t ret;
+ ret = (sizeof(struct zsWlanDev));
+ zm_assert((ret>>16) == 0);
+ return (u16_t)ret;
+}
+
+
+/* Initialize WLAN hardware and software, resource will be allocated */
+/* for WLAN operation, must be called first before other function. */
+extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl)
+{
+ //u16_t ret;
+ //u32_t i;
+ //u8_t* ch;
+ //u8_t bPassive;
+ u32_t devSize;
+ struct zfCbUsbFuncTbl cbUsbFuncTbl;
+ zmw_get_wlan_dev(dev);
+
+ zm_debug_msg0("start");
+
+ devSize = sizeof(struct zsWlanDev);
+ /* Zeroize zsWlanDev struct */
+ zfZeroMemory((u8_t*)wd, (u16_t)devSize);
+
+#ifdef ZM_ENABLE_AGGREGATION
+ zfAggInit(dev);
+#endif
+
+ zfCwmInit(dev);
+
+ wd->commTally.RateCtrlTxMPDU = 0;
+ wd->commTally.RateCtrlBAFail = 0;
+ wd->preambleTypeInUsed = ZM_PREAMBLE_TYPE_SHORT;
+
+ if (cbFuncTbl == NULL)
+ {
+ /* zfcbRecvEth() is mandatory */
+ zm_assert(0);
+ }
+ else
+ {
+ if (cbFuncTbl->zfcbRecvEth == NULL)
+ {
+ /* zfcbRecvEth() is mandatory */
+ zm_assert(0);
+ }
+ wd->zfcbAuthNotify = cbFuncTbl->zfcbAuthNotify;
+ wd->zfcbAuthNotify = cbFuncTbl->zfcbAuthNotify;
+ wd->zfcbAsocNotify = cbFuncTbl->zfcbAsocNotify;
+ wd->zfcbDisAsocNotify = cbFuncTbl->zfcbDisAsocNotify;
+ wd->zfcbApConnectNotify = cbFuncTbl->zfcbApConnectNotify;
+ wd->zfcbConnectNotify = cbFuncTbl->zfcbConnectNotify;
+ wd->zfcbScanNotify = cbFuncTbl->zfcbScanNotify;
+ wd->zfcbMicFailureNotify = cbFuncTbl->zfcbMicFailureNotify;
+ wd->zfcbApMicFailureNotify = cbFuncTbl->zfcbApMicFailureNotify;
+ wd->zfcbIbssPartnerNotify = cbFuncTbl->zfcbIbssPartnerNotify;
+ wd->zfcbMacAddressNotify = cbFuncTbl->zfcbMacAddressNotify;
+ wd->zfcbSendCompleteIndication = cbFuncTbl->zfcbSendCompleteIndication;
+ wd->zfcbRecvEth = cbFuncTbl->zfcbRecvEth;
+ wd->zfcbRestoreBufData = cbFuncTbl->zfcbRestoreBufData;
+ wd->zfcbRecv80211 = cbFuncTbl->zfcbRecv80211;
+#ifdef ZM_ENABLE_CENC
+ wd->zfcbCencAsocNotify = cbFuncTbl->zfcbCencAsocNotify;
+#endif //ZM_ENABLE_CENC
+ wd->zfcbClassifyTxPacket = cbFuncTbl->zfcbClassifyTxPacket;
+ wd->zfcbHwWatchDogNotify = cbFuncTbl->zfcbHwWatchDogNotify;
+ }
+
+ //add by honda 0330
+ cbUsbFuncTbl.zfcbUsbRecv = zfiUsbRecv;
+ cbUsbFuncTbl.zfcbUsbRegIn = zfiUsbRegIn;
+ cbUsbFuncTbl.zfcbUsbOutComplete = zfiUsbOutComplete;
+ cbUsbFuncTbl.zfcbUsbRegOutComplete = zfiUsbRegOutComplete;
+ zfwUsbRegisterCallBack(dev, &cbUsbFuncTbl);
+ /* Init OWN MAC address */
+ wd->macAddr[0] = 0x8000;
+ wd->macAddr[1] = 0x0000;
+ wd->macAddr[2] = 0x0000;
+
+ wd->regulationTable.regionCode = 0xffff;
+
+ zfHpInit(dev, wd->frequency);
+
+ /* init region code */
+ //wd->regulationTable.regionCode = NULL1_WORLD; //Only 2.4g RegCode
+ //zfHpGetRegulationTablefromRegionCode(dev, NULL1_WORLD);
+ //zfiWlanSetDot11DMode(dev , 1); // Enable 802.11d
+ /* Get the first channel */
+ //wd->frequency = zfChGetFirstChannel(dev, &bPassive);
+#ifdef ZM_AP_DEBUG
+ //wd->frequency = 2437;
+#endif
+
+ //STA mode
+ wd->sta.mTxRate = 0x0;
+ wd->sta.uTxRate = 0x3;
+ wd->sta.mmTxRate = 0x0;
+ wd->sta.adapterState = ZM_STA_STATE_DISCONNECT;
+ wd->sta.capability[0] = 0x01;
+ wd->sta.capability[1] = 0x00;
+
+ wd->sta.preambleTypeHT = 0;
+ wd->sta.htCtrlBandwidth = 0;
+ wd->sta.htCtrlSTBC = 0;
+ wd->sta.htCtrlSG = 0;
+ wd->sta.defaultTA = 0;
+ //wd->sta.activescanTickPerChannel = ZM_TIME_ACTIVE_SCAN/ZM_MS_PER_TICK;
+ {
+ u8_t Dur = ZM_TIME_ACTIVE_SCAN;
+ zfwGetActiveScanDur(dev, &Dur);
+ wd->sta.activescanTickPerChannel = Dur/ZM_MS_PER_TICK;
+
+ }
+ wd->sta.passiveScanTickPerChannel = ZM_TIME_PASSIVE_SCAN/ZM_MS_PER_TICK;
+ wd->sta.bAutoReconnect = TRUE;
+ wd->sta.dropUnencryptedPkts = FALSE;
+
+ /* set default to bypass all multicast packet for linux, window XP would set 0 by wrapper initialization */
+ wd->sta.bAllMulticast = 1;
+
+ /* Initial the RIFS Status / RIFS-like frame count / RIFS count */
+ wd->sta.rifsState = ZM_RIFS_STATE_DETECTING;
+ wd->sta.rifsLikeFrameCnt = 0;
+ wd->sta.rifsCount = 0;
+
+ wd->sta.osRxFilter = 0;
+ wd->sta.bSafeMode = 0;
+
+ //Common
+ zfResetSupportRate(dev, ZM_DEFAULT_SUPPORT_RATE_DISCONNECT);
+ wd->beaconInterval = 100;
+ wd->rtsThreshold = 2346;
+ wd->fragThreshold = 32767;
+ wd->wlanMode = ZM_MODE_INFRASTRUCTURE;
+ wd->txMCS = 0xff; //AUTO
+ wd->dtim = 1;
+ //wd->txMT = 1; //OFDM
+ wd->tick = 1;
+ wd->maxTxPower2 = 0xff;
+ wd->maxTxPower5 = 0xff;
+ wd->supportMode = 0xffffffff;
+ wd->ws.adhocMode = ZM_ADHOCBAND_G;
+ wd->ws.autoSetFrequency = 0xff;
+
+ //AP mode
+ //wd->bgMode = wd->ws.bgMode;
+ wd->ap.ssidLen[0] = 6;
+ wd->ap.ssid[0][0] = 'Z';
+ wd->ap.ssid[0][1] = 'D';
+ wd->ap.ssid[0][2] = '1';
+ wd->ap.ssid[0][3] = '2';
+ wd->ap.ssid[0][4] = '2';
+ wd->ap.ssid[0][5] = '1';
+
+ // Init the country iso name as NA
+ wd->ws.countryIsoName[0] = 0;
+ wd->ws.countryIsoName[1] = 0;
+ wd->ws.countryIsoName[2] = '\0';
+
+ /* init fragmentation is disabled */
+ //zfiWlanSetFragThreshold(dev, 0);
+
+ /* airopeek : swSniffer 1=>on 0=>off */
+ wd->swSniffer = 0;
+ wd->XLinkMode = 0;
+
+// jhlee HT 0
+#if 1
+ /* AP Mode*/
+ /* Init HT Capability Info */
+ wd->ap.HTCap.Data.ElementID = ZM_WLAN_EID_HT_CAPABILITY;
+ wd->ap.HTCap.Data.Length = 26;
+ //wd->ap.HTCap.Data.SupChannelWidthSet = 0;
+ //wd->ap.HTCap.Data.MIMOPowerSave = 3;
+ //wd->ap.HTCap.Data.ShortGIfor40MHz = 0;
+ //wd->ap.HTCap.Data.ShortGIfor20MHz = 0;
+ //wd->ap.HTCap.Data.DSSSandCCKin40MHz = 0;
+ wd->ap.HTCap.Data.AMPDUParam |= HTCAP_MaxRxAMPDU3;
+ wd->ap.HTCap.Data.MCSSet[0] = 0xFF; // MCS 0 ~ 7
+ wd->ap.HTCap.Data.MCSSet[1] = 0xFF; // MCS 8 ~ 15
+
+ /* Init Extended HT Capability Info */
+ wd->ap.ExtHTCap.Data.ElementID = ZM_WLAN_EID_EXTENDED_HT_CAPABILITY;
+ wd->ap.ExtHTCap.Data.Length = 22;
+ wd->ap.ExtHTCap.Data.ControlChannel = 6;
+ //wd->ap.ExtHTCap.Data.ExtChannelOffset = 3;
+ wd->ap.ExtHTCap.Data.ChannelInfo |= ExtHtCap_RecomTxWidthSet;
+ //wd->ap.ExtHTCap.Data.RIFSMode = 1;
+ wd->ap.ExtHTCap.Data.OperatingInfo |= 1;
+
+ /* STA Mode*/
+ /* Init HT Capability Info */
+ wd->sta.HTCap.Data.ElementID = ZM_WLAN_EID_HT_CAPABILITY;
+ wd->sta.HTCap.Data.Length = 26;
+
+ /* Test with 5G-AP : 7603 */
+ //wd->sta.HTCap.Data.SupChannelWidthSet = 1;
+ wd->sta.HTCap.Data.HtCapInfo |= HTCAP_SMEnabled;
+ wd->sta.HTCap.Data.HtCapInfo |= HTCAP_SupChannelWidthSet;
+ wd->sta.HTCap.Data.HtCapInfo |= HTCAP_ShortGIfor40MHz;
+ wd->sta.HTCap.Data.HtCapInfo |= HTCAP_DSSSandCCKin40MHz;
+#ifndef ZM_DISABLE_AMSDU8K_SUPPORT
+ wd->sta.HTCap.Data.HtCapInfo |= HTCAP_MaxAMSDULength;
+#endif
+ //wd->sta.HTCap.Data.MIMOPowerSave = 0;
+ //wd->sta.HTCap.Data.ShortGIfor40MHz = 0;
+ //wd->sta.HTCap.Data.ShortGIfor20MHz = 0;
+ //wd->sta.HTCap.Data.DSSSandCCKin40MHz = 0;
+ wd->sta.HTCap.Data.AMPDUParam |= HTCAP_MaxRxAMPDU3;
+ wd->sta.HTCap.Data.MCSSet[0] = 0xFF; // MCS 0 ~ 7
+ wd->sta.HTCap.Data.MCSSet[1] = 0xFF; // MCS 8 ~ 15
+ wd->sta.HTCap.Data.PCO |= HTCAP_TransmissionTime3;
+ //wd->sta.HTCap.Data.TransmissionTime = 0;
+ /* Init Extended HT Capability Info */
+ wd->sta.ExtHTCap.Data.ElementID = ZM_WLAN_EID_EXTENDED_HT_CAPABILITY;
+ wd->sta.ExtHTCap.Data.Length = 22;
+ wd->sta.ExtHTCap.Data.ControlChannel = 6;
+
+ //wd->sta.ExtHTCap.Data.ExtChannelOffset |= 3;
+ wd->sta.ExtHTCap.Data.ChannelInfo |= ExtHtCap_ExtChannelOffsetBelow;
+
+ //wd->sta.ExtHTCap.Data.RecomTxWidthSet = 1;
+ //wd->sta.ExtHTCap.Data.RIFSMode = 1;
+ wd->sta.ExtHTCap.Data.OperatingInfo |= 1;
+#endif
+
+#if 0
+ /* WME test code */
+ wd->ap.qosMode[0] = 1;
+#endif
+
+ wd->ledStruct.ledMode[0] = 0x2221;
+ wd->ledStruct.ledMode[1] = 0x2221;
+
+ zfTimerInit(dev);
+
+ ZM_PERFORMANCE_INIT(dev);
+
+ zfBssInfoCreate(dev);
+ zfScanMgrInit(dev);
+ zfPowerSavingMgrInit(dev);
+
+#if 0
+ /* Test code */
+ {
+ u32_t key[4] = {0xffffffff, 0xff, 0, 0};
+ u16_t addr[3] = {0x8000, 0x01ab, 0x0000};
+ //zfSetKey(dev, 0, 0, ZM_WEP64, addr, key);
+ //zfSetKey(dev, 0, 0, ZM_AES, addr, key);
+ //zfSetKey(dev, 64, 0, 1, wd->macAddr, key);
+ }
+#endif
+
+ // WME settings
+ wd->ws.staWmeEnabled = 1; // Enable WME by default
+ #define ZM_UAPSD_Q_SIZE 32 //2^N
+ wd->ap.uapsdQ = zfQueueCreate(dev, ZM_UAPSD_Q_SIZE);
+ zm_assert(wd->ap.uapsdQ != NULL);
+ wd->sta.uapsdQ = zfQueueCreate(dev, ZM_UAPSD_Q_SIZE);
+ zm_assert(wd->sta.uapsdQ != NULL);
+
+ //zfHpInit(dev, wd->frequency);
+
+ /* MAC address */
+ //zfHpSetMacAddress(dev, wd->macAddr, 0);
+ zfHpGetMacAddress(dev);
+
+ zfCoreSetFrequency(dev, wd->frequency);
+
+#if ZM_PCI_LOOP_BACK == 1
+ zfwWriteReg(dev, ZM_REG_PCI_CONTROL, 6);
+#endif /* #if ZM_PCI_LOOP_BACK == 1 */
+
+ //zfiWlanSetDot11DMode(dev , 1); // Enable 802.11d
+ //zfiWlanSetDot11HDFSMode(dev , 1); // Enable 802.11h DFS
+ wd->sta.DFSEnable = 1;
+ wd->sta.capability[1] |= ZM_BIT_0;
+
+ //zfiWlanSetFrequency(dev, 5260000, TRUE);
+ //zfiWlanSetAniMode(dev , 1); // Enable ANI
+
+ /* Trgger Rx DMA */
+ zfHpStartRecv(dev);
+
+ zm_debug_msg0("end");
+
+ return 0;
+}
+
+/* WLAN hardware will be shutdown and all resource will be release */
+u16_t zfiWlanClose(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ zm_msg0_init(ZM_LV_0, "enter");
+
+ wd->state = ZM_WLAN_STATE_CLOSEDED;
+
+ //zfiWlanDisable(dev, 1);
+ zfWlanReset(dev);
+
+ zfHpStopRecv(dev);
+
+ /* Disable MAC */
+ /* Disable PHY */
+ /* Disable RF */
+
+ zfHpRelease(dev);
+
+ zfQueueDestroy(dev, wd->ap.uapsdQ);
+ zfQueueDestroy(dev, wd->sta.uapsdQ);
+
+ zfBssInfoDestroy(dev);
+
+#ifdef ZM_ENABLE_AGGREGATION
+ /* add by honda */
+ zfAggRxFreeBuf(dev, 1); //1 for release structure memory
+ /* end of add by honda */
+#endif
+
+ zm_msg0_init(ZM_LV_0, "exit");
+
+ return 0;
+}
+
+void zfGetWrapperSetting(zdev_t* dev)
+{
+ u8_t bPassive;
+ u16_t vapId = 0;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+#if 0
+ if ( (wd->ws.countryIsoName[0] != 0)
+ || (wd->ws.countryIsoName[1] != 0)
+ || (wd->ws.countryIsoName[2] != '\0') )
+ {
+ zfHpGetRegulationTablefromRegionCode(
+ dev,
+ zfHpGetRegionCodeFromIsoName(dev, wd->ws.countryIsoName) );
+ }
+#endif
+ zmw_enter_critical_section(dev);
+
+ wd->wlanMode = wd->ws.wlanMode;
+
+ /* set channel */
+ if ( wd->ws.frequency )
+ {
+ wd->frequency = wd->ws.frequency;
+ wd->ws.frequency = 0;
+ }
+ else
+ {
+ wd->frequency = zfChGetFirstChannel(dev, &bPassive);
+
+ if ( wd->wlanMode == ZM_MODE_IBSS )
+ {
+ if (wd->ws.adhocMode == ZM_ADHOCBAND_A)
+ {
+ wd->frequency = ZM_CH_A_36;
+ }
+ else
+ {
+ wd->frequency = ZM_CH_G_6;
+ }
+ }
+ }
+#ifdef ZM_AP_DEBUG
+ /* honda add for debug, 2437 channel 6, 2452 channel 9 */
+ wd->frequency = 2437;
+ /* end of add by honda */
+#endif
+
+ /* set preamble type */
+ switch (wd->ws.preambleType)
+ {
+ case ZM_PREAMBLE_TYPE_AUTO:
+ case ZM_PREAMBLE_TYPE_SHORT:
+ case ZM_PREAMBLE_TYPE_LONG:
+ wd->preambleType = wd->ws.preambleType;
+ break;
+ default:
+ wd->preambleType = ZM_PREAMBLE_TYPE_SHORT;
+ break;
+ }
+ wd->ws.preambleType = 0;
+
+ if ( wd->wlanMode == ZM_MODE_AP )
+ {
+ vapId = zfwGetVapId(dev);
+
+ if (vapId == 0xffff)
+ {
+ wd->ap.authAlgo[0] = wd->ws.authMode;
+ wd->ap.encryMode[0] = wd->ws.encryMode;
+ }
+ else
+ {
+ wd->ap.authAlgo[vapId + 1] = wd->ws.authMode;
+ wd->ap.encryMode[vapId + 1] = wd->ws.encryMode;
+ }
+ wd->ws.authMode = 0;
+ wd->ws.encryMode = ZM_NO_WEP;
+
+ /* Get beaconInterval from WrapperSetting */
+ if ((wd->ws.beaconInterval >= 20) && (wd->ws.beaconInterval <= 1000))
+ {
+ wd->beaconInterval = wd->ws.beaconInterval;
+ }
+ else
+ {
+ wd->beaconInterval = 100; //100ms
+ }
+
+ if (wd->ws.dtim > 0)
+ {
+ wd->dtim = wd->ws.dtim;
+ }
+ else
+ {
+ wd->dtim = 1;
+ }
+
+ wd->ap.qosMode = wd->ws.apWmeEnabled & 0x1;
+ wd->ap.uapsdEnabled = (wd->ws.apWmeEnabled & 0x2) >> 1;
+ }
+ else
+ {
+ wd->sta.authMode = wd->ws.authMode;
+ wd->sta.currentAuthMode = wd->ws.authMode;
+ wd->sta.wepStatus = wd->ws.wepStatus;
+
+ if ( wd->ws.beaconInterval )
+ {
+ wd->beaconInterval = wd->ws.beaconInterval;
+ }
+ else
+ {
+ wd->beaconInterval = 0x64;
+ }
+
+ if ( wd->wlanMode == ZM_MODE_IBSS )
+ {
+ /* 1. Set default channel 6 (2437MHz) */
+// wd->frequency = 2437;
+
+ /* 2. Otus support 802.11g Mode */
+ if ((wd->ws.adhocMode == ZM_ADHOCBAND_G) ||
+ (wd->ws.adhocMode == ZM_ADHOCBAND_BG) ||
+ (wd->ws.adhocMode == ZM_ADHOCBAND_ABG) ) {
+ wd->wfc.bIbssGMode = 1;
+ } else {
+ wd->wfc.bIbssGMode = 0;
+ }
+
+ /* 3. set short preamble */
+ //wd->sta.preambleType = ZM_PREAMBLE_TYPE_SHORT ;
+ }
+
+ /* set ATIM window */
+ if ( wd->ws.atimWindow )
+ {
+ wd->sta.atimWindow = wd->ws.atimWindow;
+ }
+ else
+ {
+ //wd->sta.atimWindow = 0x0a;
+ wd->sta.atimWindow = 0;
+ }
+
+ //wd->sta.connectingHiddenAP = 1;//wd->ws.connectingHiddenAP;
+ wd->sta.dropUnencryptedPkts = wd->ws.dropUnencryptedPkts;
+ wd->sta.ibssJoinOnly = wd->ws.ibssJoinOnly;
+
+ if ( wd->ws.bDesiredBssid )
+ {
+ zfMemoryCopy(wd->sta.desiredBssid, wd->ws.desiredBssid, 6);
+ wd->sta.bDesiredBssid = TRUE;
+ wd->ws.bDesiredBssid = FALSE;
+ }
+ else
+ {
+ wd->sta.bDesiredBssid = FALSE;
+ }
+
+ /* check ssid */
+ if ( wd->ws.ssidLen != 0 )
+ {
+ if ( (!zfMemoryIsEqual(wd->ws.ssid, wd->sta.ssid,
+ wd->sta.ssidLen))||
+ (wd->ws.ssidLen != wd->sta.ssidLen)||
+ (wd->sta.authMode == ZM_AUTH_MODE_WPA)||
+ (wd->sta.authMode == ZM_AUTH_MODE_WPAPSK) ||
+ (wd->ws.staWmeQosInfo!= 0) )
+ {
+ /*if u-APSD test(set QosInfo), clear connectByReasso to do association (not reassociation)*/
+ wd->sta.connectByReasso = FALSE;
+ wd->sta.failCntOfReasso = 0;
+ wd->sta.pmkidInfo.bssidCount = 0;
+
+ wd->sta.ssidLen = wd->ws.ssidLen;
+ zfMemoryCopy(wd->sta.ssid, wd->ws.ssid, wd->sta.ssidLen);
+
+ if ( wd->sta.ssidLen < 32 )
+ {
+ wd->sta.ssid[wd->sta.ssidLen] = 0;
+ }
+ }
+ }
+ else
+ { /* ANY BSS */
+ wd->sta.ssid[0] = 0;
+ wd->sta.ssidLen = 0;
+ }
+
+ wd->sta.wmeEnabled = wd->ws.staWmeEnabled;
+ wd->sta.wmeQosInfo = wd->ws.staWmeQosInfo;
+
+ }
+
+ zmw_leave_critical_section(dev);
+}
+
+u16_t zfWlanEnable(zdev_t* dev)
+{
+ u8_t bssid[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ if ( wd->wlanMode == ZM_MODE_UNKNOWN )
+ {
+ zm_debug_msg0("Unknown Mode...Skip...");
+ return 0;
+ }
+
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ u16_t vapId;
+
+ vapId = zfwGetVapId(dev);
+
+ if (vapId == 0xffff)
+ {
+ /* AP mode */
+ zfApInitStaTbl(dev);
+
+ /* AP default parameters */
+ wd->bRate = 0xf;
+ wd->gRate = 0xff;
+ wd->bRateBasic = 0xf;
+ wd->gRateBasic = 0x0;
+ //wd->beaconInterval = 100;
+ wd->ap.apBitmap = 1;
+ wd->ap.beaconCounter = 0;
+ //wd->ap.vapNumber = 1; //mark by ygwei for Vap
+
+ wd->ap.hideSsid[0] = 0;
+ wd->ap.staAgingTimeSec = 10*60;
+ wd->ap.staProbingTimeSec = 60;
+
+ for (i=0; i<ZM_MAX_AP_SUPPORT; i++)
+ {
+ wd->ap.bcmcHead[i] = wd->ap.bcmcTail[i] = 0;
+ }
+
+ //wd->ap.uniHead = wd->ap.uniTail = 0;
+
+ /* load AP parameters */
+ wd->bRateBasic = wd->ws.bRateBasic;
+ wd->gRateBasic = wd->ws.gRateBasic;
+ wd->bgMode = wd->ws.bgMode;
+ if ((wd->ws.ssidLen <= 32) && (wd->ws.ssidLen != 0))
+ {
+ wd->ap.ssidLen[0] = wd->ws.ssidLen;
+ for(i=0; i<wd->ws.ssidLen; i++)
+ {
+ wd->ap.ssid[0][i] = wd->ws.ssid[i];
+ }
+ wd->ws.ssidLen = 0; // Reset Wrapper Variable
+ }
+
+ if (wd->ap.encryMode[0] == 0)
+ {
+ wd->ap.capab[0] = 0x001;
+ }
+ else
+ {
+ wd->ap.capab[0] = 0x011;
+ }
+ /* set Short Slot Time bit if not 11b */
+ if (wd->ap.wlanType[0] != ZM_WLAN_TYPE_PURE_B)
+ {
+ wd->ap.capab[0] |= 0x400;
+ }
+
+ // wd->ap.vapNumber = 1; // mark by ygwei for Vap Test
+ }
+ else
+ {
+#if 0
+ /* VAP Test Code */
+ wd->ap.apBitmap = 0x3;
+ wd->ap.capab[1] = 0x401;
+ wd->ap.ssidLen[1] = 4;
+ wd->ap.ssid[1][0] = 'v';
+ wd->ap.ssid[1][1] = 'a';
+ wd->ap.ssid[1][2] = 'p';
+ wd->ap.ssid[1][3] = '1';
+ wd->ap.authAlgo[1] = wd->ws.authMode;
+ wd->ap.encryMode[1] = wd->ws.encryMode;
+ wd->ap.vapNumber = 2;
+#else
+ /* VAP Test Code */
+ wd->ap.apBitmap = 0x1 | (0x01 << (vapId+1));
+
+ if ((wd->ws.ssidLen <= 32) && (wd->ws.ssidLen != 0))
+ {
+ wd->ap.ssidLen[vapId+1] = wd->ws.ssidLen;
+ for(i=0; i<wd->ws.ssidLen; i++)
+ {
+ wd->ap.ssid[vapId+1][i] = wd->ws.ssid[i];
+ }
+ wd->ws.ssidLen = 0; // Reset Wrapper Variable
+ }
+
+ if (wd->ap.encryMode[vapId+1] == 0)
+ {
+ wd->ap.capab[vapId+1] = 0x401;
+ }
+ else
+ {
+ wd->ap.capab[vapId+1] = 0x411;
+ }
+
+ wd->ap.authAlgo[vapId+1] = wd->ws.authMode;
+ wd->ap.encryMode[vapId+1] = wd->ws.encryMode;
+
+ /* Need to be modified when VAP is used */
+ //wd->ap.vapNumber = 2;
+#endif
+ }
+
+ wd->ap.vapNumber++;
+
+ zfCoreSetFrequency(dev, wd->frequency);
+
+ zfInitMacApMode(dev);
+
+ /* Disable protection mode */
+ zfApSetProtectionMode(dev, 0);
+
+ zfApSendBeacon(dev);
+ } /*if (wd->wlanMode == ZM_MODE_AP) */
+ else
+ {
+ zfScanMgrScanStop(dev, ZM_SCAN_MGR_SCAN_INTERNAL);
+ zfScanMgrScanStop(dev, ZM_SCAN_MGR_SCAN_EXTERNAL);
+
+ zmw_enter_critical_section(dev);
+ wd->sta.oppositeCount = 0; /* reset opposite count */
+ //wd->sta.bAutoReconnect = wd->sta.bAutoReconnectEnabled;
+ //wd->sta.scanWithSSID = 0;
+ zfStaInitOppositeInfo(dev);
+ zmw_leave_critical_section(dev);
+
+ zfStaResetStatus(dev, 0);
+
+ if ( (wd->sta.cmDisallowSsidLength != 0)&&
+ (wd->sta.ssidLen == wd->sta.cmDisallowSsidLength)&&
+ (zfMemoryIsEqual(wd->sta.ssid, wd->sta.cmDisallowSsid,
+ wd->sta.ssidLen)) &&
+ (wd->sta.wepStatus == ZM_ENCRYPTION_TKIP))
+ { /* countermeasures */
+ zm_debug_msg0("countermeasures disallow association");
+
+ }
+ else
+ {
+ switch( wd->wlanMode )
+ {
+ case ZM_MODE_IBSS:
+ /* some registers may be set here */
+ if ( wd->sta.authMode == ZM_AUTH_MODE_WPA2PSK )
+ {
+ zfHpSetApStaMode(dev, ZM_HAL_80211_MODE_IBSS_WPA2PSK);
+ }
+ else
+ {
+ zfHpSetApStaMode(dev, ZM_HAL_80211_MODE_IBSS_GENERAL);
+ }
+
+ zm_msg0_mm(ZM_LV_0, "ZM_MODE_IBSS");
+ zfIbssConnectNetwork(dev);
+ break;
+
+ case ZM_MODE_INFRASTRUCTURE:
+ /* some registers may be set here */
+ zfHpSetApStaMode(dev, ZM_HAL_80211_MODE_STA);
+
+ zfInfraConnectNetwork(dev);
+ break;
+
+ case ZM_MODE_PSEUDO:
+ /* some registers may be set here */
+ zfHpSetApStaMode(dev, ZM_HAL_80211_MODE_STA);
+
+ zfUpdateBssid(dev, bssid);
+ zfCoreSetFrequency(dev, wd->frequency);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ }
+
+
+ //if ( (wd->wlanMode != ZM_MODE_INFRASTRUCTURE)&&
+ // (wd->wlanMode != ZM_MODE_AP) )
+ if ( wd->wlanMode == ZM_MODE_PSEUDO )
+ {
+ /* Reset Wlan status */
+ zfWlanReset(dev);
+
+ if (wd->zfcbConnectNotify != NULL)
+ {
+ wd->zfcbConnectNotify(dev, ZM_STATUS_MEDIA_CONNECT, wd->sta.bssid);
+ }
+ zfChangeAdapterState(dev, ZM_STA_STATE_CONNECTED);
+ }
+
+
+ if(wd->wlanMode == ZM_MODE_AP)
+ {
+ if (wd->zfcbConnectNotify != NULL)
+ {
+ wd->zfcbConnectNotify(dev, ZM_STATUS_MEDIA_CONNECT, wd->sta.bssid);
+ }
+ //zfChangeAdapterState(dev, ZM_STA_STATE_CONNECTED);
+ }
+
+ // Assign default Tx Rate
+ if ( wd->sta.EnableHT )
+ {
+ u32_t oneTxStreamCap;
+ oneTxStreamCap = (zfHpCapability(dev) & ZM_HP_CAP_11N_ONE_TX_STREAM);
+ if(oneTxStreamCap)
+ wd->CurrentTxRateKbps = 135000;
+ else
+ wd->CurrentTxRateKbps = 270000;
+ wd->CurrentRxRateKbps = 270000;
+ }
+ else
+ {
+ wd->CurrentTxRateKbps = 54000;
+ wd->CurrentRxRateKbps = 54000;
+ }
+
+ wd->state = ZM_WLAN_STATE_ENABLED;
+
+ return 0;
+}
+
+/* Enable/disable Wlan operation */
+u16_t zfiWlanEnable(zdev_t* dev)
+{
+ u16_t ret;
+
+ zmw_get_wlan_dev(dev);
+
+ zm_msg0_mm(ZM_LV_1, "Enable Wlan");
+
+ zfGetWrapperSetting(dev);
+
+ zfZeroMemory((u8_t*) &wd->trafTally, sizeof(struct zsTrafTally));
+
+ // Reset cmMicFailureCount to 0 for new association request
+ if ( wd->sta.cmMicFailureCount == 1 )
+ {
+ zfTimerCancel(dev, ZM_EVENT_CM_TIMER);
+ wd->sta.cmMicFailureCount = 0;
+ }
+
+ zfFlushVtxq(dev);
+ if ((wd->queueFlushed & 0x10) != 0)
+ {
+ zfHpUsbReset(dev);
+ }
+ ret = zfWlanEnable(dev);
+
+ return ret;
+}
+/* Add a flag named ResetKeyCache to show if KeyCache should be cleared.
+ for hostapd in AP mode, if driver receives iwconfig ioctl
+ after setting group key, it shouldn't clear KeyCache. */
+u16_t zfiWlanDisable(zdev_t* dev, u8_t ResetKeyCache)
+{
+ u16_t i;
+ u8_t isConnected;
+
+ zmw_get_wlan_dev(dev);
+
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ zmw_declare_for_critical_section();
+#endif
+ wd->state = ZM_WLAN_STATE_DISABLED;
+
+ zm_msg0_mm(ZM_LV_1, "Disable Wlan");
+
+ if ( wd->wlanMode != ZM_MODE_AP )
+ {
+ isConnected = zfStaIsConnected(dev);
+
+ if ( (wd->wlanMode == ZM_MODE_INFRASTRUCTURE)&&
+ (wd->sta.currentAuthMode != ZM_AUTH_MODE_WPA2) )
+ {
+ /* send deauthentication frame */
+ if (isConnected)
+ {
+ //zfiWlanDeauth(dev, NULL, 0);
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH, wd->sta.bssid, 3, 0, 0);
+ //zmw_debug_msg0("send a Deauth frame!");
+ }
+ }
+
+ // Remove all the connected peer stations
+ if ( wd->wlanMode == ZM_MODE_IBSS )
+ {
+ wd->sta.ibssBssIsCreator = 0;
+ zfTimerCancel(dev, ZM_EVENT_IBSS_MONITOR);
+ zfStaIbssMonitoring(dev, 1);
+ }
+
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ zmw_enter_critical_section(dev);
+ wd->sta.ibssWpa2Psk = 0;
+ zmw_leave_critical_section(dev);
+#endif
+
+ wd->sta.wpaState = ZM_STA_WPA_STATE_INIT;
+
+ /* reset connect timeout counter */
+ wd->sta.connectTimeoutCount = 0;
+
+ /* reset connectState to None */
+ wd->sta.connectState = ZM_STA_CONN_STATE_NONE;
+
+ /* reset leap enable variable */
+ wd->sta.leapEnabled = 0;
+
+ /* Disable the RIFS Status / RIFS-like frame count / RIFS count */
+ if( wd->sta.rifsState == ZM_RIFS_STATE_DETECTED )
+ zfHpDisableRifs(dev);
+ wd->sta.rifsState = ZM_RIFS_STATE_DETECTING;
+ wd->sta.rifsLikeFrameCnt = 0;
+ wd->sta.rifsCount = 0;
+
+ wd->sta.osRxFilter = 0;
+ wd->sta.bSafeMode = 0;
+
+ zfChangeAdapterState(dev, ZM_STA_STATE_DISCONNECT);
+ if (ResetKeyCache)
+ zfHpResetKeyCache(dev);
+
+ if (isConnected)
+ {
+ if (wd->zfcbConnectNotify != NULL)
+ {
+ wd->zfcbConnectNotify(dev, ZM_STATUS_MEDIA_CONNECTION_DISABLED, wd->sta.bssid);
+ }
+ }
+ else
+ {
+ if (wd->zfcbConnectNotify != NULL)
+ {
+ wd->zfcbConnectNotify(dev, ZM_STATUS_MEDIA_DISABLED, wd->sta.bssid);
+ }
+ }
+ }
+ else //if (wd->wlanMode == ZM_MODE_AP)
+ {
+ for (i=0; i<ZM_MAX_STA_SUPPORT; i++)
+ {
+ /* send deauthentication frame */
+ if (wd->ap.staTable[i].valid == 1)
+ {
+ /* Reason : Sending station is leaving */
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH,
+ wd->ap.staTable[i].addr, 3, 0, 0);
+ }
+ }
+
+ if (ResetKeyCache)
+ zfHpResetKeyCache(dev);
+
+ wd->ap.vapNumber--;
+ }
+
+ /* stop beacon */
+ zfHpDisableBeacon(dev);
+
+ /* Flush VTxQ and MmQ */
+ zfFlushVtxq(dev);
+ /* Flush AP PS queues */
+ zfApFlushBufferedPsFrame(dev);
+ /* Free buffer in defragment list*/
+ zfAgingDefragList(dev, 1);
+
+ #ifdef ZM_ENABLE_AGGREGATION
+ /* add by honda */
+ zfAggRxFreeBuf(dev, 0); //1 for release structure memory
+ /* end of add by honda */
+ #endif
+
+ // Clear the information for the peer stations of IBSS or AP of Station mode
+ zfZeroMemory((u8_t*)wd->sta.oppositeInfo, sizeof(struct zsOppositeInfo) * ZM_MAX_OPPOSITE_COUNT);
+
+ /* Turn off Software WEP/TKIP */
+ if (wd->sta.SWEncryptEnable != 0)
+ {
+ zm_debug_msg0("Disable software encryption");
+ zfStaDisableSWEncryption(dev);
+ }
+
+ /* Improve WEP/TKIP performace with HT AP, detail information please look bug#32495 */
+ //zfHpSetTTSIFSTime(dev, 0x8);
+
+ return 0;
+}
+
+u16_t zfiWlanSuspend(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ // Change the HAL state to init so that any packet can't be transmitted between
+ // resume & HAL reinit. This would cause the chip hang issue in OTUS.
+ zmw_enter_critical_section(dev);
+ wd->halState = ZM_HAL_STATE_INIT;
+ zmw_leave_critical_section(dev);
+
+ return 0;
+}
+
+u16_t zfiWlanResume(zdev_t* dev, u8_t doReconn)
+{
+ u16_t ret;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ /* Redownload firmware, Reinit MAC,PHY,RF */
+ zfHpReinit(dev, wd->frequency);
+
+ //Set channel according to AP's configuration
+ zfCoreSetFrequencyExV2(dev, wd->frequency, wd->BandWidth40,
+ wd->ExtOffset, NULL, 1);
+
+ zfHpSetMacAddress(dev, wd->macAddr, 0);
+
+ /* Start Rx */
+ zfHpStartRecv(dev);
+
+ zfFlushVtxq(dev);
+
+ if ( wd->wlanMode != ZM_MODE_INFRASTRUCTURE &&
+ wd->wlanMode != ZM_MODE_IBSS )
+ {
+ return 1;
+ }
+
+ zm_msg0_mm(ZM_LV_1, "Resume Wlan");
+ if ( (zfStaIsConnected(dev)) || (zfStaIsConnecting(dev)) )
+ {
+ if (doReconn == 1)
+ {
+ zm_msg0_mm(ZM_LV_1, "Re-connect...");
+ zmw_enter_critical_section(dev);
+ wd->sta.connectByReasso = FALSE;
+ zmw_leave_critical_section(dev);
+
+ zfWlanEnable(dev);
+ }
+ else if (doReconn == 0)
+ {
+ zfHpSetRollCallTable(dev);
+ }
+ }
+
+ ret = 0;
+
+ return ret;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfiWlanFlushAllQueuedBuffers */
+/* Flush Virtual TxQ, MmQ, PS frames and defragment list */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2007.1 */
+/* */
+/************************************************************************/
+void zfiWlanFlushAllQueuedBuffers(zdev_t* dev)
+{
+ /* Flush VTxQ and MmQ */
+ zfFlushVtxq(dev);
+ /* Flush AP PS queues */
+ zfApFlushBufferedPsFrame(dev);
+ /* Free buffer in defragment list*/
+ zfAgingDefragList(dev, 1);
+}
+
+/* Do WLAN site survey */
+u16_t zfiWlanScan(zdev_t* dev)
+{
+ u16_t ret = 1;
+ zmw_get_wlan_dev(dev);
+
+ zm_debug_msg0("");
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ wd->heartBeatNotification |= ZM_BSSID_LIST_SCAN;
+ wd->sta.scanFrequency = 0;
+ //wd->sta.pUpdateBssList->bssCount = 0;
+ ret = 0;
+ }
+ else
+ {
+ #if 0
+ if ( !zfStaBlockWlanScan(dev) )
+ {
+ zm_debug_msg0("scan request");
+ //zfTimerSchedule(dev, ZM_EVENT_SCAN, ZM_TICK_ZERO);
+ ret = 0;
+ goto start_scan;
+ }
+ #else
+ goto start_scan;
+ #endif
+ }
+
+ zmw_leave_critical_section(dev);
+
+ return ret;
+
+start_scan:
+ zmw_leave_critical_section(dev);
+
+ if(wd->ledStruct.LEDCtrlFlagFromReg & ZM_LED_CTRL_FLAG_ALPHA) // flag for Alpha
+ wd->ledStruct.LEDCtrlFlag |= ZM_LED_CTRL_FLAG_ALPHA;
+
+ ret = zfScanMgrScanStart(dev, ZM_SCAN_MGR_SCAN_EXTERNAL);
+
+ zm_debug_msg1("ret = ", ret);
+
+ return ret;
+}
+
+
+/* rate */
+/* 0 : AUTO */
+/* 1 : CCK 1M */
+/* 2 : CCK 2M */
+/* 3 : CCK 5.5M */
+/* 4 : CCK 11M */
+/* 5 : OFDM 6M */
+/* 6 : OFDM 9M */
+/* 7 : OFDM 12M */
+/* 8 : OFDM 18M */
+/* 9 : OFDM 24M */
+/* 10 : OFDM 36M */
+/* 11 : OFDM 48M */
+/* 12 : OFDM 54M */
+/* 13 : MCS 0 */
+/* 28 : MCS 15 */
+u16_t zcRateToMCS[] =
+ {0xff, 0, 1, 2, 3, 0xb, 0xf, 0xa, 0xe, 0x9, 0xd, 0x8, 0xc};
+u16_t zcRateToMT[] = {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1};
+
+u16_t zfiWlanSetTxRate(zdev_t* dev, u16_t rate)
+{ // jhlee HT 0
+ zmw_get_wlan_dev(dev);
+
+ if (rate <=12)
+ {
+ wd->txMCS = zcRateToMCS[rate];
+ wd->txMT = zcRateToMT[rate];
+ return ZM_SUCCESS;
+ }
+ else if ((rate<=28)||(rate==13+32))
+ {
+ wd->txMCS = rate - 12 - 1;
+ wd->txMT = 2;
+ return ZM_SUCCESS;
+ }
+
+ return ZM_ERR_INVALID_TX_RATE;
+}
+
+const u32_t zcRateIdToKbps40M[] =
+ {
+ 1000, 2000, 5500, 11000, /* 1M, 2M, 5M, 11M , 0 1 2 3*/
+ 6000, 9000, 12000, 18000, /* 6M 9M 12M 18M , 4 5 6 7*/
+ 24000, 36000, 48000, 54000, /* 24M 36M 48M 54M , 8 9 10 11*/
+ 13500, 27000, 40500, 54000, /* MCS0 MCS1 MCS2 MCS3 , 12 13 14 15*/
+ 81000, 108000, 121500, 135000, /* MCS4 MCS5 MCS6 MCS7 , 16 17 18 19*/
+ 27000, 54000, 81000, 108000, /* MCS8 MCS9 MCS10 MCS11 , 20 21 22 23*/
+ 162000, 216000, 243000, 270000, /* MCS12 MCS13 MCS14 MCS15 , 24 25 26 27*/
+ 270000, 300000, 150000 /* MCS14SG, MCS15SG, MCS7SG , 28 29 30*/
+ };
+
+const u32_t zcRateIdToKbps20M[] =
+ {
+ 1000, 2000, 5500, 11000, /* 1M, 2M, 5M, 11M , 0 1 2 3*/
+ 6000, 9000, 12000, 18000, /* 6M 9M 12M 18M , 4 5 6 7*/
+ 24000, 36000, 48000, 54000, /* 24M 36M 48M 54M , 8 9 10 11*/
+ 6500, 13000, 19500, 26000, /* MCS0 MCS1 MCS2 MCS3 , 12 13 14 15*/
+ 39000, 52000, 58500, 65000, /* MCS4 MCS5 MCS6 MCS7 , 16 17 18 19*/
+ 13000, 26000, 39000, 52000, /* MCS8 MCS9 MCS10 MCS11 , 20 21 22 23*/
+ 78000, 104000, 117000, 130000, /* MCS12 MCS13 MCS14 MCS15 , 24 25 26 27*/
+ 130000, 144400, 72200 /* MCS14SG, MCS15SG, MSG7SG , 28 29 30*/
+ };
+
+u32_t zfiWlanQueryTxRate(zdev_t* dev)
+{
+ u8_t rateId = 0xff;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ /* If Tx rate had not been trained, return maximum Tx rate instead */
+ if ((wd->wlanMode == ZM_MODE_INFRASTRUCTURE) && (zfStaIsConnected(dev)))
+ {
+ zmw_enter_critical_section(dev);
+ //Not in fixed rate mode
+ if (wd->txMCS == 0xff)
+ {
+ if ((wd->sta.oppositeInfo[0].rcCell.flag & ZM_RC_TRAINED_BIT) == 0)
+ {
+ rateId = wd->sta.oppositeInfo[0].rcCell.operationRateSet[wd->sta.oppositeInfo[0].rcCell.operationRateCount-1];
+ }
+ else
+ {
+ rateId = wd->sta.oppositeInfo[0].rcCell.operationRateSet[wd->sta.oppositeInfo[0].rcCell.currentRateIndex];
+ }
+ }
+ zmw_leave_critical_section(dev);
+ }
+ if (rateId != 0xff)
+ {
+ if (wd->sta.htCtrlBandwidth)
+ {
+ return zcRateIdToKbps40M[rateId];
+ }
+ else
+ {
+ return zcRateIdToKbps20M[rateId];
+ }
+ }
+ else
+ {
+ return wd->CurrentTxRateKbps;
+ }
+}
+
+void zfWlanUpdateRxRate(zdev_t* dev, struct zsAdditionInfo* addInfo)
+{
+ u32_t rxRateKbps;
+ zmw_get_wlan_dev(dev);
+ //zm_msg1_mm(ZM_LV_0, "addInfo->Tail.Data.RxMacStatus =", addInfo->Tail.Data.RxMacStatus & 0x03);
+
+ /* b5~b4: MPDU indication. */
+ /* 00: Single MPDU. */
+ /* 10: First MPDU of A-MPDU. */
+ /* 11: Middle MPDU of A-MPDU. */
+ /* 01: Last MPDU of A-MPDU. */
+ /* Only First MPDU and Single MPDU have PLCP header */
+ /* First MPDU : (mpduInd & 0x30) == 0x00 */
+ /* Single MPDU : (mpduInd & 0x30) == 0x20 */
+ if ((addInfo->Tail.Data.RxMacStatus & 0x10) == 0)
+ {
+ /* Modulation type */
+ wd->modulationType = addInfo->Tail.Data.RxMacStatus & 0x03;
+ switch(wd->modulationType)
+ {
+ case 0x0: wd->rateField = addInfo->PlcpHeader[0] & 0xff; //CCK mode
+ wd->rxInfo = 0;
+ break;
+ case 0x1: wd->rateField = addInfo->PlcpHeader[0] & 0x0f; //Legacy-OFDM mode
+ wd->rxInfo = 0;
+ break;
+ case 0x2: wd->rateField = addInfo->PlcpHeader[3]; //HT-OFDM mode
+ wd->rxInfo = addInfo->PlcpHeader[6];
+ break;
+ default: break;
+ }
+
+ rxRateKbps = zfUpdateRxRate(dev);
+ if (wd->CurrentRxRateUpdated == 1)
+ {
+ if (rxRateKbps > wd->CurrentRxRateKbps)
+ {
+ wd->CurrentRxRateKbps = rxRateKbps;
+ }
+ }
+ else
+ {
+ wd->CurrentRxRateKbps = rxRateKbps;
+ wd->CurrentRxRateUpdated = 1;
+ }
+ }
+}
+#if 0
+u16_t zcIndextoRateBG[16] = {1000, 2000, 5500, 11000, 0, 0, 0, 0, 48000,
+ 24000, 12000, 6000, 54000, 36000, 18000, 9000};
+u32_t zcIndextoRateN20L[16] = {6500, 13000, 19500, 26000, 39000, 52000, 58500,
+ 65000, 13000, 26000, 39000, 52000, 78000, 104000,
+ 117000, 130000};
+u32_t zcIndextoRateN20S[16] = {7200, 14400, 21700, 28900, 43300, 57800, 65000,
+ 72200, 14400, 28900, 43300, 57800, 86700, 115600,
+ 130000, 144400};
+u32_t zcIndextoRateN40L[16] = {13500, 27000, 40500, 54000, 81000, 108000, 121500,
+ 135000, 27000, 54000, 81000, 108000, 162000, 216000,
+ 243000, 270000};
+u32_t zcIndextoRateN40S[16] = {15000, 30000, 45000, 60000, 90000, 120000, 135000,
+ 150000, 30000, 60000, 90000, 120000, 180000, 240000,
+ 270000, 300000};
+#endif
+
+extern u16_t zcIndextoRateBG[16];
+extern u32_t zcIndextoRateN20L[16];
+extern u32_t zcIndextoRateN20S[16];
+extern u32_t zcIndextoRateN40L[16];
+extern u32_t zcIndextoRateN40S[16];
+
+u32_t zfiWlanQueryRxRate(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->CurrentRxRateUpdated = 0;
+ return wd->CurrentRxRateKbps;
+}
+
+u32_t zfUpdateRxRate(zdev_t* dev)
+{
+ u8_t mcs, bandwidth;
+ u32_t rxRateKbps = 130000;
+ zmw_get_wlan_dev(dev);
+
+ switch (wd->modulationType)
+ {
+ case 0x0: //CCK mode
+ switch (wd->rateField)
+ {
+ case 0x0a: rxRateKbps = 1000;
+ break;
+ case 0x14: rxRateKbps = 2000;
+
+ case 0x37: rxRateKbps = 5500;
+ break;
+ case 0x6e: rxRateKbps = 11000;
+ break;
+ default:
+ break;
+ }
+ break;
+ case 0x1: //Legacy-OFDM mode
+ if (wd->rateField <= 15)
+ {
+ rxRateKbps = zcIndextoRateBG[wd->rateField];
+ }
+ break;
+ case 0x2: //HT-OFDM mode
+ mcs = wd->rateField & 0x7F;
+ bandwidth = wd->rateField & 0x80;
+ if (mcs <= 15)
+ {
+ if (bandwidth != 0)
+ {
+ if((wd->rxInfo & 0x80) != 0)
+ {
+ /* Short GI 40 MHz MIMO Rate */
+ rxRateKbps = zcIndextoRateN40S[mcs];
+ }
+ else
+ {
+ /* Long GI 40 MHz MIMO Rate */
+ rxRateKbps = zcIndextoRateN40L[mcs];
+ }
+ }
+ else
+ {
+ if((wd->rxInfo & 0x80) != 0)
+ {
+ /* Short GI 20 MHz MIMO Rate */
+ rxRateKbps = zcIndextoRateN20S[mcs];
+ }
+ else
+ {
+ /* Long GI 20 MHz MIMO Rate */
+ rxRateKbps = zcIndextoRateN20L[mcs];
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ //zm_msg1_mm(ZM_LV_0, "wd->CurrentRxRateKbps=", wd->CurrentRxRateKbps);
+
+ // ToDo: use bandwith field to define 40MB
+ return rxRateKbps;
+}
+
+/* Get WLAN stastics */
+u16_t zfiWlanGetStatistics(zdev_t* dev)
+{
+ /* Return link statistics */
+ return 0;
+}
+
+u16_t zfiWlanReset(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->state = ZM_WLAN_STATE_DISABLED;
+
+ return zfWlanReset(dev);
+}
+
+/* Reset WLAN */
+u16_t zfWlanReset(zdev_t* dev)
+{
+ u8_t isConnected;
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zm_debug_msg0("zfWlanReset");
+
+ isConnected = zfStaIsConnected(dev);
+
+ //if ( wd->wlanMode != ZM_MODE_AP )
+ {
+ if ( (wd->wlanMode == ZM_MODE_INFRASTRUCTURE)&&
+ (wd->sta.currentAuthMode != ZM_AUTH_MODE_WPA2) )
+ {
+ /* send deauthentication frame */
+ if (isConnected)
+ {
+ //zfiWlanDeauth(dev, NULL, 0);
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH, wd->sta.bssid, 3, 0, 0);
+ //zmw_debug_msg0("send a Deauth frame!");
+ }
+ }
+ }
+
+ zfChangeAdapterState(dev, ZM_STA_STATE_DISCONNECT);
+ zfHpResetKeyCache(dev);
+
+ if (isConnected)
+ {
+ //zfiWlanDisable(dev);
+ if (wd->zfcbConnectNotify != NULL)
+ {
+ wd->zfcbConnectNotify(dev, ZM_STATUS_MEDIA_CONNECTION_RESET, wd->sta.bssid);
+ }
+ }
+ else
+ {
+ if (wd->zfcbConnectNotify != NULL)
+ {
+ wd->zfcbConnectNotify(dev, ZM_STATUS_MEDIA_RESET, wd->sta.bssid);
+ }
+ }
+
+ /* stop beacon */
+ zfHpDisableBeacon(dev);
+
+ /* Free buffer in defragment list*/
+ zfAgingDefragList(dev, 1);
+
+ /* Flush VTxQ and MmQ */
+ zfFlushVtxq(dev);
+
+ #ifdef ZM_ENABLE_AGGREGATION
+ /* add by honda */
+ zfAggRxFreeBuf(dev, 0); //1 for release structure memory
+ /* end of add by honda */
+ #endif
+
+ zfStaRefreshBlockList(dev, 1);
+
+ zmw_enter_critical_section(dev);
+
+ zfTimerCancel(dev, ZM_EVENT_IBSS_MONITOR);
+ zfTimerCancel(dev, ZM_EVENT_CM_BLOCK_TIMER);
+ zfTimerCancel(dev, ZM_EVENT_CM_DISCONNECT);
+
+ wd->sta.connectState = ZM_STA_CONN_STATE_NONE;
+ wd->sta.connectByReasso = FALSE;
+ wd->sta.cmDisallowSsidLength = 0;
+ wd->sta.bAutoReconnect = 0;
+ wd->sta.InternalScanReq = 0;
+ wd->sta.encryMode = ZM_NO_WEP;
+ wd->sta.wepStatus = ZM_ENCRYPTION_WEP_DISABLED;
+ wd->sta.wpaState = ZM_STA_WPA_STATE_INIT;
+ wd->sta.cmMicFailureCount = 0;
+ wd->sta.ibssBssIsCreator = 0;
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ wd->sta.ibssWpa2Psk = 0;
+#endif
+ /* reset connect timeout counter */
+ wd->sta.connectTimeoutCount = 0;
+
+ /* reset leap enable variable */
+ wd->sta.leapEnabled = 0;
+
+ /* Reset the RIFS Status / RIFS-like frame count / RIFS count */
+ if( wd->sta.rifsState == ZM_RIFS_STATE_DETECTED )
+ zfHpDisableRifs(dev);
+ wd->sta.rifsState = ZM_RIFS_STATE_DETECTING;
+ wd->sta.rifsLikeFrameCnt = 0;
+ wd->sta.rifsCount = 0;
+
+ wd->sta.osRxFilter = 0;
+ wd->sta.bSafeMode = 0;
+
+ // Clear the information for the peer stations of IBSS or AP of Station mode
+ zfZeroMemory((u8_t*)wd->sta.oppositeInfo, sizeof(struct zsOppositeInfo) * ZM_MAX_OPPOSITE_COUNT);
+
+ zmw_leave_critical_section(dev);
+
+ zfScanMgrScanStop(dev, ZM_SCAN_MGR_SCAN_INTERNAL);
+ zfScanMgrScanStop(dev, ZM_SCAN_MGR_SCAN_EXTERNAL);
+
+ /* Turn off Software WEP/TKIP */
+ if (wd->sta.SWEncryptEnable != 0)
+ {
+ zm_debug_msg0("Disable software encryption");
+ zfStaDisableSWEncryption(dev);
+ }
+
+ /* Improve WEP/TKIP performace with HT AP, detail information please look bug#32495 */
+ //zfHpSetTTSIFSTime(dev, 0x8);
+
+ /* Keep Pseudo mode */
+ if ( wd->wlanMode != ZM_MODE_PSEUDO )
+ {
+ wd->wlanMode = ZM_MODE_INFRASTRUCTURE;
+ }
+ return 0;
+}
+
+/* Deauthenticate a STA */
+u16_t zfiWlanDeauth(zdev_t* dev, u16_t* macAddr, u16_t reason)
+{
+ zmw_get_wlan_dev(dev);
+
+ if ( wd->wlanMode == ZM_MODE_AP )
+ {
+ //u16_t id;
+
+ /*
+ * we will reset all key in zfHpResetKeyCache() when call
+ * zfiWlanDisable(), if we want to reset PairwiseKey for each sta,
+ * need to use a nullAddr to let keyindex not match.
+ * otherwise hardware will still find PairwiseKey when AP change
+ * encryption mode from WPA to WEP
+ */
+
+ /*
+ if ((id = zfApFindSta(dev, macAddr)) != 0xffff)
+ {
+ u32_t key[8];
+ u16_t nullAddr[3] = { 0x0, 0x0, 0x0 };
+
+ if (wd->ap.staTable[i].encryMode != ZM_NO_WEP)
+ {
+ zfHpSetApPairwiseKey(dev, nullAddr,
+ ZM_NO_WEP, &key[0], &key[4], i+1);
+ }
+ //zfHpSetApPairwiseKey(dev, (u16_t *)macAddr,
+ // ZM_NO_WEP, &key[0], &key[4], id+1);
+ wd->ap.staTable[id].encryMode = ZM_NO_WEP;
+ wd->ap.staTable[id].keyIdx = 0xff;
+ }
+ */
+
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH, macAddr, reason, 0, 0);
+ }
+ else
+ {
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH, wd->sta.bssid, 3, 0, 0);
+ }
+
+ /* Issue DEAUTH command to FW */
+ return 0;
+}
+
+
+/* XP packet filter feature : */
+/* 1=>enable: All multicast address packets, not just the ones enumerated in the multicast address list. */
+/* 0=>disable */
+void zfiWlanSetAllMulticast(zdev_t* dev, u32_t setting)
+{
+ zmw_get_wlan_dev(dev);
+ zm_msg1_mm(ZM_LV_0, "sta.bAllMulticast = ", setting);
+ wd->sta.bAllMulticast = (u8_t)setting;
+}
+
+
+/* HT configure API */
+void zfiWlanSetHTCtrl(zdev_t* dev, u32_t *setting, u32_t forceTxTPC)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->preambleType = (u8_t)setting[0];
+ wd->sta.preambleTypeHT = (u8_t)setting[1];
+ wd->sta.htCtrlBandwidth = (u8_t)setting[2];
+ wd->sta.htCtrlSTBC = (u8_t)setting[3];
+ wd->sta.htCtrlSG = (u8_t)setting[4];
+ wd->sta.defaultTA = (u8_t)setting[5];
+ wd->enableAggregation = (u8_t)setting[6];
+ wd->enableWDS = (u8_t)setting[7];
+
+ wd->forceTxTPC = forceTxTPC;
+}
+
+/* FB50 in OS XP, RD private test code */
+void zfiWlanQueryHTCtrl(zdev_t* dev, u32_t *setting, u32_t *forceTxTPC)
+{
+ zmw_get_wlan_dev(dev);
+
+ setting[0] = wd->preambleType;
+ setting[1] = wd->sta.preambleTypeHT;
+ setting[2] = wd->sta.htCtrlBandwidth;
+ setting[3] = wd->sta.htCtrlSTBC;
+ setting[4] = wd->sta.htCtrlSG;
+ setting[5] = wd->sta.defaultTA;
+ setting[6] = wd->enableAggregation;
+ setting[7] = wd->enableWDS;
+
+ *forceTxTPC = wd->forceTxTPC;
+}
+
+void zfiWlanDbg(zdev_t* dev, u8_t setting)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->enableHALDbgInfo = setting;
+}
+
+/* FB50 in OS XP, RD private test code */
+void zfiWlanSetRxPacketDump(zdev_t* dev, u32_t setting)
+{
+ zmw_get_wlan_dev(dev);
+ if (setting)
+ {
+ wd->rxPacketDump = 1; /* enable */
+ }
+ else
+ {
+ wd->rxPacketDump = 0; /* disable */
+ }
+}
+
+
+/* FB50 in OS XP, RD private test code */
+/* Tally */
+void zfiWlanResetTally(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ wd->commTally.txUnicastFrm = 0; //txUnicastFrames
+ wd->commTally.txMulticastFrm = 0; //txMulticastFrames
+ wd->commTally.txUnicastOctets = 0; //txUniOctets byte size
+ wd->commTally.txMulticastOctets = 0; //txMultiOctets byte size
+ wd->commTally.txFrmUpperNDIS = 0;
+ wd->commTally.txFrmDrvMgt = 0;
+ wd->commTally.RetryFailCnt = 0;
+ wd->commTally.Hw_TotalTxFrm = 0; //Hardware total Tx Frame
+ wd->commTally.Hw_RetryCnt = 0; //txMultipleRetriesFrames
+ wd->commTally.Hw_UnderrunCnt = 0;//
+ wd->commTally.DriverRxFrmCnt = 0;//
+ wd->commTally.rxUnicastFrm = 0; //rxUnicastFrames
+ wd->commTally.rxMulticastFrm = 0; //rxMulticastFrames
+ wd->commTally.NotifyNDISRxFrmCnt = 0;//
+ wd->commTally.rxUnicastOctets = 0; //rxUniOctets byte size
+ wd->commTally.rxMulticastOctets = 0; //rxMultiOctets byte size
+ wd->commTally.DriverDiscardedFrm = 0;// Discard by ValidateFrame
+ wd->commTally.LessThanDataMinLen = 0;//
+ wd->commTally.GreaterThanMaxLen = 0;//
+ wd->commTally.DriverDiscardedFrmCauseByMulticastList = 0;
+ wd->commTally.DriverDiscardedFrmCauseByFrmCtrl = 0;
+ wd->commTally.rxNeedFrgFrm = 0; // need more frg frm
+ wd->commTally.DriverRxMgtFrmCnt = 0;
+ wd->commTally.rxBroadcastFrm = 0; //Receive broadcast frame count
+ wd->commTally.rxBroadcastOctets = 0; //Receive broadcast frame byte size
+ wd->commTally.Hw_TotalRxFrm = 0;//
+ wd->commTally.Hw_CRC16Cnt = 0; //rxPLCPCRCErrCnt
+ wd->commTally.Hw_CRC32Cnt = 0; //rxCRC32ErrCnt
+ wd->commTally.Hw_DecrypErr_UNI = 0;//
+ wd->commTally.Hw_DecrypErr_Mul = 0;//
+ wd->commTally.Hw_RxFIFOOverrun = 0;//
+ wd->commTally.Hw_RxTimeOut = 0;
+ wd->commTally.LossAP = 0;//
+
+ wd->commTally.Tx_MPDU = 0;
+ wd->commTally.BA_Fail = 0;
+ wd->commTally.Hw_Tx_AMPDU = 0;
+ wd->commTally.Hw_Tx_MPDU = 0;
+
+ wd->commTally.txQosDropCount[0] = 0;
+ wd->commTally.txQosDropCount[1] = 0;
+ wd->commTally.txQosDropCount[2] = 0;
+ wd->commTally.txQosDropCount[3] = 0;
+ wd->commTally.txQosDropCount[4] = 0;
+
+ wd->commTally.Hw_RxMPDU = 0;
+ wd->commTally.Hw_RxDropMPDU = 0;
+ wd->commTally.Hw_RxDelMPDU = 0;
+
+ wd->commTally.Hw_RxPhyMiscError = 0;
+ wd->commTally.Hw_RxPhyXRError = 0;
+ wd->commTally.Hw_RxPhyOFDMError = 0;
+ wd->commTally.Hw_RxPhyCCKError = 0;
+ wd->commTally.Hw_RxPhyHTError = 0;
+ wd->commTally.Hw_RxPhyTotalCount = 0;
+
+#if (defined(GCCK) && defined(OFDM))
+ wd->commTally.rx11bDataFrame = 0;
+ wd->commTally.rxOFDMDataFrame = 0;
+#endif
+
+ zmw_leave_critical_section(dev);
+}
+
+/* FB50 in OS XP, RD private test code */
+void zfiWlanQueryTally(zdev_t* dev, struct zsCommTally *tally)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ zfMemoryCopy((u8_t*)tally, (u8_t*)&wd->commTally, sizeof(struct zsCommTally));
+ zmw_leave_critical_section(dev);
+}
+void zfiWlanQueryTrafTally(zdev_t* dev, struct zsTrafTally *tally)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ zfMemoryCopy((u8_t*)tally, (u8_t*)&wd->trafTally, sizeof(struct zsTrafTally));
+ zmw_leave_critical_section(dev);
+}
+
+void zfiWlanQueryMonHalRxInfo(zdev_t* dev, struct zsMonHalRxInfo *monHalRxInfo)
+{
+ zfHpQueryMonHalRxInfo(dev, (u8_t *)monHalRxInfo);
+}
+
+/* parse the modeMDKEnable to DrvCore */
+void zfiDKEnable(zdev_t* dev, u32_t enable)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->modeMDKEnable = enable;
+ zm_debug_msg1("modeMDKEnable = ", wd->modeMDKEnable);
+}
+
+/* airoPeek */
+u32_t zfiWlanQueryPacketTypePromiscuous(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ return wd->swSniffer;
+}
+
+/* airoPeek */
+void zfiWlanSetPacketTypePromiscuous(zdev_t* dev, u32_t setValue)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->swSniffer = setValue;
+ zm_msg1_mm(ZM_LV_0, "wd->swSniffer ", wd->swSniffer);
+ if (setValue)
+ {
+ /* write register for sniffer mode */
+ zfHpSetSnifferMode(dev, 1);
+ zm_msg0_mm(ZM_LV_1, "enalbe sniffer mode");
+ }
+ else
+ {
+ zfHpSetSnifferMode(dev, 0);
+ zm_msg0_mm(ZM_LV_0, "disalbe sniffer mode");
+ }
+}
+
+void zfiWlanSetXLinkMode(zdev_t* dev, u32_t setValue)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->XLinkMode = setValue;
+ if (setValue)
+ {
+ /* write register for sniffer mode */
+ zfHpSetSnifferMode(dev, 1);
+ }
+ else
+ {
+ zfHpSetSnifferMode(dev, 0);
+ }
+}
+
+extern void zfStaChannelManagement(zdev_t* dev, u8_t scan);
+void zfiSetChannelManagement(zdev_t* dev, u32_t setting)
+{
+ zmw_get_wlan_dev(dev);
+
+ switch (setting)
+ {
+ case 1:
+ wd->sta.EnableHT = 1;
+ wd->BandWidth40 = 1;
+ wd->ExtOffset = 1;
+ break;
+ case 3:
+ wd->sta.EnableHT = 1;
+ wd->BandWidth40 = 1;
+ wd->ExtOffset = 3;
+ break;
+ case 0:
+ wd->sta.EnableHT = 1;
+ wd->BandWidth40 = 0;
+ wd->ExtOffset = 0;
+ break;
+ default:
+ wd->BandWidth40 = 0;
+ wd->ExtOffset = 0;
+ break;
+
+ }
+ zfCoreSetFrequencyEx(dev, wd->frequency, wd->BandWidth40,
+ wd->ExtOffset, NULL);
+}
+
+void zfiSetRifs(zdev_t* dev, u16_t setting)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->sta.ie.HtInfo.ChannelInfo |= ExtHtCap_RIFSMode;
+ wd->sta.EnableHT = 1;
+ switch (setting)
+ {
+ case 0:
+ wd->sta.HT2040 = 0;
+// zfHpSetRifs(dev, 1, 0, (wd->sta.currentFrequency < 3000)? 1:0);
+ break;
+ case 1:
+ wd->sta.HT2040 = 1;
+// zfHpSetRifs(dev, 1, 1, (wd->sta.currentFrequency < 3000)? 1:0);
+ break;
+ default:
+ wd->sta.HT2040 = 0;
+// zfHpSetRifs(dev, 1, 0, (wd->sta.currentFrequency < 3000)? 1:0);
+ break;
+ }
+}
+
+void zfiCheckRifs(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ if(wd->sta.ie.HtInfo.ChannelInfo & ExtHtCap_RIFSMode)
+ {
+// zfHpSetRifs(dev, wd->sta.EnableHT, wd->sta.HT2040, (wd->sta.currentFrequency < 3000)? 1:0);
+ }
+}
+
+void zfiSetReorder(zdev_t* dev, u16_t value)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->reorder = value;
+}
+
+void zfiSetSeqDebug(zdev_t* dev, u16_t value)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->seq_debug = value;
+}
diff --git a/drivers/staging/otus/80211core/cfunc.c b/drivers/staging/otus/80211core/cfunc.c
new file mode 100644
index 00000000000..d7c49d7523d
--- /dev/null
+++ b/drivers/staging/otus/80211core/cfunc.c
@@ -0,0 +1,1227 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "cprecomp.h"
+
+u8_t zfQueryOppositeRate(zdev_t* dev, u8_t dst_mac[6], u8_t frameType)
+{
+ zmw_get_wlan_dev(dev);
+
+ /* For AP's rate adaption */
+ if ( wd->wlanMode == ZM_MODE_AP )
+ {
+ return 0;
+ }
+
+ /* For STA's rate adaption */
+ if ( (frameType & 0x0c) == ZM_WLAN_DATA_FRAME )
+ {
+ if ( ZM_IS_MULTICAST(dst_mac) )
+ {
+ return wd->sta.mTxRate;
+ }
+ else
+ {
+ return wd->sta.uTxRate;
+ }
+ }
+
+ return wd->sta.mmTxRate;
+}
+
+void zfCopyToIntTxBuffer(zdev_t* dev, zbuf_t* buf, u8_t* src,
+ u16_t offset, u16_t length)
+{
+ u16_t i;
+
+ for(i=0; i<length;i++)
+ {
+ zmw_tx_buf_writeb(dev, buf, offset+i, src[i]);
+ }
+}
+
+void zfCopyToRxBuffer(zdev_t* dev, zbuf_t* buf, u8_t* src,
+ u16_t offset, u16_t length)
+{
+ u16_t i;
+
+ for(i=0; i<length;i++)
+ {
+ zmw_rx_buf_writeb(dev, buf, offset+i, src[i]);
+ }
+}
+
+void zfCopyFromIntTxBuffer(zdev_t* dev, zbuf_t* buf, u8_t* dst,
+ u16_t offset, u16_t length)
+{
+ u16_t i;
+
+ for(i=0; i<length; i++)
+ {
+ dst[i] = zmw_tx_buf_readb(dev, buf, offset+i);
+ }
+}
+
+void zfCopyFromRxBuffer(zdev_t* dev, zbuf_t* buf, u8_t* dst,
+ u16_t offset, u16_t length)
+{
+ u16_t i;
+
+ for(i=0; i<length; i++)
+ {
+ dst[i] = zmw_rx_buf_readb(dev, buf, offset+i);
+ }
+}
+
+#if 1
+void zfMemoryCopy(u8_t* dst, u8_t* src, u16_t length)
+{
+ zfwMemoryCopy(dst, src, length);
+}
+
+void zfMemoryMove(u8_t* dst, u8_t* src, u16_t length)
+{
+ zfwMemoryMove(dst, src, length);
+}
+
+void zfZeroMemory(u8_t* va, u16_t length)
+{
+ zfwZeroMemory(va, length);
+}
+
+u8_t zfMemoryIsEqual(u8_t* m1, u8_t* m2, u16_t length)
+{
+ return zfwMemoryIsEqual(m1, m2, length);
+}
+#endif
+
+u8_t zfRxBufferEqualToStr(zdev_t* dev, zbuf_t* buf,
+ const u8_t* str, u16_t offset, u16_t length)
+{
+ u16_t i;
+ u8_t ch;
+
+ for(i=0; i<length; i++)
+ {
+ ch = zmw_rx_buf_readb(dev, buf, offset+i);
+ if ( ch != str[i] )
+ {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+void zfTxBufferCopy(zdev_t*dev, zbuf_t* dst, zbuf_t* src,
+ u16_t dstOffset, u16_t srcOffset, u16_t length)
+{
+ u16_t i;
+
+ for(i=0; i<length; i++)
+ {
+ zmw_tx_buf_writeb(dev, dst, dstOffset+i,
+ zmw_tx_buf_readb(dev, src, srcOffset+i));
+ }
+}
+
+void zfRxBufferCopy(zdev_t*dev, zbuf_t* dst, zbuf_t* src,
+ u16_t dstOffset, u16_t srcOffset, u16_t length)
+{
+ u16_t i;
+
+ for(i=0; i<length; i++)
+ {
+ zmw_rx_buf_writeb(dev, dst, dstOffset+i,
+ zmw_rx_buf_readb(dev, src, srcOffset+i));
+ }
+}
+
+
+void zfCollectHWTally(zdev_t*dev, u32_t* rsp, u8_t id)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ if (id == 0)
+ {
+ wd->commTally.Hw_UnderrunCnt += (0xFFFF & rsp[1]);
+ wd->commTally.Hw_TotalRxFrm += rsp[2];
+ wd->commTally.Hw_CRC32Cnt += rsp[3];
+ wd->commTally.Hw_CRC16Cnt += rsp[4];
+ #ifdef ZM_ENABLE_NATIVE_WIFI
+ /* These code are here to satisfy Vista DTM */
+ wd->commTally.Hw_DecrypErr_UNI += ((rsp[5]>50) && (rsp[5]<60))?50:rsp[5];
+ #else
+ wd->commTally.Hw_DecrypErr_UNI += rsp[5];
+ #endif
+ wd->commTally.Hw_RxFIFOOverrun += rsp[6];
+ wd->commTally.Hw_DecrypErr_Mul += rsp[7];
+ wd->commTally.Hw_RetryCnt += rsp[8];
+ wd->commTally.Hw_TotalTxFrm += rsp[9];
+ wd->commTally.Hw_RxTimeOut +=rsp[10];
+
+ wd->commTally.Tx_MPDU += rsp[11];
+ wd->commTally.BA_Fail += rsp[12];
+ wd->commTally.Hw_Tx_AMPDU += rsp[13];
+ wd->commTally.Hw_Tx_MPDU += rsp[14];
+ wd->commTally.RateCtrlTxMPDU += rsp[11];
+ wd->commTally.RateCtrlBAFail += rsp[12];
+ }
+ else
+ {
+ wd->commTally.Hw_RxMPDU += rsp[1];
+ wd->commTally.Hw_RxDropMPDU += rsp[2];
+ wd->commTally.Hw_RxDelMPDU += rsp[3];
+
+ wd->commTally.Hw_RxPhyMiscError += rsp[4];
+ wd->commTally.Hw_RxPhyXRError += rsp[5];
+ wd->commTally.Hw_RxPhyOFDMError += rsp[6];
+ wd->commTally.Hw_RxPhyCCKError += rsp[7];
+ wd->commTally.Hw_RxPhyHTError += rsp[8];
+ wd->commTally.Hw_RxPhyTotalCount += rsp[9];
+ }
+
+ zmw_leave_critical_section(dev);
+
+ if (id == 0)
+ {
+ zm_msg1_mm(ZM_LV_1, "rsplen =", rsp[0]);
+ zm_msg1_mm(ZM_LV_1, "Hw_UnderrunCnt = ", (0xFFFF & rsp[1]));
+ zm_msg1_mm(ZM_LV_1, "Hw_TotalRxFrm = ", rsp[2]);
+ zm_msg1_mm(ZM_LV_1, "Hw_CRC32Cnt = ", rsp[3]);
+ zm_msg1_mm(ZM_LV_1, "Hw_CRC16Cnt = ", rsp[4]);
+ zm_msg1_mm(ZM_LV_1, "Hw_DecrypErr_UNI = ", rsp[5]);
+ zm_msg1_mm(ZM_LV_1, "Hw_RxFIFOOverrun = ", rsp[6]);
+ zm_msg1_mm(ZM_LV_1, "Hw_DecrypErr_Mul = ", rsp[7]);
+ zm_msg1_mm(ZM_LV_1, "Hw_RetryCnt = ", rsp[8]);
+ zm_msg1_mm(ZM_LV_1, "Hw_TotalTxFrm = ", rsp[9]);
+ zm_msg1_mm(ZM_LV_1, "Hw_RxTimeOut = ", rsp[10]);
+ zm_msg1_mm(ZM_LV_1, "Tx_MPDU = ", rsp[11]);
+ zm_msg1_mm(ZM_LV_1, "BA_Fail = ", rsp[12]);
+ zm_msg1_mm(ZM_LV_1, "Hw_Tx_AMPDU = ", rsp[13]);
+ zm_msg1_mm(ZM_LV_1, "Hw_Tx_MPDU = ", rsp[14]);
+ }
+ else
+ {
+ zm_msg1_mm(ZM_LV_1, "rsplen = ", rsp[0]);
+ zm_msg1_mm(ZM_LV_1, "Hw_RxMPDU = ", (0xFFFF & rsp[1]));
+ zm_msg1_mm(ZM_LV_1, "Hw_RxDropMPDU = ", rsp[2]);
+ zm_msg1_mm(ZM_LV_1, "Hw_RxDelMPDU = ", rsp[3]);
+ zm_msg1_mm(ZM_LV_1, "Hw_RxPhyMiscError = ", rsp[4]);
+ zm_msg1_mm(ZM_LV_1, "Hw_RxPhyXRError = ", rsp[5]);
+ zm_msg1_mm(ZM_LV_1, "Hw_RxPhyOFDMError = ", rsp[6]);
+ zm_msg1_mm(ZM_LV_1, "Hw_RxPhyCCKError = ", rsp[7]);
+ zm_msg1_mm(ZM_LV_1, "Hw_RxPhyHTError = ", rsp[8]);
+ zm_msg1_mm(ZM_LV_1, "Hw_RxPhyTotalCount = ", rsp[9]);
+ }
+
+}
+
+/* Timer related functions */
+void zfTimerInit(zdev_t* dev)
+{
+ u8_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ zm_debug_msg0("");
+
+ wd->timerList.freeCount = ZM_MAX_TIMER_COUNT;
+ wd->timerList.head = &(wd->timerList.list[0]);
+ wd->timerList.tail = &(wd->timerList.list[ZM_MAX_TIMER_COUNT-1]);
+ wd->timerList.head->pre = NULL;
+ wd->timerList.head->next = &(wd->timerList.list[1]);
+ wd->timerList.tail->pre = &(wd->timerList.list[ZM_MAX_TIMER_COUNT-2]);
+ wd->timerList.tail->next = NULL;
+
+ for( i=1; i<(ZM_MAX_TIMER_COUNT-1); i++ )
+ {
+ wd->timerList.list[i].pre = &(wd->timerList.list[i-1]);
+ wd->timerList.list[i].next = &(wd->timerList.list[i+1]);
+ }
+
+ wd->bTimerReady = TRUE;
+}
+
+
+u16_t zfTimerSchedule(zdev_t* dev, u16_t event, u32_t tick)
+{
+ struct zsTimerEntry *pFreeEntry;
+ struct zsTimerEntry *pEntry;
+ u8_t i, count;
+
+ zmw_get_wlan_dev(dev);
+
+ if ( wd->timerList.freeCount == 0 )
+ {
+ zm_debug_msg0("no more timer");
+ return 1;
+ }
+
+ //zm_debug_msg2("event = ", event);
+ //zm_debug_msg1("target tick = ", wd->tick + tick);
+
+ count = ZM_MAX_TIMER_COUNT - wd->timerList.freeCount;
+
+ if ( count == 0 )
+ {
+ wd->timerList.freeCount--;
+ wd->timerList.head->event = event;
+ wd->timerList.head->timer = wd->tick + tick;
+ //zm_debug_msg1("free timer count = ", wd->timerList.freeCount);
+
+ return 0;
+ }
+
+ pFreeEntry = wd->timerList.tail;
+ pFreeEntry->timer = wd->tick + tick;
+ pFreeEntry->event = event;
+ wd->timerList.tail = pFreeEntry->pre;
+ pEntry = wd->timerList.head;
+
+ for( i=0; i<count; i++ )
+ {
+ // prevent from the case of tick overflow
+ if ( ( pEntry->timer > pFreeEntry->timer )&&
+ ((pEntry->timer - pFreeEntry->timer) < 1000000000) )
+ {
+ if ( i != 0 )
+ {
+ pFreeEntry->pre = pEntry->pre;
+ pFreeEntry->pre->next = pFreeEntry;
+ }
+ else
+ {
+ pFreeEntry->pre = NULL;
+ }
+
+ pEntry->pre = pFreeEntry;
+ pFreeEntry->next = pEntry;
+ break;
+ }
+
+ pEntry = pEntry->next;
+ }
+
+ if ( i == 0 )
+ {
+ wd->timerList.head = pFreeEntry;
+ }
+
+ if ( i == count )
+ {
+ pFreeEntry->pre = pEntry->pre;
+ pFreeEntry->pre->next = pFreeEntry;
+ pEntry->pre = pFreeEntry;
+ pFreeEntry->next = pEntry;
+ }
+
+ wd->timerList.freeCount--;
+ //zm_debug_msg1("free timer count = ", wd->timerList.freeCount);
+
+ return 0;
+}
+
+u16_t zfTimerCancel(zdev_t* dev, u16_t event)
+{
+ struct zsTimerEntry *pEntry;
+ u8_t i, count;
+
+ zmw_get_wlan_dev(dev);
+
+ //zm_debug_msg2("event = ", event);
+ //zm_debug_msg1("free timer count(b) = ", wd->timerList.freeCount);
+
+ pEntry = wd->timerList.head;
+ count = ZM_MAX_TIMER_COUNT - wd->timerList.freeCount;
+
+ for( i=0; i<count; i++ )
+ {
+ if ( pEntry->event == event )
+ {
+ if ( pEntry == wd->timerList.head )
+ { /* remove head entry */
+ wd->timerList.head = pEntry->next;
+ wd->timerList.tail->next = pEntry;
+ pEntry->pre = wd->timerList.tail;
+ wd->timerList.tail = pEntry;
+ pEntry = wd->timerList.head;
+ }
+ else
+ { /* remove non-head entry */
+ pEntry->pre->next = pEntry->next;
+ pEntry->next->pre = pEntry->pre;
+ wd->timerList.tail->next = pEntry;
+ pEntry->pre = wd->timerList.tail;
+ wd->timerList.tail = pEntry;
+ pEntry = pEntry->next;
+ }
+
+ wd->timerList.freeCount++;
+ }
+ else
+ {
+ pEntry = pEntry->next;
+ }
+ }
+
+ //zm_debug_msg1("free timer count(a) = ", wd->timerList.freeCount);
+
+ return 0;
+}
+
+void zfTimerClear(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->timerList.freeCount = ZM_MAX_TIMER_COUNT;
+}
+
+u16_t zfTimerCheckAndHandle(zdev_t* dev)
+{
+ struct zsTimerEntry *pEntry;
+ struct zsTimerEntry *pTheLastEntry = NULL;
+ u16_t event[ZM_MAX_TIMER_COUNT];
+ u8_t i, j=0, count;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ if ( !wd->bTimerReady )
+ {
+ return 0;
+ }
+
+ zmw_enter_critical_section(dev);
+
+ pEntry = wd->timerList.head;
+ count = ZM_MAX_TIMER_COUNT - wd->timerList.freeCount;
+
+ for( i=0; i<count; i++ )
+ {
+ // prevent from the case of tick overflow
+ if ( ( pEntry->timer > wd->tick )&&
+ ((pEntry->timer - wd->tick) < 1000000000) )
+ {
+ break;
+ }
+
+ event[j++] = pEntry->event;
+ pTheLastEntry = pEntry;
+ pEntry = pEntry->next;
+ }
+
+ if ( j > 0 )
+ {
+ wd->timerList.tail->next = wd->timerList.head;
+ wd->timerList.head->pre = wd->timerList.tail;
+ wd->timerList.head = pEntry;
+ wd->timerList.tail = pTheLastEntry;
+ wd->timerList.freeCount += j;
+ //zm_debug_msg1("free timer count = ", wd->timerList.freeCount);
+ }
+
+ zmw_leave_critical_section(dev);
+
+ zfProcessEvent(dev, event, j);
+
+ return 0;
+}
+
+u32_t zfCoreSetKey(zdev_t* dev, u8_t user, u8_t keyId, u8_t type,
+ u16_t* mac, u32_t* key)
+{
+ u32_t ret;
+
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ wd->sta.flagKeyChanging++;
+ zm_debug_msg1(" zfCoreSetKey++++ ", wd->sta.flagKeyChanging);
+ zmw_leave_critical_section(dev);
+
+ ret = zfHpSetKey(dev, user, keyId, type, mac, key);
+ return ret;
+}
+
+void zfCoreSetKeyComplete(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+#if 0
+ wd->sta.flagKeyChanging = 0;
+#else
+ if(wd->sta.flagKeyChanging)
+ {
+ zmw_enter_critical_section(dev);
+ wd->sta.flagKeyChanging--;
+ zmw_leave_critical_section(dev);
+ }
+#endif
+ zm_debug_msg1(" zfCoreSetKeyComplete--- ", wd->sta.flagKeyChanging);
+
+ zfPushVtxq(dev);
+}
+
+void zfCoreHalInitComplete(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ wd->halState = ZM_HAL_STATE_RUNNING;
+ zmw_leave_critical_section(dev);
+
+ zfPushVtxq(dev);
+}
+
+void zfCoreMacAddressNotify(zdev_t* dev, u8_t* addr)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->macAddr[0] = addr[0] | ((u16_t)addr[1]<<8);
+ wd->macAddr[1] = addr[2] | ((u16_t)addr[3]<<8);
+ wd->macAddr[2] = addr[4] | ((u16_t)addr[5]<<8);
+
+
+ //zfHpSetMacAddress(dev, wd->macAddr, 0);
+ if (wd->zfcbMacAddressNotify != NULL)
+ {
+ wd->zfcbMacAddressNotify(dev, addr);
+ }
+}
+
+void zfCoreSetIsoName(zdev_t* dev, u8_t* isoName)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->ws.countryIsoName[0] = isoName[0];
+ wd->ws.countryIsoName[1] = isoName[1];
+ wd->ws.countryIsoName[2] = '\0';
+ }
+
+
+extern void zfScanMgrScanEventStart(zdev_t* dev);
+extern u8_t zfScanMgrScanEventTimeout(zdev_t* dev);
+extern void zfScanMgrScanEventRetry(zdev_t* dev);
+
+void zfProcessEvent(zdev_t* dev, u16_t* eventArray, u8_t eventCount)
+{
+ u8_t i, j, bypass = FALSE;
+ u16_t eventBypass[32];
+ u8_t eventBypassCount = 0;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zfZeroMemory((u8_t*) eventBypass, 64);
+
+ for( i=0; i<eventCount; i++ )
+ {
+ for( j=0; j<eventBypassCount; j++ )
+ {
+ if ( eventBypass[j] == eventArray[i] )
+ {
+ bypass = TRUE;
+ break;
+ }
+ }
+
+ if ( bypass )
+ {
+ continue;
+ }
+
+ switch( eventArray[i] )
+ {
+ case ZM_EVENT_SCAN:
+ {
+ zfScanMgrScanEventStart(dev);
+ eventBypass[eventBypassCount++] = ZM_EVENT_IN_SCAN;
+ eventBypass[eventBypassCount++] = ZM_EVENT_TIMEOUT_SCAN;
+ }
+ break;
+
+ case ZM_EVENT_TIMEOUT_SCAN:
+ {
+ u8_t res;
+
+ res = zfScanMgrScanEventTimeout(dev);
+ if ( res == 0 )
+ {
+ eventBypass[eventBypassCount++] = ZM_EVENT_TIMEOUT_SCAN;
+ }
+ else if ( res == 1 )
+ {
+ eventBypass[eventBypassCount++] = ZM_EVENT_IN_SCAN;
+ }
+ }
+ break;
+
+ case ZM_EVENT_IBSS_MONITOR:
+ {
+ zfStaIbssMonitoring(dev, 0);
+ }
+ break;
+
+ case ZM_EVENT_IN_SCAN:
+ {
+ zfScanMgrScanEventRetry(dev);
+ }
+ break;
+
+ case ZM_EVENT_CM_TIMER:
+ {
+ zm_msg0_mm(ZM_LV_0, "ZM_EVENT_CM_TIMER");
+
+ wd->sta.cmMicFailureCount = 0;
+ }
+ break;
+
+ case ZM_EVENT_CM_DISCONNECT:
+ {
+ zm_msg0_mm(ZM_LV_0, "ZM_EVENT_CM_DISCONNECT");
+
+ zfChangeAdapterState(dev, ZM_STA_STATE_DISCONNECT);
+
+ zmw_enter_critical_section(dev);
+ //zfTimerSchedule(dev, ZM_EVENT_CM_BLOCK_TIMER,
+ // ZM_TICK_CM_BLOCK_TIMEOUT);
+
+ /* Timer Resolution on WinXP is 15/16 ms */
+ /* Decrease Time offset for <XP> Counter Measure */
+ zfTimerSchedule(dev, ZM_EVENT_CM_BLOCK_TIMER,
+ ZM_TICK_CM_BLOCK_TIMEOUT - ZM_TICK_CM_BLOCK_TIMEOUT_OFFSET);
+
+ zmw_leave_critical_section(dev);
+ wd->sta.cmMicFailureCount = 0;
+ //zfiWlanDisable(dev);
+ zfHpResetKeyCache(dev);
+ if (wd->zfcbConnectNotify != NULL)
+ {
+ wd->zfcbConnectNotify(dev, ZM_STATUS_MEDIA_DISCONNECT_MIC_FAIL,
+ wd->sta.bssid);
+ }
+ }
+ break;
+
+ case ZM_EVENT_CM_BLOCK_TIMER:
+ {
+ zm_msg0_mm(ZM_LV_0, "ZM_EVENT_CM_BLOCK_TIMER");
+
+ //zmw_enter_critical_section(dev);
+ wd->sta.cmDisallowSsidLength = 0;
+ if ( wd->sta.bAutoReconnect )
+ {
+ zm_msg0_mm(ZM_LV_0, "ZM_EVENT_CM_BLOCK_TIMER:bAutoReconnect!=0");
+ zfScanMgrScanStop(dev, ZM_SCAN_MGR_SCAN_INTERNAL);
+ zfScanMgrScanStart(dev, ZM_SCAN_MGR_SCAN_INTERNAL);
+ }
+ //zmw_leave_critical_section(dev);
+ }
+ break;
+
+ case ZM_EVENT_TIMEOUT_ADDBA:
+ {
+ if (!wd->addbaComplete && (wd->addbaCount < 5))
+ {
+ zfAggSendAddbaRequest(dev, wd->sta.bssid, 0, 0);
+ wd->addbaCount++;
+ zfTimerSchedule(dev, ZM_EVENT_TIMEOUT_ADDBA, 100);
+ }
+ else
+ {
+ zfTimerCancel(dev, ZM_EVENT_TIMEOUT_ADDBA);
+ }
+ }
+ break;
+
+ #ifdef ZM_ENABLE_PERFORMANCE_EVALUATION
+ case ZM_EVENT_TIMEOUT_PERFORMANCE:
+ {
+ zfiPerformanceRefresh(dev);
+ }
+ break;
+ #endif
+ case ZM_EVENT_SKIP_COUNTERMEASURE:
+ //enable the Countermeasure
+ {
+ zm_debug_msg0("Countermeasure : Enable MIC Check ");
+ wd->TKIP_Group_KeyChanging = 0x0;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+void zfBssInfoCreate(zdev_t* dev)
+{
+ u8_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ wd->sta.bssList.bssCount = 0;
+ wd->sta.bssList.head = NULL;
+ wd->sta.bssList.tail = NULL;
+ wd->sta.bssInfoArrayHead = 0;
+ wd->sta.bssInfoArrayTail = 0;
+ wd->sta.bssInfoFreeCount = ZM_MAX_BSS;
+
+ for( i=0; i< ZM_MAX_BSS; i++ )
+ {
+ //wd->sta.bssInfoArray[i] = &(wd->sta.bssInfoPool[i]);
+ wd->sta.bssInfoArray[i] = zfwMemAllocate(dev, sizeof(struct zsBssInfo));
+
+ }
+
+ zmw_leave_critical_section(dev);
+}
+
+void zfBssInfoDestroy(zdev_t* dev)
+{
+ u8_t i;
+ zmw_get_wlan_dev(dev);
+
+ zfBssInfoRefresh(dev, 1);
+
+ for( i=0; i< ZM_MAX_BSS; i++ )
+ {
+ if (wd->sta.bssInfoArray[i] != NULL)
+ {
+ zfwMemFree(dev, wd->sta.bssInfoArray[i], sizeof(struct zsBssInfo));
+ }
+ else
+ {
+ zm_assert(0);
+ }
+ }
+ return;
+}
+
+struct zsBssInfo* zfBssInfoAllocate(zdev_t* dev)
+{
+ struct zsBssInfo* pBssInfo;
+
+ zmw_get_wlan_dev(dev);
+
+ if (wd->sta.bssInfoFreeCount == 0)
+ return NULL;
+
+ pBssInfo = wd->sta.bssInfoArray[wd->sta.bssInfoArrayHead];
+ wd->sta.bssInfoArray[wd->sta.bssInfoArrayHead] = NULL;
+ wd->sta.bssInfoArrayHead = (wd->sta.bssInfoArrayHead + 1) & (ZM_MAX_BSS - 1);
+ wd->sta.bssInfoFreeCount--;
+
+ zfZeroMemory((u8_t*)pBssInfo, sizeof(struct zsBssInfo));
+
+ return pBssInfo;
+}
+
+void zfBssInfoFree(zdev_t* dev, struct zsBssInfo* pBssInfo)
+{
+ zmw_get_wlan_dev(dev);
+
+ zm_assert(wd->sta.bssInfoArray[wd->sta.bssInfoArrayTail] == NULL);
+
+ pBssInfo->signalStrength = pBssInfo->signalQuality = 0;
+ pBssInfo->sortValue = 0;
+
+ wd->sta.bssInfoArray[wd->sta.bssInfoArrayTail] = pBssInfo;
+ wd->sta.bssInfoArrayTail = (wd->sta.bssInfoArrayTail + 1) & (ZM_MAX_BSS - 1);
+ wd->sta.bssInfoFreeCount++;
+}
+
+void zfBssInfoReorderList(zdev_t* dev)
+{
+ struct zsBssInfo* pBssInfo = NULL;
+ struct zsBssInfo* pInsBssInfo = NULL;
+ struct zsBssInfo* pNextBssInfo = NULL;
+ struct zsBssInfo* pPreBssInfo = NULL;
+ u8_t i = 0;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ if (wd->sta.bssList.bssCount > 1)
+ {
+ pInsBssInfo = wd->sta.bssList.head;
+ wd->sta.bssList.tail = pInsBssInfo;
+ pBssInfo = pInsBssInfo->next;
+ pInsBssInfo->next = NULL;
+ while (pBssInfo != NULL)
+ {
+ i = 0;
+ while (1)
+ {
+// if (pBssInfo->signalStrength >= pInsBssInfo->signalStrength)
+ if( pBssInfo->sortValue >= pInsBssInfo->sortValue)
+ {
+ if (i==0)
+ {
+ //Insert BssInfo to head
+ wd->sta.bssList.head = pBssInfo;
+ pNextBssInfo = pBssInfo->next;
+ pBssInfo->next = pInsBssInfo;
+ break;
+ }
+ else
+ {
+ //Insert BssInfo to neither head nor tail
+ pPreBssInfo->next = pBssInfo;
+ pNextBssInfo = pBssInfo->next;
+ pBssInfo->next = pInsBssInfo;
+ break;
+ }
+ }
+ else
+ {
+ if (pInsBssInfo->next != NULL)
+ {
+ //Signal strength smaller than current BssInfo, check next
+ pPreBssInfo = pInsBssInfo;
+ pInsBssInfo = pInsBssInfo->next;
+ }
+ else
+ {
+ //Insert BssInfo to tail
+ pInsBssInfo->next = pBssInfo;
+ pNextBssInfo = pBssInfo->next;
+ wd->sta.bssList.tail = pBssInfo;
+ pBssInfo->next = NULL;
+ break;
+ }
+ }
+ i++;
+ }
+ pBssInfo = pNextBssInfo;
+ pInsBssInfo = wd->sta.bssList.head;
+ }
+ } //if (wd->sta.bssList.bssCount > 1)
+
+ zmw_leave_critical_section(dev);
+}
+
+void zfBssInfoInsertToList(zdev_t* dev, struct zsBssInfo* pBssInfo)
+{
+ zmw_get_wlan_dev(dev);
+
+ zm_assert(pBssInfo);
+
+ //zm_debug_msg2("pBssInfo = ", pBssInfo);
+
+ if ( wd->sta.bssList.bssCount == 0 )
+ {
+ wd->sta.bssList.head = pBssInfo;
+ wd->sta.bssList.tail = pBssInfo;
+ }
+ else
+ {
+ wd->sta.bssList.tail->next = pBssInfo;
+ wd->sta.bssList.tail = pBssInfo;
+ }
+
+ pBssInfo->next = NULL;
+ wd->sta.bssList.bssCount++;
+
+ //zm_debug_msg2("bss count = ", wd->sta.bssList.bssCount);
+}
+
+void zfBssInfoRemoveFromList(zdev_t* dev, struct zsBssInfo* pBssInfo)
+{
+ struct zsBssInfo* pNowBssInfo;
+ struct zsBssInfo* pPreBssInfo = NULL;
+ u8_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ zm_assert(pBssInfo);
+ zm_assert(wd->sta.bssList.bssCount);
+
+ //zm_debug_msg2("pBssInfo = ", pBssInfo);
+
+ pNowBssInfo = wd->sta.bssList.head;
+
+ for( i=0; i<wd->sta.bssList.bssCount; i++ )
+ {
+ if ( pNowBssInfo == pBssInfo )
+ {
+ if ( i == 0 )
+ { /* remove head */
+ wd->sta.bssList.head = pBssInfo->next;
+ }
+ else
+ {
+ pPreBssInfo->next = pBssInfo->next;
+ }
+
+ if ( i == (wd->sta.bssList.bssCount - 1) )
+ { /* remove tail */
+ wd->sta.bssList.tail = pPreBssInfo;
+ }
+
+ break;
+ }
+
+ pPreBssInfo = pNowBssInfo;
+ pNowBssInfo = pNowBssInfo->next;
+ }
+
+ zm_assert(i != wd->sta.bssList.bssCount);
+ wd->sta.bssList.bssCount--;
+
+ //zm_debug_msg2("bss count = ", wd->sta.bssList.bssCount);
+}
+
+void zfBssInfoRefresh(zdev_t* dev, u16_t mode)
+{
+ struct zsBssInfo* pBssInfo;
+ struct zsBssInfo* pNextBssInfo;
+ u8_t i, bssCount;
+
+ zmw_get_wlan_dev(dev);
+
+ pBssInfo = wd->sta.bssList.head;
+ bssCount = wd->sta.bssList.bssCount;
+
+ for( i=0; i<bssCount; i++ )
+ {
+ if (mode == 1)
+ {
+ pNextBssInfo = pBssInfo->next;
+ zfBssInfoRemoveFromList(dev, pBssInfo);
+ zfBssInfoFree(dev, pBssInfo);
+ pBssInfo = pNextBssInfo;
+ }
+ else
+ {
+ if ( pBssInfo->flag & ZM_BSS_INFO_VALID_BIT )
+ { /* this one must be kept */
+ pBssInfo->flag &= ~ZM_BSS_INFO_VALID_BIT;
+ pBssInfo = pBssInfo->next;
+ }
+ else
+ {
+ #define ZM_BSS_CACHE_TIME_IN_MS 20000
+ if ((wd->tick - pBssInfo->tick) > (ZM_BSS_CACHE_TIME_IN_MS/ZM_MS_PER_TICK))
+ {
+ pNextBssInfo = pBssInfo->next;
+ zfBssInfoRemoveFromList(dev, pBssInfo);
+ zfBssInfoFree(dev, pBssInfo);
+ pBssInfo = pNextBssInfo;
+ }
+ else
+ {
+ pBssInfo = pBssInfo->next;
+ }
+ }
+ }
+ } //for( i=0; i<bssCount; i++ )
+ return;
+}
+
+void zfDumpSSID(u8_t length, u8_t *value)
+{
+ u8_t buf[50];
+ u8_t tmpLength = length;
+
+ if ( tmpLength > 49 )
+ {
+ tmpLength = 49;
+ }
+
+ zfMemoryCopy(buf, value, tmpLength);
+ buf[tmpLength] = '\0';
+ //printk("SSID: %s\n", buf);
+ //zm_debug_msg_s("ssid = ", value);
+}
+
+void zfCoreReinit(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->sta.flagKeyChanging = 0;
+ wd->sta.flagFreqChanging = 0;
+}
+
+void zfGenerateRandomBSSID(zdev_t* dev, u8_t *MACAddr, u8_t *BSSID)
+{
+ //ULONGLONG time;
+ u32_t time;
+
+ zmw_get_wlan_dev(dev);
+
+ time = wd->tick;
+
+ //
+ // Initialize the random BSSID to be the same as MAC address.
+ //
+
+ // RtlCopyMemory(BSSID, MACAddr, sizeof(DOT11_MAC_ADDRESS));
+ zfMemoryCopy(BSSID, MACAddr, 6);
+
+ //
+ // Get the system time in 10 millisecond.
+ //
+
+ // NdisGetCurrentSystemTime((PLARGE_INTEGER)&time);
+ // time /= 100000;
+
+ //
+ // Randomize the first 4 bytes of BSSID.
+ //
+
+ BSSID[0] ^= (u8_t)(time & 0xff);
+ BSSID[0] &= ~0x01; // Turn off multicast bit
+ BSSID[0] |= 0x02; // Turn on local bit
+
+ time >>= 8;
+ BSSID[1] ^= (u8_t)(time & 0xff);
+
+ time >>= 8;
+ BSSID[2] ^= (u8_t)(time & 0xff);
+
+ time >>= 8;
+ BSSID[3] ^= (u8_t)(time & 0xff);
+}
+
+u8_t zfiWlanGetDestAddrFromBuf(zdev_t *dev, zbuf_t *buf, u16_t *macAddr)
+{
+#ifdef ZM_ENABLE_NATIVE_WIFI
+ zmw_get_wlan_dev(dev);
+
+ if ( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ {
+ /* DA */
+ macAddr[0] = zmw_tx_buf_readh(dev, buf, 16);
+ macAddr[1] = zmw_tx_buf_readh(dev, buf, 18);
+ macAddr[2] = zmw_tx_buf_readh(dev, buf, 20);
+ }
+ else if ( wd->wlanMode == ZM_MODE_IBSS )
+ {
+ /* DA */
+ macAddr[0] = zmw_tx_buf_readh(dev, buf, 4);
+ macAddr[1] = zmw_tx_buf_readh(dev, buf, 6);
+ macAddr[2] = zmw_tx_buf_readh(dev, buf, 8);
+ }
+ else if ( wd->wlanMode == ZM_MODE_AP )
+ {
+ /* DA */
+ macAddr[0] = zmw_tx_buf_readh(dev, buf, 4);
+ macAddr[1] = zmw_tx_buf_readh(dev, buf, 6);
+ macAddr[2] = zmw_tx_buf_readh(dev, buf, 8);
+ }
+ else
+ {
+ return 1;
+ }
+#else
+ /* DA */
+ macAddr[0] = zmw_tx_buf_readh(dev, buf, 0);
+ macAddr[1] = zmw_tx_buf_readh(dev, buf, 2);
+ macAddr[2] = zmw_tx_buf_readh(dev, buf, 4);
+#endif
+
+ return 0;
+}
+
+/* Leave an empty line below to remove warning message on some compiler */
+
+u16_t zfFindCleanFrequency(zdev_t* dev, u32_t adhocMode)
+{
+ u8_t i, j;
+ u16_t returnChannel;
+ u16_t count_24G = 0, min24GIndex = 0;
+ u16_t count_5G = 0, min5GIndex = 0;
+ u16_t CombinationBssNumberIn24G[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+ u16_t BssNumberIn24G[17] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+ u16_t Array_24G[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+ u16_t BssNumberIn5G[31] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+ u16_t Array_5G[31] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+ struct zsBssInfo* pBssInfo;
+
+ zmw_get_wlan_dev(dev);
+
+ if ((pBssInfo = wd->sta.bssList.head) == NULL)
+ {
+ if( adhocMode == ZM_ADHOCBAND_B || adhocMode == ZM_ADHOCBAND_G ||
+ adhocMode == ZM_ADHOCBAND_BG || adhocMode == ZM_ADHOCBAND_ABG )
+ {
+ returnChannel = zfChGetFirst2GhzChannel(dev);
+ }
+ else
+ {
+ returnChannel = zfChGetFirst5GhzChannel(dev);
+ }
+
+ return returnChannel;
+ }
+
+ /* #1 Get Allowed Channel following Country Code ! */
+ zmw_declare_for_critical_section();
+ zmw_enter_critical_section(dev);
+ for (i = 0; i < wd->regulationTable.allowChannelCnt; i++)
+ {
+ if (wd->regulationTable.allowChannel[i].channel < 3000)
+ { // 2.4GHz
+ Array_24G[count_24G] = wd->regulationTable.allowChannel[i].channel;
+ count_24G++;
+ }
+ else
+ { // 5GHz
+ count_5G++;
+ Array_5G[i] = wd->regulationTable.allowChannel[i].channel;
+ }
+ }
+ zmw_leave_critical_section(dev);
+
+ while( pBssInfo != NULL )
+ {
+ /* #2_1 Count BSS number in some specificed frequency in 2.4GHz band ! */
+ if( adhocMode == ZM_ADHOCBAND_B || adhocMode == ZM_ADHOCBAND_G ||
+ adhocMode == ZM_ADHOCBAND_BG || adhocMode == ZM_ADHOCBAND_ABG )
+ {
+ for( i=0; i<=(count_24G+3); i++ )
+ {
+ if( pBssInfo->frequency == Array_24G[i] )
+ { // Array_24G[0] correspond to BssNumberIn24G[2]
+ BssNumberIn24G[pBssInfo->channel+1]++;
+ }
+ }
+ }
+
+ /* #2_2 Count BSS number in some specificed frequency in 5GHz band ! */
+ if( adhocMode == ZM_ADHOCBAND_A || adhocMode == ZM_ADHOCBAND_ABG )
+ {
+ for( i=0; i<count_5G; i++ )
+ { // 5GHz channel is not equal to array index
+ if( pBssInfo->frequency == Array_5G[i] )
+ { // Array_5G[0] correspond to BssNumberIn5G[0]
+ BssNumberIn5G[i]++;
+ }
+ }
+ }
+
+ pBssInfo = pBssInfo->next;
+ }
+
+#if 0
+ for(i=0; i<=(count_24G+3); i++)
+ {
+ printk("2.4GHz Before combin, %d BSS network : %d", i, BssNumberIn24G[i]);
+ }
+
+ for(i=0; i<count_5G; i++)
+ {
+ printk("5GHz Before combin, %d BSS network : %d", i, BssNumberIn5G[i]);
+ }
+#endif
+
+ if( adhocMode == ZM_ADHOCBAND_B || adhocMode == ZM_ADHOCBAND_G ||
+ adhocMode == ZM_ADHOCBAND_BG || adhocMode == ZM_ADHOCBAND_ABG )
+ {
+ /* #3_1 Count BSS number that influence the specificed frequency in 2.4GHz ! */
+ for( j=0; j<count_24G; j++ )
+ {
+ CombinationBssNumberIn24G[j] = BssNumberIn24G[j] + BssNumberIn24G[j+1] +
+ BssNumberIn24G[j+2] + BssNumberIn24G[j+3] +
+ BssNumberIn24G[j+4];
+ //printk("After combine, the number of BSS network channel %d is %d",
+ // j , CombinationBssNumberIn24G[j]);
+ }
+
+ /* #4_1 Find the less utilized frequency in 2.4GHz band ! */
+ min24GIndex = zfFindMinimumUtilizationChannelIndex(dev, CombinationBssNumberIn24G, count_24G);
+ }
+
+ /* #4_2 Find the less utilized frequency in 5GHz band ! */
+ if( adhocMode == ZM_ADHOCBAND_A || adhocMode == ZM_ADHOCBAND_ABG )
+ {
+ min5GIndex = zfFindMinimumUtilizationChannelIndex(dev, BssNumberIn5G, count_5G);
+ }
+
+ if( adhocMode == ZM_ADHOCBAND_B || adhocMode == ZM_ADHOCBAND_G || adhocMode == ZM_ADHOCBAND_BG )
+ {
+ return Array_24G[min24GIndex];
+ }
+ else if( adhocMode == ZM_ADHOCBAND_A )
+ {
+ return Array_5G[min5GIndex];
+ }
+ else if( adhocMode == ZM_ADHOCBAND_ABG )
+ {
+ if ( CombinationBssNumberIn24G[min24GIndex] <= BssNumberIn5G[min5GIndex] )
+ return Array_24G[min24GIndex];
+ else
+ return Array_5G[min5GIndex];
+ }
+ else
+ return 2412;
+}
+
+u16_t zfFindMinimumUtilizationChannelIndex(zdev_t* dev, u16_t* array, u16_t count)
+{
+ u8_t i;
+ u16_t tempMinIndex, tempMinValue;
+
+ zmw_get_wlan_dev(dev);
+
+ i = 1;
+ tempMinIndex = 0;
+ tempMinValue = array[tempMinIndex];
+ while( i< count )
+ {
+ if( array[i] < tempMinValue )
+ {
+ tempMinValue = array[i];
+ tempMinIndex = i;
+ }
+ i++;
+ }
+
+ return tempMinIndex;
+}
+
+u8_t zfCompareWithBssid(zdev_t* dev, u16_t* bssid)
+{
+ zmw_get_wlan_dev(dev);
+
+ if ( zfMemoryIsEqual((u8_t*)bssid, (u8_t*)wd->sta.bssid, 6) )
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+}
diff --git a/drivers/staging/otus/80211core/cfunc.h b/drivers/staging/otus/80211core/cfunc.h
new file mode 100644
index 00000000000..fc7548c39d1
--- /dev/null
+++ b/drivers/staging/otus/80211core/cfunc.h
@@ -0,0 +1,449 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : func_extr.c */
+/* */
+/* Abstract */
+/* This module contains function prototype. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/************************************************************************/
+
+#ifndef _CFUNC_H
+#define _CFUNC_H
+
+#include "queue.h"
+
+/* amsdu.c */
+void zfDeAmsdu(zdev_t* dev, zbuf_t* buf, u16_t vap, u8_t encryMode);
+
+/* cscanmgr.c */
+void zfScanMgrInit(zdev_t* dev);
+u8_t zfScanMgrScanStart(zdev_t* dev, u8_t scanType);
+void zfScanMgrScanStop(zdev_t* dev, u8_t scanType);
+void zfScanMgrScanAck(zdev_t* dev);
+
+/* cpsmgr.c */
+void zfPowerSavingMgrInit(zdev_t* dev);
+void zfPowerSavingMgrSetMode(zdev_t* dev, u8_t mode);
+void zfPowerSavingMgrMain(zdev_t* dev);
+void zfPowerSavingMgrWakeup(zdev_t* dev);
+u8_t zfPowerSavingMgrIsSleeping(zdev_t *dev);
+void zfPowerSavingMgrProcessBeacon(zdev_t* dev, zbuf_t* buf);
+void zfPowerSavingMgrAtimWinExpired(zdev_t* dev);
+void zfPowerSavingMgrConnectNotify(zdev_t *dev);
+void zfPowerSavingMgrPreTBTTInterrupt(zdev_t *dev);
+
+/* ccmd.c */
+u16_t zfWlanEnable(zdev_t* dev);
+
+/* cfunc.c */
+u8_t zfQueryOppositeRate(zdev_t* dev, u8_t dst_mac[6], u8_t frameType);
+void zfCopyToIntTxBuffer(zdev_t* dev, zbuf_t* buf, u8_t* src,
+ u16_t offset, u16_t length);
+void zfCopyToRxBuffer(zdev_t* dev, zbuf_t* buf, u8_t* src,
+ u16_t offset, u16_t length);
+void zfCopyFromIntTxBuffer(zdev_t* dev, zbuf_t* buf, u8_t* dst,
+ u16_t offset, u16_t length);
+void zfCopyFromRxBuffer(zdev_t* dev, zbuf_t* buf, u8_t* dst,
+ u16_t offset, u16_t length);
+void zfMemoryCopy(u8_t* dst, u8_t* src, u16_t length);
+void zfMemoryMove(u8_t* dst, u8_t* src, u16_t length);
+void zfZeroMemory(u8_t* va, u16_t length);
+u8_t zfMemoryIsEqual(u8_t* m1, u8_t* m2, u16_t length);
+u8_t zfRxBufferEqualToStr(zdev_t* dev, zbuf_t* buf, const u8_t* str,
+ u16_t offset, u16_t length);
+void zfTxBufferCopy(zdev_t*dev, zbuf_t* dst, zbuf_t* src,
+ u16_t dstOffset, u16_t srcOffset, u16_t length);
+void zfRxBufferCopy(zdev_t*dev, zbuf_t* dst, zbuf_t* src,
+ u16_t dstOffset, u16_t srcOffset, u16_t length);
+
+void zfCollectHWTally(zdev_t*dev, u32_t* rsp, u8_t id);
+void zfTimerInit(zdev_t* dev);
+u16_t zfTimerSchedule(zdev_t* dev, u16_t event, u32_t tick);
+u16_t zfTimerCancel(zdev_t* dev, u16_t event);
+void zfTimerClear(zdev_t* dev);
+u16_t zfTimerCheckAndHandle(zdev_t* dev);
+void zfProcessEvent(zdev_t* dev, u16_t* eventArray, u8_t eventCount);
+
+void zfBssInfoCreate(zdev_t* dev);
+void zfBssInfoDestroy(zdev_t* dev);
+
+struct zsBssInfo* zfBssInfoAllocate(zdev_t* dev);
+void zfBssInfoFree(zdev_t* dev, struct zsBssInfo* pBssInfo);
+void zfBssInfoReorderList(zdev_t* dev);
+void zfBssInfoInsertToList(zdev_t* dev, struct zsBssInfo* pBssInfo);
+void zfBssInfoRemoveFromList(zdev_t* dev, struct zsBssInfo* pBssInfo);
+void zfBssInfoRefresh(zdev_t* dev, u16_t mode);
+void zfCoreSetFrequencyComplete(zdev_t* dev);
+void zfCoreSetFrequency(zdev_t* dev, u16_t frequency);
+void zfCoreSetFrequencyV2(zdev_t* dev, u16_t frequency,
+ zfpFreqChangeCompleteCb cb);
+void zfCoreSetFrequencyEx(zdev_t* dev, u16_t frequency, u8_t bw40,
+ u8_t extOffset, zfpFreqChangeCompleteCb cb);
+void zfCoreSetFrequencyExV2(zdev_t* dev, u16_t frequency, u8_t bw40,
+ u8_t extOffset, zfpFreqChangeCompleteCb cb, u8_t forceSetFreq);
+void zfReSetCurrentFrequency(zdev_t* dev);
+u32_t zfCoreSetKey(zdev_t* dev, u8_t user, u8_t keyId, u8_t type,
+ u16_t* mac, u32_t* key);
+void zfCoreSetKeyComplete(zdev_t* dev);
+void zfCoreReinit(zdev_t* dev);
+void zfCoreMacAddressNotify(zdev_t* dev, u8_t *addr);
+void zfCoreSetIsoName(zdev_t* dev, u8_t* isoName);
+void zfGenerateRandomBSSID(zdev_t* dev, u8_t *MACAddr, u8_t *BSSID);
+void zfCoreHalInitComplete(zdev_t* dev);
+
+u16_t zfFindCleanFrequency(zdev_t* dev, u32_t adhocMode);
+u16_t zfFindMinimumUtilizationChannelIndex(zdev_t* dev, u16_t* array, u16_t count);
+u8_t zfCompareWithBssid(zdev_t* dev, u16_t* bssid);
+
+/* chb.c */
+void zfDumpBssList(zdev_t* dev);
+
+
+u16_t zfIssueCmd(zdev_t* dev, u32_t* cmd, u16_t cmdLen, u16_t src, u8_t* buf);
+
+
+/* cic.c */
+void zfUpdateBssid(zdev_t* dev, u8_t* bssid);
+void zfResetSupportRate(zdev_t* dev, u8_t type);
+void zfUpdateSupportRate(zdev_t* dev, u8_t* rateArray);
+u8_t zfIsGOnlyMode(zdev_t* dev, u16_t frequency, u8_t* rateArray);
+void zfGatherBMode(zdev_t* dev, u8_t* rateArray, u8_t* extrateArray);
+u8_t zfPSDeviceSleep(zdev_t* dev);
+u16_t zfGetRandomNumber(zdev_t* dev, u16_t initValue);
+void zfCoreEvent(zdev_t* dev, u16_t event, u8_t* rsp);
+void zfBeaconCfgInterrupt(zdev_t* dev, u8_t* rsp);
+void zfEndOfAtimWindowInterrupt(zdev_t* dev);
+
+/* cinit.c */
+u16_t zfTxGenWlanHeader(zdev_t* dev, zbuf_t* buf, u16_t* header, u16_t seq,
+ u8_t flag, u16_t plusLen, u16_t minusLen, u16_t port,
+ u16_t* da, u16_t* sa, u8_t up, u16_t *micLen,
+ u16_t* snap, u16_t snapLen, struct aggControl *aggControl);
+u16_t zfTxGenMmHeader(zdev_t* dev, u8_t frameType, u16_t* dst,
+ u16_t* header, u16_t len, zbuf_t* buf, u16_t vap, u8_t encrypt);
+void zfInitMacApMode(zdev_t* dev);
+u16_t zfChGetNextChannel(zdev_t* dev, u16_t frequency, u8_t* pbPassive);
+u16_t zfChGetFirstChannel(zdev_t* dev, u8_t* pbPassive);
+u16_t zfChGetFirst2GhzChannel(zdev_t* dev);
+u16_t zfChGetFirst5GhzChannel(zdev_t* dev);
+u16_t zfChGetLastChannel(zdev_t* dev, u8_t* pbPassive);
+u16_t zfChGetLast5GhzChannel(zdev_t* dev);
+u16_t zfChNumToFreq(zdev_t* dev, u8_t ch, u8_t freqBand);
+u8_t zfChFreqToNum(u16_t freq, u8_t* bIs5GBand);
+
+/* cmm.c */
+void zfProcessManagement(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* AddInfo); //CWYang(m)
+void zfSendMmFrame(zdev_t* dev, u8_t frameType, u16_t* dst,
+ u32_t p1, u32_t p2, u32_t p3);
+u16_t zfFindElement(zdev_t* dev, zbuf_t* buf, u8_t eid);
+u16_t zfFindWifiElement(zdev_t* dev, zbuf_t* buf, u8_t type, u8_t subtype);
+u16_t zfFindSuperGElement(zdev_t* dev, zbuf_t* buf, u8_t type);
+u16_t zfFindXRElement(zdev_t* dev, zbuf_t* buf, u8_t type);
+u16_t zfRemoveElement(zdev_t* dev, u8_t* buf, u16_t size, u8_t eid);
+u16_t zfUpdateElement(zdev_t* dev, u8_t* buf, u16_t size, u8_t* updateeid);
+void zfProcessProbeReq(zdev_t* dev, zbuf_t* buf, u16_t* src);
+void zfProcessProbeRsp(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* AddInfo);
+u16_t zfSendProbeReq(zdev_t* dev, zbuf_t* buf, u16_t offset, u8_t bWithSSID);
+u16_t zfMmAddIeSupportRate(zdev_t* dev, zbuf_t* buf,
+ u16_t offset, u8_t eid, u8_t rateSet);
+u16_t zfMmAddIeDs(zdev_t* dev, zbuf_t* buf, u16_t offset);
+u16_t zfMmAddIeErp(zdev_t* dev, zbuf_t* buf, u16_t offset);
+void zfUpdateDefaultQosParameter(zdev_t* dev, u8_t mode);
+u16_t zfMmAddIeWpa(zdev_t* dev, zbuf_t* buf, u16_t offset, u16_t apId);
+u16_t zfMmAddHTCapability(zdev_t* dev, zbuf_t* buf, u16_t offset); //CWYang(+)
+u16_t zfMmAddPreNHTCapability(zdev_t* dev, zbuf_t* buf, u16_t offset);
+u16_t zfMmAddExtendedHTCapability(zdev_t* dev, zbuf_t* buf, u16_t offset); //CWYang(+)
+u16_t zfFindATHExtCap(zdev_t* dev, zbuf_t* buf, u8_t type, u8_t subtype);
+u16_t zfFindBrdcmMrvlRlnkExtCap(zdev_t* dev, zbuf_t* buf);
+u16_t zfFindMarvelExtCap(zdev_t* dev, zbuf_t* buf);
+u16_t zfFindBroadcomExtCap(zdev_t* dev, zbuf_t* buf);
+u16_t zfFindRlnkExtCap(zdev_t* dev, zbuf_t* buf);
+
+/* cmmap.c */
+void zfMmApTimeTick(zdev_t* dev);
+void zfApAgingSta(zdev_t* dev);
+u16_t zfApAddSta(zdev_t* dev, u16_t* addr, u16_t state, u16_t apId, u8_t type,
+ u8_t qosType, u8_t qosInfo);
+void zfApProtctionMonitor(zdev_t* dev);
+void zfApProcessBeacon(zdev_t* dev, zbuf_t* buf);
+void zfApProcessAuth(zdev_t* dev, zbuf_t* buf, u16_t* src, u16_t apId);
+void zfApProcessAsocReq(zdev_t* dev, zbuf_t* buf, u16_t* src, u16_t apId);
+void zfApProcessAsocRsp(zdev_t* dev, zbuf_t* buf);
+void zfApProcessDeauth(zdev_t* dev, zbuf_t* buf, u16_t* src, u16_t apId);
+void zfApProcessDisasoc(zdev_t* dev, zbuf_t* buf, u16_t* src, u16_t apId);
+void zfApProcessProbeRsp(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* AddInfo);
+void zfApStoreAsocReqIe(zdev_t* dev, zbuf_t* buf, u16_t aid);
+u16_t zfApAddIeSsid(zdev_t* dev, zbuf_t* buf, u16_t offset, u16_t vap);
+void zfApSendBeacon(zdev_t* dev);
+u16_t zfApGetSTAInfo(zdev_t* dev, u16_t* addr, u16_t* state, u8_t* vap);
+u16_t zfIntrabssForward(zdev_t* dev, zbuf_t* buf, u8_t srcVap);
+u16_t zfApBufferPsFrame(zdev_t* dev, zbuf_t* buf, u16_t port);
+void zfApInitStaTbl(zdev_t* dev);
+void zfApGetStaTxRateAndQosType(zdev_t* dev, u16_t* addr, u32_t* phyCtrl,
+ u8_t* qosType, u16_t* rcProbingFlag);
+void zfApGetStaQosType(zdev_t* dev, u16_t* addr, u8_t* qosType);
+void zfApSetStaTxRate(zdev_t* dev, u16_t* addr, u32_t phyCtrl);
+struct zsMicVar* zfApGetRxMicKey(zdev_t* dev, zbuf_t* buf);
+struct zsMicVar* zfApGetTxMicKey(zdev_t* dev, zbuf_t* buf, u8_t* qosType);
+u16_t zfApAddIeWmePara(zdev_t* dev, zbuf_t* buf, u16_t offset, u16_t vap);
+u16_t zfApUpdatePsBit(zdev_t* dev, zbuf_t* buf, u8_t* vap, u8_t* uapsdTrig);
+void zfApProcessPsPoll(zdev_t* dev, zbuf_t* buf);
+u16_t zfApFindSta(zdev_t* dev, u16_t* addr);
+void zfApGetStaEncryType(zdev_t* dev, u16_t* addr, u8_t* encryType);
+void zfApGetStaWpaIv(zdev_t* dev, u16_t* addr, u16_t* iv16, u32_t* iv32);
+void zfApSetStaWpaIv(zdev_t* dev, u16_t* addr, u16_t iv16, u32_t iv32);
+void zfApClearStaKey(zdev_t* dev, u16_t* addr);
+#ifdef ZM_ENABLE_CENC
+void zfApGetStaCencIvAndKeyIdx(zdev_t* dev, u16_t* addr, u32_t *iv,
+ u8_t *keyIdx);
+void zfApSetStaCencIv(zdev_t* dev, u16_t* addr, u32_t *iv);
+#endif //ZM_ENABLE_CENC
+void zfApSetProtectionMode(zdev_t* dev, u16_t mode);
+void zfApFlushBufferedPsFrame(zdev_t* dev);
+void zfApSendFailure(zdev_t* dev, u8_t* addr);
+u8_t zfApRemoveFromPsQueue(zdev_t* dev, u16_t id, u16_t* src);
+void zfApProcessAction(zdev_t* dev, zbuf_t* buf);
+/* cmmsta.c */
+void zfMmStaTimeTick(zdev_t* dev);
+void zfReWriteBeaconStartAddress(zdev_t* dev); // Mxzeng
+void zfStaProcessBeacon(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* AddInfo); //CWYang(m)
+void zfStaProcessAuth(zdev_t* dev, zbuf_t* buf, u16_t* src, u16_t apId);
+void zfStaProcessAsocReq(zdev_t* dev, zbuf_t* buf, u16_t* src, u16_t apId);
+void zfStaProcessAsocRsp(zdev_t* dev, zbuf_t* buf);
+void zfStaProcessDeauth(zdev_t* dev, zbuf_t* buf);
+void zfStaProcessDisasoc(zdev_t* dev, zbuf_t* buf);
+void zfStaProcessProbeRsp(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* AddInfo);
+void zfStaProcessAtim(zdev_t* dev, zbuf_t* buf);
+void zfStaStoreAsocRspIe(zdev_t* dev, zbuf_t* buf);
+void zfStaChannelManagement(zdev_t* dev, u8_t scan);
+void zfIbssConnectNetwork(zdev_t* dev);
+void zfInfraConnectNetwork(zdev_t* dev);
+u8_t zfCheckAuthentication(zdev_t* dev, struct zsBssInfo* pBssInfo);
+u8_t zfChangeAdapterState(zdev_t* dev, u8_t newState);
+u16_t zfStaAddIeSsid(zdev_t* dev, zbuf_t* buf, u16_t offset);
+u16_t zfStaAddIeWpaRsn(zdev_t* dev, zbuf_t* buf, u16_t offset, u8_t frameType);
+u16_t zfStaAddIeIbss(zdev_t* dev, zbuf_t* buf, u16_t offset);
+void zfStaStartConnect(zdev_t* dev, u8_t bIsSharedKey);
+u8_t zfStaIsConnected(zdev_t* dev);
+u8_t zfStaIsConnecting(zdev_t* dev);
+u8_t zfStaIsDisconnect(zdev_t* dev);
+void zfStaSendBeacon(zdev_t* dev);
+void zfSendNullData(zdev_t* dev, u8_t type);
+void zfSendPSPoll(zdev_t* dev);
+void zfSendBA(zdev_t* dev, u16_t start_seq, u8_t *bitmap);
+void zdRateInfoCountTx(zdev_t* dev, u16_t* macAddr);
+struct zsMicVar* zfStaGetRxMicKey(zdev_t* dev, zbuf_t* buf);
+struct zsMicVar* zfStaGetTxMicKey(zdev_t* dev, zbuf_t* buf);
+u16_t zfStaRxValidateFrame(zdev_t* dev, zbuf_t* buf);
+void zfStaMicFailureHandling(zdev_t* dev, zbuf_t* buf);
+u8_t zfStaBlockWlanScan(zdev_t* dev);
+void zfStaIbssPSCheckState(zdev_t* dev, zbuf_t* buf);
+u8_t zfStaIbssPSQueueData(zdev_t* dev, zbuf_t* buf);
+void zfStaIbssPSSend(zdev_t* dev);
+void zfStaResetStatus(zdev_t* dev, u8_t bInit);
+u16_t zfStaAddIeWmeInfo(zdev_t* dev, zbuf_t* buf, u16_t offset, u8_t qosInfo);
+void zfInitPartnerNotifyEvent(zdev_t* dev, zbuf_t* buf, struct zsPartnerNotifyEvent *event);
+void zfStaInitOppositeInfo(zdev_t* dev);
+void zfStaIbssMonitoring(zdev_t* dev, u8_t reset);
+struct zsBssInfo* zfStaFindBssInfo(zdev_t* dev, zbuf_t* buf, struct zsWlanProbeRspFrameHeader *pProbeRspHeader);
+u8_t zfStaInitBssInfo(zdev_t* dev, zbuf_t* buf,
+ struct zsWlanProbeRspFrameHeader *pProbeRspHeader,
+ struct zsBssInfo* pBssInfo, struct zsAdditionInfo* AddInfo, u8_t type);
+s8_t zfStaFindFreeOpposite(zdev_t* dev, u16_t *sa, int *pFoundIdx);
+s8_t zfStaFindOppositeByMACAddr(zdev_t* dev, u16_t *sa, u8_t *pFoundIdx);
+void zfStaRefreshBlockList(zdev_t* dev, u16_t flushFlag);
+void zfStaConnectFail(zdev_t* dev, u16_t reason, u16_t* bssid, u8_t weight);
+void zfStaGetTxRate(zdev_t* dev, u16_t* macAddr, u32_t* phyCtrl,
+ u16_t* rcProbingFlag);
+u16_t zfStaProcessAction(zdev_t* dev, zbuf_t* buf);
+struct zsTkipSeed* zfStaGetRxSeed(zdev_t* dev, zbuf_t* buf);
+#ifdef ZM_ENABLE_CENC
+/* CENC */
+u16_t zfStaAddIeCenc(zdev_t* dev, zbuf_t* buf, u16_t offset);
+#endif //ZM_ENABLE_CENC
+void zfStaEnableSWEncryption(zdev_t *dev, u8_t value);
+void zfStaDisableSWEncryption(zdev_t *dev);
+u16_t zfComputeBssInfoWeightValue(zdev_t *dev, u8_t isBMode, u8_t isHT, u8_t isHT40, u8_t signalStrength);
+u16_t zfStaAddIbssAdditionalIE(zdev_t* dev, zbuf_t* buf, u16_t offset);
+
+/* ctkip.c */
+void zfTkipInit(u8_t* key, u8_t* ta, struct zsTkipSeed* pSeed, u8_t* initIv);
+void zfMicSetKey(u8_t* key, struct zsMicVar* pMic);
+void zfMicAppendByte(u8_t b, struct zsMicVar* pMic);
+void zfMicClear(struct zsMicVar* pMic);
+void zfMicAppendTxBuf(zdev_t* dev, zbuf_t* buf, u8_t* da, u8_t* sa,
+ u16_t removeLen, u8_t* mic);
+u8_t zfMicRxVerify(zdev_t* dev, zbuf_t* buf);
+void zfMicGetMic(u8_t* dst, struct zsMicVar* pMic);
+void zfCalTxMic(zdev_t *dev, zbuf_t *buf, u8_t *snap, u16_t snapLen, u16_t offset, u16_t *da, u16_t *sa, u8_t up, u8_t *mic);
+void zfTKIPEncrypt(zdev_t *dev, zbuf_t *buf, u8_t *snap, u16_t snapLen, u16_t offset, u8_t keyLen, u8_t* key, u32_t* icv);
+u16_t zfTKIPDecrypt(zdev_t *dev, zbuf_t *buf, u16_t offset, u8_t keyLen, u8_t* key);
+void zfTkipGetseeds(u16_t iv16, u8_t *RC4Key, struct zsTkipSeed *Seed);
+u8_t zfTkipPhase1KeyMix(u32_t iv32, struct zsTkipSeed* pSeed);
+u8_t zfTkipPhase2KeyMix(u16_t iv16, struct zsTkipSeed* pSeed);
+void zfWEPEncrypt(zdev_t *dev, zbuf_t *buf, u8_t *snap, u16_t snapLen, u16_t offset, u8_t keyLen, u8_t* WepKey, u8_t *iv);
+u16_t zfWEPDecrypt(zdev_t *dev, zbuf_t *buf, u16_t offset, u8_t keyLen, u8_t* WepKey, u8_t *iv);
+
+/* ctxrx.c */
+u16_t zfSend80211Frame(zdev_t* dev, zbuf_t* buf);
+void zfIsrPciTxComp(zdev_t* dev);
+void zfTxPciDmaStart(zdev_t* dev);
+u16_t zfTxPortControl(zdev_t* dev, zbuf_t* buf, u16_t port);
+u16_t zfTxSendEth(zdev_t* dev, zbuf_t* buf, u16_t port,
+ u16_t bufType, u16_t flag);
+u16_t zfTxGenWlanTail(zdev_t* dev, zbuf_t* buf, u16_t* snap, u16_t snaplen,
+ u16_t* mic);
+u16_t zfTxGenWlanSnap(zdev_t* dev, zbuf_t* buf, u16_t* snap, u16_t* snaplen);
+void zfTxGetIpTosAndFrag(zdev_t* dev, zbuf_t* buf, u8_t* up, u16_t* fragOff);
+u16_t zfPutVtxq(zdev_t* dev, zbuf_t* buf);
+void zfPushVtxq(zdev_t* dev);
+u8_t zfIsVtxqEmpty(zdev_t* dev);
+u16_t zfGetSeqCtrl(zdev_t* dev, zbuf_t* buf, u16_t offset);
+u8_t zfGetFragNo(zdev_t* dev, zbuf_t* buf);
+void zfShowRxEAPOL(zdev_t* dev, zbuf_t* buf, u16_t offset);
+void zfShowTxEAPOL(zdev_t* dev, zbuf_t* buf, u16_t offset);
+void zfCoreRecv(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo);
+u16_t zfPutVmmq(zdev_t* dev, zbuf_t* buf);
+void zfFlushVtxq(zdev_t* dev);
+void zfAgingDefragList(zdev_t* dev, u16_t flushFlag);
+
+void zfLed100msCtrl(zdev_t* dev);
+void zf80211FrameSend(zdev_t* dev, zbuf_t* buf, u16_t* header, u16_t snapLen,
+ u16_t* da, u16_t* sa, u8_t up, u16_t headerLen, u16_t* snap,
+ u16_t* tail, u16_t tailLen, u16_t offset, u16_t bufType,
+ u8_t ac, u8_t keyIdx);
+void zfCheckIsRIFSFrame(zdev_t* dev, zbuf_t* buf, u16_t frameSubType);
+
+/* queue.c */
+struct zsQueue* zfQueueCreate(zdev_t* dev, u16_t size);
+void zfQueueDestroy(zdev_t* dev, struct zsQueue* q);
+u16_t zfQueuePutNcs(zdev_t* dev, struct zsQueue* q, zbuf_t* buf, u32_t tick);
+u16_t zfQueuePut(zdev_t* dev, struct zsQueue* q, zbuf_t* buf, u32_t tick);
+zbuf_t* zfQueueGet(zdev_t* dev, struct zsQueue* q);
+zbuf_t* zfQueueGetWithMac(zdev_t* dev, struct zsQueue* q, u8_t* addr, u8_t* mb);
+void zfQueueFlush(zdev_t* dev, struct zsQueue* q);
+void zfQueueAge(zdev_t* dev, struct zsQueue* q, u32_t tick, u32_t msAge);
+void zfQueueGenerateUapsdTim(zdev_t* dev, struct zsQueue* q,
+ u8_t* uniBitMap, u16_t* highestByte);
+
+/* hpmain.c */
+u16_t zfHpInit(zdev_t* dev, u32_t frequency);
+u16_t zfHpRelease(zdev_t* dev);
+void zfHpSetFrequencyEx(zdev_t* dev, u32_t frequency, u8_t bw40,
+ u8_t extOffset, u8_t initRF);
+u16_t zfHpStartRecv(zdev_t* dev);
+u16_t zfHpStopRecv(zdev_t* dev);
+u16_t zfHpResetKeyCache(zdev_t* dev);
+u16_t zfHpSetApStaMode(zdev_t* dev, u8_t mode);
+u16_t zfHpSetBssid(zdev_t* dev, u8_t* bssid);
+u16_t zfHpSetSnifferMode(zdev_t* dev, u16_t on);
+u8_t zfHpUpdateQosParameter(zdev_t* dev, u16_t* cwminTbl, u16_t* cwmaxTbl,
+ u16_t* aifsTbl, u16_t* txopTbl);
+void zfHpSetAtimWindow(zdev_t* dev, u16_t atimWin);
+void zfHpEnableBeacon(zdev_t* dev, u16_t mode, u16_t bcnInterval, u16_t dtim, u8_t enableAtim);
+void zfHpDisableBeacon(zdev_t* dev);
+void zfHpSetBasicRateSet(zdev_t* dev, u16_t bRateBasic, u16_t gRateBasic);
+void zfHpSetRTSCTSRate(zdev_t* dev, u32_t rate);
+void zfHpSetMacAddress(zdev_t* dev, u16_t* macAddr, u16_t macAddrId);
+u32_t zfHpGetMacAddress(zdev_t* dev);
+u32_t zfHpGetTransmitPower(zdev_t* dev);
+void zfHpSetMulticastList(zdev_t* dev, u8_t size, u8_t* pList, u8_t bAllMulticast);
+
+u16_t zfHpRemoveKey(zdev_t* dev, u16_t user);
+u32_t zfHpSetKey(zdev_t* dev, u8_t user, u8_t keyId, u8_t type,
+ u16_t* mac, u32_t* key);
+//u32_t zfHpSetStaPairwiseKey(zdev_t* dev, u16_t* apMacAddr, u8_t type,
+// u32_t* key, u32_t* micKey);
+//u32_t zfHpSetStaGroupKey(zdev_t* dev, u16_t* apMacAddr, u8_t type,
+// u32_t* key, u32_t* micKey);
+u32_t zfHpSetApPairwiseKey(zdev_t* dev, u16_t* staMacAddr, u8_t type,
+ u32_t* key, u32_t* micKey, u16_t staAid);
+u32_t zfHpSetApGroupKey(zdev_t* dev, u16_t* apMacAddr, u8_t type,
+ u32_t* key, u32_t* micKey, u16_t vapId);
+u32_t zfHpSetDefaultKey(zdev_t* dev, u8_t keyId, u8_t type, u32_t* key, u32_t* micKey);
+u32_t zfHpSetPerUserKey(zdev_t* dev, u8_t user, u8_t keyId, u8_t* mac, u8_t type, u32_t* key, u32_t* micKey);
+
+void zfHpSendBeacon(zdev_t* dev, zbuf_t* buf, u16_t len);
+u16_t zfHpGetPayloadLen(zdev_t* dev,
+ zbuf_t* buf,
+ u16_t len,
+ u16_t plcpHdrLen,
+ u32_t *rxMT,
+ u32_t *rxMCS,
+ u32_t *rxBW,
+ u32_t *rxSG
+ );
+u32_t zfHpGetFreeTxdCount(zdev_t* dev);
+u32_t zfHpGetMaxTxdCount(zdev_t* dev);
+u16_t zfHpSend(zdev_t* dev, u16_t* header, u16_t headerLen,
+ u16_t* snap, u16_t snapLen, u16_t* tail, u16_t tailLen, zbuf_t* buf,
+ u16_t offset, u16_t bufType, u8_t ac, u8_t keyIdx);
+void zfHpGetRegulationTablefromRegionCode(zdev_t* dev, u16_t regionCode);
+void zfHpGetRegulationTablefromCountry(zdev_t* dev, u16_t CountryCode);
+u8_t zfHpGetRegulationTablefromISO(zdev_t* dev, u8_t *countryInfo, u8_t length);
+const char* zfHpGetisoNamefromregionCode(zdev_t* dev, u16_t regionCode);
+u16_t zfHpGetRegionCodeFromIsoName(zdev_t* dev, u8_t *countryIsoName);
+u8_t zfHpGetRegulatoryDomain(zdev_t* dev);
+void zfHpLedCtrl(zdev_t* dev, u16_t ledId, u8_t mode);
+u16_t zfHpResetTxRx(zdev_t* dev);
+u16_t zfHpDeleteAllowChannel(zdev_t* dev, u16_t freq);
+u16_t zfHpAddAllowChannel(zdev_t* dev, u16_t freq);
+u32_t zfHpCwmUpdate(zdev_t* dev);
+u32_t zfHpAniUpdate(zdev_t* dev);
+u32_t zfHpAniUpdateRssi(zdev_t* dev, u8_t rssi);
+void zfHpAniAttach(zdev_t* dev);
+void zfHpAniArPoll(zdev_t* dev, u32_t listenTime, u32_t phyCnt1, u32_t phyCnt2);
+void zfHpHeartBeat(zdev_t* dev);
+void zfHpPowerSaveSetState(zdev_t* dev, u8_t psState);
+void zfHpPowerSaveSetMode(zdev_t* dev, u8_t staMode, u8_t psMode, u16_t bcnInterval);
+u16_t zfHpIsDfsChannel(zdev_t* dev, u16_t freq);
+u16_t zfHpIsDfsChannelNCS(zdev_t* dev, u16_t freq);
+u16_t zfHpFindFirstNonDfsChannel(zdev_t* dev, u16_t aBand);
+u16_t zfHpIsAllowedChannel(zdev_t* dev, u16_t freq);
+void zfHpDisableDfsChannel(zdev_t* dev, u8_t disableFlag);
+void zfHpSetTTSIFSTime(zdev_t* dev, u8_t sifs_time);
+
+void zfHpQueryMonHalRxInfo(zdev_t* dev, u8_t *monHalRxInfo);
+
+void zfDumpSSID(u8_t length, u8_t *value);
+void zfHpSetAggPktNum(zdev_t* dev, u32_t num);
+void zfHpSetMPDUDensity(zdev_t* dev, u8_t density);
+void zfHpSetSlotTime(zdev_t* dev, u8_t type);
+void zfHpSetSlotTimeRegister(zdev_t* dev, u8_t type);
+void zfHpSetRifs(zdev_t* dev, u8_t ht_enable, u8_t ht2040, u8_t g_mode);
+void zfHpBeginSiteSurvey(zdev_t* dev, u8_t status);
+void zfHpFinishSiteSurvey(zdev_t* dev, u8_t status);
+u16_t zfHpEnableHwRetry(zdev_t* dev);
+u16_t zfHpDisableHwRetry(zdev_t* dev);
+void zfHpSWDecrypt(zdev_t* dev, u8_t enable);
+void zfHpSWEncrypt(zdev_t* dev, u8_t enable);
+u32_t zfHpCapability(zdev_t* dev);
+void zfHpSetRollCallTable(zdev_t* dev);
+u8_t zfHpregulatoryDomain(zdev_t* dev);
+u16_t zfStaAddIePowerCap(zdev_t* dev, zbuf_t* buf, u16_t offset);
+u8_t zfHpGetMaxTxPower(zdev_t* dev);
+u8_t zfHpGetMinTxPower(zdev_t* dev);
+u16_t zfStaAddIeSupportCh(zdev_t* dev, zbuf_t* buf, u16_t offset);
+void zfHpEnableRifs(zdev_t* dev, u8_t mode24g, u8_t modeHt, u8_t modeHt2040);
+void zfHpDisableRifs(zdev_t* dev);
+u16_t zfHpUsbReset(zdev_t* dev);
+
+
+#endif /* #ifndef _CFUNC_H */
diff --git a/drivers/staging/otus/80211core/chb.c b/drivers/staging/otus/80211core/chb.c
new file mode 100644
index 00000000000..7fac1501125
--- /dev/null
+++ b/drivers/staging/otus/80211core/chb.c
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : hb.c */
+/* */
+/* Abstract */
+/* This module contains house keeping and timer functions. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/************************************************************************/
+#include "cprecomp.h"
+
+/* Called by wrapper every 10 msec */
+void zfiHeartBeat(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->tick++;
+
+#if 0
+ /* => every 1.28 seconds */
+ if (wd->cwm.cw_enable && ((wd->tick & 0x7f) == 0x3f))
+ {
+ zfHpCwmUpdate(dev);
+ }
+#endif
+ /* => every 2.56 seconds */
+ if ((wd->tick & 0xff) == 0)
+ {
+ zfAgingDefragList(dev, 1);
+ }
+
+ /* Watch Dog */
+ //zfWatchDog();
+
+ /* LED Control (per 100ms) */
+ if ((wd->tick % 10) == 9)
+ {
+ zfLed100msCtrl(dev);
+#ifdef ZM_ENABLE_BA_RATECTRL
+ if (!wd->modeMDKEnable)
+ {
+ zfiDbgReadTally(dev);
+ }
+#endif
+ }
+
+#ifdef ZM_ENABLE_REWRITE_BEACON_START_ADDRESS
+ if ( wd->wlanMode == ZM_MODE_IBSS )
+ {
+ if ( zfStaIsConnected(dev) )
+ {
+ zfReWriteBeaconStartAddress(dev);
+ }
+ }
+#endif
+
+ if ( wd->wlanMode == ZM_MODE_IBSS )
+ {
+ if ( zfStaIsConnected(dev) )
+ {
+ wd->tickIbssReceiveBeacon++; // add 10ms
+
+ if ( (wd->sta.ibssSiteSurveyStatus == 2) &&
+ (wd->tickIbssReceiveBeacon == 300) &&
+ (wd->sta.ibssReceiveBeaconCount < 3) )
+ {
+ zm_debug_msg0("It is happen!!! No error message");
+ zfReSetCurrentFrequency(dev);
+ }
+ }
+ }
+
+ if(wd->sta.ReceivedPacketRateCounter <= 0)
+ {
+ wd->sta.ReceivedPktRatePerSecond = wd->sta.TotalNumberOfReceivePackets;
+ //zm_debug_msg1("Receive Packet Per Second = ", wd->sta.ReceivedPktRatePerSecond);
+ if (wd->sta.TotalNumberOfReceivePackets != 0)
+ {
+ wd->sta.avgSizeOfReceivePackets = wd->sta.TotalNumberOfReceiveBytes/wd->sta.TotalNumberOfReceivePackets;
+ }
+ else
+ {
+ wd->sta.avgSizeOfReceivePackets = 640;
+ }
+ wd->sta.TotalNumberOfReceivePackets = 0;
+ wd->sta.TotalNumberOfReceiveBytes = 0;
+ wd->sta.ReceivedPacketRateCounter = 100; /*for another 1s*/
+ }
+ else
+ {
+ wd->sta.ReceivedPacketRateCounter--;
+ }
+
+ /* => every 1.28 seconds */
+ if((wd->tick & 0x7f) == 0x3f)
+ {
+ if( wd->sta.NonNAPcount > 0)
+ {
+ wd->sta.RTSInAGGMode = TRUE;
+ wd->sta.NonNAPcount = 0;
+ }
+ else
+ {
+ wd->sta.RTSInAGGMode = FALSE;
+ }
+ }
+
+
+
+ /* Maintain management time tick */
+ zfMmApTimeTick(dev);
+ zfMmStaTimeTick(dev);
+
+ //zfPhyCrTuning(dev);
+
+ //zfTxPowerControl(dev);
+ zfHpHeartBeat(dev);
+
+}
+
+
+void zfDumpBssList(zdev_t* dev)
+{
+ struct zsBssInfo* pBssInfo;
+ u8_t str[33];
+ u8_t i, j;
+ u32_t addr1, addr2;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zm_debug_msg0("***** Bss scan result *****");
+ zmw_enter_critical_section(dev);
+
+ pBssInfo = wd->sta.bssList.head;
+
+ for( i=0; i<wd->sta.bssList.bssCount; i++ )
+ {
+ if ( i )
+ {
+ zm_debug_msg0("---------------------------");
+ }
+
+ zm_debug_msg1("BSS #", i);
+ for(j=0; j<pBssInfo->ssid[1]; j++)
+ {
+ str[j] = pBssInfo->ssid[2+j];
+ }
+ str[pBssInfo->ssid[1]] = 0;
+ zm_debug_msg0("SSID = ");
+ zm_debug_msg0(str);
+
+ addr1 = (pBssInfo->bssid[0] << 16) + (pBssInfo->bssid[1] << 8 )
+ + pBssInfo->bssid[2];
+ addr2 = (pBssInfo->bssid[3] << 16) + (pBssInfo->bssid[4] << 8 )
+ + pBssInfo->bssid[5];
+ zm_debug_msg2("Bssid = ", addr1);
+ zm_debug_msg2(" ", addr2);
+ zm_debug_msg1("frequency = ", pBssInfo->frequency);
+ zm_debug_msg1("security type = ", pBssInfo->securityType);
+ zm_debug_msg1("WME = ", pBssInfo->wmeSupport);
+ zm_debug_msg1("beacon interval = ", pBssInfo->beaconInterval[0]
+ + (pBssInfo->beaconInterval[1] << 8));
+ zm_debug_msg1("capability = ", pBssInfo->capability[0]
+ + (pBssInfo->capability[1] << 8));
+ if ( pBssInfo->supportedRates[1] > 0 )
+ {
+ for( j=0; j<pBssInfo->supportedRates[1]; j++ )
+ {
+ zm_debug_msg2("supported rates = ", pBssInfo->supportedRates[2+j]);
+ }
+ }
+
+ for( j=0; j<pBssInfo->extSupportedRates[1]; j++ )
+ {
+ zm_debug_msg2("ext supported rates = ", pBssInfo->extSupportedRates[2+j]);
+ }
+
+ pBssInfo = pBssInfo->next;
+ }
+ zmw_leave_critical_section(dev);
+
+ zm_debug_msg0("***************************");
+}
+
diff --git a/drivers/staging/otus/80211core/cic.c b/drivers/staging/otus/80211core/cic.c
new file mode 100644
index 00000000000..c84f079e3d8
--- /dev/null
+++ b/drivers/staging/otus/80211core/cic.c
@@ -0,0 +1,496 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "cprecomp.h"
+#include "ratectrl.h"
+
+
+void zfUpdateBssid(zdev_t* dev, u8_t* bssid)
+{
+
+ zmw_get_wlan_dev(dev);
+
+ //zmw_declare_for_critical_section();
+
+ //zmw_enter_critical_section(dev);
+ wd->sta.bssid[0] = bssid[0] + (((u16_t) bssid[1]) << 8);
+ wd->sta.bssid[1] = bssid[2] + (((u16_t) bssid[3]) << 8);
+ wd->sta.bssid[2] = bssid[4] + (((u16_t) bssid[5]) << 8);
+ //zmw_leave_critical_section(dev);
+
+ zfHpSetBssid(dev, bssid);
+
+}
+
+/************************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfResetSupportRate */
+/* Reset support rate to default value. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* type: ZM_DEFAULT_SUPPORT_RATE_ZERO => reset to zero */
+/* ZM_DEFAULT_SUPPORT_RATE_DISCONNECT => reset to disconnect status */
+/* ZM_DEFAULT_SUPPORT_RATE_IBSS_B => reset to IBSS creator(b mode) */
+/* ZM_DEFAULT_SUPPORT_RATE_IBSS_AG => reset to IBSS creator(a/g mode) */
+/* */
+/************************************************************************************/
+void zfResetSupportRate(zdev_t* dev, u8_t type)
+{
+ zmw_get_wlan_dev(dev);
+
+ switch(type)
+ {
+ case ZM_DEFAULT_SUPPORT_RATE_ZERO:
+ wd->bRate = 0;
+ wd->bRateBasic = 0;
+ wd->gRate = 0;
+ wd->gRateBasic = 0;
+ break;
+ case ZM_DEFAULT_SUPPORT_RATE_DISCONNECT:
+ wd->bRate = 0xf;
+ wd->bRateBasic = 0xf;
+ wd->gRate = 0xff;
+ wd->gRateBasic = 0x15;
+ break;
+ case ZM_DEFAULT_SUPPORT_RATE_IBSS_B:
+ wd->bRate = 0xf;
+ wd->bRateBasic = 0xf;
+ wd->gRate = 0;
+ wd->gRateBasic = 0;
+ break;
+ case ZM_DEFAULT_SUPPORT_RATE_IBSS_AG:
+ wd->bRate = 0xf;
+ wd->bRateBasic = 0xf;
+ wd->gRate = 0xff;
+ wd->gRateBasic = 0;
+ break;
+ }
+}
+
+void zfUpdateSupportRate(zdev_t* dev, u8_t* rateArray)
+{
+ u8_t bRate=0, bRateBasic=0, gRate=0, gRateBasic=0;
+ u8_t length = rateArray[1];
+ u8_t i, j;
+
+ zmw_get_wlan_dev(dev);
+
+ for(i=2; i<length+2; i++)
+ {
+ for(j=0; j<4; j++)
+ {
+ if ( (rateArray[i] & 0x7f) == zg11bRateTbl[j] )
+ {
+ bRate |= (1 << j);
+ if ( rateArray[i] & 0x80 )
+ {
+ bRateBasic |= (1 << j);
+ }
+ }
+ }
+
+ if ( j == 4 )
+ {
+ for(j=0; j<8; j++)
+ {
+ if ( (rateArray[i] & 0x7f) == zg11gRateTbl[j] )
+ {
+ gRate |= (1 << j);
+ if ( rateArray[i] & 0x80 )
+ {
+ gRateBasic |= (1 << j);
+ }
+ }
+ }
+ }
+ }
+
+
+ wd->bRate |= bRate;
+ wd->bRateBasic |= bRateBasic;
+ wd->gRate |= gRate;
+ wd->gRateBasic |= gRateBasic;
+}
+
+u8_t zfIsGOnlyMode(zdev_t* dev, u16_t frequency, u8_t* rateArray)
+{
+ u8_t length = rateArray[1];
+ u8_t i, j;
+
+ if (frequency < 3000) {
+ for (i = 2; i < length+2; i++) {
+ for (j = 0; j < 8; j++) {
+ if ( ((rateArray[i] & 0x7f) == zg11gRateTbl[j])
+ && (rateArray[i] & 0x80) ) {
+ return 1;
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+void zfGatherBMode(zdev_t* dev, u8_t* rateArray, u8_t* extrateArray)
+{
+ u8_t gatherBMode[ZM_MAX_SUPP_RATES_IE_SIZE + 2];
+ u8_t i, j, k = 0;
+ u8_t length;
+
+ gatherBMode[0] = ZM_WLAN_EID_SUPPORT_RATE;
+ gatherBMode[1] = 0;
+
+ length = rateArray[1];
+ for (i = 2; i < length+2; i++) {
+ for (j = 0; j < 4; j++) {
+ if ( (rateArray[i] & 0x7f) == zg11bRateTbl[j] ) {
+ gatherBMode[2+k] = rateArray[i];
+
+ gatherBMode[1]++;
+ k++;
+ }
+ }
+ }
+
+ length = extrateArray[1];
+ for (i = 2; i < length+2; i++) {
+ for (j = 0; j < 4; j++) {
+ if ( (extrateArray[i] & 0x7f) == zg11bRateTbl[j] ) {
+ gatherBMode[2+k] = extrateArray[i];
+
+ gatherBMode[1]++;
+ k++;
+ }
+ }
+ }
+
+ extrateArray[0] = extrateArray[1] = 0;
+ zfMemoryCopy(rateArray, gatherBMode, gatherBMode[1]+2);
+}
+
+u16_t zfGetRandomNumber(zdev_t* dev, u16_t initValue)
+{
+#if 0
+ /* Compiler/Linker error on Linux */
+ if ( initValue )
+ {
+ srand(initValue);
+ }
+
+ return ((u16_t)rand());
+#endif
+ return 0;
+}
+
+u8_t zfPSDeviceSleep(zdev_t* dev)
+{
+ //zmw_get_wlan_dev(dev);
+
+ /* enter PS mode */
+
+ return 0;
+}
+
+u8_t zcOfdmPhyCrtlToRate[] =
+{
+ /* 0x8=48M, 0x9=24M, 0xa=12M, 0xb=6M, 0xc=54M, 0xd=36M, 0xe=18M, 0xf=9M */
+ 10, 8, 6, 4, 11, 9, 7, 5
+};
+
+u8_t zfPhyCtrlToRate(u32_t phyCtrl)
+{
+ u32_t mt, mcs, sg;
+ u8_t rate = 0;
+
+ mt = phyCtrl & 0x3;
+ mcs = (phyCtrl>>18) & 0x3f;
+ sg = (phyCtrl>>31) & 0x1;
+
+ if ((mt == 0) && (mcs <=3))
+ {
+ rate = (u8_t)mcs;
+ }
+ else if ((mt == 1) && (mcs >= 0x8) && (mcs <= 0xf))
+ {
+ rate = zcOfdmPhyCrtlToRate[mcs-8];
+ }
+ else if ((mt == 2) && (mcs <= 15))
+ {
+ rate = (u8_t)mcs + 12;
+ if(sg) {
+ if (mcs != 7)
+ {
+ rate = (u8_t)mcs + 12 + 2;
+ }
+ else //MCS7-SG
+ {
+ rate = (u8_t)30;
+ }
+ }
+ }
+
+ return rate;
+}
+
+
+void zfCoreEvent(zdev_t* dev, u16_t event, u8_t* rsp)
+{
+ u16_t i;
+ zbuf_t* psBuf;
+ u8_t moreData;
+ u8_t vap = 0;
+ u8_t peerIdx;
+ s8_t res;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+
+ if (event == 0) //Beacon Event
+ {
+ if ( wd->wlanMode == ZM_MODE_AP )
+ {
+ zfApSendBeacon(dev);
+
+ if (wd->CurrentDtimCount == 0)
+ {
+ /* TODO : Send queued broadcast frames at BC/MC event */
+ do
+ {
+ psBuf = NULL;
+ moreData = 0;
+ zmw_enter_critical_section(dev);
+ if (wd->ap.bcmcTail[vap] != wd->ap.bcmcHead[vap])
+ {
+ //zm_msg0_mm(ZM_LV_0, "Send BCMC frames");
+ psBuf = wd->ap.bcmcArray[vap][wd->ap.bcmcHead[vap]];
+ wd->ap.bcmcHead[vap] = (wd->ap.bcmcHead[vap] + 1)
+ & (ZM_BCMC_ARRAY_SIZE - 1);
+ if (wd->ap.bcmcTail[vap] != wd->ap.bcmcHead[vap])
+ {
+ moreData = 0x20;
+ }
+ }
+ zmw_leave_critical_section(dev);
+ if (psBuf != NULL)
+ {
+ /* TODO : config moreData bit */
+ zfTxSendEth(dev, psBuf, 0, ZM_EXTERNAL_ALLOC_BUF,
+ moreData);
+ }
+ } while(psBuf != NULL);
+
+ }
+ }
+ else
+ {
+ /* STA mode */
+ if ( wd->sta.powerSaveMode > ZM_STA_PS_NONE )
+ {
+ /* send queued packets */
+ for(i=0; i<wd->sta.staPSDataCount; i++)
+ {
+ zfTxSendEth(dev, wd->sta.staPSDataQueue[i], 0,
+ ZM_EXTERNAL_ALLOC_BUF, 0);
+ }
+
+ wd->sta.staPSDataCount = 0;
+ }
+
+ if ( wd->wlanMode == ZM_MODE_IBSS )
+ {
+ zfStaSendBeacon(dev);
+ wd->sta.ibssAtimTimer = ZM_BIT_15 | wd->sta.atimWindow;
+ }
+
+ zfPowerSavingMgrPreTBTTInterrupt(dev);
+ }
+ } //if (event == 0) //Beacon Event
+ else if (event == 1) //Retry completed event
+ {
+ u32_t retryRate;
+
+ retryRate = (u32_t)(rsp[6]) + (((u32_t)(rsp[7]))<<8)
+ + (((u32_t)(rsp[8]))<<16) + (((u32_t)(rsp[9]))<<24);
+ /* Degrade Tx Rate */
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ zmw_enter_critical_section(dev);
+ if ((i=zfApFindSta(dev, (u16_t*)rsp)) != 0xffff)
+ {
+ zfRateCtrlTxFailEvent(dev, &wd->ap.staTable[i].rcCell, 0,(u32_t)zfPhyCtrlToRate(retryRate));
+ }
+ zmw_leave_critical_section(dev);
+ }
+ else
+ {
+ zmw_enter_critical_section(dev);
+ res = zfStaFindOppositeByMACAddr(dev, (u16_t*)rsp, &peerIdx);
+ if ( res == 0 )
+ {
+ zfRateCtrlTxFailEvent(dev, &wd->sta.oppositeInfo[peerIdx].rcCell, 0,(u32_t)zfPhyCtrlToRate(retryRate));
+ }
+ zmw_leave_critical_section(dev);
+ }
+ } //else if (event == 1) //Retry completed event
+ else if (event == 2) //Tx Fail event
+ {
+ u32_t retryRate;
+
+ retryRate = (u32_t)(rsp[6]) + (((u32_t)(rsp[7]))<<8)
+ + (((u32_t)(rsp[8]))<<16) + (((u32_t)(rsp[9]))<<24);
+
+ /* Degrade Tx Rate */
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ zmw_enter_critical_section(dev);
+ if ((i=zfApFindSta(dev, (u16_t*)rsp)) != 0xffff)
+ {
+ zfRateCtrlTxFailEvent(dev, &wd->ap.staTable[i].rcCell, 0,(u32_t)zfPhyCtrlToRate(retryRate));
+ }
+ zmw_leave_critical_section(dev);
+
+ zfApSendFailure(dev, rsp);
+ }
+ else
+ {
+ zmw_enter_critical_section(dev);
+ res = zfStaFindOppositeByMACAddr(dev, (u16_t*)rsp, &peerIdx);
+ if ( res == 0 )
+ {
+ zfRateCtrlTxFailEvent(dev, &wd->sta.oppositeInfo[peerIdx].rcCell, 0,(u32_t)zfPhyCtrlToRate(retryRate));
+ }
+ zmw_leave_critical_section(dev);
+ }
+ } //else if (event == 2) //Tx Fail event
+ else if (event == 3) //Tx Comp event
+ {
+ u32_t retryRate;
+
+ retryRate = (u32_t)(rsp[6]) + (((u32_t)(rsp[7]))<<8)
+ + (((u32_t)(rsp[8]))<<16) + (((u32_t)(rsp[9]))<<24);
+
+ /* TODO : Tx completed, used for rate control probing */
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ zmw_enter_critical_section(dev);
+ if ((i=zfApFindSta(dev, (u16_t*)rsp)) != 0xffff)
+ {
+ zfRateCtrlTxSuccessEvent(dev, &wd->ap.staTable[i].rcCell, zfPhyCtrlToRate(retryRate));
+ }
+ zmw_leave_critical_section(dev);
+ }
+ else
+ {
+ zmw_enter_critical_section(dev);
+ res = zfStaFindOppositeByMACAddr(dev, (u16_t*)rsp, &peerIdx);
+ if ( res == 0 )
+ {
+ zfRateCtrlTxSuccessEvent(dev, &wd->sta.oppositeInfo[peerIdx].rcCell, zfPhyCtrlToRate(retryRate));
+ }
+ zmw_leave_critical_section(dev);
+ }
+ } //else if (event == 3) //Tx Comp event
+ else if (event == 4) //BA failed count
+ {
+ u32_t fail;
+ u32_t rate;
+ peerIdx = 0;
+
+ fail=((u32_t*)rsp)[0] & 0xFFFF;
+ rate=((u32_t*)rsp)[0] >> 16;
+
+ if (rate > 15) {
+ rate = (rate & 0xF) + 12 + 2;
+ }
+ else {
+ rate = rate + 12;
+ }
+
+ zmw_enter_critical_section(dev);
+ zfRateCtrlTxFailEvent(dev, &wd->sta.oppositeInfo[peerIdx].rcCell, (u8_t)rate, fail);
+ zmw_leave_critical_section(dev);
+ }
+}
+
+void zfBeaconCfgInterrupt(zdev_t* dev, u8_t* rsp)
+{
+ u32_t txBeaconCounter;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ if ( wd->wlanMode == ZM_MODE_IBSS )
+ {
+ txBeaconCounter = *((u32_t *)rsp);
+ if ( wd->sta.beaconTxCnt != txBeaconCounter )
+ {
+ wd->sta.txBeaconInd = 1;
+
+ zmw_enter_critical_section(dev);
+ wd->tickIbssSendBeacon = 0;
+ zmw_leave_critical_section(dev);
+ }
+ else
+ {
+ wd->sta.txBeaconInd = 0;
+ }
+
+#ifdef ZM_ENABLE_IBSS_DELAYED_JOIN_INDICATION
+ if ( wd->sta.txBeaconInd && wd->sta.ibssDelayedInd )
+ {
+ if (wd->zfcbIbssPartnerNotify != NULL)
+ {
+ wd->zfcbIbssPartnerNotify(dev, 1, &wd->sta.ibssDelayedIndEvent);
+ }
+
+ wd->sta.ibssDelayedInd = 0;
+ }
+#endif
+
+ wd->sta.beaconTxCnt = txBeaconCounter;
+
+ // Need to check if the time is expired after ATIM window??
+
+ // Check if we have buffered any data for those stations that are sleeping
+ // If it's true, then transmitting ATIM pkt to notify them
+
+#ifdef ZM_ENABLE_IBSS_PS
+ // TODO: Need to check if the station receive our ATIM pkt???
+ zfStaIbssPSSend(dev);
+
+ if ( wd->sta.atimWindow == 0 )
+ {
+ // We won't receive the end of ATIM isr so we fake it
+ zfPowerSavingMgrAtimWinExpired(dev);
+ }
+#endif
+ }
+}
+
+void zfEndOfAtimWindowInterrupt(zdev_t* dev)
+{
+#ifdef ZM_ENABLE_IBSS_PS
+ zmw_get_wlan_dev(dev);
+
+ if ( wd->wlanMode == ZM_MODE_IBSS )
+ {
+ // Transmit any queued pkt for the stations!!
+ zfPowerSavingMgrAtimWinExpired(dev);
+ }
+#endif
+}
diff --git a/drivers/staging/otus/80211core/cinit.c b/drivers/staging/otus/80211core/cinit.c
new file mode 100644
index 00000000000..5f853ce7930
--- /dev/null
+++ b/drivers/staging/otus/80211core/cinit.c
@@ -0,0 +1,1911 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : init.c */
+/* */
+/* Abstract */
+/* This module contains init functions. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/************************************************************************/
+#include "cprecomp.h"
+#include "../hal/hpreg.h"
+
+extern const u8_t zcUpToAc[8];
+
+u16_t zcIndextoRateBG[16] = {1000, 2000, 5500, 11000, 0, 0, 0, 0, 48000,
+ 24000, 12000, 6000, 54000, 36000, 18000, 9000};
+u32_t zcIndextoRateN20L[16] = {6500, 13000, 19500, 26000, 39000, 52000, 58500,
+ 65000, 13000, 26000, 39000, 52000, 78000, 104000,
+ 117000, 130000};
+u32_t zcIndextoRateN20S[16] = {7200, 14400, 21700, 28900, 43300, 57800, 65000,
+ 72200, 14400, 28900, 43300, 57800, 86700, 115600,
+ 130000, 144400};
+u32_t zcIndextoRateN40L[16] = {13500, 27000, 40500, 54000, 81000, 108000, 121500,
+ 135000, 27000, 54000, 81000, 108000, 162000, 216000,
+ 243000, 270000};
+u32_t zcIndextoRateN40S[16] = {15000, 30000, 45000, 60000, 90000, 120000, 135000,
+ 150000, 30000, 60000, 90000, 120000, 180000, 240000,
+ 270000, 300000};
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfTxGenWlanHeader */
+/* Generate WLAN MAC header and LLC header. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : buffer pointer */
+/* id : Index of TxD */
+/* port : WLAN port */
+/* */
+/* OUTPUTS */
+/* length of removed Ethernet header */
+/* */
+/* AUTHOR */
+/* Stephen ZyDAS Technology Corporation 2005.5 */
+/* */
+/************************************************************************/
+u16_t zfTxGenWlanHeader(zdev_t* dev, zbuf_t* buf, u16_t* header, u16_t seq,
+ u8_t flag, u16_t plusLen, u16_t minusLen, u16_t port,
+ u16_t* da, u16_t* sa, u8_t up, u16_t *micLen,
+ u16_t* snap, u16_t snapLen, struct aggControl *aggControl)
+{
+
+ u16_t len;
+ u16_t macCtrl;
+ u32_t phyCtrl;
+ u16_t hlen = 16;
+ u16_t icvLen = 0;
+ u16_t wdsPortId;
+ u16_t vap = 0;
+ u16_t mcs = 0;
+ u16_t mt = 0;
+ u8_t qosType;
+ u8_t b1, b2;
+ u16_t wdsPort;
+ u8_t encExemptionActionType;
+ u16_t rateProbingFlag = 0;
+ u8_t tkipFrameOffset = 0;
+
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ u8_t res, peerIdx;
+ u8_t userIdx=0;
+ u16_t *iv16;
+ u32_t *iv32;
+#endif
+
+ zmw_get_wlan_dev(dev);
+
+ /* Generate WLAN header */
+ /* Frame control */
+ header[4] = 0x0008 | (flag<<8);
+ /* Duration */
+ header[5] = 0x0000;
+
+ if (wd->wlanMode == ZM_MODE_INFRASTRUCTURE)
+ {
+ /* ToDS bit */
+ header[4] |= 0x0100;
+
+ /*Sometimes we wake up to tx/rx but AP still think we are sleeping, so still need to set this bit*/
+ if ( zfPowerSavingMgrIsSleeping(dev) || wd->sta.psMgr.tempWakeUp == 1 )
+ {
+ header[4] |= 0x1000;
+ }
+
+ /* Address 1 = BSSID */
+ header[6] = wd->sta.bssid[0];
+ header[7] = wd->sta.bssid[1];
+ header[8] = wd->sta.bssid[2];
+ /* Address 3 = DA */
+ header[12] = da[0];
+ header[13] = da[1];
+ header[14] = da[2];
+ }
+ else if (wd->wlanMode == ZM_MODE_PSEUDO)
+ {
+ /* Address 1 = DA */
+ header[6] = da[0];
+ header[7] = da[1];
+ header[8] = da[2];
+ /* Address 3 = 00:00:00:00:00:00 */
+ header[12] = 0;
+ header[13] = 0;
+ header[14] = 0;
+
+ /* PSEUDO test : WDS */
+ if (wd->enableWDS)
+ {
+ /* ToDS and FromDS bit */
+ header[4] |= 0x0300;
+
+ /* Address 4 = SA */
+ header[16] = 0;
+ header[17] = 0;
+ header[18] = 0;
+
+ hlen = 19;
+ }
+ }
+ else if (wd->wlanMode == ZM_MODE_IBSS)
+ {
+ /* Address 1 = DA */
+ header[6] = da[0];
+ header[7] = da[1];
+ header[8] = da[2];
+ /* Address 3 = BSSID */
+ header[12] = wd->sta.bssid[0];
+ header[13] = wd->sta.bssid[1];
+ header[14] = wd->sta.bssid[2];
+
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ zmw_enter_critical_section(dev);
+ res = zfStaFindOppositeByMACAddr(dev, da, &peerIdx);
+ if(res == 0) // Find opposite in our OppositeInfo Structure !
+ {
+ userIdx = peerIdx;
+ }
+ zmw_leave_critical_section(dev);
+#endif
+ }
+ else if (wd->wlanMode == ZM_MODE_AP)
+ {
+ if (port < 0x20)
+ /* AP mode */
+ {
+ /* FromDS bit */
+ header[4] |= 0x0200;
+
+ /* Address 1 = DA */
+ header[6] = da[0];
+ header[7] = da[1];
+ header[8] = da[2];
+ /* Address 3 = SA */
+ header[12] = sa[0];
+ header[13] = sa[1];
+ header[14] = sa[2];
+
+ if (port < ZM_MAX_AP_SUPPORT)
+ {
+ vap = port;
+ header[14] += (vap<<8);
+ }
+ }
+ else
+ /* WDS port */
+ {
+ /* ToDS and FromDS bit */
+ header[4] |= 0x0300;
+
+ wdsPortId = port - 0x20;
+
+ /* Address 1 = RA */
+ header[6] = wd->ap.wds.macAddr[wdsPortId][0];
+ header[7] = wd->ap.wds.macAddr[wdsPortId][1];
+ header[8] = wd->ap.wds.macAddr[wdsPortId][2];
+ /* Address 3 = DA */
+ header[12] = da[0];
+ header[13] = da[1];
+ header[14] = da[2];
+ /* Address 4 = SA */
+ header[16] = sa[0];
+ header[17] = sa[1];
+ header[18] = sa[2];
+
+ hlen = 19;
+ }
+ } /* else if (wd->wlanMode == ZM_MODE_AP) */
+
+ /* Address 2 = TA */
+ header[9] = wd->macAddr[0];
+ header[10] = wd->macAddr[1];
+#ifdef ZM_VAPMODE_MULTILE_SSID
+ header[11] = wd->macAddr[2]; //Multiple SSID
+#else
+ header[11] = wd->macAddr[2] + (vap<<8); //VAP
+#endif
+
+ if ( (wd->wlanMode == ZM_MODE_IBSS) && (wd->XLinkMode) )
+ {
+ header[9] = sa[0];
+ header[10] = sa[1];
+ header[11] = sa[2];
+ }
+
+ /* Sequence Control */
+ header[15] = seq;
+
+
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ zfApGetStaTxRateAndQosType(dev, da, &phyCtrl, &qosType, &rateProbingFlag);
+ mt = (u16_t)(phyCtrl & 0x3);
+ mcs = (u16_t)((phyCtrl >> 16) & 0x3f);
+#if 1
+ //zfApGetStaQosType(dev, da, &qosType);
+
+ /* if DA == WME STA */
+ if (qosType == 1)
+ {
+ /* QoS data */
+ header[4] |= 0x0080;
+
+ /* QoS Control */
+ header[hlen] = up;
+ hlen += 1;
+ }
+#endif
+ }
+
+#if 0
+ //AGG Test Code
+ if (header[6] == 0x8000)
+ {
+ /* QoS data */
+ header[4] |= 0x0080;
+
+ /* QoS Control */
+ header[hlen] = 0;
+ hlen += 1;
+ }
+#endif
+
+ if (wd->wlanMode == ZM_MODE_AP) {
+ /* Todo: rate control here for qos field */
+ }
+ else {
+ /* Rate control */
+ zfStaGetTxRate(dev, da, &phyCtrl, &rateProbingFlag);
+ mt = (u16_t)(phyCtrl & 0x3);
+ mcs = (u16_t)((phyCtrl >> 16) & 0x3f);
+ }
+
+ if (wd->txMCS != 0xff)
+ {
+ /* fixed rate */
+ phyCtrl = ((u32_t)wd->txMCS<<16) + wd->txMT;
+ mcs = wd->txMCS;
+ mt = wd->txMT;
+ }
+
+ if (wd->enableAggregation)
+ {
+ /* force enable aggregation */
+ if (wd->enableAggregation==2 && !(header[6]&0x1))
+ {
+ /* QoS data */
+ header[4] |= 0x0080;
+
+ /* QoS Control */
+ header[hlen] = 0;
+ hlen += 1;
+ }
+ /* if wd->enableAggregation=1 => force disable */
+ /* if wd->enableAggregation=0 => auto */
+ }
+
+#ifdef ZM_ENABLE_AGGREGATION
+ /*
+ * aggregation control
+ */
+
+ /*
+ * QoS data
+ */
+ if (wd->wlanMode == ZM_MODE_AP) {
+ if (aggControl && mt == 2) {
+ if (wd->enableAggregation==0 && !(header[6]&0x1))
+ {
+ header[4] |= 0x0080;
+
+ /*
+ * QoS Control
+ */
+ header[hlen] = 0;
+ hlen += 1;
+ }
+ }
+ }
+#endif
+
+ // MSDU Length
+ len = zfwBufGetSize(dev, buf);
+
+ /* Generate control setting */
+ /* Backoff, Non-Burst and hardware duration */
+ macCtrl = 0x208;
+
+ /* ACK */
+ if ((header[6] & 0x1) == 0x1)
+ {
+ /* multicast frame : Set NO-ACK bit */
+ macCtrl |= 0x4;
+ }
+ else
+ {
+ /* unicast frame */
+ #if 0
+ // Enable RTS according to MPDU Lengths ( not MSDU Lengths )
+ if (len >= wd->rtsThreshold)
+ {
+ /* Enable RTS */
+ macCtrl |= 1;
+ }
+ #endif
+ }
+ /* VAP test code */
+ //macCtrl |= 0x4;
+
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ u8_t encryType;
+ u16_t iv16;
+ u32_t iv32;
+
+ /* Check whether this is a multicast frame */
+ if ((header[6] & 0x1) == 0x1)
+ {
+ /* multicast frame */
+ if (wd->ap.encryMode[vap] == ZM_TKIP)
+ {
+ wd->ap.iv16[vap]++;
+
+ if(wd->ap.iv16[vap] == 0)
+ {
+ wd->ap.iv32[vap]++;
+ }
+
+ b1 = (u8_t) (wd->ap.iv16[vap] >> 8);
+ b2 = (b1 | 0x20) & 0x7f;
+ header[hlen] = ((u16_t)b2 << 8) + b1;
+ b1 = (u8_t) wd->ap.iv16[vap];
+ b2 = 0x20 | (wd->ap.bcKeyIndex[vap] << 6);
+ header[hlen+1] = ((u16_t)b2 << 8) + b1;
+ header[hlen+2] = (u16_t) wd->ap.iv32[vap];
+ header[hlen+3] = (u16_t) (wd->ap.iv32[vap] >> 16);
+
+ //macCtrl |= 0x80;
+ macCtrl |= 0x40;
+ icvLen = 4;
+
+ /* set hardware MIC */
+ if ( (!(seq & 0xf))&&(!(flag & 0x4)) )
+ {
+ macCtrl |= 0x100;
+ plusLen += 8;
+ *micLen = 8;
+ }
+
+ header[4] |= 0x4000;
+ hlen += 4;
+ }
+ else if (wd->ap.encryMode[vap] == ZM_AES)
+ {
+ wd->ap.iv16[vap]++;
+
+ if(wd->ap.iv16[vap] == 0)
+ {
+ wd->ap.iv32[vap]++;
+ }
+
+ b1 = (u8_t) wd->ap.iv16[vap];
+ b2 = (u8_t) (wd->ap.iv16[vap] >> 8);
+ header[hlen] = ((u16_t)b2 << 8) + b1;
+ header[hlen+1] = 0x2000 | (wd->ap.bcKeyIndex[vap] << 14);
+ header[hlen+2] = (u16_t) (wd->ap.iv32[vap]);
+ header[hlen+3] = (u16_t) (wd->ap.iv32[vap] >> 16);
+
+ macCtrl |= 0xc0;
+ icvLen = 8; /* MIC */
+
+ header[4] |= 0x4000;
+ hlen += 4;
+ }
+ #ifdef ZM_ENABLE_CENC
+ else if (wd->ap.encryMode[vap] == ZM_CENC)
+ {
+ //u32_t txiv[4];
+
+ wd->ap.txiv[vap][0]++;
+
+ if (wd->ap.txiv[vap][0] == 0)
+ {
+ wd->ap.txiv[vap][1]++;
+ }
+
+ if (wd->ap.txiv[vap][1] == 0)
+ {
+ wd->ap.txiv[vap][2]++;
+ }
+
+ if (wd->ap.txiv[vap][2] == 0)
+ {
+ wd->ap.txiv[vap][3]++;
+ }
+
+ if (wd->ap.txiv[vap][3] == 0)
+ {
+ wd->ap.txiv[vap][0] = 0;
+ wd->ap.txiv[vap][1] = 0;
+ wd->ap.txiv[vap][2] = 0;
+ }
+
+ header[hlen] = (wd->ap.bcKeyIndex[vap] & 0x0001); /* For Key Id and reserved field */
+ header[hlen+1] = (u16_t)wd->ap.txiv[vap][0];
+ header[hlen+2] = (u16_t)(wd->ap.txiv[vap][0] >> 16);
+ header[hlen+3] = (u16_t)wd->ap.txiv[vap][1];
+ header[hlen+4] = (u16_t)(wd->ap.txiv[vap][1] >> 16);
+ header[hlen+5] = (u16_t)wd->ap.txiv[vap][2];
+ header[hlen+6] = (u16_t)(wd->ap.txiv[vap][2] >> 16);
+ header[hlen+7] = (u16_t)wd->ap.txiv[vap][3];
+ header[hlen+8] = (u16_t)(wd->ap.txiv[vap][3] >> 16);
+
+ macCtrl |= 0x80;
+ icvLen = 16; /* MIC */
+
+ header[4] |= 0x4000;
+ hlen += 9;
+ }
+ #endif //ZM_ENABLE_CENC
+ }
+ else
+ {
+ /* Get STA's encryption type */
+ zfApGetStaEncryType(dev, da, &encryType);
+
+ if (encryType == ZM_TKIP)
+ {
+ /* Get iv16 and iv32 */
+ zfApGetStaWpaIv(dev, da, &iv16, &iv32);
+
+ iv16++;
+ if (iv16 == 0)
+ {
+ iv32++;
+ }
+
+ b1 = (u8_t) (iv16 >> 8);
+ b2 = (b1 | 0x20) & 0x7f;
+ header[hlen] = ((u16_t)b2 << 8) + b1;
+ b1 = (u8_t) iv16;
+ b2 = 0x20;
+ header[hlen+1] = ((u16_t)b2 << 8) + b1;
+ header[hlen+2] = (u16_t) iv32;
+ header[hlen+3] = (u16_t) (iv32 >> 16);
+
+ //macCtrl |= 0x80;
+ macCtrl |= 0x40;
+ icvLen = 4;
+
+ /* set hardware MIC */
+ if ( (!(seq & 0xf))&&(!(flag & 0x4)) )
+ {
+ macCtrl |= 0x100;
+ plusLen += 8;
+ *micLen = 8;
+ }
+
+ header[4] |= 0x4000;
+ hlen += 4;
+
+ /* Set iv16 and iv32 */
+ zfApSetStaWpaIv(dev, da, iv16, iv32);
+ }
+ else if (encryType == ZM_AES)
+ {
+ /* Get iv16 and iv32 */
+ zfApGetStaWpaIv(dev, da, &iv16, &iv32);
+
+ iv16++;
+ if (iv16 == 0)
+ {
+ iv32++;
+ }
+
+ b1 = (u8_t) iv16;
+ b2 = (u8_t) (iv16 >> 8);
+ header[hlen] = ((u16_t)b2 << 8) + b1;
+ header[hlen+1] = 0x2000;
+ header[hlen+2] = (u16_t) (iv32);
+ header[hlen+3] = (u16_t) (iv32 >> 16);
+
+ macCtrl |= 0xc0;
+ icvLen = 8; /* MIC */
+
+ header[4] |= 0x4000;
+ hlen += 4;
+
+ /* Set iv16 and iv32 */
+ zfApSetStaWpaIv(dev, da, iv16, iv32);
+ }
+ #ifdef ZM_ENABLE_CENC
+ else if (encryType == ZM_CENC)
+ {
+ u32_t txiv[4];
+ u8_t keyIdx;
+
+ /* Get CENC TxIV */
+ zfApGetStaCencIvAndKeyIdx(dev, da, txiv, &keyIdx);
+
+ txiv[0] += 2;
+
+ if (txiv[0] == 0 || txiv[0] == 1)
+ {
+ txiv[1]++;
+ }
+
+ if (txiv[1] == 0)
+ {
+ txiv[2]++;
+ }
+
+ if (txiv[2] == 0)
+ {
+ txiv[3]++;
+ }
+
+ if (txiv[3] == 0)
+ {
+ txiv[0] = 0;
+ txiv[1] = 0;
+ txiv[2] = 0;
+ }
+
+ header[hlen] = (keyIdx & 0x0001); /* For Key Id and reserved field */
+ header[hlen+1] = (u16_t)txiv[0];
+ header[hlen+2] = (u16_t)(txiv[0] >> 16);
+ header[hlen+3] = (u16_t)txiv[1];
+ header[hlen+4] = (u16_t)(txiv[1] >> 16);
+ header[hlen+5] = (u16_t)txiv[2];
+ header[hlen+6] = (u16_t)(txiv[2] >> 16);
+ header[hlen+7] = (u16_t)txiv[3];
+ header[hlen+8] = (u16_t)(txiv[3] >> 16);
+
+ macCtrl |= 0x80;
+ icvLen = 16; /* MIC */
+
+ header[4] |= 0x4000;
+ hlen += 9;
+
+ /* Set CENC IV */
+ zfApSetStaCencIv(dev, da, txiv);
+ }
+ #endif //ZM_ENABLE_CENC
+ }
+
+ /* protection mode */
+ if (wd->ap.protectionMode == 1)
+ {
+ /* Enable Self-CTS */
+ macCtrl &= 0xFFFC;
+ macCtrl |= 2;
+ }
+
+ /* Rate Control */
+ if (port < 0x20)
+ {
+ /* AP */
+ /* IV */
+ if ((wd->ap.encryMode[vap] == ZM_WEP64) ||
+ (wd->ap.encryMode[vap] == ZM_WEP128) ||
+ (wd->ap.encryMode[vap] == ZM_WEP256))
+ {
+ header[4] |= 0x4000;
+ header[hlen] = 0x0; //IV
+ header[hlen+1] = wd->ap.bcKeyIndex[vap] << 14; //IV with Keyid--CWYang(m)
+ hlen += 2;
+ icvLen = 4;
+ macCtrl |= 0x40;
+ }
+ }
+ else
+ {
+ /* WDS */
+
+ /* TODO : Fixed rate to 54M */
+ phyCtrl = 0xc0001; //PHY control L
+
+ /* WDS port checking */
+ if ((wdsPort = (port - 0x20)) >= ZM_MAX_WDS_SUPPORT)
+ {
+ wdsPort = 0;
+ }
+
+ #if 1
+ /* IV */
+ switch (wd->ap.wds.encryMode[wdsPort])
+ {
+ case ZM_WEP64:
+ case ZM_WEP128:
+ case ZM_WEP256:
+ header[4] |= 0x4000;
+ header[hlen] = 0x0; //IV
+ header[hlen+1] = wd->ap.bcKeyIndex[vap] << 14; //IV with Keyid
+ hlen += 2;
+ icvLen = 4;
+ macCtrl |= 0x40;
+ break;
+
+ case ZM_TKIP:
+ wd->sta.iv16++;
+
+ if ( wd->sta.iv16 == 0 )
+ {
+ wd->sta.iv32++;
+ }
+
+ b1 = (u8_t) (wd->sta.iv16 >> 8);
+ b2 = (b1 | 0x20) & 0x7f;
+ header[hlen] = ((u16_t)b2 << 8) + b1;
+ b1 = (u8_t) wd->sta.iv16;
+ b2 = 0x20;
+ header[hlen+1] = ((u16_t)b2 << 8) + b1;
+ header[hlen+2] = (u16_t) wd->sta.iv32;
+ header[hlen+3] = (u16_t) (wd->sta.iv32 >> 16);
+
+ //macCtrl |= 0x80;
+ macCtrl |= 0x40;
+ icvLen = 4;
+
+ /* set hardware MIC */
+ if ( (!(seq & 0xf))&&(!(flag & 0x4)) )
+ {
+ macCtrl |= 0x100;
+ plusLen += 8;
+ *micLen = 8;
+ }
+
+ header[4] |= 0x4000;
+ hlen += 4;
+ break;
+
+ case ZM_AES:
+ wd->sta.iv16++;
+ if ( wd->sta.iv16 == 0 )
+ {
+ wd->sta.iv32++;
+ }
+
+ b1 = (u8_t) wd->sta.iv16;
+ b2 = (u8_t) (wd->sta.iv16 >> 8);
+ header[hlen] = ((u16_t)b2 << 8) + b1;
+ header[hlen+1] = 0x2000;
+ header[hlen+2] = (u16_t) (wd->sta.iv32);
+ header[hlen+3] = (u16_t) (wd->sta.iv32 >> 16);
+
+ macCtrl |= 0xc0; /* Set to AES in control setting */
+ icvLen = 8; /* MIC */
+
+ header[4] |= 0x4000; /* Set WEP bit in wlan header */
+ hlen += 4; /* plus IV length */
+ break;
+ }/* end of switch */
+ #endif
+ }
+ }
+ else /* wd->wlanMode != ZM_MODE_AP */
+ {
+ encExemptionActionType = zfwGetPktEncExemptionActionType(dev, buf);
+
+ if ( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ {
+ #if 1
+ /* if WME AP */
+ if (wd->sta.wmeConnected != 0)
+ {
+ /* QoS data */
+ header[4] |= 0x0080;
+
+ /* QoS Control */
+ header[hlen] = up;
+ hlen += 1;
+ }
+ #endif
+
+ if ( encExemptionActionType == ZM_ENCRYPTION_EXEMPT_NO_EXEMPTION )
+ {
+ if ( wd->sta.authMode < ZM_AUTH_MODE_WPA )
+ { /* non-WPA */
+ if ( wd->sta.wepStatus == ZM_ENCRYPTION_WEP_ENABLED )
+ {
+ if ( (wd->sta.encryMode == ZM_WEP64)||
+ (wd->sta.encryMode == ZM_WEP128)||
+ (wd->sta.encryMode == ZM_WEP256) )
+ {
+ header[4] |= 0x4000;
+ header[hlen] = 0x0; //IV
+ header[hlen+1] = 0x0; //IV
+ header[hlen+1] |= (((u16_t) wd->sta.keyId) << 14);
+ hlen += 2;
+ icvLen = 4;
+
+ /* For Software WEP */
+ if ((wd->sta.SWEncryptEnable & ZM_SW_WEP_ENCRY_EN) != 0)
+ {
+ u8_t keyLen = 5;
+ u8_t iv[3];
+
+ iv[0] = 0x0;
+ iv[1] = 0x0;
+ iv[2] = 0x0;
+
+ if (wd->sta.SWEncryMode[wd->sta.keyId] == ZM_WEP64)
+ {
+ keyLen = 5;
+ }
+ else if (wd->sta.SWEncryMode[wd->sta.keyId] == ZM_WEP128)
+ {
+ keyLen = 13;
+ }
+ else if (wd->sta.SWEncryMode[wd->sta.keyId] == ZM_WEP256)
+ {
+ keyLen = 29;
+ }
+
+ zfWEPEncrypt(dev, buf, (u8_t*) snap, snapLen, minusLen, keyLen,
+ wd->sta.wepKey[wd->sta.keyId], iv);
+ }
+ else
+ {
+ macCtrl |= 0x40;
+ }
+ }
+ }
+ }
+ else
+ { /* WPA */
+ if ( wd->sta.wpaState >= ZM_STA_WPA_STATE_PK_OK )
+ {
+ wd->sta.iv16++;
+ if ( wd->sta.iv16 == 0 )
+ {
+ wd->sta.iv32++;
+ }
+
+ /* set encryption mode */
+ if ( wd->sta.encryMode == ZM_TKIP )
+ {
+ b1 = (u8_t) (wd->sta.iv16 >> 8);
+ b2 = (b1 | 0x20) & 0x7f;
+ header[hlen] = ((u16_t)b2 << 8) + b1;
+ b1 = (u8_t) wd->sta.iv16;
+ b2 = 0x20;
+
+ // header[hlen+1] = (((u16_t) wd->sta.keyId) << 14) | (((u16_t)b2 << 8) + b1);
+ // STA in infrastructure mode should use keyId = 0 to transmit unicast !
+ header[hlen+1] = (((u16_t)b2 << 8) + b1);
+ header[hlen+2] = (u16_t) wd->sta.iv32;
+ header[hlen+3] = (u16_t) (wd->sta.iv32 >> 16);
+
+ /* If software encryption enable */
+ if ((wd->sta.SWEncryptEnable & ZM_SW_TKIP_ENCRY_EN) == 0)
+ {
+ //macCtrl |= 0x80;
+ /* TKIP same to WEP */
+ macCtrl |= 0x40;
+ icvLen = 4;
+
+ /* set hardware MIC */
+ if ( (!(seq & 0xf))&&(!(flag & 0x4)) )
+ {
+ macCtrl |= 0x100;
+ plusLen += 8;
+ *micLen = 8;
+ }
+ }
+ else
+ {
+ u8_t mic[8];
+ u16_t offset;
+ u32_t icv;
+ u8_t RC4Key[16];
+
+ /* TODO: Remove the criticial section here. */
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ /* Calculate MIC */
+ zfCalTxMic(dev, buf, (u8_t *)snap, snapLen, minusLen, da, sa, up, mic);
+
+ offset = zfwBufGetSize(dev, buf);
+
+ /* Append MIC to the buffer */
+ zfCopyToIntTxBuffer(dev, buf, mic, offset, 8);
+ zfwBufSetSize(dev, buf, offset+8);
+ zmw_leave_critical_section(dev);
+
+ /* TKIP Key Mixing */
+ zfTkipPhase1KeyMix(wd->sta.iv32, &wd->sta.txSeed);
+ zfTkipPhase2KeyMix(wd->sta.iv16, &wd->sta.txSeed);
+ zfTkipGetseeds(wd->sta.iv16, RC4Key, &wd->sta.txSeed);
+
+ /* Encrypt Data */
+ zfTKIPEncrypt(dev, buf, (u8_t *)snap, snapLen, minusLen, 16, RC4Key, &icv);
+
+ icvLen = 4;
+ len += 8;
+ }
+
+ header[4] |= 0x4000;
+ hlen += 4;
+ }
+ else if ( wd->sta.encryMode == ZM_AES )
+ {
+ b1 = (u8_t) wd->sta.iv16;
+ b2 = (u8_t) (wd->sta.iv16 >> 8);
+ header[hlen] = ((u16_t)b2 << 8) + b1;
+ // header[hlen+1] = (((u16_t) wd->sta.keyId) << 14) | (0x2000);
+ // STA in infrastructure mode should use keyId = 0 to transmit unicast !
+ header[hlen+1] = 0x2000;
+ header[hlen+2] = (u16_t) (wd->sta.iv32);
+ header[hlen+3] = (u16_t) (wd->sta.iv32 >> 16);
+
+ macCtrl |= 0xc0;
+ icvLen = 8; /* MIC */
+
+ header[4] |= 0x4000;
+ hlen += 4;
+ }
+ #ifdef ZM_ENABLE_CENC
+ else if ( wd->sta.encryMode == ZM_CENC )
+ {
+ /* Accumlate the PN sequence */
+ wd->sta.txiv[0] += 2;
+
+ if (wd->sta.txiv[0] == 0 || wd->sta.txiv[0] == 1)
+ {
+ wd->sta.txiv[1]++;
+ }
+
+ if (wd->sta.txiv[1] == 0)
+ {
+ wd->sta.txiv[2]++;
+ }
+
+ if (wd->sta.txiv[2] == 0)
+ {
+ wd->sta.txiv[3]++;
+ }
+
+ if (wd->sta.txiv[3] == 0)
+ {
+ wd->sta.txiv[0] = 0;
+ wd->sta.txiv[1] = 0;
+ wd->sta.txiv[2] = 0;
+ }
+
+ header[hlen] = (wd->sta.cencKeyId & 0x0001); /* For Key Id and reserved field */
+ header[hlen+1] = (u16_t) wd->sta.txiv[0];
+ header[hlen+2] = (u16_t) (wd->sta.txiv[0] >> 16);
+ header[hlen+3] = (u16_t) wd->sta.txiv[1];
+ header[hlen+4] = (u16_t) (wd->sta.txiv[1] >> 16);
+ header[hlen+5] = (u16_t) wd->sta.txiv[2];
+ header[hlen+6] = (u16_t) (wd->sta.txiv[2] >> 16);
+ header[hlen+7] = (u16_t) wd->sta.txiv[3];
+ header[hlen+8] = (u16_t) (wd->sta.txiv[3] >> 16);
+
+ macCtrl |= 0x80;
+ icvLen = 16; /* MIC */
+
+ header[4] |= 0x4000;
+ hlen += 9;
+ }
+ #endif //ZM_ENABLE_CENC
+ }
+ }
+ } // if ( encExemptionActionType == ZM_ENCRYPTION_EXEMPT_NO_EXEMPTION )
+ } /* if ( wd->wlanMode != ZM_MODE_INFRASTRUCTURE ) */
+
+ if ( wd->wlanMode == ZM_MODE_IBSS )
+ {
+ if ( encExemptionActionType == ZM_ENCRYPTION_EXEMPT_NO_EXEMPTION )
+ {
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ if( wd->sta.oppositeInfo[userIdx].wpaState >= ZM_STA_WPA_STATE_PK_OK || wd->sta.wpaState >= ZM_STA_WPA_STATE_PK_OK)
+ {
+ int isUnicast = 1 ;
+
+ if((da[0]& 0x1))
+ {
+ isUnicast = 0 ; // Not unicast , is broadcast
+ }
+
+ if( wd->sta.ibssWpa2Psk == 1 )
+ { /* The IV order is not the same between unicast and broadcast ! */
+ if ( isUnicast )
+ {
+ iv16 = &wd->sta.oppositeInfo[userIdx].iv16;
+ iv32 = &wd->sta.oppositeInfo[userIdx].iv32;
+ }
+ else
+ {
+ iv16 = &wd->sta.iv16;
+ iv32 = &wd->sta.iv32;
+ }
+ }
+ else
+ {
+ iv16 = &wd->sta.iv16;
+ iv32 = &wd->sta.iv32;
+ }
+
+ (*iv16)++;
+ if ( *iv16 == 0 )
+ {
+ *iv32++;
+ }
+
+ if ( wd->sta.oppositeInfo[userIdx].encryMode == ZM_AES || wd->sta.encryMode == ZM_AES)
+ {
+ //printk("Station encryption mode is AES-CCMP\n") ;
+ b1 = (u8_t) (*iv16);
+ b2 = (u8_t) ((*iv16) >> 8);
+ header[hlen] = ((u16_t)b2 << 8) + b1;
+
+ if ( isUnicast )
+ {
+ header[hlen+1] = 0x2000;
+ }
+ else
+ {
+ header[hlen+1] = 0x2000 | (((u16_t) wd->sta.keyId) << 14);
+ }
+
+ header[hlen+2] = (u16_t) (*iv32);
+ header[hlen+3] = (u16_t) ((*iv32) >> 16);
+ macCtrl |= 0xc0;
+ icvLen = 8; /* MIC */
+ }
+
+ header[4] |= 0x4000;
+ hlen += 4;
+ }
+ else if ( wd->sta.wepStatus == ZM_ENCRYPTION_WEP_ENABLED)
+ {
+ if ( (wd->sta.encryMode == ZM_WEP64)||
+ (wd->sta.encryMode == ZM_WEP128)||
+ (wd->sta.encryMode == ZM_WEP256) )
+ {
+ header[4] |= 0x4000;
+ header[hlen] = 0x0; //IV
+ header[hlen+1] = 0x0; //IV
+ header[hlen+1] |= (((u16_t) wd->sta.keyId) << 14);
+ hlen += 2;
+ icvLen = 4;
+ macCtrl |= 0x40;
+ }
+ }
+#else
+ /* ----- 20070405 add by Mxzeng ----- */
+ if( wd->sta.wpaState >= ZM_STA_WPA_STATE_PK_OK )
+ {
+ int isUnicast = 1 ;
+
+ if((da[0]& 0x1))
+ {
+ isUnicast = 0 ; // Not unicast , is broadcast
+ }
+
+ wd->sta.iv16++;
+ if ( wd->sta.iv16 == 0 )
+ {
+ wd->sta.iv32++;
+ }
+
+ if ( wd->sta.encryMode == ZM_AES )
+ {
+ //printk("Station encryption mode is AES-CCMP\n") ;
+ b1 = (u8_t) wd->sta.iv16;
+ b2 = (u8_t) (wd->sta.iv16 >> 8);
+ header[hlen] = ((u16_t)b2 << 8) + b1;
+
+ if ( isUnicast )
+ {
+ header[hlen+1] = 0x2000;
+ }
+ else
+ {
+ header[hlen+1] = 0x2000 | (((u16_t) wd->sta.keyId) << 14);
+ }
+
+ header[hlen+2] = (u16_t) (wd->sta.iv32);
+ header[hlen+3] = (u16_t) (wd->sta.iv32 >> 16);
+ macCtrl |= 0xc0;
+ icvLen = 8; /* MIC */
+ }
+
+ header[4] |= 0x4000;
+ hlen += 4;
+ }
+ else if ( wd->sta.wepStatus == ZM_ENCRYPTION_WEP_ENABLED)
+ {
+ if ( (wd->sta.encryMode == ZM_WEP64)||
+ (wd->sta.encryMode == ZM_WEP128)||
+ (wd->sta.encryMode == ZM_WEP256) )
+ {
+ header[4] |= 0x4000;
+ header[hlen] = 0x0; //IV
+ header[hlen+1] = 0x0; //IV
+ header[hlen+1] |= (((u16_t) wd->sta.keyId) << 14);
+ hlen += 2;
+ icvLen = 4;
+ macCtrl |= 0x40;
+ }
+ }
+#endif
+ } // End if ( encExemptionActionType == ZM_ENCRYPTION_EXEMPT_NO_EXEMPTION )
+ } // End if ( wd->wlanMode == ZM_MODE_IBSS )
+ else if ( wd->wlanMode == ZM_MODE_PSEUDO )
+ {
+ switch (wd->sta.encryMode)
+ {
+ case ZM_WEP64:
+ case ZM_WEP128:
+ case ZM_WEP256:
+ header[4] |= 0x4000;
+ header[hlen] = 0x0; //IV
+ header[hlen+1] = 0x0; //IV
+ hlen += 2;
+ icvLen = 4;
+ macCtrl |= 0x40;
+ break;
+
+ case ZM_TKIP:
+ {
+ wd->sta.iv16++;
+ if ( wd->sta.iv16 == 0 )
+ {
+ wd->sta.iv32++;
+ }
+
+ b1 = (u8_t) (wd->sta.iv16 >> 8);
+ b2 = (b1 | 0x20) & 0x7f;
+ header[hlen] = ((u16_t)b2 << 8) + b1;
+ b1 = (u8_t) wd->sta.iv16;
+ b2 = 0x20;
+ header[hlen+1] = ((u16_t)b2 << 8) + b1;
+ header[hlen+2] = (u16_t) wd->sta.iv32;
+ header[hlen+3] = (u16_t) (wd->sta.iv32 >> 16);
+
+ //macCtrl |= 0x80;
+ macCtrl |= 0x40;
+ icvLen = 4;
+
+ /* set hardware MIC */
+ if ( (!(seq & 0xf))&&(!(flag & 0x4)) )
+ {
+ macCtrl |= 0x100;
+ plusLen += 8;
+ *micLen = 8;
+ }
+
+ header[4] |= 0x4000;
+ hlen += 4;
+ }/* end of PSEUDO TKIP */
+ break;
+
+ case ZM_AES:
+ {
+ wd->sta.iv16++;
+ if ( wd->sta.iv16 == 0 )
+ {
+ wd->sta.iv32++;
+ }
+
+ b1 = (u8_t) wd->sta.iv16;
+ b2 = (u8_t) (wd->sta.iv16 >> 8);
+ header[hlen] = ((u16_t)b2 << 8) + b1;
+ header[hlen+1] = 0x2000;
+ header[hlen+2] = (u16_t) (wd->sta.iv32);
+ header[hlen+3] = (u16_t) (wd->sta.iv32 >> 16);
+ macCtrl |= 0xc0;
+ icvLen = 8; /* MIC */
+ header[4] |= 0x4000;
+ hlen += 4;
+ }/* end of PSEUDO AES */
+ break;
+
+ #ifdef ZM_ENABLE_CENC
+ case ZM_CENC:
+ /* Accumlate the PN sequence */
+ wd->sta.txiv[0] += 2;
+
+ if (wd->sta.txiv[0] == 0 || wd->sta.txiv[0] == 1)
+ {
+ wd->sta.txiv[1]++;
+ }
+
+ if (wd->sta.txiv[1] == 0)
+ {
+ wd->sta.txiv[2]++;
+ }
+
+ if (wd->sta.txiv[2] == 0)
+ {
+ wd->sta.txiv[3]++;
+ }
+
+ if (wd->sta.txiv[3] == 0)
+ {
+ wd->sta.txiv[0] = 0;
+ wd->sta.txiv[1] = 0;
+ wd->sta.txiv[2] = 0;
+ }
+
+ header[hlen] = 0;
+ header[hlen+1] = (u16_t) wd->sta.txiv[0];
+ header[hlen+2] = (u16_t) (wd->sta.txiv[0] >> 16);
+ header[hlen+3] = (u16_t) wd->sta.txiv[1];
+ header[hlen+4] = (u16_t) (wd->sta.txiv[1] >> 16);
+ header[hlen+5] = (u16_t) wd->sta.txiv[2];
+ header[hlen+6] = (u16_t) (wd->sta.txiv[2] >> 16);
+ header[hlen+7] = (u16_t) wd->sta.txiv[3];
+ header[hlen+8] = (u16_t) (wd->sta.txiv[3] >> 16);
+
+ macCtrl |= 0x80;
+ icvLen = 16; /* MIC */
+
+ header[4] |= 0x4000;
+ hlen += 9;
+ break;
+ #endif //ZM_ENABLE_CENC
+ }/* end of switch */
+ }
+
+ /* Generate control setting */
+
+ /* protection mode */
+ if (wd->enableProtectionMode)
+ {
+ if (wd->enableProtectionMode==2)
+ {
+ /* Force enable protection: self cts */
+ macCtrl &= 0xFFFC;
+ macCtrl |= 2;
+ }
+ /* if wd->enableProtectionMode=1 => force disable */
+ /* if wd->enableProtectionMode=0 => auto */
+ }
+ else
+ {
+
+ /* protection mode */
+ if (wd->sta.bProtectionMode == TRUE)
+ {
+ /* Enable Self-CTS */
+ macCtrl &= 0xFFFC;
+ macCtrl |= 2;
+ }
+ }
+
+ }
+
+ if (wd->txMCS != 0xff)
+ {
+ /* fixed rate */
+ phyCtrl = ((u32_t)wd->txMCS<<16) + wd->txMT;
+ mcs = wd->txMCS;
+ mt = wd->txMT;
+ }
+
+ if (mt == 2)
+ {
+#if 0
+ /* HT PT: 0 Mixed mode 1 Green field */
+ if (wd->sta.preambleTypeHT == ZM_PREAMBLE_TYPE_GREEN_FIELD)
+ {
+ phyCtrl |= 0x4; /* Bit 2 */
+ }
+#endif
+ /* Bandwidth */
+ if (wd->sta.htCtrlBandwidth == ZM_BANDWIDTH_40MHZ)
+ {
+ phyCtrl |= (0x80<<16); /* BIT 23 */
+ }
+#if 0
+ /* STBC */
+ if (wd->sta.htCtrlSTBC<=0x3)
+ {
+ phyCtrl |= (wd->sta.htCtrlSTBC<<28); /* BIT 23 */
+ }
+#endif
+ /* Short GI */
+ if(wd->sta.htCtrlSG)
+ {
+ phyCtrl |= (0x8000<<16); /* BIT 31 */
+ }
+
+ /* TA */
+ if ( ((mcs >=0x8) && (mcs<=0xf)) || (wd->sta.htCtrlSTBC) )
+ {
+ phyCtrl |= 0x1800; /* BIT 11 12 */
+ }
+ }
+ else if(mt == 1)
+ {
+ #if 0
+ //bug that cause OFDM rate become duplicate legacy rate
+ /* Bandwidth */
+ if (wd->sta.htCtrlBandwidth == ZM_BANDWIDTH_40MHZ)
+ {
+ phyCtrl |= (0x80<<16); /* BIT 23 */
+ mt = 3; /* duplicate legacy */
+ phyCtrl |= mt;
+ }
+ #endif
+ }
+ else if(mt == 0)
+ {
+ /* CCK PT: Legcy Preamble: 1 long preamble 2 short preamble */
+ if (wd->preambleTypeInUsed == ZM_PREAMBLE_TYPE_SHORT)
+ {
+ //phyCtrl |= 0x4; /* BIT 2 */
+ }
+ }
+
+ /* TA */
+ if (wd->sta.defaultTA)
+ {
+ phyCtrl |= 0x1000;
+ }
+ else
+ {
+ phyCtrl |= 0x0800;
+ }
+
+ //Get CurrentTxRate -- CWYang(+)
+ if ((mt == 0) || (mt == 1)) //B,G Rate
+ {
+ if (mcs < 16)
+ {
+ wd->CurrentTxRateKbps = zcIndextoRateBG[mcs];
+ }
+ }
+ else if (mt == 2)
+ {
+ if (mcs < 16)
+ {
+ if (wd->sta.htCtrlBandwidth == ZM_BANDWIDTH_40MHZ)
+ {
+ if((phyCtrl & 0x80000000) != 0)
+ {
+ /* Short GI 40 MHz MIMO Rate */
+ wd->CurrentTxRateKbps = zcIndextoRateN40S[mcs];
+ }
+ else
+ {
+ /* Long GI 40 MHz MIMO Rate */
+ wd->CurrentTxRateKbps = zcIndextoRateN40L[mcs];
+ }
+ }
+ else
+ {
+ if((phyCtrl & 0x80000000) != 0)
+ {
+ /* Short GI 20 MHz MIMO Rate */
+ wd->CurrentTxRateKbps = zcIndextoRateN20S[mcs];
+ }
+ else
+ {
+ /* Long GI 20 MHz MIMO Rate */
+ wd->CurrentTxRateKbps = zcIndextoRateN20L[mcs];
+ }
+ }
+ }
+ }
+
+ //802.11 header(include IV) = (hlen<<1)-8
+ //ethernet frame = len
+ //snap + mic = plusLen
+ //ethernet header = minusLen
+ //icv = icvLen
+ //crc32 = 4
+ //length=802.11 header+snap+(ethernet frame-ethernet header)+mic+icv+crc32
+ header[0] = ((hlen<<1)-8)+plusLen+(len-minusLen)+icvLen+4; //Length
+
+ // header[0] : MPDU Lengths
+ if ((header[6] & 0x1) != 0x1) // Unicast Frame
+ {
+ if (header[0] >= wd->rtsThreshold)
+ {
+ /* Enable RTS */
+ macCtrl |= 1;
+ }
+ }
+
+ if ( wd->sta.encryMode == ZM_TKIP )
+ tkipFrameOffset = 8;
+
+ if( wd->sta.EnableHT != 1 )
+ { // Aggregation should not be fragmented !
+ if ( header[0] > ( wd->fragThreshold + tkipFrameOffset ) )
+ {
+ return 0; // Need to be fragmented ! !
+ }
+ }
+
+ //if ( wd->sta.encryMode == ZM_TKIP )
+ //{
+ // zm_debug_msg1("ctrl length = ", header[0]);
+ //}
+
+ //MAC control
+ if (rateProbingFlag != 0)
+ {
+ macCtrl |= 0x8000;
+ }
+ header[1] = macCtrl;
+ //PHY control L
+ header[2] = (u16_t) ((phyCtrl&0xffff) | 0x700 | (zcUpToAc[up&0x7]<<13));
+ //PHY control H
+ header[3] = (u16_t) ((phyCtrl>>16) | 0x700);
+
+ if (wd->enableAggregation)
+ {
+ /* force enable aggregation */
+ if (wd->enableAggregation==2 && !(header[6]&0x1))
+ {
+ if (((header[2] & 0x3) == 2))
+ {
+ /* Enable aggregation */
+ header[1] |= 0x20;
+ }
+ }
+ /* if wd->enableAggregation=1 => force disable */
+ /* if wd->enableAggregation=0 => auto */
+ }
+
+#ifdef ZM_ENABLE_AGGREGATION
+ if (wd->addbaComplete) {
+ #ifdef ZM_BYPASS_AGGR_SCHEDULING
+ if (!(header[6]&0x1) && !rateProbingFlag && (wd->enableAggregation != 1))
+ {
+ if (((header[2] & 0x3) == 2))
+ {
+ /* Unicast frame with HT rate => Enable aggregation */
+ /* We only support software encryption in single packet mode */
+ if ((wd->sta.SWEncryptEnable & ZM_SW_TKIP_ENCRY_EN) == 0 &&
+ (wd->sta.SWEncryptEnable & ZM_SW_WEP_ENCRY_EN) == 0)
+ {
+ /* Set aggregation group bits per AC */
+ header[1] |= (0x20 | (zcUpToAc[up&0x7]<<10));
+
+ //if (wd->sta.currentFrequency < 3000)
+ {
+ /* issue: -PB42 Enable RTS/CTS to prevent OWL Tx hang up */
+ /* If this is Owl Ap, enable RTS/CTS protect */
+ if ( (wd->sta.athOwlAp == 1) || (wd->sta.RTSInAGGMode == TRUE) )
+ {
+ header[1] &= 0xfffc;
+ header[1] |= 0x1;
+ }
+
+ /* Enable RIFS : workaround 854T RTS/CTS */
+ /* Bit13 : TI enable RIFS */
+ //header[1] |= 0x2000;
+ }
+ }
+ }
+ }
+ #else
+ /*
+ * aggregation ampduIndication control
+ */
+ if (aggControl && aggControl->aggEnabled) {
+ if (wd->enableAggregation==0 && !(header[6]&0x1))
+ {
+ if (((header[2] & 0x3) == 2))
+ {
+ /* Enable aggregation */
+ header[1] |= 0x20;
+ if (ZM_AGG_LAST_MPDU == aggControl->ampduIndication)
+ header[1] |= 0x4000;
+ }
+ else {
+ zm_debug_msg1("no aggr, header[2]&0x3 = ",header[2] & 0x3)
+ aggControl->aggEnabled = 0;
+ }
+ }
+ else {
+ zm_debug_msg1("no aggr, wd->enableAggregation = ", wd->enableAggregation);
+ zm_debug_msg1("no aggr, !header[6]&0x1 = ",!(header[6]&0x1));
+ aggControl->aggEnabled = 0;
+ }
+ }
+ #endif
+
+ #ifdef ZM_AGGR_BIT_ON
+ if (!(header[6]&0x1) && !rateProbingFlag)
+ {
+ if (((header[2] & 0x3) == 2))
+ {
+ /* Unicast frame with HT rate => Enable aggregation */
+ /* Set aggregation group bits per AC */
+ header[1] |= (0x20 | (zcUpToAc[up&0x7]<<10));
+
+ //if (wd->sta.currentFrequency < 3000)
+ {
+ /* Enable RTS/CTS to prevent OWL Tx hang up */
+ header[1] &= 0xfffc;
+ header[1] |= 0x1;
+ }
+ }
+ }
+ #endif
+ }
+#endif
+
+ return (hlen<<1);
+}
+
+
+u16_t zfTxGenMmHeader(zdev_t* dev, u8_t frameType, u16_t* dst,
+ u16_t* header, u16_t len, zbuf_t* buf, u16_t vap, u8_t encrypt)
+{
+ //u16_t bodyLen;
+ u8_t hlen = 32; // MAC ctrl + PHY ctrl + 802.11 MM header
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ /* Generate control setting */
+ //bodyLen = zfwBufGetSize(dev, buf);
+ header[0] = 24+len+4; //Length
+ if ((dst[0] & 0x1) != 0) //Broadcast, multicast frames
+ {
+ header[1] = 0xc; //MAC control, backoff + noack
+ }
+ else
+ {
+ header[1] = 0x8; //MAC control, backoff + (ack)
+ }
+ /* Dualband Management frame tx Rate */
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ if (wd->frequency < 3000)
+ {
+ /* CCK 1M */
+ header[2] = 0x0f00; //PHY control L
+ header[3] = 0x0000; //PHY control H
+ }
+ else
+ {
+ /* CCK 6M */
+ header[2] = 0x0f01; //PHY control L
+ header[3] = 0x000B; //PHY control H
+ }
+ }
+ else
+ {
+ if (wd->sta.currentFrequency < 3000)
+ {
+ /* CCK 2M */
+ header[2] = 0x0f00; //PHY control L
+ header[3] = 0x0001; //PHY control H
+ }
+ else
+ {
+ /* CCK 6M */
+ header[2] = 0x0f01; //PHY control L
+ header[3] = 0x000B; //PHY control H
+ }
+ }
+ /* Generate WLAN header */
+ /* Frame control */
+ header[4+0] = frameType;
+ /* Duration */
+ header[4+1] = 0;
+
+ if (wd->wlanMode == ZM_MODE_INFRASTRUCTURE)
+ {
+ if ( frameType == ZM_WLAN_FRAME_TYPE_PROBEREQ )
+ {
+ header[4+8] = 0xFFFF;
+ header[4+9] = 0xFFFF;
+ header[4+10] = 0xFFFF;
+ }
+ else if ( frameType == ZM_WLAN_FRAME_TYPE_BA ) {
+ /* do nothing */
+ }
+ else
+ {
+ header[4+8] = wd->sta.bssid[0];
+ header[4+9] = wd->sta.bssid[1];
+ header[4+10] = wd->sta.bssid[2];
+ }
+ }
+ else if (wd->wlanMode == ZM_MODE_PSEUDO)
+ {
+ /* Address 3 = 00:00:00:00:00:00 */
+ header[4+8] = 0;
+ header[4+9] = 0;
+ header[4+10] = 0;
+ }
+ else if (wd->wlanMode == ZM_MODE_IBSS)
+ {
+ header[4+8] = wd->sta.bssid[0];
+ header[4+9] = wd->sta.bssid[1];
+ header[4+10] = wd->sta.bssid[2];
+
+ if ( frameType == ZM_WLAN_FRAME_TYPE_ATIM )
+ {
+ /* put ATIM to queue 5th */
+ //header[2] |= (ZM_BIT_13|ZM_BIT_14);
+ header[2] |= ZM_BIT_15;
+ }
+ }
+ else if (wd->wlanMode == ZM_MODE_AP)
+ {
+ /* Address 3 = BSSID */
+ header[4+8] = wd->macAddr[0];
+ header[4+9] = wd->macAddr[1];
+#ifdef ZM_VAPMODE_MULTILE_SSID
+ header[4+10] = wd->macAddr[2]; //Multiple SSID
+#else
+ header[4+10] = wd->macAddr[2] + (vap<<8); //VAP
+#endif
+ //if in scan, must set address 3 to broadcast because of some ap would care this
+ //if ((wd->heartBeatNotification & ZM_BSSID_LIST_SCAN)
+ // == ZM_BSSID_LIST_SCAN)
+ //if FrameType is Probe Request, Address3 should be boradcast
+ if (frameType == ZM_WLAN_FRAME_TYPE_PROBEREQ)
+ {
+ header[4+8] = 0xFFFF;
+ header[4+9] = 0xFFFF;
+ header[4+10] = 0xFFFF;
+ }
+ }
+
+ /* Address 1 = DA */
+ header[4+2] = dst[0];
+ header[4+3] = dst[1];
+ header[4+4] = dst[2];
+
+ /* Address 2 = SA */
+ header[4+5] = wd->macAddr[0];
+ header[4+6] = wd->macAddr[1];
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+#ifdef ZM_VAPMODE_MULTILE_SSID
+ header[4+7] = wd->macAddr[2]; //Multiple SSID
+#else
+ header[4+7] = wd->macAddr[2] + (vap<<8); //VAP
+#endif
+ }
+ else
+ {
+ header[4+7] = wd->macAddr[2];
+ }
+
+ /* Sequence Control */
+ zmw_enter_critical_section(dev);
+ header[4+11] = ((wd->mmseq++)<<4);
+ zmw_leave_critical_section(dev);
+
+ if( frameType == ZM_WLAN_FRAME_TYPE_QOS_NULL )
+ {
+ /*Qos Control*/
+ header[4+12] = 0x0;
+ hlen+=2;
+ header[0]+=2;
+ }
+
+ if ( encrypt )
+ {
+ if ( wd->sta.wepStatus == ZM_ENCRYPTION_WEP_ENABLED )
+ {
+ if ( (wd->sta.encryMode == ZM_WEP64)||
+ (wd->sta.encryMode == ZM_WEP128)||
+ (wd->sta.encryMode == ZM_WEP256) )
+ {
+ header[4] |= 0x4000;
+ header[16] = 0x0; //IV
+ header[17] = 0x0; //IV
+ header[17] |= (((u16_t) wd->sta.keyId) << 14);
+ hlen += 4;
+
+ header[0] += 8; // icvLen = 4;
+ header[1] |= 0x40; // enable encryption on macCtrl
+ }
+ }
+ }
+
+ // Enable HW duration
+ if ( frameType != ZM_WLAN_FRAME_TYPE_PSPOLL )
+ {
+ header[1] |= 0x200;
+ }
+
+ return hlen;
+}
+
+void zfInitMacApMode(zdev_t* dev)
+{
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ zfHpEnableBeacon(dev, ZM_MODE_AP, (wd->beaconInterval/wd->ap.vapNumber), 1, 0);
+
+ /* AP mode */
+ zfHpSetApStaMode(dev, ZM_HAL_80211_MODE_AP);
+
+ /* VAP test code */
+ /* AP + VAP mode */
+ if (wd->ap.vapNumber >= 2)
+ {
+ for (i=1; i<ZM_MAX_AP_SUPPORT; i++)
+ {
+ if (((wd->ap.apBitmap >> i) & 0x1) != 0)
+ {
+ u16_t mac[3];
+ mac[0] = wd->macAddr[0];
+ mac[1] = wd->macAddr[1];
+#ifdef ZM_VAPMODE_MULTILE_SSID
+ mac[2] = wd->macAddr[2]; //Multiple SSID
+#else
+ mac[2] = wd->macAddr[2] + (i<<8); //VAP
+#endif
+ zfHpSetMacAddress(dev, mac, i);
+
+ }
+ }
+ }
+
+ /* basic rate setting */
+ zfHpSetBasicRateSet(dev, wd->bRateBasic, wd->gRateBasic);
+
+ /* Set TxQs CWMIN, CWMAX, AIFS and TXO to WME AP default. */
+ zfUpdateDefaultQosParameter(dev, 1);
+
+ return;
+}
+
+u16_t zfChGetNextChannel(zdev_t* dev, u16_t frequency, u8_t* pbPassive)
+{
+ u8_t i;
+ u8_t bPassive;
+
+ zmw_get_wlan_dev(dev);
+
+ /* Avoid NULL value */
+ if ( pbPassive == NULL )
+ {
+ pbPassive = &bPassive;
+ }
+
+ for( i=0; i<wd->regulationTable.allowChannelCnt; i++ )
+ {
+ if ( wd->regulationTable.allowChannel[i].channel == frequency )
+ {
+ if ( i == (wd->regulationTable.allowChannelCnt-1) )
+ {
+ i = 0;
+ }
+ else
+ {
+ i++;
+ }
+
+ if ( wd->regulationTable.allowChannel[i].channelFlags
+ & ZM_REG_FLAG_CHANNEL_PASSIVE )
+ {
+ *pbPassive = TRUE;
+ }
+ else
+ {
+ *pbPassive = FALSE;
+ }
+
+ return wd->regulationTable.allowChannel[i].channel;
+ }
+ }
+
+ return 0xffff;
+}
+
+u16_t zfChGetFirstChannel(zdev_t* dev, u8_t* pbPassive)
+{
+ u8_t bPassive;
+
+ zmw_get_wlan_dev(dev);
+
+ /* Avoid NULL value */
+ if ( pbPassive == NULL )
+ {
+ pbPassive = &bPassive;
+ }
+
+ if ( wd->regulationTable.allowChannel[0].channelFlags & ZM_REG_FLAG_CHANNEL_PASSIVE )
+ {
+ *pbPassive = TRUE;
+ }
+ else
+ {
+ *pbPassive = FALSE;
+ }
+
+ return wd->regulationTable.allowChannel[0].channel;
+}
+
+u16_t zfChGetFirst2GhzChannel(zdev_t* dev)
+{
+ u8_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ for( i=0; i<wd->regulationTable.allowChannelCnt; i++ )
+ {
+ if ( wd->regulationTable.allowChannel[i].channel < 3000 )
+ {
+ /* find the first 2Ghz channel */
+ return wd->regulationTable.allowChannel[i].channel;
+ }
+ }
+
+ /* Can not find any 2Ghz channel */
+ return 0;
+}
+
+u16_t zfChGetFirst5GhzChannel(zdev_t* dev)
+{
+ u8_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ for( i=0; i<wd->regulationTable.allowChannelCnt; i++ )
+ {
+ if ( wd->regulationTable.allowChannel[i].channel > 3000 )
+ {
+ /* find the first 5Ghz channel */
+ return wd->regulationTable.allowChannel[i].channel;
+ }
+ }
+
+ /* Can not find any 5Ghz channel */
+ return 0;
+}
+
+u16_t zfChGetLastChannel(zdev_t* dev, u8_t* pbPassive)
+{
+ u8_t bPassive;
+ u8_t ChannelIndex;
+
+ zmw_get_wlan_dev(dev);
+
+ ChannelIndex = wd->regulationTable.allowChannelCnt-1;
+
+ /* Avoid NULL value */
+ if ( pbPassive == NULL )
+ {
+ pbPassive = &bPassive;
+ }
+
+ if ( wd->regulationTable.allowChannel[ChannelIndex].channelFlags
+ & ZM_REG_FLAG_CHANNEL_PASSIVE )
+ {
+ *pbPassive = TRUE;
+ }
+ else
+ {
+ *pbPassive = FALSE;
+ }
+
+ return wd->regulationTable.allowChannel[ChannelIndex].channel;
+}
+
+u16_t zfChGetLast5GhzChannel(zdev_t* dev)
+{
+ u8_t i;
+ u16_t last5Ghzfrequency;
+
+ zmw_get_wlan_dev(dev);
+
+ last5Ghzfrequency = 0;
+ for( i=0; i<wd->regulationTable.allowChannelCnt; i++ )
+ {
+ if ( wd->regulationTable.allowChannel[i].channel > 3000 )
+ {
+ last5Ghzfrequency = wd->regulationTable.allowChannel[i].channel;
+ }
+ }
+
+ return last5Ghzfrequency;
+}
+
+/* freqBand = 0 => auto check */
+/* = 1 => 2.4 GHz band */
+/* = 2 => 5 GHz band */
+u16_t zfChNumToFreq(zdev_t* dev, u8_t ch, u8_t freqBand)
+{
+ u16_t freq = 0xffff;
+
+ if ( freqBand == 0 )
+ {
+ if (ch > 14)
+ { /* adapter is at 5 GHz band */
+ freqBand = 2;
+ }
+ else
+ {
+ freqBand = 1;
+ }
+ }
+
+ if ( freqBand == 2 )
+ { /* the channel belongs to 5 GHz band */
+ if ( (ch >= 184)&&(ch <= 196) )
+ {
+ freq = 4000 + ch*5;
+ }
+ else
+ {
+ freq = 5000 + ch*5;
+ }
+ }
+ else
+ { /* the channel belongs to 2.4 GHz band */
+ if ( ch == 14 )
+ {
+ freq = ZM_CH_G_14;
+ }
+ else
+ {
+ freq = ZM_CH_G_1 + (ch-1)*5;
+ }
+ }
+
+ return freq;
+}
+
+u8_t zfChFreqToNum(u16_t freq, u8_t* pbIs5GBand)
+{
+ u8_t ch;
+ u8_t Is5GBand;
+
+ /* to avoid NULL value */
+ if ( pbIs5GBand == NULL )
+ {
+ pbIs5GBand = &Is5GBand;
+ }
+
+ *pbIs5GBand = FALSE;
+
+ if ( freq == ZM_CH_G_14 )
+ {
+ ch = 14;
+ }
+ else if ( freq < 4000 )
+ {
+ ch = (freq - ZM_CH_G_1) / 5 + 1;
+ }
+ else if ( freq < 5000 )
+ {
+ ch = (freq - 4000) / 5;
+ *pbIs5GBand = TRUE;
+ }
+ else
+ {
+ ch = (freq - 5000) / 5;
+ *pbIs5GBand = TRUE;
+ }
+
+ return ch;
+}
diff --git a/drivers/staging/otus/80211core/cmm.c b/drivers/staging/otus/80211core/cmm.c
new file mode 100644
index 00000000000..b74379d928f
--- /dev/null
+++ b/drivers/staging/otus/80211core/cmm.c
@@ -0,0 +1,2141 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : mm.c */
+/* */
+/* Abstract */
+/* This module contains common functions for handle management */
+/* frame. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/************************************************************************/
+#include "cprecomp.h"
+#include "../hal/hpreg.h"
+
+/* TODO : put all constant tables to a file */
+const u8_t zg11bRateTbl[4] = {2, 4, 11, 22};
+const u8_t zg11gRateTbl[8] = {12, 18, 24, 36, 48, 72, 96, 108};
+
+/* 0xff => element does not exist */
+const u8_t zgElementOffsetTable[] =
+{
+ 4, /* 0 : asoc req */
+ 6, /* 1 : asoc rsp */
+ 10, /* 2 : reasoc req*/
+ 6, /* 3 : reasoc rsp */
+ 0, /* 4 : probe req */
+ 12, /* 5 : probe rsp */
+ 0xff, /* 6 : reserved */
+ 0xff, /* 7 : reserved */
+ 12, /* 8 : beacon */
+ 4, /* 9 : ATIM */
+ 0xff, /* 10 : disasoc */
+ 6, /* 11 : auth */
+ 0xff, /* 12 : deauth */
+ 4, /* 13 : action */
+ 0xff, /* 14 : reserved */
+ 0xff, /* 15 : reserved */
+};
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfFindElement */
+/* Find a specific element in management frame */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : management frame buffer */
+/* eid : target element id */
+/* */
+/* OUTPUTS */
+/* byte offset of target element */
+/* or 0xffff if not found */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+u16_t zfFindElement(zdev_t* dev, zbuf_t* buf, u8_t eid)
+{
+ u8_t subType;
+ u16_t offset;
+ u16_t bufLen;
+ u16_t elen;
+ u8_t id, HTEid=0;
+ u8_t oui[4] = {0x00, 0x50, 0xf2, 0x01};
+ u8_t oui11n[3] = {0x00,0x90,0x4C};
+ u8_t HTType = 0;
+
+ /* Get offset of first element */
+ subType = (zmw_rx_buf_readb(dev, buf, 0) >> 4);
+ if ((offset = zgElementOffsetTable[subType]) == 0xff)
+ {
+ zm_assert(0);
+ }
+
+ /* Plus wlan header */
+ offset += 24;
+
+ // jhlee HT 0
+
+ if ((eid == ZM_WLAN_EID_HT_CAPABILITY) ||
+ (eid == ZM_WLAN_EID_EXTENDED_HT_CAPABILITY))
+ {
+ HTEid = eid;
+ eid = ZM_WLAN_EID_WPA_IE;
+ HTType = 1;
+ }
+
+
+ bufLen = zfwBufGetSize(dev, buf);
+ /* Search loop */
+ while ((offset+2)<bufLen) // including element ID and length (2bytes)
+ {
+ /* Search target element */
+ if ((id = zmw_rx_buf_readb(dev, buf, offset)) == eid)
+ {
+ /* Bingo */
+ if ((elen = zmw_rx_buf_readb(dev, buf, offset+1))>(bufLen - offset))
+ {
+ /* Element length error */
+ return 0xffff;
+ }
+
+ if ( elen == 0 && eid != ZM_WLAN_EID_SSID)
+ {
+ /* Element length error */
+ return 0xffff;
+ }
+
+ if ( eid == ZM_WLAN_EID_WPA_IE )
+ {
+ /* avoid sta to be thought use 11n when find a WPA_IE */
+ if ( (HTType == 0) && zfRxBufferEqualToStr(dev, buf, oui, offset+2, 4) )
+ {
+ return offset;
+ }
+
+ // jhlee HT 0
+ // CWYang(+)
+
+ if ((HTType == 1) && ( zfRxBufferEqualToStr(dev, buf, oui11n, offset+2, 3) ))
+ {
+ if ( zmw_rx_buf_readb(dev, buf, offset+5) == HTEid )
+ {
+ return offset + 5;
+ }
+ }
+
+ }
+ else
+ {
+ return offset;
+ }
+ }
+ /* Advance to next element */
+ #if 1
+ elen = zmw_rx_buf_readb(dev, buf, offset+1);
+ #else
+ if ((elen = zmw_rx_buf_readb(dev, buf, offset+1)) == 0)
+ {
+ return 0xffff;
+ }
+ #endif
+
+ offset += (elen+2);
+ }
+ return 0xffff;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfFindWifiElement */
+/* Find a specific Wifi element in management frame */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : management frame buffer */
+/* type : OUI type */
+/* subType : OUI subtype */
+/* */
+/* OUTPUTS */
+/* byte offset of target element */
+/* or 0xffff if not found */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2006.1 */
+/* */
+/************************************************************************/
+u16_t zfFindWifiElement(zdev_t* dev, zbuf_t* buf, u8_t type, u8_t subtype)
+{
+ u8_t subType;
+ u16_t offset;
+ u16_t bufLen;
+ u16_t elen;
+ u8_t id;
+ u8_t tmp;
+
+ /* Get offset of first element */
+ subType = (zmw_rx_buf_readb(dev, buf, 0) >> 4);
+
+ if ((offset = zgElementOffsetTable[subType]) == 0xff)
+ {
+ zm_assert(0);
+ }
+
+ /* Plus wlan header */
+ offset += 24;
+
+ bufLen = zfwBufGetSize(dev, buf);
+ /* Search loop */
+ while ((offset+2)<bufLen) // including element ID and length (2bytes)
+ {
+ /* Search target element */
+ if ((id = zmw_rx_buf_readb(dev, buf, offset)) == ZM_WLAN_EID_WIFI_IE)
+ {
+ /* Bingo */
+ if ((elen = zmw_rx_buf_readb(dev, buf, offset+1))>(bufLen - offset))
+ {
+ /* Element length error */
+ return 0xffff;
+ }
+
+ if ( elen == 0 )
+ {
+ return 0xffff;
+ }
+
+ if (((tmp = zmw_rx_buf_readb(dev, buf, offset+2)) == 0x00)
+ && ((tmp = zmw_rx_buf_readb(dev, buf, offset+3)) == 0x50)
+ && ((tmp = zmw_rx_buf_readb(dev, buf, offset+4)) == 0xF2)
+ && ((tmp = zmw_rx_buf_readb(dev, buf, offset+5)) == type))
+
+ {
+ if ( subtype != 0xff )
+ {
+ if ( (tmp = zmw_rx_buf_readb(dev, buf, offset+6)) == subtype )
+ {
+ return offset;
+ }
+ }
+ else
+ {
+ return offset;
+ }
+ }
+ }
+ /* Advance to next element */
+ if ((elen = zmw_rx_buf_readb(dev, buf, offset+1)) == 0)
+ {
+ return 0xffff;
+ }
+ offset += (elen+2);
+ }
+ return 0xffff;
+}
+
+u16_t zfRemoveElement(zdev_t* dev, u8_t* buf, u16_t size, u8_t eid)
+{
+ u16_t offset = 0;
+ u16_t elen;
+ u8_t HTEid = 0;
+ u8_t oui[4] = {0x00, 0x50, 0xf2, 0x01};
+ u8_t oui11n[3] = {0x00,0x90,0x4C};
+ u8_t HTType = 0;
+
+ if ((eid == ZM_WLAN_EID_HT_CAPABILITY) ||
+ (eid == ZM_WLAN_EID_EXTENDED_HT_CAPABILITY))
+ {
+ HTEid = eid;
+ eid = ZM_WLAN_EID_WPA_IE;
+ HTType = 1;
+ }
+
+ while (offset < size)
+ {
+ elen = *(buf+offset+1);
+
+ if (*(buf+offset) == eid)
+ {
+ if ( eid == ZM_WLAN_EID_WPA_IE )
+ {
+ if ( (HTType == 0)
+ && (*(buf+offset+2) == oui[0])
+ && (*(buf+offset+3) == oui[1])
+ && (*(buf+offset+4) == oui[2])
+ && (*(buf+offset+5) == oui[3]) )
+ {
+ zfMemoryMove(buf+offset, buf+offset+elen+2, size-offset-elen-2);
+ return (size-elen-2);
+ }
+
+ if ( (HTType == 1)
+ && (*(buf+offset+2) == oui11n[0])
+ && (*(buf+offset+3) == oui11n[1])
+ && (*(buf+offset+4) == oui11n[2])
+ && (*(buf+offset+5) == HTEid) )
+ {
+ zfMemoryMove(buf+offset, buf+offset+elen+2, size-offset-elen-2);
+ return (size-elen-2);
+ }
+ }
+ else
+ {
+ zfMemoryMove(buf+offset, buf+offset+elen+2, size-offset-elen-2);
+ return (size-elen-2);
+ }
+ }
+
+ offset += (elen+2);
+ }
+
+ return size;
+}
+
+u16_t zfUpdateElement(zdev_t* dev, u8_t* buf, u16_t size, u8_t* updateeid)
+{
+ u16_t offset = 0;
+ u16_t elen;
+
+ while (offset < size) {
+ elen = *(buf+offset+1);
+
+ if (*(buf+offset) == updateeid[0]) {
+ if (updateeid[1] <= elen) {
+ zfMemoryMove(buf+offset, updateeid, updateeid[1]+2);
+ zfMemoryMove(buf+offset+updateeid[1]+2, buf+offset+elen+2, size-offset-elen-2);
+
+ return size-(elen-updateeid[1]);
+ } else {
+ zfMemoryMove(buf+offset+updateeid[1]+2, buf+offset+elen+2, size-offset-elen-2);
+ zfMemoryMove(buf+offset, updateeid, updateeid[1]+2);
+
+ return size+(updateeid[1]-elen);
+ }
+ }
+
+ offset += (elen+2);
+ }
+
+ return size;
+}
+
+u16_t zfFindSuperGElement(zdev_t* dev, zbuf_t* buf, u8_t type)
+{
+ u8_t subType;
+ u16_t offset;
+ u16_t bufLen;
+ u16_t elen;
+ u8_t id;
+ u8_t super_feature;
+ u8_t ouiSuperG[6] = {0x00,0x03,0x7f,0x01, 0x01, 0x00};
+
+ zmw_get_wlan_dev(dev);
+
+ /* Get offset of first element */
+ subType = (zmw_rx_buf_readb(dev, buf, 0) >> 4);
+ if ((offset = zgElementOffsetTable[subType]) == 0xff)
+ {
+ zm_assert(0);
+ }
+
+ /* Plus wlan header */
+ offset += 24;
+
+ bufLen = zfwBufGetSize(dev, buf);
+ /* Search loop */
+ while ((offset+2)<bufLen) // including element ID and length (2bytes)
+ {
+ /* Search target element */
+ if ((id = zmw_rx_buf_readb(dev, buf, offset)) == ZM_WLAN_EID_VENDOR_PRIVATE)
+ {
+ /* Bingo */
+ if ((elen = zmw_rx_buf_readb(dev, buf, offset+1))>(bufLen - offset))
+ {
+ /* Element length error */
+ return 0xffff;
+ }
+
+ if ( elen == 0 )
+ {
+ return 0xffff;
+ }
+
+ if (zfRxBufferEqualToStr(dev, buf, ouiSuperG, offset+2, 6) && ( zmw_rx_buf_readb(dev, buf, offset+1) >= 6))
+ {
+ /* super_feature 0:useFastFrame, 1:useCompression, 2:useTurboPrime */
+ super_feature= zmw_rx_buf_readb(dev, buf, offset+8);
+ if ((super_feature & 0x01) || (super_feature & 0x02) || (super_feature & 0x04))
+ {
+ return offset;
+ }
+ }
+ }
+ /* Advance to next element */
+ #if 1
+ elen = zmw_rx_buf_readb(dev, buf, offset+1);
+ #else
+ if ((elen = zmw_rx_buf_readb(dev, buf, offset+1)) == 0)
+ {
+ return 0xffff;
+ }
+ #endif
+
+ offset += (elen+2);
+ }
+ return 0xffff;
+}
+
+u16_t zfFindXRElement(zdev_t* dev, zbuf_t* buf, u8_t type)
+{
+ u8_t subType;
+ u16_t offset;
+ u16_t bufLen;
+ u16_t elen;
+ u8_t id;
+ u8_t ouixr[6] = {0x00,0x03,0x7f,0x03, 0x01, 0x00};
+
+ zmw_get_wlan_dev(dev);
+
+ /* Get offset of first element */
+ subType = (zmw_rx_buf_readb(dev, buf, 0) >> 4);
+ if ((offset = zgElementOffsetTable[subType]) == 0xff)
+ {
+ zm_assert(0);
+ }
+
+ /* Plus wlan header */
+ offset += 24;
+
+ bufLen = zfwBufGetSize(dev, buf);
+ /* Search loop */
+ while ((offset+2)<bufLen) // including element ID and length (2bytes)
+ {
+ /* Search target element */
+ if ((id = zmw_rx_buf_readb(dev, buf, offset)) == ZM_WLAN_EID_VENDOR_PRIVATE)
+ {
+ /* Bingo */
+ if ((elen = zmw_rx_buf_readb(dev, buf, offset+1))>(bufLen - offset))
+ {
+ /* Element length error */
+ return 0xffff;
+ }
+
+ if ( elen == 0 )
+ {
+ return 0xffff;
+ }
+
+ if (zfRxBufferEqualToStr(dev, buf, ouixr, offset+2, 6) && ( zmw_rx_buf_readb(dev, buf, offset+1) >= 6))
+ {
+ return offset;
+ }
+ }
+ /* Advance to next element */
+ #if 1
+ elen = zmw_rx_buf_readb(dev, buf, offset+1);
+ #else
+ if ((elen = zmw_rx_buf_readb(dev, buf, offset+1)) == 0)
+ {
+ return 0xffff;
+ }
+ #endif
+
+ offset += (elen+2);
+ }
+ return 0xffff;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfMmAddIeSupportRate */
+/* Add information element Support Rate to buffer. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : buffer to add information element */
+/* offset : add information element from this offset */
+/* eid : element ID */
+/* rateSet : CCK or OFDM */
+/* */
+/* OUTPUTS */
+/* buffer offset after adding information element */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+u16_t zfMmAddIeSupportRate(zdev_t* dev, zbuf_t* buf, u16_t offset, u8_t eid, u8_t rateSet)
+{
+ u8_t len = 0;
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ //if ( (rateSet == ZM_RATE_SET_OFDM)&&((wd->gRate & 0xff) == 0) )
+ //{
+ // return offset;
+ //}
+
+ /* Information : Support Rate */
+ if ( rateSet == ZM_RATE_SET_CCK )
+ {
+ for (i=0; i<4; i++)
+ {
+ if ((wd->bRate & (0x1<<i)) == (0x1<<i))
+ //if ((0xf & (0x1<<i)) == (0x1<<i))
+ {
+ zmw_tx_buf_writeb(dev, buf, offset+len+2,
+ zg11bRateTbl[i]+((wd->bRateBasic & (0x1<<i))<<(7-i)));
+ len++;
+ }
+ }
+ }
+ else if ( rateSet == ZM_RATE_SET_OFDM )
+ {
+ for (i=0; i<8; i++)
+ {
+ if ((wd->gRate & (0x1<<i)) == (0x1<<i))
+ //if ((0xff & (0x1<<i)) == (0x1<<i))
+ {
+ zmw_tx_buf_writeb(dev, buf, offset+len+2,
+ zg11gRateTbl[i]+((wd->gRateBasic & (0x1<<i))<<(7-i)));
+ len++;
+ }
+ }
+ }
+
+ if (len > 0)
+ {
+ /* Element ID */
+ zmw_tx_buf_writeb(dev, buf, offset, eid);
+
+ /* Element Length */
+ zmw_tx_buf_writeb(dev, buf, offset+1, len);
+
+ /* Return value */
+ offset += (2+len);
+ }
+
+ return offset;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfMmAddIeDs */
+/* Add information element DS to buffer. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : buffer to add information element */
+/* offset : add information element from this offset */
+/* */
+/* OUTPUTS */
+/* buffer offset after adding information element */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+u16_t zfMmAddIeDs(zdev_t* dev, zbuf_t* buf, u16_t offset)
+{
+ zmw_get_wlan_dev(dev);
+
+ /* Element ID */
+ zmw_tx_buf_writeb(dev, buf, offset++, ZM_WLAN_EID_DS);
+
+ /* Element Length */
+ zmw_tx_buf_writeb(dev, buf, offset++, 1);
+
+ /* Information : DS */
+ zmw_tx_buf_writeb(dev, buf, offset++,
+ zfChFreqToNum(wd->frequency, NULL));
+
+ return offset;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfMmAddIeErp */
+/* Add information element ERP to buffer. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : buffer to add information element */
+/* offset : add information element from this offset */
+/* */
+/* OUTPUTS */
+/* buffer offset after adding information element */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+u16_t zfMmAddIeErp(zdev_t* dev, zbuf_t* buf, u16_t offset)
+{
+ zmw_get_wlan_dev(dev);
+
+ /* Element ID */
+ zmw_tx_buf_writeb(dev, buf, offset++, ZM_WLAN_EID_ERP);
+
+ /* Element Length */
+ zmw_tx_buf_writeb(dev, buf, offset++, 1);
+
+ /* Information : ERP */
+ zmw_tx_buf_writeb(dev, buf, offset++, wd->erpElement);
+
+ return offset;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfMmAddIeWpa */
+/* Add information element WPA to buffer. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : buffer to add information element */
+/* offset : add information element from this offset */
+/* */
+/* OUTPUTS */
+/* buffer offset after adding information element */
+/* */
+/* AUTHOR */
+/* Yuan-Gu Wei ZyDAS Technology Corporation 2006.2 */
+/* */
+/************************************************************************/
+u16_t zfMmAddIeWpa(zdev_t* dev, zbuf_t* buf, u16_t offset, u16_t apId)
+{
+ //struct zsWlanDev* wd = (struct zsWlanDev*) zmw_wlan_dev(dev);
+ int i;
+
+ zmw_get_wlan_dev(dev);
+
+ /* Element ID */
+ //zmw_inttx_buf_writeb(dev, buf, offset++, ZM_WLAN_EID_WPA_IE);
+
+ /* Element Length */
+ //zmw_inttx_buf_writeb(dev, buf, offset++, wd->ap.wpaLen);
+ for(i = 0; i < wd->ap.wpaLen[apId]; i++)
+ {
+ /* Information : WPA */
+ zmw_tx_buf_writeb(dev, buf, offset++, wd->ap.wpaIe[apId][i]);
+ }
+
+ return offset;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfMmAddHTCapability */
+/* Add HT Capability Infomation to buffer. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : buffer to add information element */
+/* offset : add information element from this offset */
+/* */
+/* OUTPUTS */
+/* buffer offset after adding information element */
+/* */
+/* AUTHOR */
+/* Chao-Wen Yang ZyDAS Technology Corporation 2006.06 */
+/* */
+/************************************************************************/
+u16_t zfMmAddHTCapability(zdev_t* dev, zbuf_t* buf, u16_t offset)
+{
+ u8_t OUI[3] = {0x0,0x90,0x4C};
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ /* Prob ID */
+ zmw_buf_writeb(dev, buf, offset++, ZM_WLAN_EID_WPA_IE);
+
+ if ( wd->wlanMode == ZM_MODE_AP )
+ {
+ /* Element Length */
+ zmw_buf_writeb(dev, buf, offset++, wd->ap.HTCap.Data.Length + 4);
+
+ /* OUI Data */
+ for (i = 0; i < 3; i++)
+ {
+ zmw_buf_writeb(dev, buf, offset++, OUI[i]);
+ }
+
+ /* Element Type ID */
+ zmw_buf_writeb(dev, buf, offset++, wd->ap.HTCap.Data.ElementID);
+
+ /* HT Capability Data */
+ for (i = 0; i < 26; i++)
+ {
+ zmw_buf_writeb(dev, buf, offset++, wd->ap.HTCap.Byte[i+2]);
+ }
+ }
+ else
+ {
+ /* Element Length */
+ zmw_buf_writeb(dev, buf, offset++, wd->sta.HTCap.Data.Length + 4);
+
+ /* OUI Data */
+ for (i = 0; i < 3; i++)
+ {
+ zmw_buf_writeb(dev, buf, offset++, OUI[i]);
+ }
+
+ /* Element Type ID */
+ zmw_buf_writeb(dev, buf, offset++, wd->sta.HTCap.Data.ElementID);
+
+ /* HT Capability Data */
+ for (i = 0; i < 26; i++)
+ {
+ zmw_buf_writeb(dev, buf, offset++, wd->sta.HTCap.Byte[i+2]);
+ }
+ }
+
+ return offset;
+}
+
+
+u16_t zfMmAddPreNHTCapability(zdev_t* dev, zbuf_t* buf, u16_t offset)
+{
+ //u8_t OUI[3] = {0x0,0x90,0x4C};
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ /* Prob ID */
+ zmw_buf_writeb(dev, buf, offset++, ZM_WLAN_PREN2_EID_HTCAPABILITY);
+
+ if ( wd->wlanMode == ZM_MODE_AP )
+ {
+ /* Element Length */
+ zmw_buf_writeb(dev, buf, offset++, wd->ap.HTCap.Data.Length);
+
+ /* HT Capability Data */
+ for (i = 0; i < 26; i++)
+ {
+ zmw_buf_writeb(dev, buf, offset++, wd->ap.HTCap.Byte[i+2]);
+ }
+ }
+ else
+ {
+ /* Element Length */
+ zmw_buf_writeb(dev, buf, offset++, wd->sta.HTCap.Data.Length);
+
+ /* HT Capability Data */
+ for (i = 0; i < 26; i++)
+ {
+ zmw_buf_writeb(dev, buf, offset++, wd->sta.HTCap.Byte[i+2]);
+ }
+ }
+
+ return offset;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfMmAddExtendedHTCapability */
+/* Add Extended HT Capability Infomation to buffer. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : buffer to add information element */
+/* offset : add information element from this offset */
+/* */
+/* OUTPUTS */
+/* buffer offset after adding information element */
+/* */
+/* AUTHOR */
+/* Chao-Wen Yang ZyDAS Technology Corporation 2006.06 */
+/* */
+/************************************************************************/
+u16_t zfMmAddExtendedHTCapability(zdev_t* dev, zbuf_t* buf, u16_t offset)
+{
+ u8_t OUI[3] = {0x0,0x90,0x4C};
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ /* Prob ID */
+ zmw_buf_writeb(dev, buf, offset++, ZM_WLAN_EID_WPA_IE);
+
+ if ( wd->wlanMode == ZM_MODE_AP )
+ {
+ /* Element Length */
+ zmw_buf_writeb(dev, buf, offset++, wd->ap.ExtHTCap.Data.Length + 4);
+
+ /* OUI Data */
+ for (i = 0; i < 3; i++)
+ {
+ zmw_buf_writeb(dev, buf, offset++, OUI[i]);
+ }
+
+ /* Element Type ID */
+ zmw_buf_writeb(dev, buf, offset++, wd->ap.ExtHTCap.Data.ElementID);
+
+ /* HT Capability Data */
+ for (i = 0; i < 22; i++)
+ {
+ zmw_buf_writeb(dev, buf, offset++, wd->ap.ExtHTCap.Byte[i+2]);
+ }
+ }
+ else
+ {
+ /* Element Length */
+ zmw_buf_writeb(dev, buf, offset++, wd->sta.ExtHTCap.Data.Length + 4);
+
+ /* OUI Data */
+ for (i = 0; i < 3; i++)
+ {
+ zmw_buf_writeb(dev, buf, offset++, OUI[i]);
+ }
+
+ /* Element Type ID */
+ zmw_buf_writeb(dev, buf, offset++, wd->sta.ExtHTCap.Data.ElementID);
+
+ /* HT Capability Data */
+ for (i = 0; i < 22; i++)
+ {
+ zmw_buf_writeb(dev, buf, offset++, wd->sta.ExtHTCap.Byte[i+2]);
+ }
+ }
+
+ return offset;
+}
+
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfSendMmFrame */
+/* Send management frame. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* frameType : management frame type */
+/* dst : destination MAC address */
+/* p1 : parameter 1 */
+/* p2 : parameter 2 */
+/* p3 : parameter 3 */
+/* */
+/* OUTPUTS */
+/* none */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+/* probe req : p1=> bWithSSID, p2=>R, p3=>R */
+/* probe rsp : p1=>R, p2=>R, p3=>VAP ID(AP) */
+/* deauth : p1=>Reason Code, p2=>R, p3=>VAP ID(AP) */
+/* Disasoc : p1=>Reason Code, p2=>R, p3=>VAP ID(AP) */
+/* ATIM : p1=>R, p2=>R, p3=>R */
+/* (re)asoc rsp : p1=>Status Code, p2=>AID, p3=>VAP ID(AP) */
+/* asoc req : p1=>R, p2=>R, p3=>R */
+/* reasoc req : p1=>AP MAC[0], p2=>AP MAC[1], p3=>AP MAC[2] */
+/* auth : p1=>low=Algorithm, high=Transaction, p2=>Status, p3=>VAP ID */
+void zfSendMmFrame(zdev_t* dev, u8_t frameType, u16_t* dst,
+ u32_t p1, u32_t p2, u32_t p3)
+{
+ zbuf_t* buf;
+ //u16_t addrTblSize;
+ //struct zsAddrTbl addrTbl;
+ u16_t offset = 0;
+ u16_t hlen = 32;
+ u16_t header[(24+25+1)/2];
+ u16_t vap = 0;
+ u16_t i;
+ u8_t encrypt = 0;
+ u16_t aid;
+
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zm_msg2_mm(ZM_LV_2, "Send mm frame, type=", frameType);
+ /* TBD : Maximum size of managment frame */
+ if ((buf = zfwBufAllocate(dev, 1024)) == NULL)
+ {
+ zm_msg0_mm(ZM_LV_0, "Alloc mm buf Fail!");
+ return;
+ }
+
+ //Reserve room for wlan header
+ offset = hlen;
+
+ switch (frameType)
+ {
+ case ZM_WLAN_FRAME_TYPE_PROBEREQ :
+ offset = zfSendProbeReq(dev, buf, offset, (u8_t) p1);
+ break;
+
+ case ZM_WLAN_FRAME_TYPE_PROBERSP :
+ zm_msg0_mm(ZM_LV_3, "probe rsp");
+ /* 24-31 Time Stamp : hardware WON'T fill this field */
+ zmw_tx_buf_writeh(dev, buf, offset, 0);
+ zmw_tx_buf_writeh(dev, buf, offset+2, 0);
+ zmw_tx_buf_writeh(dev, buf, offset+4, 0);
+ zmw_tx_buf_writeh(dev, buf, offset+6, 0);
+ offset+=8;
+
+ /* Beacon Interval */
+ zmw_tx_buf_writeh(dev, buf, offset, wd->beaconInterval);
+ offset+=2;
+
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ vap = (u16_t) p3;
+ /* Capability */
+ zmw_tx_buf_writeh(dev, buf, offset, wd->ap.capab[vap]);
+ offset+=2;
+ /* SSID */
+ offset = zfApAddIeSsid(dev, buf, offset, vap);
+ }
+ else
+ {
+ /* Capability */
+ zmw_tx_buf_writeb(dev, buf, offset++, wd->sta.capability[0]);
+ zmw_tx_buf_writeb(dev, buf, offset++, wd->sta.capability[1]);
+ /* SSID */
+ offset = zfStaAddIeSsid(dev, buf, offset);
+ }
+
+ /* Support Rate */
+ if ( wd->frequency < 3000 )
+ {
+ offset = zfMmAddIeSupportRate(dev, buf, offset,
+ ZM_WLAN_EID_SUPPORT_RATE, ZM_RATE_SET_CCK);
+ }
+ else
+ {
+ offset = zfMmAddIeSupportRate(dev, buf, offset,
+ ZM_WLAN_EID_SUPPORT_RATE, ZM_RATE_SET_OFDM);
+ }
+
+ /* DS parameter set */
+ offset = zfMmAddIeDs(dev, buf, offset);
+
+ /* TODO  IBSS */
+ if ( wd->wlanMode == ZM_MODE_IBSS )
+ {
+ offset = zfStaAddIeIbss(dev, buf, offset);
+
+ if (wd->frequency < 3000)
+ {
+ if( wd->wfc.bIbssGMode
+ && (wd->supportMode & (ZM_WIRELESS_MODE_24_54|ZM_WIRELESS_MODE_24_N)) ) // Only accompany with enabling a mode .
+ {
+ /* ERP Information */
+ wd->erpElement = 0;
+ offset = zfMmAddIeErp(dev, buf, offset);
+
+ /* Enable G Mode */
+ /* Extended Supported Rates */
+ offset = zfMmAddIeSupportRate(dev, buf, offset,
+ ZM_WLAN_EID_EXTENDED_RATE, ZM_RATE_SET_OFDM);
+ }
+ }
+ }
+
+
+ if ((wd->wlanMode == ZM_MODE_AP)
+ && (wd->ap.wlanType[vap] != ZM_WLAN_TYPE_PURE_B))
+ {
+ /* ERP Information */
+ offset = zfMmAddIeErp(dev, buf, offset);
+
+ /* Extended Supported Rates */
+ if ( wd->frequency < 3000 )
+ {
+ offset = zfMmAddIeSupportRate(dev, buf, offset,
+ ZM_WLAN_EID_EXTENDED_RATE, ZM_RATE_SET_OFDM);
+ }
+ }
+
+ /* ERP Information */
+ //offset = zfMmAddIeErp(dev, buf, offset);
+
+ /* Extended Supported Rates */
+ //offset = zfMmAddIeSupportRate(dev, buf, offset,
+ // ZM_WLAN_EID_EXTENDED_RATE, ZM_RATE_SET_OFDM);
+
+ /* TODO : RSN */
+ if (wd->wlanMode == ZM_MODE_AP && wd->ap.wpaSupport[vap] == 1)
+ {
+ offset = zfMmAddIeWpa(dev, buf, offset, vap);
+ }
+ else if ( wd->wlanMode == ZM_MODE_IBSS && wd->sta.authMode == ZM_AUTH_MODE_WPA2PSK)
+ {
+ offset = zfwStaAddIeWpaRsn(dev, buf, offset, ZM_WLAN_FRAME_TYPE_AUTH);
+ }
+
+ /* WME Parameters */
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ if (wd->ap.qosMode == 1)
+ {
+ offset = zfApAddIeWmePara(dev, buf, offset, vap);
+ }
+ }
+
+ if ( wd->wlanMode != ZM_MODE_IBSS )
+ {
+ // jhlee HT 0
+ //CWYang(+)
+ /* TODO : Need to check if it is ok */
+ /* HT Capabilities Info */
+ offset = zfMmAddHTCapability(dev, buf, offset);
+ //CWYang(+)
+ /* Extended HT Capabilities Info */
+ offset = zfMmAddExtendedHTCapability(dev, buf, offset);
+ }
+
+ if ( wd->sta.ibssAdditionalIESize )
+ offset = zfStaAddIbssAdditionalIE(dev, buf, offset);
+ break;
+
+ case ZM_WLAN_FRAME_TYPE_AUTH :
+ if (p1 == 0x30001)
+ {
+ hlen += 4;
+ offset += 4; // for reserving wep header
+ encrypt = 1;
+ }
+
+ /* Algotrithm Number */
+ zmw_tx_buf_writeh(dev, buf, offset, (u16_t)(p1&0xffff));
+ offset+=2;
+
+ /* Transaction Number */
+ zmw_tx_buf_writeh(dev, buf, offset, (u16_t)(p1>>16));
+ offset+=2;
+
+ /* Status Code */
+ zmw_tx_buf_writeh(dev, buf, offset, (u16_t)p2);
+ offset+=2;
+
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ vap = (u16_t) p3;
+ }
+
+ /* Challenge Text => share-2 or share-3 */
+ if (p1 == 0x20001)
+ {
+ if (p2 == 0) //Status == success
+ {
+ zmw_buf_writeh(dev, buf, offset, 0x8010);
+ offset+=2;
+ /* share-2 : AP generate challenge text */
+ for (i=0; i<128; i++)
+ {
+ wd->ap.challengeText[i] = (u8_t)zfGetRandomNumber(dev, 0);
+ }
+ zfCopyToIntTxBuffer(dev, buf, wd->ap.challengeText, offset, 128);
+ offset += 128;
+ }
+ }
+ else if (p1 == 0x30001)
+ {
+ /* share-3 : STA return challenge Text */
+ zfCopyToIntTxBuffer(dev, buf, wd->sta.challengeText, offset, wd->sta.challengeText[1]+2);
+ offset += (wd->sta.challengeText[1]+2);
+ }
+
+ break;
+
+ case ZM_WLAN_FRAME_TYPE_ASOCREQ :
+ case ZM_WLAN_FRAME_TYPE_REASOCREQ :
+ /* Capability */
+ zmw_tx_buf_writeb(dev, buf, offset++, wd->sta.capability[0]);
+ zmw_tx_buf_writeb(dev, buf, offset++, wd->sta.capability[1]);
+
+ /* Listen Interval */
+ zmw_tx_buf_writeh(dev, buf, offset, 0x0005);
+ offset+=2;
+
+ /* Reassocaited Request : Current AP address */
+ if (frameType == ZM_WLAN_FRAME_TYPE_REASOCREQ)
+ {
+ zmw_tx_buf_writeh(dev, buf, offset, wd->sta.bssid[0]);
+ offset+=2;
+ zmw_tx_buf_writeh(dev, buf, offset, wd->sta.bssid[1]);
+ offset+=2;
+ zmw_tx_buf_writeh(dev, buf, offset, wd->sta.bssid[2]);
+ offset+=2;
+ }
+
+ /* SSID */
+ offset = zfStaAddIeSsid(dev, buf, offset);
+
+
+ if ( wd->sta.currentFrequency < 3000 )
+ {
+ /* Support Rate */
+ offset = zfMmAddIeSupportRate(dev, buf, offset, ZM_WLAN_EID_SUPPORT_RATE, ZM_RATE_SET_CCK);
+ }
+ else
+ {
+ /* Support Rate */
+ offset = zfMmAddIeSupportRate(dev, buf, offset, ZM_WLAN_EID_SUPPORT_RATE, ZM_RATE_SET_OFDM);
+ }
+
+ if ((wd->sta.capability[1] & ZM_BIT_0) == 1)
+ { //spectrum managment flag enable
+ offset = zfStaAddIePowerCap(dev, buf, offset);
+ offset = zfStaAddIeSupportCh(dev, buf, offset);
+ }
+
+ if (wd->sta.currentFrequency < 3000)
+ {
+ /* Extended Supported Rates */
+ if (wd->supportMode & (ZM_WIRELESS_MODE_24_54|ZM_WIRELESS_MODE_24_N))
+ {
+ offset = zfMmAddIeSupportRate(dev, buf, offset, ZM_WLAN_EID_EXTENDED_RATE, ZM_RATE_SET_OFDM);
+ }
+ }
+
+
+ //offset = zfStaAddIeWpaRsn(dev, buf, offset, frameType);
+ //Move to wrapper function, for OS difference--CWYang(m)
+ //for windows wrapper, zfwStaAddIeWpaRsn() should be below:
+ //u16_t zfwStaAddIeWpaRsn(zdev_t* dev, zbuf_t* buf, u16_t offset, u8_t frameType)
+ //{
+ // return zfStaAddIeWpaRsn(dev, buf, offset, frameType);
+ //}
+ offset = zfwStaAddIeWpaRsn(dev, buf, offset, frameType);
+
+#ifdef ZM_ENABLE_CENC
+ /* CENC */
+ //if (wd->sta.encryMode == ZM_CENC)
+ offset = zfStaAddIeCenc(dev, buf, offset);
+#endif //ZM_ENABLE_CENC
+ if (((wd->sta.wmeEnabled & ZM_STA_WME_ENABLE_BIT) != 0) //WME enabled
+ && ((wd->sta.apWmeCapability & 0x1) != 0)) //WME AP
+ {
+ if (((wd->sta.apWmeCapability & 0x80) != 0) //UAPSD AP
+ && ((wd->sta.wmeEnabled & ZM_STA_UAPSD_ENABLE_BIT) != 0)) //UAPSD enabled
+ {
+ offset = zfStaAddIeWmeInfo(dev, buf, offset, wd->sta.wmeQosInfo);
+ }
+ else
+ {
+ offset = zfStaAddIeWmeInfo(dev, buf, offset, 0);
+ }
+ }
+ // jhlee HT 0
+ //CWYang(+)
+ if (wd->sta.EnableHT != 0)
+ {
+ #ifndef ZM_DISABLE_AMSDU8K_SUPPORT
+ //Support 8K A-MSDU
+ if (wd->sta.wepStatus == ZM_ENCRYPTION_WEP_DISABLED)
+ {
+ wd->sta.HTCap.Data.HtCapInfo |= HTCAP_MaxAMSDULength;
+ }
+ else
+ {
+ wd->sta.HTCap.Data.HtCapInfo &= (~HTCAP_MaxAMSDULength);
+ }
+ #else
+ //Support 4K A-MSDU
+ wd->sta.HTCap.Data.HtCapInfo &= (~HTCAP_MaxAMSDULength);
+ #endif
+
+ /* HT Capabilities Info */
+ if (wd->BandWidth40 == 1) {
+ wd->sta.HTCap.Data.HtCapInfo |= HTCAP_SupChannelWidthSet;
+ }
+ else {
+ wd->sta.HTCap.Data.HtCapInfo &= ~HTCAP_SupChannelWidthSet;
+ //wd->sta.HTCap.Data.HtCapInfo |= HTCAP_SupChannelWidthSet;
+ }
+
+ wd->sta.HTCap.Data.AMPDUParam &= ~HTCAP_MaxRxAMPDU3;
+ wd->sta.HTCap.Data.AMPDUParam |= HTCAP_MaxRxAMPDU3;
+ wd->sta.HTCap.Data.MCSSet[1] = 0xFF; // MCS 8 ~ 15
+ offset = zfMmAddHTCapability(dev, buf, offset);
+ offset = zfMmAddPreNHTCapability(dev, buf, offset);
+ //CWYang(+)
+ /* Extended HT Capabilities Info */
+ //offset = zfMmAddExtendedHTCapability(dev, buf, offset);
+ }
+
+
+ //Store asoc request frame body, for VISTA only
+ wd->sta.asocReqFrameBodySize = ((offset - hlen) >
+ ZM_CACHED_FRAMEBODY_SIZE)?
+ ZM_CACHED_FRAMEBODY_SIZE:(offset - hlen);
+ for (i=0; i<wd->sta.asocReqFrameBodySize; i++)
+ {
+ wd->sta.asocReqFrameBody[i] = zmw_tx_buf_readb(dev, buf, i + hlen);
+ }
+ break;
+
+ case ZM_WLAN_FRAME_TYPE_ASOCRSP :
+ case ZM_WLAN_FRAME_TYPE_REASOCRSP :
+ vap = (u16_t) p3;
+
+ /* Capability */
+ zmw_tx_buf_writeh(dev, buf, offset, wd->ap.capab[vap]);
+ offset+=2;
+
+ /* Status Code */
+ zmw_tx_buf_writeh(dev, buf, offset, (u16_t)p1);
+ offset+=2;
+
+ /* AID */
+ zmw_tx_buf_writeh(dev, buf, offset, (u16_t)(p2|0xc000));
+ offset+=2;
+
+
+ if ( wd->frequency < 3000 )
+ {
+ /* Support Rate */
+ offset = zfMmAddIeSupportRate(dev, buf, offset, ZM_WLAN_EID_SUPPORT_RATE, ZM_RATE_SET_CCK);
+
+ /* Extended Supported Rates */
+ offset = zfMmAddIeSupportRate(dev, buf, offset, ZM_WLAN_EID_EXTENDED_RATE, ZM_RATE_SET_OFDM);
+ }
+ else
+ {
+ /* Support Rate */
+ offset = zfMmAddIeSupportRate(dev, buf, offset, ZM_WLAN_EID_SUPPORT_RATE, ZM_RATE_SET_OFDM);
+ }
+
+
+
+ /* WME Parameters */
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ /* TODO : if WME STA then send WME parameter element */
+ if (wd->ap.qosMode == 1)
+ {
+ offset = zfApAddIeWmePara(dev, buf, offset, vap);
+ }
+ }
+ // jhlee HT 0
+ //CWYang(+)
+ /* HT Capabilities Info */
+ offset = zfMmAddHTCapability(dev, buf, offset);
+ //CWYang(+)
+ /* Extended HT Capabilities Info */
+ offset = zfMmAddExtendedHTCapability(dev, buf, offset);
+ break;
+
+ case ZM_WLAN_FRAME_TYPE_ATIM :
+ /* NULL frame */
+ /* TODO : add two dumb bytes temporarily */
+ offset += 2;
+ break;
+
+ case ZM_WLAN_FRAME_TYPE_QOS_NULL :
+ zmw_buf_writeh(dev, buf, offset, 0x0010);
+ offset += 2;
+ break;
+
+ case ZM_WLAN_DATA_FRAME :
+ break;
+
+ case ZM_WLAN_FRAME_TYPE_DISASOC :
+ case ZM_WLAN_FRAME_TYPE_DEAUTH :
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ vap = (u16_t) p3;
+
+ if ((aid = zfApFindSta(dev, dst)) != 0xffff)
+ {
+ zmw_enter_critical_section(dev);
+ /* Clear STA table */
+ wd->ap.staTable[aid].valid = 0;
+
+ zmw_leave_critical_section(dev);
+
+ if (wd->zfcbDisAsocNotify != NULL)
+ {
+ wd->zfcbDisAsocNotify(dev, (u8_t*)dst, vap);
+ }
+ }
+ }
+ /* Reason Code */
+ zmw_tx_buf_writeh(dev, buf, offset, (u16_t)p1);
+ offset+=2;
+ break;
+ }
+
+ zfwBufSetSize(dev, buf, offset);
+
+ zm_msg2_mm(ZM_LV_2, "management frame body size=", offset-hlen);
+
+ //Copy wlan header
+ zfTxGenMmHeader(dev, frameType, dst, header, offset-hlen, buf, vap, encrypt);
+ for (i=0; i<(hlen>>1); i++)
+ {
+ zmw_tx_buf_writeh(dev, buf, i*2, header[i]);
+ }
+
+ /* Get buffer DMA address */
+ //if ((addrTblSize = zfwBufMapDma(dev, buf, &addrTbl)) == 0)
+ //if ((addrTblSize = zfwMapTxDma(dev, buf, &addrTbl)) == 0)
+ //{
+ // goto zlError;
+ //}
+
+ zm_msg2_mm(ZM_LV_2, "offset=", offset);
+ zm_msg2_mm(ZM_LV_2, "hlen=", hlen);
+ //zm_msg2_mm(ZM_LV_2, "addrTblSize=", addrTblSize);
+ //zm_msg2_mm(ZM_LV_2, "addrTbl.len[0]=", addrTbl.len[0]);
+ //zm_msg2_mm(ZM_LV_2, "addrTbl.physAddrl[0]=", addrTbl.physAddrl[0]);
+ //zm_msg2_mm(ZM_LV_2, "buf->data=", buf->data);
+
+ #if 0
+ if ((err = zfHpSend(dev, NULL, 0, NULL, 0, NULL, 0, buf, 0,
+ ZM_INTERNAL_ALLOC_BUF, 0, 0xff)) != ZM_SUCCESS)
+ {
+ goto zlError;
+ }
+ #else
+ zfPutVmmq(dev, buf);
+ zfPushVtxq(dev);
+ #endif
+
+ return;
+#if 0
+zlError:
+
+ zfwBufFree(dev, buf, 0);
+ return;
+#endif
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfProcessManagement */
+/* Process received management frame. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : received management frame buffer */
+/* */
+/* OUTPUTS */
+/* none */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+void zfProcessManagement(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* AddInfo) //CWYang(m)
+{
+ u8_t frameType;
+ u16_t ta[3];
+ u16_t ra[3];
+ u16_t vap = 0, index = 0;
+ //u16_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ ra[0] = zmw_rx_buf_readh(dev, buf, 4);
+ ra[1] = zmw_rx_buf_readh(dev, buf, 6);
+ ra[2] = zmw_rx_buf_readh(dev, buf, 8);
+
+ ta[0] = zmw_rx_buf_readh(dev, buf, 10);
+ ta[1] = zmw_rx_buf_readh(dev, buf, 12);
+ ta[2] = zmw_rx_buf_readh(dev, buf, 14);
+
+ frameType = zmw_rx_buf_readb(dev, buf, 0);
+
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+#if 1
+ vap = 0;
+ if ((ra[0] & 0x1) != 1)
+ {
+ /* AP : Find virtual AP */
+ if ((index = zfApFindSta(dev, ta)) != 0xffff)
+ {
+ vap = wd->ap.staTable[index].vap;
+ }
+ }
+ zm_msg2_mm(ZM_LV_2, "vap=", vap);
+#endif
+
+ /* Dispatch by frame type */
+ switch (frameType)
+ {
+ /* Beacon */
+ case ZM_WLAN_FRAME_TYPE_BEACON :
+ zfApProcessBeacon(dev, buf);
+ break;
+ /* Authentication */
+ case ZM_WLAN_FRAME_TYPE_AUTH :
+ zfApProcessAuth(dev, buf, ta, vap);
+ break;
+ /* Association request */
+ case ZM_WLAN_FRAME_TYPE_ASOCREQ :
+ /* Reassociation request */
+ case ZM_WLAN_FRAME_TYPE_REASOCREQ :
+ zfApProcessAsocReq(dev, buf, ta, vap);
+ break;
+ /* Association response */
+ case ZM_WLAN_FRAME_TYPE_ASOCRSP :
+ //zfApProcessAsocRsp(dev, buf);
+ break;
+ /* Deauthentication */
+ case ZM_WLAN_FRAME_TYPE_DEAUTH :
+ zfApProcessDeauth(dev, buf, ta, vap);
+ break;
+ /* Disassociation */
+ case ZM_WLAN_FRAME_TYPE_DISASOC :
+ zfApProcessDisasoc(dev, buf, ta, vap);
+ break;
+ /* Probe request */
+ case ZM_WLAN_FRAME_TYPE_PROBEREQ :
+ zfProcessProbeReq(dev, buf, ta);
+ break;
+ /* Probe response */
+ case ZM_WLAN_FRAME_TYPE_PROBERSP :
+ zfApProcessProbeRsp(dev, buf, AddInfo);
+ break;
+ /* Action */
+ case ZM_WLAN_FRAME_TYPE_ACTION :
+ zfApProcessAction(dev, buf);
+ break;
+ }
+ }
+ else //if ((wd->wlanMode == ZM_MODE_INFRASTRUCTURE) || (wd->wlanMode == ZM_MODE_IBSS))
+ {
+ /* Dispatch by frame type */
+ switch (frameType)
+ {
+ /* Beacon */
+ case ZM_WLAN_FRAME_TYPE_BEACON :
+ /* if enable 802.11h and current chanel is silent but receive beacon from other AP */
+ if (((wd->regulationTable.allowChannel[wd->regulationTable.CurChIndex].channelFlags
+ & ZM_REG_FLAG_CHANNEL_CSA) != 0) && wd->sta.DFSEnable)
+ {
+ wd->regulationTable.allowChannel[wd->regulationTable.CurChIndex].channelFlags
+ &= ~(ZM_REG_FLAG_CHANNEL_CSA & ZM_REG_FLAG_CHANNEL_PASSIVE);
+ }
+ zfStaProcessBeacon(dev, buf, AddInfo); //CWYang(m)
+ break;
+ /* Authentication */
+ case ZM_WLAN_FRAME_TYPE_AUTH :
+ /* TODO : vap parameter is useless in STA mode, get rid of it */
+ zfStaProcessAuth(dev, buf, ta, 0);
+ break;
+ /* Association request */
+ case ZM_WLAN_FRAME_TYPE_ASOCREQ :
+ /* TODO : vap parameter is useless in STA mode, get rid of it */
+ zfStaProcessAsocReq(dev, buf, ta, 0);
+ break;
+ /* Association response */
+ case ZM_WLAN_FRAME_TYPE_ASOCRSP :
+ /* Reassociation request */
+ case ZM_WLAN_FRAME_TYPE_REASOCRSP :
+ zfStaProcessAsocRsp(dev, buf);
+ break;
+ /* Deauthentication */
+ case ZM_WLAN_FRAME_TYPE_DEAUTH :
+ zm_debug_msg0("Deauthentication received");
+ zfStaProcessDeauth(dev, buf);
+ break;
+ /* Disassociation */
+ case ZM_WLAN_FRAME_TYPE_DISASOC :
+ zm_debug_msg0("Disassociation received");
+ zfStaProcessDisasoc(dev, buf);
+ break;
+ /* Probe request */
+ case ZM_WLAN_FRAME_TYPE_PROBEREQ :
+ zfProcessProbeReq(dev, buf, ta);
+ break;
+ /* Probe response */
+ case ZM_WLAN_FRAME_TYPE_PROBERSP :
+ /* if enable 802.11h and current chanel is silent but receive probe response from other AP */
+ if (((wd->regulationTable.allowChannel[wd->regulationTable.CurChIndex].channelFlags
+ & ZM_REG_FLAG_CHANNEL_CSA) != 0) && wd->sta.DFSEnable)
+ {
+ wd->regulationTable.allowChannel[wd->regulationTable.CurChIndex].channelFlags
+ &= ~(ZM_REG_FLAG_CHANNEL_CSA & ZM_REG_FLAG_CHANNEL_PASSIVE);
+ }
+ zfStaProcessProbeRsp(dev, buf, AddInfo);
+ break;
+
+ case ZM_WLAN_FRAME_TYPE_ATIM:
+ zfStaProcessAtim(dev, buf);
+ break;
+ /* Action */
+ case ZM_WLAN_FRAME_TYPE_ACTION :
+ zm_msg0_mm(ZM_LV_2, "ProcessActionMgtFrame");
+ zfStaProcessAction(dev, buf);
+ break;
+ }
+ }
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfProcessProbeReq */
+/* Process probe request management frame. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : auth frame buffer */
+/* */
+/* OUTPUTS */
+/* none */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+void zfProcessProbeReq(zdev_t* dev, zbuf_t* buf, u16_t* src)
+{
+ u16_t offset;
+ u8_t len;
+ u16_t i, j;
+ u8_t ch;
+ u16_t sendFlag;
+
+ zmw_get_wlan_dev(dev);
+
+ /* check mode : AP/IBSS */
+ if ((wd->wlanMode != ZM_MODE_AP) && (wd->wlanMode != ZM_MODE_IBSS))
+ {
+ zm_msg0_mm(ZM_LV_3, "Ignore probe req");
+ return;
+ }
+
+ if ((wd->wlanMode != ZM_MODE_AP) && (wd->sta.adapterState == ZM_STA_STATE_DISCONNECT))
+ {
+ zm_msg0_mm(ZM_LV_3, "Packets dropped due to disconnect state");
+ return;
+ }
+
+ if ( wd->wlanMode == ZM_MODE_IBSS )
+ {
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_PROBERSP, src, 0, 0, 0);
+
+ return;
+ }
+
+ /* check SSID */
+ if ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_SSID)) == 0xffff)
+ {
+ zm_msg0_mm(ZM_LV_3, "probe req SSID not found");
+ return;
+ }
+
+ len = zmw_rx_buf_readb(dev, buf, offset+1);
+
+ for (i=0; i<ZM_MAX_AP_SUPPORT; i++)
+ {
+ if ((wd->ap.apBitmap & (1<<i)) != 0)
+ {
+ zm_msg1_mm(ZM_LV_3, "len=", len);
+ sendFlag = 0;
+ /* boardcast SSID */
+ if (len == 0)
+ {
+ if (wd->ap.hideSsid[i] == 0)
+ {
+ sendFlag = 1;
+ }
+ }
+ /* Not broadcast SSID */
+ else if (wd->ap.ssidLen[i] == len)
+ {
+ for (j=0; j<len; j++)
+ {
+ if ((ch = zmw_rx_buf_readb(dev, buf, offset+2+j))
+ != wd->ap.ssid[i][j])
+ {
+ break;
+ }
+ }
+ if (j == len)
+ {
+ sendFlag = 1;
+ }
+ }
+ if (sendFlag == 1)
+ {
+ /* Send probe response */
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_PROBERSP, src, i, 0, i);
+ }
+ }
+ }
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfProcessProbeRsp */
+/* Process probe response management frame. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : auth frame buffer */
+/* AddInfo : Rx Header and Rx Mac Status */
+/* */
+/* OUTPUTS */
+/* none */
+/* */
+/* AUTHOR */
+/* Aress Yang ZyDAS Technology Corporation 2006.11 */
+/* */
+/************************************************************************/
+void zfProcessProbeRsp(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* AddInfo)
+{
+ /* Gather scan result */
+ /* Parse TIM and send PS-POLL in power saving mode */
+ struct zsWlanProbeRspFrameHeader* pProbeRspHeader;
+ struct zsBssInfo* pBssInfo;
+ u8_t pBuf[sizeof(struct zsWlanProbeRspFrameHeader)];
+ int res;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zfCopyFromRxBuffer(dev, buf, pBuf, 0,
+ sizeof(struct zsWlanProbeRspFrameHeader));
+ pProbeRspHeader = (struct zsWlanProbeRspFrameHeader*) pBuf;
+
+ zmw_enter_critical_section(dev);
+
+ //zm_debug_msg1("bss count = ", wd->sta.bssList.bssCount);
+
+ pBssInfo = zfStaFindBssInfo(dev, buf, pProbeRspHeader);
+
+ //if ( i == wd->sta.bssList.bssCount )
+ if ( pBssInfo == NULL )
+ {
+ /* Allocate a new entry if BSS not in the scan list */
+ pBssInfo = zfBssInfoAllocate(dev);
+ if (pBssInfo != NULL)
+ {
+ res = zfStaInitBssInfo(dev, buf, pProbeRspHeader, pBssInfo, AddInfo, 0);
+ //zfDumpSSID(pBssInfo->ssid[1], &(pBssInfo->ssid[2]));
+ if ( res != 0 )
+ {
+ zfBssInfoFree(dev, pBssInfo);
+ }
+ else
+ {
+ zfBssInfoInsertToList(dev, pBssInfo);
+ }
+ }
+ }
+ else
+ {
+ res = zfStaInitBssInfo(dev, buf, pProbeRspHeader, pBssInfo, AddInfo, 1);
+ if (res == 2)
+ {
+ zfBssInfoRemoveFromList(dev, pBssInfo);
+ zfBssInfoFree(dev, pBssInfo);
+ }
+ else if ( wd->wlanMode == ZM_MODE_IBSS )
+ {
+ int idx;
+
+ // It would reset the alive counter if the peer station is found!
+ zfStaFindFreeOpposite(dev, (u16_t *)pBssInfo->macaddr, &idx);
+ }
+ }
+
+ zmw_leave_critical_section(dev);
+
+ return;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfSendProbeReq */
+/* Send probe request management frame. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* */
+/* OUTPUTS */
+/* none */
+/* */
+/* AUTHOR */
+/* Ji-Huang Lee ZyDAS Technology Corporation 2005.11 */
+/* */
+/************************************************************************/
+
+u16_t zfSendProbeReq(zdev_t* dev, zbuf_t* buf, u16_t offset, u8_t bWithSSID)
+{
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+
+ /* SSID */
+ if (bWithSSID == 0) /* broadcast ssid */
+ {
+ //zmw_leave_critical_section(dev);
+ zmw_tx_buf_writeb(dev, buf, offset++, ZM_WLAN_EID_SSID);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0); /* length = 0 */
+ }
+ else
+ {
+ zmw_enter_critical_section(dev);
+ if (wd->ws.probingSsidList[bWithSSID-1].ssidLen == 0)
+ {
+ zmw_tx_buf_writeb(dev, buf, offset++, ZM_WLAN_EID_SSID);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0); /* length = 0 */
+ }
+ else
+ {
+ zmw_tx_buf_writeb(dev, buf, offset++, ZM_WLAN_EID_SSID);
+ zmw_tx_buf_writeb(dev, buf, offset++,
+ wd->ws.probingSsidList[bWithSSID-1].ssidLen);
+ zfCopyToIntTxBuffer(dev, buf,
+ wd->ws.probingSsidList[bWithSSID-1].ssid,
+ offset,
+ wd->ws.probingSsidList[bWithSSID-1].ssidLen); /* ssid */
+ offset += wd->ws.probingSsidList[bWithSSID-1].ssidLen;
+ }
+ zmw_leave_critical_section(dev);
+ }
+
+ /* Supported rates */
+ if ( wd->sta.currentFrequency < 3000 )
+ { /* 802.11b+g */
+ offset = zfMmAddIeSupportRate(dev, buf, offset,
+ ZM_WLAN_EID_SUPPORT_RATE, ZM_RATE_SET_CCK);
+
+ if (wd->supportMode & (ZM_WIRELESS_MODE_24_54|ZM_WIRELESS_MODE_24_N)) {
+ if (wd->wlanMode == ZM_MODE_IBSS) {
+ if (wd->wfc.bIbssGMode) {
+ offset = zfMmAddIeSupportRate(dev, buf, offset,
+ ZM_WLAN_EID_EXTENDED_RATE, ZM_RATE_SET_OFDM);
+ }
+ } else {
+ offset = zfMmAddIeSupportRate(dev, buf, offset,
+ ZM_WLAN_EID_EXTENDED_RATE, ZM_RATE_SET_OFDM);
+ }
+ }
+ }
+ else
+ { /* 802.11a */
+ offset = zfMmAddIeSupportRate(dev, buf, offset,
+ ZM_WLAN_EID_SUPPORT_RATE, ZM_RATE_SET_OFDM);
+ }
+
+ return offset;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfUpdateDefaultQosParameter */
+/* Update TxQs CWMIN, CWMAX, AIFS and TXO to WME default value. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* mode : 0=>STA, 1=>AP */
+/* */
+/* OUTPUTS */
+/* none */
+/* */
+/* AUTHOR */
+/* Stephen ZyDAS Technology Corporation 2006.6 */
+/* */
+/************************************************************************/
+void zfUpdateDefaultQosParameter(zdev_t* dev, u8_t mode)
+{
+ u16_t cwmin[5];
+ u16_t cwmax[5];
+ u16_t aifs[5];
+ u16_t txop[5];
+
+ /* WMM parameter for STA */
+ /* Best Effor */
+ cwmin[0] = 15;
+ cwmax[0] = 1023;
+ aifs[0] = 3 * 9 + 10;
+ txop[0] = 0;
+ /* Back Ground */
+ cwmin[1] = 15;
+ cwmax[1] = 1023;
+ aifs[1] = 7 * 9 + 10;
+ txop[1] = 0;
+ /* VIDEO */
+ cwmin[2] = 7;
+ cwmax[2] = 15;
+ aifs[2] = 2 * 9 + 10;
+ txop[2] = 94;
+ /* VOICE */
+ cwmin[3] = 3;
+ cwmax[3] = 7;
+ aifs[3] = 2 * 9 + 10;
+ txop[3] = 47;
+ /* Special TxQ */
+ cwmin[4] = 3;
+ cwmax[4] = 7;
+ aifs[4] = 2 * 9 + 10;
+ txop[4] = 0;
+
+ /* WMM parameter for AP */
+ if (mode == 1)
+ {
+ cwmax[0] = 63;
+ aifs[3] = 1 * 9 + 10;
+ aifs[4] = 1 * 9 + 10;
+ }
+ zfHpUpdateQosParameter(dev, cwmin, cwmax, aifs, txop);
+}
+
+u16_t zfFindATHExtCap(zdev_t* dev, zbuf_t* buf, u8_t type, u8_t subtype)
+{
+ u8_t subType;
+ u16_t offset;
+ u16_t bufLen;
+ u16_t elen;
+ u8_t id;
+ u8_t tmp;
+
+ /* Get offset of first element */
+ subType = (zmw_rx_buf_readb(dev, buf, 0) >> 4);
+
+ if ((offset = zgElementOffsetTable[subType]) == 0xff)
+ {
+ zm_assert(0);
+ }
+
+ /* Plus wlan header */
+ offset += 24;
+
+ bufLen = zfwBufGetSize(dev, buf);
+
+ /* Search loop */
+ while ((offset+2)<bufLen) // including element ID and length (2bytes)
+ {
+ /* Search target element */
+ if ((id = zmw_rx_buf_readb(dev, buf, offset)) == ZM_WLAN_EID_WIFI_IE)
+ {
+ /* Bingo */
+ if ((elen = zmw_rx_buf_readb(dev, buf, offset+1))>(bufLen - offset))
+ {
+ /* Element length error */
+ return 0xffff;
+ }
+
+ if ( elen == 0 )
+ {
+ return 0xffff;
+ }
+
+ if (((tmp = zmw_rx_buf_readb(dev, buf, offset+2)) == 0x00)
+ && ((tmp = zmw_rx_buf_readb(dev, buf, offset+3)) == 0x03)
+ && ((tmp = zmw_rx_buf_readb(dev, buf, offset+4)) == 0x7f)
+ && ((tmp = zmw_rx_buf_readb(dev, buf, offset+5)) == type))
+
+ {
+ if ( subtype != 0xff )
+ {
+ if ( (tmp = zmw_rx_buf_readb(dev, buf, offset+6)) == subtype )
+ {
+ return offset;
+ }
+ }
+ else
+ {
+ return offset;
+ }
+ }
+ }
+
+ /* Advance to next element */
+ if ((elen = zmw_rx_buf_readb(dev, buf, offset+1)) == 0)
+ {
+ return 0xffff;
+ }
+ offset += (elen+2);
+ }
+ return 0xffff;
+}
+
+u16_t zfFindBrdcmMrvlRlnkExtCap(zdev_t* dev, zbuf_t* buf)
+{
+ u8_t subType;
+ u16_t offset;
+ u16_t bufLen;
+ u16_t elen;
+ u8_t id;
+ u8_t tmp;
+
+ /* Get offset of first element */
+ subType = (zmw_rx_buf_readb(dev, buf, 0) >> 4);
+
+ if ((offset = zgElementOffsetTable[subType]) == 0xff)
+ {
+ zm_assert(0);
+ }
+
+ /* Plus wlan header */
+ offset += 24;
+
+ bufLen = zfwBufGetSize(dev, buf);
+
+ /* Search loop */
+ while ((offset+2)<bufLen) // including element ID and length (2bytes)
+ {
+ /* Search target element */
+ if ((id = zmw_rx_buf_readb(dev, buf, offset)) == ZM_WLAN_EID_WIFI_IE)
+ {
+ /* Bingo */
+ if ((elen = zmw_rx_buf_readb(dev, buf, offset+1))>(bufLen - offset))
+ {
+ /* Element length error */
+ return 0xffff;
+ }
+
+ if ( elen == 0 )
+ {
+ return 0xffff;
+ }
+
+ if (((tmp = zmw_rx_buf_readb(dev, buf, offset+2)) == 0x00)
+ && ((tmp = zmw_rx_buf_readb(dev, buf, offset+3)) == 0x10)
+ && ((tmp = zmw_rx_buf_readb(dev, buf, offset+4)) == 0x18))
+
+ {
+ return offset;
+ }
+ else if (((tmp = zmw_rx_buf_readb(dev, buf, offset+2)) == 0x00)
+ && ((tmp = zmw_rx_buf_readb(dev, buf, offset+3)) == 0x50)
+ && ((tmp = zmw_rx_buf_readb(dev, buf, offset+4)) == 0x43))
+
+ {
+ return offset;
+ }
+ }
+ else if ((id = zmw_rx_buf_readb(dev, buf, offset)) == 0x7F)
+ {
+ /* Bingo */
+ if ((elen = zmw_rx_buf_readb(dev, buf, offset+1))>(bufLen - offset))
+ {
+ /* Element length error */
+ return 0xffff;
+ }
+
+ if ( elen == 0 )
+ {
+ return 0xffff;
+ }
+
+ if ((tmp = zmw_rx_buf_readb(dev, buf, offset+2)) == 0x01)
+
+ {
+ return offset;
+ }
+ }
+
+ /* Advance to next element */
+ if ((elen = zmw_rx_buf_readb(dev, buf, offset+1)) == 0)
+ {
+ return 0xffff;
+ }
+ offset += (elen+2);
+ }
+ return 0xffff;
+}
+
+u16_t zfFindMarvelExtCap(zdev_t* dev, zbuf_t* buf)
+{
+ u8_t subType;
+ u16_t offset;
+ u16_t bufLen;
+ u16_t elen;
+ u8_t id;
+ u8_t tmp;
+
+ /* Get offset of first element */
+ subType = (zmw_rx_buf_readb(dev, buf, 0) >> 4);
+
+ if ((offset = zgElementOffsetTable[subType]) == 0xff)
+ {
+ zm_assert(0);
+ }
+
+ /* Plus wlan header */
+ offset += 24;
+
+ bufLen = zfwBufGetSize(dev, buf);
+
+ /* Search loop */
+ while ((offset+2)<bufLen) // including element ID and length (2bytes)
+ {
+ /* Search target element */
+ if ((id = zmw_rx_buf_readb(dev, buf, offset)) == ZM_WLAN_EID_WIFI_IE)
+ {
+ /* Bingo */
+ if ((elen = zmw_rx_buf_readb(dev, buf, offset+1))>(bufLen - offset))
+ {
+ /* Element length error */
+ return 0xffff;
+ }
+
+ if ( elen == 0 )
+ {
+ return 0xffff;
+ }
+
+ if (((tmp = zmw_rx_buf_readb(dev, buf, offset+2)) == 0x00)
+ && ((tmp = zmw_rx_buf_readb(dev, buf, offset+3)) == 0x50)
+ && ((tmp = zmw_rx_buf_readb(dev, buf, offset+4)) == 0x43))
+
+ {
+ return offset;
+ }
+ }
+
+ /* Advance to next element */
+ if ((elen = zmw_rx_buf_readb(dev, buf, offset+1)) == 0)
+ {
+ return 0xffff;
+ }
+ offset += (elen+2);
+ }
+ return 0xffff;
+}
+
+u16_t zfFindBroadcomExtCap(zdev_t* dev, zbuf_t* buf)
+{
+ u8_t subType;
+ u16_t offset;
+ u16_t bufLen;
+ u16_t elen;
+ u8_t id;
+ u8_t tmp;
+
+ /* Get offset of first element */
+ subType = (zmw_rx_buf_readb(dev, buf, 0) >> 4);
+
+ if ((offset = zgElementOffsetTable[subType]) == 0xff)
+ {
+ zm_assert(0);
+ }
+
+ /* Plus wlan header */
+ offset += 24;
+
+ bufLen = zfwBufGetSize(dev, buf);
+
+ /* Search loop */
+ while((offset+2) < bufLen) // including element ID and length (2bytes)
+ {
+ /* Search target element */
+ if ((id = zmw_rx_buf_readb(dev, buf, offset)) == ZM_WLAN_EID_WIFI_IE)
+ {
+ /* Bingo */
+ if ((elen = zmw_rx_buf_readb(dev, buf, offset+1)) > (bufLen - offset))
+ {
+ /* Element length error */
+ return 0xffff;
+ }
+
+ if (elen == 0)
+ {
+ return 0xffff;
+ }
+
+ if ( ((tmp = zmw_rx_buf_readb(dev, buf, offset+2)) == 0x00)
+ && ((tmp = zmw_rx_buf_readb(dev, buf, offset+3)) == 0x10)
+ && ((tmp = zmw_rx_buf_readb(dev, buf, offset+4)) == 0x18) )
+ {
+ return offset;
+ }
+ }
+
+ /* Advance to next element */
+ if ((elen = zmw_rx_buf_readb(dev, buf, offset+1)) == 0)
+ {
+ return 0xffff;
+ }
+
+ offset += (elen+2);
+ }
+
+ return 0xffff;
+}
+
+u16_t zfFindRlnkExtCap(zdev_t* dev, zbuf_t* buf)
+{
+ u8_t subType;
+ u16_t offset;
+ u16_t bufLen;
+ u16_t elen;
+ u8_t id;
+ u8_t tmp;
+
+ /* Get offset of first element */
+ subType = (zmw_rx_buf_readb(dev, buf, 0) >> 4);
+
+ if ((offset = zgElementOffsetTable[subType]) == 0xff)
+ {
+ zm_assert(0);
+ }
+
+ /* Plus wlan header */
+ offset += 24;
+
+ bufLen = zfwBufGetSize(dev, buf);
+
+ /* Search loop */
+ while((offset+2) < bufLen) // including element ID and length (2bytes)
+ {
+ /* Search target element */
+ if ((id = zmw_rx_buf_readb(dev, buf, offset)) == 0x7F)
+ {
+ /* Bingo */
+ if ((elen = zmw_rx_buf_readb(dev, buf, offset+1)) > (bufLen - offset))
+ {
+ /* Element length error */
+ return 0xffff;
+ }
+
+ if ( elen == 0 )
+ {
+ return 0xffff;
+ }
+
+ if ((tmp = zmw_rx_buf_readb(dev, buf, offset+2)) == 0x01)
+
+ {
+ return offset;
+ }
+ }
+
+ /* Advance to next element */
+ if ((elen = zmw_rx_buf_readb(dev, buf, offset+1)) == 0)
+ {
+ return 0xffff;
+ }
+
+ offset += (elen+2);
+ }
+
+ return 0xffff;
+}
diff --git a/drivers/staging/otus/80211core/cmmap.c b/drivers/staging/otus/80211core/cmmap.c
new file mode 100644
index 00000000000..7f09fded459
--- /dev/null
+++ b/drivers/staging/otus/80211core/cmmap.c
@@ -0,0 +1,2402 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : mm.c */
+/* */
+/* Abstract */
+/* This module contains common functions for handle AP */
+/* management frame. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/************************************************************************/
+#include "cprecomp.h"
+#include "ratectrl.h"
+
+extern const u8_t zcUpToAc[];
+
+void zfMmApTimeTick(zdev_t* dev)
+{
+ u32_t now;
+ zmw_get_wlan_dev(dev);
+
+ //zm_debug_msg1("wd->wlanMode : ", wd->wlanMode);
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ /* => every 1.28 seconds */
+ /* AP : aging STA that does not active for wd->ap.staAgingTime */
+ now = wd->tick & 0x7f;
+ if (now == 0x0)
+ {
+ zfApAgingSta(dev);
+ }
+ else if (now == 0x1f)
+ {
+ zfQueueAge(dev, wd->ap.uapsdQ, wd->tick, 10000);
+ }
+ /* AP : check (wd->ap.protectedObss) and (wd->ap.bStaAssociated) */
+ /* to enable NonErp and Protection mode */
+ else if (now == 0x3f)
+ {
+ //zfApProtctionMonitor(dev);
+ }
+ }
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfApInitStaTbl */
+/* Init AP's station table. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+void zfApInitStaTbl(zdev_t* dev)
+{
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ for (i=0; i<ZM_MAX_STA_SUPPORT; i++)
+ {
+ wd->ap.staTable[i].valid = 0;
+ wd->ap.staTable[i].state = 0;
+ wd->ap.staTable[i].addr[0] = 0;
+ wd->ap.staTable[i].addr[1] = 0;
+ wd->ap.staTable[i].addr[2] = 0;
+ wd->ap.staTable[i].time = 0;
+ wd->ap.staTable[i].vap = 0;
+ wd->ap.staTable[i].encryMode = ZM_NO_WEP;
+ }
+ return;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfApFindSta */
+/* Find a STA in station table. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* addr : Target STA address */
+/* */
+/* OUTPUTS */
+/* 0xffff : fail */
+/* other : STA table index */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+u16_t zfApFindSta(zdev_t* dev, u16_t* addr)
+{
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ for (i=0; i<ZM_MAX_STA_SUPPORT; i++)
+ {
+ if (wd->ap.staTable[i].valid == 1)
+ {
+ if ((wd->ap.staTable[i].addr[0] == addr[0])
+ && (wd->ap.staTable[i].addr[1] == addr[1])
+ && (wd->ap.staTable[i].addr[2] == addr[2]))
+ {
+ return i;
+ }
+ }
+ }
+ return 0xffff;
+}
+
+u16_t zfApGetSTAInfo(zdev_t* dev, u16_t* addr, u16_t* state, u8_t* vap)
+{
+ u16_t id;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ if ((id = zfApFindSta(dev, addr)) != 0xffff)
+ {
+ *vap = wd->ap.staTable[id].vap;
+ *state = wd->ap.staTable[id++].state;
+ }
+
+ zmw_leave_critical_section(dev);
+
+ return id;
+}
+
+
+void zfApGetStaQosType(zdev_t* dev, u16_t* addr, u8_t* qosType)
+{
+ u16_t id;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ if ((id = zfApFindSta(dev, addr)) != 0xffff)
+ {
+ *qosType = wd->ap.staTable[id].qosType;
+ }
+ else
+ {
+ *qosType = 0;
+ }
+
+ zmw_leave_critical_section(dev);
+
+ return;
+}
+
+void zfApGetStaTxRateAndQosType(zdev_t* dev, u16_t* addr, u32_t* phyCtrl,
+ u8_t* qosType, u16_t* rcProbingFlag)
+{
+ u16_t id;
+ u8_t rate;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ if ((id = zfApFindSta(dev, addr)) != 0xffff)
+ {
+ rate = (u8_t)zfRateCtrlGetTxRate(dev, &wd->ap.staTable[id].rcCell, rcProbingFlag);
+#ifdef ZM_AP_DEBUG
+ //rate = 15;
+#endif
+ *phyCtrl = zcRateToPhyCtrl[rate];
+ *qosType = wd->ap.staTable[id].qosType;
+ }
+ else
+ {
+ if (wd->frequency < 3000)
+ {
+ /* CCK 1M */
+ //header[2] = 0x0f00; //PHY control L
+ //header[3] = 0x0000; //PHY control H
+ *phyCtrl = 0x00000F00;
+ }
+ else
+ {
+ /* CCK 6M */
+ //header[2] = 0x0f01; //PHY control L
+ //header[3] = 0x000B; //PHY control H
+ *phyCtrl = 0x000B0F01;
+ }
+ *qosType = 0;
+ }
+
+ zmw_leave_critical_section(dev);
+
+ zm_msg2_mm(ZM_LV_3, "PhyCtrl=", *phyCtrl);
+ return;
+}
+
+void zfApGetStaEncryType(zdev_t* dev, u16_t* addr, u8_t* encryType)
+{
+ //struct zsWlanDev* wd = (struct zsWlanDev*) zmw_wlan_dev(dev);
+ u16_t id;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ if ((id = zfApFindSta(dev, addr)) != 0xffff)
+ {
+ *encryType = wd->ap.staTable[id].encryMode;
+ }
+ else
+ {
+ *encryType = ZM_NO_WEP;
+ }
+
+ zmw_leave_critical_section(dev);
+
+ zm_msg2_mm(ZM_LV_3, "encyrType=", *encryType);
+ return;
+}
+
+void zfApGetStaWpaIv(zdev_t* dev, u16_t* addr, u16_t* iv16, u32_t* iv32)
+{
+ //struct zsWlanDev* wd = (struct zsWlanDev*) zmw_wlan_dev(dev);
+ u16_t id;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ if ((id = zfApFindSta(dev, addr)) != 0xffff)
+ {
+ *iv16 = wd->ap.staTable[id].iv16;
+ *iv32 = wd->ap.staTable[id].iv32;
+ }
+ else
+ {
+ *iv16 = 0;
+ *iv32 = 0;
+ }
+
+ zmw_leave_critical_section(dev);
+
+ zm_msg2_mm(ZM_LV_3, "iv16=", *iv16);
+ zm_msg2_mm(ZM_LV_3, "iv32=", *iv32);
+ return;
+}
+
+void zfApSetStaWpaIv(zdev_t* dev, u16_t* addr, u16_t iv16, u32_t iv32)
+{
+ //struct zsWlanDev* wd = (struct zsWlanDev*) zmw_wlan_dev(dev);
+ u16_t id;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ if ((id = zfApFindSta(dev, addr)) != 0xffff)
+ {
+ wd->ap.staTable[id].iv16 = iv16;
+ wd->ap.staTable[id].iv32 = iv32;
+ }
+
+ zmw_leave_critical_section(dev);
+
+ zm_msg2_mm(ZM_LV_3, "iv16=", iv16);
+ zm_msg2_mm(ZM_LV_3, "iv32=", iv32);
+ return;
+}
+
+void zfApClearStaKey(zdev_t* dev, u16_t* addr)
+{
+ //struct zsWlanDev* wd = (struct zsWlanDev*) zmw_wlan_dev(dev);
+ u16_t bcAddr[3] = { 0xffff, 0xffff, 0xffff };
+ u16_t id;
+
+ zmw_get_wlan_dev(dev);
+
+ if (zfMemoryIsEqual((u8_t*)bcAddr, (u8_t*)addr, sizeof(bcAddr)) == TRUE)
+ {
+ /* Turn off group key information */
+ // zfClearKey(dev, 0);
+ }
+ else
+ {
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ if ((id = zfApFindSta(dev, addr)) != 0xffff)
+ {
+ /* Turn off STA's key information */
+ zfHpRemoveKey(dev, id+1);
+
+ /* Update STA's Encryption Type */
+ wd->ap.staTable[id].encryMode = ZM_NO_WEP;
+ }
+ else
+ {
+ zm_msg0_mm(ZM_LV_3, "Can't find STA address\n");
+ }
+ zmw_leave_critical_section(dev);
+ }
+}
+
+#ifdef ZM_ENABLE_CENC
+void zfApGetStaCencIvAndKeyIdx(zdev_t* dev, u16_t* addr, u32_t *iv, u8_t *keyIdx)
+{
+ //struct zsWlanDev* wd = (struct zsWlanDev*) zmw_wlan_dev(dev);
+ u16_t id;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+
+ zmw_enter_critical_section(dev);
+
+ if ((id = zfApFindSta(dev, addr)) != 0xffff)
+ {
+ *iv++ = wd->ap.staTable[id].txiv[0];
+ *iv++ = wd->ap.staTable[id].txiv[1];
+ *iv++ = wd->ap.staTable[id].txiv[2];
+ *iv = wd->ap.staTable[id].txiv[3];
+ *keyIdx = wd->ap.staTable[id].cencKeyIdx;
+ }
+ else
+ {
+ *iv++ = 0x5c365c37;
+ *iv++ = 0x5c365c36;
+ *iv++ = 0x5c365c36;
+ *iv = 0x5c365c36;
+ *keyIdx = 0;
+ }
+
+ zmw_leave_critical_section(dev);
+ return;
+}
+
+void zfApSetStaCencIv(zdev_t* dev, u16_t* addr, u32_t *iv)
+{
+ //struct zsWlanDev* wd = (struct zsWlanDev*) zmw_wlan_dev(dev);
+ u16_t id;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+
+ zmw_enter_critical_section(dev);
+
+ if ((id = zfApFindSta(dev, addr)) != 0xffff)
+ {
+ wd->ap.staTable[id].txiv[0] = *iv++;
+ wd->ap.staTable[id].txiv[1] = *iv++;
+ wd->ap.staTable[id].txiv[2] = *iv++;
+ wd->ap.staTable[id].txiv[3] = *iv;
+ }
+
+ zmw_leave_critical_section(dev);
+
+ return;
+}
+#endif //ZM_ENABLE_CENC
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfApFlushBufferedPsFrame */
+/* Free buffered PS frames. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2007.1 */
+/* */
+/************************************************************************/
+void zfApFlushBufferedPsFrame(zdev_t* dev)
+{
+ u16_t emptyFlag;
+ u16_t freeCount;
+ u16_t vap;
+ zbuf_t* psBuf = NULL;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ freeCount = 0;
+ emptyFlag = 0;
+ while (1)
+ {
+ psBuf = NULL;
+ zmw_enter_critical_section(dev);
+ if (wd->ap.uniHead != wd->ap.uniTail)
+ {
+ psBuf = wd->ap.uniArray[wd->ap.uniHead];
+ wd->ap.uniHead = (wd->ap.uniHead + 1) & (ZM_UNI_ARRAY_SIZE - 1);
+ }
+ else
+ {
+ emptyFlag = 1;
+ }
+ zmw_leave_critical_section(dev);
+
+ if (psBuf != NULL)
+ {
+ zfwBufFree(dev, psBuf, ZM_ERR_FLUSH_PS_QUEUE);
+ }
+ zm_assert(freeCount++ < (ZM_UNI_ARRAY_SIZE*2));
+
+ if (emptyFlag != 0)
+ {
+ break;
+ }
+ }
+
+ for (vap=0; vap<ZM_MAX_AP_SUPPORT; vap++)
+ {
+ freeCount = 0;
+ emptyFlag = 0;
+ while (1)
+ {
+ psBuf = NULL;
+ zmw_enter_critical_section(dev);
+ if (wd->ap.bcmcHead[vap] != wd->ap.bcmcTail[vap])
+ {
+ psBuf = wd->ap.bcmcArray[vap][wd->ap.bcmcHead[vap]];
+ wd->ap.bcmcHead[vap] = (wd->ap.bcmcHead[vap] + 1)
+ & (ZM_BCMC_ARRAY_SIZE - 1);
+ }
+ else
+ {
+ emptyFlag = 1;
+ }
+ zmw_leave_critical_section(dev);
+
+ if (psBuf != NULL)
+ {
+ zfwBufFree(dev, psBuf, ZM_ERR_FLUSH_PS_QUEUE);
+ }
+ zm_assert(freeCount++ < (ZM_BCMC_ARRAY_SIZE*2));
+
+ if (emptyFlag != 0)
+ {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+
+u16_t zfApBufferPsFrame(zdev_t* dev, zbuf_t* buf, u16_t port)
+{
+ u16_t id;
+ u16_t addr[3];
+ u16_t vap = 0;
+ u8_t up;
+ u16_t fragOff;
+ u8_t ac;
+ u16_t ret;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ if (port < ZM_MAX_AP_SUPPORT)
+ {
+ vap = port;
+ }
+
+ addr[0] = zmw_rx_buf_readh(dev, buf, 0);
+ addr[1] = zmw_rx_buf_readh(dev, buf, 2);
+ addr[2] = zmw_rx_buf_readh(dev, buf, 4);
+
+ if ((addr[0] & 0x1) == 0x1)
+ {
+ if (wd->ap.staPowerSaving > 0)
+ {
+ zmw_enter_critical_section(dev);
+
+ /* Buffer this BC or MC frame */
+ if (((wd->ap.bcmcTail[vap]+1)&(ZM_BCMC_ARRAY_SIZE-1))
+ != wd->ap.bcmcHead[vap])
+ {
+ wd->ap.bcmcArray[vap][wd->ap.bcmcTail[vap]++] = buf;
+ wd->ap.bcmcTail[vap] &= (ZM_BCMC_ARRAY_SIZE-1);
+ zmw_leave_critical_section(dev);
+
+ zm_msg0_tx(ZM_LV_0, "Buffer BCMC");
+ }
+ else
+ {
+ /* bcmcArray full */
+ zmw_leave_critical_section(dev);
+
+ zm_msg0_tx(ZM_LV_0, "BCMC buffer full");
+
+ /* free buffer according to buffer type */
+ zfwBufFree(dev, buf, ZM_ERR_BCMC_PS_BUFFER_UNAVAILABLE);
+ }
+ return 1;
+ }
+ }
+ else
+ {
+ zmw_enter_critical_section(dev);
+
+ if ((id = zfApFindSta(dev, addr)) != 0xffff)
+ {
+ if (wd->ap.staTable[id].psMode == 1)
+ {
+
+ zfTxGetIpTosAndFrag(dev, buf, &up, &fragOff);
+ ac = zcUpToAc[up&0x7] & 0x3;
+
+ if ((wd->ap.staTable[id].qosType == 1) &&
+ ((wd->ap.staTable[id].qosInfo & (0x8>>ac)) != 0))
+ {
+ ret = zfQueuePutNcs(dev, wd->ap.uapsdQ, buf, wd->tick);
+ zmw_leave_critical_section(dev);
+ if (ret != ZM_SUCCESS)
+ {
+ zfwBufFree(dev, buf, ZM_ERR_AP_UAPSD_QUEUE_FULL);
+ }
+ }
+ else
+ {
+ /* Buffer this unicast frame */
+ if (((wd->ap.uniTail+1)&(ZM_UNI_ARRAY_SIZE-1))
+ != wd->ap.uniHead)
+ {
+ wd->ap.uniArray[wd->ap.uniTail++] = buf;
+ wd->ap.uniTail &= (ZM_UNI_ARRAY_SIZE-1);
+ zmw_leave_critical_section(dev);
+ zm_msg0_tx(ZM_LV_0, "Buffer UNI");
+
+ }
+ else
+ {
+ /* uniArray full */
+ zmw_leave_critical_section(dev);
+ zm_msg0_tx(ZM_LV_0, "UNI buffer full");
+ /* free buffer according to buffer type */
+ zfwBufFree(dev, buf, ZM_ERR_UNI_PS_BUFFER_UNAVAILABLE);
+ }
+ }
+ return 1;
+ } /* if (wd->ap.staTable[id++].psMode == 1) */
+ } /* if ((id = zfApFindSta(dev, addr)) != 0xffff) */
+ zmw_leave_critical_section(dev);
+ }
+
+ return 0;
+}
+
+u16_t zfApGetSTAInfoAndUpdatePs(zdev_t* dev, u16_t* addr, u16_t* state,
+ u8_t* vap, u16_t psMode, u8_t* uapsdTrig)
+{
+ u16_t id;
+ u8_t uapsdStaAwake = 0;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+#ifdef ZM_AP_DEBUG
+ //psMode=0;
+#endif
+
+ if ((id = zfApFindSta(dev, addr)) != 0xffff)
+ {
+ if (psMode != 0)
+ {
+ zm_msg0_mm(ZM_LV_0, "psMode = 1");
+ if (wd->ap.staTable[id].psMode == 0)
+ {
+ wd->ap.staPowerSaving++;
+ }
+ else
+ {
+ if (wd->ap.staTable[id].qosType == 1)
+ {
+ zm_msg0_mm(ZM_LV_0, "UAPSD trigger");
+ *uapsdTrig = wd->ap.staTable[id].qosInfo;
+ }
+ }
+ }
+ else
+ {
+ if (wd->ap.staTable[id].psMode != 0)
+ {
+ wd->ap.staPowerSaving--;
+ if ((wd->ap.staTable[id].qosType == 1) && ((wd->ap.staTable[id].qosInfo&0xf)!=0))
+ {
+ uapsdStaAwake = 1;
+ }
+ }
+ }
+
+ wd->ap.staTable[id].psMode = (u8_t) psMode;
+ wd->ap.staTable[id].time = wd->tick;
+ *vap = wd->ap.staTable[id].vap;
+ *state = wd->ap.staTable[id++].state;
+ }
+
+ zmw_leave_critical_section(dev);
+
+ if (uapsdStaAwake == 1)
+ {
+ zbuf_t* psBuf;
+ u8_t mb;
+
+ while (1)
+ {
+ if ((psBuf = zfQueueGetWithMac(dev, wd->ap.uapsdQ, (u8_t*)addr, &mb)) != NULL)
+ {
+ zfTxSendEth(dev, psBuf, 0, ZM_EXTERNAL_ALLOC_BUF, 0);
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+
+ return id;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfApGetNewSta */
+/* Get a new STA from station table. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* 0xffff : fail */
+/* other : STA table index */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+u16_t zfApGetNewSta(zdev_t* dev)
+{
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ for (i=0; i<ZM_MAX_STA_SUPPORT; i++)
+ {
+ if (wd->ap.staTable[i].valid == 0)
+ {
+ zm_msg2_mm(ZM_LV_0, "zfApGetNewSta=", i);
+ return i;
+ }
+ }
+ return 0xffff;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfApAddSta */
+/* Add a STA to station table. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* addr : STA MAC address */
+/* state : STA state */
+/* apId : Virtual AP ID */
+/* type : 0=>11b, 1=>11g */
+/* */
+/* OUTPUTS */
+/* 0xffff : fail */
+/* Other : index */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+u16_t zfApAddSta(zdev_t* dev, u16_t* addr, u16_t state, u16_t apId, u8_t type,
+ u8_t qosType, u8_t qosInfo)
+{
+ u16_t index;
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zm_msg1_mm(ZM_LV_0, "STA type=", type);
+
+ zmw_enter_critical_section(dev);
+
+ if ((index = zfApFindSta(dev, addr)) != 0xffff)
+ {
+ zm_msg0_mm(ZM_LV_2, "found");
+ /* Update STA state */
+ if ((state == ZM_STATE_AUTH) || (state == ZM_STATE_PREAUTH))
+ {
+ wd->ap.staTable[index].state = state;
+ wd->ap.staTable[index].time = wd->tick;
+ wd->ap.staTable[index].vap = (u8_t)apId;
+ }
+ else if (state == ZM_STATE_ASOC)
+ {
+ if ((wd->ap.staTable[index].state == ZM_STATE_AUTH))
+ //&& (wd->ap.staTable[index].vap == apId))
+ {
+ wd->ap.staTable[index].state = state;
+ wd->ap.staTable[index].time = wd->tick;
+ wd->ap.staTable[index].qosType = qosType;
+ wd->ap.staTable[index].vap = (u8_t)apId;
+ wd->ap.staTable[index].staType = type;
+ wd->ap.staTable[index].qosInfo = qosInfo;
+
+ if (wd->frequency < 3000)
+ {
+ /* Init 11b/g */
+ zfRateCtrlInitCell(dev, &wd->ap.staTable[index].rcCell, type, 1, 1);
+ }
+ else
+ {
+ /* Init 11a */
+ zfRateCtrlInitCell(dev, &wd->ap.staTable[index].rcCell, type, 0, 1);
+ }
+
+ if (wd->zfcbApConnectNotify != NULL)
+ {
+ wd->zfcbApConnectNotify(dev, (u8_t*)addr, apId);
+ }
+ }
+ else
+ {
+ index = 0xffff;
+ }
+ }
+ }
+ else
+ {
+ zm_msg0_mm(ZM_LV_2, "Not found");
+ if ((state == ZM_STATE_AUTH) || (state == ZM_STATE_PREAUTH))
+ {
+ /* Get a new STA and update state */
+ index = zfApGetNewSta(dev);
+ zm_msg2_mm(ZM_LV_1, "new STA index=", index);
+
+ if (index != 0xffff)
+ {
+ for (i=0; i<3; i++)
+ {
+ wd->ap.staTable[index].addr[i] = addr[i];
+ }
+ wd->ap.staTable[index].state = state;
+ wd->ap.staTable[index].valid = 1;
+ wd->ap.staTable[index].time = wd->tick;
+ wd->ap.staTable[index].vap = (u8_t)apId;
+ wd->ap.staTable[index].encryMode = ZM_NO_WEP;
+ }
+ }
+ }
+
+ zmw_leave_critical_section(dev);
+
+ return index;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfApAgingSta */
+/* Aging STA in station table. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* number of 11b STA in STA table */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+void zfApAgingSta(zdev_t* dev)
+{
+ u16_t i;
+ u32_t deltaMs;
+ u16_t addr[3];
+ u16_t txFlag;
+ u16_t psStaCount = 0;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ wd->ap.gStaAssociated = wd->ap.bStaAssociated = 0;
+
+ for (i=0; i<ZM_MAX_STA_SUPPORT; i++)
+ {
+ txFlag = 0;
+ zmw_enter_critical_section(dev);
+ if (wd->ap.staTable[i].valid == 1)
+ {
+ addr[0] = wd->ap.staTable[i].addr[0];
+ addr[1] = wd->ap.staTable[i].addr[1];
+ addr[2] = wd->ap.staTable[i].addr[2];
+ /* millisecond */
+ deltaMs = (u32_t)((u32_t)wd->tick-(u32_t)wd->ap.staTable[i].time)
+ * ZM_MS_PER_TICK;
+
+ /* preauth */
+ if ((wd->ap.staTable[i].state == ZM_STATE_PREAUTH)
+ && (deltaMs > ZM_PREAUTH_TIMEOUT_MS))
+ {
+ /* Aging STA */
+ wd->ap.staTable[i].valid = 0;
+ wd->ap.authSharing = 0;
+ txFlag = 1;
+ }
+
+ /* auth */
+ if ((wd->ap.staTable[i].state == ZM_STATE_AUTH)
+ && (deltaMs > ZM_AUTH_TIMEOUT_MS))
+ {
+ /* Aging STA */
+ wd->ap.staTable[i].valid = 0;
+ txFlag = 1;
+ }
+
+ /* asoc */
+ if (wd->ap.staTable[i].state == ZM_STATE_ASOC)
+ {
+ if (wd->ap.staTable[i].psMode != 0)
+ {
+ psStaCount++;
+ }
+
+ if (deltaMs > ((u32_t)wd->ap.staAgingTimeSec<<10))
+ {
+ /* Aging STA */
+ zm_msg1_mm(ZM_LV_0, "Age STA index=", i);
+ wd->ap.staTable[i].valid = 0;
+ txFlag = 1;
+ }
+ else if (deltaMs > ((u32_t)wd->ap.staProbingTimeSec<<10))
+ {
+ if (wd->ap.staTable[i].psMode == 0)
+ {
+ /* Probing non-PS STA */
+ zm_msg1_mm(ZM_LV_0, "Probing STA index=", i);
+ wd->ap.staTable[i].time +=
+ (wd->ap.staProbingTimeSec * ZM_TICK_PER_SECOND);
+ txFlag = 2;
+ }
+ }
+ }
+
+
+ }
+ zmw_leave_critical_section(dev);
+
+ if (txFlag == 1)
+ {
+ /* Send deauthentication management frame */
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH, addr, 4, 0, 0);
+ }
+ else if (txFlag == 2)
+ {
+ zfSendMmFrame(dev, ZM_WLAN_DATA_FRAME, addr, 0, 0, 0);
+ }
+
+ }
+
+ wd->ap.staPowerSaving = psStaCount;
+
+ return;
+}
+
+void zfApProtctionMonitor(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ /* 11b STA associated => nonErp, Protect */
+ if (wd->ap.bStaAssociated > 0)
+ {
+ /* Enable NonErp bit in information element */
+ wd->erpElement = ZM_WLAN_NON_ERP_PRESENT_BIT
+ | ZM_WLAN_USE_PROTECTION_BIT;
+
+ /* Enable protection mode */
+ zfApSetProtectionMode(dev, 1);
+
+ }
+ /* 11b STA not associated, protection OBSS present => Protect */
+ else if (wd->ap.protectedObss > 2) //Threshold
+ {
+ if (wd->disableSelfCts == 0)
+ {
+ /* Disable NonErp bit in information element */
+ wd->erpElement = ZM_WLAN_USE_PROTECTION_BIT;
+
+ /* Enable protection mode */
+ zfApSetProtectionMode(dev, 1);
+ }
+ }
+ else
+ {
+ /* Disable NonErp bit in information element */
+ wd->erpElement = 0;
+
+ /* Disable protection mode */
+ zfApSetProtectionMode(dev, 0);
+ }
+ wd->ap.protectedObss = 0;
+}
+
+
+void zfApProcessBeacon(zdev_t* dev, zbuf_t* buf)
+{
+ u16_t offset;
+ u8_t ch;
+
+ zmw_get_wlan_dev(dev);
+
+ zm_msg0_mm(ZM_LV_3, "Rx beacon");
+
+ /* update Non-ERP flag(wd->ap.nonErpObss) */
+ if ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_ERP)) == 0xffff)
+ {
+ /* 11b OBSS */
+ wd->ap.protectedObss++;
+ return;
+ }
+
+ ch = zmw_rx_buf_readb(dev, buf, offset+2);
+ if ((ch & ZM_WLAN_USE_PROTECTION_BIT) == ZM_WLAN_USE_PROTECTION_BIT)
+ {
+ /* Protected OBSS */
+ wd->ap.protectedObss = 1;
+ }
+
+ return;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfProcessAuth */
+/* Process authenticate management frame. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : auth frame buffer */
+/* */
+/* OUTPUTS */
+/* none */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+/* Note : AP allows one authenticating STA at a time, does not */
+/* support multiple authentication process. Make sure */
+/* authentication state machine will not be blocked due */
+/* to incompleted authentication handshake. */
+void zfApProcessAuth(zdev_t* dev, zbuf_t* buf, u16_t* src, u16_t apId)
+{
+ u16_t algo, seq, status;
+ u8_t authSharing;
+ u16_t ret;
+ u16_t i;
+ u8_t challengePassed = 0;
+ u8_t frameCtrl;
+ u32_t retAlgoSeq;
+ u32_t retStatus;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+
+ frameCtrl = zmw_rx_buf_readb(dev, buf, 1);
+ /* AP : Auth share 3 */
+ /* shift for WEP IV */
+ if ((frameCtrl & 0x40) != 0)
+ {
+ algo = zmw_rx_buf_readh(dev, buf, 28);
+ seq = zmw_rx_buf_readh(dev, buf, 30);
+ status = zmw_rx_buf_readh(dev, buf, 32);
+ }
+ else
+ {
+ algo = zmw_rx_buf_readh(dev, buf, 24);
+ seq = zmw_rx_buf_readh(dev, buf, 26);
+ status = zmw_rx_buf_readh(dev, buf, 28);
+ }
+
+ zm_msg2_mm(ZM_LV_0, "Rx Auth, seq=", seq);
+
+ /* Set default to authentication algorithm not support */
+ retAlgoSeq = 0x20000 | algo;
+ retStatus = 13; /* authentication algorithm not support */
+
+ /* AP : Auth open 1 */
+ if (algo == 0)
+ {
+ if (wd->ap.authAlgo[apId] == 0)
+ {
+ retAlgoSeq = 0x20000;
+ if (seq == 1)
+ {
+ /* AP : update STA to auth */
+ if ((ret = zfApAddSta(dev, src, ZM_STATE_AUTH, apId, 0, 0, 0)) != 0xffff)
+ {
+ /* AP : call zfwAuthNotify() for host to judge */
+ //zfwAuthNotify(dev, src);
+
+ /* AP : response Auth seq=2, success */
+ retStatus = 0;
+
+ }
+ else
+ {
+ /* AP : response Auth seq=2, unspecific error */
+ retStatus = 1;
+ }
+ }
+ else
+ {
+ /* AP : response Auth seq=2, sequence number out of expected */
+ retStatus = 14;
+ }
+ }
+ }
+ /* AP : Auth share 1 */
+ else if (algo == 1)
+ {
+ if (wd->ap.authAlgo[apId] == 1)
+ {
+ if (seq == 1)
+ {
+ retAlgoSeq = 0x20001;
+
+ /* critical section */
+ zmw_enter_critical_section(dev);
+ if (wd->ap.authSharing == 1)
+ {
+ authSharing = 1;
+ }
+ else
+ {
+ authSharing = 0;
+ wd->ap.authSharing = 1;
+ }
+ /* end of critical section */
+ zmw_leave_critical_section(dev);
+
+ if (authSharing == 1)
+ {
+ /* AP : response Auth seq=2, status = fail */
+ retStatus = 1;
+ }
+ else
+ {
+ /* AP : update STA to preauth */
+ zfApAddSta(dev, src, ZM_STATE_PREAUTH, apId, 0, 0, 0);
+
+ /* AP : call zfwAuthNotify() for host to judge */
+ //zfwAuthNotify(dev, src);
+
+ /* AP : response Auth seq=2 */
+ retStatus = 0;
+ }
+ }
+ else if (seq == 3)
+ {
+ retAlgoSeq = 0x40001;
+
+ if (wd->ap.authSharing == 1)
+ {
+ /* check challenge text */
+ if (zmw_buf_readh(dev, buf, 30+4) == 0x8010)
+ {
+ for (i=0; i<128; i++)
+ {
+ if (wd->ap.challengeText[i]
+ != zmw_buf_readb(dev, buf, 32+i+4))
+ {
+ break;
+ }
+ }
+ if (i == 128)
+ {
+ challengePassed = 1;
+ }
+ }
+
+ if (challengePassed == 1)
+ {
+ /* AP : update STA to auth */
+ zfApAddSta(dev, src, ZM_STATE_AUTH, apId, 0, 0, 0);
+
+ /* AP : response Auth seq=2 */
+ retStatus = 0;
+ }
+ else
+ {
+ /* AP : response Auth seq=2, challenge failure */
+ retStatus = 15;
+
+ /* TODO : delete STA */
+ }
+
+ wd->ap.authSharing = 0;
+ }
+ }
+ else
+ {
+ retAlgoSeq = 0x40001;
+ retStatus = 14;
+ }
+ }
+ }
+
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_AUTH, src, retAlgoSeq,
+ retStatus, apId);
+ return;
+}
+
+void zfApProcessAsocReq(zdev_t* dev, zbuf_t* buf, u16_t* src, u16_t apId)
+{
+ u16_t aid = 0xffff;
+ u8_t frameType;
+ u16_t offset;
+ u8_t staType = 0;
+ u8_t qosType = 0;
+ u8_t qosInfo = 0;
+ u8_t tmp;
+ u16_t i, j, k;
+ u16_t encMode = 0;
+
+ zmw_get_wlan_dev(dev);
+ /* AP : check SSID */
+ if ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_SSID)) != 0xffff)
+ {
+ k = 0;
+ for (j = 0; j < wd->ap.vapNumber; j++)
+ {
+ if ((tmp = zmw_buf_readb(dev, buf, offset+1))
+ != wd->ap.ssidLen[j])
+ {
+ k++;
+ }
+ }
+ if (k == wd->ap.vapNumber)
+ {
+ goto zlDeauth;
+ }
+
+ k = 0;
+ for (j = 0; j < wd->ap.vapNumber; j++)
+ {
+ for (i=0; i<wd->ap.ssidLen[j]; i++)
+ {
+ if ((tmp = zmw_buf_readb(dev, buf, offset+2+i))
+ != wd->ap.ssid[j][i])
+ {
+ break;
+ }
+ }
+ if (i == wd->ap.ssidLen[j])
+ {
+ apId = j;
+ }
+ else
+ {
+ k++;
+ }
+ }
+ if (k == wd->ap.vapNumber)
+ {
+ goto zlDeauth;
+ }
+ }
+
+ /* TODO : check capability */
+
+ /* AP : check support rate */
+ if ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_EXTENDED_RATE)) != 0xffff)
+ {
+ /* 11g STA */
+ staType = 1;
+ }
+ //CWYang(+)
+ if ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_HT_CAPABILITY)) != 0xffff)
+ {
+ /* 11n STA */
+ staType = 2;
+ }
+
+ /* TODO : do not allow 11b STA to associated in Pure G mode */
+ if (wd->ap.wlanType[apId] == ZM_WLAN_TYPE_PURE_G && staType == 0)
+ {
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH, src, 3, 0, 0);
+ return;
+ }
+
+ /* In pure B mode, we set G STA into B mode */
+ if (wd->ap.wlanType[apId] == ZM_WLAN_TYPE_PURE_B && staType == 1)
+ {
+ staType = 0;
+ }
+
+ /* AP : check 11i and WPA */
+ /* AP : check 11h */
+
+ /* AP : check WME */
+ if ((offset = zfFindWifiElement(dev, buf, 2, 0)) != 0xffff)
+ {
+ /* WME STA */
+ qosType = 1;
+ zm_msg0_mm(ZM_LV_0, "WME STA");
+
+ if (wd->ap.uapsdEnabled != 0)
+ {
+ qosInfo = zmw_rx_buf_readb(dev, buf, offset+8);
+ }
+ }
+
+ if (wd->ap.wpaSupport[apId] == 1)
+ {
+ if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_WPA_IE)) != 0xffff )
+ {
+ /* get WPA IE */
+ u8_t length = zmw_rx_buf_readb(dev, buf, offset+1);
+ if (length+2 < ZM_MAX_WPAIE_SIZE)
+ {
+ zfCopyFromRxBuffer(dev, buf, wd->ap.stawpaIe[apId], offset, length+2);
+ wd->ap.stawpaLen[apId] = length+2;
+ encMode = 1;
+
+
+ zm_msg1_mm(ZM_LV_0, "WPA Mode zfwAsocNotify, apId=", apId);
+
+ /* AP : Call zfwAsocNotify() */
+ if (wd->zfcbAsocNotify != NULL)
+ {
+ wd->zfcbAsocNotify(dev, src, wd->ap.stawpaIe[apId], wd->ap.stawpaLen[apId], apId);
+ }
+ }
+ else
+ {
+ goto zlDeauth;
+ }
+ }
+ else if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_RSN_IE)) != 0xffff )
+ {
+ /* get RSN IE */
+ u8_t length = zmw_rx_buf_readb(dev, buf, offset+1);
+ if (length+2 < ZM_MAX_WPAIE_SIZE)
+ {
+ zfCopyFromRxBuffer(dev, buf, wd->ap.stawpaIe[apId], offset, length+2);
+ wd->ap.stawpaLen[apId] = length+2;
+ encMode = 1;
+
+ zm_msg1_mm(ZM_LV_0, "RSN Mode zfwAsocNotify, apId=", apId);
+
+ /* AP : Call zfwAsocNotify() */
+ if (wd->zfcbAsocNotify != NULL)
+ {
+ wd->zfcbAsocNotify(dev, src, wd->ap.stawpaIe[apId], wd->ap.stawpaLen[apId], apId);
+ }
+ }
+ else
+ {
+ goto zlDeauth;
+ }
+ }
+#ifdef ZM_ENABLE_CENC
+ else if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_CENC_IE)) != 0xffff )
+ {
+ /* get CENC IE */
+ u8_t length = zmw_rx_buf_readb(dev, buf, offset+1);
+
+ if (length+2 < ZM_MAX_WPAIE_SIZE)
+ {
+ zfCopyFromRxBuffer(dev, buf, wd->ap.stawpaIe[apId], offset, length+2);
+ wd->ap.stawpaLen[apId] = length+2;
+ encMode = 1;
+
+ zm_msg1_mm(ZM_LV_0, "CENC Mode zfwAsocNotify, apId=", apId);
+
+ /* AP : Call zfwAsocNotify() */
+ if (wd->zfcbCencAsocNotify != NULL)
+ {
+ wd->zfcbCencAsocNotify(dev, src, wd->ap.stawpaIe[apId],
+ wd->ap.stawpaLen[apId], apId);
+ }
+ }
+ else
+ {
+ goto zlDeauth;
+ }
+ }
+#endif //ZM_ENABLE_CENC
+ else
+ { /* ap is encryption but sta has no wpa/rsn ie */
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH, src, 6, 0, 0);
+ return;
+ }
+ }
+ /* sta has wpa/rsn ie but ap is no encryption */
+ if ((wd->ap.wpaSupport[apId] == 0) && (encMode == 1))
+ {
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH, src, 6, 0, 0);
+ return;
+ }
+
+ /* AP : update STA to asoc */
+ aid = zfApAddSta(dev, src, ZM_STATE_ASOC, apId, staType, qosType, qosInfo);
+
+ zfApStoreAsocReqIe(dev, buf, aid);
+
+zlDeauth:
+ /* AP : send asoc rsp2 */
+ if (aid != 0xffff)
+ {
+ frameType = zmw_rx_buf_readb(dev, buf, 0);
+
+ if (frameType == ZM_WLAN_FRAME_TYPE_ASOCREQ)
+ {
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_ASOCRSP, src, 0, aid+1, apId);
+ }
+ else
+ {
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_REASOCRSP, src, 0, aid+1, apId);
+ }
+ }
+ else
+ {
+ /* TODO : send deauthentication */
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH, src, 6, 0, 0);
+ }
+
+ return;
+}
+
+void zfApStoreAsocReqIe(zdev_t* dev, zbuf_t* buf, u16_t aid)
+{
+ //struct zsWlanAssoFrameHeader* pAssoFrame;
+ //u8_t pBuf[sizeof(struct zsWlanAssoFrameHeader)];
+ u16_t offset;
+ u32_t i;
+ u16_t length;
+ u8_t *htcap;
+
+ zmw_get_wlan_dev(dev);
+
+ for (i=0; i<wd->sta.asocRspFrameBodySize; i++)
+ {
+ wd->sta.asocRspFrameBody[i] = zmw_rx_buf_readb(dev, buf, i+24);
+ }
+ /* capability: 2 octets */
+ offset = 24;
+
+ /* Listen interval: 2 octets */
+ offset = 26;
+
+ /* SSID */
+ offset = 28;
+
+ /* supported rates */
+ if ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_SUPPORT_RATE)) == 0xffff)
+ return;
+ length = zmw_rx_buf_readb(dev, buf, offset + 1);
+
+ /* extended supported rates */
+ if ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_EXTENDED_RATE)) == 0xffff)
+ return;
+ length = zmw_rx_buf_readb(dev, buf, offset + 1);
+
+ /* power capability:4 octets */
+ offset = offset + 2 + length;
+
+ /* supported channels: 4 octets */
+ offset = offset + 2 + 4;
+
+ /* RSN */
+
+ /* QoS */
+
+ /* HT capabilities: 28 octets */
+ if ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_HT_CAPABILITY)) != 0xffff) {
+ /* atheros pre n */
+ htcap = (u8_t *)&wd->ap.ie[aid].HtCap;
+ htcap[0] = zmw_rx_buf_readb(dev, buf, offset);
+ htcap[1] = 26;
+ for (i=1; i<=26; i++)
+ {
+ htcap[i+1] = zmw_rx_buf_readb(dev, buf, offset + i);
+ zm_debug_msg2("ASOC: HT Capabilities, htcap=", htcap[i+1]);
+ }
+ return;
+ }
+ else if ((offset = zfFindElement(dev, buf, ZM_WLAN_PREN2_EID_HTCAPABILITY)) != 0xffff) {
+ /* pre n 2.0 standard */
+ htcap = (u8_t *)&wd->ap.ie[aid].HtCap;
+ for (i=0; i<28; i++)
+ {
+ htcap[i] = zmw_rx_buf_readb(dev, buf, offset + i);
+ zm_debug_msg2("ASOC: HT Capabilities, htcap=", htcap[i]);
+ }
+ }
+ else {
+ /* not 11n AP */
+ return;
+ }
+
+
+ /* supported regulatory classes */
+ offset = offset + length;
+ //length = zmw_rx_buf_readb(dev, buf, offset + 1);
+ {
+ u8_t *htcap;
+ htcap = (u8_t *)&wd->sta.ie.HtInfo;
+ //zm_debug_msg2("ASOC: HT Capabilities info=", ((u16_t *)htcap)[1]);
+ //zm_debug_msg2("ASOC: A-MPDU parameters=", htcap[4]);
+ //zm_debug_msg2("ASOC: Supported MCS set=", ((u32_t *)htcap)[1]>>8);
+ }
+
+}
+
+void zfApProcessAsocRsp(zdev_t* dev, zbuf_t* buf)
+{
+
+}
+
+void zfApProcessDeauth(zdev_t* dev, zbuf_t* buf, u16_t* src, u16_t apId)
+{
+ u16_t aid;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ /* AP : if SA=associated STA then deauthenticate STA */
+ if ((aid = zfApFindSta(dev, src)) != 0xffff)
+ {
+ /* Clear STA table */
+ wd->ap.staTable[aid].valid = 0;
+ if (wd->zfcbDisAsocNotify != NULL)
+ {
+ wd->zfcbDisAsocNotify(dev, (u8_t*)src, apId);
+ }
+ }
+ zmw_leave_critical_section(dev);
+
+}
+
+void zfApProcessDisasoc(zdev_t* dev, zbuf_t* buf, u16_t* src, u16_t apId)
+{
+ u16_t aid;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ /* AP : if SA=associated STA then deauthenticate STA */
+ if ((aid = zfApFindSta(dev, src)) != 0xffff)
+ {
+ /* Clear STA table */
+ wd->ap.staTable[aid].valid = 0;
+ zmw_leave_critical_section(dev);
+ if (wd->zfcbDisAsocNotify != NULL)
+ {
+ wd->zfcbDisAsocNotify(dev, (u8_t*)src, apId);
+ }
+ }
+ zmw_leave_critical_section(dev);
+
+}
+
+
+void zfApProcessProbeRsp(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* AddInfo)
+{
+#if 0
+ zmw_get_wlan_dev(dev);
+
+ zm_msg0_mm(ZM_LV_0, "Rx probersp");
+
+ /* Gather scan result */
+
+ //zm_debug_msg1("bssList Count = ", wd->sta.bssList.bssCount);
+ /* return if not in scanning */
+ if ((wd->heartBeatNotification & ZM_BSSID_LIST_SCAN)
+ != ZM_BSSID_LIST_SCAN)
+ {
+ return;
+ }
+
+ //if ( wd->sta.pUpdateBssList->bssCount == ZM_MAX_BSS )
+ if ( wd->sta.bssList.bssCount == ZM_MAX_BSS )
+ {
+ return;
+ }
+
+ zfProcessProbeRsp(dev, buf, AddInfo);
+
+#endif
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfApAddIeSsid */
+/* Add AP information element SSID to buffer. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : buffer to add information element */
+/* offset : add information element from this offset */
+/* vap : virtual AP ID */
+/* */
+/* OUTPUTS */
+/* buffer offset after adding information element */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.11 */
+/* */
+/************************************************************************/
+u16_t zfApAddIeSsid(zdev_t* dev, zbuf_t* buf, u16_t offset, u16_t vap)
+{
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ /* Element ID */
+ zmw_tx_buf_writeb(dev, buf, offset++, ZM_WLAN_EID_SSID);
+
+ /* Element Length */
+ zmw_tx_buf_writeb(dev, buf, offset++, wd->ap.ssidLen[vap]);
+
+ /* Information : SSID */
+ for (i=0; i<wd->ap.ssidLen[vap]; i++)
+ {
+ zmw_tx_buf_writeb(dev, buf, offset++, wd->ap.ssid[vap][i]);
+ }
+
+ return offset;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfApAddIeTim */
+/* Add AP information element TIM to buffer. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : buffer to add information element */
+/* offset : add information element from this offset */
+/* vap : virtual AP ID */
+/* */
+/* OUTPUTS */
+/* buffer offset after adding information element */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.11 */
+/* */
+/************************************************************************/
+u16_t zfApAddIeTim(zdev_t* dev, zbuf_t* buf, u16_t offset, u16_t vap)
+{
+ u8_t uniBitMap[9];
+ u16_t highestByte;
+ u16_t i;
+ u16_t lenOffset;
+ u16_t id;
+ u16_t dst[3];
+ u16_t aid;
+ u16_t bitPosition;
+ u16_t bytePosition;
+ zbuf_t* psBuf;
+ zbuf_t* tmpBufArray[ZM_UNI_ARRAY_SIZE];
+ u16_t tmpBufArraySize = 0;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ /* Element ID */
+ zmw_tx_buf_writeb(dev, buf, offset++, ZM_WLAN_EID_TIM);
+
+ /* offset of Element Length */
+ lenOffset = offset++;
+
+ /* Information : TIM */
+ /* DTIM count */
+ /* TODO : Doesn't work for Virtual AP's case */
+ wd->CurrentDtimCount++;
+ if (wd->CurrentDtimCount >= wd->dtim)
+ {
+ wd->CurrentDtimCount = 0;
+ }
+ zmw_tx_buf_writeb(dev, buf, offset++, wd->CurrentDtimCount);
+ /* DTIM period */
+ zmw_tx_buf_writeb(dev, buf, offset++, wd->dtim);
+ /* bitmap offset */
+ zmw_tx_buf_writeb(dev, buf, offset++, 0);
+
+ /* Update BCMC bit */
+ if (wd->CurrentDtimCount == 0)
+ {
+ zmw_enter_critical_section(dev);
+ wd->ap.timBcmcBit[vap] = (wd->ap.bcmcTail[vap]!=wd->ap.bcmcHead[vap])?1:0;
+ zmw_leave_critical_section(dev);
+ }
+ else
+ {
+ wd->ap.timBcmcBit[vap] = 0;
+ }
+
+ /* Update Unicast bitmap */
+ /* reset bit map */
+ for (i=0; i<9; i++)
+ {
+ uniBitMap[i] = 0;
+ }
+ highestByte = 0;
+#if 1
+
+ zmw_enter_critical_section(dev);
+
+ id = wd->ap.uniHead;
+ while (id != wd->ap.uniTail)
+ {
+ psBuf = wd->ap.uniArray[id];
+
+ /* TODO : Aging PS frame after queuing for more than 10 seconds */
+
+ /* get destination STA's aid */
+ dst[0] = zmw_tx_buf_readh(dev, psBuf, 0);
+ dst[1] = zmw_tx_buf_readh(dev, psBuf, 2);
+ dst[2] = zmw_tx_buf_readh(dev, psBuf, 4);
+ if ((aid = zfApFindSta(dev, dst)) != 0xffff)
+ {
+ if (wd->ap.staTable[aid].psMode != 0)
+ {
+ zm_msg1_mm(ZM_LV_0, "aid=",aid);
+ aid++;
+ zm_assert(aid<=64);
+ bitPosition = (1 << (aid & 0x7));
+ bytePosition = (aid >> 3);
+ uniBitMap[bytePosition] |= bitPosition;
+
+ if (bytePosition>highestByte)
+ {
+ highestByte = bytePosition;
+ }
+ id = (id+1) & (ZM_UNI_ARRAY_SIZE-1);
+ }
+ else
+ {
+ zm_msg0_mm(ZM_LV_0, "Send PS frame which STA no longer in PS mode");
+ /* Send PS frame which STA no longer in PS mode */
+ zfApRemoveFromPsQueue(dev, id, dst);
+ tmpBufArray[tmpBufArraySize++] = psBuf;
+ }
+ }
+ else
+ {
+ zm_msg0_mm(ZM_LV_0, "Free garbage PS frame");
+ /* Free garbage PS frame */
+ zfApRemoveFromPsQueue(dev, id, dst);
+ zfwBufFree(dev, psBuf, 0);
+ }
+ }
+
+ zmw_leave_critical_section(dev);
+#endif
+
+ zfQueueGenerateUapsdTim(dev, wd->ap.uapsdQ, uniBitMap, &highestByte);
+
+ zm_msg1_mm(ZM_LV_3, "bm=",uniBitMap[0]);
+ zm_msg1_mm(ZM_LV_3, "highestByte=",highestByte);
+ zm_msg1_mm(ZM_LV_3, "timBcmcBit[]=",wd->ap.timBcmcBit[vap]);
+
+ /* bitmap */
+ zmw_tx_buf_writeb(dev, buf, offset++,
+ uniBitMap[0] | wd->ap.timBcmcBit[vap]);
+ for (i=0; i<highestByte; i++)
+ {
+ zmw_tx_buf_writeb(dev, buf, offset++, uniBitMap[i+1]);
+ }
+
+ /* Element Length */
+ zmw_tx_buf_writeb(dev, buf, lenOffset, highestByte+4);
+
+ for (i=0; i<tmpBufArraySize; i++)
+ {
+ /* Put to VTXQ[ac] */
+ zfPutVtxq(dev, tmpBufArray[i]);
+ }
+ /* Push VTXQ[ac] */
+ zfPushVtxq(dev);
+
+ return offset;
+}
+
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfApRemoveFromPsQueue */
+/* Remove zbuf from PS queue. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* id : index in ps queue */
+/* */
+/* OUTPUTS */
+/* more data bit */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2007.1 */
+/* */
+/************************************************************************/
+u8_t zfApRemoveFromPsQueue(zdev_t* dev, u16_t id, u16_t* addr)
+{
+ u16_t dst[3];
+ u16_t nid;
+ u8_t moreData = 0;
+ zmw_get_wlan_dev(dev);
+
+ wd->ap.uniTail = (wd->ap.uniTail-1) & (ZM_UNI_ARRAY_SIZE-1);
+ while (id != wd->ap.uniTail)
+ {
+ nid = (id + 1) & (ZM_UNI_ARRAY_SIZE - 1);
+ wd->ap.uniArray[id] = wd->ap.uniArray[nid];
+
+ /* Search until tail to config more data bit */
+ dst[0] = zmw_buf_readh(dev, wd->ap.uniArray[id], 0);
+ dst[1] = zmw_buf_readh(dev, wd->ap.uniArray[id], 2);
+ dst[2] = zmw_buf_readh(dev, wd->ap.uniArray[id], 4);
+ if ((addr[0] == dst[0]) && (addr[1] == dst[1])
+ && (addr[2] == dst[2]))
+ {
+ moreData = 0x20;
+ }
+
+ id = nid;
+ }
+ return moreData;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfApAddIeWmePara */
+/* Add WME Parameter Element to buffer. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : buffer to add information element */
+/* offset : add information element from this offset */
+/* vap : virtual AP ID */
+/* */
+/* OUTPUTS */
+/* buffer offset after adding information element */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2006.1 */
+/* */
+/************************************************************************/
+u16_t zfApAddIeWmePara(zdev_t* dev, zbuf_t* buf, u16_t offset, u16_t vap)
+{
+ zmw_get_wlan_dev(dev);
+
+ /* Element ID */
+ zmw_tx_buf_writeb(dev, buf, offset++, ZM_WLAN_EID_WIFI_IE);
+
+ /* Element Length */
+ zmw_tx_buf_writeb(dev, buf, offset++, 24);
+
+ /* OUI */
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x00);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x50);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0xF2);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x02);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x01);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x01);
+
+ /* QoS Info */
+ if (wd->ap.uapsdEnabled)
+ {
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x81);
+ }
+ else
+ {
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x01);
+ }
+
+ /* Reserved */
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x00);
+
+ /* Best Effort AC parameters */
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x03);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0xA4);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x00);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x00);
+ /* Backfround AC parameters */
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x27);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0xA4);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x00);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x00);
+ /* Video AC parameters */
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x42);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x43);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x5E);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x00);
+ /* Voice AC parameters */
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x62);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x32);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x2F);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x00);
+
+ return offset;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfApSendBeacon */
+/* Sned AP mode beacon. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* none */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.11 */
+/* */
+/************************************************************************/
+void zfApSendBeacon(zdev_t* dev)
+{
+ zbuf_t* buf;
+ u16_t offset;
+ u16_t vap;
+ u16_t seq;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ wd->ap.beaconCounter++;
+ if (wd->ap.beaconCounter >= wd->ap.vapNumber)
+ {
+ wd->ap.beaconCounter = 0;
+ }
+ vap = wd->ap.beaconCounter;
+
+
+ zm_msg1_mm(ZM_LV_2, "Send beacon, vap=", vap);
+
+ /* TBD : Maximum size of beacon */
+ if ((buf = zfwBufAllocate(dev, 1024)) == NULL)
+ {
+ zm_msg0_mm(ZM_LV_0, "Alloc beacon buf Fail!");
+ return;
+ }
+
+ offset = 0;
+
+ /* wlan header */
+ /* Frame control */
+ zmw_tx_buf_writeh(dev, buf, offset, 0x0080);
+ offset+=2;
+ /* Duration */
+ zmw_tx_buf_writeh(dev, buf, offset, 0x0000);
+ offset+=2;
+ /* Address 1 */
+ zmw_tx_buf_writeh(dev, buf, offset, 0xffff);
+ offset+=2;
+ zmw_tx_buf_writeh(dev, buf, offset, 0xffff);
+ offset+=2;
+ zmw_tx_buf_writeh(dev, buf, offset, 0xffff);
+ offset+=2;
+ /* Address 2 */
+ zmw_tx_buf_writeh(dev, buf, offset, wd->macAddr[0]);
+ offset+=2;
+ zmw_tx_buf_writeh(dev, buf, offset, wd->macAddr[1]);
+ offset+=2;
+#ifdef ZM_VAPMODE_MULTILE_SSID
+ zmw_tx_buf_writeh(dev, buf, offset, wd->macAddr[2]); //Multiple SSID
+#else
+ zmw_tx_buf_writeh(dev, buf, offset, (wd->macAddr[2]+(vap<<8))); //VAP
+#endif
+ offset+=2;
+ /* Address 3 */
+ zmw_tx_buf_writeh(dev, buf, offset, wd->macAddr[0]);
+ offset+=2;
+ zmw_tx_buf_writeh(dev, buf, offset, wd->macAddr[1]);
+ offset+=2;
+#ifdef ZM_VAPMODE_MULTILE_SSID
+ zmw_tx_buf_writeh(dev, buf, offset, wd->macAddr[2]); //Multiple SSID
+#else
+ zmw_tx_buf_writeh(dev, buf, offset, (wd->macAddr[2]+(vap<<8))); //VAP
+#endif
+ offset+=2;
+
+ /* Sequence number */
+ zmw_enter_critical_section(dev);
+ seq = ((wd->mmseq++)<<4);
+ zmw_leave_critical_section(dev);
+ zmw_tx_buf_writeh(dev, buf, offset, seq);
+ offset+=2;
+
+ /* 24-31 Time Stamp : hardware will fill this field */
+ zmw_tx_buf_writeh(dev, buf, offset, 0);
+ zmw_tx_buf_writeh(dev, buf, offset+2, 0);
+ zmw_tx_buf_writeh(dev, buf, offset+4, 0);
+ zmw_tx_buf_writeh(dev, buf, offset+6, 0);
+ offset+=8;
+
+ /* Beacon Interval */
+ zmw_tx_buf_writeh(dev, buf, offset, wd->beaconInterval);
+ offset+=2;
+
+ /* Capability */
+ zmw_tx_buf_writeh(dev, buf, offset, wd->ap.capab[vap]);
+ offset+=2;
+
+ /* SSID */
+ if (wd->ap.hideSsid[vap] == 0)
+ {
+ offset = zfApAddIeSsid(dev, buf, offset, vap);
+ }
+ else
+ {
+ zmw_tx_buf_writeb(dev, buf, offset++, ZM_WLAN_EID_SSID);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0);
+
+ }
+
+ /* Support Rate */
+ if ( wd->frequency < 3000 )
+ {
+ offset = zfMmAddIeSupportRate(dev, buf, offset,
+ ZM_WLAN_EID_SUPPORT_RATE, ZM_RATE_SET_CCK);
+ }
+ else
+ {
+ offset = zfMmAddIeSupportRate(dev, buf, offset,
+ ZM_WLAN_EID_SUPPORT_RATE, ZM_RATE_SET_OFDM);
+ }
+
+ /* DS parameter set */
+ offset = zfMmAddIeDs(dev, buf, offset);
+
+ /* TIM */
+ offset = zfApAddIeTim(dev, buf, offset, vap);
+
+ /* If WLAN Type is not PURE B */
+ if (wd->ap.wlanType[vap] != ZM_WLAN_TYPE_PURE_B)
+ {
+ if ( wd->frequency < 3000 )
+ {
+ /* ERP Information */
+ offset = zfMmAddIeErp(dev, buf, offset);
+
+ /* Extended Supported Rates */
+ offset = zfMmAddIeSupportRate(dev, buf, offset,
+ ZM_WLAN_EID_EXTENDED_RATE, ZM_RATE_SET_OFDM);
+ }
+ }
+
+ /* TODO : country information */
+ /* TODO : RSN */
+ if (wd->ap.wpaSupport[vap] == 1)
+ {
+ offset = zfMmAddIeWpa(dev, buf, offset, vap);
+ }
+
+ /* WME Parameters */
+ if (wd->ap.qosMode == 1)
+ {
+ offset = zfApAddIeWmePara(dev, buf, offset, vap);
+ }
+
+ /* HT Capabilities Info */
+ offset = zfMmAddHTCapability(dev, buf, offset);
+
+ /* Extended HT Capabilities Info */
+ offset = zfMmAddExtendedHTCapability(dev, buf, offset);
+
+ /* 1212 : write to beacon fifo */
+ /* 1221 : write to share memory */
+ zfHpSendBeacon(dev, buf, offset);
+
+ /* Free beacon buffer */
+ /* TODO: In order to fit the madwifi beacon architecture, we need to
+ free beacon buffer in the HAL layer.
+ */
+
+ //zfwBufFree(dev, buf, 0);
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfIntrabssForward */
+/* Called to transmit intra-BSS frame from upper layer. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : buffer pointer */
+/* vap : virtual AP */
+/* */
+/* OUTPUTS */
+/* 1 : unicast intras-BSS frame */
+/* 0 : other frames */
+/* */
+/* AUTHOR */
+/* Stephen ZyDAS Technology Corporation 2005.11 */
+/* */
+/************************************************************************/
+u16_t zfIntrabssForward(zdev_t* dev, zbuf_t* buf, u8_t srcVap)
+{
+ u16_t err;
+ u16_t asocFlag = 0;
+ u16_t dst[3];
+ u16_t aid;
+ u16_t staState;
+ zbuf_t* txBuf;
+ u16_t len;
+ u16_t i;
+ u16_t temp;
+ u16_t ret;
+ u8_t vap = 0;
+#ifdef ZM_ENABLE_NATIVE_WIFI
+ dst[0] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A3_OFFSET);
+ dst[1] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A3_OFFSET+2);
+ dst[2] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A3_OFFSET+4);
+#else
+ dst[0] = zmw_rx_buf_readh(dev, buf, 0);
+ dst[1] = zmw_rx_buf_readh(dev, buf, 2);
+ dst[2] = zmw_rx_buf_readh(dev, buf, 4);
+#endif // ZM_ENABLE_NATIVE_WIFI
+
+ /* Do Intra-BSS forward(data copy) if necessary*/
+ if ((dst[0]&0x1) != 0x1)
+ {
+ aid = zfApGetSTAInfo(dev, dst, &staState, &vap);
+ if ((aid != 0xffff) && (staState == ZM_STATE_ASOC) && (srcVap == vap))
+ {
+ asocFlag = 1;
+ zm_msg0_rx(ZM_LV_2, "Intra-BSS forward : asoc STA");
+ }
+
+ }
+ else
+ {
+ vap = srcVap;
+ zm_msg0_rx(ZM_LV_2, "Intra-BSS forward : BCorMC");
+ }
+
+ /* destination address = associated STA or BC/MC */
+ if ((asocFlag == 1) || ((dst[0]&0x1) == 0x1))
+ {
+ /* Allocate frame */
+ if ((txBuf = zfwBufAllocate(dev, ZM_RX_FRAME_SIZE))
+ == NULL)
+ {
+ zm_msg0_rx(ZM_LV_1, "Alloc intra-bss buf Fail!");
+ goto zlAllocError;
+ }
+
+ /* Copy frame */
+ len = zfwBufGetSize(dev, buf);
+ for (i=0; i<len; i+=2)
+ {
+ temp = zmw_rx_buf_readh(dev, buf, i);
+ zmw_tx_buf_writeh(dev, txBuf, i, temp);
+ }
+ zfwBufSetSize(dev, txBuf, len);
+
+#ifdef ZM_ENABLE_NATIVE_WIFI
+ /* Tx-A2 = Rx-A1, Tx-A3 = Rx-A2, Tx-A1 = Rx-A3 */
+ for (i=0; i<6; i+=2)
+ {
+ temp = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A1_OFFSET+i);
+ zmw_tx_buf_writeh(dev, txBuf, ZM_WLAN_HEADER_A2_OFFSET+i, temp);
+ temp = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A2_OFFSET+i);
+ zmw_tx_buf_writeh(dev, txBuf, ZM_WLAN_HEADER_A3_OFFSET+i, temp);
+ temp = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A3_OFFSET+i);
+ zmw_tx_buf_writeh(dev, txBuf, ZM_WLAN_HEADER_A1_OFFSET+i, temp);
+ }
+
+ #endif
+
+ /* Transmit frame */
+ /* Return error if port is disabled */
+ if ((err = zfTxPortControl(dev, txBuf, vap)) == ZM_PORT_DISABLED)
+ {
+ err = ZM_ERR_TX_PORT_DISABLED;
+ goto zlTxError;
+ }
+
+#if 1
+ /* AP : Buffer frame for power saving STA */
+ if ((ret = zfApBufferPsFrame(dev, txBuf, vap)) == 0)
+ {
+ /* forward frame if not been buffered */
+ #if 1
+ /* Put to VTXQ[ac] */
+ ret = zfPutVtxq(dev, txBuf);
+ /* Push VTXQ[ac] */
+ zfPushVtxq(dev);
+ #else
+ zfTxSendEth(dev, txBuf, vap, ZM_INTERNAL_ALLOC_BUF, 0);
+ #endif
+
+ }
+#endif
+ }
+ return asocFlag;
+
+zlTxError:
+ zfwBufFree(dev, txBuf, 0);
+zlAllocError:
+ return asocFlag;
+}
+
+struct zsMicVar* zfApGetRxMicKey(zdev_t* dev, zbuf_t* buf)
+{
+ u8_t sa[6];
+ u16_t id = 0, macAddr[3];
+
+ zmw_get_wlan_dev(dev);
+
+ zfCopyFromRxBuffer(dev, buf, sa, ZM_WLAN_HEADER_A2_OFFSET, 6);
+
+ macAddr[0] = sa[0] + (sa[1] << 8);
+ macAddr[1] = sa[2] + (sa[3] << 8);
+ macAddr[2] = sa[4] + (sa[5] << 8);
+
+ if ((id = zfApFindSta(dev, macAddr)) != 0xffff)
+ return (&wd->ap.staTable[id].rxMicKey);
+
+ return NULL;
+}
+
+struct zsMicVar* zfApGetTxMicKey(zdev_t* dev, zbuf_t* buf, u8_t* qosType)
+{
+ u8_t da[6];
+ u16_t id = 0, macAddr[3];
+
+ zmw_get_wlan_dev(dev);
+
+ zfCopyFromIntTxBuffer(dev, buf, da, 0, 6);
+
+ macAddr[0] = da[0] + (da[1] << 8);
+ macAddr[1] = da[2] + (da[3] << 8);
+ macAddr[2] = da[4] + (da[5] << 8);
+
+ if ((macAddr[0] & 0x1))
+ {
+ return (&wd->ap.bcMicKey[0]);
+ }
+ else if ((id = zfApFindSta(dev, macAddr)) != 0xffff)
+ {
+ *qosType = wd->ap.staTable[id].qosType;
+ return (&wd->ap.staTable[id].txMicKey);
+ }
+
+ return NULL;
+}
+
+u16_t zfApUpdatePsBit(zdev_t* dev, zbuf_t* buf, u8_t* vap, u8_t* uapsdTrig)
+{
+ u16_t staState;
+ u16_t aid;
+ u16_t psBit;
+ u16_t src[3];
+ u16_t dst[1];
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ src[0] = zmw_rx_buf_readh(dev, buf, 10);
+ src[1] = zmw_rx_buf_readh(dev, buf, 12);
+ src[2] = zmw_rx_buf_readh(dev, buf, 14);
+
+ if ((zmw_rx_buf_readb(dev, buf, 1) & 0x3) != 3)
+ {
+ /* AP */
+ dst[0] = zmw_rx_buf_readh(dev, buf, 4);
+
+ psBit = (zmw_rx_buf_readb(dev, buf, 1) & 0x10) >> 4;
+ /* Get AID and update STA PS mode */
+ aid = zfApGetSTAInfoAndUpdatePs(dev, src, &staState, vap, psBit, uapsdTrig);
+
+ /* if STA not associated, send deauth */
+ if ((aid == 0xffff) || (staState != ZM_STATE_ASOC))
+ {
+ if ((dst[0]&0x1)==0)
+ {
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH, src, 0x7,
+ 0, 0);
+ }
+
+ return ZM_ERR_STA_NOT_ASSOCIATED;
+ }
+ } /* if ((zmw_rx_buf_readb(dev, buf, 1) & 0x3) != 3) */
+ else
+ {
+ /* WDS */
+ for (i=0; i<ZM_MAX_WDS_SUPPORT; i++)
+ {
+ if ((wd->ap.wds.wdsBitmap & (1<<i)) != 0)
+ {
+ if ((src[0] == wd->ap.wds.macAddr[i][0])
+ && (src[1] == wd->ap.wds.macAddr[i][1])
+ && (src[2] == wd->ap.wds.macAddr[i][2]))
+ {
+ *vap = 0x20 + i;
+ break;
+ }
+ }
+ }
+ }
+ return ZM_SUCCESS;
+}
+
+void zfApProcessPsPoll(zdev_t* dev, zbuf_t* buf)
+{
+ u16_t src[3];
+ u16_t dst[3];
+ zbuf_t* psBuf = NULL;
+ u16_t id;
+ u8_t moreData = 0;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ src[0] = zmw_tx_buf_readh(dev, buf, 10);
+ src[1] = zmw_tx_buf_readh(dev, buf, 12);
+ src[2] = zmw_tx_buf_readh(dev, buf, 14);
+
+ /* Find ps buffer for PsPoll */
+ zmw_enter_critical_section(dev);
+ id = wd->ap.uniHead;
+ while (id != wd->ap.uniTail)
+ {
+ psBuf = wd->ap.uniArray[id];
+
+ dst[0] = zmw_tx_buf_readh(dev, psBuf, 0);
+ dst[1] = zmw_tx_buf_readh(dev, psBuf, 2);
+ dst[2] = zmw_tx_buf_readh(dev, psBuf, 4);
+
+ if ((src[0] == dst[0]) && (src[1] == dst[1]) && (src[2] == dst[2]))
+ {
+ moreData = zfApRemoveFromPsQueue(dev, id, src);
+ break;
+ }
+ else
+ {
+ psBuf = NULL;
+ }
+ id = (id + 1) & (ZM_UNI_ARRAY_SIZE - 1);
+ }
+ zmw_leave_critical_section(dev);
+
+ /* Send ps buffer */
+ if (psBuf != NULL)
+ {
+ /* Send with more data bit */
+ zfTxSendEth(dev, psBuf, 0, ZM_EXTERNAL_ALLOC_BUF, moreData);
+ }
+
+ return;
+}
+
+void zfApSetProtectionMode(zdev_t* dev, u16_t mode)
+{
+ zmw_get_wlan_dev(dev);
+
+ if (mode == 0)
+ {
+ if (wd->ap.protectionMode != mode)
+ {
+ /* Write MAC&PHY registers to disable protection */
+
+ wd->ap.protectionMode = mode;
+ }
+
+ }
+ else
+ {
+ if (wd->ap.protectionMode != mode)
+ {
+ /* Write MAC&PHY registers to enable protection */
+
+ wd->ap.protectionMode = mode;
+ }
+ }
+ return;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfApSendFailure */
+/* Send failure. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* addr : receiver address */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2007.1 */
+/* */
+/************************************************************************/
+void zfApSendFailure(zdev_t* dev, u8_t* addr)
+{
+ u16_t id;
+ u16_t staAddr[3];
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ staAddr[0] = addr[0] + (((u16_t)addr[1])<<8);
+ staAddr[1] = addr[2] + (((u16_t)addr[3])<<8);
+ staAddr[2] = addr[4] + (((u16_t)addr[5])<<8);
+ zmw_enter_critical_section(dev);
+ if ((id = zfApFindSta(dev, staAddr)) != 0xffff)
+ {
+ /* Send failture : Add 3 minutes to inactive time that will */
+ /* will make STA been kicked out soon */
+ wd->ap.staTable[id].time -= (3*ZM_TICK_PER_MINUTE);
+ }
+ zmw_leave_critical_section(dev);
+}
+
+
+void zfApProcessAction(zdev_t* dev, zbuf_t* buf)
+{
+ u8_t category;
+
+ //zmw_get_wlan_dev(dev);
+
+ //zmw_declare_for_critical_section();
+
+ category = zmw_rx_buf_readb(dev, buf, 24);
+
+ switch (category)
+ {
+ case ZM_WLAN_BLOCK_ACK_ACTION_FRAME:
+ zfAggBlockAckActionFrame(dev, buf);
+ break;
+ default:
+ break;
+ }
+
+ return;
+}
diff --git a/drivers/staging/otus/80211core/cmmsta.c b/drivers/staging/otus/80211core/cmmsta.c
new file mode 100644
index 00000000000..c75ba11ee43
--- /dev/null
+++ b/drivers/staging/otus/80211core/cmmsta.c
@@ -0,0 +1,5782 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "cprecomp.h"
+#include "ratectrl.h"
+#include "../hal/hpreg.h"
+
+/* TODO : change global variable to constant */
+u8_t zgWpaRadiusOui[] = { 0x00, 0x50, 0xf2, 0x01 };
+u8_t zgWpaAesOui[] = { 0x00, 0x50, 0xf2, 0x04 };
+u8_t zgWpa2RadiusOui[] = { 0x00, 0x0f, 0xac, 0x01 };
+u8_t zgWpa2AesOui[] = { 0x00, 0x0f, 0xac, 0x04 };
+
+const u16_t zcCwTlb[16] = { 0, 1, 3, 7, 15, 31, 63, 127,
+ 255, 511, 1023, 2047, 4095, 4095, 4095, 4095};
+
+void zfStaStartConnectCb(zdev_t* dev);
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfStaPutApIntoBlockingList */
+/* Put AP into blocking AP list. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* bssid : AP's BSSID */
+/* weight : weight of AP */
+/* */
+/* OUTPUTS */
+/* none */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2006.12 */
+/* */
+/************************************************************************/
+void zfStaPutApIntoBlockingList(zdev_t* dev, u8_t* bssid, u8_t weight)
+{
+ u16_t i, j;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ if (weight > 0)
+ {
+ zmw_enter_critical_section(dev);
+ /*Find same bssid entry first*/
+ for (i=0; i<ZM_MAX_BLOCKING_AP_LIST_SIZE; i++)
+ {
+ for (j=0; j<6; j++)
+ {
+ if(wd->sta.blockingApList[i].addr[j]!= bssid[j])
+ {
+ break;
+ }
+ }
+
+ if(j==6)
+ {
+ break;
+ }
+ }
+ /*This bssid doesn't have old record.Find an empty entry*/
+ if (i == ZM_MAX_BLOCKING_AP_LIST_SIZE)
+ {
+ for (i=0; i<ZM_MAX_BLOCKING_AP_LIST_SIZE; i++)
+ {
+ if (wd->sta.blockingApList[i].weight == 0)
+ {
+ break;
+ }
+ }
+ }
+
+ /* If the list is full, pick one entry for replacement */
+ if (i == ZM_MAX_BLOCKING_AP_LIST_SIZE)
+ {
+ i = bssid[5] & (ZM_MAX_BLOCKING_AP_LIST_SIZE-1);
+ }
+
+ /* Update AP address and weight */
+ for (j=0; j<6; j++)
+ {
+ wd->sta.blockingApList[i].addr[j] = bssid[j];
+ }
+
+ wd->sta.blockingApList[i].weight = weight;
+ zmw_leave_critical_section(dev);
+ }
+
+ return;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfStaIsApInBlockingList */
+/* Is AP in blocking list. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* bssid : AP's BSSID */
+/* */
+/* OUTPUTS */
+/* TRUE : AP in blocking list */
+/* FALSE : AP not in blocking list */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2006.12 */
+/* */
+/************************************************************************/
+u16_t zfStaIsApInBlockingList(zdev_t* dev, u8_t* bssid)
+{
+ u16_t i, j;
+ zmw_get_wlan_dev(dev);
+ //zmw_declare_for_critical_section();
+
+ //zmw_enter_critical_section(dev);
+ for (i=0; i<ZM_MAX_BLOCKING_AP_LIST_SIZE; i++)
+ {
+ if (wd->sta.blockingApList[i].weight != 0)
+ {
+ for (j=0; j<6; j++)
+ {
+ if (wd->sta.blockingApList[i].addr[j] != bssid[j])
+ {
+ break;
+ }
+ }
+ if (j == 6)
+ {
+ //zmw_leave_critical_section(dev);
+ return TRUE;
+ }
+ }
+ }
+ //zmw_leave_critical_section(dev);
+ return FALSE;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfStaRefreshBlockList */
+/* Is AP in blocking list. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* flushFlag : flush whole blocking list */
+/* */
+/* OUTPUTS */
+/* none */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2006.12 */
+/* */
+/************************************************************************/
+void zfStaRefreshBlockList(zdev_t* dev, u16_t flushFlag)
+{
+ u16_t i;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ for (i=0; i<ZM_MAX_BLOCKING_AP_LIST_SIZE; i++)
+ {
+ if (wd->sta.blockingApList[i].weight != 0)
+ {
+ if (flushFlag != 0)
+ {
+ wd->sta.blockingApList[i].weight = 0;
+ }
+ else
+ {
+ wd->sta.blockingApList[i].weight--;
+ }
+ }
+ }
+ zmw_leave_critical_section(dev);
+ return;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfStaConnectFail */
+/* Handle Connect failure. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* bssid : BSSID */
+/* reason : reason of failure */
+/* */
+/* OUTPUTS */
+/* none */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2006.12 */
+/* */
+/************************************************************************/
+void zfStaConnectFail(zdev_t* dev, u16_t reason, u16_t* bssid, u8_t weight)
+{
+ zmw_get_wlan_dev(dev);
+
+ /* Change internal state */
+ zfChangeAdapterState(dev, ZM_STA_STATE_DISCONNECT);
+
+ /* Improve WEP/TKIP performace with HT AP, detail information please look bug#32495 */
+ //zfHpSetTTSIFSTime(dev, 0x8);
+
+ /* Notify wrapper of connection status changes */
+ if (wd->zfcbConnectNotify != NULL)
+ {
+ wd->zfcbConnectNotify(dev, reason, bssid);
+ }
+
+ /* Put AP into internal blocking list */
+ zfStaPutApIntoBlockingList(dev, (u8_t *)bssid, weight);
+
+ /* Issue another SCAN */
+ if ( wd->sta.bAutoReconnect )
+ {
+ zm_debug_msg0("Start internal scan...");
+ zfScanMgrScanStop(dev, ZM_SCAN_MGR_SCAN_INTERNAL);
+ zfScanMgrScanStart(dev, ZM_SCAN_MGR_SCAN_INTERNAL);
+ }
+}
+
+u8_t zfiWlanIBSSGetPeerStationsCount(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ return wd->sta.oppositeCount;
+}
+
+u8_t zfiWlanIBSSIteratePeerStations(zdev_t* dev, u8_t numToIterate, zfpIBSSIteratePeerStationCb callback, void *ctx)
+{
+ u8_t oppositeCount;
+ u8_t i;
+ u8_t index = 0;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ oppositeCount = wd->sta.oppositeCount;
+ if ( oppositeCount > numToIterate )
+ {
+ oppositeCount = numToIterate;
+ }
+
+ for(i=0; i < ZM_MAX_OPPOSITE_COUNT; i++)
+ {
+ if ( oppositeCount == 0 )
+ {
+ break;
+ }
+
+ if ( wd->sta.oppositeInfo[i].valid == 0 )
+ {
+ continue;
+ }
+
+ callback(dev, &wd->sta.oppositeInfo[i], ctx, index++);
+ oppositeCount--;
+
+ }
+
+ zmw_leave_critical_section(dev);
+
+ return index;
+}
+
+
+s8_t zfStaFindFreeOpposite(zdev_t* dev, u16_t *sa, int *pFoundIdx)
+{
+ int oppositeCount;
+ int i;
+
+ zmw_get_wlan_dev(dev);
+
+ oppositeCount = wd->sta.oppositeCount;
+
+ for(i=0; i < ZM_MAX_OPPOSITE_COUNT; i++)
+ {
+ if ( oppositeCount == 0 )
+ {
+ break;
+ }
+
+ if ( wd->sta.oppositeInfo[i].valid == 0 )
+ {
+ continue;
+ }
+
+ oppositeCount--;
+ if ( zfMemoryIsEqual((u8_t*) sa, wd->sta.oppositeInfo[i].macAddr, 6) )
+ {
+ //wd->sta.oppositeInfo[i].aliveCounter++;
+ wd->sta.oppositeInfo[i].aliveCounter = ZM_IBSS_PEER_ALIVE_COUNTER;
+
+ /* it is already stored */
+ return 1;
+ }
+ }
+
+ // Check if there's still space for new comer
+ if ( wd->sta.oppositeCount == ZM_MAX_OPPOSITE_COUNT )
+ {
+ return -1;
+ }
+
+ // Find an unused slot for new peer station
+ for(i=0; i < ZM_MAX_OPPOSITE_COUNT; i++)
+ {
+ if ( wd->sta.oppositeInfo[i].valid == 0 )
+ {
+ break;
+ }
+ }
+
+ *pFoundIdx = i;
+ return 0;
+}
+
+s8_t zfStaFindOppositeByMACAddr(zdev_t* dev, u16_t *sa, u8_t *pFoundIdx)
+{
+ u32_t oppositeCount;
+ u32_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ oppositeCount = wd->sta.oppositeCount;
+
+ for(i=0; i < ZM_MAX_OPPOSITE_COUNT; i++)
+ {
+ if ( oppositeCount == 0 )
+ {
+ break;
+ }
+
+ if ( wd->sta.oppositeInfo[i].valid == 0 )
+ {
+ continue;
+ }
+
+ oppositeCount--;
+ if ( zfMemoryIsEqual((u8_t*) sa, wd->sta.oppositeInfo[i].macAddr, 6) )
+ {
+ *pFoundIdx = (u8_t)i;
+
+ return 0;
+ }
+ }
+
+ *pFoundIdx = 0;
+ return 1;
+}
+
+static void zfStaInitCommonOppositeInfo(zdev_t* dev, int i)
+{
+ zmw_get_wlan_dev(dev);
+
+ /* set the default rate to the highest rate */
+ wd->sta.oppositeInfo[i].valid = 1;
+ wd->sta.oppositeInfo[i].aliveCounter = ZM_IBSS_PEER_ALIVE_COUNTER;
+ wd->sta.oppositeCount++;
+
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ /* Set parameters for new opposite peer station !!! */
+ wd->sta.oppositeInfo[i].camIdx = 0xff; // Not set key in this location
+ wd->sta.oppositeInfo[i].pkInstalled = 0;
+ wd->sta.oppositeInfo[i].wpaState = ZM_STA_WPA_STATE_INIT ; // No encryption
+#endif
+}
+
+int zfStaSetOppositeInfoFromBSSInfo(zdev_t* dev, struct zsBssInfo* pBssInfo)
+{
+ int i;
+ u8_t* dst;
+ u16_t sa[3];
+ int res;
+ u32_t oneTxStreamCap;
+
+ zmw_get_wlan_dev(dev);
+
+ zfMemoryCopy((u8_t*) sa, pBssInfo->macaddr, 6);
+
+ res = zfStaFindFreeOpposite(dev, sa, &i);
+ if ( res != 0 )
+ {
+ goto zlReturn;
+ }
+
+ dst = wd->sta.oppositeInfo[i].macAddr;
+ zfMemoryCopy(dst, (u8_t *)sa, 6);
+
+ oneTxStreamCap = (zfHpCapability(dev) & ZM_HP_CAP_11N_ONE_TX_STREAM);
+
+ if (pBssInfo->extSupportedRates[1] != 0)
+ {
+ /* TODO : Handle 11n */
+ if (pBssInfo->frequency < 3000)
+ {
+ /* 2.4GHz */
+ if (pBssInfo->EnableHT == 1)
+ zfRateCtrlInitCell(dev, &wd->sta.oppositeInfo[i].rcCell, (oneTxStreamCap!=0)?3:2, 1, pBssInfo->SG40);
+ else
+ zfRateCtrlInitCell(dev, &wd->sta.oppositeInfo[i].rcCell, 1, 1, pBssInfo->SG40);
+ }
+ else
+ {
+ /* 5GHz */
+ if (pBssInfo->EnableHT == 1)
+ zfRateCtrlInitCell(dev, &wd->sta.oppositeInfo[i].rcCell, (oneTxStreamCap!=0)?3:2, 0, pBssInfo->SG40);
+ else
+ zfRateCtrlInitCell(dev, &wd->sta.oppositeInfo[i].rcCell, 1, 0, pBssInfo->SG40);
+ }
+ }
+ else
+ {
+ /* TODO : Handle 11n */
+ if (pBssInfo->frequency < 3000)
+ {
+ /* 2.4GHz */
+ if (pBssInfo->EnableHT == 1)
+ zfRateCtrlInitCell(dev, &wd->sta.oppositeInfo[i].rcCell, (oneTxStreamCap!=0)?3:2, 1, pBssInfo->SG40);
+ else
+ zfRateCtrlInitCell(dev, &wd->sta.oppositeInfo[i].rcCell, 0, 1, pBssInfo->SG40);
+ }
+ else
+ {
+ /* 5GHz */
+ if (pBssInfo->EnableHT == 1)
+ zfRateCtrlInitCell(dev, &wd->sta.oppositeInfo[i].rcCell, (oneTxStreamCap!=0)?3:2, 0, pBssInfo->SG40);
+ else
+ zfRateCtrlInitCell(dev, &wd->sta.oppositeInfo[i].rcCell, 1, 0, pBssInfo->SG40);
+ }
+ }
+
+
+ zfStaInitCommonOppositeInfo(dev, i);
+zlReturn:
+ return 0;
+}
+
+int zfStaSetOppositeInfoFromRxBuf(zdev_t* dev, zbuf_t* buf)
+{
+ int i;
+ u8_t* dst;
+ u16_t sa[3];
+ int res = 0;
+ u16_t offset;
+ u8_t bSupportExtRate;
+ u32_t rtsctsRate = 0xffffffff; /* CTS:OFDM 6M, RTS:OFDM 6M */
+ u32_t oneTxStreamCap;
+
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ sa[0] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A2_OFFSET);
+ sa[1] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A2_OFFSET+2);
+ sa[2] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A2_OFFSET+4);
+
+ zmw_enter_critical_section(dev);
+
+ res = zfStaFindFreeOpposite(dev, sa, &i);
+ if ( res != 0 )
+ {
+ goto zlReturn;
+ }
+
+ dst = wd->sta.oppositeInfo[i].macAddr;
+ zfCopyFromRxBuffer(dev, buf, dst, ZM_WLAN_HEADER_A2_OFFSET, 6);
+
+ if ( (wd->sta.currentFrequency < 3000) && !(wd->supportMode & (ZM_WIRELESS_MODE_24_54|ZM_WIRELESS_MODE_24_N)) )
+ {
+ bSupportExtRate = 0;
+ } else {
+ bSupportExtRate = 1;
+ }
+
+ if ( (bSupportExtRate == 1)
+ && (wd->sta.currentFrequency < 3000)
+ && (wd->wlanMode == ZM_MODE_IBSS)
+ && (wd->wfc.bIbssGMode == 0) )
+ {
+ bSupportExtRate = 0;
+ }
+
+ wd->sta.connection_11b = 0;
+ oneTxStreamCap = (zfHpCapability(dev) & ZM_HP_CAP_11N_ONE_TX_STREAM);
+
+ if ( ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_EXTENDED_RATE)) != 0xffff)
+ && (bSupportExtRate == 1) )
+ {
+ /* TODO : Handle 11n */
+ if (wd->sta.currentFrequency < 3000)
+ {
+ /* 2.4GHz */
+ if (wd->sta.EnableHT == 1)
+ {
+ //11ng
+ zfRateCtrlInitCell(dev, &wd->sta.oppositeInfo[i].rcCell, (oneTxStreamCap!=0)?3:2, 1, wd->sta.SG40);
+ }
+ else
+ {
+ //11g
+ zfRateCtrlInitCell(dev, &wd->sta.oppositeInfo[i].rcCell, 1, 1, wd->sta.SG40);
+ }
+ rtsctsRate = 0x00001bb; /* CTS:CCK 1M, RTS:OFDM 6M */
+ }
+ else
+ {
+ /* 5GHz */
+ if (wd->sta.EnableHT == 1)
+ {
+ //11na
+ zfRateCtrlInitCell(dev, &wd->sta.oppositeInfo[i].rcCell, (oneTxStreamCap!=0)?3:2, 0, wd->sta.SG40);
+ }
+ else
+ {
+ //11a
+ zfRateCtrlInitCell(dev, &wd->sta.oppositeInfo[i].rcCell, 1, 0, wd->sta.SG40);
+ }
+ rtsctsRate = 0x10b01bb; /* CTS:OFDM 6M, RTS:OFDM 6M */
+ }
+ }
+ else
+ {
+ /* TODO : Handle 11n */
+ if (wd->sta.currentFrequency < 3000)
+ {
+ /* 2.4GHz */
+ if (wd->sta.EnableHT == 1)
+ {
+ //11ng
+ zfRateCtrlInitCell(dev, &wd->sta.oppositeInfo[i].rcCell, (oneTxStreamCap!=0)?3:2, 1, wd->sta.SG40);
+ rtsctsRate = 0x00001bb; /* CTS:CCK 1M, RTS:OFDM 6M */
+ }
+ else
+ {
+ //11b
+ zfRateCtrlInitCell(dev, &wd->sta.oppositeInfo[i].rcCell, 0, 1, wd->sta.SG40);
+ rtsctsRate = 0x0; /* CTS:CCK 1M, RTS:CCK 1M */
+ wd->sta.connection_11b = 1;
+ }
+ }
+ else
+ {
+ /* 5GHz */
+ if (wd->sta.EnableHT == 1)
+ {
+ //11na
+ zfRateCtrlInitCell(dev, &wd->sta.oppositeInfo[i].rcCell, (oneTxStreamCap!=0)?3:2, 0, wd->sta.SG40);
+ }
+ else
+ {
+ //11a
+ zfRateCtrlInitCell(dev, &wd->sta.oppositeInfo[i].rcCell, 1, 0, wd->sta.SG40);
+ }
+ rtsctsRate = 0x10b01bb; /* CTS:OFDM 6M, RTS:OFDM 6M */
+ }
+ }
+
+ zfStaInitCommonOppositeInfo(dev, i);
+
+zlReturn:
+ zmw_leave_critical_section(dev);
+
+ if (rtsctsRate != 0xffffffff)
+ {
+ zfHpSetRTSCTSRate(dev, rtsctsRate);
+ }
+ return res;
+}
+
+void zfStaProtErpMonitor(zdev_t* dev, zbuf_t* buf)
+{
+ u16_t offset;
+ u8_t erp;
+ u8_t bssid[6];
+
+ zmw_get_wlan_dev(dev);
+
+ if ( (wd->wlanMode == ZM_MODE_INFRASTRUCTURE)&&(zfStaIsConnected(dev)) )
+ {
+ ZM_MAC_WORD_TO_BYTE(wd->sta.bssid, bssid);
+
+ if (zfRxBufferEqualToStr(dev, buf, bssid, ZM_WLAN_HEADER_A2_OFFSET, 6))
+ {
+ if ( (offset=zfFindElement(dev, buf, ZM_WLAN_EID_ERP)) != 0xffff )
+ {
+ erp = zmw_rx_buf_readb(dev, buf, offset+2);
+
+ if ( erp & ZM_BIT_1 )
+ {
+ //zm_debug_msg0("protection mode on");
+ if (wd->sta.bProtectionMode == FALSE)
+ {
+ wd->sta.bProtectionMode = TRUE;
+ zfHpSetSlotTime(dev, 0);
+ }
+ }
+ else
+ {
+ //zm_debug_msg0("protection mode off");
+ if (wd->sta.bProtectionMode == TRUE)
+ {
+ wd->sta.bProtectionMode = FALSE;
+ zfHpSetSlotTime(dev, 1);
+ }
+ }
+ }
+ }
+ //Check the existence of Non-N AP
+ //Follow the check the "pBssInfo->EnableHT"
+ if ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_HT_CAPABILITY)) != 0xffff)
+ {}
+ else if ((offset = zfFindElement(dev, buf, ZM_WLAN_PREN2_EID_HTCAPABILITY)) != 0xffff)
+ {}
+ else
+ {wd->sta.NonNAPcount++;}
+ }
+}
+
+void zfStaUpdateWmeParameter(zdev_t* dev, zbuf_t* buf)
+{
+ u16_t tmp;
+ u16_t aifs[5];
+ u16_t cwmin[5];
+ u16_t cwmax[5];
+ u16_t txop[5];
+ u8_t acm;
+ u8_t ac;
+ u16_t len;
+ u16_t i;
+ u16_t offset;
+ u8_t rxWmeParameterSetCount;
+
+ zmw_get_wlan_dev(dev);
+
+ /* Update if WME parameter set count is changed */
+ /* If connect to WME AP */
+ if (wd->sta.wmeConnected != 0)
+ {
+ /* Find WME parameter element */
+ if ((offset = zfFindWifiElement(dev, buf, 2, 1)) != 0xffff)
+ {
+ if ((len = zmw_rx_buf_readb(dev, buf, offset+1)) >= 7)
+ {
+ rxWmeParameterSetCount=zmw_rx_buf_readb(dev, buf, offset+8);
+ if (rxWmeParameterSetCount != wd->sta.wmeParameterSetCount)
+ {
+ zm_msg0_mm(ZM_LV_0, "wmeParameterSetCount changed!");
+ wd->sta.wmeParameterSetCount = rxWmeParameterSetCount;
+ /* retrieve WME parameter and update TxQ parameters */
+ acm = 0xf;
+ for (i=0; i<4; i++)
+ {
+ if (len >= (8+(i*4)+4))
+ {
+ tmp=zmw_rx_buf_readb(dev, buf, offset+10+i*4);
+ ac = (tmp >> 5) & 0x3;
+ if ((tmp & 0x10) == 0)
+ {
+ acm &= (~(1<<ac));
+ }
+ aifs[ac] = ((tmp & 0xf) * 9) + 10;
+ tmp=zmw_rx_buf_readb(dev, buf, offset+11+i*4);
+ /* Convert to 2^n */
+ cwmin[ac] = zcCwTlb[(tmp & 0xf)];
+ cwmax[ac] = zcCwTlb[(tmp >> 4)];
+ txop[ac]=zmw_rx_buf_readh(dev, buf,
+ offset+12+i*4);
+ }
+ }
+
+ if ((acm & 0x4) != 0)
+ {
+ cwmin[2] = cwmin[0];
+ cwmax[2] = cwmax[0];
+ aifs[2] = aifs[0];
+ txop[2] = txop[0];
+ }
+ if ((acm & 0x8) != 0)
+ {
+ cwmin[3] = cwmin[2];
+ cwmax[3] = cwmax[2];
+ aifs[3] = aifs[2];
+ txop[3] = txop[2];
+ }
+ cwmin[4] = 3;
+ cwmax[4] = 7;
+ aifs[4] = 28;
+
+ if ((cwmin[2]+aifs[2]) > ((cwmin[0]+aifs[0])+1))
+ {
+ wd->sta.ac0PriorityHigherThanAc2 = 1;
+ }
+ else
+ {
+ wd->sta.ac0PriorityHigherThanAc2 = 0;
+ }
+ zfHpUpdateQosParameter(dev, cwmin, cwmax, aifs, txop);
+ }
+ }
+ }
+ } //if (wd->sta.wmeConnected != 0)
+}
+/* process 802.11h Dynamic Frequency Selection */
+void zfStaUpdateDot11HDFS(zdev_t* dev, zbuf_t* buf)
+{
+ zmw_get_wlan_dev(dev);
+
+ /*
+ Channel Switch Announcement Element Format
+ +------+----------+------+-------------------+------------------+--------------------+
+ |Format|Element ID|Length|Channel Switch Mode|New Channel Number|Channel Switch Count|
+ +------+----------+------+-------------------+------------------+--------------------+
+ |Bytes | 1 | 1 | 1 | 1 | 1 |
+ +------+----------+------+-------------------+------------------+--------------------+
+ |Value | 37 | 3 | 0 or 1 |unsigned integer |unsigned integer |
+ +------+----------+------+-------------------+------------------+--------------------+
+ */
+ //u8_t length, channel, is5G;
+ u16_t offset;
+
+ /* get EID(Channel Switch Announcement) */
+ if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_CHANNEL_SWITCH_ANNOUNCE)) == 0xffff )
+ {
+ //zm_debug_msg0("EID(Channel Switch Announcement) not found");
+ return;
+ }
+ else if ( zmw_rx_buf_readb(dev, buf, offset+1) == 0x3 )
+ {
+ zm_debug_msg0("EID(Channel Switch Announcement) found");
+
+ //length = zmw_rx_buf_readb(dev, buf, offset+1);
+ //zfCopyFromRxBuffer(dev, buf, pBssInfo->supportedRates, offset, length+2);
+
+ //Chanell Switch Mode set to 1, driver should disable transmit immediate
+ //we do this by poll CCA high
+ if (zmw_rx_buf_readb(dev, buf, offset+2) == 0x1 )
+ {
+ //use ZM_OID_INTERNAL_WRITE,ZM_CMD_RESET to notice firmware flush quene and stop dma,
+ //then restart rx dma but not tx dma
+ if (wd->sta.DFSDisableTx != TRUE)
+ {
+ /* TODO : zfHpResetTxRx would cause Rx hang */
+ //zfHpResetTxRx(dev);
+ wd->sta.DFSDisableTx = TRUE;
+ /* Trgger Rx DMA */
+ zfHpStartRecv(dev);
+ }
+ //Adapter->ZD80211HSetting.DisableTxBy80211H=TRUE;
+ //AcquireCtrOfPhyReg(Adapter);
+ //ZD1205_WRITE_REGISTER(Adapter,CR24, 0x0);
+ //ReleaseDoNotSleep(Adapter);
+ }
+
+ if (zmw_rx_buf_readb(dev, buf, offset+4) <= 0x2 )
+ {
+ //Channel Switch
+ //if Channel Switch Count = 0 , STA should change channel immediately.
+ //if Channel Switch Count > 0 , STA should change channel after TBTT*count
+ //But it won't be accurate to let driver calculate TBTT*count, and the value of
+ //Channel Switch Count will decrease by one each when continue receving beacon
+ //So we change channel here when we receive count <=2.
+
+ zfHpDeleteAllowChannel(dev, wd->sta.currentFrequency);
+ wd->frequency = zfChNumToFreq(dev, zmw_rx_buf_readb(dev, buf, offset+3), 0);
+ //zfHpAddAllowChannel(dev, wd->frequency);
+ zm_debug_msg1("CWY - jump to frequency = ", wd->frequency);
+ zfCoreSetFrequency(dev, wd->frequency);
+ wd->sta.DFSDisableTx = FALSE;
+ /* Increase rxBeaconCount to prevent beacon lost */
+ if (zfStaIsConnected(dev))
+ {
+ wd->sta.rxBeaconCount = 1 << 6; // 2 times of check would pass
+ }
+ //start tx dma to transmit packet
+
+ //if (zmw_rx_buf_readb(dev, buf, offset+3) != wd->frequency)
+ //{
+ // //ZDDbgPrint(("Radar Detect by AP\n"));
+ // zfCoreSetFrequency();
+ // ProcessRadarDetectEvent(Adapter);
+ // Set_RF_Channel(Adapter, SwRfd->Rfd->RxBuffer[index+3], (UCHAR)Adapter->RF_Mode, 1);
+ // Adapter->CardSetting.Channel = SwRfd->Rfd->RxBuffer[index+3];
+ // Adapter->SaveChannel = Adapter->CardSetting.Channel;
+ // Adapter->UtilityChannel = Adapter->CardSetting.Channel;
+ //}
+ }
+ }
+
+}
+/* TODO : process 802.11h Transmission Power Control */
+void zfStaUpdateDot11HTPC(zdev_t* dev, zbuf_t* buf)
+{
+}
+
+/* IBSS power-saving mode */
+void zfStaIbssPSCheckState(zdev_t* dev, zbuf_t* buf)
+{
+ u8_t i, frameCtrl;
+
+ zmw_get_wlan_dev(dev);
+
+ if ( !zfStaIsConnected(dev) )
+ {
+ return;
+ }
+
+ if ( wd->wlanMode != ZM_MODE_IBSS )
+ {
+ return ;
+ }
+
+ /* check BSSID */
+ if ( !zfRxBufferEqualToStr(dev, buf, (u8_t*) wd->sta.bssid,
+ ZM_WLAN_HEADER_A3_OFFSET, 6) )
+ {
+ return;
+ }
+
+ frameCtrl = zmw_rx_buf_readb(dev, buf, 1);
+
+ /* check power management bit */
+ if ( frameCtrl & ZM_BIT_4 )
+ {
+ for(i=1; i<ZM_MAX_PS_STA; i++)
+ {
+ if ( !wd->sta.staPSList.entity[i].bUsed )
+ {
+ continue;
+ }
+
+ /* check source address */
+ if ( zfRxBufferEqualToStr(dev, buf,
+ wd->sta.staPSList.entity[i].macAddr,
+ ZM_WLAN_HEADER_A2_OFFSET, 6) )
+ {
+ return;
+ }
+ }
+
+ for(i=1; i<ZM_MAX_PS_STA; i++)
+ {
+ if ( !wd->sta.staPSList.entity[i].bUsed )
+ {
+ wd->sta.staPSList.entity[i].bUsed = TRUE;
+ wd->sta.staPSList.entity[i].bDataQueued = FALSE;
+ break;
+ }
+ }
+
+ if ( i == ZM_MAX_PS_STA )
+ {
+ /* STA list is full */
+ return;
+ }
+
+ zfCopyFromRxBuffer(dev, buf, wd->sta.staPSList.entity[i].macAddr,
+ ZM_WLAN_HEADER_A2_OFFSET, 6);
+
+ if ( wd->sta.staPSList.count == 0 )
+ {
+ // enable ATIM window
+ //zfEnableAtimWindow(dev);
+ }
+
+ wd->sta.staPSList.count++;
+ }
+ else if ( wd->sta.staPSList.count )
+ {
+ for(i=1; i<ZM_MAX_PS_STA; i++)
+ {
+ if ( wd->sta.staPSList.entity[i].bUsed )
+ {
+ if ( zfRxBufferEqualToStr(dev, buf,
+ wd->sta.staPSList.entity[i].macAddr,
+ ZM_WLAN_HEADER_A2_OFFSET, 6) )
+ {
+ wd->sta.staPSList.entity[i].bUsed = FALSE;
+ wd->sta.staPSList.count--;
+
+ if ( wd->sta.staPSList.entity[i].bDataQueued )
+ {
+ /* send queued data */
+ }
+ }
+ }
+ }
+
+ if ( wd->sta.staPSList.count == 0 )
+ {
+ /* disable ATIM window */
+ //zfDisableAtimWindow(dev);
+ }
+
+ }
+}
+
+/* IBSS power-saving mode */
+u8_t zfStaIbssPSQueueData(zdev_t* dev, zbuf_t* buf)
+{
+ u8_t i;
+ u16_t da[3];
+
+ zmw_get_wlan_dev(dev);
+
+ if ( !zfStaIsConnected(dev) )
+ {
+ return 0;
+ }
+
+ if ( wd->wlanMode != ZM_MODE_IBSS )
+ {
+ return 0;
+ }
+
+ if ( wd->sta.staPSList.count == 0 && wd->sta.powerSaveMode <= ZM_STA_PS_NONE )
+ {
+ return 0;
+ }
+
+ /* DA */
+#ifdef ZM_ENABLE_NATIVE_WIFI
+ da[0] = zmw_tx_buf_readh(dev, buf, ZM_WLAN_HEADER_A1_OFFSET);
+ da[1] = zmw_tx_buf_readh(dev, buf, ZM_WLAN_HEADER_A1_OFFSET + 2);
+ da[2] = zmw_tx_buf_readh(dev, buf, ZM_WLAN_HEADER_A1_OFFSET + 4);
+#else
+ da[0] = zmw_tx_buf_readh(dev, buf, 0);
+ da[1] = zmw_tx_buf_readh(dev, buf, 2);
+ da[2] = zmw_tx_buf_readh(dev, buf, 4);
+#endif
+
+ if ( ZM_IS_MULTICAST_OR_BROADCAST(da) )
+ {
+ wd->sta.staPSList.entity[0].bDataQueued = TRUE;
+ wd->sta.ibssPSDataQueue[wd->sta.ibssPSDataCount++] = buf;
+ return 1;
+ }
+
+ // Unicast packet...
+
+ for(i=1; i<ZM_MAX_PS_STA; i++)
+ {
+ if ( zfMemoryIsEqual(wd->sta.staPSList.entity[i].macAddr,
+ (u8_t*) da, 6) )
+ {
+ wd->sta.staPSList.entity[i].bDataQueued = TRUE;
+ wd->sta.ibssPSDataQueue[wd->sta.ibssPSDataCount++] = buf;
+
+ return 1;
+ }
+ }
+
+#if 0
+ if ( wd->sta.powerSaveMode > ZM_STA_PS_NONE )
+ {
+ wd->sta.staPSDataQueue[wd->sta.staPSDataCount++] = buf;
+
+ return 1;
+ }
+#endif
+
+ return 0;
+}
+
+/* IBSS power-saving mode */
+void zfStaIbssPSSend(zdev_t* dev)
+{
+ u8_t i;
+ u16_t bcastAddr[3] = {0xffff, 0xffff, 0xffff};
+
+ zmw_get_wlan_dev(dev);
+
+ if ( !zfStaIsConnected(dev) )
+ {
+ return ;
+ }
+
+ if ( wd->wlanMode != ZM_MODE_IBSS )
+ {
+ return ;
+ }
+
+ for(i=0; i<ZM_MAX_PS_STA; i++)
+ {
+ if ( wd->sta.staPSList.entity[i].bDataQueued )
+ {
+ if ( i == 0 )
+ {
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_ATIM,
+ bcastAddr,
+ 0, 0, 0);
+ }
+ else if ( wd->sta.staPSList.entity[i].bUsed )
+ {
+ // Send ATIM to prevent the peer to go to sleep
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_ATIM,
+ (u16_t*) wd->sta.staPSList.entity[i].macAddr,
+ 0, 0, 0);
+ }
+
+ wd->sta.staPSList.entity[i].bDataQueued = FALSE;
+ }
+ }
+
+ for(i=0; i<wd->sta.ibssPSDataCount; i++)
+ {
+ zfTxSendEth(dev, wd->sta.ibssPSDataQueue[i], 0,
+ ZM_EXTERNAL_ALLOC_BUF, 0);
+ }
+
+ wd->sta.ibssPrevPSDataCount = wd->sta.ibssPSDataCount;
+ wd->sta.ibssPSDataCount = 0;
+}
+
+
+void zfStaReconnect(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ if ( wd->wlanMode != ZM_MODE_INFRASTRUCTURE &&
+ wd->wlanMode != ZM_MODE_IBSS )
+ {
+ return;
+ }
+
+ if ( (zfStaIsConnected(dev))||(zfStaIsConnecting(dev)) )
+ {
+ return;
+ }
+
+ if ( wd->sta.bChannelScan )
+ {
+ return;
+ }
+
+ /* Recover zero SSID length */
+ if ( (wd->wlanMode == ZM_MODE_INFRASTRUCTURE) && (wd->ws.ssidLen == 0))
+ {
+ zm_debug_msg0("zfStaReconnect: NOT Support!! Set SSID to any BSS");
+ /* ANY BSS */
+ zmw_enter_critical_section(dev);
+ wd->sta.ssid[0] = 0;
+ wd->sta.ssidLen = 0;
+ zmw_leave_critical_section(dev);
+ }
+
+ // RAY: To ensure no TX pending before re-connecting
+ zfFlushVtxq(dev);
+ zfWlanEnable(dev);
+ zfScanMgrScanAck(dev);
+}
+
+void zfStaTimer100ms(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ if ( (wd->tick % 10) == 0 )
+ {
+ zfPushVtxq(dev);
+// zfPowerSavingMgrMain(dev);
+ }
+}
+
+
+void zfStaCheckRxBeacon(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ if (( wd->wlanMode == ZM_MODE_INFRASTRUCTURE ) && (zfStaIsConnected(dev)))
+ {
+ if (wd->beaconInterval == 0)
+ {
+ wd->beaconInterval = 100;
+ }
+ if ( (wd->tick % ((wd->beaconInterval * 10) / ZM_MS_PER_TICK)) == 0 )
+ {
+ /* Check rxBeaconCount */
+ if (wd->sta.rxBeaconCount == 0)
+ {
+ if (wd->sta.beaconMissState == 1)
+ {
+ /*notify AP that we left*/
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH, wd->sta.bssid, 3, 0, 0);
+ /* Beacon Lost */
+ zfStaConnectFail(dev, ZM_STATUS_MEDIA_DISCONNECT_BEACON_MISS,
+ wd->sta.bssid, 0);
+ }
+ else
+ {
+ wd->sta.beaconMissState = 1;
+ /* Reset channel */
+ zfCoreSetFrequencyExV2(dev, wd->frequency, wd->BandWidth40,
+ wd->ExtOffset, NULL, 1);
+ }
+ }
+ else
+ {
+ wd->sta.beaconMissState = 0;
+ }
+ wd->sta.rxBeaconCount = 0;
+ }
+ }
+}
+
+
+
+void zfStaCheckConnectTimeout(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ if ( wd->wlanMode != ZM_MODE_INFRASTRUCTURE )
+ {
+ return;
+ }
+
+ if ( !zfStaIsConnecting(dev) )
+ {
+ return;
+ }
+
+ zmw_enter_critical_section(dev);
+ if ( (wd->sta.connectState == ZM_STA_CONN_STATE_AUTH_OPEN)||
+ (wd->sta.connectState == ZM_STA_CONN_STATE_AUTH_SHARE_1)||
+ (wd->sta.connectState == ZM_STA_CONN_STATE_AUTH_SHARE_2)||
+ (wd->sta.connectState == ZM_STA_CONN_STATE_ASSOCIATE) )
+ {
+ if ( (wd->tick - wd->sta.connectTimer) > ZM_INTERVAL_CONNECT_TIMEOUT )
+ {
+ if ( wd->sta.connectByReasso )
+ {
+ wd->sta.failCntOfReasso++;
+ if ( wd->sta.failCntOfReasso > 2 )
+ {
+ wd->sta.connectByReasso = FALSE;
+ }
+ }
+
+ wd->sta.connectState = ZM_STA_CONN_STATE_NONE;
+ zm_debug_msg1("connect timeout, state = ", wd->sta.connectState);
+ //zfiWlanDisable(dev);
+ goto failed;
+ }
+ }
+
+ zmw_leave_critical_section(dev);
+ return;
+
+failed:
+ zmw_leave_critical_section(dev);
+ if(wd->sta.authMode == ZM_AUTH_MODE_AUTO)
+ { // Fix some AP not send authentication failed message to sta and lead to connect timeout !
+ wd->sta.connectTimeoutCount++;
+ }
+ zfStaConnectFail(dev, ZM_STATUS_MEDIA_DISCONNECT_TIMEOUT, wd->sta.bssid, 2);
+ return;
+}
+
+void zfMmStaTimeTick(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ /* airopeek */
+ if (wd->wlanMode != ZM_MODE_AP && !wd->swSniffer)
+ {
+ if ( wd->tick & 1 )
+ {
+ zfTimerCheckAndHandle(dev);
+ }
+
+ zfStaCheckRxBeacon(dev);
+ zfStaTimer100ms(dev);
+ zfStaCheckConnectTimeout(dev);
+ zfPowerSavingMgrMain(dev);
+ }
+
+#ifdef ZM_ENABLE_AGGREGATION
+ /*
+ * add by honda
+ */
+ zfAggScanAndClear(dev, wd->tick);
+#endif
+}
+
+void zfStaSendBeacon(zdev_t* dev)
+{
+ zbuf_t* buf;
+ u16_t offset, seq;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ //zm_debug_msg0("\n");
+
+ /* TBD : Maximum size of beacon */
+ if ((buf = zfwBufAllocate(dev, 1024)) == NULL)
+ {
+ zm_debug_msg0("Allocate beacon buffer failed");
+ return;
+ }
+
+ offset = 0;
+ /* wlan header */
+ /* Frame control */
+ zmw_tx_buf_writeh(dev, buf, offset, 0x0080);
+ offset+=2;
+ /* Duration */
+ zmw_tx_buf_writeh(dev, buf, offset, 0x0000);
+ offset+=2;
+ /* Address 1 */
+ zmw_tx_buf_writeh(dev, buf, offset, 0xffff);
+ offset+=2;
+ zmw_tx_buf_writeh(dev, buf, offset, 0xffff);
+ offset+=2;
+ zmw_tx_buf_writeh(dev, buf, offset, 0xffff);
+ offset+=2;
+ /* Address 2 */
+ zmw_tx_buf_writeh(dev, buf, offset, wd->macAddr[0]);
+ offset+=2;
+ zmw_tx_buf_writeh(dev, buf, offset, wd->macAddr[1]);
+ offset+=2;
+ zmw_tx_buf_writeh(dev, buf, offset, wd->macAddr[2]);
+ offset+=2;
+ /* Address 3 */
+ zmw_tx_buf_writeh(dev, buf, offset, wd->sta.bssid[0]);
+ offset+=2;
+ zmw_tx_buf_writeh(dev, buf, offset, wd->sta.bssid[1]);
+ offset+=2;
+ zmw_tx_buf_writeh(dev, buf, offset, wd->sta.bssid[2]);
+ offset+=2;
+
+ /* Sequence number */
+ zmw_enter_critical_section(dev);
+ seq = ((wd->mmseq++)<<4);
+ zmw_leave_critical_section(dev);
+ zmw_tx_buf_writeh(dev, buf, offset, seq);
+ offset+=2;
+
+ /* 24-31 Time Stamp : hardware will fill this field */
+ offset+=8;
+
+ /* Beacon Interval */
+ zmw_tx_buf_writeh(dev, buf, offset, wd->beaconInterval);
+ offset+=2;
+
+ /* Capability */
+ zmw_tx_buf_writeb(dev, buf, offset++, wd->sta.capability[0]);
+ zmw_tx_buf_writeb(dev, buf, offset++, wd->sta.capability[1]);
+
+ /* SSID */
+ offset = zfStaAddIeSsid(dev, buf, offset);
+
+ if(wd->frequency <= ZM_CH_G_14) // 2.4 GHz b+g
+ {
+
+ /* Support Rate */
+ offset = zfMmAddIeSupportRate(dev, buf, offset,
+ ZM_WLAN_EID_SUPPORT_RATE, ZM_RATE_SET_CCK);
+
+ /* DS parameter set */
+ offset = zfMmAddIeDs(dev, buf, offset);
+
+ offset = zfStaAddIeIbss(dev, buf, offset);
+
+ if( wd->wfc.bIbssGMode
+ && (wd->supportMode & (ZM_WIRELESS_MODE_24_54|ZM_WIRELESS_MODE_24_N)) ) // Only accompany with enabling a mode .
+ {
+ /* ERP Information */
+ wd->erpElement = 0;
+ offset = zfMmAddIeErp(dev, buf, offset);
+ }
+
+ /* TODO : country information */
+ /* RSN */
+ if ( wd->sta.authMode == ZM_AUTH_MODE_WPA2PSK )
+ {
+ offset = zfwStaAddIeWpaRsn(dev, buf, offset, ZM_WLAN_FRAME_TYPE_AUTH);
+ }
+
+ if( wd->wfc.bIbssGMode
+ && (wd->supportMode & (ZM_WIRELESS_MODE_24_54|ZM_WIRELESS_MODE_24_N)) ) // Only accompany with enabling a mode .
+ {
+ /* Enable G Mode */
+ /* Extended Supported Rates */
+ offset = zfMmAddIeSupportRate(dev, buf, offset,
+ ZM_WLAN_EID_EXTENDED_RATE, ZM_RATE_SET_OFDM);
+ }
+ }
+ else // 5GHz a
+ {
+ /* Support Rate a Mode */
+ offset = zfMmAddIeSupportRate(dev, buf, offset,
+ ZM_WLAN_EID_SUPPORT_RATE, ZM_RATE_SET_OFDM);
+
+ /* DS parameter set */
+ offset = zfMmAddIeDs(dev, buf, offset);
+
+ offset = zfStaAddIeIbss(dev, buf, offset);
+
+ /* TODO : country information */
+ /* RSN */
+ if ( wd->sta.authMode == ZM_AUTH_MODE_WPA2PSK )
+ {
+ offset = zfwStaAddIeWpaRsn(dev, buf, offset, ZM_WLAN_FRAME_TYPE_AUTH);
+ }
+ }
+
+ if ( wd->wlanMode != ZM_MODE_IBSS )
+ {
+ /* TODO : Need to check if it is ok */
+ /* HT Capabilities Info */
+ offset = zfMmAddHTCapability(dev, buf, offset);
+
+ /* Extended HT Capabilities Info */
+ offset = zfMmAddExtendedHTCapability(dev, buf, offset);
+ }
+
+ if ( wd->sta.ibssAdditionalIESize )
+ offset = zfStaAddIbssAdditionalIE(dev, buf, offset);
+
+ /* 1212 : write to beacon fifo */
+ /* 1221 : write to share memory */
+ zfHpSendBeacon(dev, buf, offset);
+
+ /* Free beacon buffer */
+ //zfwBufFree(dev, buf, 0);
+}
+
+void zfStaSignalStatistic(zdev_t* dev, u8_t SignalStrength, u8_t SignalQuality) //CWYang(+)
+{
+ zmw_get_wlan_dev(dev);
+
+ /* Add Your Code to Do Works Like Moving Average Here */
+ wd->SignalStrength = (wd->SignalStrength * 7 + SignalStrength * 3)/10;
+ wd->SignalQuality = (wd->SignalQuality * 7 + SignalQuality * 3)/10;
+
+}
+
+struct zsBssInfo* zfStaFindBssInfo(zdev_t* dev, zbuf_t* buf, struct zsWlanProbeRspFrameHeader *pProbeRspHeader)
+{
+ u8_t i;
+ u8_t j;
+ u8_t k;
+ u8_t isMatched, length, channel;
+ u16_t offset, frequency;
+ struct zsBssInfo* pBssInfo;
+
+ zmw_get_wlan_dev(dev);
+
+ if ((pBssInfo = wd->sta.bssList.head) == NULL)
+ {
+ return NULL;
+ }
+
+ for( i=0; i<wd->sta.bssList.bssCount; i++ )
+ {
+ //zm_debug_msg2("check pBssInfo = ", pBssInfo);
+
+ /* Check BSSID */
+ for( j=0; j<6; j++ )
+ {
+ if ( pBssInfo->bssid[j] != pProbeRspHeader->bssid[j] )
+ {
+ break;
+ }
+ }
+
+ /* Check SSID */
+ if (j == 6)
+ {
+ if (pProbeRspHeader->ssid[1] <= 32)
+ {
+ /* compare length and ssid */
+ isMatched = 1;
+ if((pProbeRspHeader->ssid[1] != 0) && (pBssInfo->ssid[1] != 0))
+ {
+ for( k=1; k<pProbeRspHeader->ssid[1] + 1; k++ )
+ {
+ if ( pBssInfo->ssid[k] != pProbeRspHeader->ssid[k] )
+ {
+ isMatched = 0;
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ isMatched = 0;
+ }
+ }
+ else
+ {
+ isMatched = 0;
+ }
+
+ /* Check channel */
+ /* Add check channel to solve the bug #31222 */
+ if (isMatched) {
+ if ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_DS)) != 0xffff) {
+ if ((length = zmw_rx_buf_readb(dev, buf, offset+1)) == 1) {
+ channel = zmw_rx_buf_readb(dev, buf, offset+2);
+ if (zfHpIsAllowedChannel(dev, zfChNumToFreq(dev, channel, 0)) == 0) {
+ frequency = 0;
+ } else {
+ frequency = zfChNumToFreq(dev, channel, 0);;
+ }
+ } else {
+ frequency = 0;
+ }
+ } else {
+ frequency = wd->sta.currentFrequency;
+ }
+
+ if (frequency != 0) {
+ if ( ((frequency > 3000) && (pBssInfo->frequency > 3000))
+ || ((frequency < 3000) && (pBssInfo->frequency < 3000)) ) {
+ /* redundant */
+ break;
+ }
+ }
+ }
+
+ pBssInfo = pBssInfo->next;
+ }
+
+ if ( i == wd->sta.bssList.bssCount )
+ {
+ pBssInfo = NULL;
+ }
+
+ return pBssInfo;
+}
+
+u8_t zfStaInitBssInfo(zdev_t* dev, zbuf_t* buf,
+ struct zsWlanProbeRspFrameHeader *pProbeRspHeader,
+ struct zsBssInfo* pBssInfo, struct zsAdditionInfo* AddInfo, u8_t type)
+{
+ u8_t length, channel, is5G;
+ u16_t i, offset;
+ u8_t apQosInfo;
+ u16_t eachIElength = 0;
+ u16_t accumulateLen = 0;
+
+ zmw_get_wlan_dev(dev);
+
+ if ((type == 1) && ((pBssInfo->flag & ZM_BSS_INFO_VALID_BIT) != 0))
+ {
+ goto zlUpdateRssi;
+ }
+
+ /* get SSID */
+ if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_SSID)) == 0xffff )
+ {
+ zm_debug_msg0("EID(SSID) not found");
+ goto zlError;
+ }
+
+ length = zmw_rx_buf_readb(dev, buf, offset+1);
+
+ {
+ u8_t Show_Flag = 0;
+ zfwGetShowZeroLengthSSID(dev, &Show_Flag);
+
+ if(Show_Flag)
+ {
+ if (length > ZM_MAX_SSID_LENGTH )
+ {
+ zm_debug_msg0("EID(SSID) is invalid");
+ goto zlError;
+ }
+ }
+ else
+ {
+ if ( length == 0 || length > ZM_MAX_SSID_LENGTH )
+ {
+ zm_debug_msg0("EID(SSID) is invalid");
+ goto zlError;
+ }
+
+ }
+ }
+ zfCopyFromRxBuffer(dev, buf, pBssInfo->ssid, offset, length+2);
+
+ /* get DS parameter */
+ if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_DS)) != 0xffff )
+ {
+ length = zmw_rx_buf_readb(dev, buf, offset+1);
+ if ( length != 1 )
+ {
+ zm_msg0_mm(ZM_LV_0, "Abnormal DS Param Set IE");
+ goto zlError;
+ }
+ channel = zmw_rx_buf_readb(dev, buf, offset+2);
+
+ if (zfHpIsAllowedChannel(dev, zfChNumToFreq(dev, channel, 0)) == 0)
+ {
+ goto zlError2;
+ }
+
+ pBssInfo->frequency = zfChNumToFreq(dev, channel, 0); // auto check
+ pBssInfo->channel = channel;
+
+
+ }
+ else
+ {
+ /* DS parameter not found */
+ pBssInfo->frequency = wd->sta.currentFrequency;
+ pBssInfo->channel = zfChFreqToNum(wd->sta.currentFrequency, &is5G);
+ }
+
+ /* initialize security type */
+ pBssInfo->securityType = ZM_SECURITY_TYPE_NONE;
+
+ /* get macaddr */
+ for( i=0; i<6; i++ )
+ {
+ pBssInfo->macaddr[i] = pProbeRspHeader->sa[i];
+ }
+
+ /* get bssid */
+ for( i=0; i<6; i++ )
+ {
+ pBssInfo->bssid[i] = pProbeRspHeader->bssid[i];
+ }
+
+ /* get timestamp */
+ for( i=0; i<8; i++ )
+ {
+ pBssInfo->timeStamp[i] = pProbeRspHeader->timeStamp[i];
+ }
+
+ /* get beacon interval */
+ pBssInfo->beaconInterval[0] = pProbeRspHeader->beaconInterval[0];
+ pBssInfo->beaconInterval[1] = pProbeRspHeader->beaconInterval[1];
+
+ /* get capability */
+ pBssInfo->capability[0] = pProbeRspHeader->capability[0];
+ pBssInfo->capability[1] = pProbeRspHeader->capability[1];
+
+ /* Copy frame body */
+ offset = 36; // Copy from the start of variable IE
+ pBssInfo->frameBodysize = zfwBufGetSize(dev, buf)-offset;
+ if (pBssInfo->frameBodysize > (ZM_MAX_PROBE_FRAME_BODY_SIZE-1))
+ {
+ pBssInfo->frameBodysize = ZM_MAX_PROBE_FRAME_BODY_SIZE-1;
+ }
+ accumulateLen = 0;
+ do
+ {
+ eachIElength = zmw_rx_buf_readb(dev, buf, offset + accumulateLen+1) + 2; //Len+(EID+Data)
+
+ if ( (eachIElength >= 2)
+ && ((accumulateLen + eachIElength) <= pBssInfo->frameBodysize) )
+ {
+ zfCopyFromRxBuffer(dev, buf, pBssInfo->frameBody+accumulateLen, offset+accumulateLen, eachIElength);
+ accumulateLen+=(u16_t)eachIElength;
+ }
+ else
+ {
+ zm_msg0_mm(ZM_LV_1, "probersp frameBodysize abnormal");
+ break;
+ }
+ }
+ while(accumulateLen < pBssInfo->frameBodysize);
+ pBssInfo->frameBodysize = accumulateLen;
+
+ /* get supported rates */
+ if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_SUPPORT_RATE)) == 0xffff )
+ {
+ zm_debug_msg0("EID(supported rates) not found");
+ goto zlError;
+ }
+
+ length = zmw_rx_buf_readb(dev, buf, offset+1);
+ if ( length == 0 || length > ZM_MAX_SUPP_RATES_IE_SIZE)
+ {
+ zm_msg0_mm(ZM_LV_0, "Supported rates IE length abnormal");
+ goto zlError;
+ }
+ zfCopyFromRxBuffer(dev, buf, pBssInfo->supportedRates, offset, length+2);
+
+
+
+ /* get Country information */
+ if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_COUNTRY)) != 0xffff )
+ {
+ length = zmw_rx_buf_readb(dev, buf, offset+1);
+ if (length > ZM_MAX_COUNTRY_INFO_SIZE)
+ {
+ length = ZM_MAX_COUNTRY_INFO_SIZE;
+ }
+ zfCopyFromRxBuffer(dev, buf, pBssInfo->countryInfo, offset, length+2);
+ /* check 802.11d support data */
+ if (wd->sta.b802_11D)
+ {
+ zfHpGetRegulationTablefromISO(dev, (u8_t *)&pBssInfo->countryInfo, 3);
+ /* only set regulatory one time */
+ wd->sta.b802_11D = 0;
+ }
+ }
+
+ /* get ERP information */
+ if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_ERP)) != 0xffff )
+ {
+ pBssInfo->erp = zmw_rx_buf_readb(dev, buf, offset+2);
+ }
+
+ /* get extended supported rates */
+ if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_EXTENDED_RATE)) != 0xffff )
+ {
+ length = zmw_rx_buf_readb(dev, buf, offset+1);
+ if (length > ZM_MAX_SUPP_RATES_IE_SIZE)
+ {
+ zm_msg0_mm(ZM_LV_0, "Extended rates IE length abnormal");
+ goto zlError;
+ }
+ zfCopyFromRxBuffer(dev, buf, pBssInfo->extSupportedRates, offset, length+2);
+ }
+ else
+ {
+ pBssInfo->extSupportedRates[0] = 0;
+ pBssInfo->extSupportedRates[1] = 0;
+ }
+
+ /* get WPA IE */
+ if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_WPA_IE)) != 0xffff )
+ {
+ length = zmw_rx_buf_readb(dev, buf, offset+1);
+ if (length > ZM_MAX_IE_SIZE)
+ {
+ length = ZM_MAX_IE_SIZE;
+ }
+ zfCopyFromRxBuffer(dev, buf, pBssInfo->wpaIe, offset, length+2);
+ pBssInfo->securityType = ZM_SECURITY_TYPE_WPA;
+ }
+ else
+ {
+ pBssInfo->wpaIe[1] = 0;
+ }
+
+ /* get WPS IE */
+ if ((offset = zfFindWifiElement(dev, buf, 4, 0xff)) != 0xffff)
+ {
+ length = zmw_rx_buf_readb(dev, buf, offset+1);
+ if (length > ZM_MAX_WPS_IE_SIZE )
+ {
+ length = ZM_MAX_WPS_IE_SIZE;
+ }
+ zfCopyFromRxBuffer(dev, buf, pBssInfo->wscIe, offset, length+2);
+ }
+ else
+ {
+ pBssInfo->wscIe[1] = 0;
+ }
+
+ /* get SuperG IE */
+ if ((offset = zfFindSuperGElement(dev, buf, ZM_WLAN_EID_VENDOR_PRIVATE)) != 0xffff)
+ {
+ pBssInfo->apCap |= ZM_SuperG_AP;
+ }
+
+ /* get XR IE */
+ if ((offset = zfFindXRElement(dev, buf, ZM_WLAN_EID_VENDOR_PRIVATE)) != 0xffff)
+ {
+ pBssInfo->apCap |= ZM_XR_AP;
+ }
+
+ /* get RSN IE */
+ if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_RSN_IE)) != 0xffff )
+ {
+ length = zmw_rx_buf_readb(dev, buf, offset+1);
+ if (length > ZM_MAX_IE_SIZE)
+ {
+ length = ZM_MAX_IE_SIZE;
+ }
+ zfCopyFromRxBuffer(dev, buf, pBssInfo->rsnIe, offset, length+2);
+ pBssInfo->securityType = ZM_SECURITY_TYPE_WPA;
+ }
+ else
+ {
+ pBssInfo->rsnIe[1] = 0;
+ }
+#ifdef ZM_ENABLE_CENC
+ /* get CENC IE */
+ if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_CENC_IE)) != 0xffff )
+ {
+ length = zmw_rx_buf_readb(dev, buf, offset+1);
+ if (length > ZM_MAX_IE_SIZE )
+ {
+ length = ZM_MAX_IE_SIZE;
+ }
+ zfCopyFromRxBuffer(dev, buf, pBssInfo->cencIe, offset, length+2);
+ pBssInfo->securityType = ZM_SECURITY_TYPE_CENC;
+ pBssInfo->capability[0] &= 0xffef;
+ }
+ else
+ {
+ pBssInfo->cencIe[1] = 0;
+ }
+#endif //ZM_ENABLE_CENC
+ /* get WME Parameter IE, probe rsp may contain WME parameter element */
+ //if ( wd->bQoSEnable )
+ {
+ if ((offset = zfFindWifiElement(dev, buf, 2, 1)) != 0xffff)
+ {
+ apQosInfo = zmw_rx_buf_readb(dev, buf, offset+8) & 0x80;
+ pBssInfo->wmeSupport = 1 | apQosInfo;
+ }
+ else if ((offset = zfFindWifiElement(dev, buf, 2, 0)) != 0xffff)
+ {
+ apQosInfo = zmw_rx_buf_readb(dev, buf, offset+8) & 0x80;
+ pBssInfo->wmeSupport = 1 | apQosInfo;
+ }
+ else
+ {
+ pBssInfo->wmeSupport = 0;
+ }
+ }
+ //CWYang(+)
+ if ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_HT_CAPABILITY)) != 0xffff)
+ {
+ /* 11n AP */
+ pBssInfo->EnableHT = 1;
+ if (zmw_rx_buf_readb(dev, buf, offset+1) & 0x02)
+ {
+ pBssInfo->enableHT40 = 1;
+ }
+ else
+ {
+ pBssInfo->enableHT40 = 0;
+ }
+
+ if (zmw_rx_buf_readb(dev, buf, offset+1) & 0x40)
+ {
+ pBssInfo->SG40 = 1;
+ }
+ else
+ {
+ pBssInfo->SG40 = 0;
+ }
+ }
+ else if ((offset = zfFindElement(dev, buf, ZM_WLAN_PREN2_EID_HTCAPABILITY)) != 0xffff)
+ {
+ /* 11n AP */
+ pBssInfo->EnableHT = 1;
+ pBssInfo->apCap |= ZM_All11N_AP;
+ if (zmw_rx_buf_readb(dev, buf, offset+2) & 0x02)
+ {
+ pBssInfo->enableHT40 = 1;
+ }
+ else
+ {
+ pBssInfo->enableHT40 = 0;
+ }
+
+ if (zmw_rx_buf_readb(dev, buf, offset+2) & 0x40)
+ {
+ pBssInfo->SG40 = 1;
+ }
+ else
+ {
+ pBssInfo->SG40 = 0;
+ }
+ }
+ else
+ {
+ pBssInfo->EnableHT = 0;
+ }
+ /* HT information */
+ if ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_EXTENDED_HT_CAPABILITY)) != 0xffff)
+ {
+ /* atheros pre n */
+ pBssInfo->extChOffset = zmw_rx_buf_readb(dev, buf, offset+2) & 0x03;
+ }
+ else if ((offset = zfFindElement(dev, buf, ZM_WLAN_PREN2_EID_HTINFORMATION)) != 0xffff)
+ {
+ /* pre n 2.0 standard */
+ pBssInfo->extChOffset = zmw_rx_buf_readb(dev, buf, offset+3) & 0x03;
+ }
+ else
+ {
+ pBssInfo->extChOffset = 0;
+ }
+
+ if ( (pBssInfo->enableHT40 == 1)
+ && ((pBssInfo->extChOffset != 1) && (pBssInfo->extChOffset != 3)) )
+ {
+ pBssInfo->enableHT40 = 0;
+ }
+
+ if (pBssInfo->enableHT40 == 1)
+ {
+ if (zfHpIsAllowedChannel(dev, pBssInfo->frequency+((pBssInfo->extChOffset==1)?20:-20)) == 0)
+ {
+ /* if extension channel is not an allowed channel, treat AP as non-HT mode */
+ pBssInfo->EnableHT = 0;
+ pBssInfo->enableHT40 = 0;
+ pBssInfo->extChOffset = 0;
+ }
+ }
+
+ /* get ATH Extended Capability */
+ if ( ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_EXTENDED_HT_CAPABILITY)) != 0xffff)&&
+ ((offset = zfFindBrdcmMrvlRlnkExtCap(dev, buf)) == 0xffff))
+
+ {
+ pBssInfo->athOwlAp = 1;
+ }
+ else
+ {
+ pBssInfo->athOwlAp = 0;
+ }
+
+ /* get Broadcom Extended Capability */
+ if ( (pBssInfo->EnableHT == 1) //((offset = zfFindElement(dev, buf, ZM_WLAN_EID_EXTENDED_HT_CAPABILITY)) != 0xffff)
+ && ((offset = zfFindBroadcomExtCap(dev, buf)) != 0xffff) )
+ {
+ pBssInfo->broadcomHTAp = 1;
+ }
+ else
+ {
+ pBssInfo->broadcomHTAp = 0;
+ }
+
+ /* get Marvel Extended Capability */
+ if ((offset = zfFindMarvelExtCap(dev, buf)) != 0xffff)
+ {
+ pBssInfo->marvelAp = 1;
+ }
+ else
+ {
+ pBssInfo->marvelAp = 0;
+ }
+
+ /* get ATIM window */
+ if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_IBSS)) != 0xffff )
+ {
+ pBssInfo->atimWindow = zmw_rx_buf_readh(dev, buf,offset+2);
+ }
+
+ /* Fit for support mode */
+ if (pBssInfo->frequency > 3000) {
+ if (wd->supportMode & ZM_WIRELESS_MODE_5_N) {
+#if 0
+ if (wd->supportMode & ZM_WIRELESS_MODE_5_54) {
+ /* support mode: a, n */
+ /* do nothing */
+ } else {
+ /* support mode: n */
+ /* reject non-n bss info */
+ if (!pBssInfo->EnableHT) {
+ goto zlError2;
+ }
+ }
+#endif
+ } else {
+ if (wd->supportMode & ZM_WIRELESS_MODE_5_54) {
+ /* support mode: a */
+ /* delete n mode information */
+ pBssInfo->EnableHT = 0;
+ pBssInfo->enableHT40 = 0;
+ pBssInfo->apCap &= (~ZM_All11N_AP);
+ pBssInfo->extChOffset = 0;
+ pBssInfo->frameBodysize = zfRemoveElement(dev, pBssInfo->frameBody,
+ pBssInfo->frameBodysize, ZM_WLAN_EID_HT_CAPABILITY);
+ pBssInfo->frameBodysize = zfRemoveElement(dev, pBssInfo->frameBody,
+ pBssInfo->frameBodysize, ZM_WLAN_PREN2_EID_HTCAPABILITY);
+ pBssInfo->frameBodysize = zfRemoveElement(dev, pBssInfo->frameBody,
+ pBssInfo->frameBodysize, ZM_WLAN_EID_EXTENDED_HT_CAPABILITY);
+ pBssInfo->frameBodysize = zfRemoveElement(dev, pBssInfo->frameBody,
+ pBssInfo->frameBodysize, ZM_WLAN_PREN2_EID_HTINFORMATION);
+ } else {
+ /* support mode: none */
+ goto zlError2;
+ }
+ }
+ } else {
+ if (wd->supportMode & ZM_WIRELESS_MODE_24_N) {
+#if 0
+ if (wd->supportMode & ZM_WIRELESS_MODE_24_54) {
+ if (wd->supportMode & ZM_WIRELESS_MODE_24_11) {
+ /* support mode: b, g, n */
+ /* do nothing */
+ } else {
+ /* support mode: g, n */
+ /* reject b-only bss info */
+ if ( (!pBssInfo->EnableHT)
+ && (pBssInfo->extSupportedRates[1] == 0) ) {
+ goto zlError2;
+ }
+ }
+ } else {
+ if (wd->supportMode & ZM_WIRELESS_MODE_24_11) {
+ /* support mode: b, n */
+ /* 1. reject g-only bss info
+ * 2. if non g-only, delete g mode information
+ */
+ if ( !pBssInfo->EnableHT ) {
+ if ( zfIsGOnlyMode(dev, pBssInfo->frequency, pBssInfo->supportedRates)
+ || zfIsGOnlyMode(dev, pBssInfo->frequency, pBssInfo->extSupportedRates) ) {
+ goto zlError2;
+ } else {
+ zfGatherBMode(dev, pBssInfo->supportedRates,
+ pBssInfo->extSupportedRates);
+ pBssInfo->erp = 0;
+
+ pBssInfo->frameBodysize = zfRemoveElement(dev,
+ pBssInfo->frameBody, pBssInfo->frameBodysize,
+ ZM_WLAN_EID_ERP);
+ pBssInfo->frameBodysize = zfRemoveElement(dev,
+ pBssInfo->frameBody, pBssInfo->frameBodysize,
+ ZM_WLAN_EID_EXTENDED_RATE);
+
+ pBssInfo->frameBodysize = zfUpdateElement(dev,
+ pBssInfo->frameBody, pBssInfo->frameBodysize,
+ pBssInfo->supportedRates);
+ }
+ }
+ } else {
+ /* support mode: n */
+ /* reject non-n bss info */
+ if (!pBssInfo->EnableHT) {
+ goto zlError2;
+ }
+ }
+ }
+#endif
+ } else {
+ /* delete n mode information */
+ pBssInfo->EnableHT = 0;
+ pBssInfo->enableHT40 = 0;
+ pBssInfo->apCap &= (~ZM_All11N_AP);
+ pBssInfo->extChOffset = 0;
+ pBssInfo->frameBodysize = zfRemoveElement(dev, pBssInfo->frameBody,
+ pBssInfo->frameBodysize, ZM_WLAN_EID_HT_CAPABILITY);
+ pBssInfo->frameBodysize = zfRemoveElement(dev, pBssInfo->frameBody,
+ pBssInfo->frameBodysize, ZM_WLAN_PREN2_EID_HTCAPABILITY);
+ pBssInfo->frameBodysize = zfRemoveElement(dev, pBssInfo->frameBody,
+ pBssInfo->frameBodysize, ZM_WLAN_EID_EXTENDED_HT_CAPABILITY);
+ pBssInfo->frameBodysize = zfRemoveElement(dev, pBssInfo->frameBody,
+ pBssInfo->frameBodysize, ZM_WLAN_PREN2_EID_HTINFORMATION);
+
+ if (wd->supportMode & ZM_WIRELESS_MODE_24_54) {
+#if 0
+ if (wd->supportMode & ZM_WIRELESS_MODE_24_11) {
+ /* support mode: b, g */
+ /* delete n mode information */
+ } else {
+ /* support mode: g */
+ /* delete n mode information */
+ /* reject b-only bss info */
+ if (pBssInfo->extSupportedRates[1] == 0) {
+ goto zlError2;
+ }
+ }
+#endif
+ } else {
+ if (wd->supportMode & ZM_WIRELESS_MODE_24_11) {
+ /* support mode: b */
+ /* delete n mode information */
+ if ( zfIsGOnlyMode(dev, pBssInfo->frequency, pBssInfo->supportedRates)
+ || zfIsGOnlyMode(dev, pBssInfo->frequency, pBssInfo->extSupportedRates) ) {
+ goto zlError2;
+ } else {
+ zfGatherBMode(dev, pBssInfo->supportedRates,
+ pBssInfo->extSupportedRates);
+ pBssInfo->erp = 0;
+
+ pBssInfo->frameBodysize = zfRemoveElement(dev,
+ pBssInfo->frameBody, pBssInfo->frameBodysize,
+ ZM_WLAN_EID_ERP);
+ pBssInfo->frameBodysize = zfRemoveElement(dev,
+ pBssInfo->frameBody, pBssInfo->frameBodysize,
+ ZM_WLAN_EID_EXTENDED_RATE);
+
+ pBssInfo->frameBodysize = zfUpdateElement(dev,
+ pBssInfo->frameBody, pBssInfo->frameBodysize,
+ pBssInfo->supportedRates);
+ }
+ } else {
+ /* support mode: none */
+ goto zlError2;
+ }
+ }
+ }
+ }
+
+ pBssInfo->flag |= ZM_BSS_INFO_VALID_BIT;
+
+zlUpdateRssi:
+ /* Update Timer information */
+ pBssInfo->tick = wd->tick;
+
+ /* Update ERP information */
+ if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_ERP)) != 0xffff )
+ {
+ pBssInfo->erp = zmw_rx_buf_readb(dev, buf, offset+2);
+ }
+
+ if( (s8_t)pBssInfo->signalStrength < (s8_t)AddInfo->Tail.Data.SignalStrength1 )
+ {
+ /* Update signal strength */
+ pBssInfo->signalStrength = (u8_t)AddInfo->Tail.Data.SignalStrength1;
+ /* Update signal quality */
+ pBssInfo->signalQuality = (u8_t)(AddInfo->Tail.Data.SignalStrength1 * 2);
+
+ /* Update the sorting value */
+ pBssInfo->sortValue = zfComputeBssInfoWeightValue(dev,
+ (pBssInfo->supportedRates[6] + pBssInfo->extSupportedRates[0]),
+ pBssInfo->EnableHT,
+ pBssInfo->enableHT40,
+ pBssInfo->signalStrength);
+ }
+
+ return 0;
+
+zlError:
+
+ return 1;
+
+zlError2:
+
+ return 2;
+}
+
+void zfStaProcessBeacon(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* AddInfo) //CWYang(m)
+{
+ /* Parse TIM and send PS-POLL in power saving mode */
+ struct zsWlanBeaconFrameHeader* pBeaconHeader;
+ struct zsBssInfo* pBssInfo;
+ u8_t pBuf[sizeof(struct zsWlanBeaconFrameHeader)];
+ u8_t bssid[6];
+ int res;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ /* sta routine jobs */
+ zfStaProtErpMonitor(dev, buf); /* check protection mode */
+
+ if (zfStaIsConnected(dev))
+ {
+ ZM_MAC_WORD_TO_BYTE(wd->sta.bssid, bssid);
+
+ if ( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ {
+ if ( zfRxBufferEqualToStr(dev, buf, bssid, ZM_WLAN_HEADER_A2_OFFSET, 6) )
+ {
+ zfPowerSavingMgrProcessBeacon(dev, buf);
+ zfStaUpdateWmeParameter(dev, buf);
+ if (wd->sta.DFSEnable)
+ zfStaUpdateDot11HDFS(dev, buf);
+ if (wd->sta.TPCEnable)
+ zfStaUpdateDot11HTPC(dev, buf);
+ /* update signal strength and signal quality */
+ zfStaSignalStatistic(dev, AddInfo->Tail.Data.SignalStrength1,
+ AddInfo->Tail.Data.SignalQuality); //CWYang(+)
+ wd->sta.rxBeaconCount++;
+ }
+ }
+ else if ( wd->wlanMode == ZM_MODE_IBSS )
+ {
+ if ( zfRxBufferEqualToStr(dev, buf, bssid, ZM_WLAN_HEADER_A3_OFFSET, 6) )
+ {
+ int res;
+ struct zsPartnerNotifyEvent event;
+
+ zm_debug_msg0("20070916 Receive opposite Beacon!");
+ zmw_enter_critical_section(dev);
+ wd->sta.ibssReceiveBeaconCount++;
+ zmw_leave_critical_section(dev);
+
+ res = zfStaSetOppositeInfoFromRxBuf(dev, buf);
+ if ( res == 0 )
+ {
+ // New peer station found. Notify the wrapper now
+ zfInitPartnerNotifyEvent(dev, buf, &event);
+ if (wd->zfcbIbssPartnerNotify != NULL)
+ {
+ wd->zfcbIbssPartnerNotify(dev, 1, &event);
+ }
+ }
+ /* update signal strength and signal quality */
+ zfStaSignalStatistic(dev, AddInfo->Tail.Data.SignalStrength1,
+ AddInfo->Tail.Data.SignalQuality); //CWYang(+)
+ }
+ //else if ( wd->sta.ibssPartnerStatus == ZM_IBSS_PARTNER_LOST )
+ // Why does this happen in IBSS?? The impact of Vista since
+ // we need to tell it the BSSID
+#if 0
+ else if ( wd->sta.oppositeCount == 0 )
+ { /* IBSS merge if SSID matched */
+ if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_SSID)) != 0xffff )
+ {
+ if ( (wd->sta.ssidLen == zmw_buf_readb(dev, buf, offset+1))&&
+ (zfRxBufferEqualToStr(dev, buf, wd->sta.ssid,
+ offset+2, wd->sta.ssidLen)) )
+ {
+ capabilityInfo = zmw_buf_readh(dev, buf, 34);
+
+ if ( capabilityInfo & ZM_BIT_1 )
+ {
+ if ( (wd->sta.capability[0] & ZM_BIT_4) ==
+ (capabilityInfo & ZM_BIT_4) )
+ {
+ zm_debug_msg0("IBSS merge");
+ zfCopyFromRxBuffer(dev, buf, bssid,
+ ZM_WLAN_HEADER_A3_OFFSET, 6);
+ zfUpdateBssid(dev, bssid);
+ }
+ }
+ }
+ }
+ }
+#endif
+ }
+ }
+
+ /* return if not channel scan */
+ if ( !wd->sta.bChannelScan )
+ {
+ goto zlReturn;
+ }
+
+ zfCopyFromRxBuffer(dev, buf, pBuf, 0, sizeof(struct zsWlanBeaconFrameHeader));
+ pBeaconHeader = (struct zsWlanBeaconFrameHeader*) pBuf;
+
+ zmw_enter_critical_section(dev);
+
+ //zm_debug_msg1("bss count = ", wd->sta.bssList.bssCount);
+
+ pBssInfo = zfStaFindBssInfo(dev, buf, pBeaconHeader);
+
+ if ( pBssInfo == NULL )
+ {
+ /* Allocate a new entry if BSS not in the scan list */
+ pBssInfo = zfBssInfoAllocate(dev);
+ if (pBssInfo != NULL)
+ {
+ res = zfStaInitBssInfo(dev, buf, pBeaconHeader, pBssInfo, AddInfo, 0);
+ //zfDumpSSID(pBssInfo->ssid[1], &(pBssInfo->ssid[2]));
+ if ( res != 0 )
+ {
+ zfBssInfoFree(dev, pBssInfo);
+ }
+ else
+ {
+ zfBssInfoInsertToList(dev, pBssInfo);
+ }
+ }
+ }
+ else
+ {
+ res = zfStaInitBssInfo(dev, buf, pBeaconHeader, pBssInfo, AddInfo, 1);
+ if (res == 2)
+ {
+ zfBssInfoRemoveFromList(dev, pBssInfo);
+ zfBssInfoFree(dev, pBssInfo);
+ }
+ else if ( wd->wlanMode == ZM_MODE_IBSS )
+ {
+ int idx;
+
+ // It would reset the alive counter if the peer station is found!
+ zfStaFindFreeOpposite(dev, (u16_t *)pBssInfo->macaddr, &idx);
+ }
+ }
+
+ zmw_leave_critical_section(dev);
+
+zlReturn:
+
+ return;
+}
+
+
+void zfAuthFreqCompleteCb(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ if (wd->sta.connectState == ZM_STA_CONN_STATE_AUTH_COMPLETED)
+ {
+ zm_debug_msg0("ZM_STA_CONN_STATE_ASSOCIATE");
+ wd->sta.connectTimer = wd->tick;
+ wd->sta.connectState = ZM_STA_CONN_STATE_ASSOCIATE;
+ }
+
+ zmw_leave_critical_section(dev);
+ return;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfProcessAuth */
+/* Process authenticate management frame. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : auth frame buffer */
+/* */
+/* OUTPUTS */
+/* none */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+/* Note : AP allows one authenticating STA at a time, does not */
+/* support multiple authentication process. Make sure */
+/* authentication state machine will not be blocked due */
+/* to incompleted authentication handshake. */
+void zfStaProcessAuth(zdev_t* dev, zbuf_t* buf, u16_t* src, u16_t apId)
+{
+ struct zsWlanAuthFrameHeader* pAuthFrame;
+ u8_t pBuf[sizeof(struct zsWlanAuthFrameHeader)];
+ u32_t p1, p2;
+
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ if ( !zfStaIsConnecting(dev) )
+ {
+ return;
+ }
+
+ pAuthFrame = (struct zsWlanAuthFrameHeader*) pBuf;
+ zfCopyFromRxBuffer(dev, buf, pBuf, 0, sizeof(struct zsWlanAuthFrameHeader));
+
+ if ( wd->sta.connectState == ZM_STA_CONN_STATE_AUTH_OPEN )
+ {
+ if ( (zmw_le16_to_cpu(pAuthFrame->seq) == 2)&&
+ (zmw_le16_to_cpu(pAuthFrame->algo) == 0)&&
+ (zmw_le16_to_cpu(pAuthFrame->status) == 0) )
+ {
+
+ zmw_enter_critical_section(dev);
+ wd->sta.connectTimer = wd->tick;
+ zm_debug_msg0("ZM_STA_CONN_STATE_AUTH_COMPLETED");
+ wd->sta.connectState = ZM_STA_CONN_STATE_AUTH_COMPLETED;
+ zmw_leave_critical_section(dev);
+
+ //Set channel according to AP's configuration
+ //Move to here because of Cisco 11n AP feature
+ zfCoreSetFrequencyEx(dev, wd->frequency, wd->BandWidth40,
+ wd->ExtOffset, zfAuthFreqCompleteCb);
+
+ /* send association frame */
+ if ( wd->sta.connectByReasso )
+ {
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_REASOCREQ,
+ wd->sta.bssid, 0, 0, 0);
+ }
+ else
+ {
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_ASOCREQ,
+ wd->sta.bssid, 0, 0, 0);
+ }
+
+
+ }
+ else
+ {
+ zm_debug_msg1("authentication failed, status = ",
+ pAuthFrame->status);
+
+ if (wd->sta.authMode == ZM_AUTH_MODE_AUTO)
+ {
+ wd->sta.bIsSharedKey = 1;
+ zfStaStartConnect(dev, wd->sta.bIsSharedKey);
+ }
+ else
+ {
+ zm_debug_msg0("ZM_STA_STATE_DISCONNECT");
+ zfStaConnectFail(dev, ZM_STATUS_MEDIA_DISCONNECT_AUTH_FAILED, wd->sta.bssid, 3);
+ }
+ }
+ }
+ else if ( wd->sta.connectState == ZM_STA_CONN_STATE_AUTH_SHARE_1 )
+ {
+ if ( (zmw_le16_to_cpu(pAuthFrame->algo) == 1) &&
+ (zmw_le16_to_cpu(pAuthFrame->seq) == 2) &&
+ (zmw_le16_to_cpu(pAuthFrame->status) == 0))
+ //&& (pAuthFrame->challengeText[1] <= 255) )
+ {
+ zfMemoryCopy(wd->sta.challengeText, pAuthFrame->challengeText,
+ pAuthFrame->challengeText[1]+2);
+
+ /* send the 3rd authentication frame */
+ p1 = 0x30001;
+ p2 = 0;
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_AUTH,
+ wd->sta.bssid, p1, p2, 0);
+
+ zmw_enter_critical_section(dev);
+ wd->sta.connectTimer = wd->tick;
+
+ zm_debug_msg0("ZM_STA_SUB_STATE_AUTH_SHARE_2");
+ wd->sta.connectState = ZM_STA_CONN_STATE_AUTH_SHARE_2;
+ zmw_leave_critical_section(dev);
+ }
+ else
+ {
+ zm_debug_msg1("authentication failed, status = ",
+ pAuthFrame->status);
+
+ zm_debug_msg0("ZM_STA_STATE_DISCONNECT");
+ zfStaConnectFail(dev, ZM_STATUS_MEDIA_DISCONNECT_AUTH_FAILED, wd->sta.bssid, 3);
+ }
+ }
+ else if ( wd->sta.connectState == ZM_STA_CONN_STATE_AUTH_SHARE_2 )
+ {
+ if ( (zmw_le16_to_cpu(pAuthFrame->algo) == 1)&&
+ (zmw_le16_to_cpu(pAuthFrame->seq) == 4)&&
+ (zmw_le16_to_cpu(pAuthFrame->status) == 0) )
+ {
+ //Set channel according to AP's configuration
+ //Move to here because of Cisco 11n AP feature
+ zfCoreSetFrequencyEx(dev, wd->frequency, wd->BandWidth40,
+ wd->ExtOffset, NULL);
+
+ /* send association frame */
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_ASOCREQ,
+ wd->sta.bssid, 0, 0, 0);
+
+ zmw_enter_critical_section(dev);
+ wd->sta.connectTimer = wd->tick;
+
+ zm_debug_msg0("ZM_STA_SUB_STATE_ASSOCIATE");
+ wd->sta.connectState = ZM_STA_CONN_STATE_ASSOCIATE;
+ zmw_leave_critical_section(dev);
+ }
+ else
+ {
+ zm_debug_msg1("authentication failed, status = ",
+ pAuthFrame->status);
+
+ zm_debug_msg0("ZM_STA_STATE_DISCONNECT");
+ zfStaConnectFail(dev, ZM_STATUS_MEDIA_DISCONNECT_AUTH_FAILED, wd->sta.bssid, 3);
+ }
+ }
+ else
+ {
+ zm_debug_msg0("unknown case");
+ }
+}
+
+void zfStaProcessAsocReq(zdev_t* dev, zbuf_t* buf, u16_t* src, u16_t apId)
+{
+
+ return;
+}
+
+void zfStaProcessAsocRsp(zdev_t* dev, zbuf_t* buf)
+{
+ struct zsWlanAssoFrameHeader* pAssoFrame;
+ u8_t pBuf[sizeof(struct zsWlanAssoFrameHeader)];
+ u16_t offset;
+ u32_t i;
+ u32_t oneTxStreamCap;
+
+ zmw_get_wlan_dev(dev);
+
+ if ( !zfStaIsConnecting(dev) )
+ {
+ return;
+ }
+
+ pAssoFrame = (struct zsWlanAssoFrameHeader*) pBuf;
+ zfCopyFromRxBuffer(dev, buf, pBuf, 0, sizeof(struct zsWlanAssoFrameHeader));
+
+ if ( wd->sta.connectState == ZM_STA_CONN_STATE_ASSOCIATE )
+ {
+ if ( pAssoFrame->status == 0 )
+ {
+ zm_debug_msg0("ZM_STA_STATE_CONNECTED");
+
+ if (wd->sta.EnableHT == 1)
+ {
+ wd->sta.wmeConnected = 1;
+ }
+ if ((wd->sta.wmeEnabled & ZM_STA_WME_ENABLE_BIT) != 0) //WME enabled
+ {
+ /* Asoc rsp may contain WME parameter element */
+ if ((offset = zfFindWifiElement(dev, buf, 2, 1)) != 0xffff)
+ {
+ zm_debug_msg0("WME enable");
+ wd->sta.wmeConnected = 1;
+ if ((wd->sta.wmeEnabled & ZM_STA_UAPSD_ENABLE_BIT) != 0)
+ {
+ if ((zmw_rx_buf_readb(dev, buf, offset+8) & 0x80) != 0)
+ {
+ zm_debug_msg0("UAPSD enable");
+ wd->sta.qosInfo = wd->sta.wmeQosInfo;
+ }
+ }
+
+ zfStaUpdateWmeParameter(dev, buf);
+ }
+ }
+
+
+ //Store asoc response frame body, for VISTA only
+ wd->sta.asocRspFrameBodySize = zfwBufGetSize(dev, buf)-24;
+ if (wd->sta.asocRspFrameBodySize > ZM_CACHED_FRAMEBODY_SIZE)
+ {
+ wd->sta.asocRspFrameBodySize = ZM_CACHED_FRAMEBODY_SIZE;
+ }
+ for (i=0; i<wd->sta.asocRspFrameBodySize; i++)
+ {
+ wd->sta.asocRspFrameBody[i] = zmw_rx_buf_readb(dev, buf, i+24);
+ }
+
+ zfStaStoreAsocRspIe(dev, buf);
+ if (wd->sta.EnableHT &&
+ ((wd->sta.ie.HtCap.HtCapInfo & HTCAP_SupChannelWidthSet) != 0) &&
+ (wd->ExtOffset != 0))
+ {
+ wd->sta.htCtrlBandwidth = 1;
+ }
+ else
+ {
+ wd->sta.htCtrlBandwidth = 0;
+ }
+
+ //Set channel according to AP's configuration
+ //zfCoreSetFrequencyEx(dev, wd->frequency, wd->BandWidth40,
+ // wd->ExtOffset, NULL);
+
+ if (wd->sta.EnableHT == 1)
+ {
+ wd->addbaComplete = 0;
+
+ if ((wd->sta.SWEncryptEnable & ZM_SW_TKIP_ENCRY_EN) == 0 &&
+ (wd->sta.SWEncryptEnable & ZM_SW_WEP_ENCRY_EN) == 0)
+ {
+ wd->addbaCount = 1;
+ zfAggSendAddbaRequest(dev, wd->sta.bssid, 0, 0);
+ zfTimerSchedule(dev, ZM_EVENT_TIMEOUT_ADDBA, 100);
+ }
+ }
+
+ /* set RIFS support */
+ if(wd->sta.ie.HtInfo.ChannelInfo & ExtHtCap_RIFSMode)
+ {
+ wd->sta.HT2040 = 1;
+// zfHpSetRifs(dev, wd->sta.EnableHT, 1, (wd->sta.currentFrequency < 3000)? 1:0);
+ }
+
+ wd->sta.aid = pAssoFrame->aid & 0x3fff;
+ wd->sta.oppositeCount = 0; /* reset opposite count */
+ zfStaSetOppositeInfoFromRxBuf(dev, buf);
+
+ wd->sta.rxBeaconCount = 16;
+
+ zfChangeAdapterState(dev, ZM_STA_STATE_CONNECTED);
+ wd->sta.connPowerInHalfDbm = zfHpGetTransmitPower(dev);
+ if (wd->zfcbConnectNotify != NULL)
+ {
+ if (wd->sta.EnableHT != 0) /* 11n */
+ {
+ oneTxStreamCap = (zfHpCapability(dev) & ZM_HP_CAP_11N_ONE_TX_STREAM);
+ if (wd->sta.htCtrlBandwidth == 1) /* HT40*/
+ {
+ if(oneTxStreamCap) /* one Tx stream */
+ {
+ if (wd->sta.SG40)
+ {
+ wd->CurrentTxRateKbps = 150000;
+ wd->CurrentRxRateKbps = 300000;
+ }
+ else
+ {
+ wd->CurrentTxRateKbps = 135000;
+ wd->CurrentRxRateKbps = 270000;
+ }
+ }
+ else /* Two Tx streams */
+ {
+ if (wd->sta.SG40)
+ {
+ wd->CurrentTxRateKbps = 300000;
+ wd->CurrentRxRateKbps = 300000;
+ }
+ else
+ {
+ wd->CurrentTxRateKbps = 270000;
+ wd->CurrentRxRateKbps = 270000;
+ }
+ }
+ }
+ else /* HT20 */
+ {
+ if(oneTxStreamCap) /* one Tx stream */
+ {
+ wd->CurrentTxRateKbps = 650000;
+ wd->CurrentRxRateKbps = 130000;
+ }
+ else /* Two Tx streams */
+ {
+ wd->CurrentTxRateKbps = 130000;
+ wd->CurrentRxRateKbps = 130000;
+ }
+ }
+ }
+ else /* 11abg */
+ {
+ if (wd->sta.connection_11b != 0)
+ {
+ wd->CurrentTxRateKbps = 11000;
+ wd->CurrentRxRateKbps = 11000;
+ }
+ else
+ {
+ wd->CurrentTxRateKbps = 54000;
+ wd->CurrentRxRateKbps = 54000;
+ }
+ }
+
+
+ wd->zfcbConnectNotify(dev, ZM_STATUS_MEDIA_CONNECT, wd->sta.bssid);
+ }
+ wd->sta.connectByReasso = TRUE;
+ wd->sta.failCntOfReasso = 0;
+
+ zfPowerSavingMgrConnectNotify(dev);
+
+ /* Disable here because fixed rate is only for test, TBD. */
+ //if (wd->sta.EnableHT)
+ //{
+ // wd->txMCS = 7; //Rate = 65Mbps
+ // wd->txMT = 2; // Ht rate
+ // wd->enableAggregation = 2; // Enable Aggregation
+ //}
+ }
+ else
+ {
+ zm_debug_msg1("association failed, status = ",
+ pAssoFrame->status);
+
+ zm_debug_msg0("ZM_STA_STATE_DISCONNECT");
+ wd->sta.connectByReasso = FALSE;
+ zfStaConnectFail(dev, ZM_STATUS_MEDIA_DISCONNECT_ASOC_FAILED, wd->sta.bssid, 3);
+ }
+ }
+
+}
+
+void zfStaStoreAsocRspIe(zdev_t* dev, zbuf_t* buf)
+{
+ u16_t offset;
+ u32_t i;
+ u16_t length;
+ u8_t *htcap;
+ u8_t asocBw40 = 0;
+ u8_t asocExtOffset = 0;
+
+ zmw_get_wlan_dev(dev);
+
+ for (i=0; i<wd->sta.asocRspFrameBodySize; i++)
+ {
+ wd->sta.asocRspFrameBody[i] = zmw_rx_buf_readb(dev, buf, i+24);
+ }
+
+ /* HT capabilities: 28 octets */
+ if ( ((wd->sta.currentFrequency > 3000) && !(wd->supportMode & ZM_WIRELESS_MODE_5_N))
+ || ((wd->sta.currentFrequency < 3000) && !(wd->supportMode & ZM_WIRELESS_MODE_24_N)) )
+ {
+ /* not 11n AP */
+ htcap = (u8_t *)&wd->sta.ie.HtCap;
+ for (i=0; i<28; i++)
+ {
+ htcap[i] = 0;
+ }
+ wd->BandWidth40 = 0;
+ wd->ExtOffset = 0;
+ return;
+ }
+
+ if ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_HT_CAPABILITY)) != 0xffff)
+ {
+ /* atheros pre n */
+ zm_debug_msg0("atheros pre n");
+ htcap = (u8_t *)&wd->sta.ie.HtCap;
+ htcap[0] = zmw_rx_buf_readb(dev, buf, offset);
+ htcap[1] = 26;
+ for (i=1; i<=26; i++)
+ {
+ htcap[i+1] = zmw_rx_buf_readb(dev, buf, offset + i);
+ zm_msg2_mm(ZM_LV_1, "ASOC: HT Capabilities, htcap=", htcap[i+1]);
+ }
+ }
+ else if ((offset = zfFindElement(dev, buf, ZM_WLAN_PREN2_EID_HTCAPABILITY)) != 0xffff)
+ {
+ /* pre n 2.0 standard */
+ zm_debug_msg0("pre n 2.0 standard");
+ htcap = (u8_t *)&wd->sta.ie.HtCap;
+ for (i=0; i<28; i++)
+ {
+ htcap[i] = zmw_rx_buf_readb(dev, buf, offset + i);
+ zm_msg2_mm(ZM_LV_1, "ASOC: HT Capabilities, htcap=", htcap[i]);
+ }
+ }
+ else
+ {
+ /* not 11n AP */
+ htcap = (u8_t *)&wd->sta.ie.HtCap;
+ for (i=0; i<28; i++)
+ {
+ htcap[i] = 0;
+ }
+ wd->BandWidth40 = 0;
+ wd->ExtOffset = 0;
+ return;
+ }
+
+ asocBw40 = (u8_t)((wd->sta.ie.HtCap.HtCapInfo & HTCAP_SupChannelWidthSet) >> 1);
+
+ /* HT information */
+ if ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_EXTENDED_HT_CAPABILITY)) != 0xffff)
+ {
+ /* atheros pre n */
+ zm_debug_msg0("atheros pre n HTINFO");
+ length = 22;
+ htcap = (u8_t *)&wd->sta.ie.HtInfo;
+ htcap[0] = zmw_rx_buf_readb(dev, buf, offset);
+ htcap[1] = 22;
+ for (i=1; i<=22; i++)
+ {
+ htcap[i+1] = zmw_rx_buf_readb(dev, buf, offset + i);
+ zm_msg2_mm(ZM_LV_1, "ASOC: HT Info, htinfo=", htcap[i+1]);
+ }
+ }
+ else if ((offset = zfFindElement(dev, buf, ZM_WLAN_PREN2_EID_HTINFORMATION)) != 0xffff)
+ {
+ /* pre n 2.0 standard */
+ zm_debug_msg0("pre n 2.0 standard HTINFO");
+ length = zmw_rx_buf_readb(dev, buf, offset + 1);
+ htcap = (u8_t *)&wd->sta.ie.HtInfo;
+ for (i=0; i<24; i++)
+ {
+ htcap[i] = zmw_rx_buf_readb(dev, buf, offset + i);
+ zm_msg2_mm(ZM_LV_1, "ASOC: HT Info, htinfo=", htcap[i]);
+ }
+ }
+ else
+ {
+ zm_debug_msg0("no HTINFO");
+ htcap = (u8_t *)&wd->sta.ie.HtInfo;
+ for (i=0; i<24; i++)
+ {
+ htcap[i] = 0;
+ }
+ }
+ asocExtOffset = wd->sta.ie.HtInfo.ChannelInfo & ExtHtCap_ExtChannelOffsetBelow;
+
+ if ((wd->sta.EnableHT == 1) && (asocBw40 == 1) && ((asocExtOffset == 1) || (asocExtOffset == 3)))
+ {
+ wd->BandWidth40 = asocBw40;
+ wd->ExtOffset = asocExtOffset;
+ }
+ else
+ {
+ wd->BandWidth40 = 0;
+ wd->ExtOffset = 0;
+ }
+
+ return;
+}
+
+void zfStaProcessDeauth(zdev_t* dev, zbuf_t* buf)
+{
+ u16_t apMacAddr[3];
+
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ /* STA : if SA=connected AP then disconnect with AP */
+ if ( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ {
+ apMacAddr[0] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A3_OFFSET);
+ apMacAddr[1] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A3_OFFSET+2);
+ apMacAddr[2] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A3_OFFSET+4);
+ if ((apMacAddr[0] == wd->sta.bssid[0]) && (apMacAddr[1] == wd->sta.bssid[1]) && (apMacAddr[2] == wd->sta.bssid[2]))
+ {
+ if (zfwBufGetSize(dev, buf) >= 24+2) //not a malformed frame
+ {
+ if ( zfStaIsConnected(dev) )
+ {
+ zfStaConnectFail(dev, ZM_STATUS_MEDIA_DISCONNECT_DEAUTH, wd->sta.bssid, 2);
+ }
+ else if (zfStaIsConnecting(dev))
+ {
+ zfStaConnectFail(dev, ZM_STATUS_MEDIA_DISCONNECT_AUTH_FAILED, wd->sta.bssid, 3);
+ }
+ else
+ {
+ }
+ }
+ }
+ }
+ else if ( wd->wlanMode == ZM_MODE_IBSS )
+ {
+ u16_t peerMacAddr[3];
+ u8_t peerIdx;
+ s8_t res;
+
+ if ( zfStaIsConnected(dev) )
+ {
+ peerMacAddr[0] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A2_OFFSET);
+ peerMacAddr[1] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A2_OFFSET+2);
+ peerMacAddr[2] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A2_OFFSET+4);
+
+ zmw_enter_critical_section(dev);
+ res = zfStaFindOppositeByMACAddr(dev, peerMacAddr, &peerIdx);
+ if ( res == 0 )
+ {
+ wd->sta.oppositeInfo[peerIdx].aliveCounter = 0;
+ }
+ zmw_leave_critical_section(dev);
+ }
+ }
+}
+
+void zfStaProcessDisasoc(zdev_t* dev, zbuf_t* buf)
+{
+ u16_t apMacAddr[3];
+
+ zmw_get_wlan_dev(dev);
+
+ /* STA : if SA=connected AP then disconnect with AP */
+ if ( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ {
+ apMacAddr[0] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A3_OFFSET);
+ apMacAddr[1] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A3_OFFSET+2);
+ apMacAddr[2] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A3_OFFSET+4);
+
+ if ((apMacAddr[0] == wd->sta.bssid[0]) && (apMacAddr[1] == wd->sta.bssid[1]) && (apMacAddr[2] == wd->sta.bssid[2]))
+ {
+ if (zfwBufGetSize(dev, buf) >= 24+2) //not a malformed frame
+ {
+ if ( zfStaIsConnected(dev) )
+ {
+ zfStaConnectFail(dev, ZM_STATUS_MEDIA_DISCONNECT_DISASOC, wd->sta.bssid, 2);
+ }
+ else
+ {
+ zfStaConnectFail(dev, ZM_STATUS_MEDIA_DISCONNECT_ASOC_FAILED, wd->sta.bssid, 3);
+ }
+ }
+ }
+ }
+}
+
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfProcessProbeReq */
+/* Process probe request management frame. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : auth frame buffer */
+/* */
+/* OUTPUTS */
+/* none */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+void zfStaProcessProbeReq(zdev_t* dev, zbuf_t* buf, u16_t* src)
+{
+ u16_t offset;
+ u8_t len;
+ u16_t i, j;
+ u16_t sendFlag;
+
+ zmw_get_wlan_dev(dev);
+
+ /* check mode : AP/IBSS */
+ if ((wd->wlanMode != ZM_MODE_AP) || (wd->wlanMode != ZM_MODE_IBSS))
+ {
+ zm_msg0_mm(ZM_LV_3, "Ignore probe req");
+ return;
+ }
+
+ /* check SSID */
+ if ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_SSID)) == 0xffff)
+ {
+ zm_msg0_mm(ZM_LV_3, "probe req SSID not found");
+ return;
+ }
+
+ len = zmw_rx_buf_readb(dev, buf, offset+1);
+
+ for (i=0; i<ZM_MAX_AP_SUPPORT; i++)
+ {
+ if ((wd->ap.apBitmap & (i<<i)) != 0)
+ {
+ sendFlag = 0;
+ /* boardcast SSID */
+ if ((len == 0) && (wd->ap.hideSsid[i] == 0))
+ {
+ sendFlag = 1;
+ }
+ /* Not broadcast SSID */
+ else if (wd->ap.ssidLen[i] == len)
+ {
+ for (j=0; j<len; j++)
+ {
+ if (zmw_rx_buf_readb(dev, buf, offset+1+j)
+ != wd->ap.ssid[i][j])
+ {
+ break;
+ }
+ }
+ if (j == len)
+ {
+ sendFlag = 1;
+ }
+ }
+ if (sendFlag == 1)
+ {
+ /* Send probe response */
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_PROBERSP, src, i, 0, 0);
+ }
+ }
+ }
+}
+
+void zfStaProcessProbeRsp(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* AddInfo)
+{
+ /* return if not channel scan */
+ // Probe response is sent with unicast. Is this required?
+ // IBSS would send probe request and the code below would prevent
+ // the probe response from handling.
+ #if 0
+ zmw_get_wlan_dev(dev);
+
+ if ( !wd->sta.bChannelScan )
+ {
+ return;
+ }
+ #endif
+
+ zfProcessProbeRsp(dev, buf, AddInfo);
+}
+
+void zfIBSSSetupBssDesc(zdev_t *dev)
+{
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ u8_t i;
+#endif
+ struct zsBssInfo *pBssInfo;
+ u16_t offset = 0;
+
+ zmw_get_wlan_dev(dev);
+
+ pBssInfo = &wd->sta.ibssBssDesc;
+ zfZeroMemory((u8_t *)pBssInfo, sizeof(struct zsBssInfo));
+
+ pBssInfo->signalStrength = 100;
+
+ zfMemoryCopy((u8_t *)pBssInfo->macaddr, (u8_t *)wd->macAddr,6);
+ zfMemoryCopy((u8_t *)pBssInfo->bssid, (u8_t *)wd->sta.bssid, 6);
+
+ pBssInfo->beaconInterval[0] = (u8_t)(wd->beaconInterval) ;
+ pBssInfo->beaconInterval[1] = (u8_t)((wd->beaconInterval) >> 8) ;
+
+ pBssInfo->capability[0] = wd->sta.capability[0];
+ pBssInfo->capability[1] = wd->sta.capability[1];
+
+ pBssInfo->ssid[0] = ZM_WLAN_EID_SSID;
+ pBssInfo->ssid[1] = wd->sta.ssidLen;
+ zfMemoryCopy((u8_t *)&pBssInfo->ssid[2], (u8_t *)wd->sta.ssid, wd->sta.ssidLen);
+ zfMemoryCopy((u8_t *)&pBssInfo->frameBody[offset], (u8_t *)pBssInfo->ssid,
+ wd->sta.ssidLen + 2);
+ offset += wd->sta.ssidLen + 2;
+
+ /* support rate */
+
+ /* DS parameter set */
+ pBssInfo->channel = zfChFreqToNum(wd->frequency, NULL);
+ pBssInfo->frequency = wd->frequency;
+ pBssInfo->atimWindow = wd->sta.atimWindow;
+
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ if ( wd->sta.authMode == ZM_AUTH_MODE_WPA2PSK )
+ {
+ u8_t rsn[64]=
+ {
+ /* Element ID */
+ 0x30,
+ /* Length */
+ 0x14,
+ /* Version */
+ 0x01, 0x00,
+ /* Group Cipher Suite, default=TKIP */
+ 0x00, 0x0f, 0xac, 0x04,
+ /* Pairwise Cipher Suite Count */
+ 0x01, 0x00,
+ /* Pairwise Cipher Suite, default=TKIP */
+ 0x00, 0x0f, 0xac, 0x02,
+ /* Authentication and Key Management Suite Count */
+ 0x01, 0x00,
+ /* Authentication type, default=PSK */
+ 0x00, 0x0f, 0xac, 0x02,
+ /* RSN capability */
+ 0x00, 0x00
+ };
+
+ /* Overwrite Group Cipher Suite by AP's setting */
+ zfMemoryCopy(rsn+4, zgWpa2AesOui, 4);
+
+ if ( wd->sta.wepStatus == ZM_ENCRYPTION_AES )
+ {
+ /* Overwrite Pairwise Cipher Suite by AES */
+ zfMemoryCopy(rsn+10, zgWpa2AesOui, 4);
+ }
+
+ // RSN element id
+ pBssInfo->frameBody[offset++] = ZM_WLAN_EID_RSN_IE ;
+
+ // RSN length
+ pBssInfo->frameBody[offset++] = rsn[1] ;
+
+ // RSN information
+ for(i=0; i<rsn[1]; i++)
+ {
+ pBssInfo->frameBody[offset++] = rsn[i+2] ;
+ }
+
+ zfMemoryCopy(pBssInfo->rsnIe, rsn, rsn[1]+2);
+ }
+#endif
+}
+
+void zfIbssConnectNetwork(zdev_t* dev)
+{
+ struct zsBssInfo* pBssInfo;
+ struct zsBssInfo tmpBssInfo;
+ u8_t macAddr[6], bssid[6], bssNotFound = TRUE;
+ u16_t i, j=100;
+ u16_t k;
+ struct zsPartnerNotifyEvent event;
+ u32_t channelFlags;
+ u16_t oppositeWepStatus;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ /* change state to CONNECTING and stop the channel scanning */
+ zfChangeAdapterState(dev, ZM_STA_STATE_CONNECTING);
+ zfPowerSavingMgrWakeup(dev);
+
+ /* Set TxQs CWMIN, CWMAX, AIFS and TXO to WME STA default. */
+ zfUpdateDefaultQosParameter(dev, 0);
+
+ wd->sta.bProtectionMode = FALSE;
+ zfHpSetSlotTime(dev, 1);
+
+ /* ESS bit off */
+ wd->sta.capability[0] &= ~ZM_BIT_0;
+ /* IBSS bit on */
+ wd->sta.capability[0] |= ZM_BIT_1;
+ /* not not use short slot time */
+ wd->sta.capability[1] &= ~ZM_BIT_2;
+
+ wd->sta.wmeConnected = 0;
+ wd->sta.psMgr.tempWakeUp = 0;
+ wd->sta.qosInfo = 0;
+ wd->sta.EnableHT = 0;
+ wd->BandWidth40 = 0;
+ wd->ExtOffset = 0;
+
+ if ( wd->sta.bssList.bssCount )
+ {
+ //Reorder BssList by RSSI--CWYang(+)
+ zfBssInfoReorderList(dev);
+
+ zmw_enter_critical_section(dev);
+
+ pBssInfo = wd->sta.bssList.head;
+
+ for(i=0; i<wd->sta.bssList.bssCount; i++)
+ {
+ // 20070806 #1 Privacy bit
+ if ( pBssInfo->capability[0] & ZM_BIT_4 )
+ { // Privacy Ibss network
+// zm_debug_msg0("Privacy bit on");
+ oppositeWepStatus = ZM_ENCRYPTION_WEP_ENABLED;
+
+ if ( pBssInfo->rsnIe[1] != 0 )
+ {
+ if ( (pBssInfo->rsnIe[7] == 0x01) || (pBssInfo->rsnIe[7] == 0x05) )
+ { // WEP-40 & WEP-104
+// zm_debug_msg0("WEP40 or WEP104");
+ oppositeWepStatus = ZM_ENCRYPTION_WEP_ENABLED;
+ }
+ else if ( pBssInfo->rsnIe[7] == 0x02 )
+ { // TKIP
+// zm_debug_msg0("TKIP");
+ oppositeWepStatus = ZM_ENCRYPTION_TKIP;
+ }
+ else if ( pBssInfo->rsnIe[7] == 0x04 )
+ { // AES
+// zm_debug_msg0("CCMP-AES");
+ oppositeWepStatus = ZM_ENCRYPTION_AES;
+ }
+ }
+ }
+ else
+ {
+// zm_debug_msg0("Privacy bit off");
+ oppositeWepStatus = ZM_ENCRYPTION_WEP_DISABLED;
+ }
+
+ if ( (zfMemoryIsEqual(&(pBssInfo->ssid[2]), wd->sta.ssid,
+ wd->sta.ssidLen))&&
+ (wd->sta.ssidLen == pBssInfo->ssid[1])&&
+ (oppositeWepStatus == wd->sta.wepStatus) )
+ {
+ /* Check support mode */
+ if (pBssInfo->frequency > 3000) {
+ if ( (pBssInfo->EnableHT == 1)
+ || (pBssInfo->apCap & ZM_All11N_AP) ) //11n AP
+ {
+ channelFlags = CHANNEL_A_HT;
+ if (pBssInfo->enableHT40 == 1) {
+ channelFlags |= CHANNEL_HT40;
+ }
+ } else {
+ channelFlags = CHANNEL_A;
+ }
+ } else {
+ if ( (pBssInfo->EnableHT == 1)
+ || (pBssInfo->apCap & ZM_All11N_AP) ) //11n AP
+ {
+ channelFlags = CHANNEL_G_HT;
+ if(pBssInfo->enableHT40 == 1) {
+ channelFlags |= CHANNEL_HT40;
+ }
+ } else {
+ if (pBssInfo->extSupportedRates[1] == 0) {
+ channelFlags = CHANNEL_B;
+ } else {
+ channelFlags = CHANNEL_G;
+ }
+ }
+ }
+
+ if ( ((channelFlags == CHANNEL_B) && (wd->connectMode & ZM_BIT_0))
+ || ((channelFlags == CHANNEL_G) && (wd->connectMode & ZM_BIT_1))
+ || ((channelFlags == CHANNEL_A) && (wd->connectMode & ZM_BIT_2))
+ || ((channelFlags & CHANNEL_HT20) && (wd->connectMode & ZM_BIT_3)) )
+ {
+ pBssInfo = pBssInfo->next;
+ continue;
+ }
+
+ /* Bypass DFS channel */
+ if (zfHpIsDfsChannelNCS(dev, pBssInfo->frequency))
+ {
+ zm_debug_msg0("Bypass DFS channel");
+ continue;
+ }
+
+ /* check IBSS bit */
+ if ( pBssInfo->capability[0] & ZM_BIT_1 )
+ {
+ /* may check timestamp here */
+ j = i;
+ break;
+ }
+ }
+
+ pBssInfo = pBssInfo->next;
+ }
+
+ if ((j < wd->sta.bssList.bssCount) && (pBssInfo != NULL))
+ {
+ zfwMemoryCopy((u8_t*)&tmpBssInfo, (u8_t*)(pBssInfo), sizeof(struct zsBssInfo));
+ pBssInfo = &tmpBssInfo;
+ }
+ else
+ {
+ pBssInfo = NULL;
+ }
+
+ zmw_leave_critical_section(dev);
+
+ //if ( j < wd->sta.bssList.bssCount )
+ if (pBssInfo != NULL)
+ {
+ int res;
+
+ zm_debug_msg0("IBSS found");
+
+ /* Found IBSS, reset bssNotFoundCount */
+ zmw_enter_critical_section(dev);
+ wd->sta.bssNotFoundCount = 0;
+ zmw_leave_critical_section(dev);
+
+ bssNotFound = FALSE;
+ wd->sta.atimWindow = pBssInfo->atimWindow;
+ wd->frequency = pBssInfo->frequency;
+ //wd->sta.flagFreqChanging = 1;
+ zfCoreSetFrequency(dev, wd->frequency);
+ zfUpdateBssid(dev, pBssInfo->bssid);
+ zfResetSupportRate(dev, ZM_DEFAULT_SUPPORT_RATE_ZERO);
+ zfUpdateSupportRate(dev, pBssInfo->supportedRates);
+ zfUpdateSupportRate(dev, pBssInfo->extSupportedRates);
+ wd->beaconInterval = pBssInfo->beaconInterval[0] +
+ (((u16_t) pBssInfo->beaconInterval[1]) << 8);
+
+ if (wd->beaconInterval == 0)
+ {
+ wd->beaconInterval = 100;
+ }
+
+ /* rsn information element */
+ if ( pBssInfo->rsnIe[1] != 0 )
+ {
+ zfMemoryCopy(wd->sta.rsnIe, pBssInfo->rsnIe,
+ pBssInfo->rsnIe[1]+2);
+
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ /* If not use RSNA , run traditional */
+ zmw_enter_critical_section(dev);
+ wd->sta.ibssWpa2Psk = 1;
+ zmw_leave_critical_section(dev);
+#endif
+ }
+ else
+ {
+ wd->sta.rsnIe[1] = 0;
+ }
+
+ /* privacy bit */
+ if ( pBssInfo->capability[0] & ZM_BIT_4 )
+ {
+ wd->sta.capability[0] |= ZM_BIT_4;
+ }
+ else
+ {
+ wd->sta.capability[0] &= ~ZM_BIT_4;
+ }
+
+ /* preamble type */
+ wd->preambleTypeInUsed = wd->preambleType;
+ if ( wd->preambleTypeInUsed == ZM_PREAMBLE_TYPE_AUTO )
+ {
+ if (pBssInfo->capability[0] & ZM_BIT_5)
+ {
+ wd->preambleTypeInUsed = ZM_PREAMBLE_TYPE_SHORT;
+ }
+ else
+ {
+ wd->preambleTypeInUsed = ZM_PREAMBLE_TYPE_LONG;
+ }
+ }
+
+ if (wd->preambleTypeInUsed == ZM_PREAMBLE_TYPE_LONG)
+ {
+ wd->sta.capability[0] &= ~ZM_BIT_5;
+ }
+ else
+ {
+ wd->sta.capability[0] |= ZM_BIT_5;
+ }
+
+ wd->sta.beaconFrameBodySize = pBssInfo->frameBodysize + 12;
+
+ if (wd->sta.beaconFrameBodySize > ZM_CACHED_FRAMEBODY_SIZE)
+ {
+ wd->sta.beaconFrameBodySize = ZM_CACHED_FRAMEBODY_SIZE;
+ }
+
+ for (k=0; k<8; k++)
+ {
+ wd->sta.beaconFrameBody[k] = pBssInfo->timeStamp[k];
+ }
+ wd->sta.beaconFrameBody[8] = pBssInfo->beaconInterval[0];
+ wd->sta.beaconFrameBody[9] = pBssInfo->beaconInterval[1];
+ wd->sta.beaconFrameBody[10] = pBssInfo->capability[0];
+ wd->sta.beaconFrameBody[11] = pBssInfo->capability[1];
+ //for (k=12; k<wd->sta.beaconFrameBodySize; k++)
+ for (k=0; k<pBssInfo->frameBodysize; k++)
+ {
+ wd->sta.beaconFrameBody[k+12] = pBssInfo->frameBody[k];
+ }
+
+ zmw_enter_critical_section(dev);
+ res = zfStaSetOppositeInfoFromBSSInfo(dev, pBssInfo);
+ if ( res == 0 )
+ {
+ zfMemoryCopy(event.bssid, (u8_t *)(pBssInfo->bssid), 6);
+ zfMemoryCopy(event.peerMacAddr, (u8_t *)(pBssInfo->macaddr), 6);
+ }
+ zmw_leave_critical_section(dev);
+
+ //zfwIbssPartnerNotify(dev, 1, &event);
+ goto connect_done;
+ }
+ }
+
+ /* IBSS not found */
+ if ( bssNotFound )
+ {
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ u16_t offset ;
+#endif
+ if ( wd->sta.ibssJoinOnly )
+ {
+ zm_debug_msg0("IBSS join only...retry...");
+ goto retry_ibss;
+ }
+
+ if(wd->sta.bssNotFoundCount<2)
+ {
+ zmw_enter_critical_section(dev);
+ zm_debug_msg1("IBSS not found, do sitesurvey!! bssNotFoundCount=", wd->sta.bssNotFoundCount);
+ wd->sta.bssNotFoundCount++;
+ zmw_leave_critical_section(dev);
+ goto retry_ibss;
+ }
+ else
+ {
+ zmw_enter_critical_section(dev);
+ /* Fail IBSS found, TODO create IBSS */
+ wd->sta.bssNotFoundCount = 0;
+ zmw_leave_critical_section(dev);
+ }
+
+
+ if (zfHpIsDfsChannel(dev, wd->frequency))
+ {
+ wd->frequency = zfHpFindFirstNonDfsChannel(dev, wd->frequency > 3000);
+ }
+
+ if( wd->ws.autoSetFrequency == 0 )
+ { /* Auto set frequency */
+ zm_debug_msg1("Create Ad Hoc Network Band ", wd->ws.adhocMode);
+ wd->frequency = zfFindCleanFrequency(dev, wd->ws.adhocMode);
+ wd->ws.autoSetFrequency = 0xff;
+ }
+ zm_debug_msg1("IBSS not found, created one in channel ", wd->frequency);
+
+ wd->sta.ibssBssIsCreator = 1;
+
+ //wd->sta.flagFreqChanging = 1;
+ zfCoreSetFrequency(dev, wd->frequency);
+ if (wd->sta.bDesiredBssid == TRUE)
+ {
+ for (k=0; k<6; k++)
+ {
+ bssid[k] = wd->sta.desiredBssid[k];
+ }
+ }
+ else
+ {
+ #if 1
+ macAddr[0] = (wd->macAddr[0] & 0xff);
+ macAddr[1] = (wd->macAddr[0] >> 8);
+ macAddr[2] = (wd->macAddr[1] & 0xff);
+ macAddr[3] = (wd->macAddr[1] >> 8);
+ macAddr[4] = (wd->macAddr[2] & 0xff);
+ macAddr[5] = (wd->macAddr[2] >> 8);
+ zfGenerateRandomBSSID(dev, (u8_t *)wd->macAddr, (u8_t *)bssid);
+ #else
+ for (k=0; k<6; k++)
+ {
+ bssid[k] = (u8_t) zfGetRandomNumber(dev, 0);
+ }
+ bssid[0] &= ~ZM_BIT_0;
+ bssid[0] |= ZM_BIT_1;
+ #endif
+ }
+
+ zfUpdateBssid(dev, bssid);
+ //wd->sta.atimWindow = 0x0a;
+
+ /* rate information */
+ if(wd->frequency <= ZM_CH_G_14) // 2.4 GHz b+g
+ {
+ if ( wd->wfc.bIbssGMode
+ && (wd->supportMode & (ZM_WIRELESS_MODE_24_54|ZM_WIRELESS_MODE_24_N)) )
+ {
+ zfResetSupportRate(dev, ZM_DEFAULT_SUPPORT_RATE_IBSS_AG);
+ }
+ else
+ {
+ zfResetSupportRate(dev, ZM_DEFAULT_SUPPORT_RATE_IBSS_B);
+ }
+ } else {
+ zfResetSupportRate(dev, ZM_DEFAULT_SUPPORT_RATE_IBSS_AG);
+ }
+
+ if ( wd->sta.wepStatus == ZM_ENCRYPTION_WEP_DISABLED )
+ {
+ wd->sta.capability[0] &= ~ZM_BIT_4;
+ }
+ else
+ {
+ wd->sta.capability[0] |= ZM_BIT_4;
+ }
+
+ wd->preambleTypeInUsed = wd->preambleType;
+ if (wd->preambleTypeInUsed == ZM_PREAMBLE_TYPE_LONG)
+ {
+ wd->sta.capability[0] &= ~ZM_BIT_5;
+ }
+ else
+ {
+ wd->preambleTypeInUsed = ZM_PREAMBLE_TYPE_SHORT;
+ wd->sta.capability[0] |= ZM_BIT_5;
+ }
+
+ zfIBSSSetupBssDesc(dev);
+
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+
+ // 20070411 Add WPA2PSK information to its IBSS network !!!
+ offset = 0 ;
+
+ /* timestamp */
+ offset += 8 ;
+
+ /* beacon interval */
+ wd->sta.beaconFrameBody[offset++] = (u8_t)(wd->beaconInterval) ;
+ wd->sta.beaconFrameBody[offset++] = (u8_t)((wd->beaconInterval) >> 8) ;
+
+ /* capability information */
+ wd->sta.beaconFrameBody[offset++] = wd->sta.capability[0] ;
+ wd->sta.beaconFrameBody[offset++] = wd->sta.capability[1] ;
+ #if 0
+ /* ssid */
+ // ssid element id
+ wd->sta.beaconFrameBody[offset++] = ZM_WLAN_EID_SSID ;
+ // ssid length
+ wd->sta.beaconFrameBody[offset++] = wd->sta.ssidLen ;
+ // ssid information
+ for(i=0; i<wd->sta.ssidLen; i++)
+ {
+ wd->sta.beaconFrameBody[offset++] = wd->sta.ssid[i] ;
+ }
+
+ /* support rate */
+ rateSet = ZM_RATE_SET_CCK ;
+ if ( (rateSet == ZM_RATE_SET_OFDM)&&((wd->gRate & 0xff) == 0) )
+ {
+ offset += 0 ;
+ }
+ else
+ {
+ // support rate element id
+ wd->sta.beaconFrameBody[offset++] = ZM_WLAN_EID_SUPPORT_RATE ;
+
+ // support rate length
+ lenOffset = offset++;
+
+ // support rate information
+ for (i=0; i<4; i++)
+ {
+ if ((wd->bRate & (0x1<<i)) == (0x1<<i))
+ {
+ wd->sta.beaconFrameBody[offset++] =
+ zg11bRateTbl[i]+((wd->bRateBasic & (0x1<<i))<<(7-i)) ;
+ len++;
+ }
+ }
+
+ // support rate length
+ wd->sta.beaconFrameBody[lenOffset] = len ;
+ }
+
+ /* DS parameter set */
+ // DS parameter set elemet id
+ wd->sta.beaconFrameBody[offset++] = ZM_WLAN_EID_DS ;
+
+ // DS parameter set length
+ wd->sta.beaconFrameBody[offset++] = 1 ;
+
+ // DS parameter set information
+ wd->sta.beaconFrameBody[offset++] =
+ zfChFreqToNum(wd->frequency, NULL) ;
+
+ /* IBSS parameter set */
+ // IBSS parameter set element id
+ wd->sta.beaconFrameBody[offset++] = ZM_WLAN_EID_IBSS ;
+
+ // IBSS parameter set length
+ wd->sta.beaconFrameBody[offset++] = 2 ;
+
+ // IBSS parameter set information
+ wd->sta.beaconFrameBody[offset] = wd->sta.atimWindow ;
+ offset += 2 ;
+
+ /* ERP Information and Extended Supported Rates */
+ if ( wd->wfc.bIbssGMode
+ && (wd->supportMode & (ZM_WIRELESS_MODE_24_54|ZM_WIRELESS_MODE_24_N)) )
+ {
+ /* ERP Information */
+ wd->erpElement = 0;
+ // ERP element id
+ wd->sta.beaconFrameBody[offset++] = ZM_WLAN_EID_ERP ;
+
+ // ERP length
+ wd->sta.beaconFrameBody[offset++] = 1 ;
+
+ // ERP information
+ wd->sta.beaconFrameBody[offset++] = wd->erpElement ;
+
+ /* Extended Supported Rates */
+ if ( (rateSet == ZM_RATE_SET_OFDM)&&((wd->gRate & 0xff) == 0) )
+ {
+ offset += 0 ;
+ }
+ else
+ {
+ len = 0 ;
+
+ // Extended Supported Rates element id
+ wd->sta.beaconFrameBody[offset++] = ZM_WLAN_EID_EXTENDED_RATE ;
+
+ // Extended Supported Rates length
+ lenOffset = offset++ ;
+
+ // Extended Supported Rates information
+ for (i=0; i<8; i++)
+ {
+ if ((wd->gRate & (0x1<<i)) == (0x1<<i))
+ {
+ wd->sta.beaconFrameBody[offset++] =
+ zg11gRateTbl[i]+((wd->gRateBasic & (0x1<<i))<<(7-i));
+ len++;
+ }
+ }
+
+ // extended support rate length
+ wd->sta.beaconFrameBody[lenOffset] = len ;
+ }
+ }
+ #endif
+
+ /* RSN : important information influence the result of creating an IBSS network */
+ if ( wd->sta.authMode == ZM_AUTH_MODE_WPA2PSK )
+ {
+ u8_t frameType = ZM_WLAN_FRAME_TYPE_AUTH ;
+ u8_t rsn[64]=
+ {
+ /* Element ID */
+ 0x30,
+ /* Length */
+ 0x14,
+ /* Version */
+ 0x01, 0x00,
+ /* Group Cipher Suite, default=TKIP */
+ 0x00, 0x0f, 0xac, 0x04,
+ /* Pairwise Cipher Suite Count */
+ 0x01, 0x00,
+ /* Pairwise Cipher Suite, default=TKIP */
+ 0x00, 0x0f, 0xac, 0x02,
+ /* Authentication and Key Management Suite Count */
+ 0x01, 0x00,
+ /* Authentication type, default=PSK */
+ 0x00, 0x0f, 0xac, 0x02,
+ /* RSN capability */
+ 0x00, 0x00
+ };
+
+ /* Overwrite Group Cipher Suite by AP's setting */
+ zfMemoryCopy(rsn+4, zgWpa2AesOui, 4);
+
+ if ( wd->sta.wepStatus == ZM_ENCRYPTION_AES )
+ {
+ /* Overwrite Pairwise Cipher Suite by AES */
+ zfMemoryCopy(rsn+10, zgWpa2AesOui, 4);
+ }
+
+ // RSN element id
+ wd->sta.beaconFrameBody[offset++] = ZM_WLAN_EID_RSN_IE ;
+
+ // RSN length
+ wd->sta.beaconFrameBody[offset++] = rsn[1] ;
+
+ // RSN information
+ for(i=0; i<rsn[1]; i++)
+ wd->sta.beaconFrameBody[offset++] = rsn[i+2] ;
+
+ zfMemoryCopy(wd->sta.rsnIe, rsn, rsn[1]+2);
+
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ /* If not use RSNA , run traditional */
+ zmw_enter_critical_section(dev);
+ wd->sta.ibssWpa2Psk = 1;
+ zmw_leave_critical_section(dev);
+#endif
+ }
+
+ #if 0
+ /* HT Capabilities Info */
+ {
+ u8_t OUI[3] = { 0x0 , 0x90 , 0x4C } ;
+
+ wd->sta.beaconFrameBody[offset++] = ZM_WLAN_EID_WPA_IE ;
+
+ wd->sta.beaconFrameBody[offset++] = wd->sta.HTCap.Data.Length + 4 ;
+
+ for (i = 0; i < 3; i++)
+ {
+ wd->sta.beaconFrameBody[offset++] = OUI[i] ;
+ }
+
+ wd->sta.beaconFrameBody[offset++] = wd->sta.HTCap.Data.ElementID ;
+
+ for (i = 0; i < 26; i++)
+ {
+ wd->sta.beaconFrameBody[offset++] = wd->sta.HTCap.Byte[i+2] ;
+ }
+ }
+
+ /* Extended HT Capabilities Info */
+ {
+ u8_t OUI[3] = { 0x0 , 0x90 , 0x4C } ;
+
+ wd->sta.beaconFrameBody[offset++] = ZM_WLAN_EID_WPA_IE ;
+
+ wd->sta.beaconFrameBody[offset++] = wd->sta.ExtHTCap.Data.Length + 4 ;
+
+ for (i = 0; i < 3; i++)
+ {
+ wd->sta.beaconFrameBody[offset++] = OUI[i] ;
+ }
+
+ wd->sta.beaconFrameBody[offset++] = wd->sta.ExtHTCap.Data.ElementID ;
+
+ for (i = 0; i < 22; i++)
+ {
+ wd->sta.beaconFrameBody[offset++] = wd->sta.ExtHTCap.Byte[i+2] ;
+ }
+ }
+ #endif
+
+ wd->sta.beaconFrameBodySize = offset ;
+
+ if (wd->sta.beaconFrameBodySize > ZM_CACHED_FRAMEBODY_SIZE)
+ {
+ wd->sta.beaconFrameBodySize = ZM_CACHED_FRAMEBODY_SIZE;
+ }
+
+ // 20070416 Let Create IBSS network could enter the zfwIbssPartnerNotify function
+ // bssNotFound = FALSE ;
+
+ printk("The capability info 1 = %02x\n", wd->sta.capability[0]) ;
+ printk("The capability info 2 = %02x\n", wd->sta.capability[1]) ;
+ for(k=0; k<wd->sta.beaconFrameBodySize; k++)
+ {
+ printk("%02x ", wd->sta.beaconFrameBody[k]) ;
+ }
+ #if 0
+ zmw_enter_critical_section(dev);
+ zfMemoryCopy(event.bssid, (u8_t *)bssid, 6);
+ zfMemoryCopy(event.peerMacAddr, (u8_t *)wd->macAddr, 6);
+ zmw_leave_critical_section(dev);
+ #endif
+#endif
+
+ //zmw_enter_critical_section(dev);
+ //wd->sta.ibssPartnerStatus = ZM_IBSS_PARTNER_LOST;
+ //zmw_leave_critical_section(dev);
+ }
+ else
+ {
+ wd->sta.ibssBssIsCreator = 0;
+ }
+
+connect_done:
+ zfHpEnableBeacon(dev, ZM_MODE_IBSS, wd->beaconInterval, wd->dtim, (u8_t)wd->sta.atimWindow);
+ zfStaSendBeacon(dev); // Refresh Beacon content for ZD1211B HalPlus
+ zfHpSetAtimWindow(dev, wd->sta.atimWindow);
+
+ // Start the IBSS timer to monitor for new stations
+ zmw_enter_critical_section(dev);
+ zfTimerSchedule(dev, ZM_EVENT_IBSS_MONITOR, ZM_TICK_IBSS_MONITOR);
+ zmw_leave_critical_section(dev);
+
+
+ if (wd->zfcbConnectNotify != NULL)
+ {
+ wd->zfcbConnectNotify(dev, ZM_STATUS_MEDIA_CONNECT, wd->sta.bssid);
+ }
+ zfChangeAdapterState(dev, ZM_STA_STATE_CONNECTED);
+ wd->sta.connPowerInHalfDbm = zfHpGetTransmitPower(dev);
+
+#ifdef ZM_ENABLE_IBSS_DELAYED_JOIN_INDICATION
+ if ( !bssNotFound )
+ {
+ wd->sta.ibssDelayedInd = 1;
+ zfMemoryCopy((u8_t *)&wd->sta.ibssDelayedIndEvent, (u8_t *)&event, sizeof(struct zsPartnerNotifyEvent));
+ }
+#else
+ if ( !bssNotFound )
+ {
+ if (wd->zfcbIbssPartnerNotify != NULL)
+ {
+ wd->zfcbIbssPartnerNotify(dev, 1, &event);
+ }
+ }
+#endif
+
+ return;
+
+retry_ibss:
+ zfChangeAdapterState(dev, ZM_STA_STATE_CONNECTING);
+ zfStaConnectFail(dev, ZM_STATUS_MEDIA_DISCONNECT_NOT_FOUND, wd->sta.bssid, 0);
+ return;
+}
+
+void zfStaProcessAtim(zdev_t* dev, zbuf_t* buf)
+{
+ zmw_get_wlan_dev(dev);
+
+ zm_debug_msg0("Receiving Atim window notification");
+
+ wd->sta.recvAtim = 1;
+}
+
+static struct zsBssInfo* zfInfraFindAPToConnect(zdev_t* dev,
+ struct zsBssInfo* candidateBss)
+{
+ struct zsBssInfo* pBssInfo;
+ struct zsBssInfo* pNowBssInfo=NULL;
+ u16_t i;
+ u16_t ret, apWepStatus;
+ u32_t k;
+ u32_t channelFlags;
+
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ pBssInfo = wd->sta.bssList.head;
+
+ for(i=0; i<wd->sta.bssList.bssCount; i++)
+ {
+ if ( pBssInfo->capability[0] & ZM_BIT_4 )
+ {
+ apWepStatus = ZM_ENCRYPTION_WEP_ENABLED;
+ }
+ else
+ {
+ apWepStatus = ZM_ENCRYPTION_WEP_DISABLED;
+ }
+
+ if ( ((zfMemoryIsEqual(&(pBssInfo->ssid[2]), wd->sta.ssid,
+ wd->sta.ssidLen))&&
+ (wd->sta.ssidLen == pBssInfo->ssid[1]))||
+ ((wd->sta.ssidLen == 0)&&
+ /* connect to any BSS: AP's ans STA's WEP status must match */
+ (wd->sta.wepStatus == apWepStatus )&&
+ (pBssInfo->securityType != ZM_SECURITY_TYPE_WPA) ))
+ {
+ if ( wd->sta.ssidLen == 0 )
+ {
+ zm_debug_msg0("ANY BSS found");
+ }
+
+ if ( ((wd->sta.wepStatus == ZM_ENCRYPTION_WEP_DISABLED && apWepStatus == ZM_ENCRYPTION_WEP_ENABLED) ||
+ (wd->sta.wepStatus == ZM_ENCRYPTION_WEP_ENABLED &&
+ (apWepStatus == ZM_ENCRYPTION_WEP_DISABLED && wd->sta.dropUnencryptedPkts == 1))) &&
+ (wd->sta.authMode >= ZM_AUTH_MODE_OPEN && wd->sta.authMode <= ZM_AUTH_MODE_AUTO) )
+ {
+ zm_debug_msg0("Privacy policy is inconsistent");
+ pBssInfo = pBssInfo->next;
+ continue;
+ }
+
+ /* for WPA negative test */
+ if ( !zfCheckAuthentication(dev, pBssInfo) )
+ {
+ pBssInfo = pBssInfo->next;
+ continue;
+ }
+
+ /* Check bssid */
+ if (wd->sta.bDesiredBssid == TRUE)
+ {
+ for (k=0; k<6; k++)
+ {
+ if (wd->sta.desiredBssid[k] != pBssInfo->bssid[k])
+ {
+ zm_msg0_mm(ZM_LV_1, "desired bssid not matched 1");
+ break;
+ }
+ }
+
+ if (k != 6)
+ {
+ zm_msg0_mm(ZM_LV_1, "desired bssid not matched 2");
+ pBssInfo = pBssInfo->next;
+ continue;
+ }
+ }
+
+ /* Check support mode */
+ if (pBssInfo->frequency > 3000) {
+ if ( (pBssInfo->EnableHT == 1)
+ || (pBssInfo->apCap & ZM_All11N_AP) ) //11n AP
+ {
+ channelFlags = CHANNEL_A_HT;
+ if (pBssInfo->enableHT40 == 1) {
+ channelFlags |= CHANNEL_HT40;
+ }
+ } else {
+ channelFlags = CHANNEL_A;
+ }
+ } else {
+ if ( (pBssInfo->EnableHT == 1)
+ || (pBssInfo->apCap & ZM_All11N_AP) ) //11n AP
+ {
+ channelFlags = CHANNEL_G_HT;
+ if(pBssInfo->enableHT40 == 1) {
+ channelFlags |= CHANNEL_HT40;
+ }
+ } else {
+ if (pBssInfo->extSupportedRates[1] == 0) {
+ channelFlags = CHANNEL_B;
+ } else {
+ channelFlags = CHANNEL_G;
+ }
+ }
+ }
+
+ if ( ((channelFlags == CHANNEL_B) && (wd->connectMode & ZM_BIT_0))
+ || ((channelFlags == CHANNEL_G) && (wd->connectMode & ZM_BIT_1))
+ || ((channelFlags == CHANNEL_A) && (wd->connectMode & ZM_BIT_2))
+ || ((channelFlags & CHANNEL_HT20) && (wd->connectMode & ZM_BIT_3)) )
+ {
+ pBssInfo = pBssInfo->next;
+ continue;
+ }
+
+ /* Skip if AP in blocking list */
+ if ((ret = zfStaIsApInBlockingList(dev, pBssInfo->bssid)) == TRUE)
+ {
+ zm_msg0_mm(ZM_LV_0, "Candidate AP in blocking List, skip if there's stilla choice!");
+ pNowBssInfo = pBssInfo;
+ pBssInfo = pBssInfo->next;
+ continue;
+ }
+
+ if ( pBssInfo->capability[0] & ZM_BIT_0 ) // check if infra-BSS
+ {
+ pNowBssInfo = pBssInfo;
+ wd->sta.apWmeCapability = pBssInfo->wmeSupport;
+
+
+ goto done;
+ }
+ }
+
+ pBssInfo = pBssInfo->next;
+ }
+
+done:
+ if (pNowBssInfo != NULL)
+ {
+ zfwMemoryCopy((void*)candidateBss, (void*)pNowBssInfo, sizeof(struct zsBssInfo));
+ pNowBssInfo = candidateBss;
+ }
+
+ zmw_leave_critical_section(dev);
+
+ return pNowBssInfo;
+}
+
+
+void zfInfraConnectNetwork(zdev_t* dev)
+{
+ struct zsBssInfo* pBssInfo;
+ struct zsBssInfo* pNowBssInfo=NULL;
+ struct zsBssInfo candidateBss;
+ //u16_t i, j=100, quality=10000;
+ //u8_t ret=FALSE, apWepStatus;
+ u8_t ret=FALSE;
+ u16_t k;
+ u8_t density = ZM_MPDU_DENSITY_NONE;
+
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ /* Reset bssNotFoundCount for Ad-Hoc:IBSS */
+ /* Need review : IbssConn -> InfraConn -> IbssConn etc, flag/counter reset? */
+ zmw_enter_critical_section(dev);
+ wd->sta.bssNotFoundCount = 0;
+ zmw_leave_critical_section(dev);
+
+ /* Set TxQs CWMIN, CWMAX, AIFS and TXO to WME STA default. */
+ zfUpdateDefaultQosParameter(dev, 0);
+
+ zfStaRefreshBlockList(dev, 0);
+
+ /* change state to CONNECTING and stop the channel scanning */
+ zfChangeAdapterState(dev, ZM_STA_STATE_CONNECTING);
+ zfPowerSavingMgrWakeup(dev);
+
+ wd->sta.wmeConnected = 0;
+ wd->sta.psMgr.tempWakeUp = 0;
+ wd->sta.qosInfo = 0;
+ zfQueueFlush(dev, wd->sta.uapsdQ);
+
+ wd->sta.connectState = ZM_STA_CONN_STATE_NONE;
+
+ //Reorder BssList by RSSI--CWYang(+)
+ zfBssInfoReorderList(dev);
+
+ pNowBssInfo = zfInfraFindAPToConnect(dev, &candidateBss);
+
+ if (wd->sta.SWEncryptEnable != 0)
+ {
+ if (wd->sta.bSafeMode == 0)
+ {
+ zfStaDisableSWEncryption(dev);//Quickly reboot
+ }
+ }
+ if ( pNowBssInfo != NULL )
+ {
+ //zm_assert(pNowBssInfo != NULL);
+
+ pBssInfo = pNowBssInfo;
+ wd->sta.ssidLen = pBssInfo->ssid[1];
+ zfMemoryCopy(wd->sta.ssid, &(pBssInfo->ssid[2]), pBssInfo->ssid[1]);
+ wd->frequency = pBssInfo->frequency;
+ //wd->sta.flagFreqChanging = 1;
+
+ //zfCoreSetFrequency(dev, wd->frequency);
+ zfUpdateBssid(dev, pBssInfo->bssid);
+ zfResetSupportRate(dev, ZM_DEFAULT_SUPPORT_RATE_ZERO);
+ zfUpdateSupportRate(dev, pBssInfo->supportedRates);
+ zfUpdateSupportRate(dev, pBssInfo->extSupportedRates);
+
+ wd->beaconInterval = pBssInfo->beaconInterval[0] +
+ (((u16_t) pBssInfo->beaconInterval[1]) << 8);
+ if (wd->beaconInterval == 0)
+ {
+ wd->beaconInterval = 100;
+ }
+
+ /* ESS bit on */
+ wd->sta.capability[0] |= ZM_BIT_0;
+ /* IBSS bit off */
+ wd->sta.capability[0] &= ~ZM_BIT_1;
+
+ /* 11n AP flag */
+ wd->sta.EnableHT = pBssInfo->EnableHT;
+ wd->sta.SG40 = pBssInfo->SG40;
+#ifdef ZM_ENABLE_CENC
+ if ( pBssInfo->securityType == ZM_SECURITY_TYPE_CENC )
+ {
+ wd->sta.wmeEnabled = 0; //Disable WMM in CENC
+ cencInit(dev);
+ cencSetCENCMode(dev, NdisCENC_PSK);
+ wd->sta.wpaState = ZM_STA_WPA_STATE_INIT;
+ /* CENC */
+ if ( pBssInfo->cencIe[1] != 0 )
+ {
+ //wd->sta.wepStatus = ZM_ENCRYPTION_CENC;
+ //wd->sta.encryMode = ZM_CENC;
+ zfwCencHandleBeaconProbrespon(dev, (u8_t *)&pBssInfo->cencIe,
+ (u8_t *)&pBssInfo->ssid, (u8_t *)&pBssInfo->macaddr);
+ zfMemoryCopy(wd->sta.cencIe, pBssInfo->cencIe,
+ pBssInfo->cencIe[1]+2);
+ }
+ else
+ {
+ wd->sta.cencIe[1] = 0;
+ }
+ }
+#endif //ZM_ENABLE_CENC
+ if ( pBssInfo->securityType == ZM_SECURITY_TYPE_WPA )
+ {
+ wd->sta.wpaState = ZM_STA_WPA_STATE_INIT;
+
+ if ( wd->sta.wepStatus == ZM_ENCRYPTION_TKIP )
+ {
+ wd->sta.encryMode = ZM_TKIP;
+
+ /* Turn on software encryption/decryption for TKIP */
+ if (wd->sta.EnableHT == 1)
+ {
+ zfStaEnableSWEncryption(dev, (ZM_SW_TKIP_ENCRY_EN|ZM_SW_TKIP_DECRY_EN));
+ }
+
+ /* Do not support TKIP in 11n mode */
+ //wd->sta.EnableHT = 0;
+ //pBssInfo->enableHT40 = 0;
+ }
+ else if ( wd->sta.wepStatus == ZM_ENCRYPTION_AES )
+ {
+ wd->sta.encryMode = ZM_AES;
+
+ /* If AP supports HT mode */
+ if (wd->sta.EnableHT)
+ {
+ /* Set MPDU density to 8 us*/
+ density = ZM_MPDU_DENSITY_8US;
+ }
+ }
+
+ if ( pBssInfo->wpaIe[1] != 0 )
+ {
+ zfMemoryCopy(wd->sta.wpaIe, pBssInfo->wpaIe,
+ pBssInfo->wpaIe[1]+2);
+ }
+ else
+ {
+ wd->sta.wpaIe[1] = 0;
+ }
+
+ if ( pBssInfo->rsnIe[1] != 0 )
+ {
+ zfMemoryCopy(wd->sta.rsnIe, pBssInfo->rsnIe,
+ pBssInfo->rsnIe[1]+2);
+ }
+ else
+ {
+ wd->sta.rsnIe[1] = 0;
+ }
+ }
+
+
+
+ /* check preamble bit */
+ wd->preambleTypeInUsed = wd->preambleType;
+ if ( wd->preambleTypeInUsed == ZM_PREAMBLE_TYPE_AUTO )
+ {
+ if (pBssInfo->capability[0] & ZM_BIT_5)
+ {
+ wd->preambleTypeInUsed = ZM_PREAMBLE_TYPE_SHORT;
+ }
+ else
+ {
+ wd->preambleTypeInUsed = ZM_PREAMBLE_TYPE_LONG;
+ }
+ }
+
+ if (wd->preambleTypeInUsed == ZM_PREAMBLE_TYPE_LONG)
+ {
+ wd->sta.capability[0] &= ~ZM_BIT_5;
+ }
+ else
+ {
+ wd->sta.capability[0] |= ZM_BIT_5;
+ }
+
+ /* check 802.11n 40MHz Setting */
+ if ((pBssInfo->enableHT40 == 1) &&
+ ((pBssInfo->extChOffset == 1) || (pBssInfo->extChOffset == 3)))
+ {
+ wd->BandWidth40 = pBssInfo->enableHT40;
+ wd->ExtOffset = pBssInfo->extChOffset;
+ }
+ else
+ {
+ wd->BandWidth40 = 0;
+ wd->ExtOffset = 0;
+ }
+
+ /* check 802.11H support bit */
+
+ /* check Owl Ap */
+ if ( pBssInfo->athOwlAp & ZM_BIT_0 )
+ {
+ /* In this function, FW retry will be enable, ZM_MAC_REG_RETRY_MAX
+ will be set to 0.
+ */
+ zfHpDisableHwRetry(dev);
+ wd->sta.athOwlAp = 1;
+ /* Set MPDU density to 8 us*/
+ density = ZM_MPDU_DENSITY_8US;
+ }
+ else
+ {
+ /* In this function, FW retry will be disable, ZM_MAC_REG_RETRY_MAX
+ will be set to 3.
+ */
+ zfHpEnableHwRetry(dev);
+ wd->sta.athOwlAp = 0;
+ }
+ wd->reorder = 1;
+
+ /* Set MPDU density */
+ zfHpSetMPDUDensity(dev, density);
+
+ /* check short slot time bit */
+ if ( pBssInfo->capability[1] & ZM_BIT_2 )
+ {
+ wd->sta.capability[1] |= ZM_BIT_2;
+ }
+
+ if ( pBssInfo->erp & ZM_BIT_1 )
+ {
+ //zm_debug_msg0("protection mode on");
+ wd->sta.bProtectionMode = TRUE;
+ zfHpSetSlotTime(dev, 0);
+ }
+ else
+ {
+ //zm_debug_msg0("protection mode off");
+ wd->sta.bProtectionMode = FALSE;
+ zfHpSetSlotTime(dev, 1);
+ }
+
+ if (pBssInfo->marvelAp == 1)
+ {
+ wd->sta.enableDrvBA = 0;
+ /*
+ * 8701 : NetGear 3500 (MARVELL)
+ * Downlink issue : set slottime to 20.
+ */
+ zfHpSetSlotTimeRegister(dev, 0);
+ }
+ else
+ {
+ wd->sta.enableDrvBA = 1;
+
+ /*
+ * This is not good for here do reset slot time.
+ * I think it should reset when leave MARVELL ap
+ * or enter disconnect state etc.
+ */
+ zfHpSetSlotTimeRegister(dev, 1);
+ }
+
+ //Store probe response frame body, for VISTA only
+ wd->sta.beaconFrameBodySize = pBssInfo->frameBodysize + 12;
+ if (wd->sta.beaconFrameBodySize > ZM_CACHED_FRAMEBODY_SIZE)
+ {
+ wd->sta.beaconFrameBodySize = ZM_CACHED_FRAMEBODY_SIZE;
+ }
+ for (k=0; k<8; k++)
+ {
+ wd->sta.beaconFrameBody[k] = pBssInfo->timeStamp[k];
+ }
+ wd->sta.beaconFrameBody[8] = pBssInfo->beaconInterval[0];
+ wd->sta.beaconFrameBody[9] = pBssInfo->beaconInterval[1];
+ wd->sta.beaconFrameBody[10] = pBssInfo->capability[0];
+ wd->sta.beaconFrameBody[11] = pBssInfo->capability[1];
+ for (k=0; k<(wd->sta.beaconFrameBodySize - 12); k++)
+ {
+ wd->sta.beaconFrameBody[k+12] = pBssInfo->frameBody[k];
+ }
+
+ if ( ( pBssInfo->capability[0] & ZM_BIT_4 )&&
+ (( wd->sta.authMode == ZM_AUTH_MODE_OPEN )||
+ ( wd->sta.authMode == ZM_AUTH_MODE_SHARED_KEY)||
+ (wd->sta.authMode == ZM_AUTH_MODE_AUTO)) )
+ { /* privacy enabled */
+
+ if ( wd->sta.wepStatus == ZM_ENCRYPTION_WEP_DISABLED )
+ {
+ zm_debug_msg0("Adapter is no WEP, try to connect to WEP AP");
+ ret = FALSE;
+ }
+
+ /* Do not support WEP in 11n mode */
+ if ( wd->sta.wepStatus == ZM_ENCRYPTION_WEP_ENABLED )
+ {
+ /* Turn on software encryption/decryption for WEP */
+ if (wd->sta.EnableHT == 1)
+ {
+ zfStaEnableSWEncryption(dev, (ZM_SW_WEP_ENCRY_EN|ZM_SW_WEP_DECRY_EN));
+ }
+
+ //wd->sta.EnableHT = 0;
+ //wd->BandWidth40 = 0;
+ //wd->ExtOffset = 0;
+ }
+
+ wd->sta.capability[0] |= ZM_BIT_4;
+
+ if ( wd->sta.authMode == ZM_AUTH_MODE_AUTO )
+ { /* Try to use open and shared-key authehtication alternatively */
+ if ( (wd->sta.connectTimeoutCount % 2) == 0 )
+ wd->sta.bIsSharedKey = 0;
+ else
+ wd->sta.bIsSharedKey = 1;
+ }
+ else if ( wd->sta.authMode != ZM_AUTH_MODE_SHARED_KEY )
+ { /* open or auto */
+ //zfStaStartConnect(dev, 0);
+ wd->sta.bIsSharedKey = 0;
+ }
+ else if ( wd->sta.authMode != ZM_AUTH_MODE_OPEN )
+ { /* shared key */
+ //zfStaStartConnect(dev, 1) ;
+ wd->sta.bIsSharedKey = 1;
+ }
+ }
+ else
+ {
+ if ( (pBssInfo->securityType == ZM_SECURITY_TYPE_WPA)||
+ (pBssInfo->capability[0] & ZM_BIT_4) )
+ {
+ wd->sta.capability[0] |= ZM_BIT_4;
+ /* initialize WPA related parameters */
+ }
+ else
+ {
+ wd->sta.capability[0] &= (~ZM_BIT_4);
+ }
+
+ /* authentication with open system */
+ //zfStaStartConnect(dev, 0);
+ wd->sta.bIsSharedKey = 0;
+ }
+
+ /* Improve WEP/TKIP performace with HT AP, detail information please look bug#32495 */
+ /*
+ if ( (pBssInfo->broadcomHTAp == 1)
+ && (wd->sta.SWEncryptEnable != 0) )
+ {
+ zfHpSetTTSIFSTime(dev, 0xa);
+ }
+ else
+ {
+ zfHpSetTTSIFSTime(dev, 0x8);
+ }
+ */
+ }
+ else
+ {
+ zm_debug_msg0("Desired SSID not found");
+ goto zlConnectFailed;
+ }
+
+
+ zfCoreSetFrequencyV2(dev, wd->frequency, zfStaStartConnectCb);
+ return;
+
+zlConnectFailed:
+ zfStaConnectFail(dev, ZM_STATUS_MEDIA_DISCONNECT_NOT_FOUND, wd->sta.bssid, 0);
+ return;
+}
+
+u8_t zfCheckWPAAuth(zdev_t* dev, struct zsBssInfo* pBssInfo)
+{
+ u8_t ret=TRUE;
+ u8_t pmkCount;
+ u8_t i;
+ u16_t encAlgoType = 0;
+
+ zmw_get_wlan_dev(dev);
+
+ if ( wd->sta.wepStatus == ZM_ENCRYPTION_TKIP )
+ {
+ encAlgoType = ZM_TKIP;
+ }
+ else if ( wd->sta.wepStatus == ZM_ENCRYPTION_AES )
+ {
+ encAlgoType = ZM_AES;
+ }
+
+ switch(wd->sta.authMode)
+ {
+ case ZM_AUTH_MODE_WPA:
+ case ZM_AUTH_MODE_WPAPSK:
+ if ( pBssInfo->wpaIe[1] == 0 )
+ {
+ ret = FALSE;
+ break;
+ }
+
+ pmkCount = pBssInfo->wpaIe[12];
+ for(i=0; i < pmkCount; i++)
+ {
+ if ( pBssInfo->wpaIe[17 + 4*i] == encAlgoType )
+ {
+ ret = TRUE;
+ goto done;
+ }
+ }
+
+ ret = FALSE;
+ break;
+
+ case ZM_AUTH_MODE_WPA2:
+ case ZM_AUTH_MODE_WPA2PSK:
+ if ( pBssInfo->rsnIe[1] == 0 )
+ {
+ ret = FALSE;
+ break;
+ }
+
+ pmkCount = pBssInfo->rsnIe[8];
+ for(i=0; i < pmkCount; i++)
+ {
+ if ( pBssInfo->rsnIe[13 + 4*i] == encAlgoType )
+ {
+ ret = TRUE;
+ goto done;
+ }
+ }
+
+ ret = FALSE;
+ break;
+ }
+
+done:
+ return ret;
+}
+
+u8_t zfCheckAuthentication(zdev_t* dev, struct zsBssInfo* pBssInfo)
+{
+ u8_t ret=TRUE;
+ u16_t encAlgoType;
+ u16_t UnicastCipherNum;
+
+ zmw_get_wlan_dev(dev);
+
+ /* Connecting to ANY has been checked */
+ if ( wd->sta.ssidLen == 0 )
+ {
+ return ret;
+ }
+
+
+ switch(wd->sta.authMode)
+ //switch(wd->ws.authMode)//Quickly reboot
+ {
+ case ZM_AUTH_MODE_WPA_AUTO:
+ case ZM_AUTH_MODE_WPAPSK_AUTO:
+ encAlgoType = 0;
+ if(pBssInfo->rsnIe[1] != 0)
+ {
+ UnicastCipherNum = (pBssInfo->rsnIe[8]) +
+ (pBssInfo->rsnIe[9] << 8);
+
+ /* If there is only one unicast cipher */
+ if (UnicastCipherNum == 1)
+ {
+ encAlgoType = pBssInfo->rsnIe[13];
+ //encAlgoType = pBssInfo->rsnIe[7];
+ }
+ else
+ {
+ u16_t ii;
+ u16_t desiredCipher = 0;
+ u16_t IEOffSet = 13;
+
+ /* Enumerate all the supported unicast cipher */
+ for (ii = 0; ii < UnicastCipherNum; ii++)
+ {
+ if (pBssInfo->rsnIe[IEOffSet+ii*4] > desiredCipher)
+ {
+ desiredCipher = pBssInfo->rsnIe[IEOffSet+ii*4];
+ }
+ }
+
+ encAlgoType = desiredCipher;
+ }
+
+ if ( encAlgoType == 0x02 )
+ {
+ wd->sta.wepStatus = ZM_ENCRYPTION_TKIP;
+
+ if ( wd->sta.authMode == ZM_AUTH_MODE_WPA_AUTO )
+ {
+ wd->sta.currentAuthMode = ZM_AUTH_MODE_WPA2;
+ }
+ else //ZM_AUTH_MODE_WPAPSK_AUTO
+ {
+ wd->sta.currentAuthMode = ZM_AUTH_MODE_WPA2PSK;
+ }
+ }
+ else if ( encAlgoType == 0x04 )
+ {
+ wd->sta.wepStatus = ZM_ENCRYPTION_AES;
+
+ if ( wd->sta.authMode == ZM_AUTH_MODE_WPA_AUTO )
+ {
+ wd->sta.currentAuthMode = ZM_AUTH_MODE_WPA2;
+ }
+ else //ZM_AUTH_MODE_WPAPSK_AUTO
+ {
+ wd->sta.currentAuthMode = ZM_AUTH_MODE_WPA2PSK;
+ }
+ }
+ else
+ {
+ ret = FALSE;
+ }
+ }
+ else if(pBssInfo->wpaIe[1] != 0)
+ {
+ UnicastCipherNum = (pBssInfo->wpaIe[12]) +
+ (pBssInfo->wpaIe[13] << 8);
+
+ /* If there is only one unicast cipher */
+ if (UnicastCipherNum == 1)
+ {
+ encAlgoType = pBssInfo->wpaIe[17];
+ //encAlgoType = pBssInfo->wpaIe[11];
+ }
+ else
+ {
+ u16_t ii;
+ u16_t desiredCipher = 0;
+ u16_t IEOffSet = 17;
+
+ /* Enumerate all the supported unicast cipher */
+ for (ii = 0; ii < UnicastCipherNum; ii++)
+ {
+ if (pBssInfo->wpaIe[IEOffSet+ii*4] > desiredCipher)
+ {
+ desiredCipher = pBssInfo->wpaIe[IEOffSet+ii*4];
+ }
+ }
+
+ encAlgoType = desiredCipher;
+ }
+
+ if ( encAlgoType == 0x02 )
+ {
+ wd->sta.wepStatus = ZM_ENCRYPTION_TKIP;
+
+ if ( wd->sta.authMode == ZM_AUTH_MODE_WPA_AUTO )
+ {
+ wd->sta.currentAuthMode = ZM_AUTH_MODE_WPA;
+ }
+ else //ZM_AUTH_MODE_WPAPSK_AUTO
+ {
+ wd->sta.currentAuthMode = ZM_AUTH_MODE_WPAPSK;
+ }
+ }
+ else if ( encAlgoType == 0x04 )
+ {
+ wd->sta.wepStatus = ZM_ENCRYPTION_AES;
+
+ if ( wd->sta.authMode == ZM_AUTH_MODE_WPA_AUTO )
+ {
+ wd->sta.currentAuthMode = ZM_AUTH_MODE_WPA;
+ }
+ else //ZM_AUTH_MODE_WPAPSK_AUTO
+ {
+ wd->sta.currentAuthMode = ZM_AUTH_MODE_WPAPSK;
+ }
+ }
+ else
+ {
+ ret = FALSE;
+ }
+
+
+ }
+ else
+ {
+ ret = FALSE;
+ }
+
+ break;
+
+ case ZM_AUTH_MODE_WPA:
+ case ZM_AUTH_MODE_WPAPSK:
+ case ZM_AUTH_MODE_WPA_NONE:
+ case ZM_AUTH_MODE_WPA2:
+ case ZM_AUTH_MODE_WPA2PSK:
+ {
+ if ( pBssInfo->securityType != ZM_SECURITY_TYPE_WPA )
+ {
+ ret = FALSE;
+ }
+
+ ret = zfCheckWPAAuth(dev, pBssInfo);
+ }
+ break;
+
+ case ZM_AUTH_MODE_OPEN:
+ case ZM_AUTH_MODE_SHARED_KEY:
+ case ZM_AUTH_MODE_AUTO:
+ {
+ if ( pBssInfo->wscIe[1] )
+ {
+ // If the AP is a Jumpstart AP, it's ok!! Ray
+ break;
+ }
+ else if ( pBssInfo->securityType == ZM_SECURITY_TYPE_WPA )
+ {
+ ret = FALSE;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return ret;
+}
+
+u8_t zfStaIsConnected(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ if ( wd->sta.adapterState == ZM_STA_STATE_CONNECTED )
+ {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+u8_t zfStaIsConnecting(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ if ( wd->sta.adapterState == ZM_STA_STATE_CONNECTING )
+ {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+u8_t zfStaIsDisconnect(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ if ( wd->sta.adapterState == ZM_STA_STATE_DISCONNECT )
+ {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+u8_t zfChangeAdapterState(zdev_t* dev, u8_t newState)
+{
+ u8_t ret = TRUE;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ //if ( newState == wd->sta.adapterState )
+ //{
+ // return FALSE;
+ //}
+
+ switch(newState)
+ {
+ case ZM_STA_STATE_DISCONNECT:
+ zfResetSupportRate(dev, ZM_DEFAULT_SUPPORT_RATE_DISCONNECT);
+
+ #if 1
+ zfScanMgrScanStop(dev, ZM_SCAN_MGR_SCAN_INTERNAL);
+ #else
+ if ( wd->sta.bChannelScan )
+ {
+ /* stop the action of channel scanning */
+ wd->sta.bChannelScan = FALSE;
+ ret = TRUE;
+ break;
+ }
+ #endif
+
+ break;
+ case ZM_STA_STATE_CONNECTING:
+ #if 1
+ zfScanMgrScanStop(dev, ZM_SCAN_MGR_SCAN_INTERNAL);
+ #else
+ if ( wd->sta.bChannelScan )
+ {
+ /* stop the action of channel scanning */
+ wd->sta.bChannelScan = FALSE;
+ ret = TRUE;
+ break;
+ }
+ #endif
+
+ break;
+ case ZM_STA_STATE_CONNECTED:
+ break;
+ default:
+ break;
+ }
+
+ //if ( ret )
+ //{
+ zmw_enter_critical_section(dev);
+ wd->sta.adapterState = newState;
+ zmw_leave_critical_section(dev);
+
+ zm_debug_msg1("change adapter state = ", newState);
+ //}
+
+ return ret;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfStaMmAddIeSsid */
+/* Add information element SSID to buffer. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : buffer to add information element */
+/* offset : add information element from this offset */
+/* */
+/* OUTPUTS */
+/* buffer offset after adding information element */
+/* */
+/* AUTHOR */
+/* Ji-Huang Lee ZyDAS Technology Corporation 2005.11 */
+/* */
+/************************************************************************/
+u16_t zfStaAddIeSsid(zdev_t* dev, zbuf_t* buf, u16_t offset)
+{
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ /* Element ID */
+ zmw_tx_buf_writeb(dev, buf, offset++, ZM_WLAN_EID_SSID);
+
+ /* Element Length */
+ zmw_tx_buf_writeb(dev, buf, offset++, wd->sta.ssidLen);
+
+ /* Information : SSID */
+ for (i=0; i<wd->sta.ssidLen; i++)
+ {
+ zmw_tx_buf_writeb(dev, buf, offset++, wd->sta.ssid[i]);
+ }
+
+ return offset;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfStaMmAddIeWpa */
+/* Add information element SSID to buffer. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : buffer to add information element */
+/* offset : add information element from this offset */
+/* */
+/* OUTPUTS */
+/* buffer offset after adding information element */
+/* */
+/* AUTHOR */
+/* Ji-Huang Lee ZyDAS Technology Corporation 2006.01 */
+/* */
+/************************************************************************/
+u16_t zfStaAddIeWpaRsn(zdev_t* dev, zbuf_t* buf, u16_t offset, u8_t frameType)
+{
+ u32_t i;
+ u8_t ssn[64]={
+ /* Element ID */
+ 0xdd,
+ /* Length */
+ 0x18,
+ /* OUI type */
+ 0x00, 0x50, 0xf2, 0x01,
+ /* Version */
+ 0x01, 0x00,
+ /* Group Cipher Suite, default=TKIP */
+ 0x00, 0x50, 0xf2, 0x02,
+ /* Pairwise Cipher Suite Count */
+ 0x01, 0x00,
+ /* Pairwise Cipher Suite, default=TKIP */
+ 0x00, 0x50, 0xf2, 0x02,
+ /* Authentication and Key Management Suite Count */
+ 0x01, 0x00,
+ /* Authentication type, default=PSK */
+ 0x00, 0x50, 0xf2, 0x02,
+ /* WPA capability */
+ 0x00, 0x00
+ };
+
+ u8_t rsn[64]={
+ /* Element ID */
+ 0x30,
+ /* Length */
+ 0x14,
+ /* Version */
+ 0x01, 0x00,
+ /* Group Cipher Suite, default=TKIP */
+ 0x00, 0x0f, 0xac, 0x02,
+ /* Pairwise Cipher Suite Count */
+ 0x01, 0x00,
+ /* Pairwise Cipher Suite, default=TKIP */
+ 0x00, 0x0f, 0xac, 0x02,
+ /* Authentication and Key Management Suite Count */
+ 0x01, 0x00,
+ /* Authentication type, default=PSK */
+ 0x00, 0x0f, 0xac, 0x02,
+ /* RSN capability */
+ 0x00, 0x00
+ };
+
+ zmw_get_wlan_dev(dev);
+
+ if ( wd->sta.currentAuthMode == ZM_AUTH_MODE_WPAPSK )
+ {
+ /* Overwrite Group Cipher Suite by AP's setting */
+ zfMemoryCopy(ssn+8, wd->sta.wpaIe+8, 4);
+
+ if ( wd->sta.wepStatus == ZM_ENCRYPTION_AES )
+ {
+ /* Overwrite Pairwise Cipher Suite by AES */
+ zfMemoryCopy(ssn+14, zgWpaAesOui, 4);
+ }
+
+ zfCopyToIntTxBuffer(dev, buf, ssn, offset, ssn[1]+2);
+ zfMemoryCopy(wd->sta.wpaIe, ssn, ssn[1]+2);
+ offset += (ssn[1]+2);
+ }
+ else if ( wd->sta.currentAuthMode == ZM_AUTH_MODE_WPA )
+ {
+ /* Overwrite Group Cipher Suite by AP's setting */
+ zfMemoryCopy(ssn+8, wd->sta.wpaIe+8, 4);
+ /* Overwrite Key Management Suite by WPA-Radius */
+ zfMemoryCopy(ssn+20, zgWpaRadiusOui, 4);
+
+ if ( wd->sta.wepStatus == ZM_ENCRYPTION_AES )
+ {
+ /* Overwrite Pairwise Cipher Suite by AES */
+ zfMemoryCopy(ssn+14, zgWpaAesOui, 4);
+ }
+
+ zfCopyToIntTxBuffer(dev, buf, ssn, offset, ssn[1]+2);
+ zfMemoryCopy(wd->sta.wpaIe, ssn, ssn[1]+2);
+ offset += (ssn[1]+2);
+ }
+ else if ( wd->sta.currentAuthMode == ZM_AUTH_MODE_WPA2PSK )
+ {
+ /* Overwrite Group Cipher Suite by AP's setting */
+ zfMemoryCopy(rsn+4, wd->sta.rsnIe+4, 4);
+
+ if ( wd->sta.wepStatus == ZM_ENCRYPTION_AES )
+ {
+ /* Overwrite Pairwise Cipher Suite by AES */
+ zfMemoryCopy(rsn+10, zgWpa2AesOui, 4);
+ }
+
+ if ( frameType == ZM_WLAN_FRAME_TYPE_REASOCREQ )
+ {
+ for(i=0; i<wd->sta.pmkidInfo.bssidCount; i++)
+ {
+ if ( zfMemoryIsEqual((u8_t*) wd->sta.pmkidInfo.bssidInfo[i].bssid,
+ (u8_t*) wd->sta.bssid, 6) )
+ {
+ /* matched */
+ break;
+ }
+
+ if ( i < wd->sta.pmkidInfo.bssidCount )
+ {
+ // Fill PMKID Count in RSN information element
+ rsn[22] = 0x01;
+ rsn[23] = 0x00;
+
+ // Fill PMKID in RSN information element
+ zfMemoryCopy(rsn+24,
+ wd->sta.pmkidInfo.bssidInfo[i].pmkid, 16);
+ rsn[1] += 18;
+ }
+ }
+ }
+
+ zfCopyToIntTxBuffer(dev, buf, rsn, offset, rsn[1]+2);
+ zfMemoryCopy(wd->sta.rsnIe, rsn, rsn[1]+2);
+ offset += (rsn[1]+2);
+ }
+ else if ( wd->sta.currentAuthMode == ZM_AUTH_MODE_WPA2 )
+ {
+ /* Overwrite Group Cipher Suite by AP's setting */
+ zfMemoryCopy(rsn+4, wd->sta.rsnIe+4, 4);
+ /* Overwrite Key Management Suite by WPA2-Radius */
+ zfMemoryCopy(rsn+16, zgWpa2RadiusOui, 4);
+
+ if ( wd->sta.wepStatus == ZM_ENCRYPTION_AES )
+ {
+ /* Overwrite Pairwise Cipher Suite by AES */
+ zfMemoryCopy(rsn+10, zgWpa2AesOui, 4);
+ }
+
+ if (( frameType == ZM_WLAN_FRAME_TYPE_REASOCREQ || ( frameType == ZM_WLAN_FRAME_TYPE_ASOCREQ )))
+ {
+
+ if (wd->sta.pmkidInfo.bssidCount != 0) {
+ // Fill PMKID Count in RSN information element
+ rsn[22] = 1;
+ rsn[23] = 0;
+ /*
+ * The caller is respnsible to give us the relevant PMKID.
+ * We'll only accept 1 PMKID for now.
+ */
+ for(i=0; i<wd->sta.pmkidInfo.bssidCount; i++)
+ {
+ if ( zfMemoryIsEqual((u8_t*) wd->sta.pmkidInfo.bssidInfo[i].bssid, (u8_t*) wd->sta.bssid, 6) )
+ {
+ zfMemoryCopy(rsn+24, wd->sta.pmkidInfo.bssidInfo[i].pmkid, 16);
+ break;
+ }
+ }
+ rsn[1] += 18;
+ }
+
+ }
+
+ zfCopyToIntTxBuffer(dev, buf, rsn, offset, rsn[1]+2);
+ zfMemoryCopy(wd->sta.rsnIe, rsn, rsn[1]+2);
+ offset += (rsn[1]+2);
+ }
+
+ return offset;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfStaAddIeIbss */
+/* Add information element IBSS parameter to buffer. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : buffer to add information element */
+/* offset : add information element from this offset */
+/* */
+/* OUTPUTS */
+/* buffer offset after adding information element */
+/* */
+/* AUTHOR */
+/* Ji-Huang Lee ZyDAS Technology Corporation 2005.12 */
+/* */
+/************************************************************************/
+u16_t zfStaAddIeIbss(zdev_t* dev, zbuf_t* buf, u16_t offset)
+{
+ zmw_get_wlan_dev(dev);
+
+ /* Element ID */
+ zmw_tx_buf_writeb(dev, buf, offset++, ZM_WLAN_EID_IBSS);
+
+ /* Element Length */
+ zmw_tx_buf_writeb(dev, buf, offset++, 2);
+
+ /* ATIM window */
+ zmw_tx_buf_writeh(dev, buf, offset, wd->sta.atimWindow);
+ offset += 2;
+
+ return offset;
+}
+
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfStaAddIeWmeInfo */
+/* Add WME Information Element to buffer. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : buffer to add information element */
+/* offset : add information element from this offset */
+/* */
+/* OUTPUTS */
+/* buffer offset after adding information element */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2006.6 */
+/* */
+/************************************************************************/
+u16_t zfStaAddIeWmeInfo(zdev_t* dev, zbuf_t* buf, u16_t offset, u8_t qosInfo)
+{
+ /* Element ID */
+ zmw_tx_buf_writeb(dev, buf, offset++, ZM_WLAN_EID_WIFI_IE);
+
+ /* Element Length */
+ zmw_tx_buf_writeb(dev, buf, offset++, 7);
+
+ /* OUI */
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x00);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x50);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0xF2);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x02);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x00);
+ zmw_tx_buf_writeb(dev, buf, offset++, 0x01);
+
+ /* QoS Info */
+ zmw_tx_buf_writeb(dev, buf, offset++, qosInfo);
+
+ return offset;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfStaAddIePowerCap */
+/* Add information element Power capability to buffer. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : buffer to add information element */
+/* offset : add information element from this offset */
+/* */
+/* OUTPUTS */
+/* buffer offset after adding information element */
+/* */
+/* AUTHOR */
+/* Sharon 2007.12 */
+/* */
+/************************************************************************/
+u16_t zfStaAddIePowerCap(zdev_t* dev, zbuf_t* buf, u16_t offset)
+{
+ u8_t MaxTxPower;
+ u8_t MinTxPower;
+
+ zmw_get_wlan_dev(dev);
+
+ /* Element ID */
+ zmw_tx_buf_writeb(dev, buf, offset++, ZM_WLAN_EID_POWER_CAPABILITY);
+
+ /* Element Length */
+ zmw_tx_buf_writeb(dev, buf, offset++, 2);
+
+ MinTxPower = (u8_t)(zfHpGetMinTxPower(dev)/2);
+ MaxTxPower = (u8_t)(zfHpGetMaxTxPower(dev)/2);
+
+ /* Min Transmit Power Cap */
+ zmw_tx_buf_writeh(dev, buf, offset++, MinTxPower);
+
+ /* Max Transmit Power Cap */
+ zmw_tx_buf_writeh(dev, buf, offset++, MaxTxPower);
+
+ return offset;
+}
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfStaAddIeSupportCh */
+/* Add information element supported channels to buffer. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : buffer to add information element */
+/* offset : add information element from this offset */
+/* */
+/* OUTPUTS */
+/* buffer offset after adding information element */
+/* */
+/* AUTHOR */
+/* Sharon 2007.12 */
+/* */
+/************************************************************************/
+u16_t zfStaAddIeSupportCh(zdev_t* dev, zbuf_t* buf, u16_t offset)
+{
+
+ u8_t i;
+ u16_t count_24G = 0;
+ u16_t count_5G = 0;
+ u16_t channelNum;
+ u8_t length;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+ zmw_enter_critical_section(dev);
+
+ for (i = 0; i < wd->regulationTable.allowChannelCnt; i++)
+ {
+ if (wd->regulationTable.allowChannel[i].channel < 3000)
+ { // 2.4Hz
+ count_24G++;
+ }
+ else
+ { // 5GHz
+ count_5G++;
+ }
+ }
+
+ length = (u8_t)(count_5G * 2 + 2); //5G fill by pair, 2,4G (continuous channels) fill 2 bytes
+
+ /* Element ID */
+ zmw_tx_buf_writeb(dev, buf, offset++, ZM_WLAN_EID_SUPPORTED_CHANNELS );
+
+ /* Element Length */
+ zmw_tx_buf_writeb(dev, buf, offset++, length);
+
+ // 2.4GHz (continuous channels)
+ /* First channel number */
+ zmw_tx_buf_writeh(dev, buf, offset++, 1); //Start from channle 1
+ /* Number of channels */
+ zmw_tx_buf_writeh(dev, buf, offset++, count_24G);
+
+ for (i = 0; i < wd->regulationTable.allowChannelCnt ; i++)
+ {
+ if (wd->regulationTable.allowChannel[i].channel > 4000 && wd->regulationTable.allowChannel[i].channel < 5000)
+ { // 5GHz 4000 -5000Mhz
+ channelNum = (wd->regulationTable.allowChannel[i].channel-4000)/5;
+ /* First channel number */
+ zmw_tx_buf_writeh(dev, buf, offset++, channelNum);
+ /* Number of channels */
+ zmw_tx_buf_writeh(dev, buf, offset++, 1);
+ }
+ else if (wd->regulationTable.allowChannel[i].channel >= 5000)
+ { // 5GHz >5000Mhz
+ channelNum = (wd->regulationTable.allowChannel[i].channel-5000)/5;
+ /* First channel number */
+ zmw_tx_buf_writeh(dev, buf, offset++, channelNum);
+ /* Number of channels */
+ zmw_tx_buf_writeh(dev, buf, offset++, 1);
+ }
+ }
+ zmw_leave_critical_section(dev);
+
+ return offset;
+}
+
+void zfStaStartConnectCb(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ zfStaStartConnect(dev, wd->sta.bIsSharedKey);
+}
+
+void zfStaStartConnect(zdev_t* dev, u8_t bIsSharedKey)
+{
+ u32_t p1, p2;
+ u8_t newConnState;
+
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ /* p1_low = algorithm number, p1_high = transaction sequence number */
+ if ( bIsSharedKey )
+ {
+ //wd->sta.connectState = ZM_STA_CONN_STATE_AUTH_SHARE_1;
+ newConnState = ZM_STA_CONN_STATE_AUTH_SHARE_1;
+ zm_debug_msg0("ZM_STA_CONN_STATE_AUTH_SHARE_1");
+ p1 = ZM_AUTH_ALGO_SHARED_KEY;
+ }
+ else
+ {
+ //wd->sta.connectState = ZM_STA_CONN_STATE_AUTH_OPEN;
+ newConnState = ZM_STA_CONN_STATE_AUTH_OPEN;
+ zm_debug_msg0("ZM_STA_CONN_STATE_AUTH_OPEN");
+ if( wd->sta.leapEnabled )
+ p1 = ZM_AUTH_ALGO_LEAP;
+ else
+ p1 = ZM_AUTH_ALGO_OPEN_SYSTEM;
+ }
+
+ /* status code */
+ p2 = 0x0;
+
+ zmw_enter_critical_section(dev);
+ wd->sta.connectTimer = wd->tick;
+ wd->sta.connectState = newConnState;
+ zmw_leave_critical_section(dev);
+
+ /* send the 1st authentication frame */
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_AUTH, wd->sta.bssid, p1, p2, 0);
+
+ return;
+}
+
+void zfSendNullData(zdev_t* dev, u8_t type)
+{
+ zbuf_t* buf;
+ //u16_t addrTblSize;
+ //struct zsAddrTbl addrTbl;
+ u16_t err;
+ u16_t hlen;
+ u16_t header[(34+8+1)/2];
+ u16_t bcastAddr[3] = {0xffff,0xffff,0xffff};
+ u16_t *dstAddr;
+
+ zmw_get_wlan_dev(dev);
+
+ if ((buf = zfwBufAllocate(dev, 1024)) == NULL)
+ {
+ zm_msg0_mm(ZM_LV_0, "Alloc mm buf Fail!");
+ return;
+ }
+
+ zfwBufSetSize(dev, buf, 0);
+
+ //zm_msg2_mm(ZM_LV_2, "buf->len=", buf->len);
+
+ if ( wd->wlanMode == ZM_MODE_IBSS)
+ {
+ dstAddr = bcastAddr;
+ }
+ else
+ {
+ dstAddr = wd->sta.bssid;
+ }
+
+ if (wd->sta.wmeConnected != 0)
+ {
+ /* If connect to a WMM AP, Send QoS Null data */
+ hlen = zfTxGenMmHeader(dev, ZM_WLAN_FRAME_TYPE_QOS_NULL, dstAddr, header, 0, buf, 0, 0);
+ }
+ else
+ {
+ hlen = zfTxGenMmHeader(dev, ZM_WLAN_FRAME_TYPE_NULL, dstAddr, header, 0, buf, 0, 0);
+ }
+
+ if (wd->wlanMode == ZM_MODE_INFRASTRUCTURE)
+ {
+ header[4] |= 0x0100; //TODS bit
+ }
+
+ if ( type == 1 )
+ {
+ header[4] |= 0x1000;
+ }
+
+ /* Get buffer DMA address */
+ //if ((addrTblSize = zfwBufMapDma(dev, buf, &addrTbl)) == 0)
+ //if ((addrTblSize = zfwMapTxDma(dev, buf, &addrTbl)) == 0)
+ //{
+ // goto zlError;
+ //}
+
+ /*increase unicast frame counter*/
+ wd->commTally.txUnicastFrm++;
+
+ if ((err = zfHpSend(dev, header, hlen, NULL, 0, NULL, 0, buf, 0,
+ ZM_INTERNAL_ALLOC_BUF, 0, 0xff)) != ZM_SUCCESS)
+ {
+ goto zlError;
+ }
+
+
+ return;
+
+zlError:
+
+ zfwBufFree(dev, buf, 0);
+ return;
+
+}
+
+void zfSendPSPoll(zdev_t* dev)
+{
+ zbuf_t* buf;
+ //u16_t addrTblSize;
+ //struct zsAddrTbl addrTbl;
+ u16_t err;
+ u16_t hlen;
+ u16_t header[(8+24+1)/2];
+
+ zmw_get_wlan_dev(dev);
+
+ if ((buf = zfwBufAllocate(dev, 1024)) == NULL)
+ {
+ zm_msg0_mm(ZM_LV_0, "Alloc mm buf Fail!");
+ return;
+ }
+
+ zfwBufSetSize(dev, buf, 0);
+
+ //zm_msg2_mm(ZM_LV_2, "buf->len=", buf->len);
+
+ zfTxGenMmHeader(dev, ZM_WLAN_FRAME_TYPE_PSPOLL, wd->sta.bssid, header, 0, buf, 0, 0);
+
+ header[0] = 20;
+ header[4] |= 0x1000;
+ header[5] = wd->sta.aid | 0xc000; //Both bit-14 and bit-15 are 1
+ hlen = 16 + 8;
+
+ /* Get buffer DMA address */
+ //if ((addrTblSize = zfwBufMapDma(dev, buf, &addrTbl)) == 0)
+ //if ((addrTblSize = zfwMapTxDma(dev, buf, &addrTbl)) == 0)
+ //{
+ // goto zlError;
+ //}
+
+ if ((err = zfHpSend(dev, header, hlen, NULL, 0, NULL, 0, buf, 0,
+ ZM_INTERNAL_ALLOC_BUF, 0, 0xff)) != ZM_SUCCESS)
+ {
+ goto zlError;
+ }
+
+ return;
+
+zlError:
+
+ zfwBufFree(dev, buf, 0);
+ return;
+
+}
+
+void zfSendBA(zdev_t* dev, u16_t start_seq, u8_t *bitmap)
+{
+ zbuf_t* buf;
+ //u16_t addrTblSize;
+ //struct zsAddrTbl addrTbl;
+ u16_t err;
+ u16_t hlen;
+ u16_t header[(8+24+1)/2];
+ u16_t i, offset = 0;
+
+ zmw_get_wlan_dev(dev);
+
+ if ((buf = zfwBufAllocate(dev, 1024)) == NULL)
+ {
+ zm_msg0_mm(ZM_LV_0, "Alloc mm buf Fail!");
+ return;
+ }
+
+ zfwBufSetSize(dev, buf, 12); // 28 = FC 2 + DU 2 + RA 6 + TA 6 + BAC 2 + SEQ 2 + BitMap 8
+ // 12 = BAC 2 + SEQ 2 + BitMap 8
+
+ //zm_msg2_mm(ZM_LV_2, "buf->len=", buf->len);
+
+ zfTxGenMmHeader(dev, ZM_WLAN_FRAME_TYPE_BA, wd->sta.bssid, header, 0, buf, 0, 0);
+
+ header[0] = 32; /* MAC header 16 + BA control 2 + BA info 10 + FCS 4*/
+ header[1] = 0x4; /* No ACK */
+
+ /* send by OFDM 6M */
+ header[2] = (u16_t)(zcRateToPhyCtrl[4] & 0xffff);
+ header[3] = (u16_t)(zcRateToPhyCtrl[4]>>16) & 0xffff;
+
+ hlen = 16 + 8; /* MAC header 16 + control 8*/
+ offset = 0;
+ zmw_tx_buf_writeh(dev, buf, offset, 0x05); /*compressed bitmap on*/
+ offset+=2;
+ zmw_tx_buf_writeh(dev, buf, offset, start_seq);
+ offset+=2;
+
+ for (i=0; i<8; i++) {
+ zmw_tx_buf_writeb(dev, buf, offset, bitmap[i]);
+ offset++;
+ }
+
+ if ((err = zfHpSend(dev, header, hlen, NULL, 0, NULL, 0, buf, 0,
+ ZM_INTERNAL_ALLOC_BUF, 0, 0xff)) != ZM_SUCCESS)
+ {
+ goto zlError;
+ }
+
+ return;
+
+zlError:
+
+ zfwBufFree(dev, buf, 0);
+ return;
+
+}
+
+void zfStaGetTxRate(zdev_t* dev, u16_t* macAddr, u32_t* phyCtrl,
+ u16_t* rcProbingFlag)
+{
+ u8_t addr[6], i;
+ u8_t rate;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ ZM_MAC_WORD_TO_BYTE(macAddr, addr);
+ *phyCtrl = 0;
+
+ if ( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ {
+ zmw_enter_critical_section(dev);
+ rate = (u8_t)zfRateCtrlGetTxRate(dev, &wd->sta.oppositeInfo[0].rcCell, rcProbingFlag);
+//#ifdef ZM_FB50
+ //rate = 27;
+//#endif
+ *phyCtrl = zcRateToPhyCtrl[rate];
+ zmw_leave_critical_section(dev);
+ }
+ else
+ {
+ zmw_enter_critical_section(dev);
+ for(i=0; i<wd->sta.oppositeCount; i++)
+ {
+ if ( addr[0] && 0x01 == 1 ) // The default beacon transmitted rate is CCK and 1 Mbps , but the a mode should use
+ // OFDM modulation and 6Mbps to transmit beacon.
+ {
+ //rate = (u8_t)zfRateCtrlGetTxRate(dev, &wd->sta.oppositeInfo[i].rcCell, rcProbingFlag);
+ rate = wd->sta.oppositeInfo[i].rcCell.operationRateSet[0];
+ *phyCtrl = zcRateToPhyCtrl[rate];
+ break;
+ }
+ else if ( zfMemoryIsEqual(addr, wd->sta.oppositeInfo[i].macAddr, 6) )
+ {
+ rate = (u8_t)zfRateCtrlGetTxRate(dev, &wd->sta.oppositeInfo[i].rcCell, rcProbingFlag);
+ *phyCtrl = zcRateToPhyCtrl[rate];
+ break;
+ }
+ }
+ zmw_leave_critical_section(dev);
+ }
+
+ return;
+}
+
+struct zsMicVar* zfStaGetRxMicKey(zdev_t* dev, zbuf_t* buf)
+{
+ u8_t keyIndex;
+ u8_t da0;
+
+ zmw_get_wlan_dev(dev);
+
+ /* if need not check MIC, return NULL */
+ if ( ((wd->sta.encryMode != ZM_TKIP)&&(wd->sta.encryMode != ZM_AES))||
+ (wd->sta.wpaState < ZM_STA_WPA_STATE_PK_OK) )
+ {
+ return NULL;
+ }
+
+ da0 = zmw_rx_buf_readb(dev, buf, ZM_WLAN_HEADER_A1_OFFSET);
+
+ if ((zmw_rx_buf_readb(dev, buf, 0) & 0x80) == 0x80)
+ keyIndex = zmw_rx_buf_readb(dev, buf, ZM_WLAN_HEADER_IV_OFFSET+5); /* Qos Packet*/
+ else
+ keyIndex = zmw_rx_buf_readb(dev, buf, ZM_WLAN_HEADER_IV_OFFSET+3); /* normal Packet*/
+ keyIndex = (keyIndex & 0xc0) >> 6;
+
+ return (&wd->sta.rxMicKey[keyIndex]);
+}
+
+struct zsMicVar* zfStaGetTxMicKey(zdev_t* dev, zbuf_t* buf)
+{
+ zmw_get_wlan_dev(dev);
+
+ /* if need not check MIC, return NULL */
+ //if ( ((wd->sta.encryMode != ZM_TKIP)&&(wd->sta.encryMode != ZM_AES))||
+ // (wd->sta.wpaState < ZM_STA_WPA_STATE_PK_OK) )
+ if ( (wd->sta.encryMode != ZM_TKIP) || (wd->sta.wpaState < ZM_STA_WPA_STATE_PK_OK) )
+ {
+ return NULL;
+ }
+
+ return (&wd->sta.txMicKey);
+}
+
+u16_t zfStaRxValidateFrame(zdev_t* dev, zbuf_t* buf)
+{
+ u8_t frameType, frameCtrl;
+ u8_t da0;
+ //u16_t sa[3];
+ u16_t ret;
+ u16_t i;
+ //u8_t sa0;
+
+ zmw_get_wlan_dev(dev);
+
+ frameType = zmw_rx_buf_readb(dev, buf, 0);
+ da0 = zmw_rx_buf_readb(dev, buf, ZM_WLAN_HEADER_A1_OFFSET);
+ //sa0 = zmw_rx_buf_readb(dev, buf, ZM_WLAN_HEADER_A2_OFFSET);
+
+ if ( (!zfStaIsConnected(dev))&&((frameType & 0xf) == ZM_WLAN_DATA_FRAME) )
+ {
+ return ZM_ERR_DATA_BEFORE_CONNECTED;
+ }
+
+
+ if ( (zfStaIsConnected(dev))&&((frameType & 0xf) == ZM_WLAN_DATA_FRAME) )
+ {
+ /* check BSSID */
+ if ( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ {
+ /* Big Endian and Little Endian Compatibility */
+ u16_t mac[3];
+ mac[0] = zmw_cpu_to_le16(wd->sta.bssid[0]);
+ mac[1] = zmw_cpu_to_le16(wd->sta.bssid[1]);
+ mac[2] = zmw_cpu_to_le16(wd->sta.bssid[2]);
+ if ( !zfRxBufferEqualToStr(dev, buf, (u8_t *)mac,
+ ZM_WLAN_HEADER_A2_OFFSET, 6) )
+ {
+/*We will get lots of garbage data, especially in AES mode.*/
+/*To avoid sending too many deauthentication frames in STA mode, mark it.*/
+#if 0
+ /* If unicast frame, send deauth to the transmitter */
+ if (( da0 & 0x01 ) == 0)
+ {
+ for (i=0; i<3; i++)
+ {
+ sa[i] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A2_OFFSET+(i*2));
+ }
+ /* If mutilcast address, don't send deauthentication*/
+ if (( sa0 & 0x01 ) == 0)
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH, sa, 7, 0, 0);
+ }
+#endif
+ return ZM_ERR_DATA_BSSID_NOT_MATCHED;
+ }
+ }
+ else if ( wd->wlanMode == ZM_MODE_IBSS )
+ {
+ /* Big Endian and Little Endian Compatibility */
+ u16_t mac[3];
+ mac[0] = zmw_cpu_to_le16(wd->sta.bssid[0]);
+ mac[1] = zmw_cpu_to_le16(wd->sta.bssid[1]);
+ mac[2] = zmw_cpu_to_le16(wd->sta.bssid[2]);
+ if ( !zfRxBufferEqualToStr(dev, buf, (u8_t *)mac,
+ ZM_WLAN_HEADER_A3_OFFSET, 6) )
+ {
+ return ZM_ERR_DATA_BSSID_NOT_MATCHED;
+ }
+ }
+
+ frameCtrl = zmw_rx_buf_readb(dev, buf, 1);
+
+ /* check security bit */
+ if ( wd->sta.dropUnencryptedPkts &&
+ (wd->sta.wepStatus != ZM_ENCRYPTION_WEP_DISABLED )&&
+ ( !(frameCtrl & ZM_BIT_6) ) )
+ { /* security on, but got data without encryption */
+
+ #if 1
+ ret = ZM_ERR_DATA_NOT_ENCRYPTED;
+ if ( wd->sta.pStaRxSecurityCheckCb != NULL )
+ {
+ ret = wd->sta.pStaRxSecurityCheckCb(dev, buf);
+ }
+ else
+ {
+ ret = ZM_ERR_DATA_NOT_ENCRYPTED;
+ }
+ if (ret == ZM_ERR_DATA_NOT_ENCRYPTED)
+ {
+ wd->commTally.swRxDropUnencryptedCount++;
+ }
+ return ret;
+ #else
+ if ( (wd->sta.wepStatus != ZM_ENCRYPTION_TKIP)&&
+ (wd->sta.wepStatus != ZM_ENCRYPTION_AES) )
+ {
+ return ZM_ERR_DATA_NOT_ENCRYPTED;
+ }
+ #endif
+ }
+ }
+
+ return ZM_SUCCESS;
+}
+
+void zfStaMicFailureHandling(zdev_t* dev, zbuf_t* buf)
+{
+ u8_t da0;
+ u8_t micNotify = 1;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ if ( wd->sta.wpaState < ZM_STA_WPA_STATE_PK_OK )
+ {
+ return;
+ }
+
+ zmw_enter_critical_section(dev);
+
+ wd->sta.cmMicFailureCount++;
+
+ if ( wd->sta.cmMicFailureCount == 1 )
+ {
+ zm_debug_msg0("get the first MIC failure");
+ //zfTimerSchedule(dev, ZM_EVENT_CM_TIMER, ZM_TICK_CM_TIMEOUT);
+
+ /* Timer Resolution on WinXP is 15/16 ms */
+ /* Decrease Time offset for <XP> Counter Measure */
+ zfTimerSchedule(dev, ZM_EVENT_CM_TIMER, ZM_TICK_CM_TIMEOUT - ZM_TICK_CM_TIMEOUT_OFFSET);
+ }
+ else if ( wd->sta.cmMicFailureCount == 2 )
+ {
+ zm_debug_msg0("get the second MIC failure");
+ /* reserve 2 second for OS to send MIC failure report to AP */
+ wd->sta.cmDisallowSsidLength = wd->sta.ssidLen;
+ zfMemoryCopy(wd->sta.cmDisallowSsid, wd->sta.ssid, wd->sta.ssidLen);
+ //wd->sta.cmMicFailureCount = 0;
+ zfTimerCancel(dev, ZM_EVENT_CM_TIMER);
+ //zfTimerSchedule(dev, ZM_EVENT_CM_DISCONNECT, ZM_TICK_CM_DISCONNECT);
+
+ /* Timer Resolution on WinXP is 15/16 ms */
+ /* Decrease Time offset for <XP> Counter Measure */
+ zfTimerSchedule(dev, ZM_EVENT_CM_DISCONNECT, ZM_TICK_CM_DISCONNECT - ZM_TICK_CM_DISCONNECT_OFFSET);
+ }
+ else
+ {
+ micNotify = 0;
+ }
+
+ zmw_leave_critical_section(dev);
+
+ if (micNotify == 1)
+ {
+ da0 = zmw_rx_buf_readb(dev, buf, ZM_WLAN_HEADER_A1_OFFSET);
+ if ( da0 & 0x01 )
+ {
+ if (wd->zfcbMicFailureNotify != NULL)
+ {
+ wd->zfcbMicFailureNotify(dev, wd->sta.bssid, ZM_MIC_GROUP_ERROR);
+ }
+ }
+ else
+ {
+ if (wd->zfcbMicFailureNotify != NULL)
+ {
+ wd->zfcbMicFailureNotify(dev, wd->sta.bssid, ZM_MIC_PAIRWISE_ERROR);
+ }
+ }
+ }
+}
+
+
+u8_t zfStaBlockWlanScan(zdev_t* dev)
+{
+ u8_t ret=FALSE;
+
+ zmw_get_wlan_dev(dev);
+
+ if ( wd->sta.bChannelScan )
+ {
+ return TRUE;
+ }
+
+ return ret;
+}
+
+void zfStaResetStatus(zdev_t* dev, u8_t bInit)
+{
+ u8_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ zfHpDisableBeacon(dev);
+
+ wd->dtim = 1;
+ wd->sta.capability[0] = 0x01;
+ wd->sta.capability[1] = 0x00;
+ /* 802.11h */
+ if (wd->sta.DFSEnable || wd->sta.TPCEnable)
+ wd->sta.capability[1] |= ZM_BIT_0;
+
+ /* release queued packets */
+ for(i=0; i<wd->sta.ibssPSDataCount; i++)
+ {
+ zfwBufFree(dev, wd->sta.ibssPSDataQueue[i], 0);
+ }
+
+ for(i=0; i<wd->sta.staPSDataCount; i++)
+ {
+ zfwBufFree(dev, wd->sta.staPSDataQueue[i], 0);
+ }
+
+ wd->sta.ibssPSDataCount = 0;
+ wd->sta.staPSDataCount = 0;
+ zfZeroMemory((u8_t*) &wd->sta.staPSList, sizeof(struct zsStaPSList));
+
+ wd->sta.wmeConnected = 0;
+ wd->sta.psMgr.tempWakeUp = 0;
+ wd->sta.qosInfo = 0;
+ zfQueueFlush(dev, wd->sta.uapsdQ);
+
+ return;
+
+}
+
+void zfStaIbssMonitoring(zdev_t* dev, u8_t reset)
+{
+ u16_t i;
+ u16_t oppositeCount;
+ struct zsPartnerNotifyEvent event;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ //zm_debug_msg1("zfStaIbssMonitoring %d", wd->sta.oppositeCount);
+
+ zmw_enter_critical_section(dev);
+
+ if ( wd->sta.oppositeCount == 0 )
+ {
+ goto done;
+ }
+
+ if ( wd->sta.bChannelScan )
+ {
+ goto done;
+ }
+
+ oppositeCount = wd->sta.oppositeCount;
+
+ for(i=0; i < ZM_MAX_OPPOSITE_COUNT; i++)
+ {
+ if ( oppositeCount == 0 )
+ {
+ break;
+ }
+
+ if ( reset )
+ {
+ wd->sta.oppositeInfo[i].valid = 0;
+ }
+
+ if ( wd->sta.oppositeInfo[i].valid == 0 )
+ {
+ continue;
+ }
+
+ oppositeCount--;
+
+ if ( wd->sta.oppositeInfo[i].aliveCounter )
+ {
+ zm_debug_msg1("Setting alive to ", wd->sta.oppositeInfo[i].aliveCounter);
+
+ zmw_leave_critical_section(dev);
+
+ if ( wd->sta.oppositeInfo[i].aliveCounter != ZM_IBSS_PEER_ALIVE_COUNTER )
+ {
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_PROBEREQ,
+ (u16_t*)wd->sta.oppositeInfo[i].macAddr, 1, 0, 0);
+ }
+
+ zmw_enter_critical_section(dev);
+ wd->sta.oppositeInfo[i].aliveCounter--;
+ }
+ else
+ {
+ zm_debug_msg0("zfStaIbssMonitoring remove the peer station");
+ zfMemoryCopy(event.bssid, (u8_t *)(wd->sta.bssid), 6);
+ zfMemoryCopy(event.peerMacAddr, wd->sta.oppositeInfo[i].macAddr, 6);
+
+ wd->sta.oppositeInfo[i].valid = 0;
+ wd->sta.oppositeCount--;
+ if (wd->zfcbIbssPartnerNotify != NULL)
+ {
+ zmw_leave_critical_section(dev);
+ wd->zfcbIbssPartnerNotify(dev, 0, &event);
+ zmw_enter_critical_section(dev);
+ }
+ }
+ }
+
+done:
+ if ( reset == 0 )
+ {
+ zfTimerSchedule(dev, ZM_EVENT_IBSS_MONITOR, ZM_TICK_IBSS_MONITOR);
+ }
+
+ zmw_leave_critical_section(dev);
+}
+
+void zfInitPartnerNotifyEvent(zdev_t* dev, zbuf_t* buf, struct zsPartnerNotifyEvent *event)
+{
+ u16_t *peerMacAddr;
+
+ zmw_get_wlan_dev(dev);
+
+ peerMacAddr = (u16_t *)event->peerMacAddr;
+
+ zfMemoryCopy(event->bssid, (u8_t *)(wd->sta.bssid), 6);
+ peerMacAddr[0] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A2_OFFSET);
+ peerMacAddr[1] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A2_OFFSET + 2);
+ peerMacAddr[2] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A2_OFFSET + 4);
+}
+
+void zfStaInitOppositeInfo(zdev_t* dev)
+{
+ int i;
+
+ zmw_get_wlan_dev(dev);
+
+ for(i=0; i<ZM_MAX_OPPOSITE_COUNT; i++)
+ {
+ wd->sta.oppositeInfo[i].valid = 0;
+ wd->sta.oppositeInfo[i].aliveCounter = ZM_IBSS_PEER_ALIVE_COUNTER;
+ }
+}
+#ifdef ZM_ENABLE_CENC
+u16_t zfStaAddIeCenc(zdev_t* dev, zbuf_t* buf, u16_t offset)
+{
+ zmw_get_wlan_dev(dev);
+
+ if (wd->sta.cencIe[1] != 0)
+ {
+ zfCopyToIntTxBuffer(dev, buf, wd->sta.cencIe, offset, wd->sta.cencIe[1]+2);
+ offset += (wd->sta.cencIe[1]+2);
+ }
+ return offset;
+}
+#endif //ZM_ENABLE_CENC
+u16_t zfStaProcessAction(zdev_t* dev, zbuf_t* buf)
+{
+ u8_t category, actionDetails;
+ zmw_get_wlan_dev(dev);
+
+ category = zmw_rx_buf_readb(dev, buf, 24);
+ actionDetails = zmw_rx_buf_readb(dev, buf, 25);
+ switch (category)
+ {
+ case 0: //Spectrum Management
+ switch(actionDetails)
+ {
+ case 0: //Measurement Request
+ break;
+ case 1: //Measurement Report
+ //ProcessActionSpectrumFrame_MeasurementReport(Adapter,pActionBody+3);
+ break;
+ case 2: //TPC request
+ //if (wd->sta.TPCEnable)
+ // zfStaUpdateDot11HTPC(dev, buf);
+ break;
+ case 3: //TPC report
+ //if (wd->sta.TPCEnable)
+ // zfStaUpdateDot11HTPC(dev, buf);
+ break;
+ case 4: //Channel Switch Announcement
+ if (wd->sta.DFSEnable)
+ zfStaUpdateDot11HDFS(dev, buf);
+ break;
+ default:
+ zm_debug_msg1("Action Frame contain not support action field ", actionDetails);
+ break;
+ }
+ break;
+ case ZM_WLAN_BLOCK_ACK_ACTION_FRAME:
+ zfAggBlockAckActionFrame(dev, buf);
+ break;
+ case 17: //Qos Management
+ break;
+ }
+
+ return 0;
+}
+
+/* Determine the time not send beacon , if more than some value ,
+ re-write the beacon start address */
+void zfReWriteBeaconStartAddress(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ wd->tickIbssSendBeacon++; // Increase 1 per 10ms .
+ zmw_leave_critical_section(dev);
+
+ if ( wd->tickIbssSendBeacon == 40 )
+ {
+// DbgPrint("20070727");
+ zfHpEnableBeacon(dev, ZM_MODE_IBSS, wd->beaconInterval, wd->dtim, (u8_t)wd->sta.atimWindow);
+ zmw_enter_critical_section(dev);
+ wd->tickIbssSendBeacon = 0;
+ zmw_leave_critical_section(dev);
+ }
+}
+
+struct zsTkipSeed* zfStaGetRxSeed(zdev_t* dev, zbuf_t* buf)
+{
+ u8_t keyIndex;
+ u8_t da0;
+
+ zmw_get_wlan_dev(dev);
+
+ /* if need not check MIC, return NULL */
+ if ( ((wd->sta.encryMode != ZM_TKIP)&&(wd->sta.encryMode != ZM_AES))||
+ (wd->sta.wpaState < ZM_STA_WPA_STATE_PK_OK) )
+ {
+ return NULL;
+ }
+
+ da0 = zmw_rx_buf_readb(dev, buf, ZM_WLAN_HEADER_A1_OFFSET);
+
+ if ((zmw_rx_buf_readb(dev, buf, 0) & 0x80) == 0x80)
+ keyIndex = zmw_rx_buf_readb(dev, buf, ZM_WLAN_HEADER_IV_OFFSET+5); /* Qos Packet*/
+ else
+ keyIndex = zmw_rx_buf_readb(dev, buf, ZM_WLAN_HEADER_IV_OFFSET+3); /* normal Packet*/
+ keyIndex = (keyIndex & 0xc0) >> 6;
+
+ return (&wd->sta.rxSeed[keyIndex]);
+}
+
+void zfStaEnableSWEncryption(zdev_t *dev, u8_t value)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->sta.SWEncryptEnable = value;
+ zfHpSWDecrypt(dev, 1);
+ zfHpSWEncrypt(dev, 1);
+}
+
+void zfStaDisableSWEncryption(zdev_t *dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->sta.SWEncryptEnable = 0;
+ zfHpSWDecrypt(dev, 0);
+ zfHpSWEncrypt(dev, 0);
+}
+
+u16_t zfComputeBssInfoWeightValue(zdev_t *dev, u8_t isBMode, u8_t isHT, u8_t isHT40, u8_t signalStrength)
+{
+ u8_t weightOfB = 0;
+ u8_t weightOfAGBelowThr = 0;
+ u8_t weightOfAGUpThr = 15;
+ u8_t weightOfN20BelowThr = 15;
+ u8_t weightOfN20UpThr = 30;
+ u8_t weightOfN40BelowThr = 16;
+ u8_t weightOfN40UpThr = 32;
+
+ zmw_get_wlan_dev(dev);
+
+ if( isBMode == 0 )
+ return (signalStrength + weightOfB); // pure b mode , do not add the weight value for this AP !
+ else
+ {
+ if( isHT == 0 && isHT40 == 0 )
+ { // a , g , b/g mode ! add the weight value 15 for this AP if it's signal strength is more than some value !
+ if( signalStrength < 18 ) // -77 dBm
+ return signalStrength + weightOfAGBelowThr;
+ else
+ return (signalStrength + weightOfAGUpThr);
+ }
+ else if( isHT == 1 && isHT40 == 0 )
+ { // 80211n mode use 20MHz
+ if( signalStrength < 23 ) // -72 dBm
+ return (signalStrength + weightOfN20BelowThr);
+ else
+ return (signalStrength + weightOfN20UpThr);
+ }
+ else // isHT == 1 && isHT40 == 1
+ { // 80211n mode use 40MHz
+ if( signalStrength < 16 ) // -79 dBm
+ return (signalStrength + weightOfN40BelowThr);
+ else
+ return (signalStrength + weightOfN40UpThr);
+ }
+ }
+}
+
+u16_t zfStaAddIbssAdditionalIE(zdev_t* dev, zbuf_t* buf, u16_t offset)
+{
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ for (i=0; i<wd->sta.ibssAdditionalIESize; i++)
+ {
+ zmw_tx_buf_writeb(dev, buf, offset++, wd->sta.ibssAdditionalIE[i]);
+ }
+
+ return offset;
+}
diff --git a/drivers/staging/otus/80211core/coid.c b/drivers/staging/otus/80211core/coid.c
new file mode 100644
index 00000000000..6007f3131f8
--- /dev/null
+++ b/drivers/staging/otus/80211core/coid.c
@@ -0,0 +1,2695 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : iod.c */
+/* */
+/* Abstract */
+/* This module contains OID functions. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/************************************************************************/
+#include "cprecomp.h"
+#include "../hal/hpreg.h"
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfiWlanQueryMacAddress */
+/* Query OWN MAC address. */
+/* */
+/* INPUTS */
+/* addr : for return MAC address */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+void zfiWlanQueryMacAddress(zdev_t* dev, u8_t* addr)
+{
+ u16_t vapId = 0;
+ zmw_get_wlan_dev(dev);
+
+ vapId = zfwGetVapId(dev);
+
+ addr[0] = (u8_t)(wd->macAddr[0] & 0xff);
+ addr[1] = (u8_t)(wd->macAddr[0] >> 8);
+ addr[2] = (u8_t)(wd->macAddr[1] & 0xff);
+ addr[3] = (u8_t)(wd->macAddr[1] >> 8);
+ addr[4] = (u8_t)(wd->macAddr[2] & 0xff);
+ if (vapId == 0xffff)
+ addr[5] = (u8_t)(wd->macAddr[2] >> 8);
+ else
+ {
+#ifdef ZM_VAPMODE_MULTILE_SSID
+ addr[5] = (u8_t)(wd->macAddr[2] >> 8); // Multiple SSID
+#else
+ addr[5] = vapId + 1 + (u8_t)(wd->macAddr[2] >> 8); //VAP
+#endif
+ }
+
+ return;
+}
+
+void zfiWlanQueryBssList(zdev_t* dev, struct zsBssList* pBssList)
+{
+ struct zsBssInfo* pBssInfo;
+ struct zsBssInfo* pDstBssInfo;
+ u8_t i;
+ u8_t* pMemList;
+ u8_t* pMemInfo;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ pMemList = (u8_t*) pBssList;
+ pMemInfo = pMemList + sizeof(struct zsBssList);
+ pBssList->head = (struct zsBssInfo*) pMemInfo;
+
+ zmw_enter_critical_section(dev);
+
+ pBssInfo = wd->sta.bssList.head;
+ pDstBssInfo = (struct zsBssInfo*) pMemInfo;
+ pBssList->bssCount = wd->sta.bssList.bssCount;
+
+ for( i=0; i<wd->sta.bssList.bssCount; i++ )
+ {
+ zfMemoryCopy((u8_t*)pDstBssInfo, (u8_t*)pBssInfo,
+ sizeof(struct zsBssInfo));
+
+ if ( pBssInfo->next != NULL )
+ {
+ pBssInfo = pBssInfo->next;
+ pDstBssInfo->next = pDstBssInfo + 1;
+ pDstBssInfo++;
+ }
+ else
+ {
+ zm_assert(i==(wd->sta.bssList.bssCount-1));
+ }
+ }
+
+ zmw_leave_critical_section(dev);
+
+ zfScanMgrScanAck(dev);
+}
+
+void zfiWlanQueryBssListV1(zdev_t* dev, struct zsBssListV1* bssListV1)
+{
+ struct zsBssInfo* pBssInfo;
+ //struct zsBssInfo* pDstBssInfo;
+ u8_t i, j, bdrop = 0, k = 0, Same_Count = 0;
+ u8_t bssid[6];
+ //u8_t* pMemList;
+ //u8_t* pMemInfo;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ bssListV1->bssCount = wd->sta.bssList.bssCount;
+
+ pBssInfo = wd->sta.bssList.head;
+ ZM_MAC_WORD_TO_BYTE(wd->sta.bssid, bssid);
+
+ for( i=0; i<wd->sta.bssList.bssCount; i++ )
+ {
+ bdrop = 0;
+ if ( zfStaIsConnected(dev)
+ && (wd->wlanMode == ZM_MODE_INFRASTRUCTURE ) )
+ {
+ for (j = 0; j < 6; j++)
+ {
+ if ( pBssInfo->bssid[j] != bssid[j] )
+ {
+ break;
+ }
+ }
+
+ if ( (j == 6)
+ &&((pBssInfo->ssid[1] == wd->sta.ssidLen) || (pBssInfo->ssid[1] == 0) )&& (pBssInfo->frequency == wd->frequency) )
+ {
+ if(pBssInfo->ssid[1] == 0)
+ pBssInfo->ssid[1] = wd->sta.ssidLen;
+
+ if(Same_Count == 0)
+ {//First meet
+ Same_Count++;
+ }
+ else
+ {//same one
+ bdrop = 1;
+ bssListV1->bssCount--;
+ }
+
+ }
+ }
+
+ if (bdrop == 0)
+ {
+ zfMemoryCopy((u8_t*)(&bssListV1->bssInfo[k]), (u8_t*)pBssInfo,
+ sizeof(struct zsBssInfo));
+
+ if(Same_Count == 1)
+ {
+ zfMemoryCopy(&(bssListV1->bssInfo[k].ssid[2]), wd->sta.ssid, wd->sta.ssidLen);
+ Same_Count++;
+ }
+
+ k++;
+ }
+
+ if ( pBssInfo->next != NULL )
+ {
+ pBssInfo = pBssInfo->next;
+ }
+ else
+ {
+ zm_assert(i==(wd->sta.bssList.bssCount-1));
+ }
+ }
+
+ zmw_leave_critical_section(dev);
+
+ zfScanMgrScanAck(dev);
+}
+
+void zfiWlanQueryAdHocCreatedBssDesc(zdev_t* dev, struct zsBssInfo *pBssInfo)
+{
+ zmw_get_wlan_dev(dev);
+
+ zfMemoryCopy((u8_t *)pBssInfo, (u8_t *)&wd->sta.ibssBssDesc, sizeof(struct zsBssInfo));
+}
+
+u8_t zfiWlanQueryAdHocIsCreator(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ return wd->sta.ibssBssIsCreator;
+}
+
+u32_t zfiWlanQuerySupportMode(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ return wd->supportMode;
+}
+
+u32_t zfiWlanQueryTransmitPower(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ u32_t ret = 0;
+
+ if (zfStaIsConnected(dev)) {
+ ret = wd->sta.connPowerInHalfDbm;
+ } else {
+ ret = zfHpGetTransmitPower(dev);
+ }
+
+ return ret;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfiWlanFlushBssList */
+/* Flush BSSID List. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* none */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2006.12 */
+/* */
+/************************************************************************/
+void zfiWlanFlushBssList(zdev_t* dev)
+{
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ /* Call zfBssInfoRefresh() twice to remove all entry */
+ zfBssInfoRefresh(dev, 1);
+ zmw_leave_critical_section(dev);
+}
+
+void zfiWlanSetWlanMode(zdev_t* dev, u8_t wlanMode)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ wd->ws.wlanMode = wlanMode;
+ zmw_leave_critical_section(dev);
+}
+
+void zfiWlanSetAuthenticationMode(zdev_t* dev, u8_t authMode)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ wd->ws.authMode = authMode;
+ zmw_leave_critical_section(dev);
+}
+
+void zfiWlanSetWepStatus(zdev_t* dev, u8_t wepStatus)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ wd->ws.wepStatus = wepStatus;
+ zmw_leave_critical_section(dev);
+
+}
+
+void zfiWlanSetSSID(zdev_t* dev, u8_t* ssid, u8_t ssidLength)
+{
+ u16_t i;
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ if ( ssidLength <= 32 )
+ {
+ zmw_enter_critical_section(dev);
+
+ wd->ws.ssidLen = ssidLength;
+ zfMemoryCopy(wd->ws.ssid, ssid, ssidLength);
+
+ if ( ssidLength < 32 )
+ {
+ wd->ws.ssid[ssidLength] = 0;
+ }
+
+ wd->ws.probingSsidList[0].ssidLen = ssidLength;
+ zfMemoryCopy(wd->ws.probingSsidList[0].ssid, ssid, ssidLength);
+ for (i=1; i<ZM_MAX_PROBE_HIDDEN_SSID_SIZE; i++)
+ {
+ wd->ws.probingSsidList[i].ssidLen = 0;
+ }
+
+ zmw_leave_critical_section(dev);
+ }
+}
+
+void zfiWlanSetFragThreshold(zdev_t* dev, u16_t fragThreshold)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ if (fragThreshold == 0)
+ { /* fragmentation is disabled */
+ wd->fragThreshold = 32767;
+ }
+ else if (fragThreshold < 256)
+ {
+ /* Minimum fragment threshold */
+ wd->fragThreshold = 256;
+ }
+ else if (fragThreshold > 2346)
+ {
+ wd->fragThreshold = 2346;
+ }
+ else
+ {
+ wd->fragThreshold = fragThreshold & 0xfffe;
+ }
+
+ zmw_leave_critical_section(dev);
+}
+
+void zfiWlanSetRtsThreshold(zdev_t* dev, u16_t rtsThreshold)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ wd->rtsThreshold = rtsThreshold;
+ zmw_leave_critical_section(dev);
+}
+
+void zfiWlanSetFrequency(zdev_t* dev, u32_t frequency, u8_t bImmediate)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ if ( bImmediate )
+ {
+ zmw_enter_critical_section(dev);
+ wd->frequency = (u16_t) (frequency/1000);
+ zmw_leave_critical_section(dev);
+ zfCoreSetFrequency(dev, wd->frequency);
+ }
+ else
+ {
+ zmw_enter_critical_section(dev);
+ if( frequency == 0 )
+ { // Auto select clean channel depend on wireless environment !
+ wd->ws.autoSetFrequency = 0;
+ }
+ wd->ws.frequency = (u16_t) (frequency/1000);
+ zmw_leave_critical_section(dev);
+ }
+}
+
+void zfiWlanSetBssid(zdev_t* dev, u8_t* bssid)
+{
+ u16_t i;
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ for (i=0; i<6; i++)
+ {
+ wd->ws.desiredBssid[i] = bssid[i];
+ }
+ wd->ws.bDesiredBssid = TRUE;
+ zmw_leave_critical_section(dev);
+
+}
+
+void zfiWlanSetBeaconInterval(zdev_t* dev,
+ u16_t beaconInterval,
+ u8_t bImmediate)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ if ( bImmediate )
+ {
+ zmw_enter_critical_section(dev);
+ wd->beaconInterval = beaconInterval;
+ zmw_leave_critical_section(dev);
+
+ /* update beacon interval here */
+ }
+ else
+ {
+ zmw_enter_critical_section(dev);
+ wd->ws.beaconInterval = beaconInterval;
+ zmw_leave_critical_section(dev);
+ }
+}
+
+
+void zfiWlanSetDtimCount(zdev_t* dev, u8_t dtim)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ if (dtim > 0)
+ {
+ wd->ws.dtim = dtim;
+ }
+ zmw_leave_critical_section(dev);
+}
+
+
+void zfiWlanSetAtimWindow(zdev_t* dev, u16_t atimWindow, u8_t bImmediate)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ if ( bImmediate )
+ {
+ zmw_enter_critical_section(dev);
+ wd->sta.atimWindow = atimWindow;
+ zmw_leave_critical_section(dev);
+
+ /* atim window here */
+ }
+ else
+ {
+ zmw_enter_critical_section(dev);
+ wd->ws.atimWindow = atimWindow;
+ zmw_leave_critical_section(dev);
+ }
+}
+
+
+void zfiWlanSetEncryMode(zdev_t* dev, u8_t encryMode)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ /* Hostapd Issue */
+ if ((wd->ws.encryMode != ZM_AES) && (wd->ws.encryMode != ZM_TKIP))
+ wd->ws.encryMode = encryMode;
+ }
+ else
+ wd->ws.encryMode = encryMode;
+ zmw_leave_critical_section(dev);
+}
+
+void zfiWlanSetDefaultKeyId(zdev_t* dev, u8_t keyId)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->sta.keyId = keyId;
+}
+
+u8_t zfiWlanQueryIsPKInstalled(zdev_t *dev, u8_t *staMacAddr)
+{
+ u8_t isInstalled = 0;
+
+#if 1
+//#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ u8_t res, peerIdx;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ res = zfStaFindOppositeByMACAddr(dev, (u16_t *)staMacAddr, &peerIdx);
+ if( res == 0 )
+ {
+ isInstalled = wd->sta.oppositeInfo[peerIdx].pkInstalled;
+ }
+ zmw_leave_critical_section(dev);
+//#endif
+#endif
+
+ return isInstalled;
+}
+
+u8_t zfiWlanSetKey(zdev_t* dev, struct zsKeyInfo keyInfo)
+{
+ u16_t broadcast[3] = {0xffff, 0xffff, 0xffff};
+ u32_t* key;
+ u8_t encryMode = ZM_NO_WEP;
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ u8_t encryType = ZM_NO_WEP;
+#endif
+ u8_t micKey[16];
+ u16_t id = 0;
+ u8_t vapId, i, addr[6];
+ u8_t userIdx=0;
+
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ /* Determine opposite exist or not */
+ u8_t res, peerIdx;
+// u8_t userIdx=0;
+
+ zmw_get_wlan_dev(dev);
+
+ if ( wd->sta.ibssWpa2Psk == 1 )
+ {
+ zmw_enter_critical_section(dev);
+ res = zfStaFindOppositeByMACAddr(dev, (u16_t*)keyInfo.macAddr, &peerIdx);
+ if( res == 0 )
+ {
+ userIdx = peerIdx;
+ if ( wd->sta.oppositeInfo[userIdx].camIdx == 0xff )
+ wd->sta.oppositeInfo[userIdx].camIdx = userIdx;
+ }
+ zmw_leave_critical_section(dev);
+ }
+#else
+ zmw_get_wlan_dev(dev);
+#endif
+
+ if ( keyInfo.flag & ZM_KEY_FLAG_AUTHENTICATOR )
+ { /* set key by authenticator */
+ /* set pairwise key */
+ if (keyInfo.flag & ZM_KEY_FLAG_PK)
+ {
+ /* Find STA's information */
+ if ((id = zfApFindSta(dev, keyInfo.macAddr)) == 0xffff)
+ {
+ /* Can't STA in the staTable */
+ return ZM_STATUS_FAILURE;
+ }
+
+ wd->ap.staTable[id].iv16 = 0;
+ wd->ap.staTable[id].iv32 = 0;
+
+ if (keyInfo.keyLength == 32)
+ { /* TKIP */
+ //u8_t KeyRsc[6] = {0, 0, 0, 0, 0, 0};
+
+ /* In the current AP mode, we set KeyRsc to zero */
+ //zfTkipInit(keyInfo.key, (u8_t*) wd->macAddr,
+ // &(wd->ap.staTable[id].txSeed), KeyRsc);
+ //zfTkipInit(keyInfo.key, (u8_t*) keyInfo.macAddr,
+ // &(wd->ap.staTable[id].rxSeed), KeyRsc);
+#ifdef ZM_ENABLE_CENC
+ if (keyInfo.flag & ZM_KEY_FLAG_CENC)
+ {
+ zm_debug_msg0("Set CENC pairwise Key");
+
+ wd->ap.staTable[id].encryMode = ZM_CENC;
+
+ /* Reset txiv and rxiv */
+ wd->ap.staTable[id].txiv[0] = 0x5c365c37;
+ wd->ap.staTable[id].txiv[1] = 0x5c365c36;
+ wd->ap.staTable[id].txiv[2] = 0x5c365c36;
+ wd->ap.staTable[id].txiv[3] = 0x5c365c36;
+
+ wd->ap.staTable[id].rxiv[0] = 0x5c365c36;
+ wd->ap.staTable[id].rxiv[1] = 0x5c365c36;
+ wd->ap.staTable[id].rxiv[2] = 0x5c365c36;
+ wd->ap.staTable[id].rxiv[3] = 0x5c365c36;
+
+ /* Set Key Index */
+ wd->ap.staTable[id].cencKeyIdx = keyInfo.keyIndex;
+
+ //zfCoreSetKey(dev, id+1, 1, ZM_CENC, (u16_t *)keyInfo.macAddr,
+ // (u32_t*) &keyInfo.key[16]);
+ }
+ else
+#endif //ZM_ENABLE_CENC
+ {
+ wd->ap.staTable[id].encryMode = ZM_TKIP;
+
+ zfMemoryCopy(micKey, &keyInfo.key[16], 8);
+ zfMemoryCopy(&micKey[8], &keyInfo.key[24], 8);
+
+ //zfCoreSetKey(dev, id+1, 1, ZM_TKIP, (u16_t *)keyInfo.macAddr,
+ // (u32_t*) micKey);
+
+ /* For fragmentation, we use software MIC */
+ zfMemoryCopy((u8_t *)&(wd->ap.staTable[id].txMicKey), &(keyInfo.key[16]), 8);
+ zfMemoryCopy((u8_t *)&(wd->ap.staTable[id].rxMicKey), &(keyInfo.key[24]), 8);
+
+ }
+ }
+ else if (keyInfo.keyLength == 16)
+ { /* AES */
+ wd->ap.staTable[id].encryMode = ZM_AES;
+ }
+ else if (keyInfo.keyLength == 0)
+ {
+ /* Clear Key Info */
+ zfApClearStaKey(dev, (u16_t *)keyInfo.macAddr);
+
+ return ZM_STATUS_SUCCESS;
+ }
+ else
+ {
+ return ZM_STATUS_FAILURE;
+ }
+
+ //zfCoreSetKey(dev, id+1, 0, wd->ap.staTable[id].encryMode,
+ // (u16_t *)keyInfo.macAddr, (u32_t*) keyInfo.key);
+ zfHpSetApPairwiseKey(dev, (u16_t *)keyInfo.macAddr,
+ wd->ap.staTable[id].encryMode, (u32_t*) keyInfo.key,
+ (u32_t*) &keyInfo.key[16], id+1);
+ wd->ap.staTable[id].keyIdx = id + 1 + 4;
+ }
+ else if (keyInfo.flag & ZM_KEY_FLAG_GK)
+ {
+ vapId = keyInfo.vapId;
+
+ wd->ap.iv16[vapId] = 0;
+ wd->ap.iv32[vapId] = 0;
+
+ if (keyInfo.keyLength == 32)
+ { /* TKIP */
+ //u8_t KeyRsc[6] = {0, 0, 0, 0, 0, 0};
+
+ //zfTkipInit(keyInfo.key, (u8_t*) wd->macAddr,
+ // &(wd->ap.bcSeed), KeyRsc);
+#ifdef ZM_ENABLE_CENC
+ if (keyInfo.flag & ZM_KEY_FLAG_CENC)
+ {
+ encryMode = ZM_CENC;
+ zm_debug_msg0("Set CENC group Key");
+
+ /* Reset txiv and rxiv */
+ wd->ap.txiv[vapId][0] = 0x5c365c36;
+ wd->ap.txiv[vapId][1] = 0x5c365c36;
+ wd->ap.txiv[vapId][2] = 0x5c365c36;
+ wd->ap.txiv[vapId][3] = 0x5c365c36;
+
+ //zfCoreSetKey(dev, 0, 1, ZM_CENC, keyInfo.vapAddr,
+ // (u32_t*) &keyInfo.key[16]);
+ key = (u32_t*) keyInfo.key;
+ }
+ else
+#endif //ZM_ENABLE_CENC
+ {
+ encryMode = ZM_TKIP;
+ key = (u32_t *)keyInfo.key;
+
+ /* set MIC key to HMAC */
+ //zfCoreSetKey(dev, 0, 1, ZM_TKIP, broadcast,
+ // (u32_t*) (&keyInfo.key[16]));
+ //zfCoreSetKey(dev, 0, 1, ZM_TKIP, keyInfo.vapAddr,
+ // (u32_t*) (&keyInfo.key[16]));
+
+ zfMicSetKey(&(keyInfo.key[16]), &(wd->ap.bcMicKey[0]));
+ key = (u32_t*) keyInfo.key;
+ }
+ }
+ else if (keyInfo.keyLength == 16)
+ { /* AES */
+ encryMode = ZM_AES;
+ key = (u32_t *)keyInfo.key;
+ zm_debug_msg0("CWY - Set AES Group Key");
+ }
+ else if (keyInfo.keyLength == 0)
+ {
+ /* Clear Key Info */
+ zfApClearStaKey(dev, broadcast);
+
+ /* Turn off WEP bit in the capability field */
+ wd->ap.capab[vapId] &= 0xffef;
+
+ return ZM_STATUS_SUCCESS;
+ }
+ else
+ { /* WEP */
+ if (keyInfo.keyLength == 5)
+ {
+ encryMode = ZM_WEP64;
+ }
+ else if (keyInfo.keyLength == 13)
+ {
+ encryMode = ZM_WEP128;
+ }
+ else if (keyInfo.keyLength == 29)
+ {
+ encryMode = ZM_WEP256;
+ }
+
+ key = (u32_t*) keyInfo.key;
+ }
+
+ // Modification for CAM not support VAP search
+ //zfCoreSetKey(dev, 0, 0, encryMode, broadcast, key);
+ //zfCoreSetKey(dev, 0, 0, encryMode, wd->macAddr, key);
+ //zfCoreSetKey(dev, 0, 0, encryMode, keyInfo.vapAddr, key);
+ zfHpSetApGroupKey(dev, wd->macAddr, encryMode,
+ key, (u32_t*) &keyInfo.key[16], vapId);
+
+ //zfiWlanSetEncryMode(dev, encryMode);
+ wd->ws.encryMode = encryMode;
+
+ /* set the multicast address encryption type */
+ wd->ap.encryMode[vapId] = encryMode;
+
+ /* set the multicast key index */
+ wd->ap.bcKeyIndex[vapId] = keyInfo.keyIndex;
+ wd->ap.bcHalKeyIdx[vapId] = vapId + 60;
+
+ /* Turn on WEP bit in the capability field */
+ wd->ap.capab[vapId] |= 0x10;
+ }
+ }
+ else
+ { /* set by supplicant */
+
+ if ( keyInfo.flag & ZM_KEY_FLAG_PK )
+ { /* set pairwise key */
+
+ //zfTkipInit(keyInfo.key, (u8_t*) wd->macAddr,
+ // &wd->sta.txSeed, keyInfo.initIv);
+ //zfTkipInit(keyInfo.key, (u8_t*) wd->sta.bssid,
+ // &wd->sta.rxSeed[keyInfo.keyIndex], keyInfo.initIv);
+
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ if ( wd->sta.ibssWpa2Psk == 1 )
+ {
+ /* unicast -- > pairwise key */
+ wd->sta.oppositeInfo[userIdx].iv16 = 0;
+ wd->sta.oppositeInfo[userIdx].iv32 = 0;
+ }
+ else
+ {
+ wd->sta.iv16 = 0;
+ wd->sta.iv32 = 0;
+ }
+
+ wd->sta.oppositeInfo[userIdx].pkInstalled = 1;
+#else
+ wd->sta.iv16 = 0;
+ wd->sta.iv32 = 0;
+
+ wd->sta.oppositeInfo[userIdx].pkInstalled = 1;
+#endif
+
+ if ( keyInfo.keyLength == 32 )
+ { /* TKIP */
+ zfTkipInit(keyInfo.key, (u8_t*) wd->macAddr,
+ &wd->sta.txSeed, keyInfo.initIv);
+ zfTkipInit(keyInfo.key, (u8_t*) wd->sta.bssid,
+ &wd->sta.rxSeed[keyInfo.keyIndex], keyInfo.initIv);
+
+#ifdef ZM_ENABLE_CENC
+ if (keyInfo.flag & ZM_KEY_FLAG_CENC)
+ {
+ zm_debug_msg0("Set CENC pairwise Key");
+
+ wd->sta.encryMode = ZM_CENC;
+
+ /* Reset txiv and rxiv */
+ wd->sta.txiv[0] = 0x5c365c36;
+ wd->sta.txiv[1] = 0x5c365c36;
+ wd->sta.txiv[2] = 0x5c365c36;
+ wd->sta.txiv[3] = 0x5c365c36;
+
+ wd->sta.rxiv[0] = 0x5c365c37;
+ wd->sta.rxiv[1] = 0x5c365c36;
+ wd->sta.rxiv[2] = 0x5c365c36;
+ wd->sta.rxiv[3] = 0x5c365c36;
+
+ /* Set Key Index */
+ wd->sta.cencKeyId = keyInfo.keyIndex;
+
+ //zfCoreSetKey(dev, id+1, 1, ZM_CENC, (u16_t *)keyInfo.macAddr,
+ // (u32_t*) &keyInfo.key[16]);
+ }
+ else
+#endif //ZM_ENABLE_CENC
+ {
+ wd->sta.encryMode = ZM_TKIP;
+
+ //zfCoreSetKey(dev, 0, 1, ZM_TKIP, wd->sta.bssid,
+ // (u32_t*) &keyInfo.key[16]);
+
+ zfMicSetKey(&keyInfo.key[16], &wd->sta.txMicKey);
+ zfMicSetKey(&keyInfo.key[24],
+ &wd->sta.rxMicKey[keyInfo.keyIndex]);
+ }
+ }
+ else if ( keyInfo.keyLength == 16 )
+ { /* AES */
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ if ( wd->sta.ibssWpa2Psk == 1 )
+ {
+ wd->sta.oppositeInfo[userIdx].encryMode = ZM_AES;
+ encryType = wd->sta.oppositeInfo[userIdx].encryMode;
+ }
+ else
+ {
+ wd->sta.encryMode = ZM_AES;
+ encryType = wd->sta.encryMode;
+ }
+#else
+ wd->sta.encryMode = ZM_AES;
+#endif
+ }
+ else
+ {
+ return ZM_STATUS_FAILURE;
+ }
+
+ /* user 0 */
+ //zfCoreSetKey(dev, 0, 0, wd->sta.encryMode,
+ // wd->sta.bssid, (u32_t*) keyInfo.key);
+ //zfHpSetStaPairwiseKey(dev, wd->sta.bssid, wd->sta.encryMode,
+ // (u32_t*) keyInfo.key, (u32_t*) &keyInfo.key[16]);
+
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ if ( (keyInfo.keyLength==16) && (wd->sta.ibssWpa2Psk==1) )
+ { /* If not AES-CCMP and ibss network , use traditional */
+ zfHpSetPerUserKey(dev,
+ userIdx,
+ keyInfo.keyIndex, // key id == 0 ( Pairwise key = 0 )
+ (u8_t*)keyInfo.macAddr, // RX need Source Address ( Address 2 )
+ encryType,
+// wd->sta.encryMode,
+ (u32_t*) keyInfo.key, (u32_t*) &keyInfo.key[16]);
+
+ wd->sta.oppositeInfo[userIdx].wpaState = ZM_STA_WPA_STATE_PK_OK ;
+ }
+ else
+ {/* Big Endian and Little Endian Compatibility */
+ for (i = 0; i < 3; i++)
+ {
+ addr[2 * i] = wd->sta.bssid[i] & 0xff;
+ addr[2 * i + 1] = wd->sta.bssid[i] >> 8;
+ }
+ zfHpSetPerUserKey(dev,
+ ZM_USER_KEY_PK, // user id
+ 0, // key id
+ addr,//(u8_t *)wd->sta.bssid,
+ wd->sta.encryMode,
+ (u32_t*) keyInfo.key, (u32_t*) &keyInfo.key[16]);
+
+ wd->sta.keyId = 4;
+ }
+#else
+ /* Big Endian and Little Endian Compatibility */
+ for (i = 0; i < 3; i++)
+ {
+ addr[2 * i] = wd->sta.bssid[i] & 0xff;
+ addr[2 * i + 1] = wd->sta.bssid[i] >> 8;
+ }
+ zfHpSetPerUserKey(dev,
+ ZM_USER_KEY_PK, // user id
+ 0, // key id
+ addr,//(u8_t *)wd->sta.bssid,
+ wd->sta.encryMode,
+ (u32_t*) keyInfo.key, (u32_t*) &keyInfo.key[16]);
+
+ wd->sta.keyId = 4;
+#endif
+
+ wd->sta.wpaState = ZM_STA_WPA_STATE_PK_OK;
+ }
+ else if ( keyInfo.flag & ZM_KEY_FLAG_GK )
+ { /* set group key */
+
+ zfTkipInit(keyInfo.key, (u8_t*) wd->sta.bssid,
+ &wd->sta.rxSeed[keyInfo.keyIndex], keyInfo.initIv);
+
+ if ( keyInfo.keyLength == 32 )
+ { /* TKIP */
+#ifdef ZM_ENABLE_CENC
+ if (keyInfo.flag & ZM_KEY_FLAG_CENC)
+ {
+ encryMode = ZM_CENC;
+ zm_debug_msg0("Set CENC group Key");
+
+ /* Reset txiv and rxiv */
+ wd->sta.rxivGK[0] = 0x5c365c36;
+ wd->sta.rxivGK[1] = 0x5c365c36;
+ wd->sta.rxivGK[2] = 0x5c365c36;
+ wd->sta.rxivGK[3] = 0x5c365c36;
+
+ //zfCoreSetKey(dev, 0, 1, ZM_CENC, keyInfo.vapAddr,
+ // (u32_t*) &keyInfo.key[16]);
+ key = (u32_t*) keyInfo.key;
+ }
+ else
+#endif //ZM_ENABLE_CENC
+ {
+ encryMode = ZM_TKIP;
+ key = (u32_t*) wd->sta.rxSeed[keyInfo.keyIndex].tk;
+
+ if ( !(keyInfo.flag & ZM_KEY_FLAG_INIT_IV) )
+ {
+ wd->sta.rxSeed[keyInfo.keyIndex].iv16 = 0;
+ wd->sta.rxSeed[keyInfo.keyIndex].iv32 = 0;
+ }
+
+ /* set MIC key to HMAC */
+ //zfCoreSetKey(dev, 8, 1, ZM_TKIP, broadcast,
+ // (u32_t*) (&keyInfo.key[16]));
+
+ zfMicSetKey(&keyInfo.key[24],
+ &wd->sta.rxMicKey[keyInfo.keyIndex]);
+ }
+ }
+ else if ( keyInfo.keyLength == 16 )
+ { /* AES */
+ encryMode = ZM_AES;
+ //key = (u32_t*) wd->sta.rxSeed[keyInfo.keyIndex].tk;
+ }
+ else
+ { /* WEP */
+ if ( keyInfo.keyLength == 5 )
+ {
+ encryMode = ZM_WEP64;
+ }
+ else if ( keyInfo.keyLength == 13 )
+ {
+ encryMode = ZM_WEP128;
+ }
+ else if ( keyInfo.keyLength == 29 )
+ {
+ encryMode = ZM_WEP256;
+ }
+
+ key = (u32_t*) keyInfo.key;
+ }
+
+ /* user 8 */
+ //zfCoreSetKey(dev, 8, 0, encryMode, broadcast, key);
+ //zfHpSetStaGroupKey(dev, broadcast, encryMode,
+ // (u32_t*) keyInfo.key, (u32_t*) (&keyInfo.key[16]));
+
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ if ( (keyInfo.keyLength==16) && (wd->sta.ibssWpa2Psk==1) )
+ {/* If not AES-CCMP and ibss network , use traditional */
+ zfHpSetPerUserKey(dev,
+ userIdx,
+ keyInfo.keyIndex, // key id
+ // (u8_t *)broadcast, // for only 2 stations IBSS netwrl ( A2 )
+ (u8_t*)keyInfo.macAddr, // for multiple ( > 2 ) stations IBSS network ( A2 )
+ encryMode,
+ (u32_t*) keyInfo.key, (u32_t*) &keyInfo.key[16]);
+ }
+ else
+ {
+ zfHpSetPerUserKey(dev,
+ ZM_USER_KEY_GK, // user id
+ 0, // key id
+ (u8_t *)broadcast,
+ encryMode,
+ (u32_t*) keyInfo.key, (u32_t*) &keyInfo.key[16]);
+
+ wd->sta.wpaState = ZM_STA_WPA_STATE_GK_OK;
+ }
+#else
+ zfHpSetPerUserKey(dev,
+ ZM_USER_KEY_GK, // user id
+ 0, // key id
+ (u8_t *)broadcast,
+ encryMode,
+ (u32_t*) keyInfo.key, (u32_t*) &keyInfo.key[16]);
+
+ wd->sta.wpaState = ZM_STA_WPA_STATE_GK_OK;
+#endif
+ }
+ else
+ { /* legacy WEP */
+ zm_debug_msg0("legacy WEP");
+
+ if ( keyInfo.keyIndex >= 4 )
+ {
+ return ZM_STATUS_FAILURE;
+ }
+
+ if ( keyInfo.keyLength == 5 )
+ {
+ zm_debug_msg0("WEP 64");
+
+ encryMode = ZM_WEP64;
+ }
+ else if ( keyInfo.keyLength == 13 )
+ {
+ zm_debug_msg0("WEP 128");
+
+ encryMode = ZM_WEP128;
+ }
+ else if ( keyInfo.keyLength == 32 )
+ {
+ /* TKIP */
+ #if 0
+ // Don't reset the IV since some AP would fail in IV check and drop our connection
+ if ( wd->sta.wpaState != ZM_STA_WPA_STATE_PK_OK )
+ {
+ wd->sta.iv16 = 0;
+ wd->sta.iv32 = 0;
+ }
+ #endif
+
+ encryMode = ZM_TKIP;
+
+ zfTkipInit(keyInfo.key, (u8_t*) wd->sta.bssid,
+ &wd->sta.rxSeed[keyInfo.keyIndex], keyInfo.initIv);
+ zfMicSetKey(&keyInfo.key[24],
+ &wd->sta.rxMicKey[keyInfo.keyIndex]);
+ }
+ else if ( keyInfo.keyLength == 16 )
+ {
+ /* AES */
+ #if 0
+ // Don't reset the IV since some AP would fail in IV check and drop our connection
+ if ( wd->sta.wpaState != ZM_STA_WPA_STATE_PK_OK )
+ {
+ /* broadcast -- > group key */
+ /* Only initialize when set our default key ! */
+ wd->sta.iv16 = 0;
+ wd->sta.iv32 = 0;
+ }
+ #endif
+
+ encryMode = ZM_AES;
+ }
+ else if ( keyInfo.keyLength == 29 )
+ {
+ zm_debug_msg0("WEP 256");
+
+ encryMode = ZM_WEP256;
+ //zfCoreSetKey(dev, 64, 1, wd->sta.encryMode,
+ // wd->sta.bssid, (u32_t*) (&keyInfo.key[16]));
+ }
+ else
+ {
+ return ZM_STATUS_FAILURE;
+ }
+
+ {
+ u8_t i;
+
+ zm_debug_msg0("key = ");
+ for(i = 0; i < keyInfo.keyLength; i++)
+ {
+ zm_debug_msg2("", keyInfo.key[i]);
+ }
+ }
+
+ if ( keyInfo.flag & ZM_KEY_FLAG_DEFAULT_KEY )
+ {
+ //for WEP default key 1~3 and ATOM platform--CWYang(+)
+ vapId = 0;
+ wd->ap.bcHalKeyIdx[vapId] = keyInfo.keyIndex;
+ wd->ap.bcKeyIndex[vapId] = keyInfo.keyIndex;
+ wd->sta.keyId = keyInfo.keyIndex;
+ }
+
+ if(encryMode == ZM_TKIP)
+ {
+ if(wd->TKIP_Group_KeyChanging == 0x1)
+ {
+ zm_debug_msg0("Countermeasure : Cancel Old Timer ");
+ zfTimerCancel(dev, ZM_EVENT_SKIP_COUNTERMEASURE);
+ }
+ else
+ {
+ zm_debug_msg0("Countermeasure : Create New Timer ");
+ }
+
+ wd->TKIP_Group_KeyChanging = 0x1;
+ zfTimerSchedule(dev, ZM_EVENT_SKIP_COUNTERMEASURE, 150);
+ }
+
+
+
+ //------------------------------------------------------------------------
+
+ /* use default key */
+ //zfCoreSetKey(dev, ZM_USER_KEY_DEFAULT+keyInfo.keyIndex, 0,
+ // wd->sta.encryMode, wd->sta.bssid, (u32_t*) keyInfo.key);
+
+ if ( encryMode == ZM_TKIP ||
+ encryMode == ZM_AES )
+ {
+ zfHpSetDefaultKey(dev, keyInfo.keyIndex, encryMode,
+ (u32_t*) keyInfo.key, (u32_t*) &keyInfo.key[16]);
+
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ if ( (keyInfo.keyLength==16) && (wd->sta.ibssWpa2Psk==1) )
+ {/* If not AES-CCMP and ibss network , use traditional */
+ wd->sta.wpaState = ZM_STA_WPA_STATE_PK_OK;
+ }
+ else
+ {
+ if (wd->sta.wpaState == ZM_STA_WPA_STATE_PK_OK)
+ wd->sta.wpaState = ZM_STA_WPA_STATE_GK_OK;
+ else
+ {
+ wd->sta.wpaState = ZM_STA_WPA_STATE_PK_OK;
+ wd->sta.encryMode = encryMode;
+ wd->ws.encryMode = encryMode;
+ }
+ }
+#else
+ if (wd->sta.wpaState == ZM_STA_WPA_STATE_PK_OK)
+ wd->sta.wpaState = ZM_STA_WPA_STATE_GK_OK;
+ else if ( wd->sta.wpaState == ZM_STA_WPA_STATE_INIT )
+ {
+ wd->sta.wpaState = ZM_STA_WPA_STATE_PK_OK;
+ wd->sta.encryMode = encryMode;
+ wd->ws.encryMode = encryMode;
+ }
+#endif
+ }
+ else
+ {
+ zfHpSetDefaultKey(dev, keyInfo.keyIndex, encryMode,
+ (u32_t*) keyInfo.key, NULL);
+
+ /* Save key for software WEP */
+ zfMemoryCopy(wd->sta.wepKey[keyInfo.keyIndex], keyInfo.key,
+ keyInfo.keyLength);
+
+ /* TODO: Check whether we need to save the SWEncryMode */
+ wd->sta.SWEncryMode[keyInfo.keyIndex] = encryMode;
+
+ wd->sta.encryMode = encryMode;
+ wd->ws.encryMode = encryMode;
+ }
+ }
+ }
+
+// wd->sta.flagKeyChanging = 1;
+ return ZM_STATUS_SUCCESS;
+}
+
+/* PSEUDO test */
+u8_t zfiWlanPSEUDOSetKey(zdev_t* dev, struct zsKeyInfo keyInfo)
+{
+ //u16_t broadcast[3] = {0xffff, 0xffff, 0xffff};
+ //u32_t* key;
+ u8_t micKey[16];
+
+ zmw_get_wlan_dev(dev);
+
+ switch (keyInfo.keyLength)
+ {
+ case 5:
+ wd->sta.encryMode = ZM_WEP64;
+ /* use default key */
+ zfCoreSetKey(dev, 64, 0, ZM_WEP64, (u16_t *)keyInfo.macAddr, (u32_t*) keyInfo.key);
+ break;
+
+ case 13:
+ wd->sta.encryMode = ZM_WEP128;
+ /* use default key */
+ zfCoreSetKey(dev, 64, 0, ZM_WEP128, (u16_t *)keyInfo.macAddr, (u32_t*) keyInfo.key);
+ break;
+
+ case 29:
+ wd->sta.encryMode = ZM_WEP256;
+ /* use default key */
+ zfCoreSetKey(dev, 64, 1, ZM_WEP256, (u16_t *)keyInfo.macAddr, (u32_t*) (&keyInfo.key[16]));
+ zfCoreSetKey(dev, 64, 0, ZM_WEP256, (u16_t *)keyInfo.macAddr, (u32_t*) keyInfo.key);
+ break;
+
+ case 16:
+ wd->sta.encryMode = ZM_AES;
+ //zfCoreSetKey(dev, 0, 0, ZM_AES, (u16_t *)keyInfo.macAddr, (u32_t*) keyInfo.key);
+ zfCoreSetKey(dev, 64, 0, ZM_AES, (u16_t *)keyInfo.macAddr, (u32_t*) keyInfo.key);
+ break;
+
+ case 32:
+#ifdef ZM_ENABLE_CENC
+ if (keyInfo.flag & ZM_KEY_FLAG_CENC)
+ {
+ u16_t boardcastAddr[3] = {0xffff, 0xffff, 0xffff};
+ u16_t Addr_a[] = { 0x0000, 0x0080, 0x0901};
+ u16_t Addr_b[] = { 0x0000, 0x0080, 0x0902};
+ /* CENC test: user0,1 and user2 for boardcast */
+ wd->sta.encryMode = ZM_CENC;
+ zfCoreSetKey(dev, 0, 1, ZM_CENC, (u16_t *)Addr_a, (u32_t*) (&keyInfo.key[16]));
+ zfCoreSetKey(dev, 0, 0, ZM_CENC, (u16_t *)Addr_a, (u32_t*) keyInfo.key);
+
+ zfCoreSetKey(dev, 1, 1, ZM_CENC, (u16_t *)Addr_b, (u32_t*) (&keyInfo.key[16]));
+ zfCoreSetKey(dev, 1, 0, ZM_CENC, (u16_t *)Addr_b, (u32_t*) keyInfo.key);
+
+ zfCoreSetKey(dev, 2, 1, ZM_CENC, (u16_t *)boardcastAddr, (u32_t*) (&keyInfo.key[16]));
+ zfCoreSetKey(dev, 2, 0, ZM_CENC, (u16_t *)boardcastAddr, (u32_t*) keyInfo.key);
+
+ /* Initialize PN sequence */
+ wd->sta.txiv[0] = 0x5c365c36;
+ wd->sta.txiv[1] = 0x5c365c36;
+ wd->sta.txiv[2] = 0x5c365c36;
+ wd->sta.txiv[3] = 0x5c365c36;
+ }
+ else
+#endif //ZM_ENABLE_CENC
+ {
+ wd->sta.encryMode = ZM_TKIP;
+ zfCoreSetKey(dev, 64, 1, ZM_TKIP, (u16_t *)keyInfo.macAddr, (u32_t*) micKey);
+ zfCoreSetKey(dev, 64, 0, ZM_TKIP, (u16_t *)keyInfo.macAddr, (u32_t*) keyInfo.key);
+ }
+ break;
+ default:
+ wd->sta.encryMode = ZM_NO_WEP;
+ }
+
+ return ZM_STATUS_SUCCESS;
+}
+
+void zfiWlanSetPowerSaveMode(zdev_t* dev, u8_t mode)
+{
+#if 0
+ zmw_get_wlan_dev(dev);
+
+ wd->sta.powerSaveMode = mode;
+
+ /* send null data with PwrBit to inform AP */
+ if ( mode > ZM_STA_PS_NONE )
+ {
+ if ( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ {
+ zfSendNullData(dev, 1);
+ }
+
+ /* device into PS mode */
+ zfPSDeviceSleep(dev);
+ }
+#endif
+
+ zfPowerSavingMgrSetMode(dev, mode);
+}
+
+void zfiWlanSetMacAddress(zdev_t* dev, u16_t* mac)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->macAddr[0] = mac[0];
+ wd->macAddr[1] = mac[1];
+ wd->macAddr[2] = mac[2];
+
+ zfHpSetMacAddress(dev, mac, 0);
+}
+
+u8_t zfiWlanQueryWlanMode(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ return wd->wlanMode;
+}
+
+u8_t zfiWlanQueryAdapterState(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ return wd->state;
+}
+
+u8_t zfiWlanQueryAuthenticationMode(zdev_t* dev, u8_t bWrapper)
+{
+ u8_t authMode;
+
+ zmw_get_wlan_dev(dev);
+
+ if ( bWrapper )
+ {
+ authMode = wd->ws.authMode;
+ }
+ else
+ {
+ //authMode = wd->sta.authMode;
+ authMode = wd->sta.currentAuthMode;
+ }
+
+ return authMode;
+}
+
+u8_t zfiWlanQueryWepStatus(zdev_t* dev, u8_t bWrapper)
+{
+ u8_t wepStatus;
+
+ zmw_get_wlan_dev(dev);
+
+ if ( bWrapper )
+ {
+ wepStatus = wd->ws.wepStatus;
+ }
+ else
+ {
+ wepStatus = wd->sta.wepStatus;
+ }
+
+ return wepStatus;
+}
+
+void zfiWlanQuerySSID(zdev_t* dev, u8_t* ssid, u8_t* pSsidLength)
+{
+ u16_t vapId = 0;
+ zmw_get_wlan_dev(dev);
+
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ vapId = zfwGetVapId(dev);
+
+ if (vapId == 0xffff)
+ {
+ *pSsidLength = wd->ap.ssidLen[0];
+ zfMemoryCopy(ssid, wd->ap.ssid[0], wd->ap.ssidLen[0]);
+ }
+ else
+ {
+ *pSsidLength = wd->ap.ssidLen[vapId + 1];
+ zfMemoryCopy(ssid, wd->ap.ssid[vapId + 1], wd->ap.ssidLen[vapId + 1]);
+ }
+ }
+ else
+ {
+ *pSsidLength = wd->sta.ssidLen;
+ zfMemoryCopy(ssid, wd->sta.ssid, wd->sta.ssidLen);
+ }
+}
+
+u16_t zfiWlanQueryFragThreshold(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ return wd->fragThreshold;
+}
+
+u16_t zfiWlanQueryRtsThreshold(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ return wd->rtsThreshold;
+}
+
+u32_t zfiWlanQueryFrequency(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ return (wd->frequency*1000);
+}
+
+/***********************************************************
+ * Function: zfiWlanQueryCurrentFrequency
+ * Return value:
+ * - 0 : no validate current frequency
+ * - (>0): current frequency depend on "qmode"
+ * Input:
+ * - qmode:
+ * 0: return value depend on the support mode, this
+ qmode is use to solve the bug #31223
+ * 1: return the actually current frequency
+ ***********************************************************/
+u32_t zfiWlanQueryCurrentFrequency(zdev_t* dev, u8_t qmode)
+{
+ u32_t frequency;
+
+ zmw_get_wlan_dev(dev);
+
+ switch (qmode)
+ {
+ case 0:
+ if (wd->sta.currentFrequency > 3000)
+ {
+ if (wd->supportMode & ZM_WIRELESS_MODE_5)
+ {
+ frequency = wd->sta.currentFrequency;
+ }
+ else if (wd->supportMode & ZM_WIRELESS_MODE_24)
+ {
+ frequency = zfChGetFirst2GhzChannel(dev);
+ }
+ else
+ {
+ frequency = 0;
+ }
+ }
+ else
+ {
+ if (wd->supportMode & ZM_WIRELESS_MODE_24)
+ {
+ frequency = wd->sta.currentFrequency;
+ }
+ else if (wd->supportMode & ZM_WIRELESS_MODE_5)
+ {
+ frequency = zfChGetLast5GhzChannel(dev);
+ }
+ else
+ {
+ frequency = 0;
+ }
+ }
+ break;
+
+ case 1:
+ frequency = wd->sta.currentFrequency;
+ break;
+
+ default:
+ frequency = 0;
+ }
+
+ return (frequency*1000);
+}
+
+u32_t zfiWlanQueryFrequencyAttribute(zdev_t* dev, u32_t freq)
+{
+ zmw_get_wlan_dev(dev);
+
+ u8_t i;
+ u16_t frequency = (u16_t) (freq/1000);
+ u32_t ret = 0;
+
+ for (i = 0; i < wd->regulationTable.allowChannelCnt; i++)
+ {
+ if ( wd->regulationTable.allowChannel[i].channel == frequency )
+ {
+ ret = wd->regulationTable.allowChannel[i].channelFlags;
+ }
+ }
+
+ return ret;
+}
+
+/* BandWidth 0=>20 1=>40 */
+/* ExtOffset 0=>20 1=>high control 40 3=>low control 40 */
+void zfiWlanQueryFrequencyHT(zdev_t* dev, u32_t *bandWidth, u32_t *extOffset)
+{
+ zmw_get_wlan_dev(dev);
+
+ *bandWidth = wd->BandWidth40;
+ *extOffset = wd->ExtOffset;
+}
+
+u8_t zfiWlanQueryCWMode(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ return wd->cwm.cw_mode;
+}
+
+u32_t zfiWlanQueryCWEnable(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ return wd->cwm.cw_enable;
+}
+
+void zfiWlanQueryBssid(zdev_t* dev, u8_t* bssid)
+{
+ u8_t addr[6];
+
+ zmw_get_wlan_dev(dev);
+
+ ZM_MAC_WORD_TO_BYTE(wd->sta.bssid, addr);
+ zfMemoryCopy(bssid, addr, 6);
+}
+
+u16_t zfiWlanQueryBeaconInterval(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ return wd->beaconInterval;
+}
+
+u32_t zfiWlanQueryRxBeaconTotal(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+ wd->sta.rxBeaconTotal += wd->sta.rxBeaconCount;
+
+ return wd->sta.rxBeaconTotal;
+}
+
+u16_t zfiWlanQueryAtimWindow(zdev_t* dev)
+{
+ u16_t atimWindow;
+
+ zmw_get_wlan_dev(dev);
+
+ atimWindow = wd->sta.atimWindow;
+
+ return atimWindow;
+}
+
+u8_t zfiWlanQueryEncryMode(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ if (wd->wlanMode == ZM_MODE_AP)
+ return wd->ap.encryMode[0];
+ else
+ return wd->sta.encryMode;
+}
+
+u16_t zfiWlanQueryCapability(zdev_t* dev)
+{
+ u16_t capability;
+
+ zmw_get_wlan_dev(dev);
+
+ capability = wd->sta.capability[0] +
+ (((u16_t) wd->sta.capability[1]) << 8);
+
+ return capability;
+
+}
+
+u16_t zfiWlanQueryAid(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ return wd->sta.aid;
+}
+
+void zfiWlanQuerySupportRate(zdev_t* dev, u8_t* rateArray, u8_t* pLength)
+{
+ u8_t i, j=0;
+
+ zmw_get_wlan_dev(dev);
+
+ for( i=0; i<4; i++ )
+ {
+ if ( wd->bRate & (0x1 << i) )
+ {
+ rateArray[j] = zg11bRateTbl[i] +
+ ((wd->bRateBasic & (0x1<<i))<<(7-i));
+ j++;
+ }
+ }
+
+ *pLength = j;
+}
+
+void zfiWlanQueryExtSupportRate(zdev_t* dev, u8_t* rateArray, u8_t* pLength)
+{
+ u8_t i, j=0;
+
+ zmw_get_wlan_dev(dev);
+
+ for( i=0; i<8; i++ )
+ {
+ if ( wd->gRate & (0x1 << i) )
+ {
+ rateArray[j] = zg11gRateTbl[i] +
+ ((wd->gRateBasic & (0x1<<i))<<(7-i));
+ j++;
+ }
+ }
+
+ *pLength = j;
+}
+
+void zfiWlanQueryRsnIe(zdev_t* dev, u8_t* ie, u8_t* pLength)
+{
+ u8_t len;
+
+ zmw_get_wlan_dev(dev);
+
+ len = wd->sta.rsnIe[1] + 2;
+ zfMemoryCopy(ie, wd->sta.rsnIe, len);
+ *pLength = len;
+}
+
+void zfiWlanQueryWpaIe(zdev_t* dev, u8_t* ie, u8_t* pLength)
+{
+ u8_t len;
+
+ zmw_get_wlan_dev(dev);
+
+ len = wd->sta.wpaIe[1] + 2;
+ zfMemoryCopy(ie, wd->sta.wpaIe, len);
+ *pLength = len;
+
+}
+
+u8_t zfiWlanQueryMulticastCipherAlgo(zdev_t *dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ switch( wd->sta.currentAuthMode )
+ {
+ case ZM_AUTH_MODE_WPA2PSK:
+ case ZM_AUTH_MODE_WPA2:
+ if ( wd->sta.rsnIe[7] == 2 )
+ {
+ return ZM_TKIP;
+ }
+ else
+ {
+ return ZM_AES;
+ }
+ break;
+
+ case ZM_AUTH_MODE_WPAPSK:
+ case ZM_AUTH_MODE_WPA:
+ if ( wd->sta.rsnIe[11] == 2 )
+ {
+ return ZM_TKIP;
+ }
+ else
+ {
+ return ZM_AES;
+ }
+ break;
+
+ default:
+ return wd->sta.encryMode;
+ }
+}
+
+u8_t zfiWlanQueryHTMode(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+ // 0:Legancy, 1:N
+ return wd->sta.EnableHT;
+}
+
+u8_t zfiWlanQueryBandWidth40(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+ // 0:20M, 1:40M
+ return wd->BandWidth40;
+}
+
+u16_t zfiWlanQueryRegionCode(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ return wd->regulationTable.regionCode;
+}
+void zfiWlanSetWpaIe(zdev_t* dev, u8_t* ie, u8_t Length)
+{
+ u16_t vapId = 0;
+ zmw_get_wlan_dev(dev);
+
+ if (wd->wlanMode == ZM_MODE_AP) // AP Mode
+ {
+ vapId = zfwGetVapId(dev);
+
+ if (vapId == 0xffff)
+ vapId = 0;
+ else
+ vapId++;
+
+ zm_assert(Length < ZM_MAX_WPAIE_SIZE);
+ if (Length < ZM_MAX_WPAIE_SIZE)
+ {
+ wd->ap.wpaLen[vapId] = Length;
+ zfMemoryCopy(wd->ap.wpaIe[vapId], ie, wd->ap.wpaLen[vapId]);
+ }
+
+ }
+ else
+ {
+ wd->sta.wpaLen = Length;
+ zfMemoryCopy(wd->sta.wpaIe, ie, wd->sta.wpaLen);
+ }
+ //zfiWlanSetWpaSupport(dev, 1);
+ if (wd->wlanMode == ZM_MODE_AP) // AP Mode
+ {
+ wd->ap.wpaSupport[vapId] = 1;
+ }
+ else
+ {
+ wd->sta.wpaSupport = 1;
+ }
+
+}
+
+void zfiWlanSetWpaSupport(zdev_t* dev, u8_t WpaSupport)
+{
+ u16_t vapId = 0;
+ zmw_get_wlan_dev(dev);
+
+ if (wd->wlanMode == ZM_MODE_AP) // AP Mode
+ {
+ vapId = zfwGetVapId(dev);
+
+ if (vapId == 0xffff)
+ vapId = 0;
+ else
+ vapId++;
+
+ wd->ap.wpaSupport[vapId] = WpaSupport;
+ }
+ else
+ {
+ wd->sta.wpaSupport = WpaSupport;
+ }
+
+}
+
+void zfiWlanSetProtectionMode(zdev_t* dev, u8_t mode)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->sta.bProtectionMode = mode;
+ if (wd->sta.bProtectionMode == TRUE)
+ {
+ zfHpSetSlotTime(dev, 0);
+ }
+ else
+ {
+ zfHpSetSlotTime(dev, 1);
+ }
+
+ zm_msg1_mm(ZM_LV_1, "wd->protectionMode=", wd->sta.bProtectionMode);
+}
+
+void zfiWlanSetBasicRate(zdev_t* dev, u8_t bRateSet, u8_t gRateSet,
+ u32_t nRateSet)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->ws.bRateBasic = bRateSet;
+ wd->ws.gRateBasic = gRateSet;
+ wd->ws.nRateBasic = nRateSet;
+}
+
+void zfiWlanSetBGMode(zdev_t* dev, u8_t mode)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->ws.bgMode = mode;
+}
+
+void zfiWlanSetpreambleType(zdev_t* dev, u8_t type)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->ws.preambleType = type;
+}
+
+u8_t zfiWlanQuerypreambleType(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ return wd->ws.preambleType;
+}
+
+u8_t zfiWlanQueryPowerSaveMode(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ return wd->sta.powerSaveMode;
+}
+
+u8_t zfiWlanSetPmkidInfo(zdev_t* dev, u16_t* bssid, u8_t* pmkid)
+{
+ u32_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ for(i=0; i<wd->sta.pmkidInfo.bssidCount; i++)
+ {
+ if ( zfMemoryIsEqual((u8_t*) wd->sta.pmkidInfo.bssidInfo[i].bssid,
+ (u8_t*) bssid, 6) )
+ {
+ /* matched */
+ break;
+ }
+ }
+
+ if ( i < wd->sta.pmkidInfo.bssidCount )
+ {
+ /* overwrite the original one */
+ zfMemoryCopy(wd->sta.pmkidInfo.bssidInfo[i].pmkid, pmkid, 16);
+ }
+ else
+ {
+ if ( i < ZM_PMKID_MAX_BSS_CNT )
+ {
+ wd->sta.pmkidInfo.bssidInfo[i].bssid[0] = bssid[0];
+ wd->sta.pmkidInfo.bssidInfo[i].bssid[1] = bssid[1];
+ wd->sta.pmkidInfo.bssidInfo[i].bssid[2] = bssid[2];
+
+ zfMemoryCopy(wd->sta.pmkidInfo.bssidInfo[i].pmkid, pmkid, 16);
+ wd->sta.pmkidInfo.bssidCount++;
+ }
+ }
+
+ return 0;
+}
+
+u32_t zfiWlanQueryPmkidInfo(zdev_t* dev, u8_t* buf, u32_t len)
+{
+ //struct zsPmkidInfo* pPmkidInfo = ( struct zsPmkidInfo* ) buf;
+ u32_t size;
+
+ zmw_get_wlan_dev(dev);
+
+ size = sizeof(u32_t) +
+ wd->sta.pmkidInfo.bssidCount * sizeof(struct zsPmkidBssidInfo);
+
+ if ( len < size )
+ {
+ return wd->sta.pmkidInfo.bssidCount;
+ }
+
+ zfMemoryCopy(buf, (u8_t*) &wd->sta.pmkidInfo, (u16_t) size);
+
+ return 0;
+}
+
+void zfiWlanSetMulticastList(zdev_t* dev, u8_t size, u8_t* pList)
+{
+ struct zsMulticastAddr* pMacList = (struct zsMulticastAddr*) pList;
+ u8_t i;
+ u8_t bAllMulticast = 0;
+ //u32_t value;
+
+ zmw_get_wlan_dev(dev);
+
+ wd->sta.multicastList.size = size;
+ for(i=0; i<size; i++)
+ {
+ zfMemoryCopy(wd->sta.multicastList.macAddr[i].addr,
+ pMacList[i].addr, 6);
+ }
+
+ if ( wd->sta.osRxFilter & ZM_PACKET_TYPE_ALL_MULTICAST )
+ bAllMulticast = 1;
+ zfHpSetMulticastList(dev, size, pList, bAllMulticast);
+
+}
+
+void zfiWlanRemoveKey(zdev_t* dev, u8_t keyType, u8_t keyId)
+{
+ u16_t fakeMacAddr[3] = {0, 0, 0};
+ u32_t fakeKey[4] = {0, 0, 0, 0};
+
+ zmw_get_wlan_dev(dev);
+
+ if ( keyType == 0 )
+ {
+ /* remove WEP key */
+ zm_debug_msg0("remove WEP key");
+ zfCoreSetKey(dev, ZM_USER_KEY_DEFAULT+keyId, 0,
+ ZM_NO_WEP, fakeMacAddr, fakeKey);
+ wd->sta.encryMode = ZM_NO_WEP;
+ }
+ else if ( keyType == 1 )
+ {
+ /* remove pairwise key */
+ zm_debug_msg0("remove pairwise key");
+ zfHpRemoveKey(dev, ZM_USER_KEY_PK);
+ wd->sta.encryMode = ZM_NO_WEP;
+ }
+ else
+ {
+ /* remove group key */
+ zm_debug_msg0("remove group key");
+ zfHpRemoveKey(dev, ZM_USER_KEY_GK);
+ }
+}
+
+
+void zfiWlanQueryRegulationTable(zdev_t* dev, struct zsRegulationTable* pEntry)
+{
+ zmw_get_wlan_dev(dev);
+
+ zfMemoryCopy((u8_t*) pEntry, (u8_t*) &wd->regulationTable,
+ sizeof(struct zsRegulationTable));
+}
+
+/* parameter "time" is specified in ms */
+void zfiWlanSetScanTimerPerChannel(zdev_t* dev, u16_t time)
+{
+ zmw_get_wlan_dev(dev);
+
+ zm_debug_msg1("scan time (ms) = ", time);
+
+ wd->sta.activescanTickPerChannel = time / ZM_MS_PER_TICK;
+}
+
+void zfiWlanSetAutoReconnect(zdev_t* dev, u8_t enable)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->sta.bAutoReconnect = enable;
+ //wd->sta.bAutoReconnectEnabled = enable;
+}
+
+void zfiWlanSetStaWme(zdev_t* dev, u8_t enable, u8_t uapsdInfo)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->ws.staWmeEnabled = enable & 0x3;
+ if ((enable & 0x2) != 0)
+ {
+ wd->ws.staWmeQosInfo = uapsdInfo & 0x6f;
+ }
+ else
+ {
+ wd->ws.staWmeQosInfo = 0;
+ }
+}
+
+void zfiWlanSetApWme(zdev_t* dev, u8_t enable)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->ws.apWmeEnabled = enable;
+}
+
+u8_t zfiWlanQuerywmeEnable(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ return wd->ws.staWmeEnabled;
+}
+
+void zfiWlanSetProbingHiddenSsid(zdev_t* dev, u8_t* ssid, u8_t ssidLen,
+ u16_t entry)
+{
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+
+ if ((ssidLen <= 32) && (entry < ZM_MAX_PROBE_HIDDEN_SSID_SIZE))
+ {
+ zmw_enter_critical_section(dev);
+ wd->ws.probingSsidList[entry].ssidLen = ssidLen;
+ zfMemoryCopy(wd->ws.probingSsidList[entry].ssid, ssid, ssidLen);
+ zmw_leave_critical_section(dev);
+ }
+
+ return;
+}
+
+void zfiWlanSetDisableProbingWithSsid(zdev_t* dev, u8_t mode)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->sta.disableProbingWithSsid = mode;
+
+ return;
+}
+
+void zfiWlanSetDropUnencryptedPackets(zdev_t* dev, u8_t enable)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->ws.dropUnencryptedPkts = enable;
+}
+
+void zfiWlanSetStaRxSecurityCheckCb(zdev_t* dev, zfpStaRxSecurityCheckCb pStaRxSecurityCheckCb)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->sta.pStaRxSecurityCheckCb = pStaRxSecurityCheckCb;
+}
+
+void zfiWlanSetIBSSJoinOnly(zdev_t* dev, u8_t joinOnly)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->ws.ibssJoinOnly = joinOnly;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfiConfigWdsPort */
+/* Configure WDS port. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* wdsPortId : WDS port ID, start from 0 */
+/* flag : 0=>disable WDS port, 1=>enable WDS port */
+/* wdsAddr : WDS neighbor MAC address */
+/* encType : encryption type for WDS port */
+/* wdsKey : encryption key for WDS port */
+/* */
+/* OUTPUTS */
+/* Error code */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2006.6 */
+/* */
+/************************************************************************/
+u16_t zfiConfigWdsPort(zdev_t* dev, u8_t wdsPortId, u16_t flag, u16_t* wdsAddr,
+ u16_t encType, u32_t* wdsKey)
+{
+ u16_t addr[3];
+ u32_t key[4];
+
+ zmw_get_wlan_dev(dev);
+
+ if (wdsPortId > ZM_MAX_WDS_SUPPORT)
+ {
+ return ZM_ERR_WDS_PORT_ID;
+ }
+
+ if (flag == 1)
+ {
+ /* Enable WDS port */
+ wd->ap.wds.macAddr[wdsPortId][0] = wdsAddr[0];
+ wd->ap.wds.macAddr[wdsPortId][1] = wdsAddr[1];
+ wd->ap.wds.macAddr[wdsPortId][2] = wdsAddr[2];
+
+ wd->ap.wds.wdsBitmap |= (1 << wdsPortId);
+ wd->ap.wds.encryMode[wdsPortId] = (u8_t) encType;
+
+ zfCoreSetKey(dev, 10+ZM_MAX_WDS_SUPPORT, 0, (u8_t) encType, wdsAddr, wdsKey);
+ }
+ else
+ {
+ /* Disable WDS port */
+ addr[0] = addr[1] = addr[2] = 0;
+ key[0] = key[1] = key[2] = key[3] = 0;
+ wd->ap.wds.wdsBitmap &= (~(1 << wdsPortId));
+ zfCoreSetKey(dev, 10+ZM_MAX_WDS_SUPPORT, 0, ZM_NO_WEP, addr, key);
+ }
+
+ return ZM_SUCCESS;
+}
+#ifdef ZM_ENABLE_CENC
+/* CENC */
+void zfiWlanQueryGSN(zdev_t* dev, u8_t *gsn, u16_t vapId)
+{
+ //struct zsWlanDev* wd = (struct zsWlanDev*) zmw_wlan_dev(dev);
+ u32_t txiv[4];
+ zmw_get_wlan_dev(dev);
+
+ /* convert little endian to big endian for 32 bits */
+ txiv[3] = wd->ap.txiv[vapId][0];
+ txiv[2] = wd->ap.txiv[vapId][1];
+ txiv[1] = wd->ap.txiv[vapId][2];
+ txiv[0] = wd->ap.txiv[vapId][3];
+
+ zfMemoryCopy(gsn, (u8_t*)txiv, 16);
+}
+#endif //ZM_ENABLE_CENC
+//CWYang(+)
+void zfiWlanQuerySignalInfo(zdev_t* dev, u8_t *buffer)
+{
+ zmw_get_wlan_dev(dev);
+
+ /*Change Signal Strength/Quality Value to Human Sense Here*/
+
+ buffer[0] = wd->SignalStrength;
+ buffer[1] = wd->SignalQuality;
+}
+
+/* OS-XP */
+u16_t zfiStaAddIeWpaRsn(zdev_t* dev, zbuf_t* buf, u16_t offset, u8_t frameType)
+{
+ return zfStaAddIeWpaRsn(dev, buf, offset, frameType);
+}
+
+/* zfiDebugCmd */
+/* cmd value-description */
+/* 0 schedule timer */
+/* 1 cancel timer */
+/* 2 clear timer */
+/* 3 test timer */
+/* 4 */
+/* 5 */
+/* 6 checksum test 0/1 */
+/* 7 enableProtectionMode */
+/* 8 rx packet content dump 0/1 */
+
+u32_t zfiDebugCmd(zdev_t* dev, u32_t cmd, u32_t value)
+{
+ u16_t event;
+ u32_t tick;
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+
+ zmw_enter_critical_section(dev);
+
+ if ( cmd == 0 )
+ { /* schedule timer */
+ event = (u16_t) ((value >> 16) & 0xffff);
+ tick = value & 0xffff;
+ zfTimerSchedule(dev, event, tick);
+ }
+ else if ( cmd == 1 )
+ { /* cancel timer */
+ event = (u16_t) (value & 0xffff);
+ zfTimerCancel(dev, event);
+ }
+ else if ( cmd == 2 )
+ { /* clear timer */
+ zfTimerClear(dev);
+ }
+ else if ( cmd == 3 )
+ { /* test timer */
+ zfTimerSchedule(dev, 1, 500);
+ zfTimerSchedule(dev, 2, 1000);
+ zfTimerSchedule(dev, 3, 1000);
+ zfTimerSchedule(dev, 4, 1000);
+ zfTimerSchedule(dev, 5, 1500);
+ zfTimerSchedule(dev, 6, 2000);
+ zfTimerSchedule(dev, 7, 2200);
+ zfTimerSchedule(dev, 6, 2500);
+ zfTimerSchedule(dev, 8, 2800);
+ }
+ else if ( cmd == 4)
+ {
+ zfTimerSchedule(dev, 1, 500);
+ zfTimerSchedule(dev, 2, 1000);
+ zfTimerSchedule(dev, 3, 1000);
+ zfTimerSchedule(dev, 4, 1000);
+ zfTimerSchedule(dev, 5, 1500);
+ zfTimerSchedule(dev, 6, 2000);
+ zfTimerSchedule(dev, 7, 2200);
+ zfTimerSchedule(dev, 6, 2500);
+ zfTimerSchedule(dev, 8, 2800);
+ zfTimerCancel(dev, 1);
+ zfTimerCancel(dev, 3);
+ zfTimerCancel(dev, 6);
+ }
+ else if ( cmd == 5 )
+ {
+ wd->sta.keyId = (u8_t) value;
+ }
+ else if ( cmd == 6 )
+ {
+ /* 0: normal 1: always set TCP/UDP checksum zero */
+ wd->checksumTest = value;
+ }
+ else if ( cmd == 7 )
+ {
+ wd->enableProtectionMode = value;
+ zm_msg1_mm(ZM_LV_1, "wd->enableProtectionMode=", wd->enableProtectionMode);
+ }
+ else if ( cmd == 8 )
+ {
+ /* rx packet content dump */
+ if (value)
+ {
+ wd->rxPacketDump = 1;
+ }
+ else
+ {
+ wd->rxPacketDump = 0;
+ }
+ }
+
+
+ zmw_leave_critical_section(dev);
+
+ return 0;
+}
+
+#ifdef ZM_ENABLE_CENC
+u8_t zfiWlanSetCencPairwiseKey(zdev_t* dev, u8_t keyid, u32_t *txiv, u32_t *rxiv,
+ u8_t *key, u8_t *mic)
+{
+ struct zsKeyInfo keyInfo;
+ u8_t cencKey[32];
+ u8_t i;
+ u16_t macAddr[3];
+
+ zmw_get_wlan_dev(dev);
+
+ for (i = 0; i < 16; i++)
+ cencKey[i] = key[i];
+ for (i = 0; i < 16; i++)
+ cencKey[i + 16] = mic[i];
+ keyInfo.key = cencKey;
+ keyInfo.keyLength = 32;
+ keyInfo.keyIndex = keyid;
+ keyInfo.flag = ZM_KEY_FLAG_CENC | ZM_KEY_FLAG_PK;
+ for (i = 0; i < 3; i++)
+ macAddr[i] = wd->sta.bssid[i];
+ keyInfo.macAddr = macAddr;
+
+ zfiWlanSetKey(dev, keyInfo);
+
+ /* Reset txiv and rxiv */
+ //wd->sta.txiv[0] = txiv[0];
+ //wd->sta.txiv[1] = txiv[1];
+ //wd->sta.txiv[2] = txiv[2];
+ //wd->sta.txiv[3] = txiv[3];
+ //
+ //wd->sta.rxiv[0] = rxiv[0];
+ //wd->sta.rxiv[1] = rxiv[1];
+ //wd->sta.rxiv[2] = rxiv[2];
+ //wd->sta.rxiv[3] = rxiv[3];
+
+ return 0;
+}
+
+u8_t zfiWlanSetCencGroupKey(zdev_t* dev, u8_t keyid, u32_t *rxiv,
+ u8_t *key, u8_t *mic)
+{
+ struct zsKeyInfo keyInfo;
+ u8_t cencKey[32];
+ u8_t i;
+ u16_t macAddr[6] = {0xffff, 0xffff, 0xffff};
+
+ zmw_get_wlan_dev(dev);
+
+ for (i = 0; i < 16; i++)
+ cencKey[i] = key[i];
+ for (i = 0; i < 16; i++)
+ cencKey[i + 16] = mic[i];
+ keyInfo.key = cencKey;
+ keyInfo.keyLength = 32;
+ keyInfo.keyIndex = keyid;
+ keyInfo.flag = ZM_KEY_FLAG_CENC | ZM_KEY_FLAG_GK;
+ keyInfo.vapId = 0;
+ for (i = 0; i < 3; i++)
+ keyInfo.vapAddr[i] = wd->macAddr[i];
+ keyInfo.macAddr = macAddr;
+
+ zfiWlanSetKey(dev, keyInfo);
+
+ /* Reset txiv and rxiv */
+ wd->sta.rxivGK[0] = ((rxiv[3] >> 24) & 0xFF)
+ + (((rxiv[3] >> 16) & 0xFF) << 8)
+ + (((rxiv[3] >> 8) & 0xFF) << 16)
+ + ((rxiv[3] & 0xFF) << 24);
+ wd->sta.rxivGK[1] = ((rxiv[2] >> 24) & 0xFF)
+ + (((rxiv[2] >> 16) & 0xFF) << 8)
+ + (((rxiv[2] >> 8) & 0xFF) << 16)
+ + ((rxiv[2] & 0xFF) << 24);
+ wd->sta.rxivGK[2] = ((rxiv[1] >> 24) & 0xFF)
+ + (((rxiv[1] >> 16) & 0xFF) << 8)
+ + (((rxiv[1] >> 8) & 0xFF) << 16)
+ + ((rxiv[1] & 0xFF) << 24);
+ wd->sta.rxivGK[3] = ((rxiv[0] >> 24) & 0xFF)
+ + (((rxiv[0] >> 16) & 0xFF) << 8)
+ + (((rxiv[0] >> 8) & 0xFF) << 16)
+ + ((rxiv[0] & 0xFF) << 24);
+
+ wd->sta.authMode = ZM_AUTH_MODE_CENC;
+ wd->sta.currentAuthMode = ZM_AUTH_MODE_CENC;
+
+ return 0;
+}
+#endif //ZM_ENABLE_CENC
+
+u8_t zfiWlanSetDot11DMode(zdev_t* dev, u8_t mode)
+{
+ u8_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ wd->sta.b802_11D = mode;
+ if (mode) //Enable 802.11d
+ {
+ wd->regulationTable.regionCode = NO_ENUMRD;
+ for (i = 0; i < wd->regulationTable.allowChannelCnt; i++)
+ wd->regulationTable.allowChannel[i].channelFlags |= ZM_REG_FLAG_CHANNEL_PASSIVE;
+ }
+ else //Disable
+ {
+ for (i = 0; i < wd->regulationTable.allowChannelCnt; i++)
+ wd->regulationTable.allowChannel[i].channelFlags &= ~ZM_REG_FLAG_CHANNEL_PASSIVE;
+ }
+
+ return 0;
+}
+
+u8_t zfiWlanSetDot11HDFSMode(zdev_t* dev, u8_t mode)
+{
+ zmw_get_wlan_dev(dev);
+
+ //zm_debug_msg0("CWY - Enable 802.11h DFS");
+
+ // TODO : DFS Enable in 5250 to 5350 MHz and 5470 to 5725 MHz .
+ //if ( Adapter->ZD80211HSupport &&
+ // Adapter->CardSetting.NetworkTypeInUse == Ndis802_11OFDM5 &&
+ // ((ChannelNo >=52 && ChannelNo <= 64) || //5250~5350 MHZ
+ // (ChannelNo >=100 && ChannelNo <= 140))) //5470~5725 MHZ
+ //{
+ // Adapter->ZD80211HSetting.DFSEnable=TRUE;
+ //}
+ //else
+ //{
+ // Adapter->ZD80211HSetting.DFSEnable=FALSE;
+ //}
+
+ wd->sta.DFSEnable = mode;
+ if (mode)
+ wd->sta.capability[1] |= ZM_BIT_0;
+ else
+ wd->sta.capability[1] &= (~ZM_BIT_0);
+
+ return 0;
+}
+
+u8_t zfiWlanSetDot11HTPCMode(zdev_t* dev, u8_t mode)
+{
+ zmw_get_wlan_dev(dev);
+
+ // TODO : TPC Enable in 5150~5350 MHz and 5470~5725MHz.
+ //if ( Adapter->ZD80211HSupport &&
+ // Adapter->CardSetting.NetworkTypeInUse == Ndis802_11OFDM5 &&
+ // ((ChannelNo == 36 || ChannelNo == 40 || ChannelNo == 44 || ChannelNo == 48) || //5150~5250 MHZ , Not Japan
+ // (ChannelNo >=52 && ChannelNo <= 64) || //5250~5350 MHZ
+ // (ChannelNo >=100 && ChannelNo <= 140))) //5470~5725 MHZ
+ //{
+ // Adapter->ZD80211HSetting.TPCEnable=TRUE;
+ //}
+ //else
+ //{
+ // Adapter->ZD80211HSetting.TPCEnable=FALSE;
+ //}
+
+ wd->sta.TPCEnable = mode;
+ if (mode)
+ wd->sta.capability[1] |= ZM_BIT_0;
+ else
+ wd->sta.capability[1] &= (~ZM_BIT_0);
+
+ return 0;
+}
+
+u8_t zfiWlanSetAniMode(zdev_t* dev, u8_t mode)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->aniEnable = mode;
+ if (mode)
+ zfHpAniAttach(dev);
+
+ return 0;
+}
+
+#ifdef ZM_OS_LINUX_FUNC
+void zfiWlanShowTally(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ zm_msg1_mm(ZM_LV_0, "Hw_UnderrunCnt = ", wd->commTally.Hw_UnderrunCnt);
+ zm_msg1_mm(ZM_LV_0, "Hw_TotalRxFrm = ", wd->commTally.Hw_TotalRxFrm);
+ zm_msg1_mm(ZM_LV_0, "Hw_CRC32Cnt = ", wd->commTally.Hw_CRC32Cnt);
+ zm_msg1_mm(ZM_LV_0, "Hw_CRC16Cnt = ", wd->commTally.Hw_CRC16Cnt);
+ zm_msg1_mm(ZM_LV_1, "Hw_DecrypErr_UNI = ", wd->commTally.Hw_DecrypErr_UNI);
+ zm_msg1_mm(ZM_LV_0, "Hw_RxFIFOOverrun = ", wd->commTally.Hw_RxFIFOOverrun);
+ zm_msg1_mm(ZM_LV_1, "Hw_DecrypErr_Mul = ", wd->commTally.Hw_DecrypErr_Mul);
+ zm_msg1_mm(ZM_LV_1, "Hw_RetryCnt = ", wd->commTally.Hw_RetryCnt);
+ zm_msg1_mm(ZM_LV_0, "Hw_TotalTxFrm = ", wd->commTally.Hw_TotalTxFrm);
+ zm_msg1_mm(ZM_LV_0, "Hw_RxTimeOut = ", wd->commTally.Hw_RxTimeOut);
+ zm_msg1_mm(ZM_LV_0, "Tx_MPDU = ", wd->commTally.Tx_MPDU);
+ zm_msg1_mm(ZM_LV_0, "BA_Fail = ", wd->commTally.BA_Fail);
+ zm_msg1_mm(ZM_LV_0, "Hw_Tx_AMPDU = ", wd->commTally.Hw_Tx_AMPDU);
+ zm_msg1_mm(ZM_LV_0, "Hw_Tx_MPDU = ", wd->commTally.Hw_Tx_MPDU);
+
+ zm_msg1_mm(ZM_LV_1, "Hw_RxMPDU = ", wd->commTally.Hw_RxMPDU);
+ zm_msg1_mm(ZM_LV_1, "Hw_RxDropMPDU = ", wd->commTally.Hw_RxDropMPDU);
+ zm_msg1_mm(ZM_LV_1, "Hw_RxDelMPDU = ", wd->commTally.Hw_RxDelMPDU);
+ zm_msg1_mm(ZM_LV_1, "Hw_RxPhyMiscError = ", wd->commTally.Hw_RxPhyMiscError);
+ zm_msg1_mm(ZM_LV_1, "Hw_RxPhyXRError = ", wd->commTally.Hw_RxPhyXRError);
+ zm_msg1_mm(ZM_LV_1, "Hw_RxPhyOFDMError = ", wd->commTally.Hw_RxPhyOFDMError);
+ zm_msg1_mm(ZM_LV_1, "Hw_RxPhyCCKError = ", wd->commTally.Hw_RxPhyCCKError);
+ zm_msg1_mm(ZM_LV_1, "Hw_RxPhyHTError = ", wd->commTally.Hw_RxPhyHTError);
+ zm_msg1_mm(ZM_LV_1, "Hw_RxPhyTotalCount = ", wd->commTally.Hw_RxPhyTotalCount);
+
+ if (!((wd->commTally.Tx_MPDU == 0) && (wd->commTally.BA_Fail == 0)))
+ {
+ zm_debug_msg_p("BA Fail Ratio(%) = ", wd->commTally.BA_Fail * 100,
+ (wd->commTally.BA_Fail + wd->commTally.Tx_MPDU));
+ }
+
+ if (!((wd->commTally.Hw_Tx_MPDU == 0) && (wd->commTally.Hw_Tx_AMPDU == 0)))
+ {
+ zm_debug_msg_p("Avg Agg Number = ",
+ wd->commTally.Hw_Tx_MPDU, wd->commTally.Hw_Tx_AMPDU);
+ }
+}
+#endif
+
+void zfiWlanSetMaxTxPower(zdev_t* dev, u8_t power2, u8_t power5)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ wd->maxTxPower2 = power2;
+ wd->maxTxPower5 = power5;
+ zmw_leave_critical_section(dev);
+}
+
+void zfiWlanQueryMaxTxPower(zdev_t* dev, u8_t *power2, u8_t *power5)
+{
+ zmw_get_wlan_dev(dev);
+
+ *power2 = wd->maxTxPower2;
+ *power5 = wd->maxTxPower5;
+}
+
+void zfiWlanSetConnectMode(zdev_t* dev, u8_t mode)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ wd->connectMode = mode;
+ zmw_leave_critical_section(dev);
+}
+
+void zfiWlanSetSupportMode(zdev_t* dev, u32_t mode)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ wd->supportMode = mode;
+ zmw_leave_critical_section(dev);
+}
+
+void zfiWlanSetAdhocMode(zdev_t* dev, u32_t mode)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->ws.adhocMode = mode;
+}
+
+u32_t zfiWlanQueryAdhocMode(zdev_t* dev, u8_t bWrapper)
+{
+ u32_t adhocMode;
+
+ zmw_get_wlan_dev(dev);
+
+ if ( bWrapper )
+ {
+ adhocMode = wd->ws.adhocMode;
+ }
+ else
+ {
+ adhocMode = wd->wfc.bIbssGMode;
+ }
+
+ return adhocMode;
+}
+
+
+u8_t zfiWlanSetCountryIsoName(zdev_t* dev, u8_t *countryIsoName, u8_t length)
+{
+ u8_t buf[5];
+ zmw_get_wlan_dev(dev);
+
+ if (length == 4)
+ {
+ buf[2] = wd->ws.countryIsoName[0] = countryIsoName[2];
+ buf[3] = wd->ws.countryIsoName[1] = countryIsoName[1];
+ buf[4] = wd->ws.countryIsoName[2] = countryIsoName[0];
+ }
+ else if (length == 3)
+ {
+ buf[2] = wd->ws.countryIsoName[0] = countryIsoName[1];
+ buf[3] = wd->ws.countryIsoName[1] = countryIsoName[0];
+ buf[4] = wd->ws.countryIsoName[2] = '\0';
+ }
+ else
+ {
+ return 1;
+ }
+
+ return zfHpGetRegulationTablefromISO(dev, buf, length);
+}
+
+
+const char* zfiWlanQueryCountryIsoName(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ return wd->ws.countryIsoName;
+}
+
+
+
+void zfiWlanSetRegulatory(zdev_t* dev, u8_t CCS, u16_t Code, u8_t bfirstChannel)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ if (CCS)
+ {
+ /* Reset Regulation Table by Country Code */
+ zfHpGetRegulationTablefromCountry(dev, Code);
+ }
+ else
+ {
+ /* Reset Regulation Table by Region Code */
+ zfHpGetRegulationTablefromRegionCode(dev, Code);
+ }
+
+ if (bfirstChannel) {
+ zmw_enter_critical_section(dev);
+ wd->frequency = zfChGetFirstChannel(dev, NULL);
+ zmw_leave_critical_section(dev);
+ zfCoreSetFrequency(dev, wd->frequency);
+ }
+}
+
+
+const char* zfiHpGetisoNamefromregionCode(zdev_t* dev, u16_t regionCode)
+{
+ return zfHpGetisoNamefromregionCode(dev, regionCode);
+}
+
+u16_t zfiWlanChannelToFrequency(zdev_t* dev, u8_t channel)
+{
+ return zfChNumToFreq(dev, channel, 0);
+}
+
+u8_t zfiWlanFrequencyToChannel(zdev_t* dev, u16_t freq)
+{
+ u8_t is5GBand = 0;
+
+ return zfChFreqToNum(freq, &is5GBand);
+}
+
+void zfiWlanDisableDfsChannel(zdev_t* dev, u8_t disableFlag)
+{
+ zfHpDisableDfsChannel(dev, disableFlag);
+ return;
+}
+
+void zfiWlanSetLEDCtrlParam(zdev_t* dev, u8_t type, u8_t flag)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ wd->ledStruct.LEDCtrlType = type;
+ wd->ledStruct.LEDCtrlFlagFromReg = flag;
+ zmw_leave_critical_section(dev);
+}
+
+void zfiWlanEnableLeapConfig(zdev_t* dev, u8_t leapEnabled)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->sta.leapEnabled = leapEnabled;
+}
+
+u32_t zfiWlanQueryHwCapability(zdev_t* dev)
+{
+ return zfHpCapability(dev);
+}
+
+u32_t zfiWlanQueryReceivedPacket(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ return wd->sta.ReceivedPktRatePerSecond;
+}
+
+void zfiWlanCheckSWEncryption(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ if (wd->sta.SWEncryptEnable != 0)
+ {
+ zfHpSWDecrypt(dev, 1);
+ }
+}
+
+u16_t zfiWlanQueryAllowChannels(zdev_t* dev, u16_t *channels)
+{
+ u16_t ii;
+ zmw_get_wlan_dev(dev);
+
+ for (ii = 0; ii < wd->regulationTable.allowChannelCnt; ii++)
+ {
+ channels[ii] = wd->regulationTable.allowChannel[ii].channel;
+ }
+
+ return wd->regulationTable.allowChannelCnt;
+}
+
+void zfiWlanSetDynamicSIFSParam(zdev_t* dev, u8_t val)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->dynamicSIFSEnable = val;
+
+ zm_debug_msg1("wd->dynamicSIFSEnable = ", wd->dynamicSIFSEnable)
+}
+
+u16_t zfiWlanGetMulticastAddressCount(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ return wd->sta.multicastList.size;
+}
+
+void zfiWlanGetMulticastList(zdev_t* dev, u8_t* pMCList)
+{
+ struct zsMulticastAddr* pMacList = (struct zsMulticastAddr*) pMCList;
+ u8_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ for ( i=0; i<wd->sta.multicastList.size; i++ )
+ {
+ zfMemoryCopy(pMacList[i].addr, wd->sta.multicastList.macAddr[i].addr, 6);
+ }
+}
+
+void zfiWlanSetPacketFilter(zdev_t* dev, u32_t PacketFilter)
+{
+ u8_t bAllMulticast = 0;
+ u32_t oldFilter;
+
+ zmw_get_wlan_dev(dev);
+
+ oldFilter = wd->sta.osRxFilter;
+
+ wd->sta.osRxFilter = PacketFilter;
+
+ if ((oldFilter & ZM_PACKET_TYPE_ALL_MULTICAST) !=
+ (wd->sta.osRxFilter & ZM_PACKET_TYPE_ALL_MULTICAST))
+ {
+ if ( wd->sta.osRxFilter & ZM_PACKET_TYPE_ALL_MULTICAST )
+ bAllMulticast = 1;
+ zfHpSetMulticastList(dev, wd->sta.multicastList.size,
+ (u8_t*)wd->sta.multicastList.macAddr, bAllMulticast);
+ }
+}
+
+u8_t zfiCompareWithMulticastListAddress(zdev_t* dev, u16_t* dstMacAddr)
+{
+ u8_t i;
+ u8_t bIsInMCListAddr = 0;
+
+ zmw_get_wlan_dev(dev);
+
+ for ( i=0; i<wd->sta.multicastList.size; i++ )
+ {
+ if ( zfwMemoryIsEqual((u8_t*)dstMacAddr, (u8_t*)wd->sta.multicastList.macAddr[i].addr, 6) )
+ {
+ bIsInMCListAddr = 1;
+ break;
+ }
+ }
+
+ return bIsInMCListAddr;
+}
+
+void zfiWlanSetSafeModeEnabled(zdev_t* dev, u8_t safeMode)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->sta.bSafeMode = safeMode;
+
+ if ( safeMode )
+ zfStaEnableSWEncryption(dev, 1);
+ else
+ zfStaDisableSWEncryption(dev);
+}
+
+void zfiWlanSetIBSSAdditionalIELength(zdev_t* dev, u32_t ibssAdditionalIESize, u8_t* ibssAdditionalIE)
+{
+ zmw_get_wlan_dev(dev);
+
+ if ( ibssAdditionalIESize )
+ {
+ wd->sta.ibssAdditionalIESize = ibssAdditionalIESize;
+ zfMemoryCopy(wd->sta.ibssAdditionalIE, ibssAdditionalIE, (u16_t)ibssAdditionalIESize);
+ }
+ else
+ wd->sta.ibssAdditionalIESize = 0;
+}
diff --git a/drivers/staging/otus/80211core/cprecomp.h b/drivers/staging/otus/80211core/cprecomp.h
new file mode 100644
index 00000000000..1670bfc2258
--- /dev/null
+++ b/drivers/staging/otus/80211core/cprecomp.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _CPRECOMP_H
+#define _CPRECOMP_H
+
+#include "../oal_dt.h"
+#include "../oal_marc.h"
+#include "pub_zfi.h"
+#include "pub_zfw.h"
+#include "pub_usb.h"
+#include "wlan.h"
+#include "struct.h"
+#include "cfunc.h"
+#include "cagg.h"
+#include "cwm.h"
+#include "performance.h"
+#endif
+
diff --git a/drivers/staging/otus/80211core/cpsmgr.c b/drivers/staging/otus/80211core/cpsmgr.c
new file mode 100644
index 00000000000..cf73caca8e5
--- /dev/null
+++ b/drivers/staging/otus/80211core/cpsmgr.c
@@ -0,0 +1,731 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * The power saving manager is to save the power as much as possible.
+ * Generally speaking, it controls:
+ *
+ * - when to sleep
+ * -
+ *
+ */
+#include "cprecomp.h"
+
+void zfPowerSavingMgrInit(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->sta.powerSaveMode = ZM_STA_PS_NONE;
+ wd->sta.psMgr.state = ZM_PS_MSG_STATE_ACTIVE;
+ wd->sta.psMgr.isSleepAllowed = 0;
+ wd->sta.psMgr.maxSleepPeriods = 1;
+ wd->sta.psMgr.ticks = 0;
+ wd->sta.psMgr.sleepAllowedtick = 0;
+}
+
+static u16_t zfPowerSavingMgrHandlePsNone(zdev_t* dev, u8_t *isWakeUpRequired)
+{
+ u16_t ret = 0;
+ zmw_get_wlan_dev(dev);
+
+ switch(wd->sta.psMgr.state)
+ {
+ case ZM_PS_MSG_STATE_ACTIVE:
+ *isWakeUpRequired = 0;
+ break;
+
+ case ZM_PS_MSG_STATE_T1:
+ case ZM_PS_MSG_STATE_T2:
+ case ZM_PS_MSG_STATE_SLEEP:
+ default:
+ *isWakeUpRequired = 1;
+zm_debug_msg0("zfPowerSavingMgrHandlePsNone: Wake up now\n");
+ if ( zfStaIsConnected(dev) )
+ {
+ zm_debug_msg0("zfPowerSavingMgrOnHandleT1 send Null data\n");
+ //zfSendNullData(dev, 0);
+ ret = 1;
+ }
+
+ wd->sta.psMgr.state = ZM_PS_MSG_STATE_ACTIVE;
+ break;
+ }
+ return ret;
+}
+
+static void zfPowerSavingMgrHandlePs(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ switch(wd->sta.psMgr.state)
+ {
+ case ZM_PS_MSG_STATE_ACTIVE:
+ //zm_debug_msg0("zfPowerSavingMgrHandlePs: Prepare to sleep...\n");
+ //wd->sta.psMgr.state = ZM_PS_MSG_STATE_T1;
+ break;
+
+ case ZM_PS_MSG_STATE_T1:
+ case ZM_PS_MSG_STATE_T2:
+ case ZM_PS_MSG_STATE_SLEEP:
+ default:
+ break;
+ }
+}
+
+void zfPowerSavingMgrSetMode(zdev_t* dev, u8_t mode)
+{
+ u16_t sendNull = 0;
+ u8_t isWakeUpRequired = 0;
+
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zm_debug_msg1("mode = ", mode);
+
+ if (mode > ZM_STA_PS_LIGHT)
+ {
+ zm_debug_msg0("return - wrong power save mode");
+ return;
+ }
+
+ zmw_enter_critical_section(dev);
+
+ #if 1
+ switch(mode)
+ {
+ case ZM_STA_PS_NONE:
+ sendNull = zfPowerSavingMgrHandlePsNone(dev, &isWakeUpRequired);
+ break;
+
+ case ZM_STA_PS_FAST:
+ case ZM_STA_PS_LIGHT:
+ wd->sta.psMgr.maxSleepPeriods = 1;
+ zfPowerSavingMgrHandlePs(dev);
+ break;
+
+ case ZM_STA_PS_MAX:
+ wd->sta.psMgr.maxSleepPeriods = ZM_PS_MAX_SLEEP_PERIODS;
+ zfPowerSavingMgrHandlePs(dev);
+ break;
+ }
+ #else
+ switch(wd->sta.psMgr.state)
+ {
+ case ZM_PS_MSG_STATE_ACTIVE:
+ if ( mode != ZM_STA_PS_NONE )
+ {
+zm_debug_msg0("zfPowerSavingMgrSetMode: switch from ZM_PS_MSG_STATE_ACTIVE to ZM_PS_MSG_STATE_T1\n");
+ // Stall the TX & start to wait the pending TX to be completed
+ wd->sta.psMgr.state = ZM_PS_MSG_STATE_T1;
+ }
+ break;
+
+ case ZM_PS_MSG_STATE_SLEEP:
+ break;
+ }
+ #endif
+
+ wd->sta.powerSaveMode = mode;
+ zmw_leave_critical_section(dev);
+
+ if ( isWakeUpRequired )
+ {
+ zfHpPowerSaveSetState(dev, 0);
+ wd->sta.psMgr.tempWakeUp = 0;
+ }
+
+ if ( zfStaIsConnected(dev)
+ && (wd->wlanMode == ZM_MODE_INFRASTRUCTURE) )
+ {
+ switch(mode)
+ {
+ case ZM_STA_PS_NONE:
+ zfHpPowerSaveSetMode(dev, 0, 0, wd->beaconInterval);
+ break;
+
+ case ZM_STA_PS_FAST:
+ case ZM_STA_PS_MAX:
+ case ZM_STA_PS_LIGHT:
+ zfHpPowerSaveSetMode(dev, 0, 1, wd->beaconInterval);
+ break;
+
+ default:
+ zfHpPowerSaveSetMode(dev, 0, 0, wd->beaconInterval);
+ break;
+ }
+ }
+
+ if (sendNull == 1)
+ {
+ zfSendNullData(dev, 0);
+ }
+
+ return;
+}
+
+static void zfPowerSavingMgrNotifyPSToAP(zdev_t *dev)
+{
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ if ( (wd->sta.psMgr.tempWakeUp != 1)&&
+ (wd->sta.psMgr.lastTxUnicastFrm != wd->commTally.txUnicastFrm ||
+ wd->sta.psMgr.lastTxBroadcastFrm != wd->commTally.txBroadcastFrm ||
+ wd->sta.psMgr.lastTxMulticastFrm != wd->commTally.txMulticastFrm) )
+ {
+ zmw_enter_critical_section(dev);
+ wd->sta.psMgr.lastTxUnicastFrm = wd->commTally.txUnicastFrm;
+ wd->sta.psMgr.lastTxBroadcastFrm = wd->commTally.txBroadcastFrm;
+ wd->sta.psMgr.lastTxMulticastFrm = wd->commTally.txMulticastFrm;
+ zmw_leave_critical_section(dev);
+
+ zfSendNullData(dev, 1);
+ }
+}
+
+static void zfPowerSavingMgrOnHandleT1(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ // If the tx Q is not empty...return
+ if ( zfIsVtxqEmpty(dev) == FALSE )
+ {
+ return;
+ }
+
+zm_debug_msg0("VtxQ is empty now...Check if HAL TXQ is empty\n");
+
+ // The the HAL TX Q is not empty...return
+ if ( zfHpGetFreeTxdCount(dev) != zfHpGetMaxTxdCount(dev) )
+ {
+ return;
+ }
+
+zm_debug_msg0("HAL TXQ is empty now...Could go to sleep...\n");
+
+ zmw_enter_critical_section(dev);
+
+ if (wd->sta.powerSaveMode == ZM_STA_PS_LIGHT)
+ {
+ if (wd->sta.ReceivedPktRatePerSecond > 200)
+ {
+ zmw_leave_critical_section(dev);
+ return;
+ }
+
+ if ( zfStaIsConnected(dev)
+ && (wd->wlanMode == ZM_MODE_INFRASTRUCTURE) )
+ {
+ if (wd->sta.psMgr.sleepAllowedtick) {
+ wd->sta.psMgr.sleepAllowedtick--;
+ zmw_leave_critical_section(dev);
+ return;
+ }
+ }
+ }
+
+ wd->sta.psMgr.state = ZM_PS_MSG_STATE_T2;
+
+ zmw_leave_critical_section(dev);
+
+ // Send the Null pkt to AP to notify that I'm going to sleep
+ if ( zfStaIsConnected(dev) )
+ {
+zm_debug_msg0("zfPowerSavingMgrOnHandleT1 send Null data\n");
+ zfPowerSavingMgrNotifyPSToAP(dev);
+ }
+
+ // Stall the TX now
+ // zfTxEngineStop(dev);
+}
+
+static void zfPowerSavingMgrOnHandleT2(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ // Wait until the Null pkt is transmitted
+ if ( zfHpGetFreeTxdCount(dev) != zfHpGetMaxTxdCount(dev) )
+ {
+ return;
+ }
+
+ zmw_enter_critical_section(dev);
+ wd->sta.psMgr.state = ZM_PS_MSG_STATE_SLEEP;
+ wd->sta.psMgr.lastTxUnicastFrm = wd->commTally.txUnicastFrm;
+ wd->sta.psMgr.lastTxBroadcastFrm = wd->commTally.txBroadcastFrm;
+ wd->sta.psMgr.lastTxMulticastFrm = wd->commTally.txMulticastFrm;
+ zmw_leave_critical_section(dev);
+
+ // Let CHIP sleep now
+zm_debug_msg0("zfPowerSavingMgrOnHandleT2 zzzz....\n");
+ zfHpPowerSaveSetState(dev, 1);
+ wd->sta.psMgr.tempWakeUp = 0;
+}
+
+u8_t zfPowerSavingMgrIsSleeping(zdev_t *dev)
+{
+ u8_t isSleeping = FALSE;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ if ( wd->sta.psMgr.state == ZM_PS_MSG_STATE_SLEEP ||
+ wd->sta.psMgr.state == ZM_PS_MSG_STATE_T2)
+ {
+ isSleeping = TRUE;
+ }
+ zmw_leave_critical_section(dev);
+ return isSleeping;
+}
+
+static u8_t zfPowerSavingMgrIsIdle(zdev_t *dev)
+{
+ u8_t isIdle = 0;
+
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ if ( zfStaIsConnected(dev) && wd->sta.psMgr.isSleepAllowed == 0 )
+ {
+ goto done;
+ }
+
+ if ( wd->sta.bChannelScan )
+ {
+ goto done;
+ }
+
+ if ( zfStaIsConnecting(dev) )
+ {
+ goto done;
+ }
+
+ if (wd->sta.powerSaveMode == ZM_STA_PS_LIGHT)
+ {
+ if (wd->sta.ReceivedPktRatePerSecond > 200)
+ {
+ goto done;
+ }
+
+ if ( zfStaIsConnected(dev)
+ && (wd->wlanMode == ZM_MODE_INFRASTRUCTURE) )
+ {
+ if (wd->sta.psMgr.sleepAllowedtick) {
+ wd->sta.psMgr.sleepAllowedtick--;
+ goto done;
+ }
+ }
+ }
+
+ isIdle = 1;
+
+done:
+ zmw_leave_critical_section(dev);
+
+ if ( zfIsVtxqEmpty(dev) == FALSE )
+ {
+ isIdle = 0;
+ }
+
+ return isIdle;
+}
+
+static void zfPowerSavingMgrSleepIfIdle(zdev_t *dev)
+{
+ u8_t isIdle;
+
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ isIdle = zfPowerSavingMgrIsIdle(dev);
+
+ if ( isIdle == 0 )
+ {
+ return;
+ }
+
+ zmw_enter_critical_section(dev);
+
+ switch(wd->sta.powerSaveMode)
+ {
+ case ZM_STA_PS_NONE:
+ break;
+
+ case ZM_STA_PS_MAX:
+ case ZM_STA_PS_FAST:
+ case ZM_STA_PS_LIGHT:
+ zm_debug_msg0("zfPowerSavingMgrSleepIfIdle: IDLE so slep now...\n");
+ wd->sta.psMgr.state = ZM_PS_MSG_STATE_T1;
+ break;
+ }
+
+ zmw_leave_critical_section(dev);
+}
+
+static void zfPowerSavingMgrDisconnectMain(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+#ifdef ZM_ENABLE_DISCONNECT_PS
+ switch(wd->sta.psMgr.state)
+ {
+ case ZM_PS_MSG_STATE_ACTIVE:
+ zfPowerSavingMgrSleepIfIdle(dev);
+ break;
+
+ case ZM_PS_MSG_STATE_SLEEP:
+ break;
+
+ case ZM_PS_MSG_STATE_T1:
+ zfPowerSavingMgrOnHandleT1(dev);
+ break;
+
+ case ZM_PS_MSG_STATE_T2:
+ zfPowerSavingMgrOnHandleT2(dev);
+ break;
+ }
+#else
+ zfPowerSavingMgrWakeup(dev);
+#endif
+}
+
+static void zfPowerSavingMgrInfraMain(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ switch(wd->sta.psMgr.state)
+ {
+ case ZM_PS_MSG_STATE_ACTIVE:
+ zfPowerSavingMgrSleepIfIdle(dev);
+ break;
+
+ case ZM_PS_MSG_STATE_SLEEP:
+ break;
+
+ case ZM_PS_MSG_STATE_T1:
+ zfPowerSavingMgrOnHandleT1(dev);
+ break;
+
+ case ZM_PS_MSG_STATE_T2:
+ zfPowerSavingMgrOnHandleT2(dev);
+ break;
+ }
+}
+
+void zfPowerSavingMgrAtimWinExpired(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+//printk("zfPowerSavingMgrAtimWinExpired #1\n");
+ if ( wd->sta.powerSaveMode == ZM_STA_PS_NONE )
+ {
+ return;
+ }
+
+//printk("zfPowerSavingMgrAtimWinExpired #2\n");
+ // if we received any ATIM window from the others to indicate we have buffered data
+ // at the other station, we can't go to sleep
+ if ( wd->sta.recvAtim )
+ {
+ wd->sta.recvAtim = 0;
+ zm_debug_msg0("Can't sleep due to receving ATIM window!");
+ return;
+ }
+
+ // if we are the one to tx beacon during last beacon interval. we can't go to sleep
+ // since we need to be alive to respond the probe request!
+ if ( wd->sta.txBeaconInd )
+ {
+ zm_debug_msg0("Can't sleep due to just transmit a beacon!");
+ return;
+ }
+
+ // If we buffer any data for the other stations. we could not go to sleep
+ if ( wd->sta.ibssPrevPSDataCount != 0 )
+ {
+ zm_debug_msg0("Can't sleep due to buffering data for the others!");
+ return;
+ }
+
+ // before sleeping, we still need to notify the others by transmitting null
+ // pkt with power mgmt bit turned on.
+ zfPowerSavingMgrOnHandleT1(dev);
+}
+
+static void zfPowerSavingMgrIBSSMain(zdev_t* dev)
+{
+ // wait for the end of
+ // if need to wait to know if we are the one to transmit the beacon
+ // during the beacon interval. If it's me, we can't go to sleep.
+
+ zmw_get_wlan_dev(dev);
+
+ switch(wd->sta.psMgr.state)
+ {
+ case ZM_PS_MSG_STATE_ACTIVE:
+ case ZM_PS_MSG_STATE_SLEEP:
+ case ZM_PS_MSG_STATE_T1:
+ break;
+
+ case ZM_PS_MSG_STATE_T2:
+ zfPowerSavingMgrOnHandleT2(dev);
+ break;
+ }
+
+ return;
+}
+
+#if 1
+void zfPowerSavingMgrMain(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ switch (wd->sta.adapterState)
+ {
+ case ZM_STA_STATE_DISCONNECT:
+ zfPowerSavingMgrDisconnectMain(dev);
+ break;
+ case ZM_STA_STATE_CONNECTED:
+ {
+ if (wd->wlanMode == ZM_MODE_INFRASTRUCTURE) {
+ zfPowerSavingMgrInfraMain(dev);
+ } else if (wd->wlanMode == ZM_MODE_IBSS) {
+ zfPowerSavingMgrIBSSMain(dev);
+ }
+ }
+ break;
+ case ZM_STA_STATE_CONNECTING:
+ default:
+ break;
+ }
+}
+#else
+void zfPowerSavingMgrMain(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ if ( wd->wlanMode != ZM_MODE_INFRASTRUCTURE )
+ {
+ return;
+ }
+
+ switch(wd->sta.psMgr.state)
+ {
+ case ZM_PS_MSG_STATE_ACTIVE:
+ goto check_sleep;
+ break;
+
+ case ZM_PS_MSG_STATE_SLEEP:
+ goto sleeping;
+ break;
+
+ case ZM_PS_MSG_STATE_T1:
+ zfPowerSavingMgrOnHandleT1(dev);
+ break;
+
+ case ZM_PS_MSG_STATE_T2:
+ zfPowerSavingMgrOnHandleT2(dev);
+ break;
+ }
+
+ return;
+
+sleeping:
+ return;
+
+check_sleep:
+ zfPowerSavingMgrSleepIfIdle(dev);
+ return;
+}
+#endif
+
+#ifdef ZM_ENABLE_POWER_SAVE
+void zfPowerSavingMgrWakeup(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+//zm_debug_msg0("zfPowerSavingMgrWakeup");
+
+ //if ( wd->sta.psMgr.state != ZM_PS_MSG_STATE_ACTIVE && ( zfPowerSavingMgrIsIdle(dev) == 0 ))
+ if ( wd->sta.psMgr.state != ZM_PS_MSG_STATE_ACTIVE )
+ {
+ zmw_enter_critical_section(dev);
+
+ wd->sta.psMgr.isSleepAllowed = 0;
+ wd->sta.psMgr.state = ZM_PS_MSG_STATE_ACTIVE;
+
+ if ( wd->sta.powerSaveMode > ZM_STA_PS_NONE )
+ wd->sta.psMgr.tempWakeUp = 1;
+
+ zmw_leave_critical_section(dev);
+
+ // Wake up the CHIP now!!
+ zfHpPowerSaveSetState(dev, 0);
+ }
+}
+#else
+void zfPowerSavingMgrWakeup(zdev_t* dev)
+{
+}
+#endif
+
+void zfPowerSavingMgrProcessBeacon(zdev_t* dev, zbuf_t* buf)
+{
+ u8_t length, bitmap;
+ u16_t offset, n1, n2, q, r;
+ zbuf_t* psBuf;
+
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ if ( wd->sta.powerSaveMode == ZM_STA_PS_NONE )
+ //if ( wd->sta.psMgr.state != ZM_PS_MSG_STATE_SLEEP )
+ {
+ return;
+ }
+
+ wd->sta.psMgr.isSleepAllowed = 1;
+
+ if ( (offset=zfFindElement(dev, buf, ZM_WLAN_EID_TIM)) != 0xffff )
+ {
+ length = zmw_rx_buf_readb(dev, buf, offset+1);
+
+ if ( length > 3 )
+ {
+ n1 = zmw_rx_buf_readb(dev, buf, offset+4) & (~ZM_BIT_0);
+ n2 = length + n1 - 4;
+ q = wd->sta.aid >> 3;
+ r = wd->sta.aid & 7;
+
+ if ((q >= n1) && (q <= n2))
+ {
+ bitmap = zmw_rx_buf_readb(dev, buf, offset+5+q-n1);
+
+ if ( (bitmap >> r) & ZM_BIT_0 )
+ {
+ //if ( wd->sta.powerSaveMode == ZM_STA_PS_FAST )
+ if ( 0 )
+ {
+ wd->sta.psMgr.state = ZM_PS_MSG_STATE_S1;
+ //zfSendPSPoll(dev);
+ zfSendNullData(dev, 0);
+ }
+ else
+ {
+ if ((wd->sta.qosInfo&0xf) != 0xf)
+ {
+ /* send ps-poll */
+ //printk("zfSendPSPoll #1\n");
+
+ wd->sta.psMgr.isSleepAllowed = 0;
+
+ switch (wd->sta.powerSaveMode)
+ {
+ case ZM_STA_PS_MAX:
+ case ZM_STA_PS_FAST:
+ //zm_debug_msg0("wake up and send PS-Poll\n");
+ zfSendPSPoll(dev);
+ break;
+ case ZM_STA_PS_LIGHT:
+ zm_debug_msg0("wake up and send null data\n");
+
+ zmw_enter_critical_section(dev);
+ wd->sta.psMgr.sleepAllowedtick = 400;
+ zmw_leave_critical_section(dev);
+
+ zfSendNullData(dev, 0);
+ break;
+ }
+
+ wd->sta.psMgr.tempWakeUp = 0;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ while ((psBuf = zfQueueGet(dev, wd->sta.uapsdQ)) != NULL)
+ {
+ zfTxSendEth(dev, psBuf, 0, ZM_EXTERNAL_ALLOC_BUF, 0);
+ }
+
+ //printk("zfPowerSavingMgrProcessBeacon #1\n");
+ zfPowerSavingMgrMain(dev);
+}
+
+void zfPowerSavingMgrConnectNotify(zdev_t *dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ if ( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ {
+ switch(wd->sta.powerSaveMode)
+ {
+ case ZM_STA_PS_NONE:
+ zfHpPowerSaveSetMode(dev, 0, 0, wd->beaconInterval);
+ break;
+
+ case ZM_STA_PS_FAST:
+ case ZM_STA_PS_MAX:
+ case ZM_STA_PS_LIGHT:
+ zfHpPowerSaveSetMode(dev, 0, 1, wd->beaconInterval);
+ break;
+
+ default:
+ zfHpPowerSaveSetMode(dev, 0, 0, wd->beaconInterval);
+ break;
+ }
+ }
+}
+
+void zfPowerSavingMgrPreTBTTInterrupt(zdev_t *dev)
+{
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ /* disable TBTT interrupt when change from connection to disconnect */
+ if (zfStaIsDisconnect(dev)) {
+ zfHpPowerSaveSetMode(dev, 0, 0, 0);
+ zfPowerSavingMgrWakeup(dev);
+ return;
+ }
+
+ zmw_enter_critical_section(dev);
+ wd->sta.psMgr.ticks++;
+
+ if ( wd->sta.psMgr.ticks < wd->sta.psMgr.maxSleepPeriods )
+ {
+ zmw_leave_critical_section(dev);
+ return;
+ }
+ else
+ {
+ wd->sta.psMgr.ticks = 0;
+ }
+
+ zmw_leave_critical_section(dev);
+
+ zfPowerSavingMgrWakeup(dev);
+}
+
+/* Leave an empty line below to remove warning message on some compiler */
+
diff --git a/drivers/staging/otus/80211core/cscanmgr.c b/drivers/staging/otus/80211core/cscanmgr.c
new file mode 100644
index 00000000000..b32835c8759
--- /dev/null
+++ b/drivers/staging/otus/80211core/cscanmgr.c
@@ -0,0 +1,535 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "cprecomp.h"
+
+void zfScanMgrInit(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->sta.scanMgr.scanReqs[0] = 0;
+ wd->sta.scanMgr.scanReqs[1] = 0;
+
+ wd->sta.scanMgr.currScanType = ZM_SCAN_MGR_SCAN_NONE;
+ wd->sta.scanMgr.scanStartDelay = 3;
+ //wd->sta.scanMgr.scanStartDelay = 0;
+}
+
+u8_t zfScanMgrScanStart(zdev_t* dev, u8_t scanType)
+{
+ u8_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ zm_debug_msg1("scanType = ", scanType);
+
+ zmw_declare_for_critical_section();
+
+ if ( scanType != ZM_SCAN_MGR_SCAN_INTERNAL &&
+ scanType != ZM_SCAN_MGR_SCAN_EXTERNAL )
+ {
+ zm_debug_msg0("unknown scanType");
+ return 1;
+ }
+ else if (zfStaIsConnecting(dev))
+ {
+ zm_debug_msg0("reject scan request due to connecting");
+ return 1;
+ }
+
+ i = scanType - 1;
+
+ zmw_enter_critical_section(dev);
+
+ if ( wd->sta.scanMgr.scanReqs[i] == 1 )
+ {
+ zm_debug_msg1("scan rescheduled", scanType);
+ goto scan_done;
+ }
+
+ wd->sta.scanMgr.scanReqs[i] = 1;
+ zm_debug_msg1("scan scheduled: ", scanType);
+
+ // If there's no scan pending, we do the scan right away.
+ // If there's an internal scan and the new scan request is external one,
+ // we will restart the scan.
+ if ( wd->sta.scanMgr.currScanType == ZM_SCAN_MGR_SCAN_NONE )
+ {
+ goto schedule_scan;
+ }
+ else if ( wd->sta.scanMgr.currScanType == ZM_SCAN_MGR_SCAN_INTERNAL &&
+ scanType == ZM_SCAN_MGR_SCAN_EXTERNAL )
+ {
+ // Stop the internal scan & schedule external scan first
+ zfTimerCancel(dev, ZM_EVENT_SCAN);
+
+ /* Fix for WHQL sendrecv => we do not apply delay time in which the device
+ stop transmitting packet when we already connect to some AP */
+ wd->sta.bScheduleScan = FALSE;
+
+ zfTimerCancel(dev, ZM_EVENT_TIMEOUT_SCAN);
+ zfTimerCancel(dev, ZM_EVENT_IN_SCAN);
+
+ wd->sta.bChannelScan = FALSE;
+ goto schedule_scan;
+ }
+ else
+ {
+ zm_debug_msg0("Scan is busy...waiting later to start\n");
+ }
+
+ zmw_leave_critical_section(dev);
+ return 0;
+
+scan_done:
+ zmw_leave_critical_section(dev);
+ return 1;
+
+schedule_scan:
+
+ wd->sta.bScheduleScan = TRUE;
+
+ zfTimerSchedule(dev, ZM_EVENT_SCAN, wd->sta.scanMgr.scanStartDelay);
+ wd->sta.scanMgr.scanStartDelay = 3;
+ //wd->sta.scanMgr.scanStartDelay = 0;
+ wd->sta.scanMgr.currScanType = scanType;
+ zmw_leave_critical_section(dev);
+
+ if ((zfStaIsConnected(dev)) && (!zfPowerSavingMgrIsSleeping(dev)))
+ {
+ zfSendNullData(dev, 1);
+ }
+ return 0;
+}
+
+void zfScanMgrScanStop(zdev_t* dev, u8_t scanType)
+{
+ u8_t scanNotifyRequired = 0;
+ u8_t theOtherScan = ZM_SCAN_MGR_SCAN_NONE;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ if ( wd->sta.scanMgr.currScanType == ZM_SCAN_MGR_SCAN_NONE )
+ {
+ zm_assert(wd->sta.scanMgr.scanReqs[0] == 0);
+ zm_assert(wd->sta.scanMgr.scanReqs[1] == 0);
+ goto done;
+ }
+
+ switch(scanType)
+ {
+ case ZM_SCAN_MGR_SCAN_EXTERNAL:
+ scanNotifyRequired = 1;
+ theOtherScan = ZM_SCAN_MGR_SCAN_INTERNAL;
+ break;
+
+ case ZM_SCAN_MGR_SCAN_INTERNAL:
+ theOtherScan = ZM_SCAN_MGR_SCAN_EXTERNAL;
+ break;
+
+ default:
+ goto done;
+ }
+
+ if ( wd->sta.scanMgr.currScanType != scanType )
+ {
+ goto stop_done;
+ }
+
+ zfTimerCancel(dev, ZM_EVENT_SCAN);
+
+ /* Fix for WHQL sendrecv => we do not apply delay time in which the device
+ stop transmitting packet when we already connect to some AP */
+ wd->sta.bScheduleScan = FALSE;
+
+ zfTimerCancel(dev, ZM_EVENT_TIMEOUT_SCAN);
+ zfTimerCancel(dev, ZM_EVENT_IN_SCAN);
+
+ wd->sta.bChannelScan = FALSE;
+ wd->sta.scanFrequency = 0;
+
+ if ( wd->sta.scanMgr.scanReqs[theOtherScan - 1] )
+ {
+ wd->sta.scanMgr.currScanType = theOtherScan;
+
+ // Schedule the other scan after 1 second later
+ zfTimerSchedule(dev, ZM_EVENT_SCAN, 100);
+ }
+ else
+ {
+ wd->sta.scanMgr.currScanType = ZM_SCAN_MGR_SCAN_NONE;
+ }
+
+stop_done:
+ wd->sta.scanMgr.scanReqs[scanType - 1] = 0;
+
+ zmw_leave_critical_section(dev);
+
+ /* avoid lose receive packet when site survey */
+ if ((zfStaIsConnected(dev)) && (!zfPowerSavingMgrIsSleeping(dev)))
+ {
+ zfSendNullData(dev, 0);
+ }
+
+ if ( scanNotifyRequired )
+ {
+ zm_debug_msg0("Scan notify after reset");
+ if (wd->zfcbScanNotify != NULL)
+ {
+ wd->zfcbScanNotify(dev, NULL);
+ }
+ }
+
+ return;
+
+done:
+ zmw_leave_critical_section(dev);
+ return;
+}
+
+void zfScanMgrScanAck(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ wd->sta.scanMgr.scanStartDelay = 3;
+ //wd->sta.scanMgr.scanStartDelay = 0;
+
+ zmw_leave_critical_section(dev);
+ return;
+}
+
+extern void zfStaReconnect(zdev_t* dev);
+
+static void zfScanSendProbeRequest(zdev_t* dev)
+{
+ u8_t k;
+ u16_t dst[3] = { 0xffff, 0xffff, 0xffff };
+
+ zmw_get_wlan_dev(dev);
+
+ /* Increase rxBeaconCount to prevent beacon lost */
+ if (zfStaIsConnected(dev))
+ {
+ wd->sta.rxBeaconCount++;
+ }
+
+ if ( wd->sta.bPassiveScan )
+ {
+ return;
+ }
+ /* enable 802.l11h and in DFS Band , disable sending probe request */
+ if (wd->sta.DFSEnable)
+ {
+ if (zfHpIsDfsChannel(dev, wd->sta.scanFrequency))
+ {
+ return;
+ }
+ }
+
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_PROBEREQ, dst, 0, 0, 0);
+
+ if ( wd->sta.disableProbingWithSsid )
+ {
+ return;
+ }
+
+ for (k=1; k<=ZM_MAX_PROBE_HIDDEN_SSID_SIZE; k++)
+ {
+ if ( wd->ws.probingSsidList[k-1].ssidLen != 0 )
+ {
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_PROBEREQ, dst, k, 0, 0);
+ }
+ }
+}
+
+static void zfScanMgrEventSetFreqCompleteCb(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+//printk("zfScanMgrEventSetFreqCompleteCb #1\n");
+
+ zmw_enter_critical_section(dev);
+ zfTimerSchedule(dev, ZM_EVENT_IN_SCAN, ZM_TICK_IN_SCAN);
+ if (wd->sta.bPassiveScan)
+ {
+ zfTimerSchedule(dev, ZM_EVENT_TIMEOUT_SCAN, wd->sta.passiveScanTickPerChannel);
+ }
+ else
+ {
+ zfTimerSchedule(dev, ZM_EVENT_TIMEOUT_SCAN, wd->sta.activescanTickPerChannel);
+ }
+ zmw_leave_critical_section(dev);
+
+ zfScanSendProbeRequest(dev);
+}
+
+
+static void zfScanMgrEventScanCompleteCb(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ if ((zfStaIsConnected(dev)) && (!zfPowerSavingMgrIsSleeping(dev)))
+ {
+ zfSendNullData(dev, 0);
+ }
+ return;
+}
+
+
+void zfScanMgrScanEventRetry(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ if ( !wd->sta.bChannelScan )
+ {
+ return;
+ }
+
+ if ( !wd->sta.bPassiveScan )
+ {
+ zfScanSendProbeRequest(dev);
+ #if 0
+ zmw_enter_critical_section(dev);
+ zfTimerSchedule(dev, ZM_EVENT_IN_SCAN, ZM_TICK_IN_SCAN);
+ zmw_leave_critical_section(dev);
+ #endif
+ }
+}
+
+u8_t zfScanMgrScanEventTimeout(zdev_t* dev)
+{
+ u16_t nextScanFrequency = 0;
+ u8_t temp;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ if ( wd->sta.scanFrequency == 0 )
+ {
+ zmw_leave_critical_section(dev);
+ return -1;
+ }
+
+ nextScanFrequency = zfChGetNextChannel(dev, wd->sta.scanFrequency,
+ &wd->sta.bPassiveScan);
+
+ if ( (nextScanFrequency == 0xffff)
+ || (wd->sta.scanFrequency == zfChGetLastChannel(dev, &temp)) )
+ {
+ u8_t currScanType;
+ u8_t isExternalScan = 0;
+ u8_t isInternalScan = 0;
+
+ //zm_debug_msg1("end scan = ", KeQueryInterruptTime());
+ wd->sta.scanFrequency = 0;
+
+ zm_debug_msg1("scan 1 type: ", wd->sta.scanMgr.currScanType);
+ zm_debug_msg1("scan channel count = ", wd->regulationTable.allowChannelCnt);
+
+ //zfBssInfoRefresh(dev);
+ zfTimerCancel(dev, ZM_EVENT_TIMEOUT_SCAN);
+
+ if ( wd->sta.bChannelScan == FALSE )
+ {
+ zm_debug_msg0("WOW!! scan is cancelled\n");
+ zmw_leave_critical_section(dev);
+ goto report_scan_result;
+ }
+
+
+ currScanType = wd->sta.scanMgr.currScanType;
+ switch(currScanType)
+ {
+ case ZM_SCAN_MGR_SCAN_EXTERNAL:
+ isExternalScan = 1;
+
+ if ( wd->sta.scanMgr.scanReqs[ZM_SCAN_MGR_SCAN_INTERNAL - 1] )
+ {
+ wd->sta.scanMgr.scanReqs[ZM_SCAN_MGR_SCAN_INTERNAL - 1] = 0;
+ isInternalScan = 1;
+ }
+
+ break;
+
+ case ZM_SCAN_MGR_SCAN_INTERNAL:
+ isInternalScan = 1;
+
+ if ( wd->sta.scanMgr.scanReqs[ZM_SCAN_MGR_SCAN_EXTERNAL - 1] )
+ {
+ // Because the external scan should pre-empts internal scan.
+ // So this shall not be happened!!
+ zm_assert(0);
+ }
+
+ break;
+
+ default:
+ zm_assert(0);
+ break;
+ }
+
+ wd->sta.scanMgr.scanReqs[currScanType - 1] = 0;
+ wd->sta.scanMgr.scanStartDelay = 100;
+ wd->sta.scanMgr.currScanType = ZM_SCAN_MGR_SCAN_NONE;
+ zmw_leave_critical_section(dev);
+
+ //Set channel according to AP's configuration
+ zfCoreSetFrequencyEx(dev, wd->frequency, wd->BandWidth40,
+ wd->ExtOffset, zfScanMgrEventScanCompleteCb);
+
+ wd->sta.bChannelScan = FALSE;
+
+ #if 1
+ if (zfStaIsConnected(dev))
+ { // Finish site survey, reset the variable to detect using wrong frequency !
+ zfHpFinishSiteSurvey(dev, 1);
+ zmw_enter_critical_section(dev);
+ wd->sta.ibssSiteSurveyStatus = 2;
+ wd->tickIbssReceiveBeacon = 0;
+ wd->sta.ibssReceiveBeaconCount = 0;
+ zmw_leave_critical_section(dev);
+
+ /* #5 Re-enable RIFS function after the site survey ! */
+ /* This is because switch band will reset the BB register to initial value */
+ if( wd->sta.rifsState == ZM_RIFS_STATE_DETECTED )
+ {
+ zfHpEnableRifs(dev, ((wd->sta.currentFrequency<3000)?1:0), wd->sta.EnableHT, wd->sta.HT2040);
+ }
+ }
+ else
+ {
+ zfHpFinishSiteSurvey(dev, 0);
+ zmw_enter_critical_section(dev);
+ wd->sta.ibssSiteSurveyStatus = 0;
+ zmw_leave_critical_section(dev);
+ }
+ #endif
+
+report_scan_result:
+ /* avoid lose receive packet when site survey */
+ //if ((zfStaIsConnected(dev)) && (!zfPowerSavingMgrIsSleeping(dev)))
+ //{
+ // zfSendNullData(dev, 0);
+ //}
+
+ if ( isExternalScan )//Quickly reboot
+ {
+ if (wd->zfcbScanNotify != NULL)
+ {
+ wd->zfcbScanNotify(dev, NULL);
+ }
+ }
+
+ if ( isInternalScan )
+ {
+ //wd->sta.InternalScanReq = 0;
+ zfStaReconnect(dev);
+ }
+
+ return 0;
+ }
+ else
+ {
+ wd->sta.scanFrequency = nextScanFrequency;
+
+ //zmw_enter_critical_section(dev);
+ zfTimerCancel(dev, ZM_EVENT_IN_SCAN);
+ zmw_leave_critical_section(dev);
+
+ zm_debug_msg0("scan 2");
+ zfCoreSetFrequencyV2(dev, wd->sta.scanFrequency, zfScanMgrEventSetFreqCompleteCb);
+
+ return 1;
+ }
+}
+
+void zfScanMgrScanEventStart(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ if ( wd->sta.bChannelScan )
+ {
+ return;
+ }
+
+ zfPowerSavingMgrWakeup(dev);
+
+ zmw_enter_critical_section(dev);
+
+ if ( wd->sta.scanMgr.currScanType == ZM_SCAN_MGR_SCAN_NONE )
+ {
+ goto no_scan;
+ }
+
+ //zfBssInfoRefresh(dev);
+ zfBssInfoRefresh(dev, 0);
+ wd->sta.bChannelScan = TRUE;
+ wd->sta.bScheduleScan = FALSE;
+ zfTimerCancel(dev, ZM_EVENT_IN_SCAN);
+ zfTimerCancel(dev, ZM_EVENT_TIMEOUT_SCAN);
+
+ //zm_debug_msg1("start scan = ", KeQueryInterruptTime());
+ wd->sta.scanFrequency = zfChGetFirstChannel(dev, &wd->sta.bPassiveScan);
+ zmw_leave_critical_section(dev);
+
+ /* avoid lose receive packet when site survey */
+ //if ((zfStaIsConnected(dev)) && (!zfPowerSavingMgrIsSleeping(dev)))
+ //{
+ // zfSendNullData(dev, 1);
+ //}
+// zm_debug_msg0("scan 0");
+// zfCoreSetFrequencyV2(dev, wd->sta.scanFrequency, zfScanMgrEventSetFreqCompleteCb);
+
+ #if 1
+ if (zfStaIsConnected(dev))
+ {// If doing site survey !
+ zfHpBeginSiteSurvey(dev, 1);
+ zmw_enter_critical_section(dev);
+ wd->sta.ibssSiteSurveyStatus = 1;
+ zmw_leave_critical_section(dev);
+ }
+ else
+ {
+ zfHpBeginSiteSurvey(dev, 0);
+ zmw_enter_critical_section(dev);
+ wd->sta.ibssSiteSurveyStatus = 0;
+ zmw_leave_critical_section(dev);
+ }
+ #endif
+
+ zm_debug_msg0("scan 0");
+ zfCoreSetFrequencyV2(dev, wd->sta.scanFrequency, zfScanMgrEventSetFreqCompleteCb);
+
+ return;
+
+no_scan:
+ zmw_leave_critical_section(dev);
+ return;
+}
diff --git a/drivers/staging/otus/80211core/ctkip.c b/drivers/staging/otus/80211core/ctkip.c
new file mode 100644
index 00000000000..be42f7aaa37
--- /dev/null
+++ b/drivers/staging/otus/80211core/ctkip.c
@@ -0,0 +1,598 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : ctkip.c */
+/* */
+/* Abstract */
+/* This module contains Tx and Rx functions. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/************************************************************************/
+#include "cprecomp.h"
+
+u16_t zgTkipSboxLower[256] =
+ {
+ 0xA5,0x84,0x99,0x8D,0x0D,0xBD,0xB1,0x54,
+ 0x50,0x03,0xA9,0x7D,0x19,0x62,0xE6,0x9A,
+ 0x45,0x9D,0x40,0x87,0x15,0xEB,0xC9,0x0B,
+ 0xEC,0x67,0xFD,0xEA,0xBF,0xF7,0x96,0x5B,
+ 0xC2,0x1C,0xAE,0x6A,0x5A,0x41,0x02,0x4F,
+ 0x5C,0xF4,0x34,0x08,0x93,0x73,0x53,0x3F,
+ 0x0C,0x52,0x65,0x5E,0x28,0xA1,0x0F,0xB5,
+ 0x09,0x36,0x9B,0x3D,0x26,0x69,0xCD,0x9F,
+ 0x1B,0x9E,0x74,0x2E,0x2D,0xB2,0xEE,0xFB,
+ 0xF6,0x4D,0x61,0xCE,0x7B,0x3E,0x71,0x97,
+ 0xF5,0x68,0x00,0x2C,0x60,0x1F,0xC8,0xED,
+ 0xBE,0x46,0xD9,0x4B,0xDE,0xD4,0xE8,0x4A,
+ 0x6B,0x2A,0xE5,0x16,0xC5,0xD7,0x55,0x94,
+ 0xCF,0x10,0x06,0x81,0xF0,0x44,0xBA,0xE3,
+ 0xF3,0xFE,0xC0,0x8A,0xAD,0xBC,0x48,0x04,
+ 0xDF,0xC1,0x75,0x63,0x30,0x1A,0x0E,0x6D,
+ 0x4C,0x14,0x35,0x2F,0xE1,0xA2,0xCC,0x39,
+ 0x57,0xF2,0x82,0x47,0xAC,0xE7,0x2B,0x95,
+ 0xA0,0x98,0xD1,0x7F,0x66,0x7E,0xAB,0x83,
+ 0xCA,0x29,0xD3,0x3C,0x79,0xE2,0x1D,0x76,
+ 0x3B,0x56,0x4E,0x1E,0xDB,0x0A,0x6C,0xE4,
+ 0x5D,0x6E,0xEF,0xA6,0xA8,0xA4,0x37,0x8B,
+ 0x32,0x43,0x59,0xB7,0x8C,0x64,0xD2,0xE0,
+ 0xB4,0xFA,0x07,0x25,0xAF,0x8E,0xE9,0x18,
+ 0xD5,0x88,0x6F,0x72,0x24,0xF1,0xC7,0x51,
+ 0x23,0x7C,0x9C,0x21,0xDD,0xDC,0x86,0x85,
+ 0x90,0x42,0xC4,0xAA,0xD8,0x05,0x01,0x12,
+ 0xA3,0x5F,0xF9,0xD0,0x91,0x58,0x27,0xB9,
+ 0x38,0x13,0xB3,0x33,0xBB,0x70,0x89,0xA7,
+ 0xB6,0x22,0x92,0x20,0x49,0xFF,0x78,0x7A,
+ 0x8F,0xF8,0x80,0x17,0xDA,0x31,0xC6,0xB8,
+ 0xC3,0xB0,0x77,0x11,0xCB,0xFC,0xD6,0x3A
+ };
+
+
+u16_t zgTkipSboxUpper[256] =
+ {
+ 0xC6,0xF8,0xEE,0xF6,0xFF,0xD6,0xDE,0x91,
+ 0x60,0x02,0xCE,0x56,0xE7,0xB5,0x4D,0xEC,
+ 0x8F,0x1F,0x89,0xFA,0xEF,0xB2,0x8E,0xFB,
+ 0x41,0xB3,0x5F,0x45,0x23,0x53,0xE4,0x9B,
+ 0x75,0xE1,0x3D,0x4C,0x6C,0x7E,0xF5,0x83,
+ 0x68,0x51,0xD1,0xF9,0xE2,0xAB,0x62,0x2A,
+ 0x08,0x95,0x46,0x9D,0x30,0x37,0x0A,0x2F,
+ 0x0E,0x24,0x1B,0xDF,0xCD,0x4E,0x7F,0xEA,
+ 0x12,0x1D,0x58,0x34,0x36,0xDC,0xB4,0x5B,
+ 0xA4,0x76,0xB7,0x7D,0x52,0xDD,0x5E,0x13,
+ 0xA6,0xB9,0x00,0xC1,0x40,0xE3,0x79,0xB6,
+ 0xD4,0x8D,0x67,0x72,0x94,0x98,0xB0,0x85,
+ 0xBB,0xC5,0x4F,0xED,0x86,0x9A,0x66,0x11,
+ 0x8A,0xE9,0x04,0xFE,0xA0,0x78,0x25,0x4B,
+ 0xA2,0x5D,0x80,0x05,0x3F,0x21,0x70,0xF1,
+ 0x63,0x77,0xAF,0x42,0x20,0xE5,0xFD,0xBF,
+ 0x81,0x18,0x26,0xC3,0xBE,0x35,0x88,0x2E,
+ 0x93,0x55,0xFC,0x7A,0xC8,0xBA,0x32,0xE6,
+ 0xC0,0x19,0x9E,0xA3,0x44,0x54,0x3B,0x0B,
+ 0x8C,0xC7,0x6B,0x28,0xA7,0xBC,0x16,0xAD,
+ 0xDB,0x64,0x74,0x14,0x92,0x0C,0x48,0xB8,
+ 0x9F,0xBD,0x43,0xC4,0x39,0x31,0xD3,0xF2,
+ 0xD5,0x8B,0x6E,0xDA,0x01,0xB1,0x9C,0x49,
+ 0xD8,0xAC,0xF3,0xCF,0xCA,0xF4,0x47,0x10,
+ 0x6F,0xF0,0x4A,0x5C,0x38,0x57,0x73,0x97,
+ 0xCB,0xA1,0xE8,0x3E,0x96,0x61,0x0D,0x0F,
+ 0xE0,0x7C,0x71,0xCC,0x90,0x06,0xF7,0x1C,
+ 0xC2,0x6A,0xAE,0x69,0x17,0x99,0x3A,0x27,
+ 0xD9,0xEB,0x2B,0x22,0xD2,0xA9,0x07,0x33,
+ 0x2D,0x3C,0x15,0xC9,0x87,0xAA,0x50,0xA5,
+ 0x03,0x59,0x09,0x1A,0x65,0xD7,0x84,0xD0,
+ 0x82,0x29,0x5A,0x1E,0x7B,0xA8,0x6D,0x2C
+ };
+
+u16_t zfrotr1(u16_t a)
+// rotate right by 1 bit.
+{
+ u16_t b;
+
+ if (a & 0x01)
+ {
+ b = (a >> 1) | 0x8000;
+ }
+ else
+ {
+ b = (a >> 1) & 0x7fff;
+ }
+ return b;
+}
+
+/*************************************************************/
+/* zfTkipSbox() */
+/* Returns a 16 bit value from a 64K entry table. The Table */
+/* is synthesized from two 256 entry byte wide tables. */
+/*************************************************************/
+u16_t zfTkipSbox(u16_t index)
+{
+ u16_t low;
+ u16_t high;
+ u16_t left, right;
+
+ low = (index & 0xFF);
+ high = ((index >> 8) & 0xFF);
+
+ left = zgTkipSboxLower[low] + (zgTkipSboxUpper[low] << 8 );
+ right = zgTkipSboxUpper[high] + (zgTkipSboxLower[high] << 8 );
+
+ return (left ^ right);
+}
+
+u8_t zfTkipPhase1KeyMix(u32_t iv32, struct zsTkipSeed* pSeed)
+{
+ u16_t tsc0;
+ u16_t tsc1;
+ u16_t i, j;
+#if 0
+ /* Need not proceed this function with the same iv32 */
+ if ( iv32 == pSeed->iv32 )
+ {
+ return 1;
+ }
+#endif
+ tsc0 = (u16_t) ((iv32 >> 16) & 0xffff); /* msb */
+ tsc1 = (u16_t) (iv32 & 0xffff);
+
+ /* Phase 1, step 1 */
+ pSeed->ttak[0] = tsc1;
+ pSeed->ttak[1] = tsc0;
+ pSeed->ttak[2] = (u16_t) (pSeed->ta[0] + (pSeed->ta[1] <<8));
+ pSeed->ttak[3] = (u16_t) (pSeed->ta[2] + (pSeed->ta[3] <<8));
+ pSeed->ttak[4] = (u16_t) (pSeed->ta[4] + (pSeed->ta[5] <<8));
+
+ /* Phase 1, step 2 */
+ for (i=0; i<8; i++)
+ {
+ j = 2*(i & 1);
+ pSeed->ttak[0] =(pSeed->ttak[0] + zfTkipSbox(pSeed->ttak[4]
+ ^ ZM_BYTE_TO_WORD(pSeed->tk[1+j], pSeed->tk[j])))
+ & 0xffff;
+ pSeed->ttak[1] =(pSeed->ttak[1] + zfTkipSbox(pSeed->ttak[0]
+ ^ ZM_BYTE_TO_WORD(pSeed->tk[5+j], pSeed->tk[4+j] )))
+ & 0xffff;
+ pSeed->ttak[2] =(pSeed->ttak[2] + zfTkipSbox(pSeed->ttak[1]
+ ^ ZM_BYTE_TO_WORD(pSeed->tk[9+j], pSeed->tk[8+j] )))
+ & 0xffff;
+ pSeed->ttak[3] =(pSeed->ttak[3] + zfTkipSbox(pSeed->ttak[2]
+ ^ ZM_BYTE_TO_WORD(pSeed->tk[13+j], pSeed->tk[12+j])))
+ & 0xffff;
+ pSeed->ttak[4] =(pSeed->ttak[4] + zfTkipSbox(pSeed->ttak[3]
+ ^ ZM_BYTE_TO_WORD(pSeed->tk[1+j], pSeed->tk[j] )))
+ & 0xffff;
+ pSeed->ttak[4] =(pSeed->ttak[4] + i) & 0xffff;
+ }
+
+ if ( iv32 == (pSeed->iv32+1) )
+ {
+ pSeed->iv32tmp = iv32;
+ return 1;
+ }
+
+ return 0;
+}
+
+u8_t zfTkipPhase2KeyMix(u16_t iv16, struct zsTkipSeed* pSeed)
+{
+ u16_t tsc2;
+
+ tsc2 = iv16;
+
+ /* Phase 2, Step 1 */
+ pSeed->ppk[0] = pSeed->ttak[0];
+ pSeed->ppk[1] = pSeed->ttak[1];
+ pSeed->ppk[2] = pSeed->ttak[2];
+ pSeed->ppk[3] = pSeed->ttak[3];
+ pSeed->ppk[4] = pSeed->ttak[4];
+ pSeed->ppk[5] = (pSeed->ttak[4] + tsc2) & 0xffff;
+
+ /* Phase2, Step 2 */
+ pSeed->ppk[0] = pSeed->ppk[0]
+ + zfTkipSbox(pSeed->ppk[5] ^ ZM_BYTE_TO_WORD(pSeed->tk[1],pSeed->tk[0]));
+ pSeed->ppk[1] = pSeed->ppk[1]
+ + zfTkipSbox(pSeed->ppk[0] ^ ZM_BYTE_TO_WORD(pSeed->tk[3],pSeed->tk[2]));
+ pSeed->ppk[2] = pSeed->ppk[2]
+ + zfTkipSbox(pSeed->ppk[1] ^ ZM_BYTE_TO_WORD(pSeed->tk[5],pSeed->tk[4]));
+ pSeed->ppk[3] = pSeed->ppk[3]
+ + zfTkipSbox(pSeed->ppk[2] ^ ZM_BYTE_TO_WORD(pSeed->tk[7],pSeed->tk[6]));
+ pSeed->ppk[4] = pSeed->ppk[4]
+ + zfTkipSbox(pSeed->ppk[3] ^ ZM_BYTE_TO_WORD(pSeed->tk[9],pSeed->tk[8]));
+ pSeed->ppk[5] = pSeed->ppk[5]
+ + zfTkipSbox(pSeed->ppk[4] ^ ZM_BYTE_TO_WORD(pSeed->tk[11],pSeed->tk[10]));
+
+ pSeed->ppk[0] = pSeed->ppk[0]
+ + zfrotr1(pSeed->ppk[5] ^ ZM_BYTE_TO_WORD(pSeed->tk[13],pSeed->tk[12]));
+ pSeed->ppk[1] = pSeed->ppk[1]
+ + zfrotr1(pSeed->ppk[0] ^ ZM_BYTE_TO_WORD(pSeed->tk[15],pSeed->tk[14]));
+ pSeed->ppk[2] = pSeed->ppk[2] + zfrotr1(pSeed->ppk[1]);
+ pSeed->ppk[3] = pSeed->ppk[3] + zfrotr1(pSeed->ppk[2]);
+ pSeed->ppk[4] = pSeed->ppk[4] + zfrotr1(pSeed->ppk[3]);
+ pSeed->ppk[5] = pSeed->ppk[5] + zfrotr1(pSeed->ppk[4]);
+
+ if (iv16 == 0)
+ {
+ if (pSeed->iv16 == 0xffff)
+ {
+ pSeed->iv16tmp=0;
+ return 1;
+ }
+ else
+ return 0;
+ }
+ else if (iv16 == (pSeed->iv16+1))
+ {
+ pSeed->iv16tmp = iv16;
+ return 1;
+ }
+ else
+ return 0;
+}
+
+void zfTkipInit(u8_t* key, u8_t* ta, struct zsTkipSeed* pSeed, u8_t* initIv)
+{
+ u16_t iv16;
+ u32_t iv32;
+ u16_t i;
+
+ /* clear memory */
+ zfZeroMemory((u8_t*) pSeed, sizeof(struct zsTkipSeed));
+ /* set key to seed */
+ zfMemoryCopy(pSeed->ta, ta, 6);
+ zfMemoryCopy(pSeed->tk, key, 16);
+
+ iv16 = *initIv++;
+ iv16 += *initIv<<8;
+ initIv++;
+
+ iv32=0;
+
+ for(i=0; i<4; i++) // initiv is little endian
+ {
+ iv32 += *initIv<<(i*8);
+ *initIv++;
+ }
+
+ pSeed->iv32 = iv32+1; // Force Recalculating on Tkip Phase1
+ zfTkipPhase1KeyMix(iv32, pSeed);
+
+ pSeed->iv16 = iv16;
+ pSeed->iv32 = iv32;
+}
+
+u32_t zfGetU32t(u8_t* p)
+{
+ u32_t res=0;
+ u16_t i;
+
+ for( i=0; i<4; i++ )
+ {
+ res |= (*p++) << (8*i);
+ }
+
+ return res;
+
+}
+
+void zfPutU32t(u8_t* p, u32_t value)
+{
+ u16_t i;
+
+ for(i=0; i<4; i++)
+ {
+ *p++ = (u8_t) (value & 0xff);
+ value >>= 8;
+ }
+}
+
+void zfMicClear(struct zsMicVar* pMic)
+{
+ pMic->left = pMic->k0;
+ pMic->right = pMic->k1;
+ pMic->nBytes = 0;
+ pMic->m = 0;
+}
+
+void zfMicSetKey(u8_t* key, struct zsMicVar* pMic)
+{
+ pMic->k0 = zfGetU32t(key);
+ pMic->k1 = zfGetU32t(key+4);
+ zfMicClear(pMic);
+}
+
+void zfMicAppendByte(u8_t b, struct zsMicVar* pMic)
+{
+ // Append the byte to our word-sized buffer
+ pMic->m |= b << (8* pMic->nBytes);
+ pMic->nBytes++;
+
+ // Process the word if it is full.
+ if ( pMic->nBytes >= 4 )
+ {
+ pMic->left ^= pMic->m;
+ pMic->right ^= ZM_ROL32(pMic->left, 17 );
+ pMic->left += pMic->right;
+ pMic->right ^= ((pMic->left & 0xff00ff00) >> 8) |
+ ((pMic->left & 0x00ff00ff) << 8);
+ pMic->left += pMic->right;
+ pMic->right ^= ZM_ROL32( pMic->left, 3 );
+ pMic->left += pMic->right;
+ pMic->right ^= ZM_ROR32( pMic->left, 2 );
+ pMic->left += pMic->right;
+ // Clear the buffer
+ pMic->m = 0;
+ pMic->nBytes = 0;
+ }
+}
+
+void zfMicGetMic(u8_t* dst, struct zsMicVar* pMic)
+{
+ // Append the minimum padding
+ zfMicAppendByte(0x5a, pMic);
+ zfMicAppendByte(0, pMic);
+ zfMicAppendByte(0, pMic);
+ zfMicAppendByte(0, pMic);
+ zfMicAppendByte(0, pMic);
+
+ // and then zeroes until the length is a multiple of 4
+ while( pMic->nBytes != 0 )
+ {
+ zfMicAppendByte(0, pMic);
+ }
+
+ // The appendByte function has already computed the result.
+ zfPutU32t(dst, pMic->left);
+ zfPutU32t(dst+4, pMic->right);
+
+ // Reset to the empty message.
+ zfMicClear(pMic);
+
+}
+
+u8_t zfMicRxVerify(zdev_t* dev, zbuf_t* buf)
+{
+ struct zsMicVar* pMicKey;
+ struct zsMicVar MyMicKey;
+ u8_t mic[8];
+ u8_t da[6];
+ u8_t sa[6];
+ u8_t bValue;
+ u16_t i, payloadOffset, tailOffset;
+
+ zmw_get_wlan_dev(dev);
+
+ /* need not check MIC if pMicKEy is equal to NULL */
+ if ( wd->wlanMode == ZM_MODE_AP )
+ {
+ pMicKey = zfApGetRxMicKey(dev, buf);
+
+ if ( pMicKey != NULL )
+ {
+ zfCopyFromRxBuffer(dev, buf, sa, ZM_WLAN_HEADER_A2_OFFSET, 6);
+ zfCopyFromRxBuffer(dev, buf, da, ZM_WLAN_HEADER_A3_OFFSET, 6);
+ }
+ else
+ {
+ return ZM_MIC_SUCCESS;
+ }
+ }
+ else if ( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ {
+ pMicKey = zfStaGetRxMicKey(dev, buf);
+
+ if ( pMicKey != NULL )
+ {
+ zfCopyFromRxBuffer(dev, buf, sa, ZM_WLAN_HEADER_A3_OFFSET, 6);
+ zfCopyFromRxBuffer(dev, buf, da, ZM_WLAN_HEADER_A1_OFFSET, 6);
+ }
+ else
+ {
+ return ZM_MIC_SUCCESS;
+ }
+ }
+ else
+ {
+ return ZM_MIC_SUCCESS;
+ }
+
+ MyMicKey.k0=pMicKey->k0;
+ MyMicKey.k1=pMicKey->k1;
+ pMicKey = &MyMicKey;
+
+ zfMicClear(pMicKey);
+ tailOffset = zfwBufGetSize(dev, buf);
+ tailOffset -= 8;
+
+ /* append DA */
+ for(i=0; i<6; i++)
+ {
+ zfMicAppendByte(da[i], pMicKey);
+ }
+ /* append SA */
+ for(i=0; i<6; i++)
+ {
+ zfMicAppendByte(sa[i], pMicKey);
+ }
+
+ /* append for alignment */
+ if ((zmw_rx_buf_readb(dev, buf, 0) & 0x80) != 0)
+ zfMicAppendByte(zmw_rx_buf_readb(dev, buf,24)&0x7, pMicKey);
+ else
+ zfMicAppendByte(0, pMicKey);
+ zfMicAppendByte(0, pMicKey);
+ zfMicAppendByte(0, pMicKey);
+ zfMicAppendByte(0, pMicKey);
+
+ /* append payload */
+ payloadOffset = ZM_SIZE_OF_WLAN_DATA_HEADER +
+ ZM_SIZE_OF_IV +
+ ZM_SIZE_OF_EXT_IV;
+
+ if ((zmw_rx_buf_readb(dev, buf, 0) & 0x80) != 0)
+ {
+ /* Qos Packet, Plcpheader + 2 */
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ /* TODO : Rx Qos element offset in software MIC check */
+ }
+ else if (wd->wlanMode == ZM_MODE_INFRASTRUCTURE)
+ {
+ if (wd->sta.wmeConnected != 0)
+ {
+ payloadOffset += 2;
+ }
+ }
+ }
+
+ for(i=payloadOffset; i<tailOffset; i++)
+ {
+ bValue = zmw_rx_buf_readb(dev, buf, i);
+ zfMicAppendByte(bValue, pMicKey);
+ }
+
+ zfMicGetMic(mic, pMicKey);
+
+ if ( !zfRxBufferEqualToStr(dev, buf, mic, tailOffset, 8) )
+ {
+ return ZM_MIC_FAILURE;
+ }
+
+ return ZM_MIC_SUCCESS;
+}
+
+void zfTkipGetseeds(u16_t iv16, u8_t *RC4Key, struct zsTkipSeed *Seed)
+{
+ RC4Key[0] = ZM_HI8(iv16);
+ RC4Key[1] = (ZM_HI8(iv16) | 0x20) & 0x7f;
+ RC4Key[2] = ZM_LO8(iv16);
+ RC4Key[3] = ((Seed->ppk[5] ^ ZM_BYTE_TO_WORD(Seed->tk[1],Seed->tk[0]))>>1) & 0xff;
+ RC4Key[4] = Seed->ppk[0] & 0xff;
+ RC4Key[5] = Seed->ppk[0] >> 8;
+ RC4Key[6] = Seed->ppk[1] & 0xff;
+ RC4Key[7] = Seed->ppk[1] >> 8;
+ RC4Key[8] = Seed->ppk[2] & 0xff;
+ RC4Key[9] = Seed->ppk[2] >> 8;
+ RC4Key[10] = Seed->ppk[3] & 0xff;
+ RC4Key[11] = Seed->ppk[3] >> 8;
+ RC4Key[12] = Seed->ppk[4] & 0xff;
+ RC4Key[13] = Seed->ppk[4] >> 8;
+ RC4Key[14] = Seed->ppk[5] & 0xff;
+ RC4Key[15] = Seed->ppk[5] >> 8;
+}
+
+void zfCalTxMic(zdev_t *dev, zbuf_t *buf, u8_t *snap, u16_t snapLen, u16_t offset, u16_t *da, u16_t *sa, u8_t up, u8_t *mic)
+{
+ struct zsMicVar* pMicKey;
+ u16_t i;
+ u16_t len;
+ u8_t bValue;
+ u8_t qosType;
+ u8_t *pDa = (u8_t *)da;
+ u8_t *pSa = (u8_t *)sa;
+
+ zmw_get_wlan_dev(dev);
+
+ /* need not check MIC if pMicKEy is equal to NULL */
+ if ( wd->wlanMode == ZM_MODE_AP )
+ {
+ pMicKey = zfApGetTxMicKey(dev, buf, &qosType);
+
+ if ( pMicKey == NULL )
+ return;
+ }
+ else if ( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ {
+ pMicKey = zfStaGetTxMicKey(dev, buf);
+
+ if ( pMicKey == NULL )
+ {
+ zm_debug_msg0("pMicKey is NULL");
+ return;
+ }
+ }
+ else
+ {
+ return;
+ }
+
+ zfMicClear(pMicKey);
+ len = zfwBufGetSize(dev, buf);
+
+ /* append DA */
+ for(i = 0; i < 6; i++)
+ {
+ zfMicAppendByte(pDa[i], pMicKey);
+ }
+
+ /* append SA */
+ for(i = 0; i < 6; i++)
+ {
+ zfMicAppendByte(pSa[i], pMicKey);
+ }
+
+ if (up != 0)
+ zfMicAppendByte((up&0x7), pMicKey);
+ else
+ zfMicAppendByte(0, pMicKey);
+
+ zfMicAppendByte(0, pMicKey);
+ zfMicAppendByte(0, pMicKey);
+ zfMicAppendByte(0, pMicKey);
+
+ /* For Snap header */
+ for(i = 0; i < snapLen; i++)
+ {
+ zfMicAppendByte(snap[i], pMicKey);
+ }
+
+ for(i = offset; i < len; i++)
+ {
+ bValue = zmw_tx_buf_readb(dev, buf, i);
+ zfMicAppendByte(bValue, pMicKey);
+ }
+
+ zfMicGetMic(mic, pMicKey);
+}
+
+void zfTKIPEncrypt(zdev_t *dev, zbuf_t *buf, u8_t *snap, u16_t snapLen, u16_t offset, u8_t keyLen, u8_t* key, u32_t* icv)
+{
+ u8_t iv[3];
+
+ iv[0] = key[0];
+ iv[1] = key[1];
+ iv[2] = key[2];
+
+ keyLen -= 3;
+
+ zfWEPEncrypt(dev, buf, snap, snapLen, offset, keyLen, &key[3], iv);
+}
+
+u16_t zfTKIPDecrypt(zdev_t *dev, zbuf_t *buf, u16_t offset, u8_t keyLen, u8_t* key)
+{
+ u16_t ret = ZM_ICV_SUCCESS;
+ u8_t iv[3];
+
+ iv[0] = key[0];
+ iv[1] = key[1];
+ iv[2] = key[2];
+
+ keyLen -= 3;
+
+ ret = zfWEPDecrypt(dev, buf, offset, keyLen, &key[3], iv);
+
+ return ret;
+}
diff --git a/drivers/staging/otus/80211core/ctxrx.c b/drivers/staging/otus/80211core/ctxrx.c
new file mode 100644
index 00000000000..e258a7df536
--- /dev/null
+++ b/drivers/staging/otus/80211core/ctxrx.c
@@ -0,0 +1,4096 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : htr.c */
+/* */
+/* Abstract */
+/* This module contains Tx and Rx functions. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/************************************************************************/
+#include "cprecomp.h"
+
+u16_t zfWlanRxValidate(zdev_t* dev, zbuf_t* buf);
+u16_t zfWlanRxFilter(zdev_t* dev, zbuf_t* buf);
+
+
+
+const u8_t zgSnapBridgeTunnel[6] = { 0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8 };
+const u8_t zgSnap8021h[6] = { 0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00 };
+/* Table for converting IP DSCP P2-P0 bits to 802.11e Access Category */
+const u8_t zcUpToAc[8] = {0, 1, 1, 0, 2, 2, 3, 3}; //WMM default
+//const u8_t zcUpToAc[8] = {0, 1, 1, 0, 0, 0, 0, 0}; //For 2 TxQ
+//const u8_t zcUpToAc[8] = {0, 0, 0, 0, 0, 0, 0, 0}; //For single TxQ
+const u8_t zcMaxspToPktNum[4] = {8, 2, 4, 6};
+
+u8_t zfGetEncryModeFromRxStatus(struct zsAdditionInfo* addInfo)
+{
+ u8_t securityByte;
+ u8_t encryMode;
+
+ securityByte = (addInfo->Tail.Data.SAIndex & 0xc0) >> 4; /* byte4 */
+ securityByte |= (addInfo->Tail.Data.DAIndex & 0xc0) >> 6; /* byte5 */
+
+ switch( securityByte )
+ {
+ case ZM_NO_WEP:
+ case ZM_WEP64:
+ case ZM_WEP128:
+ case ZM_WEP256:
+#ifdef ZM_ENABLE_CENC
+ case ZM_CENC:
+#endif //ZM_ENABLE_CENC
+ case ZM_TKIP:
+ case ZM_AES:
+
+ encryMode = securityByte;
+ break;
+
+ default:
+
+ if ( (securityByte & 0xf8) == 0x08 )
+ {
+ // decrypted by software
+ }
+
+ encryMode = ZM_NO_WEP;
+ break;
+ }
+
+ return encryMode;
+}
+
+void zfGetRxIvIcvLength(zdev_t* dev, zbuf_t* buf, u8_t vap, u16_t* pIvLen,
+ u16_t* pIcvLen, struct zsAdditionInfo* addInfo)
+{
+ u16_t wdsPort;
+ u8_t encryMode;
+
+ zmw_get_wlan_dev(dev);
+
+ *pIvLen = 0;
+ *pIcvLen = 0;
+
+ encryMode = zfGetEncryModeFromRxStatus(addInfo);
+
+ if ( wd->wlanMode == ZM_MODE_AP )
+ {
+ if (vap < ZM_MAX_AP_SUPPORT)
+ {
+ if (( wd->ap.encryMode[vap] == ZM_WEP64 ) ||
+ ( wd->ap.encryMode[vap] == ZM_WEP128 ) ||
+ ( wd->ap.encryMode[vap] == ZM_WEP256 ))
+ {
+ *pIvLen = 4;
+ *pIcvLen = 4;
+ }
+ else
+ {
+ u16_t id;
+ u16_t addr[3];
+
+ addr[0] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A2_OFFSET);
+ addr[1] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A2_OFFSET+2);
+ addr[2] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A2_OFFSET+4);
+
+ /* Find STA's information */
+ if ((id = zfApFindSta(dev, addr)) != 0xffff)
+ {
+ if (wd->ap.staTable[id].encryMode == ZM_TKIP)
+ {
+ *pIvLen = 8;
+ *pIcvLen = 4;
+ }
+ else if (wd->ap.staTable[id].encryMode == ZM_AES)
+ {
+ *pIvLen = 8;
+ *pIcvLen = 8; // AES MIC
+ //*pIcvLen = 0;
+ }
+#ifdef ZM_ENABLE_CENC
+ else if (wd->ap.staTable[id].encryMode == ZM_CENC)
+ {
+ *pIvLen = 18;
+ *pIcvLen= 16;
+ }
+#endif //ZM_ENABLE_CENC
+ }
+ }
+ /* WDS port checking */
+ if ((wdsPort = vap - 0x20) >= ZM_MAX_WDS_SUPPORT)
+ {
+ wdsPort = 0;
+ }
+
+ switch (wd->ap.wds.encryMode[wdsPort])
+ {
+ case ZM_WEP64:
+ case ZM_WEP128:
+ case ZM_WEP256:
+ *pIvLen = 4;
+ *pIcvLen = 4;
+ break;
+ case ZM_TKIP:
+ *pIvLen = 8;
+ *pIcvLen = 4;
+ break;
+ case ZM_AES:
+ *pIvLen = 8;
+ *pIcvLen = 0;
+ break;
+#ifdef ZM_ENABLE_CENC
+ case ZM_CENC:
+ *pIvLen = 18;
+ *pIcvLen = 16;
+ break;
+#endif //ZM_ENABLE_CENC
+ }/* end of switch */
+ }
+ }
+ else if ( wd->wlanMode == ZM_MODE_PSEUDO)
+ {
+ /* test: 6518 for QA auto test */
+ switch (encryMode)
+ {
+ case ZM_WEP64:
+ case ZM_WEP128:
+ case ZM_WEP256:
+ *pIvLen = 4;
+ *pIcvLen = 4;
+ break;
+ case ZM_TKIP:
+ *pIvLen = 8;
+ *pIcvLen = 4;
+ break;
+ case ZM_AES:
+ *pIvLen = 8;
+ *pIcvLen = 0;
+ break;
+#ifdef ZM_ENABLE_CENC
+ case ZM_CENC:
+ *pIvLen = 18;
+ *pIcvLen = 16;
+#endif //ZM_ENABLE_CENC
+ }/* end of switch */
+ }
+ else
+ {
+ if ( (encryMode == ZM_WEP64)||
+ (encryMode == ZM_WEP128)||
+ (encryMode == ZM_WEP256) )
+ {
+ *pIvLen = 4;
+ *pIcvLen = 4;
+ }
+ else if ( encryMode == ZM_TKIP )
+ {
+ *pIvLen = 8;
+ *pIcvLen = 4;
+ }
+ else if ( encryMode == ZM_AES )
+ {
+ *pIvLen = 8;
+ *pIcvLen = 8; // AES MIC
+ }
+#ifdef ZM_ENABLE_CENC
+ else if ( encryMode == ZM_CENC)
+ {
+ *pIvLen = 18;
+ *pIcvLen= 16;
+ }
+#endif //ZM_ENABLE_CENC
+ }
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfAgingDefragList */
+/* Force flushing whole defrag list or aging the buffer */
+/* in the defrag list. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* flushFlag : 1=>flushing, 0=>Aging */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2007.1 */
+/* */
+/************************************************************************/
+void zfAgingDefragList(zdev_t* dev, u16_t flushFlag)
+{
+ u16_t i, j;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ for(i=0; i<ZM_MAX_DEFRAG_ENTRIES; i++)
+ {
+ if (wd->defragTable.defragEntry[i].fragCount != 0 )
+ {
+ if (((wd->tick - wd->defragTable.defragEntry[i].tick) >
+ (ZM_DEFRAG_AGING_TIME_SEC * ZM_TICK_PER_SECOND))
+ || (flushFlag != 0))
+ {
+ zm_msg1_rx(ZM_LV_2, "Aging defrag list :", i);
+ /* Free the buffers in the defrag list */
+ for (j=0; j<wd->defragTable.defragEntry[i].fragCount; j++)
+ {
+ zfwBufFree(dev, wd->defragTable.defragEntry[i].fragment[j], 0);
+ }
+ }
+ }
+ wd->defragTable.defragEntry[i].fragCount = 0;
+ }
+
+ zmw_leave_critical_section(dev);
+
+ return;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfAddFirstFragToDefragList */
+/* Add first fragment to defragment list, the first empty entry */
+/* will be selected. If the list is full, sequentially select */
+/* one entry for replacement. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : first fragment buffer */
+/* addr : address of first fragment buffer */
+/* seqNum : sequence of first fragment buffer */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2007.1 */
+/* */
+/************************************************************************/
+void zfAddFirstFragToDefragList(zdev_t* dev, zbuf_t* buf, u8_t* addr, u16_t seqNum)
+{
+ u16_t i, j;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ /* Find an empty one in defrag list */
+ for(i=0; i<ZM_MAX_DEFRAG_ENTRIES; i++)
+ {
+ if ( wd->defragTable.defragEntry[i].fragCount == 0 )
+ {
+ break;
+ }
+ }
+
+ /* If full, sequentially replace existing one */
+ if (i == ZM_MAX_DEFRAG_ENTRIES)
+ {
+ i = wd->defragTable.replaceNum++ & (ZM_MAX_DEFRAG_ENTRIES-1);
+ /* Free the buffers in the defrag list to be replaced */
+ for (j=0; j<wd->defragTable.defragEntry[i].fragCount; j++)
+ {
+ zfwBufFree(dev, wd->defragTable.defragEntry[i].fragment[j], 0);
+ }
+ }
+
+ wd->defragTable.defragEntry[i].fragCount = 1;
+ wd->defragTable.defragEntry[i].fragment[0] = buf;
+ wd->defragTable.defragEntry[i].seqNum = seqNum;
+ wd->defragTable.defragEntry[i].tick = wd->tick;
+
+ for (j=0; j<6; j++)
+ {
+ wd->defragTable.defragEntry[i].addr[j] = addr[j];
+ }
+
+ zmw_leave_critical_section(dev);
+
+ return;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfAddFragToDefragList */
+/* Add middle or last fragment to defragment list. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : first fragment buffer */
+/* addr : address of fragment buffer */
+/* seqNum : sequence fragment buffer */
+/* fragNum : fragment number of fragment buffer */
+/* moreFrag : more frag bit of fragment buffer */
+/* addInfo : addition info of fragment buffer */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2007.1 */
+/* */
+/************************************************************************/
+zbuf_t* zfAddFragToDefragList(zdev_t* dev, zbuf_t* buf, u8_t* addr,
+ u16_t seqNum, u8_t fragNum, u8_t moreFrag,
+ struct zsAdditionInfo* addInfo)
+{
+ u16_t i, j, k;
+ zbuf_t* returnBuf = NULL;
+ u16_t defragDone = 0;
+ u16_t lenErr = 0;
+ u16_t startAddr, fragHead, frameLen, ivLen, icvLen;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ /* Find frag in the defrag list */
+ for(i=0; i<ZM_MAX_DEFRAG_ENTRIES; i++)
+ {
+ if ( wd->defragTable.defragEntry[i].fragCount != 0 )
+ {
+ /* Compare address */
+ for (j=0; j<6; j++)
+ {
+ if (addr[j] != wd->defragTable.defragEntry[i].addr[j])
+ {
+ break;
+ }
+ }
+ if (j == 6)
+ {
+ /* Compare sequence and fragment number */
+ if (seqNum == wd->defragTable.defragEntry[i].seqNum)
+ {
+ if ((fragNum == wd->defragTable.defragEntry[i].fragCount)
+ && (fragNum < 8))
+ {
+ /* Add frag frame to defrag list */
+ wd->defragTable.defragEntry[i].fragment[fragNum] = buf;
+ wd->defragTable.defragEntry[i].fragCount++;
+ defragDone = 1;
+
+ if (moreFrag == 0)
+ {
+ /* merge all fragment if more data bit is cleared */
+ returnBuf = wd->defragTable.defragEntry[i].fragment[0];
+ startAddr = zfwBufGetSize(dev, returnBuf);
+ /* skip WLAN header 24(Data) or 26(QoS Data) */
+ fragHead = 24 + ((zmw_rx_buf_readh(dev, returnBuf, 0) & 0x80) >> 6);
+ zfGetRxIvIcvLength(dev, returnBuf, 0, &ivLen, &icvLen, addInfo);
+ fragHead += ivLen; /* skip IV */
+ for(k=1; k<wd->defragTable.defragEntry[i].fragCount; k++)
+ {
+ frameLen = zfwBufGetSize(dev,
+ wd->defragTable.defragEntry[i].fragment[k]);
+ if ((startAddr+frameLen-fragHead) < 1560)
+ {
+ zfRxBufferCopy(dev, returnBuf, wd->defragTable.defragEntry[i].fragment[k],
+ startAddr, fragHead, frameLen-fragHead);
+ startAddr += (frameLen-fragHead);
+ }
+ else
+ {
+ lenErr = 1;
+ }
+ zfwBufFree(dev, wd->defragTable.defragEntry[i].fragment[k], 0);
+ }
+
+ wd->defragTable.defragEntry[i].fragCount = 0;
+ zfwBufSetSize(dev, returnBuf, startAddr);
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ zmw_leave_critical_section(dev);
+
+ if (lenErr == 1)
+ {
+ zfwBufFree(dev, returnBuf, 0);
+ return NULL;
+ }
+ if (defragDone == 0)
+ {
+ zfwBufFree(dev, buf, 0);
+ return NULL;
+ }
+
+ return returnBuf;
+}
+
+
+/* return value = NULL => save or free this frame */
+zbuf_t* zfDefragment(zdev_t* dev, zbuf_t* buf, u8_t* pbIsDefrag,
+ struct zsAdditionInfo* addInfo)
+{
+ u8_t fragNum;
+ u16_t seqNum;
+ u8_t moreFragBit;
+ u8_t addr[6];
+ u16_t i;
+ zmw_get_wlan_dev(dev);
+
+ ZM_BUFFER_TRACE(dev, buf)
+
+ *pbIsDefrag = FALSE;
+ seqNum = zmw_buf_readh(dev, buf, 22);
+ fragNum = (u8_t)(seqNum & 0xf);
+ moreFragBit = (zmw_buf_readb(dev, buf, 1) & ZM_BIT_2) >> 2;
+
+ if ((fragNum == 0) && (moreFragBit == 0))
+ {
+ /* Not part of a fragmentation */
+
+ return buf;
+ }
+ else
+ {
+ wd->commTally.swRxFragmentCount++;
+ seqNum = seqNum >> 4;
+ for (i=0; i<6; i++)
+ {
+ addr[i] = zmw_rx_buf_readb(dev, buf, ZM_WLAN_HEADER_A2_OFFSET+i);
+ }
+
+ if (fragNum == 0)
+ {
+ /* more frag = 1 */
+ /* First part of a fragmentation */
+ zm_msg1_rx(ZM_LV_2, "First Frag, seq=", seqNum);
+ zfAddFirstFragToDefragList(dev, buf, addr, seqNum);
+ buf = NULL;
+ }
+ else
+ {
+ /* Middle or last part of a fragmentation */
+ zm_msg1_rx(ZM_LV_2, "Frag seq=", seqNum);
+ zm_msg1_rx(ZM_LV_2, "Frag moreFragBit=", moreFragBit);
+ buf = zfAddFragToDefragList(dev, buf, addr, seqNum, fragNum, moreFragBit, addInfo);
+ if (buf != NULL)
+ {
+ *pbIsDefrag = TRUE;
+ }
+ }
+ }
+
+ return buf;
+}
+
+
+#if ZM_PROTOCOL_RESPONSE_SIMULATION
+u16_t zfSwap(u16_t num)
+{
+ return ((num >> 8) + ((num & 0xff) << 8));
+}
+
+
+void zfProtRspSim(zdev_t* dev, zbuf_t* buf)
+{
+ u16_t ethType;
+ u16_t arpOp;
+ u16_t prot;
+ u16_t temp;
+ u16_t i;
+ u16_t dip[2];
+ u16_t dstPort;
+ u16_t srcPort;
+
+ ethType = zmw_rx_buf_readh(dev, buf, 12);
+ zm_msg2_rx(ZM_LV_2, "ethType=", ethType);
+
+ /* ARP */
+ if (ethType == 0x0608)
+ {
+ arpOp = zmw_rx_buf_readh(dev, buf, 20);
+ dip[0] = zmw_rx_buf_readh(dev, buf, 38);
+ dip[1] = zmw_rx_buf_readh(dev, buf, 40);
+ zm_msg2_rx(ZM_LV_2, "arpOp=", arpOp);
+ zm_msg2_rx(ZM_LV_2, "ip0=", dip[0]);
+ zm_msg2_rx(ZM_LV_2, "ip1=", dip[1]);
+
+ //ARP request to 192.168.1.15
+ if ((arpOp == 0x0100) && (dip[0] == 0xa8c0) && (dip[1] == 0x0f01));
+ {
+ zm_msg0_rx(ZM_LV_2, "ARP");
+ /* ARP response */
+ zmw_rx_buf_writeh(dev, buf, 20, 0x0200);
+
+ /* dst hardware address */
+
+ /* src hardware address */
+ //zmw_rx_buf_writeh(dev, buf, 6, 0xa000);
+ //zmw_rx_buf_writeh(dev, buf, 8, 0x0000);
+ //zmw_rx_buf_writeh(dev, buf, 10, 0x0000);
+
+ /* dst ip address */
+ for (i=0; i<5; i++)
+ {
+ temp = zmw_rx_buf_readh(dev, buf, 22+(i*2));
+ zmw_rx_buf_writeh(dev, buf, 32+(i*2), temp);
+ }
+
+ /* src hardware address */
+ zmw_rx_buf_writeh(dev, buf, 22, 0xa000);
+ zmw_rx_buf_writeh(dev, buf, 24, 0x0000);
+ zmw_rx_buf_writeh(dev, buf, 26, 0x0000);
+
+ /* src ip address */
+ zmw_rx_buf_writeh(dev, buf, 28, 0xa8c0);
+ zmw_rx_buf_writeh(dev, buf, 30, 0x0f01);
+ }
+ }
+ /* ICMP */
+ else if (ethType == 0x0008)
+ {
+ zm_msg0_rx(ZM_LV_2, "IP");
+ prot = zmw_rx_buf_readb(dev, buf, 23);
+ dip[0] = zmw_rx_buf_readh(dev, buf, 30);
+ dip[1] = zmw_rx_buf_readh(dev, buf, 32);
+ zm_msg2_rx(ZM_LV_2, "prot=", prot);
+ zm_msg2_rx(ZM_LV_2, "ip0=", dip[0]);
+ zm_msg2_rx(ZM_LV_2, "ip1=", dip[1]);
+
+ /* PING request to 192.168.1.15 */
+ if ((prot == 0x1) && (dip[0] == 0xa8c0) && (dip[1] == 0x0f01))
+ {
+ zm_msg0_rx(ZM_LV_2, "ICMP");
+ /* change dst */
+ for (i=0; i<3; i++)
+ {
+ temp = zmw_rx_buf_readh(dev, buf, 6+(i*2));
+ zmw_rx_buf_writeh(dev, buf, i*2, temp);
+ }
+ /* change src */
+ zmw_rx_buf_writeh(dev, buf, 6, 0xa000);
+ zmw_rx_buf_writeh(dev, buf, 8, 0x0000);
+ zmw_rx_buf_writeh(dev, buf, 10, 0x0000);
+
+ /* exchange src ip and dst ip */
+ for (i=0; i<2; i++)
+ {
+ temp = zmw_rx_buf_readh(dev, buf, 26+(i*2));
+ zmw_rx_buf_writeh(dev, buf, 30+(i*2), temp);
+ }
+ zmw_rx_buf_writeh(dev, buf, 26, 0xa8c0);
+ zmw_rx_buf_writeh(dev, buf, 28, 0x0f01);
+
+ /* change icmp type to echo reply */
+ zmw_rx_buf_writeb(dev, buf, 34, 0x0);
+
+ /* update icmp checksum */
+ temp = zmw_rx_buf_readh(dev, buf, 36);
+ temp += 8;
+ zmw_rx_buf_writeh(dev, buf, 36, temp);
+ }
+ else if (prot == 0x6)
+ {
+ zm_msg0_rx(ZM_LV_2, "TCP");
+ srcPort = zmw_rx_buf_readh(dev, buf, 34);
+ dstPort = zmw_rx_buf_readh(dev, buf, 36);
+ zm_msg2_rx(ZM_LV_2, "Src Port=", srcPort);
+ zm_msg2_rx(ZM_LV_2, "Dst Port=", dstPort);
+ if ((dstPort == 0x1500) || (srcPort == 0x1500))
+ {
+ zm_msg0_rx(ZM_LV_2, "FTP");
+
+ /* change dst */
+ for (i=0; i<3; i++)
+ {
+ temp = zmw_rx_buf_readh(dev, buf, 6+(i*2));
+ zmw_rx_buf_writeh(dev, buf, i*2, temp);
+ }
+ /* change src */
+ zmw_rx_buf_writeh(dev, buf, 6, 0xa000);
+ zmw_rx_buf_writeh(dev, buf, 8, 0x0000);
+ zmw_rx_buf_writeh(dev, buf, 10, 0x0000);
+
+ /* exchange src ip and dst ip */
+ for (i=0; i<2; i++)
+ {
+ temp = zmw_rx_buf_readh(dev, buf, 26+(i*2));
+ zmw_rx_buf_writeh(dev, buf, 30+(i*2), temp);
+ }
+ zmw_rx_buf_writeh(dev, buf, 26, 0xa8c0);
+ zmw_rx_buf_writeh(dev, buf, 28, 0x0f01);
+#if 0
+ /* Patch src port */
+ temp = zmw_rx_buf_readh(dev, buf, 34);
+ temp = zfSwap(zfSwap(temp) + 1);
+ zmw_rx_buf_writeh(dev, buf, 34, temp);
+ temp = zmw_rx_buf_readh(dev, buf, 38);
+ temp = zfSwap(zfSwap(temp) + 1);
+ zmw_rx_buf_writeh(dev, buf, 38, temp);
+
+ /* Patch checksum */
+ temp = zmw_rx_buf_readh(dev, buf, 50);
+ temp = zfSwap(temp);
+ temp = ~temp;
+ temp += 2;
+ temp = ~temp;
+ temp = zfSwap(temp);
+ zmw_rx_buf_writeh(dev, buf, 50, temp);
+#endif
+ }
+
+ }
+ else if (prot == 0x11)
+ {
+ /* change dst */
+ for (i=0; i<3; i++)
+ {
+ temp = zmw_rx_buf_readh(dev, buf, 6+(i*2));
+ zmw_rx_buf_writeh(dev, buf, i*2, temp);
+ }
+ /* change src */
+ zmw_rx_buf_writeh(dev, buf, 6, 0xa000);
+ zmw_rx_buf_writeh(dev, buf, 8, 0x0000);
+ zmw_rx_buf_writeh(dev, buf, 10, 0x0000);
+
+ zm_msg0_rx(ZM_LV_2, "UDP");
+ srcPort = zmw_rx_buf_readh(dev, buf, 34);
+ dstPort = zmw_rx_buf_readh(dev, buf, 36);
+ zm_msg2_rx(ZM_LV_2, "Src Port=", srcPort);
+ zm_msg2_rx(ZM_LV_2, "Dst Port=", dstPort);
+
+ /* exchange src ip and dst ip */
+ for (i=0; i<2; i++)
+ {
+ temp = zmw_rx_buf_readh(dev, buf, 26+(i*2));
+ zmw_rx_buf_writeh(dev, buf, 30+(i*2), temp);
+ }
+ zmw_rx_buf_writeh(dev, buf, 26, 0xa8c0);
+ zmw_rx_buf_writeh(dev, buf, 28, 0x0f01);
+
+ /* exchange port */
+ zmw_rx_buf_writeh(dev, buf, 34, srcPort+1);
+ zmw_rx_buf_writeh(dev, buf, 36, dstPort);
+
+ /* checksum = 0 */
+ zmw_rx_buf_writeh(dev, buf, 40, 0);
+ }
+
+ }
+ else if (ethType == 0x0060) /* =>0x0060 is port */
+ {
+ /* change src for Evl tool loop back receive */
+ zmw_rx_buf_writeh(dev, buf, 6, 0xa000);
+ zmw_rx_buf_writeh(dev, buf, 8, 0x0000);
+ zmw_rx_buf_writeh(dev, buf, 10, 0x0000);
+ }
+
+}
+#endif
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfiTxSendEth */
+/* Called to native 802.11 management frames */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : buffer pointer */
+/* port : WLAN port, 0=>standard, 0x1-0x7=>VAP, 0x20-0x25=>WDS */
+/* */
+/* OUTPUTS */
+/* error code */
+/* */
+/* AUTHOR */
+/* Ray ZyDAS Technology Corporation 2005.5 */
+/* */
+/************************************************************************/
+u16_t zfiTxSend80211Mgmt(zdev_t* dev, zbuf_t* buf, u16_t port)
+{
+ u16_t err;
+ //u16_t addrTblSize = 0;
+ //struct zsAddrTbl addrTbl;
+ u16_t hlen;
+ u16_t header[(24+25+1)/2];
+ int i;
+
+ for(i=0;i<12;i++)
+ {
+ header[i] = zmw_buf_readh(dev, buf, i);
+ }
+ hlen = 24;
+
+ zfwBufRemoveHead(dev, buf, 24);
+
+ if ((err = zfHpSend(dev, header, hlen, NULL, 0, NULL, 0, buf, 0,
+ ZM_EXTERNAL_ALLOC_BUF, 0, 0)) != ZM_SUCCESS)
+ {
+ goto zlError;
+ }
+
+ return 0;
+
+zlError:
+
+ zfwBufFree(dev, buf, 0);
+ return 0;
+}
+
+u8_t zfiIsTxQueueFull(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ if ((((wd->vtxqHead[0] + 1) & ZM_VTXQ_SIZE_MASK) != wd->vtxqTail[0]) )
+ {
+ zmw_leave_critical_section(dev);
+ return 0;
+ }
+ else
+ {
+ zmw_leave_critical_section(dev);
+ return 1;
+ }
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfiTxSendEth */
+/* Called to transmit Ethernet frame from upper layer. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : buffer pointer */
+/* port : WLAN port, 0=>standard, 0x1-0x7=>VAP, 0x20-0x25=>WDS */
+/* */
+/* OUTPUTS */
+/* error code */
+/* */
+/* AUTHOR */
+/* Stephen ZyDAS Technology Corporation 2005.5 */
+/* */
+/************************************************************************/
+u16_t zfiTxSendEth(zdev_t* dev, zbuf_t* buf, u16_t port)
+{
+ u16_t err, ret;
+
+ zmw_get_wlan_dev(dev);
+
+ ZM_PERFORMANCE_TX_MSDU(dev, wd->tick);
+ zm_msg1_tx(ZM_LV_2, "zfiTxSendEth(), port=", port);
+ /* Return error if port is disabled */
+ if ((err = zfTxPortControl(dev, buf, port)) == ZM_PORT_DISABLED)
+ {
+ err = ZM_ERR_TX_PORT_DISABLED;
+ goto zlError;
+ }
+
+#if 1
+ if ((wd->wlanMode == ZM_MODE_AP) && (port < 0x20))
+ {
+ /* AP : Buffer frame for power saving STA */
+ if ((ret = zfApBufferPsFrame(dev, buf, port)) == 1)
+ {
+ return ZM_SUCCESS;
+ }
+ }
+ else
+#endif
+ if (wd->wlanMode == ZM_MODE_INFRASTRUCTURE)
+ {
+ if ( zfPowerSavingMgrIsSleeping(dev) )
+ {
+ /*check ZM_ENABLE_POWER_SAVE flag*/
+ zfPowerSavingMgrWakeup(dev);
+ }
+ }
+#ifdef ZM_ENABLE_IBSS_PS
+ /* IBSS power-saving mode */
+ else if ( wd->wlanMode == ZM_MODE_IBSS )
+ {
+ if ( zfStaIbssPSQueueData(dev, buf) )
+ {
+ return ZM_SUCCESS;
+ }
+ }
+#endif
+
+#if 1
+ //if ( wd->bQoSEnable )
+ if (1)
+ {
+ /* Put to VTXQ[ac] */
+ ret = zfPutVtxq(dev, buf);
+
+ /* Push VTXQ[ac] */
+ zfPushVtxq(dev);
+ }
+ else
+ {
+ ret = zfTxSendEth(dev, buf, port, ZM_EXTERNAL_ALLOC_BUF, 0);
+ }
+
+ return ret;
+#else
+ return zfTxSendEth(dev, buf, port, ZM_EXTERNAL_ALLOC_BUF, 0);
+#endif
+
+zlError:
+ zm_msg2_tx(ZM_LV_1, "Tx Comp err=", err);
+
+ zfwBufFree(dev, buf, err);
+ return err;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfTxSendEth */
+/* Called to transmit Ethernet frame from upper layer. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : buffer pointer */
+/* port : WLAN port, 0=>standard, 0x10-0x17=>VAP, 0x20-0x25=>WDS */
+/* */
+/* OUTPUTS */
+/* error code */
+/* */
+/* AUTHOR */
+/* Stephen ZyDAS Technology Corporation 2005.5 */
+/* */
+/************************************************************************/
+u16_t zfTxSendEth(zdev_t* dev, zbuf_t* buf, u16_t port, u16_t bufType, u16_t flag)
+{
+ u16_t err;
+ //u16_t addrTblSize;
+ //struct zsAddrTbl addrTbl;
+ u16_t removeLen;
+ u16_t header[(8+30+2+18)/2]; /* ctr+(4+a1+a2+a3+2+a4)+qos+iv */
+ u16_t headerLen;
+ u16_t mic[8/2];
+ u16_t micLen;
+ u16_t snap[8/2];
+ u16_t snapLen;
+ u16_t fragLen;
+ u16_t frameLen;
+ u16_t fragNum;
+ struct zsFrag frag;
+ u16_t i, j, id;
+ u16_t offset;
+ u16_t da[3];
+ u16_t sa[3];
+ u8_t up;
+ u8_t qosType, keyIdx = 0;
+ u16_t fragOff;
+ u16_t newFlag;
+ struct zsMicVar* pMicKey;
+ u8_t tkipFrameOffset = 0;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ newFlag = flag & 0xff00;
+ flag = flag & 0xff;
+
+ zm_msg1_tx(ZM_LV_2, "zfTxSendEth(), port=", port);
+
+ /* Get IP TOS for QoS AC and IP frag offset */
+ zfTxGetIpTosAndFrag(dev, buf, &up, &fragOff);
+
+ //EOSP bit
+ if (newFlag & 0x100)
+ {
+ up |= 0x10;
+ }
+
+#ifdef ZM_ENABLE_NATIVE_WIFI
+ if ( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ {
+ /* DA */
+ da[0] = zmw_tx_buf_readh(dev, buf, 16);
+ da[1] = zmw_tx_buf_readh(dev, buf, 18);
+ da[2] = zmw_tx_buf_readh(dev, buf, 20);
+ /* SA */
+ sa[0] = zmw_tx_buf_readh(dev, buf, 10);
+ sa[1] = zmw_tx_buf_readh(dev, buf, 12);
+ sa[2] = zmw_tx_buf_readh(dev, buf, 14);
+ }
+ else if ( wd->wlanMode == ZM_MODE_IBSS )
+ {
+ /* DA */
+ da[0] = zmw_tx_buf_readh(dev, buf, 4);
+ da[1] = zmw_tx_buf_readh(dev, buf, 6);
+ da[2] = zmw_tx_buf_readh(dev, buf, 8);
+ /* SA */
+ sa[0] = zmw_tx_buf_readh(dev, buf, 10);
+ sa[1] = zmw_tx_buf_readh(dev, buf, 12);
+ sa[2] = zmw_tx_buf_readh(dev, buf, 14);
+ }
+ else if ( wd->wlanMode == ZM_MODE_AP )
+ {
+ /* DA */
+ da[0] = zmw_tx_buf_readh(dev, buf, 4);
+ da[1] = zmw_tx_buf_readh(dev, buf, 6);
+ da[2] = zmw_tx_buf_readh(dev, buf, 8);
+ /* SA */
+ sa[0] = zmw_tx_buf_readh(dev, buf, 16);
+ sa[1] = zmw_tx_buf_readh(dev, buf, 18);
+ sa[2] = zmw_tx_buf_readh(dev, buf, 20);
+ }
+ else
+ {
+ //
+ }
+#else
+ /* DA */
+ da[0] = zmw_tx_buf_readh(dev, buf, 0);
+ da[1] = zmw_tx_buf_readh(dev, buf, 2);
+ da[2] = zmw_tx_buf_readh(dev, buf, 4);
+ /* SA */
+ sa[0] = zmw_tx_buf_readh(dev, buf, 6);
+ sa[1] = zmw_tx_buf_readh(dev, buf, 8);
+ sa[2] = zmw_tx_buf_readh(dev, buf, 10);
+#endif
+ //Decide Key Index in ATOM, No meaning in OTUS--CWYang(m)
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ keyIdx = wd->ap.bcHalKeyIdx[port];
+ id = zfApFindSta(dev, da);
+ if (id != 0xffff)
+ {
+ switch (wd->ap.staTable[id].encryMode)
+ {
+ case ZM_AES:
+ case ZM_TKIP:
+#ifdef ZM_ENABLE_CENC
+ case ZM_CENC:
+#endif //ZM_ENABLE_CENC
+ keyIdx = wd->ap.staTable[id].keyIdx;
+ break;
+ }
+ }
+ }
+ else
+ {
+ switch (wd->sta.encryMode)
+ {
+ case ZM_WEP64:
+ case ZM_WEP128:
+ case ZM_WEP256:
+ keyIdx = wd->sta.keyId;
+ break;
+ case ZM_AES:
+ case ZM_TKIP:
+ if ((da[0] & 0x1))
+ keyIdx = 5;
+ else
+ keyIdx = 4;
+ break;
+#ifdef ZM_ENABLE_CENC
+ case ZM_CENC:
+ keyIdx = wd->sta.cencKeyId;
+ break;
+#endif //ZM_ENABLE_CENC
+ }
+ }
+
+ /* Create SNAP */
+ removeLen = zfTxGenWlanSnap(dev, buf, snap, &snapLen);
+ //zm_msg1_tx(ZM_LV_0, "fragOff=", fragOff);
+
+
+/* ********************************************************************************************** */
+/* Add 20071025 Mxzeng */
+/* ********************************************************************************************** */
+/* ---------------------------------------------------------------------------------------------- */
+/* Ethernet : frameLen = zfwBufGetSize(dev, buf); */
+/* ---+--6--+--6--+--2--+-----20-----+-------------------------+------ Variable -------+--------- */
+/* | DA | SA | Type| IP Header | TCP(20) UDP(12) ICMP(8) | Application Payload L | */
+/* ---+-----+-----+-----+------------+-------------------------+-----------------------+--------- */
+/* MSDU = 6 + 6 + 2 + ( Network Layer header ) + ( Transport Layer header ) + L */
+/* */
+/* MSDU - DA - SA : frameLen -= removeLen; */
+/* ---+--2--+-----20-----+-------------------------+------ Variable -------+--------------------- */
+/* | Type| IP Header | TCP(20) UDP(12) ICMP(8) | Application Payload L | */
+/* ---+-----+------------+-------------------------+-----------------------+--------------------- */
+/* */
+/* MPDU : frameLen + mpduLengthOffset ; */
+/* -+---2---+----2---+-6-+-6-+--6--+---2----+--1--+--1-+---1---+-------3------+-frameLen-+---4--+- */
+/* | frame |duration| DA|SA |BSSID|sequence|SNAP |SNAP|Control| RFC 1042 | | FCS | */
+/* |Control| | | | | number |DSAP |SSAP| | encapsulation| | | */
+/* -+-------+--------+---+---+-----+--------+-----+----+-------+--------------+----------+------+- */
+/* ----------------------------------------------------------------------------------------------- */
+
+ if ( wd->sta.encryMode == ZM_TKIP )
+ tkipFrameOffset = 8;
+
+ fragLen = wd->fragThreshold + tkipFrameOffset; // Fragmentation threshold for MPDU Lengths
+ frameLen = zfwBufGetSize(dev, buf); // MSDU Lengths
+ frameLen -= removeLen; // MSDU Lengths - DA - SA
+
+ /* #1st create MIC Length manually */
+ micLen = 0;
+
+ /* Access Category */
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ zfApGetStaQosType(dev, da, &qosType);
+ if (qosType == 0)
+ {
+ up = 0;
+ }
+ }
+ else if (wd->wlanMode == ZM_MODE_INFRASTRUCTURE)
+ {
+ if (wd->sta.wmeConnected == 0)
+ {
+ up = 0;
+ }
+ }
+ else
+ {
+ /* TODO : STA QoS control field */
+ up = 0;
+ }
+
+ /* #2nd Assign sequence number */
+ zmw_enter_critical_section(dev);
+ frag.seq[0] = ((wd->seq[zcUpToAc[up&0x7]]++) << 4);
+ zmw_leave_critical_section(dev);
+
+ /* #3rd Pass the total payload to generate MPDU length ! */
+ frag.buf[0] = buf;
+ frag.bufType[0] = bufType;
+ frag.flag[0] = (u8_t)flag;
+ fragNum = 1;
+
+ headerLen = zfTxGenWlanHeader(dev, frag.buf[0], header, frag.seq[0],
+ frag.flag[0], snapLen+micLen, removeLen, port, da, sa,
+ up, &micLen, snap, snapLen, NULL);
+
+ //zm_debug_msg1("#1 headerLen = ", headerLen);
+
+ /* #4th Check the HeaderLen and determine whether the MPDU Lengths bigger than Fragmentation threshold */
+ /* If MPDU Lengths large than fragmentation threshold --> headerLen = 0 */
+ if( headerLen != 0 )
+ {
+ zf80211FrameSend(dev, frag.buf[0], header, snapLen, da, sa, up,
+ headerLen, snap, mic, micLen, removeLen, frag.bufType[0],
+ zcUpToAc[up&0x7], keyIdx);
+ }
+ else //if( headerLen == 0 ) // Need to be fragmented
+ {
+ u16_t mpduLengthOffset;
+ u16_t pseudSnapLen = 0;
+
+ mpduLengthOffset = header[0] - frameLen; // For fragmentation threshold !
+
+ micLen = zfTxGenWlanTail(dev, buf, snap, snapLen, mic); // Get snap and mic information
+
+ fragLen = fragLen - mpduLengthOffset;
+
+ //zm_debug_msg1("#2 frameLen = ", frameLen);
+ //zm_debug_msg1("#3 fragThreshold = ", fragLen);
+
+ /* fragmentation */
+ if (frameLen >= fragLen)
+ {
+ //copy fragLen to frag
+ i = 0;
+ while( frameLen > 0 )
+ {
+ if ((frag.buf[i] = zfwBufAllocate(dev, fragLen+32)) != NULL)
+ {
+ frag.bufType[i] = ZM_INTERNAL_ALLOC_BUF;
+ frag.seq[i] = frag.seq[0] + i;
+ offset = removeLen + i*fragLen;
+
+ /* Consider the offset if we consider snap length to the other fragmented frame */
+ if ( i >= 1 )
+ offset = offset + pseudSnapLen*(i-1);
+
+ if (frameLen > fragLen + pseudSnapLen)
+ {
+ frag.flag[i] = flag | 0x4; /* More data */
+ /* First fragment */
+ if (i == 0)
+ {
+ /* Add SNAP */
+ for (j=0; j<snapLen; j+=2)
+ {
+ zmw_tx_buf_writeh(dev, frag.buf[i], j, snap[(j>>1)]);
+ }
+ zfTxBufferCopy(dev, frag.buf[i], buf, snapLen, offset, fragLen);
+ zfwBufSetSize(dev, frag.buf[i], snapLen+fragLen);
+
+ /* Add pseud snap length to the other fragmented frame */
+ pseudSnapLen = snapLen;
+
+ frameLen -= fragLen;
+ }
+ /* Intermediate Fragment */
+ else
+ {
+ //zfTxBufferCopy(dev, frag.buf[i], buf, 0, offset, fragLen);
+ //zfwBufSetSize(dev, frag.buf[i], fragLen);
+
+ zfTxBufferCopy(dev, frag.buf[i], buf, 0, offset, fragLen+pseudSnapLen );
+ zfwBufSetSize(dev, frag.buf[i], fragLen+pseudSnapLen);
+
+ frameLen -= (fragLen+pseudSnapLen);
+ }
+ //frameLen -= fragLen;
+ }
+ else
+ {
+ /* Last fragment */
+ zfTxBufferCopy(dev, frag.buf[i], buf, 0, offset, frameLen);
+ /* Add MIC if need */
+ if ( micLen )
+ {
+ zfCopyToRxBuffer(dev, frag.buf[i], (u8_t*) mic, frameLen, micLen);
+ }
+ zfwBufSetSize(dev, frag.buf[i], frameLen+micLen);
+ frameLen = 0;
+ frag.flag[i] = (u8_t)flag; /* No more data */
+ }
+ i++;
+ }
+ else
+ {
+ break;
+ }
+
+ // Please pay attention to the index of the buf !!!
+ // If write to null buf , the OS will crash !!!
+ zfwCopyBufContext(dev, buf, frag.buf[i-1]);
+ }
+ fragNum = i;
+ snapLen = micLen = removeLen = 0;
+
+ zfwBufFree(dev, buf, 0);
+ }
+
+ for (i=0; i<fragNum; i++)
+ {
+ /* Create WLAN header(Control Setting + 802.11 header + IV) */
+ headerLen = zfTxGenWlanHeader(dev, frag.buf[i], header, frag.seq[i],
+ frag.flag[i], snapLen+micLen, removeLen, port, da, sa, up, &micLen,
+ snap, snapLen, NULL);
+
+ zf80211FrameSend(dev, frag.buf[i], header, snapLen, da, sa, up,
+ headerLen, snap, mic, micLen, removeLen, frag.bufType[i],
+ zcUpToAc[up&0x7], keyIdx);
+
+ } /* for (i=0; i<fragNum; i++) */
+ }
+
+ return ZM_SUCCESS;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfTxPortControl */
+/* Check port status. */
+/* */
+/* INPUTS */
+/* buf : buffer pointer */
+/* port : port number, 0=>standard, 10-17=>Virtual AP, 20-25=>WDS */
+/* */
+/* OUTPUTS */
+/* ZM_PORT_ENABLED or ZM_PORT_DISABLE */
+/* */
+/* AUTHOR */
+/* Signature ZyDAS Technology Corporation 2005.4 */
+/* */
+/************************************************************************/
+u16_t zfTxPortControl(zdev_t* dev, zbuf_t* buf, u16_t port)
+{
+ zmw_get_wlan_dev(dev);
+
+ if ( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ {
+ if ( wd->sta.adapterState == ZM_STA_STATE_DISCONNECT )
+ {
+ zm_msg0_tx(ZM_LV_3, "Packets dropped due to disconnect state");
+ return ZM_PORT_DISABLED;
+ }
+ }
+
+ return ZM_PORT_ENABLED;
+}
+
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfIdlRecv */
+/* Do frame validation and filtering then pass to zfwRecv80211(). */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : received 802.11 frame buffer. */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+void zfCoreRecv(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo)
+{
+ u16_t ret = 0;
+ u16_t bssid[3];
+ struct agg_tid_rx *tid_rx;
+ zmw_get_wlan_dev(dev);
+
+ ZM_BUFFER_TRACE(dev, buf)
+
+ /* tally */
+ wd->commTally.DriverRxFrmCnt++;
+
+ bssid[0] = zmw_buf_readh(dev, buf, 16);
+ bssid[1] = zmw_buf_readh(dev, buf, 18);
+ bssid[2] = zmw_buf_readh(dev, buf, 20);
+
+ /* Validate Rx frame */
+ if ((ret = zfWlanRxValidate(dev, buf)) != ZM_SUCCESS)
+ {
+ zm_msg1_rx(ZM_LV_1, "Rx invalid:", ret);
+ goto zlError;
+ }
+
+#ifdef ZM_ENABLE_AGGREGATION
+ //#ifndef ZM_ENABLE_FW_BA_RETRANSMISSION
+ /*
+ * add by honda
+ */
+ tid_rx = zfAggRxEnabled(dev, buf);
+ if (tid_rx && wd->reorder)
+ {
+ zfAggRx(dev, buf, addInfo, tid_rx);
+
+ return;
+ }
+ /*
+ * end of add by honda
+ */
+ //#endif
+#endif
+
+ /* Filter Rx frame */
+ if ((ret = zfWlanRxFilter(dev, buf)) != ZM_SUCCESS)
+ {
+ zm_msg1_rx(ZM_LV_1, "Rx duplicated:", ret);
+ goto zlError;
+ }
+
+ /* Discard error frame except mic failure */
+ if ((addInfo->Tail.Data.ErrorIndication & 0x3f) != 0)
+ {
+ if ( wd->XLinkMode && ((addInfo->Tail.Data.ErrorIndication & 0x3f)==0x10) &&
+ zfCompareWithBssid(dev, bssid) )
+ {
+ // Bypass frames !!!
+ }
+ else
+ {
+ goto zlError;
+ }
+ }
+
+
+ /* OTUS command-8212 dump rx packet */
+ if (wd->rxPacketDump)
+ {
+ zfwDumpBuf(dev, buf);
+ }
+
+ /* Call zfwRecv80211() wrapper function to deliver Rx packet */
+ /* to driver framework. */
+
+ if (wd->zfcbRecv80211 != NULL)
+ {
+ wd->zfcbRecv80211(dev, buf, addInfo); //CWYang(m)
+ }
+ else
+ {
+ zfiRecv80211(dev, buf, addInfo);
+ }
+ return;
+
+zlError:
+ zm_msg1_rx(ZM_LV_1, "Free packet, error code:", ret);
+
+ wd->commTally.DriverDiscardedFrm++;
+
+ /* Free Rx buffer */
+ zfwBufFree(dev, buf, 0);
+
+ return;
+}
+
+
+void zfShowRxEAPOL(zdev_t* dev, zbuf_t* buf, u16_t offset)
+{
+ u8_t packetType, keyType, code, identifier, type, flags;
+ u16_t packetLen, keyInfo, keyLen, keyDataLen, length, Op_Code;
+ u32_t replayCounterH, replayCounterL, vendorId, VendorType;
+
+ /* EAPOL packet type */
+ packetType = zmw_rx_buf_readb(dev, buf, offset+1); // 0: EAP-Packet
+ // 1: EAPOL-Start
+ // 2: EAPOL-Logoff
+ // 3: EAPOL-Key
+ // 4: EAPOL-Encapsulated-ASF-Alert
+
+ /* EAPOL frame format */
+ /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */
+ /* ----------------------------------------------- */
+ /* PAE Ethernet Type (0x888e) */
+ /* ----------------------------------------------- 2 */
+ /* Protocol Version | Type */
+ /* ----------------------------------------------- 4 */
+ /* Length */
+ /* ----------------------------------------------- 6 */
+ /* Packet Body */
+ /* ----------------------------------------------- N */
+
+ /* EAPOL body length */
+ packetLen = (((u16_t) zmw_rx_buf_readb(dev, buf, offset+2)) << 8) +
+ zmw_rx_buf_readb(dev, buf, offset+3);
+
+ if( packetType == 0 )
+ { // EAP-Packet
+
+ /* EAP-Packet Code */
+ code = zmw_rx_buf_readb(dev, buf, offset+4); // 1 : Request
+ // 2 : Response
+ // 3 : Success
+ // 4 : Failure
+ // An EAP packet of the type of Success and Failure has no Data field, and has a length of 4.
+
+ /* EAP Packet format */
+ /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */
+ /* ----------------------------------------------- */
+ /* Code | Identifier */
+ /* ----------------------------------------------- 2 */
+ /* Length */
+ /* ----------------------------------------------- 4 */
+ /* Data */
+ /* ----------------------------------------------- N */
+
+ zm_debug_msg0("EAP-Packet");
+ zm_debug_msg1("Packet Length = ", packetLen);
+ zm_debug_msg1("EAP-Packet Code = ", code);
+
+ if( code == 1 )
+ {
+ zm_debug_msg0("EAP-Packet Request");
+
+ /* EAP-Packet Identifier */
+ identifier = zmw_rx_buf_readb(dev, buf, offset+5);
+ /* EAP-Packet Length */
+ length = (((u16_t) zmw_rx_buf_readb(dev, buf, offset+6)) << 8) +
+ zmw_rx_buf_readb(dev, buf, offset+7);
+ /* EAP-Packet Type */
+ type = zmw_rx_buf_readb(dev, buf, offset+8); // 1 : Identity
+ // 2 : Notification
+ // 3 : Nak (Response Only)
+ // 4 : MD5-Challenge
+ // 5 : One Time Password (OTP)
+ // 6 : Generic Token Card (GTC)
+ // 254 : (Expanded Types)Wi-Fi Protected Setup
+ // 255 : Experimental Use
+
+ /* The data field in an EAP packet of the type of Request or Response is in the format shown bellowing */
+ /* 0 1 2 3 4 5 6 7 N */
+ /* ----------------------------------------------- */
+ /* Type | Type Data */
+ /* ----------------------------------------------- */
+
+ zm_debug_msg1("EAP-Packet Identifier = ", identifier);
+ zm_debug_msg1("EAP-Packet Length = ", length);
+ zm_debug_msg1("EAP-Packet Type = ", type);
+
+ if( type == 1 )
+ {
+ zm_debug_msg0("EAP-Packet Request Identity");
+ }
+ else if( type == 2 )
+ {
+ zm_debug_msg0("EAP-Packet Request Notification");
+ }
+ else if( type == 4 )
+ {
+ zm_debug_msg0("EAP-Packet Request MD5-Challenge");
+ }
+ else if( type == 5 )
+ {
+ zm_debug_msg0("EAP-Packet Request One Time Password");
+ }
+ else if( type == 6 )
+ {
+ zm_debug_msg0("EAP-Packet Request Generic Token Card");
+ }
+ else if( type == 254 )
+ {
+ zm_debug_msg0("EAP-Packet Request Wi-Fi Protected Setup");
+
+ /* 0 1 2 3 */
+ /* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 */
+ /*+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*/
+ /*| Type | Vendor-Id |*/
+ /*+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*/
+ /*| Vendor-Type |*/
+ /*+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*/
+ /*| Vendor data... */
+ /*+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
+
+ /* EAP-Packet Vendor ID */
+ vendorId = (((u32_t) zmw_rx_buf_readb(dev, buf, offset+9)) << 16) +
+ (((u32_t) zmw_rx_buf_readb(dev, buf, offset+10)) << 8) +
+ zmw_rx_buf_readb(dev, buf, offset+11);
+ /* EAP-Packet Vendor Type */
+ VendorType = (((u32_t) zmw_rx_buf_readb(dev, buf, offset+12)) << 24) +
+ (((u32_t) zmw_rx_buf_readb(dev, buf, offset+13)) << 16) +
+ (((u32_t) zmw_rx_buf_readb(dev, buf, offset+14)) << 8) +
+ zmw_rx_buf_readb(dev, buf, offset+15);
+ /* EAP-Packet Op Code */
+ Op_Code = (((u16_t) zmw_rx_buf_readb(dev, buf, offset+16)) << 8) +
+ zmw_rx_buf_readb(dev, buf, offset+17);
+ /* EAP-Packet Flags */
+ flags = zmw_rx_buf_readb(dev, buf, offset+18);
+
+ zm_debug_msg1("EAP-Packet Vendor ID = ", vendorId);
+ zm_debug_msg1("EAP-Packet Venodr Type = ", VendorType);
+ zm_debug_msg1("EAP-Packet Op Code = ", Op_Code);
+ zm_debug_msg1("EAP-Packet Flags = ", flags);
+ }
+ }
+ else if( code == 2 )
+ {
+ zm_debug_msg0("EAP-Packet Response");
+
+ /* EAP-Packet Identifier */
+ identifier = zmw_rx_buf_readb(dev, buf, offset+5);
+ /* EAP-Packet Length */
+ length = (((u16_t) zmw_rx_buf_readb(dev, buf, offset+6)) << 8) +
+ zmw_rx_buf_readb(dev, buf, offset+7);
+ /* EAP-Packet Type */
+ type = zmw_rx_buf_readb(dev, buf, offset+8);
+
+ zm_debug_msg1("EAP-Packet Identifier = ", identifier);
+ zm_debug_msg1("EAP-Packet Length = ", length);
+ zm_debug_msg1("EAP-Packet Type = ", type);
+
+ if( type == 1 )
+ {
+ zm_debug_msg0("EAP-Packet Response Identity");
+ }
+ else if( type == 2 )
+ {
+ zm_debug_msg0("EAP-Packet Request Notification");
+ }
+ else if( type == 3 )
+ {
+ zm_debug_msg0("EAP-Packet Request Nak");
+ }
+ else if( type == 4 )
+ {
+ zm_debug_msg0("EAP-Packet Request MD5-Challenge");
+ }
+ else if( type == 5 )
+ {
+ zm_debug_msg0("EAP-Packet Request One Time Password");
+ }
+ else if( type == 6 )
+ {
+ zm_debug_msg0("EAP-Packet Request Generic Token Card");
+ }
+ else if( type == 254 )
+ {
+ zm_debug_msg0("EAP-Packet Response Wi-Fi Protected Setup");
+
+ /* EAP-Packet Vendor ID */
+ vendorId = (((u32_t) zmw_rx_buf_readb(dev, buf, offset+9)) << 16) +
+ (((u32_t) zmw_rx_buf_readb(dev, buf, offset+10)) << 8) +
+ zmw_rx_buf_readb(dev, buf, offset+11);
+ /* EAP-Packet Vendor Type */
+ VendorType = (((u32_t) zmw_rx_buf_readb(dev, buf, offset+12)) << 24) +
+ (((u32_t) zmw_rx_buf_readb(dev, buf, offset+13)) << 16) +
+ (((u32_t) zmw_rx_buf_readb(dev, buf, offset+14)) << 8) +
+ zmw_rx_buf_readb(dev, buf, offset+15);
+ /* EAP-Packet Op Code */
+ Op_Code = (((u16_t) zmw_rx_buf_readb(dev, buf, offset+16)) << 8) +
+ zmw_rx_buf_readb(dev, buf, offset+17);
+ /* EAP-Packet Flags */
+ flags = zmw_rx_buf_readb(dev, buf, offset+18);
+
+ zm_debug_msg1("EAP-Packet Vendor ID = ", vendorId);
+ zm_debug_msg1("EAP-Packet Venodr Type = ", VendorType);
+ zm_debug_msg1("EAP-Packet Op Code = ", Op_Code);
+ zm_debug_msg1("EAP-Packet Flags = ", flags);
+ }
+ }
+ else if( code == 3 )
+ {
+ zm_debug_msg0("EAP-Packet Success");
+
+ /* EAP-Packet Identifier */
+ identifier = zmw_rx_buf_readb(dev, buf, offset+5);
+ /* EAP-Packet Length */
+ length = (((u16_t) zmw_rx_buf_readb(dev, buf, offset+6)) << 8) +
+ zmw_rx_buf_readb(dev, buf, offset+7);
+
+ zm_debug_msg1("EAP-Packet Identifier = ", identifier);
+ zm_debug_msg1("EAP-Packet Length = ", length);
+ }
+ else if( code == 4 )
+ {
+ zm_debug_msg0("EAP-Packet Failure");
+
+ /* EAP-Packet Identifier */
+ identifier = zmw_rx_buf_readb(dev, buf, offset+5);
+ /* EAP-Packet Length */
+ length = (((u16_t) zmw_rx_buf_readb(dev, buf, offset+6)) << 8) +
+ zmw_rx_buf_readb(dev, buf, offset+7);
+
+ zm_debug_msg1("EAP-Packet Identifier = ", identifier);
+ zm_debug_msg1("EAP-Packet Length = ", length);
+ }
+ }
+ else if( packetType == 1 )
+ { // EAPOL-Start
+ zm_debug_msg0("EAPOL-Start");
+ }
+ else if( packetType == 2 )
+ { // EAPOL-Logoff
+ zm_debug_msg0("EAPOL-Logoff");
+ }
+ else if( packetType == 3 )
+ { // EAPOL-Key
+ /* EAPOL-Key type */
+ keyType = zmw_rx_buf_readb(dev, buf, offset+4);
+ /* EAPOL-Key information */
+ keyInfo = (((u16_t) zmw_rx_buf_readb(dev, buf, offset+5)) << 8) +
+ zmw_rx_buf_readb(dev, buf, offset+6);
+ /* EAPOL-Key length */
+ keyLen = (((u16_t) zmw_rx_buf_readb(dev, buf, offset+7)) << 8) +
+ zmw_rx_buf_readb(dev, buf, offset+8);
+ /* EAPOL-Key replay counter (high double word) */
+ replayCounterH = (((u32_t) zmw_rx_buf_readb(dev, buf, offset+9)) << 24) +
+ (((u32_t) zmw_rx_buf_readb(dev, buf, offset+10)) << 16) +
+ (((u32_t) zmw_rx_buf_readb(dev, buf, offset+11)) << 8) +
+ zmw_rx_buf_readb(dev, buf, offset+12);
+ /* EAPOL-Key replay counter (low double word) */
+ replayCounterL = (((u32_t) zmw_rx_buf_readb(dev, buf, offset+13)) << 24) +
+ (((u32_t) zmw_rx_buf_readb(dev, buf, offset+14)) << 16) +
+ (((u32_t) zmw_rx_buf_readb(dev, buf, offset+15)) << 8) +
+ zmw_rx_buf_readb(dev, buf, offset+16);
+ /* EAPOL-Key data length */
+ keyDataLen = (((u16_t) zmw_rx_buf_readb(dev, buf, offset+97)) << 8) +
+ zmw_rx_buf_readb(dev, buf, offset+98);
+
+ zm_debug_msg0("EAPOL-Key");
+ zm_debug_msg1("packet length = ", packetLen);
+
+ if ( keyType == 254 )
+ {
+ zm_debug_msg0("key type = 254 (SSN key descriptor)");
+ }
+ else
+ {
+ zm_debug_msg2("key type = 0x", keyType);
+ }
+
+ zm_debug_msg2("replay counter(L) = ", replayCounterL);
+
+ zm_debug_msg2("key information = ", keyInfo);
+
+ if ( keyInfo & ZM_BIT_3 )
+ {
+ zm_debug_msg0(" - pairwise key");
+ }
+ else
+ {
+ zm_debug_msg0(" - group key");
+ }
+
+ if ( keyInfo & ZM_BIT_6 )
+ {
+ zm_debug_msg0(" - Tx key installed");
+ }
+ else
+ {
+ zm_debug_msg0(" - Tx key not set");
+ }
+
+ if ( keyInfo & ZM_BIT_7 )
+ {
+ zm_debug_msg0(" - Ack needed");
+ }
+ else
+ {
+ zm_debug_msg0(" - Ack not needed");
+ }
+
+ if ( keyInfo & ZM_BIT_8 )
+ {
+ zm_debug_msg0(" - MIC set");
+ }
+ else
+ {
+ zm_debug_msg0(" - MIC not set");
+ }
+
+ if ( keyInfo & ZM_BIT_9 )
+ {
+ zm_debug_msg0(" - packet encrypted");
+ }
+ else
+ {
+ zm_debug_msg0(" - packet not encrypted");
+ }
+
+ zm_debug_msg1("keyLen = ", keyLen);
+ zm_debug_msg1("keyDataLen = ", keyDataLen);
+ }
+ else if( packetType == 4 )
+ {
+ zm_debug_msg0("EAPOL-Encapsulated-ASF-Alert");
+ }
+}
+
+void zfShowTxEAPOL(zdev_t* dev, zbuf_t* buf, u16_t offset)
+{
+ u8_t packetType, keyType, code, identifier, type, flags;
+ u16_t packetLen, keyInfo, keyLen, keyDataLen, length, Op_Code;
+ u32_t replayCounterH, replayCounterL, vendorId, VendorType;
+
+ zmw_get_wlan_dev(dev);
+
+ zm_debug_msg1("EAPOL Packet size = ", zfwBufGetSize(dev, buf));
+
+ /* EAPOL packet type */
+ // 0: EAP-Packet
+ // 1: EAPOL-Start
+ // 2: EAPOL-Logoff
+ // 3: EAPOL-Key
+ // 4: EAPOL-Encapsulated-ASF-Alert
+
+ /* EAPOL frame format */
+ /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */
+ /* ----------------------------------------------- */
+ /* PAE Ethernet Type (0x888e) */
+ /* ----------------------------------------------- 2 */
+ /* Protocol Version | Type */
+ /* ----------------------------------------------- 4 */
+ /* Length */
+ /* ----------------------------------------------- 6 */
+ /* Packet Body */
+ /* ----------------------------------------------- N */
+
+ packetType = zmw_tx_buf_readb(dev, buf, offset+1);
+ /* EAPOL body length */
+ packetLen = (((u16_t) zmw_tx_buf_readb(dev, buf, offset+2)) << 8) +
+ zmw_tx_buf_readb(dev, buf, offset+3);
+
+ if( packetType == 0 )
+ { // EAP-Packet
+ /* EAP-Packet Code */
+ code = zmw_tx_buf_readb(dev, buf, offset+4); // 1 : Request
+ // 2 : Response
+ // 3 : Success
+ // 4 : Failure
+
+ // An EAP packet of the type of Success and Failure has no Data field, and has a length of 4.
+
+ /* EAP Packet format */
+ /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */
+ /* ----------------------------------------------- */
+ /* Code | Identifier */
+ /* ----------------------------------------------- 2 */
+ /* Length */
+ /* ----------------------------------------------- 4 */
+ /* Data */
+ /* ----------------------------------------------- N */
+
+ zm_debug_msg0("EAP-Packet");
+ zm_debug_msg1("Packet Length = ", packetLen);
+ zm_debug_msg1("EAP-Packet Code = ", code);
+
+ if( code == 1 )
+ {
+ zm_debug_msg0("EAP-Packet Request");
+
+ /* EAP-Packet Identifier */
+ identifier = zmw_tx_buf_readb(dev, buf, offset+5);
+ /* EAP-Packet Length */
+ length = (((u16_t) zmw_tx_buf_readb(dev, buf, offset+6)) << 8) +
+ zmw_tx_buf_readb(dev, buf, offset+7);
+ /* EAP-Packet Type */
+ type = zmw_tx_buf_readb(dev, buf, offset+8); // 1 : Identity
+ // 2 : Notification
+ // 3 : Nak (Response Only)
+ // 4 : MD5-Challenge
+ // 5 : One Time Password (OTP)
+ // 6 : Generic Token Card (GTC)
+ // 254 : (Expanded Types)Wi-Fi Protected Setup
+ // 255 : Experimental Use
+
+ /* The data field in an EAP packet of the type of Request or Response is in the format shown bellowing */
+ /* 0 1 2 3 4 5 6 7 N */
+ /* ----------------------------------------------- */
+ /* Type | Type Data */
+ /* ----------------------------------------------- */
+
+ zm_debug_msg1("EAP-Packet Identifier = ", identifier);
+ zm_debug_msg1("EAP-Packet Length = ", length);
+ zm_debug_msg1("EAP-Packet Type = ", type);
+
+ if( type == 1 )
+ {
+ zm_debug_msg0("EAP-Packet Request Identity");
+ }
+ else if( type == 2 )
+ {
+ zm_debug_msg0("EAP-Packet Request Notification");
+ }
+ else if( type == 4 )
+ {
+ zm_debug_msg0("EAP-Packet Request MD5-Challenge");
+ }
+ else if( type == 5 )
+ {
+ zm_debug_msg0("EAP-Packet Request One Time Password");
+ }
+ else if( type == 6 )
+ {
+ zm_debug_msg0("EAP-Packet Request Generic Token Card");
+ }
+ else if( type == 254 )
+ {
+ zm_debug_msg0("EAP-Packet Request Wi-Fi Protected Setup");
+
+ /* 0 1 2 3 */
+ /* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 */
+ /*+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*/
+ /*| Type | Vendor-Id |*/
+ /*+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*/
+ /*| Vendor-Type |*/
+ /*+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*/
+ /*| Vendor data... */
+ /*+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
+
+ /* EAP-Packet Vendor ID */
+ vendorId = (((u32_t) zmw_tx_buf_readb(dev, buf, offset+9)) << 16) +
+ (((u32_t) zmw_tx_buf_readb(dev, buf, offset+10)) << 8) +
+ zmw_tx_buf_readb(dev, buf, offset+11);
+ /* EAP-Packet Vendor Type */
+ VendorType = (((u32_t) zmw_tx_buf_readb(dev, buf, offset+12)) << 24) +
+ (((u32_t) zmw_tx_buf_readb(dev, buf, offset+13)) << 16) +
+ (((u32_t) zmw_tx_buf_readb(dev, buf, offset+14)) << 8) +
+ zmw_tx_buf_readb(dev, buf, offset+15);
+ /* EAP-Packet Op Code */
+ Op_Code = (((u16_t) zmw_tx_buf_readb(dev, buf, offset+16)) << 8) +
+ zmw_tx_buf_readb(dev, buf, offset+17);
+ /* EAP-Packet Flags */
+ flags = zmw_tx_buf_readb(dev, buf, offset+18);
+
+ zm_debug_msg1("EAP-Packet Vendor ID = ", vendorId);
+ zm_debug_msg1("EAP-Packet Venodr Type = ", VendorType);
+ zm_debug_msg1("EAP-Packet Op Code = ", Op_Code);
+ zm_debug_msg1("EAP-Packet Flags = ", flags);
+ }
+ }
+ else if( code == 2 )
+ {
+ zm_debug_msg0("EAP-Packet Response");
+
+ /* EAP-Packet Identifier */
+ identifier = zmw_tx_buf_readb(dev, buf, offset+5);
+ /* EAP-Packet Length */
+ length = (((u16_t) zmw_tx_buf_readb(dev, buf, offset+6)) << 8) +
+ zmw_tx_buf_readb(dev, buf, offset+7);
+ /* EAP-Packet Type */
+ type = zmw_tx_buf_readb(dev, buf, offset+8);
+
+ zm_debug_msg1("EAP-Packet Identifier = ", identifier);
+ zm_debug_msg1("EAP-Packet Length = ", length);
+ zm_debug_msg1("EAP-Packet Type = ", type);
+
+ if( type == 1 )
+ {
+ zm_debug_msg0("EAP-Packet Response Identity");
+ }
+ else if( type == 2 )
+ {
+ zm_debug_msg0("EAP-Packet Request Notification");
+ }
+ else if( type == 3 )
+ {
+ zm_debug_msg0("EAP-Packet Request Nak");
+ }
+ else if( type == 4 )
+ {
+ zm_debug_msg0("EAP-Packet Request MD5-Challenge");
+ }
+ else if( type == 5 )
+ {
+ zm_debug_msg0("EAP-Packet Request One Time Password");
+ }
+ else if( type == 6 )
+ {
+ zm_debug_msg0("EAP-Packet Request Generic Token Card");
+ }
+ else if( type == 254 )
+ {
+ zm_debug_msg0("EAP-Packet Response Wi-Fi Protected Setup");
+
+ /* EAP-Packet Vendor ID */
+ vendorId = (((u32_t) zmw_tx_buf_readb(dev, buf, offset+9)) << 16) +
+ (((u32_t) zmw_tx_buf_readb(dev, buf, offset+10)) << 8) +
+ zmw_tx_buf_readb(dev, buf, offset+11);
+ /* EAP-Packet Vendor Type */
+ VendorType = (((u32_t) zmw_tx_buf_readb(dev, buf, offset+12)) << 24) +
+ (((u32_t) zmw_tx_buf_readb(dev, buf, offset+13)) << 16) +
+ (((u32_t) zmw_tx_buf_readb(dev, buf, offset+14)) << 8) +
+ zmw_tx_buf_readb(dev, buf, offset+15);
+ /* EAP-Packet Op Code */
+ Op_Code = (((u16_t) zmw_tx_buf_readb(dev, buf, offset+16)) << 8) +
+ zmw_tx_buf_readb(dev, buf, offset+17);
+ /* EAP-Packet Flags */
+ flags = zmw_tx_buf_readb(dev, buf, offset+18);
+
+ zm_debug_msg1("EAP-Packet Vendor ID = ", vendorId);
+ zm_debug_msg1("EAP-Packet Venodr Type = ", VendorType);
+ zm_debug_msg1("EAP-Packet Op Code = ", Op_Code);
+ zm_debug_msg1("EAP-Packet Flags = ", flags);
+ }
+ }
+ else if( code == 3 )
+ {
+ zm_debug_msg0("EAP-Packet Success");
+
+ /* EAP-Packet Identifier */
+ identifier = zmw_rx_buf_readb(dev, buf, offset+5);
+ /* EAP-Packet Length */
+ length = (((u16_t) zmw_rx_buf_readb(dev, buf, offset+6)) << 8) +
+ zmw_rx_buf_readb(dev, buf, offset+7);
+
+ zm_debug_msg1("EAP-Packet Identifier = ", identifier);
+ zm_debug_msg1("EAP-Packet Length = ", length);
+ }
+ else if( code == 4 )
+ {
+ zm_debug_msg0("EAP-Packet Failure");
+
+ /* EAP-Packet Identifier */
+ identifier = zmw_tx_buf_readb(dev, buf, offset+5);
+ /* EAP-Packet Length */
+ length = (((u16_t) zmw_tx_buf_readb(dev, buf, offset+6)) << 8) +
+ zmw_tx_buf_readb(dev, buf, offset+7);
+
+ zm_debug_msg1("EAP-Packet Identifier = ", identifier);
+ zm_debug_msg1("EAP-Packet Length = ", length);
+ }
+ }
+ else if( packetType == 1 )
+ { // EAPOL-Start
+ zm_debug_msg0("EAPOL-Start");
+ }
+ else if( packetType == 2 )
+ { // EAPOL-Logoff
+ zm_debug_msg0("EAPOL-Logoff");
+ }
+ else if( packetType == 3 )
+ { // EAPOL-Key
+ /* EAPOL-Key type */
+ keyType = zmw_tx_buf_readb(dev, buf, offset+4);
+ /* EAPOL-Key information */
+ keyInfo = (((u16_t) zmw_tx_buf_readb(dev, buf, offset+5)) << 8) +
+ zmw_tx_buf_readb(dev, buf, offset+6);
+ /* EAPOL-Key length */
+ keyLen = (((u16_t) zmw_tx_buf_readb(dev, buf, offset+7)) << 8) +
+ zmw_tx_buf_readb(dev, buf, offset+8);
+ /* EAPOL-Key replay counter (high double word) */
+ replayCounterH = (((u32_t) zmw_tx_buf_readb(dev, buf, offset+9)) << 24) +
+ (((u32_t) zmw_tx_buf_readb(dev, buf, offset+10)) << 16) +
+ (((u32_t) zmw_tx_buf_readb(dev, buf, offset+11)) << 8) +
+ zmw_tx_buf_readb(dev, buf, offset+12);
+ /* EAPOL-Key replay counter (low double word) */
+ replayCounterL = (((u32_t) zmw_tx_buf_readb(dev, buf, offset+13)) << 24) +
+ (((u32_t) zmw_tx_buf_readb(dev, buf, offset+14)) << 16) +
+ (((u32_t) zmw_tx_buf_readb(dev, buf, offset+15)) << 8) +
+ zmw_tx_buf_readb(dev, buf, offset+16);
+ /* EAPOL-Key data length */
+ keyDataLen = (((u16_t) zmw_tx_buf_readb(dev, buf, offset+97)) << 8) +
+ zmw_tx_buf_readb(dev, buf, offset+98);
+
+ zm_debug_msg0("EAPOL-Key");
+ zm_debug_msg1("packet length = ", packetLen);
+
+ if ( keyType == 254 )
+ {
+ zm_debug_msg0("key type = 254 (SSN key descriptor)");
+ }
+ else
+ {
+ zm_debug_msg2("key type = 0x", keyType);
+ }
+
+ zm_debug_msg2("replay counter(L) = ", replayCounterL);
+
+ zm_debug_msg2("key information = ", keyInfo);
+
+ if ( keyInfo & ZM_BIT_3 )
+ {
+ zm_debug_msg0(" - pairwise key");
+ }
+ else
+ {
+ zm_debug_msg0(" - group key");
+ }
+
+ if ( keyInfo & ZM_BIT_6 )
+ {
+ zm_debug_msg0(" - Tx key installed");
+ }
+ else
+ {
+ zm_debug_msg0(" - Tx key not set");
+ }
+
+ if ( keyInfo & ZM_BIT_7 )
+ {
+ zm_debug_msg0(" - Ack needed");
+ }
+ else
+ {
+ zm_debug_msg0(" - Ack not needed");
+ }
+
+ if ( keyInfo & ZM_BIT_8 )
+ {
+ zm_debug_msg0(" - MIC set");
+ }
+ else
+ {
+ zm_debug_msg0(" - MIC not set");
+ }
+
+ if ( keyInfo & ZM_BIT_9 )
+ {
+ zm_debug_msg0(" - packet encrypted");
+ }
+ else
+ {
+ zm_debug_msg0(" - packet not encrypted");
+ }
+
+ zm_debug_msg1("keyLen = ", keyLen);
+ zm_debug_msg1("keyDataLen = ", keyDataLen);
+ }
+ else if( packetType == 4 )
+ {
+ zm_debug_msg0("EAPOL-Encapsulated-ASF-Alert");
+ }
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfiRecv80211 */
+/* Called to receive 802.11 frame. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : received 802.11 frame buffer. */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen ZyDAS Technology Corporation 2005.5 */
+/* */
+/************************************************************************/
+void zfiRecv80211(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo)
+{
+ u8_t snapCase=0, encryMode;
+ u16_t frameType, typeLengthField;
+ u16_t frameCtrl;
+ u16_t frameSubtype;
+ u16_t ret;
+ u16_t len;
+ u8_t bIsDefrag = 0;
+ u16_t offset, tailLen;
+ u8_t vap = 0;
+ u16_t da[3], sa[3];
+ u16_t ii;
+ u8_t uapsdTrig = 0;
+ zbuf_t* psBuf;
+#ifdef ZM_ENABLE_NATIVE_WIFI
+ u8_t i;
+#endif
+
+ zmw_get_wlan_dev(dev);
+
+ ZM_BUFFER_TRACE(dev, buf)
+
+ //zm_msg2_rx(ZM_LV_2, "zfiRecv80211(), buf=", buf);
+
+ //zm_msg2_rx(ZM_LV_0, "h[0]=", zmw_rx_buf_readh(dev, buf, 0));
+ //zm_msg2_rx(ZM_LV_0, "h[2]=", zmw_rx_buf_readh(dev, buf, 2));
+ //zm_msg2_rx(ZM_LV_0, "h[4]=", zmw_rx_buf_readh(dev, buf, 4));
+
+ frameCtrl = zmw_rx_buf_readb(dev, buf, 0);
+ frameType = frameCtrl & 0xf;
+ frameSubtype = frameCtrl & 0xf0;
+
+#if 0 // Move to ProcessBeacon to judge if there's a new peer station
+ if ( (wd->wlanMode == ZM_MODE_IBSS)&&
+ (wd->sta.ibssPartnerStatus != ZM_IBSS_PARTNER_ALIVE) )
+ {
+ zfStaIbssMonitoring(dev, buf);
+ }
+#endif
+
+ /* If data frame */
+ if (frameType == ZM_WLAN_DATA_FRAME)
+ {
+ wd->sta.TotalNumberOfReceivePackets++;
+ wd->sta.TotalNumberOfReceiveBytes += zfwBufGetSize(dev, buf);
+ //zm_debug_msg1("Receive packets = ", wd->sta.TotalNumberOfReceivePackets);
+
+ //zm_msg0_rx(ZM_LV_0, "Rx data");
+ if (wd->wlanMode == ZM_MODE_AP)
+ {
+ if ((ret = zfApUpdatePsBit(dev, buf, &vap, &uapsdTrig)) != ZM_SUCCESS)
+ {
+ zfwBufFree(dev, buf, 0);
+ return;
+ }
+
+ if (((uapsdTrig&0xf) != 0) && ((frameSubtype & 0x80) != 0))
+ {
+ u8_t ac = zcUpToAc[zmw_buf_readb(dev, buf, 24)&0x7];
+ u8_t pktNum;
+ u8_t mb;
+ u16_t flag;
+ u8_t src[6];
+
+ //printk("QoS ctrl=%d\n", zmw_buf_readb(dev, buf, 24));
+ //printk("UAPSD trigger, ac=%d\n", ac);
+
+ if (((0x8>>ac) & uapsdTrig) != 0)
+ {
+ pktNum = zcMaxspToPktNum[(uapsdTrig>>4) & 0x3];
+
+ for (ii=0; ii<6; ii++)
+ {
+ src[ii] = zmw_buf_readb(dev, buf, ZM_WLAN_HEADER_A2_OFFSET+ii);
+ }
+
+ for (ii=0; ii<pktNum; ii++)
+ {
+ //if ((psBuf = zfQueueGet(dev, wd->ap.uapsdQ)) != NULL)
+ if ((psBuf = zfQueueGetWithMac(dev, wd->ap.uapsdQ, src, &mb)) != NULL)
+ {
+ if ((ii+1) == pktNum)
+ {
+ //EOSP anyway
+ flag = 0x100 | (mb<<5);
+ }
+ else
+ {
+ if (mb != 0)
+ {
+ //more data, not EOSP
+ flag = 0x20;
+ }
+ else
+ {
+ //no more data, EOSP
+ flag = 0x100;
+ }
+ }
+ zfTxSendEth(dev, psBuf, 0, ZM_EXTERNAL_ALLOC_BUF, flag);
+ }
+
+ if ((psBuf == NULL) || (mb == 0))
+ {
+ if ((ii == 0) && (psBuf == NULL))
+ {
+ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_QOS_NULL, (u16_t*)src, 0, 0, 0);
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ }
+ else if ( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ {
+ u16_t frameCtrlMSB;
+ u8_t bssid[6];
+
+ /* Check Is RIFS frame and decide to enable RIFS or not */
+ if( wd->sta.EnableHT )
+ zfCheckIsRIFSFrame(dev, buf, frameSubtype);
+
+ if ( zfPowerSavingMgrIsSleeping(dev) || wd->sta.psMgr.tempWakeUp == 1)
+ {
+ frameCtrlMSB = zmw_rx_buf_readb(dev, buf, 1);
+
+ /* check more data */
+ if ( frameCtrlMSB & ZM_BIT_5 )
+ {
+ //if rx frame's AC is not delivery-enabled
+ if ((wd->sta.qosInfo&0xf) != 0xf)
+ {
+ u8_t rxAc = 0;
+ if ((frameSubtype & 0x80) != 0)
+ {
+ rxAc = zcUpToAc[zmw_buf_readb(dev, buf, 24)&0x7];
+ }
+
+ if (((0x8>>rxAc) & wd->sta.qosInfo) == 0)
+ {
+ zfSendPSPoll(dev);
+ wd->sta.psMgr.tempWakeUp = 0;
+ }
+ }
+ }
+ }
+ /*increase beacon count when receive vaild data frame from AP*/
+ ZM_MAC_WORD_TO_BYTE(wd->sta.bssid, bssid);
+
+ if (zfStaIsConnected(dev)&&
+ zfRxBufferEqualToStr(dev, buf, bssid, ZM_WLAN_HEADER_A2_OFFSET, 6))
+ {
+ wd->sta.rxBeaconCount++;
+ }
+ }
+
+ zm_msg1_rx(ZM_LV_2, "Rx VAP=", vap);
+
+ /* handle IV, EXT-IV, ICV, and EXT-ICV */
+ zfGetRxIvIcvLength(dev, buf, vap, &offset, &tailLen, addInfo);
+
+ zfStaIbssPSCheckState(dev, buf);
+ //QoS data frame
+ if ((frameSubtype & 0x80) == 0x80)
+ {
+ offset += 2;
+ }
+
+ len = zfwBufGetSize(dev, buf);
+ /* remove ICV */
+ if (tailLen > 0)
+ {
+ if (len > tailLen)
+ {
+ len -= tailLen;
+ zfwBufSetSize(dev, buf, len);
+ }
+ }
+
+ /* Filter NULL data */
+ if (((frameSubtype&0x40) != 0) || ((len = zfwBufGetSize(dev, buf))<=24))
+ {
+ zm_msg1_rx(ZM_LV_1, "Free Rx NULL data, len=", len);
+ zfwBufFree(dev, buf, 0);
+ return;
+ }
+
+ /* check and handle defragmentation */
+ if ( wd->sta.bSafeMode && (wd->sta.wepStatus == ZM_ENCRYPTION_AES) && wd->sta.SWEncryptEnable )
+ {
+ zm_msg0_rx(ZM_LV_1, "Bypass defragmentation packets in safe mode");
+ }
+ else
+ {
+ if ( (buf = zfDefragment(dev, buf, &bIsDefrag, addInfo)) == NULL )
+ {
+ /* In this case, the buffer has been freed in zfDefragment */
+ return;
+ }
+ }
+
+ ret = ZM_MIC_SUCCESS;
+
+ /* If SW WEP/TKIP are not turned on */
+ if ((wd->sta.SWEncryptEnable & ZM_SW_TKIP_DECRY_EN) == 0 &&
+ (wd->sta.SWEncryptEnable & ZM_SW_WEP_DECRY_EN) == 0)
+ {
+ encryMode = zfGetEncryModeFromRxStatus(addInfo);
+
+ /* check if TKIP */
+ if ( encryMode == ZM_TKIP )
+ {
+ if ( bIsDefrag )
+ {
+ ret = zfMicRxVerify(dev, buf);
+ }
+ else
+ {
+ /* check MIC failure bit */
+ if ( ZM_RX_STATUS_IS_MIC_FAIL(addInfo) )
+ {
+ ret = ZM_MIC_FAILURE;
+ }
+ }
+
+ if ( ret == ZM_MIC_FAILURE )
+ {
+ u8_t Unicast_Pkt = 0x0;
+
+ if ((zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A1_OFFSET) & 0x1) == 0)
+ {
+ wd->commTally.swRxUnicastMicFailCount++;
+ Unicast_Pkt = 0x1;
+ }/*
+ else if (zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A1_OFFSET) == 0xffff)
+ {
+ wd->commTally.swRxMulticastMicFailCount++;
+ }*/
+ else
+ {
+ wd->commTally.swRxMulticastMicFailCount++;
+ }
+ if ( wd->wlanMode == ZM_MODE_AP )
+ {
+ u16_t idx;
+ u8_t addr[6];
+
+ for (idx=0; idx<6; idx++)
+ {
+ addr[idx] = zmw_rx_buf_readb(dev, buf, ZM_WLAN_HEADER_A2_OFFSET+idx);
+ }
+
+ if (wd->zfcbApMicFailureNotify != NULL)
+ {
+ wd->zfcbApMicFailureNotify(dev, addr, buf);
+ }
+ }
+ else
+ {
+ if(Unicast_Pkt)
+ {
+ zm_debug_msg0("Countermeasure : Unicast_Pkt ");
+ }
+ else
+ {
+ zm_debug_msg0("Countermeasure : Non-Unicast_Pkt ");
+ }
+
+ if((wd->TKIP_Group_KeyChanging == 0x0) || (Unicast_Pkt == 0x1))
+ {
+ zm_debug_msg0("Countermeasure : Do MIC Check ");
+ zfStaMicFailureHandling(dev, buf);
+ }
+ else
+ {
+ zm_debug_msg0("Countermeasure : SKIP MIC Check due to Group Keychanging ");
+ }
+ }
+ /* Discard MIC failed frame */
+ zfwBufFree(dev, buf, 0);
+ return;
+ }
+ }
+ }
+ else
+ {
+ u8_t IsEncryFrame;
+
+ /* TODO: Check whether WEP bit is turned on in MAC header */
+ encryMode = ZM_NO_WEP;
+
+ IsEncryFrame = (zmw_rx_buf_readb(dev, buf, 1) & 0x40);
+
+ if (IsEncryFrame)
+ {
+ /* Software decryption for TKIP */
+ if (wd->sta.SWEncryptEnable & ZM_SW_TKIP_DECRY_EN)
+ {
+ u16_t iv16;
+ u16_t iv32;
+ u8_t RC4Key[16];
+ u16_t IvOffset;
+ struct zsTkipSeed *rxSeed;
+
+ IvOffset = offset + ZM_SIZE_OF_WLAN_DATA_HEADER;
+
+ rxSeed = zfStaGetRxSeed(dev, buf);
+
+ if (rxSeed == NULL)
+ {
+ zm_debug_msg0("rxSeed is NULL");
+
+ /* Discard this frame */
+ zfwBufFree(dev, buf, 0);
+ return;
+ }
+
+ iv16 = (zmw_rx_buf_readb(dev, buf, IvOffset) << 8) + zmw_rx_buf_readb(dev, buf, IvOffset+2);
+ iv32 = zmw_rx_buf_readb(dev, buf, IvOffset+4) +
+ (zmw_rx_buf_readb(dev, buf, IvOffset+5) << 8) +
+ (zmw_rx_buf_readb(dev, buf, IvOffset+6) << 16) +
+ (zmw_rx_buf_readb(dev, buf, IvOffset+7) << 24);
+
+ /* TKIP Key Mixing */
+ zfTkipPhase1KeyMix(iv32, rxSeed);
+ zfTkipPhase2KeyMix(iv16, rxSeed);
+ zfTkipGetseeds(iv16, RC4Key, rxSeed);
+
+ /* Decrypt Data */
+ ret = zfTKIPDecrypt(dev, buf, IvOffset+ZM_SIZE_OF_IV+ZM_SIZE_OF_EXT_IV, 16, RC4Key);
+
+ if (ret == ZM_ICV_FAILURE)
+ {
+ zm_debug_msg0("TKIP ICV fail");
+
+ /* Discard ICV failed frame */
+ zfwBufFree(dev, buf, 0);
+ return;
+ }
+
+ /* Remove ICV from buffer */
+ zfwBufSetSize(dev, buf, len-4);
+
+ /* Check MIC */
+ ret = zfMicRxVerify(dev, buf);
+
+ if (ret == ZM_MIC_FAILURE)
+ {
+ if ((zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A1_OFFSET) & 0x1) == 0)
+ {
+ wd->commTally.swRxUnicastMicFailCount++;
+ }
+ else if (zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A1_OFFSET) == 0xffff)
+ {
+ wd->commTally.swRxMulticastMicFailCount++;
+ }
+ else
+ {
+ wd->commTally.swRxMulticastMicFailCount++;
+ }
+ if ( wd->wlanMode == ZM_MODE_AP )
+ {
+ u16_t idx;
+ u8_t addr[6];
+
+ for (idx=0; idx<6; idx++)
+ {
+ addr[idx] = zmw_rx_buf_readb(dev, buf, ZM_WLAN_HEADER_A2_OFFSET+idx);
+ }
+
+ if (wd->zfcbApMicFailureNotify != NULL)
+ {
+ wd->zfcbApMicFailureNotify(dev, addr, buf);
+ }
+ }
+ else
+ {
+ zfStaMicFailureHandling(dev, buf);
+ }
+
+ zm_debug_msg0("MIC fail");
+ /* Discard MIC failed frame */
+ zfwBufFree(dev, buf, 0);
+ return;
+ }
+
+ encryMode = ZM_TKIP;
+ offset += ZM_SIZE_OF_IV + ZM_SIZE_OF_EXT_IV;
+ }
+ else if(wd->sta.SWEncryptEnable & ZM_SW_WEP_DECRY_EN)
+ {
+ u16_t IvOffset;
+ u8_t keyLen = 5;
+ u8_t iv[3];
+ u8_t *wepKey;
+ u8_t keyIdx;
+
+ IvOffset = offset + ZM_SIZE_OF_WLAN_DATA_HEADER;
+
+ /* Retrieve IV */
+ iv[0] = zmw_rx_buf_readb(dev, buf, IvOffset);
+ iv[1] = zmw_rx_buf_readb(dev, buf, IvOffset+1);
+ iv[2] = zmw_rx_buf_readb(dev, buf, IvOffset+2);
+
+ keyIdx = ((zmw_rx_buf_readb(dev, buf, IvOffset+3) >> 6) & 0x03);
+
+ IvOffset += ZM_SIZE_OF_IV;
+
+ if (wd->sta.SWEncryMode[keyIdx] == ZM_WEP64)
+ {
+ keyLen = 5;
+ }
+ else if (wd->sta.SWEncryMode[keyIdx] == ZM_WEP128)
+ {
+ keyLen = 13;
+ }
+ else if (wd->sta.SWEncryMode[keyIdx] == ZM_WEP256)
+ {
+ keyLen = 29;
+ }
+
+ zfWEPDecrypt(dev, buf, IvOffset, keyLen, wd->sta.wepKey[keyIdx], iv);
+
+ if (ret == ZM_ICV_FAILURE)
+ {
+ zm_debug_msg0("WEP ICV fail");
+
+ /* Discard ICV failed frame */
+ zfwBufFree(dev, buf, 0);
+ return;
+ }
+
+ encryMode = wd->sta.SWEncryMode[keyIdx];
+
+ /* Remove ICV from buffer */
+ zfwBufSetSize(dev, buf, len-4);
+
+ offset += ZM_SIZE_OF_IV;
+ }
+ }
+ }
+
+#ifdef ZM_ENABLE_CENC
+ //else if ( encryMode == ZM_CENC ) /* check if CENC */
+ if ( encryMode == ZM_CENC )
+ {
+ u32_t rxIV[4];
+
+ rxIV[0] = (zmw_rx_buf_readh(dev, buf, 28) << 16)
+ + zmw_rx_buf_readh(dev, buf, 26);
+ rxIV[1] = (zmw_rx_buf_readh(dev, buf, 32) << 16)
+ + zmw_rx_buf_readh(dev, buf, 30);
+ rxIV[2] = (zmw_rx_buf_readh(dev, buf, 36) << 16)
+ + zmw_rx_buf_readh(dev, buf, 34);
+ rxIV[3] = (zmw_rx_buf_readh(dev, buf, 40) << 16)
+ + zmw_rx_buf_readh(dev, buf, 38);
+
+ //zm_debug_msg2("rxIV[0] = 0x", rxIV[0]);
+ //zm_debug_msg2("rxIV[1] = 0x", rxIV[1]);
+ //zm_debug_msg2("rxIV[2] = 0x", rxIV[2]);
+ //zm_debug_msg2("rxIV[3] = 0x", rxIV[3]);
+
+ /* destination address*/
+ da[0] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A1_OFFSET);
+ da[1] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A1_OFFSET+2);
+ da[2] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A1_OFFSET+4);
+
+ if ( wd->wlanMode == ZM_MODE_AP )
+ {
+ }
+ else
+ {
+ if ((da[0] & 0x1))
+ { //multicast frame
+ /* Accumlate the PN sequence */
+ wd->sta.rxivGK[0] ++;
+
+ if (wd->sta.rxivGK[0] == 0)
+ {
+ wd->sta.rxivGK[1]++;
+ }
+
+ if (wd->sta.rxivGK[1] == 0)
+ {
+ wd->sta.rxivGK[2]++;
+ }
+
+ if (wd->sta.rxivGK[2] == 0)
+ {
+ wd->sta.rxivGK[3]++;
+ }
+
+ if (wd->sta.rxivGK[3] == 0)
+ {
+ wd->sta.rxivGK[0] = 0;
+ wd->sta.rxivGK[1] = 0;
+ wd->sta.rxivGK[2] = 0;
+ }
+
+ //zm_debug_msg2("wd->sta.rxivGK[0] = 0x", wd->sta.rxivGK[0]);
+ //zm_debug_msg2("wd->sta.rxivGK[1] = 0x", wd->sta.rxivGK[1]);
+ //zm_debug_msg2("wd->sta.rxivGK[2] = 0x", wd->sta.rxivGK[2]);
+ //zm_debug_msg2("wd->sta.rxivGK[3] = 0x", wd->sta.rxivGK[3]);
+
+ if ( !((wd->sta.rxivGK[0] == rxIV[0])
+ && (wd->sta.rxivGK[1] == rxIV[1])
+ && (wd->sta.rxivGK[2] == rxIV[2])
+ && (wd->sta.rxivGK[3] == rxIV[3])))
+ {
+ u8_t PacketDiscard = 0;
+ /* Discard PN Code Error frame */
+ if (rxIV[0] < wd->sta.rxivGK[0])
+ {
+ PacketDiscard = 1;
+ }
+ if (wd->sta.rxivGK[0] > 0xfffffff0)
+ { //boundary case
+ if ((rxIV[0] < 0xfffffff0)
+ && (((0xffffffff - wd->sta.rxivGK[0]) + rxIV[0]) > 16))
+ {
+ PacketDiscard = 1;
+ }
+ }
+ else
+ { //normal case
+ if ((rxIV[0] - wd->sta.rxivGK[0]) > 16)
+ {
+ PacketDiscard = 1;
+ }
+ }
+ // sync sta pn code with ap because of losting some packets
+ wd->sta.rxivGK[0] = rxIV[0];
+ wd->sta.rxivGK[1] = rxIV[1];
+ wd->sta.rxivGK[2] = rxIV[2];
+ wd->sta.rxivGK[3] = rxIV[3];
+ if (PacketDiscard)
+ {
+ zm_debug_msg0("Discard PN Code lost too much multicast frame");
+ zfwBufFree(dev, buf, 0);
+ return;
+ }
+ }
+ }
+ else
+ { //unicast frame
+ /* Accumlate the PN sequence */
+ wd->sta.rxiv[0] += 2;
+
+ if (wd->sta.rxiv[0] == 0 || wd->sta.rxiv[0] == 1)
+ {
+ wd->sta.rxiv[1]++;
+ }
+
+ if (wd->sta.rxiv[1] == 0)
+ {
+ wd->sta.rxiv[2]++;
+ }
+
+ if (wd->sta.rxiv[2] == 0)
+ {
+ wd->sta.rxiv[3]++;
+ }
+
+ if (wd->sta.rxiv[3] == 0)
+ {
+ wd->sta.rxiv[0] = 0;
+ wd->sta.rxiv[1] = 0;
+ wd->sta.rxiv[2] = 0;
+ }
+
+ //zm_debug_msg2("wd->sta.rxiv[0] = 0x", wd->sta.rxiv[0]);
+ //zm_debug_msg2("wd->sta.rxiv[1] = 0x", wd->sta.rxiv[1]);
+ //zm_debug_msg2("wd->sta.rxiv[2] = 0x", wd->sta.rxiv[2]);
+ //zm_debug_msg2("wd->sta.rxiv[3] = 0x", wd->sta.rxiv[3]);
+
+ if ( !((wd->sta.rxiv[0] == rxIV[0])
+ && (wd->sta.rxiv[1] == rxIV[1])
+ && (wd->sta.rxiv[2] == rxIV[2])
+ && (wd->sta.rxiv[3] == rxIV[3])))
+ {
+ zm_debug_msg0("PN Code mismatch, lost unicast frame, sync pn code to recv packet");
+ // sync sta pn code with ap because of losting some packets
+ wd->sta.rxiv[0] = rxIV[0];
+ wd->sta.rxiv[1] = rxIV[1];
+ wd->sta.rxiv[2] = rxIV[2];
+ wd->sta.rxiv[3] = rxIV[3];
+ /* Discard PN Code Error frame */
+ //zm_debug_msg0("Discard PN Code mismatch unicast frame");
+ //zfwBufFree(dev, buf, 0);
+ //return;
+ }
+ }
+ }
+ }
+#endif //ZM_ENABLE_CENC
+
+ /* for tally */
+ if ((zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A1_OFFSET) & 0x1) == 0)
+ {
+ /* for ACU to display RxRate */
+ zfWlanUpdateRxRate(dev, addInfo);
+
+ wd->commTally.rxUnicastFrm++;
+ wd->commTally.rxUnicastOctets += (len-24);
+ }
+ else if (zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A1_OFFSET) == 0xffff)
+ {
+ wd->commTally.rxBroadcastFrm++;
+ wd->commTally.rxBroadcastOctets += (len-24);
+ }
+ else
+ {
+ wd->commTally.rxMulticastFrm++;
+ wd->commTally.rxMulticastOctets += (len-24);
+ }
+ wd->ledStruct.rxTraffic++;
+
+ if ((frameSubtype & 0x80) == 0x80)
+ {
+ /* if QoS control bit-7 is 1 => A-MSDU frame */
+ if ((zmw_rx_buf_readh(dev, buf, 24) & 0x80) != 0)
+ {
+ zfDeAmsdu(dev, buf, vap, encryMode);
+ return;
+ }
+ }
+
+ // Remove MIC of TKIP
+ if ( encryMode == ZM_TKIP )
+ {
+ zfwBufSetSize(dev, buf, zfwBufGetSize(dev, buf) - 8);
+ }
+
+ /* Convert 802.11 and SNAP header to ethernet header */
+ if ( (wd->wlanMode == ZM_MODE_INFRASTRUCTURE)||
+ (wd->wlanMode == ZM_MODE_IBSS) )
+ {
+ /* destination address*/
+ da[0] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A1_OFFSET);
+ da[1] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A1_OFFSET+2);
+ da[2] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A1_OFFSET+4);
+
+ /* check broadcast frame */
+ if ( (da[0] == 0xffff) && (da[1] == 0xffff) && (da[2] == 0xffff) )
+ {
+ // Ap send broadcast frame to the DUT !
+ }
+ /* check multicast frame */
+ /* TODO : Remove these code, hardware should be able to block */
+ /* multicast frame on the multicast address list */
+ /* or bypass all multicast packet by flag bAllMulticast */
+ else if ((da[0] & 0x01) && (wd->sta.bAllMulticast == 0))
+ {
+ for(ii=0; ii<wd->sta.multicastList.size; ii++)
+ {
+ if ( zfMemoryIsEqual(wd->sta.multicastList.macAddr[ii].addr,
+ (u8_t*) da, 6))
+ {
+ break;
+ }
+ }
+
+ if ( ii == wd->sta.multicastList.size )
+ { /* not found */
+ zm_debug_msg0("discard unknown multicast frame");
+
+ zfwBufFree(dev, buf, 0);
+ return;
+ }
+ }
+
+#ifdef ZM_ENABLE_NATIVE_WIFI //Native Wifi : 1, Ethernet format : 0
+ //To remove IV
+ if (offset > 0)
+ {
+ for (i=12; i>0; i--)
+ {
+ zmw_rx_buf_writeh(dev, buf, ((i-1)*2)+offset,
+ zmw_rx_buf_readh(dev, buf, (i-1)*2));
+ }
+ zfwBufRemoveHead(dev, buf, offset);
+ }
+#else
+
+ if (zfRxBufferEqualToStr(dev, buf, zgSnapBridgeTunnel,
+ 24+offset, 6))
+ {
+ snapCase = 1;
+ }
+ else if ( zfRxBufferEqualToStr(dev, buf, zgSnap8021h,
+ 24+offset, 6) )
+ {
+ typeLengthField =
+ (((u16_t) zmw_rx_buf_readb(dev, buf, 30+offset)) << 8) +
+ zmw_rx_buf_readb(dev, buf, 31+offset);
+
+ //zm_debug_msg2("tpyeLengthField = ", typeLengthField);
+
+ //8137 : IPX, 80F3 : Appletalk
+ if ( (typeLengthField != 0x8137)&&
+ (typeLengthField != 0x80F3) )
+ {
+ snapCase = 2;
+ }
+
+ if ( typeLengthField == 0x888E )
+ {
+ zfShowRxEAPOL(dev, buf, 32);
+ }
+ }
+ else
+ {
+ //zfwDumpBuf(dev, buf);
+ }
+
+ /* source address */
+ if ( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ {
+ /* SA = Address 3 */
+ sa[0] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A3_OFFSET);
+ sa[1] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A3_OFFSET+2);
+ sa[2] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A3_OFFSET+4);
+ }
+ else
+ {
+ /* SA = Address 2 */
+ sa[0] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A2_OFFSET);
+ sa[1] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A2_OFFSET+2);
+ sa[2] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A2_OFFSET+4);
+ }
+
+ if ( snapCase )
+ {
+ /* SA */
+ zmw_rx_buf_writeh(dev, buf, 24+offset, sa[0]);
+ zmw_rx_buf_writeh(dev, buf, 26+offset, sa[1]);
+ zmw_rx_buf_writeh(dev, buf, 28+offset, sa[2]);
+
+ /* DA = Address 1 */
+ zmw_rx_buf_writeh(dev, buf, 18+offset, da[0]);
+ zmw_rx_buf_writeh(dev, buf, 20+offset, da[1]);
+ zmw_rx_buf_writeh(dev, buf, 22+offset, da[2]);
+ zfwBufRemoveHead(dev, buf, 18+offset);
+ }
+ else
+ {
+ /* SA */
+ zmw_rx_buf_writeh(dev, buf, 16+offset, sa[0]);
+ zmw_rx_buf_writeh(dev, buf, 18+offset, sa[1]);
+ zmw_rx_buf_writeh(dev, buf, 20+offset, sa[2]);
+
+ /* DA = Address 1 */
+ zmw_rx_buf_writeh(dev, buf, 10+offset, da[0]);
+ zmw_rx_buf_writeh(dev, buf, 12+offset, da[1]);
+ zmw_rx_buf_writeh(dev, buf, 14+offset, da[2]);
+ zfwBufRemoveHead(dev, buf, 10+offset);
+ /* Ethernet payload length */
+ typeLengthField = zfwBufGetSize(dev, buf) - 14;
+ zmw_rx_buf_writeh(dev, buf, 12, (typeLengthField<<8)+(typeLengthField>>8));
+ }
+#endif // ZM_ENABLE_NATIVE_WIFI
+ }
+ else if (wd->wlanMode == ZM_MODE_AP)
+ {
+ //if ((zmw_rx_buf_readb(dev, buf, 1) & 0x3) != 3)
+ if (vap < ZM_MAX_AP_SUPPORT)
+ /* AP mode */
+ {
+#ifdef ZM_ENABLE_NATIVE_WIFI //Native Wifi : 1, Ethernet format : 0
+ //To remove IV
+ if (offset > 0)
+ {
+ for (i=12; i>0; i--)
+ {
+ zmw_rx_buf_writeh(dev, buf, ((i-1)*2)+offset,
+ zmw_rx_buf_readh(dev, buf, (i-1)*2));
+ }
+ zfwBufRemoveHead(dev, buf, offset);
+ }
+#else
+ /* SA = Address 2 */
+ zmw_rx_buf_writeh(dev, buf, 24+offset, zmw_rx_buf_readh(dev, buf,
+ ZM_WLAN_HEADER_A2_OFFSET));
+ zmw_rx_buf_writeh(dev, buf, 26+offset, zmw_rx_buf_readh(dev, buf,
+ ZM_WLAN_HEADER_A2_OFFSET+2));
+ zmw_rx_buf_writeh(dev, buf, 28+offset, zmw_rx_buf_readh(dev, buf,
+ ZM_WLAN_HEADER_A2_OFFSET+4));
+ /* DA = Address 3 */
+ /* Seq : Read 20 write 22, read 18 write 20, read 16 write 18 */
+ /* sequence must not be inverted */
+ zmw_rx_buf_writeh(dev, buf, 22+offset, zmw_rx_buf_readh(dev, buf,
+ ZM_WLAN_HEADER_A3_OFFSET+4));
+ zmw_rx_buf_writeh(dev, buf, 20+offset, zmw_rx_buf_readh(dev, buf,
+ ZM_WLAN_HEADER_A3_OFFSET+2));
+ zmw_rx_buf_writeh(dev, buf, 18+offset, zmw_rx_buf_readh(dev, buf,
+ ZM_WLAN_HEADER_A3_OFFSET));
+ zfwBufRemoveHead(dev, buf, 18+offset);
+#endif // ZM_ENABLE_NATIVE_WIFI
+ #if 1
+ if ((ret = zfIntrabssForward(dev, buf, vap)) == 1)
+ {
+ /* Free Rx buffer if intra-BSS unicast frame */
+ zm_msg0_rx(ZM_LV_2, "Free intra-BSS unicast frame");
+ zfwBufFree(dev, buf, 0);
+ return;
+ }
+ #endif
+ }
+ else
+ /* WDS mode */
+ {
+ zm_msg0_rx(ZM_LV_2, "Rx WDS data");
+
+ /* SA = Address 4 */
+ zmw_rx_buf_writeh(dev, buf, 30+offset, zmw_rx_buf_readh(dev, buf,
+ ZM_WLAN_HEADER_A4_OFFSET));
+ zmw_rx_buf_writeh(dev, buf, 32+offset, zmw_rx_buf_readh(dev, buf,
+ ZM_WLAN_HEADER_A4_OFFSET+2));
+ zmw_rx_buf_writeh(dev, buf, 34+offset, zmw_rx_buf_readh(dev, buf,
+ ZM_WLAN_HEADER_A4_OFFSET+4));
+ /* DA = Address 3 */
+ /* Seq : Read 20 write 22, read 18 write 20, read 16 write 18 */
+ /* sequence must not be inverted */
+ zmw_rx_buf_writeh(dev, buf, 28+offset, zmw_rx_buf_readh(dev, buf,
+ ZM_WLAN_HEADER_A3_OFFSET+4));
+ zmw_rx_buf_writeh(dev, buf, 26+offset, zmw_rx_buf_readh(dev, buf,
+ ZM_WLAN_HEADER_A3_OFFSET+2));
+ zmw_rx_buf_writeh(dev, buf, 24+offset, zmw_rx_buf_readh(dev, buf,
+ ZM_WLAN_HEADER_A3_OFFSET));
+ zfwBufRemoveHead(dev, buf, 24+offset);
+ }
+ }
+ else if (wd->wlanMode == ZM_MODE_PSEUDO)
+ {
+ /* WDS test: remove add4 */
+ if (wd->enableWDS)
+ {
+ offset += 6;
+ }
+
+ /* SA = Address 2 */
+ zmw_rx_buf_writeh(dev, buf, 24+offset, zmw_rx_buf_readh(dev, buf,
+ ZM_WLAN_HEADER_A2_OFFSET));
+ zmw_rx_buf_writeh(dev, buf, 26+offset, zmw_rx_buf_readh(dev, buf,
+ ZM_WLAN_HEADER_A2_OFFSET+2));
+ zmw_rx_buf_writeh(dev, buf, 28+offset, zmw_rx_buf_readh(dev, buf,
+ ZM_WLAN_HEADER_A2_OFFSET+4));
+ /* DA = Address 1 */
+ zmw_rx_buf_writeh(dev, buf, 18+offset, zmw_rx_buf_readh(dev, buf,
+ ZM_WLAN_HEADER_A1_OFFSET));
+ zmw_rx_buf_writeh(dev, buf, 20+offset, zmw_rx_buf_readh(dev, buf,
+ ZM_WLAN_HEADER_A1_OFFSET+2));
+ zmw_rx_buf_writeh(dev, buf, 22+offset, zmw_rx_buf_readh(dev, buf,
+ ZM_WLAN_HEADER_A1_OFFSET+4));
+ zfwBufRemoveHead(dev, buf, 18+offset);
+ }
+ else
+ {
+ zm_assert(0);
+ }
+
+ /* Call zfwRecvEth() to notify upper layer */
+ //zm_msg2_rx(ZM_LV_2, "Call zfwRecvEth(), buf=", buf);
+ //zfwDumpBuf(dev, buf);
+
+ #if ZM_PROTOCOL_RESPONSE_SIMULATION == 1
+ zfProtRspSim(dev, buf);
+ #endif
+ //zfwDumpBuf(dev, buf);
+
+ /* tally */
+ wd->commTally.NotifyNDISRxFrmCnt++;
+
+ if (wd->zfcbRecvEth != NULL)
+ {
+ wd->zfcbRecvEth(dev, buf, vap);
+ ZM_PERFORMANCE_RX_MSDU(dev, wd->tick)
+ }
+ }
+ /* if management frame */
+ else if (frameType == ZM_WLAN_MANAGEMENT_FRAME)
+ {
+ zm_msg2_rx(ZM_LV_2, "Rx management,FC=", frameCtrl);
+ /* Call zfProcessManagement() to handle management frame */
+ zfProcessManagement(dev, buf, addInfo); //CWYang(m)
+ zfwBufFree(dev, buf, 0);
+ }
+ /* PsPoll */
+ else if ((wd->wlanMode == ZM_MODE_AP) && (frameCtrl == 0xa4))
+ {
+ zm_msg0_rx(ZM_LV_0, "Rx PsPoll");
+ zfApProcessPsPoll(dev, buf);
+ zfwBufFree(dev, buf, 0);
+ }
+ else
+ {
+ zm_msg0_rx(ZM_LV_1, "Rx discard!!");
+ wd->commTally.DriverDiscardedFrm++;
+
+ zfwBufFree(dev, buf, 0);
+ }
+ return;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfWlanRxValidate */
+/* Validate Rx frame. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : received 802.11 frame buffer. */
+/* */
+/* OUTPUTS */
+/* Error code */
+/* */
+/* AUTHOR */
+/* Stephen ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+u16_t zfWlanRxValidate(zdev_t* dev, zbuf_t* buf)
+{
+ u16_t frameType;
+ u16_t frameCtrl;
+ u16_t frameLen;
+ u16_t ret;
+ u8_t frameSubType;
+
+ zmw_get_wlan_dev(dev);
+
+ frameCtrl = zmw_rx_buf_readh(dev, buf, 0);
+ frameType = frameCtrl & 0xC;
+ frameSubType = (frameCtrl & 0xF0) >> 4;
+
+ frameLen = zfwBufGetSize(dev, buf);
+
+ /* Accept Data/Management frame with protocol version = 0 */
+ if ((frameType == 0x8) || (frameType == 0x0))
+ {
+
+ /* TODO : check rx status => erro bit */
+
+ /* Check Minimum Length with Wep */
+ if ((frameCtrl & 0x4000) != 0)
+ {
+ /* Minimum Length = */
+ /* PLCP(5)+Header(24)+IV(4)+ICV(4)+CRC(4)+RxStatus(8) */
+ if (frameLen < 32)
+ {
+ return ZM_ERR_MIN_RX_ENCRYPT_FRAME_LENGTH;
+ }
+ }
+ else if ( frameSubType == 0x5 || frameSubType == 0x8 )
+ {
+ /* Minimum Length = PLCP(5)+MACHeader(24)+Timestamp(8)+BeaconInterval(2)+Cap(2)+CRC(4)+RxStatus(8) */
+ if (frameLen < 36)
+ {
+ return ZM_ERR_MIN_RX_FRAME_LENGTH;
+ }
+ }
+ else
+ {
+ /* Minimum Length = PLCP(5)+MACHeader(24)+CRC(4)+RxStatus(8) */
+ if (frameLen < 24)
+ {
+ return ZM_ERR_MIN_RX_FRAME_LENGTH;
+ }
+ }
+
+ /* Check if frame Length > ZM_WLAN_MAX_RX_SIZE. */
+ if (frameLen > ZM_WLAN_MAX_RX_SIZE)
+ {
+ return ZM_ERR_MAX_RX_FRAME_LENGTH;
+ }
+ }
+ else if ((frameCtrl&0xff) == 0xa4)
+ {
+ /* PsPoll */
+ //zm_msg0_rx(ZM_LV_0, "rx pspoll");
+ }
+ else if ((frameCtrl&0xff) == ZM_WLAN_FRAME_TYPE_BAR)
+ {
+ if (wd->sta.enableDrvBA == 1)
+ {
+ zfAggRecvBAR(dev, buf);
+ }
+
+ return ZM_ERR_RX_BAR_FRAME;
+ }
+ else
+ {
+ return ZM_ERR_RX_FRAME_TYPE;
+ }
+
+ if ( wd->wlanMode == ZM_MODE_AP )
+ {
+ }
+ else if ( wd->wlanMode != ZM_MODE_PSEUDO )
+ {
+ if ( (ret=zfStaRxValidateFrame(dev, buf))!=ZM_SUCCESS )
+ {
+ //zm_debug_msg1("discard frame, code = ", ret);
+ return ret;
+ }
+ }
+
+ return ZM_SUCCESS;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfWlanRxFilter */
+/* Filter duplicated frame. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : received 802.11 frame buffer. */
+/* */
+/* OUTPUTS */
+/* Error code */
+/* */
+/* AUTHOR */
+/* Stephen ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+u16_t zfWlanRxFilter(zdev_t* dev, zbuf_t* buf)
+{
+ u16_t src[3];
+ u16_t dst0;
+ u16_t frameType;
+ u16_t seq;
+ u16_t offset;
+ u16_t index;
+ u16_t col;
+ u16_t i;
+ u8_t up = 0; /* User priority */
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ ZM_BUFFER_TRACE(dev, buf)
+
+ /* RX PREFIX */
+ offset = 0;
+
+ frameType = zmw_rx_buf_readh(dev, buf, offset);
+
+ // Don't divide 2^4 because we don't want the fragementation pkt to be treated as
+ // duplicated frames
+ seq = zmw_rx_buf_readh(dev, buf, offset+22);
+ dst0 = zmw_rx_buf_readh(dev, buf, offset+4);
+ src[0] = zmw_rx_buf_readh(dev, buf, offset+10);
+ src[1] = zmw_rx_buf_readh(dev, buf, offset+12);
+ src[2] = zmw_rx_buf_readh(dev, buf, offset+14);
+
+ /* QoS data frame */
+ if ((frameType & 0x88) == 0x88)
+ {
+ up = zmw_rx_buf_readb(dev, buf, offset+24);
+ up &= 0x7;
+ }
+
+ index = (src[2]+up) & (ZM_FILTER_TABLE_ROW-1);
+
+ /* TBD : filter frame with source address == own MAC adress */
+ if ((wd->macAddr[0] == src[0]) && (wd->macAddr[1] == src[1])
+ && (wd->macAddr[2] == src[2]))
+ {
+ //zm_msg0_rx(ZM_LV_0, "Rx filter=>src is own MAC");
+ wd->trafTally.rxSrcIsOwnMac++;
+#if 0
+ return ZM_ERR_RX_SRC_ADDR_IS_OWN_MAC;
+#endif
+ }
+
+ zm_msg2_rx(ZM_LV_2, "Rx seq=", seq);
+
+ /* Filter unicast frame only */
+ if ((dst0 & 0x1) == 0)
+ {
+ zmw_enter_critical_section(dev);
+
+ for(i=0; i<ZM_FILTER_TABLE_COL; i++)
+ {
+ if ((wd->rxFilterTbl[i][index].addr[0] == src[0])
+ && (wd->rxFilterTbl[i][index].addr[1] == src[1])
+ && (wd->rxFilterTbl[i][index].addr[2] == src[2])
+ && (wd->rxFilterTbl[i][index].up == up))
+ {
+ if (((frameType&0x800)==0x800)
+ &&(wd->rxFilterTbl[i][index].seq==seq))
+ {
+ zmw_leave_critical_section(dev);
+ /* hit : duplicated frame */
+ zm_msg0_rx(ZM_LV_1, "Rx filter hit=>duplicated");
+ wd->trafTally.rxDuplicate++;
+ return ZM_ERR_RX_DUPLICATE;
+ }
+ else
+ {
+ /* hit : not duplicated frame, update sequence number */
+ wd->rxFilterTbl[i][index].seq = seq;
+ zmw_leave_critical_section(dev);
+ zm_msg0_rx(ZM_LV_2, "Rx filter hit");
+ return ZM_SUCCESS;
+ }
+ }
+ } /* for(i=0; i<ZM_FILTER_TABLE_COL; i++) */
+
+ /* miss : add to table */
+ zm_msg0_rx(ZM_LV_1, "Rx filter miss");
+ /* TODO : Random select a column */
+ col = (u16_t)(wd->tick & (ZM_FILTER_TABLE_COL-1));
+ wd->rxFilterTbl[col][index].addr[0] = src[0];
+ wd->rxFilterTbl[col][index].addr[1] = src[1];
+ wd->rxFilterTbl[col][index].addr[2] = src[2];
+ wd->rxFilterTbl[col][index].seq = seq;
+ wd->rxFilterTbl[col][index].up = up;
+
+ zmw_leave_critical_section(dev);
+ } /* if ((dst0 & 0x1) == 0) */
+
+ return ZM_SUCCESS;
+}
+
+
+
+u16_t zfTxGenWlanTail(zdev_t* dev, zbuf_t* buf, u16_t* snap, u16_t snaplen,
+ u16_t* mic)
+{
+ struct zsMicVar* pMicKey;
+ u16_t i, length, payloadOffset;
+ u8_t bValue, qosType = 0;
+ u8_t snapByte[12];
+
+ zmw_get_wlan_dev(dev);
+
+ if ( wd->wlanMode == ZM_MODE_AP )
+ {
+ pMicKey = zfApGetTxMicKey(dev, buf, &qosType);
+
+ if ( pMicKey == NULL )
+ {
+ return 0;
+ }
+ }
+ else if ( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ {
+ pMicKey = zfStaGetTxMicKey(dev, buf);
+
+ if ( pMicKey == NULL )
+ {
+ return 0;
+ }
+ }
+ else
+ {
+ return 0;
+ }
+
+ length = zfwBufGetSize(dev, buf);
+
+ zfMicClear(pMicKey);
+
+ /* append DA and SA */
+#ifdef ZM_ENABLE_NATIVE_WIFI
+ for(i=16; i<22; i++)
+ { // VISTA DA
+ bValue = zmw_tx_buf_readb(dev, buf, i);
+ zfMicAppendByte(bValue, pMicKey);
+ }
+ for(i=10; i<16; i++)
+ { // VISTA SA
+ bValue = zmw_tx_buf_readb(dev, buf, i);
+ zfMicAppendByte(bValue, pMicKey);
+ }
+#else
+ for(i=0; i<12; i++)
+ {
+ bValue = zmw_tx_buf_readb(dev, buf, i);
+ zfMicAppendByte(bValue, pMicKey);
+ }
+#endif
+
+ /* append for alignment */
+ if ( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ {
+ if (wd->sta.wmeConnected != 0)
+ zfMicAppendByte(zmw_tx_buf_readb(dev, buf, ZM_80211_FRAME_IP_OFFSET + 1) >> 5, pMicKey);
+ else
+ zfMicAppendByte(0, pMicKey);
+ }
+ else if ( wd->wlanMode == ZM_MODE_AP )
+ {
+ if (qosType == 1)
+ zfMicAppendByte(zmw_tx_buf_readb(dev, buf, ZM_80211_FRAME_IP_OFFSET + 1) >> 5, pMicKey);
+ else
+ zfMicAppendByte(0, pMicKey);
+ }
+ else
+ {
+ /* TODO : Qos Software MIC in IBSS Mode */
+ zfMicAppendByte(0, pMicKey);
+ }
+ zfMicAppendByte(0, pMicKey);
+ zfMicAppendByte(0, pMicKey);
+ zfMicAppendByte(0, pMicKey);
+
+ if ( snaplen == 0 )
+ {
+ payloadOffset = ZM_80211_FRAME_IP_OFFSET;
+ }
+ else
+ {
+ payloadOffset = ZM_80211_FRAME_TYPE_OFFSET;
+
+ for(i=0; i<(snaplen>>1); i++)
+ {
+ snapByte[i*2] = (u8_t) (snap[i] & 0xff);
+ snapByte[i*2+1] = (u8_t) ((snap[i] >> 8) & 0xff);
+ }
+
+ for(i=0; i<snaplen; i++)
+ {
+ zfMicAppendByte(snapByte[i], pMicKey);
+ }
+ }
+
+ for(i=payloadOffset; i<length; i++)
+ {
+ bValue = zmw_tx_buf_readb(dev, buf, i);
+ zfMicAppendByte(bValue, pMicKey);
+ }
+
+ zfMicGetMic( (u8_t*) mic, pMicKey);
+
+ return ZM_SIZE_OF_MIC;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfTxGetIpTosAndFrag */
+/* Get IP TOS and frag offset from Tx buffer */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : Tx buffer pointer */
+/* up : pointer for returning user priority */
+/* fragOff : pointer for returning ip frag offset */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2006.6 */
+/* */
+/************************************************************************/
+void zfTxGetIpTosAndFrag(zdev_t* dev, zbuf_t* buf, u8_t* up, u16_t* fragOff)
+{
+ u8_t ipv;
+ u16_t len;
+ u16_t etherType;
+ u8_t tos;
+
+ *up = 0;
+ *fragOff = 0;
+
+ len = zfwBufGetSize(dev, buf);
+
+ if (len >= 34) //Minimum IPv4 packet size, 14(Ether header)+20(IPv4 header)
+ {
+ etherType = (((u16_t)zmw_tx_buf_readb(dev, buf, ZM_80211_FRAME_TYPE_OFFSET))<<8)
+ + zmw_tx_buf_readb(dev, buf, ZM_80211_FRAME_TYPE_OFFSET + 1);
+
+ /* protocol type = IP */
+ if (etherType == 0x0800)
+ {
+ ipv = zmw_tx_buf_readb(dev, buf, ZM_80211_FRAME_IP_OFFSET) >> 4;
+ if (ipv == 0x4) //IPv4
+ {
+ tos = zmw_tx_buf_readb(dev, buf, ZM_80211_FRAME_IP_OFFSET + 1);
+ *up = (tos >> 5);
+ *fragOff = zmw_tx_buf_readh(dev, buf, ZM_80211_FRAME_IP_OFFSET + 6);
+ }
+ /* TODO : handle VLAN tag and IPv6 packet */
+ }
+ }
+ return;
+}
+
+#ifdef ZM_ENABLE_NATIVE_WIFI
+u16_t zfTxGenWlanSnap(zdev_t* dev, zbuf_t* buf, u16_t* snap, u16_t* snaplen)
+{
+ snap[0] = zmw_buf_readh(dev, buf, ZM_80211_FRAME_HEADER_LEN + 0);
+ snap[1] = zmw_buf_readh(dev, buf, ZM_80211_FRAME_HEADER_LEN + 2);
+ snap[2] = zmw_buf_readh(dev, buf, ZM_80211_FRAME_HEADER_LEN + 4);
+ *snaplen = 6;
+
+ return ZM_80211_FRAME_HEADER_LEN + *snaplen;
+}
+#else
+u16_t zfTxGenWlanSnap(zdev_t* dev, zbuf_t* buf, u16_t* snap, u16_t* snaplen)
+{
+ u16_t removed;
+ u16_t etherType;
+ u16_t len;
+
+ len = zfwBufGetSize(dev, buf);
+ if (len < 14) //Minimum Ethernet packet size, 14(Ether header)
+ {
+ /* TODO : Assert? */
+ *snaplen = 0;
+ return 0;
+ }
+
+ /* Generate RFC1042 header */
+ etherType = (((u16_t)zmw_tx_buf_readb(dev, buf, 12))<<8)
+ + zmw_tx_buf_readb(dev, buf, 13);
+
+ //zm_debug_msg2("ethernet type or length = ", etherType);
+
+ if (etherType > 1500)
+ {
+ /* ETHERNET format */
+ removed = 12;
+ snap[0] = 0xaaaa;
+ snap[1] = 0x0003;
+ if ((etherType ==0x8137) || (etherType == 0x80f3))
+ {
+ /* Bridge Tunnel */
+ snap[2] = 0xF800;
+ }
+ else
+ {
+ /* RFC 1042 */
+ snap[2] = 0x0000;
+ }
+ *snaplen = 6;
+
+ if ( etherType == 0x888E )
+ {
+ zfShowTxEAPOL(dev, buf, 14);
+ }
+ }
+ else
+ {
+ /* 802.3 format */
+ removed = 14;
+ *snaplen = 0;
+ }
+
+ return removed;
+}
+#endif
+
+u8_t zfIsVtxqEmpty(zdev_t* dev)
+{
+ u8_t isEmpty = TRUE;
+ u8_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ if (wd->vmmqHead != wd->vmmqTail)
+ {
+ isEmpty = FALSE;
+ goto check_done;
+ }
+
+ for(i=0; i < 4; i++)
+ {
+ if (wd->vtxqHead[i] != wd->vtxqTail[i])
+ {
+ isEmpty = FALSE;
+ goto check_done;
+ }
+ }
+
+check_done:
+ zmw_leave_critical_section(dev);
+ return isEmpty;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfPutVtxq */
+/* Put Tx buffer to virtual TxQ */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : Tx buffer pointer */
+/* */
+/* OUTPUTS */
+/* ZM_SUCCESS or error code */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2006.6 */
+/* */
+/************************************************************************/
+u16_t zfPutVtxq(zdev_t* dev, zbuf_t* buf)
+{
+ u8_t ac;
+ u8_t up;
+ u16_t fragOff;
+#ifdef ZM_AGG_TALLY
+ struct aggTally *agg_tal;
+#endif
+#ifdef ZM_ENABLE_AGGREGATION
+ #ifndef ZM_BYPASS_AGGR_SCHEDULING
+ u16_t ret;
+ u16_t tid;
+ #endif
+#endif
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zfTxGetIpTosAndFrag(dev, buf, &up, &fragOff);
+
+ if ( wd->zfcbClassifyTxPacket != NULL )
+ {
+ ac = wd->zfcbClassifyTxPacket(dev, buf);
+ }
+ else
+ {
+ ac = zcUpToAc[up&0x7] & 0x3;
+ }
+
+ /*
+ * add by honda
+ * main A-MPDU aggregation function
+ */
+#ifdef ZM_AGG_TALLY
+ agg_tal = &wd->agg_tal;
+ agg_tal->got_packets_sum++;
+
+#endif
+
+#ifdef ZM_ENABLE_AGGREGATION
+ #ifndef ZM_BYPASS_AGGR_SCHEDULING
+ tid = up&0x7;
+ if(wd->enableAggregation==0)
+ {
+ if( (wd->wlanMode == ZM_MODE_AP) ||
+ (wd->wlanMode == ZM_MODE_INFRASTRUCTURE && wd->sta.EnableHT) ||
+ (wd->wlanMode == ZM_MODE_PSEUDO) ) {
+ // (infrastructure_mode && connect_to_11n_ap) || (ap_mode && is_11n_ap)
+ //ret = zfAggPutVtxq(dev, buf);
+
+
+ ret = zfAggTx(dev, buf, tid);
+ if (ZM_SUCCESS == ret)
+ {
+ //zfwBufFree(dev, buf, ZM_SUCCESS);
+
+ return ZM_SUCCESS;
+ }
+ if (ZM_ERR_EXCEED_PRIORITY_THRESHOLD == ret)
+ {
+ wd->commTally.txQosDropCount[ac]++;
+ zfwBufFree(dev, buf, ZM_SUCCESS);
+
+ zm_msg1_tx(ZM_LV_1, "Packet discarded, VTXQ full, ac=", ac);
+
+ return ZM_ERR_EXCEED_PRIORITY_THRESHOLD;
+ }
+ if (ZM_ERR_TX_BUFFER_UNAVAILABLE == ret)
+ {
+ /*
+ * do nothing
+ * continue following procession, put into VTXQ
+ * return ZM_SUCCESS;
+ */
+ }
+ }
+ }
+ #endif
+#endif
+ /*
+ * end of add by honda
+ */
+
+ /* First Ip frag */
+ if ((fragOff & 0xff3f) == 0x0020)
+ {
+ /* Don't let ip frag in if VTXQ unable to hold */
+ /* whole ip frag burst(assume 20 frag) */
+ zmw_enter_critical_section(dev);
+ if (((wd->vtxqHead[ac] - wd->vtxqTail[ac])& ZM_VTXQ_SIZE_MASK)
+ > (ZM_VTXQ_SIZE-20))
+ {
+ wd->qosDropIpFrag[ac] = 1;
+ }
+ else
+ {
+ wd->qosDropIpFrag[ac] = 0;
+ }
+ zmw_leave_critical_section(dev);
+
+ if (wd->qosDropIpFrag[ac] == 1)
+ {
+ //zm_debug_msg2("vtQ full, drop buf = ", buf);
+ wd->commTally.txQosDropCount[ac]++;
+ zfwBufFree(dev, buf, ZM_SUCCESS);
+ zm_msg1_tx(ZM_LV_1, "Packet discarded, first ip frag, ac=", ac);
+ //VTXQ[] can not hold whold ip frag burst(assume 20 frags)
+ return ZM_ERR_EXCEED_PRIORITY_THRESHOLD;
+ }
+ }
+ else if ((fragOff & 0xff3f) == 0)
+ {
+ wd->qosDropIpFrag[ac] = 0;
+ }
+
+ if (((fragOff &= 0xff1f) != 0) && (wd->qosDropIpFrag[ac] == 1))
+ {
+ wd->commTally.txQosDropCount[ac]++;
+ zfwBufFree(dev, buf, ZM_SUCCESS);
+ zm_msg1_tx(ZM_LV_1, "Packet discarded, ip frag, ac=", ac);
+ //Discard following ip frags
+ return ZM_ERR_EXCEED_PRIORITY_THRESHOLD;
+ }
+
+ zmw_enter_critical_section(dev);
+ if (((wd->vtxqHead[ac] + 1) & ZM_VTXQ_SIZE_MASK) != wd->vtxqTail[ac])
+ {
+ wd->vtxq[ac][wd->vtxqHead[ac]] = buf;
+ wd->vtxqHead[ac] = ((wd->vtxqHead[ac] + 1) & ZM_VTXQ_SIZE_MASK);
+ zmw_leave_critical_section(dev);
+ return ZM_SUCCESS;
+ }
+ else
+ {
+ zmw_leave_critical_section(dev);
+
+ wd->commTally.txQosDropCount[ac]++;
+ zfwBufFree(dev, buf, ZM_SUCCESS);
+ zm_msg1_tx(ZM_LV_1, "Packet discarded, VTXQ full, ac=", ac);
+ return ZM_ERR_EXCEED_PRIORITY_THRESHOLD; //VTXQ[] Full
+ }
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfGetVtxq */
+/* Get Tx buffer from virtual TxQ */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* Tx buffer pointer */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2006.6 */
+/* */
+/************************************************************************/
+zbuf_t* zfGetVtxq(zdev_t* dev, u8_t ac)
+{
+ zbuf_t* buf;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ ac &= 0x3;
+ zmw_enter_critical_section(dev);
+ if (wd->vtxqHead[ac] != wd->vtxqTail[ac])
+ {
+ buf = wd->vtxq[ac][wd->vtxqTail[ac]];
+ wd->vtxqTail[ac] = ((wd->vtxqTail[ac] + 1) & ZM_VTXQ_SIZE_MASK);
+ zmw_leave_critical_section(dev);
+ return buf;
+ }
+ else
+ {
+ zmw_leave_critical_section(dev);
+ return 0; //VTXQ[] empty
+ }
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfPutVmmq */
+/* Put Tx buffer to virtual MmQ */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* buf : Tx buffer pointer */
+/* */
+/* OUTPUTS */
+/* ZM_SUCCESS or error code */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2006.12 */
+/* */
+/************************************************************************/
+u16_t zfPutVmmq(zdev_t* dev, zbuf_t* buf)
+{
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ if (((wd->vmmqHead + 1) & ZM_VMMQ_SIZE_MASK) != wd->vmmqTail)
+ {
+ wd->vmmq[wd->vmmqHead] = buf;
+ wd->vmmqHead = ((wd->vmmqHead + 1) & ZM_VMMQ_SIZE_MASK);
+ zmw_leave_critical_section(dev);
+ return ZM_SUCCESS;
+ }
+ else
+ {
+ zmw_leave_critical_section(dev);
+
+ zfwBufFree(dev, buf, ZM_SUCCESS);
+ zm_msg0_mm(ZM_LV_0, "Packet discarded, VMmQ full");
+ return ZM_ERR_VMMQ_FULL; //VTXQ[] Full
+ }
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfGetVmmq */
+/* Get Tx buffer from virtual MmQ */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* Tx buffer pointer */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2006.12 */
+/* */
+/************************************************************************/
+zbuf_t* zfGetVmmq(zdev_t* dev)
+{
+ zbuf_t* buf;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ if (wd->vmmqHead != wd->vmmqTail)
+ {
+ buf = wd->vmmq[wd->vmmqTail];
+ wd->vmmqTail = ((wd->vmmqTail + 1) & ZM_VMMQ_SIZE_MASK);
+ zmw_leave_critical_section(dev);
+ return buf;
+ }
+ else
+ {
+ zmw_leave_critical_section(dev);
+ return 0; //VTXQ[] empty
+ }
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfPushVtxq */
+/* Service Virtual TxQ (weighted round robin) */
+/* Get Tx buffer form virtual TxQ and put to hardware TxD queue */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2006.6 */
+/* */
+/************************************************************************/
+void zfPushVtxq(zdev_t* dev)
+{
+ zbuf_t* buf;
+ u16_t i;
+ u16_t txed;
+ u32_t freeTxd;
+ u16_t err;
+ u16_t skipFlag = 0;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+
+
+ //zm_debug_msg1("zfHpGetFreeTxdCount = ", zfHpGetFreeTxdCount(dev));
+
+ if (wd->halState == ZM_HAL_STATE_INIT)
+ {
+ if (!wd->modeMDKEnable)
+ {
+ zm_debug_msg0("HAL is not ready for Tx");
+ }
+ return;
+ }
+ else if (wd->sta.DFSDisableTx)
+ {
+ zm_debug_msg0("return because 802.11h DFS Disable Tx");
+ return;
+ }
+ else if (wd->sta.flagFreqChanging != 0)
+ {
+ //Hold until RF frequency changed
+ return;
+ }
+ else if (( wd->sta.flagKeyChanging ) && ( wd->wlanMode != ZM_MODE_AP ))
+ {
+ return;
+ }
+#ifdef ZM_ENABLE_POWER_SAVE
+ else if ( zfPowerSavingMgrIsSleeping(dev) )
+ {
+ //zm_debug_msg0("Packets queued since the MAC is in power-saving mode\n");
+ return;
+ }
+#endif
+
+ zmw_enter_critical_section(dev);
+ if (wd->vtxqPushing != 0)
+ {
+ skipFlag = 1;
+ }
+ else
+ {
+ wd->vtxqPushing = 1;
+ }
+ zmw_leave_critical_section(dev);
+
+ if (skipFlag == 1)
+ {
+ return;
+ }
+
+ while (1)
+ {
+ txed = 0;
+
+ /* 2006.12.20, Serve Management queue */
+ while( zfHpGetFreeTxdCount(dev) > 0 )
+ {
+ if ((buf = zfGetVmmq(dev)) != 0)
+ {
+ txed = 1;
+ //zm_debug_msg2("send buf = ", buf);
+ if ((err = zfHpSend(dev, NULL, 0, NULL, 0, NULL, 0, buf, 0,
+ ZM_INTERNAL_ALLOC_BUF, 0, 0xff)) != ZM_SUCCESS)
+ {
+ zfwBufFree(dev, buf, 0);
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+ if ((wd->sta.bScheduleScan) || ((wd->sta.bChannelScan == TRUE) && (zfStaIsConnected(dev))))
+ {
+ //Hold until Scan Stop
+ wd->vtxqPushing = 0;
+ return;
+ }
+
+#ifdef ZM_ENABLE_AGGREGATION
+ #ifndef ZM_BYPASS_AGGR_SCHEDULING
+ if( (wd->wlanMode == ZM_MODE_AP) ||
+ (wd->wlanMode == ZM_MODE_INFRASTRUCTURE && wd->sta.EnableHT) ||
+ (wd->wlanMode == ZM_MODE_PSEUDO) ) {
+
+ zfAggTxScheduler(dev, 0);
+
+ if (txed == 0) {
+ wd->vtxqPushing = 0;
+ return;
+ }
+ else {
+ continue;
+ }
+ }
+ #endif
+#endif
+
+ /* Service VTxQ[3] */
+ for (i=0; i<4; i++)
+ {
+ if ((freeTxd = zfHpGetFreeTxdCount(dev)) >= 3)
+ {
+ if ((buf = zfGetVtxq(dev, 3)) != 0)
+ {
+ txed = 1;
+ //zm_debug_msg2("send buf = ", buf);
+ zfTxSendEth(dev, buf, 0, ZM_EXTERNAL_ALLOC_BUF, 0);
+ ZM_PERFORMANCE_TX_MPDU(dev, wd->tick);
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ /* Service VTxQ[2] */
+ for (i=0; i<3; i++)
+ {
+ if ((freeTxd = zfHpGetFreeTxdCount(dev)) >= (zfHpGetMaxTxdCount(dev)*1/4))
+ {
+ if ((buf = zfGetVtxq(dev, 2)) != 0)
+ {
+ txed = 1;
+ zfTxSendEth(dev, buf, 0, ZM_EXTERNAL_ALLOC_BUF, 0);
+ ZM_PERFORMANCE_TX_MPDU(dev, wd->tick);
+ }
+ if (wd->sta.ac0PriorityHigherThanAc2 == 1)
+ {
+ if ((buf = zfGetVtxq(dev, 0)) != 0)
+ {
+ txed = 1;
+ zfTxSendEth(dev, buf, 0, ZM_EXTERNAL_ALLOC_BUF, 0);
+ ZM_PERFORMANCE_TX_MPDU(dev, wd->tick);
+ }
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ /* Service VTxQ[0] */
+ for (i=0; i<2; i++)
+ {
+ if ((freeTxd = zfHpGetFreeTxdCount(dev)) >= (zfHpGetMaxTxdCount(dev)*2/4))
+ {
+ if ((buf = zfGetVtxq(dev, 0)) != 0)
+ {
+ txed = 1;
+ zfTxSendEth(dev, buf, 0, ZM_EXTERNAL_ALLOC_BUF, 0);
+ ZM_PERFORMANCE_TX_MPDU(dev, wd->tick);
+ }
+ }
+ else
+ {
+ break;
+ }
+
+ }
+
+ /* Service VTxQ[1] */
+ if ((freeTxd = zfHpGetFreeTxdCount(dev)) >= (zfHpGetMaxTxdCount(dev)*3/4))
+ {
+ if ((buf = zfGetVtxq(dev, 1)) != 0)
+ {
+ txed = 1;
+ zfTxSendEth(dev, buf, 0, ZM_EXTERNAL_ALLOC_BUF, 0);
+ ZM_PERFORMANCE_TX_MPDU(dev, wd->tick);
+ }
+ }
+
+ /* All VTxQs are either empty or exceed their threshold */
+ if (txed == 0)
+ {
+ wd->vtxqPushing = 0;
+ return;
+ }
+ } //while (1)
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfFlushVtxq */
+/* Flush Virtual TxQ and MmQ */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2007.1 */
+/* */
+/************************************************************************/
+void zfFlushVtxq(zdev_t* dev)
+{
+ zbuf_t* buf;
+ u8_t i;
+ zmw_get_wlan_dev(dev);
+
+ /* Flush MmQ */
+ while ((buf = zfGetVmmq(dev)) != 0)
+ {
+ zfwBufFree(dev, buf, 0);
+ zm_debug_msg0("zfFlushVtxq: [Vmmq]");
+ wd->queueFlushed |= 0x10;
+ }
+
+ /* Flush VTxQ */
+ for (i=0; i<4; i++)
+ {
+ while ((buf = zfGetVtxq(dev, i)) != 0)
+ {
+ zfwBufFree(dev, buf, 0);
+ zm_debug_msg1("zfFlushVtxq: [zfGetVtxq]- ", i);
+ wd->queueFlushed |= (1<<i);
+ }
+ }
+}
+
+void zf80211FrameSend(zdev_t* dev, zbuf_t* buf, u16_t* header, u16_t snapLen,
+ u16_t* da, u16_t* sa, u8_t up, u16_t headerLen, u16_t* snap,
+ u16_t* tail, u16_t tailLen, u16_t offset, u16_t bufType,
+ u8_t ac, u8_t keyIdx)
+{
+ u16_t err;
+ u16_t fragLen;
+
+ zmw_get_wlan_dev(dev);
+
+ fragLen = zfwBufGetSize(dev, buf);
+ if ((da[0]&0x1) == 0)
+ {
+ wd->commTally.txUnicastFrm++;
+ wd->commTally.txUnicastOctets += (fragLen+snapLen);
+ }
+ else if (da[0] == 0xffff)
+ {
+ wd->commTally.txBroadcastFrm++;
+ wd->commTally.txBroadcastOctets += (fragLen+snapLen);
+ }
+ else
+ {
+ wd->commTally.txMulticastFrm++;
+ wd->commTally.txMulticastOctets += (fragLen+snapLen);
+ }
+ wd->ledStruct.txTraffic++;
+
+ if ((err = zfHpSend(dev, header, headerLen, snap, snapLen,
+ tail, tailLen, buf, offset,
+ bufType, ac, keyIdx)) != ZM_SUCCESS)
+ {
+ if (bufType == ZM_EXTERNAL_ALLOC_BUF)
+ {
+ zfwBufFree(dev, buf, err);
+ }
+ else if (bufType == ZM_INTERNAL_ALLOC_BUF)
+ {
+ zfwBufFree(dev, buf, 0);
+ }
+ else
+ {
+ zm_assert(0);
+ }
+ }
+}
+
+void zfCheckIsRIFSFrame(zdev_t* dev, zbuf_t* buf, u16_t frameSubtype)
+{
+ zmw_get_wlan_dev(dev);
+
+ /* #2 Record the sequence number to determine whether the unicast frame is separated by RIFS or not */
+ if (frameSubtype & 0x80)
+ { //QoS data frame
+ u16_t sequenceNum;
+ u16_t qosControlField;
+
+ sequenceNum = ( zmw_buf_readh(dev, buf, 22) >> 4 ); // Discard fragment number !
+ qosControlField = zmw_buf_readh(dev, buf, 24); // Don't consider WDS (Wireless Distribution System)
+ //DbgPrint("The QoS Control Field : %d", qosControlField);
+ //DbgPrint("The RIFS Count : %d", wd->sta.rifsCount);
+
+ if( qosControlField & ZM_BIT_5 )
+ {// ACK policy is "No ACK"
+ /* RIFS-Like frame */
+ wd->sta.rifsLikeFrameSequence[wd->sta.rifsLikeFrameCnt] = sequenceNum;
+
+ if( wd->sta.rifsState == ZM_RIFS_STATE_DETECTING )
+ {
+ if( wd->sta.rifsLikeFrameSequence[2] != 0 )
+ {// RIFS-like Pattern collected
+ if( ( wd->sta.rifsLikeFrameSequence[2] - wd->sta.rifsLikeFrameSequence[1] == 2 ) &&
+ ( wd->sta.rifsLikeFrameSequence[1] - wd->sta.rifsLikeFrameSequence[0] == 2 ) )
+ {
+ /* RIFS pattern matched */
+
+ /* #3 Enable RIFS function if the RIFS pattern matched */
+ zfHpEnableRifs(dev, ((wd->sta.currentFrequency<3000)?1:0), wd->sta.EnableHT, wd->sta.HT2040);
+
+ // Set RIFS timer
+ wd->sta.rifsTimer = wd->tick;
+
+ wd->sta.rifsCount++;
+
+ // Set state to be Detected
+ wd->sta.rifsState = ZM_RIFS_STATE_DETECTED;
+ }
+ }
+ }
+ else
+ {// state = Detected
+ // Reset RIFS timer
+ if( (wd->tick - wd->sta.rifsTimer) < ZM_RIFS_TIMER_TIMEOUT )
+ wd->sta.rifsTimer = wd->tick;
+ }
+
+ //DbgPrint("SN1 = %d, SN2 = %d, SN3 = %d\n", wd->sta.rifsLikeFrameSequence[0],
+ // wd->sta.rifsLikeFrameSequence[1],
+ // wd->sta.rifsLikeFrameSequence[2]);
+
+ // Update RIFS-like sequence number
+ if( wd->sta.rifsLikeFrameSequence[2] != 0 )
+ {
+ wd->sta.rifsLikeFrameSequence[0] = wd->sta.rifsLikeFrameSequence[1];
+ wd->sta.rifsLikeFrameSequence[1] = wd->sta.rifsLikeFrameSequence[2];
+ wd->sta.rifsLikeFrameSequence[2] = 0;
+ }
+
+ // Only record three adjacent frame
+ if( wd->sta.rifsLikeFrameCnt < 2 )
+ wd->sta.rifsLikeFrameCnt++;
+ }
+ }
+
+ /* #4 Disable RIFS function if the timer TIMEOUT */
+ if( wd->sta.rifsState == ZM_RIFS_STATE_DETECTED )
+ {
+ if( ( wd->tick - wd->sta.rifsTimer ) > ZM_RIFS_TIMER_TIMEOUT )
+ {// TIMEOUT
+ // Disable RIFS
+ zfHpDisableRifs(dev);
+
+ // Reset RIFS-like sequence number FIFO
+ wd->sta.rifsLikeFrameSequence[0] = 0;
+ wd->sta.rifsLikeFrameSequence[1] = 0;
+ wd->sta.rifsLikeFrameSequence[2] = 0;
+ wd->sta.rifsLikeFrameCnt = 0;
+
+ // Set state to be Detecting
+ wd->sta.rifsState = ZM_RIFS_STATE_DETECTING;
+ }
+ }
+}
diff --git a/drivers/staging/otus/80211core/cwep.c b/drivers/staging/otus/80211core/cwep.c
new file mode 100644
index 00000000000..ec31bb1ac28
--- /dev/null
+++ b/drivers/staging/otus/80211core/cwep.c
@@ -0,0 +1,299 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : cwep.c */
+/* */
+/* Abstract */
+/* This module contains Tx and Rx functions. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/************************************************************************/
+#include "cprecomp.h"
+
+u32_t crc32_tab[] =
+{
+ 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
+ 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
+ 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
+ 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
+ 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
+ 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
+ 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
+ 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
+ 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
+ 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
+ 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
+ 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
+ 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
+ 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
+ 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
+ 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
+ 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
+ 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
+ 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
+ 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
+ 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
+ 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
+ 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
+ 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
+ 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
+ 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
+ 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
+ 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
+ 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
+ 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
+ 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
+ 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
+ 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
+ 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
+ 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
+ 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
+ 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
+ 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
+ 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
+ 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
+ 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
+ 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
+ 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
+ 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
+ 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
+ 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
+ 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
+ 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
+ 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
+ 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
+ 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
+ 0x2d02ef8dL
+};
+
+void zfWEPEncrypt(zdev_t *dev, zbuf_t *buf, u8_t *snap, u16_t snapLen, u16_t offset, u8_t keyLen, u8_t* WepKey, u8_t *iv)
+{
+ u8_t S[256],S2[256];
+ u16_t ui;
+ u16_t i;
+ u16_t j;
+ u8_t temp;
+ u8_t K;
+ u32_t ltemp;
+ u16_t len;
+ u32_t icv;
+ u8_t key[32];
+
+ key[0] = iv[0];
+ key[1] = iv[1];
+ key[2] = iv[2];
+
+ /* Append Wep Key after IV */
+ zfMemoryCopy(&key[3], WepKey, keyLen);
+
+ keyLen += 3;
+
+ for(i = 0; i < 256; i++)
+ {
+ S[i] = (u8_t)i;
+ S2[i] = key[i&(keyLen-1)];
+ }
+
+ j = 0;
+ for(i = 0; i < 256; i++)
+ {
+ j = (j + S[i] + S2[i]) ;
+ j&=255 ;
+
+ // Swap S[i] and S[j]
+ temp = S[i];
+ S[i] = S[j];
+ S[j] = temp;
+ }
+
+ i = j = 0;
+ icv = -1;
+
+ /* For Snap Header */
+ for (ui = 0; ui < snapLen; ui++)
+ {
+ u8_t In;
+
+ i++;
+ i &= 255;
+ j += S[i];
+ j &= 255;
+
+ // Swap S[i] and S[j]
+ temp = S[i];
+ S[i] = S[j];
+ S[j] = temp;
+// temp = (S[i] + temp) & 255;
+ temp += S[i];
+ temp &=255;
+ K = S[temp]; // Key used to Xor with input data
+
+ In = snap[ui];
+ icv = (icv>>8) ^ crc32_tab[(icv^In)&0xff];
+
+ snap[ui] = In ^ K;
+ //zmw_tx_buf_writeb(dev, buf, ui, In ^ K);
+ }
+
+ len = zfwBufGetSize(dev, buf);
+
+ for (ui = offset; ui < len; ui++)
+ {
+ u8_t In;
+
+ i++;
+ i &= 255;
+ j += S[i];
+ j &= 255;
+
+ // Swap S[i] and S[j]
+ temp = S[i];
+ S[i] = S[j];
+ S[j] = temp;
+// temp = (S[i] + temp) & 255;
+ temp += S[i];
+ temp &=255;
+ K = S[temp]; // Key used to Xor with input data
+
+ In = zmw_tx_buf_readb(dev, buf, ui);
+ icv = (icv>>8) ^ crc32_tab[(icv^In)&0xff];
+
+ zmw_tx_buf_writeb(dev, buf, ui, In ^ K);
+ } //End of for (ui = 0; ui < Num_Bytes; ui++)
+
+ icv = ~(icv);
+ ltemp = (u32_t) icv;
+
+ for (ui = 0; ui < 4; ui++)
+ {
+ i ++;
+ i &= 255;
+ j += S[i];
+ j &= 255;
+
+ // Swap S[i] and S[j]
+ temp = S[i];
+ S[i] = S[j];
+ S[j] = temp;
+ temp += S[i];
+ temp &= 255;
+ K = S[temp]; // Key used to Xor with input data
+
+ //*Out++ = (u8_t)(ltemp ^ K)&0xff;
+ zmw_tx_buf_writeb(dev, buf, len+ui, (u8_t)(ltemp ^ K)&0xff);
+ ltemp >>= 8;
+ }
+
+ zfwBufSetSize(dev, buf, len+4);
+}
+
+u16_t zfWEPDecrypt(zdev_t *dev, zbuf_t *buf, u16_t offset, u8_t keyLen, u8_t* WepKey, u8_t *iv)
+{
+ u8_t S[256];
+ u8_t S2[256];
+ u16_t ui;
+ u16_t i;
+ u16_t j;
+ u32_t icv_tmp;
+ u32_t *icv;
+ u32_t rxbuf_icv;
+ u8_t temp;
+ u8_t K;
+ u16_t len;
+ u8_t key[32];
+
+ /* Retrieve IV */
+ key[0] = iv[0];
+ key[1] = iv[1];
+ key[2] = iv[2];
+
+ /* Append Wep Key after IV */
+ zfMemoryCopy(&key[3], WepKey, keyLen);
+
+ keyLen += 3;
+
+ for(i = 0; i < 256; i++)
+ {
+ S[i] = (u8_t)i;
+ S2[i] = key[i&(keyLen-1)];
+ }
+
+ j = 0;
+ for(i = 0; i < 256; i++)
+ {
+ j = (j + S[i] + S2[i]);
+ j&=255 ;
+
+ // Swap S[i] and S[j]
+ temp = S[i];
+ S[i] = S[j];
+ S[j] = temp;
+ }
+
+ i = j = 0;
+
+ len = zfwBufGetSize(dev, buf);
+
+ for (ui = offset; ui < len; ui++)
+ {
+ u8_t In;
+
+ i++;
+ i &= 255;
+ j += S[i];
+ j &= 255;
+
+ // Swap S[i] and S[j]
+ temp = S[i];
+ S[i] = S[j];
+ S[j] = temp;
+// temp = (S[i] + temp) & 255;
+ temp += S[i];
+ temp &=255;
+ K = S[temp]; // Key used to Xor with input data
+
+ In = zmw_rx_buf_readb(dev, buf, ui);
+
+ zmw_rx_buf_writeb(dev, buf, ui, In ^ K);
+ } //End of for (ui = 0; ui < Num_Bytes; ui++)
+
+ icv = &icv_tmp;
+ *icv = -1;
+
+ for (ui = offset; ui < len - 4; ui++)
+ {
+ u8_t In;
+
+ In = zmw_rx_buf_readb(dev, buf, ui);
+ *icv = (*icv>>8) ^ crc32_tab[(*icv^In)&0xff];
+ }
+
+ *icv = ~*icv;
+
+ rxbuf_icv = (zmw_rx_buf_readb(dev, buf, len-4) |
+ zmw_rx_buf_readb(dev, buf, len-3) << 8 |
+ zmw_rx_buf_readb(dev, buf, len-2) << 16 |
+ zmw_rx_buf_readb(dev, buf, len-1) << 24);
+
+ if (*icv != rxbuf_icv)
+ {
+ return ZM_ICV_FAILURE;
+ }
+
+ return ZM_ICV_SUCCESS;
+}
diff --git a/drivers/staging/otus/80211core/cwm.c b/drivers/staging/otus/80211core/cwm.c
new file mode 100644
index 00000000000..80f1141bf91
--- /dev/null
+++ b/drivers/staging/otus/80211core/cwm.c
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : cwm.c */
+/* */
+/* Abstract */
+/* This module contains channel width related functions. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/************************************************************************/
+
+#include "cprecomp.h"
+
+
+
+void zfCwmInit(zdev_t* dev) {
+ //u16_t i;
+ zmw_get_wlan_dev(dev);
+
+ switch (wd->wlanMode) {
+ case ZM_MODE_AP:
+ wd->cwm.cw_mode = CWM_MODE2040;
+ wd->cwm.cw_width = CWM_WIDTH40;
+ wd->cwm.cw_enable = 1;
+ break;
+ case ZM_MODE_INFRASTRUCTURE:
+ case ZM_MODE_PSEUDO:
+ case ZM_MODE_IBSS:
+ default:
+ wd->cwm.cw_mode = CWM_MODE2040;
+ wd->cwm.cw_width = CWM_WIDTH20;
+ wd->cwm.cw_enable = 1;
+ break;
+ }
+}
+
+
+void zfCoreCwmBusy(zdev_t* dev, u16_t busy)
+{
+
+ zmw_get_wlan_dev(dev);
+
+ zm_msg1_mm(ZM_LV_0, "CwmBusy=", busy);
+
+ if(wd->cwm.cw_mode == CWM_MODE20) {
+ wd->cwm.cw_width = CWM_WIDTH20;
+ return;
+ }
+
+ if(wd->cwm.cw_mode == CWM_MODE40) {
+ wd->cwm.cw_width = CWM_WIDTH40;
+ return;
+ }
+
+ if (busy) {
+ wd->cwm.cw_width = CWM_WIDTH20;
+ return;
+ }
+
+
+ if((wd->wlanMode == ZM_MODE_INFRASTRUCTURE || wd->wlanMode == ZM_MODE_PSEUDO ||
+ wd->wlanMode == ZM_MODE_IBSS)) {
+ if (wd->sta.ie.HtCap.HtCapInfo && HTCAP_SupChannelWidthSet != 0 &&
+ wd->sta.ie.HtInfo.ChannelInfo && ExtHtCap_RecomTxWidthSet != 0 &&
+ (wd->sta.ie.HtInfo.ChannelInfo && ExtHtCap_ExtChannelOffsetAbove) == 1) {
+
+ wd->cwm.cw_width = CWM_WIDTH40;
+ }
+ else {
+ wd->cwm.cw_width = CWM_WIDTH20;
+ }
+
+ return;
+ }
+
+ if(wd->wlanMode == ZM_MODE_AP) {
+ wd->cwm.cw_width = CWM_WIDTH40;
+ }
+
+}
+
+
+
+
+u16_t zfCwmIsExtChanBusy(u32_t ctlBusy, u32_t extBusy)
+{
+ u32_t busy; /* percentage */
+ u32_t cycleTime, ctlClear;
+
+ cycleTime = 1280000; //1.28 seconds
+
+ if (cycleTime > ctlBusy) {
+ ctlClear = cycleTime - ctlBusy;
+ }
+ else
+ {
+ ctlClear = 0;
+ }
+
+ /* Compute ratio of extension channel busy to control channel clear
+ * as an approximation to extension channel cleanliness.
+ *
+ * According to the hardware folks, ext rxclear is undefined
+ * if the ctrl rxclear is de-asserted (i.e. busy)
+ */
+ if (ctlClear) {
+ busy = (extBusy * 100) / ctlClear;
+ } else {
+ busy = 0;
+ }
+ if (busy > ATH_CWM_EXTCH_BUSY_THRESHOLD) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
diff --git a/drivers/staging/otus/80211core/cwm.h b/drivers/staging/otus/80211core/cwm.h
new file mode 100644
index 00000000000..40c39fad5f4
--- /dev/null
+++ b/drivers/staging/otus/80211core/cwm.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : cwm.h */
+/* */
+/* Abstract */
+/* This module contains channel width relatived functions. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/****************************************************************************/
+/*Revision History: */
+/* Who When What */
+/* -------- -------- ----------------------------------------------*/
+/* */
+/* Honda 3-19-07 created */
+/* */
+/****************************************************************************/
+
+#ifndef _CWM_H
+#define _CWM_H
+
+#define ATH_CWM_EXTCH_BUSY_THRESHOLD 30 /* Extension Channel Busy Threshold (0-100%) */
+
+void zfCwmInit(zdev_t* dev);
+void zfCoreCwmBusy(zdev_t* dev, u16_t busy);
+u16_t zfCwmIsExtChanBusy(u32_t ctlBusy, u32_t extBusy);
+
+
+
+#endif /* #ifndef _CWM_H */
diff --git a/drivers/staging/otus/80211core/freqctrl.c b/drivers/staging/otus/80211core/freqctrl.c
new file mode 100644
index 00000000000..bab0df08d82
--- /dev/null
+++ b/drivers/staging/otus/80211core/freqctrl.c
@@ -0,0 +1,259 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "cprecomp.h"
+
+/* zfAddFreqChangeReq should be called inside the critical section */
+static void zfAddFreqChangeReq(zdev_t* dev, u16_t frequency, u8_t bw40,
+ u8_t extOffset, zfpFreqChangeCompleteCb cb)
+{
+ zmw_get_wlan_dev(dev);
+
+//printk("zfAddFreqChangeReq freqReqQueueTail%d\n", wd->freqCtrl.freqReqQueueTail);
+ wd->freqCtrl.freqReqQueue[wd->freqCtrl.freqReqQueueTail] = frequency;
+ wd->freqCtrl.freqReqBw40[wd->freqCtrl.freqReqQueueTail] = bw40;
+ wd->freqCtrl.freqReqExtOffset[wd->freqCtrl.freqReqQueueTail] = extOffset;
+ wd->freqCtrl.freqChangeCompCb[wd->freqCtrl.freqReqQueueTail] = cb;
+ wd->freqCtrl.freqReqQueueTail++;
+ if ( wd->freqCtrl.freqReqQueueTail >= ZM_MAX_FREQ_REQ_QUEUE )
+ {
+ wd->freqCtrl.freqReqQueueTail = 0;
+ }
+}
+
+void zfCoreSetFrequencyV2(zdev_t* dev, u16_t frequency, zfpFreqChangeCompleteCb cb)
+{
+ zfCoreSetFrequencyEx(dev, frequency, 0, 0, cb);
+}
+
+void zfCoreSetFrequencyExV2(zdev_t* dev, u16_t frequency, u8_t bw40,
+ u8_t extOffset, zfpFreqChangeCompleteCb cb, u8_t forceSetFreq)
+{
+ u8_t setFreqImmed = 0;
+ u8_t initRF = 0;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zm_msg1_scan(ZM_LV_1, "Freq=", frequency);
+
+ zmw_enter_critical_section(dev);
+ if ((wd->sta.currentFrequency == frequency)
+ && (wd->sta.currentBw40 == bw40)
+ && (wd->sta.currentExtOffset == extOffset))
+ {
+ if ( forceSetFreq == 0 && wd->sta.flagFreqChanging == 0 )
+ {
+ goto done;
+ }
+ }
+#ifdef ZM_FB50
+ /*if(frequency!=2437) {
+ zmw_leave_critical_section(dev);
+ return;
+ }*/
+#endif
+
+ zfAddFreqChangeReq(dev, frequency, bw40, extOffset, cb);
+
+// zm_assert( wd->sta.flagFreqChanging == 0 );
+ //wd->sta.flagFreqChanging = 1;
+ if ( wd->sta.flagFreqChanging == 0 )
+ {
+ if ((wd->sta.currentBw40 != bw40) || (wd->sta.currentExtOffset != extOffset))
+ {
+ initRF = 1;
+ }
+ wd->sta.currentFrequency = frequency;
+ wd->sta.currentBw40 = bw40;
+ wd->sta.currentExtOffset = extOffset;
+ setFreqImmed = 1;
+ }
+ wd->sta.flagFreqChanging++;
+
+ zmw_leave_critical_section(dev);
+
+ if ( setFreqImmed )
+ {
+ //zfHpSetFrequency(dev, frequency, 0);
+ if ( forceSetFreq )
+ { // Cold reset to reset the frequency after scanning !
+ zm_debug_msg0("#6_1 20070917");
+ zm_debug_msg0("It is happen!!! No error message");
+ zfHpSetFrequencyEx(dev, frequency, bw40, extOffset, 2);
+ }
+ else
+ {
+ zfHpSetFrequencyEx(dev, frequency, bw40, extOffset, initRF);
+ }
+
+ if ( zfStaIsConnected(dev)
+ && (frequency == wd->frequency)) {
+ wd->sta.connPowerInHalfDbm = zfHpGetTransmitPower(dev);
+ }
+ }
+ return;
+
+done:
+ zmw_leave_critical_section(dev);
+
+ if ( cb != NULL )
+ {
+ cb(dev);
+ }
+ zfPushVtxq(dev);
+ return;
+}
+
+void zfCoreSetFrequencyEx(zdev_t* dev, u16_t frequency, u8_t bw40,
+ u8_t extOffset, zfpFreqChangeCompleteCb cb)
+{
+ zfCoreSetFrequencyExV2(dev, frequency, bw40, extOffset, cb, 0);
+}
+
+void zfCoreSetFrequency(zdev_t* dev, u16_t frequency)
+{
+ zfCoreSetFrequencyV2(dev, frequency, NULL);
+}
+
+/* zfRemoveFreqChangeReq SHOULD NOT be called inside the critical section */
+static void zfRemoveFreqChangeReq(zdev_t* dev)
+{
+ zfpFreqChangeCompleteCb cb = NULL;
+ u16_t frequency;
+ u8_t bw40;
+ u8_t extOffset;
+ u16_t compFreq = 0;
+ u8_t compBw40 = 0;
+ u8_t compExtOffset = 0;
+
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ if (wd->freqCtrl.freqReqQueueHead != wd->freqCtrl.freqReqQueueTail)
+ {
+ zm_msg1_scan(ZM_LV_1, "Freq=",
+ wd->freqCtrl.freqReqQueue[wd->freqCtrl.freqReqQueueHead]);
+ compFreq = wd->freqCtrl.freqReqQueue[wd->freqCtrl.freqReqQueueHead];
+ compBw40 = wd->freqCtrl.freqReqBw40[wd->freqCtrl.freqReqQueueHead];
+ compExtOffset = wd->freqCtrl.freqReqExtOffset[wd->freqCtrl.freqReqQueueHead];
+
+ wd->freqCtrl.freqReqQueue[wd->freqCtrl.freqReqQueueHead] = 0;
+ cb = wd->freqCtrl.freqChangeCompCb[wd->freqCtrl.freqReqQueueHead];
+ wd->freqCtrl.freqReqQueueHead++;
+ if ( wd->freqCtrl.freqReqQueueHead >= ZM_MAX_FREQ_REQ_QUEUE )
+ {
+ wd->freqCtrl.freqReqQueueHead = 0;
+ }
+ }
+ zmw_leave_critical_section(dev);
+
+ if ( cb != NULL )
+ {
+ cb(dev);
+ }
+
+ zmw_enter_critical_section(dev);
+ while (wd->freqCtrl.freqReqQueue[wd->freqCtrl.freqReqQueueHead] != 0)
+ {
+ frequency = wd->freqCtrl.freqReqQueue[wd->freqCtrl.freqReqQueueHead];
+ bw40 = wd->freqCtrl.freqReqBw40[wd->freqCtrl.freqReqQueueHead];
+ extOffset=wd->freqCtrl.freqReqExtOffset[wd->freqCtrl.freqReqQueueHead];
+ if ((compFreq == frequency)
+ && (compBw40 == bw40)
+ && (compExtOffset == extOffset))
+ {
+ /* Duplicated frequency command */
+ zm_msg1_scan(ZM_LV_1, "Duplicated Freq=", frequency);
+
+ cb = wd->freqCtrl.freqChangeCompCb[wd->freqCtrl.freqReqQueueHead];
+ wd->freqCtrl.freqReqQueue[wd->freqCtrl.freqReqQueueHead] = 0;
+ wd->freqCtrl.freqReqQueueHead++;
+
+ if ( wd->freqCtrl.freqReqQueueHead >= ZM_MAX_FREQ_REQ_QUEUE )
+ {
+ wd->freqCtrl.freqReqQueueHead = 0;
+ }
+
+ if ( wd->sta.flagFreqChanging != 0 )
+ {
+ wd->sta.flagFreqChanging--;
+ }
+
+ zmw_leave_critical_section(dev);
+ if ( cb != NULL )
+ {
+ cb(dev);
+ }
+ zmw_enter_critical_section(dev);
+ }
+ else
+ {
+ u8_t initRF = 0;
+ if ((wd->sta.currentBw40 != bw40) || (wd->sta.currentExtOffset != extOffset))
+ {
+ initRF = 1;
+ }
+ wd->sta.currentFrequency = frequency;
+ wd->sta.currentBw40 = bw40;
+ wd->sta.currentExtOffset = extOffset;
+ zmw_leave_critical_section(dev);
+
+ zfHpSetFrequencyEx(dev, frequency, bw40, extOffset, initRF);
+ if ( zfStaIsConnected(dev)
+ && (frequency == wd->frequency)) {
+ wd->sta.connPowerInHalfDbm = zfHpGetTransmitPower(dev);
+ }
+
+ return;
+ }
+ }
+ zmw_leave_critical_section(dev);
+
+ return;
+}
+
+void zfCoreSetFrequencyComplete(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zm_msg1_scan(ZM_LV_1, "flagFreqChanging=", wd->sta.flagFreqChanging);
+
+ zmw_enter_critical_section(dev);
+ //wd->sta.flagFreqChanging = 0;
+ if ( wd->sta.flagFreqChanging != 0 )
+ {
+ wd->sta.flagFreqChanging--;
+ }
+
+ zmw_leave_critical_section(dev);
+
+ zfRemoveFreqChangeReq(dev);
+
+ zfPushVtxq(dev);
+ return;
+}
+
+void zfReSetCurrentFrequency(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ zm_debug_msg0("It is happen!!! No error message");
+
+ zfCoreSetFrequencyExV2(dev, wd->frequency, 0, 0, NULL, 1);
+}
diff --git a/drivers/staging/otus/80211core/ledmgr.c b/drivers/staging/otus/80211core/ledmgr.c
new file mode 100644
index 00000000000..1e104a928ca
--- /dev/null
+++ b/drivers/staging/otus/80211core/ledmgr.c
@@ -0,0 +1,557 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "cprecomp.h"
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfLedCtrlType1 */
+/* Traditional single-LED state */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2007.6 */
+/* */
+/************************************************************************/
+// bit 15-12 : Toff for Scan state
+// 11-8 : Ton for Scan state
+// 7 : Reserved
+// 6 : mode
+//--------------------------------------
+// bit 6 = 0
+// 5-4 : Connect state
+// 00 => always off
+// 01 => always on
+// 10 => Idle off, acitve on
+// 11 => Idle on, active off
+//--------------------------------------
+// bit 6 = 1
+// 5-4 : freq
+// 00 => 1Hz
+// 01 => 0.5Hz
+// 10 => 0.25Hz
+// 11 => 0.125Hz
+//--------------------------------------
+// 3 : Power save state
+// 0 => always off in power save state
+// 1 => works as connect state
+// 2 : Disable state
+// 1 : Reserved
+// 0 : Power-on state
+void zfLedCtrlType1(zdev_t* dev)
+{
+ u16_t i;
+ u32_t ton, toff, tmp, period;
+ zmw_get_wlan_dev(dev);
+
+ for (i=0; i<ZM_MAX_LED_NUMBER; i++)
+ {
+ if (zfStaIsConnected(dev) != TRUE)
+ {
+ //Scan state
+ ton = ((wd->ledStruct.ledMode[i] & 0xf00) >> 8) * 5;
+ toff = ((wd->ledStruct.ledMode[i] & 0xf000) >> 12) * 5;
+
+ if ((ton + toff) != 0)
+ {
+ tmp = wd->ledStruct.counter / (ton+toff);
+ tmp = wd->ledStruct.counter - (tmp * (ton+toff));
+ if (tmp < ton)
+ {
+ zfHpLedCtrl(dev, i, 1);
+ }
+ else
+ {
+ zfHpLedCtrl(dev, i, 0);
+ }
+ }
+ }
+ else
+ {
+ if ((zfPowerSavingMgrIsSleeping(dev)) && ((wd->ledStruct.ledMode[i] & 0x8) == 0))
+ {
+ zfHpLedCtrl(dev, i, 0);
+ }
+ else
+ {
+ //Connect state
+ if ((wd->ledStruct.ledMode[i] & 0x40) == 0)
+ {
+ if ((wd->ledStruct.counter & 1) == 0)
+ {
+ zfHpLedCtrl(dev, i, (wd->ledStruct.ledMode[i] & 0x10) >> 4);
+ }
+ else
+ {
+ if ((wd->ledStruct.txTraffic > 0) || (wd->ledStruct.rxTraffic > 0))
+ {
+ wd->ledStruct.txTraffic = wd->ledStruct.rxTraffic = 0;
+ if ((wd->ledStruct.ledMode[i] & 0x20) != 0)
+ {
+ zfHpLedCtrl(dev, i, ((wd->ledStruct.ledMode[i] & 0x10) >> 4)^1);
+ }
+ }
+ }
+ }// if ((wd->ledStruct.ledMode[i] & 0x40) == 0)
+ else
+ {
+ period = 5 * (1 << ((wd->ledStruct.ledMode[i] & 0x30) >> 4));
+ tmp = wd->ledStruct.counter / (period*2);
+ tmp = wd->ledStruct.counter - (tmp * (period*2));
+ if (tmp < period)
+ {
+ if ((wd->ledStruct.counter & 1) == 0)
+ {
+ zfHpLedCtrl(dev, i, 0);
+ }
+ else
+ {
+ if ((wd->ledStruct.txTraffic > 0) || (wd->ledStruct.rxTraffic > 0))
+ {
+ wd->ledStruct.txTraffic = wd->ledStruct.rxTraffic = 0;
+ zfHpLedCtrl(dev, i, 1);
+ }
+ }
+ }
+ else
+ {
+ if ((wd->ledStruct.counter & 1) == 0)
+ {
+ zfHpLedCtrl(dev, i, 1);
+ }
+ else
+ {
+ if ((wd->ledStruct.txTraffic > 0) || (wd->ledStruct.rxTraffic > 0))
+ {
+ wd->ledStruct.txTraffic = wd->ledStruct.rxTraffic = 0;
+ zfHpLedCtrl(dev, i, 0);
+ }
+ }
+ }
+ } //else, if ((wd->ledStruct.ledMode[i] & 0x40) == 0)
+ } //else, if (zfPowerSavingMgrIsSleeping(dev))
+ } //else : if (zfStaIsConnected(dev) != TRUE)
+ } //for (i=0; i<ZM_MAX_LED_NUMBER; i++)
+}
+
+/******************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfLedCtrlType2 */
+/* Customize for Netgear Dual-LED state ((bug#31292)) */
+/* */
+/* 1. Status: When dongle does not connect to 2.4G or 5G but in site */
+/* survey/association */
+/* LED status: Slow blinking, Amber then Blue per 500ms */
+/* 2. Status: Connection at 2.4G in site survey/association */
+/* LED status: Slow blinking, Amber/off per 500ms */
+/* 3. Status: Connection at 5G in site survey/association */
+/* LED status: Slow blinking, Blue/off per 500ms */
+/* 4. Status: When transfer the packet */
+/* LED status: Blink per packet, including TX and RX */
+/* 5. Status: When linking is established but no traffic */
+/* LED status: Always on */
+/* 6. Status: When linking is dropped but no re-connection */
+/* LED status: Always off */
+/* 7. Status: From one connection(2.4G or 5G) to change to another band */
+/* LED status: Amber/Blue =>Slow blinking, Amber then Blue per 500ms */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Shang-Chun Liu Atheros Communications, INC. 2007.11 */
+/* */
+/******************************************************************************/
+void zfLedCtrlType2_scan(zdev_t* dev);
+
+void zfLedCtrlType2(zdev_t* dev)
+{
+ u32_t ton, toff, tmp, period;
+ u16_t OperateLED;
+ zmw_get_wlan_dev(dev);
+
+ if (zfStaIsConnected(dev) != TRUE)
+ {
+ // Disconnect state
+ if(wd->ledStruct.counter % 4 != 0)
+ {
+ // Update LED each 400ms(4*100)
+ // Prevent this situation
+ // _______ ___
+ // LED[0] ON | | | x |
+ // ------ OFF->+-+-+-+-+-+-+-+-+-+-+-+->>>...
+ // LED[1] ON
+ //
+ return;
+ }
+
+ if (((wd->state == ZM_WLAN_STATE_DISABLED) && (wd->sta.bChannelScan))
+ || ((wd->state != ZM_WLAN_STATE_DISABLED) && (wd->sta.bAutoReconnect)))
+ {
+ // Scan/AutoReconnect state
+ zfLedCtrlType2_scan(dev);
+ }
+ else
+ {
+ // Neither Connected nor Scan
+ zfHpLedCtrl(dev, 0, 0);
+ zfHpLedCtrl(dev, 1, 0);
+ }
+ }
+ else
+ {
+ if( wd->sta.bChannelScan )
+ {
+ // Scan state
+ if(wd->ledStruct.counter % 4 != 0)
+ return;
+ zfLedCtrlType2_scan(dev);
+ return;
+ }
+
+ if(wd->frequency < 3000)
+ {
+ OperateLED = 0; // LED[0]: work on 2.4G (b/g band)
+ zfHpLedCtrl(dev, 1, 0);
+ }
+ else
+ {
+ OperateLED = 1; // LED[1]: work on 5G (a band)
+ zfHpLedCtrl(dev, 0, 0);
+ }
+
+ if ((zfPowerSavingMgrIsSleeping(dev)) && ((wd->ledStruct.ledMode[OperateLED] & 0x8) == 0))
+ {
+ // If Sleeping, turn OFF
+ zfHpLedCtrl(dev, OperateLED, 0);
+ }
+ else
+ {
+ //Connect state
+ if ((wd->ledStruct.counter & 1) == 0) // even
+ {
+ // No traffic, always ON
+ zfHpLedCtrl(dev, OperateLED, 1);
+ }
+ else // odd
+ {
+ if ((wd->ledStruct.txTraffic > 0) || (wd->ledStruct.rxTraffic > 0))
+ {
+ // If have traffic, turn OFF
+ // _____ _ _ _ _____
+ // LED[Operate] ON | | | | | | | |
+ // ------------ OFF->-+-+-+-+-+-+-+-+-+-+-+-+-+->>>...
+ //
+ wd->ledStruct.txTraffic = wd->ledStruct.rxTraffic = 0;
+ zfHpLedCtrl(dev, OperateLED, 0);
+ }
+ }
+ }
+ }
+}
+
+void zfLedCtrlType2_scan(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ // When doing scan, blink(Amber/Blue) and off per 500ms (about 400ms in our driver)
+ // _______ _______
+ // LED[0] ON | | 8 12 | |
+ // ------ OFF->-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+->>>...
+ // LED[1] ON 0 4 |_______| 0 3
+ //
+
+ switch(wd->ledStruct.counter % 16)
+ {
+ case 0: // case 0~3, LED[0] on
+ if(wd->supportMode & ZM_WIRELESS_MODE_24)
+ {
+ zfHpLedCtrl(dev, 0, 1);
+ zfHpLedCtrl(dev, 1, 0);
+ }
+ else
+ {
+ zfHpLedCtrl(dev, 1, 1);
+ zfHpLedCtrl(dev, 0, 0);
+ }
+ break;
+
+ case 8: // case 8~11, LED[1] on
+ if(wd->supportMode & ZM_WIRELESS_MODE_5)
+ {
+ zfHpLedCtrl(dev, 1, 1);
+ zfHpLedCtrl(dev, 0, 0);
+ }
+ else
+ {
+ zfHpLedCtrl(dev, 0, 1);
+ zfHpLedCtrl(dev, 1, 0);
+ }
+ break;
+
+ default: // others, all off
+ zfHpLedCtrl(dev, 0, 0);
+ zfHpLedCtrl(dev, 1, 0);
+ break;
+ }
+}
+
+/**********************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfLedCtrlType3 */
+/* Customize for Netgear Single-LED state ((bug#32243)) */
+/* */
+/* Off: when the adapter is disabled or hasn't started to associate with AP */
+/* yet. */
+/* On: Once adpater associate with AP successfully */
+/* Slow blinking: whenever adapters do site-survey or try to associate with AP */
+/* - If there is a connection already, and adapters do site-survey or */
+/* re-associate action, the LED should keep LED backgraoud as ON, thus */
+/* the blinking behavior SHOULD be OFF (200ms) - ON (800ms) and continue this*/
+/* cycle. */
+/* - If there is no connection yet, and adapters start to do site-survey or */
+/* associate action, the LED should keep LED background as OFF, thus the */
+/* blinking behavior SHOULD be ON (200ms) - OFF (800ms) and continue this */
+/* cycle. */
+/* - For the case that associate fail, adpater should keep associating, and the*/
+/* LED should also keep slow blinking. */
+/* Quick blinking: to blink OFF-ON cycle for each time that traffic packet is */
+/* received or is transmitted. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Shang-Chun Liu Atheros Communications, INC. 2008.01 */
+/* */
+/**********************************************************************************/
+void zfLedCtrlType3_scan(zdev_t* dev, u16_t isConnect);
+
+void zfLedCtrlType3(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ if (zfStaIsConnected(dev) != TRUE)
+ {
+ // Disconnect state
+ if(wd->ledStruct.counter % 2 != 0)
+ {
+ // Update LED each 200ms(2*100)
+ // Prevent this situation
+ // ___ _
+ // LED[0] ON | | |x|
+ // ------ OFF->+-+-+-+-+-+-+->>>...
+ //
+ return;
+ }
+
+ if (((wd->state == ZM_WLAN_STATE_DISABLED) && (wd->sta.bChannelScan))
+ || ((wd->state != ZM_WLAN_STATE_DISABLED) && (wd->sta.bAutoReconnect)))
+ {
+ // Scan/AutoReconnect state
+ zfLedCtrlType3_scan(dev, 0);
+ }
+ else
+ {
+ // Neither Connected nor Scan
+ zfHpLedCtrl(dev, 0, 0);
+ zfHpLedCtrl(dev, 1, 0);
+ }
+ }
+ else
+ {
+ if( wd->sta.bChannelScan )
+ {
+ // Scan state
+ if(wd->ledStruct.counter % 2 != 0)
+ return;
+ zfLedCtrlType3_scan(dev, 1);
+ return;
+ }
+
+ if ((zfPowerSavingMgrIsSleeping(dev)) && ((wd->ledStruct.ledMode[0] & 0x8) == 0))
+ {
+ // If Sleeping, turn OFF
+ zfHpLedCtrl(dev, 0, 0);
+ zfHpLedCtrl(dev, 1, 0);
+ }
+ else
+ {
+ //Connect state
+ if ((wd->ledStruct.counter & 1) == 0) // even
+ {
+ // No traffic, always ON
+ zfHpLedCtrl(dev, 0, 1);
+ zfHpLedCtrl(dev, 1, 1);
+ }
+ else // odd
+ {
+ if ((wd->ledStruct.txTraffic > 0) || (wd->ledStruct.rxTraffic > 0))
+ {
+ // If have traffic, turn OFF
+ // _____ _ _ _ _____
+ // LED[Operate] ON | | | | | | | |
+ // ------------ OFF->-+-+-+-+-+-+-+-+-+-+-+-+-+->>>...
+ //
+ wd->ledStruct.txTraffic = wd->ledStruct.rxTraffic = 0;
+ zfHpLedCtrl(dev, 0, 0);
+ zfHpLedCtrl(dev, 1, 0);
+ }
+ }
+ }
+ }
+}
+
+void zfLedCtrlType3_scan(zdev_t* dev, u16_t isConnect)
+{
+ u32_t ton, toff, tmp;
+ zmw_get_wlan_dev(dev);
+
+ // Doing scan when :
+ // 1. Disconnected: ON (200ms) - OFF (800ms) (200ms-600ms in our driver)
+ // ___ ___ ___
+ // LED[0] ON | | | | | |
+ // ------ OFF->-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+->>>...
+ // 0 2 4 6 8 10 12 14 16
+ // 2. Connected: ON (800ms) - OFF (200ms) (600ms-200ms in our driver)
+ // ___________ ___________ ______
+ // LED[0] ON | | | | |
+ // ------ OFF->-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+->>>...
+ // 0 2 4 6 8 10 12 14 16
+
+ //Scan state
+ if(!isConnect)
+ ton = 2, toff = 6;
+ else
+ ton = 6, toff = 2;
+
+ if ((ton + toff) != 0)
+ {
+ tmp = wd->ledStruct.counter % (ton+toff);
+ if (tmp < ton)
+ {
+ zfHpLedCtrl(dev, 0, 1);
+ zfHpLedCtrl(dev, 1, 1);
+ }
+ else
+ {
+ zfHpLedCtrl(dev, 0, 0);
+ zfHpLedCtrl(dev, 1, 0);
+ }
+ }
+}
+
+/******************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfLedCtrl_BlinkWhenScan_Alpha */
+/* Customize for Alpha/DLink LED */
+/* - Blink LED 12 times within 3 seconds when doing Active Scan */
+/* ___ ___ ___ ___ */
+/* LED[0] ON | | | | | | | | */
+/* -------OFF->-+-+-+-+-+-+-+-+-+-+-+-+-+--+-->>>... */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Shang-Chun Liu Atheros Communications, INC. 2007.11 */
+/* */
+/******************************************************************************/
+void zfLedCtrl_BlinkWhenScan_Alpha(zdev_t* dev)
+{
+ static u32_t counter = 0;
+ zmw_get_wlan_dev(dev);
+
+ if(counter > 34) // counter for 3 sec
+ {
+ wd->ledStruct.LEDCtrlFlag &= ~(u8_t)ZM_LED_CTRL_FLAG_ALPHA;
+ counter = 0;
+ }
+
+ if( (counter % 3) < 2)
+ zfHpLedCtrl(dev, 0, 1);
+ else
+ zfHpLedCtrl(dev, 0, 0);
+
+ counter++;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfLed100msCtrl */
+/* LED 100 milliseconds timer. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2007.6 */
+/* */
+/************************************************************************/
+void zfLed100msCtrl(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ wd->ledStruct.counter++;
+
+ if(wd->ledStruct.LEDCtrlFlag)
+ {
+ switch(wd->ledStruct.LEDCtrlFlag) {
+ case ZM_LED_CTRL_FLAG_ALPHA:
+ zfLedCtrl_BlinkWhenScan_Alpha(dev);
+ break;
+ }
+ }
+ else
+ {
+ switch(wd->ledStruct.LEDCtrlType) {
+ case 1: // Traditional 1 LED
+ zfLedCtrlType1(dev);
+ break;
+
+ case 2: // Dual-LEDs for Netgear
+ zfLedCtrlType2(dev);
+ break;
+
+ case 3: // Single-LED for Netgear (WN111v2)
+ zfLedCtrlType3(dev);
+ break;
+
+ default:
+ zfLedCtrlType1(dev);
+ break;
+ }
+ }
+}
+
diff --git a/drivers/staging/otus/80211core/performance.c b/drivers/staging/otus/80211core/performance.c
new file mode 100644
index 00000000000..51b42d54f65
--- /dev/null
+++ b/drivers/staging/otus/80211core/performance.c
@@ -0,0 +1,431 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : performance.c */
+/* */
+/* Abstract */
+/* This module performance evaluation functions. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/************************************************************************/
+#include "cprecomp.h"
+#ifdef ZM_ENABLE_PERFORMANCE_EVALUATION
+
+#define ZM_TP_SIZE 50
+struct zsSummary zm_summary;
+struct zsVariation zm_var;
+struct zsThroughput zm_tp;
+
+void zfiPerformanceInit(zdev_t* dev)
+{
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ zm_summary.tick_base = wd->tick;
+ zm_summary.tx_msdu_count = 0;
+ zm_summary.tx_mpdu_count = 0;
+ zm_summary.rx_msdu_count = 0;
+ zm_summary.rx_mpdu_count = 0;
+ zm_summary.rx_broken_seq = 0;
+ zm_summary.rx_broken_sum = 0;
+ zm_summary.rx_seq_base = 0;
+ zm_summary.rx_broken_seq_dis = 0;
+ zm_summary.rx_duplicate_seq = 0;
+ zm_summary.rx_old_seq = 0;
+ zm_summary.reset_count = 0;
+ zm_summary.reset_sum = 0;
+ zm_summary.rx_lost_sum = 0;
+ zm_summary.rx_duplicate_error = 0;
+ zm_summary.rx_free = 0;
+ zm_summary.rx_amsdu_len = 0;
+ zm_summary.rx_flush = 0;
+ zm_summary.rx_clear = 0;
+ zm_summary.rx_reorder = 0;
+
+ for (i=0; i<100; i++)
+ {
+ zm_var.tx_msdu_tick[i] = zm_var.tx_mpdu_tick[i] = 0;
+ zm_var.rx_msdu_tick[i] = zm_var.rx_mpdu_tick[i] = 0;
+ }
+
+ zfTimerSchedule(dev, ZM_EVENT_TIMEOUT_PERFORMANCE, 100);
+
+ zm_tp.size = ZM_TP_SIZE;
+ zm_tp.head = zm_tp.size - 1;
+ zm_tp.tail = 0;
+ for (i=0; i<zm_tp.size; i++)
+ {
+ zm_tp.tx[i]=0;
+ zm_tp.rx[i]=0;
+ }
+}
+
+void zfiPerformanceGraph(zdev_t* dev)
+{
+ s16_t i,j;
+ u8_t s[ZM_TP_SIZE+5];
+ zmw_get_wlan_dev(dev);
+
+ for (i=0; i<(zm_tp.size-1); i++)
+ {
+ zm_tp.tx[i] = zm_tp.tx[i+1];
+ zm_tp.rx[i] = zm_tp.rx[i+1];
+ }
+ zm_tp.tx[zm_tp.size-1] = zm_summary.tx_mpdu_count*1500*8/1000000;
+ zm_tp.rx[zm_tp.size-1] = zm_summary.rx_msdu_count*1500*8/1000000;
+
+ for (i=15; i>0; i--)
+ {
+ s[0] = (i/10) + '0';
+ s[1] = (i%10) + '0';
+ s[2] = '0';
+ s[3] = '|';
+ for (j=0; j<zm_tp.size; j++)
+ {
+ if ((zm_tp.tx[j]/10 == i) && (zm_tp.rx[j]/10 == i))
+ {
+ s[4+j] = 'X';
+ }
+ else if (zm_tp.tx[j]/10 == i)
+ {
+ s[4+j] = 'T';
+ }
+ else if (zm_tp.rx[j]/10 == i)
+ {
+ s[4+j] = 'R';
+ }
+ else
+ {
+ s[4+j] = ' ';
+ }
+ }
+ s[zm_tp.size+4] = '\0';
+ DbgPrint("%s",s);
+ }
+ DbgPrint("000|__________________________________________________");
+
+}
+
+
+void zfiPerformanceRefresh(zdev_t* dev)
+{
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ zfiDbgReadReg(dev, 0x11772c);
+
+ zm_var.tx_msdu_mean = zm_summary.tx_msdu_count / 100;
+ zm_var.tx_mpdu_mean = zm_summary.tx_mpdu_count / 100;
+ zm_var.rx_msdu_mean = zm_summary.rx_msdu_count / 100;
+ zm_var.rx_mpdu_mean = zm_summary.rx_mpdu_count / 100;
+
+ zm_var.tx_msdu_sum = zm_var.tx_mpdu_sum = 0;
+ zm_var.rx_msdu_sum = zm_var.rx_mpdu_sum = 0;
+ zm_summary.tx_idle_count = zm_summary.rx_idle_count = 0;
+ for (i=0; i<100; i++)
+ {
+ zm_var.tx_msdu_sum += (zm_var.tx_msdu_tick[i] * zm_var.tx_msdu_tick[i]);
+ zm_var.tx_mpdu_sum += (zm_var.tx_mpdu_tick[i] * zm_var.tx_mpdu_tick[i]);
+ zm_var.rx_msdu_sum += (zm_var.rx_msdu_tick[i] * zm_var.rx_msdu_tick[i]);
+ zm_var.rx_mpdu_sum += (zm_var.rx_mpdu_tick[i] * zm_var.rx_mpdu_tick[i]);
+
+ if (!zm_var.tx_mpdu_tick[i]) zm_summary.tx_idle_count++;
+ if (!zm_var.rx_mpdu_tick[i]) zm_summary.rx_idle_count++;
+ }
+ zm_var.tx_msdu_var = (zm_var.tx_msdu_sum / 100) - (zm_var.tx_msdu_mean * zm_var.tx_msdu_mean);
+ zm_var.tx_mpdu_var = (zm_var.tx_mpdu_sum / 100) - (zm_var.tx_mpdu_mean * zm_var.tx_mpdu_mean);
+ zm_var.rx_msdu_var = (zm_var.rx_msdu_sum / 100) - (zm_var.rx_msdu_mean * zm_var.rx_msdu_mean);
+ zm_var.rx_mpdu_var = (zm_var.rx_mpdu_sum / 100) - (zm_var.rx_mpdu_mean * zm_var.rx_mpdu_mean);
+
+ zm_summary.tick_base = wd->tick;
+ zm_summary.rx_broken_sum += zm_summary.rx_broken_seq;
+ zm_summary.rx_lost_sum += (zm_summary.rx_broken_seq - zm_summary.rx_duplicate_seq - zm_summary.rx_old_seq);
+
+ zfiPerformanceGraph(dev);
+
+ DbgPrint("******************************************************\n");
+ DbgPrint("* TX: MSDU=%5d, VAR=%5d; MPDU=%5d, VAR=%5d\n", zm_summary.tx_msdu_count,
+ zm_var.tx_msdu_var, zm_summary.tx_mpdu_count, zm_var.tx_mpdu_var);
+ DbgPrint("* TX: idle=%5d,TxRate=%3d, PER=%5d\n", zm_summary.tx_idle_count,
+ wd->CurrentTxRateKbps/1000,
+ (u16_t)wd->PER[wd->sta.oppositeInfo[0].rcCell.currentRate]);
+ DbgPrint("* RX: MSDU=%5d, VAR=%5d; MPDU=%5d, VAR=%5d\n", zm_summary.rx_msdu_count,
+ zm_var.rx_msdu_var, zm_summary.rx_mpdu_count, zm_var.rx_mpdu_var);
+ DbgPrint("* RX: idle=%5d,RxRate=%3d,AMSDU=%5d\n", zm_summary.rx_idle_count,
+ wd->CurrentRxRateKbps/1000, zm_summary.rx_amsdu_len);
+ DbgPrint("* RX broken seq=%4d, distances=%4d, duplicates=%4d\n", zm_summary.rx_broken_seq,
+ zm_summary.rx_broken_seq_dis, zm_summary.rx_duplicate_seq);
+ DbgPrint("* RX old seq=%4d, lost=%4d, broken sum=%4d\n", zm_summary.rx_old_seq,
+ (zm_summary.rx_broken_seq - zm_summary.rx_duplicate_seq - zm_summary.rx_old_seq),
+ zm_summary.rx_broken_sum);
+ DbgPrint("* Rx lost sum=%4d,dup. error=%4d, free count=%4d\n", zm_summary.rx_lost_sum,
+ zm_summary.rx_duplicate_error, zm_summary.rx_free);
+ DbgPrint("* Rx flush sum=%4d, clear sum=%4d, reorder=%7d\n", zm_summary.rx_flush,
+ zm_summary.rx_clear, zm_summary.rx_reorder);
+ DbgPrint("* Firmware reset=%3d, reset sum=%4d\n", zm_summary.reset_count,
+ zm_summary.reset_sum);
+ DbgPrint("******************************************************\n\n");
+ //reset count 11772c
+ zm_summary.tx_msdu_count = 0;
+ zm_summary.tx_mpdu_count = 0;
+ zm_summary.rx_msdu_count = 0;
+ zm_summary.rx_mpdu_count = 0;
+ zm_summary.rx_broken_seq = 0;
+ zm_summary.rx_broken_seq_dis = 0;
+ zm_summary.rx_duplicate_seq = 0;
+ zm_summary.rx_old_seq = 0;
+ zm_summary.reset_count = 0;
+ zm_summary.rx_amsdu_len = 0;
+
+ for (i=0; i<100; i++)
+ {
+ zm_var.tx_msdu_tick[i] = zm_var.tx_mpdu_tick[i] = 0;
+ zm_var.rx_msdu_tick[i] = zm_var.rx_mpdu_tick[i] = 0;
+ }
+
+ zfTimerSchedule(dev, ZM_EVENT_TIMEOUT_PERFORMANCE, 100);
+}
+
+void zfiTxPerformanceMSDU(zdev_t* dev, u32_t tick)
+{
+ u32_t index;
+ zm_summary.tx_msdu_count++;
+
+ index = tick - zm_summary.tick_base;
+
+ if (index < 100)
+ {
+ zm_var.tx_msdu_tick[index]++;
+ }
+ else
+ {
+ //DbgPrint("wd->tick exceeded tick_base+100!\n");
+ }
+}
+
+void zfiRxPerformanceMSDU(zdev_t* dev, u32_t tick)
+{
+ u32_t index;
+ zm_summary.rx_msdu_count++;
+
+ index = tick - zm_summary.tick_base;
+
+ if (index < 100)
+ {
+ zm_var.rx_msdu_tick[index]++;
+ }
+ else
+ {
+ //DbgPrint("wd->tick exceeded tick_base+100!\n");
+ }
+}
+
+void zfiTxPerformanceMPDU(zdev_t* dev, u32_t tick)
+{
+ u32_t index;
+ zm_summary.tx_mpdu_count++;
+
+ index = tick - zm_summary.tick_base;
+
+ if (index < 100)
+ {
+ zm_var.tx_mpdu_tick[index]++;
+ }
+ else
+ {
+ //DbgPrint("wd->tick exceeded tick_base+100!\n");
+ }
+}
+
+#ifndef ZM_INT_USE_EP2_HEADER_SIZE
+#define ZM_INT_USE_EP2_HEADER_SIZE 12
+#endif
+void zfiRxPerformanceMPDU(zdev_t* dev, zbuf_t* buf)
+{
+ u32_t index;
+ u16_t frameType;
+ u16_t frameCtrl;
+ u8_t mpduInd;
+ u16_t plcpHdrLen;
+ u16_t len;
+
+ zmw_get_wlan_dev(dev);
+
+ len = zfwBufGetSize(dev, buf);
+ mpduInd = zmw_rx_buf_readb(dev, buf, len-1);
+ /* First MPDU or Single MPDU */
+ if(((mpduInd & 0x30) == 0x00) || ((mpduInd & 0x30) == 0x20))
+ //if ((mpduInd & 0x10) == 0x00)
+ {
+ plcpHdrLen = 12; // PLCP header length
+ }
+ else
+ {
+ if (zmw_rx_buf_readh(dev, buf, 4) == wd->macAddr[0] &&
+ zmw_rx_buf_readh(dev, buf, 6) == wd->macAddr[1] &&
+ zmw_rx_buf_readh(dev, buf, 8) == wd->macAddr[2]) {
+ plcpHdrLen = 0;
+ }
+ else if (zmw_rx_buf_readh(dev, buf, 16) == wd->macAddr[0] &&
+ zmw_rx_buf_readh(dev, buf, 18) == wd->macAddr[1] &&
+ zmw_rx_buf_readh(dev, buf, 20) == wd->macAddr[2]){
+ plcpHdrLen = 12;
+ }
+ else {
+ plcpHdrLen = 0;
+ }
+ }
+
+ frameCtrl = zmw_rx_buf_readb(dev, buf, plcpHdrLen + 0);
+ frameType = frameCtrl & 0xf;
+
+ if (frameType != ZM_WLAN_DATA_FRAME)
+ {
+ return;
+ }
+
+ zm_summary.rx_mpdu_count++;
+
+ index = wd->tick - zm_summary.tick_base;
+
+ if (index < 100)
+ {
+ zm_var.rx_mpdu_tick[index]++;
+ }
+ else
+ {
+ //DbgPrint("wd->tick exceeded tick_base+100!\n");
+ }
+}
+
+void zfiRxPerformanceSeq(zdev_t* dev, zbuf_t* buf)
+{
+ u16_t seq_no;
+ u16_t offset = 0;
+ u16_t old_dis = zm_summary.rx_broken_seq_dis;
+ //sys_time = KeQueryPerformanceCounter(&freq);
+
+ seq_no = zmw_rx_buf_readh(dev, buf, offset+22) >> 4;
+
+ ZM_SEQ_DEBUG("Out %5d\n", seq_no);
+
+ if (seq_no < zm_summary.rx_seq_base)
+ {
+ if (seq_no == 0)
+ {
+ if (zm_summary.rx_seq_base != 4095)
+ {
+ zm_summary.rx_broken_seq++;
+ ZM_SEQ_DEBUG("Broken seq");
+ zm_summary.rx_broken_seq_dis+=(4096 - zm_summary.rx_seq_base);
+ }
+ }
+ else if ((seq_no < 300) && (zm_summary.rx_seq_base > 3800))
+ {
+ zm_summary.rx_broken_seq++;
+ ZM_SEQ_DEBUG("Broken seq");
+ zm_summary.rx_broken_seq_dis+=(4096 - zm_summary.rx_seq_base + seq_no);
+ }
+ else
+ {
+ zm_summary.rx_broken_seq++;
+ ZM_SEQ_DEBUG("Broken seq");
+ zm_summary.rx_broken_seq_dis+=(zm_summary.rx_seq_base - seq_no);
+ zm_summary.rx_old_seq++;
+ }
+ }
+ else
+ {
+ if (seq_no != (zm_summary.rx_seq_base + 1))
+ {
+ if ((seq_no > 3800) && (zm_summary.rx_seq_base < 300))
+ {
+ zm_summary.rx_broken_seq++;
+ ZM_SEQ_DEBUG("Broken seq");
+ zm_summary.rx_broken_seq_dis+=(4096 - seq_no + zm_summary.rx_seq_base);
+ zm_summary.rx_old_seq++;
+ }
+ else
+ {
+ zm_summary.rx_broken_seq++;
+ ZM_SEQ_DEBUG("Broken seq");
+ zm_summary.rx_broken_seq_dis+=(seq_no - zm_summary.rx_seq_base);
+ }
+ }
+ }
+ if (seq_no == zm_summary.rx_seq_base)
+ {
+ zm_summary.rx_duplicate_seq++;
+ }
+
+ if ((zm_summary.rx_broken_seq_dis - old_dis) > 100)
+ {
+ DbgPrint("* seq_no=%4d, base_seq=%4d, dis_diff=%4d", seq_no,
+ zm_summary.rx_seq_base, zm_summary.rx_broken_seq_dis - old_dis);
+ }
+ zm_summary.rx_seq_base = seq_no;
+}
+
+void zfiRxPerformanceReg(zdev_t* dev, u32_t reg, u32_t rsp)
+{
+ zm_summary.reset_count = (u16_t)rsp - zm_summary.reset_sum;
+ zm_summary.reset_sum = (u16_t)rsp;
+}
+
+void zfiRxPerformanceDup(zdev_t* dev, zbuf_t* buf1, zbuf_t* buf2)
+{
+ u16_t seq_no1, seq_no2;
+
+ seq_no1 = zmw_rx_buf_readh(dev, buf1, 22) >> 4;
+ seq_no2 = zmw_rx_buf_readh(dev, buf2, 22) >> 4;
+ if (seq_no1 != seq_no2)
+ {
+ zm_summary.rx_duplicate_error++;
+ }
+}
+
+void zfiRxPerformanceFree(zdev_t* dev, zbuf_t* buf)
+{
+ zm_summary.rx_free++;
+}
+
+void zfiRxPerformanceAMSDU(zdev_t* dev, zbuf_t* buf, u16_t len)
+{
+ if (zm_summary.rx_amsdu_len < len)
+ {
+ zm_summary.rx_amsdu_len = len;
+ }
+}
+void zfiRxPerformanceFlush(zdev_t* dev)
+{
+ zm_summary.rx_flush++;
+}
+
+void zfiRxPerformanceClear(zdev_t* dev)
+{
+ zm_summary.rx_clear++;
+ ZM_SEQ_DEBUG("RxClear");
+}
+
+void zfiRxPerformanceReorder(zdev_t* dev)
+{
+ zm_summary.rx_reorder++;
+}
+#endif /* end of ZM_ENABLE_PERFORMANCE_EVALUATION */
diff --git a/drivers/staging/otus/80211core/performance.h b/drivers/staging/otus/80211core/performance.h
new file mode 100644
index 00000000000..29f658ae477
--- /dev/null
+++ b/drivers/staging/otus/80211core/performance.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#ifndef _PERFORMANCE_H
+#define _PERFORMANCE_H
+
+#ifdef ZM_ENABLE_PERFORMANCE_EVALUATION
+
+struct zsSummary
+{
+ u32_t tx_msdu_count;
+ u32_t tx_mpdu_count;
+ u32_t rx_msdu_count;
+ u32_t rx_mpdu_count;
+ u32_t tick_base;
+ u16_t rx_seq_base;
+ u16_t rx_broken_seq;
+ u16_t rx_broken_sum;
+ u16_t rx_broken_seq_dis;
+ u16_t rx_duplicate_seq;
+ u16_t rx_duplicate_error;
+ u16_t rx_old_seq;
+ u16_t rx_lost_sum;
+ u16_t tx_idle_count;
+ u16_t rx_idle_count;
+ u16_t reset_count;
+ u16_t reset_sum;
+ u16_t rx_free;
+ u16_t rx_amsdu_len;
+ u16_t rx_flush;
+ u16_t rx_clear;
+ u32_t rx_reorder;
+};
+
+struct zsVariation
+{
+ u32_t tx_msdu_tick[100];
+ u32_t tx_mpdu_tick[100];
+ u32_t rx_msdu_tick[100];
+ u32_t rx_mpdu_tick[100];
+
+ u32_t tx_msdu_mean;
+ u32_t tx_mpdu_mean;
+ u32_t rx_msdu_mean;
+ u32_t rx_mpdu_mean;
+
+ u32_t tx_msdu_sum;
+ u32_t tx_mpdu_sum;
+ u32_t rx_msdu_sum;
+ u32_t rx_mpdu_sum;
+
+ u32_t tx_msdu_var;
+ u32_t tx_mpdu_var;
+ u32_t rx_msdu_var;
+ u32_t rx_mpdu_var;
+};
+
+struct zsThroughput
+{
+ u32_t tx[50];
+ u32_t rx[50];
+ u16_t head;
+ u16_t tail;
+ u16_t size;
+ LARGE_INTEGER sys_time;
+ LARGE_INTEGER freq;
+};
+
+void zfiPerformanceInit(zdev_t* dev);
+void zfiPerformanceRefresh(zdev_t* dev);
+
+void zfiTxPerformanceMSDU(zdev_t* dev, u32_t tick);
+void zfiRxPerformanceMSDU(zdev_t* dev, u32_t tick);
+void zfiTxPerformanceMPDU(zdev_t* dev, u32_t tick);
+void zfiRxPerformanceMPDU(zdev_t* dev, zbuf_t* buf);
+void zfiRxPerformanceSeq(zdev_t* dev, zbuf_t* buf);
+void zfiRxPerformanceReg(zdev_t* dev, u32_t reg, u32_t rsp);
+void zfiRxPerformanceDup(zdev_t* dev, zbuf_t* buf1, zbuf_t* buf2);
+void zfiRxPerformanceFree(zdev_t* dev, zbuf_t* buf);
+void zfiRxPerformanceAMSDU(zdev_t* dev, zbuf_t* buf, u16_t len);
+void zfiRxPerformanceFlush(zdev_t* dev);
+void zfiRxPerformanceClear(zdev_t* dev);
+void zfiRxPerformanceReorder(zdev_t* dev);
+#endif /* end of ZM_ENABLE_PERFORMANCE_EVALUATION */
+#endif /* end of _PERFORMANCE_H */
diff --git a/drivers/staging/otus/80211core/pub_usb.h b/drivers/staging/otus/80211core/pub_usb.h
new file mode 100644
index 00000000000..c4b4bd25e82
--- /dev/null
+++ b/drivers/staging/otus/80211core/pub_usb.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _PUB_USB_H
+#define _PUB_USB_H
+
+#include "../oal_dt.h"
+
+#define ZM_HAL_80211_MODE_AP 0
+#define ZM_HAL_80211_MODE_STA 1
+#define ZM_HAL_80211_MODE_IBSS_GENERAL 2
+#define ZM_HAL_80211_MODE_IBSS_WPA2PSK 3
+
+/* USB module description */
+/* Queue Management */
+/* 80211core requires OAL to implement a transmission queue in OAL's */
+/* USB module. Because there is only limited on-chip memory, so USB */
+/* data transfer may be pending until on-chip memory is available. */
+/* 80211core also requires OAL's USB module to provide two functions */
+/* zfwUsbGetFreeTxQSize() and zfwUsbGetMaxTxQSize() for 80211core to */
+/* query the status of this transmission queue. The main purpose of */
+/* this queue is for QoS/WMM. Though there are hardware priority */
+/* queues on the chip, and also software priority queues in the */
+/* 80211core. There is still one and only one USB channel. So */
+/* 80211core will use the information that zfwUsbGetFreeTxQSize() */
+/* returned to schedule the traffic from the software priority */
+/* queues to the hardware priority queues. For example, if 80211core */
+/* found that USB transmission queue is going to be full, it will */
+/* not allow packets with lower priority to enter the USB channel. */
+
+
+/* Structure for USB call back functions */
+struct zfCbUsbFuncTbl {
+ void (*zfcbUsbRecv)(zdev_t *dev, zbuf_t *buf);
+ void (*zfcbUsbRegIn)(zdev_t* dev, u32_t* rsp, u16_t rspLen);
+ void (*zfcbUsbOutComplete)(zdev_t* dev, zbuf_t *buf, u8_t status, u8_t *hdr);
+ void (*zfcbUsbRegOutComplete)(zdev_t* dev);
+};
+
+/* Call back functions */
+/* Below are the functions that should be called by the OAL */
+
+/* When data is available in endpoint 3, OAL shall embed the data in */
+/* zbuf_t and supply to 80211core by calling this function */
+/* void (*zfcbUsbRecv)(zdev_t *dev, zbuf_t *buf); */
+
+/* When data is available in endpoint 2, OAL shall call this function */
+/* void (*zfcbUsbRegIn)(zdev_t* dev, u32_t* rsp, u16_t rspLen); */
+
+/* When USB data transfer completed in endpoint 1, OAL shall call this function */
+/* void (*zfcbUsbOutComplete)(zdev_t* dev, zbuf_t *buf, u8_t status, u8_t *hdr); */
+
+
+/* Call out functions */
+/* Below are the functions that supply by the OAL for 80211core to */
+/* manipulate the USB */
+
+/* Return OAL's USB TxQ size */
+extern u32_t zfwUsbGetMaxTxQSize(zdev_t* dev);
+
+/* Return OAL's TxQ available size */
+extern u32_t zfwUsbGetFreeTxQSize(zdev_t* dev);
+
+/* Register call back function */
+extern void zfwUsbRegisterCallBack(zdev_t* dev, struct zfCbUsbFuncTbl *zfUsbFunc);
+
+/* Enable USB interrupt endpoint */
+extern u32_t zfwUsbEnableIntEpt(zdev_t *dev, u8_t endpt);
+
+/* Enable USB Rx endpoint */
+extern int zfwUsbEnableRxEpt(zdev_t* dev, u8_t endpt);
+
+/* 80211core call this function to send a USB request over endpoint 0 */
+extern u32_t zfwUsbSubmitControl(zdev_t* dev, u8_t req, u16_t value,
+ u16_t index, void *data, u32_t size);
+extern u32_t zfwUsbSubmitControlIo(zdev_t* dev, u8_t req, u8_t reqtype,
+ u16_t value, u16_t index, void *data, u32_t size);
+
+/* 80211core call this function to transfer data out over endpoint 1 */
+extern void zfwUsbCmd(zdev_t* dev, u8_t endpt, u32_t* cmd, u16_t cmdLen);
+
+/* 80211core call this function to transfer data out over endpoint 4 */
+extern u32_t zfwUsbSend(zdev_t* dev, u8_t endpt, u8_t *hdr, u16_t hdrlen, u8_t *snap, u16_t snapLen,
+ u8_t *tail, u16_t tailLen, zbuf_t *buf, u16_t offset);
+
+/* 80211core call this function to set USB configuration */
+extern u32_t zfwUsbSetConfiguration(zdev_t *dev, u16_t value);
+
+#endif
diff --git a/drivers/staging/otus/80211core/pub_zfi.h b/drivers/staging/otus/80211core/pub_zfi.h
new file mode 100644
index 00000000000..a35bd5d41d2
--- /dev/null
+++ b/drivers/staging/otus/80211core/pub_zfi.h
@@ -0,0 +1,821 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _PUB_DEFS_H
+#define _PUB_DEFS_H
+
+#include "../oal_dt.h"
+
+/***** Section 1 : Tunable Parameters *****/
+/* The defintions in this section are tunabel parameters */
+
+/* Maximum number of BSS that could be scaned */
+#define ZM_MAX_BSS 128
+
+/* Maximum number of WPA2 PMKID that supported */
+#define ZM_PMKID_MAX_BSS_CNT 8
+
+/* Enable aggregation and deaggregation */
+#define ZM_ENABLE_AGGREGATION
+
+#ifdef ZM_ENABLE_AGGREGATION
+ /* Enable BA failed retransmission in firmware */
+ #define ZM_ENABLE_FW_BA_RETRANSMISSION
+ #define ZM_BYPASS_AGGR_SCHEDULING
+ //#define ZM_AGGR_BIT_ON
+#endif
+
+
+#ifndef ZM_FB50
+//#define ZM_FB50
+#endif
+
+#ifndef ZM_AP_DEBUG
+//#define ZM_AP_DEBUG
+#endif
+
+//#define ZM_ENABLE_BA_RATECTRL
+
+/***** End of section 1 *****/
+
+
+/***** Section 2 : Public Definitions, data structures and prototypes *****/
+/* function return status */
+#define ZM_STATUS_SUCCESS 0
+#define ZM_STATUS_FAILURE 1
+
+// media connect status
+#define ZM_STATUS_MEDIA_CONNECT 0x00
+#define ZM_STATUS_MEDIA_DISCONNECT 0x01
+#define ZM_STATUS_MEDIA_DISCONNECT_NOT_FOUND 0x02
+#define ZM_STATUS_MEDIA_DISABLED 0x03
+#define ZM_STATUS_MEDIA_CONNECTION_DISABLED 0x04
+#define ZM_STATUS_MEDIA_CONNECTION_RESET 0x05
+#define ZM_STATUS_MEDIA_RESET 0x06
+#define ZM_STATUS_MEDIA_DISCONNECT_DEAUTH 0x07
+#define ZM_STATUS_MEDIA_DISCONNECT_DISASOC 0x08
+#define ZM_STATUS_MEDIA_DISCONNECT_TIMEOUT 0x09
+#define ZM_STATUS_MEDIA_DISCONNECT_AUTH_FAILED 0x0a
+#define ZM_STATUS_MEDIA_DISCONNECT_ASOC_FAILED 0x0b
+#define ZM_STATUS_MEDIA_DISCONNECT_MIC_FAIL 0x0c
+#define ZM_STATUS_MEDIA_DISCONNECT_UNREACHABLE 0x0d
+#define ZM_STATUS_MEDIA_DISCONNECT_BEACON_MISS 0x0e
+
+// Packet Filter
+#define ZM_PACKET_TYPE_DIRECTED 0x00000001
+#define ZM_PACKET_TYPE_MULTICAST 0x00000002
+#define ZM_PACKET_TYPE_ALL_MULTICAST 0x00000004
+#define ZM_PACKET_TYPE_BROADCAST 0x00000008
+#define ZM_PACKET_TYPE_PROMISCUOUS 0x00000020
+
+/* BSS mode definition */
+/* TODO : The definitions here are coupled with XP's NDIS OID. */
+/* We can't be changed them freely, need to disarm this mine */
+#define ZM_MODE_IBSS 0
+#define ZM_MODE_INFRASTRUCTURE 1
+#define ZM_MODE_UNKNOWN 2
+#define ZM_MODE_INFRASTRUCTURE_MAX 3
+#define ZM_MODE_AP 4
+#define ZM_MODE_PSEUDO 5
+
+
+/* Authentication mode */
+#define ZM_AUTH_MODE_OPEN 0
+#define ZM_AUTH_MODE_SHARED_KEY 1
+#define ZM_AUTH_MODE_AUTO 2
+#define ZM_AUTH_MODE_WPA 3
+#define ZM_AUTH_MODE_WPAPSK 4
+#define ZM_AUTH_MODE_WPA_NONE 5
+#define ZM_AUTH_MODE_WPA2 6
+#define ZM_AUTH_MODE_WPA2PSK 7
+#ifdef ZM_ENABLE_CENC
+#define ZM_AUTH_MODE_CENC 8
+#endif //ZM_ENABLE_CENC
+#define ZM_AUTH_MODE_WPA_AUTO 9
+#define ZM_AUTH_MODE_WPAPSK_AUTO 10
+
+// Encryption mode
+#define ZM_NO_WEP 0x0
+#define ZM_AES 0x4
+#define ZM_TKIP 0x2
+#define ZM_WEP64 0x1
+#define ZM_WEP128 0x5
+#define ZM_WEP256 0x6
+#ifdef ZM_ENABLE_CENC
+#define ZM_CENC 0x7
+#endif //ZM_ENABLE_CENC
+
+/* Encryption type for wep status */
+#define ZM_ENCRYPTION_WEP_DISABLED 0
+#define ZM_ENCRYPTION_WEP_ENABLED 1
+#define ZM_ENCRYPTION_WEP_KEY_ABSENT 2
+#define ZM_ENCRYPTION_NOT_SUPPORTED 3
+#define ZM_ENCRYPTION_TKIP 4
+#define ZM_ENCRYPTION_TKIP_KEY_ABSENT 5
+#define ZM_ENCRYPTION_AES 6
+#define ZM_ENCRYPTION_AES_KEY_ABSENT 7
+
+#ifdef ZM_ENABLE_CENC
+#define ZM_ENCRYPTION_CENC 8
+#endif //ZM_ENABLE_CENC
+
+/* security type */
+#define ZM_SECURITY_TYPE_NONE 0
+#define ZM_SECURITY_TYPE_WEP 1
+#define ZM_SECURITY_TYPE_WPA 2
+
+#ifdef ZM_ENABLE_CENC
+#define ZM_SECURITY_TYPE_CENC 3
+#endif //ZM_ENABLE_CENC
+
+/* Encryption Exemption Action Type */
+#define ZM_ENCRYPTION_EXEMPT_NO_EXEMPTION 0
+#define ZM_ENCRYPTION_EXEMPT_ALWAYS 1
+
+/* MIC failure */
+#define ZM_MIC_PAIRWISE_ERROR 0x06
+#define ZM_MIC_GROUP_ERROR 0x0E
+
+
+/* power save mode */
+#define ZM_STA_PS_NONE 0
+#define ZM_STA_PS_MAX 1
+#define ZM_STA_PS_FAST 2
+#define ZM_STA_PS_LIGHT 3
+
+/* WME AC Type */
+#define ZM_WME_AC_BK 0 /* Background AC */
+#define ZM_WME_AC_BE 1 /* Best-effort AC */
+#define ZM_WME_AC_VIDEO 2 /* Video AC */
+#define ZM_WME_AC_VOICE 3 /* Voice AC */
+
+/* Preamble type */
+#define ZM_PREAMBLE_TYPE_AUTO 0
+#define ZM_PREAMBLE_TYPE_LONG 1
+#define ZM_PREAMBLE_TYPE_SHORT 2
+
+/* wireless modes constants */
+#define ZM_WIRELESS_MODE_5_54 0x01 ///< 5 GHz 54 Mbps
+#define ZM_WIRELESS_MODE_5_108 0x02 ///< 5 GHz 108 Mbps
+#define ZM_WIRELESS_MODE_24_11 0x04 ///< 2.4 GHz 11 Mbps
+#define ZM_WIRELESS_MODE_24_54 0x08 ///< 2.4 GHz 54 Mbps
+#define ZM_WIRELESS_MODE_24_108 0x10 ///< 2.4 GHz 108 Mbps
+#define ZM_WIRELESS_MODE_49_13 0x100 ///< 4.9 GHz 13.5 Mbps, quarter rate chn-bandwidth = 5
+#define ZM_WIRELESS_MODE_49_27 0x200 ///< 4.9 GHz 27 Mbps, half rate chn-bandwidth = 10
+#define ZM_WIRELESS_MODE_49_54 0x400 ///< 4.9 GHz 54 Mbps, full rate chn-bandwidth = 20
+#define ZM_WIRELESS_MODE_5_300 0x1000 ///< 5 GHz 300 Mbps
+#define ZM_WIRELESS_MODE_24_300 0x2000 ///< 2.4 GHz 300 Mbps
+#define ZM_WIRELESS_MODE_5_130 0x4000 ///< 5 GHz 130 Mbps
+#define ZM_WIRELESS_MODE_24_130 0x8000 ///< 2.4 GHz 130 Mbps
+
+#define ZM_WIRELESS_MODE_24_N (ZM_WIRELESS_MODE_24_130|ZM_WIRELESS_MODE_24_300)
+#define ZM_WIRELESS_MODE_5_N (ZM_WIRELESS_MODE_5_130|ZM_WIRELESS_MODE_5_300)
+#define ZM_WIRELESS_MODE_24 (ZM_WIRELESS_MODE_24_11|ZM_WIRELESS_MODE_24_54|ZM_WIRELESS_MODE_24_N)
+#define ZM_WIRELESS_MODE_5 (ZM_WIRELESS_MODE_5_54|ZM_WIRELESS_MODE_5_N)
+
+/* AdHoc Mode with different band */
+#define ZM_ADHOCBAND_A 1
+#define ZM_ADHOCBAND_B 2
+#define ZM_ADHOCBAND_G 3
+#define ZM_ADHOCBAND_BG 4
+#define ZM_ADHOCBAND_ABG 5
+
+/* Authentication algorithm in the field algNo of authentication frames */
+#define ZM_AUTH_ALGO_OPEN_SYSTEM 0x10000 /* Open system */
+#define ZM_AUTH_ALGO_SHARED_KEY 0x10001 /* Shared Key */
+#define ZM_AUTH_ALGO_LEAP 0x10080 /* Leap */
+
+struct zsScanResult
+{
+ u32_t reserved;
+};
+
+
+struct zsStastics
+{
+ u32_t reserved;
+};
+
+#define ZM_MAX_SUPP_RATES_IE_SIZE 12
+#define ZM_MAX_IE_SIZE 50 //100
+#define ZM_MAX_WPS_IE_SIZE 150
+#define ZM_MAX_PROBE_FRAME_BODY_SIZE 512//300
+#define ZM_MAX_COUNTRY_INFO_SIZE 20
+
+#define ZM_MAX_SSID_LENGTH 32
+struct zsBssInfo
+{
+ u8_t macaddr[6];
+ u8_t bssid[6];
+ u8_t beaconInterval[2];
+ u8_t capability[2];
+ u8_t timeStamp[8];
+ u8_t ssid[ZM_MAX_SSID_LENGTH + 2]; // EID(1) + Length(1) + SSID(32)
+ u8_t supportedRates[ZM_MAX_SUPP_RATES_IE_SIZE + 2]; // EID(1) + Length(1) + supported rates [12]
+ u8_t channel;
+ u16_t frequency;
+ u16_t atimWindow;
+ u8_t erp;
+ u8_t extSupportedRates[ZM_MAX_SUPP_RATES_IE_SIZE + 2]; // EID(1) + Length(1) + extended supported rates [12]
+ u8_t wpaIe[ZM_MAX_IE_SIZE + 2];
+ u8_t wscIe[ZM_MAX_WPS_IE_SIZE + 2];
+ u8_t rsnIe[ZM_MAX_IE_SIZE + 2];
+#ifdef ZM_ENABLE_CENC
+ u8_t cencIe[ZM_MAX_IE_SIZE + 2]; /* CENC */ /* half size because of memory exceed 64k boundary */
+#endif //ZM_ENABLE_CENC
+ u8_t securityType;
+ u8_t signalStrength;
+ u8_t signalQuality;
+ u16_t sortValue;
+ u8_t wmeSupport;
+ u8_t flag;
+ u8_t EnableHT;
+ u8_t enableHT40;
+ u8_t SG40;
+ u8_t extChOffset;
+ u8_t apCap; // bit0:11N AP
+ u16_t frameBodysize;
+ u8_t frameBody[ZM_MAX_PROBE_FRAME_BODY_SIZE];
+ u8_t countryInfo[ZM_MAX_COUNTRY_INFO_SIZE + 2];
+ u16_t athOwlAp;
+ u16_t marvelAp;
+ u16_t broadcomHTAp;
+ u32_t tick;
+ struct zsBssInfo* next;
+};
+
+struct zsBssList
+{
+ u8_t bssCount;
+ struct zsBssInfo* head;
+ struct zsBssInfo* tail;
+};
+
+struct zsBssListV1
+{
+ u8_t bssCount;
+ struct zsBssInfo bssInfo[ZM_MAX_BSS];
+};
+
+#define ZM_KEY_FLAG_GK 0x0001
+#define ZM_KEY_FLAG_PK 0X0002
+#define ZM_KEY_FLAG_AUTHENTICATOR 0x0004
+#define ZM_KEY_FLAG_INIT_IV 0x0008
+#define ZM_KEY_FLAG_DEFAULT_KEY 0x0010
+
+#ifdef ZM_ENABLE_CENC
+#define ZM_KEY_FLAG_CENC 0x0020
+#endif //ZM_ENABLE_CENC
+
+// Comment: For TKIP, key[0]~key[15] => TKIP key
+// key[16]~key[23] => Tx MIC key
+// key[24]~key[31] => Rx MIC key
+struct zsKeyInfo
+{
+ u8_t* key;
+ u8_t keyLength;
+ u8_t keyIndex;
+ u8_t* initIv;
+ u16_t flag;
+ u8_t vapId;
+ u16_t vapAddr[3];
+ u16_t* macAddr;
+};
+
+
+
+/*
+ * Channels are specified by frequency.
+ */
+typedef struct {
+ u16_t channel; /* setting in Mhz */
+ u32_t channelFlags; /* see below */
+ u8_t privFlags;
+ s8_t maxRegTxPower; /* max regulatory tx power in dBm */
+ s8_t maxTxPower; /* max true tx power in 0.25 dBm */
+ s8_t minTxPower; /* min true tx power in 0.25 dBm */
+} ZM_HAL_CHANNEL;
+
+struct zsRegulationTable
+{
+ u16_t regionCode;
+ u16_t CurChIndex;
+ u16_t allowChannelCnt;
+ ZM_HAL_CHANNEL allowChannel[60]; /* 2.4GHz: 14 channels, 5 GHz: 31 channels */
+};
+
+struct zsPartnerNotifyEvent
+{
+ u8_t bssid[6]; // The BSSID of IBSS
+ u8_t peerMacAddr[6]; // The MAC address of peer station
+};
+
+#define ZM_RC_TRAINED_BIT 0x1
+struct zsRcCell
+{
+ u32_t txCount;
+ u32_t failCount;
+ u8_t currentRate;
+ u8_t currentRateIndex;
+ u32_t probingTime;
+ u8_t operationRateSet[24];
+ u8_t operationRateCount;
+ u16_t rxRssi;
+ u8_t flag;
+ u32_t lasttxCount;
+ u32_t lastTime;
+};
+
+struct zsOppositeInfo
+{
+ u8_t macAddr[6];
+ struct zsRcCell rcCell;
+ u8_t valid; // This indicate if this opposite is still valid
+ u8_t aliveCounter;
+ u8_t pkInstalled;
+
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ /* For WPA2PSK ! */
+ u8_t wpaState;
+ u8_t camIdx;
+ u8_t encryMode;
+ u16_t iv16;
+ u32_t iv32;
+#endif
+};
+
+typedef void (*zfpIBSSIteratePeerStationCb)(
+ zdev_t* dev, struct zsOppositeInfo *peerInfo, void *ctx, u8_t index);
+
+typedef u16_t (*zfpStaRxSecurityCheckCb)(zdev_t* dev, zbuf_t* buf);
+
+
+/* Communication Tally data structure */
+struct zsCommTally
+{
+ u32_t txUnicastFrm; // 0 txUnicastFrames
+ u32_t txMulticastFrm; // 1 txMulticastFrames
+ u32_t txUnicastOctets; // 2 txUniOctets byte size
+ u32_t txMulticastOctets; // 3 txMultiOctets byte size
+ u32_t txFrmUpperNDIS; // 4
+ u32_t txFrmDrvMgt; // 5
+ u32_t RetryFailCnt; // 6
+ u32_t Hw_TotalTxFrm; // 7 Hardware total Tx Frame
+ u32_t Hw_RetryCnt; // 8 txMultipleRetriesFrames
+ u32_t Hw_UnderrunCnt; // 9
+
+ u32_t DriverRxFrmCnt; // 10
+ u32_t rxUnicastFrm; // 11 rxUnicastFrames
+ u32_t rxMulticastFrm; // 12rxMulticastFrames
+
+ u32_t NotifyNDISRxFrmCnt; // 14
+ u32_t rxUnicastOctets; // 15 rxUniOctets byte size
+ u32_t rxMulticastOctets; // 16 rxMultiOctets byte size
+ u32_t DriverDiscardedFrm; // 17 Discard by ValidateFrame
+ u32_t LessThanDataMinLen; // 18
+ u32_t GreaterThanMaxLen; // 19
+ u32_t DriverDiscardedFrmCauseByMulticastList;
+ u32_t DriverDiscardedFrmCauseByFrmCtrl;
+ u32_t rxNeedFrgFrm; // 22 need more frg frm
+ u32_t DriverRxMgtFrmCnt;
+ u32_t rxBroadcastFrm; // 24 Receive broadcast frame count
+ u32_t rxBroadcastOctets; // 25 Receive broadcast frame byte size
+ u32_t rx11bDataFrame; // 26 Measured quality 11b data frame count
+ u32_t rxOFDMDataFrame; // 27 Measured quality 11g data frame count
+
+
+ u32_t Hw_TotalRxFrm; // 28
+ u32_t Hw_CRC16Cnt; // 29 rxPLCPCRCErrCnt
+ u32_t Hw_CRC32Cnt; // 30 rxCRC32ErrCnt
+ u32_t Hw_DecrypErr_UNI; // 31
+ u32_t Hw_DecrypErr_Mul; // 32
+
+ u32_t Hw_RxFIFOOverrun; // 34
+ u32_t Hw_RxTimeOut; // 35
+ u32_t LossAP; // 36
+
+ u32_t Tx_MPDU; // 37
+ u32_t BA_Fail; // 38
+ u32_t Hw_Tx_AMPDU; // 39
+ u32_t Hw_Tx_MPDU; // 40
+
+ u32_t RateCtrlTxMPDU;
+ u32_t RateCtrlBAFail;
+
+ u32_t txQosDropCount[5]; //41 42 43 44 45
+
+ u32_t Hw_RxMPDU; // 46
+ u32_t Hw_RxDropMPDU; // 47
+ u32_t Hw_RxDelMPDU; // 48
+
+ u32_t Hw_RxPhyMiscError; // 49
+ u32_t Hw_RxPhyXRError; // 50
+ u32_t Hw_RxPhyOFDMError; // 51
+ u32_t Hw_RxPhyCCKError; // 52
+ u32_t Hw_RxPhyHTError; // 53
+ u32_t Hw_RxPhyTotalCount; // 54
+
+ u32_t swRxFragmentCount; // 55
+ u32_t swRxUnicastMicFailCount; // 56
+ u32_t swRxMulticastMicFailCount; // 57
+ u32_t swRxDropUnencryptedCount; // 58
+
+ u32_t txBroadcastFrm;
+ u32_t txBroadcastOctets;
+};
+
+/* Traffic Monitor Tally data structure */
+struct zsTrafTally
+{
+ u32_t rxDuplicate;
+ u32_t rxSrcIsOwnMac;
+ //u32_t rxDataFrameCount;
+ //u32_t rxDataByteCount;
+ //u32_t rxDataBytesIn1000ms;
+ //u32_t rxDataTmpFor1000ms;
+ //u32_t rxDataBytesIn2000ms;
+ //u32_t rxDataTmpFor2000ms;
+
+ //u32_t txDataFrameCount;
+ //u32_t txDataByteCount;
+ //u32_t txDataBytesIn1000ms;
+ //u32_t txDataTmpFor1000ms;
+ u32_t txDataBytesIn2000ms;
+ u32_t txDataTmpFor2000ms;
+};
+
+/* Hal rx packet moniter information */
+struct zsMonHalRxInfo
+{
+ u32_t currentRSSI[7];
+ u32_t currentRxEVM[14];
+ u32_t currentRxDataMT;
+ u32_t currentRxDataMCS;
+ u32_t currentRxDataBW;
+ u32_t currentRxDataSG;
+};
+
+struct zsTail
+{
+ u8_t SignalStrength1;
+ u8_t SignalStrength2;
+ u8_t SignalStrength3;
+ u8_t SignalQuality;
+ u8_t SAIndex;
+ u8_t DAIndex;
+ u8_t ErrorIndication;
+ u8_t RxMacStatus;
+};
+
+union zuTail
+{
+ struct zsTail Data;
+ u8_t Byte[8];
+};
+
+struct zsAdditionInfo
+{
+ u8_t PlcpHeader[12];
+ union zuTail Tail;
+};
+
+
+struct zsPmkidBssidInfo
+{
+ u16_t bssid[3];
+ u8_t pmkid[16];
+};
+
+struct zsPmkidInfo
+{
+ u32_t bssidCount;
+ struct zsPmkidBssidInfo bssidInfo[ZM_PMKID_MAX_BSS_CNT];
+};
+
+
+struct zsCbFuncTbl
+{
+ u16_t (*zfcbAuthNotify)(zdev_t* dev, u16_t* macAddr);
+ u16_t (*zfcbAsocNotify)(zdev_t* dev, u16_t* macAddr, u8_t* body,
+ u16_t bodySize, u16_t port);
+ u16_t (*zfcbDisAsocNotify)(zdev_t* dev, u8_t* macAddr, u16_t port);
+ u16_t (*zfcbApConnectNotify)(zdev_t* dev, u8_t* macAddr, u16_t port);
+ void (*zfcbConnectNotify)(zdev_t* dev, u16_t status, u16_t* bssid);
+ void (*zfcbScanNotify)(zdev_t* dev, struct zsScanResult* result);
+ void (*zfcbMicFailureNotify)(zdev_t* dev, u16_t* addr, u16_t status);
+ void (*zfcbApMicFailureNotify)(zdev_t* dev, u8_t* addr, zbuf_t* buf);
+ void (*zfcbIbssPartnerNotify)(zdev_t* dev, u16_t status,
+ struct zsPartnerNotifyEvent *event);
+ void (*zfcbMacAddressNotify)(zdev_t* dev, u8_t* addr);
+ void (*zfcbSendCompleteIndication)(zdev_t* dev, zbuf_t* buf);
+ void (*zfcbRecvEth)(zdev_t* dev, zbuf_t* buf, u16_t port);
+ void (*zfcbRecv80211)(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo);
+ void (*zfcbRestoreBufData)(zdev_t* dev, zbuf_t* buf);
+#ifdef ZM_ENABLE_CENC
+ u16_t (*zfcbCencAsocNotify)(zdev_t* dev, u16_t* macAddr, u8_t* body,
+ u16_t bodySize, u16_t port);
+#endif //ZM_ENABLE_CENC
+ u8_t (*zfcbClassifyTxPacket)(zdev_t* dev, zbuf_t* buf);
+
+ void (*zfcbHwWatchDogNotify)(zdev_t* dev);
+};
+
+extern void zfZeroMemory(u8_t* va, u16_t length);
+#define ZM_INIT_CB_FUNC_TABLE(p) zfZeroMemory((u8_t *)p, sizeof(struct zsCbFuncTbl));
+
+//extern struct zsWlanDev zgWlanDev;
+
+/* Initialize WLAN hardware and software, resource will be allocated */
+/* for WLAN operation, must be called first before other function. */
+extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl);
+
+/* WLAN hardware will be shutdown and all resource will be release */
+extern u16_t zfiWlanClose(zdev_t* dev);
+
+/* Enable/disable Wlan operation */
+extern u16_t zfiWlanEnable(zdev_t* dev);
+extern u16_t zfiWlanDisable(zdev_t* dev, u8_t ResetKeyCache);
+extern u16_t zfiWlanResume(zdev_t* dev, u8_t doReconn);
+extern u16_t zfiWlanSuspend(zdev_t* dev);
+
+/* Enable/disable ISR interrupt */
+extern u16_t zfiWlanInterruptEnable(zdev_t* dev);
+extern u16_t zfiWlanInterruptDisable(zdev_t* dev);
+
+/* Do WLAN site survey */
+extern u16_t zfiWlanScan(zdev_t* dev);
+
+/* Get WLAN stastics */
+extern u16_t zfiWlanGetStatistics(zdev_t* dev);
+
+/* Reset WLAN */
+extern u16_t zfiWlanReset(zdev_t* dev);
+
+/* Deauthenticate a STA */
+extern u16_t zfiWlanDeauth(zdev_t* dev, u16_t* macAddr, u16_t reason);
+
+extern u16_t zfiTxSendEth(zdev_t* dev, zbuf_t* buf, u16_t port);
+extern u8_t zfiIsTxQueueFull(zdev_t* dev);
+extern u16_t zfiTxSend80211Mgmt(zdev_t* dev, zbuf_t* buf, u16_t port);
+
+extern void zfiIsrPci(zdev_t* dev);
+
+extern u8_t zfiWlanIBSSGetPeerStationsCount(zdev_t* dev);
+extern u8_t zfiWlanIBSSIteratePeerStations(zdev_t* dev, u8_t numToIterate, zfpIBSSIteratePeerStationCb callback, void *ctx);
+extern void zfiWlanFlushAllQueuedBuffers(zdev_t* dev);
+
+/* coid.c */
+extern void zfiWlanQueryMacAddress(zdev_t* dev, u8_t* addr);
+
+extern u16_t zfiGlobalDataSize(zdev_t* dev);
+
+extern void zfiHeartBeat(zdev_t* dev);
+
+extern void zfiWlanSetWlanMode(zdev_t* dev, u8_t wlanMode);
+extern void zfiWlanSetAuthenticationMode(zdev_t* dev, u8_t authMode);
+extern void zfiWlanSetWepStatus(zdev_t* dev, u8_t wepStatus);
+extern void zfiWlanSetSSID(zdev_t* dev, u8_t* ssid, u8_t ssidLength);
+extern void zfiWlanSetFragThreshold(zdev_t* dev, u16_t fragThreshold);
+extern void zfiWlanSetRtsThreshold(zdev_t* dev, u16_t rtsThreshold);
+extern void zfiWlanSetFrequency(zdev_t* dev, u32_t frequency, u8_t bImmediate);
+extern void zfiWlanSetBssid(zdev_t* dev, u8_t* bssid);
+extern void zfiWlanSetBeaconInterval(zdev_t* dev, u16_t beaconInterval,
+ u8_t bImmediate);
+extern void zfiWlanSetDtimCount(zdev_t* dev, u8_t dtim);
+extern void zfiWlanSetAtimWindow(zdev_t* dev, u16_t atimWindow, u8_t bImmediate);
+extern void zfiWlanSetEncryMode(zdev_t* dev, u8_t encryMode);
+extern u8_t zfiWlanSetKey(zdev_t* dev, struct zsKeyInfo keyInfo);
+extern u8_t zfiWlanPSEUDOSetKey(zdev_t* dev, struct zsKeyInfo keyInfo);
+extern void zfiWlanSetPowerSaveMode(zdev_t* dev, u8_t mode);
+extern void zfiWlanQueryBssListV1(zdev_t* dev, struct zsBssListV1* bssListV1);
+extern void zfiWlanQueryBssList(zdev_t* dev, struct zsBssList* pBssList);
+extern void zfiWlanSetProtectionMode(zdev_t* dev, u8_t mode);
+extern void zfiWlanFlushBssList(zdev_t* dev);
+
+void zfiWlanDisableDfsChannel(zdev_t* dev, u8_t disableFlag);
+
+extern u8_t zfiWlanQueryWlanMode(zdev_t* dev);
+extern u16_t zfiWlanChannelToFrequency(zdev_t* dev, u8_t channel);
+extern u8_t zfiWlanFrequencyToChannel(zdev_t* dev, u16_t freq);
+
+#define ZM_WLAN_STATE_OPENED 0
+#define ZM_WLAN_STATE_ENABLED 1
+#define ZM_WLAN_STATE_DISABLED 2
+#define ZM_WLAN_STATE_CLOSEDED 3
+extern u8_t zfiWlanQueryAdapterState(zdev_t* dev);
+extern u8_t zfiWlanQueryAuthenticationMode(zdev_t* dev, u8_t bWrapper);
+extern u8_t zfiWlanQueryWepStatus(zdev_t* dev, u8_t bWrapper);
+extern void zfiWlanQuerySSID(zdev_t* dev, u8_t* ssid, u8_t* pSsidLength);
+extern u16_t zfiWlanQueryFragThreshold(zdev_t* dev);
+extern u16_t zfiWlanQueryRtsThreshold(zdev_t* dev);
+extern u32_t zfiWlanQueryFrequency(zdev_t* dev);
+extern u32_t zfiWlanQueryCurrentFrequency(zdev_t* dev, u8_t qmode);
+extern u32_t zfiWlanQueryFrequencyAttribute(zdev_t* dev, u32_t frequency);
+extern void zfiWlanQueryFrequencyHT(zdev_t* dev, u32_t *bandWidth, u32_t *extOffset);
+extern u8_t zfiWlanQueryCWMode(zdev_t* dev);
+extern u32_t zfiWlanQueryCWEnable(zdev_t* dev);
+extern void zfiWlanQueryBssid(zdev_t* dev, u8_t* bssid);
+extern u16_t zfiWlanQueryBeaconInterval(zdev_t* dev);
+extern u32_t zfiWlanQueryRxBeaconTotal(zdev_t* dev);
+extern u16_t zfiWlanQueryAtimWindow(zdev_t* dev);
+extern u8_t zfiWlanQueryEncryMode(zdev_t* dev);
+extern u16_t zfiWlanQueryCapability(zdev_t* dev);
+extern u16_t zfiWlanQueryAid(zdev_t* dev);
+extern void zfiWlanQuerySupportRate(zdev_t* dev, u8_t* rateArray, u8_t* pLength);
+extern void zfiWlanQueryExtSupportRate(zdev_t* dev, u8_t* rateArray, u8_t* pLength);
+extern void zfiWlanQueryRsnIe(zdev_t* dev, u8_t* ie, u8_t* pLength);
+extern void zfiWlanQueryWpaIe(zdev_t* dev, u8_t* ie, u8_t* pLength);
+extern u8_t zfiWlanQueryHTMode(zdev_t* dev);
+extern u8_t zfiWlanQueryBandWidth40(zdev_t* dev);
+extern u8_t zfiWlanQueryMulticastCipherAlgo(zdev_t *dev);
+extern u16_t zfiWlanQueryRegionCode(zdev_t* dev);
+extern void zfiWlanSetWpaIe(zdev_t* dev, u8_t* ie, u8_t Length);
+extern void zfiWlanSetWpaSupport(zdev_t* dev, u8_t WpaSupport);
+extern void zfiWlanCheckStaWpaIe(zdev_t* dev);
+extern void zfiWlanSetBasicRate(zdev_t* dev, u8_t bRateSet, u8_t gRateSet,
+ u32_t nRateSet);
+extern void zfiWlanSetBGMode(zdev_t* dev, u8_t mode);
+extern void zfiWlanSetpreambleType(zdev_t* dev, u8_t type);
+extern u8_t zfiWlanQuerypreambleType(zdev_t* dev);
+extern u8_t zfiWlanQueryPowerSaveMode(zdev_t* dev);
+extern void zfiWlanSetMacAddress(zdev_t* dev, u16_t* mac);
+extern u16_t zfiWlanSetTxRate(zdev_t* dev, u16_t rate);
+extern u32_t zfiWlanQueryTxRate(zdev_t* dev);
+extern void zfWlanUpdateRxRate(zdev_t* dev, struct zsAdditionInfo* addInfo);
+extern u32_t zfiWlanQueryRxRate(zdev_t* dev);
+extern u8_t zfiWlanSetPmkidInfo(zdev_t* dev, u16_t* bssid, u8_t* pmkid);
+extern u32_t zfiWlanQueryPmkidInfo(zdev_t* dev, u8_t* buf, u32_t len);
+extern void zfiWlanSetAllMulticast(zdev_t* dev, u32_t setting);
+extern void zfiWlanSetHTCtrl(zdev_t* dev, u32_t *setting, u32_t forceTxTPC);
+extern void zfiWlanQueryHTCtrl(zdev_t* dev, u32_t *setting, u32_t *forceTxTPC);
+extern void zfiWlanDbg(zdev_t* dev, u8_t setting);
+
+extern void zfiWlanResetTally(zdev_t* dev);
+extern void zfiWlanQueryTally(zdev_t* dev, struct zsCommTally *tally);
+extern void zfiWlanQueryTrafTally(zdev_t* dev, struct zsTrafTally *tally);
+extern void zfiWlanQueryMonHalRxInfo(zdev_t* dev, struct zsMonHalRxInfo *halRxInfo);
+
+extern u32_t zfiFWConfig(zdev_t* dev, u32_t size);
+
+extern void zfiDKEnable(zdev_t* dev, u32_t enable);
+
+extern void zfiWlanSetMulticastList(zdev_t* dev, u8_t size, u8_t* pList);
+extern void zfiWlanRemoveKey(zdev_t* dev, u8_t keyType, u8_t keyId);
+extern u8_t zfiWlanQueryIsPKInstalled(zdev_t *dev, u8_t *staMacAddr);
+extern u32_t zfiWlanQueryPacketTypePromiscuous(zdev_t* dev);
+extern void zfiWlanSetPacketTypePromiscuous(zdev_t* dev, u32_t setValue);
+extern void zfiSetChannelManagement(zdev_t* dev, u32_t setting);
+extern void zfiSetRifs(zdev_t* dev, u16_t setting);
+extern void zfiCheckRifs(zdev_t* dev);
+extern void zfiSetReorder(zdev_t* dev, u16_t value);
+extern void zfiSetSeqDebug(zdev_t* dev, u16_t value);
+
+extern u16_t zfiConfigWdsPort(zdev_t* dev, u8_t wdsPortId, u16_t flag, u16_t* wdsAddr,
+ u16_t encType, u32_t* wdsKey);
+extern void zfiWlanQueryRegulationTable(zdev_t* dev, struct zsRegulationTable* pEntry);
+extern void zfiWlanSetScanTimerPerChannel(zdev_t* dev, u16_t time);
+extern void zfiWlanSetAutoReconnect(zdev_t* dev, u8_t enable);
+extern u32_t zfiDebugCmd(zdev_t* dev, u32_t cmd, u32_t value);
+extern void zfiWlanSetProbingHiddenSsid(zdev_t* dev, u8_t* ssid, u8_t ssidLen,
+ u16_t entry);
+extern void zfiWlanSetDropUnencryptedPackets(zdev_t* dev, u8_t enable);
+extern void zfiWlanSetIBSSJoinOnly(zdev_t* dev, u8_t joinOnly);
+extern void zfiWlanSetDefaultKeyId(zdev_t* dev, u8_t keyId);
+extern void zfiWlanSetDisableProbingWithSsid(zdev_t* dev, u8_t mode);
+extern void zfiWlanQueryGSN(zdev_t* dev, u8_t *gsn, u16_t vapId);
+extern u16_t zfiStaAddIeWpaRsn(zdev_t* dev, zbuf_t* buf, u16_t offset, u8_t frameType);
+extern u8_t zfiWlanSetDot11DMode(zdev_t* dev, u8_t mode);
+extern u8_t zfiWlanSetDot11HDFSMode(zdev_t* dev, u8_t mode);
+extern u8_t zfiWlanSetDot11HTPCMode(zdev_t* dev, u8_t mode);
+extern u8_t zfiWlanSetAniMode(zdev_t* dev, u8_t mode);
+extern void zfiWlanSetStaWme(zdev_t* dev, u8_t enable, u8_t uapsdInfo);
+extern void zfiWlanSetApWme(zdev_t* dev, u8_t enable);
+extern u8_t zfiWlanQuerywmeEnable(zdev_t* dev);
+#ifdef ZM_OS_LINUX_FUNC
+extern void zfiWlanShowTally(zdev_t* dev);
+#endif
+#ifdef ZM_ENABLE_CENC
+/* CENC */
+extern u8_t zfiWlanSetCencPairwiseKey(zdev_t* dev, u8_t keyid, u32_t *txiv, u32_t *rxiv,
+ u8_t *key, u8_t *mic);
+extern u8_t zfiWlanSetCencGroupKey(zdev_t* dev, u8_t keyid, u32_t *rxiv,
+ u8_t *key, u8_t *mic);
+#endif //ZM_ENABLE_CENC
+extern void zfiWlanQuerySignalInfo(zdev_t* dev, u8_t *buffer);
+extern void zfiWlanQueryAdHocCreatedBssDesc(zdev_t* dev, struct zsBssInfo *pBssInfo);
+extern u8_t zfiWlanQueryAdHocIsCreator(zdev_t* dev);
+extern u32_t zfiWlanQuerySupportMode(zdev_t* dev);
+extern u32_t zfiWlanQueryTransmitPower(zdev_t* dev);
+extern void zfiWlanEnableLeapConfig(zdev_t* dev, u8_t leapEnabled);
+
+/* returned buffer allocated by driver core */
+extern void zfiRecvEthComplete(zdev_t* dev, zbuf_t* buf);
+
+extern void zfiRecv80211(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo);
+
+extern void zfiWlanSetMaxTxPower(zdev_t* dev, u8_t power2, u8_t power5);
+extern void zfiWlanQueryMaxTxPower(zdev_t* dev, u8_t *power2, u8_t *power5);
+extern void zfiWlanSetConnectMode(zdev_t* dev, u8_t mode);
+extern void zfiWlanSetSupportMode(zdev_t* dev, u32_t mode);
+extern void zfiWlanSetAdhocMode(zdev_t* dev, u32_t mode);
+extern u32_t zfiWlanQueryAdhocMode(zdev_t* dev, u8_t bWrapper);
+extern u8_t zfiWlanSetCountryIsoName(zdev_t* dev, u8_t *countryIsoName, u8_t length);
+extern const char* zfiWlanQueryCountryIsoName(zdev_t* dev);
+extern u8_t zfiWlanQueryregulatoryDomain(zdev_t* dev);
+extern u8_t zfiWlanQueryCCS(zdev_t* dev);
+extern void zfiWlanSetCCS(zdev_t* dev, u8_t mode);
+extern void zfiWlanSetRegulatory(zdev_t* dev, u8_t CCS, u16_t Code, u8_t bfirstChannel);
+extern const char* zfiHpGetisoNamefromregionCode(zdev_t* dev, u16_t regionCode);
+extern void zfiWlanSetLEDCtrlParam(zdev_t* dev, u8_t type, u8_t flag);
+extern u32_t zfiWlanQueryReceivedPacket(zdev_t* dev);
+extern void zfiWlanCheckSWEncryption(zdev_t* dev);
+extern u16_t zfiWlanQueryAllowChannels(zdev_t *dev, u16_t *channels);
+extern u16_t zfiWlanGetMulticastAddressCount(zdev_t* dev);
+extern void zfiWlanGetMulticastList(zdev_t* dev, u8_t* pMCList);
+extern void zfiWlanSetPacketFilter(zdev_t* dev, u32_t PacketFilter);
+extern u8_t zfiCompareWithMulticastListAddress(zdev_t* dev, u16_t* dstMacAddr);
+extern void zfiWlanSetSafeModeEnabled(zdev_t* dev, u8_t safeMode);
+extern void zfiWlanSetIBSSAdditionalIELength(zdev_t* dev, u32_t ibssAdditionalIESize, u8_t* ibssAdditionalIE);
+extern void zfiWlanSetXLinkMode(zdev_t* dev, u32_t setValue);
+
+/* hprw.c */
+extern u32_t zfiDbgWriteFlash(zdev_t* dev, u32_t addr, u32_t val);
+extern u32_t zfiDbgWriteReg(zdev_t* dev, u32_t addr, u32_t val);
+extern u32_t zfiDbgReadReg(zdev_t* dev, u32_t addr);
+
+extern u32_t zfiDbgWriteEeprom(zdev_t* dev, u32_t addr, u32_t val);
+extern u32_t zfiDbgBlockWriteEeprom(zdev_t* dev, u32_t addr, u32_t* buf);
+extern u32_t zfiDbgBlockWriteEeprom_v2(zdev_t* dev, u32_t addr, u32_t* buf, u32_t wrlen);
+
+extern u16_t zfiDbgChipEraseFlash(zdev_t *dev);
+extern u16_t zfiDbgProgramFlash(zdev_t *dev, u32_t offset, u32_t len, u32_t *data);
+extern u32_t zfiDbgGetFlashCheckSum(zdev_t *dev, u32_t addr, u32_t len);
+extern u32_t zfiDbgReadFlash(zdev_t *dev, u32_t addr, u32_t len);
+extern u32_t zfiDownloadFwSet(zdev_t *dev);
+
+extern u32_t zfiDbgDelayWriteReg(zdev_t* dev, u32_t addr, u32_t val);
+extern u32_t zfiDbgFlushDelayWrite(zdev_t* dev);
+
+extern u32_t zfiDbgSetIFSynthesizer(zdev_t* dev, u32_t value);
+extern u32_t zfiDbgReadTally(zdev_t* dev);
+
+extern u32_t zfiDbgQueryHwTxBusy(zdev_t* dev);
+
+extern u8_t zfiWlanGetDestAddrFromBuf(zdev_t *dev, zbuf_t *buf, u16_t *macAddr);
+
+extern u32_t zfiWlanQueryHwCapability(zdev_t* dev);
+
+extern void zfiWlanSetDynamicSIFSParam(zdev_t* dev, u8_t val);
+
+/***** End of section 2 *****/
+
+/***** section 3 performace evaluation *****/
+#ifdef ZM_ENABLE_PERFORMANCE_EVALUATION
+extern void zfiTxPerformanceMSDU(zdev_t* dev, u32_t tick);
+extern void zfiRxPerformanceMPDU(zdev_t* dev, zbuf_t* buf);
+extern void zfiRxPerformanceReg(zdev_t* dev, u32_t reg, u32_t rsp);
+#define ZM_PERFORMANCE_INIT(dev) zfiPerformanceInit(dev);
+#define ZM_PERFORMANCE_TX_MSDU(dev, tick) zfiTxPerformanceMSDU(dev, tick);
+#define ZM_PERFORMANCE_RX_MSDU(dev, tick) zfiRxPerformanceMSDU(dev, tick);
+#define ZM_PERFORMANCE_TX_MPDU(dev, tick) zfiTxPerformanceMPDU(dev, tick);
+#define ZM_PERFORMANCE_RX_MPDU(dev, buf) zfiRxPerformanceMPDU(dev, buf);
+#define ZM_PERFORMANCE_RX_SEQ(dev, buf) zfiRxPerformanceSeq(dev, buf);
+#define ZM_PERFORMANCE_REG(dev, reg, rsp) {if(cmd[1] == reg) zfiRxPerformanceReg(dev, reg, rsp);}
+#define ZM_PERFORMANCE_DUP(dev, buf1, buf2) zfiRxPerformanceDup(dev, buf1, buf2);
+#define ZM_PERFORMANCE_FREE(dev, buf) zfiRxPerformanceFree(dev, buf);
+#define ZM_PERFORMANCE_RX_AMSDU(dev, buf, len) zfiRxPerformanceAMSDU(dev, buf, len);
+#define ZM_PERFORMANCE_RX_FLUSH(dev) zfiRxPerformanceFlush(dev);
+#define ZM_PERFORMANCE_RX_CLEAR(dev) zfiRxPerformanceClear(dev);
+#define ZM_SEQ_DEBUG if (wd->seq_debug) DbgPrint
+#define ZM_PERFORMANCE_RX_REORDER(dev) zfiRxPerformanceReorder(dev);
+#else
+#define ZM_PERFORMANCE_INIT(dev)
+#define ZM_PERFORMANCE_TX_MSDU(dev, tick)
+#define ZM_PERFORMANCE_RX_MSDU(dev, tick)
+#define ZM_PERFORMANCE_TX_MPDU(dev, tick)
+#define ZM_PERFORMANCE_RX_MPDU(dev, buf)
+#define ZM_PERFORMANCE_RX_SEQ(dev, buf)
+#define ZM_PERFORMANCE_REG(dev, reg, rsp)
+#define ZM_PERFORMANCE_DUP(dev, buf1, buf2)
+#define ZM_PERFORMANCE_FREE(dev, buf)
+#define ZM_PERFORMANCE_RX_AMSDU(dev, buf, len)
+#define ZM_PERFORMANCE_RX_FLUSH(dev)
+#define ZM_PERFORMANCE_RX_CLEAR(dev)
+#define ZM_SEQ_DEBUG
+#define ZM_PERFORMANCE_RX_REORDER(dev)
+#endif
+/***** End of section 3 *****/
+#endif
diff --git a/drivers/staging/otus/80211core/pub_zfw.h b/drivers/staging/otus/80211core/pub_zfw.h
new file mode 100644
index 00000000000..2474bb7536e
--- /dev/null
+++ b/drivers/staging/otus/80211core/pub_zfw.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _PUB_ZFW_H
+#define _PUB_ZFW_H
+
+#include "../oal_dt.h"
+
+
+/* Buffer management */
+#ifdef ZM_ENABLE_BUFFER_DEBUG
+extern zbuf_t* zfwBufAllocateWithContext(zdev_t* dev, u16_t len, u8_t *functionName, ULONG line);
+#define zfwBufAllocate(dev, len) zfwBufAllocateWithContext(dev, len, (u8_t *)__func__, __LINE__)
+#else
+extern zbuf_t* zfwBufAllocate(zdev_t* dev, u16_t len);
+#endif
+extern void zfwBufFree(zdev_t* dev, zbuf_t* buf, u16_t errCode);
+extern u16_t zfwBufChain(zdev_t* dev, zbuf_t** head, zbuf_t* tail);
+extern u16_t zfwBufCopy(zdev_t* dev, zbuf_t* dst, zbuf_t* src);
+extern u16_t zfwBufSetSize(zdev_t* dev, zbuf_t* buf, u16_t size);
+extern u16_t zfwBufRemoveHead(zdev_t* dev, zbuf_t* buf, u16_t size);
+extern u16_t zfwBufGetSize(zdev_t* dev, zbuf_t* buf);
+extern void zfwCopyBufContext(zdev_t* dev, zbuf_t* source, zbuf_t* dest);
+
+/* Memory management */
+extern void* zfwMemAllocate(zdev_t* dev, u32_t size);
+extern void zfwMemFree(zdev_t* dev, void* mem, u32_t size);
+extern void zfwMemoryCopy(u8_t* dst, u8_t* src, u16_t length);
+extern void zfwMemoryMove(u8_t* dst, u8_t* src, u16_t length);
+extern void zfwZeroMemory(u8_t* va, u16_t length);
+extern u8_t zfwMemoryIsEqual(u8_t* m1, u8_t* m2, u16_t length);
+
+/* Others */
+extern void zfwSleep(zdev_t* dev, u32_t ms);
+extern u16_t zfwGetVapId(zdev_t* dev);
+extern u16_t zfwStaAddIeWpaRsn(zdev_t* dev, zbuf_t* buf, u16_t offset, u8_t frameType);
+extern u32_t zfwWaitForEvent(zdev_t *dev, u32_t event, u32_t timeout);
+extern void zfwSendEvent(zdev_t* dev);
+extern void zfwGetActiveScanDur(zdev_t* dev, u8_t* Dur );
+extern void zfwGetShowZeroLengthSSID(zdev_t* dev, u8_t* Dur );
+/* For debugging */
+extern void zfwDumpBuf(zdev_t* dev, zbuf_t* buf);
+extern void zfwDbgReadRegDone(zdev_t* dev, u32_t addr, u32_t val);
+/* For Evl */
+extern void zfwDbgDownloadFwInitDone(zdev_t* dev);
+extern void zfwDbgReadFlashDone(zdev_t* dev, u32_t addr, u32_t* rspdata, u32_t datalen);
+extern void zfwDbgGetFlashChkSumDone(zdev_t* dev, u32_t* rspdata);
+extern void zfwDbgProgrameFlashDone(zdev_t* dev);
+extern void zfwDbgProgrameFlashChkDone(zdev_t* dev);
+extern void zfwDbgWriteRegDone(zdev_t* dev, u32_t addr, u32_t val);
+extern void zfwDbgWriteEepromDone(zdev_t* dev, u32_t addr, u32_t val);
+extern void zfwDbgReadTallyDone(zdev_t* dev);
+extern void zfwWlanReadRegDone(zdev_t* dev, u32_t addr, u32_t val);
+extern void zfwWlanWriteRegDone(zdev_t* dev, u32_t addr, u32_t val);
+extern void zfwWlanReadTallyDone(zdev_t* dev);
+extern void zfwDbgQueryHwTxBusyDone(zdev_t* dev, u32_t val);
+extern u32_t zfwReadReg(zdev_t* dev, u32_t offset);
+extern u32_t zfwReadEeprom(zdev_t* dev, u32_t addr);
+
+/* Reserved for Vista, please return 0 */
+extern u8_t zfwGetPktEncExemptionActionType(zdev_t* dev, zbuf_t* buf);
+
+#ifdef ZM_ENABLE_CENC
+/* Reserved for CENC, please return 0 */
+extern u8_t zfwCencHandleBeaconProbrespon(zdev_t* dev, u8_t *pWIEc,
+ u8_t *pPeerSSIDc, u8_t *pPeerAddrc);
+#endif //ZM_ENABLE_CENC
+
+#ifdef ZM_HALPLUS_LOCK
+extern asmlinkage struct zsWlanDev *zfwGetWlanDev(zdev_t* dev);
+extern asmlinkage void zfwEnterCriticalSection(zdev_t* dev);
+extern asmlinkage void zfwLeaveCriticalSection(zdev_t* dev);
+extern asmlinkage u8_t zfwBufReadByte(zdev_t* dev, zbuf_t* buf, u16_t offset);
+extern asmlinkage u16_t zfwBufReadHalfWord(zdev_t* dev, zbuf_t* buf, u16_t offset);
+extern asmlinkage void zfwBufWriteByte(zdev_t* dev, zbuf_t* buf, u16_t offset, u8_t value);
+extern asmlinkage void zfwBufWriteHalfWord(zdev_t* dev, zbuf_t* buf, u16_t offset, u16_t value);
+extern asmlinkage u8_t *zfwGetBuffer(zdev_t* dev, zbuf_t* buf);
+#endif
+
+#endif //_PUB_ZFW_H
diff --git a/drivers/staging/otus/80211core/queue.c b/drivers/staging/otus/80211core/queue.c
new file mode 100644
index 00000000000..d294831b5c3
--- /dev/null
+++ b/drivers/staging/otus/80211core/queue.c
@@ -0,0 +1,303 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : queue.c */
+/* */
+/* Abstract */
+/* This module contains queue management functions. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/************************************************************************/
+#include "cprecomp.h"
+#include "queue.h"
+
+
+struct zsQueue* zfQueueCreate(zdev_t* dev, u16_t size)
+{
+ struct zsQueue* q;
+
+ if ((q = (struct zsQueue*)zfwMemAllocate(dev, sizeof(struct zsQueue)
+ + (sizeof(struct zsQueueCell)*(size-1)))) != NULL)
+ {
+ q->size = size;
+ q->sizeMask = size-1;
+ q->head = 0;
+ q->tail = 0;
+ }
+ return q;
+}
+
+void zfQueueDestroy(zdev_t* dev, struct zsQueue* q)
+{
+ u16_t size = sizeof(struct zsQueue) + (sizeof(struct zsQueueCell)*(q->size-1));
+
+ zfQueueFlush(dev, q);
+ zfwMemFree(dev, q, size);
+
+ return;
+}
+
+u16_t zfQueuePutNcs(zdev_t* dev, struct zsQueue* q, zbuf_t* buf, u32_t tick)
+{
+ u16_t ret = ZM_ERR_QUEUE_FULL;
+
+ zm_msg0_mm(ZM_LV_1, "zfQueuePutNcs()");
+
+ if (((q->tail+1)&q->sizeMask) != q->head)
+ {
+ q->cell[q->tail].buf = buf;
+ q->cell[q->tail].tick = tick;
+ q->tail = (q->tail+1) & q->sizeMask;
+ ret = ZM_SUCCESS;
+ }
+
+ return ret;
+}
+
+u16_t zfQueuePut(zdev_t* dev, struct zsQueue* q, zbuf_t* buf, u32_t tick)
+{
+ u16_t ret;
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ ret = zfQueuePutNcs(dev, q, buf, tick);
+
+ zmw_leave_critical_section(dev);
+
+ return ret;
+}
+
+zbuf_t* zfQueueGet(zdev_t* dev, struct zsQueue* q)
+{
+ zbuf_t* buf = NULL;
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ if (q->head != q->tail)
+ {
+ buf = q->cell[q->head].buf;
+ q->head = (q->head+1) & q->sizeMask;
+ }
+
+ zmw_leave_critical_section(dev);
+
+ return buf;
+}
+
+u16_t zfCompareDstwithBuf(zdev_t* dev, zbuf_t* buf, u8_t* addr)
+{
+ u16_t i;
+ u8_t dst[6];
+
+ for (i=0; i<6; i++)
+ {
+ dst[i] = zmw_buf_readb(dev, buf, i);
+ if (dst[i] != addr[i])
+ {
+ return 1+i;
+ }
+ }
+
+ return 0;
+}
+
+
+zbuf_t* zfQueueGetWithMac(zdev_t* dev, struct zsQueue* q, u8_t* addr, u8_t* mb)
+{
+ zbuf_t* buf;
+ zbuf_t* retBuf = NULL;
+ u16_t index, next;
+ zmw_declare_for_critical_section();
+
+ *mb = 0;
+
+ zmw_enter_critical_section(dev);
+
+ index = q->head;
+
+ while (1)
+ {
+ if (index != q->tail)
+ {
+ buf = q->cell[index].buf;
+
+ //if buf's detination address == input addr
+ if (zfCompareDstwithBuf(dev, buf, addr) == 0)
+ {
+ retBuf = buf;
+ //Get it, and trace the whole queue to calculate more bit
+ while ((next =((index+1)&q->sizeMask)) != q->tail)
+ {
+ q->cell[index].buf = q->cell[next].buf;
+ q->cell[index].tick = q->cell[next].tick;
+
+ if ((*mb == 0) && (zfCompareDstwithBuf(dev,
+ q->cell[next].buf, addr) == 0))
+ {
+ *mb = 1;
+ }
+
+ index = next;
+ }
+ q->tail = (q->tail-1) & q->sizeMask;
+
+ zmw_leave_critical_section(dev);
+ return retBuf;
+ }
+ index = (index + 1) & q->sizeMask;
+ } //if (index != q->tail)
+ else
+ {
+ break;
+ }
+ }
+
+ zmw_leave_critical_section(dev);
+
+ return retBuf;
+
+}
+
+void zfQueueFlush(zdev_t* dev, struct zsQueue* q)
+{
+ zbuf_t* buf;
+
+ while ((buf = zfQueueGet(dev, q)) != NULL)
+ {
+ zfwBufFree(dev, buf, 0);
+ }
+
+ return;
+}
+
+void zfQueueAge(zdev_t* dev, struct zsQueue* q, u32_t tick, u32_t msAge)
+{
+ zbuf_t* buf;
+ u32_t buftick;
+ zmw_declare_for_critical_section();
+
+ while (1)
+ {
+ buf = NULL;
+ zmw_enter_critical_section(dev);
+
+ if (q->head != q->tail)
+ {
+ buftick = q->cell[q->head].tick;
+ if (((tick - buftick)*ZM_MS_PER_TICK) > msAge)
+ {
+ buf = q->cell[q->head].buf;
+ q->head = (q->head+1) & q->sizeMask;
+ }
+ }
+
+ zmw_leave_critical_section(dev);
+
+ if (buf != NULL)
+ {
+ zm_msg0_mm(ZM_LV_0, "Age frame in queue!");
+ zfwBufFree(dev, buf, 0);
+ }
+ else
+ {
+ break;
+ }
+ }
+ return;
+}
+
+
+u8_t zfQueueRemovewithIndex(zdev_t* dev, struct zsQueue* q, u16_t index, u8_t* addr)
+{
+ u16_t next;
+ u8_t mb = 0;
+
+ //trace the whole queue to calculate more bit
+ while ((next =((index+1)&q->sizeMask)) != q->tail)
+ {
+ q->cell[index].buf = q->cell[next].buf;
+ q->cell[index].tick = q->cell[next].tick;
+
+ if ((mb == 0) && (zfCompareDstwithBuf(dev,
+ q->cell[next].buf, addr) == 0))
+ {
+ mb = 1;
+ }
+
+ index = next;
+ }
+ q->tail = (q->tail-1) & q->sizeMask;
+
+ return mb;
+
+}
+
+void zfQueueGenerateUapsdTim(zdev_t* dev, struct zsQueue* q,
+ u8_t* uniBitMap, u16_t* highestByte)
+{
+ zbuf_t* psBuf;
+ u8_t dst[6];
+ u16_t id, aid, index, i;
+ u16_t bitPosition;
+ u16_t bytePosition;
+ zmw_get_wlan_dev(dev);
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ index = q->head;
+
+ while (index != q->tail)
+ {
+ psBuf = q->cell[index].buf;
+ for (i=0; i<6; i++)
+ {
+ dst[i] = zmw_buf_readb(dev, psBuf, i);
+ }
+ /* TODO : use u8_t* fot MAC address */
+ if (((id = zfApFindSta(dev, (u16_t*)dst)) != 0xffff)
+ && (wd->ap.staTable[id].psMode != 0))
+ {
+ /* Calculate PVB only when all AC are delivery-enabled */
+ if ((wd->ap.staTable[id].qosInfo & 0xf) == 0xf)
+ {
+ aid = id + 1;
+ bitPosition = (1 << (aid & 0x7));
+ bytePosition = (aid >> 3);
+ uniBitMap[bytePosition] |= bitPosition;
+
+ if (bytePosition>*highestByte)
+ {
+ *highestByte = bytePosition;
+ }
+ }
+ index = (index+1) & q->sizeMask;
+ }
+ else
+ {
+ /* Free garbage UAPSD frame */
+ zfQueueRemovewithIndex(dev, q, index, dst);
+ zfwBufFree(dev, psBuf, 0);
+ }
+ }
+ zmw_leave_critical_section(dev);
+
+ return;
+}
diff --git a/drivers/staging/otus/80211core/queue.h b/drivers/staging/otus/80211core/queue.h
new file mode 100644
index 00000000000..4526b882bd0
--- /dev/null
+++ b/drivers/staging/otus/80211core/queue.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _QUEUE_H
+#define _QUEUE_H
+
+#include "../oal_dt.h"
+
+struct zsQueueCell
+{
+ u32_t tick;
+ zbuf_t* buf;
+};
+
+struct zsQueue
+{
+ u16_t size;
+ u16_t sizeMask;
+ u16_t head;
+ u16_t tail;
+ struct zsQueueCell cell[1];
+};
+
+#endif //#ifndef _QUEUE_H
diff --git a/drivers/staging/otus/80211core/ratectrl.c b/drivers/staging/otus/80211core/ratectrl.c
new file mode 100644
index 00000000000..a43104cd7f5
--- /dev/null
+++ b/drivers/staging/otus/80211core/ratectrl.c
@@ -0,0 +1,874 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "cprecomp.h"
+#include "ratectrl.h"
+
+const u32_t zcRateToPhyCtrl[] =
+ {
+ /* 1M, 2M, 5M, 11M , 0 1 2 3*/
+ 0x00000, 0x10000, 0x20000, 0x30000,
+ /* 6M 9M 12M 18M , 4 5 6 7*/
+ 0xb0001, 0xf0001, 0xa0001, 0xe0001,
+ /* 24M 36M 48M 54M , 8 9 10 11*/
+ 0x90001, 0xd0001, 0x80001, 0xc0001,
+ /* MCS0 MCS1 MCS2 MCS3, 12 13 14 15*/
+ 0x00002, 0x10002, 0x20002, 0x30002,
+ /* MCS4 MCS5 MCS6 MCS7, 16 17 18 19*/
+ 0x40002, 0x50002, 0x60002, 0x70002,
+ /* MCS8 MCS9 MCS10 MCS11, 20 21 22 23*/
+ 0x80002, 0x90002, 0xa0002, 0xb0002,
+ /* MCS12 MCS13 MCS14 MCS15, 24 25 26 27*/
+ 0xc0002, 0xd0002, 0xe0002, 0xf0002,
+ /* MCS14SG, MCS15SG MCS7SG , 28 29, 30*/
+ 0x800e0002, 0x800f0002, 0x80070002
+ };
+
+
+const u8_t zcHtRateTable[15][4] =
+ { /*[5G 20MHz] [5G 40MHz] [2.4G 20MHz] [2.4G 40MHz]*/
+ { 4, 4, 0, 0}, /*OFDM6M OFDM6M CCK1M CCK1M */
+ { 5, 5, 1, 1}, /*OFDM9M OFDM9M CCK2M CCK2M */
+ { 13, 12, 2, 2}, /*MCS1 MCS0 CCK5M CCK5M */
+ { 14, 13, 3, 3}, /*MCS2 MCS1 CCK11M CCK11M */
+ { 15, 14, 13, 12}, /*MCS3 MCS2 MCS1 MCS0 */
+ { 16, 15, 14, 13}, /*MCS4 MCS3 MCS2 MCS1 */
+ { 23, 16, 15, 14}, /*MCS11 MCS4 MCS3 MCS2 */
+ { 24, 23, 16, 15}, /*MCS12 MCS11 MCS4 MCS3 */
+ { 25, 24, 23, 16}, /*MCS13 MCS12 MCS11 MCS4 */
+ { 26, 25, 24, 23}, /*MCS14 MCS13 MCS12 MCS11 */
+ { 27, 26, 25, 24}, /*MCS15 MCS14 MCS13 MCS12 */
+ { 0, 27, 26, 25}, /*0 MCS15 MCS14 MCS13 */
+ { 0, 29, 27, 26}, /*0 MCS15SG MCS15 MCS14 */
+ { 0, 0, 0, 28}, /*0 0 0 MCS14SG*/
+ { 0, 0, 0, 29} /*0 0 0 MCS15SG*/
+ };
+
+const u8_t zcHtOneTxStreamRateTable[15][4] =
+ { /*[5G 20MHz] [5G 40MHz] [2.4G 20MHz] [2.4G 40MHz]*/
+ { 4, 4, 0, 0}, /*OFDM6M OFDM6M CCK1M CCK1M */
+ { 5, 5, 1, 1}, /*OFDM9M OFDM9M CCK2M CCK2M */
+ { 13, 12, 2, 2}, /*MCS1 MCS0 CCK5M CCK5M */
+ { 14, 13, 3, 3}, /*MCS2 MCS1 CCK11M CCK11M */
+ { 15, 14, 13, 12}, /*MCS3 MCS2 MCS1 MCS0 */
+ { 16, 15, 14, 13}, /*MCS4 MCS3 MCS2 MCS1 */
+ { 17, 16, 15, 14}, /*MCS5 MCS4 MCS3 MCS2 */
+ { 18, 17, 16, 15}, /*MCS6 MCS5 MCS4 MCS3 */
+ { 19, 18, 17, 16}, /*MCS7 MCS6 MCS5 MCS4 */
+ { 0, 19, 18, 17}, /*0 MCS7 MCS6 MCS5 */
+ { 0, 30, 19, 18}, /*0 MCS7SG MCS7 MCS6 */
+ { 0, 0, 0, 19}, /*0 0 0 MCS7 */
+ { 0, 0, 0, 30}, /*0 0 0 MCS7SG */
+ { 0, 0, 0, 0 }, /*0 0 0 0 */
+ { 0, 0, 0, 0 } /*0 0 0 0 */
+ };
+
+const u16_t zcRate[] =
+ {
+ 1, 2, 5, 11, /* 1M, 2M, 5M, 11M , 0 1 2 3*/
+ 6, 9, 12, 18, /* 6M 9M 12M 18M , 4 5 6 7*/
+ 24, 36, 48, 54, /* 24M 36M 48M 54M , 8 9 10 11*/
+ 13, 27, 40, 54, /* MCS0 MCS1 MCS2 MCS3 , 12 13 14 15*/
+ 81, 108, 121, 135, /* MCS4 MCS5 MCS6 MCS7 , 16 17 18 19*/
+ 27, 54, 81, 108, /* MCS8 MCS9 MCS10 MCS11 , 20 21 22 23*/
+ 162, 216, 243, 270, /* MCS12 MCS13 MCS14 MCS15 , 24 25 26 27*/
+ 270, 300, 150 /* MCS14SG, MCS15SG, MCS7SG , 28 29 30*/
+ };
+
+const u16_t PERThreshold[] =
+ {
+ 100, 50, 50, 50, /* 1M, 2M, 5M, 11M , 0 1 2 3*/
+ 50, 50, 30, 30, /* 6M 9M 12M 18M , 4 5 6 7*/
+ 25, 25, 25, 20, /* 24M 36M 48M 54M , 8 9 10 11*/
+ 50, 50, 50, 40, /* MCS0 MCS1 MCS2 MCS3 , 12 13 14 15*/
+ 30, 30, 30, 30, /* MCS4 MCS5 MCS6 MCS7 , 16 17 18 19*/
+ 30, 30, 25, 25, /* MCS8 MCS9 MCS10 MCS11 , 20 21 22 23*/
+ 25, 25, 15, 15, /* MCS12 MCS13 MCS14 MCS15 , 24 25 26 27*/
+ 15, 15, 10 /* MCS14SG, MCS15SG , 28 29*/
+ };
+
+const u16_t FailDiff[] =
+ {
+ 40, 46, 40, 0, /* 1M, 2M, 5M, 11M , 0 1 2 3*/
+ 24, 17, 22, 16, /* 6M 9M 12M 18M , 4 5 6 7*/
+ 19, 13, 5, 0, /* 24M 36M 48M 54M , 8 9 10 11*/
+ 36, 22, 15, 19, /* MCS0 MCS1 MCS2 MCS3 , 12 13 14 15*/
+ 12, 5, 4, 7, /* MCS4 MCS5 MCS6 MCS7 , 16 17 18 19*/
+ 0, 0, 0, 0, /* MCS8 MCS9 MCS10 MCS11 , 20 21 22 23*/
+ 9, 4, 3, 3, /* MCS12 MCS13 MCS14 MCS15 , 24 25 26 27*/
+ 3, 0, 0 /* MCS14SG, MCS15SG , 28 29*/
+ };
+
+
+#ifdef ZM_ENABLE_BA_RATECTRL
+u32_t TxMPDU[29];
+u32_t BAFail[29];
+u32_t BAPER[29];
+const u16_t BADiff[] =
+ {
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 361, 220, 151, 187,
+ 122, 48, 41, 65,
+ 0, 0, 0, 0,
+ 88, 33, 27, 25,
+ 0
+ };
+#endif
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfRateCtrlInitCell */
+/* Initialize rate control cell. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* type : 0=>11b, 1=>11a/g, 2=>11n, 3=>11n one Tx stream */
+/* gBand : 1=>2.4G, 0=>5G */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2007.2 */
+/* */
+/************************************************************************/
+void zfRateCtrlInitCell(zdev_t* dev, struct zsRcCell* rcCell, u8_t type,
+ u8_t gBand, u8_t SG40)
+{
+ u8_t i;
+ u8_t maxrate;
+ zmw_get_wlan_dev(dev);
+
+ if (SG40) SG40 = 1;
+
+ if (gBand != 0)
+ {
+ if (type == 1) //11g
+ {
+ for (i=0; i<4; i++) //1M 2M 5M 11M
+ {
+ rcCell->operationRateSet[i] = (u8_t)i;
+ }
+ for (i=4; i<10; i++) //12M 18M 24M 36M 48M 54M
+ {
+ rcCell->operationRateSet[i] = 2+i;
+ }
+ rcCell->operationRateCount = 10;
+ rcCell->currentRateIndex = 5; //18M
+ }
+ else if (type == 2) //11ng
+ {
+ if (wd->wlanMode == ZM_MODE_AP) //AP 11ng 40M
+ {
+ for (i=0; i<15; i++)
+ {
+ rcCell->operationRateSet[i] = zcHtRateTable[i][3];
+ }
+ if(!SG40) rcCell->operationRateSet[13] = 27;
+ rcCell->operationRateCount = 14+SG40;
+ rcCell->currentRateIndex = 10;
+ }
+ else //STA
+ {
+ if (wd->sta.htCtrlBandwidth == ZM_BANDWIDTH_40MHZ) //11ng 40M
+ {
+ for (i=0; i<15; i++)
+ {
+ rcCell->operationRateSet[i] = zcHtRateTable[i][3];
+ }
+ if(!SG40) rcCell->operationRateSet[13] = 27;
+ rcCell->operationRateCount = 14+SG40;
+ rcCell->currentRateIndex = 10;
+ }
+ else //11ng 20M
+ {
+ for (i=0; i<13; i++)
+ {
+ rcCell->operationRateSet[i] = zcHtRateTable[i][2];
+ }
+ rcCell->operationRateCount = 13;
+ rcCell->currentRateIndex = 9;
+ }
+ }
+ }
+ else if (type == 3) //11ng one Tx stream
+ {
+ if (wd->sta.htCtrlBandwidth == ZM_BANDWIDTH_40MHZ) //11ng 40M one Tx stream
+ {
+ if(SG40 != 0)
+ {
+ maxrate = 13;
+ }
+ else
+ {
+ maxrate = 12;
+ }
+ for (i=0; i<maxrate; i++)
+ {
+ rcCell->operationRateSet[i] = zcHtOneTxStreamRateTable[i][3];
+ }
+ rcCell->operationRateCount = i;
+ rcCell->currentRateIndex = ((i+1)*3)/4;
+ }
+ else //11ng 20M
+ {
+ for (i=0; i<11; i++)
+ {
+ rcCell->operationRateSet[i] = zcHtOneTxStreamRateTable[i][2];
+ }
+ rcCell->operationRateCount = i;
+ rcCell->currentRateIndex = ((i+1)*3)/4;
+ }
+ }
+ else //if (type == 0) //11b
+ {
+ for (i=0; i<4; i++)
+ {
+ rcCell->operationRateSet[i] = (u8_t)i;
+ }
+ rcCell->operationRateCount = 4;
+ rcCell->currentRateIndex = rcCell->operationRateCount-1;
+ }
+ }
+ else
+ {
+ if (type == 2) //11na
+ {
+ if (wd->wlanMode == ZM_MODE_AP) //AP 11na 40M
+ {
+ for (i=0; i<(12+SG40); i++)
+ {
+ rcCell->operationRateSet[i] = zcHtRateTable[i][1];
+ }
+ rcCell->operationRateCount = 12+SG40;
+ rcCell->currentRateIndex = 8;
+ }
+ else //STA
+ {
+ if (wd->sta.htCtrlBandwidth == ZM_BANDWIDTH_40MHZ) //11na 40M
+ {
+ for (i=0; i<(12+SG40); i++)
+ {
+ rcCell->operationRateSet[i] = zcHtRateTable[i][1];
+ }
+ rcCell->operationRateCount = 12+SG40;
+ rcCell->currentRateIndex = 8;
+ }
+ else //11na 20M
+ {
+ for (i=0; i<11; i++)
+ {
+ rcCell->operationRateSet[i] = zcHtRateTable[i][0];
+ }
+ rcCell->operationRateCount = 11;
+ rcCell->currentRateIndex = 7;
+ }
+ }
+ }
+ else if (type == 3) //11na one Tx stream
+ {
+ if (wd->sta.htCtrlBandwidth == ZM_BANDWIDTH_40MHZ) //11na 40M one Tx stream
+ {
+ if(SG40 != 0)
+ {
+ maxrate = 11;
+ }
+ else
+ {
+ maxrate = 10;
+ }
+ for (i=0; i<maxrate; i++)
+ {
+ rcCell->operationRateSet[i] = zcHtOneTxStreamRateTable[i][1];
+ }
+ rcCell->operationRateCount = i;
+ rcCell->currentRateIndex = ((i+1)*3)/4;
+ }
+ else //11ng 20M
+ {
+ for (i=0; i<9; i++)
+ {
+ rcCell->operationRateSet[i] = zcHtOneTxStreamRateTable[i][0];
+ }
+ rcCell->operationRateCount = i;
+ rcCell->currentRateIndex = ((i+1)*3)/4;
+ }
+ }
+ else //if (type == 1) //11a
+ {
+ for (i=0; i<8; i++) //6M 9M 12M 18M 24M 36M 48M 54M
+ {
+ rcCell->operationRateSet[i] = i+4;
+ }
+ rcCell->operationRateCount = 8;
+ rcCell->currentRateIndex = 4; //24M
+ }
+ }
+
+ rcCell->flag = 0;
+ rcCell->txCount = 0;
+ rcCell->failCount = 0;
+ rcCell->currentRate = rcCell->operationRateSet[rcCell->currentRateIndex];
+ rcCell->lasttxCount = 0;
+ rcCell->lastTime = wd->tick;
+ rcCell->probingTime = wd->tick;
+ for (i=0; i<ZM_RATE_TABLE_SIZE; i++) {
+ wd->PER[i] = 0;
+ wd->txMPDU[i] = wd->txFail[i] = 0;
+ }
+ wd->probeCount = 0;
+ wd->probeInterval = 0;
+#ifdef ZM_ENABLE_BA_RATECTRL
+ for (i=0; i<29; i++) {
+ TxMPDU[i]=0;
+ BAFail[i]=0;
+ BAPER[i]=0;
+ }
+#endif
+ return;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfRateCtrlGetHigherRate */
+/* Get a higher rate. */
+/* */
+/* INPUTS */
+/* rcCell : rate control cell */
+/* */
+/* OUTPUTS */
+/* rate */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2007.2 */
+/* */
+/************************************************************************/
+u8_t zfRateCtrlGetHigherRate(struct zsRcCell* rcCell)
+{
+ u8_t rateIndex;
+
+ rateIndex = rcCell->currentRateIndex
+ + (((rcCell->currentRateIndex+1) < rcCell->operationRateCount)?1:0);
+ return rcCell->operationRateSet[rateIndex];
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfRateCtrlNextLowerRate */
+/* Get a lower rate. */
+/* */
+/* INPUTS */
+/* rcCell : rate control cell */
+/* */
+/* OUTPUTS */
+/* rate */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2007.2 */
+/* */
+/************************************************************************/
+u8_t zfRateCtrlNextLowerRate(zdev_t* dev, struct zsRcCell* rcCell)
+{
+ zmw_get_wlan_dev(dev);
+ if (rcCell->currentRateIndex > 0)
+ {
+ rcCell->currentRateIndex--;
+ rcCell->currentRate = rcCell->operationRateSet[rcCell->currentRateIndex];
+ }
+ zm_msg1_tx(ZM_LV_0, "Lower Tx Rate=", rcCell->currentRate);
+ //DbgPrint("Lower Tx Rate=%d", rcCell->currentRate);
+ rcCell->failCount = rcCell->txCount = 0;
+ rcCell->lasttxCount = 0;
+ rcCell->lastTime = wd->tick;
+ return rcCell->currentRate;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfRateCtrlRateDiff */
+/* Rate difference. */
+/* */
+/* INPUTS */
+/* rcCell : rate control cell */
+/* retryRate : retry rate */
+/* */
+/* OUTPUTS */
+/* rate difference */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2007.2 */
+/* */
+/************************************************************************/
+u8_t zfRateCtrlRateDiff(struct zsRcCell* rcCell, u8_t retryRate)
+{
+ u16_t i;
+
+ /* Find retryRate in operationRateSet[] */
+ for (i=0; i<rcCell->operationRateCount; i++)
+ {
+ if (retryRate == rcCell->operationRateSet[i])
+ {
+ if (i < rcCell->currentRateIndex)
+ {
+ return ((rcCell->currentRateIndex - i)+1)>>1;
+ }
+ else if (i == rcCell->currentRateIndex == 0)
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ }
+ /* TODO : retry rate not in operation rate set */
+ zm_msg1_tx(ZM_LV_0, "Not in operation rate set:", retryRate);
+ return 1;
+
+}
+
+u32_t zfRateCtrlUDPTP(zdev_t* dev, u16_t Rate, u32_t PER) {
+ if ((PER < 100) && (Rate > 0) && PER)
+ return 1168000/(((12304/Rate)+197)*(100+100*PER/(100-PER)));
+ else
+ return 0;
+}
+
+u8_t zfRateCtrlFindMaxUDPTP(zdev_t* dev, struct zsRcCell* rcCell) {
+ u8_t i, maxIndex=0, rateIndex;
+ u32_t max=0, UDPThroughput;
+
+ zmw_get_wlan_dev(dev);
+
+ rateIndex = zm_agg_min(rcCell->currentRateIndex+3, rcCell->operationRateCount-1);
+ for (i=rcCell->currentRateIndex; i < rateIndex; i++) {
+ UDPThroughput = zfRateCtrlUDPTP(dev, zcRate[rcCell->operationRateSet[i]],
+ wd->PER[rcCell->operationRateSet[i]]);
+ if (max < UDPThroughput) {
+ max = UDPThroughput;
+ maxIndex = i;
+ }
+ }
+
+ return rcCell->operationRateSet[maxIndex];
+}
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfRateCtrlGetTxRate */
+/* Get transmission rate. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* rcCell : rate control cell */
+/* probing : rate probing flag */
+/* */
+/* OUTPUTS */
+/* Tx rate */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2007.2 */
+/* */
+/************************************************************************/
+u16_t zfRateCtrlGetTxRate(zdev_t* dev, struct zsRcCell* rcCell, u16_t* probing)
+{
+ u8_t newRate, highRate;
+ zmw_get_wlan_dev(dev);
+
+ zm_msg1_tx(ZM_LV_3, "txCount=", rcCell->txCount);
+ zm_msg1_tx(ZM_LV_3, "probingTime=", rcCell->probingTime);
+ zm_msg1_tx(ZM_LV_3, "tick=", wd->tick);
+ *probing = 0;
+ newRate = rcCell->currentRate;
+
+ if (wd->probeCount && (wd->probeCount < wd->success_probing))
+ {
+ if (wd->probeInterval < 50)
+ {
+ wd->probeInterval++;
+ }
+ else
+ {
+ wd->probeInterval++;
+ if (wd->probeInterval > 52) //probe 51, 52, 53 three packets every 50 packets
+ {
+ wd->probeInterval = 0;
+ }
+ newRate=zfRateCtrlGetHigherRate(rcCell);
+ *probing = 1;
+ wd->probeCount++;
+ rcCell->probingTime = wd->tick;
+ }
+ }
+ /* Accumulate at least 1000ms and 8 packets or Accumulate over 1K packets */
+ else if ((((wd->tick - rcCell->probingTime) > (ZM_RATE_CTRL_PROBING_INTERVAL_MS/ZM_MS_PER_TICK))
+ && (rcCell->txCount >= ZM_RATE_CTRL_MIN_PROBING_PACKET))
+ || (rcCell->txCount >= 1000))
+ {
+#ifndef ZM_DISABLE_RATE_CTRL
+ /* PER = fail/total */
+ wd->probeCount = 0;
+ wd->probeSuccessCount = 0;
+ if (wd->txMPDU[rcCell->currentRate] != 0) {
+ wd->PER[rcCell->currentRate] = zm_agg_min(100,
+ (wd->txFail[rcCell->currentRate]*100)/wd->txMPDU[rcCell->currentRate]);
+ if (!wd->PER[rcCell->currentRate]) wd->PER[rcCell->currentRate] ++;
+ }
+
+ /* if PER < threshold, do rate probing, return probing rate */
+ if ((wd->PER[rcCell->currentRate] <= (ZM_RATE_PROBING_THRESHOLD+15)) ||
+ ((rcCell->currentRate <= 16) &&
+ ((wd->PER[rcCell->currentRate]/2) <= ZM_RATE_PROBING_THRESHOLD)))
+ {
+ if ((newRate=zfRateCtrlGetHigherRate(rcCell)) != rcCell->currentRate)
+ {
+ *probing = 1;
+ wd->probeCount++;
+ wd->probeInterval = 0;
+ wd->success_probing =
+ (rcCell->currentRate <= 16)? (ZM_RATE_SUCCESS_PROBING/2) : ZM_RATE_SUCCESS_PROBING;
+ //DbgPrint("Start Probing");
+ zm_msg1_tx(ZM_LV_0, "Probing Rate=", newRate);
+ }
+ }
+#endif
+
+ zm_msg0_tx(ZM_LV_1, "Diminish counter");
+ rcCell->failCount = rcCell->failCount>>1;
+ rcCell->txCount = rcCell->txCount>>1;
+ wd->txFail[rcCell->currentRate] = wd->txFail[rcCell->currentRate] >> 1;
+ wd->txMPDU[rcCell->currentRate] = wd->txMPDU[rcCell->currentRate] >> 1;
+
+
+ if (rcCell->currentRate > 15) {
+ highRate = zfRateCtrlGetHigherRate(rcCell);
+ if ((highRate != rcCell->currentRate) && wd->PER[highRate] &&
+ ((wd->PER[rcCell->currentRate] + FailDiff[rcCell->currentRate]) >
+ wd->PER[highRate])) {
+ //DbgPrint("PER compare force raise rate to %d", highRate);
+ wd->probeSuccessCount = wd->probeCount = ZM_RATE_SUCCESS_PROBING;
+ zfRateCtrlTxSuccessEvent(dev, rcCell, highRate);
+ }
+ }
+ else {
+ highRate = zfRateCtrlFindMaxUDPTP(dev, rcCell);
+ if (rcCell->currentRate < highRate) {
+ //DbgPrint("UDP Throughput compare force raise rate to %d", highRate);
+ wd->probeSuccessCount = wd->probeCount = ZM_RATE_SUCCESS_PROBING;
+ zfRateCtrlTxSuccessEvent(dev, rcCell, highRate);
+ }
+ }
+ rcCell->probingTime = wd->tick;
+ }
+
+ if( (wd->tick > 1000)
+ && ((wd->tick - rcCell->lastTime) > 3840) )
+ {
+ if (rcCell->lasttxCount < 70)
+ {
+ rcCell->failCount = rcCell->failCount>>1;
+ rcCell->txCount = rcCell->txCount>>1;
+ wd->txFail[rcCell->currentRate] = wd->txFail[rcCell->currentRate] >> 1;
+ wd->txMPDU[rcCell->currentRate] = wd->txMPDU[rcCell->currentRate] >> 1;
+
+ rcCell->failCount = (rcCell->failCount < rcCell->txCount)?
+ rcCell->failCount : rcCell->txCount;
+ wd->txFail[rcCell->currentRate] = (wd->txFail[rcCell->currentRate] < wd->txMPDU[rcCell->currentRate])?
+ wd->txFail[rcCell->currentRate] : wd->txMPDU[rcCell->currentRate];
+ }
+
+ rcCell->lastTime = wd->tick;
+ rcCell->lasttxCount = 0;
+ }
+
+ rcCell->txCount++;
+ rcCell->lasttxCount++;
+ wd->txMPDU[rcCell->currentRate]++;
+ zm_msg1_tx(ZM_LV_1, "Get Tx Rate=", newRate);
+ return newRate;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfRateCtrlTxFailEvent */
+/* Tx fail event. Calculate PER and lower Tx rate if under */
+/* PER under threshold. */
+/* */
+/* INPUTS */
+/* rcCell : rate control cell */
+/* retryRate : retry rate */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2007.2 */
+/* */
+/************************************************************************/
+void zfRateCtrlTxFailEvent(zdev_t* dev, struct zsRcCell* rcCell, u8_t aggRate, u32_t retryRate)
+{
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+#ifndef ZM_DISABLE_RATE_CTRL
+ //DbgPrint("aggRate=%d, retryRate=%d", aggRate, retryRate);
+ if (aggRate && (aggRate != rcCell->currentRate)) {
+ wd->txFail[aggRate] += retryRate;
+ return;
+ }
+
+ if (!aggRate) {
+ retryRate = (zfRateCtrlRateDiff(rcCell, (u8_t)retryRate)+1)>>1;
+ if (rcCell->currentRate <12) //legacy rate
+ {
+ retryRate*=2;
+ }
+ }
+ rcCell->failCount += retryRate;
+ wd->txFail[rcCell->currentRate] += retryRate;
+
+ //DbgPrint("failCount=%d", rcCell->failCount);
+ if (rcCell->failCount > ZM_MIN_RATE_FAIL_COUNT)
+ {
+ if (wd->txMPDU[rcCell->currentRate] != 0) {
+ wd->PER[rcCell->currentRate] = zm_agg_min(100,
+ (wd->txFail[rcCell->currentRate]*100)/wd->txMPDU[rcCell->currentRate]);
+ if (!wd->PER[rcCell->currentRate]) wd->PER[rcCell->currentRate] ++;
+ }
+ //zm_msg1_tx(ZM_LV_1, "PER=", per);
+ //DbgPrint("PER=%d, txFail=%d, txMPDU=%d", wd->PER[rcCell->currentRate], wd->txFail[rcCell->currentRate], wd->txMPDU[rcCell->currentRate]);
+ if (wd->PER[rcCell->currentRate] > PERThreshold[rcCell->currentRate])
+ {
+ /* Lower Tx Rate if PER < THRESHOLD */
+ zfRateCtrlNextLowerRate(dev, rcCell);
+ rcCell->flag |= ZM_RC_TRAINED_BIT;
+
+ // Resolve compatibility problem with Marvell
+ if(rcCell->currentRate == 15)
+ {
+ zmw_leave_critical_section(dev);
+ zfHpSetAggPktNum(dev, 8);
+ zmw_enter_critical_section(dev);
+ }
+
+ wd->txFail[rcCell->currentRate] = wd->txFail[rcCell->currentRate] >> 1;
+ wd->txMPDU[rcCell->currentRate] = wd->txMPDU[rcCell->currentRate] >> 1;
+
+ wd->probeCount = wd->probeSuccessCount = 0;
+ }
+ }
+
+#endif
+ return;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfRateCtrlTxSuccessEvent */
+/* Tx success event. Raise Tx rate because rate probing success. */
+/* */
+/* INPUTS */
+/* rcCell : rate control cell */
+/* successRate : success rate */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2007.2 */
+/* */
+/************************************************************************/
+void zfRateCtrlTxSuccessEvent(zdev_t* dev, struct zsRcCell* rcCell, u8_t successRate)
+{
+ /* Raise Tx Rate */
+ u16_t i, PERProbe;
+ u16_t pcount;
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ //DbgPrint("Probing successRate=%d", successRate);
+ /* Find successRate in operationRateSet[] */
+ wd->probeSuccessCount++;
+ if (wd->probeCount < wd->success_probing)
+ {
+ return;
+ }
+
+ pcount = wd->probeCount;
+ if (pcount != 0)
+ {
+ PERProbe = wd->probeSuccessCount * 100 / pcount;
+ }
+ else
+ {
+ PERProbe = 1;
+ }
+
+ if (PERProbe < ((rcCell->currentRate < 16)? 80:100))
+ {
+ return;
+ }
+ //DbgPrint("wd->probeCount=%d, wd->probeSuccessCount=%d", wd->probeCount, wd->probeSuccessCount);
+ wd->probeCount = wd->probeSuccessCount = 0;
+ for (i=0; i<rcCell->operationRateCount; i++)
+ {
+ if (successRate == rcCell->operationRateSet[i])
+ {
+ if (i > rcCell->currentRateIndex)
+ {
+ /* Raise current Tx rate */
+ zm_msg1_tx(ZM_LV_0, "Raise Tx Rate=", successRate);
+ //DbgPrint("Raise Tx Rate=%d", successRate);
+
+ // Resolve compatibility problem with Marvell
+ if((rcCell->currentRate <= 15) && (successRate > 15))
+ {
+ zmw_leave_critical_section(dev);
+ zfHpSetAggPktNum(dev, 16);
+ zmw_enter_critical_section(dev);
+ }
+
+ rcCell->currentRate = successRate;
+ rcCell->currentRateIndex = (u8_t)i;
+ rcCell->failCount = rcCell->txCount = 0;
+ rcCell->lasttxCount = 0;
+ rcCell->lastTime = wd->tick;
+ wd->txFail[rcCell->currentRate] = wd->txFail[rcCell->currentRate] >> 1;
+ wd->txMPDU[rcCell->currentRate] = wd->txMPDU[rcCell->currentRate] >> 1;
+ }
+ }
+ }
+
+ return;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfRateCtrlRxRssiEvent */
+/* Rx RSSI event. Calculate RSSI moving average, accelarate */
+/* rate probing if RSSI variation over threshold. */
+/* */
+/* INPUTS */
+/* rcCell : rate control cell */
+/* successRate : success rate */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen Chen Atheros Communications, INC. 2007.2 */
+/* */
+/************************************************************************/
+void zfRateCtrlRxRssiEvent(struct zsRcCell* rcCell, u16_t rxRssi)
+{
+ /* if delta(rcCell->rxRssi, rxRssi) > ZM_RATE_CTRL_RSSI_VARIATION */
+ if ((rcCell->rxRssi - rxRssi) > ZM_RATE_CTRL_RSSI_VARIATION)
+ {
+ /* Accelerate rate probing via decreaing rcCell->probingTime */
+ rcCell->probingTime -= ZM_RATE_CTRL_PROBING_INTERVAL_MS/ZM_MS_PER_TICK;
+ }
+
+ /* Update RSSI moving average */
+ rcCell->rxRssi = (((rcCell->rxRssi*7) + rxRssi)+4) >> 3;
+ return;
+}
+
+
+#ifdef ZM_ENABLE_BA_RATECTRL
+u8_t HigherRate(u8_t Rate) {
+ if (Rate < 28) Rate++; //28=MCS15SG, 27=MCS15, 26=MCS14, 25=MCS13
+ if (Rate > 28) Rate = 28;
+ while ((Rate >= 20) && (Rate <= 23)) {
+ Rate ++;
+ }
+ return Rate;
+}
+
+u8_t LowerRate(u8_t Rate) {
+ if (Rate > 1) Rate--;
+ while ((Rate >= 20) && (Rate <= 23)) {
+ Rate --;
+ }
+ return Rate;
+}
+
+u8_t RateMapToRateIndex(u8_t Rate, struct zsRcCell* rcCell) {
+ u8_t i;
+ for (i=0; i<rcCell->operationRateCount; i++) {
+ if (Rate == rcCell->operationRateSet[i]) {
+ return i;
+ }
+ }
+ return 0;
+}
+
+void zfRateCtrlAggrSta(zdev_t* dev) {
+ u8_t RateIndex, Rate;
+ u8_t HRate;
+ u8_t LRate;
+ u32_t RateCtrlTxMPDU, RateCtrlBAFail;
+ zmw_get_wlan_dev(dev);
+
+ RateIndex = wd->sta.oppositeInfo[0].rcCell.currentRateIndex;
+ Rate = wd->sta.oppositeInfo[0].rcCell.operationRateSet[RateIndex];
+
+ TxMPDU[Rate] = (TxMPDU[Rate] / 5) + (wd->commTally.RateCtrlTxMPDU * 4 / 5);
+ BAFail[Rate] = (BAFail[Rate] / 5) + (wd->commTally.RateCtrlBAFail * 4 / 5);
+ RateCtrlTxMPDU = wd->commTally.RateCtrlTxMPDU;
+ RateCtrlBAFail = wd->commTally.RateCtrlBAFail;
+ wd->commTally.RateCtrlTxMPDU = 0;
+ wd->commTally.RateCtrlBAFail = 0;
+ if (TxMPDU[Rate] > 0) {
+ BAPER[Rate] = BAFail[Rate] * 1000 / TxMPDU[Rate]; //PER*1000
+ BAPER[Rate] = (BAPER[Rate]>0)? BAPER[Rate]:1;
+ }
+ else {
+ return;
+ }
+
+ HRate = HigherRate(Rate);
+ LRate = LowerRate(Rate);
+ if (BAPER[Rate]>200) {
+ if ((RateCtrlTxMPDU > 100) && (BAPER[Rate]<300) && (HRate != Rate) && BAPER[HRate] &&
+ (BAPER[HRate] < BAPER[Rate] + BADiff[Rate])) {
+ Rate = HRate;
+ //DbgPrint("Rate improved to %d", Rate);
+ }
+ else {
+ Rate = LRate;
+ //DbgPrint("Rate decreased to %d", Rate);
+ }
+ }
+ else if (BAPER[Rate] && BAPER[Rate]<100) {
+ if (RateCtrlTxMPDU > 100) {
+ Rate = HRate;
+ //DbgPrint("Rate improved to %d", Rate);
+ }
+ }
+ wd->sta.oppositeInfo[0].rcCell.currentRate = Rate;
+ wd->sta.oppositeInfo[0].rcCell.currentRateIndex = RateMapToRateIndex(Rate, &wd->sta.oppositeInfo[0].rcCell);
+}
+#endif
diff --git a/drivers/staging/otus/80211core/ratectrl.h b/drivers/staging/otus/80211core/ratectrl.h
new file mode 100644
index 00000000000..92411d725cd
--- /dev/null
+++ b/drivers/staging/otus/80211core/ratectrl.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _RATECTRL_H
+#define _RATECTRL_H
+
+#define ZM_RATE_CTRL_PROBING_INTERVAL_MS 1000 //1000ms
+#define ZM_RATE_CTRL_MIN_PROBING_PACKET 8
+
+#define ZM_MIN_RATE_FAIL_COUNT 20
+
+#define ZM_RATE_PROBING_THRESHOLD 15 //6%
+#define ZM_RATE_SUCCESS_PROBING 10
+
+#define ZM_RATE_CTRL_RSSI_VARIATION 5 //TBD
+
+extern const u32_t zcRateToPhyCtrl[];
+
+extern void zfRateCtrlInitCell(zdev_t* dev, struct zsRcCell* rcCell, u8_t type, u8_t gBand, u8_t SG40);
+extern u16_t zfRateCtrlGetTxRate(zdev_t* dev, struct zsRcCell* rcCell, u16_t* probing);
+extern void zfRateCtrlTxFailEvent(zdev_t* dev, struct zsRcCell* rcCell, u8_t aggRate, u32_t retryRate);
+extern void zfRateCtrlTxSuccessEvent(zdev_t* dev, struct zsRcCell* rcCell, u8_t successRate);
+extern void zfRateCtrlAggrSta(zdev_t* dev);
+#endif
diff --git a/drivers/staging/otus/80211core/struct.h b/drivers/staging/otus/80211core/struct.h
new file mode 100644
index 00000000000..17b5ce37ebb
--- /dev/null
+++ b/drivers/staging/otus/80211core/struct.h
@@ -0,0 +1,1315 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _STRUCT_H
+#define _STRUCT_H
+
+#include "../oal_marc.h"
+
+#define ZM_SW_LOOP_BACK 0 /* 1=>enable, 0=>disable */
+#define ZM_PCI_LOOP_BACK 0 /* 1=>enable, 0=>disable */
+#define ZM_PROTOCOL_RESPONSE_SIMULATION 0
+
+#define ZM_RX_FRAME_SIZE 1600
+
+extern const u8_t zg11bRateTbl[4];
+extern const u8_t zg11gRateTbl[8];
+
+#define ZM_DRIVER_CORE_MAJOR_VERSION 1
+#define ZM_DRIVER_CORE_MINOR_VERSION 1
+#define ZM_DRIVER_CORE_BRANCH_MAJOR_VERSION 3
+#define ZM_DRIVER_CORE_BRANCH_MINOR_VERSION 39
+
+#ifndef ZM_VTXQ_SIZE
+#define ZM_VTXQ_SIZE 1024 //2^N
+#endif
+
+#define ZM_VTXQ_SIZE_MASK (ZM_VTXQ_SIZE-1)
+#define ZM_VMMQ_SIZE 8 //2^N
+#define ZM_VMMQ_SIZE_MASK (ZM_VMMQ_SIZE-1)
+
+#include "cagg.h"
+
+#define ZM_AGG_POOL_SIZE 20
+#define ZM_RATE_TABLE_SIZE 32
+
+#define ZM_MAX_BUF_DISCRETE_NUMBER 5
+
+
+
+
+
+
+
+
+
+/**********************************************************************************/
+/* IBSS macros */
+/**********************************************************************************/
+#define ZM_IBSS_PEER_ALIVE_COUNTER 4
+
+/**********************************************************************************/
+/* BIT mapping related macros */
+/**********************************************************************************/
+
+#define ZM_BIT_0 0x1
+#define ZM_BIT_1 0x2
+#define ZM_BIT_2 0x4
+#define ZM_BIT_3 0x8
+#define ZM_BIT_4 0x10
+#define ZM_BIT_5 0x20
+#define ZM_BIT_6 0x40
+#define ZM_BIT_7 0x80
+#define ZM_BIT_8 0x100
+#define ZM_BIT_9 0x200
+#define ZM_BIT_10 0x400
+#define ZM_BIT_11 0x800
+#define ZM_BIT_12 0x1000
+#define ZM_BIT_13 0x2000
+#define ZM_BIT_14 0x4000
+#define ZM_BIT_15 0x8000
+#define ZM_BIT_16 0x10000
+#define ZM_BIT_17 0x20000
+#define ZM_BIT_18 0x40000
+#define ZM_BIT_19 0x80000
+#define ZM_BIT_20 0x100000
+#define ZM_BIT_21 0x200000
+#define ZM_BIT_22 0x400000
+#define ZM_BIT_23 0x800000
+#define ZM_BIT_24 0x1000000
+#define ZM_BIT_25 0x2000000
+#define ZM_BIT_26 0x4000000
+#define ZM_BIT_27 0x8000000
+#define ZM_BIT_28 0x10000000
+#define ZM_BIT_29 0x20000000 //WPA support
+#define ZM_BIT_30 0x40000000
+#define ZM_BIT_31 0x80000000
+
+
+/**********************************************************************************/
+/* MAC address related macros */
+/**********************************************************************************/
+#define ZM_MAC_BYTE_TO_WORD(macb, macw) macw[0] = macb[0] + (macb[1] << 8); \
+ macw[1] = macb[2] + (macb[3] << 8); \
+ macw[2] = macb[4] + (macb[5] << 8);
+
+#define ZM_MAC_WORD_TO_BYTE(macw, macb) macb[0] = (u8_t) (macw[0] & 0xff); \
+ macb[1] = (u8_t) (macw[0] >> 8); \
+ macb[2] = (u8_t) (macw[1] & 0xff); \
+ macb[3] = (u8_t) (macw[1] >> 8); \
+ macb[4] = (u8_t) (macw[2] & 0xff); \
+ macb[5] = (u8_t) (macw[2] >> 8);
+
+#define ZM_MAC_0(macw) ((u8_t)(macw[0] & 0xff))
+#define ZM_MAC_1(macw) ((u8_t)(macw[0] >> 8))
+#define ZM_MAC_2(macw) ((u8_t)(macw[1] & 0xff))
+#define ZM_MAC_3(macw) ((u8_t)(macw[1] >> 8))
+#define ZM_MAC_4(macw) ((u8_t)(macw[2] & 0xff))
+#define ZM_MAC_5(macw) ((u8_t)(macw[2] >> 8))
+
+#define ZM_IS_MULTICAST_OR_BROADCAST(mac) (mac[0] & 0x01)
+#define ZM_IS_MULTICAST(mac) ((mac[0] & 0x01) && (((u8_t)mac[0]) != 0xFF))
+
+#define ZM_MAC_EQUAL(mac1, mac2) ((mac1[0]==mac2[0])&&(mac1[1]==mac2[1])&&(mac1[2]==mac2[2]))
+#define ZM_MAC_NOT_EQUAL(mac1, mac2) ((mac1[0]!=mac2[0])||(mac1[1]!=mac2[1])||(mac1[2]!=mac2[2]))
+/**********************************************************************************/
+/* MAC address related mac'ros (end) */
+/**********************************************************************************/
+#define ZM_BYTE_TO_WORD(A, B) ((A<<8)+B)
+#define ZM_ROL32( A, n ) \
+ ( ((A) << (n)) | ( ((A)>>(32-(n))) & ( (1UL << (n)) - 1 ) ) )
+#define ZM_ROR32( A, n ) ZM_ROL32( (A), 32-(n) )
+#define ZM_LO8(v16) ((u8_t)((v16) & 0xFF))
+#define ZM_HI8(v16) ((u8_t)(((v16)>>8)&0xFF))
+
+#ifdef ZM_ENABLE_BUFFER_TRACE
+extern void zfwBufTrace(zdev_t* dev, zbuf_t *buf, u8_t *functionName);
+#define ZM_BUFFER_TRACE(dev, buf) zfwBufTrace(dev, buf, __func__);
+#else
+#define ZM_BUFFER_TRACE(dev, buf)
+#endif
+
+/* notification events to heart beat function */
+#define ZM_BSSID_LIST_SCAN 0x01
+
+/* CAM mode */
+#define ZM_CAM_AP 0x1
+#define ZM_CAM_STA 0x2
+#define ZM_CAM_HOST 0x4
+
+/* finite state machine for adapter */
+#define ZM_STA_STATE_DISCONNECT 1
+#define ZM_STA_STATE_CONNECTING 2
+#define ZM_STA_STATE_CONNECTED 3
+
+/* Event definitions for finite state machine */
+#define ZM_EVENT_TIMEOUT_SCAN 0x0000
+#define ZM_EVENT_TIMEOUT_BG_SCAN 0x0001
+#define ZN_EVENT_TIMEOUT_RECONNECT 0x0002
+#define ZM_EVENT_TIMEOUT_INIT_SCAN 0x0003
+#define ZM_EVENT_TIMEOUT_AUTH 0x0004
+#define ZM_EVENT_TIMEOUT_ASSO 0x0005
+#define ZM_EVENT_TIMEOUT_AUTO_SCAN 0x0006
+#define ZM_EVENT_TIMEOUT_MIC_FAIL 0x0007
+#define ZM_EVENT_TIMEOUT_CHECK_AP 0x0008
+#define ZM_EVENT_CONNECT 0x0009
+#define ZM_EVENT_INIT_SCAN 0x000a
+#define ZM_EVENT_SCAN 0x000b
+#define ZM_EVENT_BG_SCAN 0x000c
+#define ZM_EVENT_DISCONNECT 0x000d
+#define ZM_EVENT_WPA_MIC_FAIL 0x000e
+#define ZM_EVENT_AP_ALIVE 0x000f
+#define ZM_EVENT_CHANGE_TO_AP 0x0010
+#define ZM_EVENT_CHANGE_TO_STA 0x0011
+#define ZM_EVENT_IDLE 0x0012
+#define ZM_EVENT_AUTH 0x0013
+#define ZM_EVENT_ASSO_RSP 0x0014
+#define ZM_EVENT_WPA_PK_OK 0x0015
+#define ZM_EVENT_WPA_GK_OK 0x0016
+#define ZM_EVENT_RCV_BEACON 0x0017
+#define ZM_EVENT_RCV_PROBE_RSP 0x0018
+#define ZM_EVENT_SEND_DATA 0x0019
+#define ZM_EVENT_AUTO_SCAN 0x001a
+#define ZM_EVENT_MIC_FAIL1 0x001d
+#define ZM_EVENT_MIC_FAIL2 0x001e
+#define ZM_EVENT_IBSS_MONITOR 0x001f
+#define ZM_EVENT_IN_SCAN 0x0020
+#define ZM_EVENT_CM_TIMER 0x0021
+#define ZM_EVENT_CM_DISCONNECT 0x0022
+#define ZM_EVENT_CM_BLOCK_TIMER 0x0023
+#define ZM_EVENT_TIMEOUT_ADDBA 0x0024
+#define ZM_EVENT_TIMEOUT_PERFORMANCE 0x0025
+#define ZM_EVENT_SKIP_COUNTERMEASURE 0x0026
+#define ZM_EVENT_NONE 0xffff
+
+/* Actions after call finite state machine */
+#define ZM_ACTION_NONE 0x0000
+#define ZM_ACTION_QUEUE_DATA 0x0001
+#define ZM_ACTION_DROP_DATA 0x0002
+
+/* Timers for finite state machine */
+#define ZM_TICK_ZERO 0
+#define ZM_TICK_INIT_SCAN_END 8
+#define ZM_TICK_NEXT_BG_SCAN 50
+#define ZM_TICK_BG_SCAN_END 8
+#define ZM_TICK_AUTH_TIMEOUT 4
+#define ZM_TICK_ASSO_TIMEOUT 4
+#define ZM_TICK_AUTO_SCAN 300
+#define ZM_TICK_MIC_FAIL_TIMEOUT 6000
+#define ZM_TICK_CHECK_AP1 150
+#define ZM_TICK_CHECK_AP2 350
+#define ZM_TICK_CHECK_AP3 250
+#define ZM_TICK_IBSS_MONITOR 160
+#define ZM_TICK_IN_SCAN 4
+#define ZM_TICK_CM_TIMEOUT 6000
+#define ZM_TICK_CM_DISCONNECT 200
+#define ZM_TICK_CM_BLOCK_TIMEOUT 6000
+
+/* Fix bug#33338 Counter Measure Issur */
+#ifdef NDIS_CM_FOR_XP
+#define ZM_TICK_CM_TIMEOUT_OFFSET 2160
+#define ZM_TICK_CM_DISCONNECT_OFFSET 72
+#define ZM_TICK_CM_BLOCK_TIMEOUT_OFFSET 2160
+#else
+#define ZM_TICK_CM_TIMEOUT_OFFSET 0
+#define ZM_TICK_CM_DISCONNECT_OFFSET 0
+#define ZM_TICK_CM_BLOCK_TIMEOUT_OFFSET 0
+#endif
+
+#define ZM_TIME_ACTIVE_SCAN 30 //ms
+#define ZM_TIME_PASSIVE_SCAN 110 //ms
+
+/* finite state machine for BSS connect */
+#define ZM_STA_CONN_STATE_NONE 0
+#define ZM_STA_CONN_STATE_AUTH_OPEN 1
+#define ZM_STA_CONN_STATE_AUTH_SHARE_1 2
+#define ZM_STA_CONN_STATE_AUTH_SHARE_2 3
+#define ZM_STA_CONN_STATE_ASSOCIATE 4
+#define ZM_STA_CONN_STATE_SSID_NOT_FOUND 5
+#define ZM_STA_CONN_STATE_AUTH_COMPLETED 6
+
+/* finite state machine for WPA handshaking */
+#define ZM_STA_WPA_STATE_INIT 0
+#define ZM_STA_WPA_STATE_PK_OK 1
+#define ZM_STA_WPA_STATE_GK_OK 2
+
+/* various timers */
+#define ZM_INTERVAL_CONNECT_TIMEOUT 20 /* 200 milisecond */
+
+/* IBSS definitions */
+#define ZM_IBSS_PARTNER_LOST 0
+#define ZM_IBSS_PARTNER_ALIVE 1
+#define ZM_IBSS_PARTNER_CHECK 2
+
+#define ZM_BCMC_ARRAY_SIZE 16 /* Must be 2^N */
+#define ZM_UNI_ARRAY_SIZE 16 /* Must be 2^N */
+
+#define ZM_MAX_DEFRAG_ENTRIES 4 /* 2^N */
+#define ZM_DEFRAG_AGING_TIME_SEC 5 /* 5 seconds */
+
+#define ZM_MAX_WPAIE_SIZE 128
+/* WEP related definitions */
+#define ZM_USER_KEY_DEFAULT 64
+#define ZM_USER_KEY_PK 0 /* Pairwise Key */
+#define ZM_USER_KEY_GK 1 /* Group Key */
+/* AP WLAN Type */
+#define ZM_WLAN_TYPE_PURE_B 2
+#define ZM_WLAN_TYPE_PURE_G 1
+#define ZM_WLAN_TYPE_MIXED 0
+
+/* HAL State */
+#define ZM_HAL_STATE_INIT 0
+#define ZM_HAL_STATE_RUNNING 1
+
+/* AP Capability */
+#define ZM_All11N_AP 0x01
+#define ZM_XR_AP 0x02
+#define ZM_SuperG_AP 0x04
+
+/* MPDU Density */
+#define ZM_MPDU_DENSITY_NONE 0
+#define ZM_MPDU_DENSITY_1_8US 1
+#define ZM_MPDU_DENSITY_1_4US 2
+#define ZM_MPDU_DENSITY_1_2US 3
+#define ZM_MPDU_DENSITY_1US 4
+#define ZM_MPDU_DENSITY_2US 5
+#define ZM_MPDU_DENSITY_4US 6
+#define ZM_MPDU_DENSITY_8US 7
+
+/* Software Encryption */
+#define ZM_SW_TKIP_ENCRY_EN 0x01
+#define ZM_SW_TKIP_DECRY_EN 0x02
+#define ZM_SW_WEP_ENCRY_EN 0x04
+#define ZM_SW_WEP_DECRY_EN 0x08
+
+/* Default Support Rate */
+#define ZM_DEFAULT_SUPPORT_RATE_ZERO 0x0
+#define ZM_DEFAULT_SUPPORT_RATE_DISCONNECT 0x1
+#define ZM_DEFAULT_SUPPORT_RATE_IBSS_B 0x2
+#define ZM_DEFAULT_SUPPORT_RATE_IBSS_AG 0x3
+
+/* security related definitions */
+struct zsTkipSeed
+{
+ u8_t tk[32]; /* key */
+ u8_t ta[6];
+ u16_t ttak[5];
+ u16_t ppk[6];
+ u16_t iv16,iv16tmp;
+ u32_t iv32,iv32tmp;
+};
+
+struct zsMicVar
+{
+ u32_t k0, k1; // Key
+ u32_t left, right; // Current state
+ u32_t m; // Message accumulator (single word)
+ u16_t nBytes; // # bytes in M
+};
+
+struct zsDefragEntry
+{
+ u8_t fragCount;
+ u8_t addr[6];
+ u16_t seqNum;
+ zbuf_t* fragment[8];
+ u32_t tick;
+};
+
+struct zsDefragList
+{
+ struct zsDefragEntry defragEntry[ZM_MAX_DEFRAG_ENTRIES];
+ u8_t replaceNum;
+};
+
+#define ZM_MAX_OPPOSITE_COUNT 16
+#define ZM_MAX_TX_SAMPLES 15
+#define ZM_TX_RATE_DOWN_CRITERIA 80
+#define ZM_TX_RATE_UP_CRITERIA 200
+
+
+#define ZM_MAX_PROBE_HIDDEN_SSID_SIZE 2
+struct zsSsidList
+{
+ u8_t ssid[32];
+ u8_t ssidLen;
+};
+
+struct zsWrapperSetting
+{
+ u8_t bDesiredBssid;
+ u8_t desiredBssid[6];
+ u16_t bssid[3];
+ u8_t ssid[32];
+ u8_t ssidLen;
+ u8_t authMode;
+ u8_t wepStatus;
+ u8_t encryMode;
+ u8_t wlanMode;
+ u16_t frequency;
+ u16_t beaconInterval;
+ u8_t dtim;
+ u8_t preambleType;
+ u16_t atimWindow;
+
+ struct zsSsidList probingSsidList[ZM_MAX_PROBE_HIDDEN_SSID_SIZE];
+
+ u8_t dropUnencryptedPkts;
+ u8_t ibssJoinOnly;
+ u32_t adhocMode;
+ u8_t countryIsoName[4];
+ u16_t autoSetFrequency;
+
+ /* AP */
+ u8_t bRateBasic;
+ u8_t gRateBasic;
+ u32_t nRateBasic;
+ u8_t bgMode;
+
+ /* Common */
+ u8_t staWmeEnabled;
+ u8_t staWmeQosInfo;
+ u8_t apWmeEnabled;
+
+
+ /* rate information: added in the future */
+};
+
+struct zsWrapperFeatureCtrl
+{
+ u8_t bIbssGMode;
+};
+
+#define ZM_MAX_PS_STA 16
+#define ZM_PS_QUEUE_SIZE 32
+
+struct zsStaPSEntity
+{
+ u8_t bUsed;
+ u8_t macAddr[6];
+ u8_t bDataQueued;
+};
+
+struct zsStaPSList
+{
+ u8_t count;
+ struct zsStaPSEntity entity[ZM_MAX_PS_STA];
+};
+
+#define ZM_MAX_TIMER_COUNT 32
+
+/* double linked list */
+struct zsTimerEntry
+{
+ u16_t event;
+ u32_t timer;
+ struct zsTimerEntry *pre;
+ struct zsTimerEntry *next;
+};
+
+struct zsTimerList
+{
+ u8_t freeCount;
+ struct zsTimerEntry list[ZM_MAX_TIMER_COUNT];
+ struct zsTimerEntry *head;
+ struct zsTimerEntry *tail;
+};
+
+/* Multicast list */
+#define ZM_MAX_MULTICAST_LIST_SIZE 64
+
+struct zsMulticastAddr
+{
+ u8_t addr[6];
+};
+
+struct zsMulticastList
+{
+ u8_t size;
+ struct zsMulticastAddr macAddr[ZM_MAX_MULTICAST_LIST_SIZE];
+};
+
+enum ieee80211_cwm_mode {
+ CWM_MODE20,
+ CWM_MODE2040,
+ CWM_MODE40,
+ CWM_MODEMAX
+
+};
+
+enum ieee80211_cwm_extprotspacing {
+ CWM_EXTPROTSPACING20,
+ CWM_EXTPROTSPACING25,
+ CWM_EXTPROTSPACINGMAX
+};
+
+enum ieee80211_cwm_width {
+ CWM_WIDTH20,
+ CWM_WIDTH40
+};
+
+enum ieee80211_cwm_extprotmode {
+ CWM_EXTPROTNONE, /* no protection */
+ CWM_EXTPROTCTSONLY, /* CTS to self */
+ CWM_EXTPROTRTSCTS, /* RTS-CTS */
+ CWM_EXTPROTMAX
+};
+
+struct ieee80211_cwm {
+
+ /* Configuration */
+ enum ieee80211_cwm_mode cw_mode; /* CWM mode */
+ u8_t cw_extoffset; /* CWM Extension Channel Offset */
+ enum ieee80211_cwm_extprotmode cw_extprotmode; /* CWM Extension Channel Protection Mode */
+ enum ieee80211_cwm_extprotspacing cw_extprotspacing;/* CWM Extension Channel Protection Spacing */
+ u32_t cw_enable; /* CWM State Machine Enabled */
+ u32_t cw_extbusythreshold;/* CWM Extension Channel Busy Threshold */
+
+ /* State */
+ enum ieee80211_cwm_width cw_width; /* CWM channel width */
+};
+
+
+/* AP : STA database structure */
+struct zsStaTable
+{
+ u32_t time; /* tick time */
+ //u32_t phyCtrl; /* Tx PHY CTRL */
+ u16_t addr[3]; /* STA MAC address */
+ u16_t state; /* aut/asoc */
+ //u16_t retry; /* Retry count */
+ struct zsRcCell rcCell;
+
+ u8_t valid; /* Valid flag : 1=>valid */
+ u8_t psMode; /* STA power saving mode */
+ u8_t staType; /* 0=>11b, 1=>11g, 2=>11n */
+ u8_t qosType; /* 0=>Legacy, 1=>WME */
+ u8_t qosInfo; /* WME QoS info */
+ u8_t vap; /* Virtual AP ID */
+ u8_t encryMode; /* Encryption type for this STA */
+ u8_t keyIdx;
+ struct zsMicVar txMicKey;
+ struct zsMicVar rxMicKey;
+ u16_t iv16;
+ u32_t iv32;
+#ifdef ZM_ENABLE_CENC
+ /* CENC */
+ u8_t cencKeyIdx;
+ u32_t txiv[4];
+ u32_t rxiv[4];
+#endif //ZM_ENABLE_CENC
+};
+
+struct zdStructWds
+{
+ u8_t wdsBitmap; /* Set bit-N to 1 to enable WDS */
+ u8_t encryMode[ZM_MAX_WDS_SUPPORT]; /* WDS encryption mode */
+ u16_t macAddr[ZM_MAX_WDS_SUPPORT][3]; /* WDS neighbor MAC address */
+};
+
+ // htcapinfo 16bits
+#define HTCAP_AdvCodingCap 0x0001
+#define HTCAP_SupChannelWidthSet 0x0002
+#define HTCAP_DynamicSMPS 0x0004
+#define HTCAP_SMEnabled 0x000C
+#define HTCAP_GreenField 0x0010
+#define HTCAP_ShortGIfor20MHz 0x0020
+#define HTCAP_ShortGIfor40MHz 0x0040
+#define HTCAP_TxSTBC 0x0080
+#define HTCAP_RxOneStream 0x0100
+#define HTCAP_RxTwoStream 0x0200
+#define HTCAP_RxThreeStream 0x0300
+#define HTCAP_DelayedBlockACK 0x0400
+#define HTCAP_MaxAMSDULength 0x0800
+#define HTCAP_DSSSandCCKin40MHz 0x1000
+#define HTCAP_PSMPSup 0x2000
+#define HTCAP_STBCControlFrameSup 0x4000
+#define HTCAP_LSIGTXOPProtectionSUP 0x8000
+ // Ampdu HT Parameter Info 8bits
+#define HTCAP_MaxRxAMPDU0 0x00
+#define HTCAP_MaxRxAMPDU1 0x01
+#define HTCAP_MaxRxAMPDU2 0x02
+#define HTCAP_MaxRxAMPDU3 0x03
+ // PCO 8bits
+#define HTCAP_PCO 0x01
+#define HTCAP_TransmissionTime1 0x02
+#define HTCAP_TransmissionTime2 0x04
+#define HTCAP_TransmissionTime3 0x06
+ // MCS FeedBack 8bits
+#define HTCAP_PlusHTCSupport 0x04
+#define HTCAP_RDResponder 0x08
+ // TX Beamforming 0 8bits
+#define HTCAP_TxBFCapable 0x01
+#define HTCAP_RxStaggeredSoundCap 0x02
+#define HTCAP_TxStaggeredSoundCap 0x04
+#define HTCAP_RxZLFCapable 0x08
+#define HTCAP_TxZLFCapable 0x10
+#define HTCAP_ImplicitTxBFCapable 0x20
+ // Tx Beamforming 1 8bits
+#define HTCAP_ExplicitCSITxBFCap 0x01
+#define HTCAP_ExpUncompSteerMatrCap 0x02
+ // Antenna Selection Capabilities 8bits
+#define HTCAP_AntennaSelectionCap 0x01
+#define HTCAP_ExplicitCSITxASCap 0x02
+#define HTCAP_AntennaIndFeeTxASCap 0x04
+#define HTCAP_ExplicitCSIFeedbackCap 0x08
+#define HTCAP_AntennaIndFeedbackCap 0x10
+#define HTCAP_RxASCap 0x20
+#define HTCAP_TxSoundPPDUsCap 0x40
+
+
+
+struct zsHTCapability
+{
+ u8_t ElementID;
+ u8_t Length;
+ // HT Capability Info
+ u16_t HtCapInfo;
+ u8_t AMPDUParam;
+ u8_t MCSSet[16]; //16 bytes
+ // Extended HT Capability Info
+ u8_t PCO;
+ u8_t MCSFeedBack;
+
+ u8_t TxBFCap[4];
+ u8_t AselCap;
+};
+
+union zuHTCapability
+{
+ struct zsHTCapability Data;
+ u8_t Byte[28];
+};
+
+ //channelinfo 8bits
+#define ExtHtCap_ExtChannelOffsetAbove 0x01
+#define ExtHtCap_ExtChannelOffsetBelow 0x03
+#define ExtHtCap_RecomTxWidthSet 0x04
+#define ExtHtCap_RIFSMode 0x08
+#define ExtHtCap_ControlAccessOnly 0x10
+ //operatinginfo 16bits
+#define ExtHtCap_NonGFDevicePresent 0x0004
+ //beaconinfo 16bits
+#define ExtHtCap_DualBeacon 0x0040
+#define ExtHtCap_DualSTBCProtection 0x0080
+#define ExtHtCap_SecondaryBeacon 0x0100
+#define ExtHtCap_LSIGTXOPProtectFullSup 0x0200
+#define ExtHtCap_PCOActive 0x0400
+#define ExtHtCap_PCOPhase 0x0800
+
+
+struct zsExtHTCapability
+{
+ u8_t ElementID;
+ u8_t Length;
+ u8_t ControlChannel;
+ u8_t ChannelInfo;
+ u16_t OperatingInfo;
+ u16_t BeaconInfo;
+ // Supported MCS Set
+ u8_t MCSSet[16];
+};
+
+union zuExtHTCapability
+{
+ struct zsExtHTCapability Data;
+ u8_t Byte[24];
+};
+
+struct InformationElementSta {
+ struct zsHTCapability HtCap;
+ struct zsExtHTCapability HtInfo;
+};
+
+struct InformationElementAp {
+ struct zsHTCapability HtCap;
+};
+
+#define ZM_MAX_FREQ_REQ_QUEUE 32
+typedef void (*zfpFreqChangeCompleteCb)(zdev_t* dev);
+
+struct zsWlanDevFreqControl
+{
+ u16_t freqReqQueue[ZM_MAX_FREQ_REQ_QUEUE];
+ u8_t freqReqBw40[ZM_MAX_FREQ_REQ_QUEUE];
+ u8_t freqReqExtOffset[ZM_MAX_FREQ_REQ_QUEUE];
+ zfpFreqChangeCompleteCb freqChangeCompCb[ZM_MAX_FREQ_REQ_QUEUE];
+ u8_t freqReqQueueHead;
+ u8_t freqReqQueueTail;
+};
+
+struct zsWlanDevAp
+{
+ u16_t protectedObss; /* protected overlap BSS */
+ u16_t staAgingTimeSec; /* in second, STA will be deathed if it does not */
+ /* active for this long time */
+ u16_t staProbingTimeSec;/* in second, STA will be probed if it does not */
+ /* active for this long time */
+ u8_t authSharing; /* authentication on going*/
+ u8_t bStaAssociated; /* 11b STA associated */
+ u8_t gStaAssociated; /* 11g STA associated */
+ u8_t nStaAssociated; /* 11n STA associated */
+ u16_t protectionMode; /* AP protection mode flag */
+ u16_t staPowerSaving; /* Set associated power saving STA count */
+
+
+
+ zbuf_t* uniArray[ZM_UNI_ARRAY_SIZE]; /* array to store unicast frames */
+ u16_t uniHead;
+ u16_t uniTail;
+
+ /* HT Capability Info */
+ union zuHTCapability HTCap; //CWYang(+)
+
+ /* Extended HT Capability Info */
+ union zuExtHTCapability ExtHTCap; //CWYang(+)
+
+ /* STA table */
+ struct zsStaTable staTable[ZM_MAX_STA_SUPPORT];
+
+ /* WDS */
+ struct zdStructWds wds;
+ /* WPA */
+ u8_t wpaIe[ZM_MAX_AP_SUPPORT][ZM_MAX_WPAIE_SIZE];
+ u8_t wpaLen[ZM_MAX_AP_SUPPORT];
+ u8_t stawpaIe[ZM_MAX_AP_SUPPORT][ZM_MAX_WPAIE_SIZE];
+ u8_t stawpaLen[ZM_MAX_AP_SUPPORT];
+ u8_t wpaSupport[ZM_MAX_AP_SUPPORT];
+
+ //struct zsTkipSeed bcSeed;
+ u8_t bcKeyIndex[ZM_MAX_AP_SUPPORT];
+ u8_t bcHalKeyIdx[ZM_MAX_AP_SUPPORT];
+ struct zsMicVar bcMicKey[ZM_MAX_AP_SUPPORT];
+ u16_t iv16[ZM_MAX_AP_SUPPORT];
+ u32_t iv32[ZM_MAX_AP_SUPPORT];
+
+#ifdef ZM_ENABLE_CENC
+ /* CENC */
+ u32_t txiv[ZM_MAX_AP_SUPPORT][4];
+#endif //ZM_ENABLE_CENC
+
+ /* Virtual AP */
+ u8_t beaconCounter;
+ u8_t vapNumber;
+ u8_t apBitmap; /* Set bit-N to 1 to enable VAP */
+ u8_t hideSsid[ZM_MAX_AP_SUPPORT];
+ u8_t authAlgo[ZM_MAX_AP_SUPPORT];
+ u8_t ssid[ZM_MAX_AP_SUPPORT][32]; /* SSID */
+ u8_t ssidLen[ZM_MAX_AP_SUPPORT]; /* SSID length */
+ u8_t encryMode[ZM_MAX_AP_SUPPORT];
+ u8_t wepStatus[ZM_MAX_AP_SUPPORT];
+ u16_t capab[ZM_MAX_AP_SUPPORT]; /* Capability */
+ u8_t timBcmcBit[ZM_MAX_AP_SUPPORT]; /* BMCM bit of TIM */
+ u8_t wlanType[ZM_MAX_AP_SUPPORT];
+
+ /* Array to store BC or MC frames */
+ zbuf_t* bcmcArray[ZM_MAX_AP_SUPPORT][ZM_BCMC_ARRAY_SIZE];
+ u16_t bcmcHead[ZM_MAX_AP_SUPPORT];
+ u16_t bcmcTail[ZM_MAX_AP_SUPPORT];
+
+ u8_t qosMode; /* 1=>WME */
+ u8_t uapsdEnabled;
+ struct zsQueue* uapsdQ;
+
+ u8_t challengeText[128];
+
+ struct InformationElementAp ie[ZM_MAX_STA_SUPPORT];
+
+
+};
+
+#define ZM_MAX_BLOCKING_AP_LIST_SIZE 4 /* 2^N */
+struct zsBlockingAp
+{
+ u8_t addr[6];
+ u8_t weight;
+};
+
+#define ZM_SCAN_MGR_SCAN_NONE 0
+#define ZM_SCAN_MGR_SCAN_INTERNAL 1
+#define ZM_SCAN_MGR_SCAN_EXTERNAL 2
+
+struct zsWlanDevStaScanMgr
+{
+ u8_t scanReqs[2];
+ u8_t currScanType;
+ u8_t scanStartDelay;
+};
+
+#define ZM_PS_MSG_STATE_ACTIVE 0
+#define ZM_PS_MSG_STATE_SLEEP 1
+#define ZM_PS_MSG_STATE_T1 2
+#define ZM_PS_MSG_STATE_T2 3
+#define ZM_PS_MSG_STATE_S1 4
+
+#define ZM_PS_MAX_SLEEP_PERIODS 3 // The number of beacon periods
+
+struct zsWlanDevStaPSMgr
+{
+ u8_t state;
+ u8_t isSleepAllowed;
+ u8_t maxSleepPeriods;
+ u8_t ticks;
+ u32_t lastTxUnicastFrm;
+ u32_t lastTxMulticastFrm;
+ u32_t lastTxBroadcastFrm;
+ u8_t tempWakeUp; /*enable when wake up but still in ps mode */
+ u16_t sleepAllowedtick;
+};
+
+struct zsWlanDevSta
+{
+ u32_t beaconTxCnt; /* Transmitted beacon counter (in IBSS) */
+ u8_t txBeaconInd; /* In IBSS mode, true means that we just transmit a beacon during
+ last beacon period.
+ */
+ u16_t beaconCnt; /* receive beacon count, will be perodically reset */
+ u16_t bssid[3]; /* BSSID of connected AP */
+ u8_t ssid[32]; /* SSID */
+ u8_t ssidLen; /* SSID length */
+ u8_t mTxRate; /* Tx rate for multicast */
+ u8_t uTxRate; /* Tx rate for unicast */
+ u8_t mmTxRate; /* Tx rate for management frame */
+ u8_t bChannelScan;
+ u8_t bScheduleScan;
+
+ u8_t InternalScanReq;
+ u16_t activescanTickPerChannel;
+ u16_t passiveScanTickPerChannel;
+ u16_t scanFrequency;
+ u32_t connPowerInHalfDbm;
+
+ u16_t currentFrequency;
+ u16_t currentBw40;
+ u16_t currentExtOffset;
+
+ u8_t bPassiveScan;
+
+ struct zsBlockingAp blockingApList[ZM_MAX_BLOCKING_AP_LIST_SIZE];
+
+ //struct zsBssInfo bssInfoPool[ZM_MAX_BSS];
+ struct zsBssInfo* bssInfoArray[ZM_MAX_BSS];
+ struct zsBssList bssList;
+ u8_t bssInfoArrayHead;
+ u8_t bssInfoArrayTail;
+ u8_t bssInfoFreeCount;
+
+ u8_t authMode;
+ u8_t currentAuthMode;
+ u8_t wepStatus;
+ u8_t encryMode;
+ u8_t keyId;
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ u8_t ibssWpa2Psk;
+#endif
+#ifdef ZM_ENABLE_CENC
+ u8_t cencKeyId; //CENC
+#endif //ZM_ENABLE_CENC
+ u8_t dropUnencryptedPkts;
+ u8_t ibssJoinOnly;
+ u8_t adapterState;
+ u8_t oldAdapterState;
+ u8_t connectState;
+ u8_t connectRetry;
+ u8_t wpaState;
+ u8_t wpaIe[ZM_MAX_IE_SIZE + 2];
+ u8_t rsnIe[ZM_MAX_IE_SIZE + 2];
+ u8_t challengeText[255+2];
+ u8_t capability[2];
+ //u8_t connectingHiddenAP;
+ //u8_t scanWithSSID;
+ u16_t aid;
+ u32_t mgtFrameCount;
+ u8_t bProtectionMode;
+ u32_t NonNAPcount;
+ u8_t RTSInAGGMode;
+ u32_t connectTimer;
+ u16_t atimWindow;
+ u8_t desiredBssid[6];
+ u8_t bDesiredBssid;
+ struct zsTkipSeed txSeed;
+ struct zsTkipSeed rxSeed[4];
+ struct zsMicVar txMicKey;
+ struct zsMicVar rxMicKey[4];
+ u16_t iv16;
+ u32_t iv32;
+ struct zsOppositeInfo oppositeInfo[ZM_MAX_OPPOSITE_COUNT];
+ u8_t oppositeCount;
+ u8_t bssNotFoundCount; /* sitesurvey for search desired ISBB threshold */
+ u16_t rxBeaconCount;
+ u8_t beaconMissState;
+ u32_t rxBeaconTotal;
+ u8_t bIsSharedKey;
+ u8_t connectTimeoutCount;
+
+ u8_t recvAtim;
+
+ /* ScanMgr Control block */
+ struct zsWlanDevStaScanMgr scanMgr;
+ struct zsWlanDevStaPSMgr psMgr;
+
+ // The callback would be called if receiving an unencrypted packets but
+ // the station is in encrypted mode. The wrapper could decide whether
+ // to drop the packet by its OS setting.
+ zfpStaRxSecurityCheckCb pStaRxSecurityCheckCb;
+
+ /* WME */
+ u8_t apWmeCapability; //bit-0 => a WME AP
+ //bit-7 => a UAPSD AP
+ u8_t wmeParameterSetCount;
+
+ u8_t wmeEnabled;
+ #define ZM_STA_WME_ENABLE_BIT 0x1
+ #define ZM_STA_UAPSD_ENABLE_BIT 0x2
+ u8_t wmeQosInfo;
+
+ u8_t wmeConnected;
+ u8_t qosInfo;
+ struct zsQueue* uapsdQ;
+
+ /* countermeasures */
+ u8_t cmMicFailureCount;
+ u8_t cmDisallowSsidLength;
+ u8_t cmDisallowSsid[32];
+
+ /* power-saving mode */
+ u8_t powerSaveMode;
+ zbuf_t* staPSDataQueue[ZM_PS_QUEUE_SIZE];
+ u8_t staPSDataCount;
+
+ /* IBSS power-saving mode */
+ /* record the STA which has entered the PS mode */
+ struct zsStaPSList staPSList;
+ /* queue the data of the PS STAs */
+ zbuf_t* ibssPSDataQueue[ZM_PS_QUEUE_SIZE];
+ u8_t ibssPSDataCount;
+ u8_t ibssPrevPSDataCount;
+ u8_t bIbssPSEnable;
+ /* BIT_15: ON/OFF, BIT_0~14: Atim Timer */
+ u16_t ibssAtimTimer;
+
+ /* WPA2 */
+ struct zsPmkidInfo pmkidInfo;
+
+ /* Multicast list related objects */
+ struct zsMulticastList multicastList;
+
+ /* XP packet filter feature : */
+ /* 1=>enable: All multicast address packets, not just the ones enumerated in the multicast address list. */
+ /* 0=>disable */
+ u8_t bAllMulticast;
+
+ /* reassociation flag */
+ u8_t connectByReasso;
+ u8_t failCntOfReasso;
+
+ /* for HT configure control setting */
+ u8_t preambleTypeHT; /* HT: 0 Mixed mode 1 Green field */
+ u8_t htCtrlBandwidth;
+ u8_t htCtrlSTBC;
+ u8_t htCtrlSG;
+ u8_t defaultTA;
+
+ u8_t connection_11b;
+
+ u8_t EnableHT;
+ u8_t SG40;
+ u8_t HT2040;
+ /* for WPA setting */
+ u8_t wpaSupport;
+ u8_t wpaLen;
+
+ /* IBSS related objects */
+ u8_t ibssDelayedInd;
+ struct zsPartnerNotifyEvent ibssDelayedIndEvent;
+ u8_t ibssPartnerStatus;
+
+ u8_t bAutoReconnect;
+
+ u8_t flagFreqChanging;
+ u8_t flagKeyChanging;
+ struct zsBssInfo ibssBssDesc;
+ u8_t ibssBssIsCreator;
+ u16_t ibssReceiveBeaconCount;
+ u8_t ibssSiteSurveyStatus;
+
+ u8_t disableProbingWithSsid;
+#ifdef ZM_ENABLE_CENC
+ /* CENC */
+ u8_t cencIe[ZM_MAX_IE_SIZE + 2];
+#endif //ZM_ENABLE_CENC
+ u32_t txiv[4]; //Tx PN Sequence
+ u32_t rxiv[4]; //Rx PN Sequence
+ u32_t rxivGK[4];//Broadcast Rx PN Sequence
+ u8_t wepKey[4][32]; // For Software WEP
+ u8_t SWEncryMode[4];
+
+ /* 802.11d */
+ u8_t b802_11D;
+
+ /* 802.11h */
+ u8_t TPCEnable;
+ u8_t DFSEnable;
+ u8_t DFSDisableTx;
+
+ /* Owl AP */
+ u8_t athOwlAp;
+
+ /* Enable BA response in driver */
+ u8_t enableDrvBA;
+
+ /* HT Capability Info */
+ union zuHTCapability HTCap; //CWYang(+)
+
+ /* Extended HT Capability Info */
+ union zuExtHTCapability ExtHTCap; //CWYang(+)
+
+ struct InformationElementSta ie;
+
+#define ZM_CACHED_FRAMEBODY_SIZE 200
+ u8_t asocReqFrameBody[ZM_CACHED_FRAMEBODY_SIZE];
+ u16_t asocReqFrameBodySize;
+ u8_t asocRspFrameBody[ZM_CACHED_FRAMEBODY_SIZE];
+ u16_t asocRspFrameBodySize;
+ u8_t beaconFrameBody[ZM_CACHED_FRAMEBODY_SIZE];
+ u16_t beaconFrameBodySize;
+
+ u8_t ac0PriorityHigherThanAc2;
+ u8_t SWEncryptEnable;
+
+ u8_t leapEnabled;
+
+ u32_t TotalNumberOfReceivePackets;
+ u32_t TotalNumberOfReceiveBytes;
+ u32_t avgSizeOfReceivePackets;
+
+ u32_t ReceivedPacketRateCounter;
+ u32_t ReceivedPktRatePerSecond;
+
+ /* #2 Record the sequence number to determine whether the unicast frame is separated by RIFS or not */
+#define ZM_RIFS_STATE_DETECTING 0
+#define ZM_RIFS_STATE_DETECTED 1
+#define ZM_RIFS_TIMER_TIMEOUT 4480 // <Driver time>4480ms <Real time>7s
+ u8_t rifsState;
+ u8_t rifsLikeFrameCnt;
+ u16_t rifsLikeFrameSequence[3];
+ u32_t rifsTimer;
+ u32_t rifsCount;
+
+ /* RX filter desired by upper layers. Note this contains some bits which must be filtered
+ by sw since the hw supports only a subset of possible filter actions.= */
+ u32_t osRxFilter;
+
+ u8_t bSafeMode;
+
+ u32_t ibssAdditionalIESize;
+ u8_t ibssAdditionalIE[256];
+}; //struct zsWlanDevSta
+
+#define ZM_CMD_QUEUE_SIZE 256 //Roger Check, test 64 when ready
+
+#define ZM_OID_READ 1
+#define ZM_OID_WRITE 2
+#define ZM_OID_INTERNAL_WRITE 3
+#define ZM_CMD_SET_FREQUENCY 4
+#define ZM_CMD_SET_KEY 5
+#define ZM_CWM_READ 6
+#define ZM_MAC_READ 7
+#define ZM_ANI_READ 8
+#define ZM_EEPROM_READ 9
+#define ZM_EEPROM_WRITE 0x0A
+#define ZM_OID_CHAN 0x30
+#define ZM_OID_SYNTH 0x32
+#define ZM_OID_TALLY 0x81
+#define ZM_OID_TALLY_APD 0x82
+
+#define ZM_OID_DKTX_STATUS 0x92
+#define ZM_OID_FLASH_CHKSUM 0xD0
+#define ZM_OID_FLASH_READ 0xD1
+#define ZM_OID_FLASH_PROGRAM 0xD2
+#define ZM_OID_FW_DL_INIT 0xD3
+
+/* Driver to Firmware OID */
+#define ZM_CMD_ECHO 0x80
+#define ZM_CMD_TALLY 0x81
+#define ZM_CMD_TALLY_APD 0x82
+#define ZM_CMD_CONFIG 0x83
+#define ZM_CMD_RREG 0x00
+#define ZM_CMD_WREG 0x01
+#define ZM_CMD_RMEM 0x02
+#define ZM_CMD_WMEM 0x03
+#define ZM_CMD_BITAND 0x04
+#define ZM_CMD_BITOR 0x05
+#define ZM_CMD_EKEY 0x28
+#define ZM_CMD_DKEY 0x29
+#define ZM_CMD_FREQUENCY 0x30
+#define ZM_CMD_RF_INIT 0x31
+#define ZM_CMD_SYNTH 0x32
+#define ZM_CMD_FREQ_STRAT 0x33
+#define ZM_CMD_RESET 0x90
+#define ZM_CMD_DKRESET 0x91
+#define ZM_CMD_DKTX_STATUS 0x92
+#define ZM_CMD_FDC 0xA0
+#define ZM_CMD_WREEPROM 0xB0
+#define ZM_CMD_WFLASH 0xB0
+#define ZM_CMD_FLASH_ERASE 0xB1
+#define ZM_CMD_FLASH_PROG 0xB2
+#define ZM_CMD_FLASH_CHKSUM 0xB3
+#define ZM_CMD_FLASH_READ 0xB4
+#define ZM_CMD_FW_DL_INIT 0xB5
+#define ZM_CMD_MEM_WREEPROM 0xBB
+
+
+/* duplicate filter table column */
+#define ZM_FILTER_TABLE_COL 2 /* 2^n */
+/* duplicate filter table Row */
+#define ZM_FILTER_TABLE_ROW 8 /* 2^n */
+
+/* duplicate filter table structure */
+struct zsRxFilter
+{
+ u16_t addr[3];
+ u16_t seq;
+ u8_t up;
+};
+
+struct zsWlanDev
+{
+ /* AP global variables */
+ struct zsWlanDevAp ap;
+ /* STA global variables */
+ struct zsWlanDevSta sta;
+ /* save wrapper setting */
+ struct zsWrapperSetting ws;
+ /* features determined by wrapper (vendor) */
+ struct zsWrapperFeatureCtrl wfc;
+ /* Traffic Monitor tally */
+ struct zsTrafTally trafTally;
+ /* Communication tally */
+ struct zsCommTally commTally;
+ /* Duplicate frame filter table */
+ struct zsRxFilter rxFilterTbl[ZM_FILTER_TABLE_COL][ZM_FILTER_TABLE_ROW];
+ /* Regulatory table */
+ struct zsRegulationTable regulationTable;
+
+ /* */
+ struct zsWlanDevFreqControl freqCtrl;
+
+ enum devState state;
+
+ u8_t halState;
+ u8_t wlanMode; /* AP/INFRASTRUCTURE/IBSS/PSEUDO */
+ u16_t macAddr[3]; /* MAC address */
+ u16_t beaconInterval; /* beacon Interval */
+ u8_t dtim; /* DTIM period */
+ u8_t CurrentDtimCount;
+ u8_t preambleType;
+ u8_t preambleTypeInUsed;
+ u8_t maxTxPower2; /* 2.4 GHz Max Tx power (Unit: 0.5 dBm) */
+ u8_t maxTxPower5; /* 5 GHz Max Tx power (Unit: 0.5 dBm) */
+ u8_t connectMode;
+ u32_t supportMode;
+
+ u8_t bRate; /* 11b Support Rate bit map */
+ u8_t bRateBasic; /* 11b Basic Rate bit map */
+ u8_t gRate; /* 11g Support Rate bit map */
+ u8_t gRateBasic; /* 11g Basic Rate bit map */
+ /* channel index point to the item in regulation table */
+ u8_t channelIndex;
+
+ /* channel management */
+ u8_t BandWidth40;
+ u8_t ExtOffset; //1 above, 3 below, 0 not present
+ u16_t frequency; /* operation frequency */
+
+ u8_t erpElement; /* ERP information element data */
+
+ u8_t disableSelfCts; /* set to 1 to disable Self-CTS */
+ u8_t bgMode;
+
+ /* private test flag */
+ u32_t enableProtectionMode; /* force enable/disable self cts */
+ u32_t checksumTest; /* OTUS checksum test 1=>zero checksum 0=>normal */
+ u32_t rxPacketDump; /* rx packet dump */
+
+ u8_t enableAggregation; /* force enable/disable A-MSPU */
+ u8_t enableWDS; /* force enable/disable WDS testing */
+ u8_t enableTxPathMode; /* OTUS special testing mode 1=>diable, 0=>enable: ZM_SYSTEM_TEST_MODE */
+ u8_t enableHALDbgInfo; /* */
+
+ u32_t forceTxTPC; /* force tx packet send TPC */
+
+ u16_t seq[4];
+ u16_t mmseq;
+
+ /* driver core time tick */
+ u32_t tick;
+ u16_t tickIbssSendBeacon;
+ u16_t tickIbssReceiveBeacon;
+
+ /* RTS threshold */
+ u16_t rtsThreshold;
+
+ /* fragmentation threshold, 256 <= value <= 2346, 0=disabled */
+ u16_t fragThreshold;
+
+ /* Tx Rate */
+ u16_t txMCS;
+ u16_t txMT;
+ u32_t CurrentTxRateKbps; //CWYang(+)
+ /* Rx Rate */
+ u32_t CurrentRxRateKbps; //Janet(+)
+ u8_t CurrentRxRateUpdated;
+ u8_t modulationType;
+ u8_t rxInfo;
+ u16_t rateField;
+
+ /* timer related objects */
+ struct zsTimerList timerList;
+ u8_t bTimerReady;
+
+ /* for defragmentation */
+ struct zsDefragList defragTable;
+
+ /* Data struct for Interface Dependent Layer */
+ //struct zsIdlStruct idlStruct;
+
+ /* Signal Strength/Quality Related Parameters */
+ u8_t SignalStrength; //CWYang(+)
+ u8_t SignalQuality; //CWYang(+)
+
+
+
+ /* QoS */
+ zbuf_t* vtxq[4][ZM_VTXQ_SIZE];
+ u16_t vtxqHead[4];
+ u16_t vtxqTail[4];
+ u16_t qosDropIpFrag[4];
+
+ /* Management Tx queue */
+ zbuf_t* vmmq[ZM_VMMQ_SIZE];
+ u16_t vmmqHead;
+ u16_t vmmqTail;
+
+ u8_t vtxqPushing;
+
+ /*
+ * add by honda
+ * 1. Aggregate queues
+ * 2. STA's associated information and queue number
+ * 3. rx aggregation re-ordering queue
+ */
+ struct aggQueue *aggQPool[ZM_AGG_POOL_SIZE];
+ u8_t aggInitiated;
+ u8_t addbaComplete;
+ u8_t addbaCount;
+ u8_t aggState;
+ u8_t destLock;
+ struct aggSta aggSta[ZM_MAX_STA_SUPPORT];
+ struct agg_tid_rx *tid_rx[ZM_AGG_POOL_SIZE];
+ struct aggTally agg_tal;
+ struct destQ destQ;
+ struct baw_enabler *baw_enabler;
+ struct ieee80211_cwm cwm;
+ u16_t reorder;
+ u16_t seq_debug;
+ /* rate control */
+ u32_t txMPDU[ZM_RATE_TABLE_SIZE];
+ u32_t txFail[ZM_RATE_TABLE_SIZE];
+ u32_t PER[ZM_RATE_TABLE_SIZE];
+ u16_t probeCount;
+ u16_t probeSuccessCount;
+ u16_t probeInterval;
+ u16_t success_probing;
+ /*
+ * end of add by honda
+ */
+
+ /* airopeek sniffer mode for upper sw */
+ u32_t swSniffer; /* window: airoPeek */
+ u32_t XLinkMode;
+
+ /* MDK mode */
+ /* init by 0=>normal driver 1=>MDK driver */
+ u32_t modeMDKEnable;
+
+ u32_t heartBeatNotification;
+
+ /* pointer for HAL Plus private memory */
+ void* hpPrivate;
+
+ /* for WPA setting */
+ //u8_t wpaSupport[ZM_MAX_AP_SUPPORT];
+ //u8_t wpaLen[ZM_MAX_AP_SUPPORT];
+ //u8_t wpaIe[ZM_MAX_AP_SUPPORT][ZM_MAX_IE_SIZE];
+
+ struct zsLedStruct ledStruct;
+
+ /* ani flag */
+ u8_t aniEnable;
+ u16_t txq_threshold;
+
+ //Skip Mic Error Check
+ u8_t TKIP_Group_KeyChanging;
+
+ u8_t dynamicSIFSEnable;
+
+ u8_t queueFlushed;
+
+ u16_t (*zfcbAuthNotify)(zdev_t* dev, u16_t* macAddr);
+ u16_t (*zfcbAsocNotify)(zdev_t* dev, u16_t* macAddr, u8_t* body, u16_t bodySize, u16_t port);
+ u16_t (*zfcbDisAsocNotify)(zdev_t* dev, u8_t* macAddr, u16_t port);
+ u16_t (*zfcbApConnectNotify)(zdev_t* dev, u8_t* macAddr, u16_t port);
+ void (*zfcbConnectNotify)(zdev_t* dev, u16_t status, u16_t* bssid);
+ void (*zfcbScanNotify)(zdev_t* dev, struct zsScanResult* result);
+ void (*zfcbMicFailureNotify)(zdev_t* dev, u16_t* addr, u16_t status);
+ void (*zfcbApMicFailureNotify)(zdev_t* dev, u8_t* addr, zbuf_t* buf);
+ void (*zfcbIbssPartnerNotify)(zdev_t* dev, u16_t status, struct zsPartnerNotifyEvent *event);
+ void (*zfcbMacAddressNotify)(zdev_t* dev, u8_t* addr);
+ void (*zfcbSendCompleteIndication)(zdev_t* dev, zbuf_t* buf);
+ void (*zfcbRecvEth)(zdev_t* dev, zbuf_t* buf, u16_t port);
+ void (*zfcbRecv80211)(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo);
+ void (*zfcbRestoreBufData)(zdev_t* dev, zbuf_t* buf);
+#ifdef ZM_ENABLE_CENC
+ u16_t (*zfcbCencAsocNotify)(zdev_t* dev, u16_t* macAddr, u8_t* body,
+ u16_t bodySize, u16_t port);
+#endif //ZM_ENABLE_CENC
+ u8_t (*zfcbClassifyTxPacket)(zdev_t* dev, zbuf_t* buf);
+ void (*zfcbHwWatchDogNotify)(zdev_t* dev);
+};
+
+
+struct zsWlanKey
+{
+ u8_t key;
+};
+
+
+/* These macros are defined here for backward compatibility */
+/* Please leave them alone */
+/* For Tx packet allocated in upper layer layer */
+#define zmw_tx_buf_readb(dev, buf, offset) zmw_buf_readb(dev, buf, offset)
+#define zmw_tx_buf_readh(dev, buf, offset) zmw_buf_readh(dev, buf, offset)
+#define zmw_tx_buf_writeb(dev, buf, offset, value) zmw_buf_writeb(dev, buf, offset, value)
+#define zmw_tx_buf_writeh(dev, buf, offset, value) zmw_buf_writeh(dev, buf, offset, value)
+
+/* For Rx packet allocated in driver */
+#define zmw_rx_buf_readb(dev, buf, offset) zmw_buf_readb(dev, buf, offset)
+#define zmw_rx_buf_readh(dev, buf, offset) zmw_buf_readh(dev, buf, offset)
+#define zmw_rx_buf_writeb(dev, buf, offset, value) zmw_buf_writeb(dev, buf, offset, value)
+#define zmw_rx_buf_writeh(dev, buf, offset, value) zmw_buf_writeh(dev, buf, offset, value)
+
+#endif /* #ifndef _STRUCT_H */
diff --git a/drivers/staging/otus/80211core/wlan.h b/drivers/staging/otus/80211core/wlan.h
new file mode 100644
index 00000000000..26c18b837cf
--- /dev/null
+++ b/drivers/staging/otus/80211core/wlan.h
@@ -0,0 +1,595 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : wlan_defs.h */
+/* */
+/* Abstract */
+/* This module contains WLAN definitions. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/************************************************************************/
+
+#ifndef _WLAN_H
+#define _WLAN_H
+
+
+#define ZM_EXTERNAL_ALLOC_BUF 0
+#define ZM_INTERNAL_ALLOC_BUF 1
+
+#define ZM_SIZE_OF_CTRL_SET 8
+#define ZM_SIZE_OF_IV 4
+#define ZM_SIZE_OF_EXT_IV 4
+#define ZM_SIZE_OF_MIC 8
+#define ZM_SIZE_OF_CCX_MIC 8
+#define ZM_SIZE_OF_WLAN_DATA_HEADER 24
+#define ZM_SIZE_OF_QOS_CTRL 2
+
+/* Header definition */
+#define ZM_SIZE_OF_WLAN_WDS_HEADER 32
+#define ZM_SIZE_OF_SNAP_HEADER 8
+
+#define ZM_WLAN_HEADER_A1_OFFSET 4
+#define ZM_WLAN_HEADER_A2_OFFSET 10
+#define ZM_WLAN_HEADER_A3_OFFSET 16
+#define ZM_WLAN_HEADER_A4_OFFSET 24
+#define ZM_WLAN_HEADER_IV_OFFSET 24
+#define ZM_SIZE_OF_WLAN_DATA_HEADER 24
+
+/* Port definition */
+#define ZM_PORT_DISABLED 0
+#define ZM_PORT_ENABLED 1
+
+/* Frame Type */
+#define ZM_WLAN_MANAGEMENT_FRAME 0x0
+#define ZM_WLAN_CONTROL_FRAME 0x4
+#define ZM_WLAN_DATA_FRAME 0x8
+
+/* Frame Subtype */
+#define ZM_WLAN_FRAME_TYPE_ASOCREQ 0x00
+#define ZM_WLAN_FRAME_TYPE_ASOCRSP 0x10
+#define ZM_WLAN_FRAME_TYPE_REASOCREQ 0x20
+#define ZM_WLAN_FRAME_TYPE_REASOCRSP 0x30
+#define ZM_WLAN_FRAME_TYPE_PROBEREQ 0x40
+#define ZM_WLAN_FRAME_TYPE_PROBERSP 0x50
+/* 0x60, 0x70 => Reserved */
+#define ZM_WLAN_FRAME_TYPE_BEACON 0x80
+#define ZM_WLAN_FRAME_TYPE_ATIM 0x90
+#define ZM_WLAN_FRAME_TYPE_DISASOC 0xA0
+#define ZM_WLAN_FRAME_TYPE_AUTH 0xB0
+#define ZM_WLAN_FRAME_TYPE_DEAUTH 0xC0
+#define ZM_WLAN_FRAME_TYPE_ACTION 0xD0
+
+/* Frame type and subtype */
+#define ZM_WLAN_FRAME_TYPE_NULL 0x48
+#define ZM_WLAN_FRAME_TYPE_BAR 0x84
+#define ZM_WLAN_FRAME_TYPE_BA 0x94
+#define ZM_WLAN_FRAME_TYPE_PSPOLL 0xA4
+#define ZM_WLAN_FRAME_TYPE_RTS 0xB4
+#define ZM_WLAN_FRAME_TYPE_CTS 0xC4
+#define ZM_WLAN_FRAME_TYPE_QOS_NULL 0xC8
+
+/* action frame */
+#define ZM_WLAN_SPECTRUM_MANAGEMENT_ACTION_FRAME 0
+#define ZM_WLAN_QOS_ACTION_FRAME 1
+#define ZM_WLAN_DLS_ACTION_FRAME 2
+#define ZM_WLAN_BLOCK_ACK_ACTION_FRAME 3
+/* block ack action frame*/
+#define ZM_WLAN_ADDBA_REQUEST_FRAME 0
+#define ZM_WLAN_ADDBA_RESPONSE_FRAME 1
+#define ZM_WLAN_DELBA_FRAME 2
+
+/* Element ID */
+#define ZM_WLAN_EID_SSID 0
+#define ZM_WLAN_EID_SUPPORT_RATE 1
+#define ZM_WLAN_EID_FH 2
+#define ZM_WLAN_EID_DS 3
+#define ZM_WLAN_EID_CFS 4
+#define ZM_WLAN_EID_TIM 5
+#define ZM_WLAN_EID_IBSS 6
+#define ZM_WLAN_EID_COUNTRY 7
+/* reserved 8-15 */
+#define ZM_WLAN_EID_CHALLENGE 16
+/* reserved 17-31 */
+#define ZM_WLAN_EID_POWER_CONSTRAINT 32
+#define ZM_WLAN_EID_POWER_CAPABILITY 33
+#define ZM_WLAN_EID_TPC_REQUEST 34
+#define ZM_WLAN_EID_TPC_REPORT 35
+#define ZM_WLAN_EID_SUPPORTED_CHANNELS 36
+#define ZM_WLAN_EID_CHANNEL_SWITCH_ANNOUNCE 37
+#define ZM_WLAN_EID_MEASUREMENT_REQUEST 38
+#define ZM_WLAN_EID_MEASUREMENT_REPORT 39
+#define ZM_WLAN_EID_QUIET 40
+#define ZM_WLAN_EID_IBSS_DFS 41
+#define ZM_WLAN_EID_ERP 42
+#define ZM_WLAN_PREN2_EID_HTCAPABILITY 45
+#define ZM_WLAN_EID_RSN_IE 48
+#define ZM_WLAN_EID_EXTENDED_RATE 50
+#define ZM_WLAN_EID_HT_CAPABILITY 51
+#define ZM_WLAN_EID_EXTENDED_HT_CAPABILITY 52
+#define ZM_WLAN_EID_NEW_EXT_CHANNEL_OFFSET 53
+#define ZM_WLAN_PREN2_EID_HTINFORMATION 61
+#define ZM_WLAN_PREN2_EID_SECONDCHOFFSET 62
+#ifdef ZM_ENABLE_CENC
+#define ZM_WLAN_EID_CENC_IE 68
+#endif //ZM_ENABLE_CENC
+#define ZM_WLAN_EID_VENDOR_PRIVATE 221 /* Vendor private space; must demux OUI */
+#define ZM_WLAN_EID_WPA_IE 221
+#define ZM_WLAN_EID_WPS_IE 221
+#define ZM_WLAN_EID_WIFI_IE 221
+
+/* ERP information element */
+#define ZM_WLAN_NON_ERP_PRESENT_BIT 0x1
+#define ZM_WLAN_USE_PROTECTION_BIT 0x2
+#define ZM_WLAN_BARKER_PREAMBLE_MODE_BIT 0x4
+
+/* Channel frequency, in MHz */
+#define ZM_CH_G_1 2412
+#define ZM_CH_G_2 2417
+#define ZM_CH_G_3 2422
+#define ZM_CH_G_4 2427
+#define ZM_CH_G_5 2432
+#define ZM_CH_G_6 2437
+#define ZM_CH_G_7 2442
+#define ZM_CH_G_8 2447
+#define ZM_CH_G_9 2452
+#define ZM_CH_G_10 2457
+#define ZM_CH_G_11 2462
+#define ZM_CH_G_12 2467
+#define ZM_CH_G_13 2472
+#define ZM_CH_G_14 2484
+#define ZM_CH_A_184 4920
+#define ZM_CH_A_188 4940
+#define ZM_CH_A_192 4960
+#define ZM_CH_A_196 4980
+#define ZM_CH_A_8 5040
+#define ZM_CH_A_12 5060
+#define ZM_CH_A_16 5080
+#define ZM_CH_A_36 5180
+#define ZM_CH_A_40 5200
+#define ZM_CH_A_44 5220
+#define ZM_CH_A_48 5240
+#define ZM_CH_A_52 5260
+#define ZM_CH_A_56 5280
+#define ZM_CH_A_60 5300
+#define ZM_CH_A_64 5320
+#define ZM_CH_A_100 5500
+#define ZM_CH_A_104 5520
+#define ZM_CH_A_108 5540
+#define ZM_CH_A_112 5560
+#define ZM_CH_A_116 5580
+#define ZM_CH_A_120 5600
+#define ZM_CH_A_124 5620
+#define ZM_CH_A_128 5640
+#define ZM_CH_A_132 5660
+#define ZM_CH_A_136 5680
+#define ZM_CH_A_140 5700
+#define ZM_CH_A_149 5745
+#define ZM_CH_A_153 5765
+#define ZM_CH_A_157 5785
+#define ZM_CH_A_161 5805
+#define ZM_CH_A_165 5825
+
+
+/* AP : STA table => STA Type */
+#define ZM_11B_STA 0x0
+#define ZM_11G_STA 0x2
+#define ZM_11N_STA 0x4
+
+/* AP : timeout */
+#define ZM_MS_PER_TICK 10
+#define ZM_TICK_PER_SECOND (1000/ZM_MS_PER_TICK)
+#define ZM_TICK_PER_MINUTE (60*1000/ZM_MS_PER_TICK)
+#define ZM_PREAUTH_TIMEOUT_MS 1000 /* 1 sec */
+#define ZM_AUTH_TIMEOUT_MS 1000 /* 1 sec */
+
+/* Error code */
+#define ZM_SUCCESS 0
+#define ZM_ERR_TX_PORT_DISABLED 1
+#define ZM_ERR_BUFFER_DMA_ADDR 2
+#define ZM_ERR_FREE_TXD_EXHAUSTED 3
+#define ZM_ERR_TX_BUFFER_UNAVAILABLE 4
+#define ZM_ERR_BCMC_PS_BUFFER_UNAVAILABLE 5
+#define ZM_ERR_UNI_PS_BUFFER_UNAVAILABLE 6
+#define ZM_ERR_EXCEED_PRIORITY_THRESHOLD 7
+#define ZM_ERR_VMMQ_FULL 8
+#define ZM_ERR_FLUSH_PS_QUEUE 9
+#define ZM_ERR_CMD_INT_MISSED 15 /* Polling cmd int timeout*/
+/* Rx */
+#define ZM_ERR_RX_FRAME_TYPE 20
+#define ZM_ERR_MIN_RX_ENCRYPT_FRAME_LENGTH 21
+#define ZM_ERR_MIN_RX_FRAME_LENGTH 22
+#define ZM_ERR_MAX_RX_FRAME_LENGTH 23
+#define ZM_ERR_RX_DUPLICATE 24
+#define ZM_ERR_RX_SRC_ADDR_IS_OWN_MAC 25
+#define ZM_ERR_MIN_RX_PROTOCOL_VERSION 26
+#define ZM_ERR_WPA_GK_NOT_INSTALLED 27
+#define ZM_ERR_STA_NOT_ASSOCIATED 28
+#define ZM_ERR_DATA_BEFORE_CONNECTED 29
+#define ZM_ERR_DATA_NOT_ENCRYPTED 30
+#define ZM_ERR_DATA_BSSID_NOT_MATCHED 31
+#define ZM_ERR_RX_BAR_FRAME 32
+#define ZM_ERR_OUT_OF_ORDER_NULL_DATA 33
+
+/* ZFI */
+#define ZM_ERR_INVALID_TX_RATE 40
+#define ZM_ERR_WDS_PORT_ID 41
+
+/* QUEUE */
+#define ZM_ERR_QUEUE_FULL 50
+#define ZM_ERR_STA_UAPSD_QUEUE_FULL 51
+#define ZM_ERR_AP_UAPSD_QUEUE_FULL 52
+
+/* Maximum Rx frame length */
+#if ZM_LARGEPAYLOAD_TEST == 1
+#define ZM_WLAN_MAX_RX_SIZE 16384
+#else
+#define ZM_WLAN_MAX_RX_SIZE 8192
+#endif
+
+/* PCI DMA test error code */
+#define ZM_ERR_INTERRUPT_MISSED 100
+#define ZM_ERR_OWN_BIT_NOT_CLEARED 101
+#define ZM_ERR_RX_SEQ_NUMBER 102
+#define ZM_ERR_RX_LENGTH 103
+#define ZM_ERR_RX_DATA 104
+#define ZM_ERR_RX_DESCRIPTOR_NUM 105
+/* Common register test error code */
+#define ZM_ERR_REGISTER_ACCESS 110 /* Register R/W test fail*/
+#define ZM_ERR_CLEAR_INTERRUPT_FLAG 111
+#define ZM_ERR_COMMAND_RESPONSE 112
+#define ZM_ERR_INTERRUPT_GENERATE 113
+#define ZM_ERR_INTERRUPT_ACK 114
+#define ZM_ERR_SCRATCH_ACCESS 115
+#define ZM_ERR_INTERRUPT_MASK_ACCESS 116
+#define ZM_ERR_SHARE_MEMORY_PCI_ACCESS 117
+#define ZM_ERR_SHARE_MEMORY_FW_ACCESS 118
+#define ZM_ERR_SHARE_MEMORY_DISABLE 119
+#define ZM_ERR_SHARE_MEMORY_TEST_RESPONSE 120
+
+/* Firmware Download error code */
+#define ZM_ERR_FIRMWARE_DOWNLOAD_TIMEOUT 150
+#define ZM_ERR_FIRMWARE_DOWNLOAD_INT_FLAG 151
+#define ZM_ERR_FIRMWARE_READY_TIMEOUT 152
+#define ZM_ERR_FIRMWARE_WRONG_TYPE 153
+
+/* Debug */
+#define ZM_LV_0 0//Debug level 0, Disable debug message
+#define ZM_LV_1 1//Debug level 1, Show minimum information
+#define ZM_LV_2 2//Debug level 2, Show medium message
+#define ZM_LV_3 3//Debug level 3, Show all
+
+#define ZM_SCANMSG_LEV ZM_LV_1
+#define ZM_TXMSG_LEV ZM_LV_0//ZM_LV_0
+#define ZM_RXMSG_LEV ZM_LV_0
+#define ZM_MMMSG_LEV ZM_LV_0
+#define ZM_DESMSG_LEV ZM_LV_0//ZM_LV_0
+#define ZM_BUFMSG_LEV ZM_LV_0//ZM_LV_1
+#define ZM_INITMSG_LEV ZM_LV_0
+
+#define zm_msg0_scan(lv, msg) if (ZM_SCANMSG_LEV >= lv) \
+ {zm_debug_msg0(msg);}
+#define zm_msg1_scan(lv, msg, val) if (ZM_SCANMSG_LEV >= lv) \
+ {zm_debug_msg1(msg, val);}
+#define zm_msg2_scan(lv, msg, val) if (ZM_SCANMSG_LEV >= lv) \
+ {zm_debug_msg2(msg, val);}
+
+#define zm_msg0_tx(lv, msg) if (ZM_TXMSG_LEV >= lv) \
+ {zm_debug_msg0(msg);}
+#define zm_msg1_tx(lv, msg, val) if (ZM_TXMSG_LEV >= lv) \
+ {zm_debug_msg1(msg, val);}
+#define zm_msg2_tx(lv, msg, val) if (ZM_TXMSG_LEV >= lv) \
+ {zm_debug_msg2(msg, val);}
+
+#define zm_msg0_rx(lv, msg) if (ZM_RXMSG_LEV >= lv) \
+ {zm_debug_msg0(msg);}
+#define zm_msg1_rx(lv, msg, val) if (ZM_RXMSG_LEV >= lv) \
+ {zm_debug_msg1(msg, val);}
+#define zm_msg2_rx(lv, msg, val) if (ZM_RXMSG_LEV >= lv) \
+ {zm_debug_msg2(msg, val);}
+
+#define zm_msg0_mm(lv, msg) if (ZM_MMMSG_LEV >= lv) \
+ {zm_debug_msg0(msg);}
+#define zm_msg1_mm(lv, msg, val) if (ZM_MMMSG_LEV >= lv) \
+ {zm_debug_msg1(msg, val);}
+#define zm_msg2_mm(lv, msg, val) if (ZM_MMMSG_LEV >= lv) \
+ {zm_debug_msg2(msg, val);}
+
+#define zm_msg0_des(lv, msg) if (ZM_DESMSG_LEV >= lv) \
+ {zm_debug_msg0(msg);}
+#define zm_msg1_des(lv, msg, val) if (ZM_DESMSG_LEV >= lv) \
+ {zm_debug_msg1(msg, val);}
+#define zm_msg2_des(lv, msg, val) if (ZM_DESMSG_LEV >= lv) \
+ {zm_debug_msg2(msg, val);}
+
+#define zm_msg0_buf(lv, msg) if (ZM_BUFMSG_LEV >= lv) \
+ {zm_debug_msg0(msg);}
+#define zm_msg1_buf(lv, msg, val) if (ZM_BUFMSG_LEV >= lv) \
+ {zm_debug_msg1(msg, val);}
+#define zm_msg2_buf(lv, msg, val) if (ZM_BUFMSG_LEV >= lv) \
+ {zm_debug_msg2(msg, val);}
+
+#define zm_msg0_init(lv, msg) if (ZM_INITMSG_LEV >= lv) \
+ {zm_debug_msg0(msg);}
+#define zm_msg1_init(lv, msg, val) if (ZM_INITMSG_LEV >= lv) \
+ {zm_debug_msg1(msg, val);}
+#define zm_msg2_init(lv, msg, val) if (ZM_INITMSG_LEV >= lv) \
+ {zm_debug_msg2(msg, val);}
+
+#define ZM_MAX_AP_SUPPORT 2 /* Must <= 8 */
+#define ZM_MAX_WDS_SUPPORT 6 /* Must <= 6 */
+#define ZM_MAX_STA_SUPPORT 16 /* Must <= 64 */
+
+/* STA table state */
+#define ZM_STATE_AUTH 1
+#define ZM_STATE_PREAUTH 2
+#define ZM_STATE_ASOC 3
+
+/* Rate set */
+#define ZM_RATE_SET_CCK 0
+#define ZM_RATE_SET_OFDM 1
+
+/* HT PT */
+#define ZM_PREAMBLE_TYPE_MIXED_MODE 0
+#define ZM_PREAMBLE_TYPE_GREEN_FIELD 1
+
+/* HT bandwidth */
+#define ZM_BANDWIDTH_20MHZ 0
+#define ZM_BANDWIDTH_40MHZ 1
+
+/* MIC status */
+#define ZM_MIC_SUCCESS 0
+#define ZM_MIC_FAILURE 1
+
+/* ICV status */
+#define ZM_ICV_SUCCESS 0
+#define ZM_ICV_FAILURE 1
+
+/* definition check */
+#if (ZM_MAX_AP_SUPPORT > 8)
+definition error, ZM_MAX_AP_SUPPORT > 8
+#endif
+#if (ZM_MAX_AP_SUPPORT > 64)
+definition error, ZM_MAX_STA_SUPPORT > 64
+#endif
+
+/* Transmission Rate information */
+
+/* WLAN frame format */
+#define ZM_PLCP_HEADER_SIZE 5
+#define ZM_ETHERNET_ADDRESS_LENGTH 6
+#define ZM_TIMESTAMP_OFFSET 0
+#define ZM_BEACON_INTERVAL_OFFSET 8
+#define ZM_CAPABILITY_OFFSET 10
+
+/* Reason Code */
+/* An unsolicited notification management frame of */
+/* type Disassocation or Deauthentication was generated. */
+#ifdef ZM_REASON_CODE
+#define ZM_WLAN_REASON_CODE_UNSPECIFIED 1
+#define ZM_WLAN_FRAME_DISASOC_DEAUTH_REASON_CODE 24
+#endif
+
+struct zsWlanManagementFrameHeader
+{
+ //u8_t plcpHdr[ZM_PLCP_HEADER_SIZE];
+ u8_t frameCtrl[2];
+ u8_t duration[2];
+ u8_t da[ZM_ETHERNET_ADDRESS_LENGTH];
+ u8_t sa[ZM_ETHERNET_ADDRESS_LENGTH];
+ u8_t bssid[ZM_ETHERNET_ADDRESS_LENGTH];
+ u8_t seqCtrl[2];
+ u8_t body[1];
+};
+
+struct zsWlanProbeRspFrameHeader
+{
+ //u8_t plcpHdr[ZM_PLCP_HEADER_SIZE];
+ u8_t frameCtrl[2];
+ u8_t duration[2];
+ u8_t da[ZM_ETHERNET_ADDRESS_LENGTH];
+ u8_t sa[ZM_ETHERNET_ADDRESS_LENGTH];
+ u8_t bssid[ZM_ETHERNET_ADDRESS_LENGTH];
+ u8_t seqCtrl[2];
+ u8_t timeStamp[8];
+ u8_t beaconInterval[2];
+ u8_t capability[2];
+ u8_t ssid[ZM_MAX_SSID_LENGTH + 2]; // EID(1) + Length(1) + SSID(32)
+} ;
+
+#define zsWlanBeaconFrameHeader zsWlanProbeRspFrameHeader
+
+struct zsWlanAuthFrameHeader
+{
+ //u8_t plcpHdr[ZM_PLCP_HEADER_SIZE];
+ u8_t frameCtrl[2];
+ u8_t duration[2];
+ u8_t address1[ZM_ETHERNET_ADDRESS_LENGTH];
+ u8_t address2[ZM_ETHERNET_ADDRESS_LENGTH];
+ u8_t address3[ZM_ETHERNET_ADDRESS_LENGTH];
+ u8_t seqCtrl[2];
+ u16_t algo;
+ u16_t seq;
+ u16_t status;
+ u8_t challengeText[255]; // the first 2 bytes are information ID, length
+};
+
+struct zsWlanAssoFrameHeader
+{
+ //u8_t plcpHdr[PLCP_HEADER_SIZE];
+ u8_t frameCtrl[2];
+ u8_t duration[2];
+ u8_t address1[ZM_ETHERNET_ADDRESS_LENGTH];
+ u8_t address2[ZM_ETHERNET_ADDRESS_LENGTH];
+ u8_t address3[ZM_ETHERNET_ADDRESS_LENGTH];
+ u8_t seqCtrl[2];
+ u8_t capability[2];
+ u16_t status;
+ u16_t aid;
+ //u8_t supportedRates[10];
+};
+
+struct zsFrag
+{
+ zbuf_t* buf[16];
+ u16_t bufType[16];
+ u16_t seq[16];
+ u8_t flag[16];
+
+};
+
+//================================
+// Hardware related definitions
+//================================
+#define ZM_MAC_REG_BASE 0x1c3000
+
+#define ZM_MAC_REG_ATIM_WINDOW (ZM_MAC_REG_BASE + 0x51C)
+#define ZM_MAC_REG_BCN_PERIOD (ZM_MAC_REG_BASE + 0x520)
+#define ZM_MAC_REG_PRETBTT (ZM_MAC_REG_BASE + 0x524)
+
+#define ZM_MAC_REG_MAC_ADDR_L (ZM_MAC_REG_BASE + 0x610)
+#define ZM_MAC_REG_MAC_ADDR_H (ZM_MAC_REG_BASE + 0x614)
+
+#define ZM_MAC_REG_GROUP_HASH_TBL_L (ZM_MAC_REG_BASE + 0x624)
+#define ZM_MAC_REG_GROUP_HASH_TBL_H (ZM_MAC_REG_BASE + 0x628)
+
+#define ZM_MAC_REG_BASIC_RATE (ZM_MAC_REG_BASE + 0x630)
+#define ZM_MAC_REG_MANDATORY_RATE (ZM_MAC_REG_BASE + 0x634)
+#define ZM_MAC_REG_RTS_CTS_RATE (ZM_MAC_REG_BASE + 0x638)
+#define ZM_MAC_REG_BACKOFF_PROTECT (ZM_MAC_REG_BASE + 0x63c)
+#define ZM_MAC_REG_RX_THRESHOLD (ZM_MAC_REG_BASE + 0x640)
+#define ZM_MAC_REG_RX_PE_DELAY (ZM_MAC_REG_BASE + 0x64C)
+
+#define ZM_MAC_REG_DYNAMIC_SIFS_ACK (ZM_MAC_REG_BASE + 0x658)
+#define ZM_MAC_REG_SNIFFER (ZM_MAC_REG_BASE + 0x674)
+#define ZM_MAC_REG_TX_UNDERRUN (ZM_MAC_REG_BASE + 0x688)
+#define ZM_MAC_REG_RX_TOTAL (ZM_MAC_REG_BASE + 0x6A0)
+#define ZM_MAC_REG_RX_CRC32 (ZM_MAC_REG_BASE + 0x6A4)
+#define ZM_MAC_REG_RX_CRC16 (ZM_MAC_REG_BASE + 0x6A8)
+#define ZM_MAC_REG_RX_ERR_UNI (ZM_MAC_REG_BASE + 0x6AC)
+#define ZM_MAC_REG_RX_OVERRUN (ZM_MAC_REG_BASE + 0x6B0)
+#define ZM_MAC_REG_RX_ERR_MUL (ZM_MAC_REG_BASE + 0x6BC)
+#define ZM_MAC_REG_TX_RETRY (ZM_MAC_REG_BASE + 0x6CC)
+#define ZM_MAC_REG_TX_TOTAL (ZM_MAC_REG_BASE + 0x6F4)
+
+
+#define ZM_MAC_REG_ACK_EXTENSION (ZM_MAC_REG_BASE + 0x690)
+#define ZM_MAC_REG_EIFS_AND_SIFS (ZM_MAC_REG_BASE + 0x698)
+
+#define ZM_MAC_REG_SLOT_TIME (ZM_MAC_REG_BASE + 0x6F0)
+
+#define ZM_MAC_REG_ROLL_CALL_TBL_L (ZM_MAC_REG_BASE + 0x704)
+#define ZM_MAC_REG_ROLL_CALL_TBL_H (ZM_MAC_REG_BASE + 0x708)
+
+#define ZM_MAC_REG_AC0_CW (ZM_MAC_REG_BASE + 0xB00)
+#define ZM_MAC_REG_AC1_CW (ZM_MAC_REG_BASE + 0xB04)
+#define ZM_MAC_REG_AC2_CW (ZM_MAC_REG_BASE + 0xB08)
+#define ZM_MAC_REG_AC3_CW (ZM_MAC_REG_BASE + 0xB0C)
+#define ZM_MAC_REG_AC4_CW (ZM_MAC_REG_BASE + 0xB10)
+#define ZM_MAC_REG_AC1_AC0_AIFS (ZM_MAC_REG_BASE + 0xB14)
+#define ZM_MAC_REG_AC3_AC2_AIFS (ZM_MAC_REG_BASE + 0xB18)
+
+#define ZM_MAC_REG_RETRY_MAX (ZM_MAC_REG_BASE + 0xB28)
+
+#define ZM_MAC_REG_TXOP_NOT_ENOUGH_INDICATION (ZM_MAC_REG_BASE + 0xB30)
+
+#define ZM_MAC_REG_AC1_AC0_TXOP (ZM_MAC_REG_BASE + 0xB44)
+#define ZM_MAC_REG_AC3_AC2_TXOP (ZM_MAC_REG_BASE + 0xB48)
+
+#define ZM_MAC_REG_ACK_TABLE (ZM_MAC_REG_BASE + 0xC00)
+
+#define ZM_MAC_REG_BCN_ADDR (ZM_MAC_REG_BASE + 0xD84)
+#define ZM_MAC_REG_BCN_LENGTH (ZM_MAC_REG_BASE + 0xD88)
+
+#define ZM_MAC_REG_BCN_PLCP (ZM_MAC_REG_BASE + 0xD90)
+#define ZM_MAC_REG_BCN_CTRL (ZM_MAC_REG_BASE + 0xD94)
+
+#define ZM_MAC_REG_BCN_HT1 (ZM_MAC_REG_BASE + 0xDA0)
+#define ZM_MAC_REG_BCN_HT2 (ZM_MAC_REG_BASE + 0xDA4)
+
+
+#define ZM_RX_STATUS_IS_MIC_FAIL(rxStatus) rxStatus->Tail.Data.ErrorIndication & ZM_BIT_6
+
+//================================
+//================================
+
+#ifdef ZM_ENABLE_NATIVE_WIFI
+#define ZM_80211_FRAME_HEADER_LEN 24
+#define ZM_80211_FRAME_TYPE_OFFSET 30 // ZM_80211_FRAME_HEADER_LEN + SNAP
+#define ZM_80211_FRAME_IP_OFFSET 32 // ZM_80211_FRAME_HEADER_LEN + SNAP + TYPE
+#else
+#define ZM_80211_FRAME_HEADER_LEN 14
+#define ZM_80211_FRAME_TYPE_OFFSET 12 // ZM_80211_FRAME_HEADER_LEN + SNAP
+#define ZM_80211_FRAME_IP_OFFSET 14 // ZM_80211_FRAME_HEADER_LEN + SNAP + TYPE
+#endif
+
+#define ZM_BSS_INFO_VALID_BIT 0x01
+#define ZM_BSS_INFO_UPDATED_BIT 0x02
+
+
+
+
+
+#define ZM_ERROR_INDICATION_RX_TIMEOUT 0x01
+#define ZM_ERROR_INDICATION_OVERRUN 0x02
+#define ZM_ERROR_INDICATION_DECRYPT_ERROR 0x04
+#define ZM_ERROR_INDICATION_CRC32_ERROR 0x08
+#define ZM_ERROR_INDICATION_ADDR_NOT_MATCH 0x10
+#define ZM_ERROR_INDICATION_CRC16_ERROR 0x20
+#define ZM_ERROR_INDICATION_MIC_ERROR 0x40
+
+#define ZM_RXMAC_STATUS_MOD_TYPE_CCK 0x00
+#define ZM_RXMAC_STATUS_MOD_TYPE_OFDM 0x01
+#define ZM_RXMAC_STATUS_MOD_TYPE_HT_OFDM 0x02
+#define ZM_RXMAC_STATUS_MOD_TYPE_DL_OFDM 0x03
+#define ZM_RXMAC_STATUS_TOTAL_ERROR 0x80
+
+
+
+
+
+#define ZM_MAX_LED_NUMBER 2
+
+#define ZM_LED_DISABLE_MODE 0x0
+#define ZM_LED_LINK_MODE 0x1
+#define ZM_LED_LINK_TR_MODE 0x2
+#define ZM_LED_TR_ON_MODE 0x3
+#define ZM_LED_TR_OFF_MODE 0x4
+
+#define ZM_LED_CTRL_FLAG_ALPHA 0x1
+
+struct zsLedStruct
+{
+ u32_t counter;
+ u32_t counter100ms;
+ u16_t ledLinkState;
+ u16_t ledMode[ZM_MAX_LED_NUMBER];
+ u32_t txTraffic;
+ u32_t rxTraffic;
+ u8_t LEDCtrlType;
+ u8_t LEDCtrlFlag; // Control Flag for vendors
+ u8_t LEDCtrlFlagFromReg; // Control Flag for vendors in registry
+};
+
+
+//HAL+ capability bits definition
+#define ZM_HP_CAP_11N 0x1
+#define ZM_HP_CAP_11N_ONE_TX_STREAM 0x2
+#define ZM_HP_CAP_2G 0x4
+#define ZM_HP_CAP_5G 0x8
+
+#endif /* #ifndef _WLAN_H */
diff --git a/drivers/staging/otus/Kconfig b/drivers/staging/otus/Kconfig
new file mode 100644
index 00000000000..d549d08fd49
--- /dev/null
+++ b/drivers/staging/otus/Kconfig
@@ -0,0 +1,32 @@
+config OTUS
+ tristate "Atheros OTUS 802.11n USB wireless support"
+ depends on USB && WLAN_80211 && MAC80211
+ default N
+ ---help---
+ Enable support for Atheros 802.11n USB hardware:
+ * UB81 - 2x2 2.4 GHz
+ * UB82 - 2x2 2.4 GHz and 5 GHz
+ * UB83 - 1x2 2.4 GHz
+
+ This includes the following devices currently on the market:
+ Dlink DWA-160A1, Netgear WNDA3100 and WN111v2, TP-Link
+ TL-WN821N, and AVM FRITZ!WLAN N USB Stick.
+
+ This driver requires its own supplicant driver for
+ wpa_supplicant 0.4.8. For your convenience you can find the
+ tarball here:
+
+ http://www.kernel.org/pub/linux/kernel/people/mcgrof/otus/wpa_supplicant-0.4.8_otus.tar.bz2
+
+ Before compiling wpa_supplicant, ensure your .config has at
+ least the following:
+ CONFIG_WIRELESS_EXTENSION=y
+ CONFIG_EAP_WSC=y
+ CONFIG_WSC_IE=y
+ CONFIG_DRIVER_WEXT=y
+ CONFIG_DRIVER_OTUS=y
+
+ After a successful compile, you can use the Atheros device as
+ shown in the example:
+ $ wpa_supplicant -Dotus -i <atheros device from ifconfig> -c /path/to/wpa_supplicant.conf -d
+
diff --git a/drivers/staging/otus/Makefile b/drivers/staging/otus/Makefile
new file mode 100644
index 00000000000..debcc5cbf87
--- /dev/null
+++ b/drivers/staging/otus/Makefile
@@ -0,0 +1,67 @@
+obj-$(CONFIG_OTUS) += arusb_lnx.o
+
+EXTRA_CFLAGS += -DAMAC
+EXTRA_CFLAGS += -DGCCK
+EXTRA_CFLAGS += -DOFDM
+EXTRA_CFLAGS += -DTXQ_IN_ISR
+EXTRA_CFLAGS += -DWLAN_HOSTIF=0 #0:USB, 1:PCI
+
+#Test Mode
+EXTRA_CFLAGS += -DZM_USB_STREAM_MODE=1
+EXTRA_CFLAGS += -DZM_USB_TX_STREAM_MODE=0
+EXTRA_CFLAGS += -DZM_PCI_DMA_TEST=0
+EXTRA_CFLAGS += -DZM_LARGEPAYLOAD_TEST=0
+EXTRA_CFLAGS += -DZM_FW_LOOP_BACK=0
+EXTRA_CFLAGS += -DZM_LINUX_TPC=1
+#EXTRA_CFLAGS += -DZM_DONT_COPY_RX_BUFFER
+
+EXTRA_CFLAGS += -DZM_HOSTAPD_SUPPORT
+#EXTRA_CFLAGS += -DfTX_GAIN_OFDM=0
+#EXTRA_CFLAGS += -DZM_CONFIG_BIG_ENDIAN -DBIG_ENDIAN
+EXTRA_CFLAGS += -DZM_HALPLUS_LOCK
+EXTRA_CFLAGS += -DZM_OTUS_LINUX_PHASE_2
+
+arusb_lnx-objs := \
+ usbdrv.o \
+ zdusb.o \
+ ioctl.o \
+ wrap_buf.o \
+ wrap_mem.o \
+ wrap_ev.o \
+ wrap_usb.o \
+ wrap_pkt.o \
+ wrap_dbg.o \
+ wrap_mis.o \
+ wrap_sec.o \
+ wwrap.o \
+ 80211core/ccmd.o \
+ 80211core/chb.o \
+ 80211core/cinit.o \
+ 80211core/cmm.o \
+ 80211core/cmmap.o \
+ 80211core/cmmsta.o \
+ 80211core/cfunc.o \
+ 80211core/coid.o \
+ 80211core/ctkip.o \
+ 80211core/ctxrx.o \
+ 80211core/cic.o \
+ 80211core/cpsmgr.o \
+ 80211core/cscanmgr.o \
+ 80211core/ratectrl.o \
+ 80211core/ledmgr.o \
+ 80211core/amsdu.o \
+ 80211core/cwm.o \
+ 80211core/cagg.o \
+ 80211core/queue.o \
+ 80211core/freqctrl.o \
+ 80211core/cwep.o \
+ hal/hprw.o \
+ hal/hpmain.o \
+ hal/hpusb.o \
+ hal/hpreg.o \
+ hal/hpfwuinit.o \
+ hal/hpfwbu.o \
+ hal/hpfw2.o \
+ hal/hpDKfwu.o \
+ hal/hpfwspiu.o \
+ hal/hpani.o
diff --git a/drivers/staging/otus/TODO b/drivers/staging/otus/TODO
new file mode 100644
index 00000000000..e912293ed1e
--- /dev/null
+++ b/drivers/staging/otus/TODO
@@ -0,0 +1,9 @@
+TODO:
+ - checkpatch.pl cleanups
+ - sparse cleanups
+ - port to in-kernel 80211 stack
+ - proper network developer maintainer
+
+Please send any patches to Greg Kroah-Hartman <greg@kroah.com> and
+Luis Rodriguez <Luis.Rodriguez@Atheros.com> and the
+otus-devel@lists.madwifi-project.org mailing list.
diff --git a/drivers/staging/otus/apdbg.c b/drivers/staging/otus/apdbg.c
new file mode 100644
index 00000000000..d3e2f622419
--- /dev/null
+++ b/drivers/staging/otus/apdbg.c
@@ -0,0 +1,457 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : apdbg.c */
+/* */
+/* Abstract */
+/* Debug tools */
+/* */
+/* NOTES */
+/* None */
+/* */
+/************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <netinet/in.h>
+
+#include <linux/sockios.h>
+
+#define ZM_IOCTL_REG_READ 0x01
+#define ZM_IOCTL_REG_WRITE 0x02
+#define ZM_IOCTL_MEM_DUMP 0x03
+#define ZM_IOCTL_REG_DUMP 0x05
+#define ZM_IOCTL_TXD_DUMP 0x06
+#define ZM_IOCTL_RXD_DUMP 0x07
+#define ZM_IOCTL_MEM_READ 0x0B
+#define ZM_IOCTL_MEM_WRITE 0x0C
+#define ZM_IOCTL_DMA_TEST 0x10
+#define ZM_IOCTL_REG_TEST 0x11
+#define ZM_IOCTL_TEST 0x80
+#define ZM_IOCTL_TALLY 0x81 //CWYang(+)
+#define ZM_IOCTL_RTS 0xA0
+#define ZM_IOCTL_MIX_MODE 0xA1
+#define ZM_IOCTL_FRAG 0xA2
+#define ZM_IOCTL_SCAN 0xA3
+#define ZM_IOCTL_KEY 0xA4
+#define ZM_IOCTL_RATE 0xA5
+#define ZM_IOCTL_ENCRYPTION_MODE 0xA6
+#define ZM_IOCTL_GET_TXCNT 0xA7
+#define ZM_IOCTL_GET_DEAGG_CNT 0xA8
+#define ZM_IOCTL_DURATION_MODE 0xA9
+#define ZM_IOCTL_SET_AES_KEY 0xAA
+#define ZM_IOCTL_SET_AES_MODE 0xAB
+#define ZM_IOCTL_SIGNAL_STRENGTH 0xAC //CWYang(+)
+#define ZM_IOCTL_SIGNAL_QUALITY 0xAD //CWYang(+)
+#define ZM_IOCTL_SET_PIBSS_MODE 0xAE
+#define ZDAPIOCTL SIOCDEVPRIVATE
+
+struct zdap_ioctl {
+ unsigned short cmd; /* Command to run */
+ unsigned int addr; /* Length of the data buffer */
+ unsigned int value; /* Pointer to the data buffer */
+ unsigned char data[0x100];
+};
+
+/* Declaration of macro and function for handling WEP Keys */
+
+#if 0
+
+#define SKIP_ELEM { \
+ while(isxdigit(*p)) \
+ p++; \
+}
+
+#define SKIP_DELIMETER { \
+ if(*p == ':' || *p == ' ') \
+ p++; \
+}
+
+#endif
+
+char hex(char);
+unsigned char asctohex(char *str);
+
+char *prgname;
+
+int set_ioctl(int sock, struct ifreq *req)
+{
+ if (ioctl(sock, ZDAPIOCTL, req) < 0) {
+ fprintf(stderr, "%s: ioctl(SIOCGIFMAP): %s\n",
+ prgname, strerror(errno));
+ return -1;
+ }
+
+ return 0;
+}
+
+
+int read_reg(int sock, struct ifreq *req)
+{
+ struct zdap_ioctl *zdreq = 0;
+
+ if (!set_ioctl(sock, req))
+ return -1;
+
+ //zdreq = (struct zdap_ioctl *)req->ifr_data;
+ //printf( "reg = %4x, value = %4x\n", zdreq->addr, zdreq->value);
+
+ return 0;
+}
+
+
+int read_mem(int sock, struct ifreq *req)
+{
+ struct zdap_ioctl *zdreq = 0;
+ int i;
+
+ if (!set_ioctl(sock, req))
+ return -1;
+
+ /*zdreq = (struct zdap_ioctl *)req->ifr_data;
+ printf( "dump mem from %x, length = %x\n", zdreq->addr, zdreq->value);
+
+ for (i=0; i<zdreq->value; i++) {
+ printf("%02x", zdreq->data[i]);
+ printf(" ");
+
+ if ((i>0) && ((i+1)%16 == 0))
+ printf("\n");
+ }*/
+
+ return 0;
+}
+
+
+int main(int argc, char **argv)
+{
+ int sock;
+ int addr, value;
+ struct ifreq req;
+ char *action = NULL;
+ struct zdap_ioctl zdreq;
+
+ prgname = argv[0];
+
+ if (argc < 3) {
+ fprintf(stderr,"%s: usage is \"%s <ifname> <operation> [<address>] [<value>]\"\n",
+ prgname, prgname);
+ fprintf(stderr,"valid operation: read, write, mem, reg,\n");
+ fprintf(stderr," : txd, rxd, rmem, wmem\n");
+ fprintf(stderr," : dmat, regt, test\n");
+
+ fprintf(stderr," scan, Channel Scan\n");
+ fprintf(stderr," rts <decimal>, Set RTS Threshold\n");
+ fprintf(stderr," frag <decimal>, Set Fragment Threshold\n");
+ fprintf(stderr," rate <0-28>, 0:AUTO, 1-4:CCK, 5-12:OFDM, 13-28:HT\n");
+ fprintf(stderr," TBD mix <0 or 1>, Set 1 to enable mixed mode\n");
+ fprintf(stderr," enc, <0-3>, 0=>OPEN, 1=>WEP64, 2=>WEP128, 3=>WEP256\n");
+ fprintf(stderr," skey <key>, Set WEP key\n");
+ fprintf(stderr," txcnt, Get TxQ Cnt\n");
+ fprintf(stderr," dagcnt, Get Deaggregate Cnt\n");
+ fprintf(stderr," durmode <mode>, Set Duration Mode 0=>HW, 1=>SW\n");
+ fprintf(stderr," aeskey <user> <key>\n");
+ fprintf(stderr," aesmode <mode>\n");
+ fprintf(stderr," wlanmode <0,1> 0:Station mode, 1:PIBSS mode\n");
+ fprintf(stderr," tal <0,1>, Get Current Tally Info, 0=>read, 1=>read and reset\n");
+
+ exit(1);
+ }
+
+ strcpy(req.ifr_name, argv[1]);
+ zdreq.addr = 0;
+ zdreq.value = 0;
+
+ /* a silly raw socket just for ioctl()ling it */
+ sock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
+ if (sock < 0) {
+ fprintf(stderr, "%s: socket(): %s\n", argv[0], strerror(errno));
+ exit(1);
+ }
+
+ if (argc >= 4)
+ {
+ sscanf(argv[3], "%x", &addr);
+ }
+
+ if (argc >= 5)
+ {
+ sscanf(argv[4], "%x", &value);
+ }
+
+ zdreq.addr = addr;
+ zdreq.value = value;
+
+ if (!strcmp(argv[2], "read"))
+ {
+ zdreq.cmd = ZM_IOCTL_REG_READ;
+ }
+ else if (!strcmp(argv[2], "mem"))
+ {
+ zdreq.cmd = ZM_IOCTL_MEM_DUMP;
+ }
+ else if (!strcmp(argv[2], "write"))
+ {
+ zdreq.cmd = ZM_IOCTL_REG_WRITE;
+ }
+ else if (!strcmp(argv[2], "reg"))
+ {
+ zdreq.cmd = ZM_IOCTL_REG_DUMP;
+ }
+ else if (!strcmp(argv[2], "txd"))
+ {
+ zdreq.cmd = ZM_IOCTL_TXD_DUMP;
+ }
+ else if (!strcmp(argv[2], "rxd"))
+ {
+ zdreq.cmd = ZM_IOCTL_RXD_DUMP;
+ }
+ else if (!strcmp(argv[2], "rmem"))
+ {
+ zdreq.cmd = ZM_IOCTL_MEM_READ;
+ }
+ else if (!strcmp(argv[2], "wmem"))
+ {
+ zdreq.cmd = ZM_IOCTL_MEM_WRITE;
+ }
+ else if (!strcmp(argv[2], "dmat"))
+ {
+ zdreq.cmd = ZM_IOCTL_DMA_TEST;
+ }
+ else if (!strcmp(argv[2], "regt"))
+ {
+ zdreq.cmd = ZM_IOCTL_REG_TEST;
+ }
+ else if (!strcmp(argv[2], "test"))
+ {
+ zdreq.cmd = ZM_IOCTL_TEST;
+ }
+ else if (!strcmp(argv[2], "tal"))
+ {
+ sscanf(argv[3], "%d", &addr);
+ zdreq.addr = addr;
+ zdreq.cmd = ZM_IOCTL_TALLY;
+ }
+ else if (!strcmp(argv[2], "rts"))
+ {
+ sscanf(argv[3], "%d", &addr);
+ zdreq.addr = addr;
+ zdreq.cmd = ZM_IOCTL_RTS;
+ }
+ else if (!strcmp(argv[2], "mix"))
+ {
+ zdreq.cmd = ZM_IOCTL_MIX_MODE;
+ }
+ else if (!strcmp(argv[2], "frag"))
+ {
+ sscanf(argv[3], "%d", &addr);
+ zdreq.addr = addr;
+ zdreq.cmd = ZM_IOCTL_FRAG;
+ }
+ else if (!strcmp(argv[2], "scan"))
+ {
+ zdreq.cmd = ZM_IOCTL_SCAN;
+ }
+ else if (!strcmp(argv[2], "skey"))
+ {
+ zdreq.cmd = ZM_IOCTL_KEY;
+
+ if (argc >= 4)
+ {
+ unsigned char temp[29];
+ int i;
+ int keyLen;
+ int encType;
+
+ keyLen = strlen(argv[3]);
+
+ if (keyLen == 10)
+ {
+ sscanf(argv[3], "%02x%02x%02x%02x%02x", &temp[0], &temp[1],
+ &temp[2], &temp[3], &temp[4]);
+ }
+ else if (keyLen == 26)
+ {
+ sscanf(argv[3], "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
+ &temp[0], &temp[1], &temp[2], &temp[3], &temp[4],
+ &temp[5], &temp[6], &temp[7], &temp[8], &temp[9],
+ &temp[10], &temp[11], &temp[12]);
+ }
+ else if (keyLen == 58)
+ {
+ sscanf(argv[3], "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
+ &temp[0], &temp[1], &temp[2], &temp[3], &temp[4],
+ &temp[5], &temp[6], &temp[7], &temp[8], &temp[9],
+ &temp[10], &temp[11], &temp[12], &temp[13], &temp[14],
+ &temp[15], &temp[16], &temp[17], &temp[18], &temp[19],
+ &temp[20], &temp[21], &temp[22], &temp[23], &temp[24],
+ &temp[25], &temp[26], &temp[27], &temp[28]);
+ }
+ else
+ {
+ fprintf(stderr, "Invalid key length\n");
+ exit(1);
+ }
+ zdreq.addr = keyLen/2;
+
+ for(i=0; i<zdreq.addr; i++)
+ {
+ zdreq.data[i] = temp[i];
+ }
+ }
+ else
+ {
+ printf("Error : Key required!\n");
+ }
+ }
+ else if (!strcmp(argv[2], "rate"))
+ {
+ sscanf(argv[3], "%d", &addr);
+
+ if (addr > 28)
+ {
+ fprintf(stderr, "Invalid rate, range:0~28\n");
+ exit(1);
+ }
+ zdreq.addr = addr;
+ zdreq.cmd = ZM_IOCTL_RATE;
+ }
+ else if (!strcmp(argv[2], "enc"))
+ {
+ sscanf(argv[3], "%d", &addr);
+
+ if (addr > 3)
+ {
+ fprintf(stderr, "Invalid encryption mode, range:0~3\n");
+ exit(1);
+ }
+
+ if (addr == 2)
+ {
+ addr = 5;
+ }
+ else if (addr == 3)
+ {
+ addr = 6;
+ }
+
+ zdreq.addr = addr;
+ zdreq.cmd = ZM_IOCTL_ENCRYPTION_MODE;
+ }
+ else if (!strcmp(argv[2], "txcnt"))
+ {
+ zdreq.cmd = ZM_IOCTL_GET_TXCNT;
+ }
+ else if (!strcmp(argv[2], "dagcnt"))
+ {
+ sscanf(argv[3], "%d", &addr);
+
+ if (addr != 0 && addr != 1)
+ {
+ fprintf(stderr, "The value should be 0 or 1\n");
+ exit(0);
+ }
+
+ zdreq.addr = addr;
+ zdreq.cmd = ZM_IOCTL_GET_DEAGG_CNT;
+ }
+ else if (!strcmp(argv[2], "durmode"))
+ {
+ sscanf(argv[3], "%d", &addr);
+
+ if (addr != 0 && addr != 1)
+ {
+ fprintf(stderr, "The Duration mode should be 0 or 1\n");
+ exit(0);
+ }
+
+ zdreq.addr = addr;
+ zdreq.cmd = ZM_IOCTL_DURATION_MODE;
+ }
+ else if (!strcmp(argv[2], "aeskey"))
+ {
+ unsigned char temp[16];
+ int i;
+
+ sscanf(argv[3], "%d", &addr);
+
+ sscanf(argv[4], "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", &temp[0], &temp[1], &temp[2], &temp[3], &temp[4], &temp[5], &temp[6], &temp[7], &temp[8], &temp[9], &temp[10], &temp[11], &temp[12], &temp[13], &temp[14], &temp[15]);
+
+ for(i = 0; i < 16; i++)
+ {
+ zdreq.data[i] = temp[i];
+ }
+
+ zdreq.addr = addr;
+ zdreq.cmd = ZM_IOCTL_SET_AES_KEY;
+ }
+ else if (!strcmp(argv[2], "aesmode"))
+ {
+ sscanf(argv[3], "%d", &addr);
+
+ zdreq.addr = addr;
+ zdreq.cmd = ZM_IOCTL_SET_AES_MODE;
+ }
+ else if (!strcmp(argv[2], "wlanmode"))
+ {
+ sscanf(argv[3], "%d", &addr);
+
+ zdreq.addr = addr;
+ zdreq.cmd = ZM_IOCTL_SET_PIBSS_MODE;
+ }
+ else
+ {
+ fprintf(stderr, "error action\n");
+ exit(1);
+ }
+
+ req.ifr_data = (char *)&zdreq;
+ set_ioctl(sock, &req);
+
+fail:
+ exit(0);
+}
+
+unsigned char asctohex(char *str)
+{
+ unsigned char value;
+
+ value = hex(*str) & 0x0f;
+ value = value << 4;
+ str++;
+ value |= hex(*str) & 0x0f;
+
+ return value;
+}
+
+char hex(char v)
+{
+ if(isdigit(v))
+ return v - '0';
+ else if(isxdigit(v))
+ return (tolower(v) - 'a' + 10);
+ else
+ return 0;
+}
+
diff --git a/drivers/staging/otus/athr_common.h b/drivers/staging/otus/athr_common.h
new file mode 100644
index 00000000000..620f78a41d5
--- /dev/null
+++ b/drivers/staging/otus/athr_common.h
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* Module Name : athr_common.h */
+/* */
+/* Abstract */
+/* WPA related function and data structure definitions. */
+/* */
+/* NOTES */
+/* Platform dependent. */
+/* */
+/************************************************************************/
+
+#ifndef _ATHR_COMMON_H
+#define _ATHR_COMMON_H
+
+#define ZD_IOCTL_WPA (SIOCDEVPRIVATE + 1)
+#define ZD_IOCTL_PARAM (SIOCDEVPRIVATE + 2)
+#define ZD_IOCTL_GETWPAIE (SIOCDEVPRIVATE + 3)
+#define ZD_PARAM_ROAMING 0x0001
+#define ZD_PARAM_PRIVACY 0x0002
+#define ZD_PARAM_WPA 0x0003
+#define ZD_PARAM_COUNTERMEASURES 0x0004
+#define ZD_PARAM_DROPUNENCRYPTED 0x0005
+#define ZD_PARAM_AUTH_ALGS 0x0006
+
+#define ZD_CMD_SET_ENCRYPT_KEY 0x0001
+#define ZD_CMD_SET_MLME 0x0002
+#define ZD_CMD_SCAN_REQ 0x0003
+#define ZD_CMD_SET_GENERIC_ELEMENT 0x0004
+#define ZD_CMD_GET_TSC 0x0005
+
+#define ZD_FLAG_SET_TX_KEY 0x0001
+
+#define ZD_GENERIC_ELEMENT_HDR_LEN \
+((int) (&((struct athr_wlan_param *) 0)->u.generic_elem.data))
+
+#define ZD_CRYPT_ALG_NAME_LEN 16
+#define ZD_MAX_KEY_SIZE 32
+#define ZD_MAX_GENERIC_SIZE 64
+
+#define IEEE80211_ADDR_LEN 6
+#define IEEE80211_MAX_IE_SIZE 256
+
+#ifdef ZM_ENALBE_WAPI
+#define ZM_CMD_WAPI_SETWAPI 0x0001
+#define ZM_CMD_WAPI_GETWAPI 0x0002
+#define ZM_CMD_WAPI_SETKEY 0x0003
+#define ZM_CMD_WAPI_GETKEY 0x0004
+#define ZM_CMD_WAPI_REKEY 0x0005
+
+#define ZM_WAPI_WAI_REQUEST 0x00f1
+#define ZM_WAPI_UNICAST_REKEY 0x00f2
+#define ZM_WAPI_STA_AGING 0x00f3
+#define ZM_WAPI_MULTI_REKEY 0x00f4
+
+#define ZM_WAPI_KEY_SIZE 32
+#define ZM_WAPI_IV_LEN 16
+#endif //ZM_ENALBE_WAPI
+/* structure definition */
+
+struct athr_wlan_param {
+ u32 cmd;
+ u8 sta_addr[ETH_ALEN];
+ union {
+ struct {
+ u8 alg[ZD_CRYPT_ALG_NAME_LEN];
+ u32 flags;
+ u32 err;
+ u8 idx;
+ u8 seq[8]; /* sequence counter (set: RX, get: TX) */
+ u16 key_len;
+ u8 key[ZD_MAX_KEY_SIZE];
+ } crypt;
+ struct {
+ u32 flags_and;
+ u32 flags_or;
+ } set_flags_sta;
+ struct {
+ u8 len;
+ u8 data[ZD_MAX_GENERIC_SIZE];
+ } generic_elem;
+ struct {
+#define MLME_STA_DEAUTH 0
+#define MLME_STA_DISASSOC 1
+ u16 cmd;
+ u16 reason_code;
+ } mlme;
+ struct {
+ u8 ssid_len;
+ u8 ssid[32];
+ } scan_req;
+ } u;
+};
+
+struct ieee80211req_wpaie {
+ u8 wpa_macaddr[IEEE80211_ADDR_LEN];
+ u8 wpa_ie[IEEE80211_MAX_IE_SIZE];
+};
+
+#ifdef ZM_ENALBE_WAPI
+struct athr_wapi_param {
+ u16 cmd;
+ u16 len;
+
+ union {
+ struct {
+ u8 sta_addr[ETH_ALEN];
+ u8 reserved;
+ u8 keyid;
+ u8 key[ZM_WAPI_KEY_SIZE];
+ } crypt;
+ struct {
+ u8 wapi_policy;
+ } info;
+ } u;
+};
+
+struct athr_wapi_sta_info
+{
+ u16 msg_type;
+ u16 datalen;
+ u8 sta_mac[ETH_ALEN];
+ u8 reserve_data[2];
+ u8 gsn[ZM_WAPI_IV_LEN];
+ u8 wie[256];
+};
+#endif //ZM_ENALBE_WAPI
+#endif
diff --git a/drivers/staging/otus/hal/hpDKfwu.c b/drivers/staging/otus/hal/hpDKfwu.c
new file mode 100644
index 00000000000..144c62dc8da
--- /dev/null
+++ b/drivers/staging/otus/hal/hpDKfwu.c
@@ -0,0 +1,832 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include "../80211core/cprecomp.h"
+
+const u32_t zcDKFwImage[] = {
+0x0009000B, 0x4F222FE6, 0xDE3E7FFC, 0xE114D73E,
+0x1E13D43E, 0x1E4C470B, 0x0009B017, 0x956EE600,
+0xC84060E2, 0x2F028F03, 0x8FF93652, 0xD4387601,
+0x4E0BDE38, 0xD4380009, 0x00094E0B, 0x4E0BD437,
+0x7F040009, 0xA0364F26, 0x4F226EF6, 0x410BD134,
+0xD4340009, 0x0009440B, 0x450BD533, 0xD7330009,
+0xD233E1FF, 0x2712611D, 0xD4325029, 0xE1FFCB01,
+0x1209E501, 0x12112212, 0xD52F2452, 0xD22F9740,
+0xE7002572, 0xD42FD12E, 0x2270D62F, 0x2172E201,
+0x26202420, 0xE4FFD62D, 0xE6002641, 0xE104D52C,
+0x6063666D, 0x626D7601, 0x32124000, 0x05458FF8,
+0x000B4F26, 0xEAC80009, 0xDB266AAC, 0xDD27DC26,
+0xD828DE27, 0x4C0BE901, 0x4D0B0009, 0x4E0B0009,
+0x60B20009, 0x89078801, 0x6242D423, 0x890332A6,
+0x6050D522, 0x8BEE8801, 0x2B92D41F, 0x26686642,
+0x480B89E9, 0xD51D0009, 0xAFE4E200, 0x27102520,
+0x00000FA0, 0x001C001C, 0x00200ED4, 0x0000B38E,
+0x00202F90, 0x00201356, 0x00202F9C, 0x00202FB4,
+0x00201314, 0x00201412, 0x00200EF8, 0x001C3510,
+0x001C3624, 0x001E212C, 0x00202F00, 0x00202A9C,
+0x00202F08, 0x00202F14, 0x00202F20, 0x00202F22,
+0x00202F26, 0x001C1028, 0x00201220, 0x0020294C,
+0x00201D10, 0x00201EC8, 0x00203220, 0x00202F24,
+0x2FB62F96, 0x2FD62FC6, 0x4F222FE6, 0xDE947F80,
+0x61E0E024, 0x0F14D493, 0x710161E3, 0xD7926210,
+0x470BE028, 0xD5910F24, 0x0009450B, 0x6D032008,
+0x1F0B8F11, 0xD48FDC8E, 0xDD8F67C0, 0x657C4D0B,
+0xDD8FD18E, 0x6B9C6910, 0x420862B3, 0x32B84208,
+0x3D2C4208, 0xE0281FDB, 0xE58004FC, 0x604C66E2,
+0x3050655C, 0x2D628F13, 0x01FCE024, 0x641CE500,
+0x625DDE84, 0x8B013243, 0x0009A39E, 0x6753655D,
+0x607037EC, 0x39DC6953, 0xAFF27501, 0x20088094,
+0xE0248B13, 0xE50001FC, 0xA009DE7A, 0x655D641C,
+0x32EC6253, 0x6C536B22, 0x3CDC67B2, 0x75041C71,
+0x3243625D, 0xA37F8BF3, 0x88012D10, 0xE0248B16,
+0xE40001FC, 0x671C2D40, 0x624DDE6E, 0x8B013273,
+0x0009A372, 0x6CE3644D, 0x7C046943, 0x39EC6B43,
+0x65923BCC, 0x74086DB2, 0x25D2AFEF, 0x8B198804,
+0x01FCE024, 0x2D70E700, 0x1FD86D1C, 0x627DDE61,
+0x8B0132D3, 0x0009A358, 0x6B73677D, 0x3BEC61E3,
+0x710464B2, 0x3C1C6C73, 0x694265C2, 0x29597708,
+0x2492AFED, 0x8B188805, 0x01FCE024, 0x2D40E400,
+0xDE54671C, 0x3273624D, 0xA33D8B01, 0x644D0009,
+0x6BE36D43, 0x65D23DEC, 0x61437B04, 0x6C1231BC,
+0x74086952, 0xAFED29CB, 0x88312592, 0xDE4A8B20,
+0x65E6DB4A, 0x61E6DC4A, 0x67E2D94A, 0x62E27E04,
+0x1FEC7EE8, 0x7E0464E2, 0x6EE21FED, 0x5BFD2BE0,
+0x60B27B04, 0xC9011FBE, 0x6BB22C00, 0x29B04B09,
+0xDC412F26, 0x66134C0B, 0xE2007F04, 0x2D20A30C,
+0x8B218830, 0xD939DE38, 0xE06465E6, 0x720462E3,
+0x672666E2, 0x6E23DC36, 0x62227EE8, 0x6BE261E6,
+0x29B01FEF, 0x7E040F16, 0xC90160E2, 0x6EE22C00,
+0x4E09DC30, 0x2F262CE0, 0xD130E068, 0x04FE410B,
+0xE2007F04, 0x2D20A2E8, 0x8B058833, 0x4E0BDE2C,
+0xE1000009, 0x2D10A2E0, 0x89018828, 0x0009A106,
+0xE143DE20, 0xE04062E1, 0x3217622D, 0x0FE68F04,
+0x6023E240, 0x262106FE, 0x8B013217, 0x0009A0EF,
+0x02FEE040, 0x8521E401, 0x8B013046, 0x0009A0E7,
+0xE501E040, 0x2D5007FE, 0x6471B2C7, 0x09FEE040,
+0x6291E143, 0x652DE068, 0x8D6B3517, 0xE6400F56,
+0x8B273563, 0xE048E600, 0xE11A0F65, 0x72C0A031,
+0x00117800, 0x00202FB8, 0x00201356, 0x00202480,
+0x00202F1A, 0x00202FBC, 0x002013A2, 0x00202F19,
+0x00202B40, 0x00117804, 0x00117810, 0x00202F15,
+0x00202F16, 0x00202F17, 0x00200B84, 0x00200BD8,
+0x00200BD4, 0x41216153, 0x41214121, 0x41214121,
+0x45214521, 0x60534521, 0x6603C903, 0x0F65E048,
+0xE0077118, 0xE0442209, 0x641D0F25, 0x65F3E04C,
+0x0F46B314, 0x04FDE048, 0x0BFDE044, 0x61BD674D,
+0x41084708, 0x0F16E050, 0xD2936073, 0x420B09FE,
+0x6C07E00F, 0x607329C9, 0xE0400F96, 0x65F30EFE,
+0x6D0D85E2, 0x01FEE050, 0x60D3420B, 0x6073290B,
+0xE04C0F96, 0x04FEB2D9, 0x06FEE040, 0x6261E068,
+0x0F56652D, 0x3563E640, 0xE000894E, 0x602381F8,
+0x4008C903, 0x6B034000, 0xE0546103, 0xE0580FB6,
+0xECFFDD7D, 0x6CCC0FF6, 0x0FD6E06C, 0x4D0B60C3,
+0x42216253, 0x42214221, 0x64234221, 0x324C4200,
+0xE05C6E07, 0x45214200, 0xE0400FE6, 0x0BFE4521,
+0xC9036053, 0x30FC4008, 0x6D037B06, 0x85F81F05,
+0x6C2D1FB7, 0x1FC66E03, 0x0FC6E060, 0x05FEE058,
+0x64C3B2B4, 0x33FCE354, 0x563262D2, 0x22696132,
+0x67B42D22, 0x490B5936, 0x220B607C, 0x05FEE058,
+0x64C32D22, 0x7E01B289, 0xE70662ED, 0x8FE33273,
+0xE0407C01, 0x626106FE, 0x06FEE040, 0x85614200,
+0x302C760C, 0x6103701B, 0x64F3E500, 0x7501E704,
+0x6B5D6966, 0x24923B73, 0x74048FF9, 0xB26C65F3,
+0xE040641D, 0xB20506FE, 0xA1DD6461, 0xD44F0009,
+0xE201D74F, 0x2D20470B, 0x0009A1D6, 0x8B078829,
+0xEC00DE4C, 0x61E22DC0, 0x641DB1D7, 0x0009A1CC,
+0x622CE281, 0x8B013020, 0x0009A118, 0x06FCE028,
+0xE682626C, 0x3260666C, 0xA0EE8B01, 0xE6830009,
+0x3260666C, 0xA0DC8B01, 0xE6900009, 0x3260666C,
+0xA0D08B01, 0xE6910009, 0x3260666C, 0xA0B98B01,
+0xE6B00009, 0x3260666C, 0xA07F8B01, 0xE6BB0009,
+0x3260666C, 0xE6928920, 0x3260666C, 0xE4008B14,
+0xEB04D531, 0x52516652, 0x8B073620, 0x624D7401,
+0x8FF732B7, 0xE6007508, 0x52FBA002, 0xE60152FB,
+0xE6041261, 0x2260A188, 0xD229D428, 0xD4296542,
+0x0009420B, 0x0009A180, 0xE100E670, 0x601336FC,
+0xE0248162, 0x0BFCD21F, 0x6BBC6722, 0x26727BFC,
+0xEB0416B2, 0x06FEE078, 0x3263621D, 0xA16B8B01,
+0xDE1D0009, 0x31EC611D, 0xD41C6E12, 0x410BD114,
+0xE0700009, 0x450BD51A, 0xD41A04FE, 0x420BD210,
+0xD2170009, 0x64E3420B, 0xD60DD417, 0x0009460B,
+0x05FEE070, 0x01FDE074, 0x611DE600, 0x6253351C,
+0x326C666D, 0x22E07601, 0x32B3626D, 0x4E198FF7,
+0xE0747104, 0x0F15AFCE, 0x002029F8, 0x00202FDC,
+0x00201356, 0x00117804, 0x00202B10, 0x00117800,
+0x002013A2, 0x00203014, 0x00117808, 0x00202FF4,
+0x0020139A, 0x00203008, 0x00203010, 0x02FCE024,
+0x672CE07C, 0xEC000F76, 0xE07CEB04, 0x62CD07FE,
+0x8B013273, 0x0009A118, 0x6CCDD7B9, 0x357C65C3,
+0x62C37704, 0xD4B7327C, 0x6D52D7B7, 0x6E22470B,
+0x470BD7B6, 0xD4B664D3, 0x420BD2B3, 0xD2B30009,
+0x64E3420B, 0xD6B0D4B3, 0x0009460B, 0x67D3E600,
+0x376C666D, 0x626D7601, 0x27E032B3, 0x4E198FF7,
+0x7C08AFD3, 0x6212D1A6, 0x2228622C, 0xD2AA8B04,
+0x0009420B, 0x0009A003, 0x420BD2A8, 0x56FB0009,
+0xA0E1E200, 0xB1A62620, 0x56FB0009, 0xA0DBE200,
+0x52FB2620, 0xE500D69A, 0x65622250, 0x7604D2A0,
+0x62622252, 0xA0CFD69F, 0x56FB2620, 0x2610E124,
+0x5217D19D, 0x52181621, 0x52191622, 0x521A1623,
+0x551B1624, 0x1655E200, 0x1656551C, 0x1657551D,
+0x1658551E, 0x1659551F, 0x11281127, 0x112A1129,
+0x112C112B, 0x112E112D, 0x112FA0AE, 0xD68FD18E,
+0x6262E040, 0x76046512, 0x2152352C, 0x55116266,
+0x1151352C, 0x62626563, 0x75085612, 0x1162362C,
+0x56136252, 0x362C75EC, 0x62521163, 0x75105614,
+0x1164362C, 0x62526653, 0x76105515, 0x1155352C,
+0x56166262, 0x362CD57E, 0x62561166, 0x362C5617,
+0x66531167, 0x55186252, 0x352C7604, 0x62661158,
+0x352C5519, 0x65631159, 0x561A6262, 0x362C7504,
+0x6252116A, 0x7504561B, 0x116B362C, 0x561C6256,
+0x116C362C, 0x561D6256, 0x116D362C, 0x62526653,
+0x7604551E, 0x115E352C, 0x561F6262, 0x362CD569,
+0x6252116F, 0x7594061E, 0x0166362C, 0x6653E044,
+0x051E6252, 0x352C7644, 0xE0480156, 0x061E6262,
+0x0166362C, 0xE054D660, 0x051E6262, 0x352C4229,
+0x76040156, 0xE0586262, 0x4229061E, 0x0166362C,
+0xE23856FB, 0xE0442620, 0xE048021E, 0x62121621,
+0x55111622, 0x1653E200, 0x16545512, 0x16555515,
+0x16565513, 0x16575516, 0xE040051E, 0x051E1658,
+0x1659E050, 0x165A5514, 0xE04C051E, 0x051E165B,
+0x165CE054, 0xE058051E, 0x051E165D, 0x165EE044,
+0xE0480126, 0x11212122, 0x11251122, 0x11261123,
+0xE0400126, 0xE0500126, 0x01261124, 0x0126E04C,
+0x0126E054, 0x0126E058, 0x3F3C9358, 0x6EF64F26,
+0x6CF66DF6, 0x000B6BF6, 0x4F2269F6, 0xE240614D,
+0x89143123, 0x3127E21F, 0x8B09D734, 0xD434614D,
+0xE00171E0, 0x5671440B, 0x26596507, 0x1761A007,
+0xE001D42F, 0x6672440B, 0x26596507, 0x4F262762,
+0x0009000B, 0x614D4F22, 0x3123E240, 0xE21F8912,
+0xD7263127, 0x614D8B08, 0x5671D225, 0x420B71E0,
+0x260BE001, 0x1761A006, 0x6672D221, 0xE001420B,
+0x2762260B, 0x000B4F26, 0xE6400009, 0x46284618,
+0x6252D51C, 0x89FC2268, 0x0009000B, 0x4618E680,
+0xD5184628, 0x22686252, 0x000B89FC, 0xA0010009,
+0x7201E200, 0x8BFC3242, 0x0009000B, 0x00000080,
+0x00117804, 0x00202FF4, 0x00201356, 0x0020139A,
+0x00203008, 0x00203010, 0x00200C38, 0x00200C12,
+0x00202F00, 0x00202F14, 0x00202AA4, 0x001C36A0,
+0x001C3CA0, 0x001C36F4, 0x001C3B88, 0x001C3704,
+0x002029F8, 0x001C373C, 0x4618E680, 0xD52F4628,
+0x22686252, 0x000B8BFC, 0x2FE60009, 0x7FFC4F22,
+0xBFF16E53, 0x61E22F42, 0xE280D629, 0x54E11615,
+0x16464218, 0x422855E2, 0x57E31657, 0x16786EF2,
+0x26E22E2B, 0x4F267F04, 0x6EF6AFA8, 0x2FD62FC6,
+0x4F222FE6, 0x6C53DD1E, 0x6E43BFD6, 0x2DE2BF95,
+0x0009BFD2, 0x2C1251D5, 0x1C4154D6, 0x1C5255D7,
+0x1C6356D8, 0x6EF64F26, 0x000B6DF6, 0x61636CF6,
+0xA004E600, 0x62564109, 0x24227601, 0x36127404,
+0x000B8BF9, 0x4F220009, 0xD10FD40E, 0x0009410B,
+0xD40FD20E, 0xE5056022, 0x2202CB20, 0xD50D2452,
+0x450BE700, 0xD70C2472, 0x0009470B, 0xE601D10B,
+0x2162D20B, 0x4F264618, 0x2262000B, 0x001C3700,
+0x001C370C, 0x00203028, 0x00201356, 0x001C3500,
+0x001D4004, 0x002013CC, 0x00200EF8, 0x001E212C,
+0x001C3D30, 0x0009A1A9, 0x2FE62FD6, 0xDD8F4F22,
+0xA0049EA7, 0xD48E0009, 0x420BD28E, 0x62D265D2,
+0x8BF822E8, 0x0009A004, 0xD28AD48B, 0x55D1420B,
+0x22E852D1, 0xA0048BF8, 0xD4880009, 0x420BD285,
+0x52D255D2, 0x8BF822E8, 0x0009A004, 0xD281D484,
+0x55D3420B, 0x22E852D3, 0xA0048BF8, 0xD4810009,
+0x420BD27C, 0x52D455D4, 0x8BF822E8, 0x6EF64F26,
+0x6DF6000B, 0x2FD62FC6, 0x4F222FE6, 0x6E636D73,
+0x6C53B018, 0x64C357F4, 0xB05465E3, 0xB06A66D3,
+0xB09A0009, 0xB09E0009, 0xB0A20009, 0xB0BE0009,
+0xB0C10009, 0xB1240009, 0x4F260009, 0x6DF66EF6,
+0x6CF6A023, 0x3412D16C, 0xD66C0529, 0x2650D76C,
+0x2742000B, 0x0009A014, 0x2FD62FC6, 0x4F222FE6,
+0x6E636D73, 0x6C53BFEE, 0x64C357F4, 0xB02A65E3,
+0xB10666D3, 0x4F260009, 0x6DF66EF6, 0x6CF6A005,
+0xE603D260, 0x000B4618, 0xD25E2262, 0x000BE600,
+0x4F222262, 0xE40ABF7E, 0x0009BF7E, 0xE104D25A,
+0xE5004118, 0x2212E40A, 0x2252BF74, 0x6072D757,
+0x4F26CB20, 0x2702000B, 0xD1554F22, 0xE400410B,
+0x452BD554, 0x2FE64F26, 0x6E63D153, 0x44186612,
+0x45289210, 0x26294408, 0x44084500, 0x4400265B,
+0x4708264B, 0x47082162, 0x27EBD14C, 0x000B2172,
+0x03F06EF6, 0x2FE61FFF, 0xDE494F22, 0xE40AE101,
+0x2E12BF48, 0x726C62E3, 0xE401E100, 0x22122212,
+0x22122212, 0x22122212, 0xE7302242, 0xE40AE503,
+0x22122212, 0x22122212, 0x22122212, 0x22122212,
+0x22122212, 0x22122212, 0x22522272, 0x22122212,
+0x22122212, 0x22122212, 0x22122212, 0x121ABF22,
+0x2E62E600, 0x000B4F26, 0xD2326EF6, 0xE441E101,
+0x000B2212, 0xD1302242, 0xE605D430, 0x000B2162,
+0xD52F2462, 0x6050D22F, 0x8B0E8801, 0x6040D42E,
+0x8B078801, 0x9626D52D, 0x88016050, 0x96238B0C,
+0x0009A00A, 0xA0079621, 0xE6000009, 0x2262D426,
+0x88016040, 0xE6048B00, 0xAEF3E40A, 0xD2242262,
+0xE40AE601, 0x2262AEEE, 0x2FC62FB6, 0x2FE62FD6,
+0xDC204F22, 0x60C2ED00, 0xCB01EB64, 0x60C22C02,
+0xA041C901, 0x03C46E03, 0x034003D4, 0x001C3B88,
+0x0020302C, 0x002013A2, 0x00203034, 0x0020303C,
+0x00203044, 0x0020304C, 0x0025E720, 0x0020321C,
+0x00202F04, 0x001C5968, 0x001D4004, 0x001C3500,
+0x00201154, 0x00201180, 0x001C5814, 0x001C59D0,
+0x001C5830, 0x001C6268, 0x001C59A4, 0x001C639C,
+0x00202F16, 0x001C5804, 0x00202F15, 0x00202F17,
+0x001C581C, 0x001C5860, 0x89073DB2, 0xE40A60C2,
+0xBE9FC901, 0x7D016E03, 0x8BF52EE8, 0x8B033DB2,
+0xD23ED43D, 0x0009420B, 0x4F26E40A, 0x6DF66EF6,
+0xAE8F6CF6, 0x44116BF6, 0x604B8F01, 0x000B6043,
+0x2FB60009, 0x2FD62FC6, 0x4F222FE6, 0xDC347FFC,
+0x60C2ED00, 0xCB02EB64, 0x60C22C02, 0xC9022F02,
+0x6E03A009, 0x89083DB3, 0xE40A60C2, 0xC9022F02,
+0x6E03BE70, 0x2EE87D01, 0x3DB38BF4, 0xD4298B08,
+0x7F04D226, 0x6EF64F26, 0x6CF66DF6, 0x6BF6422B,
+0x4F267F04, 0x6DF66EF6, 0x000B6CF6, 0xD5226BF6,
+0x60525651, 0x000B4628, 0x2FB6306C, 0x2FD62FC6,
+0x4F222FE6, 0x4F024F12, 0x6E43BFF1, 0xDC1B6B03,
+0xBFECDD1B, 0x30B80009, 0x060A3C05, 0x46094609,
+0x3D654601, 0x4209020A, 0x42094209, 0x8BF032E2,
+0x4F164F06, 0x6EF64F26, 0x6CF66DF6, 0x6BF6000B,
+0x4F222FE6, 0xE102DE0F, 0xE403E500, 0xBFD42E12,
+0xE6062E52, 0xE7004618, 0x2E62E403, 0x4F262E72,
+0x6EF6AFCB, 0x0009000B, 0x00203054, 0x00201356,
+0x001C5860, 0x0020306C, 0x001C1040, 0xCCCCCCCD,
+0x10624DD3, 0x001D4004, 0x2F962F86, 0x2FB62FA6,
+0x2FD62FC6, 0x4F222FE6, 0xE5007FDC, 0x6453E110,
+0x6C534128, 0xED096E53, 0x6653655D, 0x365C4608,
+0x75014608, 0x6043361C, 0x0F66675D, 0xEB0060C3,
+0x26C137D3, 0x81628161, 0x16B28163, 0x16B416E3,
+0x74048FEA, 0xD9A668F2, 0x1981DAA6, 0x59F12982,
+0x1A91D1A5, 0x5AF22A92, 0x5DF45BF3, 0x54F65EF5,
+0x21A211A1, 0x11B211B3, 0x11D411D5, 0x11E611E7,
+0x11481149, 0x55F7EE00, 0x57F8DD9C, 0x64E3D29C,
+0xDB9DD99C, 0xE845EAB8, 0x2D521D51, 0x6AAC2272,
+0x6EED4808, 0x4D086DE3, 0x3DEC65E3, 0x4D084508,
+0x3D9C35EC, 0x450860C3, 0x81D12DC1, 0x4508E050,
+0x45084008, 0x60C381D2, 0xE60035BC, 0x81D334A2,
+0x1D531DD2, 0x8D01D489, 0xD4861D64, 0xB05C65D3,
+0x64ED7E01, 0x8BDC3482, 0xDB88D182, 0xD2806812,
+0x1B814829, 0x2FD26412, 0x2B92694D, 0xD97F6722,
+0x1B734729, 0xD77C6822, 0x1BA26A8D, 0xD2806B72,
+0x22B2D57B, 0xE0035D72, 0x5E7412D2, 0x12E44018,
+0xD67C5176, 0x54781216, 0x1248E103, 0xD4796792,
+0x6852127A, 0x28C1E7FF, 0x81916952, 0x6A52E050,
+0x81A24008, 0x60C36B52, 0x6C5281B3, 0x6E521CC2,
+0x62521E63, 0x1264E600, 0x46086563, 0x7501364C,
+0x665D2672, 0x8BF83613, 0x4F267F24, 0x6DF66EF6,
+0x6BF66CF6, 0x69F66AF6, 0x68F6000B, 0x60616642,
+0x8D04C803, 0x6061E500, 0x8802C903, 0x52628B03,
+0x51246563, 0x000B2412, 0x2FD66053, 0x4F222FE6,
+0x6E537FEC, 0xE5506253, 0xE4006D43, 0xA0014508,
+0x5224E101, 0x22116043, 0x81238121, 0x81226053,
+0x362056E2, 0xD2548BF5, 0x64F316E4, 0x420BE614,
+0x65E165E3, 0x2549E4FC, 0x61F12E51, 0x214965F3,
+0x54D12F11, 0x410BD14C, 0x57D1E614, 0xCB016071,
+0x1DE12701, 0x4F267F14, 0x000B6EF6, 0x2FD66DF6,
+0x4F222FE6, 0x6E537FEC, 0xE5FC6653, 0x60616D43,
+0xCB012059, 0x52E22601, 0x8B063260, 0x51E212E4,
+0x8B0431E0, 0xA00252D1, 0xAFF01E22, 0xD23A5664,
+0xE61464F3, 0x65E3420B, 0xE1FC67E1, 0x2E712719,
+0x54D167F1, 0xD1342719, 0xE61465F3, 0x2F71410B,
+0x602152D1, 0x2201CB01, 0x7F141DE1, 0x6EF64F26,
+0x6DF6000B, 0x4F222FE6, 0xDE23624C, 0x42004208,
+0x3E2CA005, 0xD41F5252, 0xBF8E5624, 0x65E22E62,
+0x352052E1, 0xD6228BF6, 0x4F262622, 0x6EF6000B,
+0x2FC62FB6, 0x2FE62FD6, 0xDC184F22, 0x52C1DB1F,
+0x362066C2, 0x6061891C, 0x8801C903, 0xDE138918,
+0xBF63DD1B, 0x650364E3, 0x66B28503, 0x3262620D,
+0xD40B8907, 0x0009BF9B, 0x4D0BD416, 0xAFE60009,
+0xBF620009, 0xD41464E3, 0x00094D0B, 0x0009AFDF,
+0x2262D212, 0x6EF64F26, 0x6CF66DF6, 0x6BF6000B,
+0x00202B00, 0x00202B08, 0x00202B10, 0x00202B38,
+0x00202F1C, 0x001000B4, 0x00101680, 0x001E2108,
+0x001C3D00, 0x00117880, 0x00200A9E, 0x00202F00,
+0x00201356, 0x00203088, 0x0020308C, 0x001C3D28,
+0x2FC62FB6, 0x2FE62FD6, 0x7FFC4F22, 0x6022D22B,
+0x8D41C803, 0xDE2A2F01, 0xDB2BDC2A, 0xED01A017,
+0xC9036051, 0x89168801, 0xD128D426, 0x0009410B,
+0x61035503, 0xC8208551, 0xE0508903, 0x720102BE,
+0xD2230B26, 0x420B64E3, 0xD6226513, 0x52C126D2,
+0x352065C2, 0xDE208BE4, 0xDB21DD20, 0x52D1DC21,
+0x352065D2, 0x60518918, 0x8801C903, 0xD41B8914,
+0x460BD616, 0x57030009, 0x8F0437E0, 0xE2016503,
+0xAFEC2B20, 0xD4182C52, 0x420BD218, 0xD6110009,
+0x4118E101, 0x2612AFE3, 0xC80460F1, 0xD2148907,
+0x4F267F04, 0x6DF66EF6, 0x422B6CF6, 0x7F046BF6,
+0x6EF64F26, 0x6CF66DF6, 0x6BF6000B, 0x001E2100,
+0x00202B10, 0x00202B08, 0x00202AA4, 0x0020106C,
+0x002010EE, 0x001C3D30, 0x00117880, 0x00202B00,
+0x00202F20, 0x00202F1C, 0x00202B38, 0x0020108A,
+0x00200170, 0xE601D203, 0x1265D503, 0x000B2252,
+0x00001266, 0x001C1010, 0x0000C34F, 0x0009000B,
+0x2FD62FC6, 0x4F222FE6, 0x6D436C53, 0xEE00A004,
+0x7E0164D4, 0x644CBFF2, 0x8BF93EC2, 0x6EF64F26,
+0x000B6DF6, 0xE5006CF6, 0x6643A002, 0x76017501,
+0x22286260, 0xAFE38BFA, 0x2FE60009, 0x75076253,
+0xE1086753, 0x6043EE0A, 0x4409C90F, 0x650330E2,
+0x8D014409, 0xE630E637, 0x4110365C, 0x8FF22760,
+0xE00077FF, 0x000B8028, 0x000B6EF6, 0x000BE000,
+0x2FE6E000, 0x7FEC4F22, 0x6E436253, 0xBFDC65F3,
+0xBFD06423, 0xBFCE64E3, 0xD40364F3, 0x0009BFCB,
+0x4F267F14, 0x6EF6000B, 0x00203090, 0xE4FDD59A,
+0xD69A6152, 0x25122149, 0x74016052, 0x2502CB01,
+0xD1976752, 0x25722749, 0xC8406010, 0x60628902,
+0x2602CB04, 0xE5016062, 0x2602CB08, 0xE4026062,
+0x2602C9CF, 0x45186062, 0x2602CB03, 0x000B1642,
+0xD58C1653, 0xD28DD78C, 0xE100D48D, 0x2511E600,
+0x22102711, 0x2461AFD2, 0xD28A664C, 0x362C4600,
+0xCB106060, 0x2600000B, 0xD286654C, 0x352C4500,
+0xE1EF6650, 0x000B2619, 0x664C2560, 0x4600D282,
+0x6060362C, 0x000BCB10, 0x654C2600, 0x4500D27E,
+0x6650352C, 0x2619E1EF, 0x2560000B, 0xD279664C,
+0x362C4600, 0xCB086060, 0x2600000B, 0xD275654C,
+0x352C4500, 0xE1F76650, 0x000B2619, 0x664C2560,
+0x4600D271, 0x6060362C, 0x000BCB08, 0x654C2600,
+0x4500D26D, 0x6650352C, 0x2619E1F7, 0x2560000B,
+0xD668624C, 0x326C4200, 0xC9086020, 0x40214021,
+0x000B4021, 0x624C600C, 0x4200D663, 0x6020326C,
+0x4021C908, 0x40214021, 0x600C000B, 0x644CD15F,
+0x6240341C, 0x602C000B, 0x644CD15D, 0x6240341C,
+0x602C000B, 0x4F222FE6, 0x645C6E43, 0x3467E60A,
+0xBFEB8914, 0x640C0009, 0x880160EC, 0xE00F8B02,
+0x2409A002, 0x44094409, 0xE60A624C, 0x89053263,
+0x644CBFE2, 0x6023620C, 0x8B00C880, 0x6023E200,
+0x000B4F26, 0x4F226EF6, 0x6062D64A, 0x8B038801,
+0x0009B246, 0x0009A003, 0xE640D247, 0xD6472260,
+0x4F26E200, 0x2622000B, 0xD6424F22, 0x88026062,
+0xB28F8B01, 0xD6410009, 0x4F26E200, 0x2622000B,
+0xD43DD53C, 0xE701E100, 0x000B2512, 0xD23A2470,
+0x000BE604, 0x4F222260, 0xD13AD439, 0x0009410B,
+0xE1FDD539, 0xD2396650, 0xE7002619, 0x4F262560,
+0x2270000B, 0xD4364F22, 0x410BD132, 0xD5320009,
+0x6650E7FB, 0x4F262679, 0x2560000B, 0xD4314F22,
+0x410BD12C, 0xD52C0009, 0x6650E7F7, 0x4F262679,
+0x2560000B, 0x942DD528, 0x22496250, 0x2520000B,
+0xE4BFD525, 0x22496250, 0x2520000B, 0xD2264F22,
+0x600D8522, 0x89112008, 0x89138801, 0x89158803,
+0x89438805, 0x89498806, 0x894F8808, 0x89558809,
+0x895B880A, 0x8961880B, 0x0009A068, 0x0009B06A,
+0x600CA065, 0x0009B078, 0x600CA061, 0x0009B081,
+0x600CA05D, 0x0000FF7F, 0x001E2148, 0x001E1108,
+0x001E1000, 0x00202F60, 0x00202F62, 0x00202F81,
+0x00202F44, 0x001E103F, 0x001E105F, 0x001E102F,
+0x001E1090, 0x00202F68, 0x001E100B, 0x00202F64,
+0x00203094, 0x00201356, 0x001E1028, 0x00202F80,
+0x002030A0, 0x002030B0, 0x00202F38, 0x6260D684,
+0x8B2B2228, 0x0009B061, 0x600CA029, 0x6260D680,
+0x8B232228, 0x0009B069, 0x600CA021, 0x6260D67C,
+0x8B1B2228, 0x0009B0C7, 0x600CA019, 0x6260D678,
+0x8B132228, 0x0009B0CD, 0x600CA011, 0x6260D674,
+0x8B0B2228, 0x0009B125, 0x600CA009, 0x6260D670,
+0x8B032228, 0x0009B13D, 0x600CA001, 0x4F26E000,
+0x0009000B, 0xD26CD16B, 0xD56C8412, 0x4000C90F,
+0xD76B012D, 0xE403D66B, 0xE20F611C, 0x2540E001,
+0x25202712, 0x2602000B, 0xE601D262, 0x30668523,
+0xE0008D05, 0xD663D260, 0xE0018122, 0x000B2602,
+0xD25C0009, 0x600D8523, 0x89052008, 0x8B0A8801,
+0x6060D65D, 0x2600CB01, 0xD457D65A, 0xE001E101,
+0x000B2612, 0x000B8142, 0xD152E000, 0x8513E501,
+0x640D4518, 0x66033453, 0xE0008D05, 0xD551D253,
+0x2260E001, 0x000B2502, 0x4F220009, 0x8513D149,
+0x6453650D, 0x62494419, 0x227D672E, 0x8801602C,
+0x88028909, 0x88038910, 0x8806891A, 0x88078935,
+0xA04C893B, 0xD5460009, 0x6652D746, 0x2762D446,
+0x622C6261, 0x2421A038, 0x2228625C, 0xD4438B3F,
+0x6642D540, 0x2562D440, 0x24018561, 0x6203A02C,
+0x2008605C, 0x88108907, 0x88208908, 0x88308909,
+0xA02C890A, 0xD23A0009, 0x6222A008, 0xA005D239,
+0xD2396222, 0x6222A002, 0x6262D638, 0xD432D531,
+0x66212522, 0xA00F626C, 0xD6352421, 0x6261D52D,
+0x622CD42D, 0xA0072562, 0xD6322421, 0x8561D529,
+0x2562D429, 0x62032401, 0x662D8515, 0x3617610D,
+0x65038F01, 0xB0CB2451, 0xA0010009, 0xE000E001,
+0x000B4F26, 0xD6190009, 0xD427E101, 0x65412610,
+0xD118D717, 0xE20F655D, 0x2752E001, 0x000B2620,
+0x2FE62102, 0xD20F4F22, 0x640C8523, 0x8B082448,
+0xD511D61D, 0x2621E200, 0x940F8451, 0xA0482049,
+0xDE0D8051, 0xC84060E0, 0xE2018D32, 0x89443427,
+0xD216D615, 0x2641420B, 0x0009A030, 0x0000FF7F,
+0x00202F81, 0x00202F38, 0x00202F44, 0x001E1100,
+0x001E100C, 0x00202F64, 0x001E1000, 0x001E1001,
+0x00202F6C, 0x00202F4C, 0x00202F50, 0x00202F54,
+0x00202F70, 0x00202F74, 0x00202F78, 0x00202F7C,
+0x00203280, 0x0020328A, 0x00202F5E, 0x0020225A,
+0x89123427, 0xD294D693, 0x2641420B, 0xCB8084E1,
+0x80E1B0F5, 0xD69160E0, 0x2E00CB04, 0xC93F6060,
+0xD68F2600, 0xA001E001, 0xE0002602, 0x000B4F26,
+0xD68C6EF6, 0xC8806060, 0xD2868919, 0x88016021,
+0xD2898B15, 0x8524E501, 0x89103056, 0xE203D187,
+0x2120D487, 0xE00B6541, 0x0656655D, 0xE40FD585,
+0x2140E702, 0xD77E2571, 0x000BE001, 0x000B2702,
+0x2FE6E000, 0xDE804F22, 0xC88084E1, 0xD57A892C,
+0x20088554, 0x61038F28, 0x8553D77C, 0x64036672,
+0x8566650C, 0x3520620C, 0xD6798B1E, 0x651CD774,
+0x2651644C, 0x60E02741, 0x8904C840, 0x420BD275,
+0xA0030009, 0xD2680009, 0x0009420B, 0x0009B09F,
+0xE201D167, 0x60E02122, 0xCB04D464, 0x60402E00,
+0x2400C93F, 0x6023A001, 0x4F26E000, 0x6EF6000B,
+0x2FB62FA6, 0x2FD62FC6, 0xDA622FE6, 0x66A1E240,
+0x3622DC5E, 0x62638900, 0x6ED36D2C, 0x4E2136D8,
+0x4E212A61, 0xDB61D460, 0xE700A00F, 0x770162B2,
+0x71026123, 0x66212B12, 0x71026213, 0x61212B12,
+0x651D666D, 0x356C4528, 0x627C2452, 0x8BED32E3,
+0xC90360D3, 0x8B108803, 0x617367B2, 0x2B127102,
+0x71026E13, 0x2B126571, 0x655D6DE1, 0x422862DD,
+0x325CE107, 0xA00C2C10, 0x88022422, 0xA0038B01,
+0x8801E203, 0xE2018B05, 0x66B22C20, 0x655D6561,
+0xE60F2452, 0x67A12C60, 0x8B052778, 0xDD38DC44,
+0xEB01EA00, 0x2DB22CA2, 0x6DF66EF6, 0x6BF66CF6,
+0x6AF6000B, 0x2FE62FD6, 0xE240DD36, 0x362266D1,
+0x62638900, 0x3678672C, 0x7703DE38, 0x47212D61,
+0x64E2D635, 0xA00E4721, 0x6562E100, 0x62537101,
+0x74012450, 0x24204219, 0x45297401, 0x74012450,
+0x24504519, 0x621C7401, 0x8BEE3273, 0x66E24200,
+0x420061D1, 0x2118362C, 0x2E628F06, 0xDD1CD728,
+0xE501E400, 0x2D522742, 0x000B6EF6, 0x2FD66DF6,
+0x4F222FE6, 0xED0AEE01, 0x64E3BC96, 0xBC9B64E3,
+0x62EC7E01, 0x8BF732D7, 0xBC9EEE01, 0x64E364E3,
+0x7E01BCA3, 0x32D762EC, 0x4F268BF7, 0x000B6EF6,
+0xD1186DF6, 0xD418920D, 0x72122122, 0x2422D617,
+0xD7177204, 0x72202622, 0x2722D116, 0x000B7230,
+0x137A2122, 0x00202F5E, 0x00202366, 0x001E1015,
+0x00202F64, 0x001E1001, 0x00202F38, 0x001E1100,
+0x00202F62, 0x00202F50, 0x001E1000, 0x00202F54,
+0x00202F60, 0x0020225A, 0x001E100C, 0x00202F4C,
+0x00202F68, 0x00202F6C, 0x00202F70, 0x00202F74,
+0x00202F78, 0x00202F7C, 0x4F222FE6, 0xD6507FFC,
+0x88016060, 0xE2018951, 0x2620BFBB, 0xD54ED14D,
+0xDE4E6010, 0x64E36552, 0x7402C840, 0x8D22D14C,
+0xD24C7502, 0xE601D74C, 0xE7042722, 0x76016255,
+0x626C2421, 0x8FF93273, 0xD4437402, 0x6242E601,
+0x640D8528, 0x67494419, 0x275D657E, 0x81E4607C,
+0xE417D542, 0x67557601, 0x3243626C, 0x8FF92171,
+0xA0207102, 0xD23E0009, 0xE601D73B, 0xE7042722,
+0x76016255, 0x626C2421, 0x8FF93273, 0xD4327402,
+0x6242E601, 0x640D8528, 0x67494419, 0x275D657E,
+0x81E4607C, 0xE417D533, 0x67557601, 0x3243626C,
+0x8FF92171, 0x924A7102, 0xD2262E21, 0x5E23D72E,
+0x64F22FE2, 0x604365F2, 0x2700C980, 0xC9606043,
+0x80716103, 0xC9036043, 0x80724519, 0x65F2605C,
+0x817266F2, 0x46194629, 0x606C4529, 0x4018645C,
+0x8173304C, 0x21185E23, 0x64F22FE2, 0x6E4C62F2,
+0x602C4219, 0x66F262F2, 0x46294018, 0x461930EC,
+0x42298174, 0x652C606C, 0x305C4018, 0x81758F07,
+0x0009BC9C, 0x2228620C, 0xA00A8908, 0x60130009,
+0x8B038840, 0x0009B009, 0x0009A003, 0xE202D60F,
+0x7F042622, 0x000B4F26, 0x000B6EF6, 0x060A0009,
+0x00202F80, 0x001E1000, 0x00202F6C, 0x00203280,
+0x0020328C, 0x00203224, 0x00202F54, 0x00203254,
+0x00203252, 0x00203226, 0x00202F38, 0x00202F64,
+0x4F222FE6, 0xDE937FFC, 0x200884E9, 0x2F008D06,
+0xD692D491, 0x0009460B, 0x64F0B194, 0x6620D290,
+0x89022668, 0xC9BF60E0, 0x7F042E00, 0x000B4F26,
+0x000B6EF6, 0x2FE60009, 0xDE8A4F22, 0x60E0D68A,
+0xCBC0D48A, 0x62602E00, 0xC803602C, 0x40218904,
+0x70014021, 0x6603A002, 0x66034009, 0xD684616D,
+0xE500A004, 0x75016262, 0x74042422, 0x3213625D,
+0xD2808BF8, 0x0009420B, 0xC9BF84E2, 0x4F2680E2,
+0x6EF6000B, 0x2FE62FD6, 0x7FFC4F22, 0x6260D67A,
+0x89442228, 0xD56FE100, 0x60502610, 0xCB40D477,
+0x2500440B, 0x8D052008, 0x62E06E03, 0x7104612C,
+0x2F11A006, 0xD472D66A, 0xDD726760, 0x657C4D0B,
+0xE23C6D1D, 0x8B033D27, 0xD264D46F, 0x0009420B,
+0x4D214D21, 0xA005D76D, 0x66E6E400, 0x357C4508,
+0x74012562, 0x35D3654D, 0xD7698BF7, 0x6172E003,
+0x81114018, 0x6E7260F1, 0x81E2700C, 0xD4656172,
+0xDD658113, 0x4D0BDE65, 0xE2016572, 0xD4642E22,
+0x420BD252, 0xD6530009, 0xC93F6060, 0x7F042600,
+0x6EF64F26, 0x6DF6000B, 0x2FC62FB6, 0x2FE62FD6,
+0xD25C4F22, 0x6B436E73, 0x420B6C53, 0x20086D63,
+0x61038F08, 0xD245D458, 0x6EF64F26, 0x6CF66DF6,
+0x6BF6422B, 0x21B060C3, 0x60D38011, 0xE5008111,
+0x64BCA007, 0x6053655D, 0x665300EC, 0x7501361C,
+0x625D8064, 0x8BF53243, 0x6060D636, 0x2600C9BF,
+0x6EF64F26, 0x6CF66DF6, 0x6BF6000B, 0x7FC44F22,
+0x720262F3, 0x22512F41, 0x45297202, 0x60632251,
+0xE5C4E682, 0x67F38121, 0x655C666C, 0xE408BFBC,
+0x4F267F3C, 0x0009000B, 0x2F962F86, 0x2FB62FA6,
+0x2FD62FC6, 0x4F222FE6, 0xE1007FC4, 0x6513ECFF,
+0x6B136CCD, 0xDE36D735, 0xEDFF64F3, 0xD835EA04,
+0x6053655C, 0x027D4000, 0x32C0622D, 0x66038D0D,
+0x09ED6063, 0x2491027D, 0x24217402, 0x698202ED,
+0x3928622D, 0x74022892, 0x75017104, 0x6063625C,
+0x07D532A2, 0x0EB58FE4, 0x2448641C, 0xE6808905,
+0x67F3E5C5, 0xBF7F666C, 0x7F3C655C, 0x6EF64F26,
+0x6CF66DF6, 0x6AF66BF6, 0x000B69F6, 0xD11E68F6,
+0x6012D21E, 0xCB20E405, 0x2102E500, 0x000B2242,
+0x00002252, 0x001E1017, 0x002030BC, 0x00201356,
+0x00202F1A, 0x001E1015, 0x001E10BF, 0x00117800,
+0x001E10FC, 0x00200170, 0x00202F20, 0x002024BE,
+0x002030C0, 0x002013A2, 0x002030DC, 0x0011788C,
+0x00202F1C, 0x00202B00, 0x002010EE, 0x001E2130,
+0x002030E4, 0x00202480, 0x002030E8, 0x00202F26,
+0x00202F2E, 0x00203220, 0x001C3500, 0x001D4004,
+0xD565D164, 0xE400D765, 0x2142E20F, 0x17411154,
+0xD5632722, 0x9669D763, 0x15412572, 0x96661562,
+0xE6011565, 0xD5601165, 0x666CE6F8, 0x25422542,
+0x25422542, 0x25422542, 0x25622542, 0x7601E727,
+0x67632572, 0x25627797, 0xE7042572, 0x2572E248,
+0xE2192522, 0xE2702522, 0x25422542, 0x25422542,
+0x25222542, 0x2522E20C, 0x25422542, 0x25422542,
+0x25422542, 0x25422542, 0x000B154A, 0xE2081145,
+0x0009422B, 0x2FE62FD6, 0x7FFC4F22, 0xC8206043,
+0x6E438D02, 0x0009BE6D, 0xC81060E3, 0xBE6A8901,
+0x60E30009, 0x8901C840, 0x0009BE8C, 0xC80160E3,
+0xDD3E8938, 0xC80260D0, 0x2F008D03, 0x460BD63C,
+0x60F00009, 0x8902C804, 0x460BD63A, 0x62F00009,
+0xC8806023, 0x60D08902, 0x2D00C97F, 0xC8016023,
+0xD6358906, 0x0009460B, 0x0009A007, 0x51630601,
+0x8902C808, 0x460BD631, 0x60F00009, 0x8902C810,
+0x420BD22F, 0xD52F0009, 0x88026052, 0xD22E8B03,
+0xA005E604, 0x88012260, 0xD22B8B02, 0x2260E601,
+0x2522E200, 0xC88060E3, 0xD628892E, 0x60E36E60,
+0x8902C880, 0x420BD226, 0x60E30009, 0x8902C840,
+0x420BD224, 0x60E30009, 0x8902C802, 0x420BD222,
+0x60E30009, 0x890EC804, 0x410BD120, 0xBF0E0009,
+0xBF4D0009, 0xD51E0009, 0x6050D41E, 0xC908D71E,
+0xBF842500, 0x60E32472, 0x8905C808, 0x7F04D21B,
+0x6EF64F26, 0x6DF6422B, 0x4F267F04, 0x000B6EF6,
+0x00006DF6, 0x001C581C, 0xA000A000, 0x001D0100,
+0x001D4000, 0x00040021, 0x001C589C, 0x001E1021,
+0x00201536, 0x00201558, 0x00201B98, 0x00201570,
+0x0020157E, 0x00202F64, 0x001E100B, 0x001E1028,
+0x002015D4, 0x002015E0, 0x00201586, 0x002015A4,
+0x001E1000, 0x0010F100, 0x12345678, 0x002015BC,
+0x644CD6A7, 0x000B346C, 0xD6A62450, 0x346C644C,
+0x2450000B, 0x644CD6A4, 0x000B346C, 0x625C2450,
+0x4208616D, 0x42084119, 0x42006019, 0x670E614C,
+0xD49E321C, 0x4200207D, 0x324CC90F, 0x2200000B,
+0x4208625C, 0x42004208, 0x324C644C, 0x4200D498,
+0x000B324C, 0x2FE62260, 0x614C4F12, 0x4100D493,
+0x6710314C, 0xE29F666D, 0x27294619, 0x6E536269,
+0x672E6573, 0x4221227D, 0x42214221, 0x7601662C,
+0xE4014608, 0x34E84608, 0x644C4600, 0x071A0467,
+0x2150257B, 0x000B4F16, 0x4F226EF6, 0xD2857FE8,
+0x88016021, 0xD2848B7B, 0x26686621, 0xD2838B77,
+0x26686621, 0xE50F8B73, 0xE401BFA2, 0xBFA4E501,
+0xE586E400, 0xE400655C, 0x2F50BFA4, 0xBFA1E401,
+0xE602E506, 0x60634618, 0x81F2E401, 0x6543BF9F,
+0xE40185F2, 0xBFAB6543, 0x85F26603, 0x6543E401,
+0x6603BFB1, 0xE40265F0, 0x6053756C, 0x80F8BF80,
+0xBF82E402, 0x84F8E512, 0x7090E402, 0x6503BF82,
+0x4618E602, 0x81F66063, 0xBF80E402, 0x85F6E500,
+0x6603E402, 0xE500BF8C, 0xE40285F6, 0xBF926603,
+0xE5FEE500, 0xE010655C, 0xBF61E403, 0xE5130F54,
+0xE40EBF63, 0x05FCE010, 0xBF63E40E, 0xE5007585,
+0xBF64E403, 0xE500E640, 0xBF71E403, 0xE500E640,
+0xBF78E403, 0xE5FFE640, 0xE014655C, 0xBF47E404,
+0xE40F0F54, 0xE504BF49, 0x05FCE014, 0xBF49E40F,
+0xE5017584, 0xBF4AE640, 0xE501E404, 0xBF57E640,
+0xE501E404, 0xE404E640, 0xAF5C7F18, 0x7F184F26,
+0x000B4F26, 0x4F220009, 0xD2427FF0, 0x88016021,
+0xD2418B71, 0x26686621, 0xD2408B6D, 0x26686621,
+0xE50F8B69, 0xE401BF1C, 0xBF1EE501, 0xE586E400,
+0xE400655C, 0x2F50BF1E, 0xBF1BE401, 0xE401E506,
+0xBF1C6543, 0xE401E640, 0xBF296543, 0xE401E640,
+0xBF306543, 0x65F0E640, 0x756CE402, 0xBEFF6053,
+0xE40280F4, 0xE512BF01, 0xE40284F4, 0xBF017090,
+0xE6406503, 0xBF02E402, 0xE640E500, 0xBF0FE402,
+0xE640E500, 0xBF16E402, 0xE5FEE500, 0x6053655C,
+0xBEE5E403, 0xE51380F8, 0xE40EBEE7, 0xE40E84F8,
+0xBEE77085, 0xE5006503, 0xBEE8E640, 0xE500E403,
+0xBEF5E640, 0xE500E403, 0xBEFCE640, 0xE5FFE403,
+0x6053655C, 0xBECBE404, 0xE40F80FC, 0xE504BECD,
+0xE40F84FC, 0xBECD7083, 0xE5016503, 0xBECEE640,
+0xE501E404, 0xBEDBE640, 0xE501E404, 0xE404E640,
+0xAEE07F10, 0x7F104F26, 0x000B4F26, 0x00000009,
+0x001E102F, 0x001E1080, 0x001E1090, 0x001E103F,
+0x001E103E, 0x00202F5E, 0x00202F60, 0x00202F62,
+0xD21DD11C, 0x66206010, 0x676C7001, 0x3700C90F,
+0xE5008D13, 0x67106210, 0x7701622C, 0x64232170,
+0xD6166010, 0x44084408, 0x3428C90F, 0x62602100,
+0x7201D513, 0x44082620, 0x000B354C, 0xD10F6053,
+0x25586510, 0xE6008D13, 0xD60DD40B, 0x655C6540,
+0x47086753, 0x37584708, 0x47086540, 0x24507501,
+0x367C6040, 0x2400C90F, 0x72FF6210, 0x000B2120,
+0x00006063, 0x00202F19, 0x00202F18, 0x00202F1A,
+0x00202B40, 0x7FFC4F22, 0xE680D1A8, 0x666C6212,
+0xD2A72F22, 0x67F36563, 0x420B7542, 0x7F04E404,
+0x000B4F26, 0xE6800009, 0xD2A1666C, 0xE7006563,
+0x422B7540, 0xE6806473, 0xD29D666C, 0xE7006563,
+0x422B7543, 0x2FB66473, 0x2FD62FC6, 0x4F222FE6,
+0x4D18ED01, 0xDB98DC97, 0x65C252C1, 0x89203520,
+0xC9036051, 0x891C8801, 0xD194DE92, 0x64E3410B,
+0x85036503, 0x670D66B2, 0x89073762, 0xD291D490,
+0x0009420B, 0xE701D190, 0x2172AFE6, 0xDE8F64E3,
+0x00094E0B, 0xD48FD68E, 0x410BD18F, 0xAFDB26D2,
+0x4F260009, 0x6DF66EF6, 0x000B6CF6, 0x4F226BF6,
+0x85467FF4, 0x2F01E681, 0x666C8547, 0x854881F1,
+0x81F2D27B, 0x67F38542, 0x854381F3, 0x81F4E40C,
+0x65636053, 0x420B81F5, 0x7F0C7540, 0x000B4F26,
+0x2F860009, 0x2FA62F96, 0x2FC62FB6, 0x2FE62FD6,
+0x7FEC4F22, 0xE000D176, 0xD4782F12, 0x81F26103,
+0xDC771F42, 0xD6776B13, 0xE0014B08, 0x460BDE76,
+0x3BEC4B00, 0x66C21F03, 0x362052C1, 0xA1818B01,
+0x60610009, 0x8801C903, 0xA17B8B01, 0x85610009,
+0x8B01C801, 0x0009A080, 0x85D25D63, 0xC9036603,
+0x85D36403, 0x6053650D, 0x40214021, 0x4500C93F,
+0x322A6103, 0x6053252D, 0xC901E510, 0xD95E3153,
+0x6E038D21, 0x4408D761, 0x44086870, 0x44006213,
+0x28884200, 0x342C8F0E, 0x6043D25D, 0x60E3072D,
+0x4A196A7D, 0x658E68A9, 0x285D8801, 0x6A7C8F0B,
+0x6A13A009, 0x6043D257, 0x61ED0E2D, 0x68194119,
+0x287D678E, 0xD1546AEC, 0x22286210, 0xEAFF8901,
+0xEEFF6AAC, 0x6EEC65AD, 0x8B0F35E0, 0x4D0BDD3F,
+0x540364C3, 0xBF72E502, 0xD44C6D03, 0x410BD13F,
+0xD74B65D3, 0xD44BEE01, 0x27E2A025, 0x2679E7FC,
+0x81D26063, 0x946085D3, 0x61032049, 0x4508268B,
+0x251B6063, 0x605381D2, 0x85D481D3, 0x4118E108,
+0x81D4201B, 0xEE0262C2, 0x20798521, 0x64C28121,
+0x6041678D, 0xCB0137E3, 0x24018D04, 0xEEE785D2,
+0x81D220E9, 0x490BD438, 0x60C20009, 0x52F366F2,
+0x2B02CB01, 0x2622AF6F, 0xD2208561, 0x8F02C802,
+0xA0D264C3, 0x420B0009, 0xD9300009, 0x5E036503,
+0x079EE04C, 0x7701DD2E, 0x69D20976, 0x7901D626,
+0x6D602D92, 0x89062DD8, 0xD218D424, 0xED01420B,
+0xA0B3D723, 0x625127D2, 0x4118E10F, 0x2219E402,
+0x32404418, 0x85518B46, 0x20D9EDFC, 0x60518151,
+0xCB017DE3, 0x85E12501, 0x20D9D60A, 0x460B81E1,
+0x69F264C3, 0xA09957F3, 0x7E032972, 0x001C3D9C,
+0x00201E38, 0x00202B38, 0x00202F00, 0x0020106C,
+0x00202B00, 0x002010EE, 0x001E2130, 0x0020108A,
+0x001C3D30, 0x00203200, 0x00201356, 0x0020320C,
+0x00202B10, 0x002029F8, 0x001C3D00, 0x0020321C,
+0x00203100, 0x00203180, 0x00202F14, 0x00202B08,
+0x001E212C, 0x00203204, 0x00203208, 0x00202AA4,
+0x00203220, 0x6DDD6D51, 0x6DD94D19, 0x2D6D66DE,
+0x60DC7D01, 0x41186103, 0x8F458801, 0xD65B2511,
+0x74016462, 0x85E32642, 0x6063660D, 0x40214021,
+0x4600C93F, 0x322A6D03, 0x6063262D, 0xD154C801,
+0x8901D954, 0x2D6B96A1, 0xE010E600, 0x64DD0F64,
+0x07FCE010, 0x4000607C, 0x622D021D, 0x8D123240,
+0x60636603, 0xE7FF021D, 0x8B013270, 0x01D5A00B,
+0x02FCE010, 0x7201E604, 0x622C0F24, 0x8BE73262,
+0x666C06FC, 0x60634600, 0x7101019D, 0xD1420915,
+0x697D6711, 0x89073940, 0x602D6211, 0x890388FF,
+0xDD3E21D1, 0x2D20E201, 0xEDFC8551, 0x815120D9,
+0xD23B6051, 0x64C3CB01, 0x2501420B, 0x02FCE010,
+0x612CD438, 0x440BE001, 0x270267F2, 0xD23685EF,
+0x420B54F2, 0xAE96650D, 0x420B0009, 0x54030009,
+0x85446E03, 0x4D18ED08, 0x30D020D9, 0xBE568B03,
+0xA007E501, 0x85410009, 0x620DDD2C, 0x890122D8,
+0xE500BE4D, 0xD22BD42A, 0x65E3420B, 0xED01D72A,
+0x27D2AE79, 0xEE0485F2, 0x610D7001, 0x81F231E7,
+0x7C088D02, 0x0009AE66, 0x4F267F14, 0x6DF66EF6,
+0x6BF66CF6, 0x69F66AF6, 0x68F6000B, 0x4F222FE6,
+0x6E22D21E, 0xC84060E3, 0x22E28D02, 0x0009BDD2,
+0x4218E240, 0x89012E28, 0x0009BDDD, 0xC81060E3,
+0xD4178905, 0x420BD217, 0xBDDC0009, 0x60E30009,
+0x8901C805, 0x0009BE2D, 0xC80260E3, 0x4F268902,
+0x6EF6ADD9, 0x000B4F26, 0x80006EF6, 0x00203220,
+0x00202F26, 0x00202F2E, 0x00202F22, 0x00202F24,
+0x002010EE, 0x002029F8, 0x002013A2, 0x00008000,
+0x00202B08, 0x0020108A, 0x001E212C, 0x001C3510,
+0x00203214, 0x00201356, 0x080A0C0E, 0x00020406,
+0x1A1C1E20, 0x12141618, 0x2E303234, 0x26282A2C,
+0x3A3C3E40, 0x6C625648, 0x41112F26, 0xE2208F18,
+0x890B3123, 0x321CD204, 0xD1026220, 0x412B312C,
+0x00090009, 0x00202A22, 0x002029D8, 0x000BE000,
+0x400062F6, 0x40004000, 0x40004000, 0x40004000,
+0x62F6000B, 0x40004000, 0x40004000, 0x40004000,
+0x40184000, 0x62F6000B, 0x40004000, 0x40004000,
+0x40004000, 0x40284000, 0x62F6000B, 0x40004000,
+0x40184000, 0x000B4028, 0xC90F62F6, 0x40054005,
+0x40054005, 0x62F6000B, 0x4005C907, 0x40054005,
+0x62F6000B, 0x4005C903, 0x000B4005, 0xC90162F6,
+0x000B4005, 0x000062F6, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x544F0D0A, 0x46205355, 0x00003A57, 0x20636544,
+0x32203231, 0x20373030, 0x333A3132, 0x34323A36,
+0x00000000, 0x00000D0A, 0x00000043, 0x42707372,
+0x3D206675, 0x554E203D, 0x202C4C4C, 0x6E49677A,
+0x4E497274, 0x6D754E51, 0x0000003D, 0x61766E49,
+0x2064696C, 0x72657375, 0x20726F20, 0x2079656B,
+0x00214449, 0x52504545, 0x57204D4F, 0x65746972,
+0x6461202C, 0x003D7264, 0x6C617620, 0x0000003D,
+0x00000A0D, 0x6E6B6E55, 0x206E776F, 0x6D6D6F63,
+0x3D646E61, 0x00000000, 0x000A0D52, 0x203A3051,
+0x00000020, 0x203A3151, 0x00000020, 0x203A3251,
+0x00000020, 0x203A3351, 0x00000020, 0x203A3451,
+0x00000020, 0x61437748, 0x7262696C, 0x6F697461,
+0x6620206E, 0x0A6C6961, 0x0000000D, 0x73696F4E,
+0x61432065, 0x7262696C, 0x6F697461, 0x6166206E,
+0x21216C69, 0x00000D0A, 0x00000072, 0x00205220,
+0x00000D0A, 0x62735576, 0x7473725F, 0x00000A0D,
+0x62735576, 0x7375735F, 0x646E6570, 0x00000A0D,
+0x62735576, 0x7365725F, 0x000A0D6D, 0x00000042,
+0x72746E49, 0x6D652051, 0x2C797470, 0x49677A20,
+0x4972746E, 0x754E514E, 0x00003D6D, 0x654C7245,
+0x0000006E, 0x00000049, 0x20746F4E, 0x756F6E65,
+0x49206867, 0x4220514E, 0x0A0D6675, 0x00000000,
+0x000000FF, 0x00020001, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x010E010D, 0x00020003, 0x01090108, 0x0002010A,
+0x02000003, 0x02020201, 0x02040203, 0x02060205,
+0x02020200, 0x02040203, 0x020C0207, 0x020E020D,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x010E010D, 0x00FF010F, 0x01090108, 0x010B010A,
+0x020000FF, 0x02020201, 0x02040203, 0x02060205,
+0x02020200, 0x02040203, 0x020C020B, 0x020E020D,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00205220, 0x00000046, 0x00000059, 0x73204142,
+0x003D7165, 0x49544120, 0x0000204D, 0x00000000,
+0x00000000, 0x002E0209, 0x80000101, 0x000409FA,
+0x00FF0400, 0x05070000, 0x02000201, 0x82050700,
+0x00020002, 0x03830507, 0x07010040, 0x40020405,
+0x02090000, 0x0101002E, 0x09FA8000, 0x04000004,
+0x000000FF, 0x02010507, 0x07000040, 0x40028205,
+0x05070000, 0x00400383, 0x04050701, 0x00004002,
+0x00000000, 0x00000000, 0x07090000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, };
+
+const u32_t zcDKFwImageSize=12988;
diff --git a/drivers/staging/otus/hal/hpani.c b/drivers/staging/otus/hal/hpani.c
new file mode 100644
index 00000000000..ba95b5d012a
--- /dev/null
+++ b/drivers/staging/otus/hal/hpani.c
@@ -0,0 +1,732 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include "../80211core/cprecomp.h"
+#include "hpani.h"
+#include "hpusb.h"
+
+
+extern u16_t zfDelayWriteInternalReg(zdev_t* dev, u32_t addr, u32_t val);
+extern u16_t zfFlushDelayWrite(zdev_t* dev);
+
+/*
+ * Anti noise immunity support. We track phy errors and react
+ * to excessive errors by adjusting the noise immunity parameters.
+ */
+
+/******************************************************************************
+ *
+ * New Ani Algorithm for Station side only
+ *
+ *****************************************************************************/
+
+#define ZM_HAL_NOISE_IMMUNE_MAX 4 /* Max noise immunity level */
+#define ZM_HAL_SPUR_IMMUNE_MAX 7 /* Max spur immunity level */
+#define ZM_HAL_FIRST_STEP_MAX 2 /* Max first step level */
+
+#define ZM_HAL_ANI_OFDM_TRIG_HIGH 500
+#define ZM_HAL_ANI_OFDM_TRIG_LOW 200
+#define ZM_HAL_ANI_CCK_TRIG_HIGH 200
+#define ZM_HAL_ANI_CCK_TRIG_LOW 100
+#define ZM_HAL_ANI_NOISE_IMMUNE_LVL 4
+#define ZM_HAL_ANI_USE_OFDM_WEAK_SIG TRUE
+#define ZM_HAL_ANI_CCK_WEAK_SIG_THR FALSE
+#define ZM_HAL_ANI_SPUR_IMMUNE_LVL 7
+#define ZM_HAL_ANI_FIRSTEP_LVL 0
+#define ZM_HAL_ANI_RSSI_THR_HIGH 40
+#define ZM_HAL_ANI_RSSI_THR_LOW 7
+#define ZM_HAL_ANI_PERIOD 100
+
+#define ZM_HAL_EP_RND(x, mul) \
+ ((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul))
+
+s32_t BEACON_RSSI(zdev_t* dev)
+{
+ s32_t rssi;
+
+ zmw_get_wlan_dev(dev);
+
+ struct zsHpPriv *HpPriv = (struct zsHpPriv*)wd->hpPrivate;
+
+ rssi = ZM_HAL_EP_RND(HpPriv->stats.ast_nodestats.ns_avgbrssi, ZM_HAL_RSSI_EP_MULTIPLIER);
+
+ return rssi;
+}
+
+/*
+ * Setup ANI handling. Sets all thresholds and levels to default level AND
+ * resets the channel statistics
+ */
+
+void zfHpAniAttach(zdev_t* dev)
+{
+#define N(a) (sizeof(a) / sizeof(a[0]))
+ u32_t i;
+
+ zmw_get_wlan_dev(dev);
+
+ struct zsHpPriv *HpPriv = (struct zsHpPriv*)wd->hpPrivate;
+
+ const int totalSizeDesired[] = { -55, -55, -55, -55, -62 };
+ const int coarseHigh[] = { -14, -14, -14, -14, -12 };
+ const int coarseLow[] = { -64, -64, -64, -64, -70 };
+ const int firpwr[] = { -78, -78, -78, -78, -80 };
+
+ for (i = 0; i < 5; i++)
+ {
+ HpPriv->totalSizeDesired[i] = totalSizeDesired[i];
+ HpPriv->coarseHigh[i] = coarseHigh[i];
+ HpPriv->coarseLow[i] = coarseLow[i];
+ HpPriv->firpwr[i] = firpwr[i];
+ }
+
+ /* owl has phy counters */
+ HpPriv->hasHwPhyCounters = 1;
+
+ memset((char *)&HpPriv->ani, 0, sizeof(HpPriv->ani));
+ for (i = 0; i < N(wd->regulationTable.allowChannel); i++)
+ {
+ /* New ANI stuff */
+ HpPriv->ani[i].ofdmTrigHigh = ZM_HAL_ANI_OFDM_TRIG_HIGH;
+ HpPriv->ani[i].ofdmTrigLow = ZM_HAL_ANI_OFDM_TRIG_LOW;
+ HpPriv->ani[i].cckTrigHigh = ZM_HAL_ANI_CCK_TRIG_HIGH;
+ HpPriv->ani[i].cckTrigLow = ZM_HAL_ANI_CCK_TRIG_LOW;
+ HpPriv->ani[i].rssiThrHigh = ZM_HAL_ANI_RSSI_THR_HIGH;
+ HpPriv->ani[i].rssiThrLow = ZM_HAL_ANI_RSSI_THR_LOW;
+ HpPriv->ani[i].ofdmWeakSigDetectOff = !ZM_HAL_ANI_USE_OFDM_WEAK_SIG;
+ HpPriv->ani[i].cckWeakSigThreshold = ZM_HAL_ANI_CCK_WEAK_SIG_THR;
+ HpPriv->ani[i].spurImmunityLevel = ZM_HAL_ANI_SPUR_IMMUNE_LVL;
+ HpPriv->ani[i].firstepLevel = ZM_HAL_ANI_FIRSTEP_LVL;
+ if (HpPriv->hasHwPhyCounters)
+ {
+ HpPriv->ani[i].ofdmPhyErrBase = 0;//AR_PHY_COUNTMAX - ZM_HAL_ANI_OFDM_TRIG_HIGH;
+ HpPriv->ani[i].cckPhyErrBase = 0;//AR_PHY_COUNTMAX - ZM_HAL_ANI_CCK_TRIG_HIGH;
+ }
+ }
+ if (HpPriv->hasHwPhyCounters)
+ {
+ //zm_debug_msg2("Setting OfdmErrBase = 0x", HpPriv->ani[0].ofdmPhyErrBase);
+ //zm_debug_msg2("Setting cckErrBase = 0x", HpPriv->ani[0].cckPhyErrBase);
+ //OS_REG_WRITE(ah, AR_PHY_ERR_1, HpPriv->ani[0].ofdmPhyErrBase);
+ //OS_REG_WRITE(ah, AR_PHY_ERR_2, HpPriv->ani[0].cckPhyErrBase);
+ }
+ HpPriv->aniPeriod = ZM_HAL_ANI_PERIOD;
+ //if (ath_hal_enableANI)
+ HpPriv->procPhyErr |= ZM_HAL_PROCESS_ANI;
+
+ HpPriv->stats.ast_nodestats.ns_avgbrssi = ZM_RSSI_DUMMY_MARKER;
+ HpPriv->stats.ast_nodestats.ns_avgrssi = ZM_RSSI_DUMMY_MARKER;
+ HpPriv->stats.ast_nodestats.ns_avgtxrssi = ZM_RSSI_DUMMY_MARKER;
+#undef N
+}
+
+/*
+ * Control Adaptive Noise Immunity Parameters
+ */
+u8_t zfHpAniControl(zdev_t* dev, ZM_HAL_ANI_CMD cmd, int param)
+{
+#define N(a) (sizeof(a)/sizeof(a[0]))
+ typedef s32_t TABLE[];
+
+ zmw_get_wlan_dev(dev);
+
+ struct zsHpPriv *HpPriv = (struct zsHpPriv*)wd->hpPrivate;
+
+ struct zsAniState *aniState = HpPriv->curani;
+
+ switch (cmd)
+ {
+ case ZM_HAL_ANI_NOISE_IMMUNITY_LEVEL:
+ {
+ u32_t level = param;
+
+ if (level >= N(HpPriv->totalSizeDesired))
+ {
+ zm_debug_msg1("level out of range, desired level : ", level);
+ zm_debug_msg1("max level : ", N(HpPriv->totalSizeDesired));
+ return FALSE;
+ }
+
+ zfDelayWriteInternalReg(dev, AR_PHY_DESIRED_SZ,
+ (HpPriv->regPHYDesiredSZ & ~AR_PHY_DESIRED_SZ_TOT_DES)
+ | ((HpPriv->totalSizeDesired[level] << AR_PHY_DESIRED_SZ_TOT_DES_S)
+ & AR_PHY_DESIRED_SZ_TOT_DES));
+ zfDelayWriteInternalReg(dev, AR_PHY_AGC_CTL1,
+ (HpPriv->regPHYAgcCtl1 & ~AR_PHY_AGC_CTL1_COARSE_LOW)
+ | ((HpPriv->coarseLow[level] << AR_PHY_AGC_CTL1_COARSE_LOW_S)
+ & AR_PHY_AGC_CTL1_COARSE_LOW));
+ zfDelayWriteInternalReg(dev, AR_PHY_AGC_CTL1,
+ (HpPriv->regPHYAgcCtl1 & ~AR_PHY_AGC_CTL1_COARSE_HIGH)
+ | ((HpPriv->coarseHigh[level] << AR_PHY_AGC_CTL1_COARSE_HIGH_S)
+ & AR_PHY_AGC_CTL1_COARSE_HIGH));
+ zfDelayWriteInternalReg(dev, AR_PHY_FIND_SIG,
+ (HpPriv->regPHYFindSig & ~AR_PHY_FIND_SIG_FIRPWR)
+ | ((HpPriv->firpwr[level] << AR_PHY_FIND_SIG_FIRPWR_S)
+ & AR_PHY_FIND_SIG_FIRPWR));
+ zfFlushDelayWrite(dev);
+
+ if (level > aniState->noiseImmunityLevel)
+ HpPriv->stats.ast_ani_niup++;
+ else if (level < aniState->noiseImmunityLevel)
+ HpPriv->stats.ast_ani_nidown++;
+ aniState->noiseImmunityLevel = (u8_t)level;
+ break;
+ }
+ case ZM_HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION:
+ {
+ const TABLE m1ThreshLow = { 127, 50 };
+ const TABLE m2ThreshLow = { 127, 40 };
+ const TABLE m1Thresh = { 127, 0x4d };
+ const TABLE m2Thresh = { 127, 0x40 };
+ const TABLE m2CountThr = { 31, 16 };
+ const TABLE m2CountThrLow = { 63, 48 };
+ u32_t on = param ? 1 : 0;
+
+ zfDelayWriteInternalReg(dev, AR_PHY_SFCORR_LOW,
+ (HpPriv->regPHYSfcorrLow & ~AR_PHY_SFCORR_LOW_M1_THRESH_LOW)
+ | ((m1ThreshLow[on] << AR_PHY_SFCORR_LOW_M1_THRESH_LOW_S)
+ & AR_PHY_SFCORR_LOW_M1_THRESH_LOW));
+ zfDelayWriteInternalReg(dev, AR_PHY_SFCORR_LOW,
+ (HpPriv->regPHYSfcorrLow & ~AR_PHY_SFCORR_LOW_M2_THRESH_LOW)
+ | ((m2ThreshLow[on] << AR_PHY_SFCORR_LOW_M2_THRESH_LOW_S)
+ & AR_PHY_SFCORR_LOW_M2_THRESH_LOW));
+ zfDelayWriteInternalReg(dev, AR_PHY_SFCORR,
+ (HpPriv->regPHYSfcorr & ~AR_PHY_SFCORR_M1_THRESH)
+ | ((m1Thresh[on] << AR_PHY_SFCORR_M1_THRESH_S)
+ & AR_PHY_SFCORR_M1_THRESH));
+ zfDelayWriteInternalReg(dev, AR_PHY_SFCORR,
+ (HpPriv->regPHYSfcorr & ~AR_PHY_SFCORR_M2_THRESH)
+ | ((m2Thresh[on] << AR_PHY_SFCORR_M2_THRESH_S)
+ & AR_PHY_SFCORR_M2_THRESH));
+ zfDelayWriteInternalReg(dev, AR_PHY_SFCORR,
+ (HpPriv->regPHYSfcorr & ~AR_PHY_SFCORR_M2COUNT_THR)
+ | ((m2CountThr[on] << AR_PHY_SFCORR_M2COUNT_THR_S)
+ & AR_PHY_SFCORR_M2COUNT_THR));
+ zfDelayWriteInternalReg(dev, AR_PHY_SFCORR_LOW,
+ (HpPriv->regPHYSfcorrLow & ~AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW)
+ | ((m2CountThrLow[on] << AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW_S)
+ & AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW));
+
+ if (on)
+ {
+ zfDelayWriteInternalReg(dev, AR_PHY_SFCORR_LOW,
+ HpPriv->regPHYSfcorrLow | AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);
+ }
+ else
+ {
+ zfDelayWriteInternalReg(dev, AR_PHY_SFCORR_LOW,
+ HpPriv->regPHYSfcorrLow & ~AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);
+ }
+ zfFlushDelayWrite(dev);
+ if (!on != aniState->ofdmWeakSigDetectOff)
+ {
+ if (on)
+ HpPriv->stats.ast_ani_ofdmon++;
+ else
+ HpPriv->stats.ast_ani_ofdmoff++;
+ aniState->ofdmWeakSigDetectOff = !on;
+ }
+ break;
+ }
+ case ZM_HAL_ANI_CCK_WEAK_SIGNAL_THR:
+ {
+ const TABLE weakSigThrCck = { 8, 6 };
+ u32_t high = param ? 1 : 0;
+
+ zfDelayWriteInternalReg(dev, AR_PHY_CCK_DETECT,
+ (HpPriv->regPHYCckDetect & ~AR_PHY_CCK_DETECT_WEAK_SIG_THR_CCK)
+ | ((weakSigThrCck[high] << AR_PHY_CCK_DETECT_WEAK_SIG_THR_CCK_S)
+ & AR_PHY_CCK_DETECT_WEAK_SIG_THR_CCK));
+ zfFlushDelayWrite(dev);
+ if (high != aniState->cckWeakSigThreshold)
+ {
+ if (high)
+ HpPriv->stats.ast_ani_cckhigh++;
+ else
+ HpPriv->stats.ast_ani_ccklow++;
+ aniState->cckWeakSigThreshold = (u8_t)high;
+ }
+ break;
+ }
+ case ZM_HAL_ANI_FIRSTEP_LEVEL:
+ {
+ const TABLE firstep = { 0, 4, 8 };
+ u32_t level = param;
+
+ if (level >= N(firstep))
+ {
+ zm_debug_msg1("level out of range, desired level : ", level);
+ zm_debug_msg1("max level : ", N(firstep));
+ return FALSE;
+ }
+ zfDelayWriteInternalReg(dev, AR_PHY_FIND_SIG,
+ (HpPriv->regPHYFindSig & ~AR_PHY_FIND_SIG_FIRSTEP)
+ | ((firstep[level] << AR_PHY_FIND_SIG_FIRSTEP_S)
+ & AR_PHY_FIND_SIG_FIRSTEP));
+ zfFlushDelayWrite(dev);
+ if (level > aniState->firstepLevel)
+ HpPriv->stats.ast_ani_stepup++;
+ else if (level < aniState->firstepLevel)
+ HpPriv->stats.ast_ani_stepdown++;
+ aniState->firstepLevel = (u8_t)level;
+ break;
+ }
+ case ZM_HAL_ANI_SPUR_IMMUNITY_LEVEL:
+ {
+ const TABLE cycpwrThr1 = { 2, 4, 6, 8, 10, 12, 14, 16 };
+ u32_t level = param;
+
+ if (level >= N(cycpwrThr1))
+ {
+ zm_debug_msg1("level out of range, desired level : ", level);
+ zm_debug_msg1("max level : ", N(cycpwrThr1));
+ return FALSE;
+ }
+ zfDelayWriteInternalReg(dev, AR_PHY_TIMING5,
+ (HpPriv->regPHYTiming5 & ~AR_PHY_TIMING5_CYCPWR_THR1)
+ | ((cycpwrThr1[level] << AR_PHY_TIMING5_CYCPWR_THR1_S)
+ & AR_PHY_TIMING5_CYCPWR_THR1));
+ zfFlushDelayWrite(dev);
+ if (level > aniState->spurImmunityLevel)
+ HpPriv->stats.ast_ani_spurup++;
+ else if (level < aniState->spurImmunityLevel)
+ HpPriv->stats.ast_ani_spurdown++;
+ aniState->spurImmunityLevel = (u8_t)level;
+ break;
+ }
+ case ZM_HAL_ANI_PRESENT:
+ break;
+#ifdef AH_PRIVATE_DIAG
+ case ZM_HAL_ANI_MODE:
+ if (param == 0)
+ {
+ HpPriv->procPhyErr &= ~ZM_HAL_PROCESS_ANI;
+ /* Turn off HW counters if we have them */
+ zfHpAniDetach(dev);
+ //zfHpSetRxFilter(dev, zfHpGetRxFilter(dev) &~ HAL_RX_FILTER_PHYERR);
+ }
+ else
+ { /* normal/auto mode */
+ HpPriv->procPhyErr |= ZM_HAL_PROCESS_ANI;
+ if (HpPriv->hasHwPhyCounters)
+ {
+ //zfHpSetRxFilter(dev, zfHpGetRxFilter(dev) &~ HAL_RX_FILTER_PHYERR);
+ }
+ else
+ {
+ //zfHpSetRxFilter(dev, zfHpGetRxFilter(dev) | HAL_RX_FILTER_PHYERR);
+ }
+ }
+ break;
+ case ZM_HAL_ANI_PHYERR_RESET:
+ HpPriv->stats.ast_ani_ofdmerrs = 0;
+ HpPriv->stats.ast_ani_cckerrs = 0;
+ break;
+#endif /* AH_PRIVATE_DIAG */
+ default:
+ zm_debug_msg1("invalid cmd ", cmd);
+ return FALSE;
+ }
+ return TRUE;
+#undef N
+}
+
+void zfHpAniRestart(zdev_t* dev)
+{
+ struct zsAniState *aniState;
+
+ zmw_get_wlan_dev(dev);
+
+ struct zsHpPriv *HpPriv = (struct zsHpPriv*)wd->hpPrivate;
+
+ aniState = HpPriv->curani;
+
+ aniState->listenTime = 0;
+ if (HpPriv->hasHwPhyCounters)
+ {
+ //if (aniState->ofdmTrigHigh > AR_PHY_COUNTMAX)
+ //{
+ // aniState->ofdmPhyErrBase = 0;
+ // zm_debug_msg0("OFDM Trigger is too high for hw counters");
+ //}
+ //else
+ // aniState->ofdmPhyErrBase = AR_PHY_COUNTMAX - aniState->ofdmTrigHigh;
+ //if (aniState->cckTrigHigh > AR_PHY_COUNTMAX)
+ //{
+ // aniState->cckPhyErrBase = 0;
+ // zm_debug_msg0("CCK Trigger is too high for hw counters");
+ //}
+ //else
+ // aniState->cckPhyErrBase = AR_PHY_COUNTMAX - aniState->cckTrigHigh;
+ //zm_debug_msg2("Writing ofdmbase = 0x", aniState->ofdmPhyErrBase);
+ //zm_debug_msg2("Writing cckbase = 0x", aniState->cckPhyErrBase);
+ //OS_REG_WRITE(ah, AR_PHY_ERR_1, aniState->ofdmPhyErrBase);
+ //OS_REG_WRITE(ah, AR_PHY_ERR_2, aniState->cckPhyErrBase);
+ //OS_REG_WRITE(ah, AR_PHY_ERR_MASK_1, AR_PHY_ERR_OFDM_TIMING);
+ //OS_REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING);
+ aniState->ofdmPhyErrBase = 0;
+ aniState->cckPhyErrBase = 0;
+ }
+ aniState->ofdmPhyErrCount = 0;
+ aniState->cckPhyErrCount = 0;
+}
+
+void zfHpAniOfdmErrTrigger(zdev_t* dev)
+{
+ struct zsAniState *aniState;
+ s32_t rssi;
+
+ zmw_get_wlan_dev(dev);
+
+ struct zsHpPriv *HpPriv = (struct zsHpPriv*)wd->hpPrivate;
+
+ //HALASSERT(chan != NULL);
+
+ if ((HpPriv->procPhyErr & ZM_HAL_PROCESS_ANI) == 0)
+ return;
+
+ aniState = HpPriv->curani;
+ /* First, raise noise immunity level, up to max */
+ if (aniState->noiseImmunityLevel < ZM_HAL_NOISE_IMMUNE_MAX)
+ {
+ zfHpAniControl(dev, ZM_HAL_ANI_NOISE_IMMUNITY_LEVEL, aniState->noiseImmunityLevel + 1);
+ return;
+ }
+ /* then, raise spur immunity level, up to max */
+ if (aniState->spurImmunityLevel < ZM_HAL_SPUR_IMMUNE_MAX)
+ {
+ zfHpAniControl(dev, ZM_HAL_ANI_SPUR_IMMUNITY_LEVEL, aniState->spurImmunityLevel + 1);
+ return;
+ }
+ rssi = BEACON_RSSI(dev);
+ if (rssi > aniState->rssiThrHigh)
+ {
+ /*
+ * Beacon rssi is high, can turn off ofdm weak sig detect.
+ */
+ if (!aniState->ofdmWeakSigDetectOff)
+ {
+ zfHpAniControl(dev, ZM_HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION, FALSE);
+ zfHpAniControl(dev, ZM_HAL_ANI_SPUR_IMMUNITY_LEVEL, 0);
+ return;
+ }
+ /*
+ * If weak sig detect is already off, as last resort, raise
+ * first step level
+ */
+ if (aniState->firstepLevel < ZM_HAL_FIRST_STEP_MAX)
+ {
+ zfHpAniControl(dev, ZM_HAL_ANI_FIRSTEP_LEVEL, aniState->firstepLevel + 1);
+ return;
+ }
+ }
+ else if (rssi > aniState->rssiThrLow)
+ {
+ /*
+ * Beacon rssi in mid range, need ofdm weak signal detect,
+ * but we can raise firststepLevel
+ */
+ if (aniState->ofdmWeakSigDetectOff)
+ zfHpAniControl(dev, ZM_HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION, TRUE);
+ if (aniState->firstepLevel < ZM_HAL_FIRST_STEP_MAX)
+ zfHpAniControl(dev, ZM_HAL_ANI_FIRSTEP_LEVEL, aniState->firstepLevel + 1);
+ return;
+ }
+ else
+ {
+ /*
+ * Beacon rssi is low, if in 11b/g mode, turn off ofdm
+ * weak sign detction and zero firstepLevel to maximize
+ * CCK sensitivity
+ */
+ if (wd->frequency < 3000)
+ {
+ if (!aniState->ofdmWeakSigDetectOff)
+ zfHpAniControl(dev, ZM_HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION, FALSE);
+ if (aniState->firstepLevel > 0)
+ zfHpAniControl(dev, ZM_HAL_ANI_FIRSTEP_LEVEL, 0);
+ return;
+ }
+ }
+}
+
+void zfHpAniCckErrTrigger(zdev_t* dev)
+{
+ struct zsAniState *aniState;
+ s32_t rssi;
+
+ zmw_get_wlan_dev(dev);
+
+ struct zsHpPriv *HpPriv = (struct zsHpPriv*)wd->hpPrivate;
+
+ //HALASSERT(chan != NULL);
+
+ if ((HpPriv->procPhyErr & ZM_HAL_PROCESS_ANI) == 0)
+ return;
+
+ /* first, raise noise immunity level, up to max */
+ aniState = HpPriv->curani;
+ if (aniState->noiseImmunityLevel < ZM_HAL_NOISE_IMMUNE_MAX)
+ {
+ zfHpAniControl(dev, ZM_HAL_ANI_NOISE_IMMUNITY_LEVEL,
+ aniState->noiseImmunityLevel + 1);
+ return;
+ }
+ rssi = BEACON_RSSI(dev);
+ if (rssi > aniState->rssiThrLow)
+ {
+ /*
+ * Beacon signal in mid and high range, raise firsteplevel.
+ */
+ if (aniState->firstepLevel < ZM_HAL_FIRST_STEP_MAX)
+ zfHpAniControl(dev, ZM_HAL_ANI_FIRSTEP_LEVEL, aniState->firstepLevel + 1);
+ }
+ else
+ {
+ /*
+ * Beacon rssi is low, zero firstepLevel to maximize
+ * CCK sensitivity.
+ */
+ if (wd->frequency < 3000)
+ {
+ if (aniState->firstepLevel > 0)
+ zfHpAniControl(dev, ZM_HAL_ANI_FIRSTEP_LEVEL, 0);
+ }
+ }
+}
+
+void zfHpAniLowerImmunity(zdev_t* dev)
+{
+ struct zsAniState *aniState;
+ s32_t rssi;
+
+ zmw_get_wlan_dev(dev);
+
+ struct zsHpPriv *HpPriv = (struct zsHpPriv*)wd->hpPrivate;
+
+ aniState = HpPriv->curani;
+
+ rssi = BEACON_RSSI(dev);
+ if (rssi > aniState->rssiThrHigh)
+ {
+ /*
+ * Beacon signal is high, leave ofdm weak signal detection off
+ * or it may oscillate. Let it fall through.
+ */
+ }
+ else if (rssi > aniState->rssiThrLow)
+ {
+ /*
+ * Beacon rssi in mid range, turn on ofdm weak signal
+ * detection or lower first step level.
+ */
+ if (aniState->ofdmWeakSigDetectOff)
+ {
+ zfHpAniControl(dev, ZM_HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION, TRUE);
+ return;
+ }
+ if (aniState->firstepLevel > 0)
+ {
+ zfHpAniControl(dev, ZM_HAL_ANI_FIRSTEP_LEVEL, aniState->firstepLevel - 1);
+ return;
+ }
+ }
+ else
+ {
+ /*
+ * Beacon rssi is low, reduce first step level.
+ */
+ if (aniState->firstepLevel > 0)
+ {
+ zfHpAniControl(dev, ZM_HAL_ANI_FIRSTEP_LEVEL, aniState->firstepLevel - 1);
+ return;
+ }
+ }
+ /* then lower spur immunity level, down to zero */
+ if (aniState->spurImmunityLevel > 0)
+ {
+ zfHpAniControl(dev, ZM_HAL_ANI_SPUR_IMMUNITY_LEVEL, aniState->spurImmunityLevel - 1);
+ return;
+ }
+ /*
+ * if all else fails, lower noise immunity level down to a min value
+ * zero for now
+ */
+ if (aniState->noiseImmunityLevel > 0)
+ {
+ zfHpAniControl(dev, ZM_HAL_ANI_NOISE_IMMUNITY_LEVEL, aniState->noiseImmunityLevel - 1);
+ return;
+ }
+}
+
+#define CLOCK_RATE 44000 /* XXX use mac_usec or similar */
+/* convert HW counter values to ms using 11g clock rate, goo9d enough
+ for 11a and Turbo */
+
+/*
+ * Return an approximation of the time spent ``listening'' by
+ * deducting the cycles spent tx'ing and rx'ing from the total
+ * cycle count since our last call. A return value <0 indicates
+ * an invalid/inconsistent time.
+ */
+s32_t zfHpAniGetListenTime(zdev_t* dev)
+{
+ struct zsAniState *aniState;
+ u32_t txFrameCount, rxFrameCount, cycleCount;
+ s32_t listenTime;
+
+ zmw_get_wlan_dev(dev);
+
+ struct zsHpPriv *HpPriv = (struct zsHpPriv*)wd->hpPrivate;
+
+ txFrameCount = 0;//OS_REG_READ(ah, AR_TFCNT);
+ rxFrameCount = 0;//OS_REG_READ(ah, AR_RFCNT);
+ cycleCount = 0;//OS_REG_READ(ah, AR_CCCNT);
+
+ aniState = HpPriv->curani;
+ if (aniState->cycleCount == 0 || aniState->cycleCount > cycleCount)
+ {
+ /*
+ * Cycle counter wrap (or initial call); it's not possible
+ * to accurately calculate a value because the registers
+ * right shift rather than wrap--so punt and return 0.
+ */
+ listenTime = 0;
+ HpPriv->stats.ast_ani_lzero++;
+ }
+ else
+ {
+ s32_t ccdelta = cycleCount - aniState->cycleCount;
+ s32_t rfdelta = rxFrameCount - aniState->rxFrameCount;
+ s32_t tfdelta = txFrameCount - aniState->txFrameCount;
+ listenTime = (ccdelta - rfdelta - tfdelta) / CLOCK_RATE;
+ }
+ aniState->cycleCount = cycleCount;
+ aniState->txFrameCount = txFrameCount;
+ aniState->rxFrameCount = rxFrameCount;
+ return listenTime;
+}
+
+/*
+ * Do periodic processing. This routine is called from the
+ * driver's rx interrupt handler after processing frames.
+ */
+void zfHpAniArPoll(zdev_t* dev, u32_t listenTime, u32_t phyCnt1, u32_t phyCnt2)
+{
+ struct zsAniState *aniState;
+ //s32_t listenTime;
+
+ zmw_get_wlan_dev(dev);
+
+ struct zsHpPriv *HpPriv = (struct zsHpPriv*)wd->hpPrivate;
+
+ /*
+ * Since we're called from end of rx tasklet, we also check for
+ * AR processing now
+ */
+
+ aniState = HpPriv->curani;
+ //HpPriv->stats.ast_nodestats = *stats; /* XXX optimize? */
+
+ //listenTime = zfHpAniGetListenTime(dev);
+ //if (listenTime < 0)
+ //{
+ // HpPriv->stats.ast_ani_lneg++;
+ // /* restart ANI period if listenTime is invalid */
+ // zfHpAniRestart(dev);
+ // return;
+ //}
+ /* XXX beware of overflow? */
+ aniState->listenTime += listenTime;
+
+ if (HpPriv->hasHwPhyCounters)
+ {
+ //u32_t phyCnt1, phyCnt2;
+ u32_t ofdmPhyErrCnt, cckPhyErrCnt;
+
+ /* NB: these are not reset-on-read */
+ //phyCnt1 = 0;//OS_REG_READ(ah, AR_PHY_ERR_1);
+ //phyCnt2 = 0;//OS_REG_READ(ah, AR_PHY_ERR_2);
+ /* XXX sometimes zero, why? */
+ //if (phyCnt1 < aniState->ofdmPhyErrBase ||
+ // phyCnt2 < aniState->cckPhyErrBase)
+ //{
+ // if (phyCnt1 < aniState->ofdmPhyErrBase)
+ // {
+ // zm_debug_msg2("phyCnt1 = 0x", phyCnt1);
+ // zm_debug_msg2("resetting counter value to 0x", aniState->ofdmPhyErrBase);
+ // //OS_REG_WRITE(ah, AR_PHY_ERR_1, aniState->ofdmPhyErrBase);
+ // //OS_REG_WRITE(ah, AR_PHY_ERR_MASK_1, AR_PHY_ERR_OFDM_TIMING);
+ // }
+ // if (phyCnt2 < aniState->cckPhyErrBase)
+ // {
+ // zm_debug_msg2("phyCnt2 = 0x", phyCnt2);
+ // zm_debug_msg2("resetting counter value to 0x", aniState->cckPhyErrBase);
+ // //OS_REG_WRITE(ah, AR_PHY_ERR_2, aniState->cckPhyErrBase);
+ // //OS_REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING);
+ // }
+ // return; /* XXX */
+ //}
+ /* NB: only use ast_ani_*errs with AH_PRIVATE_DIAG */
+ //ofdmPhyErrCnt = phyCnt1 - aniState->ofdmPhyErrBase;
+ //HpPriv->stats.ast_ani_ofdmerrs += ofdmPhyErrCnt - aniState->ofdmPhyErrCount;
+ //aniState->ofdmPhyErrCount = ofdmPhyErrCnt;
+ ofdmPhyErrCnt = phyCnt1;
+ HpPriv->stats.ast_ani_ofdmerrs += ofdmPhyErrCnt;
+ aniState->ofdmPhyErrCount += ofdmPhyErrCnt;
+
+ //cckPhyErrCnt = phyCnt2 - aniState->cckPhyErrBase;
+ //HpPriv->stats.ast_ani_cckerrs += cckPhyErrCnt - aniState->cckPhyErrCount;
+ //aniState->cckPhyErrCount = cckPhyErrCnt;
+ cckPhyErrCnt = phyCnt2;
+ HpPriv->stats.ast_ani_cckerrs += cckPhyErrCnt;
+ aniState->cckPhyErrCount += cckPhyErrCnt;
+ }
+ /*
+ * If ani is not enabled, return after we've collected
+ * statistics
+ */
+ if ((HpPriv->procPhyErr & ZM_HAL_PROCESS_ANI) == 0)
+ return;
+ if (aniState->listenTime > 5 * HpPriv->aniPeriod)
+ {
+ /*
+ * Check to see if need to lower immunity if
+ * 5 aniPeriods have passed
+ */
+ if (aniState->ofdmPhyErrCount <= aniState->listenTime *
+ aniState->ofdmTrigLow/1000 &&
+ aniState->cckPhyErrCount <= aniState->listenTime *
+ aniState->cckTrigLow/1000)
+ zfHpAniLowerImmunity(dev);
+ zfHpAniRestart(dev);
+ }
+ else if (aniState->listenTime > HpPriv->aniPeriod)
+ {
+ /* check to see if need to raise immunity */
+ if (aniState->ofdmPhyErrCount > aniState->listenTime *
+ aniState->ofdmTrigHigh / 1000)
+ {
+ zfHpAniOfdmErrTrigger(dev);
+ zfHpAniRestart(dev);
+ }
+ else if (aniState->cckPhyErrCount > aniState->listenTime *
+ aniState->cckTrigHigh / 1000)
+ {
+ zfHpAniCckErrTrigger(dev);
+ zfHpAniRestart(dev);
+ }
+ }
+}
diff --git a/drivers/staging/otus/hal/hpani.h b/drivers/staging/otus/hal/hpani.h
new file mode 100644
index 00000000000..96e69af3c68
--- /dev/null
+++ b/drivers/staging/otus/hal/hpani.h
@@ -0,0 +1,420 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include "../80211core/cprecomp.h"
+
+typedef struct {
+ u32_t ackrcv_bad;
+ u32_t rts_bad;
+ u32_t rts_good;
+ u32_t fcs_bad;
+ u32_t beacons;
+} ZM_HAL_MIB_STATS;
+
+/*
+ * Per-node statistics maintained by the driver for use in
+ * optimizing signal quality and other operational aspects.
+ */
+typedef struct {
+ u32_t ns_avgbrssi; /* average beacon rssi */
+ u32_t ns_avgrssi; /* average data rssi */
+ u32_t ns_avgtxrssi; /* average tx rssi */
+} ZM_HAL_NODE_STATS;
+
+#define ZM_HAL_RSSI_EP_MULTIPLIER (1<<7) /* pow2 to optimize out * and / */
+
+struct zsAniStats {
+ u32_t ast_ani_niup; /* ANI increased noise immunity */
+ u32_t ast_ani_nidown; /* ANI decreased noise immunity */
+ u32_t ast_ani_spurup; /* ANI increased spur immunity */
+ u32_t ast_ani_spurdown;/* ANI descreased spur immunity */
+ u32_t ast_ani_ofdmon; /* ANI OFDM weak signal detect on */
+ u32_t ast_ani_ofdmoff;/* ANI OFDM weak signal detect off */
+ u32_t ast_ani_cckhigh;/* ANI CCK weak signal threshold high */
+ u32_t ast_ani_ccklow; /* ANI CCK weak signal threshold low */
+ u32_t ast_ani_stepup; /* ANI increased first step level */
+ u32_t ast_ani_stepdown;/* ANI decreased first step level */
+ u32_t ast_ani_ofdmerrs;/* ANI cumulative ofdm phy err count */
+ u32_t ast_ani_cckerrs;/* ANI cumulative cck phy err count */
+ u32_t ast_ani_reset; /* ANI parameters zero'd for non-STA */
+ u32_t ast_ani_lzero; /* ANI listen time forced to zero */
+ u32_t ast_ani_lneg; /* ANI listen time calculated < 0 */
+ ZM_HAL_MIB_STATS ast_mibstats; /* MIB counter stats */
+ ZM_HAL_NODE_STATS ast_nodestats; /* Latest rssi stats from driver */
+};
+
+/*
+ * Per-channel ANI state private to the driver.
+ */
+struct zsAniState {
+ ZM_HAL_CHANNEL c;
+ u8_t noiseImmunityLevel;
+ u8_t spurImmunityLevel;
+ u8_t firstepLevel;
+ u8_t ofdmWeakSigDetectOff;
+ u8_t cckWeakSigThreshold;
+
+ /* Thresholds */
+ u32_t listenTime;
+ u32_t ofdmTrigHigh;
+ u32_t ofdmTrigLow;
+ s32_t cckTrigHigh;
+ s32_t cckTrigLow;
+ s32_t rssiThrLow;
+ s32_t rssiThrHigh;
+
+ u32_t noiseFloor; /* The current noise floor */
+ u32_t txFrameCount; /* Last txFrameCount */
+ u32_t rxFrameCount; /* Last rx Frame count */
+ u32_t cycleCount; /* Last cycleCount (can detect wrap-around) */
+ u32_t ofdmPhyErrCount;/* OFDM err count since last reset */
+ u32_t cckPhyErrCount; /* CCK err count since last reset */
+ u32_t ofdmPhyErrBase; /* Base value for ofdm err counter */
+ u32_t cckPhyErrBase; /* Base value for cck err counters */
+ s16_t pktRssi[2]; /* Average rssi of pkts for 2 antennas */
+ s16_t ofdmErrRssi[2]; /* Average rssi of ofdm phy errs for 2 ant */
+ s16_t cckErrRssi[2]; /* Average rssi of cck phy errs for 2 ant */
+};
+
+typedef enum {
+ ZM_HAL_ANI_PRESENT, /* is ANI support present */
+ ZM_HAL_ANI_NOISE_IMMUNITY_LEVEL, /* set level */
+ ZM_HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION, /* enable/disable */
+ ZM_HAL_ANI_CCK_WEAK_SIGNAL_THR, /* enable/disable */
+ ZM_HAL_ANI_FIRSTEP_LEVEL, /* set level */
+ ZM_HAL_ANI_SPUR_IMMUNITY_LEVEL, /* set level */
+ ZM_HAL_ANI_MODE, /* 0 => manual, 1 => auto */
+ ZM_HAL_ANI_PHYERR_RESET, /* reset phy error stats */
+} ZM_HAL_ANI_CMD;
+
+#define AR_PHY_COUNTMAX (3 << 22) // Max counted before intr
+#define ZM_HAL_PROCESS_ANI 0x00000001 /* ANI state setup */
+#define ZM_RSSI_DUMMY_MARKER 0x127
+
+/* PHY registers in ar5416, related base and register offsets
+ may need to be changed in otus BB */
+#define AR_PHY_BASE 0x1C5800 /* base address of phy regs */
+#define AR_PHY(_n) (AR_PHY_BASE + ((_n)<<2))
+
+#define AR_PHY_TEST 0x1C5800 /* PHY test control */
+#define PHY_AGC_CLR 0x10000000 /* disable AGC to A2 */
+#define RFSILENT_BB 0x00002000 /* shush bb */
+
+#define AR_PHY_TURBO 0x1C5804 /* frame control register */
+#define AR_PHY_FC_TURBO_MODE 0x00000001 /* Set turbo mode bits */
+#define AR_PHY_FC_TURBO_SHORT 0x00000002 /* Set short symbols to turbo mode setting */
+#define AR_PHY_FC_DYN2040_EN 0x00000004 /* Enable dyn 20/40 mode */
+#define AR_PHY_FC_DYN2040_PRI_ONLY 0x00000008 /* dyn 20/40 - primary only */
+#define AR_PHY_FC_DYN2040_PRI_CH 0x00000010 /* dyn 20/40 - primary ch offset (0=+10MHz, 1=-10MHz)*/
+#define AR_PHY_FC_DYN2040_EXT_CH 0x00000020 /* dyn 20/40 - ext ch spacing (0=20MHz/ 1=25MHz) */
+#define AR_PHY_FC_HT_EN 0x00000040 /* ht enable */
+#define AR_PHY_FC_SHORT_GI_40 0x00000080 /* allow short GI for HT 40 */
+#define AR_PHY_FC_WALSH 0x00000100 /* walsh spatial spreading for 2 chains,2 streams TX */
+#define AR_PHY_FC_SINGLE_HT_LTF1 0x00000200 /* single length (4us) 1st HT long training symbol */
+
+#define AR_PHY_TIMING2 0x1C5810 /* Timing Control 2 */
+#define AR_PHY_TIMING2_USE_FORCE 0x00001000
+#define AR_PHY_TIMING2_FORCE_VAL 0x00000fff
+
+#define AR_PHY_TIMING3 0x1C5814 /* Timing control 3 */
+#define AR_PHY_TIMING3_DSC_MAN 0xFFFE0000
+#define AR_PHY_TIMING3_DSC_MAN_S 17
+#define AR_PHY_TIMING3_DSC_EXP 0x0001E000
+#define AR_PHY_TIMING3_DSC_EXP_S 13
+
+#define AR_PHY_CHIP_ID 0x1C5818 /* PHY chip revision ID */
+#define AR_PHY_CHIP_ID_REV_0 0x80 /* 5416 Rev 0 (owl 1.0) BB */
+#define AR_PHY_CHIP_ID_REV_1 0x81 /* 5416 Rev 1 (owl 2.0) BB */
+
+#define AR_PHY_ACTIVE 0x1C581C /* activation register */
+#define AR_PHY_ACTIVE_EN 0x00000001 /* Activate PHY chips */
+#define AR_PHY_ACTIVE_DIS 0x00000000 /* Deactivate PHY chips */
+
+#define AR_PHY_RF_CTL2 0x1C5824
+#define AR_PHY_TX_END_DATA_START 0x000000FF
+#define AR_PHY_TX_END_DATA_START_S 0
+#define AR_PHY_TX_END_PA_ON 0x0000FF00
+#define AR_PHY_TX_END_PA_ON_S 8
+
+
+#define AR_PHY_RF_CTL3 0x1C5828
+#define AR_PHY_TX_END_TO_A2_RX_ON 0x00FF0000
+#define AR_PHY_TX_END_TO_A2_RX_ON_S 16
+
+#define AR_PHY_ADC_CTL 0x1C582C
+#define AR_PHY_ADC_CTL_OFF_INBUFGAIN 0x00000003
+#define AR_PHY_ADC_CTL_OFF_INBUFGAIN_S 0
+#define AR_PHY_ADC_CTL_OFF_PWDDAC 0x00002000
+#define AR_PHY_ADC_CTL_OFF_PWDBANDGAP 0x00004000 /* BB Rev 4.2+ only */
+#define AR_PHY_ADC_CTL_OFF_PWDADC 0x00008000 /* BB Rev 4.2+ only */
+#define AR_PHY_ADC_CTL_ON_INBUFGAIN 0x00030000
+#define AR_PHY_ADC_CTL_ON_INBUFGAIN_S 16
+
+#define AR_PHY_ADC_SERIAL_CTL 0x1C5830
+#define AR_PHY_SEL_INTERNAL_ADDAC 0x00000000
+#define AR_PHY_SEL_EXTERNAL_RADIO 0x00000001
+
+#define AR_PHY_RF_CTL4 0x1C5834
+#define AR_PHY_RF_CTL4_TX_END_XPAB_OFF 0xFF000000
+#define AR_PHY_RF_CTL4_TX_END_XPAB_OFF_S 24
+#define AR_PHY_RF_CTL4_TX_END_XPAA_OFF 0x00FF0000
+#define AR_PHY_RF_CTL4_TX_END_XPAA_OFF_S 16
+#define AR_PHY_RF_CTL4_FRAME_XPAB_ON 0x0000FF00
+#define AR_PHY_RF_CTL4_FRAME_XPAB_ON_S 8
+#define AR_PHY_RF_CTL4_FRAME_XPAA_ON 0x000000FF
+#define AR_PHY_RF_CTL4_FRAME_XPAA_ON_S 0
+
+#define AR_PHY_SETTLING 0x1C5844
+#define AR_PHY_SETTLING_SWITCH 0x00003F80
+#define AR_PHY_SETTLING_SWITCH_S 7
+
+#define AR_PHY_RXGAIN 0x1C5848
+#define AR_PHY_RXGAIN_TXRX_ATTEN 0x0003F000
+#define AR_PHY_RXGAIN_TXRX_ATTEN_S 12
+#define AR_PHY_RXGAIN_TXRX_RF_MAX 0x007C0000
+#define AR_PHY_RXGAIN_TXRX_RF_MAX_S 18
+
+#define AR_PHY_DESIRED_SZ 0x1C5850
+#define AR_PHY_DESIRED_SZ_ADC 0x000000FF
+#define AR_PHY_DESIRED_SZ_ADC_S 0
+#define AR_PHY_DESIRED_SZ_PGA 0x0000FF00
+#define AR_PHY_DESIRED_SZ_PGA_S 8
+#define AR_PHY_DESIRED_SZ_TOT_DES 0x0FF00000
+#define AR_PHY_DESIRED_SZ_TOT_DES_S 20
+
+#define AR_PHY_FIND_SIG 0x1C5858
+#define AR_PHY_FIND_SIG_FIRSTEP 0x0003F000
+#define AR_PHY_FIND_SIG_FIRSTEP_S 12
+#define AR_PHY_FIND_SIG_FIRPWR 0x03FC0000
+#define AR_PHY_FIND_SIG_FIRPWR_S 18
+
+#define AR_PHY_AGC_CTL1 0x1C585C
+#define AR_PHY_AGC_CTL1_COARSE_LOW 0x00007F80
+#define AR_PHY_AGC_CTL1_COARSE_LOW_S 7
+#define AR_PHY_AGC_CTL1_COARSE_HIGH 0x003F8000
+#define AR_PHY_AGC_CTL1_COARSE_HIGH_S 15
+
+#define AR_PHY_AGC_CONTROL 0x1C5860 /* chip calibration and noise floor setting */
+#define AR_PHY_AGC_CONTROL_CAL 0x00000001 /* do internal calibration */
+#define AR_PHY_AGC_CONTROL_NF 0x00000002 /* do noise-floor calculation */
+
+#define AR_PHY_CCA 0x1C5864
+#define AR_PHY_MINCCA_PWR 0x1FF00000
+#define AR_PHY_MINCCA_PWR_S 19
+#define AR_PHY_CCA_THRESH62 0x0007F000
+#define AR_PHY_CCA_THRESH62_S 12
+
+#define AR_PHY_SFCORR_LOW 0x1C586C
+#define AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW 0x00000001
+#define AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW 0x00003F00
+#define AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW_S 8
+#define AR_PHY_SFCORR_LOW_M1_THRESH_LOW 0x001FC000
+#define AR_PHY_SFCORR_LOW_M1_THRESH_LOW_S 14
+#define AR_PHY_SFCORR_LOW_M2_THRESH_LOW 0x0FE00000
+#define AR_PHY_SFCORR_LOW_M2_THRESH_LOW_S 21
+
+#define AR_PHY_SFCORR 0x1C5868
+#define AR_PHY_SFCORR_M2COUNT_THR 0x0000001F
+#define AR_PHY_SFCORR_M2COUNT_THR_S 0
+#define AR_PHY_SFCORR_M1_THRESH 0x00FE0000
+#define AR_PHY_SFCORR_M1_THRESH_S 17
+#define AR_PHY_SFCORR_M2_THRESH 0x7F000000
+#define AR_PHY_SFCORR_M2_THRESH_S 24
+
+#define AR_PHY_SLEEP_CTR_CONTROL 0x1C5870
+#define AR_PHY_SLEEP_CTR_LIMIT 0x1C5874
+#define AR_PHY_SLEEP_SCAL 0x1C5878
+
+#define AR_PHY_PLL_CTL 0x1C587c /* PLL control register */
+#define AR_PHY_PLL_CTL_40 0xaa /* 40 MHz */
+#define AR_PHY_PLL_CTL_40_5413 0x04
+#define AR_PHY_PLL_CTL_44 0xab /* 44 MHz for 11b, 11g */
+#define AR_PHY_PLL_CTL_44_2133 0xeb /* 44 MHz for 11b, 11g */
+#define AR_PHY_PLL_CTL_40_2133 0xea /* 40 MHz for 11a, turbos */
+
+#define AR_PHY_RX_DELAY 0x1C5914 /* analog pow-on time (100ns) */
+#define AR_PHY_RX_DELAY_DELAY 0x00003FFF /* delay from wakeup to rx ena */
+
+#define AR_PHY_TIMING_CTRL4 0x1C5920 /* timing control */
+#define AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF 0x01F /* Mask for kcos_theta-1 for q correction */
+#define AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF_S 0 /* shift for Q_COFF */
+#define AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF 0x7E0 /* Mask for sin_theta for i correction */
+#define AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF_S 5 /* Shift for sin_theta for i correction */
+#define AR_PHY_TIMING_CTRL4_IQCORR_ENABLE 0x800 /* enable IQ correction */
+#define AR_PHY_TIMING_CTRL4_IQCAL_LOG_COUNT_MAX 0xF000 /* Mask for max number of samples (logarithmic) */
+#define AR_PHY_TIMING_CTRL4_IQCAL_LOG_COUNT_MAX_S 12 /* Shift for max number of samples */
+#define AR_PHY_TIMING_CTRL4_DO_IQCAL 0x10000 /* perform IQ calibration */
+
+#define AR_PHY_TIMING5 0x1C5924
+#define AR_PHY_TIMING5_CYCPWR_THR1 0x000000FE
+#define AR_PHY_TIMING5_CYCPWR_THR1_S 1
+
+#define AR_PHY_POWER_TX_RATE1 0x1C5934
+#define AR_PHY_POWER_TX_RATE2 0x1C5938
+#define AR_PHY_POWER_TX_RATE_MAX 0x1C593c
+#define AR_PHY_POWER_TX_RATE_MAX_TPC_ENABLE 0x00000040
+
+#define AR_PHY_FRAME_CTL 0x1C5944
+#define AR_PHY_FRAME_CTL_TX_CLIP 0x00000038
+#define AR_PHY_FRAME_CTL_TX_CLIP_S 3
+
+#define AR_PHY_TXPWRADJ 0x1C594C /* BB Rev 4.2+ only */
+#define AR_PHY_TXPWRADJ_CCK_GAIN_DELTA 0x00000FC0
+#define AR_PHY_TXPWRADJ_CCK_GAIN_DELTA_S 6
+#define AR_PHY_TXPWRADJ_CCK_PCDAC_INDEX 0x00FC0000
+#define AR_PHY_TXPWRADJ_CCK_PCDAC_INDEX_S 18
+
+#define AR_PHY_RADAR_0 0x1C5954 /* radar detection settings */
+#define AR_PHY_RADAR_0_ENA 0x00000001 /* Enable radar detection */
+#define AR_PHY_RADAR_0_INBAND 0x0000003e /* Inband pulse threshold */
+#define AR_PHY_RADAR_0_INBAND_S 1
+#define AR_PHY_RADAR_0_PRSSI 0x00000FC0 /* Pulse rssi threshold */
+#define AR_PHY_RADAR_0_PRSSI_S 6
+#define AR_PHY_RADAR_0_HEIGHT 0x0003F000 /* Pulse height threshold */
+#define AR_PHY_RADAR_0_HEIGHT_S 12
+#define AR_PHY_RADAR_0_RRSSI 0x00FC0000 /* Radar rssi threshold */
+#define AR_PHY_RADAR_0_RRSSI_S 18
+#define AR_PHY_RADAR_0_FIRPWR 0x7F000000 /* Radar firpwr threshold */
+#define AR_PHY_RADAR_0_FIRPWR_S 24
+
+#define AR_PHY_SWITCH_CHAIN_0 0x1C5960
+#define AR_PHY_SWITCH_COM 0x1C5964
+
+#define AR_PHY_SIGMA_DELTA 0x1C596C /* AR5312 only */
+#define AR_PHY_SIGMA_DELTA_ADC_SEL 0x00000003
+#define AR_PHY_SIGMA_DELTA_ADC_SEL_S 0
+#define AR_PHY_SIGMA_DELTA_FILT2 0x000000F8
+#define AR_PHY_SIGMA_DELTA_FILT2_S 3
+#define AR_PHY_SIGMA_DELTA_FILT1 0x00001F00
+#define AR_PHY_SIGMA_DELTA_FILT1_S 8
+#define AR_PHY_SIGMA_DELTA_ADC_CLIP 0x01FFE000
+#define AR_PHY_SIGMA_DELTA_ADC_CLIP_S 13
+
+#define AR_PHY_RESTART 0x1C5970 /* restart */
+#define AR_PHY_RESTART_DIV_GC 0x001C0000 /* bb_ant_fast_div_gc_limit */
+#define AR_PHY_RESTART_DIV_GC_S 18
+
+#define AR_PHY_RFBUS_REQ 0x1C597C
+#define AR_PHY_RFBUS_REQ_EN 0x00000001
+
+#define AR_PHY_RX_CHAINMASK 0x1C59a4
+
+#define AR_PHY_EXT_CCA 0x1C59bc
+#define AR_PHY_EXT_MINCCA_PWR 0xFF800000
+#define AR_PHY_EXT_MINCCA_PWR_S 23
+
+#define AR_PHY_HALFGI 0x1C59D0 /* Timing control 3 */
+#define AR_PHY_HALFGI_DSC_MAN 0x0007FFF0
+#define AR_PHY_HALFGI_DSC_MAN_S 4
+#define AR_PHY_HALFGI_DSC_EXP 0x0000000F
+#define AR_PHY_HALFGI_DSC_EXP_S 0
+
+#define AR_PHY_HEAVY_CLIP_ENABLE 0x1C59E0
+
+#define AR_PHY_M_SLEEP 0x1C59f0 /* sleep control registers */
+#define AR_PHY_REFCLKDLY 0x1C59f4
+#define AR_PHY_REFCLKPD 0x1C59f8
+
+/* PHY IQ calibration results */
+#define AR_PHY_IQCAL_RES_PWR_MEAS_I 0x1C5C10 /* power measurement for I */
+#define AR_PHY_IQCAL_RES_PWR_MEAS_Q 0x1C5C14 /* power measurement for Q */
+#define AR_PHY_IQCAL_RES_IQ_CORR_MEAS 0x1C5C18 /* IQ correlation measurement */
+
+#define AR_PHY_CURRENT_RSSI 0x1C5C1c /* rssi of current frame rx'd */
+
+#define AR_PHY_RFBUS_GRANT 0x1C5C20
+#define AR_PHY_RFBUS_GRANT_EN 0x00000001
+
+#define AR_PHY_MODE 0x1C6200 /* Mode register */
+#define AR_PHY_MODE_AR2133 0x08 /* AR2133 */
+#define AR_PHY_MODE_AR5111 0x00 /* AR5111/AR2111 */
+#define AR_PHY_MODE_AR5112 0x08 /* AR5112*/
+#define AR_PHY_MODE_DYNAMIC 0x04 /* dynamic CCK/OFDM mode */
+#define AR_PHY_MODE_RF2GHZ 0x02 /* 2.4 GHz */
+#define AR_PHY_MODE_RF5GHZ 0x00 /* 5 GHz */
+#define AR_PHY_MODE_CCK 0x01 /* CCK */
+#define AR_PHY_MODE_OFDM 0x00 /* OFDM */
+
+#define AR_PHY_CCK_TX_CTRL 0x1C6204
+#define AR_PHY_CCK_TX_CTRL_JAPAN 0x00000010
+
+#define AR_PHY_CCK_DETECT 0x1C6208
+#define AR_PHY_CCK_DETECT_WEAK_SIG_THR_CCK 0x0000003F
+#define AR_PHY_CCK_DETECT_WEAK_SIG_THR_CCK_S 0
+#define AR_PHY_CCK_DETECT_ANT_SWITCH_TIME 0x00001FC0 // [12:6] settling time for antenna switch
+#define AR_PHY_CCK_DETECT_ANT_SWITCH_TIME_S 6
+#define AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV 0x2000
+
+#define AR_PHY_GAIN_2GHZ 0x1C620C
+#define AR_PHY_GAIN_2GHZ_RXTX_MARGIN 0x00FC0000
+#define AR_PHY_GAIN_2GHZ_RXTX_MARGIN_S 18
+#define AR_PHY_GAIN_2GHZ_BSW_MARGIN 0x00003C00
+#define AR_PHY_GAIN_2GHZ_BSW_MARGIN_S 10
+#define AR_PHY_GAIN_2GHZ_BSW_ATTEN 0x0000001F
+#define AR_PHY_GAIN_2GHZ_BSW_ATTEN_S 0
+
+#define AR_PHY_CCK_RXCTRL4 0x1C621C
+#define AR_PHY_CCK_RXCTRL4_FREQ_EST_SHORT 0x01F80000
+#define AR_PHY_CCK_RXCTRL4_FREQ_EST_SHORT_S 19
+
+#define AR_PHY_DAG_CTRLCCK 0x1C6228
+#define AR_PHY_DAG_CTRLCCK_EN_RSSI_THR 0x00000200 /* BB Rev 4.2+ only */
+#define AR_PHY_DAG_CTRLCCK_RSSI_THR 0x0001FC00 /* BB Rev 4.2+ only */
+#define AR_PHY_DAG_CTRLCCK_RSSI_THR_S 10 /* BB Rev 4.2+ only */
+
+#define AR_PHY_POWER_TX_RATE3 0x1C6234
+#define AR_PHY_POWER_TX_RATE4 0x1C6238
+
+#define AR_PHY_SCRM_SEQ_XR 0x1C623C
+#define AR_PHY_HEADER_DETECT_XR 0x1C6240
+#define AR_PHY_CHIRP_DETECTED_XR 0x1C6244
+#define AR_PHY_BLUETOOTH 0x1C6254
+
+#define AR_PHY_TPCRG1 0x1C6258 /* ar2413 power control */
+#define AR_PHY_TPCRG1_NUM_PD_GAIN 0x0000c000
+#define AR_PHY_TPCRG1_NUM_PD_GAIN_S 14
+
+#define AR_PHY_TPCRG1_PD_GAIN_1 0x00030000
+#define AR_PHY_TPCRG1_PD_GAIN_1_S 16
+#define AR_PHY_TPCRG1_PD_GAIN_2 0x000C0000
+#define AR_PHY_TPCRG1_PD_GAIN_2_S 18
+#define AR_PHY_TPCRG1_PD_GAIN_3 0x00300000
+#define AR_PHY_TPCRG1_PD_GAIN_3_S 20
+//
+
+#define AR_PHY_ANALOG_SWAP 0xa268
+#define AR_PHY_SWAP_ALT_CHAIN 0x00000040
+
+#define AR_PHY_TPCRG5 0x1C626C /* ar2413 power control */
+#define AR_PHY_TPCRG5_PD_GAIN_OVERLAP 0x0000000F
+#define AR_PHY_TPCRG5_PD_GAIN_OVERLAP_S 0
+#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_1 0x000003F0
+#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_1_S 4
+#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_2 0x0000FC00
+#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_2_S 10
+#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_3 0x003F0000
+#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_3_S 16
+#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_4 0x0FC00000
+#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_4_S 22
+
+#define AR_PHY_POWER_TX_RATE5 0x1C638C
+#define AR_PHY_POWER_TX_RATE6 0x1C6390
+
+#define AR_PHY_CAL_CHAINMASK 0x1C639C
+
+#define AR_PHY_POWER_TX_SUB 0x1C63C8
+#define AR_PHY_POWER_TX_RATE7 0x1C63CC
+#define AR_PHY_POWER_TX_RATE8 0x1C63D0
+#define AR_PHY_POWER_TX_RATE9 0x1C63D4
diff --git a/drivers/staging/otus/hal/hpfw2.c b/drivers/staging/otus/hal/hpfw2.c
new file mode 100644
index 00000000000..baceb029976
--- /dev/null
+++ b/drivers/staging/otus/hal/hpfw2.c
@@ -0,0 +1,1018 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include "../80211core/cprecomp.h"
+
+const u32_t zcP2FwImage[] = {
+0x0009000B, 0x4F222FE6, 0xDE947FFC, 0xE114D594,
+0x1E13D494, 0x67521E4C, 0xD494D693, 0x37402769,
+0x62528F06, 0x7201D692, 0x60602522, 0x2600C93F,
+0xD7906152, 0x2512611D, 0x264B6652, 0x2562470B,
+0x0009B00D, 0xE60095AC, 0xC84060E2, 0x2F028F03,
+0x8FF93652, 0x7F047601, 0xA05A4F26, 0x4F226EF6,
+0x410BD185, 0xD4850009, 0x0009440B, 0x450BD584,
+0xD7840009, 0xD284E1FF, 0x2712611D, 0xD4835029,
+0xE1FFCB01, 0x1209E501, 0x12112212, 0xE7202452,
+0x4718D57F, 0x2572D27F, 0xD17FE700, 0xD680D47F,
+0xE2012270, 0x24702172, 0xD67E2620, 0x2641E4FF,
+0xD57DE600, 0x666DE104, 0x76016063, 0x4000626D,
+0x8FF83212, 0xD5790545, 0x2520E201, 0xD279D778,
+0x2710E100, 0xE5802212, 0x655C6613, 0x666DD476,
+0x76046763, 0x374C626D, 0x8FF83253, 0xD4732712,
+0xD573E101, 0xD6732410, 0x2542E400, 0xE03AE501,
+0xD272D771, 0xE0390654, 0x27110654, 0x000B4F26,
+0x7FC82211, 0xD76FD16E, 0xDC70DB6F, 0xD271DE70,
+0xD572D471, 0x1F12D672, 0x1F76710C, 0x1FB877FC,
+0x1FEA1FC9, 0x72041F2B, 0xDE6FDC6E, 0x1F13EB10,
+0x1F511F44, 0x1F771F65, 0xD86C1F2C, 0xDD6DD96C,
+0xD26DEA00, 0x89003A22, 0xD1587A01, 0x88016010,
+0x56F98B03, 0x4218E201, 0xD1682622, 0x0009410B,
+0x440BD467, 0xD5670009, 0x0009450B, 0x6010D14C,
+0x8B108801, 0xE650D14B, 0x46186212, 0x8B083266,
+0x56FAD147, 0x2120E200, 0xCB016062, 0x2602A003,
+0x72012710, 0x60822122, 0x89098801, 0xE2C8D15A,
+0x622C6612, 0x89033626, 0x6010D158, 0x8BC88801,
+0x51F76792, 0x217252F6, 0xD6555191, 0x55FB2212,
+0x52FC6462, 0x55612542, 0x2252E400, 0x61436643,
+0x05DE6013, 0x36CC4608, 0x02DE2652, 0xC9036021,
+0x8B028801, 0x720162E2, 0x74012E22, 0x36B3664C,
+0x71048FEE, 0x66C2D147, 0x45286512, 0x265B4518,
+0x60822C62, 0x89018801, 0x0009A168, 0x6272D742,
+0x8B132228, 0xD726D541, 0x6552D441, 0x51436672,
+0x316C365C, 0x27622668, 0x14138D05, 0x6262D63D,
+0xB1A57201, 0xD61E2622, 0x2622E200, 0x52916692,
+0x8B013620, 0x0009A144, 0x6061A06E, 0x001C001C,
+0x001D4020, 0x0000B38E, 0xFFFF0000, 0x12340000,
+0x001E1015, 0x00201278, 0x002018A0, 0x00201922,
+0x0020128C, 0x001C3510, 0x001C3624, 0x001E212C,
+0x0020397C, 0x00203514, 0x00203984, 0x00203990,
+0x0020399C, 0x002039F8, 0x002039FC, 0x002039A4,
+0x002039A5, 0x002039A8, 0x00117700, 0x00203A12,
+0x00203578, 0x001142D8, 0x00203A14, 0x00203A16,
+0x001C3D30, 0x00117718, 0x001C3D00, 0x001C1000,
+0x001C36F8, 0x00117734, 0x001C3684, 0x00117710,
+0x001C3520, 0x00117600, 0x00117740, 0x001C1028,
+0x0020358C, 0x002039AC, 0x7FFFFFFF, 0x00201734,
+0x002032BE, 0x002022E8, 0x00203DC0, 0x002039FA,
+0x00203584, 0x002039EC, 0x001C3D2C, 0x001C36B0,
+0x0020351C, 0x0011775C, 0x8801C90F, 0xA0CF8901,
+0xD17C0009, 0x36206212, 0xD47B8904, 0x2421E200,
+0x2162A0CC, 0x6211D179, 0x89012228, 0x0009A0C3,
+0xE202D775, 0x75016571, 0x3123615D, 0x27518D02,
+0x0009A0BC, 0xD27255F2, 0x62226052, 0x40094019,
+0xC90F4009, 0x8F19880A, 0x52F31F2D, 0x40196022,
+0x40094009, 0x8808C90F, 0xA0A78901, 0x60630009,
+0x51F255F8, 0xE701CB01, 0x2502D263, 0xE1002172,
+0x2211D564, 0x74016452, 0x2542A098, 0x8B3F8805,
+0x602252F3, 0x40094019, 0xC90F4009, 0x8B168802,
+0xE5FFD45D, 0x655D6742, 0x8B102758, 0x6272D75B,
+0x8B0C3260, 0x55F257F8, 0x2762E101, 0xD5522512,
+0xD757E400, 0x62722541, 0xA0777201, 0x52F32722,
+0x40196022, 0x40094009, 0x8805C90F, 0x31B38B6E,
+0xD5508B6C, 0x615257F4, 0x7101E240, 0x64722512,
+0x1F4DD14D, 0x42182419, 0x8B033420, 0x6262D64B,
+0x26227201, 0xE200D640, 0x2621B0AA, 0x0009A056,
+0x3123E220, 0x88038B52, 0x52F38B1E, 0x40196022,
+0x40094009, 0x8803C90F, 0xD7418B16, 0x647251F4,
+0x7401D23D, 0x65122742, 0x1F5DE640, 0x46182529,
+0x8B033560, 0x6262D63B, 0x26227201, 0xE200D62E,
+0x2621B086, 0x0009A010, 0xD738D137, 0xD22A6412,
+0xE5007401, 0x21423A76, 0x22518F06, 0xEA00D634,
+0x72016262, 0x2622B074, 0x2FB2D532, 0x95406652,
+0xD4305BF1, 0x36205241, 0x60618910, 0x8B01C803,
+0x2B22E201, 0x8FF54510, 0x57F15664, 0x6272E1F0,
+0x41284118, 0x2722221B, 0x6BF2A008, 0x6BF2A006,
+0xE200D615, 0xD1152621, 0x2121E200, 0xE20256F5,
+0x42186662, 0x26284228, 0x1F6D8D0C, 0xD61FD11E,
+0x460B6511, 0x2008645D, 0x57F58904, 0x6272D11C,
+0x27222219, 0xD11BE201, 0x66122822, 0x8B012668,
+0x0009AE17, 0x450BD518, 0xD1180009, 0xAE10E600,
+0x07D12160, 0x00203A0C, 0x00203A10, 0x00203A18,
+0x001C3DC0, 0x0011772C, 0x001C3B88, 0x002039F4,
+0x0011773C, 0x00117744, 0x0000F000, 0x00117764,
+0x00117748, 0x00117768, 0x0011776C, 0x01FFFFFF,
+0x0011774C, 0x00203584, 0x001142D8, 0x00114774,
+0xFDFFFFFF, 0x00203DC0, 0x0020246C, 0x002039FA,
+0x2F962F86, 0x2FB62FA6, 0x2FD62FC6, 0x4F222FE6,
+0xD11F7FF4, 0x6212DE1F, 0x67E25411, 0xD41E1F41,
+0x1F722F22, 0x6743D51D, 0x7794D21D, 0x5A425841,
+0x6C726942, 0x6D225B16, 0xE6006052, 0x2502CB20,
+0x7601E540, 0x3253626D, 0x62F28BFB, 0x212255F1,
+0x55F21151, 0x2E52D613, 0x14A21481, 0xD4122492,
+0x11B627C2, 0x674226D2, 0xD911DA10, 0x2A72E801,
+0x1A8C490B, 0x4218E201, 0x7F0C1A2C, 0x6EF64F26,
+0x6CF66DF6, 0x6AF66BF6, 0x000B69F6, 0x000068F6,
+0x001C3B9C, 0x001C3D98, 0x001C3700, 0x001C3500,
+0x001C5960, 0x001C8960, 0x0020358C, 0x001C3D00,
+0x00201610, 0x2F962F86, 0x2FC62FA6, 0x2FE62FD6,
+0x4F124F22, 0x7F884F02, 0xE018DEB2, 0xD4B261E0,
+0x61E30F14, 0x62107101, 0x440BE01C, 0x20080F24,
+0x8F126D03, 0xD4AD1F08, 0x6740DDAD, 0x657CD4AD,
+0x470BD7AD, 0xD2AD0009, 0x621C6120, 0x46086623,
+0x36284608, 0x3D6C4608, 0xE01C1FD8, 0xE58004FC,
+0x604C66E2, 0x3050655C, 0x2D628F17, 0x01FCE018,
+0xDEA3E500, 0x641CA008, 0x6753655D, 0x607037EC,
+0x31DC6153, 0x80147501, 0x3243625D, 0xD49D8BF4,
+0xE200D59D, 0xA27F2421, 0x20082521, 0xE0188B13,
+0xE50001FC, 0xA009DE96, 0x655D641C, 0x32EC6253,
+0x62536722, 0x32DC6672, 0x75041261, 0x3243625D,
+0xA2698BF3, 0x88012D10, 0xE0188B16, 0xE40001FC,
+0x671C2D40, 0x624DDE8A, 0x8B013273, 0x0009A25C,
+0x6DE3644D, 0x7D046243, 0x32EC6643, 0x652236DC,
+0x74086162, 0x2512AFEF, 0x8B198804, 0x01FCE018,
+0x2D70E700, 0x1FD56D1C, 0x627DDE7D, 0x8B0132D3,
+0x0009A242, 0x6173677D, 0x31EC65E3, 0x75046412,
+0x365C6673, 0x61426262, 0x21297708, 0x2412AFED,
+0x8B198805, 0x01FCE018, 0x2D70E700, 0x1FD46D1C,
+0x627DDE6F, 0x8B0132D3, 0x0009A226, 0x6173677D,
+0x31EC65E3, 0x75046412, 0x365C6673, 0x61426262,
+0x212B7708, 0x2412AFED, 0x8B598831, 0x61E6DE67,
+0x61E31F19, 0x64E27104, 0x1F4A6216, 0x1F2B6416,
+0x75E46513, 0x66536712, 0x1F4C7604, 0x64521F7D,
+0xD75F6E66, 0x27E0D25F, 0xDE5F6062, 0xC9013245,
+0x65622E00, 0x4609060A, 0x4609D15C, 0x46094509,
+0x21501F4E, 0xB2B0646D, 0x620D1F6F, 0x8B012228,
+0x0009A1EA, 0xD756DE55, 0x661C61E0, 0x6410D150,
+0x470B654C, 0x7FFC54FF, 0x2FE25EFE, 0x51FE7FFC,
+0x2F12E040, 0x55FBD14F, 0x57FD56FC, 0x04FE410B,
+0xD24D7F08, 0xE11C640D, 0x1D412D10, 0xD44B6522,
+0x67421D52, 0x1D73DE4A, 0xD24A65E2, 0x67221D54,
+0x1D75D249, 0xD2496E22, 0x66221DE6, 0x1D67A1BC,
+0x89018830, 0x0009A08E, 0xE340D538, 0x33FC6156,
+0x23126456, 0x71046153, 0x67521341, 0x13726416,
+0x7EE46E13, 0x65E66212, 0x66E3D731, 0x13246EE2,
+0x760427E0, 0x6062D22F, 0x3255DE2F, 0x2E00C901,
+0x060A6E62, 0xD12D4609, 0x4E094609, 0x13434609,
+0x646D21E0, 0xB2501F5E, 0x620D1F6F, 0x8B012228,
+0x0009A18A, 0xDE25D522, 0x61E06450, 0xD724654C,
+0x470B54FF, 0x7FFC661C, 0x06FEE054, 0x7FFC2F62,
+0xEE4001FE, 0x2F123EFC, 0x55E2D125, 0x57E456E3,
+0x64E2410B, 0xD21C7F08, 0xE11C640D, 0x1D412D10,
+0xD61A6522, 0x67621D52, 0x1D73DE19, 0xD2196EE2,
+0x62221DE4, 0xD2181D25, 0x1D266222, 0x6222D217,
+0x1D27A15A, 0x00117800, 0x00202A18, 0x00203996,
+0x002035BC, 0x00203A7C, 0x002018D0, 0x00203995,
+0x00117804, 0x00203A14, 0x00203A16, 0x00117810,
+0x00203991, 0x10624DD3, 0x00203992, 0x00203993,
+0x00114AA4, 0x00200F68, 0x001C5864, 0x001C6864,
+0x001C7864, 0x001C59BC, 0x001C69BC, 0x001C79BC,
+0x00200FC0, 0x8B048833, 0x470BD7A2, 0xA123EE00,
+0x88282DE0, 0xA0D38901, 0xDE9F0009, 0x62E1E143,
+0x3216E054, 0x0FE68F02, 0x2E21E240, 0x622D62E1,
+0x8B013217, 0x0009A0BC, 0xE50185E1, 0x8B013056,
+0x0009A0B6, 0x2D10E101, 0x64E1B111, 0x06FEE054,
+0x6261E143, 0x3517652D, 0xE6408945, 0x8B0C3563,
+0xE058E41A, 0xE5000F45, 0x72C0E05C, 0x60230F55,
+0x6703C907, 0xA014E060, 0x66530F75, 0x46214621,
+0x46214621, 0x45214621, 0xE0587618, 0x0F654521,
+0xE0034521, 0xE05C2509, 0xE0070F55, 0xE0602209,
+0xE8540F25, 0x858238FC, 0x640D65F3, 0x1844B170,
+0xDD7A8584, 0x85866C0D, 0x610D4C08, 0x410860C3,
+0xE00F0EFE, 0x18154D0B, 0x2E296207, 0x668260C3,
+0x85620FE6, 0x4D0B5185, 0x2E0B600D, 0x548460C3,
+0xB13C0FE6, 0xE05465F3, 0xE5400EFE, 0xE06C62E1,
+0x3653662D, 0x0F668D41, 0xC9036023, 0x40004008,
+0x61036403, 0xD965E070, 0x0F46E5FF, 0xE074655C,
+0x60530F96, 0x6263490B, 0x42214221, 0x42214221,
+0x42006723, 0x4200327C, 0x6C074621, 0x4621E054,
+0x606309FE, 0x4008C903, 0x790630FC, 0x6A036D2D,
+0x65F3E800, 0x64D3B124, 0xE0706EA2, 0x2AE22EC9,
+0x01FE6694, 0x666CE074, 0x470B07FE, 0x2E0B6063,
+0x65F32AE2, 0xB0FA64D3, 0x628D7801, 0x32E3EE06,
+0x7D018FE7, 0x0EFEE054, 0xE05462E1, 0x420006FE,
+0x760C8561, 0x701B302C, 0xE4006103, 0xE70465F3,
+0x68667401, 0x3973694D, 0x8FF92582, 0x65F37504,
+0x641DB0DD, 0x0EFEE054, 0x64E1B09C, 0x0009A054,
+0xD43B56F8, 0xEA01D23B, 0x26A0420B, 0x0009A04C,
+0x06FCE01C, 0x8829606C, 0x5CF88B08, 0xE200D636,
+0x52612C20, 0x642DB04B, 0x0009A03E, 0x666CE681,
+0x8B043060, 0x420BD231, 0xA03554F8, 0xE6820009,
+0x3060666C, 0xD22E8B04, 0x54F8420B, 0x0009A02C,
+0x666CE683, 0x8B0A3060, 0xDA2755F8, 0x2590E900,
+0xD82855A1, 0x2852D628, 0xA01D52A2, 0xE6922620,
+0x3060666C, 0xD2208B08, 0x5C21D824, 0x6CCC52F8,
+0x28C1E600, 0x2260A010, 0x666CE693, 0x8B063060,
+0xD61F59F8, 0xE201EA00, 0xA00529A0, 0xD6162621,
+0xD21DD41C, 0x6562420B, 0x4F067F78, 0x4F264F16,
+0x6DF66EF6, 0x6AF66CF6, 0x000B69F6, 0x4F2268F6,
+0xE240614D, 0x89323123, 0x3127E21F, 0x8B27D713,
+0xD406614D, 0xE00171E0, 0x5671440B, 0x26596507,
+0x1761A025, 0x00200FBC, 0x00117804, 0x00203470,
+0x00203A9C, 0x002018C0, 0x00117800, 0x00115F00,
+0x00116058, 0x0020397C, 0x00203990, 0x00203A1A,
+0x00203A16, 0x00203AB4, 0x002018D0, 0x001C3704,
+0xE001D490, 0x6672440B, 0x26596507, 0x4F262762,
+0x0009000B, 0x614D4F22, 0x3123E240, 0xE21F8912,
+0xD7893127, 0x614D8B08, 0x5671D286, 0x420B71E0,
+0x260BE001, 0x1761A006, 0x6672D282, 0xE001420B,
+0x2762260B, 0x000B4F26, 0xE6400009, 0x46284618,
+0x6252D57E, 0x89FC2268, 0x0009000B, 0x4618E680,
+0xD57A4628, 0x22686252, 0x000B89FC, 0xA0010009,
+0x7201E200, 0x8BFC3242, 0x0009000B, 0x4618E680,
+0xD5734628, 0x22686252, 0x000B8BFC, 0x2FE60009,
+0x7FFC4F22, 0xBFF16E53, 0x61E22F42, 0xE280D66D,
+0x54E11615, 0x16464218, 0x422855E2, 0x57E31657,
+0x16786EF2, 0x26E22E2B, 0x4F267F04, 0x6EF6AFCE,
+0x2FD62FC6, 0x4F222FE6, 0x6C53DD62, 0x6E43BFD6,
+0x2DE2BFBB, 0x0009BFD2, 0x2C1251D5, 0x1C4154D6,
+0x1C5255D7, 0x1C6356D8, 0x6EF64F26, 0x000B6DF6,
+0x61636CF6, 0xA004E600, 0x62564109, 0x24227601,
+0x36127404, 0x000B8BF9, 0xD6530009, 0x8562E500,
+0xA00B674D, 0x655D610D, 0x40006053, 0x305CD44F,
+0x024D4008, 0x3270622D, 0x75018905, 0x3213625D,
+0x000B8BF1, 0x000BE000, 0x2FE6E001, 0x54416743,
+0x4E08EE7F, 0x4E28D246, 0x25E96543, 0x60436E21,
+0x9E7562ED, 0x4529C903, 0xE60032E3, 0x8D456103,
+0x21184509, 0xD23F8B05, 0x002C6053, 0xA08AC93F,
+0x60136603, 0x8B268801, 0x880C6053, 0xD53A8B04,
+0xC93F8453, 0x6603A07F, 0x8B048808, 0x84E2DE36,
+0xA078C93F, 0x880D6603, 0x8B03D633, 0xC93F8461,
+0x6603A071, 0x88096260, 0x622C8F09, 0xE014DE2C,
+0x655C05EC, 0x60233258, 0xA064C93F, 0x60236603,
+0xA060C93F, 0x88026603, 0xE0078B5D, 0x60432509,
+0x8905C810, 0x6053D225, 0xC93F002C, 0x6603A053,
+0x6053DE23, 0xC93F00EC, 0x6603A04D, 0x88016013,
+0x60538B19, 0x8B04880C, 0x8423D21E, 0xA042C93F,
+0x88086603, 0xD51B8B04, 0xC93F8452, 0x6603A03B,
+0xD618880D, 0x84618B03, 0xA034C93F, 0x60606603,
+0xA030C93F, 0x88026603, 0xE0078B2D, 0x60432509,
+0x8923C810, 0x6053DE10, 0xC93F00EC, 0x6603A023,
+0x00000BB8, 0x00203470, 0x001C3704, 0x001C373C,
+0x001C3700, 0x001C370C, 0x00114000, 0x00114008,
+0x001142D8, 0x001142E4, 0x001142E8, 0x001142F5,
+0x001142ED, 0x001142FD, 0x00114309, 0x6053D209,
+0xC93F002C, 0x60136603, 0x8B038802, 0xC8106043,
+0x76028900, 0xC93F6063, 0x40004018, 0x1741240B,
+0x6EF6000B, 0x00114301, 0x0009A16E, 0x2FE62FD6,
+0xDD944F22, 0xA0049EB2, 0xD4930009, 0x420BD293,
+0x62D265D2, 0x8BF822E8, 0x0009A004, 0xD28FD490,
+0x55D1420B, 0x22E852D1, 0xA0048BF8, 0xD48D0009,
+0x420BD28A, 0x52D255D2, 0x8BF822E8, 0x0009A004,
+0xD286D489, 0x55D3420B, 0x22E852D3, 0xA0048BF8,
+0xD4860009, 0x420BD281, 0x52D455D4, 0x8BF822E8,
+0x6EF64F26, 0x6DF6000B, 0x2FD62FC6, 0x4F222FE6,
+0x6E636C73, 0x6D53B01A, 0x64D357F4, 0xB05F65E3,
+0xB07566C3, 0xB0A40009, 0xB0A80009, 0xB0AC0009,
+0xB0AC0009, 0xB0AF0009, 0xB03154F5, 0x6CCD6C03,
+0x4F2660C3, 0x6DF66EF6, 0x6CF6000B, 0x3412D170,
+0xD6700529, 0x2650D770, 0x2742000B, 0x0009A018,
+0x2FD62FC6, 0x4F222FE6, 0x6E636C73, 0x6D53BFEE,
+0x64D357F4, 0xB03365E3, 0xB08D66C3, 0xB00F54F5,
+0x6CCD6C03, 0x4F2660C3, 0x6DF66EF6, 0x6CF6000B,
+0xE503D162, 0xD763D462, 0x21524518, 0x2472000B,
+0xD45FD15E, 0x2162E600, 0x2462000B, 0xBF734F22,
+0xBF73E40A, 0xD25C0009, 0x4118E104, 0xE40AE500,
+0xBF692212, 0xD7592252, 0xCB206072, 0x000B4F26,
+0x4F222702, 0x410BD156, 0xD556E400, 0x4F26452B,
+0xD1552FE6, 0x66126E63, 0x92104418, 0x44084528,
+0x45002629, 0x265B4408, 0x264B4400, 0x21624708,
+0xD14E4708, 0x217227EB, 0x6EF6000B, 0x1FFF03F0,
+0x4F222FE6, 0xE101DE4A, 0xBF3DE40A, 0x67E32E12,
+0xE500776C, 0xE204E130, 0x2752E40A, 0x27522752,
+0x27522752, 0x27522752, 0x27522752, 0x27522752,
+0x27522752, 0x27522752, 0x27522752, 0x27522752,
+0x27222712, 0x27522752, 0x27522752, 0x27522752,
+0x27522752, 0x175ABF18, 0x2E62E600, 0x000B4F26,
+0xD2346EF6, 0xE441E101, 0x000B2212, 0xD1322242,
+0xE605D432, 0x000B2162, 0x000B2462, 0xD2300009,
+0xE40AE601, 0x2262AF00, 0x2FC62FB6, 0x2FE62FD6,
+0x7FFC4F22, 0x6C43DB2B, 0xED0060B2, 0x2B02CB03,
+0xC90360B2, 0x6E03A008, 0x89073DC2, 0xE46460B2,
+0xB07CC903, 0x7D016E03, 0x8BF52EE8, 0x8F043DC2,
+0xD4212FE1, 0x460BD621, 0x62F10009, 0x6023622D,
+0x89FFC801, 0x7F046023, 0x6EF64F26, 0x6CF66DF6,
+0x6BF6000B, 0x001C3B88, 0x00203AC8, 0x002018D0,
+0x00203AD0, 0x00203AD8, 0x00203AE0, 0x00203AE8,
+0x0025E720, 0x00203DBC, 0x00203980, 0x001C5968,
+0x001C3B40, 0x000F8000, 0x001D4004, 0x001C3500,
+0x002015E4, 0x00201610, 0x001C5814, 0x001C59D0,
+0x001C5830, 0x001C6268, 0x001C59A4, 0x001C639C,
+0x001C581C, 0x001C5860, 0x00203AF0, 0x002018C0,
+0x8F014411, 0x6043604B, 0x0009000B, 0x5651D52B,
+0x46286052, 0x306C000B, 0x2FC62FB6, 0x2FE62FD6,
+0x4F124F22, 0xBFF14F02, 0x6B036E43, 0xDD25DC24,
+0x0009BFEC, 0x3C0530B8, 0x4609060A, 0x46014609,
+0x020A3D65, 0x42094209, 0x32E24209, 0x4F068BF0,
+0x4F264F16, 0x6DF66EF6, 0x000B6CF6, 0x2FC66BF6,
+0x2FE62FD6, 0x4F124F22, 0xBFCF4F02, 0x6C036E43,
+0xBFCBDD13, 0x30C80009, 0x060A3D05, 0x46094609,
+0x36E24601, 0x4F068BF5, 0x4F264F16, 0x6DF66EF6,
+0x6CF6000B, 0x4F222FE6, 0xE102DE0B, 0xE403E500,
+0xBFB92E12, 0xE6062E52, 0xE7004618, 0x2E62E403,
+0x4F262E72, 0x6EF6AFB0, 0x0009000B, 0x001C1040,
+0xCCCCCCCD, 0x10624DD3, 0x001D4004, 0x2F962F86,
+0x2FB62FA6, 0x2FD62FC6, 0x4F222FE6, 0xE5007F98,
+0x6453E710, 0x6B534728, 0xEE1ADCBC, 0x6153655D,
+0x315C4108, 0x75014108, 0x6043317C, 0x0F16665D,
+0xED0060B3, 0x21B136E3, 0x81128111, 0x11D28113,
+0x11D411D3, 0x74048FEA, 0xD8B167F2, 0x1871D9B1,
+0x58F12872, 0x1981D1B0, 0x59F22982, 0x5DF45AF3,
+0x54F65EF5, 0x21921191, 0x11A211A3, 0x11D411D5,
+0x11E611E7, 0x11481149, 0xDAA855F7, 0x57F8EE00,
+0x52F9DDA7, 0x64E3D6A7, 0x2A521A51, 0xD8A7D9A6,
+0x2D72EAEF, 0x6AAC2622, 0x6DE36EED, 0x61E34D08,
+0x41083DEC, 0x31EC4D08, 0x60B33D9C, 0x2DB14108,
+0xE05081D1, 0xE79F4108, 0x41084008, 0x81D2677C,
+0x318C60B3, 0x3472E200, 0x1DD281D3, 0xD4931D13,
+0x1D248D01, 0x65D3D48F, 0x7E01B0B2, 0x34A264ED,
+0xDA8C8BDA, 0x68A22FD2, 0x4829DD91, 0x64A22D82,
+0x694D7DFC, 0x2D92D286, 0x4E296E22, 0x2DE27D0C,
+0x6AD36822, 0xD784618D, 0x6D722A16, 0xD583D489,
+0x5E7224D2, 0x14E2D688, 0xEE005174, 0x58761414,
+0x1486D186, 0xE7105978, 0x62521498, 0x142A65E3,
+0x64E326E2, 0x644DE600, 0x48086843, 0x4808384C,
+0x6053381C, 0x28B10C86, 0x60B309CE, 0x60538191,
+0x60430ACE, 0x605381A2, 0x60B30DCE, 0x605381D3,
+0x740108CE, 0x09CE1882, 0x19E3624D, 0x32730ACE,
+0x8FE01A64, 0xD96A7504, 0x6C92E003, 0x2CB14018,
+0xDA6F6D92, 0xE05081D1, 0x40086E92, 0x619281E2,
+0x811360B3, 0xE6006492, 0x67921442, 0x17A3D468,
+0xE1FF6892, 0xE7031864, 0x46086563, 0x7501364C,
+0x665D2612, 0x8BF83673, 0xE003DC5A, 0x40186DC2,
+0x6EC22DB1, 0x81E1D25F, 0xEE0061C2, 0x64C21112,
+0x1423E024, 0xD45B65C2, 0x67C215E4, 0x8172E580,
+0x66E368C2, 0x655C8183, 0x6963666D, 0x6A6D7604,
+0x3A53394C, 0x29E28FF8, 0xDC54DB53, 0x740424B2,
+0x7F6824C2, 0x6EF64F26, 0x6CF66DF6, 0x6AF66BF6,
+0x000B69F6, 0x614268F6, 0xC8036011, 0xE5008F03,
+0x3420D23C, 0x60118B06, 0x8802C903, 0xD2398B06,
+0x8B033420, 0x65135612, 0x24225264, 0x6053000B,
+0x2FE62FD6, 0x7FEC4F22, 0x62536E53, 0x6D43E550,
+0x4508E400, 0xE101A001, 0x60435224, 0x81212211,
+0x60538123, 0x56E28122, 0x8BF53620, 0x16E4D238,
+0xE61464F3, 0x65E3420B, 0xE4FC65E1, 0x2E512549,
+0x65F361F1, 0x2F112149, 0xD13154D1, 0xE614410B,
+0x607157D1, 0x2701CB01, 0x7F141DE1, 0x6EF64F26,
+0x6DF6000B, 0x2FE62FD6, 0x7FEC4F22, 0x66536E53,
+0x6D43E5FC, 0x20596061, 0x2601CB01, 0x326052E2,
+0x12E48B06, 0x31E051E2, 0x52D18B04, 0x1E22A002,
+0x5664AFF0, 0x64F3D21E, 0x420BE614, 0x67E165E3,
+0x2719E1FC, 0x67F12E71, 0x271954D1, 0x65F3D118,
+0x410BE614, 0x52D12F71, 0xCB016021, 0x1DE12201,
+0x4F267F14, 0x000B6EF6, 0x00006DF6, 0x002039AC,
+0x0020357C, 0x00203584, 0x0020358C, 0x002035B4,
+0x00203998, 0x002039A0, 0x00100208, 0x001014C0,
+0x001E210C, 0x001C3D00, 0x002039EC, 0x001000C8,
+0x00117880, 0x00117780, 0x00040020, 0x0026C401,
+0x00200D42, 0x4F222FE6, 0xDE42624C, 0x42004208,
+0x3E2CA005, 0xD4405252, 0xBF695624, 0x65E22E62,
+0x352052E1, 0xD63D8BF6, 0x4F262622, 0x6EF6000B,
+0x2FC62FB6, 0x2FE62FD6, 0xDC394F22, 0x52C1DB39,
+0x362066C2, 0x6061891C, 0x8801C903, 0xDE348918,
+0xBF38DD35, 0x650364E3, 0x66B28503, 0x3262620D,
+0xD4328907, 0x0009BF76, 0x4D0BD431, 0xAFE60009,
+0xBF3D0009, 0xD42F64E3, 0x00094D0B, 0x0009AFDF,
+0x2262D22D, 0x6EF64F26, 0x6CF66DF6, 0x6BF6000B,
+0x2FD62FC6, 0x4F222FE6, 0xDD29DC28, 0x6E4360C2,
+0x04DE4008, 0xE614D127, 0x65E3410B, 0xD127D726,
+0x55E227E2, 0x35E05254, 0x21228F04, 0x400860C2,
+0x122202DE, 0x605365C2, 0x75014008, 0x0DE606DE,
+0xC90F6053, 0x60632C02, 0x6EF64F26, 0x000B6DF6,
+0x85436CF6, 0x650D5643, 0x622D6262, 0x35277204,
+0xE1008F0C, 0x2268960C, 0xD6158B03, 0x72015261,
+0xD6131621, 0x6262E101, 0x26227201, 0x6013000B,
+0x000001FF, 0x0020358C, 0x00203584, 0x001C3D00,
+0x002035B4, 0x0020397C, 0x002018C0, 0x0020357C,
+0x00203B18, 0x00203B1C, 0x001C3D28, 0x002039EC,
+0x002039AC, 0x00200D42, 0x002039F0, 0x002039F4,
+0x00117754, 0x2FA62F96, 0x2FC62FB6, 0x2FE62FD6,
+0x7FF84F22, 0x6C22D241, 0xC80360C3, 0xDE40896E,
+0xDA41DB40, 0x52B1D941, 0x362066B2, 0x60618945,
+0x8801C903, 0xDD3B8941, 0x420BD23D, 0x650364D3,
+0x60A12F02, 0x89328801, 0x85145153, 0x8840600C,
+0x1F118F0C, 0xD5376191, 0x641D450B, 0x8B262008,
+0xD7356691, 0x646D470B, 0x8B202008, 0x420BD233,
+0x51F154F1, 0xC8208511, 0xD1318904, 0x021EE050,
+0x01267201, 0x420BD22F, 0x200864F2, 0x64D38907,
+0x4D0BDD2D, 0xD12D65F2, 0xAFC4E601, 0xD22C2162,
+0x420B65F2, 0xD72B64E3, 0xAFBCE601, 0xD2262762,
+0x420B65F2, 0xAFB664D3, 0xDE270009, 0xDA28DD27,
+0x52D1DB28, 0x362066D2, 0x60618918, 0x8801C903,
+0xD4228914, 0x450BD516, 0x56030009, 0x8F0436E0,
+0xE2016503, 0xAFEC2A20, 0xD41F2B52, 0x420BD216,
+0xD7180009, 0x4118E101, 0x2712AFE3, 0xC80460C3,
+0xD21A8902, 0x0009420B, 0x4F267F08, 0x6DF66EF6,
+0x6BF66CF6, 0x000B6AF6, 0x000069F6, 0x001E2100,
+0x0020358C, 0x00203584, 0x00203A14, 0x001142D8,
+0x002014A6, 0x00115EA2, 0x00114774, 0x00200D8A,
+0x0020351C, 0x002016C2, 0x002014D0, 0x001E212C,
+0x00201534, 0x001C3D30, 0x00117880, 0x0020357C,
+0x0020399C, 0x00203998, 0x002035B4, 0x00200644,
+0xE601D203, 0x1265D503, 0x000B2252, 0x00001266,
+0x001C1010, 0x0000C34F, 0x0009000B, 0x0009000B,
+0x0009000B, 0x0009000B, 0xE000000B, 0xE000000B,
+0x0009000B, 0xE4FDD59D, 0xD69D6152, 0x25122149,
+0x74016052, 0x2502CB01, 0xD19A6752, 0x25722749,
+0xC8406010, 0x60628902, 0x2602CB04, 0xE1F76462,
+0x26422419, 0xE7016062, 0x2602C9CF, 0xE5026062,
+0x2602CB10, 0x47186062, 0x2602CB03, 0x000B1652,
+0xD58D1673, 0xD28ED78D, 0xE100D48E, 0x2511E600,
+0x22102711, 0x2461AFCE, 0xD28B664C, 0x362C4600,
+0xCB106060, 0x2600000B, 0xD287654C, 0x352C4500,
+0xE1EF6650, 0x000B2619, 0x664C2560, 0x4600D283,
+0x6060362C, 0x000BCB10, 0x654C2600, 0x4500D27F,
+0x6650352C, 0x2619E1EF, 0x2560000B, 0xD27A664C,
+0x362C4600, 0xCB086060, 0x2600000B, 0xD276654C,
+0x352C4500, 0xE1F76650, 0x000B2619, 0x664C2560,
+0x4600D272, 0x6060362C, 0x000BCB08, 0x654C2600,
+0x4500D26E, 0x6650352C, 0x2619E1F7, 0x2560000B,
+0xD669624C, 0x326C4200, 0xC9086020, 0x40214021,
+0x000B4021, 0x624C600C, 0x4200D664, 0x6020326C,
+0x4021C908, 0x40214021, 0x600C000B, 0x644CD160,
+0x6240341C, 0x602C000B, 0x644CD15E, 0x6240341C,
+0x602C000B, 0x4F222FE6, 0x645C6E43, 0x3467E60A,
+0xBFEB8914, 0x640C0009, 0x880160EC, 0xE00F8B02,
+0x2409A002, 0x44094409, 0xE60A624C, 0x89053263,
+0x644CBFE2, 0x6023620C, 0x8B00C880, 0x6023E200,
+0x000B4F26, 0x4F226EF6, 0x6062D64B, 0x8B038801,
+0x0009B256, 0x0009A003, 0xE640D248, 0xD6482260,
+0x4F26E200, 0x2622000B, 0xD6434F22, 0x88026062,
+0xB29F8B01, 0xD6420009, 0x4F26E200, 0x2622000B,
+0xD43ED53D, 0xE701E100, 0x000B2512, 0xD23B2470,
+0x000BE604, 0x4F222260, 0xD13BD43A, 0x0009410B,
+0xE1FDD53A, 0xD23A6650, 0xE7002619, 0x4F262560,
+0x2270000B, 0xD5374F22, 0x6152D237, 0x611DD737,
+0x64522512, 0x242BE6FF, 0xD4352542, 0x666DD22E,
+0x2762420B, 0xE1FBD52D, 0x27196750, 0x000B4F26,
+0x4F222570, 0xD128D42F, 0x0009410B, 0xE7F7D527,
+0x26796650, 0x000B4F26, 0xD5242560, 0x62509425,
+0x000B2249, 0xD5212520, 0x6250E4BF, 0x000B2249,
+0x4F222520, 0x8522D224, 0x2008600D, 0x88018911,
+0x88038944, 0x88058946, 0x88068948, 0x8808894E,
+0x88098954, 0x880A895A, 0x880B8960, 0xA06D8966,
+0xB06F0009, 0xA06A0009, 0xFF7F600C, 0x001E2148,
+0x001E1108, 0x001E1000, 0x00203A4C, 0x00203A4E,
+0x00203A6D, 0x00203A30, 0x001E103F, 0x001E105F,
+0x001E102F, 0x001E1090, 0x00203A54, 0x001E100B,
+0x00203A50, 0x00203B20, 0x002018C0, 0x001E1028,
+0x00203A6C, 0x001D4020, 0x98760000, 0x001C1000,
+0x00203B2C, 0x00203B3C, 0x00203A24, 0x0009B04C,
+0x600CA035, 0x0009B055, 0x600CA031, 0x6260D684,
+0x8B2B2228, 0x0009B061, 0x600CA029, 0x6260D680,
+0x8B232228, 0x0009B069, 0x600CA021, 0x6260D67C,
+0x8B1B2228, 0x0009B0C7, 0x600CA019, 0x6260D678,
+0x8B132228, 0x0009B0CD, 0x600CA011, 0x6260D674,
+0x8B0B2228, 0x0009B125, 0x600CA009, 0x6260D670,
+0x8B032228, 0x0009B13D, 0x600CA001, 0x4F26E000,
+0x0009000B, 0xD26CD16B, 0xD56C8412, 0x4000C90F,
+0xD76B012D, 0xE403D66B, 0xE20F611C, 0x2540E001,
+0x25202712, 0x2602000B, 0xE601D262, 0x30668523,
+0xE0008D05, 0xD663D260, 0xE0018122, 0x000B2602,
+0xD25C0009, 0x600D8523, 0x89052008, 0x8B0A8801,
+0x6060D65D, 0x2600CB01, 0xD457D65A, 0xE001E101,
+0x000B2612, 0x000B8142, 0xD152E000, 0x8513E501,
+0x640D4518, 0x66033453, 0xE0008D05, 0xD551D253,
+0x2260E001, 0x000B2502, 0x4F220009, 0x8513D149,
+0x6453650D, 0x62494419, 0x227D672E, 0x8801602C,
+0x88028909, 0x88038910, 0x8806891A, 0x88078935,
+0xA04C893B, 0xD5460009, 0x6652D746, 0x2762D446,
+0x622C6261, 0x2421A038, 0x2228625C, 0xD4438B3F,
+0x6642D540, 0x2562D440, 0x24018561, 0x6203A02C,
+0x2008605C, 0x88108907, 0x88208908, 0x88308909,
+0xA02C890A, 0xD23A0009, 0x6222A008, 0xA005D239,
+0xD2396222, 0x6222A002, 0x6262D638, 0xD432D531,
+0x66212522, 0xA00F626C, 0xD6352421, 0x6261D52D,
+0x622CD42D, 0xA0072562, 0xD6322421, 0x8561D529,
+0x2562D429, 0x62032401, 0x662D8515, 0x3617610D,
+0x65038F01, 0xB0CB2451, 0xA0010009, 0xE000E001,
+0x000B4F26, 0xD6190009, 0xD427E101, 0x65412610,
+0xD118D717, 0xE20F655D, 0x2752E001, 0x000B2620,
+0x2FE62102, 0xD20F4F22, 0x640C8523, 0x8B082448,
+0xD511D61D, 0x2621E200, 0x940F8451, 0xA0482049,
+0xDE0D8051, 0xC84060E0, 0xE2018D32, 0x89443427,
+0xD216D615, 0x2641420B, 0x0009A030, 0x0000FF7F,
+0x00203A6D, 0x00203A24, 0x00203A30, 0x001E1100,
+0x001E100C, 0x00203A50, 0x001E1000, 0x001E1001,
+0x00203A58, 0x00203A38, 0x00203A3C, 0x00203A40,
+0x00203A5C, 0x00203A60, 0x00203A64, 0x00203A68,
+0x00203E20, 0x00203E2A, 0x00203A4A, 0x002027F2,
+0x89123427, 0xD294D693, 0x2641420B, 0xCB8084E1,
+0x80E1B0F5, 0xD69160E0, 0x2E00CB04, 0xC93F6060,
+0xD68F2600, 0xA001E001, 0xE0002602, 0x000B4F26,
+0xD68C6EF6, 0xC8806060, 0xD2868919, 0x88016021,
+0xD2898B15, 0x8524E501, 0x89103056, 0xE203D187,
+0x2120D487, 0xE00B6541, 0x0656655D, 0xE40FD585,
+0x2140E702, 0xD77E2571, 0x000BE001, 0x000B2702,
+0x2FE6E000, 0xDE804F22, 0xC88084E1, 0xD57A892C,
+0x20088554, 0x61038F28, 0x8553D77C, 0x64036672,
+0x8566650C, 0x3520620C, 0xD6798B1E, 0x651CD774,
+0x2651644C, 0x60E02741, 0x8904C840, 0x420BD275,
+0xA0030009, 0xD2680009, 0x0009420B, 0x0009B09F,
+0xE201D167, 0x60E02122, 0xCB04D464, 0x60402E00,
+0x2400C93F, 0x6023A001, 0x4F26E000, 0x6EF6000B,
+0x2FB62FA6, 0x2FD62FC6, 0xDA622FE6, 0x66A1E240,
+0x3622DC5E, 0x62638900, 0x6ED36D2C, 0x4E2136D8,
+0x4E212A61, 0xDB61D460, 0xE700A00F, 0x770162B2,
+0x71026123, 0x66212B12, 0x71026213, 0x61212B12,
+0x651D666D, 0x356C4528, 0x627C2452, 0x8BED32E3,
+0xC90360D3, 0x8B108803, 0x617367B2, 0x2B127102,
+0x71026E13, 0x2B126571, 0x655D6DE1, 0x422862DD,
+0x325CE107, 0xA00C2C10, 0x88022422, 0xA0038B01,
+0x8801E203, 0xE2018B05, 0x66B22C20, 0x655D6561,
+0xE60F2452, 0x67A12C60, 0x8B052778, 0xDD38DC44,
+0xEB01EA00, 0x2DB22CA2, 0x6DF66EF6, 0x6BF66CF6,
+0x6AF6000B, 0x2FE62FD6, 0xE240DD36, 0x362266D1,
+0x62638900, 0x3678672C, 0x7703DE38, 0x47212D61,
+0x64E2D635, 0xA00E4721, 0x6562E100, 0x62537101,
+0x74012450, 0x24204219, 0x45297401, 0x74012450,
+0x24504519, 0x621C7401, 0x8BEE3273, 0x66E24200,
+0x420061D1, 0x2118362C, 0x2E628F06, 0xDD1CD728,
+0xE501E400, 0x2D522742, 0x000B6EF6, 0x2FD66DF6,
+0x4F222FE6, 0xED0AEE01, 0x64E3BC86, 0xBC8B64E3,
+0x62EC7E01, 0x8BF732D7, 0xBC8EEE01, 0x64E364E3,
+0x7E01BC93, 0x32D762EC, 0x4F268BF7, 0x000B6EF6,
+0xD1186DF6, 0xD418920D, 0x72122122, 0x2422D617,
+0xD7177204, 0x72202622, 0x2722D116, 0x000B7230,
+0x137A2122, 0x00203A4A, 0x002028FE, 0x001E1015,
+0x00203A50, 0x001E1001, 0x00203A24, 0x001E1100,
+0x00203A4E, 0x00203A3C, 0x001E1000, 0x00203A40,
+0x00203A4C, 0x002027F2, 0x001E100C, 0x00203A38,
+0x00203A54, 0x00203A58, 0x00203A5C, 0x00203A60,
+0x00203A64, 0x00203A68, 0x4F222FE6, 0xD6707FFC,
+0x88016060, 0xE2018951, 0x2620BFBB, 0xD56ED16D,
+0xDE6E6010, 0x64E36552, 0x7402C840, 0x8D22D16C,
+0xD26C7502, 0xE601D76C, 0xE7042722, 0x76016255,
+0x626C2421, 0x8FF93273, 0xD4637402, 0x6242E601,
+0x640D8528, 0x67494419, 0x275D657E, 0x81E4607C,
+0xE417D562, 0x67557601, 0x3243626C, 0x8FF92171,
+0xA0207102, 0xD25E0009, 0xE601D75B, 0xE7042722,
+0x76016255, 0x626C2421, 0x8FF93273, 0xD4527402,
+0x6242E601, 0x640D8528, 0x67494419, 0x275D657E,
+0x81E4607C, 0xE417D553, 0x67557601, 0x3243626C,
+0x8FF92171, 0x92897102, 0xD2462E21, 0x5E23D74E,
+0x64F22FE2, 0x604365F2, 0x2700C980, 0xC9606043,
+0x80716103, 0xC9036043, 0x80724519, 0x65F2605C,
+0x817266F2, 0x46194629, 0x606C4529, 0x4018645C,
+0x8173304C, 0x21185E23, 0x64F22FE2, 0x6E4C62F2,
+0x602C4219, 0x66F262F2, 0x46294018, 0x461930EC,
+0x42298174, 0x652C606C, 0x305C4018, 0x81758F07,
+0x0009BC97, 0x2228620C, 0xA00A8908, 0x60130009,
+0x8B038840, 0x0009B009, 0x0009A003, 0xE202D62F,
+0x7F042622, 0x000B4F26, 0x4F226EF6, 0x8552D52A,
+0x8830600D, 0x88318903, 0xA0348923, 0x85550009,
+0xD428D727, 0x85532701, 0x610DD627, 0x24124118,
+0x460BD426, 0xD7230009, 0xD226D425, 0x6572420B,
+0xE230D120, 0x42286712, 0x2729E620, 0x37604628,
+0xD6218B03, 0xA016E200, 0xD61F2622, 0xA012E202,
+0xD1182622, 0x6212E530, 0xE6204528, 0x46282259,
+0x89083260, 0xD41AD119, 0xE601D513, 0x2160450B,
+0x472BD718, 0x4F264F26, 0x0009000B, 0x0000060A,
+0x00203A6C, 0x001E1000, 0x00203A58, 0x00203E20,
+0x00203E2C, 0x00203DC4, 0x00203A40, 0x00203DF4,
+0x00203DF2, 0x00203DC6, 0x00203A24, 0x00203A50,
+0x00203A3C, 0x00203A38, 0x002018C0, 0x00203B48,
+0x00203B4C, 0x002018D0, 0x00203A54, 0x001E100B,
+0x00203B60, 0x00114004, 0x4F222FE6, 0x84E9DE86,
+0x2448640C, 0xB17B8901, 0xD2840009, 0x26686620,
+0x60E08902, 0x2E00C9BF, 0x000B4F26, 0x000B6EF6,
+0x2FE60009, 0xDE7E4F22, 0x60E0D67E, 0xCBC0D47E,
+0x62602E00, 0xC803602C, 0x40218904, 0x70014021,
+0x6603A002, 0x66034009, 0xD678616D, 0xE500A004,
+0x75016262, 0x74042422, 0x3213625D, 0xD2748BF8,
+0x0009420B, 0xC9BF84E2, 0x4F2680E2, 0x6EF6000B,
+0x2FE62FD6, 0x7FFC4F22, 0x6260D66E, 0x89402228,
+0xD565E100, 0x60502610, 0xCB40D46B, 0x2500440B,
+0x8D052008, 0x62E06E03, 0x7104612C, 0x2F11A006,
+0xD466D65E, 0xDD666760, 0x657C4D0B, 0xE23C6D1D,
+0x8B033D27, 0xD264D463, 0x0009420B, 0x4D214D21,
+0xA005D762, 0x66E6E400, 0x357C4508, 0x74012562,
+0x35D3654D, 0xD75E8BF7, 0x6E72E003, 0x81E14018,
+0x6E7260F1, 0x81E2700C, 0xD45A6172, 0xDD5A8113,
+0x65724D0B, 0xD64AD259, 0x2212E101, 0xC93F6060,
+0x7F042600, 0x6EF64F26, 0x6DF6000B, 0x2FC62FB6,
+0x2FE62FD6, 0xD2524F22, 0x6B436E73, 0x420B6C53,
+0x20086D63, 0x64038D1C, 0xE50ED13C, 0x32526210,
+0x60C38916, 0x804124B0, 0x814160D3, 0xA007E500,
+0x655D61BC, 0x00EC6053, 0x364C6653, 0x80647501,
+0x3213625D, 0xD6308BF5, 0xC9BF6060, 0x2600A008,
+0xD239D440, 0x6EF64F26, 0x6CF66DF6, 0x6BF6422B,
+0x6EF64F26, 0x6CF66DF6, 0x6BF6000B, 0x2F962F86,
+0x2FB62FA6, 0x2FD62FC6, 0x4F222FE6, 0xE1007FC4,
+0x6513ECFF, 0x6B136CCD, 0xDE34D733, 0xEDFF64F3,
+0xD833EA04, 0x6053655C, 0x027D4000, 0x32C0622D,
+0x66038D0D, 0x09ED6063, 0x2491027D, 0x24217402,
+0x698202ED, 0x3928622D, 0x74022892, 0x75017104,
+0x6063625C, 0x07D532A2, 0x0EB58FE4, 0x2448641C,
+0xE6808905, 0x67F3E5C5, 0xBF8F666C, 0x7F3C655C,
+0x6EF64F26, 0x6CF66DF6, 0x6AF66BF6, 0x000B69F6,
+0xD11C68F6, 0x6012D21C, 0xCB20E405, 0x2102E500,
+0x000B2242, 0x00002252, 0x001E1017, 0x00203996,
+0x001E1015, 0x001E10BF, 0x00117800, 0x001E10FC,
+0x00200644, 0x0020399C, 0x00202A56, 0x00203B64,
+0x002018D0, 0x00203B80, 0x002018C0, 0x0011788C,
+0x00203998, 0x0020357C, 0x00201534, 0x001E2130,
+0x00202A18, 0x00203B88, 0x002039FC, 0x00203A04,
+0x00203DC0, 0x001C3500, 0x001D4004, 0xD564D163,
+0xE400D764, 0x2142E20F, 0x17411154, 0xD5622722,
+0x9669D762, 0x15412572, 0x96661562, 0xE6011565,
+0xD55F1165, 0x666CE6F8, 0x25422542, 0x25422542,
+0x25422542, 0x25622542, 0x7601E727, 0x67632572,
+0x25627797, 0xE7042572, 0x2572E248, 0xE2192522,
+0xE2702522, 0x25422542, 0x25422542, 0x25222542,
+0x2522E20C, 0x25422542, 0x25422542, 0x25422542,
+0x25422542, 0x000B154A, 0xE2081145, 0x0009422B,
+0x2FE62FD6, 0x7FFC4F22, 0xC8206043, 0x6E438D02,
+0x0009BE85, 0xC81060E3, 0xBE828901, 0x60E30009,
+0x8901C840, 0x0009BEA4, 0xC80160E3, 0xDD3D8938,
+0xC80260D0, 0x2F008D03, 0x460BD63B, 0x60F00009,
+0x8902C804, 0x460BD639, 0x62F00009, 0xC8806023,
+0x60D08902, 0x2D00C97F, 0xC8016023, 0xD6348906,
+0x0009460B, 0x0009A007, 0x51630601, 0x8902C808,
+0x460BD630, 0x60F00009, 0x8902C810, 0x420BD22E,
+0xD52E0009, 0x88026052, 0xD22D8B03, 0xA005E604,
+0x88012260, 0xD22A8B02, 0x2260E601, 0x2522E200,
+0xC88060E3, 0xD227892D, 0x60E36E20, 0x8902C880,
+0x420BD225, 0x60E30009, 0x8902C840, 0x420BD223,
+0x60E30009, 0x8902C802, 0x420BD221, 0x60E30009,
+0x890DC804, 0xDD20D11F, 0x0009410B, 0x0009BF11,
+0x0009BF4C, 0xD51ED41D, 0x2470E708, 0x25D2BF85,
+0xC80860E3, 0xD21B8905, 0x4F267F04, 0x422B6EF6,
+0x7F046DF6, 0x6EF64F26, 0x6DF6000B, 0x001C581C,
+0xA000A000, 0x001D0100, 0x001D4000, 0x00040021,
+0x001C589C, 0x001E1021, 0x00201A46, 0x00201A68,
+0x002020C8, 0x00201A80, 0x00201A8E, 0x00203A50,
+0x001E100B, 0x001E1028, 0x00201AFA, 0x00201B06,
+0x00201A96, 0x00201AB4, 0x12345678, 0x001E1000,
+0x0010F100, 0x00201AE2, 0x644CD6A7, 0x000B346C,
+0xD6A62450, 0x346C644C, 0x2450000B, 0x644CD6A4,
+0x000B346C, 0x625C2450, 0x4208616D, 0x42084119,
+0x42006019, 0x670E614C, 0xD49E321C, 0x4200207D,
+0x324CC90F, 0x2200000B, 0x4208625C, 0x42004208,
+0x324C644C, 0x4200D498, 0x000B324C, 0x2FE62260,
+0x614C4F12, 0x4100D493, 0x6710314C, 0xE29F666D,
+0x27294619, 0x6E536269, 0x672E6573, 0x4221227D,
+0x42214221, 0x7601662C, 0xE4014608, 0x34E84608,
+0x644C4600, 0x071A0467, 0x2150257B, 0x000B4F16,
+0x4F226EF6, 0xD2857FE8, 0x88016021, 0xD2848B7B,
+0x26686621, 0xD2838B77, 0x26686621, 0xE50F8B73,
+0xE401BFA2, 0xBFA4E501, 0xE586E400, 0xE400655C,
+0x2F50BFA4, 0xBFA1E401, 0xE602E506, 0x60634618,
+0x81F2E401, 0x6543BF9F, 0xE40185F2, 0xBFAB6543,
+0x85F26603, 0x6543E401, 0x6603BFB1, 0xE40265F0,
+0x6053756C, 0x80F8BF80, 0xBF82E402, 0x84F8E512,
+0x7090E402, 0x6503BF82, 0x4618E602, 0x81F66063,
+0xBF80E402, 0x85F6E500, 0x6603E402, 0xE500BF8C,
+0xE40285F6, 0xBF926603, 0xE5FEE500, 0xE010655C,
+0xBF61E403, 0xE5130F54, 0xE40EBF63, 0x05FCE010,
+0xBF63E40E, 0xE5007585, 0xBF64E403, 0xE500E640,
+0xBF71E403, 0xE500E640, 0xBF78E403, 0xE5FFE640,
+0xE014655C, 0xBF47E404, 0xE40F0F54, 0xE504BF49,
+0x05FCE014, 0xBF49E40F, 0xE5017584, 0xBF4AE640,
+0xE501E404, 0xBF57E640, 0xE501E404, 0xE404E640,
+0xAF5C7F18, 0x7F184F26, 0x000B4F26, 0x4F220009,
+0xD2427FF0, 0x88016021, 0xD2418B71, 0x26686621,
+0xD2408B6D, 0x26686621, 0xE50F8B69, 0xE401BF1C,
+0xBF1EE501, 0xE586E400, 0xE400655C, 0x2F50BF1E,
+0xBF1BE401, 0xE401E506, 0xBF1C6543, 0xE401E640,
+0xBF296543, 0xE401E640, 0xBF306543, 0x65F0E640,
+0x756CE402, 0xBEFF6053, 0xE40280F4, 0xE512BF01,
+0xE40284F4, 0xBF017090, 0xE6406503, 0xBF02E402,
+0xE640E500, 0xBF0FE402, 0xE640E500, 0xBF16E402,
+0xE5FEE500, 0x6053655C, 0xBEE5E403, 0xE51380F8,
+0xE40EBEE7, 0xE40E84F8, 0xBEE77085, 0xE5006503,
+0xBEE8E640, 0xE500E403, 0xBEF5E640, 0xE500E403,
+0xBEFCE640, 0xE5FFE403, 0x6053655C, 0xBECBE404,
+0xE40F80FC, 0xE504BECD, 0xE40F84FC, 0xBECD7083,
+0xE5016503, 0xBECEE640, 0xE501E404, 0xBEDBE640,
+0xE501E404, 0xE404E640, 0xAEE07F10, 0x7F104F26,
+0x000B4F26, 0x00000009, 0x001E102F, 0x001E1080,
+0x001E1090, 0x001E103F, 0x001E103E, 0x00203A4A,
+0x00203A4C, 0x00203A4E, 0xD21DD11C, 0x66206010,
+0x676C7001, 0x3700C90F, 0xE5008D13, 0x67106210,
+0x7701622C, 0x64232170, 0xD6166010, 0x44084408,
+0x3428C90F, 0x62602100, 0x7201D513, 0x44082620,
+0x000B354C, 0xD10F6053, 0x25586510, 0xE6008D13,
+0xD60DD40B, 0x655C6540, 0x47086753, 0x37584708,
+0x47086540, 0x24507501, 0x367C6040, 0x2400C90F,
+0x72FF6210, 0x000B2120, 0x00006063, 0x00203995,
+0x00203994, 0x00203996, 0x002035BC, 0x7FFC4F22,
+0xE680D1A8, 0x666C6212, 0xD2A72F22, 0x67F36563,
+0x420B7542, 0x7F04E404, 0x000B4F26, 0xE6800009,
+0xD2A1666C, 0xE7006563, 0x422B7540, 0xE6806473,
+0xD29D666C, 0xE7006563, 0x422B7543, 0x2F866473,
+0x2FA62F96, 0x2FC62FB6, 0x2FE62FD6, 0x7FC04F22,
+0xDB97D296, 0x72012F22, 0xD1961F21, 0x66125211,
+0x8B013620, 0x0009A0F9, 0xC9036061, 0x8B018801,
+0x0009A0F3, 0xD290DC8F, 0x64C3420B, 0x6503D18F,
+0x60111F02, 0x8B048801, 0x420BD28D, 0xAFE464C3,
+0x54530009, 0x844CEE84, 0x890130E0, 0x0009A0C3,
+0x6610D188, 0x6023626C, 0x8B718801, 0x6210D186,
+0x89662228, 0xDA86D285, 0xE0036122, 0x64221112,
+0x4018D881, 0xDD83E500, 0x814167A3, 0x77042850,
+0x647266A2, 0x6ED3D580, 0x1F457E04, 0x65521F56,
+0x64E368D2, 0x1F8874F8, 0x684369E2, 0x1F637894,
+0x1F991F74, 0x62826142, 0xD779D978, 0x1F2BD679,
+0x67726292, 0x1F1A6062, 0x2602CB20, 0xD176E600,
+0xE5401F57, 0x1F7D1F2C, 0x76011F1E, 0x3253626D,
+0x51F38BFB, 0x52F555F4, 0x25222A12, 0x55F757F6,
+0x27525AF8, 0x5DF92DA2, 0x2ED251FB, 0xD56B5EFA,
+0x54FC24E2, 0x281257FD, 0xD160D869, 0x25722942,
+0x69126782, 0x1974D866, 0xDD666A12, 0x56FE60A1,
+0x2A01CB01, 0xDA646412, 0xE9012842, 0x4A0B2D42,
+0x52FE2692, 0xD661EE01, 0x22E24E18, 0x72016262,
+0x60B22622, 0xCB01D14F, 0x2B02E202, 0x2120A03F,
+0x8B3C2228, 0xE601D55A, 0x2160E700, 0xE01C2572,
+0xC801004C, 0xD8578B0C, 0x1F8FD257, 0xE6002822,
+0x7601E57D, 0x3253626C, 0x56FF8BFB, 0x2622D253,
+0xE2FE69B2, 0x2B922929, 0x0A4CE01E, 0xE01F65F2,
+0x014C25A0, 0x741057F1, 0xEA062710, 0xDD4CE600,
+0x8446DE4C, 0x2D007601, 0x696C6844, 0x2E8039A3,
+0x8FF67E01, 0xDE487D01, 0x2EA0EA94, 0xE1007E01,
+0x7E0F2E10, 0xD12FE205, 0x64102E20, 0x6023624C,
+0x89088801, 0x55F2D22A, 0x64C3420B, 0xEE01D132,
+0xAF1A4E18, 0x55F221E2, 0x8553D13C, 0x620D6612,
+0x89063262, 0xD63BD43A, 0xE801460B, 0xAF0CD73A,
+0xD91F2782, 0x64C3490B, 0xEE01D127, 0xDA38D437,
+0x4A0B4E18, 0xAF0021E2, 0x7F400009, 0x6EF64F26,
+0x6CF66DF6, 0x6AF66BF6, 0x000B69F6, 0x4F2268F6,
+0x85467FF4, 0x2F01E681, 0x666C8547, 0x854881F1,
+0x81F2D209, 0x67F38542, 0x854381F3, 0x81F4E40C,
+0x65636053, 0x420B81F5, 0x7F0C7540, 0x000B4F26,
+0x00000009, 0x001C3D9C, 0x002023FC, 0x0011779A,
+0x001C36F8, 0x002035B4, 0x002014A6, 0x00203A16,
+0x002014D0, 0x002039A5, 0x002039A4, 0x002039A0,
+0x001C3B9C, 0x001C3704, 0x001C3D98, 0x001C3BB4,
+0x001C5960, 0x001C3500, 0x001C3D30, 0x001C8960,
+0x0020358C, 0x001C3D00, 0x00201610, 0x00117730,
+0x002039A8, 0x001C582C, 0x2000A000, 0x0000A000,
+0x0011778C, 0x00117792, 0x00117788, 0x0020397C,
+0x0020357C, 0x00201534, 0x001E2130, 0x00203DA0,
+0x002018C0, 0x2F962F86, 0x2FB62FA6, 0x2FD62FC6,
+0x4F222FE6, 0xD19B7FEC, 0x2F12E000, 0x6103D49A,
+0x1F4281F2, 0xDD9ADA99, 0xD69A6813, 0xE0014808,
+0x460BDE99, 0x38EC4800, 0x65A21F03, 0x352052A1,
+0xA23E8B01, 0x60510009, 0x8801C903, 0xA2388B01,
+0x52530009, 0x32E0DE91, 0xD9918B10, 0x64A3490B,
+0x4B0BDB90, 0xDE906403, 0xD791D690, 0xEC01D591,
+0x2E02E100, 0x271026C0, 0x2502AFDF, 0xC8018551,
+0xA1578B01, 0x62510009, 0x4200622D, 0x5E53366A,
+0x85E2226D, 0xC903642C, 0x85E36603, 0x6053650D,
+0x40214021, 0x4500C93F, 0x322A6703, 0x6053252D,
+0xC901D17F, 0x60106C03, 0x8801D97F, 0xDB7F8B05,
+0x2120E200, 0xCB0160B2, 0xD17D2B02, 0x88016011,
+0x65A28B0A, 0x8D042448, 0x9B9E6251, 0xA00322B9,
+0x919B2521, 0x2521221B, 0x37B3EB10, 0x2448895E,
+0xD4738B07, 0x22286241, 0x60638903, 0xA05781F8,
+0xD5706473, 0x46084608, 0x85E26273, 0x46006B50,
+0x362C4200, 0x2BB8C910, 0x8F1F6463, 0x26686603,
+0xD2698911, 0x062D6043, 0x4119616D, 0x6B0E6019,
+0x81F820BD, 0x880160C3, 0x646C8F2C, 0x880F6073,
+0xA0278B1B, 0xD2610009, 0x052D6043, 0x4119615D,
+0x670E6019, 0x645C207D, 0x81F8A01C, 0x890F2668,
+0x6043D25B, 0x6B5D052D, 0x60B94B19, 0x201D610E,
+0x60C381F8, 0x8F0D8801, 0x6473645C, 0xEC00A00A,
+0x6043D254, 0x625D052D, 0x60294219, 0x207D670E,
+0x81F8645C, 0x880285F8, 0x85E1890A, 0x8D07C820,
+0xE6DC6203, 0x60232269, 0x81E1A002, 0x644CE4FF,
+0x6210D149, 0x89012228, 0x644CE4FF, 0x654DEBFF,
+0x35B06BBC, 0xDB368B2B, 0x64A34B0B, 0x410BD135,
+0x54036403, 0x85446E03, 0xC948DB40, 0xDC408808,
+0xBEAC8B01, 0x64B3E502, 0x65E34C0B, 0xDB3DEC01,
+0xD13D2DC2, 0x621260B2, 0x72017001, 0x21228805,
+0x2B028F08, 0x666CE680, 0x6563D238, 0x7549E700,
+0x6473420B, 0xA030D436, 0x7FFF0009, 0x85E28000,
+0x20B9EBFC, 0x610381E2, 0x942A85E3, 0x62032049,
+0x450885F8, 0x81E2201B, 0xC90160C3, 0x40084018,
+0x40084008, 0x4000225B, 0x6023220B, 0x85E481E3,
+0x4118E108, 0x81E4201B, 0xE40262A2, 0x20B98521,
+0x67A28121, 0xCB016071, 0x85F82701, 0x89033042,
+0xECE785E2, 0x81E220C9, 0x490BD41E, 0xA03B0009,
+0x7E030009, 0x001C3D30, 0x00203DAC, 0x0020358C,
+0x001E212C, 0x00203470, 0x001C3D00, 0x00117780,
+0x002014A6, 0x00201670, 0x0011770C, 0x002039A4,
+0x002039A5, 0x002039A0, 0x002018C0, 0x001C36F8,
+0x00203A1A, 0x00203DBC, 0x00203BA0, 0x00203C20,
+0x00203CA0, 0x00203D20, 0x00203990, 0x00203584,
+0x002014D0, 0x00203A1C, 0x00203A20, 0x002023FC,
+0x00203DA4, 0x00203DA8, 0x602262F2, 0x40094019,
+0xC90F4009, 0x8B0B880A, 0x60E2DE8C, 0x40094019,
+0xC90F4009, 0x8B038808, 0xCB0160A2, 0x2802A006,
+0x65E2DE87, 0x2E527501, 0x286266A2, 0x52F366F2,
+0x2622AE83, 0xD2838551, 0xDE83C802, 0xA0958B01,
+0x420B0009, 0x4E0B64A3, 0x5E036403, 0x85E46503,
+0x4918E908, 0xD77D209B, 0xE04C81E4, 0xDC7C0B7E,
+0x7B01D97C, 0x61C207B6, 0x71016690, 0x8D062668,
+0xD4792C12, 0x420BD279, 0xA070EB01, 0x62512DB2,
+0x4B18EB0F, 0x22B9E102, 0x32104118, 0x85518B0F,
+0x2029E2FC, 0x60518151, 0xCB0172E0, 0x85E12501,
+0x202994A3, 0x85E481E1, 0xA0522049, 0x675181E4,
+0x4719677D, 0x667E6779, 0x7701276D, 0x6903607C,
+0x88014918, 0x25918F3E, 0x6B12D161, 0x21B27B01,
+0x660D85E3, 0x40216063, 0xC93F4021, 0x6C034600,
+0x262D322A, 0xC8016063, 0xDB5ED15D, 0x967D8901,
+0xE6002C6B, 0x666C67CD, 0x40006063, 0x622D021D,
+0x8D0E3270, 0x60436403, 0xE9FF021D, 0x8B013290,
+0x01C5A007, 0x626C7601, 0x3292E904, 0x646C8BEB,
+0x60434400, 0xD15004BD, 0x0B457401, 0x669D6911,
+0x89073670, 0x602D6211, 0x890388FF, 0xE201DB4B,
+0x2B2021C1, 0xECFC8551, 0x815120C9, 0xCB016051,
+0xDC472501, 0x64A34C0B, 0x51F366F2, 0x85EF2612,
+0x54F2D244, 0x650D420B, 0x0009ADE7, 0xE500DC42,
+0x420B2C52, 0x4E0B64A3, 0x54036403, 0x85446E03,
+0x6703E908, 0x65034918, 0x27998541, 0xDB323790,
+0x8F0BD932, 0x6013610D, 0x8B07C820, 0xC9486053,
+0x8B038808, 0xE501BD4B, 0x0009A005, 0x2128D233,
+0xBD448901, 0x64B3E500, 0x490B65E3, 0xADBCEC01,
+0x85F22DC2, 0x7001EE04, 0x31E7610D, 0x8D0281F2,
+0xADA97A08, 0x7F140009, 0x6EF64F26, 0x6CF66DF6,
+0x6AF66BF6, 0x000B69F6, 0xF7FF68F6, 0x2FE68000,
+0xD2234F22, 0x60E36E22, 0x8D02C840, 0xBBE522E2,
+0xE2400009, 0x2E284218, 0xBBF08901, 0x60E30009,
+0x8905C810, 0xD21CD41B, 0x0009420B, 0x0009BBEF,
+0xC80560E3, 0xBD6D8901, 0x60E30009, 0x8902C802,
+0xABEC4F26, 0x4F266EF6, 0x6EF6000B, 0x001C3D3C,
+0x00117760, 0x002014A6, 0x00201670, 0x0020351C,
+0x00203DC0, 0x00203990, 0x00203584, 0x002014D0,
+0x002039FC, 0x00203A04, 0x002039F8, 0x002039FA,
+0x00201534, 0x002018D0, 0x00203A1C, 0x00008000,
+0x001C3510, 0x00203DB4, 0x002018C0, 0x89014F22,
+0x611B600B, 0x611BB00A, 0x000B4F26, 0x600B600B,
+0x611BA004, 0x8DF12107, 0x8BF84011, 0x620D2F26,
+0x8F3E3020, 0x40180019, 0x8B0B3016, 0x31043104,
+0x31043104, 0x31043104, 0x31043104, 0x412462F6,
+0x601C000B, 0x41296219, 0x20084018, 0x31048926,
+0x31043104, 0x31043104, 0x31043104, 0x31043104,
+0x31043104, 0x31043104, 0x31043104, 0x61193104,
+0x3204221D, 0x32043204, 0x32043204, 0x32043204,
+0x32043204, 0x32043204, 0x32043204, 0x32043204,
+0x212D3204, 0x601962F6, 0x4024000B, 0x000BE000,
+0x621362F6, 0x41294228, 0x31044224, 0x31044224,
+0x31044224, 0x31044224, 0x31044224, 0x31044224,
+0x31044224, 0x31044224, 0x31044224, 0x31044224,
+0x31044224, 0x31044224, 0x31044224, 0x31044224,
+0x31044224, 0x31044224, 0x602D4224, 0x62F6000B,
+0x080A0C0E, 0x00020406, 0x1A1C1E20, 0x12141618,
+0x2E303234, 0x26282A2C, 0x3A3C3E40, 0x6C625648,
+0x41112F26, 0xE2208F18, 0x890B3123, 0x321CD204,
+0xD1026220, 0x412B312C, 0x00090009, 0x0020349A,
+0x00203450, 0x000BE000, 0x400062F6, 0x40004000,
+0x40004000, 0x40004000, 0x62F6000B, 0x40004000,
+0x40004000, 0x40004000, 0x40184000, 0x62F6000B,
+0x40004000, 0x40004000, 0x40004000, 0x40284000,
+0x62F6000B, 0x40004000, 0x40184000, 0x000B4028,
+0xC90F62F6, 0x40054005, 0x40054005, 0x62F6000B,
+0x4005C907, 0x40054005, 0x62F6000B, 0x4005C903,
+0x000B4005, 0xC90162F6, 0x000B4005, 0x000062F6,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x42707372,
+0x3D206675, 0x554E203D, 0x202C4C4C, 0x6E49677A,
+0x4E497274, 0x6D754E51, 0x0000003D, 0x61766E49,
+0x2064696C, 0x72657375, 0x20726F20, 0x2079656B,
+0x00214449, 0x6E6B6E55, 0x206E776F, 0x6D6D6F63,
+0x3D646E61, 0x00000000, 0x203A3051, 0x00000020,
+0x203A3151, 0x00000020, 0x203A3251, 0x00000020,
+0x203A3351, 0x00000020, 0x203A3451, 0x00000020,
+0x2B434741, 0x73696F4E, 0x61432065, 0x7262696C,
+0x6F697461, 0x6166206E, 0x6F206C69, 0x6974206E,
+0x0D0A656D, 0x00000000, 0x00000072, 0x00205220,
+0x62735576, 0x7473725F, 0x00000A0D, 0x62735576,
+0x7375735F, 0x646E6570, 0x00000A0D, 0x62735576,
+0x7365725F, 0x000A0D6D, 0x00000044, 0x44387570,
+0x72637365, 0x6F747069, 0x3D584572, 0x00000000,
+0x00000047, 0x72746E49, 0x6D652051, 0x2C797470,
+0x49677A20, 0x4972746E, 0x754E514E, 0x00003D6D,
+0x654C7245, 0x0000006E, 0x20746F4E, 0x756F6E65,
+0x49206867, 0x4220514E, 0x0A0D6675, 0x00000000,
+0x000000FF, 0x00020001, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x010E010D, 0x00020003, 0x01090108, 0x0002010A,
+0x02000003, 0x02020201, 0x02040203, 0x02060205,
+0x02020200, 0x02040203, 0x020C020B, 0x020E020D,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x000000FF, 0x00020001, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x010E010D, 0x00020003, 0x01090108, 0x0002010A,
+0x00030003, 0x02020201, 0x02040203, 0x02060205,
+0x02020200, 0x02040203, 0x020C020B, 0x020E020D,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x010E010D, 0x00FF010F, 0x01090108, 0x010B010A,
+0x0200010F, 0x02020201, 0x02040203, 0x02060205,
+0x02020200, 0x02040203, 0x020C020B, 0x020E020D,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x010E010D, 0x00FF010F, 0x01090108, 0x010B010A,
+0x010F010F, 0x02020201, 0x02040203, 0x02060205,
+0x02020200, 0x02040203, 0x020C020B, 0x020E020D,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00205220, 0x00000046, 0x00000059, 0x73204142,
+0x003D7165, 0x49544120, 0x0000204D, 0x00000000,
+0x00000000, 0x002E0209, 0x80000101, 0x000409FA,
+0x00FF0400, 0x05070000, 0x02000201, 0x82050700,
+0x00020002, 0x03830507, 0x07010040, 0x40030405,
+0x02090100, 0x0101002E, 0x09FA8000, 0x04000004,
+0x000000FF, 0x02010507, 0x07000040, 0x40028205,
+0x05070000, 0x00400383, 0x04050701, 0x00004002,
+0x00000000, 0x00000000, 0x07090000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, };
+
+const u32_t zcP2FwImageSize=15964;
diff --git a/drivers/staging/otus/hal/hpfwbu.c b/drivers/staging/otus/hal/hpfwbu.c
new file mode 100644
index 00000000000..f60f57ed887
--- /dev/null
+++ b/drivers/staging/otus/hal/hpfwbu.c
@@ -0,0 +1,5269 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include "../80211core/cprecomp.h"
+
+const u32_t zcFwBufImage[] = {
+0x3A4BCF18, 0xF44C076E, 0xF59452EA, 0x451BA755,
+0x140AC87A, 0xC07EE942, 0x3EF978AB, 0xF5B03DC6,
+0xB70080F0, 0xA89064EA, 0x54E2C1D6, 0xEB047DF4,
+0x1798390C, 0x00350624, 0x35B3ECF0, 0x59F2FABF,
+0xAF9D248E, 0xF9BDB9F0, 0xD05C8B47, 0xC08B5A16,
+0x990093C7, 0xD335A160, 0x1C04942C, 0xBF6E7A88,
+0xFD232B0F, 0x5C224387, 0xBF1E156C, 0xF24F2A27,
+0xFF56421D, 0xB213037C, 0x2BA67BA0, 0x4950CF8A,
+0x05F00F25, 0xA5E82085, 0x74168A0C, 0x2F2AB30B,
+0xC80C57EE, 0xB6BDF570, 0x89BC5A99, 0x7F3B5A67,
+0xF6C943B8, 0x0C9C9201, 0xE8383747, 0x0C9A72D6,
+0xE0520704, 0xA66D7F30, 0xE444A434, 0xE0C94AB7,
+0x8DD7751C, 0x1A659464, 0x6C9ABA4F, 0x792F2D2D,
+0x5936F66B, 0x061E580E, 0x59903F6C, 0x1FBFB8A0,
+0xCC822EFE, 0x4B030CAF, 0xB62457C9, 0x27E9BF15,
+0xB113A487, 0xFA0FC915, 0x447B184A, 0x5330CD51,
+0x00BCC622, 0xF30DE149, 0xFF718E1C, 0x7B5D2861,
+0xDBCA573E, 0xFB0D7BF9, 0xE1CFBAAC, 0xF99D4583,
+0x4BA7498A, 0x7CAEA7EB, 0xBA958E32, 0x36C530FF,
+0x8F88CA99, 0xF93CABC2, 0x8E47EF11, 0xFB0EED6F,
+0x5B3668A1, 0x9D63ADDE, 0xA0EEAB8C, 0x084915F1,
+0xFACAAA27, 0x209638FE, 0x1CED9EFF, 0xEEBD2335,
+0x38C6F424, 0x2D1F3D7E, 0x976E8106, 0xBE087AD2,
+0x32194845, 0x756066DB, 0xC70E3165, 0xC568DCB1,
+0x3212E4E1, 0xB5D991AD, 0x07C3CEF8, 0xDB4ABB38,
+0x1574C232, 0xF8C792BC, 0x14E62DBE, 0x5A48E7DC,
+0xEFDC5407, 0xC45B4017, 0x3B814E89, 0xF0936466,
+0x89491B2B, 0x9A359A41, 0x82287675, 0xA0F338D3,
+0x523FDD3C, 0x4E40B795, 0x458ADAA4, 0xED812957,
+0x7ADC73BC, 0x6FD7DB78, 0x2740FC04, 0x6392AEA3,
+0x185ABCEA, 0x6B50ABC3, 0x3681F07F, 0xC840F8CE,
+0x5733E7EC, 0x0805FA71, 0x0B34530A, 0x8CB3D033,
+0x81451551, 0x53B0B4EC, 0x908646D0, 0x10A3E642,
+0xF358DC34, 0xC1FA570C, 0x2B1284B0, 0x592322BB,
+0x9D587783, 0xE7D77988, 0xE1BE5D7B, 0x44B93E23,
+0xF8BE94A2, 0x506DC723, 0x6E0A7D09, 0x3FB1046F,
+0xDB3A166F, 0x9CB7D6A0, 0xE278DE6D, 0x88459334,
+0xB52BA3C9, 0x284740A2, 0x04D30792, 0x944D79CA,
+0x1D050EA9, 0xA404DB1B, 0x99526023, 0xBACE24E7,
+0xB9F20704, 0x284E6432, 0x47A593D1, 0x95F8DFCB,
+0x220C9167, 0x8FAABBBC, 0x93D34E8C, 0xCE077138,
+0x4FC18081, 0xE76DD7E5, 0x67465F6C, 0x7A479D77,
+0x74D61F82, 0x00559214, 0x2F66E42E, 0x8742A96B,
+0x62063950, 0xA2DBFAE5, 0x368B966F, 0xAB5FCCE1,
+0xCB4023B1, 0x1E7AF542, 0x05953E30, 0x8CA51CFC,
+0x2216547D, 0x29D562D4, 0xE9C9F8EE, 0xA90505C9,
+0x088D0EEB, 0xD7A290FA, 0x95E5B567, 0x53FAD3C0,
+0xB89FC625, 0x69A7519B, 0x3687C7EF, 0x7188CB55,
+0xCE5DB97E, 0xA260574A, 0xD453D173, 0x145D970B,
+0x12112CC6, 0x399839E0, 0x29C55BEB, 0xE467C71F,
+0x10B3C9D4, 0x8F1C9662, 0xF207A826, 0xE0245600,
+0x688B1812, 0x5A483031, 0x7048380A, 0x78E3D5BB,
+0x1951533D, 0x8FA5D8E3, 0xC5BE500D, 0x71DB5B2B,
+0xA17AA000, 0x408C9BE8, 0x161E12F5, 0xB1C38C45,
+0x22A88F05, 0xDE3F4405, 0x5078ADBB, 0xCE1BF1A6,
+0xB7A75B04, 0x6B8364E8, 0x0CE32E3E, 0x9BF65504,
+0x28C18157, 0x78359AC6, 0x617BF202, 0x1E76FA09,
+0x0F8E61A8, 0x6D02F0D5, 0x80356459, 0x79CEFAE7,
+0x7D00F155, 0x5C1C0128, 0xC75CA073, 0x32816090,
+0x9FF78DFC, 0x848D269C, 0xF811B314, 0xA86920FC,
+0x6F885D01, 0xACFE6525, 0xC726074D, 0xFED68599,
+0xF1D5C76A, 0x8799E5F5, 0xF85F5171, 0xD8DE2D3B,
+0xE7DD8E75, 0x43F8614A, 0x0684FC8D, 0x9683B8C8,
+0x74BE786B, 0x2514762D, 0x7D866682, 0xE711FE1F,
+0x0DE9E273, 0x12F53167, 0x4FA3A7FE, 0x2A00EB61,
+0xB3984A28, 0x4319F2B0, 0x42BA0CA2, 0x848771B6,
+0x995E945E, 0xD41115F5, 0x43D9834B, 0x54EEDC36,
+0x5C3C5407, 0x671B540E, 0xDCF18948, 0x150ED973,
+0x2D4922DE, 0xF93CA17D, 0xB24A76E5, 0xD1C01C22,
+0xF2963DD6, 0x3B860066, 0x08EF0EA4, 0x609B60CC,
+0xE2E901FA, 0x25BE9B93, 0xDF96D9BC, 0x86D415DF,
+0x75CCF6BB, 0x882D54B2, 0x7976E9AF, 0x88A0B178,
+0x5ADE5A55, 0x8A8C0112, 0xD896755A, 0xCB6789B3,
+0x8B63AE2F, 0x2545036C, 0xE4655B94, 0x20959977,
+0x29DFB4D1, 0xCDAAEBF4, 0x1C07EC05, 0x5A6F607D,
+0x88A9B31D, 0x118C74D2, 0x000BB065, 0x75C46712,
+0xEF1A58BD, 0x50ECA262, 0xCCE393B9, 0x6EDB92E8,
+0x700EF517, 0xBF6CF4AD, 0x57456DC0, 0xF629517C,
+0x40331F8B, 0xC10A454D, 0x6CCB02CF, 0x9BF11B1C,
+0xE0871437, 0x23623585, 0xF519F09C, 0x4DB2AFC8,
+0x88FCBD7B, 0xB512FE8D, 0xDE445894, 0x078AD03C,
+0x44375FB0, 0x0BABEDB1, 0x40D5E8E1, 0x13F20A86,
+0xF1406303, 0x7205C322, 0x3FC43779, 0x7A60D510,
+0x14469E04, 0xF4E77873, 0x2EAD7ECE, 0xA135D6EA,
+0x3F4C4B30, 0x21488077, 0x69F64F1C, 0xEEF4876E,
+0x63610C0B, 0xB7B24C5C, 0x324A76FE, 0x0CF651D3,
+0x9460F0B1, 0x81A83230, 0x0839CFF9, 0x70722F04,
+0xC278FB3B, 0x5DD1BDA4, 0x1E4B3DBA, 0xAE161A93,
+0x9E1033C3, 0xD938FCEC, 0xDA2B2F93, 0x28CD82EA,
+0x14AD1FAF, 0xE4EC9CB8, 0xE770AFDF, 0xEFB12898,
+0x500BE181, 0x602625C5, 0xF160631B, 0x78D3643F,
+0x4E13ED37, 0x647BB223, 0xCF18D75C, 0xF477F94C,
+0x786ECB89, 0xB3ED21F8, 0x1BEF3916, 0x240FB35A,
+0x5C69B7D9, 0x8E96290A, 0xD40DC98C, 0xD1370291,
+0x5870021E, 0x3F7CF23F, 0xFD4A6ADA, 0x36482457,
+0x926600AF, 0xDC8618BC, 0x67D3779F, 0x3422830C,
+0x87A41FBA, 0xCA0AFF53, 0x63BC45F3, 0x520BBBAE,
+0xEDE2E031, 0xB6FA9450, 0x258CA712, 0xD709C4E4,
+0x617709B2, 0xAACE0B41, 0x363DBF55, 0x701D6583,
+0x39F3C885, 0x7CD6297B, 0x078FE13B, 0xA398DABF,
+0xDB97C514, 0x039102E3, 0x5CA545AF, 0x9298BA18,
+0xD18DAF86, 0x3D70EEA2, 0x5266AD68, 0xB04945B5,
+0x402DDA5B, 0x01DC6CD1, 0x93AC5053, 0x08DF9EA9,
+0x485EBE97, 0xA5D05853, 0x6CBEE910, 0xD485F4E2,
+0x8F201D07, 0xEFC384A3, 0x7272AFBE, 0xC0B41FD7,
+0x8E54A971, 0xA7F9E0F7, 0xC21700B4, 0xC24A4ED0,
+0x5419EACF, 0xBC2D8FB1, 0x2C5B5AFF, 0x0345274C,
+0xC41DF47A, 0x37658AFF, 0x24CF3BE7, 0xA3086248,
+0xF82B5928, 0xB49A9B04, 0xD4105AEF, 0x444EBE8D,
+0x348368DF, 0xDC77A7A0, 0x68D37E0D, 0xD2EB54EE,
+0xDDAC8C33, 0xE5C93C79, 0xE4706ABF, 0x17536EFD,
+0x6C2B2B16, 0x038AA806, 0xDAD42458, 0xAE1D76A1,
+0xCC8DE95C, 0x1BA20647, 0x0521068C, 0x306FBE44,
+0x4E29D881, 0xD2A14D53, 0xA155853E, 0x44500CC4,
+0xFC4466B7, 0x5AACD51D, 0x506D3A73, 0x3F61E0FE,
+0x58F11F9D, 0xC92A2CAD, 0xD9A4F86B, 0x1FA747B1,
+0x77DEC5D2, 0xDFAB369A, 0xD471EA01, 0x724502DA,
+0x618CE21A, 0x52388BEB, 0x2E8A4CC5, 0x58332211,
+0x3FCC46E1, 0x501210E2, 0xE9D51D1A, 0x37237B55,
+0x8CE3E2F1, 0x6B2E98CC, 0xB56A11E5, 0x8819036B,
+0xA6AA2F27, 0xB0124A0E, 0x92F17364, 0xD4A89238,
+0x0507E337, 0x8ED95DEC, 0x9C014BA8, 0xBA5B11C6,
+0x9C15D38C, 0x52596C98, 0x9330DD3D, 0xD6147570,
+0x21701F1B, 0x5A2385F1, 0xE2F38C6C, 0xB3E94698,
+0x2F9C63FA, 0x7E0234D8, 0x4CDD3288, 0xE1969B5F,
+0x853B3C1D, 0xF61465A7, 0xF281C419, 0x46C5F072,
+0x9F1722DD, 0x64F2A994, 0x86AEE8A8, 0x55895E17,
+0x6047D1AC, 0x3375A934, 0x336BEACA, 0x90791174,
+0x4DACC4D2, 0x24253860, 0x2A7876FB, 0x9DBDF98D,
+0xD5BCE182, 0x67EB5F70, 0xCC06BA38, 0xE8F78715,
+0xFEB0EB44, 0xE9776E03, 0x892A0898, 0x7A070650,
+0x6D04DDC4, 0x99A5B7EA, 0x3B416BB6, 0xDADCE834,
+0xB3B03278, 0xDB73B70E, 0xB0F0224E, 0x538A4AF9,
+0xD25D6A37, 0x8F627FB0, 0x11ED9387, 0xB8C88457,
+0x0CF320CA, 0xA20E62A2, 0x1DACDD4A, 0xAB84575D,
+0x740DAF75, 0xAB9DB955, 0xFF787314, 0xA680B8E3,
+0xC976D38E, 0x1FD38F4D, 0x0AEB6633, 0xB69A03DF,
+0xB6CA8610, 0x106354C2, 0xC37D48C8, 0x3E5EED54,
+0x534CC9BA, 0xE37DFFAD, 0x9F69EB05, 0xF67217EE,
+0x50180B3D, 0xCC61C127, 0xC3598D73, 0xE5C00F01,
+0xFFE9B111, 0x5E23EA2F, 0xF6C45DCE, 0x44585E39,
+0xB02C6004, 0x37233902, 0x4F374C0D, 0x34288898,
+0xE274937D, 0xC81D472C, 0x17A43151, 0x2638F7D3,
+0x5304E5B5, 0xD5CE5EDE, 0x357FA7B3, 0xFBE27986,
+0x64E65D1F, 0xC28D1237, 0xA73D9AB3, 0x124CA6C8,
+0x770D7415, 0x5788C32C, 0x18DEFC00, 0xB3B2B06A,
+0x55CC86A0, 0x8D929309, 0x84AB381A, 0x9DEFE8DD,
+0x26C742C8, 0x952BAC34, 0x0A3B140F, 0x82A9304B,
+0x52CEC9F4, 0x47DF4D08, 0x15A116D8, 0x7B890B18,
+0xC87BEF1A, 0xB59601B6, 0xD37BFB28, 0x5D9F564D,
+0xFB002F8D, 0xE7602E57, 0xE429C852, 0x9C0A8C75,
+0xE02611DC, 0x8A1C9861, 0x7495D6DE, 0xCA059710,
+0xAE5969B8, 0xE5B2CBDC, 0xA49F6EC1, 0x85D2A553,
+0xE4719B0F, 0x40F68BBC, 0x092E24B5, 0x7B132678,
+0xD70C17E1, 0x309E6AA1, 0xE009657F, 0xA7238C7A,
+0xE0575D78, 0x1D6980E7, 0xEFCDD368, 0x19F08D93,
+0xFAC03B85, 0x51BADA8F, 0x037DF839, 0x8F4D29F4,
+0x1DC8A913, 0x50C55402, 0xDEE578F0, 0x2BA1C091,
+0x9ACA567E, 0xA8FFECFA, 0xA3C05D12, 0xF18C6283,
+0xEAAE6662, 0xB4DC6A79, 0xCEC5E782, 0x93A2E384,
+0x8F8A5E6F, 0xCA8379D5, 0x81BCD49E, 0x5FCE174B,
+0xD1543A5B, 0x845D635F, 0xD53125B9, 0x3B2121AE,
+0xF8ECDD01, 0xF84D2D11, 0x6579BC21, 0x5C2DC220,
+0x9EC1A688, 0x1148D831, 0x6C087799, 0x58944357,
+0x56F79FC6, 0x6B689B55, 0x740B5FD1, 0x9F7BFB5F,
+0x6B2F3E2D, 0x10E09273, 0x2E9E3213, 0xF3436AA0,
+0x14A9F681, 0x9087D3CE, 0x68D0430B, 0x9FAFE3EF,
+0xD45B8C61, 0xB982724A, 0x04448D7F, 0x8712E47A,
+0x2C188D15, 0x9C3F06CC, 0x6343B130, 0x56C6765C,
+0xF657BC9A, 0x15F1E973, 0x47E71181, 0x8639F5D7,
+0xC1F3FDD5, 0xDC522441, 0x56BB2908, 0xAA48AEC6,
+0xEC04087A, 0x8D375875, 0xE2941F88, 0xED31CC72,
+0x09BD8794, 0x4C81D5C1, 0x1CC96D9C, 0x98A89022,
+0xAA362C57, 0x924D583D, 0x270430E6, 0x0FD4040A,
+0xAF561155, 0x38DCD1CF, 0xE861D2AC, 0x24A2EF3C,
+0x2B7E3868, 0x13DA6C12, 0x69202EB6, 0x4A5FEC66,
+0x185417A9, 0x3C92EFF4, 0x949842E6, 0x02115D93,
+0xAD1726FF, 0x4E093D7D, 0xC3E41B9C, 0x27BBC1C1,
+0x4FFA49C7, 0x6C63D24C, 0x84255444, 0x282C3BA2,
+0x3D679D86, 0x03B410B1, 0x64DB454C, 0x535499D4,
+0x25B421A1, 0x7E68C8FE, 0x0477E3B9, 0xCEFB087D,
+0x9E59B89C, 0xBB787559, 0x1A550EE4, 0x078B48AB,
+0x73A865FE, 0xD7227471, 0x3A864049, 0xE5EE3A1D,
+0x201BC19D, 0xEB8DAE2C, 0x0E2AB31D, 0xCDAC2D79,
+0xDAAB08B1, 0x63ECD4F2, 0xC00F9716, 0xD415C6BB,
+0x8C20C39F, 0xDED8F5A2, 0x1D6A4190, 0x3D319167,
+0x56B3A26B, 0x0547BF52, 0xA056924F, 0x4DAA539A,
+0x557241D1, 0x42C9124E, 0x18723323, 0x6AD6E7EC,
+0x8E039337, 0xF6FDDD65, 0x5F3525F9, 0xC0AD9704,
+0x810EF049, 0xCE022EE0, 0x41CE7E52, 0x8E172A44,
+0x648808E2, 0xC7FF6896, 0x2AD0985C, 0x304B9631,
+0xD21EA39B, 0x279F5089, 0xCDB5C390, 0x21716A40,
+0x5E34B278, 0x39475D72, 0xBA4F4DB1, 0x8B25818F,
+0xE6E466F4, 0xC4A09DF8, 0x59F18AC7, 0x887AB5FE,
+0xEEA4BA42, 0x17371DA8, 0xA82193D1, 0x6DC30EF7,
+0xDEB9D349, 0x2B3271D4, 0x1FE83836, 0xEC755A29,
+0x05F07FCD, 0xC331D3AE, 0xC6208B76, 0x497FF280,
+0x4C579C5A, 0x22B71F94, 0x30FD620B, 0x31B71AE3,
+0xDF7D1A41, 0xF041ACA5, 0x9533261B, 0x3262D291,
+0x060E9672, 0x7D191A55, 0x6D0F0945, 0xF8C7777C,
+0x1C173808, 0x78308E77, 0xC1EEAD3B, 0x059CCD9D,
+0xA8FDBE19, 0xE47630FA, 0x88A49DE5, 0x03347DAB,
+0x4F31F969, 0xF9C62B12, 0x93AB126F, 0x8A7A3BFB,
+0x82591545, 0x2A1A2131, 0x1DEBB134, 0x449E28DD,
+0xFA7E0248, 0xC1E3A5BC, 0x1747E097, 0x4C69AA5C,
+0x1FD71B4B, 0xAC64CA6C, 0x5545F9F9, 0x5E5886F2,
+0x243DBA6C, 0x495BE163, 0x4ECF5A6C, 0x430C9019,
+0x89A980FA, 0x528945AE, 0x00CE6936, 0x9F9A73B2,
+0x9E59DC6B, 0xD57740CD, 0x0E0CB735, 0xB1202BE3,
+0xAA26C2A9, 0x267A77A6, 0x3FA12CF0, 0x4587C0AF,
+0x354ED831, 0xFFD8BD8E, 0x56CC0F26, 0x75717AE3,
+0x51B10674, 0x3E33EC26, 0x26CE80DB, 0x5C4A9140,
+0x017F6C2F, 0xF9038D9A, 0x0A22C29F, 0xBA1F7C8D,
+0x125CC934, 0x6CF66BFF, 0x48C13DCD, 0x63FC3D81,
+0x258C181D, 0x1A4C3DDD, 0x2E24BECC, 0x7C86A9ED,
+0x5BD1989C, 0x57CE595C, 0xDF291AFE, 0xEAF00887,
+0xD8DD4259, 0xDF67331E, 0x50D0CE88, 0x1FD090AE,
+0x632DA5F0, 0x95272A5B, 0x31172F25, 0x547FD7DF,
+0xAFBE11D9, 0x97189DFC, 0xC4881191, 0x1C92365D,
+0x843DEFDE, 0xCF0A399B, 0xCF327CAF, 0xDDAF0BCE,
+0x03AA7A2E, 0x411A8664, 0x6CCF7CD9, 0x61097EF5,
+0x07F3941E, 0x5BC3EB75, 0x2791945F, 0xBEBB526E,
+0x18631A34, 0x25FEBF10, 0x419834CF, 0xF642D176,
+0x372FFF10, 0x2A1BEA1B, 0x400FF345, 0x257A234A,
+0x9F15E99D, 0xE06AA1DB, 0x3A0DB315, 0x2BA30D99,
+0x0E9E831E, 0x1B25EE41, 0x8DB30E70, 0x9FBA6D64,
+0xAB8AA5E3, 0x5A96177A, 0x6BE03535, 0x97E37DCE,
+0xACA24F26, 0x5F0096F7, 0x5D02722F, 0xAF8F3EC7,
+0xA6824151, 0x70FAD406, 0xDEBA8513, 0x99C63E34,
+0x1CC4A3DF, 0x7F756508, 0xB7386527, 0x647C7FB8,
+0x43F1F4DF, 0xC7E4EC18, 0x302BA109, 0xD5E9175B,
+0x82856F77, 0x0F6D45D9, 0x95AE28B9, 0xE63385C3,
+0x8FB26619, 0xBD99F298, 0xC884B948, 0x0B596FF1,
+0xE061C3F9, 0xBC2F9A81, 0xC488CD91, 0x372EF590,
+0x3DA1BFE5, 0x10DE037B, 0x7210B4DC, 0x74E4EFF8,
+0x6365AFD2, 0x8CEABC85, 0x1D8FFD43, 0x4DE243F8,
+0xEC976FD9, 0xAD827765, 0xC679F15D, 0xC125EC31,
+0x95D3481C, 0xC4EA6EAC, 0xC8FC014F, 0x1352EB66,
+0x9C400EB5, 0x227BFAB9, 0xB12BF958, 0x85B6D782,
+0x78B6E44D, 0xE2232EEE, 0x4F101711, 0x9ABEBF69,
+0x66ACC682, 0x04AD5F55, 0xE4FC6238, 0xBA3D2266,
+0xA2BA3170, 0x083F39AB, 0xFF2075C4, 0x945C4B05,
+0x41E8C113, 0xEC7CAD67, 0x3653733E, 0x03510C3B,
+0x1E973158, 0xFBE507F3, 0x2CCD8D9A, 0x6EA9442F,
+0x0D48DE95, 0xC517BFAE, 0x04EBB5C9, 0xEFAB1823,
+0xD5FBFC0A, 0x6890F212, 0xA1C00CCD, 0x6DD561E6,
+0x20D39B1C, 0x56113FBA, 0xCF3A7FD7, 0x3AB5A0DB,
+0x3656572E, 0x7BC48CD3, 0x8902AE36, 0xD3E94AFF,
+0xC06EB447, 0xCC513C0C, 0x2544B7DD, 0x6F168877,
+0x53162607, 0x461DCEF0, 0xF47AF2BB, 0x8AF9F3CC,
+0x1EEFF9E6, 0x57CFB6B6, 0x7F712439, 0xAB20C93D,
+0x043F9003, 0x60C808BC, 0x86C2137C, 0x46ADB474,
+0x848B65F2, 0x5544789B, 0x18E9AEC7, 0xC889913E,
+0xFEB79B2F, 0xA3FBE518, 0x67922463, 0x93746398,
+0x968E160F, 0x8CA856A4, 0xA040202E, 0x660C00C6,
+0x8F0A8E62, 0xE2BA54DE, 0x4BD0C117, 0x1A1A3092,
+0x086CAA3A, 0x2BBA5676, 0x89610176, 0x00ED2F97,
+0xC72130C7, 0x5A053880, 0x7298E553, 0xD67971EA,
+0x0D41E477, 0x2FA8285F, 0xB856A190, 0x132DB916,
+0xCDFFDD11, 0xB5519A81, 0x1BC7001B, 0x97C824DC,
+0xBB4C707F, 0x90166DC2, 0x42DFAB7A, 0x90E33184,
+0x6C6B940C, 0xDC553814, 0xC4F5E7AA, 0x99434AE9,
+0x82BB09D4, 0xCB0A7DA3, 0x3A8033AE, 0x054D3481,
+0xE20AF761, 0x25F5F254, 0x7AD3AF3A, 0x23A34C29,
+0xA19C57BC, 0x39B57AD9, 0x55E1EC59, 0x5ECA4198,
+0xDB908BCD, 0x4871C3F4, 0xE7091328, 0x64A9B6EC,
+0x1CCAB2F3, 0xEDB22423, 0xFFB6A717, 0x6FA13548,
+0x361FF711, 0x24664017, 0xCBBF9970, 0x83A7B7DE,
+0x9B704690, 0x01A0B877, 0x95041B60, 0xC048F3E1,
+0xA31625F2, 0xE3DFBE27, 0xF657295B, 0x1F5C3AF5,
+0x60EE1637, 0x575EDFAC, 0x725844FB, 0x242723D0,
+0x04FA46FC, 0x1A8C3F44, 0x0E03A5FE, 0x8778079F,
+0x606E4E1A, 0x7C0AF3D5, 0x9578B266, 0x63BCE765,
+0xA8ED66D9, 0x9242377A, 0x817A5D5E, 0xD0981A98,
+0xC07F2E7F, 0x0E66F84A, 0x3635F854, 0xD7AD8359,
+0xDCF23230, 0xC1B9084C, 0xA7987FE5, 0xC3B27EB4,
+0x1F747061, 0xFD278601, 0xB6ED3B5A, 0x9CEF8AA0,
+0xA5023C46, 0xB49832AF, 0xB12055FD, 0xD85310E1,
+0x2C19ADE6, 0xEFBB17A8, 0xC246A4C7, 0xBE4B2666,
+0x13C2D7F9, 0x50063BA1, 0x9B00E02D, 0x335B9DF8,
+0xD424AF25, 0xBAE40C92, 0xE87BD6B7, 0x384D1EB1,
+0x8B91E8F4, 0x9E3FC6D5, 0x6BB1A51E, 0x21AE5533,
+0xFCB8E713, 0x188B66B1, 0x6572E9ED, 0x98829178,
+0x7BAE8CBF, 0xE00C32B4, 0xDAFC14D5, 0xEA8FC746,
+0x2C8D712E, 0x89A05FC9, 0x9A274641, 0xAC2450AD,
+0x2437784F, 0x3B1B80F0, 0x0B4A31FD, 0x277C0232,
+0xFDDC6829, 0x3F3C606C, 0x0EF62352, 0x3D07D04A,
+0x4E0939E8, 0xD59BF115, 0xA02752E7, 0x42BF7133,
+0x9FA0939E, 0x64764109, 0xD5D03EBA, 0x3D4433A3,
+0x1749B437, 0x137298B1, 0x677BE344, 0xA83CEF7E,
+0x17813A39, 0xBC71823F, 0x2070E9A7, 0x3873AEF8,
+0x5AF1E21B, 0x1F0CC692, 0xB8EFB04D, 0x1A1CC514,
+0xADED6C3D, 0xDF35A8D7, 0x6D93275E, 0x9C362545,
+0x62BF7583, 0xFC56D990, 0x0CD6A324, 0xF12A7939,
+0x52587029, 0xD00D5F16, 0x51622555, 0x1178E887,
+0x81E7BCC8, 0x92BB1C11, 0x097330E4, 0xCF8C5CAF,
+0xD076D6BC, 0xBA292918, 0xF835A829, 0x4280A51E,
+0x09CD7827, 0x11583487, 0xB8BA2CEF, 0xD598AE93,
+0x99F4FD77, 0xEB151110, 0x1571B076, 0x63F2103A,
+0x56C6BF44, 0x9E63B556, 0xFB981238, 0x5D8C978B,
+0x9501D936, 0x82A1E971, 0xE5A4F7E2, 0xC6E3727A,
+0x03329F07, 0x248ACDD6, 0x437E917B, 0x23B02B20,
+0x73F76AA0, 0x75EA06C5, 0xD7C662B3, 0x267777F8,
+0xDC96BF06, 0x54020346, 0xCBDF069B, 0x030133EC,
+0xA7EF1C2E, 0x568959AB, 0x4FC31DE0, 0x3A22890E,
+0x280F8652, 0x1BD8CB24, 0x9A8D92C9, 0x52718DE1,
+0x12033FC7, 0xD48490CC, 0x681ADEE2, 0xF91BF7B8,
+0xB8609B38, 0x34CF4BCA, 0x8F123290, 0x0D0F4FCD,
+0xC4F43323, 0x2FC04F1C, 0x4669B890, 0x1E8D2A7F,
+0x0658CAE6, 0x5489F3A3, 0x9CD362FE, 0xBA5190B1,
+0x06A58820, 0x7A9AF759, 0xDC94E672, 0xEB284B85,
+0xF8EFA022, 0x3837C379, 0x7C9E9A2A, 0xD2ED96BC,
+0x5D1E4C7E, 0x97F2169F, 0xFC3C37C2, 0xE039EDF1,
+0xDBE93909, 0x81FEAC6B, 0xFCD383FC, 0x170B91FB,
+0x05BA3243, 0x8FB2ADE1, 0x52AFB984, 0xE8262E9A,
+0x1E704638, 0x89B8DFD8, 0x18C0C641, 0x2760C7E6,
+0xD3AFF3C9, 0xC4E3543B, 0x0C0B7910, 0x1DEF7792,
+0x483D7194, 0x9AAF5864, 0x08607947, 0x626F0CF3,
+0xC0F6A486, 0xEB4525CE, 0xA8BBA8F8, 0xE450DA14,
+0x2DC4D114, 0xBCA527C9, 0x6682AA4D, 0xCBB48A5F,
+0x1B474C99, 0x7F5B526C, 0xEC435C0C, 0x9E8D3E1A,
+0x67D2EA29, 0xA3B7ADCD, 0x8328590E, 0x7345607B,
+0xB6057588, 0x1A8B034C, 0x5C8CA534, 0x8115DC5F,
+0x189C2ABE, 0xF1B92927, 0x78A3B62F, 0x4B621D49,
+0xDC176A68, 0xCBD3C1DC, 0xD82348BB, 0xEEF05FA7,
+0xC0DD3D83, 0xC1F2A7BF, 0xB2079D00, 0x14B5730E,
+0x73203CD7, 0xA8672433, 0xA171FFED, 0x9F181200,
+0x4E16A5C8, 0x56D8AC31, 0x73803D86, 0xD4685CA4,
+0xE8DE9FE2, 0xA35D2CE8, 0x808CF3E2, 0x198700AE,
+0x0034163F, 0x57BC76FE, 0x271ACF93, 0xAA3AF6D0,
+0x37003A7E, 0x450B74F4, 0x157401CB, 0xB79DDDA8,
+0xD60AB7A4, 0x3A4C8779, 0xB6990FC8, 0xA1668D5A,
+0x05B7965F, 0x7814376D, 0xFA0D2D8A, 0xD97A1142,
+0xE804DE3D, 0x4939089E, 0x78D40CAC, 0x01DEF5EA,
+0x3DD1CADA, 0x96465956, 0x6358CFB6, 0xACE02DE5,
+0xB4C9F6CE, 0xE9C95AFF, 0x70EAD28E, 0x58803693,
+0x89EF9972, 0x58F0273F, 0xDB17A277, 0x0B082B98,
+0xAAB13ABD, 0xE86381EC, 0xC18924D4, 0xE28D4348,
+0xC21895AB, 0xE17073AD, 0x9417539B, 0xA043E5F5,
+0x88FFD026, 0xD972F017, 0xD0C8B8D3, 0xB34F3D67,
+0xC525E4B5, 0x0189A5A1, 0x59224A35, 0xAA18F2D5,
+0xFC9E170C, 0x16D3795A, 0x35DB09FA, 0x1624DB1D,
+0x4A6E059F, 0xC5C88A93, 0x9051D373, 0x4B12B09C,
+0x4088AF39, 0x705394F6, 0x360F2BAC, 0x8A1F2420,
+0x641D4FA5, 0xA78B78F9, 0xA5A5302E, 0x691D2108,
+0x7CFB57FD, 0x1812FE68, 0x8A2BB5E0, 0xF181CA14,
+0x1846848E, 0xDC044F67, 0x17FCCA28, 0x21D7C5AC,
+0x4C43432F, 0xC457E26E, 0xB0C9ADD2, 0x791EE2B4,
+0x620F27BE, 0x229E0B1E, 0x746B4FFC, 0x02038738,
+0x1C7B971B, 0x05193430, 0x8645DBD7, 0x58678F98,
+0x141E912D, 0xD89C587E, 0x9FD7B43F, 0x21851D56,
+0x725311A7, 0x0605B1B2, 0xC18BF2B7, 0xC6F79EA9,
+0xBD84A01B, 0xC9B7F2DA, 0x04E47EE8, 0x1C1A14F5,
+0xBD5B4FF1, 0xE15FBC2E, 0xC4D43F01, 0x5D39AD4A,
+0xBD3BD983, 0xB2314A4B, 0x8DABA67E, 0xB5263B5A,
+0x9912F262, 0x82659C80, 0xC3610181, 0x3F229014,
+0x2685532F, 0xCE4EC210, 0xF46AB09A, 0xFAFA69C8,
+0xD1292944, 0x2EF880D9, 0xD03AAEAB, 0x0E83C435,
+0x842C482C, 0xA70951A1, 0x0E4EA07D, 0xE0332D0C,
+0x3EA27E55, 0x04721425, 0x7C8B56DC, 0x96391312,
+0xF600D78C, 0xC850517C, 0xB3F9F2AE, 0x59A99351,
+0x8D6AA838, 0xF586672E, 0xD81FE525, 0x3CEF31DF,
+0xABDC7079, 0x6E1BB8F6, 0x6B45B87B, 0x9FD2CAC4,
+0x648E357A, 0x6C57D30B, 0x23766B64, 0x8C8BD9C1,
+0x9A29001A, 0x206F47E3, 0x5F423D75, 0x293A32C4,
+0xDCC6432B, 0xA4280954, 0x457790B8, 0x11E84CEF,
+0xAB11D0BF, 0xD04258E3, 0xFB44C0CE, 0xED8231B2,
+0x0277A6B2, 0xD8E5C517, 0xCEDF4C8B, 0x19D90170,
+0x20555532, 0xFCB610B9, 0x88D5F5A9, 0xD35DC77E,
+0xEF5EA686, 0xD866959C, 0xF0886B56, 0x005CFB90,
+0x582AD255, 0x7381289F, 0xC18CED4D, 0x444F0A6B,
+0x9917AE56, 0x505A7BCD, 0xCBDC903B, 0x51EF0F3C,
+0xC4E6AF5A, 0xB148AD2F, 0x609A124A, 0xB5DA89E4,
+0x3A68C7D4, 0x98694F02, 0xE85B1766, 0x754BA5FF,
+0x1296A58E, 0x27736843, 0x9B6280BD, 0x2686032D,
+0xB428AC04, 0xB06DBA5C, 0x625FE034, 0xD4BCB25E,
+0xC91C5B3C, 0x73BB70E5, 0xA26A479A, 0x73173229,
+0x3AA1235C, 0xE16171D1, 0x42D0D42F, 0xFC624752,
+0xF1F5DCC2, 0x1B6F20A9, 0xFF9D626D, 0xDBF052C0,
+0x90E38D23, 0xFB72CC5E, 0x9186519C, 0xF2330093,
+0xE5251385, 0xA0094977, 0xE83FA066, 0x2E389CE2,
+0xD3A62E72, 0xA9422A8B, 0xC61CFD5B, 0x1B3A516A,
+0x58087800, 0x3A47462C, 0x557DDD8B, 0x94FD21D4,
+0xE1AEA942, 0x4B2CC532, 0xB2185B36, 0xDCA15259,
+0x1D044D7D, 0x781317B8, 0x49CB13E7, 0xDAAFFBC6,
+0x30A05644, 0x77B05F37, 0x065A567C, 0x94721C79,
+0x47316C60, 0x58AAC7C9, 0x410081AB, 0x7D4A36FA,
+0xCDF23455, 0x1873EF87, 0x186982B5, 0x7C78D9DA,
+0x3567D966, 0x10FF5E8E, 0xDB88E5B3, 0xFF1D39A1,
+0xB8A345A3, 0x7A7258F3, 0x9706B3CE, 0xB5ADCC26,
+0x4561EF5B, 0xB002FBF6, 0xF3F4C6FA, 0x57EC75AD,
+0xBCF37924, 0xBC05B0AD, 0x2AB19DAA, 0x0EBD25EA,
+0xF335D08C, 0xDFF79E19, 0xDD86D418, 0xECE11951,
+0xC06F4D50, 0xFD698DF8, 0xBA6192EF, 0x365A28CE,
+0x74DEC0B7, 0xE971F67B, 0xBF89DD42, 0x1E683399,
+0x164A7158, 0xA1E48475, 0xBE139E8E, 0xBDEBA7FE,
+0x74E03AEC, 0x88EA9618, 0x9B0048C2, 0x68C1DD20,
+0x8DC9FC85, 0x24B55E3B, 0x51C38BDA, 0x2ECD7B13,
+0x54D66C89, 0x69A3EBC1, 0x4B4E4F13, 0xAD37B7DF,
+0x030A1D8B, 0x85A114D9, 0x403BE495, 0xB5E40331,
+0x316E7310, 0xB36AA494, 0xDBFFCB9A, 0x5C0E5DA5,
+0x099BA9E8, 0x66826E9D, 0x0BC5849B, 0x1A20CBAB,
+0x0744FBE6, 0x2CB52040, 0x8B88533F, 0xA8A44BF1,
+0x62FEB4A8, 0xDB2ABC4D, 0x46F0B676, 0xCBD06470,
+0xDB6D71EF, 0x5DC3551A, 0x71B31A5B, 0x046D4C7F,
+0xC051A998, 0x1EC19FF9, 0xA9E21F9F, 0x7951E081,
+0x78BCBA62, 0x91B623F2, 0x8EF6A81D, 0x1023755E,
+0xCE47F5AA, 0x0EF27527, 0xE9E488D5, 0xD53E4A29,
+0x78A276E1, 0xB2100585, 0x01208E3C, 0xA38BCAFF,
+0x36221FB7, 0xB3C9194E, 0x51BD75D4, 0x9C8C73AC,
+0x7ACA9964, 0x17890C94, 0x9FDA51F4, 0xC4FDF688,
+0x2C8244B2, 0x0D834C74, 0x290973D3, 0x7F134553,
+0x296D2FC2, 0x4E08ED27, 0x1C51E53D, 0x3D892F49,
+0x945F76CC, 0x2E531E63, 0x71EE37E0, 0x9C47F346,
+0x2D8D920C, 0xC3E465BA, 0x3A72D142, 0x5B6AB80D,
+0x364C2AE7, 0x3B18389B, 0xB9442484, 0x5D687BB5,
+0x97C65A4F, 0xC7DBE8BE, 0x0F840061, 0x5A73EA89,
+0xCBBDD954, 0xAFE9CABD, 0x06ABDF95, 0xF139302D,
+0x3804FEA8, 0x7CE6542F, 0xDE47B8ED, 0xD34BE509,
+0x5EB9C9E1, 0xDC582534, 0xE77D7FC8, 0x2BEFED7E,
+0x4EA26DFD, 0x54670B81, 0x665C4531, 0x5B7A7023,
+0xA05D9A2E, 0x71BDDB2E, 0x9D51D8C2, 0xD8A665CC,
+0xA9B87A22, 0x581D28BF, 0xF9D40373, 0xE04D8F63,
+0x117B9842, 0x8868B9BE, 0x8397FAB9, 0xEF5CED75,
+0xF70F90D8, 0xD3DFD3A6, 0x1779F576, 0x3059520D,
+0xC38F4AA9, 0x6B7A6D0A, 0x4E73112A, 0x4FF9DCED,
+0xAEA1383A, 0xBAB0AA93, 0x41DBCBED, 0x266775A6,
+0x8EE0D5D5, 0xB522CB9E, 0xC6E5D0D3, 0x86E4C8FD,
+0xA894642F, 0xF69821A9, 0x88B41798, 0x4585A188,
+0x9D2130FC, 0xC5B18E0D, 0x6B92C9EE, 0x3C9289FB,
+0x1F02CBB6, 0x31FA86DE, 0x1B2295CD, 0x5B4DA19C,
+0x3134D8FC, 0xE5EABC44, 0xDF8C5095, 0xF6571881,
+0x1F2FBD62, 0xE585FE61, 0x020CEDF6, 0xD70ABC83,
+0x5F37746A, 0x6FDA3BF7, 0x5434E503, 0x44CF6915,
+0x561B2393, 0xEA4A2251, 0xA988C080, 0xE47B1791,
+0xD335CFBE, 0xEDA9DEE2, 0x4F70FB22, 0x83A2C29F,
+0xF44FA002, 0x069D25EC, 0x4D5043F5, 0x887464CA,
+0x661D1E9F, 0x98B856AD, 0x81A23FB0, 0x3693BD42,
+0xCE0AEB0B, 0x1F6E8322, 0xCBDF571B, 0x93688909,
+0xFA16A774, 0x25834437, 0xEE77FA98, 0x8DC68C60,
+0x155A8760, 0x22B8FCA3, 0x1B1BB054, 0xCA3AFFCA,
+0xC8EACEA4, 0xC86BADD9, 0x473770AB, 0x41D6E398,
+0x568B397D, 0x065C0BE5, 0x51D38A0D, 0x3BB3A0E1,
+0xBC386DCB, 0x7DCBA6B0, 0x19007254, 0x3F4FC726,
+0xF27DAE85, 0xF7FDA72A, 0x6D0B5C07, 0x64A0ED12,
+0xE26D8878, 0x210E4F6B, 0x65F92C0D, 0x4E4E2CA6,
+0x5E479D49, 0x7B287050, 0xE9A4836C, 0xC3A111A2,
+0x9B90D6FD, 0xA5F362E0, 0xADC9526B, 0x79B736E9,
+0x72A9A57B, 0x181B4E70, 0x5236F32A, 0x5567E3C9,
+0x23EFD063, 0x87113163, 0xCDF6D4F4, 0xF53A8722,
+0xB70CF941, 0x757F40C8, 0x6A652BE7, 0xD71DA5AA,
+0xF87D51C2, 0xB4A68E16, 0x763D8FEB, 0xB6DE5436,
+0x12184DCD, 0x38D1DE90, 0xB39E5209, 0x1600492A,
+0x073AE8F5, 0x0366AC0E, 0x1AD5014F, 0x398E0873,
+0xD653928E, 0x30B5B4DE, 0xAC68A06E, 0x8DAEF4D3,
+0x76A880D8, 0xF3B3BCC5, 0x2B631F58, 0x340914DB,
+0xB4771DCC, 0x7C9D4A43, 0xAFDB1138, 0x014B5A83,
+0x0D44185D, 0x20C89576, 0x994B4367, 0xA84BD792,
+0xB2E17CB1, 0x00CE5214, 0xFB93E54F, 0x03CCA7F1,
+0x956A82E6, 0x22329A71, 0x2A634374, 0xF18B7AD9,
+0x1F168BC4, 0xC2CB1EDC, 0x8E0AF6CD, 0x211AF22A,
+0xAB5DA374, 0x63F1F25E, 0xEC58D4CC, 0x48C65C46,
+0x5A7F7574, 0x7BA60047, 0x279EF299, 0xE0B77F48,
+0x647A03C3, 0xAE7C4D8F, 0xF65149D0, 0xAC9EF228,
+0xCD90B1CD, 0xCEEDA54C, 0xD8FD0A6A, 0x8D7C2291,
+0xB38EF6C1, 0x7F38E676, 0xDADD0A8F, 0x1125713C,
+0xAA78A299, 0x54033F20, 0x199C76C5, 0xCAF82A17,
+0x16F2EE8B, 0x20071D0F, 0x2CA000F8, 0x0178A24B,
+0x0029EE46, 0xA9D8C738, 0x123D2BBD, 0xEF7CAC52,
+0xBD241869, 0x435F8FF7, 0xB573A190, 0x402BFB2F,
+0xFDA3097C, 0xF3765889, 0x68E2C7D5, 0x4C26F858,
+0xD6814D1F, 0x6B043C7B, 0x173DB091, 0x95126C7C,
+0x0FE8E1BE, 0xFDEB233C, 0xB979B0CB, 0x00E00659,
+0x19952E52, 0xA0976F7E, 0x02FB462C, 0x798815C8,
+0xA2504EFE, 0x0F4811AD, 0xBA8F122E, 0x5EE5864F,
+0xD39B6799, 0x5319F6A3, 0xF6A66685, 0x988D106F,
+0x7ABA5220, 0x0320384B, 0x4DE48C79, 0xF5CB36E6,
+0x2B33270F, 0xFF4E6965, 0xD4D843D5, 0x7EEE861C,
+0xA96AE5EE, 0x310E5215, 0x6D20068E, 0xB149AE8B,
+0x0997D9EF, 0x5043FFFA, 0x0516E2B6, 0x3FCCDA32,
+0x8E604A04, 0x23012778, 0x9444A474, 0xB7F5DC24,
+0x3A58E6FB, 0x17B759FB, 0xF29C1EE7, 0x8893D2D1,
+0xC6CD235B, 0xAAB0CBCE, 0x2D84474C, 0x8A0BE027,
+0xFDB87FB5, 0xE6B507BD, 0x19B41927, 0x783FF4DA,
+0x485A1D5D, 0x8ED285C2, 0x25AFC4C5, 0xBF0D662B,
+0xC4238532, 0x4339FCCF, 0x14A784B6, 0x71665819,
+0xED76E473, 0x5F1BAE9E, 0xD0AEC17B, 0x4CE78814,
+0xD3609F61, 0xD4E49EB0, 0xE4E3EFDA, 0x9B7CAD1D,
+0xEF01ABB7, 0xD137BEE9, 0xEE87A81D, 0xD4B204FF,
+0x00B25737, 0x2770FBD1, 0x174AFF7F, 0x0A77A21C,
+0xF1B370E7, 0x9C093CB0, 0x080C1FFA, 0x83CE92D9,
+0x1707470C, 0x3303479F, 0x25F1B6AF, 0xF40EEB7F,
+0xB98A1677, 0xA54A1BA2, 0x43B4144A, 0x2F092A35,
+0x33286A77, 0xA0AB9C93, 0x4F8D70DC, 0x3A47BF6F,
+0xB6209AB5, 0xA4C94557, 0x5E757055, 0x706EAD9F,
+0x467BC02A, 0x6472A857, 0x42055C57, 0x66F2BA60,
+0x33C0536F, 0x3240BFBD, 0x3DD74E6B, 0x1F58A552,
+0x822E9577, 0xF49BFE77, 0x5490DC6D, 0x1D32BBA0,
+0x1C30B072, 0x78A4A5C0, 0x1EE88A57, 0x97CAC3C8,
+0x9912861F, 0xC916BBAF, 0xFC3A7F0E, 0xCA5E1F3A,
+0x630F09CD, 0xF6C8C210, 0xF0A12A72, 0xF3148619,
+0xDF1672E1, 0xFCE5C390, 0x29CAE554, 0xE984A45C,
+0x8A1F0A3A, 0x6A02C707, 0x8CFB3ED6, 0xC0A741BD,
+0x7A871FE5, 0x91021A69, 0x505FB05A, 0x8F85227B,
+0xC300ACF1, 0x0A1B201B, 0x224614B2, 0x54A23576,
+0x5360A5BA, 0xDCD23A31, 0xF98DF638, 0x79FF79D7,
+0xEAC8EAC3, 0x4D22C65D, 0xDFFBF1D9, 0x55FD8848,
+0x4BFD2347, 0xE2A08287, 0xE6A48824, 0x80625EA9,
+0x71AB3F7E, 0x99B84DE5, 0x6512ADBE, 0xFBF24C47,
+0x3EEF2564, 0x23DF9F1B, 0x24BE5199, 0xDEDD72D5,
+0xA2FE063B, 0x4FE520B1, 0x9E4E7BBE, 0xD615BDBE,
+0xC14E8184, 0x40F86FB1, 0xD403A65A, 0xC5AF6386,
+0x412F8434, 0x6D6012B0, 0x4EC57107, 0x3F76AF19,
+0x54A305BD, 0xEA9C4EB2, 0x584E0176, 0x20759805,
+0x1A16C84A, 0x50BB10DB, 0xE610AF45, 0x98CF1EA0,
+0x3F8C7756, 0xF9056BE0, 0xBAA66B7D, 0xF7076DCF,
+0x67F1994D, 0x92BFEB62, 0x86FBDE17, 0x389DB311,
+0x2A171F5A, 0xE14898B1, 0x4D11723F, 0x29889062,
+0xCBF3DD79, 0x2B7468FC, 0x4FB93770, 0xC5FCEFE8,
+0x8FEE6678, 0x9F4ABA9C, 0x6A6B23E1, 0xFEA7077F,
+0xC835F734, 0xCA67807C, 0x1BFBEB49, 0xB8B1E842,
+0x6A850623, 0x001C1E8D, 0x782AC01E, 0xA28A72D8,
+0x6CD66FC1, 0x77EF6F13, 0xFF40D7CF, 0x4A163DFB,
+0xDB21AA89, 0x29D03A9E, 0x3A4D1D57, 0x7A89CDC9,
+0xC5623E10, 0x8A444799, 0x1F620DF4, 0xFF876758,
+0xC9DEEF2E, 0x7F86911E, 0xE3196093, 0xA00EB422,
+0xCDB1743F, 0x4AAD1988, 0x70167700, 0x70595C5F,
+0x8E648013, 0x401D8770, 0xC762F0E7, 0xDB776926,
+0x2BDC55B3, 0x8F4AD2C1, 0x1A2EEB50, 0xBD4BF2A4,
+0xA43FFE90, 0x752935E7, 0xB02C7801, 0xDD4CD3DB,
+0x3815C394, 0xAF427695, 0x7455A8F9, 0xC444C7EC,
+0x9BC9B2C5, 0x08423BA7, 0x5D91ADD8, 0x59D866DB,
+0x0AD32258, 0x7BC397F6, 0x0EF7DB59, 0xC1034320,
+0x79073406, 0x991A12B9, 0x9D6776A0, 0x6348A5EB,
+0xBD98CDC4, 0x81A6C5C5, 0x76A3ABA6, 0xFA9CDF77,
+0x97772B59, 0xD987E42B, 0xA4B893D4, 0x61F78E38,
+0x82567691, 0xCB91CD58, 0xEEFA69AE, 0xF7D51178,
+0xA436C578, 0x99E86E08, 0xA8C3B16B, 0xD609054F,
+0x1E0ADCE8, 0x5DF6EF20, 0xEB3CC45B, 0x9FAEA24F,
+0x97F57F19, 0x66E2713F, 0x42A423C3, 0x2A21B17C,
+0x6A4C6B40, 0xFA0F4F2B, 0xD1F3F64A, 0xD0AAFA50,
+0x767D3AC2, 0x837E626D, 0x3B21279C, 0xCAE18855,
+0xFA8CA385, 0xA91BDE45, 0x1A953327, 0x733948CC,
+0x158B8CD2, 0x904AC43D, 0xA6BC8F82, 0x55F027DA,
+0x95B6BB32, 0x9265FF80, 0x8EEF0D24, 0x28F6796E,
+0x1D736700, 0xB621D4D6, 0xAB2F1A4A, 0xECD7DB83,
+0x35CAD419, 0x60604917, 0x5DE51335, 0xA3D7E122,
+0x685D04D4, 0x494739D4, 0x0060722C, 0x59149718,
+0x03C9F144, 0x43328818, 0xBB1AE189, 0xCA7B9250,
+0xC835666D, 0x83950220, 0xD774405F, 0xF6F4FCCE,
+0x0E38794D, 0xAF184A7E, 0xEF66E15B, 0xA0C2A74F,
+0x876112D5, 0x7D68C9CF, 0x8902011C, 0x6AB0E128,
+0x2A515520, 0xA99D1DA0, 0x9EACEB4D, 0xB669AA8F,
+0x6F96DCE2, 0xCFEB5CDF, 0x46EB36BD, 0xEDDF8317,
+0x4FA30C3E, 0x9541A8A1, 0xA5F75533, 0xEFE1FEF6,
+0x7F21B481, 0xDA11D5EA, 0x64642069, 0x083D2137,
+0xDF508726, 0x8F6CCC4B, 0xC5412D0A, 0x6A9F6BEA,
+0x3E3CC54F, 0x078BBB1E, 0xA6047468, 0xF1FA39C2,
+0x26143435, 0x90132EB3, 0x4216580C, 0xF6773B8C,
+0xA6B188BF, 0xE3B49523, 0x89E4563F, 0xD0B16538,
+0x2D9079FD, 0x69ABDE36, 0x669AC5EB, 0xD0618DD9,
+0x5080BFEF, 0xADC056D6, 0x72402C9C, 0x0AE79E07,
+0x8D6DF48E, 0x0502837E, 0x79BA17AD, 0xE4871C89,
+0xC4554CD5, 0x23FCB2A4, 0x646FA999, 0x212A9DB8,
+0xBD23DF0A, 0x890B5FE6, 0xB5D03292, 0x9FA3FD59,
+0xD612F8B1, 0x611365FB, 0x7E7C9FAB, 0x024194D2,
+0x46C2C617, 0xAEB0FAD9, 0xAE5D3A7E, 0xEA8B0ABB,
+0x760730A4, 0x50443E76, 0xECA64341, 0x538E5256,
+0x8A8505F5, 0xE0E4DC29, 0x105DC564, 0xC73D93D9,
+0xE3F27C90, 0x8CC01FC8, 0x400D0F76, 0xDCD01130,
+0x1E3416D4, 0x4C612E03, 0x0BFE7A5C, 0xFDB15334,
+0x5326A77F, 0x99549BDA, 0xDDE90BAB, 0x920BD872,
+0xC4B4F5DF, 0x7B39BAC2, 0x777C6694, 0xB4971103,
+0x9E7806A1, 0xD3141F2D, 0x2B40BAD0, 0x74AF248F,
+0xD1AEED43, 0x2F453736, 0x1880104E, 0xF9CD502F,
+0x7691FE59, 0x39C3FEC7, 0x72EA7BF2, 0x0C94BAB5,
+0x35D6F509, 0xAE86AC96, 0x0624C181, 0xA69DF699,
+0x5991FCE3, 0xAB20D4F1, 0xF30F1BC9, 0xB094CF62,
+0xA3B5A732, 0x3BC8C32F, 0xE7710370, 0x429A8D96,
+0xD8913A42, 0xCFBD0E4F, 0x710B7078, 0xC6501E93,
+0x241224AF, 0x978D2320, 0x8EF1064B, 0x273FAE07,
+0x316EC02C, 0xB3C16C0B, 0x8249C245, 0x21AD11CB,
+0x6265FE57, 0xA9F1D5FC, 0x0B52F1CD, 0x0381D983,
+0x2931D6B1, 0xD126CD94, 0x69D95197, 0x7CFB6AD0,
+0x46E6D50D, 0xE60BCBD2, 0x72FBB436, 0xC971A4CA,
+0xA580B9B9, 0xBC823514, 0x5D15A840, 0x87A91622,
+0x63490D13, 0x277189A8, 0x22CA2EDC, 0x1C56456D,
+0x1B5EB836, 0xD8BBF2EB, 0x20F56DFB, 0x99321E4B,
+0x9238B783, 0xE5E5D085, 0xC81DAA11, 0xEF8DD032,
+0xCEC28645, 0xFC40AAA5, 0xBFA5FC68, 0x1C2CF7C7,
+0xC0DFD194, 0x5AB730DA, 0xE3FB56A9, 0xA0AD00E9,
+0xB7BA2E2E, 0x579C8722, 0x04AA07FD, 0xF55C6C5C,
+0xE56CD6DD, 0xA7DA5100, 0x2A6BA1E5, 0x9B7E5104,
+0x81410420, 0xDC6130A8, 0x3EC8935B, 0xCC2EC782,
+0x142344EF, 0xF016E0CA, 0xA3ACFA8E, 0x019A7009,
+0xA0DAEC5D, 0xFA503565, 0xC907794E, 0x77AA4E69,
+0xB45B7E54, 0x929A056A, 0x46AA4AE1, 0x55E56EDF,
+0xFDD9D726, 0x35744D5C, 0xD6854700, 0x9A6E1EEE,
+0x0B00F6FB, 0x6BE65BFB, 0x9CF98DE0, 0xD80ACE66,
+0x1E5300E4, 0x745338DD, 0x4CB925DE, 0xB369B0D4,
+0x7A53A606, 0xD2B96E54, 0x88F96B30, 0xB72C3E19,
+0xC2A41177, 0x6206F879, 0xC1F6CD78, 0x879DA74F,
+0x763F9417, 0xD109B779, 0x6A58B34C, 0xDCD7C21A,
+0x1B0A0154, 0x45EE3A9C, 0x62C60161, 0x79E47020,
+0x42250A39, 0x9E2C2C59, 0xCE4F6206, 0xC2970386,
+0x983CC2C3, 0x0DAF0A85, 0x388626DA, 0x06A56D27,
+0x9223203A, 0x96E0148C, 0x22F0D052, 0xD5F1AA88,
+0x394BC8B9, 0x03CF58FA, 0xC0B1073C, 0xC16B35C7,
+0x7B7CF9F8, 0x2E3A24A5, 0xA19089C9, 0x4223FAE9,
+0x7751D977, 0x802E7062, 0x6D3651EF, 0x39E9B52E,
+0x946D07F8, 0x8E2EAEB7, 0xF9279A65, 0x14DEE911,
+0x8B92A149, 0x9611756E, 0x067DD22D, 0x59907967,
+0xB3417E3C, 0x3B72AB7A, 0x825D87C7, 0xCE5FA852,
+0x5D88C5F8, 0xE792BF66, 0x28DB3A4A, 0x118CA3A2,
+0xCC86284E, 0xA0AC4AE8, 0x33394B70, 0x974F96C2,
+0x86ADD3B5, 0xC87295B9, 0x1447D26F, 0xC9ECAE80,
+0x10CA01D7, 0xE04ECC68, 0xAE56597E, 0xAAA1248C,
+0x81C35460, 0x0087CA93, 0x943AABA2, 0x0AFCBFAA,
+0xEA77D5AB, 0x020D36D6, 0xF1CCBBB6, 0x8DF1426F,
+0xAE726D96, 0xA6E4C915, 0x58F15F91, 0x5B696D6F,
+0x00042B30, 0xC6AC90C3, 0xBD8E0187, 0xE73ED2E2,
+0xCEE64CF6, 0x48B56436, 0xA33994CA, 0xB3E3B7AB,
+0x060D5E14, 0xC1B176C6, 0x4A76C391, 0xD7C8DB1D,
+0x333E4998, 0xC20BAC4F, 0x523BE3E0, 0x237E87BC,
+0xE6CDBEC0, 0xC506F19C, 0x262C0039, 0x7F85A4AC,
+0x46160693, 0x2EA1BC36, 0x4CAC0DF2, 0x0066B83F,
+0xBCBC778D, 0x7F4AB507, 0x99CADB2F, 0xC95520D0,
+0xC5CBF067, 0x903ECD68, 0xF5D7B0FC, 0x08198C8F,
+0xA17879EC, 0x18C2723D, 0x5A4D6D37, 0x080198B6,
+0x3525186C, 0xEF8BE144, 0x44B05851, 0x28B5025A,
+0x0FDF085D, 0xDEB1F249, 0xA7C00F42, 0x7614A735,
+0x3BEBF467, 0x7871D305, 0xD4F63809, 0x9D044079,
+0xE585D3D6, 0xA89952F3, 0xF42C2B8E, 0x04179DA4,
+0x00A6CE87, 0x96CA92B8, 0x9DF2B156, 0x3ECF18BC,
+0xDE2509CF, 0x5CD85FCA, 0xF8A7CEEF, 0xCB7DC25E,
+0xF2847474, 0x35B501D1, 0x137BBB3E, 0x451E1BB9,
+0xD360D811, 0x792B3464, 0x4BF89A81, 0xA7E9C450,
+0x628BCB0C, 0x2AF7037D, 0xA45F628E, 0xF0EC875D,
+0x9CE3677D, 0x2CD0EA59, 0xA50A0217, 0x8BA45DD7,
+0x1735ACF1, 0x5804C4D9, 0xE619B352, 0x948F44A8,
+0xA9BF5C7F, 0x614D4F6C, 0x6D9FCA79, 0x29717B0C,
+0x50BF2D5C, 0xD5847B52, 0x0D4FAAA5, 0x1AABCA5D,
+0x779399E0, 0x58A90CD6, 0x37EC2615, 0x61B68C07,
+0xC49F4AEE, 0xFAC4D897, 0x9C68CC6D, 0xBB3352F6,
+0xF933436D, 0xD310078E, 0x2FBFA17A, 0x3D839C4C,
+0x186E69EF, 0xCBE7CC6A, 0x7434231A, 0x80F8130B,
+0x58CD7EA2, 0x2E46D714, 0x367286E2, 0xA6E2044D,
+0xC2ABC50A, 0x6FEDC9C4, 0xE2F26F03, 0x3B030D52,
+0x3674D8E7, 0x9096DF78, 0x90902892, 0x44A32190,
+0xD08D2649, 0xEFE0ED0A, 0xCE1BF4E9, 0x62C19753,
+0xFBF3D1A8, 0xD4AA5390, 0x4B32E77F, 0x9894F05E,
+0x41B9DBBE, 0xE9B09561, 0x46C883A0, 0xADD5D60F,
+0x69CE5BBE, 0xFD29CCF1, 0x2F209371, 0x4C6716E9,
+0x31E9A09F, 0x04089795, 0xB9EF9025, 0x97C6267D,
+0x63823150, 0x3AB346BA, 0xED3E0579, 0x85FC7062,
+0x37B35761, 0x4A32B6CD, 0xC38EB479, 0x203642CC,
+0x568FCAD7, 0x67D92B5D, 0xE51B8C3E, 0x02104078,
+0x026BC607, 0x5A06CDA7, 0xE27435D0, 0xC7C20CE7,
+0xFEA74022, 0x77310076, 0x35C6F953, 0xE1B199C5,
+0x262F139B, 0xFD2FE2C7, 0x3EEE02EB, 0x915A873F,
+0x2DE4AB8E, 0x2421DC15, 0xD1DD0D9E, 0xDE02B5AD,
+0x151C76CF, 0x798B90B7, 0x82EDDF4C, 0x795E18CF,
+0xF09CEC5A, 0x070ADF8F, 0xCDCF5232, 0xD498D43C,
+0xB4FC2662, 0x25678E54, 0x5D200482, 0xC31F21C9,
+0x35E5AF29, 0x8CC0E603, 0x995351AD, 0xD8EB54F6,
+0x564E35D9, 0x0C13E321, 0x34CFA33D, 0x33D1E5F9,
+0x2EAC9748, 0xFFB950D6, 0x2032206F, 0x4F871AE3,
+0xBD464C61, 0x06356EA0, 0xA15A290D, 0xA78456D0,
+0xD2F4EE88, 0x4D835908, 0x15DC87B3, 0x79EDB6C3,
+0xAEAF0F9E, 0x5C3E7EF9, 0x639A099E, 0xD375D8DA,
+0xB718510B, 0x090DF965, 0x9C8A362E, 0x25AD10BB,
+0xF9A42BE9, 0x8ADE3DF0, 0x5527424E, 0x301F0D0F,
+0x2F691C9A, 0x534FE1FC, 0x7D406016, 0xF98820A2,
+0x4D204871, 0xED145173, 0xD67ECE9A, 0x35F9F990,
+0x8ED4D787, 0x1F3F46E1, 0x5A68F171, 0x9A9D28B0,
+0xE726BD5C, 0x8119228D, 0x0ADBA4D2, 0xEA243204,
+0xE523C0D6, 0x261E3664, 0xB2D1211C, 0xB4D9293A,
+0x9C89D924, 0x15A6A3A9, 0x0D8C6C66, 0xEC04AD36,
+0x0CDF0F98, 0x9262C7DF, 0x8EE0E09B, 0x6B929EE9,
+0xDCC713BC, 0x75FD34FF, 0x2784E694, 0x23C23044,
+0xB7B04F09, 0xF10B753E, 0x2EC774DA, 0x470BE72E,
+0x054510E9, 0x9C7DDF10, 0x1466C277, 0x9F52F493,
+0x7F298608, 0xF1BA10D3, 0x8847A319, 0xEE8A63CA,
+0x8E64B34E, 0xEBB66933, 0x575ADB24, 0x041BFD76,
+0x727ED364, 0x00F4A008, 0x8F5EDA92, 0x21477637,
+0x0B360617, 0x56DC8978, 0x27F88944, 0x69B799EF,
+0xEA1E943B, 0x6FDD60B0, 0xCE2AD89F, 0xB98CCF43,
+0x2A3796BF, 0x4DD02535, 0xC6B524EA, 0x6B173341,
+0xDCE0A457, 0x91770646, 0x57A8D138, 0xFC218331,
+0xDC6B712D, 0x14C0B3B9, 0x30CA09AD, 0x759EB942,
+0xBC9634AB, 0x8F92A7E5, 0xF7F85B53, 0x6C831B3B,
+0x56A75B18, 0x43DB9F1C, 0xF81FC212, 0xB8EB9026,
+0x78A74B51, 0x870655E3, 0xA17B536D, 0xBDE866CF,
+0xFC609F11, 0xF34A7016, 0x7C4FD4DD, 0x236312F6,
+0xB50520A8, 0x4BEEA2C3, 0x2B690BA3, 0x18701667,
+0xBD791FA9, 0x236D36CF, 0x49E576CC, 0x316A77E1,
+0x93E9B0BF, 0x52715603, 0x83B9AAF2, 0x0F8F2A80,
+0xA87F764A, 0xD2079BEB, 0x48A24AB6, 0xAC370950,
+0x3077FB2F, 0x4BAFF3F5, 0x1A79926D, 0x8B369956,
+0xAD78F739, 0xED88CE42, 0xB96A7C15, 0xA7BBA2EE,
+0x47CC3233, 0x804DE962, 0xE0B431A3, 0x4A8257B8,
+0xA4B0E8E2, 0x2FFC49B8, 0xF0CDF5E5, 0xF089C32A,
+0x46328288, 0xEACBC054, 0xA48CB5CC, 0x77996530,
+0x83A4E184, 0x3C2F47D9, 0x5106177C, 0x33F1A787,
+0xA2266E7A, 0xEBC426C8, 0xD7E8ADD3, 0x2DF40477,
+0xF9E8D7BD, 0x80BD8EAB, 0xE61CE55F, 0xF6A7EF6F,
+0x5C67E1C0, 0xFBD0088A, 0x7ED37B24, 0xF5BFD58E,
+0xC29CFB0F, 0x61ECE08B, 0xA776CFD8, 0x9E0F3A05,
+0x8FC8B02F, 0xFDF82702, 0x028C2F2C, 0x169D3094,
+0xE4AA3228, 0xF2CD142D, 0x9C70574E, 0x057BFE78,
+0x782B9039, 0x0D01311F, 0x97552050, 0x6A097F2F,
+0x1B3242B8, 0xF43F32FB, 0x96004287, 0xC3DC0939,
+0x4215A0E1, 0xACD1A28A, 0x189932EC, 0x9BBA0475,
+0xFA154E5B, 0x4B4E8D01, 0x4D6B18B1, 0x31545B3C,
+0xC849C52D, 0x60958B9B, 0xE92CF090, 0xAC3E1B58,
+0x251D02A3, 0xFAEE4F8B, 0xB1CF6CCC, 0xC2A0D8B0,
+0x0501DF46, 0xD0369D94, 0xF3E11479, 0x397599F8,
+0xB90064D2, 0x341F6D57, 0x31F0141A, 0x2F899029,
+0xBC9EF6E8, 0x13B47347, 0xB93D59BB, 0x556E990F,
+0x5727BDFC, 0xBA9F5121, 0xD67BE7CA, 0xB167E84D,
+0x2C0ED0FF, 0x251FFD4A, 0xC98719F2, 0xD379D976,
+0x8B3A0A9B, 0x40BA5F66, 0xE40A93E8, 0x2F89FC04,
+0xFCBAFDD4, 0xF2424270, 0x1BDBDD15, 0x7F1459B0,
+0x5ACB6C6A, 0xFA20719F, 0x2F16FFB4, 0x820DDE50,
+0x468AAC15, 0x7816134C, 0x978D9570, 0x6745CD6D,
+0xC1E768C1, 0x15E243B5, 0xBA30AD61, 0x483FB6FE,
+0xCAA17D0F, 0x2F8F0974, 0x34AB68B4, 0xB3E864B0,
+0xC1DA3828, 0x5DAD43B0, 0x72D13B81, 0x01F274AB,
+0x9C0651AD, 0x0FC30C10, 0x0E7AA3CB, 0xDBE6B9D9,
+0xF423B9A7, 0x457B4E32, 0x40E8E269, 0x91DA042A,
+0x9DBF41E9, 0x308C0F2E, 0xCABFAC0D, 0x0E2C86B2,
+0x117BC3C6, 0xEEA538F8, 0xF31585DF, 0x0DF50281,
+0xEAA9601E, 0x8F408AFA, 0xF1144F9A, 0xA2AB2ECD,
+0xACB88685, 0x6F4EFFBD, 0x81EEF886, 0x46B02240,
+0x3C09D916, 0x4F0DAF68, 0x8337B3E3, 0x9A011BA6,
+0x4C63AC66, 0x2FCC669E, 0x0C7D15BB, 0x51279D9F,
+0xC1354779, 0xEFF940AF, 0xA956CB37, 0x0DB797E2,
+0xE665EE55, 0x79AF879D, 0x21BBC902, 0x30B264BF,
+0x411CDC98, 0xE453389F, 0x47C2C197, 0x3E6015F8,
+0xF9E7AA2B, 0xA9302474, 0x04C6888F, 0x4D118BF9,
+0x0DB7AAC0, 0x52A38EDB, 0x4DAB22F2, 0x7DBB6EAB,
+0xD4D17851, 0xFD944314, 0x40C5838C, 0xBA6EB0EF,
+0x9AA287A5, 0xF6D236F0, 0x41D9E2BA, 0x6968D776,
+0x31B1D129, 0x42C3F963, 0x27CCAD30, 0xCD61BF4E,
+0x2C7DABAB, 0xA78A9CC3, 0x7F856B6F, 0xB6D444A5,
+0x90CBB312, 0x95611781, 0x4916D531, 0xC496C30E,
+0x706D0CB7, 0x35D0064B, 0xFE26C36A, 0x6211F14B,
+0x2C2340BA, 0x58633567, 0x06B6BA8E, 0xA7EC3D8D,
+0x1071B0CD, 0x388EEFA8, 0x60D8FB1C, 0x5F99D147,
+0x52CA6EBF, 0xFA73602E, 0x0376C15C, 0x3C91B57D,
+0x9386AF17, 0x14A35A1A, 0xBDB42A39, 0x0E83C257,
+0xD4C5C775, 0xA607FA46, 0x91B9AD40, 0x7623C5D6,
+0xE3D53E6A, 0xA3C663E7, 0x5AD39BCE, 0x03B58394,
+0x38862C7A, 0x01D50B9F, 0xEAAB38EC, 0xAB3DFB8B,
+0x06795385, 0xB17F485E, 0xE2F57914, 0xB79A3BAA,
+0x13DA7886, 0x7136C7EB, 0x5E748AF7, 0xD34F16FC,
+0x968F6701, 0x99C5D7BE, 0x530F7FAC, 0xCDF5D567,
+0xE31DE0D3, 0xCF93BC68, 0x34C578AA, 0xA201F761,
+0x5CB8DC00, 0xCA24DB98, 0xF8AD7E4F, 0x808EC476,
+0x603BA751, 0x489555C6, 0xF2A03FF0, 0xD2461E9A,
+0x102C33BE, 0x7673933C, 0xC11A2424, 0x6A23C8C6,
+0x69499812, 0x19AA8510, 0xC8CDA75F, 0x34B5216A,
+0xD87F7420, 0xC8CEDB53, 0x8DF11BA2, 0xB10911C6,
+0x3F1E5955, 0xF075F4EB, 0x17874FC5, 0x0D55685B,
+0x5EE521E5, 0x46C72924, 0xF8540210, 0x5D5E4C5C,
+0xE87A133C, 0x91633DC9, 0x36B54D5D, 0xA8B5D440,
+0x7DB7D6C4, 0x5FA82C17, 0xAD679039, 0x86B3B839,
+0xDF5121B7, 0xC08B768A, 0x338A512F, 0xCF9A4F9A,
+0x5DEFBB5B, 0x4C9301B2, 0x08023702, 0x5B1D7E28,
+0xEC800505, 0x3A869E80, 0x4C50C8AE, 0xB1AE9064,
+0xAFFA34EB, 0xF2F006B9, 0xD8A9A3D1, 0x2C6C2134,
+0x677EE648, 0xBB6B6D5C, 0xA285136C, 0x6C47BF4C,
+0xAF158DC1, 0x0EF75E2B, 0x5B9C74D5, 0x9B8D4BE3,
+0xE495BE19, 0x5940B228, 0x55E62656, 0x3247E060,
+0xBF7094CD, 0x1C1AB380, 0xECEA2275, 0xB6DD8251,
+0xCCA39DD2, 0xAB85D992, 0x278197D2, 0xFB6C9FD0,
+0xBD53B458, 0x89EFE0EC, 0x52A3DFFD, 0xA6B7FF7B,
+0xFB043649, 0x93C93F79, 0xAEB4CD6D, 0x71DB5C90,
+0x9E8DFE92, 0x0F1A5B91, 0x55C5CF5D, 0x1A1847AC,
+0x8D25CF6C, 0x914FD316, 0x39FCFE20, 0xD8F66A07,
+0x2CDD3DC6, 0xE415AC72, 0x3D1BD09B, 0xA8322C59,
+0xBD3A826A, 0x2A988A40, 0xEBD8B1DD, 0x9F53EEEF,
+0xDF571816, 0xD4FCCDAE, 0xB85A1E50, 0xBE1A571F,
+0x0ED07534, 0x4C1E471A, 0x8B4D36F6, 0x0E388FC6,
+0x9ED2BC4D, 0x3E2D7F72, 0x752ACA15, 0x8960B48E,
+0x5892B3D7, 0x70F6F3CD, 0x26C485EF, 0xC83839B9,
+0xFE6C224B, 0x3547203F, 0xF73ACA84, 0x065DCDBC,
+0x8986EBDC, 0xCD59EA14, 0xC0EF58A8, 0xC5587229,
+0x484FBCEF, 0x9B8BF24D, 0x351CF946, 0xE10AA973,
+0x17919640, 0x95FF7B1C, 0x82AB65E5, 0x070BCC98,
+0x0E7CDB8D, 0x38DB27DE, 0xCA543C2B, 0x0131EB41,
+0x8300996B, 0x88B63D66, 0x03ADAC1D, 0xB205A87B,
+0xD8BDC0C6, 0x443F6071, 0x2CE69D2A, 0x6E1E5A53,
+0x4EFF93AC, 0x70322657, 0x5CCDD146, 0x04C435B6,
+0x5BF3CD69, 0x51E09115, 0x2545DFB2, 0xA52EF448,
+0x8D387046, 0x7C4F1F25, 0x2EFFD8AA, 0xFD6422B0,
+0xB82E26A7, 0xCF01CC45, 0x88899EBE, 0xDB621966,
+0xBBA1822F, 0xB264AAEB, 0x1076EAA5, 0xC24B0CD5,
+0x54D554B0, 0x4ECA7C05, 0xC8C9B053, 0x70A86D97,
+0x4E3265CA, 0xEA24F810, 0x873B172D, 0x79A74D18,
+0xEC3F49D5, 0xD1799602, 0xA21A28B6, 0x3FB99AD1,
+0xC2DB35B3, 0x63EC2E51, 0x17E4489F, 0xE8E19164,
+0x79ADD819, 0x10D66157, 0x5F621A73, 0x1CD063BA,
+0x6665815F, 0xFA0B7081, 0x6E0FA473, 0x0CE3571E,
+0xB5EAEF46, 0xAA04CF54, 0x336680CA, 0xDABBFF11,
+0x2259E797, 0xB57B4470, 0x111EB4BF, 0xC171D42B,
+0x5889A7A4, 0x419CCB3E, 0xBEA1F366, 0x41FE414B,
+0xA65CB898, 0x6C28363A, 0x8F82FC84, 0xDBED5A9C,
+0x4DBF3526, 0xF2F34E66, 0x9D2C9B11, 0x0C0D4DFB,
+0x4DBF79D4, 0xA256E86D, 0x6407376C, 0x3F3E8AFF,
+0x474B3593, 0xE55965C8, 0xCB20D358, 0x0C671A9B,
+0x169F8342, 0xD2E1C9E7, 0xBDDBAAEB, 0x93DF0C75,
+0xF27707F7, 0x5108305B, 0x4FF2C060, 0xEB9C08DE,
+0xDF11020E, 0xD2271046, 0x6D1BFD27, 0xED020CDC,
+0x2C22659B, 0x692050D9, 0xD14BE291, 0x3EBF8E86,
+0x8344B625, 0x7840B91C, 0xB702BD5F, 0x4935D318,
+0x01A22013, 0xF2A20B08, 0x651A1C38, 0x004FE633,
+0xE51DCC06, 0xF5B86138, 0x9FBFF118, 0x6F7B3CD4,
+0x028938B4, 0x071E96AE, 0xDF33DC9E, 0x79001AC7,
+0x7B5D20FC, 0x3F137794, 0x81165B04, 0x973F8FD4,
+0x0AE4CBF5, 0x7C48180B, 0x4A96BC89, 0x58066E74,
+0x86669DC6, 0xDC55A218, 0x858C3130, 0x99AEAC91,
+0x26983FC4, 0xEE4D4F06, 0xD8D6D657, 0x18EF262B,
+0x374A620F, 0x85995F9C, 0xCC814AC1, 0x39F487E0,
+0xC628177B, 0x2FAE2C39, 0x642525A2, 0xC1474F2D,
+0xBC7CD49E, 0xE81E13F7, 0x83F42BDB, 0x8AB7D99A,
+0xA8040B11, 0xD8AA68EC, 0x983B3739, 0xEE42ECDB,
+0xC9513498, 0xCAA06A14, 0xE4784094, 0xE6BEBB9E,
+0x13BE8018, 0x59E3D5D4, 0x0CF1728F, 0x963413BE,
+0x319533B7, 0x14662ABE, 0x3363B45D, 0x59A99687,
+0xBBB0FDA4, 0xCDBB8B21, 0x0240F3B1, 0x226DAC3B,
+0x30E1C49E, 0x76E076D7, 0x4B91C598, 0xB3C46E2F,
+0x4A657CC7, 0x66C3875A, 0xCBC6FC54, 0xF832EBE8,
+0xDD1EAD3D, 0xFEFDAF85, 0x8DE51B88, 0xAEAFD5D3,
+0x3E4CEA82, 0x55F47934, 0x9F8314CA, 0xD0220BC0,
+0x5ACEF81F, 0x71FDD8E9, 0x13A14ED8, 0x6F1FC1E4,
+0x75046A04, 0xC6C4FDAF, 0x4FFFF724, 0xF44FEDD6,
+0x7E1C5CBC, 0x784C6B4C, 0x8D85F220, 0x38B65C3E,
+0x8C992050, 0x2DE34C13, 0x9F2A4547, 0x48E58F65,
+0xA280B689, 0x6F540D8A, 0x10B61B39, 0x1C8A2849,
+0xA7316358, 0xDBFB7862, 0x182C553D, 0x92F04389,
+0x1FE7BADD, 0x6A724CBA, 0x970BE020, 0x93760058,
+0x2DF9E0AD, 0xCFF1F8B1, 0x170D810A, 0x45F4E6A2,
+0x37A0E8FD, 0x86D11C6D, 0x4F3C6A3A, 0x4B144452,
+0xCE9B87A1, 0x7C08C30D, 0x9CB9B0AB, 0xD55F2CC5,
+0xFF95180F, 0xF35505BD, 0xED5BDB96, 0x85CA2E41,
+0x8708B264, 0xD6079734, 0xCA76AB3D, 0xFD6CDF4F,
+0x9AAB840B, 0x92D3A5F7, 0x93A92C38, 0x0419AA7A,
+0x1D50006E, 0x126F48FF, 0xACDA412C, 0x01139454,
+0x8E23C486, 0x01D44F51, 0x7A5F6F10, 0x377D4D5E,
+0xB784E72F, 0xA9AC925F, 0xB9C66C79, 0x057331E6,
+0xCFF040E4, 0x77E8A960, 0x35E31EEC, 0xEB807A44,
+0x8594FFFC, 0xD27629B7, 0x5DDF526E, 0xBCF2F484,
+0x88805013, 0x41047850, 0xB8574ECD, 0x3E15082F,
+0x309C16DC, 0x297B6904, 0x30C39ECB, 0xD20B61AF,
+0x51A578AF, 0x4E0D24A9, 0xC61FBE5F, 0x7A89F4C6,
+0x9432299D, 0xFE261B95, 0xDD1FC4CA, 0x044BFB92,
+0x41BE56CA, 0x0A2B6831, 0xE135D75D, 0xAB2D00A0,
+0xB4374080, 0xFAA6DBD0, 0xA704C4A9, 0xD81385A4,
+0x51533312, 0xED5EDAF7, 0xE4EDFAEB, 0x74B7DAFE,
+0x9D810AA7, 0x40B91827, 0x65219BCB, 0x75431C16,
+0x94D923D3, 0x00B7AA4E, 0xB8A88FDA, 0x927278D7,
+0x7A237697, 0x45B14097, 0x2E3A562F, 0x93003322,
+0x0B88A5FF, 0xD13D4ADD, 0x6D7B7579, 0x72D834C4,
+0x0BCAA361, 0xC02E00B8, 0x15023551, 0x481C5E93,
+0x02E81A16, 0x8A846A33, 0x1239A971, 0x994818B4,
+0xFC3DBB6D, 0x43C8D2F2, 0xE3AE548C, 0x408032F1,
+0x02B05636, 0xE361A60C, 0xFE2CA292, 0x061D2374,
+0xDB285556, 0x70627EA4, 0x7FC64AF0, 0xFE100B6D,
+0x71AEB3F2, 0xA565A412, 0xA698731F, 0x49DD9767,
+0xC3627EBC, 0x75FB2DBF, 0xFDC0E971, 0xF6ED12A6,
+0xA23DC00F, 0x897E917B, 0x7F2031E0, 0x17DCE568,
+0xDF69CAD3, 0xC6FB5B6D, 0x097268B0, 0xE1102444,
+0x86DF9383, 0xBD7B9CC2, 0xBAAF7DCF, 0x985B45D1,
+0x4218E95A, 0xB2455EF4, 0xDB015F9B, 0x54CCCE76,
+0x56EDF561, 0x6F66F95E, 0xF8B1EBD0, 0xF7A39AE0,
+0xF66D8346, 0xA4677007, 0x02C4B3EB, 0x829987B0,
+0x7C0E1919, 0x51F7060B, 0x4B30F1D6, 0x85A4E0CA,
+0xEC049FA0, 0x17CBF1E4, 0x7A1AAD95, 0xEBA4C513,
+0xE8462E78, 0x54CDDA0C, 0xEE7B8378, 0x9858C8C1,
+0xBA33587C, 0x4D6F1B14, 0x7A2C0525, 0x7E6EE4D2,
+0xACA18692, 0xDD186820, 0x41198B03, 0x8AC85AB7,
+0xBD86900B, 0x36E2C354, 0xE65F9115, 0xB10645DA,
+0x7971D230, 0xC83D3583, 0x8C60C81D, 0x94DB5741,
+0x4FCB8934, 0x9A520FE2, 0xCE49446D, 0x8864E641,
+0xF5EF25A5, 0xC1DEED0A, 0xC8057F37, 0xFB305C73,
+0x392E670D, 0xA4D00D2A, 0x356A46F0, 0x2F675567,
+0xB7997CF0, 0x88AF3A4E, 0x56C9D51E, 0xDD746ECD,
+0x40CFA453, 0x5EA740CD, 0xE4DD6BB1, 0xCCB31429,
+0xA2227F3F, 0x18A1EAF0, 0xC155417B, 0x41FE735F,
+0x16D40B00, 0xC9F72AFC, 0x86B1D62D, 0x6A99A82A,
+0x09D33248, 0xEC44639C, 0x9B0AB2B2, 0x6969164C,
+0xEF602BB1, 0x0208FC6F, 0xC1109578, 0x2997AB87,
+0xE5626B14, 0xCDAF48E1, 0x20781633, 0x2EBE0A41,
+0x7379261E, 0xF216F7A1, 0x714D8258, 0x936FE68F,
+0x160856F9, 0x2A4D1416, 0xB558E412, 0x7DB196DF,
+0xDC88CCB2, 0xF37AB612, 0x7423F214, 0xD3B06A43,
+0x25A8012D, 0xC1C69FFA, 0x936F2C18, 0x56D77C19,
+0x774BFC69, 0xF5E85E24, 0xD79158C9, 0xA67C3E15,
+0xB958819E, 0x69F81278, 0xF2B35107, 0xBF2F4085,
+0x1C997A06, 0x6C238C3B, 0xC756D56E, 0xD15C1149,
+0x351E6EC4, 0x2311303F, 0x0621602C, 0xB11B6DD1,
+0xBE8E50B5, 0x34A5F589, 0xE4D308AE, 0x4344B297,
+0xA33AE98D, 0x0A303CDB, 0x388EA17B, 0x0107B5A5,
+0x38B39042, 0xFE678995, 0xB426FE69, 0x221FCF06,
+0xC45926AB, 0x21A430F9, 0x6D192D2E, 0x4168C10B,
+0x5BA6B132, 0x0519ECA7, 0x21127582, 0xF6C447E0,
+0x0C72FC31, 0x0941B3F0, 0x76F23877, 0x86CF0677,
+0xE7785105, 0xA4637864, 0x94C82B45, 0xF60FD6A0,
+0x46941C27, 0x7A33A698, 0xE1DF8BFB, 0x5249970B,
+0xDFE65E1C, 0xF4A4FB22, 0x599639F4, 0xFE0E9722,
+0x7BB48F58, 0x533465E3, 0x9E884B35, 0x2620429C,
+0x2875FFC1, 0xF11EC0CA, 0x663AF5F0, 0xB2C59C38,
+0x03556ED9, 0x271E9E39, 0x8556E062, 0x08207682,
+0xE5797F00, 0x66A362B5, 0x7ED8394D, 0x2922C374,
+0x271657BE, 0xAC15071B, 0xE296691E, 0x0FE2C740,
+0x19120FB5, 0x9ABD888A, 0xA200762C, 0x7837F41C,
+0xC6F4EA19, 0xF286ABF4, 0xFCA8998F, 0x97B0E7D5,
+0x1339C79F, 0xFED05D43, 0xB3392E71, 0xFC2A01EB,
+0xB720CBED, 0x4FA71358, 0x04A57F62, 0x3D558B0A,
+0x1DEB4D40, 0xC9C823F1, 0x470F630A, 0x08F22975,
+0x2BD85107, 0x3288A628, 0xB0C89675, 0x32D957C1,
+0x80B78426, 0x98A46953, 0xA493AF60, 0xC2B84AC4,
+0x486D658F, 0xFE119FF9, 0xB2FE565F, 0xEADB58CD,
+0x1F45F9B4, 0xCEAE62B6, 0x68EC702D, 0xF52ADDF7,
+0x0FFC0715, 0x4129E42C, 0x956AC4D9, 0x0035CD9C,
+0xF8FEBAA1, 0x29C58397, 0x7C2E2E41, 0x7BE74DAF,
+0x2791D34D, 0xB6D67B0D, 0x8F557528, 0x9DDEED5B,
+0xB3AA4BB7, 0x05E22E43, 0x4CDA600D, 0x432E2D32,
+0x405DA5BD, 0xAF23818C, 0x2F73FE09, 0xD4624626,
+0x653EFCB3, 0x77D65D3F, 0x51A3DCB3, 0x767F407C,
+0xC66452E3, 0x10B6842E, 0x93A0840E, 0xE453AD10,
+0xDE58FC3D, 0x6C227215, 0x1EE130EA, 0xB0BF64BE,
+0xA11E5D38, 0x0131B755, 0x191F70D0, 0xDB483959,
+0xAA8D2F9E, 0x5A002AA0, 0xF5A2996D, 0xFD0F95F9,
+0xD6A12864, 0x3AA48B74, 0x50F6679F, 0x0ADF5C49,
+0xE2F8CE68, 0xBF213E67, 0x5E9ACEEA, 0xCACD0EBE,
+0x6DF766A5, 0x33C0A156, 0x720868EA, 0x3112A0DC,
+0xB382350A, 0x369D9C50, 0xE8F890D0, 0x0A121399,
+0x2AB458EA, 0x51C8233D, 0xBF46403C, 0x0728CD55,
+0x23F6774B, 0x2FB59DB0, 0xFA2CF724, 0xB49FA848,
+0x5FFFA125, 0xDE2C0D15, 0x76B78C41, 0x192BA62C,
+0x4C9563E2, 0x8F742507, 0x882104E0, 0x357AD078,
+0x799E25A2, 0xEF3ED021, 0x69D54B46, 0x5EC57870,
+0x0FF418E0, 0x07C5AC7F, 0xC1ACBF9A, 0x80A830D9,
+0x837C7C5A, 0x04C11D86, 0xC14C8BC7, 0x92BA650B,
+0x94D34FA8, 0xDBDD5EDC, 0x9ED2A08F, 0xA1FAE485,
+0x5FD66C3D, 0x4CCB6F9F, 0xB7AA56B0, 0x0FB3C73A,
+0x03AF96E6, 0xDB2D38F9, 0x7AF20D60, 0xB57CBE90,
+0x20EB2D6E, 0xCF934452, 0x82EC26F6, 0x84B3737A,
+0x0972F1B7, 0x39B6DB4D, 0x13E53CC0, 0x67C41D72,
+0x94BAAC78, 0x663A9C6C, 0x36927448, 0xCFBC2610,
+0x980F53BA, 0x7E56C96A, 0x04C62DFB, 0xA471D579,
+0xDF9B2EE1, 0xE12DEBB7, 0x2DB9B042, 0xF0C74B96,
+0x6A3762E9, 0xF4DC39D9, 0x761A5884, 0xFA363D3B,
+0x92766759, 0xF3EAD441, 0x878269ED, 0x1AFFAFE5,
+0xCB432764, 0xFE19475C, 0xCF8776DA, 0x1F0AD906,
+0x7D99AC20, 0xC27317FB, 0x439944A4, 0x65D14C2D,
+0x43E45262, 0xCDE6B3BD, 0xE25C67CD, 0x321AA2E6,
+0x352A2764, 0x5569EF42, 0x005C370D, 0x290801E0,
+0x61883035, 0x2A2DBC48, 0xE2D559FF, 0x01F5DF13,
+0x69B61558, 0xE94BF364, 0x3CA76FCA, 0x2E016483,
+0xDB675F9C, 0x4FA5B6DC, 0x59A6C3EC, 0x56C6E6CF,
+0x24CD59F5, 0x46911834, 0x683B9E39, 0xB5AF6174,
+0x5C31E269, 0x679C9A12, 0x3787D3E6, 0xF1727EE6,
+0xB070882F, 0xFC37EACA, 0xBEE0783F, 0xF6218369,
+0x19372940, 0x3FF7D890, 0x69736919, 0xDD961CB9,
+0x883010F1, 0x6E472D5B, 0x2447E00D, 0xF39E1F0E,
+0x1DBD442F, 0xBE1977E0, 0xC8655F42, 0x37C84253,
+0x3480DAC4, 0x4CFE1DC8, 0xF1521AD5, 0xA45C4F8C,
+0x87FBAEE0, 0x3E41E9E2, 0xF47771E5, 0x16C74CDF,
+0xA33D4035, 0x38513A10, 0xABF3264D, 0xB8D80DF6,
+0xD9AD7256, 0xF78375B8, 0xD7661CF7, 0x1C363AF9,
+0xD425FA32, 0x001D7B98, 0xDB96A1CC, 0xA092E683,
+0x65CF5316, 0x5F282689, 0x9F52F912, 0x8958A1B7,
+0x6457A3F7, 0xAB43FADD, 0x061328C7, 0x9D31B5E3,
+0x75A77F6D, 0x4A764D4A, 0x488CE83E, 0x29887218,
+0x9A04BDD0, 0xEF331070, 0xBCD2F884, 0x6BF66A6F,
+0xB85143CB, 0xFA529278, 0x9EA3A354, 0x4A73BDAF,
+0x0CBB7563, 0xD01AE35F, 0xD2AC3DAA, 0xFC8243B7,
+0xD805D97B, 0xC162A75F, 0x1D49AC67, 0x9E1BC38C,
+0x1D06AAE8, 0xEAF80CD8, 0xCE825DD4, 0xACA3F06A,
+0x83D092EE, 0x3F2BAABC, 0x2482D120, 0xF301680C,
+0x7DAC373F, 0xF5D6178D, 0xB7E9217F, 0xCCFE8C13,
+0x976024E0, 0xA2F39F8C, 0xB6C65734, 0x10AE514A,
+0x696584CF, 0x2542113C, 0x479CB20F, 0x8D3A22E3,
+0xF7C4B88C, 0xF4F7FBE2, 0x2F553308, 0x9EA71E3A,
+0x7B958F48, 0x0927DAAB, 0xF08949B7, 0x7CD46C0E,
+0x7A892BBC, 0x882F32CE, 0x34C490C8, 0x8483ED04,
+0x07EB4EFC, 0x4BEBCD82, 0x83B15EE8, 0x8F3B78AC,
+0xF95EFDA9, 0x816BEBF9, 0x269BDA58, 0xEE373342,
+0xE09FDA9F, 0xC7651AAB, 0xB8D398B2, 0xC7F449B2,
+0x031310F5, 0xC869706F, 0xDA22F127, 0x8C68DF91,
+0xE676068A, 0xB85AAAC7, 0xD32F35BC, 0xE22DF031,
+0xFE142BD9, 0xD4FB2700, 0x2D197707, 0xA3A43A64,
+0x0C02B050, 0xE945AD56, 0x7DEE0A5D, 0x1075DE3E,
+0xD99AD91C, 0x6A7BB71D, 0x1774B3B8, 0x2228B112,
+0x0DEEE844, 0x38074EBE, 0x6DACF57B, 0x7E0094B7,
+0xCE46F8EC, 0x4DAF34F4, 0x5B961907, 0xC8236FF7,
+0xFD380AA7, 0x61EBA84A, 0xAE4892EB, 0x0F1B6365,
+0xB0C4C9A0, 0x04E6012D, 0xA5F90D01, 0xD6C8882E,
+0xBCB9C1EB, 0x0E5E0FEC, 0x53A46889, 0xA2C0FA51,
+0x520DA459, 0x3FD95FA2, 0x6E1D6FE8, 0xBC093220,
+0xAB16390A, 0x163E3D6D, 0x0A63517C, 0x3BF38F3D,
+0x88A1F66D, 0x96263536, 0x412DF008, 0x12FB126D,
+0x44441D7A, 0x31C9F726, 0xF66F60CF, 0xAE1453D4,
+0xDAEAD71B, 0x54EAEE0F, 0x948B73BB, 0x31EA3E74,
+0x355D4FDC, 0x2A1F3A9E, 0x586D08DF, 0x123AC2E8,
+0xF5AC0065, 0x8874ACAB, 0x05B03D63, 0x01BD6A4C,
+0x7A6A9880, 0x2BC16F93, 0xC4112F0C, 0x8287B40D,
+0x48EABF08, 0x29E56860, 0x0F505C84, 0x447DC08B,
+0x1665119C, 0x00347E37, 0x482EF03E, 0x01B15D44,
+0xE6C1B9FF, 0xB165E436, 0x0CF690F7, 0x7FC5BD01,
+0xB784C7F4, 0x9BE04EBB, 0x9F614431, 0x6C37A5A9,
+0x2D0DB87D, 0xF6511369, 0xE115073A, 0xF96C6AB6,
+0x04A13C3C, 0xBF30B2DA, 0x93D18FC6, 0xF67D2E47,
+0xCA089151, 0x51A6BC39, 0x8C1FCA93, 0xFBF2F2BB,
+0xAD0A3F33, 0x82AA2767, 0x81BF2313, 0x758A82B8,
+0xE103788E, 0xC00C4B5C, 0x5F52FF58, 0xABAD38F7,
+0xDA68EE9A, 0x9B6D405D, 0x803449D9, 0x6178B345,
+0x3C785FB4, 0xFEBABE55, 0x0E2458AB, 0x021F0D71,
+0x39201ED1, 0x741B1A7D, 0xE0B0AFF4, 0x45652CFF,
+0x907DA678, 0x313A93B4, 0x0B0D6B0D, 0x42C96E43,
+0xEEE3E7E1, 0xE83C83E9, 0x9052B867, 0xF9514243,
+0x61F20CB2, 0x57E1AC64, 0xC2443123, 0x432C96D4,
+0x616A824F, 0x3C8D1E06, 0x8E64222A, 0x65C1A21D,
+0x8686308A, 0x2A576A2F, 0x1CA0FF20, 0x2C8F9D3A,
+0xC98C9C69, 0x35322A29, 0xDFD33C93, 0x9634F411,
+0x0B4F8FFC, 0x3AED4B01, 0xEBBC7012, 0xED2387EA,
+0x48BF42AF, 0xD60399D6, 0x7A9B8CA9, 0x53886337,
+0x2DBB9429, 0x0A6AF764, 0xDE4D8F78, 0x1EDECEE4,
+0x4F8EE99E, 0xAF23EAFD, 0x929550B1, 0x2CBD8621,
+0x22A8FAA2, 0xBE2A0A8D, 0x06F7E794, 0x16E1F3EC,
+0x093AAEAA, 0x92D429F8, 0xBB79A7E7, 0x43EF89BB,
+0x0E097511, 0x748E68B0, 0x322C00AC, 0xA62EF42A,
+0xD03BB8BC, 0x9FF67810, 0xDE24BF03, 0x140CA6FD,
+0x68F16B41, 0x1B7C68C7, 0x32646342, 0xC5E714F8,
+0xEFFFD2B8, 0x27843628, 0xF8445F51, 0xB9E8519B,
+0x8EB01D04, 0x356FBF2F, 0x32E96BAD, 0x6A629BDE,
+0x52063313, 0x200069B0, 0xE161CF71, 0x84FB7A12,
+0x1805ADC0, 0x80F75012, 0xFE9E629E, 0x93395C33,
+0xFF075A91, 0xB61E46B8, 0xCA9FE7C8, 0x97DCCBCA,
+0xCEFFB6F8, 0x30EE7985, 0x1FABC829, 0x20B3F57B,
+0x27042B07, 0xE12C5151, 0x23482B8A, 0x7B9B8EB2,
+0xC997FEB3, 0x76AB2497, 0xD5CDA590, 0x9EBE90FD,
+0xE3732B18, 0xFF28CEC9, 0xC6582320, 0x6EF106FA,
+0x8ED74023, 0x1A0B69E5, 0x4A95DD91, 0xB41AF82C,
+0x83DF69D3, 0xC548861C, 0x2F60BA93, 0xFC815984,
+0x1A848B67, 0x1EAE87C4, 0xF7479103, 0x8E16DB51,
+0x040B95B9, 0x2A9DB812, 0x987AFCD1, 0x866DF413,
+0xBF9558ED, 0xACF1AF2F, 0xA65305CC, 0x168336F3,
+0x1E59B97F, 0x3F9F447C, 0x3D54B30D, 0xE939D598,
+0x36A40885, 0x02396794, 0xEB0F0A67, 0xCEAEA12F,
+0xC58B4AC8, 0xE6D49760, 0x0F8F2776, 0x66A8F436,
+0x31BACD7D, 0x376993DE, 0x32BD0431, 0x68BDC728,
+0x63EA6748, 0xE6B00E29, 0x7448CABC, 0x42A6517D,
+0xBB1313C4, 0xA04DC8FF, 0x3D402237, 0xA382645F,
+0x52ED55D6, 0x92D7D7B7, 0x541230FF, 0x7AFC0420,
+0x3DC4624F, 0xD9B2193D, 0xA73B9704, 0xBBDE0FF1,
+0x9EB56615, 0x8AB080B6, 0x3C4D8E14, 0x5001B43D,
+0x1EBFAA23, 0xD4AACD27, 0xCFAAB4BB, 0x6FFEE61F,
+0xAE5A7426, 0xDB942949, 0x452C0B16, 0x738E0637,
+0x36A5122D, 0xFF1F7A4E, 0x743D35CF, 0x847D54A9,
+0x42C3EABA, 0xD46728C5, 0x30B2708D, 0x4F6BE0BC,
+0x3C26790D, 0xB0B67C8A, 0xEE07EFDC, 0x9E380611,
+0xEAD6804C, 0x4EF66024, 0x8459AE38, 0x1DEAAFFB,
+0xF76573AE, 0x6CB1C8F0, 0xFFCC267E, 0x26A215F7,
+0x0B1A057C, 0x7DAB9CB7, 0xD40BCBA9, 0xE561F9FE,
+0xA44013A6, 0x7B22C0B9, 0x998A921F, 0xBD25244B,
+0x15E07FED, 0xF15B2E31, 0x54E80016, 0xA12BCE7F,
+0x658A2093, 0xB642C47B, 0xD731FC00, 0xC00E302D,
+0x55B251DC, 0x342939EB, 0x6EADB2F7, 0x0CF93318,
+0x61EBD85A, 0x99B715EF, 0x679C8D3A, 0x9CC1B803,
+0xABEF955E, 0xB8CFF9D4, 0x707A839F, 0xF5D02A7E,
+0x59E0D903, 0x5A425E3B, 0xBB61163C, 0x96ECE9AA,
+0x797B82AA, 0xA9FA6BB6, 0x797C00DC, 0xC1C1FC4C,
+0x8F7FDA66, 0x77902514, 0x6D1B843D, 0x4F881FA4,
+0xC24AD625, 0xBC237A45, 0x9A2E0F44, 0x82FAA3F3,
+0xD70E3489, 0x4F2B3417, 0x65CF65E4, 0xEAAE6A93,
+0x4BEAEC2C, 0x4918723D, 0x7D8F30B4, 0x7706F59A,
+0xCB2A7452, 0x5083D2D6, 0x4724B426, 0x84EB15DC,
+0xBAA2C6CF, 0x71FA984A, 0xDDF7A3DF, 0xB115BF1A,
+0x258AF0E3, 0xA1637D87, 0x03585DF8, 0x5EA4B80D,
+0x8641F318, 0x66EE2F24, 0xC81E505E, 0x5E640639,
+0xDB7739B8, 0x1A3B861F, 0x0F5ECC51, 0xB21C00DD,
+0x680FF30B, 0xDE697468, 0x57A43B33, 0xD7EF6B3B,
+0x4BFC7D25, 0x710F0752, 0xABAA9752, 0xCFCFD84D,
+0x3BCC1CDC, 0x2381C524, 0xB60CAD92, 0xE05BC1AA,
+0x2B887D88, 0xCD4566C5, 0x0D2976E7, 0xCB000A2C,
+0x667BECF6, 0xEFC7F221, 0x7A7584D1, 0xC41D8B2E,
+0xD9BB7D3F, 0x7CEB5626, 0x7D8165A0, 0xEE178F99,
+0x3E8A8CB7, 0x693D4501, 0xB0E228A5, 0xD55B73C1,
+0xAF9043BF, 0x6C627A2C, 0x7B9F490C, 0x7EA61899,
+0x92B980AF, 0x6D13C758, 0x2C007C73, 0x74336E0D,
+0xA39F13AC, 0x533F05D7, 0x75536CFB, 0x9708DE27,
+0xE2A14E87, 0x36673FEF, 0x71BA654F, 0xB98CD2FC,
+0x27F29A6E, 0x82478171, 0x1C2815F0, 0x8A8F4549,
+0x048A8D9B, 0x7CEE51F2, 0xA1648AC3, 0x004F8B8F,
+0xB6FE8EF0, 0x6D10A0A1, 0xAD7A24D8, 0x75039717,
+0x97847786, 0x2791CC05, 0x6937FD6F, 0x60F98115,
+0x5FAB6D35, 0xC0550A70, 0xC0F4D817, 0x7B5BFDDB,
+0xEF63B4D2, 0x6C87C6C5, 0x956D6B87, 0x69179257,
+0x10973C90, 0x8CDBE860, 0xC7C761EE, 0xF823E34E,
+0x6FA2CF3B, 0xA903ABCB, 0xC82C9B01, 0x60FE96E6,
+0xE5EC33C0, 0x73A3011C, 0x2A1B9054, 0xCF16F92D,
+0x4FAF6CC8, 0xD9DD74FE, 0xB3C639ED, 0x3F47AF63,
+0xC8E99D12, 0x92D95986, 0x835ACA6F, 0xD52930A2,
+0xC7DD54A5, 0x617FDD15, 0xE9A6D295, 0xF56C6087,
+0x7813B662, 0x1F8EA244, 0x1CDE3BAD, 0x58FC0F7B,
+0x02E31A5A, 0xA78EAC74, 0x10C06107, 0x22BA3C63,
+0xF84AD224, 0x6A8BF66C, 0x2A5CAAC5, 0x8ADC3FB5,
+0x9683451A, 0x1B52FCB4, 0x95491BA5, 0xFE6C3713,
+0xE9098CEF, 0x73C01EF9, 0x6E85EF1A, 0xEE189743,
+0x2E9E5286, 0xC1FAA665, 0xD861E384, 0x701C834D,
+0xDC5CA5CC, 0x52A3A6C4, 0xF2AF2C43, 0xC37C6465,
+0x6E94AD69, 0x98808AF4, 0xED8A99F2, 0x377257D3,
+0xE60F2096, 0x615EFCB8, 0x67A2BB3A, 0xB4DDD40F,
+0x1D47F918, 0x86F77D6E, 0xFD05D2B8, 0xE18C330C,
+0xA48260A4, 0x5615B83B, 0xBCD7D855, 0xF8073219,
+0x8622BB89, 0xD35CE05B, 0x17162483, 0x137BDB69,
+0xECD0F226, 0x61F8982A, 0x3C10ABD4, 0x2F33ABF4,
+0x9358B547, 0x58B277A7, 0x92456A7C, 0x4384B49A,
+0x5F1FF0EC, 0xA153EA4D, 0xA8E49100, 0xD3A75723,
+0xD1ADC606, 0x76C314B7, 0xBC6AB227, 0x257312AF,
+0x8B6AA1E3, 0xD87FF5E8, 0x2BAED373, 0xC848AB63,
+0xB72B1E5E, 0x730A73D8, 0x4915E5B6, 0xDF7D77AD,
+0xEAE247D7, 0x9556DDA8, 0xDE0C9C47, 0xA4E3296E,
+0x31F5BC94, 0x05258B24, 0x2837374F, 0xC7E4C81B,
+0x5A1AC819, 0x068074AE, 0xDF876732, 0xC0192EF9,
+0x7FFD84D8, 0xFF1CE148, 0x821B4AA3, 0x56674838,
+0xF9A147F4, 0x182EF58B, 0x16E17174, 0xDE27029E,
+0x8BEC55AD, 0x40646F89, 0xDBFF92FC, 0x9F24C017,
+0x711EAD18, 0xA663E1EF, 0xEF92F684, 0x4BD05E67,
+0x7E089B13, 0xCBF619BE, 0xCEBEF231, 0xC947586C,
+0x0F526C47, 0x6672600F, 0xDAAB63DD, 0x950D4FD0,
+0x199C3EC2, 0x0F201C9D, 0x06BCC8D3, 0xA7672C6D,
+0xB39C7D0C, 0xC74B0805, 0xC9BBD249, 0xACDD5396,
+0xAB7BDF8E, 0x12012B8E, 0x67236047, 0x0AE0741B,
+0x1D747E56, 0x7EC6C00C, 0xD08E8341, 0xB0ABDAD6,
+0x4FA4BDF6, 0x90CE8D0E, 0x6E734117, 0x3EF9192E,
+0xACA32DA2, 0xFDB9C58E, 0x256626B5, 0x5EA961B3,
+0xFBC15776, 0x36602B5F, 0xF8D08644, 0x5B693C23,
+0xC62EA3B1, 0xC664C7C3, 0x73BE8859, 0x17F44E8F,
+0xF9B8D923, 0xD168A3A5, 0x6CCD110C, 0xD353181F,
+0xC0E774EC, 0x5F9E127C, 0x6C824511, 0xFDA13494,
+0xCB588BA6, 0x47148694, 0xAB877E87, 0xE97F757B,
+0xF54D0A2A, 0x0FE11891, 0x5D8747FB, 0xE7800C7E,
+0xEF96298F, 0x400F458A, 0xE2D04518, 0x4B4E6EFC,
+0x9B15002C, 0x3CE1B537, 0xF5ACB9B8, 0x67030647,
+0x475FD148, 0x1E03A40A, 0x896C7C05, 0x85F70B68,
+0xC590CA84, 0x53B5440E, 0x1400F78F, 0x3ABE7F8A,
+0x19CA67FF, 0x68B54A34, 0x555988AC, 0x4AB16B4A,
+0x7511FA63, 0x248EC9EC, 0xC25AFE4F, 0x19F578E1,
+0xE92AF03D, 0xAF9DE18F, 0x2798C7A7, 0x6B46990F,
+0x41D45894, 0x74696A0A, 0xC6AAF5F8, 0x72CC10E0,
+0xDB9CA283, 0xD6BBD0F3, 0x58EA4C06, 0xDEA5E8B9,
+0x1908EBDB, 0x95D33DD5, 0x20D7013C, 0xE725C282,
+0xFD48C92F, 0xDBBA7D19, 0xC7BEBEA9, 0xB186B799,
+0xDD0DD17B, 0xD8090A41, 0xF98BC20B, 0xDD7E4B9D,
+0xEBAE4247, 0x4376FDC4, 0x7F3EFAC6, 0xA9B9A951,
+0x4AE390C4, 0x651863AF, 0x2CD42DBC, 0xC2A13962,
+0xEF0FC443, 0xAEE63246, 0x09B83E19, 0xC3C940AB,
+0x00B12826, 0xC0A30412, 0xFCF6ABCC, 0x3CFE721A,
+0x62C1F4C6, 0xE963A359, 0xAE11F3D6, 0xE490D12A,
+0xC45C928B, 0x05CCA78A, 0x1982E93F, 0x577F81CA,
+0x66D50D6E, 0xB4C7030F, 0x93092C3E, 0x118B08FF,
+0x178545B7, 0xEED74838, 0xF7D2CE48, 0x238969BC,
+0xB8EFAEAE, 0x75726A3B, 0xB1E0220F, 0xC4D60EB6,
+0x0EBC0243, 0x5FE0D6CA, 0x35456B45, 0x1F64AC2A,
+0x58484A1F, 0x2A11455D, 0x33BC4403, 0x56E4E62D,
+0x60B41E2B, 0xDB65D3F8, 0x7EC18D34, 0xF575DC85,
+0x6E0B9995, 0x1C14C91E, 0xB2A94718, 0xAEC4A823,
+0x993D374E, 0xF1E4210B, 0x8CFCC03A, 0x99BD1C28,
+0xA928E3F9, 0xBB957D0E, 0x77C865EF, 0x7FF50A45,
+0x4279A638, 0xE628FFA1, 0xBCCA171E, 0x284C9CEC,
+0xA476E346, 0x7E2F9C08, 0xBF65044F, 0x5B7C3D5B,
+0x6E60EE5D, 0xF5C99509, 0xFA352B7E, 0x6FDE8E8A,
+0xF2340FE1, 0xDF542B6C, 0x510CB30B, 0x367E7016,
+0x198A0A95, 0xA4DF508E, 0x593C2338, 0xB12BCDE1,
+0x554AD3C0, 0x4DDAB1C1, 0xD2BD1850, 0xF6E126CA,
+0xF87289C7, 0x86EC92A5, 0x4E033906, 0x52DC5F3F,
+0xCC6E2E59, 0xFF751753, 0xDF8B8BA2, 0xDBF5954A,
+0xBD367488, 0x6A0CDF1F, 0x4103139C, 0xDE49DBB0,
+0x5A8428F4, 0xA26872B1, 0x96BF7203, 0x99D5E78E,
+0x243850A6, 0x389DAD80, 0x6335D33F, 0xEC67B0A5,
+0x029C0CA9, 0xF5F6F6C9, 0xDF574C15, 0xE6D3EC29,
+0x1AA349BA, 0x453E7258, 0x7DB79BE3, 0x51FCA7F6,
+0x2B42FCA5, 0xBF0E4871, 0x58063C40, 0x193580E2,
+0x25605322, 0xBC49C479, 0x0ED70FC4, 0xA78B59A0,
+0xE6CE3E8C, 0x92EE657A, 0x63D12529, 0xF95DAF45,
+0xF92C3BF3, 0x7D514200, 0x694DF84A, 0xEF177E2D,
+0x4E119CCF, 0xA025C55D, 0xF96974D6, 0x26D13E7F,
+0x799ADC27, 0xD7925EC1, 0x8AE60BF7, 0xF9EF1A2E,
+0x89EADD3A, 0x9C28CACF, 0x63377EB7, 0x6D1EF7E5,
+0x6585B16C, 0x9972D115, 0x65F8F5E6, 0xF93DECB4,
+0x6D71605D, 0xC6FDBCB8, 0xD937BA31, 0xCED727EE,
+0xC34C5605, 0x25FA70B6, 0x5C0B7FB0, 0x8F9340F5,
+0xA3376693, 0x4498B66A, 0x2D21F377, 0xC0A4C6EA,
+0x0780736B, 0xF42D7F07, 0xE56D47E5, 0xB48C25D6,
+0xA48DA0DA, 0xFE69693F, 0xF01E19CA, 0x8A0C5C8F,
+0xDF702C23, 0xE18A93F0, 0xD4D5C91E, 0xD2A706F7,
+0x674F9E28, 0xAF0F80C7, 0x648D49E8, 0x6BE8640F,
+0xF5FCFFD5, 0x8EDC391E, 0xE583D8BC, 0x8426C090,
+0xF456A27D, 0x07249BF4, 0x054A2F45, 0xAC46B73B,
+0xB89EEDFB, 0x48EAF867, 0x69B2D7CC, 0xCA0CA0F1,
+0x38CD0428, 0x029808CF, 0x86EE75DC, 0xF4FEE9F0,
+0x6987D5E9, 0x56AB5537, 0x3DDD0940, 0x4742FF89,
+0x2C3B179E, 0xD05B5CB1, 0x3C4E9033, 0x6BCF0141,
+0xF2F6D3E2, 0xAD297B1F, 0xB1CC23D4, 0x5452038B,
+0x1751FCBE, 0x24AA465F, 0x94C62D18, 0xF49B2EC8,
+0x97AC47DF, 0xD66C19B5, 0x09AAB297, 0x89936144,
+0xD15C026B, 0x4CEC8778, 0x94050D61, 0xD812E96F,
+0xB6BD7B12, 0xA5F9BE77, 0x531A5C7A, 0x3605BA71,
+0xD500CE54, 0xE325964C, 0x323432FE, 0x580A9DC8,
+0xD25A3135, 0x089D6C9C, 0x58856F73, 0x7DFCEE30,
+0x7DE2580F, 0xF4E4488B, 0x71821DDF, 0xD194F5DC,
+0x7D070394, 0xBA28BF76, 0xAAF0A38E, 0xD4F6275E,
+0x1B742E66, 0xD9E68EA9, 0x68B0F939, 0x52AF9D7B,
+0x54A39705, 0x20F844C1, 0xE6981DDC, 0x80322E62,
+0x536235B9, 0x7A57F4FC, 0x14EBF376, 0x64BE2E5A,
+0x70A18910, 0x0FE09587, 0x10E9CA78, 0x8F90D3D2,
+0xAE74717D, 0xA544EAED, 0x6746AF3E, 0x430CB3FC,
+0xBC185576, 0xEAA35DC3, 0xDA6309D2, 0x40643F87,
+0x68859117, 0xA17AC84D, 0xD7922CA8, 0xEF7C0BEF,
+0x83337348, 0x9B4B1790, 0x8876A77E, 0xF293C9C7,
+0x20D399CD, 0xA78224BA, 0xFD1279C8, 0x8B7837C1,
+0x0F1DD415, 0xAE3FBD2E, 0xC4F77B52, 0x51E79FB3,
+0x7A856D9D, 0x14BFDAD7, 0x993FB625, 0x667C65EF,
+0x32F83338, 0xAA06EDCE, 0xACE7A099, 0xD26DAE89,
+0xDC6891CE, 0xCD2F6F04, 0x27425FB8, 0x7C301D8D,
+0x1EDEBE1A, 0xBE540AF8, 0x1D356C6A, 0x963E8639,
+0x9920CA55, 0xDEFE5F44, 0x107D5545, 0x3D079BE4,
+0xEF673F66, 0xDB3C2954, 0xDD76D666, 0x1DFBEF59,
+0x8F384B34, 0xBE6F773C, 0x079DD187, 0x2314AC8B,
+0x5FEB0114, 0x59E85CF3, 0x9BFE9190, 0xB360A31B,
+0x4F7EF967, 0xFEB0D561, 0xBFE779F2, 0xF33702B3,
+0xBB263417, 0x09607C65, 0xA877F109, 0xBB43CFF1,
+0x4A190DB2, 0x9B7BD38F, 0xAEB7C449, 0x3DB3A460,
+0x7D928522, 0xD18AC966, 0x187FE766, 0x97629792,
+0xF59D506E, 0x6FBA202C, 0x77035FF3, 0xDA068CDE,
+0xE195779A, 0xAEB92298, 0xD2A44EDD, 0x12577D85,
+0xA3B47B9E, 0x5BD07CB7, 0x4B6AE3FC, 0xBE35B6E2,
+0x9D7F7AF2, 0x9A38EA75, 0xD87FB055, 0x3339F2A3,
+0xD7CB82B4, 0x357721E4, 0xBEF46553, 0x9DE28CA3,
+0x1B1EC2DF, 0xE29B9CC0, 0xEFAE347E, 0xE5864917,
+0xA097B712, 0x6B67041E, 0x5B29542F, 0x01D96EED,
+0xF9A6DC07, 0xC0B5E3F0, 0x21E1899C, 0xE9373A86,
+0xF3176509, 0x950844A2, 0x7D24FFEB, 0x5DC0BCA0,
+0xC442B7C1, 0x37DC6EC1, 0xC65C8BA5, 0x18F0FA85,
+0x2AD80D2D, 0xC68CDCBB, 0x6AE5EC93, 0xE3955DBD,
+0x3E80C4B3, 0x50FED127, 0x743CABC0, 0xD0E91707,
+0x9BF7EB4B, 0x7A632755, 0x9A192482, 0x8F923E9E,
+0xE2E70FE5, 0x5F50AA16, 0x0EC496D1, 0xC6EC4862,
+0x040A0274, 0x2FC951C2, 0xF65D3A80, 0x8D585163,
+0xC6B529D1, 0xD2CAEE6E, 0xE3E112B7, 0x3244312F,
+0x1B393E58, 0x2444D538, 0xBE69AC21, 0xC92A0506,
+0xD1A74434, 0x49C3EA05, 0x0E53B319, 0x3843CE03,
+0x8DB8415E, 0x766B6FC7, 0x515B9E7A, 0x3BA05B32,
+0xBFAFC449, 0x31302A57, 0x1960A211, 0x66A097E0,
+0xBC65A9B4, 0x89E83065, 0x36FDBF2C, 0xDCD4664A,
+0x0ED6CFBF, 0xDD4DC6DC, 0xD76D2F00, 0xB6DA6540,
+0x9A396444, 0x28F185DE, 0xA0FEFA1D, 0xF476E0ED,
+0xEF15505A, 0x183365BF, 0x481FFD90, 0x29ABEE75,
+0x1EC90B07, 0xC10B2657, 0x0DBF6DDB, 0x52AD02B7,
+0xE87DDB54, 0xD3704106, 0xD4E2C592, 0x0CB2DD05,
+0x4BAA2FFB, 0x02611368, 0xD50F8F1C, 0x416FF25C,
+0x9A69782D, 0x268C6474, 0x2ECD4D64, 0x196DE2F5,
+0x47A8561C, 0x8C7CE6C9, 0xD2B1E2D2, 0xA038C165,
+0x3AB8844B, 0x4A699830, 0x0FFC0B17, 0x89B685AA,
+0xDA276D85, 0xE934C4CD, 0xF511226F, 0x9CDD2B1F,
+0x94F75492, 0x55ECEB42, 0x42F0A3D3, 0xD7EB482C,
+0xA78D0373, 0x62F088A6, 0x7ECF4602, 0x7A3404B6,
+0x40B36495, 0x60441DF4, 0x6722F539, 0xCFE76C48,
+0xB6B94C9F, 0x9ADB4B6A, 0x1EBBA65F, 0x5B5081AF,
+0xB764423C, 0xB6F910E3, 0x14AC4B6F, 0x5C811E82,
+0xAA36E5F1, 0x24EC82AF, 0xA2F1C050, 0x0504324C,
+0x304CED0F, 0x01E31DD9, 0xC82EC7E6, 0xD55AFFF9,
+0xFFB3047B, 0x3006F2E9, 0xC725BCD1, 0x7DCC1082,
+0xA9A22CF8, 0x64D5AF9D, 0x389C34AD, 0x7DFF37C6,
+0x41F1509D, 0x1845B3FE, 0x055C23F0, 0xC6291F5F,
+0xCDD3C7DD, 0x5F0356B4, 0x7FD2C387, 0x494A091E,
+0x50C69D3E, 0xFE769A5A, 0x63904701, 0x8960ABF2,
+0xE68EDF3A, 0x0AB57C8E, 0x0B9D0A6C, 0x51888148,
+0x50C5D533, 0xC69038FA, 0x3ACBE661, 0x0CAEB601,
+0x8C14AB6C, 0xBA86D94F, 0x0724056B, 0x0FEFFCBA,
+0x12449DDB, 0xABFFECCE, 0xB12A2BD7, 0x7260A0E8,
+0xBE184A48, 0xCFD3CA3F, 0xDF088660, 0x78EE9B67,
+0xA9EDB113, 0x4FD5D353, 0x8E348CC6, 0xD578C337,
+0xF0493BE9, 0xCCFB54EC, 0x9CEEF85C, 0x0CAAE15E,
+0x371AD12F, 0x9C5B9270, 0x2495F0DE, 0x06DE2DBB,
+0x911AE7EC, 0xEEDE3363, 0x6DD38D6C, 0x2AF7F3D9,
+0x51C8D118, 0xF23818A7, 0x95438AEA, 0x3A8A798F,
+0x230D2BEF, 0x3D16273C, 0x9C36FF83, 0x785C9537,
+0x3E42AF2F, 0x12A16741, 0xE58D0DC4, 0x33EBEFF9,
+0x6F1972DA, 0x128C9BAA, 0x858D6032, 0xDAF185E1,
+0xAE355065, 0xDE0086F3, 0x0F661A65, 0xF4334169,
+0xB1559BA6, 0x3892109A, 0xE903BA00, 0xAE0CBD58,
+0x073C21A0, 0xFCADB299, 0xB4E39AF1, 0x78475459,
+0xB46DC847, 0xDBA97661, 0x15D118F5, 0x01ED48D0,
+0x99F658BC, 0x399FDC8E, 0x44D4A919, 0x7C2CE4B9,
+0xCA0367CC, 0xCC2B9828, 0x16AACAA6, 0x7AA5B6BA,
+0xFEC77C66, 0x231B22F9, 0xC8BE0D04, 0x6FF2788C,
+0x5F9CEBB5, 0x901EAA5D, 0xDE682BBF, 0x998E70D4,
+0xBD9CCCDA, 0x6995441E, 0x5702F360, 0xBC035EED,
+0x20F60B51, 0xD57361D8, 0xC071113B, 0x73CE6CE4,
+0xC6569DC9, 0xD24B89ED, 0xA6052276, 0x8CEE2026,
+0xFBF5B58E, 0xF692DF81, 0x6B7CDD7C, 0xF5B6C04C,
+0xEC1BBA29, 0xD6AC8CDD, 0x320491F8, 0x1D812AC7,
+0x631B0051, 0xD08A4D2A, 0x569746DD, 0xAA653FCF,
+0xA92E8E70, 0xC59A6705, 0x278EA1FF, 0x63E5FA17,
+0x1C20E82D, 0x550F7CE3, 0x55CED415, 0x5F9C4C4A,
+0x7D746311, 0x5B07976A, 0x12477E31, 0xAB8113AA,
+0x796EDCEA, 0x4A90E4B4, 0xB36E6188, 0xEE7D5E0F,
+0x15CEA060, 0xB81AB2CA, 0x296D22B0, 0xFA0753E2,
+0x0D0D15BB, 0xD4AF8BD7, 0x951FA575, 0xCBEBD58A,
+0x0AF5C362, 0x9EF43FB0, 0xD97E5184, 0xA14469BC,
+0xCAE5D55E, 0x93D4CDF9, 0x95B013A8, 0x6998F35C,
+0xF1DDC0B1, 0x476F9FC7, 0xB6472B70, 0x1D55AC5C,
+0xF0E0C0C8, 0x95372BF5, 0x75CCCDBE, 0x9F9D2003,
+0xCAAD0D51, 0xEE54CC2E, 0xE5EBDBF0, 0x9B248BB3,
+0x4BF07D19, 0x542997E9, 0x17447C4B, 0xCF2B2768,
+0x86118A5B, 0x57579F12, 0xC5CD9E74, 0x97ED5724,
+0x01BD2EE4, 0x2A0403A6, 0x01833741, 0xA1E8D364,
+0x4D1A2EEA, 0x62760377, 0xA10D6861, 0x09C68E2F,
+0xAB482850, 0xACD24B74, 0x5038C8CA, 0x71DE3A93,
+0x671D25E4, 0x9EA7AC1A, 0x3E7287F5, 0x9FC963CF,
+0x73F90AB6, 0xC775D840, 0x00B868D9, 0xF6A9BE3D,
+0x17FFB472, 0x5D2389E3, 0x0D42A149, 0x2FAB1235,
+0x90A7998E, 0xD895F6EE, 0x19921013, 0xEE42EA48,
+0xC5D19A17, 0x5507890A, 0x9F893B29, 0x4FF39F19,
+0xD6EF85AD, 0x3FFB1599, 0xF1761017, 0xFC51B90D,
+0x8F6C566B, 0x44BAC7A4, 0x2B2E3755, 0xABECB8DB,
+0x5C4A1629, 0x837CC4F7, 0x3E732B0A, 0x803CE303,
+0x71865D8D, 0x346665AB, 0x58BF809B, 0x100626AA,
+0x9446AB13, 0xD53ADCDA, 0x75C0BFCD, 0x95853304,
+0xF4758E87, 0xD6B64517, 0x13293D0D, 0xEC9368FB,
+0xD449A2CC, 0xAA17B0BE, 0x9D0B85C0, 0x77BEED16,
+0x7699CAE7, 0xC776D10D, 0x962D48CE, 0x838D00BE,
+0x279AEBF9, 0x22EF837B, 0x58E46DAD, 0xB56B6305,
+0x3232D58B, 0x167969DB, 0x5B63F5B5, 0x7E82B175,
+0x05DDB402, 0x5AB29BBA, 0xF3B627D5, 0x97168C85,
+0xAD9EE022, 0x48F0CEEA, 0x84104C22, 0x690FCC19,
+0xCA2F2474, 0x76F95539, 0x9FD2B987, 0x79EFC557,
+0xCEE5DA4D, 0x27EB98F6, 0xA0628916, 0x8E05614F,
+0x8AC89026, 0x7705135E, 0x3F7E42B8, 0x7BCD773B,
+0xF98B9741, 0xCB8A514E, 0x9298220D, 0x5665FA3A,
+0xE66A1FF7, 0xAC4ECB71, 0xA7E56FEF, 0x9D1EF7F8,
+0x23566B64, 0xB4FE822E, 0x1AA53208, 0xF4545E5D,
+0xEA86C879, 0x18F6B7C2, 0xE10A17AC, 0xBD37011F,
+0xFBDF81B8, 0xA978A4EB, 0xD42437A7, 0x474E6A41,
+0xF8885248, 0xF750BAA9, 0xD238EA62, 0xD69BA74D,
+0x266EC6BF, 0xE7EDE077, 0xE8F0A303, 0x8B56A96D,
+0x41380980, 0xDDF0B16C, 0x00E83594, 0xA503EBF5,
+0x960A258E, 0x499827BD, 0x6C8E6F7B, 0x166C845D,
+0xC842C934, 0xBAEFC699, 0xD9846213, 0x832EC19B,
+0x1EAD7599, 0x221E7EE9, 0x8176A313, 0xB28D8E39,
+0xBAC29A96, 0xB964F91F, 0x3F268150, 0xD4BB7011,
+0x347EC445, 0x7FDC9E82, 0xEB70F4C9, 0xA6F38EBF,
+0x398CF137, 0xD7F88CF5, 0xCBDDCB3F, 0xA0DAFA74,
+0xD29D30AD, 0x822B6919, 0xCE059949, 0x3A946183,
+0xDE4C572D, 0xD1E6D844, 0xC43C7DAC, 0xDBBEEDD0,
+0xA656DF6D, 0x454C22A9, 0x9FA48790, 0x69B04531,
+0x99BB305F, 0x80500F71, 0xFE2363C2, 0xB67F538F,
+0x302EC0C3, 0x4A6E3458, 0x57E4CFD4, 0xE65CDAEB,
+0xF31ABB31, 0x62DF98AC, 0x894AE781, 0xB1588AB1,
+0x45D5CC3E, 0x3520F5B0, 0xC72D0CB7, 0xA1D6CBF9,
+0x742FFA63, 0xA0A5224F, 0x5EA1C85A, 0xB81E9F77,
+0x31D76C4F, 0x525257F5, 0xBFF85009, 0x2125B270,
+0x16E47E6E, 0x9128B981, 0x0D5FBE39, 0xF67A418C,
+0xCF3C71CB, 0xAC04ABE1, 0x9B550AAF, 0xB5077F18,
+0xFB7C5EC0, 0x64784DB4, 0x1E668B48, 0x84659836,
+0x604457BF, 0xF6F69C8D, 0x394301DC, 0xED0211BD,
+0x8BAC1A3A, 0xBB752FD2, 0x78B8C036, 0xBCB98E8A,
+0x33C595DE, 0xB3F3C5F8, 0x698666AC, 0xA1F42D7A,
+0x5751ACC8, 0xC069575B, 0x35D50F99, 0xB294BF38,
+0x82A4A331, 0x05147751, 0xCAE18C12, 0x9E89AAF1,
+0x3531C372, 0xB2114A88, 0x41797201, 0xDDDDEC10,
+0x01185F2A, 0xDED50CDC, 0x72156BAD, 0x88F3DB94,
+0x50450DDF, 0x6B1E7ABF, 0x3D317708, 0xFDFF5A15,
+0xDC8B1697, 0xCC2248FD, 0xD9196272, 0x4445195D,
+0x54D90281, 0x7A891C9D, 0x69FF98D5, 0xADE6D74B,
+0x26D27973, 0x0F14734F, 0x3F957FC8, 0x812AC874,
+0xEDC0F9B4, 0xD31D6D75, 0x7A2608C3, 0xD89984B1,
+0xF581081A, 0xEDB9DF6F, 0x16ECC191, 0x6B945724,
+0x1BCE8269, 0x02E6DB68, 0x56362541, 0x9D247CF4,
+0xA5265E72, 0x2C8B9413, 0x1157DB4B, 0x3145CFB2,
+0xFBDEBCF5, 0x1042B117, 0x284DAE18, 0x10575C21,
+0x1DDE578E, 0x80F59EDE, 0xCAB51C04, 0xB594BDA8,
+0x08ACEF85, 0x08C8D4C7, 0x7304D433, 0xE87D3A88,
+0x31CCFED8, 0x1D8E71E5, 0xC5A2F02C, 0xACBF3B5E,
+0xAA161BCA, 0xA10BE577, 0xF9CE41D2, 0x2B86F031,
+0x3D4A8D23, 0xED926DE4, 0x3844E21F, 0xFE57BCD0,
+0x36DC309D, 0x17137409, 0x9F6A8507, 0x14CF12EB,
+0xA770AFB5, 0x7C6DA2E4, 0x856B48B8, 0x2EA235DF,
+0x55BD1164, 0x5BD9FF0C, 0x5228C552, 0x9E719AFA,
+0x3EC3703B, 0xE06A94F3, 0x296FF0D9, 0xE468D9C9,
+0xD2A15CDC, 0x6C4EAAA2, 0x2AF3B8BF, 0x6B6EDC78,
+0x42B78972, 0x4C97A66C, 0x161C30BF, 0xCD2816DC,
+0x431BDA17, 0xD9653022, 0x67D95E39, 0xBCB18342,
+0x227982E7, 0x23C5B11B, 0x514420AB, 0x089F3A5C,
+0x2B2F8244, 0x2F2A80C8, 0xB0A90558, 0x75BAA243,
+0xE2FC4F62, 0xEB0A6104, 0xB7F221B2, 0x4ECD79DF,
+0xB3E08B8B, 0xBA25E1CB, 0xD39F3431, 0xB50202FE,
+0x78F15ECE, 0xEFF61ECF, 0xB3CDDD50, 0x3FD064A8,
+0x96B028BC, 0xB29DD4E1, 0x7E9EC629, 0xC407F4D1,
+0x8C21785B, 0xE11767BA, 0xCFE6DE26, 0x0DA98E22,
+0x33AC5670, 0x0FDBC175, 0xF11F8EF5, 0x60638843,
+0x8B67E55A, 0x3F27F75B, 0x6691FB98, 0x635A35A9,
+0xB317459C, 0xE7419C01, 0x8BAB28D7, 0xE347D791,
+0xEFC019A0, 0x45009041, 0xA6DEB3E8, 0x6F7379FF,
+0x0FF50390, 0x810BEE78, 0xAD13716B, 0xA7DBD7AB,
+0xEF439D4B, 0xDDA744A5, 0x31EDDE8D, 0xA85B71F2,
+0xDF439C70, 0xA7E3DA94, 0x525ED453, 0x3D913C32,
+0xD104CE61, 0x42F5FFED, 0x14C7625A, 0x4E5B314B,
+0xA7EAD1ED, 0xFA01D595, 0xE67BCF06, 0xE63685E2,
+0x3A32E9D3, 0x374C25F0, 0xA8E8A41D, 0xA403AEF5,
+0x901A194C, 0x17605BC9, 0x8522DD12, 0x27096BAA,
+0x017434B7, 0x99C8D2DA, 0x7F96B068, 0x8521CD09,
+0x529B46D6, 0x47852810, 0x021BC8BF, 0x93C98329,
+0x6FE73A78, 0x44DB69A9, 0xC839D490, 0xCAC42AFE,
+0xCF1ECCF4, 0x6F2E5F44, 0x795C8219, 0xA06C667B,
+0x80411F31, 0xB09926E1, 0xC62B6C18, 0x77C6E6DD,
+0x7622FC07, 0x02162DB2, 0x3EA31334, 0x6CC02B4A,
+0xAA6B81C3, 0x4424A9A5, 0x26BD2EF3, 0x334896D6,
+0xADDD2711, 0x76035757, 0x80AA328E, 0x2F39C06E,
+0x357520CB, 0xF62BDF46, 0xC59343C4, 0x7CA4CAE2,
+0x89B03EF3, 0x251A785B, 0xA4755BB9, 0x262D478D,
+0x462E6252, 0x6B5F6BED, 0xCA46E77B, 0xA2CF08AD,
+0x561E19EA, 0xBF31AA15, 0xD376F44C, 0xCC332150,
+0x8C0AEE42, 0xC06D5F91, 0xDADF8613, 0xBE0FA22C,
+0xF50AE482, 0xE3615501, 0xECC8D5AA, 0x58A7FD3E,
+0xD59B8CC9, 0x09DB0987, 0xF1D9753D, 0x9C79E20E,
+0x9A222AEA, 0xC4E58914, 0x6712E0A2, 0x8CD5C80E,
+0xEAB8AA56, 0xDBFA8D9C, 0x3515BD21, 0xB65B9E0C,
+0xF0D27FEE, 0xE33871C1, 0xEE8FE52F, 0x02ACCB3F,
+0xE9197277, 0xB7B70770, 0xA26E3581, 0x82481E7F,
+0x005AF99F, 0x8B970B4B, 0xEC74B662, 0x2F21C5A3,
+0x049DBA83, 0x495B3E1B, 0x112234B8, 0x95B42A5F,
+0x2C8FA833, 0x6D706E30, 0x2AAAEC09, 0xDE7C3377,
+0x06CE9D46, 0x7574EAAB, 0xFCB1A08D, 0x462AFB6C,
+0x192847B2, 0xCC149AC3, 0x427834CE, 0xE90180A0,
+0x946E526E, 0x6018BE4E, 0x20442F52, 0x1D39FA05,
+0x35F690AD, 0x29DB3A53, 0x6360158C, 0x3EC815F8,
+0xDED650AF, 0xFA168B37, 0x233F8A3D, 0x245009CF,
+0x71BB2237, 0x4989A01C, 0xD58AE4F1, 0x62C99EA0,
+0x48E9056E, 0x7E1A786D, 0xBF6CBAAB, 0x22669A6B,
+0x57857590, 0xE4558CE3, 0xBC6C63EC, 0x6AE02A61,
+0xA2ABFBBB, 0xD2B2FE90, 0xDF8BDB43, 0xEC2D59AC,
+0x7B6AFDC3, 0x6B001D5F, 0x3DFEE08F, 0xB9A597D6,
+0x09DEAC68, 0xE42D9E73, 0x2E33507C, 0x6525F051,
+0x0D7143C6, 0x01DD115B, 0x94180279, 0x28FC60D7,
+0xC0900603, 0xED4FBE53, 0xFC0677BD, 0x7DA2A878,
+0xA8D0EC73, 0xF6A09B2A, 0x24A129EE, 0x169BCA2F,
+0xE0BAE526, 0x5C8E2FCB, 0xA218EFFA, 0x842B61FB,
+0x87B860CD, 0x106E9B86, 0x930685F0, 0xC5A72109,
+0xFB977BD5, 0x9D3B4AC6, 0xDA378FE0, 0x0AAF747B,
+0x0408D50D, 0x488785B9, 0x81AE971D, 0x12ADFEF3,
+0xF0B64128, 0x3D4C90BB, 0xC994AAA1, 0xB854400E,
+0x901AE3DD, 0x7A4A0DE7, 0x18E07456, 0x20C38BCD,
+0x94441976, 0xE2E419C2, 0xDBD3C92F, 0x4DD63841,
+0xE2994959, 0xF41F196D, 0x0835431A, 0x93A2E9CF,
+0xB01FABED, 0xD0135535, 0xEBCEA18D, 0xC4F83A1B,
+0x5D72845C, 0x04335E3A, 0x68C4C987, 0x77178710,
+0xC5293A9A, 0x44E40AE1, 0xCE454FDE, 0x71DE89B7,
+0xA373D9D3, 0x6D19E483, 0x812896D6, 0xC3231C14,
+0xE960ABA4, 0xB7FB6F83, 0x1F7C4EB8, 0xD10DBE69,
+0x8575CF6E, 0xC03B15D5, 0x4D7F4EF3, 0xF0615F31,
+0x34E21762, 0x22D5A7A1, 0x729FA3F8, 0x2E1050FB,
+0x8A9F46DC, 0x535EB5A7, 0xD143560E, 0xF8EC3A4B,
+0x2249FD06, 0xE8E2AB08, 0x1E734127, 0xBA5B635A,
+0xD8F419DB, 0x0B5200D0, 0x8110304F, 0x3497DA80,
+0x35CA71CD, 0x0FD8227E, 0x086C74E2, 0xAB68A1AF,
+0xE3BD57EC, 0x83B42D29, 0x3C2D672D, 0x05D85CED,
+0x64F04926, 0x91364A12, 0x7FC73349, 0xEBA1FC77,
+0xECE0D20D, 0xB1DDDB9B, 0xEB6B492B, 0x0FC02BB6,
+0x56201D76, 0xED20F79E, 0xFC6034FB, 0x6A539F1D,
+0x520FECBF, 0x4E3AECF6, 0x76B01C74, 0xEFC421D4,
+0x82AC989A, 0x407A77CD, 0x6D287BFE, 0x26617425,
+0xEA2316C3, 0x8616554E, 0x9F4C4535, 0x88C0C6C1,
+0xEAC4F0F7, 0x32C7DD93, 0x41D9C37E, 0x2A9CBB2E,
+0x0591BAEF, 0x2BE43F21, 0x5E06EE4D, 0xDDDF5525,
+0xEC137DBE, 0xF0AA295C, 0xF2C9FDE2, 0x5DF9D693,
+0x10A6CAC0, 0xC6846D09, 0xF1DDABF3, 0xD56F8BBC,
+0xAA5DCE9D, 0x6F59004F, 0xB8A035BC, 0x61F47282,
+0xC89DAC9E, 0xFC7E5B3D, 0x4C5406DD, 0x54CFD147,
+0xBB44AB2A, 0x791269C0, 0x8CF66B4D, 0xD01A3190,
+0x636F45CA, 0xB32FC209, 0xCB8B9F49, 0xF46D74B9,
+0x5AFC9BD0, 0xC4C716C1, 0xF98C54F3, 0x36AFF013,
+0xB4D6D90B, 0x5F1299B6, 0xA3BFCFA4, 0xEA336AAD,
+0xCCD443DA, 0x74CA40B4, 0x31EF1614, 0x36D3FFEE,
+0x876AE252, 0xC8D62E9F, 0x6424F397, 0x1F730F2D,
+0xB20FDA53, 0xFCFEE60F, 0x676A61C3, 0x26C5E143,
+0xC201573E, 0x4A8C46BE, 0xEF87D0A9, 0xE07E80B4,
+0x34F20109, 0x8B936A70, 0x9F8E0305, 0xF3297CA0,
+0x4E7BF0E9, 0x0F374BB9, 0xCE78A01E, 0x5FE26DD8,
+0xA3826ACF, 0x321F69AB, 0x441AF14E, 0x8AC19CF7,
+0x4BFD1AD6, 0x5951ABD1, 0x098C17F0, 0xA9B75F76,
+0xA462551B, 0x6B703A12, 0xEDCB57B2, 0x8CD4C933,
+0xD338D3D8, 0xE343FC24, 0x9CDD52EB, 0x17A41942,
+0x63A8EF50, 0x215BB11A, 0xE1E25CB6, 0xB62C0A88,
+0xE58CDEC3, 0xC0E6389A, 0x2B7BEE55, 0xA3FCBD07,
+0x7CD451FE, 0xB06F6724, 0x5675A7EA, 0x141D52FC,
+0x05E86E9B, 0x53D75C3A, 0xE799AA2A, 0xE474384C,
+0x8C85E6E6, 0xA477A8D7, 0xA1E6AB0C, 0x9033E7CD,
+0x2F55D504, 0x4DAE81FB, 0xBD229A64, 0x862765C9,
+0x5B6A85F0, 0x95A39328, 0x38826CFB, 0xBF7DEBA4,
+0x42EFAB62, 0x2D0BBA60, 0xB06731AF, 0x16D4C4B0,
+0xCA4B9264, 0x3DF24AE2, 0xFED93848, 0x7CB33B08,
+0xAC9CAE9F, 0xA0F80B61, 0xA66CF713, 0x9364865F,
+0xDFA1E0B3, 0xFE6DF33F, 0x8039A612, 0x119F60BF,
+0xCEEDE309, 0xD28316A8, 0xCD61D2F5, 0x3CBEB015,
+0x85C0BF51, 0x6EDBBC15, 0x79F3D207, 0x485EE4FA,
+0xCEC302EA, 0x59D8B92D, 0x51C1FB36, 0xF4FE8B71,
+0x2DBD5718, 0x84024040, 0xFDD6590F, 0xA1CE9CC9,
+0xC4AEAB72, 0x0A2FE8BF, 0x28C33618, 0xBA4E15FB,
+0xA9C72819, 0xA3EE45D7, 0xD2DC52F1, 0x3FC84A2E,
+0x1C9DF73E, 0x632F9BDE, 0x7E9FBD20, 0x0D689B79,
+0x91E8D5C0, 0x6EE7952C, 0x905F192E, 0x2D79E712,
+0x8670A7A2, 0x1DBFC4D9, 0x64634429, 0xE636043B,
+0x643C6B0F, 0x50AF327B, 0x0E734D61, 0x2D7D6E46,
+0xB877DCD6, 0x7CCF4F1A, 0xDF4D8CF8, 0x0E7FA78E,
+0x0CBC4EC2, 0xAE9B4A22, 0x4F02D49C, 0x48F09C43,
+0x5031B1A0, 0xDCB8A1FC, 0x91C73599, 0xCF00A64D,
+0xDFCE561E, 0x8B18157D, 0xE1ED6A81, 0xCF94EF36,
+0xB412CE1A, 0x602E2076, 0x716B0F3F, 0xADEB32C0,
+0xD4E16094, 0xEC95D41F, 0x75858767, 0x438AD1A1,
+0xE61C5527, 0x0D71FBB2, 0x2A99D070, 0x5C018826,
+0xCCCC27FD, 0x053883D9, 0xF1D30EF5, 0x676AD38A,
+0xDF81AB28, 0x2257FB9D, 0x373313AE, 0x67E1FE8A,
+0xF4F66B02, 0xAFF8C7FA, 0x3B60D94D, 0xD44D0FE2,
+0x5FCDFE4B, 0xC63010B6, 0x06CFCCF4, 0x09D8DD85,
+0xAB79F2BE, 0xD5C0C498, 0x7364E4FD, 0xB295CEDF,
+0xDB89A068, 0x59A6A0C7, 0x0C823207, 0x7380FCFE,
+0x6E33C4B9, 0x0744E4F2, 0xF663BB33, 0x9EE512CE,
+0x870ED35B, 0xB4502654, 0x367CD4FD, 0x5D4238D9,
+0xEAB2B86E, 0x6E8ADDAA, 0xF080EDD6, 0x1DC90F46,
+0xB1FC9127, 0x63771392, 0x96729BF6, 0xD18E1413,
+0x5D85938D, 0xB8CED349, 0xF9B886C1, 0xCA486562,
+0xBAA9ED7A, 0x049718D8, 0x7CF8E67A, 0x1702843C,
+0x6DCDC34E, 0x93C51F83, 0x2415A4F3, 0xA8D77B3A,
+0x0FB823E8, 0x424F03C3, 0x9CAA503C, 0x7AA5433F,
+0x3BDD74FE, 0x99D3332E, 0x1E62231B, 0x90A4E595,
+0x7EDA974D, 0x43E2CD14, 0x27DB9D9F, 0x561F5CC6,
+0xA77EABA6, 0x97867B48, 0xAD6533CE, 0xEB726CF4,
+0x5857B217, 0x2D7DA10B, 0xD939C20E, 0x81F1F073,
+0xF42DEAF2, 0x3AD7780E, 0x88C77661, 0xD2E819B2,
+0xF872F581, 0x999F0C5A, 0x3887ABA4, 0x27F95B6D,
+0x991D9458, 0x9D1BB131, 0x6ECC5298, 0x9E9A7B26,
+0x6E65F271, 0xE90FA04C, 0x7B692AA0, 0x878943D5,
+0x924895E5, 0x041BC73A, 0x448E28B2, 0x61D22D1F,
+0xE7969773, 0xBC8E5980, 0x9A198852, 0xB94415C9,
+0xA02374BA, 0x340BD5F3, 0x27F2A0FF, 0x39BDB33F,
+0xCC042BCF, 0x83D6C135, 0x9C7A8D8E, 0x05823C23,
+0x2D7A3F91, 0xE792BCCA, 0xA2D82177, 0x73C82E7E,
+0xBEBC9613, 0x9F596CB0, 0x6E784AA7, 0x1B7BDA9F,
+0x846391F7, 0x852AD070, 0xF831E8CA, 0x16A78223,
+0xF68F5250, 0xE2554493, 0xD38F2AFB, 0x764BA7A8,
+0x3CAEFC55, 0x6E9B9037, 0xD87D486E, 0x7352AEA9,
+0x11987EE0, 0xDF7E84DA, 0x2838E736, 0xA8C7BAC2,
+0xF49E21EE, 0xFAD106E9, 0x7363AC6F, 0x5E9974CB,
+0xBA008BB0, 0xAF5DB3FC, 0x7AC3CFD7, 0x2D55EDC6,
+0x2C1C9AD7, 0x6A3AA494, 0x5F0E0A3A, 0x37422BFA,
+0x83B4D594, 0xB7ECCF66, 0x82FCCDD0, 0x8ECBFD79,
+0x664B9341, 0x02F178A2, 0x2095C8E0, 0xFC5F17B7,
+0x1810BA9B, 0x964E4CD1, 0xFBAED808, 0xDEE87796,
+0x63DE4F69, 0xC99275DD, 0x65242304, 0x7AB5C28B,
+0x01BB7A3B, 0xC85D7716, 0x32AFB9A3, 0x2ED2CBB1,
+0xB194218F, 0x21FE560D, 0xCB4503A5, 0x5CE0464D,
+0xC4AE9A3C, 0x061530CB, 0xEDA38E6B, 0x4029D3E6,
+0xB0C20336, 0xA37825C0, 0xC68F8B37, 0x9405AD3B,
+0x8B1A8F99, 0xA761DE8B, 0x683B3259, 0xA154C554,
+0x6BD835C9, 0x6DEAE35A, 0xBEAE6D49, 0x21D8B074,
+0x46C01B31, 0xBE9B3A16, 0x1D611EAA, 0x423AB74C,
+0x931F5AF5, 0xBB9E289A, 0xA4101132, 0x4A8BE0D7,
+0x3307E4B2, 0xDE78DB5E, 0x347EB5CE, 0x13EEE999,
+0x2C2D7955, 0xBA893EBA, 0x5DFC2EC1, 0xE7DD7A5F,
+0x5E1C64D8, 0x4552E447, 0x1837D8E4, 0x9711836B,
+0x3219F893, 0x04392C84, 0x3E94848C, 0x15E5F481,
+0x0EC58819, 0x7341D458, 0x4AE63711, 0x85C1FD1F,
+0x97B58BD7, 0xB0550EBE, 0xB9108743, 0x6F53B386,
+0x7A73F31B, 0xE07CF8B9, 0x61FF27C8, 0x06A9A8B4,
+0xEB0F2BB9, 0x46D275FB, 0xCF39B474, 0xC34F3B6D,
+0x52F2F119, 0xD87963BF, 0xC60BF16C, 0x7797D0AD,
+0x7EA4DBF0, 0xD21409C7, 0xF678A927, 0x638E67CD,
+0x93261AED, 0xEA9B25FE, 0x1EBCAFDC, 0x580CC829,
+0x58D1DA1A, 0x658881F8, 0xC48DB682, 0xD42E8CB4,
+0x1DF33D74, 0x31C04F68, 0x7D871E29, 0xAE11FD72,
+0xD7E8F8F6, 0x530D9D9C, 0x580A0715, 0x0F17B1A3,
+0xB863F42F, 0xA6A4DC08, 0x82773E76, 0x9354B309,
+0xE17D0770, 0x04E4DE5B, 0x712EA396, 0x49D37B55,
+0xAE4109BA, 0x03862DC9, 0x7BCF61D2, 0x43CA2017,
+0x23BDD50F, 0x74577459, 0x4E8F4E23, 0xBF924C1A,
+0xE4EC70CE, 0x37FBEC66, 0xA6DA8935, 0xE11F4090,
+0x5C8F9EE3, 0x19D167EC, 0x9EE4F2C5, 0x64A81E6C,
+0xB35642BB, 0x82083A01, 0x001CA1F6, 0xAA69C7E8,
+0x685F24D9, 0xE6868E31, 0x38ADD8F0, 0xA2FDD44E,
+0xEE0C491D, 0xC60B1E9A, 0xF7A89268, 0xFD784F35,
+0xC6B7335C, 0x75EFCEC1, 0xE2D9F7CF, 0xE1C364F8,
+0x7CC63B2C, 0xC179E2AD, 0x56C193A5, 0x5134FB69,
+0x35058BB5, 0x36F4BCD5, 0xDF4A08C2, 0x14AA2330,
+0x760C8CD8, 0x2C562394, 0x0BEB669B, 0x2301973A,
+0xAF5C4FF2, 0x1C770AAB, 0x25DD2087, 0x732AADC4,
+0x59054958, 0x59DDCBE4, 0x74CFC8A8, 0x7C015016,
+0x32A0276E, 0x8F1C2E93, 0x0CE91F71, 0x055C307A,
+0x435D967E, 0xF4C33704, 0x5BDF2AD7, 0x8855099C,
+0x307B2736, 0xBB6B19CB, 0x626349D3, 0x8F52ABFA,
+0x251A1ED6, 0xE0587BC0, 0x12831408, 0xDA83CABF,
+0xAB2C7DFD, 0x6BCF0271, 0x72058DF0, 0x17AFC1DD,
+0xFFC52C30, 0x551401E0, 0x9EED54DF, 0x14E951E4,
+0x14624B3F, 0x4C24650B, 0x5A65F86B, 0xE94F6143,
+0xDC7CE9CF, 0x94D5D8F3, 0x093B0A04, 0x22098D01,
+0xEDF09E7C, 0x165EDB0F, 0xD09CA774, 0xB96AA141,
+0xB5745978, 0x9D820434, 0x42B0E026, 0x96938A25,
+0x72E8634B, 0xBE36EC02, 0x42F3F74B, 0x358FA621,
+0xBD451484, 0xB43A75D1, 0xB0A57F91, 0x701A7C82,
+0x484B3F46, 0x047F78AD, 0x65F7371C, 0xEAC8A954,
+0xE59F6354, 0x3EEEFB4E, 0xF131954B, 0x1C00BAC2,
+0xE3897637, 0x5FEC83AB, 0x58CFA2C4, 0x1F4C0A6A,
+0x97956BC6, 0x63D11D7D, 0xB46179D0, 0x11039A75,
+0x1B50E088, 0x68E9476B, 0xAA68DB55, 0x8A4A051E,
+0xEFA0DDF5, 0x05A2A674, 0xFFE03E72, 0xC5A0295C,
+0x6FD4D834, 0x8E42BB94, 0xF3DFD88E, 0xBA691AD2,
+0x3458473E, 0x6269A348, 0x72962FB6, 0x86D5064B,
+0x8A153740, 0x54AC97D8, 0xED2CE057, 0x68200474,
+0xBBA8E19D, 0xBFDD08F3, 0xB0DF76D1, 0x62F29649,
+0x5AB77030, 0x1EE9A00E, 0x7DAB1C90, 0xAB608FFD,
+0x8506A853, 0x75B9339B, 0x1AE0CCBA, 0xFB60BB79,
+0x8650F92F, 0x4819E1F7, 0x0A7045A8, 0xB5BCE5F1,
+0x77A98B27, 0x03DE21E4, 0x3FE3F132, 0x106827EC,
+0xD4DC1469, 0xAAC82F9B, 0x1D5953A1, 0x8034B369,
+0xD4412B6F, 0x90FB9F25, 0x14279070, 0x6D98AF1C,
+0x3D286F37, 0x8324A732, 0x58123E4E, 0xEB051032,
+0xC15CD557, 0xEB82DE99, 0x6213434E, 0x39F0FC9C,
+0x5EBFE1C5, 0x8CEBF470, 0xFF7D8D8A, 0x740A6A3E,
+0x720D080C, 0xB73B74FA, 0x5173F96E, 0x9FC01794,
+0xDABF1C81, 0xCA813295, 0xBEA2DB8D, 0x4C7E0CE4,
+0x8051BA67, 0xE63399E2, 0x83A15EE4, 0x47F4A718,
+0xD8246E6A, 0x0B4F87BE, 0x031648B8, 0x99E3E3E6,
+0x4ABCC64F, 0x52768181, 0xE708372B, 0x2D0B1D2C,
+0x4DF52402, 0x389BE9F6, 0xDE2F3232, 0x5D43D74E,
+0xD37BB898, 0xE7272645, 0x9B5432DA, 0x9D7A9473,
+0xA69628A5, 0x583555A7, 0x255B08BD, 0xAD68EAE3,
+0x1A79982D, 0xACE09726, 0x15E576AD, 0x260EB406,
+0xA7440B46, 0x66B6D317, 0xBE6ECA3B, 0x3ADEA1C1,
+0xD80399C3, 0x0EF198D0, 0xFAEE2010, 0xEF2E8E56,
+0x5B6CC402, 0x3FD27BE2, 0x970AAB5F, 0x618C17C6,
+0x7F5022FB, 0x552FC1FA, 0x5DD82984, 0x09769539,
+0x98812D1F, 0xBD8B2539, 0xD78AD9A6, 0x1CE41D07,
+0x272A0AB7, 0x5CB7E101, 0x6F42D56A, 0x001D930E,
+0x3C17C305, 0x30AAE354, 0x2A4AABE0, 0x922BCB94,
+0x73F34C1C, 0xE07E1501, 0xCB55A3E1, 0x0CDC3669,
+0xD9C07DE7, 0x2DAB82BF, 0x963EACAA, 0x9B05E0F1,
+0xE2DA0EFA, 0x0613BFE5, 0xDFB605E9, 0x5DCCA8FD,
+0x6D433873, 0x81A9B4C5, 0xD1D1CB14, 0x9B6A9906,
+0xC104767C, 0x30101D37, 0x186FBB79, 0x8F95D488,
+0xA3094F43, 0x7F17C981, 0xFD92B3FE, 0xADAB3AB5,
+0x20D1406C, 0x9462C8E7, 0x5D64819D, 0xB3E85196,
+0x67B854FE, 0x7D039FC6, 0xAD98A85E, 0xF672E041,
+0x30FA19A9, 0x4A276EB8, 0xB7041D2E, 0x57BB21E2,
+0x4E251667, 0x15C5401E, 0xDAB59431, 0xD6C6FD1F,
+0x1726EB70, 0x900F4E84, 0xD327DE33, 0x7A0AE04B,
+0x76B1174E, 0xFD547B94, 0x370832DC, 0xDDE65CDD,
+0x74672C02, 0x164703FE, 0x34CAD31F, 0x3E692DED,
+0x4BC38FA5, 0x143F99E5, 0x61BB640E, 0xB957BC8D,
+0xC9DD9E35, 0x2B5CB310, 0xADD6EAD0, 0x91981D46,
+0xED803D57, 0x61D7737C, 0x92D3AC3E, 0x36A034CB,
+0xE1395DC5, 0x5F2070F8, 0xC5EE9F8A, 0x70546B88,
+0xC9EA230C, 0x58DC3073, 0x57CBBEB7, 0xA0B78CFE,
+0x0B3FE75B, 0x07ADACCD, 0xC292C338, 0xD70CD7E5,
+0x729D8F4E, 0x218FA041, 0x10EC1199, 0xAC1EC51D,
+0x5DECC8D1, 0xBA36230A, 0xBC41F5A5, 0x75864896,
+0xB4403D4A, 0xFEEE8F44, 0x8D94A256, 0x62BA0115,
+0x3A570C61, 0x9221C583, 0xD2981A6B, 0xFD8AAF5A,
+0x2A102D59, 0x64083BDD, 0xBD1AADE6, 0x7E6D1E99,
+0x20568A6D, 0x8DFA704B, 0x87D27122, 0x2EFDAB7D,
+0xF3AF9D39, 0xD8DED0B2, 0x2D4B34B9, 0x12F3E32C,
+0xA6BCBE65, 0x680029A1, 0x094B07B3, 0xDA5918ED,
+0xF7D0A86D, 0x1A7E18C8, 0x9285A97F, 0x2040282C,
+0x5B133531, 0xA48237AC, 0x3557BC1B, 0x7E6ED77B,
+0x436234C7, 0x9B2094DE, 0x5D967593, 0x8867D1C4,
+0x88EC3948, 0xE7F84AD4, 0x1871B3E6, 0xE8E992C6,
+0xA16DC2F8, 0x0DFDF590, 0x9B56238D, 0x329017F5,
+0xBF9BD409, 0x68BD9B1C, 0x4036C4FF, 0x3BF6D93C,
+0xAE100602, 0x90B43508, 0xA85B4013, 0x2C66EA54,
+0x227D32D7, 0x0BA526D1, 0x075213B8, 0x1A3DED07,
+0xD458DFFD, 0xDC8ACD43, 0xAC7809AB, 0x2D25408A,
+0xD8F0C887, 0xAD8CD30D, 0x4054F61E, 0xA9F0CCA3,
+0xBFEBD31D, 0x6D2BAB1E, 0xF8E42D8B, 0x6C94A4E4,
+0x1158D2A3, 0x93F44EFE, 0x8AD05A25, 0x8C229D32,
+0xB213D76E, 0xDFE63822, 0x561986EC, 0x806CA082,
+0x6DB3BF8D, 0x1E850D30, 0x8F7A44C0, 0x75BB3328,
+0x86C7BE12, 0xDE5C44BD, 0xDF4D048E, 0x968712C3,
+0xB1B41CF8, 0xCC194FE9, 0xDA2E1A8D, 0x72A08662,
+0x5ABA2536, 0x223E2013, 0xA5A923A5, 0x7565B5DD,
+0xBCA0A2B0, 0x0C29864B, 0xAAD8CB87, 0xE4C7E559,
+0x77E19E51, 0x194E54ED, 0x54DD1B54, 0x0FAD37A7,
+0x0EF6B0E3, 0x0E3A2FC8, 0xA0063995, 0xE17AE20E,
+0xDC11B7F8, 0x85F1A76D, 0xD97858D4, 0xB763E49C,
+0xB5BE7EC4, 0x3CE924C4, 0x4246019D, 0xD33DBB27,
+0x737863A7, 0x32C26BDD, 0x714897A3, 0x36091018,
+0xF26BC990, 0xDDB640B0, 0x448F5B12, 0xD7A5EB4B,
+0x5614EEA4, 0xCA4912FB, 0x011F9D6C, 0xA4FC90AB,
+0x9FB4982D, 0x20AD146F, 0x4B7AB74E, 0x107A9411,
+0x71DBA90A, 0xD510E3D2, 0x248D0D35, 0xB666229E,
+0x61EE1EEA, 0x702031B5, 0x36992A7B, 0xC90C08CB,
+0x6478995A, 0xE6C2BA7A, 0x8A9179AC, 0xC8EE2956,
+0x27B042C8, 0x48DB81D9, 0xAA39F2CB, 0x5E4D5F3C,
+0x24FFD6B9, 0x5B562C2F, 0x00FD33B6, 0x435F5F52,
+0xF392FFC1, 0x0E927C40, 0x5508CBAB, 0x976AA567,
+0xA13E7C52, 0x532109E9, 0x16B9021F, 0x60C615A1,
+0x1D23C258, 0xFD783147, 0x63600FB1, 0xAAA245F0,
+0x9B3DC1E1, 0x7B270D0D, 0x5B1632CE, 0x8B871F7F,
+0xC535EFF8, 0x73109C6A, 0xEB83D02D, 0xF7AE76FB,
+0x2E39E502, 0xA4128216, 0xF90D57E5, 0xFF0C465E,
+0x02008029, 0xE5CBBA1F, 0x4280FA3C, 0xCDBD75C8,
+0xCB4AF342, 0x17695A4E, 0xAA6162B5, 0x8660A679,
+0xD1A8701C, 0x47694CA7, 0xDA8D43FD, 0x44A4BC1B,
+0xAB34B9AA, 0xE55563DD, 0x08D4142B, 0x81197AC8,
+0x997B1DC2, 0x2E7CC50A, 0x7A326A21, 0xA76419DB,
+0xEA8B5428, 0x65729140, 0x051DAF66, 0x8871BCA9,
+0xA175E5BF, 0x60310C98, 0xB7DE8929, 0x35E2459E,
+0x08EB4547, 0x904D7B2B, 0x29382CC4, 0xCEC8664E,
+0x1E8C9C2C, 0x3B942134, 0x9CEC5D55, 0xDA548376,
+0x2E4EFD61, 0x26F65F09, 0x5A3DD7CA, 0x2FD4E58D,
+0x6B71B8C2, 0x13189115, 0x2B5542BA, 0x1CE85C2C,
+0x5B9FE09D, 0x68704BFE, 0xB15313B9, 0x3EF2729E,
+0x583ECC31, 0xA3DED8CA, 0xFCD27C3D, 0x904DAB39,
+0xFE1069A4, 0xE99A57BA, 0x112EB80C, 0xE1483C74,
+0x8A27B0D7, 0xA58F7325, 0x7CD050A1, 0x626D4F3E,
+0x51643657, 0xA967FC59, 0x5BACBC0B, 0x2CF3E459,
+0x7D8988D9, 0x53913DF8, 0x2381A6FC, 0x64D6D441,
+0x48AE9101, 0x185D9539, 0x1B044AEC, 0xB5ABCEDD,
+0xFA8ECA52, 0x8CCDD142, 0x96FD4442, 0xD865FEDF,
+0xCE4EE2FA, 0xA5160AE9, 0xC91B2B3A, 0xF993F45F,
+0x1509132C, 0x920ECC5F, 0xD813DDC1, 0x834B68E4,
+0xD5E876A0, 0x61DE0E41, 0x4C143913, 0xC7293985,
+0x17E226E7, 0x38830927, 0xDC604DF2, 0x799D1430,
+0x846585AB, 0xE5D21E38, 0x6381D136, 0x1B60633B,
+0x23B7AE14, 0x554E53CC, 0x5807A210, 0x30560866,
+0x12F79E62, 0xE27B5D45, 0x3889C1E5, 0x47F845FF,
+0xFFD9DE98, 0xB10E09D2, 0x4A184A72, 0x083D2971,
+0x8AB7478D, 0x92380377, 0x57A724EC, 0xBBBD5CA6,
+0xE2FB9D32, 0xAB6ADFC6, 0x3916DED4, 0x4E19438F,
+0xE21E15CF, 0x6AF4BCC9, 0x8D08924A, 0x1662BAA9,
+0x3064AD27, 0xB86D7EE4, 0x88624C62, 0x1A0BF3E7,
+0xF3E4A287, 0x6787F006, 0x01375D4B, 0x998BB38F,
+0x6D669A29, 0xD760B093, 0xC4768853, 0xF041100F,
+0x35DE10DD, 0xE06C8BB8, 0x2C79A902, 0x60600DAD,
+0x6E11CF5C, 0x18778777, 0x7CCE406C, 0xE54AF2EA,
+0x7472C475, 0x73DBEE7E, 0xE533DC40, 0xB07407DD,
+0xF6ACA8D3, 0xE71BD7D1, 0x4BD3514D, 0xC5C362CA,
+0x0690E5A1, 0x0FFDC8D8, 0x58188645, 0x8636413C,
+0x3412A033, 0xAF4FC340, 0xA5DFEAB8, 0xB87272E3,
+0xA4A9219F, 0x29696E90, 0x35D2F627, 0x8794DBD7,
+0x5D2D87F8, 0xFA73559D, 0x7D22F440, 0xF50197E9,
+0xEB74B829, 0x8F9649CF, 0x16F47D30, 0x5C7D9870,
+0x36FF6C0B, 0x313A92ED, 0x303B3654, 0xE3E33CCA,
+0x02C26ECC, 0x26949920, 0x4445DF20, 0x01FDBC98,
+0x49138C6F, 0x1B5555E2, 0x122B45D2, 0x4B2E0202,
+0x7B6014D4, 0xFAE0CD09, 0x77E165A0, 0xFBE76980,
+0xF5808BD3, 0xFD110E5E, 0x97450E11, 0x297F9B1F,
+0x607A2C41, 0xE384DFC9, 0x25D9A8DC, 0xF919D955,
+0x5E025993, 0xCC318847, 0x9717D2D5, 0x48F0DD1F,
+0x6CC4A8EB, 0x9BD0F4E1, 0x506F2A93, 0x18B8748E,
+0x16FFBA48, 0x552E4955, 0xB963F64F, 0xA1A34AC8,
+0x62E95CC7, 0x4D87EA89, 0x21E8C031, 0xC1F0ED07,
+0x28B7BB22, 0x0B838D04, 0x6361B440, 0xA653521C,
+0x92DA3F78, 0x4241CFED, 0xFAFCBD41, 0x3EFAB6BC,
+0x25F30607, 0x41BB70DA, 0x9FF3440A, 0x2502039E,
+0x3813EC82, 0xC6A4FD6B, 0xF8537C8C, 0x098ED49F,
+0xE0A0BD6E, 0x6BA2F2B3, 0xC35C9D9D, 0x1256E66A,
+0x790B2490, 0xD5C69889, 0x39E712FE, 0xCF73DE0B,
+0x41B3B614, 0x745ABD73, 0x654C79D8, 0x5B15923D,
+0x8C15F218, 0x585CCCF0, 0x624F7B44, 0x76BDDFDB,
+0x96F26B52, 0xE13058A1, 0x086C950E, 0x29519DEA,
+0xA42CFE04, 0x0D7A190B, 0xD0678C6A, 0xABB78679,
+0xBA48A2E4, 0x5F3DA10A, 0x11F04183, 0xAC720A3F,
+0x6A807781, 0x6F146BFB, 0xE8A67934, 0x54578834,
+0xAA60C8F0, 0x2061A1E6, 0x9E87799B, 0x68D91F86,
+0x8974F540, 0xB1C3F101, 0x99C21E56, 0xB57BA73F,
+0x8B2DAA3E, 0xF1E2D24E, 0x48F7D4EE, 0x7039FDB3,
+0xC666EEDC, 0x251F972E, 0x4D53F6BF, 0x6CC73EE7,
+0xCB07F7B9, 0x69ECB8CA, 0x363FD80C, 0x3B587AB3,
+0x738C1E5C, 0x5C9C1D92, 0xE7B52396, 0xEDE6324B,
+0xFE5B5045, 0xC90D8B3E, 0x371A0128, 0xF2C8DCF8,
+0x5B648CB5, 0x12F8E8FF, 0x5FE4BA71, 0xB925CFBE,
+0x7416E14F, 0x76489FFE, 0x1F4DE367, 0xA400F039,
+0x66390E83, 0x1AE79CEC, 0xDB573E98, 0xB6021F29,
+0xD01615E5, 0x02A2281F, 0xE85019C1, 0x027BB41F,
+0x8D9177C3, 0x79026E78, 0xF158B623, 0xBEFF5858,
+0x7B63518E, 0x8F42C08C, 0xB388227D, 0x940D607A,
+0xA4C79541, 0x9800CC91, 0xA356B535, 0x285BABB9,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0xE411E520, 0xA0024528, 0x442B4428, 0x96070009,
+0x46106246, 0x8FFB2522, 0xD4027504, 0x0009AFF5,
+0x00000FB3, 0x00200004, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x16D49357,
+0x0009000B, 0x4F222FE6, 0xDE947FFC, 0xE114D594,
+0x1E13D494, 0x67521E4C, 0xD494D693, 0x37402769,
+0x62528F06, 0x7201D692, 0x60602522, 0x2600C93F,
+0xD7906152, 0x2512611D, 0x264B6652, 0x2562470B,
+0x0009B00D, 0xE60095AC, 0xC84060E2, 0x2F028F03,
+0x8FF93652, 0x7F047601, 0xA05A4F26, 0x4F226EF6,
+0x410BD185, 0xD4850009, 0x0009440B, 0x450BD584,
+0xD7840009, 0xD284E1FF, 0x2712611D, 0xD4835029,
+0xE1FFCB01, 0x1209E501, 0x12112212, 0xE7202452,
+0x4718D57F, 0x2572D27F, 0xD17FE700, 0xD680D47F,
+0xE2012270, 0x24702172, 0xD67E2620, 0x2641E4FF,
+0xD57DE600, 0x666DE104, 0x76016063, 0x4000626D,
+0x8FF83212, 0xD5790545, 0x2520E201, 0xD279D778,
+0x2710E100, 0xE5802212, 0x655C6613, 0x666DD476,
+0x76046763, 0x374C626D, 0x8FF83253, 0xD4732712,
+0xD573E101, 0xD6732410, 0x2542E400, 0xE03AE501,
+0xD272D771, 0xE0390654, 0x27110654, 0x000B4F26,
+0x7FC82211, 0xD76FD16E, 0xDC70DB6F, 0xD271DE70,
+0xD572D471, 0x1F12D672, 0x1F76710C, 0x1FB877FC,
+0x1FEA1FC9, 0x72041F2B, 0xDE6FDC6E, 0x1F13EB10,
+0x1F511F44, 0x1F771F65, 0xD86C1F2C, 0xDD6DD96C,
+0xD26DEA00, 0x89003A22, 0xD1587A01, 0x88016010,
+0x56F98B03, 0x4218E201, 0xD1682622, 0x0009410B,
+0x440BD467, 0xD5670009, 0x0009450B, 0x6010D14C,
+0x8B108801, 0xE650D14B, 0x46186212, 0x8B083266,
+0x56FAD147, 0x2120E200, 0xCB016062, 0x2602A003,
+0x72012710, 0x60822122, 0x89098801, 0xE2C8D15A,
+0x622C6612, 0x89033626, 0x6010D158, 0x8BC88801,
+0x51F76792, 0x217252F6, 0xD6555191, 0x55FB2212,
+0x52FC6462, 0x55612542, 0x2252E400, 0x61436643,
+0x05DE6013, 0x36CC4608, 0x02DE2652, 0xC9036021,
+0x8B028801, 0x720162E2, 0x74012E22, 0x36B3664C,
+0x71048FEE, 0x66C2D147, 0x45286512, 0x265B4518,
+0x60822C62, 0x89018801, 0x0009A168, 0x6272D742,
+0x8B132228, 0xD726D541, 0x6552D441, 0x51436672,
+0x316C365C, 0x27622668, 0x14138D05, 0x6262D63D,
+0xB1A57201, 0xD61E2622, 0x2622E200, 0x52916692,
+0x8B013620, 0x0009A144, 0x6061A06E, 0x001C001C,
+0x001D4020, 0x0000B38E, 0xFFFF0000, 0x12340000,
+0x001E1015, 0x00201278, 0x002018A0, 0x00201922,
+0x0020128C, 0x001C3510, 0x001C3624, 0x001E212C,
+0x0020397C, 0x00203514, 0x00203984, 0x00203990,
+0x0020399C, 0x002039F8, 0x002039FC, 0x002039A4,
+0x002039A5, 0x002039A8, 0x00117700, 0x00203A12,
+0x00203578, 0x001142D8, 0x00203A14, 0x00203A16,
+0x001C3D30, 0x00117718, 0x001C3D00, 0x001C1000,
+0x001C36F8, 0x00117734, 0x001C3684, 0x00117710,
+0x001C3520, 0x00117600, 0x00117740, 0x001C1028,
+0x0020358C, 0x002039AC, 0x7FFFFFFF, 0x00201734,
+0x002032BE, 0x002022E8, 0x00203DC0, 0x002039FA,
+0x00203584, 0x002039EC, 0x001C3D2C, 0x001C36B0,
+0x0020351C, 0x0011775C, 0x8801C90F, 0xA0CF8901,
+0xD17C0009, 0x36206212, 0xD47B8904, 0x2421E200,
+0x2162A0CC, 0x6211D179, 0x89012228, 0x0009A0C3,
+0xE202D775, 0x75016571, 0x3123615D, 0x27518D02,
+0x0009A0BC, 0xD27255F2, 0x62226052, 0x40094019,
+0xC90F4009, 0x8F19880A, 0x52F31F2D, 0x40196022,
+0x40094009, 0x8808C90F, 0xA0A78901, 0x60630009,
+0x51F255F8, 0xE701CB01, 0x2502D263, 0xE1002172,
+0x2211D564, 0x74016452, 0x2542A098, 0x8B3F8805,
+0x602252F3, 0x40094019, 0xC90F4009, 0x8B168802,
+0xE5FFD45D, 0x655D6742, 0x8B102758, 0x6272D75B,
+0x8B0C3260, 0x55F257F8, 0x2762E101, 0xD5522512,
+0xD757E400, 0x62722541, 0xA0777201, 0x52F32722,
+0x40196022, 0x40094009, 0x8805C90F, 0x31B38B6E,
+0xD5508B6C, 0x615257F4, 0x7101E240, 0x64722512,
+0x1F4DD14D, 0x42182419, 0x8B033420, 0x6262D64B,
+0x26227201, 0xE200D640, 0x2621B0AA, 0x0009A056,
+0x3123E220, 0x88038B52, 0x52F38B1E, 0x40196022,
+0x40094009, 0x8803C90F, 0xD7418B16, 0x647251F4,
+0x7401D23D, 0x65122742, 0x1F5DE640, 0x46182529,
+0x8B033560, 0x6262D63B, 0x26227201, 0xE200D62E,
+0x2621B086, 0x0009A010, 0xD738D137, 0xD22A6412,
+0xE5007401, 0x21423A76, 0x22518F06, 0xEA00D634,
+0x72016262, 0x2622B074, 0x2FB2D532, 0x95406652,
+0xD4305BF1, 0x36205241, 0x60618910, 0x8B01C803,
+0x2B22E201, 0x8FF54510, 0x57F15664, 0x6272E1F0,
+0x41284118, 0x2722221B, 0x6BF2A008, 0x6BF2A006,
+0xE200D615, 0xD1152621, 0x2121E200, 0xE20256F5,
+0x42186662, 0x26284228, 0x1F6D8D0C, 0xD61FD11E,
+0x460B6511, 0x2008645D, 0x57F58904, 0x6272D11C,
+0x27222219, 0xD11BE201, 0x66122822, 0x8B012668,
+0x0009AE17, 0x450BD518, 0xD1180009, 0xAE10E600,
+0x07D12160, 0x00203A0C, 0x00203A10, 0x00203A18,
+0x001C3DC0, 0x0011772C, 0x001C3B88, 0x002039F4,
+0x0011773C, 0x00117744, 0x0000F000, 0x00117764,
+0x00117748, 0x00117768, 0x0011776C, 0x01FFFFFF,
+0x0011774C, 0x00203584, 0x001142D8, 0x00114774,
+0xFDFFFFFF, 0x00203DC0, 0x0020246C, 0x002039FA,
+0x2F962F86, 0x2FB62FA6, 0x2FD62FC6, 0x4F222FE6,
+0xD11F7FF4, 0x6212DE1F, 0x67E25411, 0xD41E1F41,
+0x1F722F22, 0x6743D51D, 0x7794D21D, 0x5A425841,
+0x6C726942, 0x6D225B16, 0xE6006052, 0x2502CB20,
+0x7601E540, 0x3253626D, 0x62F28BFB, 0x212255F1,
+0x55F21151, 0x2E52D613, 0x14A21481, 0xD4122492,
+0x11B627C2, 0x674226D2, 0xD911DA10, 0x2A72E801,
+0x1A8C490B, 0x4218E201, 0x7F0C1A2C, 0x6EF64F26,
+0x6CF66DF6, 0x6AF66BF6, 0x000B69F6, 0x000068F6,
+0x001C3B9C, 0x001C3D98, 0x001C3700, 0x001C3500,
+0x001C5960, 0x001C8960, 0x0020358C, 0x001C3D00,
+0x00201610, 0x2F962F86, 0x2FC62FA6, 0x2FE62FD6,
+0x4F124F22, 0x7F884F02, 0xE018DEB2, 0xD4B261E0,
+0x61E30F14, 0x62107101, 0x440BE01C, 0x20080F24,
+0x8F126D03, 0xD4AD1F08, 0x6740DDAD, 0x657CD4AD,
+0x470BD7AD, 0xD2AD0009, 0x621C6120, 0x46086623,
+0x36284608, 0x3D6C4608, 0xE01C1FD8, 0xE58004FC,
+0x604C66E2, 0x3050655C, 0x2D628F17, 0x01FCE018,
+0xDEA3E500, 0x641CA008, 0x6753655D, 0x607037EC,
+0x31DC6153, 0x80147501, 0x3243625D, 0xD49D8BF4,
+0xE200D59D, 0xA27F2421, 0x20082521, 0xE0188B13,
+0xE50001FC, 0xA009DE96, 0x655D641C, 0x32EC6253,
+0x62536722, 0x32DC6672, 0x75041261, 0x3243625D,
+0xA2698BF3, 0x88012D10, 0xE0188B16, 0xE40001FC,
+0x671C2D40, 0x624DDE8A, 0x8B013273, 0x0009A25C,
+0x6DE3644D, 0x7D046243, 0x32EC6643, 0x652236DC,
+0x74086162, 0x2512AFEF, 0x8B198804, 0x01FCE018,
+0x2D70E700, 0x1FD56D1C, 0x627DDE7D, 0x8B0132D3,
+0x0009A242, 0x6173677D, 0x31EC65E3, 0x75046412,
+0x365C6673, 0x61426262, 0x21297708, 0x2412AFED,
+0x8B198805, 0x01FCE018, 0x2D70E700, 0x1FD46D1C,
+0x627DDE6F, 0x8B0132D3, 0x0009A226, 0x6173677D,
+0x31EC65E3, 0x75046412, 0x365C6673, 0x61426262,
+0x212B7708, 0x2412AFED, 0x8B598831, 0x61E6DE67,
+0x61E31F19, 0x64E27104, 0x1F4A6216, 0x1F2B6416,
+0x75E46513, 0x66536712, 0x1F4C7604, 0x64521F7D,
+0xD75F6E66, 0x27E0D25F, 0xDE5F6062, 0xC9013245,
+0x65622E00, 0x4609060A, 0x4609D15C, 0x46094509,
+0x21501F4E, 0xB2B0646D, 0x620D1F6F, 0x8B012228,
+0x0009A1EA, 0xD756DE55, 0x661C61E0, 0x6410D150,
+0x470B654C, 0x7FFC54FF, 0x2FE25EFE, 0x51FE7FFC,
+0x2F12E040, 0x55FBD14F, 0x57FD56FC, 0x04FE410B,
+0xD24D7F08, 0xE11C640D, 0x1D412D10, 0xD44B6522,
+0x67421D52, 0x1D73DE4A, 0xD24A65E2, 0x67221D54,
+0x1D75D249, 0xD2496E22, 0x66221DE6, 0x1D67A1BC,
+0x89018830, 0x0009A08E, 0xE340D538, 0x33FC6156,
+0x23126456, 0x71046153, 0x67521341, 0x13726416,
+0x7EE46E13, 0x65E66212, 0x66E3D731, 0x13246EE2,
+0x760427E0, 0x6062D22F, 0x3255DE2F, 0x2E00C901,
+0x060A6E62, 0xD12D4609, 0x4E094609, 0x13434609,
+0x646D21E0, 0xB2501F5E, 0x620D1F6F, 0x8B012228,
+0x0009A18A, 0xDE25D522, 0x61E06450, 0xD724654C,
+0x470B54FF, 0x7FFC661C, 0x06FEE054, 0x7FFC2F62,
+0xEE4001FE, 0x2F123EFC, 0x55E2D125, 0x57E456E3,
+0x64E2410B, 0xD21C7F08, 0xE11C640D, 0x1D412D10,
+0xD61A6522, 0x67621D52, 0x1D73DE19, 0xD2196EE2,
+0x62221DE4, 0xD2181D25, 0x1D266222, 0x6222D217,
+0x1D27A15A, 0x00117800, 0x00202A18, 0x00203996,
+0x002035BC, 0x00203A7C, 0x002018D0, 0x00203995,
+0x00117804, 0x00203A14, 0x00203A16, 0x00117810,
+0x00203991, 0x10624DD3, 0x00203992, 0x00203993,
+0x00114AA4, 0x00200F68, 0x001C5864, 0x001C6864,
+0x001C7864, 0x001C59BC, 0x001C69BC, 0x001C79BC,
+0x00200FC0, 0x8B048833, 0x470BD7A2, 0xA123EE00,
+0x88282DE0, 0xA0D38901, 0xDE9F0009, 0x62E1E143,
+0x3216E054, 0x0FE68F02, 0x2E21E240, 0x622D62E1,
+0x8B013217, 0x0009A0BC, 0xE50185E1, 0x8B013056,
+0x0009A0B6, 0x2D10E101, 0x64E1B111, 0x06FEE054,
+0x6261E143, 0x3517652D, 0xE6408945, 0x8B0C3563,
+0xE058E41A, 0xE5000F45, 0x72C0E05C, 0x60230F55,
+0x6703C907, 0xA014E060, 0x66530F75, 0x46214621,
+0x46214621, 0x45214621, 0xE0587618, 0x0F654521,
+0xE0034521, 0xE05C2509, 0xE0070F55, 0xE0602209,
+0xE8540F25, 0x858238FC, 0x640D65F3, 0x1844B170,
+0xDD7A8584, 0x85866C0D, 0x610D4C08, 0x410860C3,
+0xE00F0EFE, 0x18154D0B, 0x2E296207, 0x668260C3,
+0x85620FE6, 0x4D0B5185, 0x2E0B600D, 0x548460C3,
+0xB13C0FE6, 0xE05465F3, 0xE5400EFE, 0xE06C62E1,
+0x3653662D, 0x0F668D41, 0xC9036023, 0x40004008,
+0x61036403, 0xD965E070, 0x0F46E5FF, 0xE074655C,
+0x60530F96, 0x6263490B, 0x42214221, 0x42214221,
+0x42006723, 0x4200327C, 0x6C074621, 0x4621E054,
+0x606309FE, 0x4008C903, 0x790630FC, 0x6A036D2D,
+0x65F3E800, 0x64D3B124, 0xE0706EA2, 0x2AE22EC9,
+0x01FE6694, 0x666CE074, 0x470B07FE, 0x2E0B6063,
+0x65F32AE2, 0xB0FA64D3, 0x628D7801, 0x32E3EE06,
+0x7D018FE7, 0x0EFEE054, 0xE05462E1, 0x420006FE,
+0x760C8561, 0x701B302C, 0xE4006103, 0xE70465F3,
+0x68667401, 0x3973694D, 0x8FF92582, 0x65F37504,
+0x641DB0DD, 0x0EFEE054, 0x64E1B09C, 0x0009A054,
+0xD43B56F8, 0xEA01D23B, 0x26A0420B, 0x0009A04C,
+0x06FCE01C, 0x8829606C, 0x5CF88B08, 0xE200D636,
+0x52612C20, 0x642DB04B, 0x0009A03E, 0x666CE681,
+0x8B043060, 0x420BD231, 0xA03554F8, 0xE6820009,
+0x3060666C, 0xD22E8B04, 0x54F8420B, 0x0009A02C,
+0x666CE683, 0x8B0A3060, 0xDA2755F8, 0x2590E900,
+0xD82855A1, 0x2852D628, 0xA01D52A2, 0xE6922620,
+0x3060666C, 0xD2208B08, 0x5C21D824, 0x6CCC52F8,
+0x28C1E600, 0x2260A010, 0x666CE693, 0x8B063060,
+0xD61F59F8, 0xE201EA00, 0xA00529A0, 0xD6162621,
+0xD21DD41C, 0x6562420B, 0x4F067F78, 0x4F264F16,
+0x6DF66EF6, 0x6AF66CF6, 0x000B69F6, 0x4F2268F6,
+0xE240614D, 0x89323123, 0x3127E21F, 0x8B27D713,
+0xD406614D, 0xE00171E0, 0x5671440B, 0x26596507,
+0x1761A025, 0x00200FBC, 0x00117804, 0x00203470,
+0x00203A9C, 0x002018C0, 0x00117800, 0x00115F00,
+0x00116058, 0x0020397C, 0x00203990, 0x00203A1A,
+0x00203A16, 0x00203AB4, 0x002018D0, 0x001C3704,
+0xE001D490, 0x6672440B, 0x26596507, 0x4F262762,
+0x0009000B, 0x614D4F22, 0x3123E240, 0xE21F8912,
+0xD7893127, 0x614D8B08, 0x5671D286, 0x420B71E0,
+0x260BE001, 0x1761A006, 0x6672D282, 0xE001420B,
+0x2762260B, 0x000B4F26, 0xE6400009, 0x46284618,
+0x6252D57E, 0x89FC2268, 0x0009000B, 0x4618E680,
+0xD57A4628, 0x22686252, 0x000B89FC, 0xA0010009,
+0x7201E200, 0x8BFC3242, 0x0009000B, 0x4618E680,
+0xD5734628, 0x22686252, 0x000B8BFC, 0x2FE60009,
+0x7FFC4F22, 0xBFF16E53, 0x61E22F42, 0xE280D66D,
+0x54E11615, 0x16464218, 0x422855E2, 0x57E31657,
+0x16786EF2, 0x26E22E2B, 0x4F267F04, 0x6EF6AFCE,
+0x2FD62FC6, 0x4F222FE6, 0x6C53DD62, 0x6E43BFD6,
+0x2DE2BFBB, 0x0009BFD2, 0x2C1251D5, 0x1C4154D6,
+0x1C5255D7, 0x1C6356D8, 0x6EF64F26, 0x000B6DF6,
+0x61636CF6, 0xA004E600, 0x62564109, 0x24227601,
+0x36127404, 0x000B8BF9, 0xD6530009, 0x8562E500,
+0xA00B674D, 0x655D610D, 0x40006053, 0x305CD44F,
+0x024D4008, 0x3270622D, 0x75018905, 0x3213625D,
+0x000B8BF1, 0x000BE000, 0x2FE6E001, 0x54416743,
+0x4E08EE7F, 0x4E28D246, 0x25E96543, 0x60436E21,
+0x9E7562ED, 0x4529C903, 0xE60032E3, 0x8D456103,
+0x21184509, 0xD23F8B05, 0x002C6053, 0xA08AC93F,
+0x60136603, 0x8B268801, 0x880C6053, 0xD53A8B04,
+0xC93F8453, 0x6603A07F, 0x8B048808, 0x84E2DE36,
+0xA078C93F, 0x880D6603, 0x8B03D633, 0xC93F8461,
+0x6603A071, 0x88096260, 0x622C8F09, 0xE014DE2C,
+0x655C05EC, 0x60233258, 0xA064C93F, 0x60236603,
+0xA060C93F, 0x88026603, 0xE0078B5D, 0x60432509,
+0x8905C810, 0x6053D225, 0xC93F002C, 0x6603A053,
+0x6053DE23, 0xC93F00EC, 0x6603A04D, 0x88016013,
+0x60538B19, 0x8B04880C, 0x8423D21E, 0xA042C93F,
+0x88086603, 0xD51B8B04, 0xC93F8452, 0x6603A03B,
+0xD618880D, 0x84618B03, 0xA034C93F, 0x60606603,
+0xA030C93F, 0x88026603, 0xE0078B2D, 0x60432509,
+0x8923C810, 0x6053DE10, 0xC93F00EC, 0x6603A023,
+0x00000BB8, 0x00203470, 0x001C3704, 0x001C373C,
+0x001C3700, 0x001C370C, 0x00114000, 0x00114008,
+0x001142D8, 0x001142E4, 0x001142E8, 0x001142F5,
+0x001142ED, 0x001142FD, 0x00114309, 0x6053D209,
+0xC93F002C, 0x60136603, 0x8B038802, 0xC8106043,
+0x76028900, 0xC93F6063, 0x40004018, 0x1741240B,
+0x6EF6000B, 0x00114301, 0x0009A16E, 0x2FE62FD6,
+0xDD944F22, 0xA0049EB2, 0xD4930009, 0x420BD293,
+0x62D265D2, 0x8BF822E8, 0x0009A004, 0xD28FD490,
+0x55D1420B, 0x22E852D1, 0xA0048BF8, 0xD48D0009,
+0x420BD28A, 0x52D255D2, 0x8BF822E8, 0x0009A004,
+0xD286D489, 0x55D3420B, 0x22E852D3, 0xA0048BF8,
+0xD4860009, 0x420BD281, 0x52D455D4, 0x8BF822E8,
+0x6EF64F26, 0x6DF6000B, 0x2FD62FC6, 0x4F222FE6,
+0x6E636C73, 0x6D53B01A, 0x64D357F4, 0xB05F65E3,
+0xB07566C3, 0xB0A40009, 0xB0A80009, 0xB0AC0009,
+0xB0AC0009, 0xB0AF0009, 0xB03154F5, 0x6CCD6C03,
+0x4F2660C3, 0x6DF66EF6, 0x6CF6000B, 0x3412D170,
+0xD6700529, 0x2650D770, 0x2742000B, 0x0009A018,
+0x2FD62FC6, 0x4F222FE6, 0x6E636C73, 0x6D53BFEE,
+0x64D357F4, 0xB03365E3, 0xB08D66C3, 0xB00F54F5,
+0x6CCD6C03, 0x4F2660C3, 0x6DF66EF6, 0x6CF6000B,
+0xE503D162, 0xD763D462, 0x21524518, 0x2472000B,
+0xD45FD15E, 0x2162E600, 0x2462000B, 0xBF734F22,
+0xBF73E40A, 0xD25C0009, 0x4118E104, 0xE40AE500,
+0xBF692212, 0xD7592252, 0xCB206072, 0x000B4F26,
+0x4F222702, 0x410BD156, 0xD556E400, 0x4F26452B,
+0xD1552FE6, 0x66126E63, 0x92104418, 0x44084528,
+0x45002629, 0x265B4408, 0x264B4400, 0x21624708,
+0xD14E4708, 0x217227EB, 0x6EF6000B, 0x1FFF03F0,
+0x4F222FE6, 0xE101DE4A, 0xBF3DE40A, 0x67E32E12,
+0xE500776C, 0xE204E130, 0x2752E40A, 0x27522752,
+0x27522752, 0x27522752, 0x27522752, 0x27522752,
+0x27522752, 0x27522752, 0x27522752, 0x27522752,
+0x27222712, 0x27522752, 0x27522752, 0x27522752,
+0x27522752, 0x175ABF18, 0x2E62E600, 0x000B4F26,
+0xD2346EF6, 0xE441E101, 0x000B2212, 0xD1322242,
+0xE605D432, 0x000B2162, 0x000B2462, 0xD2300009,
+0xE40AE601, 0x2262AF00, 0x2FC62FB6, 0x2FE62FD6,
+0x7FFC4F22, 0x6C43DB2B, 0xED0060B2, 0x2B02CB03,
+0xC90360B2, 0x6E03A008, 0x89073DC2, 0xE46460B2,
+0xB07CC903, 0x7D016E03, 0x8BF52EE8, 0x8F043DC2,
+0xD4212FE1, 0x460BD621, 0x62F10009, 0x6023622D,
+0x89FFC801, 0x7F046023, 0x6EF64F26, 0x6CF66DF6,
+0x6BF6000B, 0x001C3B88, 0x00203AC8, 0x002018D0,
+0x00203AD0, 0x00203AD8, 0x00203AE0, 0x00203AE8,
+0x0025E720, 0x00203DBC, 0x00203980, 0x001C5968,
+0x001C3B40, 0x000F8000, 0x001D4004, 0x001C3500,
+0x002015E4, 0x00201610, 0x001C5814, 0x001C59D0,
+0x001C5830, 0x001C6268, 0x001C59A4, 0x001C639C,
+0x001C581C, 0x001C5860, 0x00203AF0, 0x002018C0,
+0x8F014411, 0x6043604B, 0x0009000B, 0x5651D52B,
+0x46286052, 0x306C000B, 0x2FC62FB6, 0x2FE62FD6,
+0x4F124F22, 0xBFF14F02, 0x6B036E43, 0xDD25DC24,
+0x0009BFEC, 0x3C0530B8, 0x4609060A, 0x46014609,
+0x020A3D65, 0x42094209, 0x32E24209, 0x4F068BF0,
+0x4F264F16, 0x6DF66EF6, 0x000B6CF6, 0x2FC66BF6,
+0x2FE62FD6, 0x4F124F22, 0xBFCF4F02, 0x6C036E43,
+0xBFCBDD13, 0x30C80009, 0x060A3D05, 0x46094609,
+0x36E24601, 0x4F068BF5, 0x4F264F16, 0x6DF66EF6,
+0x6CF6000B, 0x4F222FE6, 0xE102DE0B, 0xE403E500,
+0xBFB92E12, 0xE6062E52, 0xE7004618, 0x2E62E403,
+0x4F262E72, 0x6EF6AFB0, 0x0009000B, 0x001C1040,
+0xCCCCCCCD, 0x10624DD3, 0x001D4004, 0x2F962F86,
+0x2FB62FA6, 0x2FD62FC6, 0x4F222FE6, 0xE5007F98,
+0x6453E710, 0x6B534728, 0xEE1ADCBC, 0x6153655D,
+0x315C4108, 0x75014108, 0x6043317C, 0x0F16665D,
+0xED0060B3, 0x21B136E3, 0x81128111, 0x11D28113,
+0x11D411D3, 0x74048FEA, 0xD8B167F2, 0x1871D9B1,
+0x58F12872, 0x1981D1B0, 0x59F22982, 0x5DF45AF3,
+0x54F65EF5, 0x21921191, 0x11A211A3, 0x11D411D5,
+0x11E611E7, 0x11481149, 0xDAA855F7, 0x57F8EE00,
+0x52F9DDA7, 0x64E3D6A7, 0x2A521A51, 0xD8A7D9A6,
+0x2D72EAEF, 0x6AAC2622, 0x6DE36EED, 0x61E34D08,
+0x41083DEC, 0x31EC4D08, 0x60B33D9C, 0x2DB14108,
+0xE05081D1, 0xE79F4108, 0x41084008, 0x81D2677C,
+0x318C60B3, 0x3472E200, 0x1DD281D3, 0xD4931D13,
+0x1D248D01, 0x65D3D48F, 0x7E01B0B2, 0x34A264ED,
+0xDA8C8BDA, 0x68A22FD2, 0x4829DD91, 0x64A22D82,
+0x694D7DFC, 0x2D92D286, 0x4E296E22, 0x2DE27D0C,
+0x6AD36822, 0xD784618D, 0x6D722A16, 0xD583D489,
+0x5E7224D2, 0x14E2D688, 0xEE005174, 0x58761414,
+0x1486D186, 0xE7105978, 0x62521498, 0x142A65E3,
+0x64E326E2, 0x644DE600, 0x48086843, 0x4808384C,
+0x6053381C, 0x28B10C86, 0x60B309CE, 0x60538191,
+0x60430ACE, 0x605381A2, 0x60B30DCE, 0x605381D3,
+0x740108CE, 0x09CE1882, 0x19E3624D, 0x32730ACE,
+0x8FE01A64, 0xD96A7504, 0x6C92E003, 0x2CB14018,
+0xDA6F6D92, 0xE05081D1, 0x40086E92, 0x619281E2,
+0x811360B3, 0xE6006492, 0x67921442, 0x17A3D468,
+0xE1FF6892, 0xE7031864, 0x46086563, 0x7501364C,
+0x665D2612, 0x8BF83673, 0xE003DC5A, 0x40186DC2,
+0x6EC22DB1, 0x81E1D25F, 0xEE0061C2, 0x64C21112,
+0x1423E024, 0xD45B65C2, 0x67C215E4, 0x8172E580,
+0x66E368C2, 0x655C8183, 0x6963666D, 0x6A6D7604,
+0x3A53394C, 0x29E28FF8, 0xDC54DB53, 0x740424B2,
+0x7F6824C2, 0x6EF64F26, 0x6CF66DF6, 0x6AF66BF6,
+0x000B69F6, 0x614268F6, 0xC8036011, 0xE5008F03,
+0x3420D23C, 0x60118B06, 0x8802C903, 0xD2398B06,
+0x8B033420, 0x65135612, 0x24225264, 0x6053000B,
+0x2FE62FD6, 0x7FEC4F22, 0x62536E53, 0x6D43E550,
+0x4508E400, 0xE101A001, 0x60435224, 0x81212211,
+0x60538123, 0x56E28122, 0x8BF53620, 0x16E4D238,
+0xE61464F3, 0x65E3420B, 0xE4FC65E1, 0x2E512549,
+0x65F361F1, 0x2F112149, 0xD13154D1, 0xE614410B,
+0x607157D1, 0x2701CB01, 0x7F141DE1, 0x6EF64F26,
+0x6DF6000B, 0x2FE62FD6, 0x7FEC4F22, 0x66536E53,
+0x6D43E5FC, 0x20596061, 0x2601CB01, 0x326052E2,
+0x12E48B06, 0x31E051E2, 0x52D18B04, 0x1E22A002,
+0x5664AFF0, 0x64F3D21E, 0x420BE614, 0x67E165E3,
+0x2719E1FC, 0x67F12E71, 0x271954D1, 0x65F3D118,
+0x410BE614, 0x52D12F71, 0xCB016021, 0x1DE12201,
+0x4F267F14, 0x000B6EF6, 0x00006DF6, 0x002039AC,
+0x0020357C, 0x00203584, 0x0020358C, 0x002035B4,
+0x00203998, 0x002039A0, 0x00100208, 0x001014C0,
+0x001E210C, 0x001C3D00, 0x002039EC, 0x001000C8,
+0x00117880, 0x00117780, 0x00040020, 0x0026C401,
+0x00200D42, 0x4F222FE6, 0xDE42624C, 0x42004208,
+0x3E2CA005, 0xD4405252, 0xBF695624, 0x65E22E62,
+0x352052E1, 0xD63D8BF6, 0x4F262622, 0x6EF6000B,
+0x2FC62FB6, 0x2FE62FD6, 0xDC394F22, 0x52C1DB39,
+0x362066C2, 0x6061891C, 0x8801C903, 0xDE348918,
+0xBF38DD35, 0x650364E3, 0x66B28503, 0x3262620D,
+0xD4328907, 0x0009BF76, 0x4D0BD431, 0xAFE60009,
+0xBF3D0009, 0xD42F64E3, 0x00094D0B, 0x0009AFDF,
+0x2262D22D, 0x6EF64F26, 0x6CF66DF6, 0x6BF6000B,
+0x2FD62FC6, 0x4F222FE6, 0xDD29DC28, 0x6E4360C2,
+0x04DE4008, 0xE614D127, 0x65E3410B, 0xD127D726,
+0x55E227E2, 0x35E05254, 0x21228F04, 0x400860C2,
+0x122202DE, 0x605365C2, 0x75014008, 0x0DE606DE,
+0xC90F6053, 0x60632C02, 0x6EF64F26, 0x000B6DF6,
+0x85436CF6, 0x650D5643, 0x622D6262, 0x35277204,
+0xE1008F0C, 0x2268960C, 0xD6158B03, 0x72015261,
+0xD6131621, 0x6262E101, 0x26227201, 0x6013000B,
+0x000001FF, 0x0020358C, 0x00203584, 0x001C3D00,
+0x002035B4, 0x0020397C, 0x002018C0, 0x0020357C,
+0x00203B18, 0x00203B1C, 0x001C3D28, 0x002039EC,
+0x002039AC, 0x00200D42, 0x002039F0, 0x002039F4,
+0x00117754, 0x2FA62F96, 0x2FC62FB6, 0x2FE62FD6,
+0x7FF84F22, 0x6C22D241, 0xC80360C3, 0xDE40896E,
+0xDA41DB40, 0x52B1D941, 0x362066B2, 0x60618945,
+0x8801C903, 0xDD3B8941, 0x420BD23D, 0x650364D3,
+0x60A12F02, 0x89328801, 0x85145153, 0x8840600C,
+0x1F118F0C, 0xD5376191, 0x641D450B, 0x8B262008,
+0xD7356691, 0x646D470B, 0x8B202008, 0x420BD233,
+0x51F154F1, 0xC8208511, 0xD1318904, 0x021EE050,
+0x01267201, 0x420BD22F, 0x200864F2, 0x64D38907,
+0x4D0BDD2D, 0xD12D65F2, 0xAFC4E601, 0xD22C2162,
+0x420B65F2, 0xD72B64E3, 0xAFBCE601, 0xD2262762,
+0x420B65F2, 0xAFB664D3, 0xDE270009, 0xDA28DD27,
+0x52D1DB28, 0x362066D2, 0x60618918, 0x8801C903,
+0xD4228914, 0x450BD516, 0x56030009, 0x8F0436E0,
+0xE2016503, 0xAFEC2A20, 0xD41F2B52, 0x420BD216,
+0xD7180009, 0x4118E101, 0x2712AFE3, 0xC80460C3,
+0xD21A8902, 0x0009420B, 0x4F267F08, 0x6DF66EF6,
+0x6BF66CF6, 0x000B6AF6, 0x000069F6, 0x001E2100,
+0x0020358C, 0x00203584, 0x00203A14, 0x001142D8,
+0x002014A6, 0x00115EA2, 0x00114774, 0x00200D8A,
+0x0020351C, 0x002016C2, 0x002014D0, 0x001E212C,
+0x00201534, 0x001C3D30, 0x00117880, 0x0020357C,
+0x0020399C, 0x00203998, 0x002035B4, 0x00200644,
+0xE601D203, 0x1265D503, 0x000B2252, 0x00001266,
+0x001C1010, 0x0000C34F, 0x0009000B, 0x0009000B,
+0x0009000B, 0x0009000B, 0xE000000B, 0xE000000B,
+0x0009000B, 0xE4FDD59D, 0xD69D6152, 0x25122149,
+0x74016052, 0x2502CB01, 0xD19A6752, 0x25722749,
+0xC8406010, 0x60628902, 0x2602CB04, 0xE1F76462,
+0x26422419, 0xE7016062, 0x2602C9CF, 0xE5026062,
+0x2602CB10, 0x47186062, 0x2602CB03, 0x000B1652,
+0xD58D1673, 0xD28ED78D, 0xE100D48E, 0x2511E600,
+0x22102711, 0x2461AFCE, 0xD28B664C, 0x362C4600,
+0xCB106060, 0x2600000B, 0xD287654C, 0x352C4500,
+0xE1EF6650, 0x000B2619, 0x664C2560, 0x4600D283,
+0x6060362C, 0x000BCB10, 0x654C2600, 0x4500D27F,
+0x6650352C, 0x2619E1EF, 0x2560000B, 0xD27A664C,
+0x362C4600, 0xCB086060, 0x2600000B, 0xD276654C,
+0x352C4500, 0xE1F76650, 0x000B2619, 0x664C2560,
+0x4600D272, 0x6060362C, 0x000BCB08, 0x654C2600,
+0x4500D26E, 0x6650352C, 0x2619E1F7, 0x2560000B,
+0xD669624C, 0x326C4200, 0xC9086020, 0x40214021,
+0x000B4021, 0x624C600C, 0x4200D664, 0x6020326C,
+0x4021C908, 0x40214021, 0x600C000B, 0x644CD160,
+0x6240341C, 0x602C000B, 0x644CD15E, 0x6240341C,
+0x602C000B, 0x4F222FE6, 0x645C6E43, 0x3467E60A,
+0xBFEB8914, 0x640C0009, 0x880160EC, 0xE00F8B02,
+0x2409A002, 0x44094409, 0xE60A624C, 0x89053263,
+0x644CBFE2, 0x6023620C, 0x8B00C880, 0x6023E200,
+0x000B4F26, 0x4F226EF6, 0x6062D64B, 0x8B038801,
+0x0009B256, 0x0009A003, 0xE640D248, 0xD6482260,
+0x4F26E200, 0x2622000B, 0xD6434F22, 0x88026062,
+0xB29F8B01, 0xD6420009, 0x4F26E200, 0x2622000B,
+0xD43ED53D, 0xE701E100, 0x000B2512, 0xD23B2470,
+0x000BE604, 0x4F222260, 0xD13BD43A, 0x0009410B,
+0xE1FDD53A, 0xD23A6650, 0xE7002619, 0x4F262560,
+0x2270000B, 0xD5374F22, 0x6152D237, 0x611DD737,
+0x64522512, 0x242BE6FF, 0xD4352542, 0x666DD22E,
+0x2762420B, 0xE1FBD52D, 0x27196750, 0x000B4F26,
+0x4F222570, 0xD128D42F, 0x0009410B, 0xE7F7D527,
+0x26796650, 0x000B4F26, 0xD5242560, 0x62509425,
+0x000B2249, 0xD5212520, 0x6250E4BF, 0x000B2249,
+0x4F222520, 0x8522D224, 0x2008600D, 0x88018911,
+0x88038944, 0x88058946, 0x88068948, 0x8808894E,
+0x88098954, 0x880A895A, 0x880B8960, 0xA06D8966,
+0xB06F0009, 0xA06A0009, 0xFF7F600C, 0x001E2148,
+0x001E1108, 0x001E1000, 0x00203A4C, 0x00203A4E,
+0x00203A6D, 0x00203A30, 0x001E103F, 0x001E105F,
+0x001E102F, 0x001E1090, 0x00203A54, 0x001E100B,
+0x00203A50, 0x00203B20, 0x002018C0, 0x001E1028,
+0x00203A6C, 0x001D4020, 0x98760000, 0x001C1000,
+0x00203B2C, 0x00203B3C, 0x00203A24, 0x0009B04C,
+0x600CA035, 0x0009B055, 0x600CA031, 0x6260D684,
+0x8B2B2228, 0x0009B061, 0x600CA029, 0x6260D680,
+0x8B232228, 0x0009B069, 0x600CA021, 0x6260D67C,
+0x8B1B2228, 0x0009B0C7, 0x600CA019, 0x6260D678,
+0x8B132228, 0x0009B0CD, 0x600CA011, 0x6260D674,
+0x8B0B2228, 0x0009B125, 0x600CA009, 0x6260D670,
+0x8B032228, 0x0009B13D, 0x600CA001, 0x4F26E000,
+0x0009000B, 0xD26CD16B, 0xD56C8412, 0x4000C90F,
+0xD76B012D, 0xE403D66B, 0xE20F611C, 0x2540E001,
+0x25202712, 0x2602000B, 0xE601D262, 0x30668523,
+0xE0008D05, 0xD663D260, 0xE0018122, 0x000B2602,
+0xD25C0009, 0x600D8523, 0x89052008, 0x8B0A8801,
+0x6060D65D, 0x2600CB01, 0xD457D65A, 0xE001E101,
+0x000B2612, 0x000B8142, 0xD152E000, 0x8513E501,
+0x640D4518, 0x66033453, 0xE0008D05, 0xD551D253,
+0x2260E001, 0x000B2502, 0x4F220009, 0x8513D149,
+0x6453650D, 0x62494419, 0x227D672E, 0x8801602C,
+0x88028909, 0x88038910, 0x8806891A, 0x88078935,
+0xA04C893B, 0xD5460009, 0x6652D746, 0x2762D446,
+0x622C6261, 0x2421A038, 0x2228625C, 0xD4438B3F,
+0x6642D540, 0x2562D440, 0x24018561, 0x6203A02C,
+0x2008605C, 0x88108907, 0x88208908, 0x88308909,
+0xA02C890A, 0xD23A0009, 0x6222A008, 0xA005D239,
+0xD2396222, 0x6222A002, 0x6262D638, 0xD432D531,
+0x66212522, 0xA00F626C, 0xD6352421, 0x6261D52D,
+0x622CD42D, 0xA0072562, 0xD6322421, 0x8561D529,
+0x2562D429, 0x62032401, 0x662D8515, 0x3617610D,
+0x65038F01, 0xB0CB2451, 0xA0010009, 0xE000E001,
+0x000B4F26, 0xD6190009, 0xD427E101, 0x65412610,
+0xD118D717, 0xE20F655D, 0x2752E001, 0x000B2620,
+0x2FE62102, 0xD20F4F22, 0x640C8523, 0x8B082448,
+0xD511D61D, 0x2621E200, 0x940F8451, 0xA0482049,
+0xDE0D8051, 0xC84060E0, 0xE2018D32, 0x89443427,
+0xD216D615, 0x2641420B, 0x0009A030, 0x0000FF7F,
+0x00203A6D, 0x00203A24, 0x00203A30, 0x001E1100,
+0x001E100C, 0x00203A50, 0x001E1000, 0x001E1001,
+0x00203A58, 0x00203A38, 0x00203A3C, 0x00203A40,
+0x00203A5C, 0x00203A60, 0x00203A64, 0x00203A68,
+0x00203E20, 0x00203E2A, 0x00203A4A, 0x002027F2,
+0x89123427, 0xD294D693, 0x2641420B, 0xCB8084E1,
+0x80E1B0F5, 0xD69160E0, 0x2E00CB04, 0xC93F6060,
+0xD68F2600, 0xA001E001, 0xE0002602, 0x000B4F26,
+0xD68C6EF6, 0xC8806060, 0xD2868919, 0x88016021,
+0xD2898B15, 0x8524E501, 0x89103056, 0xE203D187,
+0x2120D487, 0xE00B6541, 0x0656655D, 0xE40FD585,
+0x2140E702, 0xD77E2571, 0x000BE001, 0x000B2702,
+0x2FE6E000, 0xDE804F22, 0xC88084E1, 0xD57A892C,
+0x20088554, 0x61038F28, 0x8553D77C, 0x64036672,
+0x8566650C, 0x3520620C, 0xD6798B1E, 0x651CD774,
+0x2651644C, 0x60E02741, 0x8904C840, 0x420BD275,
+0xA0030009, 0xD2680009, 0x0009420B, 0x0009B09F,
+0xE201D167, 0x60E02122, 0xCB04D464, 0x60402E00,
+0x2400C93F, 0x6023A001, 0x4F26E000, 0x6EF6000B,
+0x2FB62FA6, 0x2FD62FC6, 0xDA622FE6, 0x66A1E240,
+0x3622DC5E, 0x62638900, 0x6ED36D2C, 0x4E2136D8,
+0x4E212A61, 0xDB61D460, 0xE700A00F, 0x770162B2,
+0x71026123, 0x66212B12, 0x71026213, 0x61212B12,
+0x651D666D, 0x356C4528, 0x627C2452, 0x8BED32E3,
+0xC90360D3, 0x8B108803, 0x617367B2, 0x2B127102,
+0x71026E13, 0x2B126571, 0x655D6DE1, 0x422862DD,
+0x325CE107, 0xA00C2C10, 0x88022422, 0xA0038B01,
+0x8801E203, 0xE2018B05, 0x66B22C20, 0x655D6561,
+0xE60F2452, 0x67A12C60, 0x8B052778, 0xDD38DC44,
+0xEB01EA00, 0x2DB22CA2, 0x6DF66EF6, 0x6BF66CF6,
+0x6AF6000B, 0x2FE62FD6, 0xE240DD36, 0x362266D1,
+0x62638900, 0x3678672C, 0x7703DE38, 0x47212D61,
+0x64E2D635, 0xA00E4721, 0x6562E100, 0x62537101,
+0x74012450, 0x24204219, 0x45297401, 0x74012450,
+0x24504519, 0x621C7401, 0x8BEE3273, 0x66E24200,
+0x420061D1, 0x2118362C, 0x2E628F06, 0xDD1CD728,
+0xE501E400, 0x2D522742, 0x000B6EF6, 0x2FD66DF6,
+0x4F222FE6, 0xED0AEE01, 0x64E3BC86, 0xBC8B64E3,
+0x62EC7E01, 0x8BF732D7, 0xBC8EEE01, 0x64E364E3,
+0x7E01BC93, 0x32D762EC, 0x4F268BF7, 0x000B6EF6,
+0xD1186DF6, 0xD418920D, 0x72122122, 0x2422D617,
+0xD7177204, 0x72202622, 0x2722D116, 0x000B7230,
+0x137A2122, 0x00203A4A, 0x002028FE, 0x001E1015,
+0x00203A50, 0x001E1001, 0x00203A24, 0x001E1100,
+0x00203A4E, 0x00203A3C, 0x001E1000, 0x00203A40,
+0x00203A4C, 0x002027F2, 0x001E100C, 0x00203A38,
+0x00203A54, 0x00203A58, 0x00203A5C, 0x00203A60,
+0x00203A64, 0x00203A68, 0x4F222FE6, 0xD6707FFC,
+0x88016060, 0xE2018951, 0x2620BFBB, 0xD56ED16D,
+0xDE6E6010, 0x64E36552, 0x7402C840, 0x8D22D16C,
+0xD26C7502, 0xE601D76C, 0xE7042722, 0x76016255,
+0x626C2421, 0x8FF93273, 0xD4637402, 0x6242E601,
+0x640D8528, 0x67494419, 0x275D657E, 0x81E4607C,
+0xE417D562, 0x67557601, 0x3243626C, 0x8FF92171,
+0xA0207102, 0xD25E0009, 0xE601D75B, 0xE7042722,
+0x76016255, 0x626C2421, 0x8FF93273, 0xD4527402,
+0x6242E601, 0x640D8528, 0x67494419, 0x275D657E,
+0x81E4607C, 0xE417D553, 0x67557601, 0x3243626C,
+0x8FF92171, 0x92897102, 0xD2462E21, 0x5E23D74E,
+0x64F22FE2, 0x604365F2, 0x2700C980, 0xC9606043,
+0x80716103, 0xC9036043, 0x80724519, 0x65F2605C,
+0x817266F2, 0x46194629, 0x606C4529, 0x4018645C,
+0x8173304C, 0x21185E23, 0x64F22FE2, 0x6E4C62F2,
+0x602C4219, 0x66F262F2, 0x46294018, 0x461930EC,
+0x42298174, 0x652C606C, 0x305C4018, 0x81758F07,
+0x0009BC97, 0x2228620C, 0xA00A8908, 0x60130009,
+0x8B038840, 0x0009B009, 0x0009A003, 0xE202D62F,
+0x7F042622, 0x000B4F26, 0x4F226EF6, 0x8552D52A,
+0x8830600D, 0x88318903, 0xA0348923, 0x85550009,
+0xD428D727, 0x85532701, 0x610DD627, 0x24124118,
+0x460BD426, 0xD7230009, 0xD226D425, 0x6572420B,
+0xE230D120, 0x42286712, 0x2729E620, 0x37604628,
+0xD6218B03, 0xA016E200, 0xD61F2622, 0xA012E202,
+0xD1182622, 0x6212E530, 0xE6204528, 0x46282259,
+0x89083260, 0xD41AD119, 0xE601D513, 0x2160450B,
+0x472BD718, 0x4F264F26, 0x0009000B, 0x0000060A,
+0x00203A6C, 0x001E1000, 0x00203A58, 0x00203E20,
+0x00203E2C, 0x00203DC4, 0x00203A40, 0x00203DF4,
+0x00203DF2, 0x00203DC6, 0x00203A24, 0x00203A50,
+0x00203A3C, 0x00203A38, 0x002018C0, 0x00203B48,
+0x00203B4C, 0x002018D0, 0x00203A54, 0x001E100B,
+0x00203B60, 0x00114004, 0x4F222FE6, 0x84E9DE86,
+0x2448640C, 0xB17B8901, 0xD2840009, 0x26686620,
+0x60E08902, 0x2E00C9BF, 0x000B4F26, 0x000B6EF6,
+0x2FE60009, 0xDE7E4F22, 0x60E0D67E, 0xCBC0D47E,
+0x62602E00, 0xC803602C, 0x40218904, 0x70014021,
+0x6603A002, 0x66034009, 0xD678616D, 0xE500A004,
+0x75016262, 0x74042422, 0x3213625D, 0xD2748BF8,
+0x0009420B, 0xC9BF84E2, 0x4F2680E2, 0x6EF6000B,
+0x2FE62FD6, 0x7FFC4F22, 0x6260D66E, 0x89402228,
+0xD565E100, 0x60502610, 0xCB40D46B, 0x2500440B,
+0x8D052008, 0x62E06E03, 0x7104612C, 0x2F11A006,
+0xD466D65E, 0xDD666760, 0x657C4D0B, 0xE23C6D1D,
+0x8B033D27, 0xD264D463, 0x0009420B, 0x4D214D21,
+0xA005D762, 0x66E6E400, 0x357C4508, 0x74012562,
+0x35D3654D, 0xD75E8BF7, 0x6E72E003, 0x81E14018,
+0x6E7260F1, 0x81E2700C, 0xD45A6172, 0xDD5A8113,
+0x65724D0B, 0xD64AD259, 0x2212E101, 0xC93F6060,
+0x7F042600, 0x6EF64F26, 0x6DF6000B, 0x2FC62FB6,
+0x2FE62FD6, 0xD2524F22, 0x6B436E73, 0x420B6C53,
+0x20086D63, 0x64038D1C, 0xE50ED13C, 0x32526210,
+0x60C38916, 0x804124B0, 0x814160D3, 0xA007E500,
+0x655D61BC, 0x00EC6053, 0x364C6653, 0x80647501,
+0x3213625D, 0xD6308BF5, 0xC9BF6060, 0x2600A008,
+0xD239D440, 0x6EF64F26, 0x6CF66DF6, 0x6BF6422B,
+0x6EF64F26, 0x6CF66DF6, 0x6BF6000B, 0x2F962F86,
+0x2FB62FA6, 0x2FD62FC6, 0x4F222FE6, 0xE1007FC4,
+0x6513ECFF, 0x6B136CCD, 0xDE34D733, 0xEDFF64F3,
+0xD833EA04, 0x6053655C, 0x027D4000, 0x32C0622D,
+0x66038D0D, 0x09ED6063, 0x2491027D, 0x24217402,
+0x698202ED, 0x3928622D, 0x74022892, 0x75017104,
+0x6063625C, 0x07D532A2, 0x0EB58FE4, 0x2448641C,
+0xE6808905, 0x67F3E5C5, 0xBF8F666C, 0x7F3C655C,
+0x6EF64F26, 0x6CF66DF6, 0x6AF66BF6, 0x000B69F6,
+0xD11C68F6, 0x6012D21C, 0xCB20E405, 0x2102E500,
+0x000B2242, 0x00002252, 0x001E1017, 0x00203996,
+0x001E1015, 0x001E10BF, 0x00117800, 0x001E10FC,
+0x00200644, 0x0020399C, 0x00202A56, 0x00203B64,
+0x002018D0, 0x00203B80, 0x002018C0, 0x0011788C,
+0x00203998, 0x0020357C, 0x00201534, 0x001E2130,
+0x00202A18, 0x00203B88, 0x002039FC, 0x00203A04,
+0x00203DC0, 0x001C3500, 0x001D4004, 0xD564D163,
+0xE400D764, 0x2142E20F, 0x17411154, 0xD5622722,
+0x9669D762, 0x15412572, 0x96661562, 0xE6011565,
+0xD55F1165, 0x666CE6F8, 0x25422542, 0x25422542,
+0x25422542, 0x25622542, 0x7601E727, 0x67632572,
+0x25627797, 0xE7042572, 0x2572E248, 0xE2192522,
+0xE2702522, 0x25422542, 0x25422542, 0x25222542,
+0x2522E20C, 0x25422542, 0x25422542, 0x25422542,
+0x25422542, 0x000B154A, 0xE2081145, 0x0009422B,
+0x2FE62FD6, 0x7FFC4F22, 0xC8206043, 0x6E438D02,
+0x0009BE85, 0xC81060E3, 0xBE828901, 0x60E30009,
+0x8901C840, 0x0009BEA4, 0xC80160E3, 0xDD3D8938,
+0xC80260D0, 0x2F008D03, 0x460BD63B, 0x60F00009,
+0x8902C804, 0x460BD639, 0x62F00009, 0xC8806023,
+0x60D08902, 0x2D00C97F, 0xC8016023, 0xD6348906,
+0x0009460B, 0x0009A007, 0x51630601, 0x8902C808,
+0x460BD630, 0x60F00009, 0x8902C810, 0x420BD22E,
+0xD52E0009, 0x88026052, 0xD22D8B03, 0xA005E604,
+0x88012260, 0xD22A8B02, 0x2260E601, 0x2522E200,
+0xC88060E3, 0xD227892D, 0x60E36E20, 0x8902C880,
+0x420BD225, 0x60E30009, 0x8902C840, 0x420BD223,
+0x60E30009, 0x8902C802, 0x420BD221, 0x60E30009,
+0x890DC804, 0xDD20D11F, 0x0009410B, 0x0009BF11,
+0x0009BF4C, 0xD51ED41D, 0x2470E708, 0x25D2BF85,
+0xC80860E3, 0xD21B8905, 0x4F267F04, 0x422B6EF6,
+0x7F046DF6, 0x6EF64F26, 0x6DF6000B, 0x001C581C,
+0xA000A000, 0x001D0100, 0x001D4000, 0x00040021,
+0x001C589C, 0x001E1021, 0x00201A46, 0x00201A68,
+0x002020C8, 0x00201A80, 0x00201A8E, 0x00203A50,
+0x001E100B, 0x001E1028, 0x00201AFA, 0x00201B06,
+0x00201A96, 0x00201AB4, 0x12345678, 0x001E1000,
+0x0010F100, 0x00201AE2, 0x644CD6A7, 0x000B346C,
+0xD6A62450, 0x346C644C, 0x2450000B, 0x644CD6A4,
+0x000B346C, 0x625C2450, 0x4208616D, 0x42084119,
+0x42006019, 0x670E614C, 0xD49E321C, 0x4200207D,
+0x324CC90F, 0x2200000B, 0x4208625C, 0x42004208,
+0x324C644C, 0x4200D498, 0x000B324C, 0x2FE62260,
+0x614C4F12, 0x4100D493, 0x6710314C, 0xE29F666D,
+0x27294619, 0x6E536269, 0x672E6573, 0x4221227D,
+0x42214221, 0x7601662C, 0xE4014608, 0x34E84608,
+0x644C4600, 0x071A0467, 0x2150257B, 0x000B4F16,
+0x4F226EF6, 0xD2857FE8, 0x88016021, 0xD2848B7B,
+0x26686621, 0xD2838B77, 0x26686621, 0xE50F8B73,
+0xE401BFA2, 0xBFA4E501, 0xE586E400, 0xE400655C,
+0x2F50BFA4, 0xBFA1E401, 0xE602E506, 0x60634618,
+0x81F2E401, 0x6543BF9F, 0xE40185F2, 0xBFAB6543,
+0x85F26603, 0x6543E401, 0x6603BFB1, 0xE40265F0,
+0x6053756C, 0x80F8BF80, 0xBF82E402, 0x84F8E512,
+0x7090E402, 0x6503BF82, 0x4618E602, 0x81F66063,
+0xBF80E402, 0x85F6E500, 0x6603E402, 0xE500BF8C,
+0xE40285F6, 0xBF926603, 0xE5FEE500, 0xE010655C,
+0xBF61E403, 0xE5130F54, 0xE40EBF63, 0x05FCE010,
+0xBF63E40E, 0xE5007585, 0xBF64E403, 0xE500E640,
+0xBF71E403, 0xE500E640, 0xBF78E403, 0xE5FFE640,
+0xE014655C, 0xBF47E404, 0xE40F0F54, 0xE504BF49,
+0x05FCE014, 0xBF49E40F, 0xE5017584, 0xBF4AE640,
+0xE501E404, 0xBF57E640, 0xE501E404, 0xE404E640,
+0xAF5C7F18, 0x7F184F26, 0x000B4F26, 0x4F220009,
+0xD2427FF0, 0x88016021, 0xD2418B71, 0x26686621,
+0xD2408B6D, 0x26686621, 0xE50F8B69, 0xE401BF1C,
+0xBF1EE501, 0xE586E400, 0xE400655C, 0x2F50BF1E,
+0xBF1BE401, 0xE401E506, 0xBF1C6543, 0xE401E640,
+0xBF296543, 0xE401E640, 0xBF306543, 0x65F0E640,
+0x756CE402, 0xBEFF6053, 0xE40280F4, 0xE512BF01,
+0xE40284F4, 0xBF017090, 0xE6406503, 0xBF02E402,
+0xE640E500, 0xBF0FE402, 0xE640E500, 0xBF16E402,
+0xE5FEE500, 0x6053655C, 0xBEE5E403, 0xE51380F8,
+0xE40EBEE7, 0xE40E84F8, 0xBEE77085, 0xE5006503,
+0xBEE8E640, 0xE500E403, 0xBEF5E640, 0xE500E403,
+0xBEFCE640, 0xE5FFE403, 0x6053655C, 0xBECBE404,
+0xE40F80FC, 0xE504BECD, 0xE40F84FC, 0xBECD7083,
+0xE5016503, 0xBECEE640, 0xE501E404, 0xBEDBE640,
+0xE501E404, 0xE404E640, 0xAEE07F10, 0x7F104F26,
+0x000B4F26, 0x00000009, 0x001E102F, 0x001E1080,
+0x001E1090, 0x001E103F, 0x001E103E, 0x00203A4A,
+0x00203A4C, 0x00203A4E, 0xD21DD11C, 0x66206010,
+0x676C7001, 0x3700C90F, 0xE5008D13, 0x67106210,
+0x7701622C, 0x64232170, 0xD6166010, 0x44084408,
+0x3428C90F, 0x62602100, 0x7201D513, 0x44082620,
+0x000B354C, 0xD10F6053, 0x25586510, 0xE6008D13,
+0xD60DD40B, 0x655C6540, 0x47086753, 0x37584708,
+0x47086540, 0x24507501, 0x367C6040, 0x2400C90F,
+0x72FF6210, 0x000B2120, 0x00006063, 0x00203995,
+0x00203994, 0x00203996, 0x002035BC, 0x7FFC4F22,
+0xE680D1A8, 0x666C6212, 0xD2A72F22, 0x67F36563,
+0x420B7542, 0x7F04E404, 0x000B4F26, 0xE6800009,
+0xD2A1666C, 0xE7006563, 0x422B7540, 0xE6806473,
+0xD29D666C, 0xE7006563, 0x422B7543, 0x2F866473,
+0x2FA62F96, 0x2FC62FB6, 0x2FE62FD6, 0x7FC04F22,
+0xDB97D296, 0x72012F22, 0xD1961F21, 0x66125211,
+0x8B013620, 0x0009A0F9, 0xC9036061, 0x8B018801,
+0x0009A0F3, 0xD290DC8F, 0x64C3420B, 0x6503D18F,
+0x60111F02, 0x8B048801, 0x420BD28D, 0xAFE464C3,
+0x54530009, 0x844CEE84, 0x890130E0, 0x0009A0C3,
+0x6610D188, 0x6023626C, 0x8B718801, 0x6210D186,
+0x89662228, 0xDA86D285, 0xE0036122, 0x64221112,
+0x4018D881, 0xDD83E500, 0x814167A3, 0x77042850,
+0x647266A2, 0x6ED3D580, 0x1F457E04, 0x65521F56,
+0x64E368D2, 0x1F8874F8, 0x684369E2, 0x1F637894,
+0x1F991F74, 0x62826142, 0xD779D978, 0x1F2BD679,
+0x67726292, 0x1F1A6062, 0x2602CB20, 0xD176E600,
+0xE5401F57, 0x1F7D1F2C, 0x76011F1E, 0x3253626D,
+0x51F38BFB, 0x52F555F4, 0x25222A12, 0x55F757F6,
+0x27525AF8, 0x5DF92DA2, 0x2ED251FB, 0xD56B5EFA,
+0x54FC24E2, 0x281257FD, 0xD160D869, 0x25722942,
+0x69126782, 0x1974D866, 0xDD666A12, 0x56FE60A1,
+0x2A01CB01, 0xDA646412, 0xE9012842, 0x4A0B2D42,
+0x52FE2692, 0xD661EE01, 0x22E24E18, 0x72016262,
+0x60B22622, 0xCB01D14F, 0x2B02E202, 0x2120A03F,
+0x8B3C2228, 0xE601D55A, 0x2160E700, 0xE01C2572,
+0xC801004C, 0xD8578B0C, 0x1F8FD257, 0xE6002822,
+0x7601E57D, 0x3253626C, 0x56FF8BFB, 0x2622D253,
+0xE2FE69B2, 0x2B922929, 0x0A4CE01E, 0xE01F65F2,
+0x014C25A0, 0x741057F1, 0xEA062710, 0xDD4CE600,
+0x8446DE4C, 0x2D007601, 0x696C6844, 0x2E8039A3,
+0x8FF67E01, 0xDE487D01, 0x2EA0EA94, 0xE1007E01,
+0x7E0F2E10, 0xD12FE205, 0x64102E20, 0x6023624C,
+0x89088801, 0x55F2D22A, 0x64C3420B, 0xEE01D132,
+0xAF1A4E18, 0x55F221E2, 0x8553D13C, 0x620D6612,
+0x89063262, 0xD63BD43A, 0xE801460B, 0xAF0CD73A,
+0xD91F2782, 0x64C3490B, 0xEE01D127, 0xDA38D437,
+0x4A0B4E18, 0xAF0021E2, 0x7F400009, 0x6EF64F26,
+0x6CF66DF6, 0x6AF66BF6, 0x000B69F6, 0x4F2268F6,
+0x85467FF4, 0x2F01E681, 0x666C8547, 0x854881F1,
+0x81F2D209, 0x67F38542, 0x854381F3, 0x81F4E40C,
+0x65636053, 0x420B81F5, 0x7F0C7540, 0x000B4F26,
+0x00000009, 0x001C3D9C, 0x002023FC, 0x0011779A,
+0x001C36F8, 0x002035B4, 0x002014A6, 0x00203A16,
+0x002014D0, 0x002039A5, 0x002039A4, 0x002039A0,
+0x001C3B9C, 0x001C3704, 0x001C3D98, 0x001C3BB4,
+0x001C5960, 0x001C3500, 0x001C3D30, 0x001C8960,
+0x0020358C, 0x001C3D00, 0x00201610, 0x00117730,
+0x002039A8, 0x001C582C, 0x2000A000, 0x0000A000,
+0x0011778C, 0x00117792, 0x00117788, 0x0020397C,
+0x0020357C, 0x00201534, 0x001E2130, 0x00203DA0,
+0x002018C0, 0x2F962F86, 0x2FB62FA6, 0x2FD62FC6,
+0x4F222FE6, 0xD19B7FEC, 0x2F12E000, 0x6103D49A,
+0x1F4281F2, 0xDD9ADA99, 0xD69A6813, 0xE0014808,
+0x460BDE99, 0x38EC4800, 0x65A21F03, 0x352052A1,
+0xA23E8B01, 0x60510009, 0x8801C903, 0xA2388B01,
+0x52530009, 0x32E0DE91, 0xD9918B10, 0x64A3490B,
+0x4B0BDB90, 0xDE906403, 0xD791D690, 0xEC01D591,
+0x2E02E100, 0x271026C0, 0x2502AFDF, 0xC8018551,
+0xA1578B01, 0x62510009, 0x4200622D, 0x5E53366A,
+0x85E2226D, 0xC903642C, 0x85E36603, 0x6053650D,
+0x40214021, 0x4500C93F, 0x322A6703, 0x6053252D,
+0xC901D17F, 0x60106C03, 0x8801D97F, 0xDB7F8B05,
+0x2120E200, 0xCB0160B2, 0xD17D2B02, 0x88016011,
+0x65A28B0A, 0x8D042448, 0x9B9E6251, 0xA00322B9,
+0x919B2521, 0x2521221B, 0x37B3EB10, 0x2448895E,
+0xD4738B07, 0x22286241, 0x60638903, 0xA05781F8,
+0xD5706473, 0x46084608, 0x85E26273, 0x46006B50,
+0x362C4200, 0x2BB8C910, 0x8F1F6463, 0x26686603,
+0xD2698911, 0x062D6043, 0x4119616D, 0x6B0E6019,
+0x81F820BD, 0x880160C3, 0x646C8F2C, 0x880F6073,
+0xA0278B1B, 0xD2610009, 0x052D6043, 0x4119615D,
+0x670E6019, 0x645C207D, 0x81F8A01C, 0x890F2668,
+0x6043D25B, 0x6B5D052D, 0x60B94B19, 0x201D610E,
+0x60C381F8, 0x8F0D8801, 0x6473645C, 0xEC00A00A,
+0x6043D254, 0x625D052D, 0x60294219, 0x207D670E,
+0x81F8645C, 0x880285F8, 0x85E1890A, 0x8D07C820,
+0xE6DC6203, 0x60232269, 0x81E1A002, 0x644CE4FF,
+0x6210D149, 0x89012228, 0x644CE4FF, 0x654DEBFF,
+0x35B06BBC, 0xDB368B2B, 0x64A34B0B, 0x410BD135,
+0x54036403, 0x85446E03, 0xC948DB40, 0xDC408808,
+0xBEAC8B01, 0x64B3E502, 0x65E34C0B, 0xDB3DEC01,
+0xD13D2DC2, 0x621260B2, 0x72017001, 0x21228805,
+0x2B028F08, 0x666CE680, 0x6563D238, 0x7549E700,
+0x6473420B, 0xA030D436, 0x7FFF0009, 0x85E28000,
+0x20B9EBFC, 0x610381E2, 0x942A85E3, 0x62032049,
+0x450885F8, 0x81E2201B, 0xC90160C3, 0x40084018,
+0x40084008, 0x4000225B, 0x6023220B, 0x85E481E3,
+0x4118E108, 0x81E4201B, 0xE40262A2, 0x20B98521,
+0x67A28121, 0xCB016071, 0x85F82701, 0x89033042,
+0xECE785E2, 0x81E220C9, 0x490BD41E, 0xA03B0009,
+0x7E030009, 0x001C3D30, 0x00203DAC, 0x0020358C,
+0x001E212C, 0x00203470, 0x001C3D00, 0x00117780,
+0x002014A6, 0x00201670, 0x0011770C, 0x002039A4,
+0x002039A5, 0x002039A0, 0x002018C0, 0x001C36F8,
+0x00203A1A, 0x00203DBC, 0x00203BA0, 0x00203C20,
+0x00203CA0, 0x00203D20, 0x00203990, 0x00203584,
+0x002014D0, 0x00203A1C, 0x00203A20, 0x002023FC,
+0x00203DA4, 0x00203DA8, 0x602262F2, 0x40094019,
+0xC90F4009, 0x8B0B880A, 0x60E2DE8C, 0x40094019,
+0xC90F4009, 0x8B038808, 0xCB0160A2, 0x2802A006,
+0x65E2DE87, 0x2E527501, 0x286266A2, 0x52F366F2,
+0x2622AE83, 0xD2838551, 0xDE83C802, 0xA0958B01,
+0x420B0009, 0x4E0B64A3, 0x5E036403, 0x85E46503,
+0x4918E908, 0xD77D209B, 0xE04C81E4, 0xDC7C0B7E,
+0x7B01D97C, 0x61C207B6, 0x71016690, 0x8D062668,
+0xD4792C12, 0x420BD279, 0xA070EB01, 0x62512DB2,
+0x4B18EB0F, 0x22B9E102, 0x32104118, 0x85518B0F,
+0x2029E2FC, 0x60518151, 0xCB0172E0, 0x85E12501,
+0x202994A3, 0x85E481E1, 0xA0522049, 0x675181E4,
+0x4719677D, 0x667E6779, 0x7701276D, 0x6903607C,
+0x88014918, 0x25918F3E, 0x6B12D161, 0x21B27B01,
+0x660D85E3, 0x40216063, 0xC93F4021, 0x6C034600,
+0x262D322A, 0xC8016063, 0xDB5ED15D, 0x967D8901,
+0xE6002C6B, 0x666C67CD, 0x40006063, 0x622D021D,
+0x8D0E3270, 0x60436403, 0xE9FF021D, 0x8B013290,
+0x01C5A007, 0x626C7601, 0x3292E904, 0x646C8BEB,
+0x60434400, 0xD15004BD, 0x0B457401, 0x669D6911,
+0x89073670, 0x602D6211, 0x890388FF, 0xE201DB4B,
+0x2B2021C1, 0xECFC8551, 0x815120C9, 0xCB016051,
+0xDC472501, 0x64A34C0B, 0x51F366F2, 0x85EF2612,
+0x54F2D244, 0x650D420B, 0x0009ADE7, 0xE500DC42,
+0x420B2C52, 0x4E0B64A3, 0x54036403, 0x85446E03,
+0x6703E908, 0x65034918, 0x27998541, 0xDB323790,
+0x8F0BD932, 0x6013610D, 0x8B07C820, 0xC9486053,
+0x8B038808, 0xE501BD4B, 0x0009A005, 0x2128D233,
+0xBD448901, 0x64B3E500, 0x490B65E3, 0xADBCEC01,
+0x85F22DC2, 0x7001EE04, 0x31E7610D, 0x8D0281F2,
+0xADA97A08, 0x7F140009, 0x6EF64F26, 0x6CF66DF6,
+0x6AF66BF6, 0x000B69F6, 0xF7FF68F6, 0x2FE68000,
+0xD2234F22, 0x60E36E22, 0x8D02C840, 0xBBE522E2,
+0xE2400009, 0x2E284218, 0xBBF08901, 0x60E30009,
+0x8905C810, 0xD21CD41B, 0x0009420B, 0x0009BBEF,
+0xC80560E3, 0xBD6D8901, 0x60E30009, 0x8902C802,
+0xABEC4F26, 0x4F266EF6, 0x6EF6000B, 0x001C3D3C,
+0x00117760, 0x002014A6, 0x00201670, 0x0020351C,
+0x00203DC0, 0x00203990, 0x00203584, 0x002014D0,
+0x002039FC, 0x00203A04, 0x002039F8, 0x002039FA,
+0x00201534, 0x002018D0, 0x00203A1C, 0x00008000,
+0x001C3510, 0x00203DB4, 0x002018C0, 0x89014F22,
+0x611B600B, 0x611BB00A, 0x000B4F26, 0x600B600B,
+0x611BA004, 0x8DF12107, 0x8BF84011, 0x620D2F26,
+0x8F3E3020, 0x40180019, 0x8B0B3016, 0x31043104,
+0x31043104, 0x31043104, 0x31043104, 0x412462F6,
+0x601C000B, 0x41296219, 0x20084018, 0x31048926,
+0x31043104, 0x31043104, 0x31043104, 0x31043104,
+0x31043104, 0x31043104, 0x31043104, 0x61193104,
+0x3204221D, 0x32043204, 0x32043204, 0x32043204,
+0x32043204, 0x32043204, 0x32043204, 0x32043204,
+0x212D3204, 0x601962F6, 0x4024000B, 0x000BE000,
+0x621362F6, 0x41294228, 0x31044224, 0x31044224,
+0x31044224, 0x31044224, 0x31044224, 0x31044224,
+0x31044224, 0x31044224, 0x31044224, 0x31044224,
+0x31044224, 0x31044224, 0x31044224, 0x31044224,
+0x31044224, 0x31044224, 0x602D4224, 0x62F6000B,
+0x080A0C0E, 0x00020406, 0x1A1C1E20, 0x12141618,
+0x2E303234, 0x26282A2C, 0x3A3C3E40, 0x6C625648,
+0x41112F26, 0xE2208F18, 0x890B3123, 0x321CD204,
+0xD1026220, 0x412B312C, 0x00090009, 0x0020349A,
+0x00203450, 0x000BE000, 0x400062F6, 0x40004000,
+0x40004000, 0x40004000, 0x62F6000B, 0x40004000,
+0x40004000, 0x40004000, 0x40184000, 0x62F6000B,
+0x40004000, 0x40004000, 0x40004000, 0x40284000,
+0x62F6000B, 0x40004000, 0x40184000, 0x000B4028,
+0xC90F62F6, 0x40054005, 0x40054005, 0x62F6000B,
+0x4005C907, 0x40054005, 0x62F6000B, 0x4005C903,
+0x000B4005, 0xC90162F6, 0x000B4005, 0x000062F6,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x42707372,
+0x3D206675, 0x554E203D, 0x202C4C4C, 0x6E49677A,
+0x4E497274, 0x6D754E51, 0x0000003D, 0x61766E49,
+0x2064696C, 0x72657375, 0x20726F20, 0x2079656B,
+0x00214449, 0x6E6B6E55, 0x206E776F, 0x6D6D6F63,
+0x3D646E61, 0x00000000, 0x203A3051, 0x00000020,
+0x203A3151, 0x00000020, 0x203A3251, 0x00000020,
+0x203A3351, 0x00000020, 0x203A3451, 0x00000020,
+0x2B434741, 0x73696F4E, 0x61432065, 0x7262696C,
+0x6F697461, 0x6166206E, 0x6F206C69, 0x6974206E,
+0x0D0A656D, 0x00000000, 0x00000072, 0x00205220,
+0x62735576, 0x7473725F, 0x00000A0D, 0x62735576,
+0x7375735F, 0x646E6570, 0x00000A0D, 0x62735576,
+0x7365725F, 0x000A0D6D, 0x00000044, 0x44387570,
+0x72637365, 0x6F747069, 0x3D584572, 0x00000000,
+0x00000047, 0x72746E49, 0x6D652051, 0x2C797470,
+0x49677A20, 0x4972746E, 0x754E514E, 0x00003D6D,
+0x654C7245, 0x0000006E, 0x20746F4E, 0x756F6E65,
+0x49206867, 0x4220514E, 0x0A0D6675, 0x00000000,
+0x000000FF, 0x00020001, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x010E010D, 0x00020003, 0x01090108, 0x0002010A,
+0x02000003, 0x02020201, 0x02040203, 0x02060205,
+0x02020200, 0x02040203, 0x020C020B, 0x020E020D,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x000000FF, 0x00020001, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x010E010D, 0x00020003, 0x01090108, 0x0002010A,
+0x00030003, 0x02020201, 0x02040203, 0x02060205,
+0x02020200, 0x02040203, 0x020C020B, 0x020E020D,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x010E010D, 0x00FF010F, 0x01090108, 0x010B010A,
+0x0200010F, 0x02020201, 0x02040203, 0x02060205,
+0x02020200, 0x02040203, 0x020C020B, 0x020E020D,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x010E010D, 0x00FF010F, 0x01090108, 0x010B010A,
+0x010F010F, 0x02020201, 0x02040203, 0x02060205,
+0x02020200, 0x02040203, 0x020C020B, 0x020E020D,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00205220, 0x00000046, 0x00000059, 0x73204142,
+0x003D7165, 0x49544120, 0x0000204D, 0x00000000,
+0x00000000, 0x002E0209, 0x80000101, 0x000409FA,
+0x00FF0400, 0x05070000, 0x02000201, 0x82050700,
+0x00020002, 0x03830507, 0x07010040, 0x40030405,
+0x02090100, 0x0101002E, 0x09FA8000, 0x04000004,
+0x000000FF, 0x02010507, 0x07000040, 0x40028205,
+0x05070000, 0x00400383, 0x04050701, 0x00004002,
+0x00000000, 0x00000000, 0x07090000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x6621D2A8, 0x2008606D, 0xA1B18B01, 0x88100009,
+0x88118922, 0x88128920, 0x8813891E, 0x8821891C,
+0x8822891A, 0x883A8918, 0x883B8916, 0xE6448914,
+0x30604608, 0xE6488910, 0x30604608, 0xE658890C,
+0x30604608, 0x963D8908, 0x89053060, 0x3060963B,
+0x96398902, 0x8B013060, 0xE010000B, 0x8B018820,
+0xE020000B, 0x892B8837, 0x89298832, 0x89278835,
+0x89258836, 0x89238830, 0x89218838, 0x891F8839,
+0x891D8834, 0x891B8833, 0x4608E64C, 0x89173060,
+0x3060961B, 0x96198914, 0x89113060, 0x30609617,
+0x9615890E, 0x890B3060, 0x30609613, 0x96118908,
+0x89053060, 0x3060960F, 0x960D8902, 0x8B0C3060,
+0xE030000B, 0x05100165, 0x02300A10, 0x04300330,
+0x06300530, 0x0B300A30, 0x88400C30, 0xA1428B01,
+0x88410009, 0xA13E8B01, 0x88430009, 0xA13A8B01,
+0x88480009, 0xA1368B01, 0x884A0009, 0xA1328B01,
+0x884B0009, 0xA12E8B01, 0x884C0009, 0xA12A8B01,
+0xE6800009, 0x3060666C, 0xA1248B01, 0xE6810009,
+0x3060666C, 0xA11E8B01, 0xE6820009, 0x3060666C,
+0xA1188B01, 0xE6830009, 0x3060666C, 0xA1128B01,
+0xE6840009, 0x3060666C, 0xA10C8B01, 0xE6850009,
+0x3060666C, 0xA1068B01, 0xE6860009, 0x3060666C,
+0xA1008B01, 0xE6870009, 0x3060666C, 0xA0FA8B01,
+0xE6880009, 0x3060666C, 0xA0F48B01, 0xE6890009,
+0x3060666C, 0xA0EE8B01, 0xE68A0009, 0x3060666C,
+0xA0E88B01, 0xE68B0009, 0x3060666C, 0xA0E28B01,
+0xE68C0009, 0x3060666C, 0xA0DC8B01, 0xE68D0009,
+0x3060666C, 0xA0D68B01, 0xE68E0009, 0x3060666C,
+0xA0D08B01, 0xE68F0009, 0x3060666C, 0xA0CA8B01,
+0xE6900009, 0x3060666C, 0xA0C48B01, 0xE6910009,
+0x3060666C, 0xA0BE8B01, 0xE6F80009, 0x3060666C,
+0xA0B88B01, 0xE6F90009, 0x3060666C, 0xA0B28B01,
+0xE6FA0009, 0x3060666C, 0xA0AC8B01, 0xE6FB0009,
+0x3060666C, 0xA0A68B01, 0xE6FC0009, 0x3060666C,
+0xA0A08B01, 0xE6FD0009, 0x3060666C, 0xA09A8B01,
+0xE6FE0009, 0x3060666C, 0xA0948B01, 0xE6FF0009,
+0x3060666C, 0xA08E8B01, 0xE6D00009, 0x3060666C,
+0xA0888B01, 0xE6D10009, 0x3060666C, 0xA0828B01,
+0xE6D20009, 0x3060666C, 0xA07C8B01, 0xE6D30009,
+0x3060666C, 0xE6D48977, 0x3060666C, 0xE6D58973,
+0x3060666C, 0xE6D6896F, 0x3060666C, 0xE6D7896B,
+0x3060666C, 0xE6D88967, 0x3060666C, 0xA0038963,
+0x00000009, 0x00114000, 0x666CE6D9, 0x895A3060,
+0x666CE6DA, 0x89563060, 0x666CE6DB, 0x89523060,
+0x666CE6DC, 0x894E3060, 0x666CE6DD, 0x894A3060,
+0x666CE6F0, 0x89463060, 0x666CE6F1, 0x89423060,
+0x666CE6F2, 0x893E3060, 0x666CE6F3, 0x893A3060,
+0x666CE6F4, 0x89363060, 0x666CE6F5, 0x89323060,
+0x666CE6F6, 0x892E3060, 0x666CE6F7, 0x892A3060,
+0x4608E650, 0x89263060, 0x3060969A, 0x96988923,
+0x89203060, 0x30609696, 0x9694891D, 0x891A3060,
+0x30609692, 0x96908917, 0x89143060, 0x3060968E,
+0x968C8911, 0x890E3060, 0x3060968A, 0x9688890B,
+0x89083060, 0x30609686, 0x96848905, 0x89023060,
+0x30609682, 0x000B8B01, 0xE0FFE040, 0x600C000B,
+0xE000000B, 0x6243D157, 0xE4028512, 0x662D670D,
+0xE500A00E, 0x6053655D, 0x305C4000, 0x4008D152,
+0x622D021D, 0x8B023260, 0xA0047108, 0x7501041C,
+0x3273625D, 0x60438BEE, 0xC90A000B, 0x674C76FE,
+0x025C606C, 0x3723622C, 0x20088906, 0x70FF8902,
+0x6603AFF6, 0xE000000B, 0x0009000B, 0x4F124F22,
+0x326052F2, 0x34508910, 0x3470890E, 0x3750890D,
+0x3268890A, 0x04273458, 0x60733758, 0x440BD43B,
+0x306C011A, 0x6203A001, 0x4F166263, 0x000B4F26,
+0x2FE66023, 0x4F124F22, 0x6E434F02, 0x614C54F4,
+0x2F164118, 0x666C677C, 0x64EC655C, 0x46184718,
+0xBFD34518, 0x65034418, 0x60537F04, 0xC980E702,
+0x6E034718, 0x37ED4728, 0x62594519, 0x010A652E,
+0x312C225D, 0x4F06601C, 0x4F264F16, 0x6EF6000B,
+0x03400240, 0x05400440, 0x07400640, 0x09400840,
+0x11400B40, 0x0A401240, 0x4F220A50, 0x614C8451,
+0x3127620C, 0xA00C8901, 0x8452E400, 0x3127620C,
+0xA0068901, 0x8453E401, 0x3127620C, 0xE4038D01,
+0x6263E402, 0x60437201, 0x677C072C, 0x62532F76,
+0x072C7201, 0x055C066C, 0x666C677C, 0xBFA8655C,
+0x7F046413, 0x000B4F26, 0x605C600C, 0x8F068801,
+0x606C6243, 0x8B018801, 0x720AA001, 0x000B72F6,
+0x00006023, 0x00114000, 0x00114008, 0x00203374,
+0xE040D690, 0x056E614C, 0x9274D78F, 0x352C357C,
+0xE400E718, 0x626C6650, 0x89043120, 0x624C7401,
+0x8FF73273, 0x000B7501, 0xE2FF6043, 0x622C644C,
+0x890D3420, 0x8801605C, 0x965D8B03, 0xA005346C,
+0x62436243, 0x324C4208, 0x326C9657, 0x6023000B,
+0x6043000B, 0x2F962F86, 0x2FB62FA6, 0x2FD62FC6,
+0x4F222FE6, 0x92497FF4, 0x6B533526, 0x00296943,
+0xE13FCA01, 0x6E03EAFF, 0x6AAC2F10, 0x6D43EC00,
+0x62D0E808, 0x34A0642C, 0xBFCE8939, 0x3B0065E3,
+0x6CCC8F0A, 0x420062C3, 0x362C6693, 0x1FC18461,
+0x4109610C, 0x2F10A02D, 0x891C2CC8, 0x65E364D0,
+0x644CBFBB, 0x89163B02, 0x70FF60C3, 0x049C4000,
+0x644C65E3, 0x1F02BFB1, 0x8D1A30B2, 0x56F21FC1,
+0x356C6593, 0xC9038451, 0x89122008, 0x660C8451,
+0xA00E4609, 0x7C012F60, 0x328362CC, 0x8FC87D02,
+0xA0061F21, 0x06250009, 0x12C008FC, 0x62CC09B4,
+0x50F11F21, 0x8B128808, 0x7CFF6CCC, 0x60C34C00,
+0x65E3049C, 0x644CBF89, 0x8B083B06, 0x849139CC,
+0x2008C903, 0x84918903, 0x4209620C, 0x60F02F20,
+0x4F267F0C, 0x6DF66EF6, 0x6BF66CF6, 0x69F66AF6,
+0x68F6000B, 0x2F962F86, 0x2FB62FA6, 0x2FD62FC6,
+0x4F222FE6, 0x92727FFC, 0x3426E100, 0x6B436953,
+0x2F12666C, 0xCA010029, 0x8D032668, 0xE2F06E03,
+0x2F22622C, 0x6AACEAFF, 0x6C93ED00, 0x66C0E808,
+0x34A0646C, 0xBF508913, 0x3B0065E3, 0x6DDC8B0A,
+0x39DC4D00, 0xC9038491, 0x8B082008, 0xCB0F60F2,
+0x2F02A005, 0x62DC7D01, 0x8FE83283, 0x60F27C02,
+0x4F267F04, 0x6DF66EF6, 0x6BF66CF6, 0x69F66AF6,
+0x68F6000B, 0x2F962F86, 0x2FB62FA6, 0x2FD62FC6,
+0x4F222FE6, 0x4F024F12, 0x3F3C9332, 0x4308E35B,
+0x605333FC, 0x80341351, 0xE7606063, 0x80381362,
+0x4708E012, 0xE03F8136, 0xD11237FC, 0x27008138,
+0x80788074, 0xE9166053, 0x60638012, 0x21414918,
+0x6B938013, 0xEDFF6AB4, 0x6AAC61B0, 0x6C1C4A18,
+0x68C82CAB, 0x6DDD688D, 0x234238D0, 0x8B131398,
+0xD207D406, 0x0009420B, 0x432BD306, 0x09B40009,
+0x0000FE10, 0x001142D8, 0x000DDD00, 0x001160B0,
+0x002018C0, 0x00115E88, 0x342292E3, 0x8F02E100,
+0xA1616593, 0x92DD0009, 0x352CE7FF, 0xEE04677C,
+0x622C6250, 0x89043270, 0x621C7101, 0x8FF732E3,
+0xE8FC7501, 0x3488688C, 0x9ACBE064, 0x40086893,
+0x0F4438AC, 0x661C6583, 0x644CBE18, 0x64E36E0C,
+0x65E37401, 0x45086643, 0x35EC4608, 0x4508364C,
+0x45004608, 0x369C4600, 0x61A39AB5, 0xE0656763,
+0x400837AC, 0x62637114, 0x321C0F76, 0x94AB7004,
+0x61430F26, 0x359C6263, 0x7004324C, 0x0F267114,
+0x7004361C, 0x0F666753, 0x700437AC, 0x7A140F76,
+0x37AC6753, 0x66537004, 0x364C0F76, 0x74147004,
+0x354C0F66, 0x0F567004, 0x395C958F, 0xED006A93,
+0x6BD3E956, 0xEC054908, 0x4008E065, 0x60B302FE,
+0x644C042C, 0x60E32F46, 0xE06A07AC, 0x01FE4008,
+0x061C60B3, 0x058C60E3, 0x4008E065, 0x677C01FC,
+0x655C666C, 0x641CBDED, 0x7F046403, 0x60D36DDC,
+0xE0660F44, 0x04FE4008, 0x054C60B3, 0x2F56655C,
+0x07AC60E3, 0x4008E06B, 0x60B301FE, 0x60E3061C,
+0xE065058C, 0x01FC4008, 0x666C677C, 0xBDD0655C,
+0x6403641C, 0x65F37F04, 0x60D37510, 0xE0650544,
+0x07FE4008, 0x057C60C3, 0x2F56655C, 0x07AC60E3,
+0x4008E06A, 0x60C301FE, 0x60E3061C, 0xE065058C,
+0x01FC4008, 0x666C677C, 0xBDB2655C, 0x6403641C,
+0x61F37F04, 0x60D37120, 0xE0660144, 0x02FE4008,
+0x052C60C3, 0x2F56655C, 0x07AC60E3, 0x4008E06B,
+0x60C301FE, 0x60E3061C, 0xE065058C, 0x01FC4008,
+0x666C677C, 0xBD94655C, 0x6503641C, 0x64F37F04,
+0x60D3349C, 0xE0670454, 0x07FE4008, 0x057C60B3,
+0x2F56655C, 0x07AC60E3, 0x4008E06C, 0xA00501FE,
+0x0BB860B3, 0x03C2013E, 0x013F0462, 0x60E3061C,
+0xE065058C, 0x01FC4008, 0x666C677C, 0xBD70655C,
+0x6203641C, 0xE1B87F04, 0x64F3611C, 0x60D3341C,
+0xE0680424, 0x05FE4008, 0x075C60B3, 0x2F76677C,
+0x07AC60E3, 0x4008E06D, 0x60B301FE, 0x60E3061C,
+0xE065058C, 0x02FC4008, 0x666C677C, 0xBD50655C,
+0x6703642C, 0xE2C07F04, 0x66F3622C, 0x60D3362C,
+0xE0670674, 0x07FE4008, 0x027C60C3, 0x2F26622C,
+0x07AC60E3, 0x4008E06C, 0x60C302FE, 0x60E3062C,
+0xE065058C, 0x02FC4008, 0x666C677C, 0xBD30655C,
+0x6203642C, 0xE7C87F04, 0x66F3677C, 0x60D3367C,
+0xE0680624, 0x06FE4008, 0x026C60C3, 0x2F26622C,
+0x07AC60E3, 0x4008E06D, 0x60C302FE, 0x60E3062C,
+0xE065058C, 0x02FC4008, 0x666C677C, 0xBD10655C,
+0x6103642C, 0x66937F04, 0x62F37608, 0x60D3326C,
+0x02147D01, 0xE60562DC, 0x7C013263, 0x7B018D02,
+0x0009AEFA, 0x0009A17B, 0xE7FF9BD5, 0x677C35BC,
+0x6250EE08, 0x3270622C, 0x71018904, 0x32E3621C,
+0x75018FF7, 0xDDD89CC8, 0x3D4534C8, 0x4008E064,
+0x4E090E0A, 0x0FE46593, 0x702435BC, 0x64EC661C,
+0x0F56BCB4, 0x64E36E0C, 0x65E37401, 0x45086243,
+0x35EC4208, 0x4508324C, 0x45004208, 0x329C4200,
+0x61B37B0C, 0x38BC6823, 0x7114E06E, 0x40086B23,
+0x91A23B1C, 0x70040F86, 0x68236413, 0x0FB6359C,
+0x7004381C, 0x0F867414, 0x7004342C, 0x67539896,
+0x0F466253, 0x7004378C, 0x6B537814, 0x7114321C,
+0x3B8C0F76, 0x351C7004, 0x0FB69789, 0x397C7004,
+0x70040F26, 0xED006893, 0x0F56EC05, 0x6AD3E956,
+0xE06E4908, 0x02FE4008, 0x012C60A3, 0x2F16611C,
+0x078C60E3, 0x4008E073, 0x60A304FE, 0xE06E064C,
+0x0BFE4008, 0x05BC60E3, 0x4008E065, 0x677C01FC,
+0x655C666C, 0x641CBC85, 0x7F046403, 0x60D36DDC,
+0xE06F0F44, 0x04FE4008, 0x054C60A3, 0x2F56655C,
+0x078C60E3, 0x4008E074, 0x60A30BFE, 0xE06E06BC,
+0x0BFE4008, 0x05BC60E3, 0x4008E065, 0x677C01FC,
+0x655C666C, 0x641CBC65, 0x7F046403, 0x751065F3,
+0x054460D3, 0x4008E06E, 0x60C307FE, 0x655C057C,
+0x60E32F56, 0xE073078C, 0x0BFE4008, 0x06BC60C3,
+0x4008E06E, 0x60E301FE, 0xE065051C, 0x0BFC4008,
+0x666C677C, 0xBC44655C, 0x610364BC, 0x6BF37F04,
+0x60D37B20, 0xE06F0B14, 0x01FE4008, 0x041C60C3,
+0x2F46644C, 0x078C60E3, 0x4008E074, 0x60C301FE,
+0xE06E061C, 0x0BFE4008, 0x05BC60E3, 0x4008E065,
+0xA00501FC, 0x0136677C, 0x028212C0, 0x01370142,
+0x655C666C, 0x641CBC1D, 0x7F046203, 0x349C64F3,
+0x042460D3, 0x4008E070, 0x60A304FE, 0x655C054C,
+0x60E32F56, 0xE075078C, 0x0BFE4008, 0x06BC60A3,
+0x4008E06E, 0x60E301FE, 0xE065051C, 0x0BFC4008,
+0x666C677C, 0xBBFC655C, 0x610364BC, 0xEBB87F04,
+0x65F36BBC, 0x60D335BC, 0xE0710514, 0x07FE4008,
+0x047C60A3, 0x2F46644C, 0x078C60E3, 0x4008E076,
+0x60A30BFE, 0xE06E06BC, 0x01FE4008, 0x051C60E3,
+0x4008E065, 0x677C0BFC, 0x655C666C, 0x64BCBBD9,
+0x7F046103, 0x622CE2C0, 0x3B2C6BF3, 0x0B1460D3,
+0x4008E070, 0x60C302FE, 0x677C072C, 0x60E32F76,
+0xE075078C, 0x02FE4008, 0x062C60C3, 0x4008E06E,
+0x60E302FE, 0xE065052C, 0x02FC4008, 0x666C677C,
+0xBBB6655C, 0x6703642C, 0xEBC87F04, 0x66F36BBC,
+0x60D336BC, 0xE0710674, 0x06FE4008, 0x026C60C3,
+0x2F26622C, 0x078C60E3, 0x4008E076, 0x60C302FE,
+0xE06E062C, 0x02FE4008, 0x052C60E3, 0x4008E065,
+0x677C02FC, 0x655C666C, 0x642CBB93, 0x7F046103,
+0x72086293, 0x362C66F3, 0x7D0160D3, 0x62DC0614,
+0x3263E605, 0x8D027C01, 0xAEE27A01, 0x6EF30009,
+0xE2B068F3, 0x6AF3E05A, 0x389C7E18, 0x69F3622C,
+0x7A084008, 0x67F36DF3, 0x392C61F3, 0x6CA30FE6,
+0x77207D10, 0xE4007128, 0xEB0565F3, 0x604C6654,
+0x66D4626C, 0x2E604221, 0x048C6674, 0x626C2C20,
+0x09444221, 0x21207001, 0x32B3620C, 0x71016403,
+0x8FEB7E01, 0xE05A7C01, 0x6EF34008, 0x7E300BFE,
+0xEC19ED00, 0x66B365A3, 0xBB7E64DC, 0x62DC7D01,
+0x2E0032C3, 0x7E018FF6, 0x666CE6B0, 0x6BF36EF3,
+0x7B283E6C, 0xEC4CA010, 0xCCCCCCCD, 0x64D36DDC,
+0x644C74F4, 0xBB6865B3, 0x67F366E3, 0x77306503,
+0x075460D3, 0x62DC7D01, 0x8BEF32C3, 0x7B306BF3,
+0x61B367B3, 0xED8064B3, 0x71027701, 0x6DDC7403,
+0xDC37E500, 0x605CDE37, 0x091C084C, 0x0A7C668C,
+0x699C4628, 0x49284618, 0x05BC6AAC, 0x4A18269B,
+0x70046803, 0x655C26AB, 0x620C38CC, 0x38EC265B,
+0x286232D3, 0x65038FE7, 0x644CE4B8, 0x3C4C6CF3,
+0x6EF37408, 0xE2B0E658, 0x3E4C6AF3, 0x74086BF3,
+0x460861F3, 0x622C68F3, 0x7A0869F3, 0x314C7B18,
+0x386C64F3, 0x6DA3392C, 0x742867B3, 0x66C4E500,
+0x626C605C, 0x422166E4, 0x66142760, 0x2D20058C,
+0x4221626C, 0x70010954, 0x620C2420, 0x3263E605,
+0x74016503, 0x8FEA7701, 0xE05E7D01, 0x02FD4008,
+0x6D2DE9D0, 0x699C7D07, 0xEE00A00B, 0x66B365A3,
+0x64ECBAFB, 0x620367F3, 0x60EC379C, 0x70010724,
+0x62EC6E03, 0x8BF132D3, 0x4008E05F, 0xEAB008FD,
+0x6DF36AAC, 0x6BF36C8D, 0x7C0D3DAC, 0x7B28A012,
+0x0000A280, 0x001BC000, 0x64E36EEC, 0x644C74F4,
+0xBADA65B3, 0x62F366D3, 0x329C6103, 0x7E0160E3,
+0x62EC0214, 0x8BEF32C3, 0x3D9C6DF3, 0x67D36ED3,
+0xEC8061D3, 0x77027E01, 0x6CCC7103, 0xDBB9E400,
+0x604CDAB9, 0x067C041C, 0x08EC654C, 0x666C4528,
+0x46284518, 0x09DC688C, 0x4818256B, 0x70046603,
+0x699C258B, 0x620C36BC, 0x36AC259B, 0x265232C3,
+0x64038FE7, 0x4008E064, 0x70E007FC, 0x706C0CFC,
+0x0F8668CC, 0x0DFC7098, 0x6ADC706C, 0x708C0FA6,
+0x9BBF0EFE, 0xE2543EB2, 0x697CE100, 0x42088F02,
+0x0009A163, 0x4008E063, 0x6EF305FE, 0x3E2C96B3,
+0x64E3356C, 0xEDFFE703, 0x32D06250, 0x622C8D07,
+0x681C7101, 0x24203873, 0x8FF57505, 0xE0647401,
+0x0AFC4008, 0x64AC65E3, 0x661CBA18, 0xE063670C,
+0x62734008, 0x42080BFE, 0x7701327C, 0x3A2C6AB3,
+0x48086873, 0x948F6EA3, 0x3E4C387C, 0x3B8C74FF,
+0x38283A4C, 0xEC003B4C, 0x6083DD88, 0x655C05EC,
+0xE0652F56, 0x67B04008, 0x65A066E4, 0x677C01FC,
+0x655C666C, 0x641CBA1D, 0x7C017F04, 0xE40462CC,
+0x2D003243, 0x7D018FE9, 0xE063E554, 0x67F34508,
+0x375C4008, 0x966805FE, 0x356CEDFF, 0x6DDC6473,
+0xEE04E100, 0x666C6650, 0x890636D0, 0x621C7101,
+0x246032E3, 0x8FF57505, 0xE0647401, 0x02FC4008,
+0x642C6573, 0x661CB9CA, 0x6E23620C, 0xE0634E08,
+0x72013E2C, 0x0BFE4008, 0x47086723, 0x6AB3372C,
+0x68733AEC, 0x6EA338E8, 0x3E1C9140, 0x3B7C71FF,
+0x3B1C3A1C, 0x0F96704C, 0xEC00E904, 0x6083DD60,
+0x644C04EC, 0xE0652F46, 0x67B04008, 0x65A066E4,
+0x677C01FC, 0x655C666C, 0x641CB9CB, 0x7C017F04,
+0x329362CC, 0x8FEA2D00, 0xE0767D01, 0x09FE4008,
+0x70B4E454, 0x67F34408, 0x374C05FE, 0xEDFF9617,
+0x356C6473, 0xE1006DDC, 0x6650EE04, 0x36D0666C,
+0x71018906, 0x32E3621C, 0x75092460, 0x74018FF5,
+0xE064A006, 0x05BA0BB8, 0x05C905BB, 0x05DD05CA,
+0x65734008, 0x661C07FC, 0x647CB970, 0x6623620C,
+0x4608E063, 0x46004008, 0x362C0BFE, 0x68237201,
+0x3A6C6AB3, 0x48004808, 0x91676EA3, 0x3E1C382C,
+0x3B8C71FF, 0x38683A1C, 0xEC003B1C, 0x6083DD35,
+0x644C04EC, 0xE0652F46, 0x67B04008, 0x65A066E4,
+0x677C01FC, 0x655C666C, 0x641CB973, 0x7C017F04,
+0xE50862CC, 0x2D003253, 0x7D018FE9, 0x4008E063,
+0x05FEE654, 0x64F34608, 0xECFF9741, 0x357C346C,
+0xEE006CCC, 0x6250ED04, 0x32C0622C, 0x7E018906,
+0x38D368EC, 0x75092420, 0x74018FF5, 0x4008E077,
+0x700405FE, 0x649306FE, 0xEA54B9A7, 0x65F34A08,
+0x640C35AC, 0x66ECB91A, 0x6613610C, 0x4608E063,
+0x46004008, 0x361C0BFE, 0x68137101, 0x3A6C6AB3,
+0x48004808, 0x92136EA3, 0x3E2C381C, 0x3B8C72FF,
+0x38683A2C, 0xEC003B2C, 0xE077DD0B, 0x05FE4008,
+0x06FE7004, 0x6493B981, 0x0009A010, 0x060105DE,
+0x00000602, 0x0000B280, 0x001BC000, 0x001142E4,
+0x001142E8, 0x001142ED, 0x001142F5, 0x60836403,
+0x677C07EC, 0x67B02F76, 0x65A066E4, 0x666C677C,
+0xB906655C, 0x7F04644C, 0x61CC7C01, 0x3123E208,
+0x8FD22D00, 0xA0FC7D01, 0xE0630009, 0x05FE4008,
+0x96D067F3, 0x356C372C, 0xEEFF6473, 0x32E06250,
+0x622C8D08, 0x681C7101, 0x3863E608, 0x75052420,
+0x74018FF4, 0x4008E064, 0x657302FC, 0xB8B5642C,
+0x650C661C, 0x4008E063, 0x0BFE6253, 0x325C4208,
+0x6AB37501, 0x68533A2C, 0x6EA34808, 0x385C94AC,
+0x74FF3E4C, 0x3A4C3B8C, 0x3B4C3828, 0xDD96EC00,
+0x06EC6083, 0x2F66666C, 0x4008E065, 0x66E467B0,
+0x01FC65A0, 0x666C677C, 0xB8BA655C, 0x7F04641C,
+0x62CC7C01, 0x3243E404, 0x8FE92D00, 0xE5547D01,
+0x4508E063, 0x400867F3, 0x05FE375C, 0xEEFF9685,
+0x6473356C, 0xE1006EEC, 0x666C6650, 0x890736E0,
+0x621C7101, 0x3283E808, 0x75092460, 0x74018FF4,
+0x4008E064, 0x65730AFC, 0xB86764AC, 0x620C661C,
+0xE0636623, 0x40084608, 0x0BFE4600, 0x7201362C,
+0x6AB36823, 0x48083A6C, 0x6EA34800, 0x382C915E,
+0x71FF3E1C, 0x3A1C3B8C, 0x3B1C3868, 0xDD6FEC00,
+0x04EC6083, 0x2F46644C, 0x4008E065, 0x66E467B0,
+0x01FC65A0, 0x666C677C, 0xB86A655C, 0x7F04641C,
+0x62CC7C01, 0x3253E508, 0x8FE92D00, 0xE0637D01,
+0xE6544008, 0x460805FE, 0x973864F3, 0x346CECFF,
+0x6CCC357C, 0xED08EE00, 0x666C6650, 0x890636C0,
+0x62EC7E01, 0x246032D3, 0x8FF57509, 0xE0777401,
+0x05FE4008, 0x06FE7004, 0xB89E6493, 0x4808E854,
+0x358C65F3, 0xB811640C, 0x610C66EC, 0xE0636613,
+0x40084608, 0x0BFE4600, 0x7101361C, 0x6AB36813,
+0x48083A6C, 0x6EA34800, 0x381C920A, 0x72FF3E2C,
+0xA0063B8C, 0x05023A2C, 0x052A0503, 0x0572052B,
+0x38680573, 0xEC003B2C, 0xE077DD41, 0x05FE4008,
+0x06FE7004, 0x6493B871, 0x60836403, 0x677C07EC,
+0x67B02F76, 0x65A066E4, 0x666C677C, 0xB808655C,
+0x7F04644C, 0x61CC7C01, 0x3123E208, 0x8FE42D00,
+0xD3347D01, 0x0009430B, 0xE079620C, 0x0F244008,
+0x88306023, 0xA24D8B01, 0x88400009, 0xA2498B01,
+0x22280009, 0xA2458B01, 0xE5FF0009, 0x655CD42A,
+0xE03AE601, 0x8F043250, 0xE0790464, 0x4008E210,
+0xE05B0F24, 0x05FE4008, 0x3566963B, 0xA1498B01,
+0x60230009, 0x640CCB01, 0x6E23B842, 0xE118660C,
+0x890F3613, 0x4008E063, 0x04FE4608, 0x97294608,
+0x460070E0, 0x05FE347C, 0x346CB85C, 0xE0606203,
+0x0F244008, 0xCB0260E3, 0x640CB82A, 0xE118660C,
+0x890F3613, 0x4008E063, 0x04FE4608, 0x91114608,
+0x460070E0, 0x05FE341C, 0x346CB844, 0xE0616203,
+0x0F244008, 0xCB0560E3, 0x640CB812, 0xA00D660C,
+0x09B4E07A, 0x0000064D, 0x001142FD, 0x00114301,
+0x00114309, 0x00114400, 0x001142D8, 0x4008E118,
+0x8F043613, 0xE0610F64, 0xA0104008, 0xE07A0DFC,
+0x06FC4008, 0x626C70A4, 0x04FE4208, 0x97B44208,
+0x420070E0, 0x05FE347C, 0x342CB814, 0xE0796D03,
+0x00FC4008, 0xCB07DB8E, 0x430BD38E, 0x610C640C,
+0x4008E07A, 0x709C0F14, 0xE61802FC, 0x8D1C3163,
+0xE05D682C, 0x01FC4008, 0x09FC70FC, 0x04FE70FC,
+0xD385661C, 0x659C430B, 0xE07A6503, 0x01FC4008,
+0x611C70A4, 0x04FE4108, 0x97864108, 0x347C4100,
+0x430BD37E, 0xA003341C, 0xE0616C03, 0x0CFC4008,
+0xE500D67B, 0x640D8562, 0x4008E05B, 0x0AFEA036,
+0x6053655C, 0x305C4000, 0x4008D676, 0x622D026D,
+0x8F2A32A0, 0xD3746E03, 0x64AD430B, 0x2228620D,
+0xD6728927, 0x066C60E3, 0x4008E060, 0x460002FC,
+0x3E676E2C, 0x62638B00, 0x4008E060, 0x0F243867,
+0x62638D03, 0x4008E061, 0xE06102FC, 0x400861DC,
+0x0F243167, 0x8F01682C, 0x626362D3, 0x346764CC,
+0x6D238D01, 0xA00466C3, 0x75016C63, 0x3243625C,
+0xE0608BC6, 0x07FC4008, 0x617CE400, 0xE904D55C,
+0x666C6650, 0x8B013617, 0x6673677C, 0x624C7401,
+0x25603293, 0x75018FF4, 0xE03AD656, 0xE400056C,
+0x8D012558, 0xE2026243, 0x4008E061, 0x67830EFC,
+0x3E283828, 0x9119E500, 0x6053655C, 0x3A1002BC,
+0x622C8D0B, 0x3A609613, 0x32778907, 0xE0618B02,
+0x02FC4008, 0xA01D6053, 0x25580B24, 0x32878908,
+0x62838B00, 0xA0156053, 0x064D0B24, 0x099E096C,
+0x8F083277, 0xE07B6623, 0x0F164008, 0x02FC7098,
+0x01FE7068, 0x626C662C, 0x32876053, 0x0B648F02,
+0x646336E8, 0x625C7501, 0x8BCD3293, 0xE014D635,
+0xE4000644, 0xD53461DC, 0x6250E708, 0x3217622C,
+0x6DDC8B01, 0x740162D3, 0x3673664C, 0x8FF42520,
+0xE4007501, 0xD52D61CC, 0x622C6250, 0x8B013217,
+0x62C36CCC, 0x664C7401, 0x25203673, 0x75018FF4,
+0x0009A0EC, 0x4008E079, 0x642C02FC, 0x430BD319,
+0x660C6E43, 0x3653E518, 0xE0638910, 0x46084008,
+0x460804FE, 0x70E09722, 0x347C4600, 0xD31305FE,
+0x346C430B, 0xE0626203, 0x0F244008, 0xCB0660E3,
+0x430BD30C, 0x660C6403, 0x3653E518, 0xE0638928,
+0x46084008, 0x460804FE, 0x70E09708, 0x347C4600,
+0xD30605FE, 0x346C430B, 0x6C03A01D, 0x0000064D,
+0x001142E8, 0x001148E0, 0x001148BA, 0x00114934,
+0x00114000, 0x00114008, 0x00114774, 0x00114011,
+0x001142E4, 0x001142D8, 0x001142ED, 0x001142F5,
+0x4008E062, 0x60E30CFC, 0xD39CCB08, 0x6403430B,
+0xE07A610C, 0x4008E618, 0x8D1C3163, 0xE05D0F14,
+0x07FC4008, 0x09FC70FC, 0x04FE70FC, 0xD394667C,
+0x659C430B, 0xE07A6503, 0x01FC4008, 0x611C70A4,
+0x04FE4108, 0x9D744108, 0x34DC4100, 0x430BD38D,
+0xA003341C, 0xE0626D03, 0x0DFC4008, 0xE500D68A,
+0x640D8562, 0x4008E05B, 0x01FEA02C, 0x6053655C,
+0x305C4000, 0x4008D685, 0x622D026D, 0x8F203210,
+0xD3836E03, 0x641D430B, 0x2228620D, 0xD681891D,
+0x066C60E3, 0x4008E062, 0x460002FC, 0x3167612C,
+0x62638B00, 0x64CCE062, 0x34674008, 0x8F010F24,
+0x626362C3, 0x356765DC, 0x6C238D01, 0xA00466D3,
+0x75016D63, 0x3243625C, 0xE0628BD0, 0x07FC4008,
+0x617CE400, 0xE904D570, 0x622C6250, 0x8B013217,
+0x6273677C, 0x664C7401, 0x25203693, 0x75018FF4,
+0x61CCE400, 0xE708D569, 0x666C6650, 0x8B013617,
+0x66C36CCC, 0x624C7401, 0x25603273, 0x75018FF4,
+0x61DCE400, 0x6650D562, 0x3617666C, 0x6DDC8B01,
+0x740166D3, 0x3273624C, 0x8FF42560, 0xA0057501,
+0x064D0009, 0xE200D65B, 0x0624E03A, 0xE03AD659,
+0x2228026C, 0xE039894B, 0x2228026C, 0xE05B8947,
+0x0EFE4008, 0x3E669690, 0xE0798941, 0x00FC4008,
+0x8D023E66, 0xCB02640C, 0xD344640C, 0x0009430B,
+0xE05C660C, 0x07FC4008, 0x4608701C, 0x617C05FE,
+0x977A4608, 0x357C4600, 0x6613356C, 0x430BD346,
+0xD54464E3, 0x62032008, 0x0029150F, 0x6603CA01,
+0x2668E03B, 0x05648D20, 0xC8F06023, 0xD53F8909,
+0x76FF6650, 0x84512560, 0x805170FF, 0x70FF8452,
+0x60238052, 0x890FC80F, 0x6260D639, 0x26207201,
+0x70018461, 0x84628061, 0xA0057001, 0xD6318062,
+0xE03BE200, 0x162F0624, 0x4008E05B, 0x964302FE,
+0x8B653266, 0xD72BD428, 0xD52E6040, 0x4028C93F,
+0x40084008, 0x50726203, 0xC802D12B, 0xE604891A,
+0x46284618, 0x2522226B, 0xE2086040, 0x6503C93F,
+0x66034508, 0x45004508, 0x46284218, 0x6263252B,
+0x42084208, 0x252B4200, 0x4218E208, 0x252B4228,
+0x2152A062, 0x4618E614, 0x226B4628, 0x60402522,
+0xC93FE428, 0x45086503, 0x45084028, 0x45004008,
+0x40084418, 0x254BE728, 0x47184000, 0x4728250B,
+0xD412257B, 0x2152A044, 0x064D09B4, 0x001148E0,
+0x001148BA, 0x00114934, 0x00114000, 0x00114008,
+0x00114774, 0x00114011, 0x001142FD, 0x00114301,
+0x00114309, 0x001142D8, 0x00114A24, 0x001142F5,
+0x001142ED, 0x001C3694, 0x001C3BB4, 0x001142E8,
+0xE214D429, 0x42186040, 0x4028C93F, 0x40084008,
+0xD6264228, 0x2602202B, 0xE7286040, 0x6503C93F,
+0x45084508, 0x45004028, 0x40084718, 0x4008257B,
+0x4000E728, 0x250B4718, 0xD21D4728, 0x2252257B,
+0xD71C6240, 0x0724E044, 0x3F3C932C, 0x4F164F06,
+0x6EF64F26, 0x6CF66DF6, 0x6AF66BF6, 0x000B69F6,
+0x2FE668F6, 0x6243D114, 0xE4028512, 0x6E2D670D,
+0xE500A00F, 0x6053655D, 0x305C4000, 0x4008D10F,
+0x622D021D, 0x8B0332E0, 0x041C7108, 0x644CA004,
+0x625D7501, 0x8BED3273, 0x4618E602, 0x604D2469,
+0x6EF6000B, 0x000001F0, 0x001142E8, 0x001C3694,
+0x001C3BB4, 0x001142D8, 0x00114000, 0x00114008,
+0xD766D565, 0x62725151, 0x321CE340, 0x51522722,
+0x337C5271, 0x1721321C, 0x52725153, 0x321C644C,
+0x1722D15F, 0x66125255, 0x2162362C, 0x316C5173,
+0x61521713, 0xD65B5274, 0x1724321C, 0x52755154,
+0x1725321C, 0x52765158, 0x1726321C, 0x51776262,
+0x1717312C, 0x51785261, 0x1718312C, 0x51795262,
+0x1719312C, 0x517A5263, 0x171A312C, 0x517B5264,
+0x171B312C, 0x517C5265, 0x171C312C, 0x517D5266,
+0x171D312C, 0x517E5267, 0x171E312C, 0x527F5168,
+0x321CD645, 0x6262172F, 0x76946132, 0x2312312C,
+0x52316162, 0x321CD641, 0x515C1321, 0x351C5532,
+0x61621352, 0x41295235, 0x1325321C, 0x56365561,
+0x365C4529, 0x1366E538, 0x55312450, 0x71046143,
+0x66722152, 0x75086543, 0x56712562, 0x750C6543,
+0x56722562, 0x75106543, 0x56752562, 0x75146543,
+0x56732562, 0x75186543, 0x56762562, 0x751C6543,
+0x56322562, 0x75206543, 0x66322562, 0x75246543,
+0x56742562, 0x75286543, 0x56342562, 0x752C6543,
+0x55332562, 0x72306243, 0x55352252, 0x72346243,
+0x56362252, 0x24627438, 0x1341E400, 0x17412742,
+0x17451742, 0x17461743, 0x23421342, 0x13441744,
+0x13451343, 0x1346000B, 0xD510E124, 0x51572410,
+0x52581411, 0x57591422, 0x515A1473, 0x525B1414,
+0x575C1425, 0x525D1476, 0x1427E700, 0x1468565E,
+0x1469565F, 0x15781577, 0x157A1579, 0x157C157B,
+0x157E157D, 0x157F000B, 0x001C369C, 0x0020351C,
+0x00203578, 0x001C3CA0, 0x001C36F4, 0x001C3B88,
+0x6E726157, 0x21676E69, 0x69685420, 0x6F642073,
+0x656C676E, 0x746F6E20, 0x65656220, 0x6163206E,
+0x7262696C, 0x64657461, 0x0000000A, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
+
+const u32_t zcFwBufImageSize=83968;
diff --git a/drivers/staging/otus/hal/hpfwspiu.c b/drivers/staging/otus/hal/hpfwspiu.c
new file mode 100644
index 00000000000..eda7ff5e573
--- /dev/null
+++ b/drivers/staging/otus/hal/hpfwspiu.c
@@ -0,0 +1,655 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include "../80211core/cprecomp.h"
+
+const u32_t zcFwImageSPI[]={
+0x0009000B, 0x4F222FE6, 0xB0187FFC, 0xE6000009,
+0x943DD520, 0xC8406052, 0x2F028F03, 0x8FF93642,
+0xD41D7601, 0x4E0BDE1D, 0xD41D0009, 0x00094E0B,
+0x4E0BD41C, 0x7F040009, 0xA0214F26, 0x4F226EF6,
+0xE205D119, 0x2122E400, 0x92222142, 0x8BFD4210,
+0x450BD516, 0xD6160009, 0x0009460B, 0xE5FFD715,
+0x2752655D, 0xE1FFD714, 0xD4145079, 0x1709CB01,
+0x17112712, 0x2412E101, 0x4F26D411, 0x2410000B,
+0xDE11DD10, 0x00094D0B, 0x00094E0B, 0x0009AFFA,
+0x03E82710, 0x001C001C, 0x00116594, 0x00114EBE,
+0x001165A4, 0x001165BC, 0x001D4004, 0x00114FA0,
+0x00114378, 0x001C3510, 0x001C3624, 0x001E212C,
+0x001164FC, 0x00114700, 0x0011589C, 0x2FA62F96,
+0x2FC62FB6, 0x2FE62FD6, 0x7FC84F22, 0xD28DDD8C,
+0x61D360D0, 0x80F47101, 0x420B6010, 0x200880F8,
+0x6E038F10, 0xDB89D488, 0xD4896A40, 0x4B0BDC89,
+0x67C065AC, 0x697CDE88, 0x41086193, 0x31984108,
+0x3E1C4108, 0x66D284F8, 0x2008600C, 0x2E628F13,
+0xE40084F4, 0xDA81670C, 0x3273624D, 0xA0D38B01,
+0x644D0009, 0x35AC6543, 0x69436652, 0x39EC6B62,
+0xAFF119B1, 0x88017404, 0x84F48B15, 0x2E70E700,
+0xDA766E0C, 0x32E3627D, 0xA0C48B01, 0x677D0009,
+0x6C7366A3, 0x65737604, 0x356C3CAC, 0x6D5264C2,
+0xAFEF7708, 0xE2B024D2, 0x3020622C, 0x84F48B30,
+0x650CEC00, 0xDA691F53, 0x55F3E904, 0x325362CD,
+0xA0A88B01, 0x6CCD0009, 0x67C36EA3, 0x6BC37E04,
+0x3BEC37AC, 0x6EB26D72, 0xDB62D461, 0x00094B0B,
+0x410BD161, 0xD46164D3, 0x00094B0B, 0x450BD55E,
+0xD45F64E3, 0x00094B0B, 0x61D3E600, 0x316C666D,
+0x646D7601, 0x21E03493, 0x4E198FF7, 0x7C08AFD5,
+0x622CE2B1, 0x8B113020, 0xD552D456, 0xDA56DC4F,
+0x0009450B, 0x4A0BE400, 0xD75467C2, 0x470BDB52,
+0x4B0B0009, 0xE900E403, 0x2E90A06D, 0x622CE2B2,
+0x89683020, 0x622CE2B3, 0x8B1D3020, 0xDA45D44C,
+0x4A0BD942, 0x65960009, 0x6792D44A, 0x1F74DD3B,
+0x1F5D4D0B, 0xD639D448, 0x460BDB48, 0x55F455F4,
+0x4B0BD936, 0xD44654FD, 0x490B6503, 0x5DF51F05,
+0x1ED1EC04, 0x2EC0A047, 0x622CE2B4, 0x8B3E3020,
+0xDA34D440, 0x4A0BDD31, 0x84F40009, 0x600C6CD2,
+0x1F072F02, 0x1FC6C903, 0xE6001F08, 0xD73AE030,
+0x6CF2DB3A, 0x1F790F65, 0xA0211FBA, 0x51F6E904,
+0x6D63666D, 0x4C1536EC, 0xD2353D1C, 0x1F6B8F05,
+0x89023C93, 0xA00264D3, 0xE50455F8, 0x420B64D3,
+0x5BFB0009, 0xD61954FA, 0x460B65D3, 0x54F91B01,
+0xDA1655B1, 0x7CFC4A0B, 0x06FDE030, 0x0F657604,
+0x626D55F7, 0x8BDA3253, 0xA00484F4, 0xD4252E00,
+0x420BD20E, 0x7F3865D2, 0x6EF64F26, 0x6CF66DF6,
+0x6AF66BF6, 0x69F6000B, 0xE6006163, 0x4109A004,
+0x76016256, 0x74042422, 0x8BF93612, 0x0009000B,
+0x00117800, 0x00115FF0, 0x001164F6, 0x00114F2C,
+0x001165C0, 0x001164F5, 0x0011611C, 0x00117804,
+0x001165E0, 0x00114EBE, 0x00114F02, 0x001165F4,
+0x001165FC, 0x00116600, 0x00114BF0, 0x001148FC,
+0x00116618, 0x00116634, 0x00116640, 0x00114E56,
+0x0011664C, 0x00116658, 0x0011667C, 0x00116670,
+0x00114BC4, 0x00116688, 0x2F962F86, 0x2FB62FA6,
+0x2FD62FC6, 0x4F222FE6, 0xE5007FD8, 0x6453E110,
+0x6C534128, 0x655DEE0A, 0x46086653, 0x4608365C,
+0x361C7501, 0x675D6043, 0x60C30F66, 0x37E3ED00,
+0x816126C1, 0x81638162, 0x16D316D2, 0x8FEA16D4,
+0x68F27404, 0xDAB3D9B2, 0x29821981, 0xD1B259F1,
+0x2A921A91, 0x5BF35AF2, 0x5EF55DF4, 0x11A154F6,
+0x11B321A2, 0x11D511B2, 0x11E711D4, 0x114911E6,
+0x55F71148, 0xEE00DBA9, 0xDDA957F8, 0xD6A952F9,
+0x1B5164E3, 0xDBA82B52, 0xEAB8D8A8, 0x2D72E945,
+0x6AAC2622, 0x6EED4908, 0x4D086DE3, 0x3DEC61E3,
+0x4D084108, 0x3DBC31EC, 0x410860C3, 0x81D12DC1,
+0x4108E050, 0x41084008, 0x60C381D2, 0xE500318C,
+0x81D334A2, 0x1D131DD2, 0x8D01D494, 0xD4911D54,
+0xB08165D3, 0x64ED7E01, 0x8BDC3492, 0xDB94D18D,
+0xD28B6812, 0x1B814829, 0x2FD26412, 0x2B92694D,
+0xD98A6722, 0x1B734729, 0xD7876822, 0x1BA26A8D,
+0xD28C6B72, 0x22B2D586, 0xE0035D72, 0x5E7412D2,
+0x12E44018, 0xD6885176, 0x54781216, 0x1248E1FF,
+0xD4856792, 0x6852127A, 0x28C1E703, 0x81916952,
+0x6A52E050, 0x81A24008, 0x60C36B52, 0x6D5281B3,
+0x6E521DD2, 0x62521E63, 0x1264E600, 0x46086563,
+0x7501364C, 0x665D2612, 0x8BF83673, 0xE003D471,
+0x40186542, 0x674225C1, 0x8171D274, 0xEE006842,
+0x69421882, 0x1923E024, 0xE5806A42, 0x6B421AE4,
+0x81B266E3, 0xD46D6C42, 0x655C81C3, 0x6D63666D,
+0x616D7604, 0x31533D4C, 0x2DE28FF8, 0xD569D268,
+0x74042422, 0x7F282452, 0x6EF64F26, 0x6CF66DF6,
+0x6AF66BF6, 0x000B69F6, 0x664268F6, 0xC8036061,
+0xE5008D04, 0xC9036061, 0x8B038802, 0x65635262,
+0x24125124, 0x6053000B, 0x2FE62FD6, 0x7FEC4F22,
+0x62536E53, 0x6D43E550, 0x4508E400, 0xE101A001,
+0x60435224, 0x81212211, 0x60538123, 0x56E28122,
+0x8BF53620, 0x16E4D250, 0xE61464F3, 0x65E3420B,
+0xE4FC65E1, 0x2E512549, 0x65F361F1, 0x2F112149,
+0xD14954D1, 0xE614410B, 0x607157D1, 0x2701CB01,
+0x7F141DE1, 0x6EF64F26, 0x6DF6000B, 0x2FE62FD6,
+0x7FEC4F22, 0x66536E53, 0x6D43E5FC, 0x20596061,
+0x2601CB01, 0x326052E2, 0x12E48B06, 0x31E051E2,
+0x52D18B04, 0x1E22A002, 0x5664AFF0, 0x64F3D236,
+0x420BE614, 0x67E165E3, 0x2719E1FC, 0x67F12E71,
+0x271954D1, 0x65F3D130, 0x410BE614, 0x52D12F71,
+0xCB016021, 0x1DE12201, 0x4F267F14, 0x000B6EF6,
+0x2FE66DF6, 0x624C4F22, 0x4208DE1B, 0xA0054200,
+0x52523E2C, 0x5624D417, 0x2E62BF8E, 0x52E165E2,
+0x8BF63520, 0x2622D61B, 0x000B4F26, 0x2FB66EF6,
+0x2FD62FC6, 0x4F222FE6, 0xDB1CDC10, 0x66C252C1,
+0x89403620, 0xC9036061, 0x893C8801, 0xDD18DE0B,
+0x64E3BF63, 0x85036503, 0x620D66B2, 0x892B3262,
+0xBF9BD403, 0xD4130009, 0x00094D0B, 0x0009AFE6,
+0x001160DC, 0x001160E4, 0x001160EC, 0x00116114,
+0x001164F8, 0x00116500, 0x001000C8, 0x00101680,
+0x001E2108, 0x001C3D00, 0x00117880, 0x00117780,
+0x00040020, 0x0026C401, 0x001142F8, 0x001164DC,
+0x00114EBE, 0x0011669C, 0x64E3BF3E, 0x4D0BD406,
+0xAFBB0009, 0xD2050009, 0x4F262262, 0x6DF66EF6,
+0x000B6CF6, 0x00006BF6, 0x001166A0, 0x001C3D28,
+0x2F962F86, 0x2FB62FA6, 0x2FD62FC6, 0x4F222FE6,
+0xD23C7FFC, 0xC8036022, 0x2F018F3D, 0x0009A061,
+0xC9036061, 0x893B8801, 0xD238D837, 0x420BD938,
+0xE4006483, 0x6A036D03, 0x5C02490B, 0xD236DB35,
+0x56D385D2, 0x650D6422, 0x4B0BE740, 0xD1326E03,
+0x64126EED, 0x214234EC, 0x3DC05DD4, 0x85D28BEF,
+0x70FF56D3, 0xE740650D, 0x6C034B0B, 0x490BDB2A,
+0x66B2E403, 0x36CC6CCD, 0xE700D928, 0x2B62E5C8,
+0x6473E650, 0x490BDC26, 0x6483655C, 0x65A34C0B,
+0xEE01D124, 0xD11C21E2, 0x66125211, 0x8BBF3620,
+0xDD22DE21, 0xDC23DB22, 0x65D252D1, 0x89183520,
+0xC9036051, 0x89148801, 0xD114D41C, 0x0009410B,
+0x36E05603, 0x65038F04, 0x2B20E201, 0x2C52AFEC,
+0xD213D419, 0x0009420B, 0xE101D618, 0xAFE34118,
+0x60F12612, 0x8902C804, 0x420BD215, 0x7F040009,
+0x6EF64F26, 0x6CF66DF6, 0x6AF66BF6, 0x000B69F6,
+0x000068F6, 0x001E2100, 0x001160E4, 0x0011453A,
+0x00114BF0, 0x00114E0C, 0x00116714, 0x001159B0,
+0x00114558, 0x001E212C, 0x00117880, 0x001160DC,
+0x001164FC, 0x001164F8, 0x00116114, 0x001C3D30,
+0x001140CC, 0xD6C2D5C1, 0x26226252, 0xC8016060,
+0x000B8BFA, 0x2FE60009, 0xBFF34F22, 0xD2BD0009,
+0xE405E100, 0x22402212, 0x6422DEB8, 0xE700D5B8,
+0x25721E42, 0xC98F8451, 0xC9F0CB10, 0x8051CB02,
+0xCB026050, 0x62522500, 0x2E22BFDC, 0xD6B250E4,
+0x4F262602, 0x6EF6000B, 0x4F222FD6, 0x0009BFDB,
+0x620CDDAE, 0x60D02D22, 0x8906C801, 0x0009BFD3,
+0x2D22620C, 0xC80160D0, 0x4F268BF8, 0x6DF6000B,
+0x4F222FE6, 0x6E43BFE8, 0xE100D2A2, 0x22E02212,
+0x6422D59E, 0xE600DE9E, 0x2E621542, 0xC9F084E1,
+0x80E1CB01, 0xCB0260E0, 0x67E22E00, 0x4F262572,
+0x6EF6AFA8, 0xE406AFE4, 0xE404AFE2, 0xBFF94F22,
+0xE4C70009, 0x644CBFDC, 0x4F26AFF6, 0xE406AFD8,
+0xE404AFD6, 0x4F222FE6, 0x6E43BFF8, 0xD58DD28D,
+0xE401E100, 0x221260E3, 0x80512240, 0x6622D187,
+0xE700DE87, 0x2E721162, 0xC9F084E1, 0x80E1CB02,
+0xCB0260E0, 0x62E22E00, 0x2122BF7C, 0xAFDF4F26,
+0x2FD66EF6, 0x4F222FE6, 0xBFCB6D53, 0xBF9B6E43,
+0xD27C0009, 0x22E061D3, 0x6022DE7D, 0x411821E9,
+0x201BC9FF, 0x2202D577, 0xD6768453, 0x60D38051,
+0xD4728053, 0xD1726762, 0x1472ED00, 0x841121D2,
+0xCB04C9F0, 0x60108011, 0x2100CB02, 0xBF516212,
+0x4F262422, 0xAFA76EF6, 0x65436DF6, 0xAFD0E4D8,
+0x6543644C, 0xAFCCE4D8, 0x2FC6644C, 0x2FE62FD6,
+0x6E534F22, 0xBF676D43, 0xD7626C63, 0x27D0D264,
+0x61E36072, 0x41182129, 0x201BC9FF, 0x2702D45D,
+0xD15B8443, 0x60E38041, 0xDE588043, 0xE6006472,
+0x21621E42, 0x65DC8411, 0x60C36203, 0x4008C907,
+0x67034008, 0xE29F6023, 0x622CC98F, 0x3520207B,
+0x80118D18, 0x7C048411, 0x60C36603, 0x6203C90F,
+0xC9F06063, 0x8011202B, 0x880B6053, 0x84118B14,
+0xC90F6603, 0xC90F7001, 0x60636203, 0x202BC9F0,
+0x8011A00A, 0x7C018411, 0x60C36603, 0x6203C90F,
+0xC9F06063, 0x8011202B, 0xCB026010, 0x62122100,
+0x2E22BEF0, 0xD63C50E4, 0x4F262602, 0x6DF66EF6,
+0x6CF6000B, 0x2FC62FB6, 0x2FE62FD6, 0x6C634F22,
+0x6E436D53, 0x6B73BF36, 0x0009BF06, 0x61D3D231,
+0xDE3322E0, 0x21E96022, 0xC9FF4118, 0xD42D201B,
+0x84432202, 0x8041D72F, 0x804360D3, 0x6622D427,
+0x1462D127, 0x14C327C2, 0x21C2EC00, 0x7B048411,
+0x60B36D03, 0x6503C90F, 0xC9F060D3, 0x8011205B,
+0xCB026010, 0x62122100, 0x4F262422, 0x6DF66EF6,
+0xAEAF6CF6, 0x2FB66BF6, 0x2FD62FC6, 0x4F222FE6,
+0x6C536D63, 0xBEFD6E43, 0xBECD6B73, 0xD2150009,
+0x22E061C3, 0x6022DE16, 0x411821E9, 0x201BC9FF,
+0x2202D110, 0xD60F8413, 0x60C38011, 0xDE0B8013,
+0xD40B6762, 0xEC006BBD, 0x1EB51E72, 0x844124C2,
+0xC9F04B21, 0x8041CB04, 0xE1406040, 0x2400CB06,
+0xE5006242, 0x4B212E22, 0x4128A014, 0x001D1200,
+0x00116528, 0x00116530, 0x00116538, 0x00116544,
+0x00FFFFFF, 0x00116534, 0x6053655D, 0x06DE4008,
+0x21627501, 0x32B3625D, 0x4F268BF6, 0x6DF66EF6,
+0xAE5F6CF6, 0x4F226BF6, 0xBF73677C, 0xAEB3644C,
+0x4F224F26, 0xBFA6677D, 0xAEAD644C, 0x4F224F26,
+0xE500E49F, 0xBF08E603, 0x4F26644C, 0x600C000B,
+0xE49F4F22, 0xE603E500, 0x644CBEFF, 0x4F264019,
+0x600D000B, 0x6543665C, 0xE403AEF7, 0x6543665C,
+0xE40BAEF3, 0xD175D674, 0x60436262, 0xC8012122,
+0x8F016010, 0xC9EFCB10, 0x62122100, 0x2622000B,
+0x4F222FE6, 0xE0004F13, 0xBE2C401E, 0xD56C6E43,
+0x2522620C, 0xE401BFE6, 0x6063D669, 0x60ECCF80,
+0x89072008, 0x89098801, 0x890D8802, 0x89118803,
+0x0009A013, 0xC9E36060, 0x2600A00F, 0xCB106060,
+0xCB04C9F7, 0x2600A009, 0xCB106060, 0xCB08C9FB,
+0x2600A003, 0xCB1C6060, 0xD5592600, 0xBE616252,
+0xE400642C, 0x4F264F17, 0x6EF6AFBC, 0x2F962F86,
+0x2FB62FA6, 0x2FD62FC6, 0x4F222FE6, 0x60C36C7C,
+0x6A638802, 0x69538F09, 0x65436290, 0x662CE4AF,
+0xBEF7E701, 0xA00A644C, 0x2CC80009, 0x88018901,
+0x65438B05, 0xE600E4AF, 0xBEEBE701, 0xBDD1644C,
+0xED010009, 0xDE43EBAF, 0xE800A02C, 0x0009BDF4,
+0x60C3D141, 0x8802E200, 0xD5402122, 0x21B08D06,
+0x89082CC8, 0x890A8801, 0x0009A00C, 0x009C60D3,
+0xA007D639, 0xD2388061, 0xA0036083, 0xD2368021,
+0x802160D3, 0xD1356412, 0x1E42E600, 0x84512162,
+0xC9F07D01, 0x8051CB02, 0xCB026050, 0x67122500,
+0x2E72BDA0, 0x8BD13DA2, 0x0009BDF6, 0x0009BDA3,
+0x620CD627, 0x4F262622, 0x6DF66EF6, 0x6BF66CF6,
+0x69F66AF6, 0x68F6000B, 0xE702AF98, 0x2F962F86,
+0x2FB62FA6, 0x2FD62FC6, 0x4F222FE6, 0x3F3C9331,
+0x0F569030, 0xE8FF70FC, 0x688C0F46, 0xE900A049,
+0x4018E010, 0xE50404FE, 0xBF33349C, 0x88FF6A43,
+0x901F893E, 0xE1100CFE, 0x41183C98, 0x8B033C16,
+0x64A3BE1B, 0x0009A031, 0x4018E010, 0xED000BFE,
+0xA0073BCC, 0x64D36EF3, 0xBF1F34BC, 0x2E00E501,
+0x7E017D01, 0x8BF63DC2, 0x64A3BE07, 0xA01AED00,
+0xEFF86EF3, 0x00001004, 0x001D1204, 0x0011652C,
+0x00116544, 0x001D1200, 0x00116530, 0x00116528,
+0x666C66E0, 0x89043680, 0x35BC65D3, 0xBE51E701,
+0x7D01E402, 0x3DC27E01, 0xE1108BF2, 0x391C4118,
+0x90547904, 0x391201FE, 0x93518BB2, 0x4F263F3C,
+0x6DF66EF6, 0x6BF66CF6, 0x69F66AF6, 0x68F6000B,
+0x676D6253, 0x66236543, 0xE402AEC3, 0x2FA62F96,
+0x2FC62FB6, 0x2FE62FD6, 0x697D4F22, 0x4A216A93,
+0x4A084A21, 0x6C436D63, 0xA0086B73, 0x64C36E53,
+0x669365D3, 0x6BBDBFE4, 0x3DAC3CBC, 0x6EEF3EB8,
+0x8BF42EE8, 0x4F26E000, 0x6DF66EF6, 0x6BF66CF6,
+0x000B6AF6, 0x2FA669F6, 0x2FC62FB6, 0x2FE62FD6,
+0xEC004F22, 0x6B536EC3, 0xA0066D43, 0x64D3EA01,
+0x65A3BEA8, 0x7D013C0C, 0x3EB27E01, 0x60C38BF7,
+0x6EF64F26, 0x6CF66DF6, 0x000B6BF6, 0x10046AF6,
+0x00001008, 0x0009000B, 0x2FD62FC6, 0x4F222FE6,
+0x6D436C53, 0xEE00A004, 0x7E0164D4, 0x644CBFF2,
+0x8BF93EC2, 0x6EF64F26, 0x000B6DF6, 0xE5006CF6,
+0x6643A002, 0x76017501, 0x22286260, 0xAFE38BFA,
+0x2FE60009, 0x75076253, 0xE1086753, 0x6043EE0A,
+0x4409C90F, 0x650330E2, 0x8D014409, 0xE630E637,
+0x4110365C, 0x8FF22760, 0xE00077FF, 0x000B8028,
+0x4F226EF6, 0xBFE47FEC, 0xBFD865F3, 0x7F1464F3,
+0x000B4F26, 0x4F22E000, 0xBFDA7FEC, 0x64F365F3,
+0x7406BFCD, 0x4F267F14, 0xE000000B, 0x4F222FE6,
+0x62537FEC, 0x65F36E43, 0x6423BFCB, 0x64E3BFBF,
+0x64F3BFBD, 0xBFBAD403, 0x7F140009, 0x000B4F26,
+0x00006EF6, 0x001166A4, 0xE4FDD29A, 0xD79A6122,
+0x22122149, 0x74016022, 0x2202CB01, 0xD5976622,
+0x22622649, 0xC8406070, 0x60528902, 0x2502CB04,
+0xE1F76452, 0x25422419, 0xE7016052, 0x2502C9CF,
+0xE6026052, 0x2502CB03, 0x15624718, 0x1573000B,
+0xD78CD58B, 0xD48DD28C, 0xE600E100, 0x27112511,
+0xAFD12210, 0x664C2461, 0x4600D289, 0x6060362C,
+0x000BCB10, 0x654C2600, 0x4500D285, 0x6650352C,
+0x2619E1EF, 0x2560000B, 0xD282664C, 0x362C4600,
+0xCB106060, 0x2600000B, 0xD27E654C, 0x352C4500,
+0xE1EF6650, 0x000B2619, 0x664C2560, 0x4600D278,
+0x6060362C, 0x000BCB08, 0x654C2600, 0x4500D274,
+0x6650352C, 0x2619E1F7, 0x2560000B, 0xD271664C,
+0x362C4600, 0xCB086060, 0x2600000B, 0xD26D654C,
+0x352C4500, 0xE1F76650, 0x000B2619, 0x624C2560,
+0x4200D667, 0x6020326C, 0x4021C908, 0x40214021,
+0x600C000B, 0xD663624C, 0x326C4200, 0xC9086020,
+0x40214021, 0x000B4021, 0xD15F600C, 0x341C644C,
+0x000B6240, 0xD15D602C, 0x341C644C, 0x000B6240,
+0x2FE6602C, 0x6E434F22, 0xE60A645C, 0x89143467,
+0x0009BFEB, 0x60EC640C, 0x8B028801, 0xA002E00F,
+0x44092409, 0x624C4409, 0x3263E60A, 0xBFE28905,
+0x620C644C, 0xC8806023, 0xE2008B00, 0x4F266023,
+0x6EF6000B, 0xD64A4F22, 0x88016062, 0xB2458B03,
+0xA0030009, 0xD2470009, 0x2260E640, 0xE200D646,
+0x000B4F26, 0x4F222622, 0x6062D641, 0x8B018802,
+0x0009B28E, 0xE200D640, 0x000B4F26, 0xD53C2622,
+0xE100D43C, 0x2512E701, 0x2470000B, 0xE604D239,
+0x2260000B, 0xD4394F22, 0x410BD139, 0xD5390009,
+0x6650E1FD, 0x2619D238, 0x2560E700, 0x000B4F26,
+0x4F222270, 0xD132D435, 0x0009410B, 0xE7FBD531,
+0x26796650, 0x000B4F26, 0x4F222560, 0xD12CD430,
+0x0009410B, 0xE7F7D52B, 0x26796650, 0x000B4F26,
+0xD5282560, 0x6250942D, 0x000B2249, 0xD5252520,
+0x6250E4BF, 0x000B2249, 0x4F222520, 0x8522D225,
+0x2008600D, 0x88018911, 0x88038913, 0x88058915,
+0x88068942, 0x88088948, 0x8809894E, 0x880A8954,
+0x880B895A, 0xA0678960, 0xB0690009, 0xA0640009,
+0xB077600C, 0xA0600009, 0xB080600C, 0xA05C0009,
+0xFF7F600C, 0x001E2148, 0x001E1000, 0x001E1108,
+0x00116570, 0x00116572, 0x00116591, 0x00116554,
+0x001E103F, 0x001E105F, 0x001E102F, 0x001E1090,
+0x00116578, 0x001E100B, 0x00116574, 0x001166A8,
+0x00114EBE, 0x001E1028, 0x00116590, 0x001166B4,
+0x001166C4, 0x00116548, 0x6260D684, 0x8B2B2228,
+0x0009B061, 0x600CA029, 0x6260D680, 0x8B232228,
+0x0009B069, 0x600CA021, 0x6260D67C, 0x8B1B2228,
+0x0009B0C7, 0x600CA019, 0x6260D678, 0x8B132228,
+0x0009B0CD, 0x600CA011, 0x6260D674, 0x8B0B2228,
+0x0009B125, 0x600CA009, 0x6260D670, 0x8B032228,
+0x0009B13D, 0x600CA001, 0x4F26E000, 0x0009000B,
+0xD26CD16B, 0xD56C8412, 0x4000C90F, 0xD76B012D,
+0xE403D66B, 0xE20F611C, 0x2540E001, 0x25202712,
+0x2602000B, 0xE601D262, 0x30668523, 0xE0008D05,
+0xD663D260, 0xE0018122, 0x000B2602, 0xD25C0009,
+0x600D8523, 0x89052008, 0x8B0A8801, 0x6060D65D,
+0x2600CB01, 0xD457D65A, 0xE001E101, 0x000B2612,
+0x000B8142, 0xD152E000, 0x8513E501, 0x640D4518,
+0x66033453, 0xE0008D05, 0xD551D253, 0x2260E001,
+0x000B2502, 0x4F220009, 0x8513D149, 0x6453650D,
+0x62494419, 0x227D672E, 0x8801602C, 0x88028909,
+0x88038910, 0x8806891A, 0x88078935, 0xA04C893B,
+0xD5460009, 0x6652D746, 0x2762D446, 0x622C6261,
+0x2421A038, 0x2228625C, 0xD4438B3F, 0x6642D540,
+0x2562D440, 0x24018561, 0x6203A02C, 0x2008605C,
+0x88108907, 0x88208908, 0x88308909, 0xA02C890A,
+0xD23A0009, 0x6222A008, 0xA005D239, 0xD2396222,
+0x6222A002, 0x6262D638, 0xD432D531, 0x66212522,
+0xA00F626C, 0xD6352421, 0x6261D52D, 0x622CD42D,
+0xA0072562, 0xD6322421, 0x8561D529, 0x2562D429,
+0x62032401, 0x662D8515, 0x3617610D, 0x65038F01,
+0xB0CB2451, 0xA0010009, 0xE000E001, 0x000B4F26,
+0xD6190009, 0xD427E101, 0x65412610, 0xD118D717,
+0xE20F655D, 0x2752E001, 0x000B2620, 0x2FE62102,
+0xD20F4F22, 0x640C8523, 0x8B082448, 0xD511D61D,
+0x2621E200, 0x940F8451, 0xA0482049, 0xDE0D8051,
+0xC84060E0, 0xE2018D32, 0x89443427, 0xD216D615,
+0x2641420B, 0x0009A030, 0x0000FF7F, 0x00116591,
+0x00116548, 0x00116554, 0x001E1100, 0x001E100C,
+0x00116574, 0x001E1000, 0x001E1001, 0x0011657C,
+0x0011655C, 0x00116560, 0x00116564, 0x00116580,
+0x00116584, 0x00116588, 0x0011658C, 0x00116774,
+0x0011677E, 0x0011656E, 0x00115DCA, 0x89123427,
+0xD294D693, 0x2641420B, 0xCB8084E1, 0x80E1B0F5,
+0xD69160E0, 0x2E00CB04, 0xC93F6060, 0xD68F2600,
+0xA001E001, 0xE0002602, 0x000B4F26, 0xD68C6EF6,
+0xC8806060, 0xD2868919, 0x88016021, 0xD2898B15,
+0x8524E501, 0x89103056, 0xE203D187, 0x2120D487,
+0xE00B6541, 0x0656655D, 0xE40FD585, 0x2140E702,
+0xD77E2571, 0x000BE001, 0x000B2702, 0x2FE6E000,
+0xDE804F22, 0xC88084E1, 0xD57A892C, 0x20088554,
+0x61038F28, 0x8553D77C, 0x64036672, 0x8566650C,
+0x3520620C, 0xD6798B1E, 0x651CD774, 0x2651644C,
+0x60E02741, 0x8904C840, 0x420BD275, 0xA0030009,
+0xD2680009, 0x0009420B, 0x0009B09F, 0xE201D167,
+0x60E02122, 0xCB04D464, 0x60402E00, 0x2400C93F,
+0x6023A001, 0x4F26E000, 0x6EF6000B, 0x2FB62FA6,
+0x2FD62FC6, 0xDA622FE6, 0x66A1E240, 0x3622DC5E,
+0x62638900, 0x6ED36D2C, 0x4E2136D8, 0x4E212A61,
+0xDB61D460, 0xE700A00F, 0x770162B2, 0x71026123,
+0x66212B12, 0x71026213, 0x61212B12, 0x651D666D,
+0x356C4528, 0x627C2452, 0x8BED32E3, 0xC90360D3,
+0x8B108803, 0x617367B2, 0x2B127102, 0x71026E13,
+0x2B126571, 0x655D6DE1, 0x422862DD, 0x325CE107,
+0xA00C2C10, 0x88022422, 0xA0038B01, 0x8801E203,
+0xE2018B05, 0x66B22C20, 0x655D6561, 0xE60F2452,
+0x67A12C60, 0x8B052778, 0xDD38DC44, 0xEB01EA00,
+0x2DB22CA2, 0x6DF66EF6, 0x6BF66CF6, 0x6AF6000B,
+0x2FE62FD6, 0xE240DD36, 0x362266D1, 0x62638900,
+0x3678672C, 0x7703DE38, 0x47212D61, 0x64E2D635,
+0xA00E4721, 0x6562E100, 0x62537101, 0x74012450,
+0x24204219, 0x45297401, 0x74012450, 0x24504519,
+0x621C7401, 0x8BEE3273, 0x66E24200, 0x420061D1,
+0x2118362C, 0x2E628F06, 0xDD1CD728, 0xE501E400,
+0x2D522742, 0x000B6EF6, 0x2FD66DF6, 0x4F222FE6,
+0xED0AEE01, 0x64E3BC97, 0xBC9C64E3, 0x62EC7E01,
+0x8BF732D7, 0xBC9FEE01, 0x64E364E3, 0x7E01BCA4,
+0x32D762EC, 0x4F268BF7, 0x000B6EF6, 0xD1186DF6,
+0xD418920D, 0x72122122, 0x2422D617, 0xD7177204,
+0x72202622, 0x2722D116, 0x000B7230, 0x137A2122,
+0x0011656E, 0x00115ED6, 0x001E1015, 0x00116574,
+0x001E1001, 0x00116548, 0x001E1100, 0x00116572,
+0x00116560, 0x001E1000, 0x00116564, 0x00116570,
+0x00115DCA, 0x001E100C, 0x0011655C, 0x00116578,
+0x0011657C, 0x00116580, 0x00116584, 0x00116588,
+0x0011658C, 0x4F222FE6, 0xD6507FFC, 0x88016060,
+0xE2018951, 0x2620BFBB, 0xD54ED14D, 0xDE4E6010,
+0x64E36552, 0x7402C840, 0x8D22D14C, 0xD24C7502,
+0xE601D74C, 0xE7042722, 0x76016255, 0x626C2421,
+0x8FF93273, 0xD4437402, 0x6242E601, 0x640D8528,
+0x67494419, 0x275D657E, 0x81E4607C, 0xE417D542,
+0x67557601, 0x3243626C, 0x8FF92171, 0xA0207102,
+0xD23E0009, 0xE601D73B, 0xE7042722, 0x76016255,
+0x626C2421, 0x8FF93273, 0xD4327402, 0x6242E601,
+0x640D8528, 0x67494419, 0x275D657E, 0x81E4607C,
+0xE417D533, 0x67557601, 0x3243626C, 0x8FF92171,
+0x924A7102, 0xD2262E21, 0x5E23D72E, 0x64F22FE2,
+0x604365F2, 0x2700C980, 0xC9606043, 0x80716103,
+0xC9036043, 0x80724519, 0x65F2605C, 0x817266F2,
+0x46194629, 0x606C4529, 0x4018645C, 0x8173304C,
+0x21185E23, 0x64F22FE2, 0x6E4C62F2, 0x602C4219,
+0x66F262F2, 0x46294018, 0x461930EC, 0x42298174,
+0x652C606C, 0x305C4018, 0x81758F07, 0x0009BC9D,
+0x2228620C, 0xA00A8908, 0x60130009, 0x8B038840,
+0x0009B009, 0x0009A003, 0xE202D60F, 0x7F042622,
+0x000B4F26, 0x000B6EF6, 0x060A0009, 0x00116590,
+0x001E1000, 0x0011657C, 0x00116774, 0x00116780,
+0x00116718, 0x00116564, 0x00116748, 0x00116746,
+0x0011671A, 0x00116548, 0x00116574, 0x4F222FE6,
+0x84E9DE8E, 0x2448640C, 0xB18B8901, 0xD28C0009,
+0x26686620, 0x60E08902, 0x2E00C9BF, 0x000B4F26,
+0x000B6EF6, 0x2FE60009, 0xDE864F22, 0x60E0D686,
+0xCBC0D486, 0x62602E00, 0xC803602C, 0x40218904,
+0x70014021, 0x6603A002, 0x66034009, 0xD680616D,
+0xE500A004, 0x75016262, 0x74042422, 0x3213625D,
+0xD27C8BF8, 0x0009420B, 0xC9BF84E2, 0x4F2680E2,
+0x6EF6000B, 0x2FE62FD6, 0x7FFC4F22, 0x6260D676,
+0x89402228, 0xD56DE100, 0x60502610, 0xCB40D473,
+0x2500440B, 0x8D052008, 0x62E06E03, 0x7104612C,
+0x2F11A006, 0xD46ED666, 0xDD6E6760, 0x657C4D0B,
+0xE23C6D1D, 0x8B033D27, 0xD26CD46B, 0x0009420B,
+0x4D214D21, 0xA005D76A, 0x66E6E400, 0x357C4508,
+0x74012562, 0x35D3654D, 0xD7668BF7, 0x6E72E003,
+0x81E14018, 0x6E7260F1, 0x81E2700C, 0xD4626172,
+0xDD628113, 0x65724D0B, 0xD652D261, 0x2212E101,
+0xC93F6060, 0x7F042600, 0x6EF64F26, 0x6DF6000B,
+0x2FC62FB6, 0x2FE62FD6, 0xD25A4F22, 0x6B436E73,
+0x420B6C53, 0x20086D63, 0x61038F08, 0xD24FD456,
+0x6EF64F26, 0x6CF66DF6, 0x6BF6422B, 0x21B060C3,
+0x60D38011, 0xE5008111, 0x64BCA007, 0x6053655D,
+0x665300EC, 0x7501361C, 0x625D8064, 0x8BF53243,
+0x6060D636, 0x2600C9BF, 0x6EF64F26, 0x6CF66DF6,
+0x6BF6000B, 0x7FC44F22, 0x720262F3, 0x22512F41,
+0x45297202, 0x60632251, 0xE5C4E682, 0x67F38121,
+0x655C666C, 0xE408BFBC, 0x4F267F3C, 0x0009000B,
+0x2F962F86, 0x2FB62FA6, 0x2FD62FC6, 0x4F222FE6,
+0xE1007FC4, 0x6513ECFF, 0x6B136CCD, 0xDE34D733,
+0xEDFF64F3, 0xD833EA04, 0x6053655C, 0x027D4000,
+0x32C0622D, 0x66038D0D, 0x09ED6063, 0x2491027D,
+0x24217402, 0x698202ED, 0x3928622D, 0x74022892,
+0x75017104, 0x6063625C, 0x07D532A2, 0x0EB58FE4,
+0x2448641C, 0xE6808905, 0x67F3E5C5, 0xBF7F666C,
+0x7F3C655C, 0x6EF64F26, 0x6CF66DF6, 0x6AF66BF6,
+0x000B69F6, 0xD11C68F6, 0x6012D21C, 0xCB20E405,
+0x2102E500, 0x000B2242, 0x00002252, 0x001E1017,
+0x001164F6, 0x001E1015, 0x001E10BF, 0x00117800,
+0x001E10FC, 0x001140CC, 0x001164FC, 0x0011602E,
+0x001166D0, 0x00114F2C, 0x001166EC, 0x00114EBE,
+0x0011788C, 0x001164F8, 0x001160DC, 0x001145BC,
+0x001E2130, 0x00115FF0, 0x001166F4, 0x00116510,
+0x00116518, 0x00116710, 0x001C3500, 0x001D4004,
+0xD565D164, 0xE400D765, 0x2142E20F, 0x17411154,
+0xD5632722, 0x9669D763, 0x15412572, 0x96661562,
+0xE6011565, 0xD5601165, 0x666CE6F8, 0x25422542,
+0x25422542, 0x25422542, 0x25622542, 0x7601E727,
+0x67632572, 0x25627797, 0xE7042572, 0x2572E248,
+0xE2192522, 0xE2702522, 0x25422542, 0x25422542,
+0x25222542, 0x2522E20C, 0x25422542, 0x25422542,
+0x25422542, 0x25422542, 0x000B154A, 0xE2081145,
+0x0009422B, 0x2FE62FD6, 0x7FFC4F22, 0xC8206043,
+0x6E438D02, 0x0009BE75, 0xC81060E3, 0xBE728901,
+0x60E30009, 0x8901C840, 0x0009BE94, 0xC80160E3,
+0xDD3E8938, 0xC80260D0, 0x2F008D03, 0x460BD63C,
+0x60F00009, 0x8902C804, 0x460BD63A, 0x62F00009,
+0xC8806023, 0x60D08902, 0x2D00C97F, 0xC8016023,
+0xD6358906, 0x0009460B, 0x0009A007, 0x51630601,
+0x8902C808, 0x460BD631, 0x60F00009, 0x8902C810,
+0x420BD22F, 0xD52F0009, 0x88026052, 0xD22E8B03,
+0xA005E604, 0x88012260, 0xD22B8B02, 0x2260E601,
+0x2522E200, 0xC88060E3, 0xD628892E, 0x60E36E60,
+0x8902C880, 0x420BD226, 0x60E30009, 0x8902C840,
+0x420BD224, 0x60E30009, 0x8902C802, 0x420BD222,
+0x60E30009, 0x890EC804, 0x410BD120, 0xBF120009,
+0xBF4D0009, 0xD51E0009, 0x6050D41E, 0xC908D71E,
+0xBF842500, 0x60E32472, 0x8905C808, 0x7F04D21B,
+0x6EF64F26, 0x6DF6422B, 0x4F267F04, 0x000B6EF6,
+0x00006DF6, 0x001C581C, 0xA000A000, 0x001D0100,
+0x001D4000, 0x00040021, 0x001C589C, 0x001E1021,
+0x001150C4, 0x001150E6, 0x00115724, 0x001150FE,
+0x0011510C, 0x00116574, 0x001E100B, 0x001E1028,
+0x00115162, 0x0011516E, 0x00115114, 0x00115132,
+0x001E1000, 0x0010F100, 0x12345678, 0x0011514A,
+0x644CD6A7, 0x000B346C, 0xD6A62450, 0x346C644C,
+0x2450000B, 0x644CD6A4, 0x000B346C, 0x625C2450,
+0x4208616D, 0x42084119, 0x42006019, 0x670E614C,
+0xD49E321C, 0x4200207D, 0x324CC90F, 0x2200000B,
+0x4208625C, 0x42004208, 0x324C644C, 0x4200D498,
+0x000B324C, 0x2FE62260, 0x614C4F12, 0x4100D493,
+0x6710314C, 0xE29F666D, 0x27294619, 0x6E536269,
+0x672E6573, 0x4221227D, 0x42214221, 0x7601662C,
+0xE4014608, 0x34E84608, 0x644C4600, 0x071A0467,
+0x2150257B, 0x000B4F16, 0x4F226EF6, 0xD2857FE8,
+0x88016021, 0xD2848B7B, 0x26686621, 0xD2838B77,
+0x26686621, 0xE50F8B73, 0xE401BFA2, 0xBFA4E501,
+0xE586E400, 0xE400655C, 0x2F50BFA4, 0xBFA1E401,
+0xE602E506, 0x60634618, 0x81F2E401, 0x6543BF9F,
+0xE40185F2, 0xBFAB6543, 0x85F26603, 0x6543E401,
+0x6603BFB1, 0xE40265F0, 0x6053756C, 0x80F8BF80,
+0xBF82E402, 0x84F8E512, 0x7090E402, 0x6503BF82,
+0x4618E602, 0x81F66063, 0xBF80E402, 0x85F6E500,
+0x6603E402, 0xE500BF8C, 0xE40285F6, 0xBF926603,
+0xE5FEE500, 0xE010655C, 0xBF61E403, 0xE5130F54,
+0xE40EBF63, 0x05FCE010, 0xBF63E40E, 0xE5007585,
+0xBF64E403, 0xE500E640, 0xBF71E403, 0xE500E640,
+0xBF78E403, 0xE5FFE640, 0xE014655C, 0xBF47E404,
+0xE40F0F54, 0xE504BF49, 0x05FCE014, 0xBF49E40F,
+0xE5017584, 0xBF4AE640, 0xE501E404, 0xBF57E640,
+0xE501E404, 0xE404E640, 0xAF5C7F18, 0x7F184F26,
+0x000B4F26, 0x4F220009, 0xD2427FF0, 0x88016021,
+0xD2418B71, 0x26686621, 0xD2408B6D, 0x26686621,
+0xE50F8B69, 0xE401BF1C, 0xBF1EE501, 0xE586E400,
+0xE400655C, 0x2F50BF1E, 0xBF1BE401, 0xE401E506,
+0xBF1C6543, 0xE401E640, 0xBF296543, 0xE401E640,
+0xBF306543, 0x65F0E640, 0x756CE402, 0xBEFF6053,
+0xE40280F4, 0xE512BF01, 0xE40284F4, 0xBF017090,
+0xE6406503, 0xBF02E402, 0xE640E500, 0xBF0FE402,
+0xE640E500, 0xBF16E402, 0xE5FEE500, 0x6053655C,
+0xBEE5E403, 0xE51380F8, 0xE40EBEE7, 0xE40E84F8,
+0xBEE77085, 0xE5006503, 0xBEE8E640, 0xE500E403,
+0xBEF5E640, 0xE500E403, 0xBEFCE640, 0xE5FFE403,
+0x6053655C, 0xBECBE404, 0xE40F80FC, 0xE504BECD,
+0xE40F84FC, 0xBECD7083, 0xE5016503, 0xBECEE640,
+0xE501E404, 0xBEDBE640, 0xE501E404, 0xE404E640,
+0xAEE07F10, 0x7F104F26, 0x000B4F26, 0x00000009,
+0x001E102F, 0x001E1080, 0x001E1090, 0x001E103F,
+0x001E103E, 0x0011656E, 0x00116570, 0x00116572,
+0xD21DD11C, 0x66206010, 0x676C7001, 0x3700C90F,
+0xE5008D13, 0x67106210, 0x7701622C, 0x64232170,
+0xD6166010, 0x44084408, 0x3428C90F, 0x62602100,
+0x7201D513, 0x44082620, 0x000B354C, 0xD10F6053,
+0x25586510, 0xE6008D13, 0xD60DD40B, 0x655C6540,
+0x47086753, 0x37584708, 0x47086540, 0x24507501,
+0x367C6040, 0x2400C90F, 0x72FF6210, 0x000B2120,
+0x00006063, 0x001164F5, 0x001164F4, 0x001164F6,
+0x0011611C, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x544F0D0A, 0x53205355, 0x46204950,
+0x00003A57, 0x2074634F, 0x32203220, 0x20373030,
+0x333A3831, 0x36343A32, 0x00000000, 0x00000D0A,
+0x42707372, 0x3D206675, 0x554E203D, 0x202C4C4C,
+0x6E49677A, 0x4E497274, 0x6D754E51, 0x0000003D,
+0x52504545, 0x57204D4F, 0x65746972, 0x6461202C,
+0x003D7264, 0x6C617620, 0x0000003D, 0x00000A0D,
+0x5A205746, 0x4D435F4D, 0x4C465F44, 0x5F485341,
+0x53415245, 0x000A0D45, 0x5A205746, 0x4D435F4D,
+0x4C465F44, 0x5F485341, 0x534B4843, 0x0A0D4D55,
+0x00000000, 0x2D495053, 0x72646461, 0x0000003D,
+0x2D495053, 0x676E656C, 0x003D6874, 0x2D495053,
+0x736B6863, 0x003D6D75, 0x5A205746, 0x4D435F4D,
+0x4C465F44, 0x5F485341, 0x44414552, 0x00000A0D,
+0x61202072, 0x3D726464, 0x00000000, 0x72202020,
+0x75427073, 0x00003D66, 0x6E6B6E55, 0x206E776F,
+0x6D6D6F63, 0x3D646E61, 0x00000000, 0x00000072,
+0x00205220, 0x00000D0A, 0x62735576, 0x7473725F,
+0x00000A0D, 0x62735576, 0x7375735F, 0x646E6570,
+0x00000A0D, 0x62735576, 0x7365725F, 0x000A0D6D,
+0x72746E49, 0x6D652051, 0x2C797470, 0x49677A20,
+0x4972746E, 0x754E514E, 0x00003D6D, 0x654C7245,
+0x0000006E, 0x20746F4E, 0x756F6E65, 0x49206867,
+0x4220514E, 0x0A0D6675, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x002E0209, 0x80000101,
+0x000409FA, 0x00FF0400, 0x05070000, 0x02000201,
+0x82050700, 0x00020002, 0x03830507, 0x07010040,
+0x40020405, 0x02090000, 0x0101002E, 0x09FA8000,
+0x04000004, 0x000000FF, 0x02010507, 0x07000040,
+0x40028205, 0x05070000, 0x00400383, 0x04050701,
+0x00004002, 0x00000000, 0x00000000, 0x07090000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, };
+
+const u32_t zcFwImageSPISize=10156;
diff --git a/drivers/staging/otus/hal/hpfwu.c b/drivers/staging/otus/hal/hpfwu.c
new file mode 100644
index 00000000000..2b77cbacc6d
--- /dev/null
+++ b/drivers/staging/otus/hal/hpfwu.c
@@ -0,0 +1,1017 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include "cprecomp.h"
+
+const u32_t zcFwImage[] = {
+0x0009000B, 0x4F222FE6, 0xDE947FFC, 0xE114D594,
+0x1E13D494, 0x67521E4C, 0xD494D693, 0x37402769,
+0x62528F06, 0x7201D692, 0x60602522, 0x2600C93F,
+0xD7906152, 0x2512611D, 0x264B6652, 0x2562470B,
+0x0009B017, 0xE60095AC, 0xC84060E2, 0x2F028F03,
+0x8FF93652, 0xD4887601, 0x4E0BDE88, 0xD4880009,
+0x00094E0B, 0x4E0BD487, 0x7F040009, 0xA0524F26,
+0x4F226EF6, 0x410BD184, 0xD4840009, 0x0009440B,
+0x450BD583, 0xD7830009, 0xD283E1FF, 0x2712611D,
+0xD4825029, 0xE1FFCB01, 0x1209E501, 0x12112212,
+0xE7202452, 0x4718D57E, 0x2572D27E, 0xD17EE700,
+0xD67FD47E, 0xE2012270, 0x24702172, 0xD67D2620,
+0x2641E4FF, 0xD57CE600, 0x666DE104, 0x76016063,
+0x4000626D, 0x8FF83212, 0xD5780545, 0x2520E201,
+0xD278D777, 0xE480E100, 0x22122710, 0x6613D576,
+0x666D644C, 0x76046763, 0x375C626D, 0x8FF83243,
+0xD5722712, 0xD273D772, 0xE400E101, 0x27102511,
+0x000B4F26, 0x7FCC2242, 0xD170D56F, 0xD271DB70,
+0x1F51D471, 0xD6717508, 0x1F12D771, 0x1F55710C,
+0x1FB975FC, 0x72041F2A, 0x1F13EB10, 0x1F561F44,
+0x1F781F67, 0xD86B1F2B, 0xDD6CD96B, 0xDC6CEA00,
+0xD26DDE6C, 0x89003A22, 0xD15D7A01, 0x88016010,
+0x56F88B03, 0x4218E201, 0xD1682622, 0x0009410B,
+0x440BD467, 0xD5670009, 0x0009450B, 0x6010D150,
+0x8B108801, 0xE650D14F, 0x46186212, 0x8B083266,
+0x56F9D14B, 0x2120E200, 0xCB016062, 0x2602A003,
+0x72012710, 0x60822122, 0x89098801, 0xE2C8D15A,
+0x622C6612, 0x89033626, 0x6010D158, 0x8BC88801,
+0x51F66792, 0x217252F5, 0xD6555191, 0x55FA2212,
+0x52FB6462, 0x55612542, 0x2252E400, 0x61436643,
+0x05DE6013, 0x36CC4608, 0x07DE2652, 0xC9036071,
+0x8B028801, 0x720162E2, 0x74012E22, 0x36B3664C,
+0x71048FEE, 0x66C2D147, 0x45286512, 0x265B4518,
+0x60822C62, 0x89018801, 0x0009A168, 0x6272D742,
+0x8B132228, 0xD42BD741, 0x6772D541, 0x51536242,
+0x312C327C, 0x24222228, 0x15138D05, 0x6262D63D,
+0xB1627201, 0xD6232622, 0x2622E200, 0x52916692,
+0x8B013620, 0x0009A144, 0x6061A06E, 0x001C001C,
+0x001D4020, 0x0000B38E, 0xFFFF0000, 0x12340000,
+0x001E1015, 0x00201274, 0x002039F4, 0x002018A2,
+0x00203A00, 0x00203A18, 0x00201860, 0x0020196C,
+0x00201288, 0x001C3510, 0x001C3624, 0x001E212C,
+0x002038F4, 0x0020348C, 0x002038FC, 0x00203908,
+0x00203914, 0x00203970, 0x00203974, 0x0020391C,
+0x0020391D, 0x00203920, 0x00117700, 0x0020398C,
+0x0020398A, 0x002034F0, 0x00117710, 0x001C3D30,
+0x001C36F8, 0x00117734, 0x001C3684, 0x001C3D00,
+0x001C1000, 0x001C1028, 0x00203504, 0x00203924,
+0x00117600, 0x00117740, 0x7FFFFFFF, 0x00201730,
+0x0020332A, 0x00202334, 0x00203DA4, 0x00203972,
+0x002034FC, 0x00203964, 0x001C3D2C, 0x001C36B0,
+0x00203494, 0x0011775C, 0x8801C90F, 0xA0CF8901,
+0xD1960009, 0x36206212, 0xD4958904, 0x2421E200,
+0x2162A0CC, 0x6211D193, 0x89012228, 0x0009A0C3,
+0xE202D78F, 0x75016571, 0x3123615D, 0x27518D02,
+0x0009A0BC, 0xD28C57F2, 0x62226072, 0x40094019,
+0xC90F4009, 0x8F19880A, 0x52F31F2C, 0x40196022,
+0x40094009, 0x8808C90F, 0xA0A78901, 0x60630009,
+0xCB0154F7, 0xD27E55F2, 0xE7012402, 0xD47FE100,
+0x22112572, 0x72016242, 0x2422A098, 0x8B3F8805,
+0x602252F3, 0x40094019, 0xC90F4009, 0x8B168802,
+0xE4FFD577, 0x644D6752, 0x8B102748, 0x6272D775,
+0x8B0C3260, 0x51F255F7, 0xD26DE701, 0x21722562,
+0xD571E100, 0x64522211, 0xA0777401, 0x52F32542,
+0x40196022, 0x40094009, 0x8805C90F, 0x31B38B6E,
+0xD26A8B6C, 0x672254F4, 0x7701D569, 0x61422272,
+0x1F1CE640, 0x46182159, 0x8B033160, 0x6262D665,
+0x26227201, 0xE200D65A, 0x2621B067, 0x0009A056,
+0x3123E220, 0x88038B52, 0x52F38B1E, 0x40196022,
+0x40094009, 0x8803C90F, 0xD25B8B16, 0x672254F4,
+0x7701D557, 0x61422272, 0x1F1CE640, 0x46182159,
+0x8B033160, 0x6262D655, 0x26227201, 0xE200D648,
+0x2621B043, 0x0009A010, 0xD452D551, 0xD2446752,
+0xE1007701, 0x25723A46, 0x22118F06, 0xEA00D64E,
+0x72016262, 0x2622B031, 0x2FB2D54C, 0x95736652,
+0xD44A5BF1, 0x36205241, 0x60618910, 0x8B01C803,
+0x2B22E201, 0x8FF54510, 0x57F15664, 0x6272E1F0,
+0x41284118, 0x2722221B, 0x6BF2A008, 0x6BF2A006,
+0xE200D62F, 0xD12F2621, 0x2121E200, 0xD13CE201,
+0x66122822, 0x8B012668, 0x0009AE2B, 0x450BD539,
+0xD1390009, 0xAE24E600, 0x2F862160, 0x2FA62F96,
+0x2FC62FB6, 0x2FE62FD6, 0x7FF44F22, 0xDE34D133,
+0x54116212, 0x1F4167E2, 0x2F22D432, 0xD5321F72,
+0xD2326743, 0x58417794, 0x69425A42, 0x5B166C72,
+0x60526D22, 0xCB20E600, 0xE5402502, 0x626D7601,
+0x8BFB3253, 0x55F162F2, 0x11512122, 0xD62855F2,
+0x14812E52, 0x249214A2, 0x27C2D426, 0x26D211B6,
+0xDA256742, 0xE801D925, 0x490B2A72, 0xE2011A8C,
+0x1A2C4218, 0x4F267F0C, 0x6DF66EF6, 0x6BF66CF6,
+0x69F66AF6, 0x68F6000B, 0x000007D1, 0x00203984,
+0x00203988, 0x0020398E, 0x001C3DC0, 0x0011772C,
+0x001C3B88, 0x0020396C, 0x0011773C, 0x00117744,
+0x0000F000, 0x00117764, 0x00117748, 0x00117768,
+0x0011776C, 0x01FFFFFF, 0x0011774C, 0x002034FC,
+0x00203DA4, 0x002024F8, 0x00203972, 0x001C3B9C,
+0x001C3D98, 0x001C3700, 0x001C3500, 0x001C5960,
+0x001C8960, 0x00203504, 0x001C3D00, 0x0020160C,
+0x2F962F86, 0x2FB62FA6, 0x2FD62FC6, 0x4F222FE6,
+0xDE957FAC, 0x61E0E014, 0x0F14D494, 0x710161E3,
+0xE0186210, 0xD2920F24, 0x0009420B, 0x450BD591,
+0x20080009, 0x8F126D03, 0xD28F1F07, 0x6720D48F,
+0x657CDD8F, 0x470BD78F, 0xD18F0009, 0x619C6910,
+0x46086613, 0x36184608, 0x3D6C4608, 0xE0181FD7,
+0xE58004FC, 0x604C66E2, 0x3050655C, 0x2D628F15,
+0x01FCE014, 0xDE85E500, 0x641CA008, 0x6753655D,
+0x607037EC, 0x39DC6953, 0x80947501, 0x3243625D,
+0xD67F8BF4, 0xA34EE200, 0x20082621, 0xE0148B13,
+0xE40001FC, 0xA009DE79, 0x644D671C, 0x35EC6543,
+0x69436652, 0x39DC6262, 0x74041921, 0x3273624D,
+0xA3388BF3, 0x88012D10, 0xE0148B17, 0xE70001FC,
+0x6D1C2D70, 0xDE6D1FD4, 0x32D3627D, 0xA32A8B01,
+0x677D0009, 0x667365E3, 0x61737504, 0x315C36EC,
+0x69126462, 0xAFEF7708, 0x88042492, 0xE0148B18,
+0xE40001FC, 0x671C2D40, 0x624DDE60, 0x8B013273,
+0x0009A311, 0x6943644D, 0x39EC62E3, 0x72046592,
+0x3D2C6D43, 0x615266D2, 0x21697408, 0x2512AFED,
+0x8B188805, 0x01FCE014, 0x2D40E400, 0xDE53671C,
+0x3273624D, 0xA2F68B01, 0x644D0009, 0x62E36943,
+0x659239EC, 0x6D437204, 0x66D23D2C, 0x74086152,
+0xAFED216B, 0x88312512, 0xD44A8B3A, 0x6146D94A,
+0x75046543, 0x67566442, 0x6E531F48, 0x65527E04,
+0x7EE462E2, 0x7E0464E2, 0x6EE21FE9, 0x5EF929E0,
+0x7E04D942, 0x1FEA60E2, 0x2900C901, 0xD9406EE2,
+0x29E04E09, 0x2F562F26, 0x56FAD93E, 0x6513490B,
+0xD13D7F08, 0xE71C6E0D, 0x1DE12D70, 0xDE3B6912,
+0x64E21D92, 0x1D43D13A, 0xD23A6512, 0x67221D54,
+0x1D75D239, 0x1D666622, 0x6262D638, 0x1D27A2AB,
+0x8B398830, 0x6596D92B, 0x67926696, 0x61967904,
+0x74E46493, 0x6E436992, 0x1F9B7E04, 0x1FEC6442,
+0xD9256EE2, 0x5EFC29E0, 0x7E04D924, 0x1FED60E2,
+0x2900C901, 0xD9226EE2, 0x29E04E09, 0x59FC7FFC,
+0xDE272F92, 0x2F164E0B, 0xD41F7F08, 0xE21C610D,
+0x1D112D20, 0xD2206442, 0xD41C1D42, 0x1D536542,
+0x6752D51B, 0xD71B1D74, 0x1D156172, 0x1D666622,
+0x6262D61A, 0x1D27A26F, 0x8B358833, 0x490BD919,
+0xA268EE00, 0x00002DE0, 0x00117800, 0x00203A1C,
+0x002018A2, 0x00202AAC, 0x0020390E, 0x00203A20,
+0x00203534, 0x002018EE, 0x0020390D, 0x00117804,
+0x0020398C, 0x00117810, 0x00203909, 0x0020390A,
+0x0020390B, 0x00200F64, 0x001C5864, 0x001C6864,
+0x001C7864, 0x001C59BC, 0x001C69BC, 0x001C79BC,
+0x00200FBC, 0x00200FB8, 0x89018828, 0x0009A0C0,
+0xE643DEB5, 0x326662E1, 0x1FEE8F02, 0x2E21E240,
+0x622D62E1, 0x8B013267, 0x0009A0AA, 0xE50185E1,
+0x8B013056, 0x0009A0A4, 0x2D10E101, 0x64E1B225,
+0xE64357FE, 0x652D6271, 0x89443567, 0x3563E640,
+0xE6008B05, 0x0F65E040, 0xA00FE11A, 0x615372C0,
+0x41214121, 0x41214121, 0x45214121, 0x45214521,
+0xC9036053, 0xE0406603, 0x71180F65, 0x2209E007,
+0x0F25E03C, 0xE044641D, 0xB2A365F3, 0xE33C0F46,
+0x853233FC, 0x620DDE95, 0x42086031, 0x6023610D,
+0x1323E944, 0x06FE4108, 0xE00F39FC, 0x13144E0B,
+0x67075D91, 0x60D32679, 0x0F6654FE, 0x51928542,
+0x600D4E0B, 0x60D3260B, 0x0F666492, 0x65F3B237,
+0x696156FE, 0xE640659D, 0x89383563, 0xD78359FE,
+0x79066591, 0xC9036053, 0x40004008, 0x61036203,
+0x0F26E050, 0x470BE0FF, 0x6C07600C, 0x6603605D,
+0x46214621, 0x46214621, 0x42006263, 0x4200326C,
+0x40214021, 0x4008C903, 0x6D2D30FC, 0xE8006A03,
+0xB25765F3, 0x6EA264D3, 0x2EC9E050, 0x66942AE2,
+0xD76E01FE, 0x606C470B, 0x2AE22E0B, 0x64D365F3,
+0x7801B1FD, 0xEE06628D, 0x8FE932E3, 0x5EFE7D01,
+0x61E1E400, 0x410085E1, 0x66E3310C, 0x760C711B,
+0xE70465F3, 0x68667401, 0x3A736A4D, 0x8FF92582,
+0x65F37504, 0x641DB1E3, 0x64E1B1A4, 0x0009A17B,
+0xD45B56F7, 0xEC01D25B, 0x26C0420B, 0x0009A173,
+0x06FCE018, 0x8829606C, 0x58F78B08, 0xE400D252,
+0x66222840, 0x646DB171, 0x0009A165, 0x666CE681,
+0x89013060, 0x0009A0AC, 0xD550D14F, 0x62126A56,
+0x212232AC, 0x54116C56, 0x34CC6253, 0x64521141,
+0x72085812, 0xD44A384C, 0x68221182, 0x5A136C42,
+0x3ACC3C8C, 0x11A324C2, 0x6C2272EC, 0x72105814,
+0x118438CC, 0x5A156822, 0x11A53A8C, 0x6A227210,
+0xD6405816, 0x118638AC, 0x52176C62, 0x112732CC,
+0x5A185861, 0x11A83A8C, 0x5C195A62, 0x11C93CAC,
+0x521A5C63, 0x112A32CC, 0x5A1B5864, 0x11AB3A8C,
+0x5C1C5A65, 0x11CC3CAC, 0x521D5C66, 0x112D32CC,
+0x5A1E5867, 0x11AE3A8C, 0x561F5A68, 0x36ACE840,
+0x116FDA2D, 0x6CA2381C, 0x7A946682, 0x286236CC,
+0x5C8162A2, 0x18C13C2C, 0x62A27A44, 0x362C5682,
+0xD6261862, 0x5A856262, 0x3A2C4229, 0x760418A5,
+0x56866262, 0x362C4229, 0x56F71866, 0x2620E238,
+0x16C15C81, 0x16226212, 0xE2005C11, 0x551216C3,
+0x55151654, 0x55131655, 0x55161656, 0x55821657,
+0x65821658, 0x55141659, 0x5584165A, 0x5583165B,
+0x5585165C, 0x5586165D, 0x1821165E, 0x11212122,
+0x11251122, 0x11261123, 0x28221822, 0x18241124,
+0x18251823, 0x1826A0C7, 0x00117804, 0x002033E8,
+0x00203A40, 0x002018A2, 0x00203494, 0x001C36A0,
+0x002034F0, 0x001C3CA0, 0x001C36F4, 0x001C3B88,
+0x666CE682, 0x8B203060, 0xEA2456F7, 0x26A0D194,
+0x16C15C17, 0x16225218, 0x16835819, 0x16A45A1A,
+0x16C55C1B, 0x1626521C, 0xE200581D, 0x551E1687,
+0x551F1658, 0x11271659, 0x11291128, 0x112B112A,
+0x112D112C, 0xA08E112E, 0xE683112F, 0x3060666C,
+0x52F78B0B, 0xEA00D883, 0x658222A0, 0x7804DC82,
+0x62822C52, 0xA07ED681, 0xE6902620, 0x3060666C,
+0xDA7F8B06, 0x00094A0B, 0xE20056F7, 0x2620A073,
+0x666CE691, 0x8B103060, 0x6222D276, 0x2228622C,
+0xD2788904, 0x0009420B, 0x0009A003, 0x420BD276,
+0x56F70009, 0xA05EE200, 0xE6922620, 0x3060666C,
+0xE0188951, 0xE6B00BFC, 0x666C62BC, 0x8B2A3260,
+0x02FCE014, 0x682CEA00, 0x62ADE904, 0x894A3283,
+0x6AADDD64, 0x3CDC6CA3, 0x7D046EC2, 0xDB68D467,
+0x32DC62A3, 0x4B0BDC67, 0x4C0B6D22, 0xD46664E3,
+0x00094B0B, 0x64D34C0B, 0x4B0BD464, 0xE6000009,
+0x666D6BE3, 0x76013B6C, 0x3293626D, 0x8FF72BD0,
+0xAFDA4D19, 0xE6B57A08, 0x3260666C, 0xD45C8B13,
+0x4B0BDB57, 0xD25B0009, 0x6022DB5B, 0xCB20E6FF,
+0x2202666D, 0xDB592B62, 0xE014E200, 0x56F72B20,
+0xA01002FC, 0xD4562620, 0x6542D256, 0x420BD456,
+0xA0080009, 0xDB520009, 0x52B1E600, 0x622CDB53,
+0x52F72B21, 0x7F542260, 0x6EF64F26, 0x6CF66DF6,
+0x6AF66BF6, 0x000B69F6, 0x4F2268F6, 0xE240614D,
+0x89143123, 0x3127E21F, 0x8B09D749, 0xD449614D,
+0xE00171E0, 0x5671440B, 0x26596507, 0x1761A007,
+0xE001D444, 0x6672440B, 0x26596507, 0x4F262762,
+0x0009000B, 0x614D4F22, 0x3123E240, 0xE21F8912,
+0xD73B3127, 0x614D8B08, 0x5671D23A, 0x420B71E0,
+0x260BE001, 0x1761A006, 0x6672D236, 0xE001420B,
+0x2762260B, 0x000B4F26, 0xE6400009, 0x46284618,
+0x6252D531, 0x89FC2268, 0x0009000B, 0x4618E680,
+0xD52D4628, 0x22686252, 0x000B89FC, 0xA0010009,
+0x7201E200, 0x8BFC3242, 0x0009000B, 0x4618E680,
+0xD5264628, 0x22686252, 0x000B8BFC, 0x2FE60009,
+0x7FFC4F22, 0xBFF16E53, 0x61E22F42, 0xE280D620,
+0x54E11615, 0x16464218, 0x422855E2, 0x57E31657,
+0x16786EF2, 0x26E22E2B, 0x4F267F04, 0x6EF6AFCE,
+0x00203494, 0x00117804, 0x002038F4, 0x00203908,
+0x0020050A, 0x00201008, 0x0020102E, 0x00203A58,
+0x002018A2, 0x002018E6, 0x00203A6C, 0x00203A74,
+0x00203A78, 0x001C3500, 0x001C1000, 0x0020398A,
+0x00117800, 0x002018EE, 0x00203A8C, 0x00203990,
+0x001C3704, 0x002033E8, 0x001C373C, 0x001C3700,
+0x001C370C, 0x2FD62FC6, 0x4F222FE6, 0x6C53DD10,
+0x6E43BFA4, 0x2DE2BF89, 0x0009BFA0, 0x2C1251D5,
+0x1C4154D6, 0x1C5255D7, 0x1C6356D8, 0x6EF64F26,
+0x000B6DF6, 0x61636CF6, 0xA004E600, 0x62564109,
+0x24227601, 0x36127404, 0x000B8BF9, 0x00000009,
+0x001C370C, 0x0009A16E, 0x2FE62FD6, 0xDD944F22,
+0xA0049EB2, 0xD4930009, 0x420BD293, 0x62D265D2,
+0x8BF822E8, 0x0009A004, 0xD28FD490, 0x55D1420B,
+0x22E852D1, 0xA0048BF8, 0xD48D0009, 0x420BD28A,
+0x52D255D2, 0x8BF822E8, 0x0009A004, 0xD286D489,
+0x55D3420B, 0x22E852D3, 0xA0048BF8, 0xD4860009,
+0x420BD281, 0x52D455D4, 0x8BF822E8, 0x6EF64F26,
+0x6DF6000B, 0x2FD62FC6, 0x4F222FE6, 0x6E636C73,
+0x6D53B01A, 0x64D357F4, 0xB05F65E3, 0xB07566C3,
+0xB0A40009, 0xB0A80009, 0xB0AC0009, 0xB0AC0009,
+0xB0AF0009, 0xB03154F5, 0x6CCD6C03, 0x4F2660C3,
+0x6DF66EF6, 0x6CF6000B, 0x3412D170, 0xD6700529,
+0x2650D770, 0x2742000B, 0x0009A018, 0x2FD62FC6,
+0x4F222FE6, 0x6E636C73, 0x6D53BFEE, 0x64D357F4,
+0xB03365E3, 0xB08D66C3, 0xB00F54F5, 0x6CCD6C03,
+0x4F2660C3, 0x6DF66EF6, 0x6CF6000B, 0xE503D162,
+0xD763D462, 0x21524518, 0x2472000B, 0xD45FD15E,
+0x2162E600, 0x2462000B, 0xBF734F22, 0xBF73E40A,
+0xD25C0009, 0x4118E104, 0xE40AE500, 0xBF692212,
+0xD7592252, 0xCB206072, 0x000B4F26, 0x4F222702,
+0x410BD156, 0xD556E400, 0x4F26452B, 0xD1552FE6,
+0x66126E63, 0x92104418, 0x44084528, 0x45002629,
+0x265B4408, 0x264B4400, 0x21624708, 0xD14E4708,
+0x217227EB, 0x6EF6000B, 0x1FFF03F0, 0x4F222FE6,
+0xE101DE4A, 0xBF3DE40A, 0x67E32E12, 0xE500776C,
+0xE204E130, 0x2752E40A, 0x27522752, 0x27522752,
+0x27522752, 0x27522752, 0x27522752, 0x27522752,
+0x27522752, 0x27522752, 0x27522752, 0x27222712,
+0x27522752, 0x27522752, 0x27522752, 0x27522752,
+0x175ABF18, 0x2E62E600, 0x000B4F26, 0xD2346EF6,
+0xE441E101, 0x000B2212, 0xD1322242, 0xE605D432,
+0x000B2162, 0x000B2462, 0xD2300009, 0xE40AE601,
+0x2262AF00, 0x2FC62FB6, 0x2FE62FD6, 0x7FFC4F22,
+0x6C43DB2B, 0xED0060B2, 0x2B02CB03, 0xC90360B2,
+0x6E03A008, 0x89073DC2, 0xE46460B2, 0xB07CC903,
+0x7D016E03, 0x8BF52EE8, 0x8F043DC2, 0xD4212FE1,
+0x460BD621, 0x62F10009, 0x6023622D, 0x89FFC801,
+0x7F046023, 0x6EF64F26, 0x6CF66DF6, 0x6BF6000B,
+0x001C3B88, 0x00203AA0, 0x002018EE, 0x00203AA8,
+0x00203AB0, 0x00203AB8, 0x00203AC0, 0x0025E720,
+0x00203DA0, 0x002038F8, 0x001C5968, 0x001C3B40,
+0x000F8000, 0x001D4004, 0x001C3500, 0x002015E0,
+0x0020160C, 0x001C5814, 0x001C59D0, 0x001C5830,
+0x001C6268, 0x001C59A4, 0x001C639C, 0x001C581C,
+0x001C5860, 0x00203AC8, 0x002018A2, 0x8F014411,
+0x6043604B, 0x0009000B, 0x5651D52B, 0x46286052,
+0x306C000B, 0x2FC62FB6, 0x2FE62FD6, 0x4F124F22,
+0xBFF14F02, 0x6B036E43, 0xDD25DC24, 0x0009BFEC,
+0x3C0530B8, 0x4609060A, 0x46014609, 0x020A3D65,
+0x42094209, 0x32E24209, 0x4F068BF0, 0x4F264F16,
+0x6DF66EF6, 0x000B6CF6, 0x2FC66BF6, 0x2FE62FD6,
+0x4F124F22, 0xBFCF4F02, 0x6C036E43, 0xBFCBDD13,
+0x30C80009, 0x060A3D05, 0x46094609, 0x36E24601,
+0x4F068BF5, 0x4F264F16, 0x6DF66EF6, 0x6CF6000B,
+0x4F222FE6, 0xE102DE0B, 0xE403E500, 0xBFB92E12,
+0xE6062E52, 0xE7004618, 0x2E62E403, 0x4F262E72,
+0x6EF6AFB0, 0x0009000B, 0x001C1040, 0xCCCCCCCD,
+0x10624DD3, 0x001D4004, 0x2F962F86, 0x2FB62FA6,
+0x2FD62FC6, 0x4F222FE6, 0xE5007F98, 0x6453E710,
+0x6B534728, 0xEE1ADCBC, 0x6153655D, 0x315C4108,
+0x75014108, 0x6043317C, 0x0F16665D, 0xED0060B3,
+0x21B136E3, 0x81128111, 0x11D28113, 0x11D411D3,
+0x74048FEA, 0xD8B167F2, 0x1871D9B1, 0x58F12872,
+0x1981D1B0, 0x59F22982, 0x5DF45AF3, 0x54F65EF5,
+0x21921191, 0x11A211A3, 0x11D411D5, 0x11E611E7,
+0x11481149, 0xDAA855F7, 0x57F8EE00, 0x52F9DDA7,
+0x64E3D6A7, 0x2A521A51, 0xD8A7D9A6, 0x2D729AD5,
+0x6EED2622, 0x4D086DE3, 0x3DEC61E3, 0x4D084108,
+0x3D9C31EC, 0x410860B3, 0x81D12DB1, 0x4108E050,
+0x4008E7B7, 0x677C4108, 0x60B381D2, 0xE200318C,
+0x81D33472, 0x1D131DD2, 0x8D01D493, 0xD4901D24,
+0xB0B365D3, 0x64ED7E01, 0x8BDA34A2, 0x2FD2DA8C,
+0xDD9268A2, 0x2D824829, 0x7DFC64A2, 0xD287694D,
+0x6E222D92, 0x7D0C4E29, 0x68222DE2, 0x618D6AD3,
+0x2A16D784, 0xD48A6D72, 0x24D2D583, 0xD6895E72,
+0x517414E2, 0x1414EE00, 0xD1875876, 0x59781486,
+0x1498E710, 0x65E36252, 0x26E2142A, 0xE60064E3,
+0x6843644D, 0x384C4808, 0x381C4808, 0x0C866053,
+0x09CE28B1, 0x819160B3, 0x0ACE6053, 0x81A26043,
+0x0DCE6053, 0x81D360B3, 0x08CE6053, 0x18827401,
+0x624D09CE, 0x0ACE19E3, 0x1A643273, 0x75048FE0,
+0xE003D96A, 0x40186C92, 0x6D922CB1, 0x81D1DA6F,
+0x6E92E050, 0x81E24008, 0x60B36192, 0x64928113,
+0x1442E600, 0xD4696792, 0x689217A3, 0x1864E1FF,
+0x6563E703, 0x364C4608, 0x26127501, 0x3673665D,
+0xDC5B8BF8, 0x6DC2E003, 0x2DB14018, 0xD2606EC2,
+0x61C281E1, 0x1112EE00, 0xE02464C2, 0x65C21423,
+0x15E4D45B, 0xE58067C2, 0x68C28172, 0x818366E3,
+0x666D655C, 0x76046963, 0x394C6A6D, 0x8FF83A53,
+0xDB5429E2, 0x24B2DC54, 0x24C27404, 0x4F267F68,
+0x6DF66EF6, 0x6BF66CF6, 0x69F66AF6, 0x68F6000B,
+0x60116142, 0x8F03C803, 0xD23DE500, 0x8B063420,
+0xC9036011, 0x8B068802, 0x3420D239, 0x56128B03,
+0x52646513, 0x000B2422, 0x01136053, 0x2FE62FD6,
+0x7FEC4F22, 0x62536E53, 0x6D43E550, 0x4508E400,
+0xE101A001, 0x60435224, 0x81212211, 0x60538123,
+0x56E28122, 0x8BF53620, 0x16E4D238, 0xE61464F3,
+0x65E3420B, 0xE4FC65E1, 0x2E512549, 0x65F361F1,
+0x2F112149, 0xD13154D1, 0xE614410B, 0x607157D1,
+0x2701CB01, 0x7F141DE1, 0x6EF64F26, 0x6DF6000B,
+0x2FE62FD6, 0x7FEC4F22, 0x66536E53, 0x6D43E5FC,
+0x20596061, 0x2601CB01, 0x326052E2, 0x12E48B06,
+0x31E051E2, 0x52D18B04, 0x1E22A002, 0x5664AFF0,
+0x64F3D21E, 0x420BE614, 0x67E165E3, 0x2719E1FC,
+0x67F12E71, 0x271954D1, 0x65F3D118, 0x410BE614,
+0x52D12F71, 0xCB016021, 0x1DE12201, 0x4F267F14,
+0x000B6EF6, 0x00006DF6, 0x00203924, 0x002034F4,
+0x002034FC, 0x00203504, 0x0020352C, 0x00203910,
+0x00203918, 0x00100208, 0x001017C0, 0x001E210C,
+0x001C3D00, 0x00203964, 0x001000C8, 0x00117880,
+0x00117780, 0x00040020, 0x0026C401, 0x00200ED6,
+0x4F222FE6, 0xDE42624C, 0x42004208, 0x3E2CA005,
+0xD4405252, 0xBF695624, 0x65E22E62, 0x352052E1,
+0xD63D8BF6, 0x4F262622, 0x6EF6000B, 0x2FC62FB6,
+0x2FE62FD6, 0xDC394F22, 0x52C1DB39, 0x362066C2,
+0x6061891C, 0x8801C903, 0xDE348918, 0xBF37DD35,
+0x650364E3, 0x66B28503, 0x3262620D, 0xD4328907,
+0x0009BF76, 0x4D0BD431, 0xAFE60009, 0xBF3D0009,
+0xD42F64E3, 0x00094D0B, 0x0009AFDF, 0x2262D22D,
+0x6EF64F26, 0x6CF66DF6, 0x6BF6000B, 0x2FD62FC6,
+0x4F222FE6, 0xDD29DC28, 0x6E4360C2, 0x04DE4008,
+0xE614D127, 0x65E3410B, 0xD127D726, 0x55E227E2,
+0x35E05254, 0x21228F04, 0x400860C2, 0x122202DE,
+0x605365C2, 0x75014008, 0x0DE606DE, 0xC90F6053,
+0x60632C02, 0x6EF64F26, 0x000B6DF6, 0x85436CF6,
+0x650D5643, 0x622D6262, 0x35277204, 0xE1008F0C,
+0x2268960C, 0xD6158B03, 0x72015261, 0xD6131621,
+0x6262E101, 0x26227201, 0x6013000B, 0x000001FF,
+0x00203504, 0x002034FC, 0x001C3D00, 0x0020352C,
+0x002038F4, 0x002018A2, 0x002034F4, 0x00203AF0,
+0x00203AF4, 0x001C3D28, 0x00203964, 0x00203924,
+0x00200ED6, 0x00203968, 0x0020396C, 0x00117754,
+0x2FC62FB6, 0x2FE62FD6, 0x7FF84F22, 0x6022D237,
+0x8D58C803, 0xDE362F01, 0xDB37DC36, 0x66C252C1,
+0x892F3620, 0xC9036061, 0x892B8801, 0xD233DD31,
+0x64D3420B, 0x1F016503, 0x880160B1, 0xD2308B04,
+0x64D3420B, 0x0009AFEA, 0x85615653, 0x8904C820,
+0xE050D72C, 0x7201027E, 0xD22B0726, 0x6453420B,
+0x89072008, 0x55F1D126, 0x64D3410B, 0xE601D727,
+0x2762AFD4, 0x55F1D226, 0x64E3420B, 0xE601D125,
+0x2162AFCC, 0xDD25DE24, 0xDC26DB25, 0x66D252D1,
+0x89183620, 0xC9036061, 0x89148801, 0xD117D41F,
+0x0009410B, 0x36E05603, 0x65038F04, 0x2B20E201,
+0x2C52AFEC, 0xD712D41C, 0x0009470B, 0xE601D115,
+0xAFE34618, 0x60F12162, 0x8907C804, 0x7F08D217,
+0x6EF64F26, 0x6CF66DF6, 0x6BF6422B, 0x4F267F08,
+0x6DF66EF6, 0x000B6CF6, 0x00006BF6, 0x001E2100,
+0x00203504, 0x002034FC, 0x0020398C, 0x002014A0,
+0x002014CC, 0x00203494, 0x002016BE, 0x001E212C,
+0x00201530, 0x001C3D30, 0x00117880, 0x002034F4,
+0x00203914, 0x00203910, 0x0020352C, 0x00200610,
+0xE601D203, 0x1265D503, 0x000B2252, 0x00001266,
+0x001C1010, 0x0000C34F, 0x0009000B, 0x2FD62FC6,
+0x4F222FE6, 0x6D436C53, 0xEE00A004, 0x7E0164D4,
+0x644CBFF2, 0x8BF93EC2, 0x6EF64F26, 0x000B6DF6,
+0xE5006CF6, 0x6643A002, 0x76017501, 0x22286260,
+0xAFE38BFA, 0x2FE60009, 0x75076253, 0xE1086753,
+0x6043EE0A, 0x4409C90F, 0x650330E2, 0x8D014409,
+0xE630E637, 0x4110365C, 0x8FF22760, 0xE00077FF,
+0x000B8028, 0x000B6EF6, 0x000BE000, 0x2FE6E000,
+0x7FEC4F22, 0x6E436253, 0xBFDC65F3, 0xBFD06423,
+0xBFCE64E3, 0xD40364F3, 0x0009BFCB, 0x4F267F14,
+0x6EF6000B, 0x00203AF8, 0xE4FDD29F, 0xD79F6122,
+0x22122149, 0x74016022, 0x2202CB01, 0xD59C6622,
+0x22622649, 0xC8406070, 0x60528902, 0x2502CB04,
+0xE1F76452, 0x25422419, 0xE7016052, 0x2502CB40,
+0xE6026052, 0x2502C9CF, 0x47186052, 0x2502CB10,
+0xCB036052, 0x15622502, 0x1573000B, 0xD78ED58D,
+0xD48FD28E, 0xE600E100, 0x27112511, 0xAFCB2210,
+0x664C2461, 0x4600D28B, 0x6060362C, 0x000BCB10,
+0x654C2600, 0x4500D287, 0x6650352C, 0x2619E1EF,
+0x2560000B, 0xD284664C, 0x362C4600, 0xCB106060,
+0x2600000B, 0xD280654C, 0x352C4500, 0xE1EF6650,
+0x000B2619, 0x664C2560, 0x4600D27A, 0x6060362C,
+0x000BCB08, 0x654C2600, 0x4500D276, 0x6650352C,
+0x2619E1F7, 0x2560000B, 0xD273664C, 0x362C4600,
+0xCB086060, 0x2600000B, 0xD26F654C, 0x352C4500,
+0xE1F76650, 0x000B2619, 0x624C2560, 0x4200D669,
+0x6020326C, 0x4021C908, 0x40214021, 0x600C000B,
+0xD665624C, 0x326C4200, 0xC9086020, 0x40214021,
+0x000B4021, 0xD161600C, 0x341C644C, 0x000B6240,
+0xD15F602C, 0x341C644C, 0x000B6240, 0x2FE6602C,
+0x6E434F22, 0xE60A645C, 0x89143467, 0x0009BFEB,
+0x60EC640C, 0x8B028801, 0xA002E00F, 0x44092409,
+0x624C4409, 0x3263E60A, 0xBFE28905, 0x620C644C,
+0xC8806023, 0xE2008B00, 0x4F266023, 0x6EF6000B,
+0xD64C4F22, 0x88016062, 0xB2578B03, 0xA0030009,
+0xD2490009, 0x2260E640, 0xE200D648, 0x000B4F26,
+0x4F222622, 0x6062D643, 0x8B018802, 0x0009B2A0,
+0xE200D642, 0x000B4F26, 0xD53E2622, 0xE100D43E,
+0x2512E701, 0x2470000B, 0xE604D23B, 0x2260000B,
+0xD43B4F22, 0x410BD13B, 0xD53B0009, 0x6650E1FD,
+0x2619D23A, 0x2560E700, 0x000B4F26, 0x4F222270,
+0xD238D537, 0xD7386152, 0x2512611D, 0xE6FF6452,
+0x2542242B, 0xD22FD435, 0x420B666D, 0xD52E2762,
+0x6750E1FB, 0x4F262719, 0x2570000B, 0xD4304F22,
+0x410BD128, 0xD5280009, 0x6650E7F7, 0x4F262679,
+0x2560000B, 0x9425D524, 0x22496250, 0x2520000B,
+0xE4BFD521, 0x22496250, 0x2520000B, 0xD2254F22,
+0x600D8522, 0x89112008, 0x89458801, 0x89478803,
+0x89498805, 0x894F8806, 0x89558808, 0x895B8809,
+0x8961880A, 0x8967880B, 0x0009A06E, 0x0009B070,
+0x600CA06B, 0x0000FF7F, 0x001E2148, 0x001E1000,
+0x001E1108, 0x002039C4, 0x002039C6, 0x002039E5,
+0x002039A8, 0x001E103F, 0x001E105F, 0x001E102F,
+0x001E1090, 0x002039CC, 0x001E100B, 0x002039C8,
+0x00203AFC, 0x002018A2, 0x001E1028, 0x002039E4,
+0x001D4020, 0x98760000, 0x001C1000, 0x00203B08,
+0x00203B18, 0x0020399C, 0x0009B04C, 0x600CA035,
+0x0009B055, 0x600CA031, 0x6260D684, 0x8B2B2228,
+0x0009B061, 0x600CA029, 0x6260D680, 0x8B232228,
+0x0009B069, 0x600CA021, 0x6260D67C, 0x8B1B2228,
+0x0009B0C7, 0x600CA019, 0x6260D678, 0x8B132228,
+0x0009B0CD, 0x600CA011, 0x6260D674, 0x8B0B2228,
+0x0009B125, 0x600CA009, 0x6260D670, 0x8B032228,
+0x0009B13D, 0x600CA001, 0x4F26E000, 0x0009000B,
+0xD26CD16B, 0xD56C8412, 0x4000C90F, 0xD76B012D,
+0xE403D66B, 0xE20F611C, 0x2540E001, 0x25202712,
+0x2602000B, 0xE601D262, 0x30668523, 0xE0008D05,
+0xD663D260, 0xE0018122, 0x000B2602, 0xD25C0009,
+0x600D8523, 0x89052008, 0x8B0A8801, 0x6060D65D,
+0x2600CB01, 0xD457D65A, 0xE001E101, 0x000B2612,
+0x000B8142, 0xD152E000, 0x8513E501, 0x640D4518,
+0x66033453, 0xE0008D05, 0xD551D253, 0x2260E001,
+0x000B2502, 0x4F220009, 0x8513D149, 0x6453650D,
+0x62494419, 0x227D672E, 0x8801602C, 0x88028909,
+0x88038910, 0x8806891A, 0x88078935, 0xA04C893B,
+0xD5460009, 0x6652D746, 0x2762D446, 0x622C6261,
+0x2421A038, 0x2228625C, 0xD4438B3F, 0x6642D540,
+0x2562D440, 0x24018561, 0x6203A02C, 0x2008605C,
+0x88108907, 0x88208908, 0x88308909, 0xA02C890A,
+0xD23A0009, 0x6222A008, 0xA005D239, 0xD2396222,
+0x6222A002, 0x6262D638, 0xD432D531, 0x66212522,
+0xA00F626C, 0xD6352421, 0x6261D52D, 0x622CD42D,
+0xA0072562, 0xD6322421, 0x8561D529, 0x2562D429,
+0x62032401, 0x662D8515, 0x3617610D, 0x65038F01,
+0xB0CB2451, 0xA0010009, 0xE000E001, 0x000B4F26,
+0xD6190009, 0xD427E101, 0x65412610, 0xD118D717,
+0xE20F655D, 0x2752E001, 0x000B2620, 0x2FE62102,
+0xD20F4F22, 0x640C8523, 0x8B082448, 0xD511D61D,
+0x2621E200, 0x940F8451, 0xA0482049, 0xDE0D8051,
+0xC84060E0, 0xE2018D32, 0x89443427, 0xD216D615,
+0x2641420B, 0x0009A030, 0x0000FF7F, 0x002039E5,
+0x0020399C, 0x002039A8, 0x001E1100, 0x001E100C,
+0x002039C8, 0x001E1000, 0x001E1001, 0x002039D0,
+0x002039B0, 0x002039B4, 0x002039B8, 0x002039D4,
+0x002039D8, 0x002039DC, 0x002039E0, 0x00203E04,
+0x00203E0E, 0x002039C2, 0x00202886, 0x89123427,
+0xD294D693, 0x2641420B, 0xCB8084E1, 0x80E1B0F5,
+0xD69160E0, 0x2E00CB04, 0xC93F6060, 0xD68F2600,
+0xA001E001, 0xE0002602, 0x000B4F26, 0xD68C6EF6,
+0xC8806060, 0xD2868919, 0x88016021, 0xD2898B15,
+0x8524E501, 0x89103056, 0xE203D187, 0x2120D487,
+0xE00B6541, 0x0656655D, 0xE40FD585, 0x2140E702,
+0xD77E2571, 0x000BE001, 0x000B2702, 0x2FE6E000,
+0xDE804F22, 0xC88084E1, 0xD57A892C, 0x20088554,
+0x61038F28, 0x8553D77C, 0x64036672, 0x8566650C,
+0x3520620C, 0xD6798B1E, 0x651CD774, 0x2651644C,
+0x60E02741, 0x8904C840, 0x420BD275, 0xA0030009,
+0xD2680009, 0x0009420B, 0x0009B09F, 0xE201D167,
+0x60E02122, 0xCB04D464, 0x60402E00, 0x2400C93F,
+0x6023A001, 0x4F26E000, 0x6EF6000B, 0x2FB62FA6,
+0x2FD62FC6, 0xDA622FE6, 0x66A1E240, 0x3622DC5E,
+0x62638900, 0x6ED36D2C, 0x4E2136D8, 0x4E212A61,
+0xDB61D460, 0xE700A00F, 0x770162B2, 0x71026123,
+0x66212B12, 0x71026213, 0x61212B12, 0x651D666D,
+0x356C4528, 0x627C2452, 0x8BED32E3, 0xC90360D3,
+0x8B108803, 0x617367B2, 0x2B127102, 0x71026E13,
+0x2B126571, 0x655D6DE1, 0x422862DD, 0x325CE107,
+0xA00C2C10, 0x88022422, 0xA0038B01, 0x8801E203,
+0xE2018B05, 0x66B22C20, 0x655D6561, 0xE60F2452,
+0x67A12C60, 0x8B052778, 0xDD38DC44, 0xEB01EA00,
+0x2DB22CA2, 0x6DF66EF6, 0x6BF66CF6, 0x6AF6000B,
+0x2FE62FD6, 0xE240DD36, 0x362266D1, 0x62638900,
+0x3678672C, 0x7703DE38, 0x47212D61, 0x64E2D635,
+0xA00E4721, 0x6562E100, 0x62537101, 0x74012450,
+0x24204219, 0x45297401, 0x74012450, 0x24504519,
+0x621C7401, 0x8BEE3273, 0x66E24200, 0x420061D1,
+0x2118362C, 0x2E628F06, 0xDD1CD728, 0xE501E400,
+0x2D522742, 0x000B6EF6, 0x2FD66DF6, 0x4F222FE6,
+0xED0AEE01, 0x64E3BC85, 0xBC8A64E3, 0x62EC7E01,
+0x8BF732D7, 0xBC8DEE01, 0x64E364E3, 0x7E01BC92,
+0x32D762EC, 0x4F268BF7, 0x000B6EF6, 0xD1186DF6,
+0xD418920D, 0x72122122, 0x2422D617, 0xD7177204,
+0x72202622, 0x2722D116, 0x000B7230, 0x137A2122,
+0x002039C2, 0x00202992, 0x001E1015, 0x002039C8,
+0x001E1001, 0x0020399C, 0x001E1100, 0x002039C6,
+0x002039B4, 0x001E1000, 0x002039B8, 0x002039C4,
+0x00202886, 0x001E100C, 0x002039B0, 0x002039CC,
+0x002039D0, 0x002039D4, 0x002039D8, 0x002039DC,
+0x002039E0, 0x4F222FE6, 0xD6707FFC, 0x88016060,
+0xE2018951, 0x2620BFBB, 0xD56ED16D, 0xDE6E6010,
+0x64E36552, 0x7402C840, 0x8D22D16C, 0xD26C7502,
+0xE601D76C, 0xE7042722, 0x76016255, 0x626C2421,
+0x8FF93273, 0xD4637402, 0x6242E601, 0x640D8528,
+0x67494419, 0x275D657E, 0x81E4607C, 0xE417D562,
+0x67557601, 0x3243626C, 0x8FF92171, 0xA0207102,
+0xD25E0009, 0xE601D75B, 0xE7042722, 0x76016255,
+0x626C2421, 0x8FF93273, 0xD4527402, 0x6242E601,
+0x640D8528, 0x67494419, 0x275D657E, 0x81E4607C,
+0xE417D553, 0x67557601, 0x3243626C, 0x8FF92171,
+0x92897102, 0xD2462E21, 0x5E23D74E, 0x64F22FE2,
+0x604365F2, 0x2700C980, 0xC9606043, 0x80716103,
+0xC9036043, 0x80724519, 0x65F2605C, 0x817266F2,
+0x46194629, 0x606C4529, 0x4018645C, 0x8173304C,
+0x21185E23, 0x64F22FE2, 0x6E4C62F2, 0x602C4219,
+0x66F262F2, 0x46294018, 0x461930EC, 0x42298174,
+0x652C606C, 0x305C4018, 0x81758F07, 0x0009BC96,
+0x2228620C, 0xA00A8908, 0x60130009, 0x8B038840,
+0x0009B009, 0x0009A003, 0xE202D62F, 0x7F042622,
+0x000B4F26, 0x4F226EF6, 0x8552D52A, 0x8830600D,
+0x88318903, 0xA0348923, 0x85550009, 0xD428D727,
+0x85532701, 0x610DD627, 0x24124118, 0x460BD426,
+0xD7230009, 0xD226D425, 0x6572420B, 0xE230D120,
+0x42286712, 0x2729E620, 0x37604628, 0xD6218B03,
+0xA016E200, 0xD61F2622, 0xA012E202, 0xD1182622,
+0x6212E530, 0xE6204528, 0x46282259, 0x89083260,
+0xD41AD119, 0xE601D513, 0x2160450B, 0x472BD718,
+0x4F264F26, 0x0009000B, 0x0000060A, 0x002039E4,
+0x001E1000, 0x002039D0, 0x00203E04, 0x00203E10,
+0x00203DA8, 0x002039B8, 0x00203DD8, 0x00203DD6,
+0x00203DAA, 0x0020399C, 0x002039C8, 0x002039B4,
+0x002039B0, 0x002018A2, 0x00203B24, 0x00203B28,
+0x002018EE, 0x002039CC, 0x001E100B, 0x00203B3C,
+0x00114004, 0x4F222FE6, 0xDE967FFC, 0x200884E9,
+0x2F008D06, 0xD695D494, 0x0009460B, 0x64F0B19A,
+0x6620D293, 0x89022668, 0xC9BF60E0, 0x7F042E00,
+0x000B4F26, 0x000B6EF6, 0x2FE60009, 0xDE8D4F22,
+0x60E0D68D, 0xCBC0D48D, 0x62602E00, 0xC803602C,
+0x40218904, 0x70014021, 0x6603A002, 0x66034009,
+0xD687616D, 0xE500A004, 0x75016262, 0x74042422,
+0x3213625D, 0xD2838BF8, 0x0009420B, 0xC9BF84E2,
+0x4F2680E2, 0x6EF6000B, 0x2FE62FD6, 0x7FFC4F22,
+0x6260D67D, 0x89442228, 0xD572E100, 0x60502610,
+0xCB40D47A, 0x2500440B, 0x8D052008, 0x62E06E03,
+0x7104612C, 0x2F11A006, 0xD475D66D, 0xDD756760,
+0x657C4D0B, 0xE23C6D1D, 0x8B033D27, 0xD267D472,
+0x0009420B, 0x4D214D21, 0xA005D770, 0x66E6E400,
+0x357C4508, 0x74012562, 0x35D3654D, 0xD76C8BF7,
+0x6172E003, 0x81114018, 0x6E7260F1, 0x81E2700C,
+0xD4686172, 0xDD688113, 0x4D0BDE68, 0xE2016572,
+0xD4672E22, 0x420BD255, 0xD6560009, 0xC93F6060,
+0x7F042600, 0x6EF64F26, 0x6DF6000B, 0x2FC62FB6,
+0x2FE62FD6, 0xD25F4F22, 0x6B436E73, 0x420B6C53,
+0x20086D63, 0x64038D1C, 0xE50ED149, 0x32526210,
+0x60C38916, 0x804124B0, 0x814160D3, 0xA007E500,
+0x655D61BC, 0x00EC6053, 0x364C6653, 0x80647501,
+0x3213625D, 0xD63B8BF5, 0xC9BF6060, 0x2600A008,
+0xD23AD44D, 0x6EF64F26, 0x6CF66DF6, 0x6BF6422B,
+0x6EF64F26, 0x6CF66DF6, 0x6BF6000B, 0x7FC44F22,
+0x720262F3, 0x22512F41, 0x45297202, 0x60632251,
+0xE5C4E682, 0x67F38121, 0x655C666C, 0xE408BFB6,
+0x4F267F3C, 0x0009000B, 0x2F962F86, 0x2FB62FA6,
+0x2FD62FC6, 0x4F222FE6, 0xE1007FC4, 0x6513ECFF,
+0x6B136CCD, 0xDE36D735, 0xEDFF64F3, 0xD835EA04,
+0x6053655C, 0x027D4000, 0x32C0622D, 0x66038D0D,
+0x09ED6063, 0x2491027D, 0x24217402, 0x698202ED,
+0x3928622D, 0x74022892, 0x75017104, 0x6063625C,
+0x07D532A2, 0x0EB58FE4, 0x2448641C, 0xE6808905,
+0x67F3E5C5, 0xBF79666C, 0x7F3C655C, 0x6EF64F26,
+0x6CF66DF6, 0x6AF66BF6, 0x000B69F6, 0xD11E68F6,
+0x6012D21E, 0xCB20E405, 0x2102E500, 0x000B2242,
+0x00002252, 0x001E1017, 0x00203B40, 0x002018A2,
+0x0020390E, 0x001E1015, 0x001E10BF, 0x00117800,
+0x001E10FC, 0x00200610, 0x00203914, 0x00202AEA,
+0x00203B44, 0x002018EE, 0x00203B60, 0x0011788C,
+0x00203910, 0x002034F4, 0x00201530, 0x001E2130,
+0x00203B68, 0x00202AAC, 0x00203B6C, 0x00203974,
+0x0020397C, 0x00203DA4, 0x001C3500, 0x001D4004,
+0xD564D163, 0xE400D764, 0x2142E20F, 0x17411154,
+0xD5622722, 0x9669D762, 0x15412572, 0x96661562,
+0xE6011565, 0xD55F1165, 0x666CE6F8, 0x25422542,
+0x25422542, 0x25422542, 0x25622542, 0x7601E727,
+0x67632572, 0x25627797, 0xE7042572, 0x2572E248,
+0xE2192522, 0xE2702522, 0x25422542, 0x25422542,
+0x25222542, 0x2522E20C, 0x25422542, 0x25422542,
+0x25422542, 0x25422542, 0x000B154A, 0xE2081145,
+0x0009422B, 0x2FE62FD6, 0x7FFC4F22, 0xC8206043,
+0x6E438D02, 0x0009BE67, 0xC81060E3, 0xBE648901,
+0x60E30009, 0x8901C840, 0x0009BE86, 0xC80160E3,
+0xDD3D8938, 0xC80260D0, 0x2F008D03, 0x460BD63B,
+0x60F00009, 0x8902C804, 0x460BD639, 0x62F00009,
+0xC8806023, 0x60D08902, 0x2D00C97F, 0xC8016023,
+0xD6348906, 0x0009460B, 0x0009A007, 0x51630601,
+0x8902C808, 0x460BD630, 0x60F00009, 0x8902C810,
+0x420BD22E, 0xD52E0009, 0x88026052, 0xD22D8B03,
+0xA005E604, 0x88012260, 0xD22A8B02, 0x2260E601,
+0x2522E200, 0xC88060E3, 0xD227892D, 0x60E36E20,
+0x8902C880, 0x420BD225, 0x60E30009, 0x8902C840,
+0x420BD223, 0x60E30009, 0x8902C802, 0x420BD221,
+0x60E30009, 0x890DC804, 0xDD20D11F, 0x0009410B,
+0x0009BF0D, 0x0009BF4C, 0xD51ED41D, 0x2470E708,
+0x25D2BF85, 0xC80860E3, 0xD21B8905, 0x4F267F04,
+0x422B6EF6, 0x7F046DF6, 0x6EF64F26, 0x6DF6000B,
+0x001C581C, 0xA000A000, 0x001D0100, 0x001D4000,
+0x00040021, 0x001C589C, 0x001E1021, 0x00201A90,
+0x00201AB2, 0x00202114, 0x00201ACA, 0x00201AD8,
+0x002039C8, 0x001E100B, 0x001E1028, 0x00201B44,
+0x00201B50, 0x00201AE0, 0x00201AFE, 0x12345678,
+0x001E1000, 0x0010F100, 0x00201B2C, 0x644CD6A7,
+0x000B346C, 0xD6A62450, 0x346C644C, 0x2450000B,
+0x644CD6A4, 0x000B346C, 0x625C2450, 0x4208616D,
+0x42084119, 0x42006019, 0x670E614C, 0xD49E321C,
+0x4200207D, 0x324CC90F, 0x2200000B, 0x4208625C,
+0x42004208, 0x324C644C, 0x4200D498, 0x000B324C,
+0x2FE62260, 0x614C4F12, 0x4100D493, 0x6710314C,
+0xE29F666D, 0x27294619, 0x6E536269, 0x672E6573,
+0x4221227D, 0x42214221, 0x7601662C, 0xE4014608,
+0x34E84608, 0x644C4600, 0x071A0467, 0x2150257B,
+0x000B4F16, 0x4F226EF6, 0xD2857FE8, 0x88016021,
+0xD2848B7B, 0x26686621, 0xD2838B77, 0x26686621,
+0xE50F8B73, 0xE401BFA2, 0xBFA4E501, 0xE586E400,
+0xE400655C, 0x2F50BFA4, 0xBFA1E401, 0xE602E506,
+0x60634618, 0x81F2E401, 0x6543BF9F, 0xE40185F2,
+0xBFAB6543, 0x85F26603, 0x6543E401, 0x6603BFB1,
+0xE40265F0, 0x6053756C, 0x80F8BF80, 0xBF82E402,
+0x84F8E512, 0x7090E402, 0x6503BF82, 0x4618E602,
+0x81F66063, 0xBF80E402, 0x85F6E500, 0x6603E402,
+0xE500BF8C, 0xE40285F6, 0xBF926603, 0xE5FEE500,
+0xE010655C, 0xBF61E403, 0xE5130F54, 0xE40EBF63,
+0x05FCE010, 0xBF63E40E, 0xE5007585, 0xBF64E403,
+0xE500E640, 0xBF71E403, 0xE500E640, 0xBF78E403,
+0xE5FFE640, 0xE014655C, 0xBF47E404, 0xE40F0F54,
+0xE504BF49, 0x05FCE014, 0xBF49E40F, 0xE5017584,
+0xBF4AE640, 0xE501E404, 0xBF57E640, 0xE501E404,
+0xE404E640, 0xAF5C7F18, 0x7F184F26, 0x000B4F26,
+0x4F220009, 0xD2427FF0, 0x88016021, 0xD2418B71,
+0x26686621, 0xD2408B6D, 0x26686621, 0xE50F8B69,
+0xE401BF1C, 0xBF1EE501, 0xE586E400, 0xE400655C,
+0x2F50BF1E, 0xBF1BE401, 0xE401E506, 0xBF1C6543,
+0xE401E640, 0xBF296543, 0xE401E640, 0xBF306543,
+0x65F0E640, 0x756CE402, 0xBEFF6053, 0xE40280F4,
+0xE512BF01, 0xE40284F4, 0xBF017090, 0xE6406503,
+0xBF02E402, 0xE640E500, 0xBF0FE402, 0xE640E500,
+0xBF16E402, 0xE5FEE500, 0x6053655C, 0xBEE5E403,
+0xE51380F8, 0xE40EBEE7, 0xE40E84F8, 0xBEE77085,
+0xE5006503, 0xBEE8E640, 0xE500E403, 0xBEF5E640,
+0xE500E403, 0xBEFCE640, 0xE5FFE403, 0x6053655C,
+0xBECBE404, 0xE40F80FC, 0xE504BECD, 0xE40F84FC,
+0xBECD7083, 0xE5016503, 0xBECEE640, 0xE501E404,
+0xBEDBE640, 0xE501E404, 0xE404E640, 0xAEE07F10,
+0x7F104F26, 0x000B4F26, 0x00000009, 0x001E102F,
+0x001E1080, 0x001E1090, 0x001E103F, 0x001E103E,
+0x002039C2, 0x002039C4, 0x002039C6, 0xD21DD11C,
+0x66206010, 0x676C7001, 0x3700C90F, 0xE5008D13,
+0x67106210, 0x7701622C, 0x64232170, 0xD6166010,
+0x44084408, 0x3428C90F, 0x62602100, 0x7201D513,
+0x44082620, 0x000B354C, 0xD10F6053, 0x25586510,
+0xE6008D13, 0xD60DD40B, 0x655C6540, 0x47086753,
+0x37584708, 0x47086540, 0x24507501, 0x367C6040,
+0x2400C90F, 0x72FF6210, 0x000B2120, 0x00006063,
+0x0020390D, 0x0020390C, 0x0020390E, 0x00203534,
+0x7FFC4F22, 0xE680D19F, 0x666C6212, 0xD29E2F22,
+0x67F36563, 0x420B7542, 0x7F04E404, 0x000B4F26,
+0xE6800009, 0xD298666C, 0xE7006563, 0x422B7540,
+0xE6806473, 0xD294666C, 0xE7006563, 0x422B7543,
+0x2F866473, 0x2FA62F96, 0x2FC62FB6, 0x2FE62FD6,
+0x7FCC4F22, 0xDC8ED28D, 0x72011F21, 0xDB8D1F22,
+0xD18EDE8D, 0x66125211, 0x8B013620, 0x0009A0E5,
+0xC9036061, 0x8B018801, 0x0009A0DF, 0xD288D487,
+0xED84420B, 0x2F025503, 0x30D0845C, 0xA0B88901,
+0xD1840009, 0x626C6610, 0x88016023, 0xD1828B68,
+0x62101FC3, 0x895B2228, 0xE003D480, 0x40186742,
+0x68421772, 0xD57EE900, 0x81816DB3, 0x7D042190,
+0x67D26AB2, 0x64E26852, 0x1F491F57, 0x740464E3,
+0x1FA46542, 0x65431F5A, 0x625275F8, 0x1F761FD5,
+0x6D531F2B, 0xDA74D773, 0x7D94D274, 0x68D21F88,
+0x6AA26972, 0xD1726022, 0x2202CB20, 0xE1401F1C,
+0x7601E600, 0x3213626D, 0x56F48BFB, 0x52F651F5,
+0x21222B62, 0x52F851F7, 0x212256F9, 0x2E6251FA,
+0x51FB2412, 0x2D822512, 0xD9662792, 0x29A2DD5F,
+0x6AD2D965, 0xD9646892, 0x68D21A84, 0x6081DA63,
+0x2801CB01, 0xD86266D2, 0x2A622962, 0xED015AFC,
+0x2AD2480B, 0x2AD24D18, 0x62D2DD5E, 0x2D227201,
+0xD15056F3, 0xE2026062, 0x2602CB01, 0x2120A03D,
+0x8B3A2228, 0xE401DD58, 0x2140E600, 0xE01C2D62,
+0xC801005C, 0xD4558B0A, 0xE600D755, 0xED7D2472,
+0x626C7601, 0x8BFB32D3, 0x24D2DD52, 0xE2FE68C2,
+0x2C822829, 0x095CE01E, 0xE01F5DF1, 0x0A5C2D90,
+0x751051F2, 0xED0621A0, 0xD74BE600, 0x8456D44B,
+0x27007601, 0x696C6854, 0x248039D3, 0x8FF67401,
+0xDA477701, 0x2A10E194, 0xE2007A01, 0x7A0F2A20,
+0xD130E805, 0x66102A80, 0x6023626C, 0x89088801,
+0xD240D42A, 0x420B65F2, 0xD131ED01, 0xAF304D18,
+0x65F221D2, 0x8553D43C, 0x620D6642, 0x89073262,
+0xD13BD43A, 0x0009410B, 0xE601D73A, 0x2762AF1A,
+0xD134D41E, 0x410B65F2, 0xD125ED01, 0xD637D436,
+0x460B4D18, 0xAF0D21D2, 0x7F340009, 0x6EF64F26,
+0x6CF66DF6, 0x6AF66BF6, 0x000B69F6, 0x4F2268F6,
+0x85467FF4, 0x2F01E681, 0x666C8547, 0x854881F1,
+0x81F2D209, 0x67F38542, 0x854381F3, 0x81F4E40C,
+0x65636053, 0x420B81F5, 0x7F0C7540, 0x000B4F26,
+0x00000009, 0x001C3D9C, 0x0020245C, 0x0011779A,
+0x001C36F8, 0x001C3B9C, 0x001C3704, 0x0020352C,
+0x002014A0, 0x0020391D, 0x0020391C, 0x00203918,
+0x001C3D98, 0x001C3BB4, 0x001C5960, 0x001C3500,
+0x001C3D30, 0x001C8960, 0x00203504, 0x001C3D00,
+0x0020160C, 0x00117730, 0x00203920, 0x001C582C,
+0x2000A000, 0x0000A000, 0x0011778C, 0x00117792,
+0x00117788, 0x002014CC, 0x002038F4, 0x002034F4,
+0x00201530, 0x001E2130, 0x00203D84, 0x002018A2,
+0x2F962F86, 0x2FB62FA6, 0x2FD62FC6, 0x4F222FE6,
+0xD19B7FEC, 0x2F12E000, 0x6103D49A, 0x1F4281F2,
+0xDD9ADA99, 0xD69A6813, 0xE0014808, 0x460BDE99,
+0x38EC4800, 0x65A21F03, 0x352052A1, 0xA23E8B01,
+0x60510009, 0x8801C903, 0xA2388B01, 0x52530009,
+0x32E0DE91, 0xD9918B10, 0x64A3490B, 0x4B0BDB90,
+0xDE906403, 0xD791D690, 0xEC01D591, 0x2E02E100,
+0x271026C0, 0x2502AFDF, 0xC8018551, 0xA1578B01,
+0x62510009, 0x4200622D, 0x5E53366A, 0x85E2226D,
+0xC903642C, 0x85E36603, 0x6053650D, 0x40214021,
+0x4500C93F, 0x322A6703, 0x6053252D, 0xC901D17F,
+0x60106C03, 0x8801D97F, 0xDB7F8B05, 0x2120E200,
+0xCB0160B2, 0xD17D2B02, 0x88016011, 0x65A28B0A,
+0x8D042448, 0x9B9E6251, 0xA00322B9, 0x919B2521,
+0x2521221B, 0x37B3EB10, 0x2448895E, 0xD4738B07,
+0x22286241, 0x60638903, 0xA05781F8, 0xD5706473,
+0x46084608, 0x85E26273, 0x46006B50, 0x362C4200,
+0x2BB8C910, 0x8F1F6463, 0x26686603, 0xD2698911,
+0x062D6043, 0x4119616D, 0x6B0E6019, 0x81F820BD,
+0x880160C3, 0x646C8F2C, 0x880F6073, 0xA0278B1B,
+0xD2610009, 0x052D6043, 0x4119615D, 0x670E6019,
+0x645C207D, 0x81F8A01C, 0x890F2668, 0x6043D25B,
+0x6B5D052D, 0x60B94B19, 0x201D610E, 0x60C381F8,
+0x8F0D8801, 0x6473645C, 0xEC00A00A, 0x6043D254,
+0x625D052D, 0x60294219, 0x207D670E, 0x81F8645C,
+0x880285F8, 0x85E1890A, 0x8D07C820, 0xE6DC6203,
+0x60232269, 0x81E1A002, 0x644CE4FF, 0x6210D149,
+0x89012228, 0x644CE4FF, 0x654DEBFF, 0x35B06BBC,
+0xDB368B2B, 0x64A34B0B, 0x410BD135, 0x54036403,
+0x85446E03, 0xC948DB40, 0xDC408808, 0xBEAE8B01,
+0x64B3E502, 0x65E34C0B, 0xDB3DEC01, 0xD13D2DC2,
+0x621260B2, 0x72017001, 0x21228805, 0x2B028F08,
+0x666CE680, 0x6563D238, 0x7549E700, 0x6473420B,
+0xA030D436, 0x7FFF0009, 0x85E28000, 0x20B9EBFC,
+0x610381E2, 0x942A85E3, 0x62032049, 0x450885F8,
+0x81E2201B, 0xC90160C3, 0x40084018, 0x40084008,
+0x4000225B, 0x6023220B, 0x85E481E3, 0x4118E108,
+0x81E4201B, 0xE40262A2, 0x20B98521, 0x67A28121,
+0xCB016071, 0x85F82701, 0x89033042, 0xECE785E2,
+0x81E220C9, 0x490BD41E, 0xA03B0009, 0x7E030009,
+0x001C3D30, 0x00203D90, 0x00203504, 0x001E212C,
+0x002033E8, 0x001C3D00, 0x00117780, 0x002014A0,
+0x0020166C, 0x0011770C, 0x0020391C, 0x0020391D,
+0x00203918, 0x002018A2, 0x001C36F8, 0x00203990,
+0x00203DA0, 0x00203B84, 0x00203C04, 0x00203C84,
+0x00203D04, 0x00203908, 0x002034FC, 0x002014CC,
+0x00203994, 0x00203998, 0x0020245C, 0x00203D88,
+0x00203D8C, 0x602262F2, 0x40094019, 0xC90F4009,
+0x8B0B880A, 0x60E2DE8C, 0x40094019, 0xC90F4009,
+0x8B038808, 0xCB0160A2, 0x2802A006, 0x65E2DE87,
+0x2E527501, 0x286266A2, 0x52F366F2, 0x2622AE83,
+0xD2838551, 0xDE83C802, 0xA0958B01, 0x420B0009,
+0x4E0B64A3, 0x5E036403, 0x85E46503, 0x4918E908,
+0xD77D209B, 0xE04C81E4, 0xDC7C0B7E, 0x7B01D97C,
+0x61C207B6, 0x71016690, 0x8D062668, 0xD4792C12,
+0x420BD279, 0xA070EB01, 0x62512DB2, 0x4B18EB0F,
+0x22B9E102, 0x32104118, 0x85518B0F, 0x2029E2FC,
+0x60518151, 0xCB0172E0, 0x85E12501, 0x202994A3,
+0x85E481E1, 0xA0522049, 0x675181E4, 0x4719677D,
+0x667E6779, 0x7701276D, 0x6903607C, 0x88014918,
+0x25918F3E, 0x6B12D161, 0x21B27B01, 0x660D85E3,
+0x40216063, 0xC93F4021, 0x6C034600, 0x262D322A,
+0xC8016063, 0xDB5ED15D, 0x967D8901, 0xE6002C6B,
+0x666C67CD, 0x40006063, 0x622D021D, 0x8D0E3270,
+0x60436403, 0xE9FF021D, 0x8B013290, 0x01C5A007,
+0x626C7601, 0x3292E904, 0x646C8BEB, 0x60434400,
+0xD15004BD, 0x0B457401, 0x669D6911, 0x89073670,
+0x602D6211, 0x890388FF, 0xE201DB4B, 0x2B2021C1,
+0xECFC8551, 0x815120C9, 0xCB016051, 0xDC472501,
+0x64A34C0B, 0x51F366F2, 0x85EF2612, 0x54F2D244,
+0x650D420B, 0x0009ADE7, 0xE500DC42, 0x420B2C52,
+0x4E0B64A3, 0x54036403, 0x85446E03, 0x6703E908,
+0x65034918, 0x27998541, 0xDB323790, 0x8F0BD932,
+0x6013610D, 0x8B07C820, 0xC9486053, 0x8B038808,
+0xE501BD4D, 0x0009A005, 0x2128D233, 0xBD468901,
+0x64B3E500, 0x490B65E3, 0xADBCEC01, 0x85F22DC2,
+0x7001EE04, 0x31E7610D, 0x8D0281F2, 0xADA97A08,
+0x7F140009, 0x6EF64F26, 0x6CF66DF6, 0x6AF66BF6,
+0x000B69F6, 0xF7FF68F6, 0x2FE68000, 0xD2234F22,
+0x60E36E22, 0x8D02C840, 0xBBF922E2, 0xE2400009,
+0x2E284218, 0xBC048901, 0x60E30009, 0x8905C810,
+0xD21CD41B, 0x0009420B, 0x0009BC03, 0xC80560E3,
+0xBD6D8901, 0x60E30009, 0x8902C802, 0xAC004F26,
+0x4F266EF6, 0x6EF6000B, 0x001C3D3C, 0x00117760,
+0x002014A0, 0x0020166C, 0x00203494, 0x00203DA4,
+0x00203908, 0x002034FC, 0x002014CC, 0x00203974,
+0x0020397C, 0x00203970, 0x00203972, 0x00201530,
+0x002018EE, 0x00203994, 0x00008000, 0x001C3510,
+0x00203D98, 0x002018A2, 0x080A0C0E, 0x00020406,
+0x1A1C1E20, 0x12141618, 0x2E303234, 0x26282A2C,
+0x3A3C3E40, 0x6C625648, 0x41112F26, 0xE2208F18,
+0x890B3123, 0x321CD204, 0xD1026220, 0x412B312C,
+0x00090009, 0x00203412, 0x002033C8, 0x000BE000,
+0x400062F6, 0x40004000, 0x40004000, 0x40004000,
+0x62F6000B, 0x40004000, 0x40004000, 0x40004000,
+0x40184000, 0x62F6000B, 0x40004000, 0x40004000,
+0x40004000, 0x40284000, 0x62F6000B, 0x40004000,
+0x40184000, 0x000B4028, 0xC90F62F6, 0x40054005,
+0x40054005, 0x62F6000B, 0x4005C907, 0x40054005,
+0x62F6000B, 0x4005C903, 0x000B4005, 0xC90162F6,
+0x000B4005, 0x000062F6, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x544F0D0A, 0x46205355, 0x00003A57,
+0x206C754A, 0x32203120, 0x20383030, 0x323A3132,
+0x34333A38, 0x00000000, 0x00000D0A, 0x00000043,
+0x42707372, 0x3D206675, 0x554E203D, 0x202C4C4C,
+0x6E49677A, 0x4E497274, 0x6D754E51, 0x0000003D,
+0x61766E49, 0x2064696C, 0x72657375, 0x20726F20,
+0x2079656B, 0x00214449, 0x52504545, 0x57204D4F,
+0x65746972, 0x6461202C, 0x003D7264, 0x6C617620,
+0x0000003D, 0x00000A0D, 0x435F4D5A, 0x465F444D,
+0x4C445F57, 0x494E495F, 0x00000054, 0x6E6B6E55,
+0x206E776F, 0x6D6D6F63, 0x3D646E61, 0x00000000,
+0x203A3051, 0x00000020, 0x203A3151, 0x00000020,
+0x203A3251, 0x00000020, 0x203A3351, 0x00000020,
+0x203A3451, 0x00000020, 0x2B434741, 0x73696F4E,
+0x61432065, 0x7262696C, 0x6F697461, 0x6166206E,
+0x6F206C69, 0x6974206E, 0x0D0A656D, 0x00000000,
+0x00000072, 0x00205220, 0x00000D0A, 0x62735576,
+0x7473725F, 0x00000A0D, 0x62735576, 0x7375735F,
+0x646E6570, 0x00000A0D, 0x62735576, 0x7365725F,
+0x000A0D6D, 0x00000044, 0x44387570, 0x72637365,
+0x6F747069, 0x3D584572, 0x00000000, 0x00000047,
+0x00000042, 0x72746E49, 0x6D652051, 0x2C797470,
+0x49677A20, 0x4972746E, 0x754E514E, 0x00003D6D,
+0x654C7245, 0x0000006E, 0x00000049, 0x20746F4E,
+0x756F6E65, 0x49206867, 0x4220514E, 0x0A0D6675,
+0x00000000, 0x000000FF, 0x00020001, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x010E010D, 0x00020003, 0x01090108,
+0x0002010A, 0x02000003, 0x02020201, 0x02040203,
+0x02060205, 0x02020200, 0x02040203, 0x020C020B,
+0x020E020D, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x000000FF, 0x00020001, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x010E010D, 0x00020003, 0x01090108,
+0x0002010A, 0x00030003, 0x02020201, 0x02040203,
+0x02060205, 0x02020200, 0x02040203, 0x020C020B,
+0x020E020D, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x010E010D, 0x00FF010F, 0x01090108,
+0x010B010A, 0x0200010F, 0x02020201, 0x02040203,
+0x02060205, 0x02020200, 0x02040203, 0x020C020B,
+0x020E020D, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x010E010D, 0x00FF010F, 0x01090108,
+0x010B010A, 0x010F010F, 0x02020201, 0x02040203,
+0x02060205, 0x02020200, 0x02040203, 0x020C020B,
+0x020E020D, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00205220, 0x00000046, 0x00000059,
+0x73204142, 0x003D7165, 0x49544120, 0x0000204D,
+0x00000000, 0x00000000, 0x002E0209, 0x80000101,
+0x000409FA, 0x00FF0400, 0x05070000, 0x02000201,
+0x82050700, 0x00020002, 0x03830507, 0x07010040,
+0x40030405, 0x02090100, 0x0101002E, 0x09FA8000,
+0x04000004, 0x000000FF, 0x02010507, 0x07000040,
+0x40028205, 0x05070000, 0x00400383, 0x04050701,
+0x00004002, 0x00000000, 0x00000000, 0x07090000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
+
+const u32_t zcFwImageSize=15936;
diff --git a/drivers/staging/otus/hal/hpfwu.c.drv_ba_resend b/drivers/staging/otus/hal/hpfwu.c.drv_ba_resend
new file mode 100644
index 00000000000..7f5bcff57b5
--- /dev/null
+++ b/drivers/staging/otus/hal/hpfwu.c.drv_ba_resend
@@ -0,0 +1,742 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include "cprecomp.h"
+
+const u32_t zcFwImage[] = {
+0x0009000B, 0x4F222FE6, 0xDE297FFC, 0xE114D729,
+0x1E13D429, 0x1E4C470B, 0x0009B018, 0xA0039545,
+0x3652E600, 0x76018D04, 0xC84060E2, 0x2F028DF9,
+0xDE23D422, 0x00094E0B, 0x4E0BD422, 0xD4220009,
+0x00094E0B, 0x4F267F04, 0x6EF6A024, 0xD11F4F22,
+0x0009410B, 0x440BD41E, 0xD51E0009, 0x0009450B,
+0xE1FFD71D, 0xD21D611D, 0x50292712, 0xCB01D41C,
+0xE501E1FF, 0x22121209, 0x24521211, 0xD61AD519,
+0xE2009714, 0xD4192572, 0xD6192620, 0x4F262422,
+0x2622000B, 0xDD18DC17, 0x4C0BDE18, 0x4D0B0009,
+0x4E0B0009, 0xAFF80009, 0x27100009, 0x00000640,
+0x001C001C, 0x00200BC4, 0x0000B38E, 0x002029F8,
+0x00200F72, 0x00202A04, 0x00202A1C, 0x00200F20,
+0x00201056, 0x00200C1C, 0x001C3510, 0x001C3624,
+0x001E212C, 0x00202994, 0x00202530, 0x0020299C,
+0x002029A8, 0x00200E50, 0x002023E6, 0x00201920,
+0x2FC62F96, 0x2FE62FD6, 0x7F904F22, 0xE020DE8D,
+0xD48D61E0, 0x61E30F14, 0x62107101, 0xE024D78B,
+0x0F24470B, 0x450BD58A, 0x20080009, 0x8F116D03,
+0xDD881F0A, 0x67D0D488, 0x410BD188, 0xD288657C,
+0x6920DD88, 0x66C36C9C, 0x46084608, 0x460836C8,
+0x1FDA3D6C, 0x04FCE024, 0x66E2E580, 0x655C604C,
+0x8F163050, 0xE0202D62, 0xE50001FC, 0xDE7E641C,
+0x3243625D, 0xA32C8B01, 0x655D0009, 0x36EC6653,
+0xE02C6760, 0x69530F74, 0x39DC607E, 0xAFEF8094,
+0x20087501, 0xE0208B14, 0xE50001FC, 0xA00ADE72,
+0x655D641C, 0x39EC6953, 0x67536C92, 0x37DC62C2,
+0x75041721, 0x625D1F2C, 0x8BF23243, 0x2D10A309,
+0x8B178801, 0x01FCE020, 0x2D70E700, 0x1FD76D1C,
+0x627DDE65, 0x8B0132D3, 0x0009A2FB, 0x65E3677D,
+0x75046673, 0x36EC6C73, 0x64623C5C, 0x770869C2,
+0x2492AFEF, 0x8B188804, 0x01FCE020, 0x2D40E400,
+0xDE59671C, 0x3273624D, 0xA2E28B01, 0x644D0009,
+0x6CE36D43, 0x65D23DEC, 0x61437C04, 0x621231CC,
+0x74086952, 0xAFED2929, 0x88052592, 0xE0208B18,
+0xE40001FC, 0x671C2D40, 0x624DDE4B, 0x8B013273,
+0x0009A2C7, 0x6943644D, 0x39EC61E3, 0x71046592,
+0x3C1C6C43, 0x6D5262C2, 0x2D2B7408, 0x25D2AFED,
+0x8B1B8831, 0xD942D241, 0x72046422, 0x72046622,
+0x72046722, 0x72E86C22, 0x1F2E1F4D, 0x72046422,
+0x72046E22, 0x652229E0, 0x2950D93A, 0xDE3A2FC6,
+0x55FE4E0B, 0xE2007F04, 0x2D20A29B, 0x8B1D8830,
+0xDE33D232, 0x72046522, 0x72046122, 0x72046722,
+0x72E86922, 0x72046422, 0x72046C22, 0x6E222EC0,
+0x1F9FD62C, 0x7FFC26E0, 0x09FEE040, 0x2F92DC2B,
+0x66134C0B, 0xE2007F04, 0x2D20A27B, 0x89018828,
+0x0009A109, 0xE143DE20, 0xE04062E1, 0x3617662D,
+0x0FE68F03, 0x660302FE, 0x36172201, 0xA0F38B01,
+0xE0400009, 0xE50104FE, 0x30568541, 0xA0EB8B01,
+0xE0400009, 0x09FEE701, 0xB2612D70, 0xE0406491,
+0xE1430CFE, 0xE06862C1, 0x3517652D, 0x0F568D68,
+0x3563E640, 0xE6008B24, 0x0F65E048, 0xA02EE11A,
+0x000072C0, 0x00117800, 0x00202A20, 0x00200F72,
+0x00201FDC, 0x002029B0, 0x00202A24, 0x00200FBC,
+0x002029AF, 0x002025D4, 0x00117804, 0x00117810,
+0x002029AC, 0x002029AD, 0x00200948, 0x00200994,
+0x41216153, 0x41214121, 0x41214121, 0x45214521,
+0x60534521, 0x6603C903, 0x0F65E048, 0xE0077118,
+0xE0442209, 0x641D0F25, 0x65F3E04C, 0x0F46B291,
+0x0EFDE048, 0x0DFDE044, 0x61DD67ED, 0x41084708,
+0x0F16E050, 0xDD946073, 0x4D0B06FE, 0x6E07E00F,
+0x607326E9, 0xE0400F66, 0x65F30CFE, 0x690D85C2,
+0x01FEE050, 0x60934D0B, 0x6073260B, 0xE04C0F66,
+0x04FEB256, 0x07FEE040, 0x6271E068, 0x0F56652D,
+0x3563E640, 0xED008954, 0x0FD5E064, 0xC9036023,
+0x40004008, 0x61036903, 0x0F96E054, 0xDE7EE058,
+0x0FF6ECFF, 0xE06C6CCC, 0x60C30FE6, 0x62534E0B,
+0x42214221, 0x42214221, 0x42006723, 0x6107327C,
+0x4200E05C, 0x0F164521, 0x4521E040, 0x60530CFE,
+0x4008C903, 0x7C0630FC, 0x6E031FC6, 0x1FD56D2D,
+0x1F04A01E, 0x0FD6E060, 0x05FEE058, 0x64D3B231,
+0x62E2E05C, 0xE05409FE, 0x2E222299, 0x64D361C4,
+0x01FE661C, 0x07FEE06C, 0x6063470B, 0xE058220B,
+0xB20505FE, 0xE0642E22, 0x7D0102FD, 0x0F257201,
+0x02FDE064, 0x3262E606, 0xE0408BDC, 0x626106FE,
+0x05FEE040, 0x85514200, 0x302C750C, 0x6103701B,
+0x64F3E600, 0xE704A004, 0x76016256, 0x74042422,
+0x3273626D, 0x65F38BF8, 0x641DB1E2, 0x06FEE040,
+0x6461B19E, 0x0009A175, 0xD74DD44C, 0x470BE201,
+0xA16E2D20, 0x88290009, 0xDE4A8B07, 0x2D20E200,
+0xB16D66E2, 0xA164646D, 0xE2810009, 0x3020622C,
+0xA0A78B01, 0xE0240009, 0x626C06FC, 0x666CE682,
+0x8B213260, 0xE42452FA, 0xD43F2240, 0x12615647,
+0x12625648, 0x12635649, 0x1264564A, 0x1265564B,
+0x1266564C, 0x1267564D, 0x1268564E, 0x1269564F,
+0x1427E200, 0x14291428, 0x142B142A, 0x142D142C,
+0x142F142E, 0x1F6CA135, 0x666CE683, 0x8B073260,
+0xE60052FA, 0xD22B2260, 0x6222D62C, 0x2622A129,
+0x666CE690, 0x8B183260, 0xE60052FA, 0xD2282260,
+0x6022E605, 0x2202CB20, 0x2262D226, 0x2262E600,
+0x460BD625, 0xD2250009, 0x0009420B, 0xE601D224,
+0xD2242262, 0xA10C4618, 0xE6B02262, 0x3260666C,
+0xD5188B22, 0xD216D420, 0x75046D52, 0x6E52420B,
+0x420BD21E, 0xD41E64D3, 0x450BD511, 0xD21B0009,
+0x64E3420B, 0xD60ED41B, 0x0009460B, 0xE600E504,
+0x3253626D, 0xA0EC8B01, 0x666D0009, 0x326C62D3,
+0x22E07601, 0x4E19AFF4, 0xD214D413, 0xD4146542,
+0x0009420B, 0x0009A0DD, 0x0020248C, 0x00202A44,
+0x00200F72, 0x00117804, 0x00202538, 0x00202994,
+0x001C3500, 0x001D4004, 0x00201056, 0x00200C1C,
+0x001E212C, 0x001C3D30, 0x00202A5C, 0x00200FB4,
+0x00202A70, 0x00202A78, 0x00117800, 0x00200FBC,
+0x00202A7C, 0xD6AED4AD, 0x6262E040, 0x76046542,
+0x2452352C, 0x62626563, 0x75045641, 0x1461362C,
+0x62526653, 0x76085542, 0x1452352C, 0x55436262,
+0x352C76EC, 0x65631453, 0x56446262, 0x362C7510,
+0x66531464, 0x55456252, 0x352C7610, 0x65621455,
+0xD69C5246, 0x1426325C, 0x55476262, 0x352C7604,
+0x62621457, 0x76045548, 0x1458352C, 0x62626563,
+0x75045649, 0x1469362C, 0x564A6252, 0x362C7504,
+0x6653146A, 0x554B6252, 0x352C7604, 0x6262145B,
+0x7604554C, 0x145C352C, 0x62626563, 0x7504564D,
+0x146D362C, 0x62526653, 0x7604554E, 0x145E352C,
+0x524F6562, 0x325CD684, 0x6262142F, 0x7694054E,
+0x0456352C, 0x6263E044, 0x054E6662, 0x356C7244,
+0xE0480456, 0x054E6622, 0xD67C356C, 0x62620456,
+0x054EE054, 0x352C4229, 0x76040456, 0xE0586262,
+0x4229064E, 0x52FA362C, 0xE6380466, 0xE0442260,
+0xE048064E, 0x66421261, 0x56411262, 0x56421263,
+0x56451264, 0x56431265, 0x56461266, 0x064E1267,
+0x1268E040, 0xE050064E, 0x56441269, 0x064E126A,
+0x126BE04C, 0xE054064E, 0x064E126C, 0x126DE058,
+0xE044064E, 0xE200126E, 0xE0480426, 0x14212422,
+0x14251422, 0x14261423, 0xE0400426, 0xE0500426,
+0x04261424, 0x0426E04C, 0x0426E054, 0x0426E058,
+0x7F701F6C, 0x6EF64F26, 0x6CF66DF6, 0x69F6000B,
+0x614D4F22, 0x3123E240, 0xE21F8917, 0x89083127,
+0xD550D44F, 0x450BE001, 0x67076642, 0xA00C2679,
+0xE23F2462, 0x89083127, 0xD64AD749, 0xE00171E0,
+0x5571460B, 0x25296207, 0x4F261751, 0x0009000B,
+0x614D4F22, 0x3123E240, 0xE21F8915, 0x89073127,
+0xD240D43F, 0x420B6642, 0x260BE001, 0x2462A00B,
+0x3127E23F, 0xD73A8907, 0x5571D63A, 0x460B71E0,
+0x250BE001, 0x4F261751, 0x0009000B, 0x4618E640,
+0xD5354628, 0x22686252, 0x000B89FC, 0xE6800009,
+0x46284618, 0x6252D530, 0x89FC2268, 0x0009000B,
+0xE200A001, 0x32427201, 0x000B8BFC, 0xE6800009,
+0x46284618, 0x6252D529, 0x8BFC2268, 0x0009000B,
+0x4F222FE6, 0x6E537FFC, 0x2F42BFF1, 0xD62461E2,
+0x1615E280, 0x421854E1, 0x55E21646, 0x16574228,
+0x6EF257E3, 0x2E2B1678, 0x7F0426E2, 0xAFCE4F26,
+0x2FC66EF6, 0x2FE62FD6, 0xDD194F22, 0xBFD66C53,
+0xBFBB6E43, 0xBFD22DE2, 0x51D50009, 0x54D62C12,
+0x55D71C41, 0x56D81C52, 0x4F261C63, 0x6DF66EF6,
+0x6CF6000B, 0xE6006163, 0x4109A004, 0x76016256,
+0x74042422, 0x8BF93612, 0x0009000B, 0x00202538,
+0x001C36A0, 0x001C3CA0, 0x001C36F4, 0x001C3B88,
+0x001C3704, 0x0020248C, 0x001C373C, 0x001C3700,
+0x001C370C, 0x0009A109, 0x2FD62FC6, 0x4F222FE6,
+0x6E636D73, 0x6C53B016, 0x64C357F4, 0xB02965E3,
+0xB03D66D3, 0xB06D0009, 0xB0710009, 0xB0750009,
+0xB08A0009, 0xB08D0009, 0x4F260009, 0x6DF66EF6,
+0x6CF6A0B4, 0x3412D190, 0xD6900529, 0x2650D790,
+0x2742000B, 0x2FD62FC6, 0x4F222FE6, 0x6E636D73,
+0x6C53BFF0, 0x64C357F4, 0x66D365E3, 0x6EF64F26,
+0x6CF66DF6, 0xD1872FE6, 0x66126E63, 0x92BC4418,
+0x44084528, 0x45002629, 0x265B4408, 0x264B4400,
+0x21624708, 0xD1804708, 0x217227EB, 0x6EF6000B,
+0x4F222FE6, 0xE101DE7D, 0xBFABE40A, 0x62E32E12,
+0xE100726C, 0x2212E401, 0x22122212, 0x22122212,
+0x22422212, 0xE503E730, 0x2212E40A, 0x22122212,
+0x22122212, 0x22122212, 0x22122212, 0x22122212,
+0x22722212, 0x22122252, 0x22122212, 0x22122212,
+0x22122212, 0xBF852212, 0xE600121A, 0x4F262E62,
+0x6EF6000B, 0xE101D266, 0x2212E441, 0x2242000B,
+0xD465D164, 0x2162E605, 0x2462000B, 0xD264D563,
+0x88016050, 0xD4638B07, 0x60409668, 0x8B098801,
+0xA0079665, 0xE6000009, 0x2262D45E, 0x88016040,
+0xE6048B00, 0xAF5DE40A, 0xD25B2262, 0xE40AE601,
+0x2262AF58, 0x2FC62FB6, 0x2FE62FD6, 0xDC574F22,
+0x60C2ED00, 0xCB01EB64, 0x60C22C02, 0xA008C901,
+0x3DB26E03, 0x60C28907, 0xC901E40A, 0x6E03BF42,
+0x2EE87D01, 0x3DB28BF5, 0xD44D8B03, 0x420BD24D,
+0xE40A0009, 0x6EF64F26, 0x6CF66DF6, 0x6BF6AF32,
+0x8F014411, 0x6043604B, 0x0009000B, 0x2FC62FB6,
+0x2FE62FD6, 0x7FFC4F22, 0xED00DC40, 0xEB6460C2,
+0x2C02CB02, 0x2F0260C2, 0xA009C902, 0x3DB36E03,
+0x60C28908, 0x2F02E40A, 0xBF13C902, 0x7D016E03,
+0x8BF42EE8, 0x8B0B3DB3, 0xD236D437, 0x4F267F04,
+0x6DF66EF6, 0x422B6CF6, 0x1FFF6BF6, 0x03C40340,
+0x4F267F04, 0x6DF66EF6, 0x000B6CF6, 0xD52F6BF6,
+0x60525651, 0x000B4628, 0x2FB6306C, 0x2FD62FC6,
+0x4F222FE6, 0x4F024F12, 0x6E43BFF1, 0xDC286B03,
+0xBFECDD28, 0x30B80009, 0x060A3C05, 0x46094609,
+0x3D654601, 0x4209020A, 0x42094209, 0x8BF032E2,
+0x4F164F06, 0x6EF64F26, 0x6CF66DF6, 0x6BF6000B,
+0x4F222FE6, 0xE102DE1C, 0xE403E500, 0xBFD42E12,
+0xE6062E52, 0xE7004618, 0x2E62E403, 0x4F262E72,
+0x6EF6AFCB, 0x0009000B, 0x0025E720, 0x00202C3C,
+0x00202998, 0x001C5814, 0x001C59D0, 0x001C5830,
+0x001C6268, 0x001C59A4, 0x001C639C, 0x002029AD,
+0x001C5804, 0x002029AC, 0x001C581C, 0x001C5860,
+0x00202A90, 0x00200F72, 0x00202AA8, 0x001C1040,
+0xCCCCCCCD, 0x10624DD3, 0x001D4004, 0x2F962F86,
+0x2FB62FA6, 0x2FD62FC6, 0x4F222FE6, 0xE4007FE0,
+0x4528E510, 0x67436C43, 0xE108A00F, 0x6043644D,
+0x0F564008, 0xEE0060C3, 0x815125C1, 0x81538152,
+0x157315E2, 0x751415E4, 0x624D7401, 0x8BED3213,
+0xDA7251F1, 0x1A1154F2, 0xD1712A12, 0x56F455F3,
+0x58F657F5, 0x21421141, 0x11521153, 0x11641165,
+0x11761177, 0x11881189, 0xD96A6DF2, 0xDB6A52F7,
+0x29D219D1, 0x2B221B21, 0xD868EB45, 0xE9B8EA50,
+0x4A084B08, 0xA020699C, 0x6EEDEE00, 0x61E36DE3,
+0x41084D08, 0x31EC3DEC, 0x41084D08, 0x60C33D8C,
+0xD75F4108, 0x81D12DC1, 0x410860A3, 0x60C381D2,
+0xE200317C, 0x81D33492, 0x1D131DD2, 0x8D01D456,
+0xD4521D24, 0x65D3B03C, 0x64ED7E01, 0x8BDC34B2,
+0xDB54D14E, 0xD24F6512, 0x1B514529, 0xD14C6412,
+0x2B72674D, 0xD6506722, 0x1B734729, 0x2FD26922,
+0x1B82689D, 0x26926912, 0x16A25A12, 0xDA465B14,
+0x5C1616B4, 0x5D1816C6, 0x6EA216D8, 0x7F2016EA,
+0x6EF64F26, 0x6CF66DF6, 0x6AF66BF6, 0x000B69F6,
+0x664268F6, 0xC8036061, 0xE5008D04, 0xC9036061,
+0x8B038802, 0x65635262, 0x24125124, 0x6053000B,
+0x2FE62FD6, 0x7FEC4F22, 0x62536E53, 0x6D43E550,
+0x4508E400, 0xE101A001, 0x60435224, 0x81212211,
+0x60538123, 0x56E28122, 0x8BF53620, 0x16E4D22F,
+0xE61464F3, 0x65E3420B, 0xE4FC65E1, 0x2E512549,
+0x65F361F1, 0x2F112149, 0xD12854D1, 0xE614410B,
+0x607157D1, 0x2701CB01, 0x7F141DE1, 0x6EF64F26,
+0x6DF6000B, 0x2FE62FD6, 0x7FEC4F22, 0x66536E53,
+0x6D43E5FC, 0x20596061, 0x2601CB01, 0x326052E2,
+0x12E48B06, 0x31E051E2, 0x52D18B04, 0x1E22A002,
+0x5664AFF0, 0x64F3D215, 0x420BE614, 0x67E165E3,
+0x2719E1FC, 0x67F12E71, 0x271954D1, 0x65F3D10F,
+0x410BE614, 0x52D12F71, 0xCB016021, 0x1DE12201,
+0x4F267F14, 0x000B6EF6, 0x00006DF6, 0x0020259C,
+0x002025A4, 0x00202594, 0x002025CC, 0x001000A0,
+0x00101640, 0x001E2108, 0x001C3D00, 0x00200904,
+0x2FC62FB6, 0x2FE62FD6, 0x7FFC4F22, 0x6022D225,
+0x8D35C803, 0xDE242F01, 0xDB25DC24, 0xED01A016,
+0xC9036061, 0x89158801, 0xD122D420, 0x0009410B,
+0x65035603, 0xC8208561, 0xE0508903, 0x720102BE,
+0xD21D0B26, 0x64E3420B, 0x21D2D11C, 0x66C252C1,
+0x8BE53620, 0xDD1AEE01, 0x4E18A00E, 0xC9036061,
+0x890D8801, 0xD713D416, 0x470BDB16, 0xD4160009,
+0x65034B0B, 0x21E2D111, 0x66D252D1, 0x8BED3620,
+0xC80460F1, 0xD2118907, 0x4F267F04, 0x6DF66EF6,
+0x422B6CF6, 0x7F046BF6, 0x6EF64F26, 0x6CF66DF6,
+0x6BF6000B, 0x001E2100, 0x002025A4, 0x0020259C,
+0x00202538, 0x00200D42, 0x00200DC4, 0x001C3D30,
+0x00202594, 0x00200D60, 0x002025CC, 0x00200100,
+0xE601D203, 0x1265D503, 0x000B2252, 0x00001266,
+0x001C1010, 0x0000C34F, 0xD62A7FFC, 0x2642644C,
+0xC8205066, 0x2F028DFC, 0x7F04000B, 0x2FD62FC6,
+0x4F222FE6, 0x6D436C53, 0xEE00A004, 0x7E0164D4,
+0x644CBFEA, 0x8BF93EC2, 0x6EF64F26, 0x000B6DF6,
+0xA0016CF6, 0x76016643, 0x22286260, 0x36488BFB,
+0x6563AFE4, 0x62532FE6, 0x67537507, 0xEE0AE108,
+0xC90F6043, 0x30E24409, 0x44096503, 0xE6378D01,
+0x365CE630, 0x27604110, 0x77FF8FF2, 0x8028E000,
+0x6EF6000B, 0xE000000B, 0xE000000B, 0x4F222FE6,
+0x62537FEC, 0x65F36E43, 0x6423BFDC, 0x64E3BFD1,
+0x64F3BFCF, 0xBFCCD404, 0x7F140009, 0x000B4F26,
+0x00006EF6, 0x001C0004, 0x00202AC4, 0xE110D5A1,
+0xE6406050, 0x2500C9FD, 0xE0FF75E9, 0x80516453,
+0x80538052, 0x80568055, 0x251075EF, 0xE1EF6250,
+0x2219E001, 0xE7202520, 0x24608052, 0x2570000B,
+0xE4FDD595, 0xE7026152, 0x25122149, 0x74016052,
+0x2502CB01, 0xD1916652, 0x25622649, 0x92C46012,
+0x2102CB08, 0xC9CF6012, 0x60122102, 0x2102CB03,
+0x000B1172, 0x4F221123, 0xD78AD589, 0xD48BD28A,
+0xE600E100, 0x27112511, 0xBFBF2210, 0xAFD72461,
+0x664C4F26, 0x4600D286, 0x6060362C, 0x000BCB10,
+0x654C2600, 0x4500D282, 0x6650352C, 0x2619E1EF,
+0x2560000B, 0xD27F664C, 0x362C4600, 0xCB106060,
+0x2600000B, 0xD27B654C, 0x352C4500, 0xE1EF6650,
+0x000B2619, 0x664C2560, 0x4600D275, 0x6060362C,
+0x000BCB08, 0x654C2600, 0x4500D271, 0x6650352C,
+0x2619E1F7, 0x2560000B, 0xD26E664C, 0x362C4600,
+0xCB086060, 0x2600000B, 0xD26A654C, 0x352C4500,
+0xE1F76650, 0x000B2619, 0x624C2560, 0x4200D664,
+0x6020326C, 0x4021C908, 0x40214021, 0x600C000B,
+0xD660624C, 0x326C4200, 0xC9086020, 0x40214021,
+0x000B4021, 0x644C600C, 0x74FFD15B, 0x6240341C,
+0x602C000B, 0x644CD159, 0x6240341C, 0x602C000B,
+0x4F222FE6, 0xE60A655C, 0x8D153567, 0xBFEA6E43,
+0x640C6453, 0x880160EC, 0xE00F8B02, 0x2409A002,
+0x44094409, 0xE60A624C, 0x89053263, 0x644CBFE2,
+0x6023620C, 0x8B00C880, 0x6023E200, 0x000B4F26,
+0x4F226EF6, 0x6062D646, 0x8B038801, 0x0009B241,
+0x0009A003, 0xE640D243, 0xD6432260, 0x4F26E200,
+0x2622000B, 0xD63E4F22, 0x88026062, 0xB28B8B01,
+0xD63D0009, 0x4F26E200, 0x2622000B, 0xD439D538,
+0xE701E100, 0x000B2512, 0x0FFF2470, 0xE604D235,
+0x2260000B, 0xD4354F22, 0x410BD135, 0xD5250009,
+0x6650E1FD, 0x2619D233, 0x2560E700, 0x000B4F26,
+0x4F222270, 0xD12ED430, 0x0009410B, 0xE7FBD51D,
+0x26796650, 0x000B4F26, 0x4F222560, 0xD128D42B,
+0x0009410B, 0xE7F7D517, 0x26796650, 0x000B4F26,
+0xD5142560, 0x62509425, 0x000B2249, 0xD5112520,
+0x6250E4BF, 0x000B2249, 0x4F222520, 0x8522D220,
+0x2008600D, 0x88018911, 0x8803893C, 0x8805893E,
+0x88068940, 0x88088946, 0x8809894C, 0x880A8952,
+0x880B8958, 0xA065895E, 0xB0670009, 0xA0620009,
+0xFF7F600C, 0x001E1028, 0x001E2148, 0x001E1108,
+0x002029DC, 0x002029DE, 0x002029E9, 0x002029C0,
+0x001E103F, 0x001E105F, 0x001E1030, 0x001E1090,
+0x002029E4, 0x001E100B, 0x002029E0, 0x00202AC8,
+0x00200F72, 0x002029E8, 0x00202AD4, 0x00202AE4,
+0x002029B4, 0x0009B04C, 0x600CA035, 0x0009B056,
+0x600CA031, 0x6260D67C, 0x8B2B2228, 0x0009B062,
+0x600CA029, 0x6260D678, 0x8B232228, 0x0009B06A,
+0x600CA021, 0x6260D674, 0x8B1B2228, 0x0009B0B4,
+0x600CA019, 0x6260D670, 0x8B132228, 0x0009B0BA,
+0x600CA011, 0x6260D66C, 0x8B0B2228, 0x0009B11A,
+0x600CA009, 0x6260D668, 0x8B032228, 0x0009B132,
+0x600CA001, 0x4F26E000, 0x0009000B, 0xD264D163,
+0xD5648412, 0x4000C90F, 0xD763012D, 0x611CE403,
+0xD662E20F, 0x27122540, 0xE0012520, 0x2602000B,
+0xE601D25A, 0x30668523, 0xE0008D06, 0xE000D258,
+0x8122D65A, 0x2602E001, 0x0009000B, 0x8523D253,
+0x2008600D, 0x88018905, 0xD6558B0A, 0xCB016060,
+0xD6522600, 0xE101D44E, 0x2612E001, 0x8142000B,
+0xE000000B, 0xE501D149, 0x45188513, 0x3453640D,
+0x8D056603, 0xD24BE000, 0xE001D548, 0x25022260,
+0x0009000B, 0xD1414F22, 0x650D8513, 0x44196453,
+0x672E6249, 0x602C227D, 0x89098801, 0x890C8802,
+0x89108803, 0x89268806, 0x89298807, 0x0009A038,
+0xD63ED53D, 0xA027E212, 0x625C2652, 0x8B2F2228,
+0xA01ED63B, 0x605C6262, 0x89052008, 0x89088810,
+0x890B8820, 0x0009A024, 0xD634D436, 0xA013E204,
+0xD7352642, 0xE20CD631, 0x2672A00E, 0xD62FD533,
+0xA009E218, 0xD4322652, 0xE20AD62C, 0x2642A004,
+0xD62AD230, 0xE22E2622, 0xD42F8515, 0x3277670D,
+0x8F012421, 0x24516503, 0x0009B0DB, 0xE001A001,
+0x4F26E000, 0x0009000B, 0xE101D61A, 0x2610D427,
+0xD7196541, 0x655DD119, 0xE001E20F, 0x26202752,
+0x2102000B, 0x4F222FE6, 0x8523D210, 0x2448640C,
+0xD61E8B08, 0xE200D512, 0x84512621, 0x20499412,
+0x8051A050, 0x60E0DE0E, 0x8D35C840, 0x3427E201,
+0xD116894C, 0x420BD216, 0xD5162141, 0xCB046052,
+0x2502A035, 0x0000FF7F, 0x002029E9, 0x002029B4,
+0x002029C0, 0x001E1100, 0x001E100C, 0x002029E0,
+0x001E1000, 0x001E1001, 0x00202C40, 0x002029C8,
+0x002029D0, 0x00202CAE, 0x00202CB2, 0x00202CBE,
+0x00202CD6, 0x00202CE0, 0x002029CC, 0x002029DA,
+0x00201DB6, 0x001E1108, 0x89173427, 0xD794D293,
+0x2241470B, 0xE5FBD693, 0x21596162, 0x84E12612,
+0xB0FFCB80, 0x60E080E1, 0xCB04D68F, 0x60602E00,
+0x2600C93F, 0xE001D68D, 0x2602A001, 0x4F26E000,
+0x6EF6000B, 0x6060D68A, 0x8919C880, 0x6021D283,
+0x8B158801, 0xE501D287, 0x30568524, 0xD1868910,
+0xD486E203, 0x65412120, 0x655DE00B, 0xD5840656,
+0xE702E40F, 0x25712140, 0xE001D77C, 0x2702000B,
+0xE000000B, 0x4F222FE6, 0x84E1DE7E, 0x8934C880,
+0x8554D578, 0x8F302008, 0xD77B6103, 0x66728553,
+0x650C6403, 0x620C8566, 0x8B263520, 0xD773D677,
+0x644C651C, 0x27412651, 0xC84060E0, 0xD2748907,
+0x0009420B, 0x6062D667, 0xA008CB04, 0xD1642602,
+0x0009410B, 0xE5FBD663, 0x24596462, 0xB0A12642,
+0xD5620009, 0x2522E201, 0xD75F60E0, 0x2E00CB04,
+0xC93F6070, 0xA0012700, 0xE0006023, 0x000B4F26,
+0x2FA66EF6, 0x2FC62FB6, 0x2FE62FD6, 0xE240DA5C,
+0xDC5966A1, 0x3123616D, 0x62638900, 0x6ED36D2C,
+0x4E2136D8, 0x4E212A61, 0xDB5BD45A, 0xE700A00F,
+0x770166B2, 0x71026163, 0x65612B12, 0x71026613,
+0x62612B12, 0x622D655D, 0x325C4228, 0x627C2422,
+0x8BED32E3, 0xC90360D3, 0x8B108803, 0xED076EB2,
+0x710261E3, 0x67132B12, 0x62E17102, 0x65712B12,
+0x655D622D, 0x352C4528, 0xA00C2CD0, 0x88022452,
+0xA0038B01, 0x8801E203, 0xE2018B05, 0x66B22C20,
+0x677D6761, 0xEB0F2472, 0x6DA12CB0, 0x8B052DD8,
+0xD432D23E, 0xE101EE00, 0x241222E2, 0x6DF66EF6,
+0x6BF66CF6, 0x6AF6000B, 0x2FE62FD6, 0xE240DD30,
+0x616D66D1, 0x89003123, 0x672C6263, 0xDE323678,
+0x2D617703, 0xD62F4721, 0x472164E2, 0xE100A00E,
+0x71016562, 0x24506253, 0x42197401, 0x74012420,
+0x24504529, 0x45197401, 0x74012450, 0x3273621C,
+0x42008BEE, 0x64D166E2, 0x362C4200, 0x8F062448,
+0xDD222E62, 0xE500DE15, 0x2D52E701, 0x6EF62E72,
+0x6DF6000B, 0x2FE62FD6, 0xEE014F22, 0xED0AA005,
+0x64E3BC97, 0x64E3BC9D, 0x62EC7E01, 0x8BF732D7,
+0xEE01A005, 0x64E3BC9E, 0x64E3BCA4, 0x62EC7E01,
+0x8BF732D7, 0x6EF64F26, 0x6DF6000B, 0x002029DA,
+0x00201EC2, 0x001E1108, 0x001E1015, 0x002029E0,
+0x001E1001, 0x002029B4, 0x001E1100, 0x002029DE,
+0x002029CC, 0x001E1000, 0x002029D0, 0x002029DC,
+0x00201DB6, 0x001E100C, 0x002029C8, 0x002029E4,
+0x2FE62FD6, 0x7FFC4F22, 0x6060D64C, 0x89488801,
+0xE101D44B, 0xD74B8548, 0x650D2610, 0x45196070,
+0x6659DD49, 0x61D3626E, 0xC840262D, 0x74027102,
+0x8D1AD746, 0xD246666C, 0xE501DE46, 0xA0042E22,
+0x6245EE04, 0x21217501, 0x625C7102, 0x8BF832E3,
+0x81D46063, 0xD540E601, 0x626CE417, 0x891E3243,
+0x76016255, 0xAFF82721, 0xD23C7702, 0xE501DE39,
+0xA0042E22, 0x6245EE04, 0x21217501, 0x625C7102,
+0x8BF832E3, 0x81D46063, 0xD535E601, 0xE417A004,
+0x76016255, 0x77022721, 0x3243626C, 0x924B8BF8,
+0xD4302D21, 0x6142D730, 0x65F22F12, 0x60536DF2,
+0x2700C980, 0xC9606053, 0x80716103, 0x6EF26053,
+0xC90365F2, 0x45294D19, 0x60DC8072, 0x81724519,
+0x605C4E29, 0x401862EC, 0x8173302C, 0x21186D42,
+0x6EF22FD2, 0x66F262F2, 0x46294219, 0x66F2656C,
+0x64EC602C, 0x46294018, 0x4619304C, 0x606C8174,
+0x305C4018, 0x81758F07, 0x0009BCBF, 0x2228620C,
+0xA00A8908, 0x60130009, 0x8B038840, 0x0009B00A,
+0x0009A003, 0xE202D611, 0x7F042622, 0x6EF64F26,
+0x6DF6000B, 0x0009000B, 0x0000060A, 0x002029E8,
+0x00202C40, 0x001E1000, 0x00202CD6, 0x00202CE2,
+0x00202C52, 0x002029D0, 0x00202C82, 0x00202C80,
+0x00202C54, 0x001E100C, 0x002029B4, 0x002029E0,
+0x4F222FE6, 0xDE907FFC, 0x200884E9, 0x2F008D06,
+0xD68FD48E, 0x0009460B, 0x64F0B146, 0x6620D28D,
+0x89022668, 0xC9BF60E0, 0x7F042E00, 0x000B4F26,
+0x000B6EF6, 0x2FE60009, 0xDE874F22, 0x60E0D687,
+0xCBC0D487, 0x62602E00, 0xC803602C, 0x40218904,
+0x70014021, 0x6603A002, 0x66034009, 0xD681616D,
+0xE500A004, 0x75016262, 0x74042422, 0x3213625D,
+0xD27D8BF8, 0x0009420B, 0xC9BF84E2, 0x4F2680E2,
+0x6EF6000B, 0x2FD62FC6, 0x4F222FE6, 0xDC727FFC,
+0x84C2D276, 0xCB40DD76, 0x80C2420B, 0x8D042008,
+0x62E06E03, 0xA006642C, 0xD66A7404, 0x6160D471,
+0x470BD771, 0x644D651C, 0x45216543, 0xA0044521,
+0x62E6E600, 0x2F227601, 0x626D2D22, 0x8BF83253,
+0xC9036043, 0x89122008, 0x89058803, 0x89068802,
+0x89078801, 0x0009A008, 0xA005E007, 0xE00380D8,
+0x80D8A002, 0x80D8E001, 0x2F2262E2, 0xE00F2D22,
+0x80D8D65E, 0xCB086060, 0x60C02600, 0x2C00C93F,
+0x4F267F04, 0x6DF66EF6, 0x6CF6000B, 0x2FC62FB6,
+0x2FE62FD6, 0xD2564F22, 0x6E436D73, 0x420B6B53,
+0x20086C63, 0x64038F08, 0xD245D452, 0x6EF64F26,
+0x6CF66DF6, 0x6BF6422B, 0x24E060B3, 0x60C38041,
+0xA0078141, 0x655DE500, 0x00DC6053, 0x324C6253,
+0x80247501, 0x6EEC625D, 0x8BF432E3, 0x6060D636,
+0x2600C9BF, 0x6EF64F26, 0x6CF66DF6, 0x6BF6000B,
+0x7FC44F22, 0x720262F3, 0x22512F41, 0x45297202,
+0x60632251, 0xE5C4E682, 0x67F38121, 0x655C666C,
+0xE408BFBC, 0x4F267F3C, 0x0009000B, 0xD237D136,
+0xE4056012, 0xE500CB20, 0x22422102, 0x2252000B,
+0xD534D133, 0xE400D734, 0x2142E20F, 0x17411154,
+0xD5322722, 0x9635D732, 0x15412572, 0x96321562,
+0xE6011565, 0xD52F1165, 0x666CE6F8, 0x25422542,
+0x25422542, 0x25422542, 0x25622542, 0x7601E727,
+0x67632572, 0x25627797, 0xE7042572, 0x2572E248,
+0xE2192522, 0xE2702522, 0x25422542, 0x25422542,
+0x25222542, 0x2522E20C, 0x25422542, 0x25422542,
+0x25422542, 0x25422542, 0x000B154A, 0xE2081145,
+0x0009422B, 0x51630601, 0x001E1017, 0x00202AF0,
+0x00200F72, 0x002029B0, 0x001E1015, 0x001E10BF,
+0x00117800, 0x001E10FC, 0x00200100, 0x0020201A,
+0x001E10F8, 0x00202AF4, 0x00200FBC, 0x001E10AE,
+0x00201FDC, 0x00202B10, 0x001C3500, 0x001D4004,
+0x001C581C, 0xA000A000, 0x001D0100, 0x001D4000,
+0x00040021, 0x001C589C, 0x2FE62FD6, 0x7FFC4F22,
+0xC8206043, 0x6E438D02, 0x0009BEBB, 0xC81060E3,
+0xBEB88901, 0x60E30009, 0x8901C840, 0x0009BEDA,
+0xC80160E3, 0xDD378936, 0xC80260D0, 0x2F008D03,
+0x460BD635, 0x60F00009, 0x8902C804, 0x460BD633,
+0x62F00009, 0xC8806023, 0x60D08902, 0x2D00C97F,
+0xC8016023, 0xD62E8904, 0x0009460B, 0x0009A005,
+0x8902C808, 0x460BD62B, 0x60F00009, 0x8902C810,
+0x420BD229, 0xD5290009, 0x88026052, 0xD2288B03,
+0xA005E604, 0x88012260, 0xD2258B02, 0x2260E601,
+0x2522E200, 0xC88060E3, 0xD622892E, 0x60E36E60,
+0x8902C880, 0x420BD220, 0x60E30009, 0x8902C840,
+0x420BD21E, 0x60E30009, 0x8902C802, 0x420BD21C,
+0x60E30009, 0x890EC804, 0x410BD11A, 0xBF150009,
+0xBF1D0009, 0xD5180009, 0x6050D418, 0xC908D718,
+0xBF542500, 0x60E32472, 0x8905C808, 0x7F04D215,
+0x6EF64F26, 0x6DF6422B, 0x4F267F04, 0x000B6EF6,
+0x00006DF6, 0x001E1021, 0x00201182, 0x002011A4,
+0x002017B0, 0x002011BC, 0x002011CC, 0x002029E0,
+0x001E100B, 0x001E1028, 0x00201222, 0x0020122E,
+0x002011D4, 0x002011F2, 0x001E1000, 0x0010F100,
+0x12345678, 0x0020120A, 0xD6A8644C, 0x346C74FF,
+0x2450000B, 0x644CD6A6, 0x000B346C, 0xD6A52450,
+0x346C644C, 0x2450000B, 0x616D625C, 0x41194208,
+0x60194208, 0x644C4200, 0x324C670E, 0x207DD19E,
+0xC90F4200, 0x000B321C, 0x67632200, 0x4208625C,
+0x42004208, 0x324C644C, 0x4200D198, 0x000B321C,
+0x2FE62270, 0x614C4F12, 0x4100D493, 0x6710314C,
+0x2729E29F, 0x65736E53, 0x4719676D, 0x672E6279,
+0x4221227D, 0x42214221, 0x7601662C, 0xE4014608,
+0x34E84608, 0x644C4600, 0x0E1A0467, 0x215025EB,
+0x000B4F16, 0x4F226EF6, 0xD2857FE8, 0x88016021,
+0xD2848B7B, 0x26686621, 0xD2838B77, 0x26686621,
+0xE50F8B73, 0xE401BFA0, 0xBFA3E501, 0xE586E400,
+0xE400655C, 0x2F50BFA3, 0xBFA0E401, 0xE602E506,
+0x60634618, 0x81F2E401, 0x6543BF9E, 0xE40185F2,
+0xBFAA6543, 0x85F26603, 0x6543E401, 0x6603BFB1,
+0xE40265F0, 0x6053756C, 0x80F8BF7E, 0xBF81E402,
+0x84F8E512, 0x7090E402, 0x6503BF81, 0x4618E602,
+0x81F66063, 0xBF7FE402, 0x85F6E500, 0x6603E402,
+0xE500BF8B, 0xE40285F6, 0xBF926603, 0xE5FEE500,
+0xE010655C, 0xBF5FE403, 0xE5130F54, 0xE40EBF62,
+0x05FCE010, 0xBF62E40E, 0xE5007585, 0xBF63E403,
+0xE500E640, 0xBF70E403, 0xE500E640, 0xBF78E403,
+0xE5FFE640, 0xE014655C, 0xBF45E404, 0xE40F0F54,
+0xE504BF48, 0x05FCE014, 0xBF48E40F, 0xE5017584,
+0xBF49E640, 0xE501E404, 0xBF56E640, 0xE501E404,
+0xE404E640, 0xAF5C7F18, 0x7F184F26, 0x000B4F26,
+0x4F220009, 0xD2427FF0, 0x88016021, 0xD2418B71,
+0x26686621, 0xD2408B6D, 0x26686621, 0xE50F8B69,
+0xE401BF1A, 0xBF1DE501, 0xE586E400, 0xE400655C,
+0x2F50BF1D, 0xBF1AE401, 0xE401E506, 0xBF1B6543,
+0xE401E640, 0xBF286543, 0xE401E640, 0xBF306543,
+0x65F0E640, 0x756CE402, 0xBEFD6053, 0xE40280F4,
+0xE512BF00, 0xE40284F4, 0xBF007090, 0xE6406503,
+0xBF01E402, 0xE640E500, 0xBF0EE402, 0xE640E500,
+0xBF16E402, 0xE5FEE500, 0x6053655C, 0xBEE3E403,
+0xE51380F8, 0xE40EBEE6, 0xE40E84F8, 0xBEE67085,
+0xE5006503, 0xBEE7E640, 0xE500E403, 0xBEF4E640,
+0xE500E403, 0xBEFCE640, 0xE5FFE403, 0x6053655C,
+0xBEC9E404, 0xE40F80FC, 0xE504BECC, 0xE40F84FC,
+0xBECC7083, 0xE5016503, 0xBECDE640, 0xE501E404,
+0xBEDAE640, 0xE501E404, 0xE404E640, 0xAEE07F10,
+0x7F104F26, 0x000B4F26, 0x00000009, 0x001E1030,
+0x001E1080, 0x001E1090, 0x001E103F, 0x001E103E,
+0x002029DA, 0x002029DC, 0x002029DE, 0xD21DD11C,
+0x66206010, 0x676C7001, 0x3700C90F, 0xE5008D13,
+0x67106210, 0x7701622C, 0x64232170, 0xD6166010,
+0x44084408, 0x3428C90F, 0x62602100, 0x7201D513,
+0x44082620, 0x000B354C, 0xD10F6053, 0x25586510,
+0xE6008D13, 0xD60DD40B, 0x655C6540, 0x47086753,
+0x37584708, 0x47086540, 0x24507501, 0x367C6040,
+0x2400C90F, 0x72FF6210, 0x000B2120, 0x00006063,
+0x002029AF, 0x002029AE, 0x002029B0, 0x002025D4,
+0x7FFC4F22, 0xE680D19D, 0x666C6212, 0xD29C2F22,
+0x67F36563, 0x420B7542, 0x7F04E404, 0x000B4F26,
+0xE6800009, 0xD296666C, 0xE7006563, 0x422B7540,
+0xE6806473, 0xD292666C, 0xE7006563, 0x422B7543,
+0x2FB66473, 0x2FD62FC6, 0x4F222FE6, 0x4D18ED01,
+0xDB8DDC8C, 0x65C252C1, 0x89203520, 0xC9036051,
+0x891C8801, 0xD189DE87, 0x64E3410B, 0x85036503,
+0x670D66B2, 0x89073762, 0xD286D485, 0x0009420B,
+0xE701D185, 0x2172AFE6, 0xDE8464E3, 0x00094E0B,
+0xD484D683, 0x410BD184, 0xAFDB26D2, 0x4F260009,
+0x6DF66EF6, 0x000B6CF6, 0x4F226BF6, 0x85467FF4,
+0x2F01E681, 0x666C8547, 0x854881F1, 0x81F2D270,
+0x67F38542, 0x854381F3, 0x81F4E40C, 0x65636053,
+0x420B81F5, 0x7F0C7540, 0x000B4F26, 0x2F860009,
+0x2FA62F96, 0x2FC62FB6, 0x2FE62FD6, 0x7FF44F22,
+0xDC6EE200, 0x2F21A136, 0xDD6D6A13, 0xE0014A08,
+0x4D0BD96C, 0x3A9C4A00, 0x1F917930, 0x66C21F02,
+0x362052C1, 0xA1218B01, 0x60610009, 0x8801C903,
+0xA11B8B01, 0x85610009, 0x8977C801, 0x85D25D63,
+0xC9036603, 0x85D36403, 0x6053650D, 0x40214021,
+0x4500C93F, 0x322A6103, 0x6053252D, 0xC901E210,
+0xD9553123, 0x6E038D21, 0x4408D757, 0x44086570,
+0x44006213, 0x25584200, 0x342C8F0E, 0x6043D253,
+0x60E3072D, 0x4B196B7D, 0x658E68B9, 0x285D8801,
+0x6B7C8F0B, 0x6B13A009, 0x6043D24D, 0x61ED0E2D,
+0x68194119, 0x287D678E, 0xD14A6BEC, 0x22286212,
+0xEBFF8901, 0xEEFF6BBC, 0x6EEC65BD, 0x8B0F35E0,
+0x4D0BDD36, 0x540364C3, 0xBF76E502, 0xD4426D03,
+0x410BD136, 0xD74165D3, 0xD441EE01, 0x27E2A01D,
+0x26E9EEFC, 0x81D26063, 0x914E85D3, 0x81D32019,
+0x450885D2, 0x81D2208B, 0xE20885D3, 0x81D3205B,
+0x421885D4, 0x81D4202B, 0x854164C2, 0x814120E9,
+0xD43465C2, 0xCB016051, 0x490B2501, 0x60C20009,
+0x52F256F1, 0x2A02CB01, 0x2622AF79, 0x420BD21B,
+0x5E0364C3, 0x85E16D03, 0x6053650D, 0x897BC820,
+0x6210D129, 0x8B112228, 0xD72785EF, 0x4221620D,
+0x42214221, 0xE501D625, 0x27504221, 0xD725D924,
+0x2621D425, 0x2960E600, 0x24612762, 0x852162C2,
+0x8B43C802, 0xD912D71E, 0xE0016270, 0x612C490B,
+0x6692D91C, 0xA03E260B, 0x7E032962, 0x001C3D9C,
+0x00201A3C, 0x002025CC, 0x00202994, 0x00200D42,
+0x00202594, 0x00200DC4, 0x001E2130, 0x00200D60,
+0x001C3D30, 0x00202C28, 0x00200F72, 0x002025A4,
+0x0020248C, 0x001C3D00, 0x00202C3C, 0x00202B28,
+0x00202BA8, 0x002029A8, 0x0020259C, 0x001E212C,
+0x00202C2C, 0x00202C30, 0x00202D10, 0x002029EE,
+0x002029EC, 0x002029F0, 0x002029F4, 0xE04CD139,
+0x7201021E, 0xD9380126, 0x6290D438, 0x72016541,
+0x29207501, 0x85E12451, 0x4618E640, 0x891D2068,
+0xD934D733, 0x665D6171, 0x6592D733, 0x641D470B,
+0xE200DE32, 0x2E20A012, 0xE90885E4, 0x49186203,
+0x32902299, 0xE5018B04, 0x64E3BEB7, 0x0009A006,
+0x2598D92B, 0xE5008902, 0x64E3BEAF, 0xD22AD429,
+0x65D3420B, 0xEE01D729, 0x27E2AED9, 0x7C0862F1,
+0x2F217201, 0xEE0462F1, 0x31E7612D, 0xAEC38901,
+0x7F0C0009, 0x6EF64F26, 0x6CF66DF6, 0x6AF66BF6,
+0x000B69F6, 0x2FE668F6, 0xD21D4F22, 0x60E36E22,
+0x8D02C840, 0xBE3322E2, 0xE2400009, 0x2E284218,
+0xBE3E8901, 0x60E30009, 0x8905C810, 0xD216D415,
+0x0009420B, 0x0009BE3D, 0xC80560E3, 0xBE8E8901,
+0x60E30009, 0x8902C802, 0xAE3A4F26, 0x4F266EF6,
+0x6EF6000B, 0x00202538, 0x002029EC, 0x002029F4,
+0x002029EE, 0x002029F0, 0x00201AA0, 0x00202D10,
+0x00008000, 0x0020259C, 0x00200D60, 0x001E212C,
+0x001C3510, 0x00202C34, 0x00200F72, 0x080A0C0E,
+0x00020406, 0x1A1C1E20, 0x12141618, 0x2E303234,
+0x26282A2C, 0x3A3C3E40, 0x6C625648, 0x41112F26,
+0xE2208F18, 0x890B3123, 0x321CD204, 0xD1026220,
+0x412B312C, 0x00090009, 0x002024B6, 0x0020246C,
+0x000BE000, 0x400062F6, 0x40004000, 0x40004000,
+0x40004000, 0x62F6000B, 0x40004000, 0x40004000,
+0x40004000, 0x40184000, 0x62F6000B, 0x40004000,
+0x40004000, 0x40004000, 0x40284000, 0x62F6000B,
+0x40004000, 0x40184000, 0x000B4028, 0xC90F62F6,
+0x40054005, 0x40054005, 0x62F6000B, 0x4005C907,
+0x40054005, 0x62F6000B, 0x4005C903, 0x000B4005,
+0xC90162F6, 0x000B4005, 0x000062F6, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x544F0D0A, 0x46205355,
+0x00003A57, 0x2079614D, 0x32203033, 0x20373030,
+0x333A3231, 0x38313A37, 0x00000000, 0x00000D0A,
+0x00000043, 0x42707372, 0x3D206675, 0x554E203D,
+0x202C4C4C, 0x6E49677A, 0x4E497274, 0x6D754E51,
+0x0000003D, 0x61766E49, 0x2064696C, 0x72657375,
+0x20726F20, 0x2079656B, 0x00214449, 0x52504545,
+0x57204D4F, 0x65746972, 0x6461202C, 0x003D7264,
+0x6C617620, 0x0000003D, 0x00000A0D, 0x6E6B6E55,
+0x206E776F, 0x6D6D6F63, 0x3D646E61, 0x00000000,
+0x61437748, 0x7262696C, 0x6F697461, 0x6620206E,
+0x0A6C6961, 0x0000000D, 0x73696F4E, 0x61432065,
+0x7262696C, 0x6F697461, 0x6166206E, 0x21216C69,
+0x00000D0A, 0x00000D0A, 0x62735576, 0x7473725F,
+0x00000A0D, 0x62735576, 0x7375735F, 0x646E6570,
+0x00000A0D, 0x62735576, 0x7365725F, 0x000A0D6D,
+0x00000042, 0x72746E49, 0x6D652051, 0x2C797470,
+0x49677A20, 0x4972746E, 0x754E514E, 0x00003D6D,
+0x20746F4E, 0x756F6E65, 0x49206867, 0x4220514E,
+0x0A0D6675, 0x00000000, 0x000000FF, 0x00020001,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x010E010D, 0x00020003,
+0x01090108, 0x0002010A, 0x00030002, 0x02020201,
+0x02040203, 0x02060205, 0x02080207, 0x020A0209,
+0x020C020B, 0x020E020D, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x010E010D, 0x00FF010F,
+0x01090108, 0x010B010A, 0x00030002, 0x02020201,
+0x02040203, 0x02060205, 0x02080207, 0x020A0209,
+0x020C020B, 0x020E020D, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00205220, 0x00000046,
+0x00000059, 0x49544120, 0x0000204D, 0x00000000,
+0x02000112, 0x40FFFFFF, 0x91700CF3, 0x20104890,
+0x02090100, 0x0101002E, 0x09FA8000, 0x04000004,
+0x000000FF, 0x02010507, 0x07000200, 0x00028205,
+0x05070002, 0x00400383, 0x04050701, 0x01004003,
+0x002E0209, 0x80000101, 0x000409FA, 0x00FF0400,
+0x05070000, 0x00400201, 0x82050700, 0x00004002,
+0x03830507, 0x07010040, 0x40030405, 0x03040100,
+0x030C0409, 0x0079005A, 0x00410044, 0x03180053,
+0x00530055, 0x00320042, 0x0030002E, 0x00570020,
+0x0041004C, 0x0000004E, 0x00000000, 0x00000000,
+0x00000709, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, };
+
+const u32_t zcFwImageSize=11540;
diff --git a/drivers/staging/otus/hal/hpfwu_2k.c b/drivers/staging/otus/hal/hpfwu_2k.c
new file mode 100644
index 00000000000..94e2caca536
--- /dev/null
+++ b/drivers/staging/otus/hal/hpfwu_2k.c
@@ -0,0 +1,1016 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include "cprecomp.h"
+
+const u32_t zcFwImage[] = {
+0x0009000B, 0x4F222FE6, 0xDE947FFC, 0xE114D594,
+0x1E13D494, 0x67521E4C, 0xD494D693, 0x37402769,
+0x62528F06, 0x7201D692, 0x60602522, 0x2600C93F,
+0xD7906152, 0x2512611D, 0x264B6652, 0x2562470B,
+0x0009B017, 0xE60095AC, 0xC84060E2, 0x2F028F03,
+0x8FF93652, 0xD4887601, 0x4E0BDE88, 0xD4880009,
+0x00094E0B, 0x4E0BD487, 0x7F040009, 0xA0524F26,
+0x4F226EF6, 0x410BD184, 0xD4840009, 0x0009440B,
+0x450BD583, 0xD7830009, 0xD283E1FF, 0x2712611D,
+0xD4825029, 0xE1FFCB01, 0x1209E501, 0x12112212,
+0xE7202452, 0x4718D57E, 0x2572D27E, 0xD17EE700,
+0xD67FD47E, 0xE2012270, 0x24702172, 0xD67D2620,
+0x2641E4FF, 0xD57CE600, 0x666DE104, 0x76016063,
+0x4000626D, 0x8FF83212, 0xD5780545, 0x2520E201,
+0xD278D777, 0xE480E100, 0x22122710, 0x6613D576,
+0x666D644C, 0x76046763, 0x375C626D, 0x8FF83243,
+0xD5722712, 0xD273D772, 0xE400E101, 0x27102511,
+0x000B4F26, 0x7FCC2242, 0xD170D56F, 0xD271DB70,
+0x1F51D471, 0xD6717508, 0x1F12D771, 0x1F55710C,
+0x1FB975FC, 0x72041F2A, 0x1F13EB10, 0x1F561F44,
+0x1F781F67, 0xD86B1F2B, 0xDD6CD96B, 0xDC6CEA00,
+0xD26DDE6C, 0x89003A22, 0xD15D7A01, 0x88016010,
+0x56F88B03, 0x4218E201, 0xD1682622, 0x0009410B,
+0x440BD467, 0xD5670009, 0x0009450B, 0x6010D150,
+0x8B108801, 0xE650D14F, 0x46186212, 0x8B083266,
+0x56F9D14B, 0x2120E200, 0xCB016062, 0x2602A003,
+0x72012710, 0x60822122, 0x89098801, 0xE2C8D15A,
+0x622C6612, 0x89033626, 0x6010D158, 0x8BC88801,
+0x51F66792, 0x217252F5, 0xD6555191, 0x55FA2212,
+0x52FB6462, 0x55612542, 0x2252E400, 0x61436643,
+0x05DE6013, 0x36CC4608, 0x07DE2652, 0xC9036071,
+0x8B028801, 0x720162E2, 0x74012E22, 0x36B3664C,
+0x71048FEE, 0x66C2D147, 0x45286512, 0x265B4518,
+0x60822C62, 0x89018801, 0x0009A168, 0x6272D742,
+0x8B132228, 0xD42BD741, 0x6772D541, 0x51536242,
+0x312C327C, 0x24222228, 0x15138D05, 0x6262D63D,
+0xB1627201, 0xD6232622, 0x2622E200, 0x52916692,
+0x8B013620, 0x0009A144, 0x6061A06E, 0x001C001C,
+0x001D4020, 0x0000B38E, 0xFFFF0000, 0x12340000,
+0x001E1015, 0x00201274, 0x002039EC, 0x002018A2,
+0x002039F8, 0x00203A10, 0x00201860, 0x00201964,
+0x00201288, 0x001C3510, 0x001C3624, 0x001E212C,
+0x002038EC, 0x00203484, 0x002038F4, 0x00203900,
+0x0020390C, 0x00203968, 0x0020396C, 0x00203914,
+0x00203915, 0x00203918, 0x00117700, 0x00203984,
+0x00203982, 0x002034E8, 0x00117710, 0x001C3D30,
+0x001C36F8, 0x00117734, 0x001C3684, 0x001C3D00,
+0x001C1000, 0x001C1028, 0x002034FC, 0x0020391C,
+0x00117600, 0x00117740, 0x7FFFFFFF, 0x00201730,
+0x00203322, 0x0020232C, 0x00203D9C, 0x0020396A,
+0x002034F4, 0x0020395C, 0x001C3D2C, 0x001C36B0,
+0x0020348C, 0x0011775C, 0x8801C90F, 0xA0CF8901,
+0xD1960009, 0x36206212, 0xD4958904, 0x2421E200,
+0x2162A0CC, 0x6211D193, 0x89012228, 0x0009A0C3,
+0xE202D78F, 0x75016571, 0x3123615D, 0x27518D02,
+0x0009A0BC, 0xD28C57F2, 0x62226072, 0x40094019,
+0xC90F4009, 0x8F19880A, 0x52F31F2C, 0x40196022,
+0x40094009, 0x8808C90F, 0xA0A78901, 0x60630009,
+0xCB0154F7, 0xD27E55F2, 0xE7012402, 0xD47FE100,
+0x22112572, 0x72016242, 0x2422A098, 0x8B3F8805,
+0x602252F3, 0x40094019, 0xC90F4009, 0x8B168802,
+0xE4FFD577, 0x644D6752, 0x8B102748, 0x6272D775,
+0x8B0C3260, 0x51F255F7, 0xD26DE701, 0x21722562,
+0xD571E100, 0x64522211, 0xA0777401, 0x52F32542,
+0x40196022, 0x40094009, 0x8805C90F, 0x31B38B6E,
+0xD26A8B6C, 0x672254F4, 0x7701D569, 0x61422272,
+0x1F1CE640, 0x46182159, 0x8B033160, 0x6262D665,
+0x26227201, 0xE200D65A, 0x2621B067, 0x0009A056,
+0x3123E220, 0x88038B52, 0x52F38B1E, 0x40196022,
+0x40094009, 0x8803C90F, 0xD25B8B16, 0x672254F4,
+0x7701D557, 0x61422272, 0x1F1CE640, 0x46182159,
+0x8B033160, 0x6262D655, 0x26227201, 0xE200D648,
+0x2621B043, 0x0009A010, 0xD452D551, 0xD2446752,
+0xE1007701, 0x25723A46, 0x22118F06, 0xEA00D64E,
+0x72016262, 0x2622B031, 0x2FB2D54C, 0x95736652,
+0xD44A5BF1, 0x36205241, 0x60618910, 0x8B01C803,
+0x2B22E201, 0x8FF54510, 0x57F15664, 0x6272E1F0,
+0x41284118, 0x2722221B, 0x6BF2A008, 0x6BF2A006,
+0xE200D62F, 0xD12F2621, 0x2121E200, 0xD13CE201,
+0x66122822, 0x8B012668, 0x0009AE2B, 0x450BD539,
+0xD1390009, 0xAE24E600, 0x2F862160, 0x2FA62F96,
+0x2FC62FB6, 0x2FE62FD6, 0x7FF44F22, 0xDE34D133,
+0x54116212, 0x1F4167E2, 0x2F22D432, 0xD5321F72,
+0xD2326743, 0x58417794, 0x69425A42, 0x5B166C72,
+0x60526D22, 0xCB20E600, 0xE5402502, 0x626D7601,
+0x8BFB3253, 0x55F162F2, 0x11512122, 0xD62855F2,
+0x14812E52, 0x249214A2, 0x27C2D426, 0x26D211B6,
+0xDA256742, 0xE801D925, 0x490B2A72, 0xE2011A8C,
+0x1A2C4218, 0x4F267F0C, 0x6DF66EF6, 0x6BF66CF6,
+0x69F66AF6, 0x68F6000B, 0x000007D1, 0x0020397C,
+0x00203980, 0x00203986, 0x001C3DC0, 0x0011772C,
+0x001C3B88, 0x00203964, 0x0011773C, 0x00117744,
+0x0000F000, 0x00117764, 0x00117748, 0x00117768,
+0x0011776C, 0x01FFFFFF, 0x0011774C, 0x002034F4,
+0x00203D9C, 0x002024F0, 0x0020396A, 0x001C3B9C,
+0x001C3D98, 0x001C3700, 0x001C3500, 0x001C5960,
+0x001C8960, 0x002034FC, 0x001C3D00, 0x0020160C,
+0x2F962F86, 0x2FB62FA6, 0x2FD62FC6, 0x4F222FE6,
+0xDE957FAC, 0x61E0E014, 0x0F14D494, 0x710161E3,
+0xE0186210, 0xD2920F24, 0x0009420B, 0x450BD591,
+0x20080009, 0x8F126D03, 0xD28F1F07, 0x6720D48F,
+0x657CDD8F, 0x470BD78F, 0xD18F0009, 0x619C6910,
+0x46086613, 0x36184608, 0x3D6C4608, 0xE0181FD7,
+0xE58004FC, 0x604C66E2, 0x3050655C, 0x2D628F15,
+0x01FCE014, 0xDE85E500, 0x641CA008, 0x6753655D,
+0x607037EC, 0x39DC6953, 0x80947501, 0x3243625D,
+0xD67F8BF4, 0xA34EE200, 0x20082621, 0xE0148B13,
+0xE40001FC, 0xA009DE79, 0x644D671C, 0x35EC6543,
+0x69436652, 0x39DC6262, 0x74041921, 0x3273624D,
+0xA3388BF3, 0x88012D10, 0xE0148B17, 0xE70001FC,
+0x6D1C2D70, 0xDE6D1FD4, 0x32D3627D, 0xA32A8B01,
+0x677D0009, 0x667365E3, 0x61737504, 0x315C36EC,
+0x69126462, 0xAFEF7708, 0x88042492, 0xE0148B18,
+0xE40001FC, 0x671C2D40, 0x624DDE60, 0x8B013273,
+0x0009A311, 0x6943644D, 0x39EC62E3, 0x72046592,
+0x3D2C6D43, 0x615266D2, 0x21697408, 0x2512AFED,
+0x8B188805, 0x01FCE014, 0x2D40E400, 0xDE53671C,
+0x3273624D, 0xA2F68B01, 0x644D0009, 0x62E36943,
+0x659239EC, 0x6D437204, 0x66D23D2C, 0x74086152,
+0xAFED216B, 0x88312512, 0xD44A8B3A, 0x6146D94A,
+0x75046543, 0x67566442, 0x6E531F48, 0x65527E04,
+0x7EE462E2, 0x7E0464E2, 0x6EE21FE9, 0x5EF929E0,
+0x7E04D942, 0x1FEA60E2, 0x2900C901, 0xD9406EE2,
+0x29E04E09, 0x2F562F26, 0x56FAD93E, 0x6513490B,
+0xD13D7F08, 0xE71C6E0D, 0x1DE12D70, 0xDE3B6912,
+0x64E21D92, 0x1D43D13A, 0xD23A6512, 0x67221D54,
+0x1D75D239, 0x1D666622, 0x6262D638, 0x1D27A2AB,
+0x8B398830, 0x6596D92B, 0x67926696, 0x61967904,
+0x74E46493, 0x6E436992, 0x1F9B7E04, 0x1FEC6442,
+0xD9256EE2, 0x5EFC29E0, 0x7E04D924, 0x1FED60E2,
+0x2900C901, 0xD9226EE2, 0x29E04E09, 0x59FC7FFC,
+0xDE272F92, 0x2F164E0B, 0xD41F7F08, 0xE21C610D,
+0x1D112D20, 0xD2206442, 0xD41C1D42, 0x1D536542,
+0x6752D51B, 0xD71B1D74, 0x1D156172, 0x1D666622,
+0x6262D61A, 0x1D27A26F, 0x8B358833, 0x490BD919,
+0xA268EE00, 0x00002DE0, 0x00117800, 0x00203A14,
+0x002018A2, 0x00202AA4, 0x00203906, 0x00203A18,
+0x0020352C, 0x002018EE, 0x00203905, 0x00117804,
+0x00203984, 0x00117810, 0x00203901, 0x00203902,
+0x00203903, 0x00200F64, 0x001C5864, 0x001C6864,
+0x001C7864, 0x001C59BC, 0x001C69BC, 0x001C79BC,
+0x00200FBC, 0x00200FB8, 0x89018828, 0x0009A0C0,
+0xE643DEB5, 0x326662E1, 0x1FEE8F02, 0x2E21E240,
+0x622D62E1, 0x8B013267, 0x0009A0AA, 0xE50185E1,
+0x8B013056, 0x0009A0A4, 0x2D10E101, 0x64E1B225,
+0xE64357FE, 0x652D6271, 0x89443567, 0x3563E640,
+0xE6008B05, 0x0F65E040, 0xA00FE11A, 0x615372C0,
+0x41214121, 0x41214121, 0x45214121, 0x45214521,
+0xC9036053, 0xE0406603, 0x71180F65, 0x2209E007,
+0x0F25E03C, 0xE044641D, 0xB2A365F3, 0xE33C0F46,
+0x853233FC, 0x620DDE95, 0x42086031, 0x6023610D,
+0x1323E944, 0x06FE4108, 0xE00F39FC, 0x13144E0B,
+0x67075D91, 0x60D32679, 0x0F6654FE, 0x51928542,
+0x600D4E0B, 0x60D3260B, 0x0F666492, 0x65F3B237,
+0x696156FE, 0xE640659D, 0x89383563, 0xD78359FE,
+0x79066591, 0xC9036053, 0x40004008, 0x61036203,
+0x0F26E050, 0x470BE0FF, 0x6C07600C, 0x6603605D,
+0x46214621, 0x46214621, 0x42006263, 0x4200326C,
+0x40214021, 0x4008C903, 0x6D2D30FC, 0xE8006A03,
+0xB25765F3, 0x6EA264D3, 0x2EC9E050, 0x66942AE2,
+0xD76E01FE, 0x606C470B, 0x2AE22E0B, 0x64D365F3,
+0x7801B1FD, 0xEE06628D, 0x8FE932E3, 0x5EFE7D01,
+0x61E1E400, 0x410085E1, 0x66E3310C, 0x760C711B,
+0xE70465F3, 0x68667401, 0x3A736A4D, 0x8FF92582,
+0x65F37504, 0x641DB1E3, 0x64E1B1A4, 0x0009A17B,
+0xD45B56F7, 0xEC01D25B, 0x26C0420B, 0x0009A173,
+0x06FCE018, 0x8829606C, 0x58F78B08, 0xE400D252,
+0x66222840, 0x646DB171, 0x0009A165, 0x666CE681,
+0x89013060, 0x0009A0AC, 0xD550D14F, 0x62126A56,
+0x212232AC, 0x54116C56, 0x34CC6253, 0x64521141,
+0x72085812, 0xD44A384C, 0x68221182, 0x5A136C42,
+0x3ACC3C8C, 0x11A324C2, 0x6C2272EC, 0x72105814,
+0x118438CC, 0x5A156822, 0x11A53A8C, 0x6A227210,
+0xD6405816, 0x118638AC, 0x52176C62, 0x112732CC,
+0x5A185861, 0x11A83A8C, 0x5C195A62, 0x11C93CAC,
+0x521A5C63, 0x112A32CC, 0x5A1B5864, 0x11AB3A8C,
+0x5C1C5A65, 0x11CC3CAC, 0x521D5C66, 0x112D32CC,
+0x5A1E5867, 0x11AE3A8C, 0x561F5A68, 0x36ACE840,
+0x116FDA2D, 0x6CA2381C, 0x7A946682, 0x286236CC,
+0x5C8162A2, 0x18C13C2C, 0x62A27A44, 0x362C5682,
+0xD6261862, 0x5A856262, 0x3A2C4229, 0x760418A5,
+0x56866262, 0x362C4229, 0x56F71866, 0x2620E238,
+0x16C15C81, 0x16226212, 0xE2005C11, 0x551216C3,
+0x55151654, 0x55131655, 0x55161656, 0x55821657,
+0x65821658, 0x55141659, 0x5584165A, 0x5583165B,
+0x5585165C, 0x5586165D, 0x1821165E, 0x11212122,
+0x11251122, 0x11261123, 0x28221822, 0x18241124,
+0x18251823, 0x1826A0C7, 0x00117804, 0x002033E0,
+0x00203A38, 0x002018A2, 0x0020348C, 0x001C36A0,
+0x002034E8, 0x001C3CA0, 0x001C36F4, 0x001C3B88,
+0x666CE682, 0x8B203060, 0xEA2456F7, 0x26A0D194,
+0x16C15C17, 0x16225218, 0x16835819, 0x16A45A1A,
+0x16C55C1B, 0x1626521C, 0xE200581D, 0x551E1687,
+0x551F1658, 0x11271659, 0x11291128, 0x112B112A,
+0x112D112C, 0xA08E112E, 0xE683112F, 0x3060666C,
+0x52F78B0B, 0xEA00D883, 0x658222A0, 0x7804DC82,
+0x62822C52, 0xA07ED681, 0xE6902620, 0x3060666C,
+0xDA7F8B06, 0x00094A0B, 0xE20056F7, 0x2620A073,
+0x666CE691, 0x8B103060, 0x6222D276, 0x2228622C,
+0xD2788904, 0x0009420B, 0x0009A003, 0x420BD276,
+0x56F70009, 0xA05EE200, 0xE6922620, 0x3060666C,
+0xE0188951, 0xE6B00BFC, 0x666C62BC, 0x8B2A3260,
+0x02FCE014, 0x682CEA00, 0x62ADE904, 0x894A3283,
+0x6AADDD64, 0x3CDC6CA3, 0x7D046EC2, 0xDB68D467,
+0x32DC62A3, 0x4B0BDC67, 0x4C0B6D22, 0xD46664E3,
+0x00094B0B, 0x64D34C0B, 0x4B0BD464, 0xE6000009,
+0x666D6BE3, 0x76013B6C, 0x3293626D, 0x8FF72BD0,
+0xAFDA4D19, 0xE6B57A08, 0x3260666C, 0xD45C8B13,
+0x4B0BDB57, 0xD25B0009, 0x6022DB5B, 0xCB20E6FF,
+0x2202666D, 0xDB592B62, 0xE014E200, 0x56F72B20,
+0xA01002FC, 0xD4562620, 0x6542D256, 0x420BD456,
+0xA0080009, 0xDB520009, 0x52B1E600, 0x622CDB53,
+0x52F72B21, 0x7F542260, 0x6EF64F26, 0x6CF66DF6,
+0x6AF66BF6, 0x000B69F6, 0x4F2268F6, 0xE240614D,
+0x89143123, 0x3127E21F, 0x8B09D749, 0xD449614D,
+0xE00171E0, 0x5671440B, 0x26596507, 0x1761A007,
+0xE001D444, 0x6672440B, 0x26596507, 0x4F262762,
+0x0009000B, 0x614D4F22, 0x3123E240, 0xE21F8912,
+0xD73B3127, 0x614D8B08, 0x5671D23A, 0x420B71E0,
+0x260BE001, 0x1761A006, 0x6672D236, 0xE001420B,
+0x2762260B, 0x000B4F26, 0xE6400009, 0x46284618,
+0x6252D531, 0x89FC2268, 0x0009000B, 0x4618E680,
+0xD52D4628, 0x22686252, 0x000B89FC, 0xA0010009,
+0x7201E200, 0x8BFC3242, 0x0009000B, 0x4618E680,
+0xD5264628, 0x22686252, 0x000B8BFC, 0x2FE60009,
+0x7FFC4F22, 0xBFF16E53, 0x61E22F42, 0xE280D620,
+0x54E11615, 0x16464218, 0x422855E2, 0x57E31657,
+0x16786EF2, 0x26E22E2B, 0x4F267F04, 0x6EF6AFCE,
+0x0020348C, 0x00117804, 0x002038EC, 0x00203900,
+0x0020050A, 0x00201008, 0x0020102E, 0x00203A50,
+0x002018A2, 0x002018E6, 0x00203A64, 0x00203A6C,
+0x00203A70, 0x001C3500, 0x001C1000, 0x00203982,
+0x00117800, 0x002018EE, 0x00203A84, 0x00203988,
+0x001C3704, 0x002033E0, 0x001C373C, 0x001C3700,
+0x001C370C, 0x2FD62FC6, 0x4F222FE6, 0x6C53DD10,
+0x6E43BFA4, 0x2DE2BF89, 0x0009BFA0, 0x2C1251D5,
+0x1C4154D6, 0x1C5255D7, 0x1C6356D8, 0x6EF64F26,
+0x000B6DF6, 0x61636CF6, 0xA004E600, 0x62564109,
+0x24227601, 0x36127404, 0x000B8BF9, 0x00000009,
+0x001C370C, 0x0009A16E, 0x2FE62FD6, 0xDD944F22,
+0xA0049EB2, 0xD4930009, 0x420BD293, 0x62D265D2,
+0x8BF822E8, 0x0009A004, 0xD28FD490, 0x55D1420B,
+0x22E852D1, 0xA0048BF8, 0xD48D0009, 0x420BD28A,
+0x52D255D2, 0x8BF822E8, 0x0009A004, 0xD286D489,
+0x55D3420B, 0x22E852D3, 0xA0048BF8, 0xD4860009,
+0x420BD281, 0x52D455D4, 0x8BF822E8, 0x6EF64F26,
+0x6DF6000B, 0x2FD62FC6, 0x4F222FE6, 0x6E636C73,
+0x6D53B01A, 0x64D357F4, 0xB05F65E3, 0xB07566C3,
+0xB0A40009, 0xB0A80009, 0xB0AC0009, 0xB0AC0009,
+0xB0AF0009, 0xB03154F5, 0x6CCD6C03, 0x4F2660C3,
+0x6DF66EF6, 0x6CF6000B, 0x3412D170, 0xD6700529,
+0x2650D770, 0x2742000B, 0x0009A018, 0x2FD62FC6,
+0x4F222FE6, 0x6E636C73, 0x6D53BFEE, 0x64D357F4,
+0xB03365E3, 0xB08D66C3, 0xB00F54F5, 0x6CCD6C03,
+0x4F2660C3, 0x6DF66EF6, 0x6CF6000B, 0xE503D162,
+0xD763D462, 0x21524518, 0x2472000B, 0xD45FD15E,
+0x2162E600, 0x2462000B, 0xBF734F22, 0xBF73E40A,
+0xD25C0009, 0x4118E104, 0xE40AE500, 0xBF692212,
+0xD7592252, 0xCB206072, 0x000B4F26, 0x4F222702,
+0x410BD156, 0xD556E400, 0x4F26452B, 0xD1552FE6,
+0x66126E63, 0x92104418, 0x44084528, 0x45002629,
+0x265B4408, 0x264B4400, 0x21624708, 0xD14E4708,
+0x217227EB, 0x6EF6000B, 0x1FFF03F0, 0x4F222FE6,
+0xE101DE4A, 0xBF3DE40A, 0x67E32E12, 0xE500776C,
+0xE204E130, 0x2752E40A, 0x27522752, 0x27522752,
+0x27522752, 0x27522752, 0x27522752, 0x27522752,
+0x27522752, 0x27522752, 0x27522752, 0x27222712,
+0x27522752, 0x27522752, 0x27522752, 0x27522752,
+0x175ABF18, 0x2E62E600, 0x000B4F26, 0xD2346EF6,
+0xE441E101, 0x000B2212, 0xD1322242, 0xE605D432,
+0x000B2162, 0x000B2462, 0xD2300009, 0xE40AE601,
+0x2262AF00, 0x2FC62FB6, 0x2FE62FD6, 0x7FFC4F22,
+0x6C43DB2B, 0xED0060B2, 0x2B02CB03, 0xC90360B2,
+0x6E03A008, 0x89073DC2, 0xE46460B2, 0xB07CC903,
+0x7D016E03, 0x8BF52EE8, 0x8F043DC2, 0xD4212FE1,
+0x460BD621, 0x62F10009, 0x6023622D, 0x89FFC801,
+0x7F046023, 0x6EF64F26, 0x6CF66DF6, 0x6BF6000B,
+0x001C3B88, 0x00203A98, 0x002018EE, 0x00203AA0,
+0x00203AA8, 0x00203AB0, 0x00203AB8, 0x0025E720,
+0x00203D98, 0x002038F0, 0x001C5968, 0x001C3B40,
+0x000F8000, 0x001D4004, 0x001C3500, 0x002015E0,
+0x0020160C, 0x001C5814, 0x001C59D0, 0x001C5830,
+0x001C6268, 0x001C59A4, 0x001C639C, 0x001C581C,
+0x001C5860, 0x00203AC0, 0x002018A2, 0x8F014411,
+0x6043604B, 0x0009000B, 0x5651D52B, 0x46286052,
+0x306C000B, 0x2FC62FB6, 0x2FE62FD6, 0x4F124F22,
+0xBFF14F02, 0x6B036E43, 0xDD25DC24, 0x0009BFEC,
+0x3C0530B8, 0x4609060A, 0x46014609, 0x020A3D65,
+0x42094209, 0x32E24209, 0x4F068BF0, 0x4F264F16,
+0x6DF66EF6, 0x000B6CF6, 0x2FC66BF6, 0x2FE62FD6,
+0x4F124F22, 0xBFCF4F02, 0x6C036E43, 0xBFCBDD13,
+0x30C80009, 0x060A3D05, 0x46094609, 0x36E24601,
+0x4F068BF5, 0x4F264F16, 0x6DF66EF6, 0x6CF6000B,
+0x4F222FE6, 0xE102DE0B, 0xE403E500, 0xBFB92E12,
+0xE6062E52, 0xE7004618, 0x2E62E403, 0x4F262E72,
+0x6EF6AFB0, 0x0009000B, 0x001C1040, 0xCCCCCCCD,
+0x10624DD3, 0x001D4004, 0x2F962F86, 0x2FB62FA6,
+0x2FD62FC6, 0x4F222FE6, 0xE5007F98, 0x6453E710,
+0x6B534728, 0xEE1ADCBC, 0x6153655D, 0x315C4108,
+0x75014108, 0x6043317C, 0x0F16665D, 0xED0060B3,
+0x21B136E3, 0x81128111, 0x11D28113, 0x11D411D3,
+0x74048FEA, 0xD8B167F2, 0x1871D9B1, 0x58F12872,
+0x1981D1B0, 0x59F22982, 0x5DF45AF3, 0x54F65EF5,
+0x21921191, 0x11A211A3, 0x11D411D5, 0x11E611E7,
+0x11481149, 0xDAA855F7, 0x57F8EE00, 0x52F9DDA7,
+0x64E3D6A7, 0x2A521A51, 0xD8A7D9A6, 0x2D729AD5,
+0x6EED2622, 0x4D086DE3, 0x3DEC61E3, 0x4D084108,
+0x3D9C31EC, 0x410860B3, 0x81D12DB1, 0x4108E050,
+0x4008E7B7, 0x677C4108, 0x60B381D2, 0xE200318C,
+0x81D33472, 0x1D131DD2, 0x8D01D493, 0xD4901D24,
+0xB0B365D3, 0x64ED7E01, 0x8BDA34A2, 0x2FD2DA8C,
+0xDD9268A2, 0x2D824829, 0x7DFC64A2, 0xD287694D,
+0x6E222D92, 0x7D0C4E29, 0x68222DE2, 0x618D6AD3,
+0x2A16D784, 0xD48A6D72, 0x24D2D583, 0xD6895E72,
+0x517414E2, 0x1414EE00, 0xD1875876, 0x59781486,
+0x1498E710, 0x65E36252, 0x26E2142A, 0xE60064E3,
+0x6843644D, 0x384C4808, 0x381C4808, 0x0C866053,
+0x09CE28B1, 0x819160B3, 0x0ACE6053, 0x81A26043,
+0x0DCE6053, 0x81D360B3, 0x08CE6053, 0x18827401,
+0x624D09CE, 0x0ACE19E3, 0x1A643273, 0x75048FE0,
+0xE003D96A, 0x40186C92, 0x6D922CB1, 0x81D1DA6F,
+0x6E92E050, 0x81E24008, 0x60B36192, 0x64928113,
+0x1442E600, 0xD4696792, 0x689217A3, 0x1864E1FF,
+0x6563E703, 0x364C4608, 0x26127501, 0x3673665D,
+0xDC5B8BF8, 0x6DC2E003, 0x2DB14018, 0xD2606EC2,
+0x61C281E1, 0x1112EE00, 0xE02464C2, 0x65C21423,
+0x15E4D45B, 0xE58067C2, 0x68C28172, 0x818366E3,
+0x666D655C, 0x76046963, 0x394C6A6D, 0x8FF83A53,
+0xDB5429E2, 0x24B2DC54, 0x24C27404, 0x4F267F68,
+0x6DF66EF6, 0x6BF66CF6, 0x69F66AF6, 0x68F6000B,
+0x60116142, 0x8F03C803, 0xD23DE500, 0x8B063420,
+0xC9036011, 0x8B068802, 0x3420D239, 0x56128B03,
+0x52646513, 0x000B2422, 0x01136053, 0x2FE62FD6,
+0x7FEC4F22, 0x62536E53, 0x6D43E550, 0x4508E400,
+0xE101A001, 0x60435224, 0x81212211, 0x60538123,
+0x56E28122, 0x8BF53620, 0x16E4D238, 0xE61464F3,
+0x65E3420B, 0xE4FC65E1, 0x2E512549, 0x65F361F1,
+0x2F112149, 0xD13154D1, 0xE614410B, 0x607157D1,
+0x2701CB01, 0x7F141DE1, 0x6EF64F26, 0x6DF6000B,
+0x2FE62FD6, 0x7FEC4F22, 0x66536E53, 0x6D43E5FC,
+0x20596061, 0x2601CB01, 0x326052E2, 0x12E48B06,
+0x31E051E2, 0x52D18B04, 0x1E22A002, 0x5664AFF0,
+0x64F3D21E, 0x420BE614, 0x67E165E3, 0x2719E1FC,
+0x67F12E71, 0x271954D1, 0x65F3D118, 0x410BE614,
+0x52D12F71, 0xCB016021, 0x1DE12201, 0x4F267F14,
+0x000B6EF6, 0x00006DF6, 0x0020391C, 0x002034EC,
+0x002034F4, 0x002034FC, 0x00203524, 0x00203908,
+0x00203910, 0x00100208, 0x001017C0, 0x001E210C,
+0x001C3D00, 0x0020395C, 0x001000C8, 0x00117880,
+0x00117780, 0x00040020, 0x0026C401, 0x00200ED6,
+0x4F222FE6, 0xDE42624C, 0x42004208, 0x3E2CA005,
+0xD4405252, 0xBF695624, 0x65E22E62, 0x352052E1,
+0xD63D8BF6, 0x4F262622, 0x6EF6000B, 0x2FC62FB6,
+0x2FE62FD6, 0xDC394F22, 0x52C1DB39, 0x362066C2,
+0x6061891C, 0x8801C903, 0xDE348918, 0xBF37DD35,
+0x650364E3, 0x66B28503, 0x3262620D, 0xD4328907,
+0x0009BF76, 0x4D0BD431, 0xAFE60009, 0xBF3D0009,
+0xD42F64E3, 0x00094D0B, 0x0009AFDF, 0x2262D22D,
+0x6EF64F26, 0x6CF66DF6, 0x6BF6000B, 0x2FD62FC6,
+0x4F222FE6, 0xDD29DC28, 0x6E4360C2, 0x04DE4008,
+0xE614D127, 0x65E3410B, 0xD127D726, 0x55E227E2,
+0x35E05254, 0x21228F04, 0x400860C2, 0x122202DE,
+0x605365C2, 0x75014008, 0x0DE606DE, 0xC90F6053,
+0x60632C02, 0x6EF64F26, 0x000B6DF6, 0x85436CF6,
+0x650D5643, 0x622D6262, 0x35277204, 0xE1008F0C,
+0x2268960C, 0xD6158B03, 0x72015261, 0xD6131621,
+0x6262E101, 0x26227201, 0x6013000B, 0x000001FF,
+0x002034FC, 0x002034F4, 0x001C3D00, 0x00203524,
+0x002038EC, 0x002018A2, 0x002034EC, 0x00203AE8,
+0x00203AEC, 0x001C3D28, 0x0020395C, 0x0020391C,
+0x00200ED6, 0x00203960, 0x00203964, 0x00117754,
+0x2FC62FB6, 0x2FE62FD6, 0x7FF84F22, 0x6022D237,
+0x8D58C803, 0xDE362F01, 0xDB37DC36, 0x66C252C1,
+0x892F3620, 0xC9036061, 0x892B8801, 0xD233DD31,
+0x64D3420B, 0x1F016503, 0x880160B1, 0xD2308B04,
+0x64D3420B, 0x0009AFEA, 0x85615653, 0x8904C820,
+0xE050D72C, 0x7201027E, 0xD22B0726, 0x6453420B,
+0x89072008, 0x55F1D126, 0x64D3410B, 0xE601D727,
+0x2762AFD4, 0x55F1D226, 0x64E3420B, 0xE601D125,
+0x2162AFCC, 0xDD25DE24, 0xDC26DB25, 0x66D252D1,
+0x89183620, 0xC9036061, 0x89148801, 0xD117D41F,
+0x0009410B, 0x36E05603, 0x65038F04, 0x2B20E201,
+0x2C52AFEC, 0xD712D41C, 0x0009470B, 0xE601D115,
+0xAFE34618, 0x60F12162, 0x8907C804, 0x7F08D217,
+0x6EF64F26, 0x6CF66DF6, 0x6BF6422B, 0x4F267F08,
+0x6DF66EF6, 0x000B6CF6, 0x00006BF6, 0x001E2100,
+0x002034FC, 0x002034F4, 0x00203984, 0x002014A0,
+0x002014CC, 0x0020348C, 0x002016BE, 0x001E212C,
+0x00201530, 0x001C3D30, 0x00117880, 0x002034EC,
+0x0020390C, 0x00203908, 0x00203524, 0x00200610,
+0xE601D203, 0x1265D503, 0x000B2252, 0x00001266,
+0x001C1010, 0x0000C34F, 0x0009000B, 0x2FD62FC6,
+0x4F222FE6, 0x6D436C53, 0xEE00A004, 0x7E0164D4,
+0x644CBFF2, 0x8BF93EC2, 0x6EF64F26, 0x000B6DF6,
+0xE5006CF6, 0x6643A002, 0x76017501, 0x22286260,
+0xAFE38BFA, 0x2FE60009, 0x75076253, 0xE1086753,
+0x6043EE0A, 0x4409C90F, 0x650330E2, 0x8D014409,
+0xE630E637, 0x4110365C, 0x8FF22760, 0xE00077FF,
+0x000B8028, 0x000B6EF6, 0x000BE000, 0x2FE6E000,
+0x7FEC4F22, 0x6E436253, 0xBFDC65F3, 0xBFD06423,
+0xBFCE64E3, 0xD40364F3, 0x0009BFCB, 0x4F267F14,
+0x6EF6000B, 0x00203AF0, 0xE4FDD29D, 0xD79D6122,
+0x22122149, 0x74016022, 0x2202CB01, 0xD59A6622,
+0x22622649, 0xC8406070, 0x60528902, 0x2502CB04,
+0xE6016052, 0x2502CB08, 0xE4026052, 0x2502C9CF,
+0x46186052, 0x2502CB10, 0xCB036052, 0x15422502,
+0x1563000B, 0xD78ED58D, 0xD48FD28E, 0xE600E100,
+0x27112511, 0xAFCF2210, 0x664C2461, 0x4600D28B,
+0x6060362C, 0x000BCB10, 0x654C2600, 0x4500D287,
+0x6650352C, 0x2619E1EF, 0x2560000B, 0xD284664C,
+0x362C4600, 0xCB106060, 0x2600000B, 0xD280654C,
+0x352C4500, 0xE1EF6650, 0x000B2619, 0x664C2560,
+0x4600D27A, 0x6060362C, 0x000BCB08, 0x654C2600,
+0x4500D276, 0x6650352C, 0x2619E1F7, 0x2560000B,
+0xD273664C, 0x362C4600, 0xCB086060, 0x2600000B,
+0xD26F654C, 0x352C4500, 0xE1F76650, 0x000B2619,
+0x624C2560, 0x4200D669, 0x6020326C, 0x4021C908,
+0x40214021, 0x600C000B, 0xD665624C, 0x326C4200,
+0xC9086020, 0x40214021, 0x000B4021, 0xD161600C,
+0x341C644C, 0x000B6240, 0xD15F602C, 0x341C644C,
+0x000B6240, 0x2FE6602C, 0x6E434F22, 0xE60A645C,
+0x89143467, 0x0009BFEB, 0x60EC640C, 0x8B028801,
+0xA002E00F, 0x44092409, 0x624C4409, 0x3263E60A,
+0xBFE28905, 0x620C644C, 0xC8806023, 0xE2008B00,
+0x4F266023, 0x6EF6000B, 0xD64C4F22, 0x88016062,
+0xB2578B03, 0xA0030009, 0xD2490009, 0x2260E640,
+0xE200D648, 0x000B4F26, 0x4F222622, 0x6062D643,
+0x8B018802, 0x0009B2A0, 0xE200D642, 0x000B4F26,
+0xD53E2622, 0xE100D43E, 0x2512E701, 0x2470000B,
+0xE604D23B, 0x2260000B, 0xD43B4F22, 0x410BD13B,
+0xD53B0009, 0x6650E1FD, 0x2619D23A, 0x2560E700,
+0x000B4F26, 0x4F222270, 0xD238D537, 0xD7386152,
+0x2512611D, 0xE6FF6452, 0x2542242B, 0xD22FD435,
+0x420B666D, 0xD52E2762, 0x6750E1FB, 0x4F262719,
+0x2570000B, 0xD4304F22, 0x410BD128, 0xD5280009,
+0x6650E7F7, 0x4F262679, 0x2560000B, 0x9425D524,
+0x22496250, 0x2520000B, 0xE4BFD521, 0x22496250,
+0x2520000B, 0xD2254F22, 0x600D8522, 0x89112008,
+0x89458801, 0x89478803, 0x89498805, 0x894F8806,
+0x89558808, 0x895B8809, 0x8961880A, 0x8967880B,
+0x0009A06E, 0x0009B070, 0x600CA06B, 0x0000FF7F,
+0x001E2148, 0x001E1000, 0x001E1108, 0x002039BC,
+0x002039BE, 0x002039DD, 0x002039A0, 0x001E103F,
+0x001E105F, 0x001E102F, 0x001E1090, 0x002039C4,
+0x001E100B, 0x002039C0, 0x00203AF4, 0x002018A2,
+0x001E1028, 0x002039DC, 0x001D4020, 0x98760000,
+0x001C1000, 0x00203B00, 0x00203B10, 0x00203994,
+0x0009B04C, 0x600CA035, 0x0009B055, 0x600CA031,
+0x6260D684, 0x8B2B2228, 0x0009B061, 0x600CA029,
+0x6260D680, 0x8B232228, 0x0009B069, 0x600CA021,
+0x6260D67C, 0x8B1B2228, 0x0009B0C7, 0x600CA019,
+0x6260D678, 0x8B132228, 0x0009B0CD, 0x600CA011,
+0x6260D674, 0x8B0B2228, 0x0009B125, 0x600CA009,
+0x6260D670, 0x8B032228, 0x0009B13D, 0x600CA001,
+0x4F26E000, 0x0009000B, 0xD26CD16B, 0xD56C8412,
+0x4000C90F, 0xD76B012D, 0xE403D66B, 0xE20F611C,
+0x2540E001, 0x25202712, 0x2602000B, 0xE601D262,
+0x30668523, 0xE0008D05, 0xD663D260, 0xE0018122,
+0x000B2602, 0xD25C0009, 0x600D8523, 0x89052008,
+0x8B0A8801, 0x6060D65D, 0x2600CB01, 0xD457D65A,
+0xE001E101, 0x000B2612, 0x000B8142, 0xD152E000,
+0x8513E501, 0x640D4518, 0x66033453, 0xE0008D05,
+0xD551D253, 0x2260E001, 0x000B2502, 0x4F220009,
+0x8513D149, 0x6453650D, 0x62494419, 0x227D672E,
+0x8801602C, 0x88028909, 0x88038910, 0x8806891A,
+0x88078935, 0xA04C893B, 0xD5460009, 0x6652D746,
+0x2762D446, 0x622C6261, 0x2421A038, 0x2228625C,
+0xD4438B3F, 0x6642D540, 0x2562D440, 0x24018561,
+0x6203A02C, 0x2008605C, 0x88108907, 0x88208908,
+0x88308909, 0xA02C890A, 0xD23A0009, 0x6222A008,
+0xA005D239, 0xD2396222, 0x6222A002, 0x6262D638,
+0xD432D531, 0x66212522, 0xA00F626C, 0xD6352421,
+0x6261D52D, 0x622CD42D, 0xA0072562, 0xD6322421,
+0x8561D529, 0x2562D429, 0x62032401, 0x662D8515,
+0x3617610D, 0x65038F01, 0xB0CB2451, 0xA0010009,
+0xE000E001, 0x000B4F26, 0xD6190009, 0xD427E101,
+0x65412610, 0xD118D717, 0xE20F655D, 0x2752E001,
+0x000B2620, 0x2FE62102, 0xD20F4F22, 0x640C8523,
+0x8B082448, 0xD511D61D, 0x2621E200, 0x940F8451,
+0xA0482049, 0xDE0D8051, 0xC84060E0, 0xE2018D32,
+0x89443427, 0xD216D615, 0x2641420B, 0x0009A030,
+0x0000FF7F, 0x002039DD, 0x00203994, 0x002039A0,
+0x001E1100, 0x001E100C, 0x002039C0, 0x001E1000,
+0x001E1001, 0x002039C8, 0x002039A8, 0x002039AC,
+0x002039B0, 0x002039CC, 0x002039D0, 0x002039D4,
+0x002039D8, 0x00203DFC, 0x00203E06, 0x002039BA,
+0x0020287E, 0x89123427, 0xD294D693, 0x2641420B,
+0xCB8084E1, 0x80E1B0F5, 0xD69160E0, 0x2E00CB04,
+0xC93F6060, 0xD68F2600, 0xA001E001, 0xE0002602,
+0x000B4F26, 0xD68C6EF6, 0xC8806060, 0xD2868919,
+0x88016021, 0xD2898B15, 0x8524E501, 0x89103056,
+0xE203D187, 0x2120D487, 0xE00B6541, 0x0656655D,
+0xE40FD585, 0x2140E702, 0xD77E2571, 0x000BE001,
+0x000B2702, 0x2FE6E000, 0xDE804F22, 0xC88084E1,
+0xD57A892C, 0x20088554, 0x61038F28, 0x8553D77C,
+0x64036672, 0x8566650C, 0x3520620C, 0xD6798B1E,
+0x651CD774, 0x2651644C, 0x60E02741, 0x8904C840,
+0x420BD275, 0xA0030009, 0xD2680009, 0x0009420B,
+0x0009B09F, 0xE201D167, 0x60E02122, 0xCB04D464,
+0x60402E00, 0x2400C93F, 0x6023A001, 0x4F26E000,
+0x6EF6000B, 0x2FB62FA6, 0x2FD62FC6, 0xDA622FE6,
+0x66A1E240, 0x3622DC5E, 0x62638900, 0x6ED36D2C,
+0x4E2136D8, 0x4E212A61, 0xDB61D460, 0xE700A00F,
+0x770162B2, 0x71026123, 0x66212B12, 0x71026213,
+0x61212B12, 0x651D666D, 0x356C4528, 0x627C2452,
+0x8BED32E3, 0xC90360D3, 0x8B108803, 0x617367B2,
+0x2B127102, 0x71026E13, 0x2B126571, 0x655D6DE1,
+0x422862DD, 0x325CE107, 0xA00C2C10, 0x88022422,
+0xA0038B01, 0x8801E203, 0xE2018B05, 0x66B22C20,
+0x655D6561, 0xE60F2452, 0x67A12C60, 0x8B052778,
+0xDD38DC44, 0xEB01EA00, 0x2DB22CA2, 0x6DF66EF6,
+0x6BF66CF6, 0x6AF6000B, 0x2FE62FD6, 0xE240DD36,
+0x362266D1, 0x62638900, 0x3678672C, 0x7703DE38,
+0x47212D61, 0x64E2D635, 0xA00E4721, 0x6562E100,
+0x62537101, 0x74012450, 0x24204219, 0x45297401,
+0x74012450, 0x24504519, 0x621C7401, 0x8BEE3273,
+0x66E24200, 0x420061D1, 0x2118362C, 0x2E628F06,
+0xDD1CD728, 0xE501E400, 0x2D522742, 0x000B6EF6,
+0x2FD66DF6, 0x4F222FE6, 0xED0AEE01, 0x64E3BC85,
+0xBC8A64E3, 0x62EC7E01, 0x8BF732D7, 0xBC8DEE01,
+0x64E364E3, 0x7E01BC92, 0x32D762EC, 0x4F268BF7,
+0x000B6EF6, 0xD1186DF6, 0xD418920D, 0x72122122,
+0x2422D617, 0xD7177204, 0x72202622, 0x2722D116,
+0x000B7230, 0x137A2122, 0x002039BA, 0x0020298A,
+0x001E1015, 0x002039C0, 0x001E1001, 0x00203994,
+0x001E1100, 0x002039BE, 0x002039AC, 0x001E1000,
+0x002039B0, 0x002039BC, 0x0020287E, 0x001E100C,
+0x002039A8, 0x002039C4, 0x002039C8, 0x002039CC,
+0x002039D0, 0x002039D4, 0x002039D8, 0x4F222FE6,
+0xD6707FFC, 0x88016060, 0xE2018951, 0x2620BFBB,
+0xD56ED16D, 0xDE6E6010, 0x64E36552, 0x7402C840,
+0x8D22D16C, 0xD26C7502, 0xE601D76C, 0xE7042722,
+0x76016255, 0x626C2421, 0x8FF93273, 0xD4637402,
+0x6242E601, 0x640D8528, 0x67494419, 0x275D657E,
+0x81E4607C, 0xE417D562, 0x67557601, 0x3243626C,
+0x8FF92171, 0xA0207102, 0xD25E0009, 0xE601D75B,
+0xE7042722, 0x76016255, 0x626C2421, 0x8FF93273,
+0xD4527402, 0x6242E601, 0x640D8528, 0x67494419,
+0x275D657E, 0x81E4607C, 0xE417D553, 0x67557601,
+0x3243626C, 0x8FF92171, 0x92897102, 0xD2462E21,
+0x5E23D74E, 0x64F22FE2, 0x604365F2, 0x2700C980,
+0xC9606043, 0x80716103, 0xC9036043, 0x80724519,
+0x65F2605C, 0x817266F2, 0x46194629, 0x606C4529,
+0x4018645C, 0x8173304C, 0x21185E23, 0x64F22FE2,
+0x6E4C62F2, 0x602C4219, 0x66F262F2, 0x46294018,
+0x461930EC, 0x42298174, 0x652C606C, 0x305C4018,
+0x81758F07, 0x0009BC96, 0x2228620C, 0xA00A8908,
+0x60130009, 0x8B038840, 0x0009B009, 0x0009A003,
+0xE202D62F, 0x7F042622, 0x000B4F26, 0x4F226EF6,
+0x8552D52A, 0x8830600D, 0x88318903, 0xA0348923,
+0x85550009, 0xD428D727, 0x85532701, 0x610DD627,
+0x24124118, 0x460BD426, 0xD7230009, 0xD226D425,
+0x6572420B, 0xE230D120, 0x42286712, 0x2729E620,
+0x37604628, 0xD6218B03, 0xA016E200, 0xD61F2622,
+0xA012E202, 0xD1182622, 0x6212E530, 0xE6204528,
+0x46282259, 0x89083260, 0xD41AD119, 0xE601D513,
+0x2160450B, 0x472BD718, 0x4F264F26, 0x0009000B,
+0x0000060A, 0x002039DC, 0x001E1000, 0x002039C8,
+0x00203DFC, 0x00203E08, 0x00203DA0, 0x002039B0,
+0x00203DD0, 0x00203DCE, 0x00203DA2, 0x00203994,
+0x002039C0, 0x002039AC, 0x002039A8, 0x002018A2,
+0x00203B1C, 0x00203B20, 0x002018EE, 0x002039C4,
+0x001E100B, 0x00203B34, 0x00114004, 0x4F222FE6,
+0xDE967FFC, 0x200884E9, 0x2F008D06, 0xD695D494,
+0x0009460B, 0x64F0B19A, 0x6620D293, 0x89022668,
+0xC9BF60E0, 0x7F042E00, 0x000B4F26, 0x000B6EF6,
+0x2FE60009, 0xDE8D4F22, 0x60E0D68D, 0xCBC0D48D,
+0x62602E00, 0xC803602C, 0x40218904, 0x70014021,
+0x6603A002, 0x66034009, 0xD687616D, 0xE500A004,
+0x75016262, 0x74042422, 0x3213625D, 0xD2838BF8,
+0x0009420B, 0xC9BF84E2, 0x4F2680E2, 0x6EF6000B,
+0x2FE62FD6, 0x7FFC4F22, 0x6260D67D, 0x89442228,
+0xD572E100, 0x60502610, 0xCB40D47A, 0x2500440B,
+0x8D052008, 0x62E06E03, 0x7104612C, 0x2F11A006,
+0xD475D66D, 0xDD756760, 0x657C4D0B, 0xE23C6D1D,
+0x8B033D27, 0xD267D472, 0x0009420B, 0x4D214D21,
+0xA005D770, 0x66E6E400, 0x357C4508, 0x74012562,
+0x35D3654D, 0xD76C8BF7, 0x6172E003, 0x81114018,
+0x6E7260F1, 0x81E2700C, 0xD4686172, 0xDD688113,
+0x4D0BDE68, 0xE2016572, 0xD4672E22, 0x420BD255,
+0xD6560009, 0xC93F6060, 0x7F042600, 0x6EF64F26,
+0x6DF6000B, 0x2FC62FB6, 0x2FE62FD6, 0xD25F4F22,
+0x6B436E73, 0x420B6C53, 0x20086D63, 0x64038D1C,
+0xE50ED149, 0x32526210, 0x60C38916, 0x804124B0,
+0x814160D3, 0xA007E500, 0x655D61BC, 0x00EC6053,
+0x364C6653, 0x80647501, 0x3213625D, 0xD63B8BF5,
+0xC9BF6060, 0x2600A008, 0xD23AD44D, 0x6EF64F26,
+0x6CF66DF6, 0x6BF6422B, 0x6EF64F26, 0x6CF66DF6,
+0x6BF6000B, 0x7FC44F22, 0x720262F3, 0x22512F41,
+0x45297202, 0x60632251, 0xE5C4E682, 0x67F38121,
+0x655C666C, 0xE408BFB6, 0x4F267F3C, 0x0009000B,
+0x2F962F86, 0x2FB62FA6, 0x2FD62FC6, 0x4F222FE6,
+0xE1007FC4, 0x6513ECFF, 0x6B136CCD, 0xDE36D735,
+0xEDFF64F3, 0xD835EA04, 0x6053655C, 0x027D4000,
+0x32C0622D, 0x66038D0D, 0x09ED6063, 0x2491027D,
+0x24217402, 0x698202ED, 0x3928622D, 0x74022892,
+0x75017104, 0x6063625C, 0x07D532A2, 0x0EB58FE4,
+0x2448641C, 0xE6808905, 0x67F3E5C5, 0xBF79666C,
+0x7F3C655C, 0x6EF64F26, 0x6CF66DF6, 0x6AF66BF6,
+0x000B69F6, 0xD11E68F6, 0x6012D21E, 0xCB20E405,
+0x2102E500, 0x000B2242, 0x00002252, 0x001E1017,
+0x00203B38, 0x002018A2, 0x00203906, 0x001E1015,
+0x001E10BF, 0x00117800, 0x001E10FC, 0x00200610,
+0x0020390C, 0x00202AE2, 0x00203B3C, 0x002018EE,
+0x00203B58, 0x0011788C, 0x00203908, 0x002034EC,
+0x00201530, 0x001E2130, 0x00203B60, 0x00202AA4,
+0x00203B64, 0x0020396C, 0x00203974, 0x00203D9C,
+0x001C3500, 0x001D4004, 0xD564D163, 0xE400D764,
+0x2142E20F, 0x17411154, 0xD5622722, 0x9669D762,
+0x15412572, 0x96661562, 0xE6011565, 0xD55F1165,
+0x666CE6F8, 0x25422542, 0x25422542, 0x25422542,
+0x25622542, 0x7601E727, 0x67632572, 0x25627797,
+0xE7042572, 0x2572E248, 0xE2192522, 0xE2702522,
+0x25422542, 0x25422542, 0x25222542, 0x2522E20C,
+0x25422542, 0x25422542, 0x25422542, 0x25422542,
+0x000B154A, 0xE2081145, 0x0009422B, 0x2FE62FD6,
+0x7FFC4F22, 0xC8206043, 0x6E438D02, 0x0009BE67,
+0xC81060E3, 0xBE648901, 0x60E30009, 0x8901C840,
+0x0009BE86, 0xC80160E3, 0xDD3D8938, 0xC80260D0,
+0x2F008D03, 0x460BD63B, 0x60F00009, 0x8902C804,
+0x460BD639, 0x62F00009, 0xC8806023, 0x60D08902,
+0x2D00C97F, 0xC8016023, 0xD6348906, 0x0009460B,
+0x0009A007, 0x51630601, 0x8902C808, 0x460BD630,
+0x60F00009, 0x8902C810, 0x420BD22E, 0xD52E0009,
+0x88026052, 0xD22D8B03, 0xA005E604, 0x88012260,
+0xD22A8B02, 0x2260E601, 0x2522E200, 0xC88060E3,
+0xD227892D, 0x60E36E20, 0x8902C880, 0x420BD225,
+0x60E30009, 0x8902C840, 0x420BD223, 0x60E30009,
+0x8902C802, 0x420BD221, 0x60E30009, 0x890DC804,
+0xDD20D11F, 0x0009410B, 0x0009BF0D, 0x0009BF4C,
+0xD51ED41D, 0x2470E708, 0x25D2BF85, 0xC80860E3,
+0xD21B8905, 0x4F267F04, 0x422B6EF6, 0x7F046DF6,
+0x6EF64F26, 0x6DF6000B, 0x001C581C, 0xA000A000,
+0x001D0100, 0x001D4000, 0x00040021, 0x001C589C,
+0x001E1021, 0x00201A88, 0x00201AAA, 0x0020210C,
+0x00201AC2, 0x00201AD0, 0x002039C0, 0x001E100B,
+0x001E1028, 0x00201B3C, 0x00201B48, 0x00201AD8,
+0x00201AF6, 0x12345678, 0x001E1000, 0x0010F100,
+0x00201B24, 0x644CD6A7, 0x000B346C, 0xD6A62450,
+0x346C644C, 0x2450000B, 0x644CD6A4, 0x000B346C,
+0x625C2450, 0x4208616D, 0x42084119, 0x42006019,
+0x670E614C, 0xD49E321C, 0x4200207D, 0x324CC90F,
+0x2200000B, 0x4208625C, 0x42004208, 0x324C644C,
+0x4200D498, 0x000B324C, 0x2FE62260, 0x614C4F12,
+0x4100D493, 0x6710314C, 0xE29F666D, 0x27294619,
+0x6E536269, 0x672E6573, 0x4221227D, 0x42214221,
+0x7601662C, 0xE4014608, 0x34E84608, 0x644C4600,
+0x071A0467, 0x2150257B, 0x000B4F16, 0x4F226EF6,
+0xD2857FE8, 0x88016021, 0xD2848B7B, 0x26686621,
+0xD2838B77, 0x26686621, 0xE50F8B73, 0xE401BFA2,
+0xBFA4E501, 0xE586E400, 0xE400655C, 0x2F50BFA4,
+0xBFA1E401, 0xE602E506, 0x60634618, 0x81F2E401,
+0x6543BF9F, 0xE40185F2, 0xBFAB6543, 0x85F26603,
+0x6543E401, 0x6603BFB1, 0xE40265F0, 0x6053756C,
+0x80F8BF80, 0xBF82E402, 0x84F8E512, 0x7090E402,
+0x6503BF82, 0x4618E602, 0x81F66063, 0xBF80E402,
+0x85F6E500, 0x6603E402, 0xE500BF8C, 0xE40285F6,
+0xBF926603, 0xE5FEE500, 0xE010655C, 0xBF61E403,
+0xE5130F54, 0xE40EBF63, 0x05FCE010, 0xBF63E40E,
+0xE5007585, 0xBF64E403, 0xE500E640, 0xBF71E403,
+0xE500E640, 0xBF78E403, 0xE5FFE640, 0xE014655C,
+0xBF47E404, 0xE40F0F54, 0xE504BF49, 0x05FCE014,
+0xBF49E40F, 0xE5017584, 0xBF4AE640, 0xE501E404,
+0xBF57E640, 0xE501E404, 0xE404E640, 0xAF5C7F18,
+0x7F184F26, 0x000B4F26, 0x4F220009, 0xD2427FF0,
+0x88016021, 0xD2418B71, 0x26686621, 0xD2408B6D,
+0x26686621, 0xE50F8B69, 0xE401BF1C, 0xBF1EE501,
+0xE586E400, 0xE400655C, 0x2F50BF1E, 0xBF1BE401,
+0xE401E506, 0xBF1C6543, 0xE401E640, 0xBF296543,
+0xE401E640, 0xBF306543, 0x65F0E640, 0x756CE402,
+0xBEFF6053, 0xE40280F4, 0xE512BF01, 0xE40284F4,
+0xBF017090, 0xE6406503, 0xBF02E402, 0xE640E500,
+0xBF0FE402, 0xE640E500, 0xBF16E402, 0xE5FEE500,
+0x6053655C, 0xBEE5E403, 0xE51380F8, 0xE40EBEE7,
+0xE40E84F8, 0xBEE77085, 0xE5006503, 0xBEE8E640,
+0xE500E403, 0xBEF5E640, 0xE500E403, 0xBEFCE640,
+0xE5FFE403, 0x6053655C, 0xBECBE404, 0xE40F80FC,
+0xE504BECD, 0xE40F84FC, 0xBECD7083, 0xE5016503,
+0xBECEE640, 0xE501E404, 0xBEDBE640, 0xE501E404,
+0xE404E640, 0xAEE07F10, 0x7F104F26, 0x000B4F26,
+0x00000009, 0x001E102F, 0x001E1080, 0x001E1090,
+0x001E103F, 0x001E103E, 0x002039BA, 0x002039BC,
+0x002039BE, 0xD21DD11C, 0x66206010, 0x676C7001,
+0x3700C90F, 0xE5008D13, 0x67106210, 0x7701622C,
+0x64232170, 0xD6166010, 0x44084408, 0x3428C90F,
+0x62602100, 0x7201D513, 0x44082620, 0x000B354C,
+0xD10F6053, 0x25586510, 0xE6008D13, 0xD60DD40B,
+0x655C6540, 0x47086753, 0x37584708, 0x47086540,
+0x24507501, 0x367C6040, 0x2400C90F, 0x72FF6210,
+0x000B2120, 0x00006063, 0x00203905, 0x00203904,
+0x00203906, 0x0020352C, 0x7FFC4F22, 0xE680D19F,
+0x666C6212, 0xD29E2F22, 0x67F36563, 0x420B7542,
+0x7F04E404, 0x000B4F26, 0xE6800009, 0xD298666C,
+0xE7006563, 0x422B7540, 0xE6806473, 0xD294666C,
+0xE7006563, 0x422B7543, 0x2F866473, 0x2FA62F96,
+0x2FC62FB6, 0x2FE62FD6, 0x7FCC4F22, 0xDC8ED28D,
+0x72011F21, 0xDB8D1F22, 0xD18EDE8D, 0x66125211,
+0x8B013620, 0x0009A0E5, 0xC9036061, 0x8B018801,
+0x0009A0DF, 0xD288D487, 0xED84420B, 0x2F025503,
+0x30D0845C, 0xA0B88901, 0xD1840009, 0x626C6610,
+0x88016023, 0xD1828B68, 0x62101FC3, 0x895B2228,
+0xE003D480, 0x40186742, 0x68421772, 0xD57EE900,
+0x81816DB3, 0x7D042190, 0x67D26AB2, 0x64E26852,
+0x1F491F57, 0x740464E3, 0x1FA46542, 0x65431F5A,
+0x625275F8, 0x1F761FD5, 0x6D531F2B, 0xDA74D773,
+0x7D94D274, 0x68D21F88, 0x6AA26972, 0xD1726022,
+0x2202CB20, 0xE1401F1C, 0x7601E600, 0x3213626D,
+0x56F48BFB, 0x52F651F5, 0x21222B62, 0x52F851F7,
+0x212256F9, 0x2E6251FA, 0x51FB2412, 0x2D822512,
+0xD9662792, 0x29A2DD5F, 0x6AD2D965, 0xD9646892,
+0x68D21A84, 0x6081DA63, 0x2801CB01, 0xD86266D2,
+0x2A622962, 0xED015AFC, 0x2AD2480B, 0x2AD24D18,
+0x62D2DD5E, 0x2D227201, 0xD15056F3, 0xE2026062,
+0x2602CB01, 0x2120A03D, 0x8B3A2228, 0xE401DD58,
+0x2140E600, 0xE01C2D62, 0xC801005C, 0xD4558B0A,
+0xE600D755, 0xED7D2472, 0x626C7601, 0x8BFB32D3,
+0x24D2DD52, 0xE2FE68C2, 0x2C822829, 0x095CE01E,
+0xE01F5DF1, 0x0A5C2D90, 0x751051F2, 0xED0621A0,
+0xD74BE600, 0x8456D44B, 0x27007601, 0x696C6854,
+0x248039D3, 0x8FF67401, 0xDA477701, 0x2A10E194,
+0xE2007A01, 0x7A0F2A20, 0xD130E805, 0x66102A80,
+0x6023626C, 0x89088801, 0xD240D42A, 0x420B65F2,
+0xD131ED01, 0xAF304D18, 0x65F221D2, 0x8553D43C,
+0x620D6642, 0x89073262, 0xD13BD43A, 0x0009410B,
+0xE601D73A, 0x2762AF1A, 0xD134D41E, 0x410B65F2,
+0xD125ED01, 0xD637D436, 0x460B4D18, 0xAF0D21D2,
+0x7F340009, 0x6EF64F26, 0x6CF66DF6, 0x6AF66BF6,
+0x000B69F6, 0x4F2268F6, 0x85467FF4, 0x2F01E681,
+0x666C8547, 0x854881F1, 0x81F2D209, 0x67F38542,
+0x854381F3, 0x81F4E40C, 0x65636053, 0x420B81F5,
+0x7F0C7540, 0x000B4F26, 0x00000009, 0x001C3D9C,
+0x00202454, 0x0011779A, 0x001C36F8, 0x001C3B9C,
+0x001C3704, 0x00203524, 0x002014A0, 0x00203915,
+0x00203914, 0x00203910, 0x001C3D98, 0x001C3BB4,
+0x001C5960, 0x001C3500, 0x001C3D30, 0x001C8960,
+0x002034FC, 0x001C3D00, 0x0020160C, 0x00117730,
+0x00203918, 0x001C582C, 0x2000A000, 0x0000A000,
+0x0011778C, 0x00117792, 0x00117788, 0x002014CC,
+0x002038EC, 0x002034EC, 0x00201530, 0x001E2130,
+0x00203D7C, 0x002018A2, 0x2F962F86, 0x2FB62FA6,
+0x2FD62FC6, 0x4F222FE6, 0xD19B7FEC, 0x2F12E000,
+0x6103D49A, 0x1F4281F2, 0xDD9ADA99, 0xD69A6813,
+0xE0014808, 0x460BDE99, 0x38EC4800, 0x65A21F03,
+0x352052A1, 0xA23E8B01, 0x60510009, 0x8801C903,
+0xA2388B01, 0x52530009, 0x32E0DE91, 0xD9918B10,
+0x64A3490B, 0x4B0BDB90, 0xDE906403, 0xD791D690,
+0xEC01D591, 0x2E02E100, 0x271026C0, 0x2502AFDF,
+0xC8018551, 0xA1578B01, 0x62510009, 0x4200622D,
+0x5E53366A, 0x85E2226D, 0xC903642C, 0x85E36603,
+0x6053650D, 0x40214021, 0x4500C93F, 0x322A6703,
+0x6053252D, 0xC901D17F, 0x60106C03, 0x8801D97F,
+0xDB7F8B05, 0x2120E200, 0xCB0160B2, 0xD17D2B02,
+0x88016011, 0x65A28B0A, 0x8D042448, 0x9B9E6251,
+0xA00322B9, 0x919B2521, 0x2521221B, 0x37B3EB10,
+0x2448895E, 0xD4738B07, 0x22286241, 0x60638903,
+0xA05781F8, 0xD5706473, 0x46084608, 0x85E26273,
+0x46006B50, 0x362C4200, 0x2BB8C910, 0x8F1F6463,
+0x26686603, 0xD2698911, 0x062D6043, 0x4119616D,
+0x6B0E6019, 0x81F820BD, 0x880160C3, 0x646C8F2C,
+0x880F6073, 0xA0278B1B, 0xD2610009, 0x052D6043,
+0x4119615D, 0x670E6019, 0x645C207D, 0x81F8A01C,
+0x890F2668, 0x6043D25B, 0x6B5D052D, 0x60B94B19,
+0x201D610E, 0x60C381F8, 0x8F0D8801, 0x6473645C,
+0xEC00A00A, 0x6043D254, 0x625D052D, 0x60294219,
+0x207D670E, 0x81F8645C, 0x880285F8, 0x85E1890A,
+0x8D07C820, 0xE6DC6203, 0x60232269, 0x81E1A002,
+0x644CE4FF, 0x6210D149, 0x89012228, 0x644CE4FF,
+0x654DEBFF, 0x35B06BBC, 0xDB368B2B, 0x64A34B0B,
+0x410BD135, 0x54036403, 0x85446E03, 0xC948DB40,
+0xDC408808, 0xBEAE8B01, 0x64B3E502, 0x65E34C0B,
+0xDB3DEC01, 0xD13D2DC2, 0x621260B2, 0x72017001,
+0x21228805, 0x2B028F08, 0x666CE680, 0x6563D238,
+0x7549E700, 0x6473420B, 0xA030D436, 0x7FFF0009,
+0x85E28000, 0x20B9EBFC, 0x610381E2, 0x942A85E3,
+0x62032049, 0x450885F8, 0x81E2201B, 0xC90160C3,
+0x40084018, 0x40084008, 0x4000225B, 0x6023220B,
+0x85E481E3, 0x4118E108, 0x81E4201B, 0xE40262A2,
+0x20B98521, 0x67A28121, 0xCB016071, 0x85F82701,
+0x89033042, 0xECE785E2, 0x81E220C9, 0x490BD41E,
+0xA03B0009, 0x7E030009, 0x001C3D30, 0x00203D88,
+0x002034FC, 0x001E212C, 0x002033E0, 0x001C3D00,
+0x00117780, 0x002014A0, 0x0020166C, 0x0011770C,
+0x00203914, 0x00203915, 0x00203910, 0x002018A2,
+0x001C36F8, 0x00203988, 0x00203D98, 0x00203B7C,
+0x00203BFC, 0x00203C7C, 0x00203CFC, 0x00203900,
+0x002034F4, 0x002014CC, 0x0020398C, 0x00203990,
+0x00202454, 0x00203D80, 0x00203D84, 0x602262F2,
+0x40094019, 0xC90F4009, 0x8B0B880A, 0x60E2DE8C,
+0x40094019, 0xC90F4009, 0x8B038808, 0xCB0160A2,
+0x2802A006, 0x65E2DE87, 0x2E527501, 0x286266A2,
+0x52F366F2, 0x2622AE83, 0xD2838551, 0xDE83C802,
+0xA0958B01, 0x420B0009, 0x4E0B64A3, 0x5E036403,
+0x85E46503, 0x4918E908, 0xD77D209B, 0xE04C81E4,
+0xDC7C0B7E, 0x7B01D97C, 0x61C207B6, 0x71016690,
+0x8D062668, 0xD4792C12, 0x420BD279, 0xA070EB01,
+0x62512DB2, 0x4B18EB0F, 0x22B9E102, 0x32104118,
+0x85518B0F, 0x2029E2FC, 0x60518151, 0xCB0172E0,
+0x85E12501, 0x202994A3, 0x85E481E1, 0xA0522049,
+0x675181E4, 0x4719677D, 0x667E6779, 0x7701276D,
+0x6903607C, 0x88014918, 0x25918F3E, 0x6B12D161,
+0x21B27B01, 0x660D85E3, 0x40216063, 0xC93F4021,
+0x6C034600, 0x262D322A, 0xC8016063, 0xDB5ED15D,
+0x967D8901, 0xE6002C6B, 0x666C67CD, 0x40006063,
+0x622D021D, 0x8D0E3270, 0x60436403, 0xE9FF021D,
+0x8B013290, 0x01C5A007, 0x626C7601, 0x3292E904,
+0x646C8BEB, 0x60434400, 0xD15004BD, 0x0B457401,
+0x669D6911, 0x89073670, 0x602D6211, 0x890388FF,
+0xE201DB4B, 0x2B2021C1, 0xECFC8551, 0x815120C9,
+0xCB016051, 0xDC472501, 0x64A34C0B, 0x51F366F2,
+0x85EF2612, 0x54F2D244, 0x650D420B, 0x0009ADE7,
+0xE500DC42, 0x420B2C52, 0x4E0B64A3, 0x54036403,
+0x85446E03, 0x6703E908, 0x65034918, 0x27998541,
+0xDB323790, 0x8F0BD932, 0x6013610D, 0x8B07C820,
+0xC9486053, 0x8B038808, 0xE501BD4D, 0x0009A005,
+0x2128D233, 0xBD468901, 0x64B3E500, 0x490B65E3,
+0xADBCEC01, 0x85F22DC2, 0x7001EE04, 0x31E7610D,
+0x8D0281F2, 0xADA97A08, 0x7F140009, 0x6EF64F26,
+0x6CF66DF6, 0x6AF66BF6, 0x000B69F6, 0xF7FF68F6,
+0x2FE68000, 0xD2234F22, 0x60E36E22, 0x8D02C840,
+0xBBF922E2, 0xE2400009, 0x2E284218, 0xBC048901,
+0x60E30009, 0x8905C810, 0xD21CD41B, 0x0009420B,
+0x0009BC03, 0xC80560E3, 0xBD6D8901, 0x60E30009,
+0x8902C802, 0xAC004F26, 0x4F266EF6, 0x6EF6000B,
+0x001C3D3C, 0x00117760, 0x002014A0, 0x0020166C,
+0x0020348C, 0x00203D9C, 0x00203900, 0x002034F4,
+0x002014CC, 0x0020396C, 0x00203974, 0x00203968,
+0x0020396A, 0x00201530, 0x002018EE, 0x0020398C,
+0x00008000, 0x001C3510, 0x00203D90, 0x002018A2,
+0x080A0C0E, 0x00020406, 0x1A1C1E20, 0x12141618,
+0x2E303234, 0x26282A2C, 0x3A3C3E40, 0x6C625648,
+0x41112F26, 0xE2208F18, 0x890B3123, 0x321CD204,
+0xD1026220, 0x412B312C, 0x00090009, 0x0020340A,
+0x002033C0, 0x000BE000, 0x400062F6, 0x40004000,
+0x40004000, 0x40004000, 0x62F6000B, 0x40004000,
+0x40004000, 0x40004000, 0x40184000, 0x62F6000B,
+0x40004000, 0x40004000, 0x40004000, 0x40284000,
+0x62F6000B, 0x40004000, 0x40184000, 0x000B4028,
+0xC90F62F6, 0x40054005, 0x40054005, 0x62F6000B,
+0x4005C907, 0x40054005, 0x62F6000B, 0x4005C903,
+0x000B4005, 0xC90162F6, 0x000B4005, 0x000062F6,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x544F0D0A,
+0x46205355, 0x00003A57, 0x206C754A, 0x32203120,
+0x20383030, 0x323A3132, 0x32313A37, 0x00000000,
+0x00000D0A, 0x00000043, 0x42707372, 0x3D206675,
+0x554E203D, 0x202C4C4C, 0x6E49677A, 0x4E497274,
+0x6D754E51, 0x0000003D, 0x61766E49, 0x2064696C,
+0x72657375, 0x20726F20, 0x2079656B, 0x00214449,
+0x52504545, 0x57204D4F, 0x65746972, 0x6461202C,
+0x003D7264, 0x6C617620, 0x0000003D, 0x00000A0D,
+0x435F4D5A, 0x465F444D, 0x4C445F57, 0x494E495F,
+0x00000054, 0x6E6B6E55, 0x206E776F, 0x6D6D6F63,
+0x3D646E61, 0x00000000, 0x203A3051, 0x00000020,
+0x203A3151, 0x00000020, 0x203A3251, 0x00000020,
+0x203A3351, 0x00000020, 0x203A3451, 0x00000020,
+0x2B434741, 0x73696F4E, 0x61432065, 0x7262696C,
+0x6F697461, 0x6166206E, 0x6F206C69, 0x6974206E,
+0x0D0A656D, 0x00000000, 0x00000072, 0x00205220,
+0x00000D0A, 0x62735576, 0x7473725F, 0x00000A0D,
+0x62735576, 0x7375735F, 0x646E6570, 0x00000A0D,
+0x62735576, 0x7365725F, 0x000A0D6D, 0x00000044,
+0x44387570, 0x72637365, 0x6F747069, 0x3D584572,
+0x00000000, 0x00000047, 0x00000042, 0x72746E49,
+0x6D652051, 0x2C797470, 0x49677A20, 0x4972746E,
+0x754E514E, 0x00003D6D, 0x654C7245, 0x0000006E,
+0x00000049, 0x20746F4E, 0x756F6E65, 0x49206867,
+0x4220514E, 0x0A0D6675, 0x00000000, 0x000000FF,
+0x00020001, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x010E010D,
+0x00020003, 0x01090108, 0x0002010A, 0x02000003,
+0x02020201, 0x02040203, 0x02060205, 0x02020200,
+0x02040203, 0x020C020B, 0x020E020D, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x000000FF,
+0x00020001, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x010E010D,
+0x00020003, 0x01090108, 0x0002010A, 0x00030003,
+0x02020201, 0x02040203, 0x02060205, 0x02020200,
+0x02040203, 0x020C020B, 0x020E020D, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x010E010D,
+0x00FF010F, 0x01090108, 0x010B010A, 0x0200010F,
+0x02020201, 0x02040203, 0x02060205, 0x02020200,
+0x02040203, 0x020C020B, 0x020E020D, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x010E010D,
+0x00FF010F, 0x01090108, 0x010B010A, 0x010F010F,
+0x02020201, 0x02040203, 0x02060205, 0x02020200,
+0x02040203, 0x020C020B, 0x020E020D, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00205220,
+0x00000046, 0x00000059, 0x73204142, 0x003D7165,
+0x49544120, 0x0000204D, 0x00000000, 0x00000000,
+0x002E0209, 0x80000101, 0x000409FA, 0x00FF0400,
+0x05070000, 0x02000201, 0x82050700, 0x00020002,
+0x03830507, 0x07010040, 0x40030405, 0x02090100,
+0x0101002E, 0x09FA8000, 0x04000004, 0x000000FF,
+0x02010507, 0x07000040, 0x40028205, 0x05070000,
+0x00400383, 0x04050701, 0x00004002, 0x00000000,
+0x00000000, 0x07090000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, };
+
+const u32_t zcFwImageSize=15928;
diff --git a/drivers/staging/otus/hal/hpfwu_BA.c b/drivers/staging/otus/hal/hpfwu_BA.c
new file mode 100644
index 00000000000..0c741571f2b
--- /dev/null
+++ b/drivers/staging/otus/hal/hpfwu_BA.c
@@ -0,0 +1,874 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include "cprecomp.h"
+
+const u32_t zcFwImage[] = {
+0x0009000B, 0x4F222FE6, 0xDE917FFC, 0xE114D791,
+0x1E13D491, 0x1E4C470B, 0x0009B017, 0x95C2E600,
+0xC84060E2, 0x2F028F03, 0x8FF93652, 0xD48B7601,
+0x4E0BDE8B, 0xD48B0009, 0x00094E0B, 0x4E0BD48A,
+0x7F040009, 0xA0474F26, 0x4F226EF6, 0x410BD187,
+0xD4870009, 0x0009440B, 0x450BD586, 0xD7860009,
+0x611DE1FF, 0xD1852712, 0x6012E2FF, 0xCB01D484,
+0x71DC2102, 0x71042122, 0x2122E501, 0xD5812452,
+0xD2819792, 0xE7002572, 0xD481D180, 0x2270D681,
+0x2172E201, 0x26202470, 0xE4FFD67F, 0xE6002641,
+0xE104D57E, 0x6063666D, 0x626D7601, 0x32124000,
+0x05458FF8, 0xE501D27A, 0xD17A2250, 0xD57BD47A,
+0xE700E600, 0x25722470, 0x11622162, 0x11691166,
+0x4F26116A, 0x116E000B, 0xD1757FC4, 0x2F12D875,
+0xD476D175, 0xD577D676, 0x1F87D777, 0xD97778FC,
+0x1F1BD277, 0x1F417104, 0x1F647404, 0x1F887604,
+0x71F41F1C, 0x1F42E8C8, 0x1F651F53, 0x1F991F76,
+0x1F1D1F2A, 0xDD6F688C, 0xDA70DE6F, 0xDC71DB70,
+0x00094A0B, 0x00094B0B, 0x00094C0B, 0x6010D15E,
+0x8B0F8801, 0xE950D15D, 0x49186212, 0x8B073296,
+0x56FAD159, 0x2120E200, 0xCB016062, 0x2602A002,
+0x21227201, 0x880160D2, 0xD1638907, 0x32866212,
+0xD1628903, 0x88016010, 0x64E28BDA, 0x52F751F8,
+0x55E12142, 0x2252D15E, 0x661254FB, 0x246259FC,
+0x29725711, 0x880160D2, 0x66E28B53, 0x362052E1,
+0x6061894C, 0x8801C90F, 0xD1568B48, 0x36206212,
+0xA0438903, 0x27102162, 0xD5530FA0, 0x6651E710,
+0x626D7601, 0x8F3C3273, 0x65F22561, 0x695251F2,
+0x54F359F1, 0x679252F4, 0x61426512, 0x56F66922,
+0x642252F5, 0xCB206062, 0xE6002602, 0x76011F1E,
+0x626DE110, 0x32134118, 0x51FE8FF8, 0x267256F1,
+0x56F457F2, 0x55F32752, 0x251257F5, 0x27422692,
+0x51F969E2, 0x2192D43D, 0xE90161F2, 0x2192440B,
+0x491865F2, 0xD9382592, 0xE200D539, 0x62512921,
+0x720154FD, 0x622D2521, 0x2422A003, 0xE200D932,
+0xE9012921, 0x2D92D12C, 0x26686612, 0xAF6F8B01,
+0xD6300009, 0x0009460B, 0xE700D128, 0x2170AF68,
+0x001C001C, 0x00200F7C, 0x0000B38E, 0x0020322C,
+0x0020145E, 0x00203238, 0x00203250, 0x0020141C,
+0x0020151C, 0x00200FA0, 0x001C3510, 0x001C3648,
+0x001E212C, 0x00203188, 0x00202D24, 0x00203190,
+0x0020319C, 0x002031A8, 0x002031B8, 0x002031BC,
+0x002031B0, 0x00117708, 0x002031B1, 0x002031B4,
+0x001C3D30, 0x00117718, 0x00117734, 0x001C3B9C,
+0x001C3704, 0x001C3D98, 0x001C3500, 0x001C3D00,
+0x001C36F8, 0x001C1028, 0x00202D98, 0x00201328,
+0x00202C04, 0x00201E18, 0x002034BC, 0x002031BA,
+0x00202D90, 0x002031CC, 0x002031D0, 0x00201276,
+0x002031D2, 0x00201FD0, 0x2FB62F96, 0x2FD62FC6,
+0x4F222FE6, 0xDE947F8C, 0x61E0E024, 0x0F14D493,
+0x710161E3, 0xD7926210, 0x470BE028, 0xD5910F24,
+0x0009450B, 0x6D032008, 0x1F0B8F11, 0xD48FDC8E,
+0xDD8F67C0, 0x657C4D0B, 0xDD8FD18E, 0x6B9C6910,
+0x420862B3, 0x32B84208, 0x3D2C4208, 0xE0281FDB,
+0xE58004FC, 0x604C66E2, 0x3050655C, 0x2D628F13,
+0x01FCE024, 0x641CE500, 0x625DDE84, 0x8B013243,
+0x0009A33D, 0x6753655D, 0x607037EC, 0x39DC6953,
+0xAFF27501, 0x20088094, 0xE0248B13, 0xE50001FC,
+0xA009DE7A, 0x655D641C, 0x32EC6253, 0x6C536B22,
+0x3CDC67B2, 0x75041C71, 0x3243625D, 0xA31E8BF3,
+0x88012D10, 0xE0248B16, 0xE40001FC, 0x671C2D40,
+0x624DDE6E, 0x8B013273, 0x0009A311, 0x6CE3644D,
+0x7C046943, 0x39EC6B43, 0x65923BCC, 0x74086DB2,
+0x25D2AFEF, 0x8B198804, 0x01FCE024, 0x2D70E700,
+0x1FD86D1C, 0x627DDE61, 0x8B0132D3, 0x0009A2F7,
+0x6B73677D, 0x3BEC61E3, 0x710464B2, 0x3C1C6C73,
+0x694265C2, 0x29597708, 0x2492AFED, 0x8B188805,
+0x01FCE024, 0x2D40E400, 0xDE54671C, 0x3273624D,
+0xA2DC8B01, 0x644D0009, 0x6BE36D43, 0x65D23DEC,
+0x61437B04, 0x6C1231BC, 0x74086952, 0xAFED29CB,
+0x88312592, 0xDE4A8B20, 0x65E6DB4A, 0x61E6DC4A,
+0x67E2D94A, 0x62E27E04, 0x1FEC7EE8, 0x7E0464E2,
+0x6EE21FED, 0x5BFD2BE0, 0x60B27B04, 0xC9011FBE,
+0x6BB22C00, 0x29B04B09, 0xDC412F26, 0x66134C0B,
+0xE2007F04, 0x2D20A2AB, 0x8B218830, 0xD939DE38,
+0xE06465E6, 0x720462E3, 0x672666E2, 0x6E23DC36,
+0x62227EE8, 0x6BE261E6, 0x29B01FEF, 0x7E040F16,
+0xC90160E2, 0x6EE22C00, 0x4E09DC30, 0x2F262CE0,
+0xD130E068, 0x04FE410B, 0xE2007F04, 0x2D20A287,
+0x8B058833, 0x4E0BDE2C, 0xE1000009, 0x2D10A27F,
+0x89018828, 0x0009A106, 0xE143DE20, 0xE04062E1,
+0x3217622D, 0x0FE68F04, 0x6023E240, 0x262106FE,
+0x8B013217, 0x0009A0EF, 0x02FEE040, 0x8521E401,
+0x8B013046, 0x0009A0E7, 0xE501E040, 0x2D5007FE,
+0x6471B265, 0x09FEE040, 0x6291E143, 0x652DE068,
+0x8D6B3517, 0xE6400F56, 0x8B273563, 0xE048E600,
+0xE11A0F65, 0x72C0A031, 0x00117800, 0x00203254,
+0x0020145E, 0x00202588, 0x002031A2, 0x00203258,
+0x002014AA, 0x002031A1, 0x00202DC8, 0x00117804,
+0x00117810, 0x0020319D, 0x0020319E, 0x0020319F,
+0x00200C2C, 0x00200C80, 0x00200C7C, 0x41216153,
+0x41214121, 0x41214121, 0x45214521, 0x60534521,
+0x6603C903, 0x0F65E048, 0xE0077118, 0xE0442209,
+0x641D0F25, 0x65F3E04C, 0x0F46B28C, 0x04FDE048,
+0x0BFDE044, 0x61BD674D, 0x41084708, 0x0F16E050,
+0xD29B6073, 0x420B09FE, 0x6C07E00F, 0x607329C9,
+0xE0400F96, 0x65F30EFE, 0x6D0D85E2, 0x01FEE050,
+0x60D3420B, 0x6073290B, 0xE04C0F96, 0x04FEB251,
+0x06FEE040, 0x6261E068, 0x0F56652D, 0x3563E640,
+0xE000894E, 0x602381F8, 0x4008C903, 0x6B034000,
+0xE0546103, 0xE0580FB6, 0xECFFDD85, 0x6CCC0FF6,
+0x0FD6E06C, 0x4D0B60C3, 0x42216253, 0x42214221,
+0x64234221, 0x324C4200, 0xE05C6E07, 0x45214200,
+0xE0400FE6, 0x0BFE4521, 0xC9036053, 0x30FC4008,
+0x6D037B06, 0x85F81F05, 0x6C2D1FB7, 0x1FC66E03,
+0x0FC6E060, 0x05FEE058, 0x64C3B22C, 0x33FCE354,
+0x563262D2, 0x22696132, 0x67B42D22, 0x490B5936,
+0x220B607C, 0x05FEE058, 0x64C32D22, 0x7E01B201,
+0xE70662ED, 0x8FE33273, 0xE0407C01, 0x626106FE,
+0x06FEE040, 0x85614200, 0x302C760C, 0x6103701B,
+0x64F3E500, 0x7501E704, 0x6B5D6966, 0x24923B73,
+0x74048FF9, 0xB1E465F3, 0xE040641D, 0xB1A306FE,
+0xA17C6461, 0xD4570009, 0xE201D757, 0x2D20470B,
+0x0009A175, 0x8B078829, 0xEC00DE54, 0x61E22DC0,
+0x641DB175, 0x0009A16B, 0x622CE281, 0x8B013020,
+0x0009A0B6, 0x06FCE028, 0xE682626C, 0x3260666C,
+0x56FB8B20, 0x2610E124, 0x5217D149, 0x52181621,
+0x52191622, 0x521A1623, 0x551B1624, 0x1655E200,
+0x1656551C, 0x1657551D, 0x1658551E, 0x1659551F,
+0x11281127, 0x112A1129, 0x112C112B, 0x112E112D,
+0x112FA13D, 0x666CE683, 0x8B0B3260, 0xD63752FB,
+0x2250E500, 0xD2376562, 0x22527604, 0xD6366262,
+0x2620A12D, 0x666CE690, 0x8B033260, 0x0009B1C7,
+0x0009A011, 0x666CE691, 0x8B103260, 0x6252D52B,
+0x2228622C, 0xD22D8904, 0x0009420B, 0x0009A003,
+0x420BD22B, 0x56FB0009, 0xA110E200, 0xE6B02620,
+0x3260666C, 0xE0248B34, 0xE07002FC, 0x0F16612C,
+0xEB04EC00, 0x01FEE070, 0x321362CD, 0xA0FE8B01,
+0xD21A0009, 0x6DC36CCD, 0x72043D2C, 0x312C61C3,
+0x6D126ED2, 0xD114D41B, 0x0009410B, 0x410BD11A,
+0xD41A64E3, 0x420BD210, 0xD2170009, 0x64D3420B,
+0xD60DD417, 0x0009460B, 0x61E3E600, 0x316C666D,
+0x626D7601, 0x21D032B3, 0x4D198FF7, 0x7C08AFD2,
+0xD211D410, 0xD4116542, 0x0009420B, 0x0009A0CF,
+0x00202C80, 0x00203278, 0x0020145E, 0x00117804,
+0x00202D2C, 0x00203188, 0x0020319C, 0x00200CBA,
+0x00200CE0, 0x00203290, 0x002014A2, 0x002032A4,
+0x002032AC, 0x00117800, 0x002014AA, 0x002032B0,
+0xD5B5D1B4, 0x6252E040, 0x75046612, 0x2162362C,
+0x56116256, 0x1161362C, 0x62526653, 0x76085512,
+0x1152352C, 0x55136262, 0x352C76EC, 0x65631153,
+0x56146262, 0x362C7510, 0x66531164, 0x55156252,
+0x352C7610, 0x62621155, 0x362C5616, 0xD6A31166,
+0x55176262, 0x352C7604, 0x62661157, 0x352C5518,
+0x65631158, 0x56196262, 0x362C7504, 0x62561169,
+0x362C561A, 0x6256116A, 0x362C561B, 0x6653116B,
+0x551C6252, 0x352C7604, 0x6266115C, 0x352C551D,
+0x6263115D, 0x551E6662, 0x356C7204, 0x6622115E,
+0xD58F521F, 0x112F326C, 0x061E6252, 0x362C7594,
+0xE0440166, 0x62526653, 0x7644051E, 0x0156352C,
+0x6262E048, 0x362C061E, 0xD6860166, 0x6262E054,
+0x4229051E, 0x0156352C, 0x62627604, 0x061EE058,
+0x362C4229, 0x56FB0166, 0x2620E238, 0x021EE044,
+0x1621E048, 0x16226212, 0x16235211, 0xE2005512,
+0x55151654, 0x55131655, 0x55161656, 0x051E1657,
+0x1658E040, 0xE050051E, 0x55141659, 0x051E165A,
+0x165BE04C, 0xE054051E, 0x051E165C, 0x165DE058,
+0xE044051E, 0x0126165E, 0x2122E048, 0x11221121,
+0x11231125, 0x01261126, 0x0126E040, 0x1124E050,
+0xE04C0126, 0xE0540126, 0xE0580126, 0x7F740126,
+0x6EF64F26, 0x6CF66DF6, 0x000B6BF6, 0x4F2269F6,
+0xE240614D, 0x89143123, 0x3127E21F, 0x8B09D75A,
+0xD45A614D, 0xE00171E0, 0x5671440B, 0x26596507,
+0x1761A007, 0xE001D455, 0x6672440B, 0x26596507,
+0x4F262762, 0x0009000B, 0x614D4F22, 0x3123E240,
+0xE21F8912, 0xD74C3127, 0x614D8B08, 0x5671D24B,
+0x420B71E0, 0x260BE001, 0x1761A006, 0x6672D247,
+0xE001420B, 0x2762260B, 0x000B4F26, 0xE6400009,
+0x46284618, 0x6252D542, 0x89FC2268, 0x0009000B,
+0x4618E680, 0xD53E4628, 0x22686252, 0x000B89FC,
+0xA0010009, 0x7201E200, 0x8BFC3242, 0x0009000B,
+0x4618E680, 0xD5374628, 0x22686252, 0x000B8BFC,
+0x2FE60009, 0x7FFC4F22, 0xBFF16E53, 0x61E22F42,
+0xE280D631, 0x54E11615, 0x16464218, 0x422855E2,
+0x57E31657, 0x16786EF2, 0x26E22E2B, 0x4F267F04,
+0x6EF6AFCE, 0x2FD62FC6, 0x4F222FE6, 0x6C53DD26,
+0x6E43BFD6, 0x2DE2BFBB, 0x0009BFD2, 0x2C1251D5,
+0x1C4154D6, 0x1C5255D7, 0x1C6356D8, 0x6EF64F26,
+0x000B6DF6, 0x61636CF6, 0xA004E600, 0x62564109,
+0x24227601, 0x36127404, 0x000B8BF9, 0x4F220009,
+0xD117D416, 0x0009410B, 0xD417D216, 0xE5056022,
+0x2202CB20, 0xD5152452, 0x450BE700, 0xD7142472,
+0x0009470B, 0xE601D113, 0x2162D213, 0x4F264618,
+0x2262000B, 0x00202D2C, 0x001C36A0, 0x001C3CA0,
+0x001C36F4, 0x001C3B88, 0x001C3704, 0x00202C80,
+0x001C373C, 0x001C3700, 0x001C370C, 0x002032C4,
+0x0020145E, 0x001C3500, 0x001D4004, 0x002014D4,
+0x00200FA0, 0x001E212C, 0x001C3D30, 0x0009A1A9,
+0x2FE62FD6, 0xDD8F4F22, 0xA0049EA7, 0xD48E0009,
+0x420BD28E, 0x62D265D2, 0x8BF822E8, 0x0009A004,
+0xD28AD48B, 0x55D1420B, 0x22E852D1, 0xA0048BF8,
+0xD4880009, 0x420BD285, 0x52D255D2, 0x8BF822E8,
+0x0009A004, 0xD281D484, 0x55D3420B, 0x22E852D3,
+0xA0048BF8, 0xD4810009, 0x420BD27C, 0x52D455D4,
+0x8BF822E8, 0x6EF64F26, 0x6DF6000B, 0x2FD62FC6,
+0x4F222FE6, 0x6E636D73, 0x6C53B018, 0x64C357F4,
+0xB05465E3, 0xB06A66D3, 0xB09A0009, 0xB09E0009,
+0xB0A20009, 0xB0BE0009, 0xB0C10009, 0xB1240009,
+0x4F260009, 0x6DF66EF6, 0x6CF6A023, 0x3412D16C,
+0xD66C0529, 0x2650D76C, 0x2742000B, 0x0009A014,
+0x2FD62FC6, 0x4F222FE6, 0x6E636D73, 0x6C53BFEE,
+0x64C357F4, 0xB02A65E3, 0xB10666D3, 0x4F260009,
+0x6DF66EF6, 0x6CF6A005, 0xE603D260, 0x000B4618,
+0xD25E2262, 0x000BE600, 0x4F222262, 0xE40ABF7E,
+0x0009BF7E, 0xE104D25A, 0xE5004118, 0x2212E40A,
+0x2252BF74, 0x6072D757, 0x4F26CB20, 0x2702000B,
+0xD1554F22, 0xE400410B, 0x452BD554, 0x2FE64F26,
+0x6E63D153, 0x44186612, 0x45289210, 0x26294408,
+0x44084500, 0x4400265B, 0x4708264B, 0x47082162,
+0x27EBD14C, 0x000B2172, 0x03F06EF6, 0x2FE61FFF,
+0xDE494F22, 0xE40AE101, 0x2E12BF48, 0x726C62E3,
+0xE401E100, 0x22122212, 0x22122212, 0x22122212,
+0xE7302242, 0xE40AE503, 0x22122212, 0x22122212,
+0x22122212, 0x22122212, 0x22122212, 0x22122212,
+0x22522272, 0x22122212, 0x22122212, 0x22122212,
+0x22122212, 0x121ABF22, 0x2E62E600, 0x000B4F26,
+0xD2326EF6, 0xE441E101, 0x000B2212, 0xD1302242,
+0xE605D430, 0x000B2162, 0xD52F2462, 0x6050D22F,
+0x8B0E8801, 0x6040D42E, 0x8B078801, 0x9626D52D,
+0x88016050, 0x96238B0C, 0x0009A00A, 0xA0079621,
+0xE6000009, 0x2262D426, 0x88016040, 0xE6048B00,
+0xAEF3E40A, 0xD2242262, 0xE40AE601, 0x2262AEEE,
+0x2FC62FB6, 0x2FE62FD6, 0xDC204F22, 0x60C2ED00,
+0xCB01EB64, 0x60C22C02, 0xA041C901, 0x03C46E03,
+0x034003D4, 0x001C3B88, 0x002032C8, 0x002014AA,
+0x002032D0, 0x002032D8, 0x002032E0, 0x002032E8,
+0x0025E720, 0x002034B8, 0x0020318C, 0x001C5968,
+0x001D4004, 0x001C3500, 0x0020124A, 0x00201276,
+0x001C5814, 0x001C59D0, 0x001C5830, 0x001C6268,
+0x001C59A4, 0x001C639C, 0x0020319E, 0x001C5804,
+0x0020319D, 0x0020319F, 0x001C581C, 0x001C5860,
+0x89073DB2, 0xE40A60C2, 0xBE9FC901, 0x7D016E03,
+0x8BF52EE8, 0x8B033DB2, 0xD23ED43D, 0x0009420B,
+0x4F26E40A, 0x6DF66EF6, 0xAE8F6CF6, 0x44116BF6,
+0x604B8F01, 0x000B6043, 0x2FB60009, 0x2FD62FC6,
+0x4F222FE6, 0xDC347FFC, 0x60C2ED00, 0xCB02EB64,
+0x60C22C02, 0xC9022F02, 0x6E03A009, 0x89083DB3,
+0xE40A60C2, 0xC9022F02, 0x6E03BE70, 0x2EE87D01,
+0x3DB38BF4, 0xD4298B08, 0x7F04D226, 0x6EF64F26,
+0x6CF66DF6, 0x6BF6422B, 0x4F267F04, 0x6DF66EF6,
+0x000B6CF6, 0xD5226BF6, 0x60525651, 0x000B4628,
+0x2FB6306C, 0x2FD62FC6, 0x4F222FE6, 0x4F024F12,
+0x6E43BFF1, 0xDC1B6B03, 0xBFECDD1B, 0x30B80009,
+0x060A3C05, 0x46094609, 0x3D654601, 0x4209020A,
+0x42094209, 0x8BF032E2, 0x4F164F06, 0x6EF64F26,
+0x6CF66DF6, 0x6BF6000B, 0x4F222FE6, 0xE102DE0F,
+0xE403E500, 0xBFD42E12, 0xE6062E52, 0xE7004618,
+0x2E62E403, 0x4F262E72, 0x6EF6AFCB, 0x0009000B,
+0x002032F0, 0x0020145E, 0x001C5860, 0x00203308,
+0x001C1040, 0xCCCCCCCD, 0x10624DD3, 0x001D4004,
+0x2F962F86, 0x2FB62FA6, 0x2FD62FC6, 0x4F222FE6,
+0xE5007FD8, 0x6453E110, 0x6C534128, 0x655DEE0A,
+0x46086653, 0x4608365C, 0x361C7501, 0x675D6043,
+0x60C30F66, 0x37E3ED00, 0x816126C1, 0x81638162,
+0x16D316D2, 0x8FEA16D4, 0x68F27404, 0xDAB3D9B2,
+0x29821981, 0xD1B259F1, 0x2A921A91, 0x5BF35AF2,
+0x5EF55DF4, 0x11A154F6, 0x11B321A2, 0x11D511B2,
+0x11E711D4, 0x114911E6, 0x55F71148, 0xEE00DBA9,
+0xDDA957F8, 0xD6A952F9, 0x1B5164E3, 0xDBA82B52,
+0xEAB8D8A8, 0x2D72E945, 0x6AAC2622, 0x6EED4908,
+0x4D086DE3, 0x3DEC61E3, 0x4D084108, 0x3DBC31EC,
+0x410860C3, 0x81D12DC1, 0x4108E050, 0x41084008,
+0x60C381D2, 0xE500318C, 0x81D334A2, 0x1D131DD2,
+0x8D01D494, 0xD4911D54, 0xB08165D3, 0x64ED7E01,
+0x8BDC3492, 0xDB94D18D, 0xD28B6812, 0x1B814829,
+0x2FD26412, 0x2B92694D, 0xD98A6722, 0x1B734729,
+0xD7876822, 0x1BA26A8D, 0xD28C6B72, 0x22B2D586,
+0xE0035D72, 0x5E7412D2, 0x12E44018, 0xD6885176,
+0x54781216, 0x1248E1FF, 0xD4856792, 0x6852127A,
+0x28C1E703, 0x81916952, 0x6A52E050, 0x81A24008,
+0x60C36B52, 0x6D5281B3, 0x6E521DD2, 0x62521E63,
+0x1264E600, 0x46086563, 0x7501364C, 0x665D2612,
+0x8BF83673, 0xE003D471, 0x40186542, 0x674225C1,
+0x8171D274, 0xEE006842, 0x69421882, 0x1923E024,
+0xE5806A42, 0x6B421AE4, 0x81B266E3, 0xD46D6C42,
+0x655C81C3, 0x6D63666D, 0x616D7604, 0x31533D4C,
+0x2DE28FF8, 0xD569D268, 0x74042422, 0x7F282452,
+0x6EF64F26, 0x6CF66DF6, 0x6AF66BF6, 0x000B69F6,
+0x664268F6, 0xC8036061, 0xE5008D04, 0xC9036061,
+0x8B038802, 0x65635262, 0x24125124, 0x6053000B,
+0x2FE62FD6, 0x7FEC4F22, 0x62536E53, 0x6D43E550,
+0x4508E400, 0xE101A001, 0x60435224, 0x81212211,
+0x60538123, 0x56E28122, 0x8BF53620, 0x16E4D250,
+0xE61464F3, 0x65E3420B, 0xE4FC65E1, 0x2E512549,
+0x65F361F1, 0x2F112149, 0xD14954D1, 0xE614410B,
+0x607157D1, 0x2701CB01, 0x7F141DE1, 0x6EF64F26,
+0x6DF6000B, 0x2FE62FD6, 0x7FEC4F22, 0x66536E53,
+0x6D43E5FC, 0x20596061, 0x2601CB01, 0x326052E2,
+0x12E48B06, 0x31E051E2, 0x52D18B04, 0x1E22A002,
+0x5664AFF0, 0x64F3D236, 0x420BE614, 0x67E165E3,
+0x2719E1FC, 0x67F12E71, 0x271954D1, 0x65F3D130,
+0x410BE614, 0x52D12F71, 0xCB016021, 0x1DE12201,
+0x4F267F14, 0x000B6EF6, 0x2FE66DF6, 0x624C4F22,
+0x4208DE1B, 0xA0054200, 0x52523E2C, 0x5624D417,
+0x2E62BF8E, 0x52E165E2, 0x8BF63520, 0x2622D61B,
+0x000B4F26, 0x2FB66EF6, 0x2FD62FC6, 0x4F222FE6,
+0xDB1CDC10, 0x66C252C1, 0x89403620, 0xC9036061,
+0x893C8801, 0xDD18DE0B, 0x64E3BF63, 0x85036503,
+0x620D66B2, 0x892B3262, 0xBF9BD403, 0xD4130009,
+0x00094D0B, 0x0009AFE6, 0x00202D88, 0x00202D90,
+0x00202D98, 0x00202DC0, 0x002031A4, 0x002031AC,
+0x001000C8, 0x00101680, 0x001E2108, 0x001C3D00,
+0x00117880, 0x00117780, 0x00040020, 0x0026C401,
+0x00200B26, 0x00203188, 0x0020145E, 0x00203324,
+0x64E3BF3E, 0x4D0BD406, 0xAFBB0009, 0xD2050009,
+0x4F262262, 0x6DF66EF6, 0x000B6CF6, 0x00006BF6,
+0x00203328, 0x001C3D28, 0x2FC62FB6, 0x2FE62FD6,
+0x7FFC4F22, 0x6022D22B, 0x8D41C803, 0xDE2A2F01,
+0xDB2BDC2A, 0xED01A017, 0xC9036051, 0x89168801,
+0xD128D426, 0x0009410B, 0x61035503, 0xC8208551,
+0xE0508903, 0x720102BE, 0xD2230B26, 0x420B64E3,
+0xD6226513, 0x52C126D2, 0x352065C2, 0xDE208BE4,
+0xDB21DD20, 0x52D1DC21, 0x352065D2, 0x60518918,
+0x8801C903, 0xD41B8914, 0x460BD616, 0x57030009,
+0x8F0437E0, 0xE2016503, 0xAFEC2B20, 0xD4182C52,
+0x420BD218, 0xD6110009, 0x4118E101, 0x2612AFE3,
+0xC80460F1, 0xD2148907, 0x4F267F04, 0x6DF66EF6,
+0x422B6CF6, 0x7F046BF6, 0x6EF64F26, 0x6CF66DF6,
+0x6BF6000B, 0x001E2100, 0x00202D98, 0x00202D90,
+0x00202D2C, 0x00201162, 0x002011E4, 0x001C3D30,
+0x00117880, 0x00202D88, 0x002031A8, 0x002031A4,
+0x00202DC0, 0x00201180, 0x00200308, 0xE601D203,
+0x1265D503, 0x000B2252, 0x00001266, 0x001C1010,
+0x0000C34F, 0x0009000B, 0x2FD62FC6, 0x4F222FE6,
+0x6D436C53, 0xEE00A004, 0x7E0164D4, 0x644CBFF2,
+0x8BF93EC2, 0x6EF64F26, 0x000B6DF6, 0xE5006CF6,
+0x6643A002, 0x76017501, 0x22286260, 0xAFE38BFA,
+0x2FE60009, 0x75076253, 0xE1086753, 0x6043EE0A,
+0x4409C90F, 0x650330E2, 0x8D014409, 0xE630E637,
+0x4110365C, 0x8FF22760, 0xE00077FF, 0x000B8028,
+0x000B6EF6, 0x000BE000, 0x2FE6E000, 0x7FEC4F22,
+0x6E436253, 0xBFDC65F3, 0xBFD06423, 0xBFCE64E3,
+0xD40364F3, 0x0009BFCB, 0x4F267F14, 0x6EF6000B,
+0x0020332C, 0xE4FDD29A, 0xD79A6122, 0x22122149,
+0x74016022, 0x2202CB01, 0xD5976622, 0x22622649,
+0xC8406070, 0x60528902, 0x2502CB04, 0xE1F76452,
+0x25422419, 0xE7016052, 0x2502C9CF, 0xE6026052,
+0x2502CB03, 0x15624718, 0x1573000B, 0xD78CD58B,
+0xD48DD28C, 0xE600E100, 0x27112511, 0xAFD12210,
+0x664C2461, 0x4600D289, 0x6060362C, 0x000BCB10,
+0x654C2600, 0x4500D285, 0x6650352C, 0x2619E1EF,
+0x2560000B, 0xD282664C, 0x362C4600, 0xCB106060,
+0x2600000B, 0xD27E654C, 0x352C4500, 0xE1EF6650,
+0x000B2619, 0x664C2560, 0x4600D278, 0x6060362C,
+0x000BCB08, 0x654C2600, 0x4500D274, 0x6650352C,
+0x2619E1F7, 0x2560000B, 0xD271664C, 0x362C4600,
+0xCB086060, 0x2600000B, 0xD26D654C, 0x352C4500,
+0xE1F76650, 0x000B2619, 0x624C2560, 0x4200D667,
+0x6020326C, 0x4021C908, 0x40214021, 0x600C000B,
+0xD663624C, 0x326C4200, 0xC9086020, 0x40214021,
+0x000B4021, 0xD15F600C, 0x341C644C, 0x000B6240,
+0xD15D602C, 0x341C644C, 0x000B6240, 0x2FE6602C,
+0x6E434F22, 0xE60A645C, 0x89143467, 0x0009BFEB,
+0x60EC640C, 0x8B028801, 0xA002E00F, 0x44092409,
+0x624C4409, 0x3263E60A, 0xBFE28905, 0x620C644C,
+0xC8806023, 0xE2008B00, 0x4F266023, 0x6EF6000B,
+0xD64A4F22, 0x88016062, 0xB2458B03, 0xA0030009,
+0xD2470009, 0x2260E640, 0xE200D646, 0x000B4F26,
+0x4F222622, 0x6062D641, 0x8B018802, 0x0009B28E,
+0xE200D640, 0x000B4F26, 0xD53C2622, 0xE100D43C,
+0x2512E701, 0x2470000B, 0xE604D239, 0x2260000B,
+0xD4394F22, 0x410BD139, 0xD5390009, 0x6650E1FD,
+0x2619D238, 0x2560E700, 0x000B4F26, 0x4F222270,
+0xD132D435, 0x0009410B, 0xE7FBD531, 0x26796650,
+0x000B4F26, 0x4F222560, 0xD12CD430, 0x0009410B,
+0xE7F7D52B, 0x26796650, 0x000B4F26, 0xD5282560,
+0x6250942D, 0x000B2249, 0xD5252520, 0x6250E4BF,
+0x000B2249, 0x4F222520, 0x8522D225, 0x2008600D,
+0x88018911, 0x88038913, 0x88058915, 0x88068942,
+0x88088948, 0x8809894E, 0x880A8954, 0x880B895A,
+0xA0678960, 0xB0690009, 0xA0640009, 0xB077600C,
+0xA0600009, 0xB080600C, 0xA05C0009, 0xFF7F600C,
+0x001E2148, 0x001E1000, 0x001E1108, 0x002031FC,
+0x002031FE, 0x0020321D, 0x002031E0, 0x001E103F,
+0x001E105F, 0x001E102F, 0x001E1090, 0x00203204,
+0x001E100B, 0x00203200, 0x00203330, 0x0020145E,
+0x001E1028, 0x0020321C, 0x0020333C, 0x0020334C,
+0x002031D4, 0x6260D684, 0x8B2B2228, 0x0009B061,
+0x600CA029, 0x6260D680, 0x8B232228, 0x0009B069,
+0x600CA021, 0x6260D67C, 0x8B1B2228, 0x0009B0C7,
+0x600CA019, 0x6260D678, 0x8B132228, 0x0009B0CD,
+0x600CA011, 0x6260D674, 0x8B0B2228, 0x0009B125,
+0x600CA009, 0x6260D670, 0x8B032228, 0x0009B13D,
+0x600CA001, 0x4F26E000, 0x0009000B, 0xD26CD16B,
+0xD56C8412, 0x4000C90F, 0xD76B012D, 0xE403D66B,
+0xE20F611C, 0x2540E001, 0x25202712, 0x2602000B,
+0xE601D262, 0x30668523, 0xE0008D05, 0xD663D260,
+0xE0018122, 0x000B2602, 0xD25C0009, 0x600D8523,
+0x89052008, 0x8B0A8801, 0x6060D65D, 0x2600CB01,
+0xD457D65A, 0xE001E101, 0x000B2612, 0x000B8142,
+0xD152E000, 0x8513E501, 0x640D4518, 0x66033453,
+0xE0008D05, 0xD551D253, 0x2260E001, 0x000B2502,
+0x4F220009, 0x8513D149, 0x6453650D, 0x62494419,
+0x227D672E, 0x8801602C, 0x88028909, 0x88038910,
+0x8806891A, 0x88078935, 0xA04C893B, 0xD5460009,
+0x6652D746, 0x2762D446, 0x622C6261, 0x2421A038,
+0x2228625C, 0xD4438B3F, 0x6642D540, 0x2562D440,
+0x24018561, 0x6203A02C, 0x2008605C, 0x88108907,
+0x88208908, 0x88308909, 0xA02C890A, 0xD23A0009,
+0x6222A008, 0xA005D239, 0xD2396222, 0x6222A002,
+0x6262D638, 0xD432D531, 0x66212522, 0xA00F626C,
+0xD6352421, 0x6261D52D, 0x622CD42D, 0xA0072562,
+0xD6322421, 0x8561D529, 0x2562D429, 0x62032401,
+0x662D8515, 0x3617610D, 0x65038F01, 0xB0CB2451,
+0xA0010009, 0xE000E001, 0x000B4F26, 0xD6190009,
+0xD427E101, 0x65412610, 0xD118D717, 0xE20F655D,
+0x2752E001, 0x000B2620, 0x2FE62102, 0xD20F4F22,
+0x640C8523, 0x8B082448, 0xD511D61D, 0x2621E200,
+0x940F8451, 0xA0482049, 0xDE0D8051, 0xC84060E0,
+0xE2018D32, 0x89443427, 0xD216D615, 0x2641420B,
+0x0009A030, 0x0000FF7F, 0x0020321D, 0x002031D4,
+0x002031E0, 0x001E1100, 0x001E100C, 0x00203200,
+0x001E1000, 0x001E1001, 0x00203208, 0x002031E8,
+0x002031EC, 0x002031F0, 0x0020320C, 0x00203210,
+0x00203214, 0x00203218, 0x0020351C, 0x00203526,
+0x002031FA, 0x00202362, 0x89123427, 0xD294D693,
+0x2641420B, 0xCB8084E1, 0x80E1B0F5, 0xD69160E0,
+0x2E00CB04, 0xC93F6060, 0xD68F2600, 0xA001E001,
+0xE0002602, 0x000B4F26, 0xD68C6EF6, 0xC8806060,
+0xD2868919, 0x88016021, 0xD2898B15, 0x8524E501,
+0x89103056, 0xE203D187, 0x2120D487, 0xE00B6541,
+0x0656655D, 0xE40FD585, 0x2140E702, 0xD77E2571,
+0x000BE001, 0x000B2702, 0x2FE6E000, 0xDE804F22,
+0xC88084E1, 0xD57A892C, 0x20088554, 0x61038F28,
+0x8553D77C, 0x64036672, 0x8566650C, 0x3520620C,
+0xD6798B1E, 0x651CD774, 0x2651644C, 0x60E02741,
+0x8904C840, 0x420BD275, 0xA0030009, 0xD2680009,
+0x0009420B, 0x0009B09F, 0xE201D167, 0x60E02122,
+0xCB04D464, 0x60402E00, 0x2400C93F, 0x6023A001,
+0x4F26E000, 0x6EF6000B, 0x2FB62FA6, 0x2FD62FC6,
+0xDA622FE6, 0x66A1E240, 0x3622DC5E, 0x62638900,
+0x6ED36D2C, 0x4E2136D8, 0x4E212A61, 0xDB61D460,
+0xE700A00F, 0x770162B2, 0x71026123, 0x66212B12,
+0x71026213, 0x61212B12, 0x651D666D, 0x356C4528,
+0x627C2452, 0x8BED32E3, 0xC90360D3, 0x8B108803,
+0x617367B2, 0x2B127102, 0x71026E13, 0x2B126571,
+0x655D6DE1, 0x422862DD, 0x325CE107, 0xA00C2C10,
+0x88022422, 0xA0038B01, 0x8801E203, 0xE2018B05,
+0x66B22C20, 0x655D6561, 0xE60F2452, 0x67A12C60,
+0x8B052778, 0xDD38DC44, 0xEB01EA00, 0x2DB22CA2,
+0x6DF66EF6, 0x6BF66CF6, 0x6AF6000B, 0x2FE62FD6,
+0xE240DD36, 0x362266D1, 0x62638900, 0x3678672C,
+0x7703DE38, 0x47212D61, 0x64E2D635, 0xA00E4721,
+0x6562E100, 0x62537101, 0x74012450, 0x24204219,
+0x45297401, 0x74012450, 0x24504519, 0x621C7401,
+0x8BEE3273, 0x66E24200, 0x420061D1, 0x2118362C,
+0x2E628F06, 0xDD1CD728, 0xE501E400, 0x2D522742,
+0x000B6EF6, 0x2FD66DF6, 0x4F222FE6, 0xED0AEE01,
+0x64E3BC97, 0xBC9C64E3, 0x62EC7E01, 0x8BF732D7,
+0xBC9FEE01, 0x64E364E3, 0x7E01BCA4, 0x32D762EC,
+0x4F268BF7, 0x000B6EF6, 0xD1186DF6, 0xD418920D,
+0x72122122, 0x2422D617, 0xD7177204, 0x72202622,
+0x2722D116, 0x000B7230, 0x137A2122, 0x002031FA,
+0x0020246E, 0x001E1015, 0x00203200, 0x001E1001,
+0x002031D4, 0x001E1100, 0x002031FE, 0x002031EC,
+0x001E1000, 0x002031F0, 0x002031FC, 0x00202362,
+0x001E100C, 0x002031E8, 0x00203204, 0x00203208,
+0x0020320C, 0x00203210, 0x00203214, 0x00203218,
+0x4F222FE6, 0xD6507FFC, 0x88016060, 0xE2018951,
+0x2620BFBB, 0xD54ED14D, 0xDE4E6010, 0x64E36552,
+0x7402C840, 0x8D22D14C, 0xD24C7502, 0xE601D74C,
+0xE7042722, 0x76016255, 0x626C2421, 0x8FF93273,
+0xD4437402, 0x6242E601, 0x640D8528, 0x67494419,
+0x275D657E, 0x81E4607C, 0xE417D542, 0x67557601,
+0x3243626C, 0x8FF92171, 0xA0207102, 0xD23E0009,
+0xE601D73B, 0xE7042722, 0x76016255, 0x626C2421,
+0x8FF93273, 0xD4327402, 0x6242E601, 0x640D8528,
+0x67494419, 0x275D657E, 0x81E4607C, 0xE417D533,
+0x67557601, 0x3243626C, 0x8FF92171, 0x924A7102,
+0xD2262E21, 0x5E23D72E, 0x64F22FE2, 0x604365F2,
+0x2700C980, 0xC9606043, 0x80716103, 0xC9036043,
+0x80724519, 0x65F2605C, 0x817266F2, 0x46194629,
+0x606C4529, 0x4018645C, 0x8173304C, 0x21185E23,
+0x64F22FE2, 0x6E4C62F2, 0x602C4219, 0x66F262F2,
+0x46294018, 0x461930EC, 0x42298174, 0x652C606C,
+0x305C4018, 0x81758F07, 0x0009BC9D, 0x2228620C,
+0xA00A8908, 0x60130009, 0x8B038840, 0x0009B009,
+0x0009A003, 0xE202D60F, 0x7F042622, 0x000B4F26,
+0x000B6EF6, 0x060A0009, 0x0020321C, 0x001E1000,
+0x00203208, 0x0020351C, 0x00203528, 0x002034C0,
+0x002031F0, 0x002034F0, 0x002034EE, 0x002034C2,
+0x002031D4, 0x00203200, 0x4F222FE6, 0xDE937FFC,
+0x200884E9, 0x2F008D06, 0xD692D491, 0x0009460B,
+0x64F0B194, 0x6620D290, 0x89022668, 0xC9BF60E0,
+0x7F042E00, 0x000B4F26, 0x000B6EF6, 0x2FE60009,
+0xDE8A4F22, 0x60E0D68A, 0xCBC0D48A, 0x62602E00,
+0xC803602C, 0x40218904, 0x70014021, 0x6603A002,
+0x66034009, 0xD684616D, 0xE500A004, 0x75016262,
+0x74042422, 0x3213625D, 0xD2808BF8, 0x0009420B,
+0xC9BF84E2, 0x4F2680E2, 0x6EF6000B, 0x2FE62FD6,
+0x7FFC4F22, 0x6260D67A, 0x89442228, 0xD56FE100,
+0x60502610, 0xCB40D477, 0x2500440B, 0x8D052008,
+0x62E06E03, 0x7104612C, 0x2F11A006, 0xD472D66A,
+0xDD726760, 0x657C4D0B, 0xE23C6D1D, 0x8B033D27,
+0xD264D46F, 0x0009420B, 0x4D214D21, 0xA005D76D,
+0x66E6E400, 0x357C4508, 0x74012562, 0x35D3654D,
+0xD7698BF7, 0x6172E003, 0x81114018, 0x6E7260F1,
+0x81E2700C, 0xD4656172, 0xDD658113, 0x4D0BDE65,
+0xE2016572, 0xD4642E22, 0x420BD252, 0xD6530009,
+0xC93F6060, 0x7F042600, 0x6EF64F26, 0x6DF6000B,
+0x2FC62FB6, 0x2FE62FD6, 0xD25C4F22, 0x6B436E73,
+0x420B6C53, 0x20086D63, 0x61038F08, 0xD245D458,
+0x6EF64F26, 0x6CF66DF6, 0x6BF6422B, 0x21B060C3,
+0x60D38011, 0xE5008111, 0x64BCA007, 0x6053655D,
+0x665300EC, 0x7501361C, 0x625D8064, 0x8BF53243,
+0x6060D636, 0x2600C9BF, 0x6EF64F26, 0x6CF66DF6,
+0x6BF6000B, 0x7FC44F22, 0x720262F3, 0x22512F41,
+0x45297202, 0x60632251, 0xE5C4E682, 0x67F38121,
+0x655C666C, 0xE408BFBC, 0x4F267F3C, 0x0009000B,
+0x2F962F86, 0x2FB62FA6, 0x2FD62FC6, 0x4F222FE6,
+0xE1007FC4, 0x6513ECFF, 0x6B136CCD, 0xDE36D735,
+0xEDFF64F3, 0xD835EA04, 0x6053655C, 0x027D4000,
+0x32C0622D, 0x66038D0D, 0x09ED6063, 0x2491027D,
+0x24217402, 0x698202ED, 0x3928622D, 0x74022892,
+0x75017104, 0x6063625C, 0x07D532A2, 0x0EB58FE4,
+0x2448641C, 0xE6808905, 0x67F3E5C5, 0xBF7F666C,
+0x7F3C655C, 0x6EF64F26, 0x6CF66DF6, 0x6AF66BF6,
+0x000B69F6, 0xD11E68F6, 0x6012D21E, 0xCB20E405,
+0x2102E500, 0x000B2242, 0x00002252, 0x001E1017,
+0x00203358, 0x0020145E, 0x002031A2, 0x001E1015,
+0x001E10BF, 0x00117800, 0x001E10FC, 0x00200308,
+0x002031A8, 0x002025C6, 0x0020335C, 0x002014AA,
+0x00203378, 0x0011788C, 0x002031A4, 0x00202D88,
+0x002011E4, 0x001E2130, 0x00203380, 0x00202588,
+0x00203384, 0x002031BC, 0x002031C4, 0x002034BC,
+0x001C3500, 0x001D4004, 0xD565D164, 0xE400D765,
+0x2142E20F, 0x17411154, 0xD5632722, 0x9669D763,
+0x15412572, 0x96661562, 0xE6011565, 0xD5601165,
+0x666CE6F8, 0x25422542, 0x25422542, 0x25422542,
+0x25622542, 0x7601E727, 0x67632572, 0x25627797,
+0xE7042572, 0x2572E248, 0xE2192522, 0xE2702522,
+0x25422542, 0x25422542, 0x25222542, 0x2522E20C,
+0x25422542, 0x25422542, 0x25422542, 0x25422542,
+0x000B154A, 0xE2081145, 0x0009422B, 0x2FE62FD6,
+0x7FFC4F22, 0xC8206043, 0x6E438D02, 0x0009BE6D,
+0xC81060E3, 0xBE6A8901, 0x60E30009, 0x8901C840,
+0x0009BE8C, 0xC80160E3, 0xDD3E8938, 0xC80260D0,
+0x2F008D03, 0x460BD63C, 0x60F00009, 0x8902C804,
+0x460BD63A, 0x62F00009, 0xC8806023, 0x60D08902,
+0x2D00C97F, 0xC8016023, 0xD6358906, 0x0009460B,
+0x0009A007, 0x51630601, 0x8902C808, 0x460BD631,
+0x60F00009, 0x8902C810, 0x420BD22F, 0xD52F0009,
+0x88026052, 0xD22E8B03, 0xA005E604, 0x88012260,
+0xD22B8B02, 0x2260E601, 0x2522E200, 0xC88060E3,
+0xD628892E, 0x60E36E60, 0x8902C880, 0x420BD226,
+0x60E30009, 0x8902C840, 0x420BD224, 0x60E30009,
+0x8902C802, 0x420BD222, 0x60E30009, 0x890EC804,
+0x410BD120, 0xBF0E0009, 0xBF4D0009, 0xD51E0009,
+0x6050D41E, 0xC908D71E, 0xBF842500, 0x60E32472,
+0x8905C808, 0x7F04D21B, 0x6EF64F26, 0x6DF6422B,
+0x4F267F04, 0x000B6EF6, 0x00006DF6, 0x001C581C,
+0xA000A000, 0x001D0100, 0x001D4000, 0x00040021,
+0x001C589C, 0x001E1021, 0x00201640, 0x00201662,
+0x00201CA0, 0x0020167A, 0x00201688, 0x00203200,
+0x001E100B, 0x001E1028, 0x002016DE, 0x002016EA,
+0x00201690, 0x002016AE, 0x001E1000, 0x0010F100,
+0x12345678, 0x002016C6, 0x644CD6A7, 0x000B346C,
+0xD6A62450, 0x346C644C, 0x2450000B, 0x644CD6A4,
+0x000B346C, 0x625C2450, 0x4208616D, 0x42084119,
+0x42006019, 0x670E614C, 0xD49E321C, 0x4200207D,
+0x324CC90F, 0x2200000B, 0x4208625C, 0x42004208,
+0x324C644C, 0x4200D498, 0x000B324C, 0x2FE62260,
+0x614C4F12, 0x4100D493, 0x6710314C, 0xE29F666D,
+0x27294619, 0x6E536269, 0x672E6573, 0x4221227D,
+0x42214221, 0x7601662C, 0xE4014608, 0x34E84608,
+0x644C4600, 0x071A0467, 0x2150257B, 0x000B4F16,
+0x4F226EF6, 0xD2857FE8, 0x88016021, 0xD2848B7B,
+0x26686621, 0xD2838B77, 0x26686621, 0xE50F8B73,
+0xE401BFA2, 0xBFA4E501, 0xE586E400, 0xE400655C,
+0x2F50BFA4, 0xBFA1E401, 0xE602E506, 0x60634618,
+0x81F2E401, 0x6543BF9F, 0xE40185F2, 0xBFAB6543,
+0x85F26603, 0x6543E401, 0x6603BFB1, 0xE40265F0,
+0x6053756C, 0x80F8BF80, 0xBF82E402, 0x84F8E512,
+0x7090E402, 0x6503BF82, 0x4618E602, 0x81F66063,
+0xBF80E402, 0x85F6E500, 0x6603E402, 0xE500BF8C,
+0xE40285F6, 0xBF926603, 0xE5FEE500, 0xE010655C,
+0xBF61E403, 0xE5130F54, 0xE40EBF63, 0x05FCE010,
+0xBF63E40E, 0xE5007585, 0xBF64E403, 0xE500E640,
+0xBF71E403, 0xE500E640, 0xBF78E403, 0xE5FFE640,
+0xE014655C, 0xBF47E404, 0xE40F0F54, 0xE504BF49,
+0x05FCE014, 0xBF49E40F, 0xE5017584, 0xBF4AE640,
+0xE501E404, 0xBF57E640, 0xE501E404, 0xE404E640,
+0xAF5C7F18, 0x7F184F26, 0x000B4F26, 0x4F220009,
+0xD2427FF0, 0x88016021, 0xD2418B71, 0x26686621,
+0xD2408B6D, 0x26686621, 0xE50F8B69, 0xE401BF1C,
+0xBF1EE501, 0xE586E400, 0xE400655C, 0x2F50BF1E,
+0xBF1BE401, 0xE401E506, 0xBF1C6543, 0xE401E640,
+0xBF296543, 0xE401E640, 0xBF306543, 0x65F0E640,
+0x756CE402, 0xBEFF6053, 0xE40280F4, 0xE512BF01,
+0xE40284F4, 0xBF017090, 0xE6406503, 0xBF02E402,
+0xE640E500, 0xBF0FE402, 0xE640E500, 0xBF16E402,
+0xE5FEE500, 0x6053655C, 0xBEE5E403, 0xE51380F8,
+0xE40EBEE7, 0xE40E84F8, 0xBEE77085, 0xE5006503,
+0xBEE8E640, 0xE500E403, 0xBEF5E640, 0xE500E403,
+0xBEFCE640, 0xE5FFE403, 0x6053655C, 0xBECBE404,
+0xE40F80FC, 0xE504BECD, 0xE40F84FC, 0xBECD7083,
+0xE5016503, 0xBECEE640, 0xE501E404, 0xBEDBE640,
+0xE501E404, 0xE404E640, 0xAEE07F10, 0x7F104F26,
+0x000B4F26, 0x00000009, 0x001E102F, 0x001E1080,
+0x001E1090, 0x001E103F, 0x001E103E, 0x002031FA,
+0x002031FC, 0x002031FE, 0xD21DD11C, 0x66206010,
+0x676C7001, 0x3700C90F, 0xE5008D13, 0x67106210,
+0x7701622C, 0x64232170, 0xD6166010, 0x44084408,
+0x3428C90F, 0x62602100, 0x7201D513, 0x44082620,
+0x000B354C, 0xD10F6053, 0x25586510, 0xE6008D13,
+0xD60DD40B, 0x655C6540, 0x47086753, 0x37584708,
+0x47086540, 0x24507501, 0x367C6040, 0x2400C90F,
+0x72FF6210, 0x000B2120, 0x00006063, 0x002031A1,
+0x002031A0, 0x002031A2, 0x00202DC8, 0x7FFC4F22,
+0xE680D19D, 0x666C6212, 0xD29C2F22, 0x67F36563,
+0x420B7542, 0x7F04E404, 0x000B4F26, 0xE6800009,
+0xD296666C, 0xE7006563, 0x422B7540, 0xE6806473,
+0xD292666C, 0xE7006563, 0x422B7543, 0x2F866473,
+0x2FA62F96, 0x2FC62FB6, 0x2FE62FD6, 0x7FF44F22,
+0xDD8CD28B, 0x72011F21, 0xDB8B1F22, 0x6AF2E840,
+0x5211D18A, 0x36206612, 0xA0A78B01, 0x60610009,
+0x8801C903, 0xA0A18B01, 0xD9840009, 0x420BD284,
+0x55036493, 0x845C6A03, 0x30E0EE84, 0xD1818B79,
+0x606C6610, 0x8B3D8801, 0x6210D17F, 0x892F2228,
+0xD57EE701, 0x64522B72, 0x1442E003, 0xD57C6252,
+0xE6004018, 0x21608121, 0xD17A6453, 0x6E527404,
+0x60126742, 0xCB20DC78, 0x76012102, 0x3283626D,
+0x25E28BFB, 0x2472DE71, 0x62E267C2, 0x1274D173,
+0x604164E2, 0x2401CB01, 0xEE0066E2, 0xDC702C62,
+0xEC012C62, 0x2DC2410B, 0x4C18EC01, 0x2BE22DC2,
+0xD764DE6C, 0xD16C60E2, 0xCB01E202, 0x27202E02,
+0x2122A02F, 0x8B2C2008, 0xE701DE68, 0xD466EC00,
+0x2170D264, 0xEE012EC2, 0x612224E2, 0x2169E6FE,
+0xE01E2212, 0x54F10C5C, 0x24C0E01F, 0x56F2025C,
+0x26207510, 0xD75EE600, 0xEE06D45E, 0x76018456,
+0x6C542700, 0x31E3616C, 0x740124C0, 0x77018FF6,
+0xE494D259, 0x72012240, 0x2250E500, 0xE605720F,
+0xD2562260, 0x65A36493, 0xEE01420B, 0xAF6F4E18,
+0x2FA22DE2, 0xD45265F2, 0x66428553, 0x3262620D,
+0xD4508907, 0x410BD150, 0xD7500009, 0xAF57E601,
+0xD43A2762, 0xDD37D149, 0x65F2410B, 0xD44CEE01,
+0x4E18D64C, 0x2DE2460B, 0x0009AF4A, 0x7F0C2FA2,
+0x6EF64F26, 0x6CF66DF6, 0x6AF66BF6, 0x000B69F6,
+0x4F2268F6, 0x85467FF4, 0x2F01E681, 0x666C8547,
+0x854881F1, 0x81F2D225, 0x67F38542, 0x854381F3,
+0x81F4E40C, 0x65636053, 0x420B81F5, 0x7F0C7540,
+0x000B4F26, 0x2F860009, 0x2FA62F96, 0x2FC62FB6,
+0x2FE62FD6, 0x7FEC4F22, 0xE800D11A, 0xD4322F12,
+0x1F416183, 0x6A13DB20, 0x4A08D630, 0xDE20E001,
+0x4A00460B, 0x1F023AEC, 0x52B166B2, 0x8B013620,
+0x0009A19B, 0xC9036061, 0x8B018801, 0x0009A195,
+0xDE275263, 0x8B4F32E0, 0x420BD20D, 0xDE2564B3,
+0xD70DD50E, 0xED01DC0B, 0x2E02E100, 0x27D02502,
+0xAFE12C10, 0x00002E16, 0x001C3D9C, 0x00201F40,
+0x0011779A, 0x001C3D30, 0x001D0104, 0x00202DC0,
+0x00201162, 0x002031B1, 0x002031B0, 0x002031AC,
+0x001C3B9C, 0x001C3500, 0x00202D98, 0x00201276,
+0x001C3D00, 0x001C36F8, 0x00117708, 0x002031B4,
+0x0011778C, 0x00117792, 0x00117788, 0x00201180,
+0x00203188, 0x00202D88, 0x002011E4, 0x001E2130,
+0x0020349C, 0x0020145E, 0x002034A8, 0x00202C80,
+0x00117780, 0x0011770C, 0xC8018561, 0x5C63897A,
+0x660385C2, 0x6403C903, 0x650D85C3, 0x40216053,
+0xC93F4021, 0x6E034500, 0x252D322A, 0xE2106053,
+0x3E23C901, 0x6D038D23, 0x4408D79D, 0x44086570,
+0x440062E3, 0x25584200, 0x342C8F0F, 0x6043D299,
+0x697D072D, 0x60994919, 0x201D610E, 0x60D381F6,
+0x8F0C8801, 0xA00A697C, 0xD29369E3, 0x052D6043,
+0x4219625D, 0x670E6029, 0x81F6207D, 0xD18F695C,
+0x22286210, 0xE9FF8901, 0xEEFF699C, 0x6EEC659D,
+0x8B0F35E0, 0x4C0BDC8A, 0x540364B3, 0xBF20E502,
+0xD4886E03, 0x410BD188, 0xD78865E3, 0xD488ED01,
+0x27D2A01E, 0x26E9EEFC, 0x81C26063, 0x97C585C3,
+0x62032079, 0x450885F6, 0x6063260B, 0x81C2252B,
+0x81C36053, 0xE10885C4, 0x201B4118, 0x62B281C4,
+0x20E98521, 0x64B28121, 0xCB016041, 0xD4792401,
+0x450BD579, 0x60B20009, 0x57F266F2, 0x2A02CB01,
+0x2672AF22, 0xD26E8561, 0x8F02C802, 0xA09F64B3,
+0x420B0009, 0xDC710009, 0x5E036503, 0x07CEE04C,
+0x7701DD6F, 0x6CD20C76, 0x7C01D664, 0x6D602DC2,
+0x89062DD8, 0xD264D463, 0xED01420B, 0xA07ED763,
+0x625127D2, 0x4118E10F, 0x2219E402, 0x32404418,
+0x85518B11, 0x20D9EDFC, 0x60518151, 0xCB017DE3,
+0x85E12501, 0x20D9D65F, 0x460B81E1, 0x6CF264B3,
+0xA06457F2, 0x6D512C72, 0x4D196DDD, 0x66DE6DD9,
+0x7D012D6D, 0x610360DC, 0x88014118, 0x25118F45,
+0x6462D653, 0x26427401, 0x660D85E3, 0x40216063,
+0xC93F4021, 0x6D034600, 0x262D322A, 0xC8016063,
+0xDC4ED14D, 0x964A8901, 0xE6002D6B, 0x0F64E010,
+0xE01064DD, 0x607C07FC, 0x021D4000, 0x3240622D,
+0x66038D12, 0x021D6063, 0x3270E7FF, 0xA00B8B01,
+0xE01001D5, 0xE60402FC, 0x0F247201, 0x3262622C,
+0x06FC8BE7, 0x4600666C, 0x01CD6063, 0x0C157101,
+0x6711D13B, 0x3C406C7D, 0x62118907, 0x88FF602D,
+0x21D18903, 0xE201DD37, 0x85512D20, 0x20D9EDFC,
+0x60518151, 0xCB01D22F, 0x420B64B3, 0xE0102501,
+0xD43102FC, 0xE001612C, 0x67F2440B, 0x85EF2702,
+0x54F1D22E, 0x650D420B, 0x0009AE7E, 0x80007E03,
+0x0009420B, 0x6E035403, 0xED088544, 0x20D94D18,
+0x8B0330D0, 0xE501BE3D, 0x0009A007, 0xDD248541,
+0x22D8620D, 0xBE348901, 0xD412E500, 0x420BD212,
+0xD71265E3, 0xAE5FED01, 0x780127D2, 0xEE04618D,
+0x8D0231E7, 0xAE4E7B08, 0x7F140009, 0x6EF64F26,
+0x6CF66DF6, 0x6AF66BF6, 0x000B69F6, 0x000068F6,
+0x002034B8, 0x0020339C, 0x0020341C, 0x0020319C,
+0x00201162, 0x00202D90, 0x00201180, 0x001E212C,
+0x002034A0, 0x002034A4, 0x0020145E, 0x00202D2C,
+0x002034BC, 0x002011E4, 0x002031BC, 0x002031C4,
+0x002031B8, 0x002031BA, 0x00202C80, 0x002014AA,
+0x00008000, 0x4F222FE6, 0x6E22D212, 0xC84060E3,
+0x22E28D02, 0x0009BCFA, 0x4218E240, 0x89012E28,
+0x0009BD05, 0xC81060E3, 0xD40B8905, 0x420BD20B,
+0xBD040009, 0x60E30009, 0x8901C805, 0x0009BDEB,
+0xC80260E3, 0x4F268902, 0x6EF6AD01, 0x000B4F26,
+0x00006EF6, 0x001C3510, 0x002034B0, 0x0020145E,
+0x080A0C0E, 0x00020406, 0x1A1C1E20, 0x12141618,
+0x2E303234, 0x26282A2C, 0x3A3C3E40, 0x6C625648,
+0x41112F26, 0xE2208F18, 0x890B3123, 0x321CD204,
+0xD1026220, 0x412B312C, 0x00090009, 0x00202CAA,
+0x00202C60, 0x000BE000, 0x400062F6, 0x40004000,
+0x40004000, 0x40004000, 0x62F6000B, 0x40004000,
+0x40004000, 0x40004000, 0x40184000, 0x62F6000B,
+0x40004000, 0x40004000, 0x40004000, 0x40284000,
+0x62F6000B, 0x40004000, 0x40184000, 0x000B4028,
+0xC90F62F6, 0x40054005, 0x40054005, 0x62F6000B,
+0x4005C907, 0x40054005, 0x62F6000B, 0x4005C903,
+0x000B4005, 0xC90162F6, 0x000B4005, 0x000062F6,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x544F0D0A,
+0x46205355, 0x00003A57, 0x206C754A, 0x32203532,
+0x20373030, 0x313A3132, 0x37323A32, 0x00000000,
+0x00000D0A, 0x00000043, 0x42707372, 0x3D206675,
+0x554E203D, 0x202C4C4C, 0x6E49677A, 0x4E497274,
+0x6D754E51, 0x0000003D, 0x61766E49, 0x2064696C,
+0x72657375, 0x20726F20, 0x2079656B, 0x00214449,
+0x52504545, 0x57204D4F, 0x65746972, 0x6461202C,
+0x003D7264, 0x6C617620, 0x0000003D, 0x00000A0D,
+0x6E6B6E55, 0x206E776F, 0x6D6D6F63, 0x3D646E61,
+0x00000000, 0x000A0D52, 0x203A3051, 0x00000020,
+0x203A3151, 0x00000020, 0x203A3251, 0x00000020,
+0x203A3351, 0x00000020, 0x203A3451, 0x00000020,
+0x61437748, 0x7262696C, 0x6F697461, 0x6620206E,
+0x0A6C6961, 0x0000000D, 0x73696F4E, 0x61432065,
+0x7262696C, 0x6F697461, 0x6166206E, 0x21216C69,
+0x00000D0A, 0x00000072, 0x00205220, 0x00000D0A,
+0x62735576, 0x7473725F, 0x00000A0D, 0x62735576,
+0x7375735F, 0x646E6570, 0x00000A0D, 0x62735576,
+0x7365725F, 0x000A0D6D, 0x00000042, 0x72746E49,
+0x6D652051, 0x2C797470, 0x49677A20, 0x4972746E,
+0x754E514E, 0x00003D6D, 0x654C7245, 0x0000006E,
+0x00000049, 0x20746F4E, 0x756F6E65, 0x49206867,
+0x4220514E, 0x0A0D6675, 0x00000000, 0x000000FF,
+0x00020001, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x010E010D,
+0x00020003, 0x01090108, 0x0002010A, 0x02000003,
+0x02020201, 0x02040203, 0x02060205, 0x02020200,
+0x02040203, 0x020C0207, 0x020E020D, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x010E010D,
+0x00FF010F, 0x01090108, 0x010B010A, 0x020000FF,
+0x02020201, 0x02040203, 0x02060205, 0x02020200,
+0x02040203, 0x020C020B, 0x020E020D, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00205220,
+0x00000046, 0x00000059, 0x73204142, 0x003D7165,
+0x49544120, 0x0000204D, 0x00000000, 0x00000000,
+0x002E0209, 0x80000101, 0x000409FA, 0x00FF0400,
+0x05070000, 0x02000201, 0x82050700, 0x00020002,
+0x03830507, 0x07010040, 0x40020405, 0x02090000,
+0x0101002E, 0x09FA8000, 0x04000004, 0x000000FF,
+0x02010507, 0x07000040, 0x40028205, 0x05070000,
+0x00400383, 0x04050701, 0x00004002, 0x00000000,
+0x00000000, 0x07090000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, };
+
+const u32_t zcFwImageSize=13656;
diff --git a/drivers/staging/otus/hal/hpfwu_FB50_mdk.c b/drivers/staging/otus/hal/hpfwu_FB50_mdk.c
new file mode 100644
index 00000000000..ed1736f945a
--- /dev/null
+++ b/drivers/staging/otus/hal/hpfwu_FB50_mdk.c
@@ -0,0 +1,721 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include "cprecomp.h"
+
+const u32_t zcFwImage[] = {
+0x0009000B, 0x4F222FE6, 0xD2287FFC, 0x0009420B,
+0x0009B019, 0x9446D526, 0xE600A003, 0x8D043642,
+0x60527601, 0x8DF9C840, 0xD4222F02, 0x4E0BDE22,
+0xD4220009, 0x00094E0B, 0x4E0BD421, 0x7F040009,
+0xA0254F26, 0x4F226EF6, 0x410BD11E, 0xD41E0009,
+0x0009440B, 0x450BD51D, 0xD71D0009, 0x611DE1FF,
+0x2712D21C, 0xD41C5029, 0xE1FFCB01, 0x1209E501,
+0x12112212, 0xD5192452, 0xD6199716, 0xE7002572,
+0x2670D218, 0x2272D618, 0x4F26E201, 0x2622000B,
+0xDD17DC16, 0x4C0BDE17, 0x4D0B0009, 0x4E0B0009,
+0xAFF80009, 0x27100009, 0x00000640, 0x0020095A,
+0x001C001C, 0x00202940, 0x00200E2A, 0x0020294C,
+0x00202964, 0x00200CF0, 0x00200F26, 0x002009C4,
+0x001C3510, 0x001C3624, 0x001E212C, 0x002028EC,
+0x00202850, 0x002028F4, 0x00202900, 0x00200BEC,
+0x00201FD4, 0x002017B8, 0x2FD62FC6, 0x4F222FE6,
+0xDEA17FA4, 0x61E0E01C, 0x7D016DE3, 0x61D00F14,
+0xD59FD49E, 0x450BE020, 0xE0200F14, 0xE78004FC,
+0x604C66E2, 0x7D7F677C, 0x1F693070, 0x2D628F17,
+0x01FCE01C, 0x641CE500, 0xD797DE96, 0x3243625D,
+0xA21A8B01, 0x655D0009, 0x31EC6153, 0xE0286C10,
+0x6D530FC4, 0x3D7C62CE, 0xAFEF2D20, 0x20087501,
+0xE01C8B15, 0xE50001FC, 0xD78BDE8A, 0x641CA00A,
+0x6C53655D, 0x66C23CEC, 0x66626253, 0x2262327C,
+0x1F697504, 0x3243625D, 0xA1F68BF2, 0x88012D10,
+0xE01C8B16, 0xE40001FC, 0x671C2D40, 0x624DDE7D,
+0x8B013273, 0x0009A1E9, 0x62E3644D, 0x72046D43,
+0x3DEC6143, 0x65D2312C, 0x74086C12, 0x25C2AFEF,
+0x8B188804, 0x01FCE01C, 0x2D40E400, 0xDE71671C,
+0x3273624D, 0xA1D08B01, 0x644D0009, 0x62E36D43,
+0x65D23DEC, 0x61437204, 0x6612312C, 0x74086C52,
+0xAFED2C69, 0x880525C2, 0xE01C8B18, 0xE40001FC,
+0x671C2D40, 0x624DDE63, 0x8B013273, 0x0009A1B5,
+0x6C43644D, 0x3CEC62E3, 0x720465C2, 0x3D2C6D43,
+0x615266D2, 0x216B7408, 0x2512AFED, 0x8B138830,
+0xE200DE58, 0x64E22D20, 0x8B042448, 0x420BD257,
+0xA19A0009, 0x55E10009, 0x57E356E2, 0xDD545CE4,
+0x2FC64D0B, 0x7F04A191, 0x89018828, 0x0009A0EA,
+0xE143DE4C, 0x622D62E1, 0x8F033217, 0x56FB1FEB,
+0x2621E240, 0x8B013217, 0x0009A0D5, 0xE1015EFB,
+0x301685E1, 0xA0CE8B01, 0xE4010009, 0x2D4055FB,
+0x6451B179, 0xE14357FB, 0xE0546271, 0x3517652D,
+0x0F568D41, 0x3563E640, 0xE6008B05, 0x0F65E034,
+0xA00FE11A, 0x615372C0, 0x41214121, 0x41214121,
+0x45214121, 0x45214521, 0xC9036053, 0xE0346603,
+0x71180F65, 0x2209E007, 0x641DE030, 0x0F2565F3,
+0x1F4EB1F1, 0x04FDE034, 0x674DE030, 0x47080CFD,
+0x607361CD, 0x4108D22B, 0xE00F0CFE, 0x1F1F420B,
+0x2CD96D07, 0x5EFB6073, 0x85E20FC6, 0x420B51FF,
+0x2C0B600D, 0x54FE6073, 0xB1BB0FC6, 0xE05465F3,
+0x652D62E1, 0xE6400F56, 0x89623563, 0xE050E100,
+0x60230F15, 0x4008C903, 0x6D034000, 0xE0406103,
+0xE0440FD6, 0xD217EEFF, 0x6EEC0FF6, 0x0F26E058,
+0x60E3420B, 0x42216253, 0x42214221, 0x66234221,
+0x326C4200, 0x45214200, 0xE0486707, 0x0F764521,
+0xC9036053, 0x40085CFB, 0x7C0630FC, 0x6E036D2D,
+0x1FD51FC6, 0x1F04A02E, 0x00117D00, 0x00202968,
+0x00200E2A, 0x00117D04, 0x00117D84, 0x00200700,
+0x0020074C, 0x00202034, 0x0FD6E04C, 0x05FEE044,
+0x64D3B189, 0x64E2E048, 0xE04006FE, 0x2E422469,
+0x01FE67C4, 0x667CE058, 0x420B02FE, 0x240B6063,
+0x05FEE044, 0xB15D2E42, 0xE05064D3, 0x7D0101FD,
+0x0F157101, 0x02FDE050, 0x3262E606, 0x56FB8BDC,
+0x55FB6261, 0x85514200, 0x302C750C, 0x6103701B,
+0x64F3E600, 0xE704A004, 0x76016256, 0x74042422,
+0x3273626D, 0x65F38BF8, 0x641DB13C, 0xB0D256FB,
+0xA0AA6461, 0xD4880009, 0xE201D588, 0x2D20450B,
+0x0009A0A3, 0x8B078829, 0xE200DE85, 0x66E22D20,
+0x646DB0A1, 0x0009A099, 0x622CE281, 0x8B3D3020,
+0xD680E738, 0xE0442D70, 0xE0480C6E, 0x6E621DC1,
+0x51611DE2, 0x54621D13, 0x55651D44, 0x57631D55,
+0x5C661D76, 0x0E6E1DC7, 0x1DE8E040, 0xE050016E,
+0x54641D19, 0x056E1D4A, 0x1D5BE04C, 0xE054076E,
+0x0C6E1D7C, 0x1DCDE058, 0xE044026E, 0xED001D2E,
+0xE04806D6, 0x16D126D2, 0x16D516D2, 0x16D616D3,
+0xE04006D6, 0xE05006D6, 0x06D616D4, 0x06D6E04C,
+0x06D6E054, 0x06D6E058, 0x1F29A057, 0x622CE282,
+0x89313020, 0x05FCE020, 0x625CE683, 0x3260666C,
+0xD65D8B07, 0x2650E500, 0x52617680, 0xA044D65B,
+0xE6902622, 0x3260666C, 0xD2578B16, 0xE500D658,
+0x60622250, 0xCB20D257, 0xE6052602, 0xD6562262,
+0x2252460B, 0x420BD255, 0xD2550009, 0x2262E601,
+0x4618D254, 0x2262A029, 0xD254D453, 0xD4546542,
+0x0009420B, 0x0009A021, 0xE524D647, 0xD5452650,
+0x16215257, 0x16225258, 0x16235259, 0x1624525A,
+0x1625525B, 0x1626525C, 0x1627525D, 0x1628525E,
+0x1F29525F, 0xE2001629, 0x15281527, 0x152A1529,
+0x152C152B, 0x152E152D, 0x7F5C152F, 0x6EF64F26,
+0x000B6DF6, 0x4F226CF6, 0xE240614D, 0x89173123,
+0x3127E21F, 0xD43B8908, 0xE001D53B, 0x6642450B,
+0x26796707, 0x2462A00C, 0x3127E23F, 0xD7358908,
+0x71E0D635, 0x460BE001, 0x62075571, 0x17512529,
+0x000B4F26, 0x4F220009, 0xE240614D, 0x89153123,
+0x3127E21F, 0xD42B8907, 0x6642D22B, 0xE001420B,
+0xA00B260B, 0xE23F2462, 0x89073127, 0xD626D725,
+0x71E05571, 0xE001460B, 0x1751250B, 0x000B4F26,
+0xE6400009, 0x46284618, 0x6252D520, 0x89FC2268,
+0x0009000B, 0x4618E680, 0xD51C4628, 0x22686252,
+0x000B89FC, 0xA0010009, 0x7201E200, 0x8BFC3242,
+0x0009000B, 0x4618E680, 0xD5154628, 0x22686252,
+0x000B8BFC, 0x00000009, 0x0020296C, 0x00200E2A,
+0x00117D04, 0x00202858, 0x00117D80, 0x002028EC,
+0x001C3500, 0x001D4004, 0x00200F26, 0x002009C4,
+0x001E212C, 0x001C3D28, 0x00117D00, 0x00200E8A,
+0x00202984, 0x001C3704, 0x00202034, 0x001C373C,
+0x001C3700, 0x4F222FE6, 0x6E537FFC, 0x2F42BFCA,
+0xD61561E2, 0x1615E280, 0x421854E1, 0x55E21646,
+0x16574228, 0x6EF257E3, 0x2E2B1678, 0x7F0426E2,
+0xAFA74F26, 0x2FC66EF6, 0x2FE62FD6, 0xDD0A4F22,
+0xBFAF6C53, 0xBF946E43, 0xBFAB2DE2, 0x51D50009,
+0x54D62C12, 0x55D71C41, 0x56D81C52, 0x4F261C63,
+0x6DF66EF6, 0x6CF6000B, 0x001C370C, 0x0009A0F8,
+0xD19B4F22, 0xD49B9299, 0x2122B00D, 0x9795E605,
+0xB0229595, 0xB0366463, 0xB03A0009, 0xB03D0009,
+0xA06C0009, 0x4F124F26, 0xD1934F02, 0x94873145,
+0x4609060A, 0x46094609, 0x00293646, 0xD78CD58F,
+0x2500CA01, 0x4F062762, 0x4F16000B, 0xBFEA4F22,
+0xB0230009, 0xA0520009, 0x2FE64F26, 0x6E63D188,
+0x44186612, 0x4528926D, 0x26294408, 0x44084500,
+0x4400265B, 0x4708264B, 0x47082162, 0x27EBD181,
+0x000B2172, 0xD1806EF6, 0xE603D480, 0x000B2162,
+0xD27F2462, 0xE40A9656, 0x2262AFB0, 0x2FC62FB6,
+0x2FE62FD6, 0xDC7B4F22, 0x2C22E201, 0xBFA5E40A,
+0x60C27C44, 0xCB01ED00, 0x60C22C02, 0xC901EB64,
+0x6E03A008, 0x89073DB2, 0xE40160C2, 0xBF95C901,
+0x7D016E03, 0x8BF52EE8, 0x8B033DB2, 0xD26FD46E,
+0x0009420B, 0x4F26E40A, 0x6DF66EF6, 0xAF856CF6,
+0x44116BF6, 0x604B8F01, 0x000B6043, 0x2F860009,
+0x2FA62F96, 0x2FC62FB6, 0x2FE62FD6, 0x7FFC4F22,
+0x6DA3EA00, 0xDC626BA3, 0x9914E864, 0x8B4E2BB8,
+0x3AE3EE0A, 0x60C2894B, 0xCB02ED00, 0x62C22C02,
+0x2F0260C2, 0xA010C902, 0x096C6E03, 0x5BB45288,
+0x1FFF09B4, 0x01FF03C4, 0x89083D83, 0xE46460C2,
+0xC9022F02, 0x6E03BF52, 0x2EE87D01, 0xD1518BF4,
+0x54C1D551, 0x66526412, 0x6269EE01, 0x4220622F,
+0x622F4219, 0x4E182299, 0x8D0322E8, 0xE4FF6423,
+0x3428229A, 0x6572D749, 0x622F6259, 0x42194220,
+0x2299622F, 0x8D0322E8, 0xE6FF6623, 0x3628229A,
+0x3468BFA7, 0x30E2EE02, 0xAFB78901, 0xD240EB01,
+0x6EECEEE6, 0xBF21E40A, 0xAFAF22E2, 0xEE0A7A01,
+0x89013AE3, 0x8B033D83, 0xD234D43A, 0x0009420B,
+0x4F267F04, 0x6DF66EF6, 0x6BF66CF6, 0x69F66AF6,
+0x68F6000B, 0x5651D534, 0x46286052, 0x306C000B,
+0x2FC62FB6, 0x2FE62FD6, 0x4F124F22, 0xBFF14F02,
+0x6B036E43, 0xDD1CDC2D, 0x0009BFEC, 0x3C0530B8,
+0x4609060A, 0x46014609, 0x020A3D65, 0x42094209,
+0x32E24209, 0x4F068BF0, 0x4F264F16, 0x6DF66EF6,
+0x000B6CF6, 0x2FE66BF6, 0xDE214F22, 0xE500E102,
+0x2E12E403, 0x2E52BFD4, 0x4618E606, 0xE403E700,
+0x2E722E62, 0xAFCB4F26, 0x4F226EF6, 0x0009BFEB,
+0xE6E6D213, 0xE40A666C, 0x2262BFC2, 0x4F26AFE3,
+0x002028F0, 0x0024CDE0, 0x10624DD3, 0x00202AF0,
+0x001C5814, 0x001C59D0, 0x001C59A4, 0x001C639C,
+0x001C5804, 0x001C581C, 0x00202998, 0x00200E2A,
+0x001C5860, 0x001C6864, 0x001C59BC, 0x001C69BC,
+0x001C947C, 0x002029B0, 0x001C1040, 0xCCCCCCCD,
+0x001D4004, 0x2F962F86, 0x2FB62FA6, 0x2FD62FC6,
+0x4F222FE6, 0xE4007FE4, 0x4528E510, 0x67436C43,
+0xE107A00F, 0x6043644D, 0x0F564008, 0xEE0060C3,
+0x815125C1, 0x81538152, 0x157315E2, 0x751415E4,
+0x624D7401, 0x8BED3213, 0xDA6F51F1, 0x1A1154F2,
+0xD16E2A12, 0x57F455F3, 0x6DF258F5, 0x1141D96C,
+0x11532142, 0x11751152, 0x11871174, 0x52F61186,
+0x19D1D668, 0xD86829D2, 0xDA68E950, 0x1621EBB4,
+0x6BBC2622, 0xA0214908, 0x6EEDEE00, 0x61E36DE3,
+0x41084D08, 0x31EC3DEC, 0x41084D08, 0x60C33D8C,
+0xE7904108, 0x81D12DC1, 0x41086093, 0x81D2677C,
+0x31AC60C3, 0x3472E200, 0x1DD281D3, 0xD4551D13,
+0x1D248D01, 0xB03AD450, 0x7E0165D3, 0x34B264ED,
+0xD14D8BDB, 0x6512DB52, 0x4529D24D, 0x64121B51,
+0x674DD14A, 0x67222B72, 0x4729D64E, 0x69221B73,
+0x689D2FD2, 0x69121B82, 0x5A122692, 0x5B1416A2,
+0x16B4DA44, 0x16C65C16, 0x16EA6EA2, 0x4F267F1C,
+0x6DF66EF6, 0x6BF66CF6, 0x69F66AF6, 0x68F6000B,
+0x60616642, 0x8D04C803, 0x6061E500, 0x8802C903,
+0x52628B03, 0x51246563, 0x000B2412, 0x2FD66053,
+0x4F222FE6, 0x6E537FEC, 0xE5506253, 0xE4006D43,
+0xA0014508, 0x5224E101, 0x22116043, 0x81238121,
+0x81226053, 0x362056E2, 0xD22F8BF5, 0x64F316E4,
+0x420BE614, 0x65E165E3, 0x2549E4FC, 0x61F12E51,
+0x214965F3, 0x54D12F11, 0x410BD127, 0x57D1E614,
+0xCB016071, 0x1DE12701, 0x4F267F14, 0x000B6EF6,
+0x2FD66DF6, 0x4F222FE6, 0x6E537FEC, 0xE5FC6653,
+0x60616D43, 0xCB012059, 0x52E22601, 0x8B063260,
+0x51E212E4, 0x8B0431E0, 0xA00252D1, 0xAFF01E22,
+0xD2155664, 0xE61464F3, 0x65E3420B, 0xE1FC67E1,
+0x2E712719, 0x54D167F1, 0xD10F2719, 0xE61465F3,
+0x2F71410B, 0x602152D1, 0x2201CB01, 0x7F141DE1,
+0x6EF64F26, 0x6DF6000B, 0x002028BC, 0x002028C4,
+0x002028B4, 0x002028E4, 0x0010008C, 0x00100EC0,
+0x001E2108, 0x001C3D00, 0x00202194, 0x2FC62FB6,
+0x2FE62FD6, 0xD6314F22, 0x60D36D62, 0x894DC803,
+0xDB30DC2F, 0x0009A02C, 0xC9036061, 0x892B8801,
+0xD22DD42B, 0x0009420B, 0x65035603, 0xC8208561,
+0xE0508903, 0x720102BE, 0x85620B26, 0x4000600D,
+0x4000366A, 0x40004624, 0x206D4624, 0xD423C903,
+0x40086E03, 0xD1224000, 0x340C410B, 0x61E3D521,
+0xD721E001, 0x450BD221, 0x64E37E30, 0x2702420B,
+0x66C252C1, 0x8BCF3620, 0x4E18EE01, 0xA011DB1C,
+0x6061EC75, 0x8801C903, 0xD4198910, 0x460BD612,
+0xD4180009, 0x470BD718, 0xD2136503, 0x64C3D113,
+0x22E2410B, 0x66B252B1, 0x8BEA3620, 0xC80460D3,
+0xD2128906, 0x6EF64F26, 0x6CF66DF6, 0x6BF6422B,
+0x6EF64F26, 0x6CF66DF6, 0x6BF6000B, 0x001E2100,
+0x002028BC, 0x00202858, 0x00200AE0, 0x002028C4,
+0x00200B62, 0x00202034, 0x001C3D30, 0x00200DF0,
+0x002028B4, 0x002028E4, 0x00200AFE, 0x002000F8,
+0xE601D237, 0x1265D537, 0x000B2252, 0xD6361266,
+0x88016062, 0xE1018B62, 0xD5342612, 0x5451D134,
+0xE0406212, 0x2122324C, 0x54115752, 0x1141347C,
+0x57125453, 0x1172374C, 0x52135755, 0x1123327C,
+0x56146452, 0x1164364C, 0x54155754, 0x1145347C,
+0x56165458, 0x1166364C, 0x6762D626, 0x327C5217,
+0x57611127, 0x327C5218, 0x57621128, 0x327C5219,
+0x57631129, 0x347C541A, 0x5764114A, 0x347C541B,
+0x5765114B, 0x347C541C, 0x5266114C, 0x372C571D,
+0x5267117D, 0x342C541E, 0x5268114E, 0x362C561F,
+0xD615116F, 0x041E6262, 0x342C7694, 0xE0440146,
+0x061E6262, 0x0166362C, 0x525CE048, 0xD60F051E,
+0x0156352C, 0xE0546262, 0x4229051E, 0x0156352C,
+0xE0585561, 0x4529061E, 0x0166365C, 0x0009000B,
+0x001C1010, 0x0000C34F, 0x001C1028, 0x001C369C,
+0x00202858, 0x001C3CA0, 0x001C36F4, 0x001C3B88,
+0xD62F7FFC, 0x2642644C, 0xC8205066, 0x2F028DFC,
+0x7F04000B, 0x2FD62FC6, 0x4F222FE6, 0x6D436C53,
+0xEE00A004, 0x7E0164D4, 0x644CBFEA, 0x8BF93EC2,
+0x6EF64F26, 0x000B6DF6, 0xA0016CF6, 0x76016643,
+0x22286260, 0x36488BFB, 0x6563AFE4, 0x2FB62F96,
+0x2FD62FC6, 0x4F222FE6, 0xEC1CED08, 0xDB196E53,
+0x61C3E90A, 0x60434B0B, 0x3092C90F, 0x66038D02,
+0x7630A001, 0x4D107637, 0x7E012E60, 0x7CFC8FF1,
+0x8058E000, 0x6EF64F26, 0x6CF66DF6, 0x000B6BF6,
+0x000B69F6, 0x000BE000, 0x2FE6E000, 0x7FEC4F22,
+0x6E436253, 0xBFD165F3, 0xBFC66423, 0xBFC464E3,
+0xD40564F3, 0x0009BFC1, 0x4F267F14, 0x6EF6000B,
+0x001C0004, 0x002020F4, 0x002029CC, 0xE110D59C,
+0xE6406050, 0x2500C9FD, 0xE0FF75E9, 0x80516453,
+0x80538052, 0x80568055, 0x251075EF, 0xE1EF6250,
+0x2219E001, 0xE7202520, 0x24608052, 0x2570000B,
+0xE4FDD590, 0xE7026152, 0x25122149, 0x74016052,
+0x2502CB01, 0xD18C6652, 0x25622649, 0x92C26012,
+0x2102CB08, 0xC9CF6012, 0x60122102, 0x2102CB03,
+0x000B1172, 0x4F221123, 0xE100D484, 0xD285D784,
+0xD5852410, 0x2711D485, 0x2211E700, 0xBFBD2511,
+0xD5832471, 0x2560E600, 0x4F26AFD2, 0xD281664C,
+0x362C4600, 0xCB106060, 0x2600000B, 0xD27D654C,
+0x352C4500, 0xE1EF6650, 0x000B2619, 0x664C2560,
+0x4600D279, 0x6060362C, 0x000BCB10, 0x654C2600,
+0x4500D275, 0x6650352C, 0x2619E1EF, 0x2560000B,
+0xD270664C, 0x362C4600, 0xCB086060, 0x2600000B,
+0xD26C654C, 0x352C4500, 0xE1F76650, 0x000B2619,
+0x664C2560, 0x4600D268, 0x6060362C, 0x000BCB08,
+0x654C2600, 0x4500D264, 0x6650352C, 0x2619E1F7,
+0x2560000B, 0xD65F624C, 0x326C4200, 0xC9086020,
+0x40214021, 0x000B4021, 0x624C600C, 0x4200D65A,
+0x6020326C, 0x4021C908, 0x40214021, 0x600C000B,
+0xD156644C, 0x341C74FF, 0x000B6240, 0xD154602C,
+0x341C644C, 0x000B6240, 0x2FE6602C, 0x655C4F22,
+0x3567E60A, 0x6E438D15, 0x6453BFEA, 0x60EC640C,
+0x8B028801, 0xA002E00F, 0x44092409, 0x624C4409,
+0x3263E60A, 0xBFE28905, 0x620C644C, 0xC8806023,
+0xE2008B00, 0x4F266023, 0x6EF6000B, 0xD6414F22,
+0x88016062, 0xB2228B03, 0xA0030009, 0xD23E0009,
+0x2260E640, 0xE200D63D, 0x000B4F26, 0x4F222622,
+0x6062D638, 0x8B018802, 0x0009B26C, 0xE200D637,
+0x000B4F26, 0x0FFF2622, 0xD433D532, 0xE701E100,
+0x000B2512, 0xD2302470, 0x000BE604, 0xD5202260,
+0x6150E4FD, 0x2149D62E, 0x2510E700, 0x2670000B,
+0xE4FBD51B, 0x22496250, 0x2520000B, 0xE4F7D518,
+0x22496250, 0x2520000B, 0xD2264F22, 0x600D8522,
+0x89112008, 0x89138801, 0x89158803, 0x89178805,
+0x89418806, 0x89478808, 0x894D8809, 0x8953880A,
+0x8959880B, 0x0009A060, 0x0009B062, 0x600CA05D,
+0x0009B070, 0x600CA059, 0x0009B07A, 0x600CA055,
+0x6260D606, 0x8B4F2228, 0x0009B086, 0x600CA04D,
+0x001E1028, 0x001E2148, 0x001E1108, 0x0020293D,
+0x0020292C, 0x0020292E, 0x00202930, 0x00202910,
+0x001E1008, 0x001E103F, 0x001E105F, 0x001E1030,
+0x001E1090, 0x00202938, 0x001E100B, 0x00202934,
+0x0020293C, 0x00202904, 0x6260D687, 0x8B232228,
+0x0009B06A, 0x600CA021, 0x6260D683, 0x8B1B2228,
+0x0009B0B4, 0x600CA019, 0x6260D67F, 0x8B132228,
+0x0009B0BA, 0x600CA011, 0x6260D67B, 0x8B0B2228,
+0x0009B11E, 0x600CA009, 0x6260D677, 0x8B032228,
+0x0009B136, 0x600CA001, 0x4F26E000, 0x0009000B,
+0xD273D172, 0xD5738412, 0x4000C90F, 0xD772012D,
+0x611CE403, 0xD671E20F, 0x27122540, 0xE0012520,
+0x2602000B, 0xE601D269, 0x30668523, 0xE0008D06,
+0xE000D267, 0x8122D669, 0x2602E001, 0x0009000B,
+0x8523D262, 0x2008600D, 0x88018905, 0xD6648B0A,
+0xCB016060, 0xD6612600, 0xE101D45D, 0x2612E001,
+0x8142000B, 0xE000000B, 0xE501D158, 0x45188513,
+0x3453640D, 0x8D056603, 0xD25AE000, 0xE001D557,
+0x25022260, 0x0009000B, 0xD1504F22, 0x650D8513,
+0x44196453, 0x672E6249, 0x602C227D, 0x89098801,
+0x890C8802, 0x89108803, 0x89268806, 0x89298807,
+0x0009A038, 0xD64DD54C, 0xA027E212, 0x625C2652,
+0x8B2F2228, 0xA01ED64A, 0x605C6262, 0x89052008,
+0x89088810, 0x890B8820, 0x0009A024, 0xD643D445,
+0xA013E204, 0xD7442642, 0xE20CD640, 0x2672A00E,
+0xD63ED542, 0xA009E218, 0xD4412652, 0xE20AD63B,
+0x2642A004, 0xD639D23F, 0xE22E2622, 0xD43E8515,
+0x3277670D, 0x8F012421, 0x24516503, 0x0009B0DF,
+0xE001A001, 0x4F26E000, 0x0009000B, 0xE101D629,
+0x2610D436, 0xD7286541, 0x655DD128, 0xE001E20F,
+0x26202752, 0x2102000B, 0x4F222FE6, 0x8523D21F,
+0x2448640C, 0xD62D8B08, 0xE200D521, 0x84512621,
+0x20499430, 0x8051A026, 0x60E0DE1D, 0x8D0BC840,
+0x3427E201, 0xD1258922, 0x420BD225, 0xD5252141,
+0xCB046052, 0x2502A00B, 0x89173427, 0xD722D21F,
+0x2241470B, 0xE5FBD61F, 0x21596162, 0x84E12612,
+0xB12DCB80, 0x60E080E1, 0xCB04D61C, 0x60602E00,
+0x2600C93F, 0xE001D609, 0x2602A001, 0x4F26E000,
+0x6EF6000B, 0x0000FF7F, 0x0020293D, 0x00202904,
+0x00202910, 0x001E1100, 0x001E100C, 0x00202934,
+0x001E1000, 0x001E1001, 0x00202AF4, 0x00202918,
+0x00202920, 0x00202B62, 0x00202B66, 0x00202B72,
+0x00202B8A, 0x00202B94, 0x0020291C, 0x0020292A,
+0x00201AB6, 0x001E1108, 0x00201BC2, 0x001E1015,
+0x6060D696, 0x8919C880, 0x6021D295, 0x8B158801,
+0xE501D294, 0x30568524, 0xD1938910, 0xD493E203,
+0x65412120, 0x655DE00B, 0xD5910656, 0xE702E40F,
+0x25712140, 0xE001D78F, 0x2702000B, 0xE000000B,
+0x4F222FE6, 0x84E1DE8C, 0x8934C880, 0x8554D585,
+0x8F302008, 0xD7896103, 0x66728553, 0x650C6403,
+0x620C8566, 0x8B263520, 0xD780D685, 0x644C651C,
+0x27412651, 0xC84060E0, 0xD2828907, 0x0009420B,
+0x6062D681, 0xA008CB04, 0xD1802602, 0x0009410B,
+0xE5FBD67D, 0x24596462, 0xB0A12642, 0xD5750009,
+0x2522E201, 0xD77A60E0, 0x2E00CB04, 0xC93F6070,
+0xA0012700, 0xE0006023, 0x000B4F26, 0x2FA66EF6,
+0x2FC62FB6, 0x2FE62FD6, 0xE240DA69, 0xDC6666A1,
+0x3123616D, 0x62638900, 0x6ED36D2C, 0x4E2136D8,
+0x4E212A61, 0xDB6CD46B, 0xE700A00F, 0x770166B2,
+0x71026163, 0x65612B12, 0x71026613, 0x62612B12,
+0x622D655D, 0x325C4228, 0x627C2422, 0x8BED32E3,
+0xC90360D3, 0x8B108803, 0xED076EB2, 0x710261E3,
+0x67132B12, 0x62E17102, 0x65712B12, 0x655D622D,
+0x352C4528, 0xA00C2CD0, 0x88022452, 0xA0038B01,
+0x8801E203, 0xE2018B05, 0x66B22C20, 0x677D6761,
+0xEB0F2472, 0x6DA12CB0, 0x8B052DD8, 0xD445D24F,
+0xE101EE00, 0x241222E2, 0x6DF66EF6, 0x6BF66CF6,
+0x6AF6000B, 0x2FE62FD6, 0xE240DD3D, 0x616D66D1,
+0x89003123, 0x672C6263, 0xDE433678, 0x2D617703,
+0xD6404721, 0x472164E2, 0xE100A00E, 0x71016562,
+0x24506253, 0x42197401, 0x74012420, 0x24504529,
+0x45197401, 0x74012450, 0x3273621C, 0x42008BEE,
+0x64D166E2, 0x362C4200, 0x8F062448, 0xDD332E62,
+0xE500DE28, 0x2D52E701, 0x6EF62E72, 0x6DF6000B,
+0x2FE62FD6, 0xEE014F22, 0xED0AA005, 0x64E3BCB6,
+0x64E3BCBC, 0x62EC7E01, 0x8BF732D7, 0xEE01A005,
+0x64E3BCBD, 0x64E3BCC3, 0x62EC7E01, 0x8BF732D7,
+0x6EF64F26, 0x6DF6000B, 0x2FE62FD6, 0x7FFC4F22,
+0x6060D61F, 0x89758801, 0xE101D41E, 0xD7128548,
+0x650D2610, 0x45196070, 0x6659DD1B, 0x61D3626E,
+0xC840262D, 0x74027102, 0x8D47D718, 0xD218666C,
+0xE501DE0A, 0xA0312E22, 0x0000EE04, 0x001E1001,
+0x0020292A, 0x00202904, 0x001E1100, 0x0020292E,
+0x0020291C, 0x00202934, 0x001E1000, 0x00202920,
+0x0020292C, 0x00201AB6, 0x001E1108, 0x00201BC2,
+0x001E1015, 0x001E100C, 0x00202918, 0x00202938,
+0x0020293C, 0x00202AF4, 0x00202B8A, 0x00202B96,
+0x00202B06, 0x75016245, 0x71022121, 0x32E3625C,
+0x60638BF8, 0xE60181D4, 0xE417D538, 0x3243626C,
+0x6255891E, 0x27217601, 0x7702AFF8, 0xDE35D234,
+0x2E22E501, 0xEE04A004, 0x75016245, 0x71022121,
+0x32E3625C, 0x60638BF8, 0xE60181D4, 0xA004D52E,
+0x6255E417, 0x27217601, 0x626C7702, 0x8BF83243,
+0x2D21924B, 0xD72AD429, 0x2F126142, 0x6DF265F2,
+0xC9806053, 0x60532700, 0x6103C960, 0x60538071,
+0x65F26EF2, 0x4D19C903, 0x80724529, 0x451960DC,
+0x4E298172, 0x62EC605C, 0x302C4018, 0x6D428173,
+0x2FD22118, 0x62F26EF2, 0x421966F2, 0x656C4629,
+0x602C66F2, 0x401864EC, 0x304C4629, 0x81744619,
+0x4018606C, 0x8F07305C, 0xBCB58175, 0x620C0009,
+0x89082228, 0x0009A00A, 0x88406013, 0xB00A8B03,
+0xA0030009, 0xD60B0009, 0x2622E202, 0x4F267F04,
+0x000B6EF6, 0x000B6DF6, 0x060A0009, 0x00202B36,
+0x00202B34, 0x00202920, 0x00202B08, 0x001E100C,
+0x00202904, 0x00202934, 0x7FFC4F22, 0x6620D27E,
+0x8D082668, 0xD47D2F60, 0x420BD27D, 0x64F00009,
+0xA0907F04, 0x7F044F26, 0x000B4F26, 0x000B0009,
+0x2FE60009, 0xDE774F22, 0x60E0D677, 0xCBC0D477,
+0x62602E00, 0xC803602C, 0x40218904, 0x70014021,
+0x6603A002, 0x66034009, 0xD671616D, 0xE500A004,
+0x75016262, 0x74042422, 0x3213625D, 0xD16D8BF8,
+0x0009410B, 0xE401D66C, 0x84E22641, 0x80E2C9BF,
+0x000B4F26, 0x2FE66EF6, 0xD5687FFC, 0x6250DE61,
+0x642C84E2, 0xCB407404, 0x80E2614D, 0x44216413,
+0xD7634421, 0xE600A004, 0x76016256, 0x27222F22,
+0x3243626D, 0x60138BF8, 0x2008C903, 0x88038912,
+0x88028905, 0x88018906, 0xA0088907, 0xE0070009,
+0x8078A005, 0xA002E003, 0xE0018078, 0x62528078,
+0x27222F22, 0xD650E00F, 0x60618078, 0x8B018801,
+0x2621E200, 0x6060D64F, 0x2600CB08, 0xC93F60E0,
+0x7F042E00, 0x6EF6000B, 0x6021D247, 0x8D188801,
+0xD2466143, 0x22106053, 0x60638021, 0xD4468121,
+0xE500A007, 0x027C605D, 0x364C6603, 0x26207001,
+0x625D6503, 0x3213611C, 0xD6408BF4, 0xC9BF6060,
+0x000B2600, 0x2FD60009, 0x4F222FE6, 0x60437FFC,
+0x8D02C820, 0xBF6A6E43, 0x60E30009, 0x8901C810,
+0x0009BF67, 0xC84060E3, 0xBF8C8901, 0x60E30009,
+0x8929C801, 0x60D0DD32, 0x8D03C802, 0xD6312F00,
+0x0009460B, 0xC80460F0, 0xD62F8902, 0x0009460B,
+0x602362F0, 0x8902C880, 0xC97F60D0, 0x60232D00,
+0x8902C801, 0x420BD229, 0xD5290009, 0x88026052,
+0xD2288B03, 0xA005E604, 0x88012260, 0xD2258B02,
+0x2260E601, 0x2522E200, 0xC88060E3, 0xD2228916,
+0x60E36E20, 0x8902C802, 0x420BD220, 0x60E30009,
+0x8902C804, 0x420BD21E, 0x60E30009, 0x8905C808,
+0x7F04D21C, 0x6EF64F26, 0x6DF6422B, 0x4F267F04,
+0x000B6EF6, 0x00006DF6, 0x001E1020, 0x002029D0,
+0x00200E2A, 0x001E1015, 0x001E10BF, 0x00117D00,
+0x001E10FC, 0x002000F8, 0x00202930, 0x00117D80,
+0x001E10F8, 0x001E10AE, 0x00117D84, 0x001E1017,
+0x001E1021, 0x0020105C, 0x0020107E, 0x00201608,
+0x00202934, 0x001E100B, 0x001E1028, 0x002010AE,
+0x002010C0, 0x002010CC, 0xD6A8644C, 0x346C74FF,
+0x2450000B, 0x644CD6A6, 0x000B346C, 0xD6A52450,
+0x346C644C, 0x2450000B, 0x616D625C, 0x41194208,
+0x60194208, 0x644C4200, 0x324C670E, 0x207DD19E,
+0xC90F4200, 0x000B321C, 0x67632200, 0x4208625C,
+0x42004208, 0x324C644C, 0x4200D198, 0x000B321C,
+0x2FE62270, 0x614C4F12, 0x4100D493, 0x6710314C,
+0x2729E29F, 0x65736E53, 0x4719676D, 0x672E6279,
+0x4221227D, 0x42214221, 0x7601662C, 0xE4014608,
+0x34E84608, 0x644C4600, 0x0E1A0467, 0x215025EB,
+0x000B4F16, 0x4F226EF6, 0xD2857FE8, 0x88016021,
+0xD2848B7B, 0x26686621, 0xD2838B77, 0x26686621,
+0xE50F8B73, 0xE401BFA0, 0xBFA3E501, 0xE586E400,
+0xE400655C, 0x2F50BFA3, 0xBFA0E401, 0xE602E506,
+0x60634618, 0x81F2E401, 0x6543BF9E, 0xE40185F2,
+0xBFAA6543, 0x85F26603, 0x6543E401, 0x6603BFB1,
+0xE40265F0, 0x6053756C, 0x80F8BF7E, 0xBF81E402,
+0x84F8E512, 0x7090E402, 0x6503BF81, 0x4618E602,
+0x81F66063, 0xBF7FE402, 0x85F6E500, 0x6603E402,
+0xE500BF8B, 0xE40285F6, 0xBF926603, 0xE5FEE500,
+0xE010655C, 0xBF5FE403, 0xE5130F54, 0xE40EBF62,
+0x05FCE010, 0xBF62E40E, 0xE5007585, 0xBF63E403,
+0xE500E640, 0xBF70E403, 0xE500E640, 0xBF78E403,
+0xE5FFE640, 0xE014655C, 0xBF45E404, 0xE40F0F54,
+0xE504BF48, 0x05FCE014, 0xBF48E40F, 0xE5017584,
+0xBF49E640, 0xE501E404, 0xBF56E640, 0xE501E404,
+0xE404E640, 0xAF5C7F18, 0x7F184F26, 0x000B4F26,
+0x4F220009, 0xD2427FF0, 0x88016021, 0xD2418B71,
+0x26686621, 0xD2408B6D, 0x26686621, 0xE50F8B69,
+0xE401BF1A, 0xBF1DE501, 0xE586E400, 0xE400655C,
+0x2F50BF1D, 0xBF1AE401, 0xE401E506, 0xBF1B6543,
+0xE401E640, 0xBF286543, 0xE401E640, 0xBF306543,
+0x65F0E640, 0x756CE402, 0xBEFD6053, 0xE40280F4,
+0xE512BF00, 0xE40284F4, 0xBF007090, 0xE6406503,
+0xBF01E402, 0xE640E500, 0xBF0EE402, 0xE640E500,
+0xBF16E402, 0xE5FEE500, 0x6053655C, 0xBEE3E403,
+0xE51380F8, 0xE40EBEE6, 0xE40E84F8, 0xBEE67085,
+0xE5006503, 0xBEE7E640, 0xE500E403, 0xBEF4E640,
+0xE500E403, 0xBEFCE640, 0xE5FFE403, 0x6053655C,
+0xBEC9E404, 0xE40F80FC, 0xE504BECC, 0xE40F84FC,
+0xBECC7083, 0xE5016503, 0xBECDE640, 0xE501E404,
+0xBEDAE640, 0xE501E404, 0xE404E640, 0xAEE07F10,
+0x7F104F26, 0x000B4F26, 0x00000009, 0x001E1030,
+0x001E1080, 0x001E1090, 0x001E103F, 0x001E103E,
+0x0020292A, 0x0020292C, 0x0020292E, 0x0009000B,
+0x666CE680, 0x6563D2A0, 0x7540E700, 0x6473422B,
+0x2FB62FA6, 0x2FD62FC6, 0x4F222FE6, 0x4C18EC01,
+0xDA9BDB9A, 0x65B252B1, 0x89223520, 0xC9036051,
+0x891E8801, 0xD197DE95, 0x64E3410B, 0x85036503,
+0x670D66A2, 0xDD943762, 0xD494890A, 0x420BD294,
+0xD1940009, 0xE701D494, 0x21724D0B, 0x0009AFE2,
+0x420BD292, 0xD69264E3, 0x4D0BD492, 0xAFD926C2,
+0x4F260009, 0x6DF66EF6, 0x6BF66CF6, 0x6AF6000B,
+0x7FF44F22, 0xE6818546, 0x85472F01, 0x81F1666C,
+0xD27D8548, 0x854281F2, 0x81F367F3, 0xE40C8543,
+0x605381F4, 0x81F56563, 0x7540420B, 0x4F267F0C,
+0x0009000B, 0x2F962F86, 0x2FB62FA6, 0x2FD62FC6,
+0x4F222FE6, 0xE2007FEC, 0xA0CBDB7B, 0x6A132F21,
+0x4A08D27A, 0xDE7AE001, 0x4A00420B, 0x7E303AEC,
+0x1F021FE1, 0x66B2DD77, 0x362052B1, 0xA0B58B01,
+0x60610009, 0x8801C903, 0xA0AF8B01, 0x85610009,
+0x8974C801, 0xEE105163, 0xDC638512, 0xC9036603,
+0x85136403, 0x4021600D, 0xC93F4021, 0x8D2030E3,
+0xD7696503, 0x62704408, 0x44004408, 0x22284500,
+0x345C8F0C, 0x6043D265, 0x625D052D, 0x60294219,
+0x207D670E, 0x605C81F6, 0x81F8A00B, 0x6043D260,
+0x685D052D, 0x60894819, 0x209D690E, 0x605C81F6,
+0xD75C81F8, 0x22286272, 0xE0FF8902, 0x81F8600C,
+0xEEFF85F8, 0x6EEC650D, 0x8B0F35E0, 0x4E0BDE45,
+0x540364B3, 0xBF7BE502, 0xD4536803, 0x410BD147,
+0xD7526583, 0xD452E901, 0x2792A020, 0x26E9EEFC,
+0x81126063, 0x946E8513, 0x81132049, 0x45088512,
+0x62036953, 0xE50885F6, 0x8112202B, 0x45188513,
+0x8113209B, 0xD4478514, 0x8114205B, 0x851161B2,
+0x811120E9, 0x602162B2, 0x2201CB01, 0x00094C0B,
+0x56F160B2, 0xCB0152F2, 0xAF7C2A02, 0x85612622,
+0xC802DC3A, 0xD938D227, 0x8D0FD82C, 0x420B64B3,
+0x65030009, 0x480B6493, 0xE8015E03, 0x85EF2C82,
+0x650DD635, 0x64D3460B, 0x0009AF65, 0x0009420B,
+0x6E035403, 0xE5088544, 0x45186103, 0x31502159,
+0xBF258B03, 0xA007E501, 0x85410009, 0x620DD52B,
+0x89012258, 0xE500BF1C, 0x480B6493, 0xD42865E3,
+0xE801D611, 0x2C82460B, 0x0009AF45, 0x7B0862F1,
+0x2F217201, 0xEE0362F1, 0x31E7612D, 0xAF2E8901,
+0x7F140009, 0x6EF64F26, 0x6CF66DF6, 0x6AF66BF6,
+0x000B69F6, 0xFE0368F6, 0x002018B8, 0x002028E4,
+0x002028EC, 0x00200AE0, 0x00200E2A, 0x002028B4,
+0x00200B62, 0x001E2130, 0x00202AD4, 0x00200AFE,
+0x001C3D30, 0x00202AD8, 0x002028C4, 0x00202034,
+0x001C3D00, 0x00202AE4, 0x00202AF0, 0x002029D4,
+0x00202A54, 0x00202900, 0x002028BC, 0x001E212C,
+0x00202ADC, 0x00202AE0, 0x00200E8A, 0x00008000,
+0x00202AEC, 0x4F222FE6, 0x6E22D20D, 0xC84060E3,
+0x22E28D02, 0x0009BE7A, 0x4218E240, 0x89012E28,
+0x0009BE76, 0xC80560E3, 0xBECB8901, 0x60E30009,
+0x8902C802, 0xAE734F26, 0x4F266EF6, 0x6EF6000B,
+0x001C3510, 0x080A0C0E, 0x00020406, 0x1A1C1E20,
+0x12141618, 0x2E303234, 0x26282A2C, 0x3A3C3E40,
+0x6C625648, 0x41112F26, 0xE2208F18, 0x890B3123,
+0x321CD204, 0xD1026220, 0x412B312C, 0x00090009,
+0x0020205E, 0x00202014, 0x000BE000, 0x400062F6,
+0x40004000, 0x40004000, 0x40004000, 0x62F6000B,
+0x40004000, 0x40004000, 0x40004000, 0x40184000,
+0x62F6000B, 0x40004000, 0x40004000, 0x40004000,
+0x40284000, 0x62F6000B, 0x40004000, 0x40184000,
+0x000B4028, 0xC90F62F6, 0x40054005, 0x40054005,
+0x62F6000B, 0x4005C907, 0x40054005, 0x62F6000B,
+0x4005C903, 0x000B4005, 0xC90162F6, 0x000B4005,
+0x000062F6, 0x080A0C0E, 0x00020406, 0x1A1C1E20,
+0x12141618, 0x2E303234, 0x26282A2C, 0x3A3C3E40,
+0x6C625648, 0x41112F26, 0xE2208F18, 0x890B3123,
+0x321CD204, 0xD1026220, 0x412B312C, 0x00090009,
+0x0020211E, 0x002020D4, 0x000BE000, 0x400162F6,
+0x40014001, 0x40014001, 0x40014001, 0x62F6000B,
+0x40014001, 0x40014001, 0x40014001, 0x40194001,
+0x62F6000B, 0x40014001, 0x40014001, 0x40014001,
+0x40294001, 0x62F6000B, 0x40014001, 0x40194001,
+0x000B4029, 0x400462F6, 0x40044004, 0xC90F4004,
+0x62F6000B, 0x40044004, 0xC9074004, 0x62F6000B,
+0x40044004, 0x000BC903, 0x400462F6, 0x000BC901,
+0x000062F6, 0x3622E218, 0x67438F12, 0x0009A004,
+0x76FF6254, 0x74012420, 0xC8036053, 0x60438BF8,
+0x8902C803, 0x422BD22B, 0xD22B0009, 0x0009422B,
+0x2FE66473, 0x8D4A3450, 0x27786763, 0x62438947,
+0x227B225B, 0xC9016023, 0x8D203452, 0x2EE86E03,
+0x60238B15, 0x8B08C803, 0x47096643, 0x47106256,
+0x8FFB2622, 0xA0327604, 0x47010009, 0x61436673,
+0x46106255, 0x8FFB2121, 0xA0287102, 0x66430009,
+0x47106254, 0x8FFB2620, 0xA0207601, 0x61430009,
+0x2EE8357C, 0x8F15317C, 0x60236653, 0x8B07C803,
+0x76FC4709, 0x47106262, 0x21268FFB, 0x0009A00F,
+0x65634701, 0x75FE6673, 0x46106251, 0x21258FFB,
+0x0009A005, 0x626076FF, 0x8FFB4710, 0x60432124,
+0x6EF6000B, 0x00202306, 0x002027B2, 0xE21E2FE6,
+0x67633626, 0x8D1B6153, 0x3E106E43, 0x3E128916,
+0x65E38908, 0x3672E600, 0x62148910, 0x25207601,
+0x7501AFF9, 0x317C64E3, 0x6513347C, 0xE600A004,
+0x625075FF, 0x24247601, 0x8BF93672, 0x60E3A011,
+0x890831E2, 0x327C6213, 0x8B0432E6, 0x651364E3,
+0xA0086673, 0xD28F6EF6, 0x651364E3, 0x422B6673,
+0x000B6EF6, 0xE2046EF6, 0x67433622, 0x8F10356C,
+0xA004346C, 0x75FF0009, 0x76FF6250, 0x60532424,
+0x8BF8C803, 0xC8036043, 0xA1058901, 0xA2770009,
+0xA2990009, 0x2FB60009, 0x2FD62FC6, 0x7FE42FE6,
+0x6C636043, 0x66521F62, 0xC9037504, 0x1F516E53,
+0x45086503, 0xE1FC6D43, 0x2D194500, 0x1F732558,
+0x1F651F44, 0x2FD28D0B, 0x88086053, 0x88108923,
+0x8818895B, 0xA0898B01, 0xA0BD0009, 0x62630009,
+0x2D22E600, 0x7CFC7D04, 0xEB10A00D, 0xE60064E6,
+0x7CF065E6, 0x62E261E6, 0x1D512D42, 0x1D231D12,
+0x7E047D10, 0x3CB21FE1, 0x1F6589F0, 0x2FD21FC2,
+0xA0A11FE6, 0x64D21FD4, 0x44286263, 0x44294418,
+0x42184419, 0x4629242B, 0x2D424619, 0x65637D04,
+0xA0217CFD, 0x67E6EB10, 0x62E67CF0, 0x64E66673,
+0x256B4618, 0x2D5261E2, 0x65234729, 0x45184719,
+0x4229275B, 0x42191D71, 0x47186743, 0x4429227B,
+0x44196713, 0x247B4718, 0x1D431D22, 0x41194129,
+0x65137D10, 0x1FE17E04, 0x89DC3CB2, 0x1FE67EFF,
+0x1FC21F55, 0xA0672FD2, 0x6CF21FD4, 0x66C257F5,
+0x46286273, 0x42284629, 0x2C62262B, 0x7C045DF2,
+0x7DFE4729, 0xA01CEB10, 0x65E65EF1, 0x66E66273,
+0x47286753, 0x6763227B, 0x452961E6, 0x257B4728,
+0x2C2264E6, 0x65131C51, 0x45284629, 0x1C62265B,
+0x41296643, 0x216B4628, 0x44291C13, 0x67437C10,
+0x3DB27DF0, 0x1FD289E1, 0x7EFEA034, 0x51F56CF2,
+0x621366C2, 0x42284618, 0x42184619, 0x2C62262B,
+0x7C045DF2, 0x7DFF4119, 0xA01FEB10, 0x65E65EF1,
+0x64E67DF0, 0x42286253, 0x421867E6, 0x66E6212B,
+0x61432C12, 0x45194128, 0x251B4118, 0x65731C51,
+0x44194528, 0x245B4518, 0x64631C42, 0x47194428,
+0x274B4418, 0x46191C73, 0x61637C10, 0x89DE3DB2,
+0x7EFD1FD2, 0x1FC41FE6, 0x5DF2E704, 0xA00D5EF6,
+0x62E451F4, 0x66E47DFC, 0x65E464E4, 0x71012120,
+0x71012160, 0x71012140, 0x71012150, 0x89F03D72,
+0x66D357F3, 0x641365E3, 0x6EF67F1C, 0x6CF66DF6,
+0x6BF6A190, 0x00202194, 0x2FC62FB6, 0x2FE62FD6,
+0x60437FE4, 0x6C63C903, 0x66031F62, 0x460875FC,
+0x61526E43, 0x4600E2FC, 0x26682E29, 0x1F441F73,
+0x1F516D53, 0x8D0B1F15, 0x60632FE2, 0x891F8808,
+0x89538810, 0x8B018818, 0x0009A081, 0x0009A0B9,
+0xEB10A00D, 0x52D37DF0, 0x54D156D2, 0x2E1665D2,
+0x2E662E26, 0x2E427EFC, 0x1FD16153, 0x3CB27CF0,
+0x7D0489F0, 0x1F151FD6, 0x2FE21FC2, 0x1FE4A0A1,
+0x621366E2, 0x42294619, 0x42194618, 0x2E62262B,
+0x7CFF4118, 0xEB10A021, 0x54D37DF0, 0x624357D2,
+0x42194229, 0x55D1212B, 0x2E1666D2, 0x41296173,
+0x41194418, 0x2E46241B, 0x44296453, 0x44194718,
+0x2E76274B, 0x47296763, 0x47194518, 0x257B7EFC,
+0x46182E52, 0x1FD16163, 0x3CB27CF0, 0x7D0389DC,
+0x1F151FD6, 0x2FE21FC2, 0x1FE4A06B, 0x57F56EF2,
+0x627366E2, 0x46284629, 0x262B4229, 0x2E625CF2,
+0x7CFE4728, 0xA01BEB10, 0x7DF05DF1, 0x55D251D3,
+0x46296613, 0x54D1276B, 0x2E7662D2, 0x41286753,
+0x217B4729, 0x61432E16, 0x41294528, 0x2E56251B,
+0x44286523, 0x245B4529, 0x42282E46, 0x7CF06723,
+0x89E23CB2, 0x1FD67D02, 0xA03A1FC2, 0x67F21FE4,
+0x657251F5, 0x45296213, 0x45284519, 0x42194518,
+0x5CF2252B, 0x41282752, 0x7CFD4118, 0xA022EB10,
+0x7DF05DF1, 0x54D256D3, 0x45196563, 0x52D14628,
+0x4618215B, 0x6ED26543, 0x45192716, 0x265B4428,
+0x65436163, 0x45186423, 0x42284419, 0x4218254B,
+0x271664E3, 0x44196623, 0x264B2756, 0x4E282766,
+0x61E34E18, 0x3CB27CF0, 0x7D0189DB, 0x1FC21FD6,
+0xE7041F74, 0x51F45DF2, 0x5EF6A00D, 0x84E27EFC,
+0x620364E0, 0x7DFC84E1, 0x84E36503, 0x21646603,
+0x21542124, 0x3D722144, 0x57F389F0, 0x641366D3,
+0x7F1C65E3, 0x6DF66EF6, 0xA09D6CF6, 0x2F866BF6,
+0x2FA62F96, 0x2FC62FB6, 0x2FE62FD6, 0x614374E0,
+0x6A636873, 0x6B56E920, 0x6C567AE0, 0x6D567120,
+0x6E563A92, 0x64566756, 0x62566656, 0x11C121B2,
+0x11E311D2, 0x11451174, 0x8DEC1166, 0x71201127,
+0x6613A004, 0x7AFF6254, 0x76012620, 0x8BF92AA8,
+0x6EF66083, 0x6CF66DF6, 0x6AF66BF6, 0x000B69F6,
+0x2F8668F6, 0x2FA62F96, 0x2FC62FB6, 0x2FE62FD6,
+0x6A636873, 0x75E0E920, 0x56565257, 0x57545155,
+0x5D525E53, 0x6B525C51, 0x24662426, 0x24762416,
+0x7AE024E6, 0x24C624D6, 0x8DEC3A92, 0x66A324B6,
+0x6EF66783, 0x6CF66DF6, 0x6AF66BF6, 0xA04369F6,
+0x2FE668F6, 0xC8046063, 0x8D046E63, 0x62166153,
+0x24227EFC, 0x60E37404, 0x8908C818, 0x71046513,
+0x62526616, 0x24227EF8, 0xAFF41461, 0xE2047408,
+0x65133E22, 0x66E38D02, 0x6EF6A01C, 0x6EF6AF87,
+0xC8046063, 0x61638D04, 0x625275FC, 0x242671FC,
+0xC8186013, 0x75F88906, 0x66525251, 0x24662426,
+0x71F8AFF6, 0x3122E204, 0x66138F02, 0x0009AFA1,
+0x0009A00A, 0x0009A004, 0x76FF6254, 0x74012420,
+0x8BF92668, 0x6073000B, 0x0009A004, 0x625075FF,
+0x242476FF, 0x8BF92668, 0x6073000B, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x544F0D0A, 0x46205355, 0x00003A57, 0x2072614D,
+0x32203232, 0x20373030, 0x353A3731, 0x37333A32,
+0x00000000, 0x00000D0A, 0x00000043, 0x61766E49,
+0x2064696C, 0x72657375, 0x20726F20, 0x2079656B,
+0x00214449, 0x6E6B6E55, 0x206E776F, 0x6D6D6F63,
+0x3D646E61, 0x00000000, 0x61437748, 0x7262696C,
+0x6F697461, 0x6620206E, 0x0A6C6961, 0x0000000D,
+0x73696F4E, 0x61432065, 0x7262696C, 0x6F697461,
+0x6166206E, 0x21216C69, 0x00000D0A, 0x00000D0A,
+0x00000042, 0x000000FF, 0x00020001, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x010E010D, 0x00020003, 0x01090108,
+0x0002010A, 0x00030002, 0x02020201, 0x02040203,
+0x02060205, 0x02080207, 0x020A0209, 0x020C020B,
+0x020E020D, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x010E010D, 0x00FF010F, 0x01090108,
+0x010B010A, 0x00030002, 0x02020201, 0x02040203,
+0x02060205, 0x02080207, 0x020A0209, 0x020C020B,
+0x020E020D, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00000072, 0x00205220, 0x00000046,
+0x00000059, 0x73204142, 0x003D7165, 0x00000074,
+0x00000000, 0x02000112, 0x40FFFFFF, 0x12210ACE,
+0x20104890, 0x02090100, 0x0101002E, 0x09FA8000,
+0x04000004, 0x000000FF, 0x02010507, 0x07000200,
+0x00028205, 0x05070002, 0x00400383, 0x04050701,
+0x01004003, 0x002E0209, 0x80000101, 0x000409FA,
+0x00FF0400, 0x05070000, 0x00400201, 0x82050700,
+0x00004002, 0x03830507, 0x07010040, 0x40030405,
+0x03040100, 0x030C0409, 0x0079005A, 0x00410044,
+0x03180053, 0x00530055, 0x00320042, 0x0030002E,
+0x00570020, 0x0041004C, 0x0000004E, 0x00000000,
+0x00000000, 0x00000709, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, };
+
+const u32_t zcFwImageSize=11204;
diff --git a/drivers/staging/otus/hal/hpfwu_OTUS_RC.c b/drivers/staging/otus/hal/hpfwu_OTUS_RC.c
new file mode 100644
index 00000000000..089d3e0ad85
--- /dev/null
+++ b/drivers/staging/otus/hal/hpfwu_OTUS_RC.c
@@ -0,0 +1,715 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include "cprecomp.h"
+
+const u32_t zcFwImage[] = {
+0x0009000B, 0x4F222FE6, 0xDE287FFC, 0xE114D728,
+0x1E13D428, 0x1E4C470B, 0x0009B018, 0xA0039543,
+0x3652E600, 0x76018D04, 0xC84060E2, 0x2F028DF9,
+0xDE22D421, 0x00094E0B, 0x4E0BD421, 0xD4210009,
+0x00094E0B, 0x4F267F04, 0x6EF6A022, 0xD11E4F22,
+0x0009410B, 0x440BD41D, 0xD51D0009, 0x0009450B,
+0xE1FFD71C, 0xD21C611D, 0x50292712, 0xCB01E1FF,
+0xD61BD41A, 0x22121209, 0xE5011211, 0x2452E200,
+0xD5182622, 0x970FD618, 0x4F262572, 0x2620000B,
+0xDD17DC16, 0x4C0BDE17, 0x4D0B0009, 0x4E0B0009,
+0xAFF80009, 0x27100009, 0x00000640, 0x001C001C,
+0x002008EA, 0x0000B38E, 0x002028DC, 0x00200DA6,
+0x002028E8, 0x00202900, 0x00200C6C, 0x00200EA2,
+0x00200940, 0x001C3510, 0x001C3624, 0x001E212C,
+0x00202894, 0x0020288C, 0x002027F0, 0x00200B68,
+0x00201F74, 0x00201734, 0x2FD62FC6, 0x4F222FE6,
+0xDEA17FA4, 0x61E0E01C, 0x7D016DE3, 0x61D00F14,
+0xD59FD49E, 0x450BE020, 0xE0200F14, 0xE78004FC,
+0x604C66E2, 0x7D7F677C, 0x1F693070, 0x2D628F17,
+0x01FCE01C, 0x641CE500, 0xD797DE96, 0x3243625D,
+0xA21A8B01, 0x655D0009, 0x31EC6153, 0xE0286C10,
+0x6D530FC4, 0x3D7C62CE, 0xAFEF2D20, 0x20087501,
+0xE01C8B15, 0xE50001FC, 0xD78BDE8A, 0x641CA00A,
+0x6C53655D, 0x66C23CEC, 0x66626253, 0x2262327C,
+0x1F697504, 0x3243625D, 0xA1F68BF2, 0x88012D10,
+0xE01C8B16, 0xE40001FC, 0x671C2D40, 0x624DDE7D,
+0x8B013273, 0x0009A1E9, 0x62E3644D, 0x72046D43,
+0x3DEC6143, 0x65D2312C, 0x74086C12, 0x25C2AFEF,
+0x8B188804, 0x01FCE01C, 0x2D40E400, 0xDE71671C,
+0x3273624D, 0xA1D08B01, 0x644D0009, 0x62E36D43,
+0x65D23DEC, 0x61437204, 0x6612312C, 0x74086C52,
+0xAFED2C69, 0x880525C2, 0xE01C8B18, 0xE40001FC,
+0x671C2D40, 0x624DDE63, 0x8B013273, 0x0009A1B5,
+0x6C43644D, 0x3CEC62E3, 0x720465C2, 0x3D2C6D43,
+0x615266D2, 0x216B7408, 0x2512AFED, 0x8B138830,
+0xE200DE58, 0x64E22D20, 0x8B042448, 0x420BD257,
+0xA19A0009, 0x55E10009, 0x57E356E2, 0xDD545CE4,
+0x2FC64D0B, 0x7F04A191, 0x89018828, 0x0009A0EA,
+0xE143DE4C, 0x622D62E1, 0x8F033217, 0x56FB1FEB,
+0x2621E240, 0x8B013217, 0x0009A0D5, 0xE1015EFB,
+0x301685E1, 0xA0CE8B01, 0xE4010009, 0x2D4055FB,
+0x6451B179, 0xE14357FB, 0xE0546271, 0x3517652D,
+0x0F568D41, 0x3563E640, 0xE6008B05, 0x0F65E034,
+0xA00FE11A, 0x615372C0, 0x41214121, 0x41214121,
+0x45214121, 0x45214521, 0xC9036053, 0xE0346603,
+0x71180F65, 0x2209E007, 0x641DE030, 0x0F2565F3,
+0x1F4EB1F1, 0x04FDE034, 0x674DE030, 0x47080CFD,
+0x607361CD, 0x4108D22B, 0xE00F0CFE, 0x1F1F420B,
+0x2CD96D07, 0x5EFB6073, 0x85E20FC6, 0x420B51FF,
+0x2C0B600D, 0x54FE6073, 0xB1BB0FC6, 0xE05465F3,
+0x652D62E1, 0xE6400F56, 0x89623563, 0xE050E100,
+0x60230F15, 0x4008C903, 0x6D034000, 0xE0406103,
+0xE0440FD6, 0xD217EEFF, 0x6EEC0FF6, 0x0F26E058,
+0x60E3420B, 0x42216253, 0x42214221, 0x66234221,
+0x326C4200, 0x45214200, 0xE0486707, 0x0F764521,
+0xC9036053, 0x40085CFB, 0x7C0630FC, 0x6E036D2D,
+0x1FD51FC6, 0x1F04A02E, 0x00117D00, 0x00202904,
+0x00200DA6, 0x00117D04, 0x00117D84, 0x00200700,
+0x0020074C, 0x00201FD4, 0x0FD6E04C, 0x05FEE044,
+0x64D3B189, 0x64E2E048, 0xE04006FE, 0x2E422469,
+0x01FE67C4, 0x667CE058, 0x420B02FE, 0x240B6063,
+0x05FEE044, 0xB15D2E42, 0xE05064D3, 0x7D0101FD,
+0x0F157101, 0x02FDE050, 0x3262E606, 0x56FB8BDC,
+0x55FB6261, 0x85514200, 0x302C750C, 0x6103701B,
+0x64F3E600, 0xE704A004, 0x76016256, 0x74042422,
+0x3273626D, 0x65F38BF8, 0x641DB13C, 0xB0D256FB,
+0xA0AA6461, 0xD4880009, 0xE201D588, 0x2D20450B,
+0x0009A0A3, 0x8B078829, 0xE200DE85, 0x66E22D20,
+0x646DB0A1, 0x0009A099, 0x622CE281, 0x8B3D3020,
+0xD680E738, 0xE0442D70, 0xE0480C6E, 0x6E621DC1,
+0x51611DE2, 0x54621D13, 0x55651D44, 0x57631D55,
+0x5C661D76, 0x0E6E1DC7, 0x1DE8E040, 0xE050016E,
+0x54641D19, 0x056E1D4A, 0x1D5BE04C, 0xE054076E,
+0x0C6E1D7C, 0x1DCDE058, 0xE044026E, 0xED001D2E,
+0xE04806D6, 0x16D126D2, 0x16D516D2, 0x16D616D3,
+0xE04006D6, 0xE05006D6, 0x06D616D4, 0x06D6E04C,
+0x06D6E054, 0x06D6E058, 0x1F29A057, 0x622CE282,
+0x89313020, 0x05FCE020, 0x625CE683, 0x3260666C,
+0xD65D8B07, 0x2650E500, 0x52617680, 0xA044D65B,
+0xE6902622, 0x3260666C, 0xD2578B16, 0xE500D658,
+0x60622250, 0xCB20D257, 0xE6052602, 0xD6562262,
+0x2252460B, 0x420BD255, 0xD2550009, 0x2262E601,
+0x4618D254, 0x2262A029, 0xD254D453, 0xD4546542,
+0x0009420B, 0x0009A021, 0xE524D647, 0xD5452650,
+0x16215257, 0x16225258, 0x16235259, 0x1624525A,
+0x1625525B, 0x1626525C, 0x1627525D, 0x1628525E,
+0x1F29525F, 0xE2001629, 0x15281527, 0x152A1529,
+0x152C152B, 0x152E152D, 0x7F5C152F, 0x6EF64F26,
+0x000B6DF6, 0x4F226CF6, 0xE240614D, 0x89173123,
+0x3127E21F, 0xD43B8908, 0xE001D53B, 0x6642450B,
+0x26796707, 0x2462A00C, 0x3127E23F, 0xD7358908,
+0x71E0D635, 0x460BE001, 0x62075571, 0x17512529,
+0x000B4F26, 0x4F220009, 0xE240614D, 0x89153123,
+0x3127E21F, 0xD42B8907, 0x6642D22B, 0xE001420B,
+0xA00B260B, 0xE23F2462, 0x89073127, 0xD626D725,
+0x71E05571, 0xE001460B, 0x1751250B, 0x000B4F26,
+0xE6400009, 0x46284618, 0x6252D520, 0x89FC2268,
+0x0009000B, 0x4618E680, 0xD51C4628, 0x22686252,
+0x000B89FC, 0xA0010009, 0x7201E200, 0x8BFC3242,
+0x0009000B, 0x4618E680, 0xD5154628, 0x22686252,
+0x000B8BFC, 0x00000009, 0x00202908, 0x00200DA6,
+0x00117D04, 0x002027F8, 0x00117D80, 0x0020288C,
+0x001C3500, 0x001D4004, 0x00200EA2, 0x00200940,
+0x001E212C, 0x001C3D28, 0x00117D00, 0x00200E06,
+0x00202920, 0x001C3704, 0x00201FD4, 0x001C373C,
+0x001C3700, 0x4F222FE6, 0x6E537FFC, 0x2F42BFCA,
+0xD61561E2, 0x1615E280, 0x421854E1, 0x55E21646,
+0x16574228, 0x6EF257E3, 0x2E2B1678, 0x7F0426E2,
+0xAFA74F26, 0x2FC66EF6, 0x2FE62FD6, 0xDD0A4F22,
+0xBFAF6C53, 0xBF946E43, 0xBFAB2DE2, 0x51D50009,
+0x54D62C12, 0x55D71C41, 0x56D81C52, 0x4F261C63,
+0x6DF66EF6, 0x6CF6000B, 0x001C370C, 0x0009A0C0,
+0xD17B4F22, 0xD47B92B6, 0x2122B00D, 0x97B2E605,
+0xB02295B2, 0xB0366463, 0xB0360009, 0xB0390009,
+0xA0680009, 0x4F124F26, 0xD1734F02, 0x94A43145,
+0x4609060A, 0x46094609, 0x00293646, 0xD76CD56F,
+0x2500CA01, 0x4F062762, 0x4F16000B, 0xBFEA4F22,
+0xB01F0009, 0xA04E0009, 0x2FE64F26, 0x6E63D168,
+0x44186612, 0x4528928A, 0x26294408, 0x44084500,
+0x4400265B, 0x4708264B, 0x47082162, 0x27EBD161,
+0x000B2172, 0x000B6EF6, 0xD25F0009, 0xE40A9677,
+0x2262AFB4, 0x2FC62FB6, 0x2FE62FD6, 0xDC5B4F22,
+0x2C22E201, 0xBFA9E40A, 0x60C27C44, 0xCB01ED00,
+0x60C22C02, 0xC901EB64, 0x6E03A008, 0x89073DB2,
+0xE40160C2, 0xBF99C901, 0x7D016E03, 0x8BF52EE8,
+0x8B033DB2, 0xD24FD44E, 0x0009420B, 0x4F26E40A,
+0x6DF66EF6, 0xAF896CF6, 0x44116BF6, 0x604B8F01,
+0x000B6043, 0x2FB60009, 0x2FD62FC6, 0x4F222FE6,
+0xDC457FFC, 0x60C2ED00, 0xCB02EB64, 0x60C22C02,
+0xC9022F02, 0x6E03A009, 0x89083DB3, 0xE46460C2,
+0xC9022F02, 0x6E03BF6A, 0x2EE87D01, 0xD73B8BF4,
+0x617251C1, 0xDE3BDC3A, 0xD23CD13B, 0x64C23DB3,
+0x651264E2, 0x65228F09, 0xD232D439, 0x4F267F04,
+0x6DF66EF6, 0x422B6CF6, 0x7F046BF6, 0x6EF64F26,
+0x6CF66DF6, 0x6BF6000B, 0x5651D532, 0x46286052,
+0x306C000B, 0x5288096C, 0x09B45BB4, 0x03C41FFF,
+0x2FC62FB6, 0x2FE62FD6, 0x4F124F22, 0xBFEB4F02,
+0x6B036E43, 0xDD18DC28, 0x0009BFE6, 0x3C0530B8,
+0x4609060A, 0x46014609, 0x020A3D65, 0x42094209,
+0x32E24209, 0x4F068BF0, 0x4F264F16, 0x6DF66EF6,
+0x000B6CF6, 0x2FE66BF6, 0xDE1C4F22, 0xE500E102,
+0x2E12E403, 0x2E52BFD4, 0x4618E606, 0xE403E700,
+0x2E722E62, 0xAFCB4F26, 0x000B6EF6, 0x00000009,
+0x00202890, 0x0024CDE0, 0x10624DD3, 0x00202A8C,
+0x001C5814, 0x001C59D0, 0x001C5804, 0x001C581C,
+0x00202934, 0x00200DA6, 0x001C5860, 0x001C6864,
+0x001C7864, 0x001C59BC, 0x001C69BC, 0x001C79BC,
+0x0020294C, 0x001C1040, 0xCCCCCCCD, 0x001D4004,
+0x2F962F86, 0x2FB62FA6, 0x2FD62FC6, 0x4F222FE6,
+0xE4007FE4, 0x4528E510, 0x67436C43, 0xE107A00F,
+0x6043644D, 0x0F564008, 0xEE0060C3, 0x815125C1,
+0x81538152, 0x157315E2, 0x751415E4, 0x624D7401,
+0x8BED3213, 0xDA6F51F1, 0x1A1154F2, 0xD16E2A12,
+0x57F455F3, 0x6DF258F5, 0x1141D96C, 0x11532142,
+0x11751152, 0x11871174, 0x52F61186, 0x19D1D668,
+0xD86829D2, 0xDA68E950, 0x1621EBB4, 0x6BBC2622,
+0xA0214908, 0x6EEDEE00, 0x61E36DE3, 0x41084D08,
+0x31EC3DEC, 0x41084D08, 0x60C33D8C, 0xE7904108,
+0x81D12DC1, 0x41086093, 0x81D2677C, 0x31AC60C3,
+0x3472E200, 0x1DD281D3, 0xD4551D13, 0x1D248D01,
+0xB03AD450, 0x7E0165D3, 0x34B264ED, 0xD14D8BDB,
+0x6512DB52, 0x4529D24D, 0x64121B51, 0x674DD14A,
+0x67222B72, 0x4729D64E, 0x69221B73, 0x689D2FD2,
+0x69121B82, 0x5A122692, 0x5B1416A2, 0x16B4DA44,
+0x16C65C16, 0x16EA6EA2, 0x4F267F1C, 0x6DF66EF6,
+0x6BF66CF6, 0x69F66AF6, 0x68F6000B, 0x60616642,
+0x8D04C803, 0x6061E500, 0x8802C903, 0x52628B03,
+0x51246563, 0x000B2412, 0x2FD66053, 0x4F222FE6,
+0x6E537FEC, 0xE5506253, 0xE4006D43, 0xA0014508,
+0x5224E101, 0x22116043, 0x81238121, 0x81226053,
+0x362056E2, 0xD22F8BF5, 0x64F316E4, 0x420BE614,
+0x65E165E3, 0x2549E4FC, 0x61F12E51, 0x214965F3,
+0x54D12F11, 0x410BD127, 0x57D1E614, 0xCB016071,
+0x1DE12701, 0x4F267F14, 0x000B6EF6, 0x2FD66DF6,
+0x4F222FE6, 0x6E537FEC, 0xE5FC6653, 0x60616D43,
+0xCB012059, 0x52E22601, 0x8B063260, 0x51E212E4,
+0x8B0431E0, 0xA00252D1, 0xAFF01E22, 0xD2155664,
+0xE61464F3, 0x65E3420B, 0xE1FC67E1, 0x2E712719,
+0x54D167F1, 0xD10F2719, 0xE61465F3, 0x2F71410B,
+0x602152D1, 0x2201CB01, 0x7F141DE1, 0x6EF64F26,
+0x6DF6000B, 0x0020285C, 0x00202864, 0x00202854,
+0x00202884, 0x0010008C, 0x00100EC0, 0x001E2108,
+0x001C3D00, 0x00202134, 0x2FC62FB6, 0x2FE62FD6,
+0xD6314F22, 0x60D36D62, 0x894DC803, 0xDB30DC2F,
+0x0009A02C, 0xC9036061, 0x892B8801, 0xD22DD42B,
+0x0009420B, 0x65035603, 0xC8208561, 0xE0508903,
+0x720102BE, 0x85620B26, 0x4000600D, 0x4000366A,
+0x40004624, 0x206D4624, 0xD423C903, 0x40086E03,
+0xD1224000, 0x340C410B, 0x61E3D521, 0xD721E001,
+0x450BD221, 0x64E37E30, 0x2702420B, 0x66C252C1,
+0x8BCF3620, 0x4E18EE01, 0xA011DB1C, 0x6061EC75,
+0x8801C903, 0xD4198910, 0x460BD612, 0xD4180009,
+0x470BD718, 0xD2136503, 0x64C3D113, 0x22E2410B,
+0x66B252B1, 0x8BEA3620, 0xC80460D3, 0xD2128906,
+0x6EF64F26, 0x6CF66DF6, 0x6BF6422B, 0x6EF64F26,
+0x6CF66DF6, 0x6BF6000B, 0x001E2100, 0x0020285C,
+0x002027F8, 0x00200A5C, 0x00202864, 0x00200ADE,
+0x00201FD4, 0x001C3D30, 0x00200D6C, 0x00202854,
+0x00202884, 0x00200A7A, 0x002000F8, 0xE601D237,
+0x1265D537, 0x000B2252, 0xD6361266, 0x88016062,
+0xE1018B62, 0xD5342612, 0x5451D134, 0xE0406212,
+0x2122324C, 0x54115752, 0x1141347C, 0x57125453,
+0x1172374C, 0x52135755, 0x1123327C, 0x56146452,
+0x1164364C, 0x54155754, 0x1145347C, 0x56165458,
+0x1166364C, 0x6762D626, 0x327C5217, 0x57611127,
+0x327C5218, 0x57621128, 0x327C5219, 0x57631129,
+0x347C541A, 0x5764114A, 0x347C541B, 0x5765114B,
+0x347C541C, 0x5266114C, 0x372C571D, 0x5267117D,
+0x342C541E, 0x5268114E, 0x362C561F, 0xD615116F,
+0x041E6262, 0x342C7694, 0xE0440146, 0x061E6262,
+0x0166362C, 0x525CE048, 0xD60F051E, 0x0156352C,
+0xE0546262, 0x4229051E, 0x0156352C, 0xE0585561,
+0x4529061E, 0x0166365C, 0x0009000B, 0x001C1010,
+0x0000C34F, 0x001C1028, 0x001C369C, 0x002027F8,
+0x001C3CA0, 0x001C36F4, 0x001C3B88, 0xD62F7FFC,
+0x2642644C, 0xC8205066, 0x2F028DFC, 0x7F04000B,
+0x2FD62FC6, 0x4F222FE6, 0x6D436C53, 0xEE00A004,
+0x7E0164D4, 0x644CBFEA, 0x8BF93EC2, 0x6EF64F26,
+0x000B6DF6, 0xA0016CF6, 0x76016643, 0x22286260,
+0x36488BFB, 0x6563AFE4, 0x2FB62F96, 0x2FD62FC6,
+0x4F222FE6, 0xEC1CED08, 0xDB196E53, 0x61C3E90A,
+0x60434B0B, 0x3092C90F, 0x66038D02, 0x7630A001,
+0x4D107637, 0x7E012E60, 0x7CFC8FF1, 0x8058E000,
+0x6EF64F26, 0x6CF66DF6, 0x000B6BF6, 0x000B69F6,
+0x000BE000, 0x2FE6E000, 0x7FEC4F22, 0x6E436253,
+0xBFD165F3, 0xBFC66423, 0xBFC464E3, 0xD40564F3,
+0x0009BFC1, 0x4F267F14, 0x6EF6000B, 0x001C0004,
+0x00202094, 0x00202968, 0xE110D59C, 0xE6406050,
+0x2500C9FD, 0xE0FF75E9, 0x80516453, 0x80538052,
+0x80568055, 0x251075EF, 0xE1EF6250, 0x2219E001,
+0xE7202520, 0x24608052, 0x2570000B, 0xE4FDD590,
+0xE7026152, 0x25122149, 0x74016052, 0x2502CB01,
+0xD18C6652, 0x25622649, 0x92C26012, 0x2102CB08,
+0xC9CF6012, 0x60122102, 0x2102CB03, 0x000B1172,
+0x4F221123, 0xE100D484, 0xD285D784, 0xD5852410,
+0x2711D485, 0x2211E700, 0xBFBD2511, 0xD5832471,
+0x2560E600, 0x4F26AFD2, 0xD281664C, 0x362C4600,
+0xCB106060, 0x2600000B, 0xD27D654C, 0x352C4500,
+0xE1EF6650, 0x000B2619, 0x664C2560, 0x4600D279,
+0x6060362C, 0x000BCB10, 0x654C2600, 0x4500D275,
+0x6650352C, 0x2619E1EF, 0x2560000B, 0xD270664C,
+0x362C4600, 0xCB086060, 0x2600000B, 0xD26C654C,
+0x352C4500, 0xE1F76650, 0x000B2619, 0x664C2560,
+0x4600D268, 0x6060362C, 0x000BCB08, 0x654C2600,
+0x4500D264, 0x6650352C, 0x2619E1F7, 0x2560000B,
+0xD65F624C, 0x326C4200, 0xC9086020, 0x40214021,
+0x000B4021, 0x624C600C, 0x4200D65A, 0x6020326C,
+0x4021C908, 0x40214021, 0x600C000B, 0xD156644C,
+0x341C74FF, 0x000B6240, 0xD154602C, 0x341C644C,
+0x000B6240, 0x2FE6602C, 0x655C4F22, 0x3567E60A,
+0x6E438D15, 0x6453BFEA, 0x60EC640C, 0x8B028801,
+0xA002E00F, 0x44092409, 0x624C4409, 0x3263E60A,
+0xBFE28905, 0x620C644C, 0xC8806023, 0xE2008B00,
+0x4F266023, 0x6EF6000B, 0xD6414F22, 0x88016062,
+0xB2228B03, 0xA0030009, 0xD23E0009, 0x2260E640,
+0xE200D63D, 0x000B4F26, 0x4F222622, 0x6062D638,
+0x8B018802, 0x0009B26C, 0xE200D637, 0x000B4F26,
+0x0FFF2622, 0xD433D532, 0xE701E100, 0x000B2512,
+0xD2302470, 0x000BE604, 0xD5202260, 0x6150E4FD,
+0x2149D62E, 0x2510E700, 0x2670000B, 0xE4FBD51B,
+0x22496250, 0x2520000B, 0xE4F7D518, 0x22496250,
+0x2520000B, 0xD2264F22, 0x600D8522, 0x89112008,
+0x89138801, 0x89158803, 0x89178805, 0x89418806,
+0x89478808, 0x894D8809, 0x8953880A, 0x8959880B,
+0x0009A060, 0x0009B062, 0x600CA05D, 0x0009B070,
+0x600CA059, 0x0009B07A, 0x600CA055, 0x6260D606,
+0x8B4F2228, 0x0009B086, 0x600CA04D, 0x001E1028,
+0x001E2148, 0x001E1108, 0x002028D9, 0x002028C8,
+0x002028CA, 0x002028CC, 0x002028AC, 0x001E1008,
+0x001E103F, 0x001E105F, 0x001E1030, 0x001E1090,
+0x002028D4, 0x001E100B, 0x002028D0, 0x002028D8,
+0x002028A0, 0x6260D687, 0x8B232228, 0x0009B06A,
+0x600CA021, 0x6260D683, 0x8B1B2228, 0x0009B0B4,
+0x600CA019, 0x6260D67F, 0x8B132228, 0x0009B0BA,
+0x600CA011, 0x6260D67B, 0x8B0B2228, 0x0009B11E,
+0x600CA009, 0x6260D677, 0x8B032228, 0x0009B136,
+0x600CA001, 0x4F26E000, 0x0009000B, 0xD273D172,
+0xD5738412, 0x4000C90F, 0xD772012D, 0x611CE403,
+0xD671E20F, 0x27122540, 0xE0012520, 0x2602000B,
+0xE601D269, 0x30668523, 0xE0008D06, 0xE000D267,
+0x8122D669, 0x2602E001, 0x0009000B, 0x8523D262,
+0x2008600D, 0x88018905, 0xD6648B0A, 0xCB016060,
+0xD6612600, 0xE101D45D, 0x2612E001, 0x8142000B,
+0xE000000B, 0xE501D158, 0x45188513, 0x3453640D,
+0x8D056603, 0xD25AE000, 0xE001D557, 0x25022260,
+0x0009000B, 0xD1504F22, 0x650D8513, 0x44196453,
+0x672E6249, 0x602C227D, 0x89098801, 0x890C8802,
+0x89108803, 0x89268806, 0x89298807, 0x0009A038,
+0xD64DD54C, 0xA027E212, 0x625C2652, 0x8B2F2228,
+0xA01ED64A, 0x605C6262, 0x89052008, 0x89088810,
+0x890B8820, 0x0009A024, 0xD643D445, 0xA013E204,
+0xD7442642, 0xE20CD640, 0x2672A00E, 0xD63ED542,
+0xA009E218, 0xD4412652, 0xE20AD63B, 0x2642A004,
+0xD639D23F, 0xE22E2622, 0xD43E8515, 0x3277670D,
+0x8F012421, 0x24516503, 0x0009B0DF, 0xE001A001,
+0x4F26E000, 0x0009000B, 0xE101D629, 0x2610D436,
+0xD7286541, 0x655DD128, 0xE001E20F, 0x26202752,
+0x2102000B, 0x4F222FE6, 0x8523D21F, 0x2448640C,
+0xD62D8B08, 0xE200D521, 0x84512621, 0x20499430,
+0x8051A026, 0x60E0DE1D, 0x8D0BC840, 0x3427E201,
+0xD1258922, 0x420BD225, 0xD5252141, 0xCB046052,
+0x2502A00B, 0x89173427, 0xD722D21F, 0x2241470B,
+0xE5FBD61F, 0x21596162, 0x84E12612, 0xB12DCB80,
+0x60E080E1, 0xCB04D61C, 0x60602E00, 0x2600C93F,
+0xE001D609, 0x2602A001, 0x4F26E000, 0x6EF6000B,
+0x0000FF7F, 0x002028D9, 0x002028A0, 0x002028AC,
+0x001E1100, 0x001E100C, 0x002028D0, 0x001E1000,
+0x001E1001, 0x00202A90, 0x002028B4, 0x002028BC,
+0x00202AFE, 0x00202B02, 0x00202B0E, 0x00202B26,
+0x00202B30, 0x002028B8, 0x002028C6, 0x00201A32,
+0x001E1108, 0x00201B3E, 0x001E1015, 0x6060D696,
+0x8919C880, 0x6021D295, 0x8B158801, 0xE501D294,
+0x30568524, 0xD1938910, 0xD493E203, 0x65412120,
+0x655DE00B, 0xD5910656, 0xE702E40F, 0x25712140,
+0xE001D78F, 0x2702000B, 0xE000000B, 0x4F222FE6,
+0x84E1DE8C, 0x8934C880, 0x8554D585, 0x8F302008,
+0xD7896103, 0x66728553, 0x650C6403, 0x620C8566,
+0x8B263520, 0xD780D685, 0x644C651C, 0x27412651,
+0xC84060E0, 0xD2828907, 0x0009420B, 0x6062D681,
+0xA008CB04, 0xD1802602, 0x0009410B, 0xE5FBD67D,
+0x24596462, 0xB0A12642, 0xD5750009, 0x2522E201,
+0xD77A60E0, 0x2E00CB04, 0xC93F6070, 0xA0012700,
+0xE0006023, 0x000B4F26, 0x2FA66EF6, 0x2FC62FB6,
+0x2FE62FD6, 0xE240DA69, 0xDC6666A1, 0x3123616D,
+0x62638900, 0x6ED36D2C, 0x4E2136D8, 0x4E212A61,
+0xDB6CD46B, 0xE700A00F, 0x770166B2, 0x71026163,
+0x65612B12, 0x71026613, 0x62612B12, 0x622D655D,
+0x325C4228, 0x627C2422, 0x8BED32E3, 0xC90360D3,
+0x8B108803, 0xED076EB2, 0x710261E3, 0x67132B12,
+0x62E17102, 0x65712B12, 0x655D622D, 0x352C4528,
+0xA00C2CD0, 0x88022452, 0xA0038B01, 0x8801E203,
+0xE2018B05, 0x66B22C20, 0x677D6761, 0xEB0F2472,
+0x6DA12CB0, 0x8B052DD8, 0xD445D24F, 0xE101EE00,
+0x241222E2, 0x6DF66EF6, 0x6BF66CF6, 0x6AF6000B,
+0x2FE62FD6, 0xE240DD3D, 0x616D66D1, 0x89003123,
+0x672C6263, 0xDE433678, 0x2D617703, 0xD6404721,
+0x472164E2, 0xE100A00E, 0x71016562, 0x24506253,
+0x42197401, 0x74012420, 0x24504529, 0x45197401,
+0x74012450, 0x3273621C, 0x42008BEE, 0x64D166E2,
+0x362C4200, 0x8F062448, 0xDD332E62, 0xE500DE28,
+0x2D52E701, 0x6EF62E72, 0x6DF6000B, 0x2FE62FD6,
+0xEE014F22, 0xED0AA005, 0x64E3BCB6, 0x64E3BCBC,
+0x62EC7E01, 0x8BF732D7, 0xEE01A005, 0x64E3BCBD,
+0x64E3BCC3, 0x62EC7E01, 0x8BF732D7, 0x6EF64F26,
+0x6DF6000B, 0x2FE62FD6, 0x7FFC4F22, 0x6060D61F,
+0x89758801, 0xE101D41E, 0xD7128548, 0x650D2610,
+0x45196070, 0x6659DD1B, 0x61D3626E, 0xC840262D,
+0x74027102, 0x8D47D718, 0xD218666C, 0xE501DE0A,
+0xA0312E22, 0x0000EE04, 0x001E1001, 0x002028C6,
+0x002028A0, 0x001E1100, 0x002028CA, 0x002028B8,
+0x002028D0, 0x001E1000, 0x002028BC, 0x002028C8,
+0x00201A32, 0x001E1108, 0x00201B3E, 0x001E1015,
+0x001E100C, 0x002028B4, 0x002028D4, 0x002028D8,
+0x00202A90, 0x00202B26, 0x00202B32, 0x00202AA2,
+0x75016245, 0x71022121, 0x32E3625C, 0x60638BF8,
+0xE60181D4, 0xE417D538, 0x3243626C, 0x6255891E,
+0x27217601, 0x7702AFF8, 0xDE35D234, 0x2E22E501,
+0xEE04A004, 0x75016245, 0x71022121, 0x32E3625C,
+0x60638BF8, 0xE60181D4, 0xA004D52E, 0x6255E417,
+0x27217601, 0x626C7702, 0x8BF83243, 0x2D21924B,
+0xD72AD429, 0x2F126142, 0x6DF265F2, 0xC9806053,
+0x60532700, 0x6103C960, 0x60538071, 0x65F26EF2,
+0x4D19C903, 0x80724529, 0x451960DC, 0x4E298172,
+0x62EC605C, 0x302C4018, 0x6D428173, 0x2FD22118,
+0x62F26EF2, 0x421966F2, 0x656C4629, 0x602C66F2,
+0x401864EC, 0x304C4629, 0x81744619, 0x4018606C,
+0x8F07305C, 0xBCB58175, 0x620C0009, 0x89082228,
+0x0009A00A, 0x88406013, 0xB00A8B03, 0xA0030009,
+0xD60B0009, 0x2622E202, 0x4F267F04, 0x000B6EF6,
+0x000B6DF6, 0x060A0009, 0x00202AD2, 0x00202AD0,
+0x002028BC, 0x00202AA4, 0x001E100C, 0x002028A0,
+0x002028D0, 0x7FFC4F22, 0x6620D27E, 0x8D082668,
+0xD47D2F60, 0x420BD27D, 0x64F00009, 0xA0907F04,
+0x7F044F26, 0x000B4F26, 0x000B0009, 0x2FE60009,
+0xDE774F22, 0x60E0D677, 0xCBC0D477, 0x62602E00,
+0xC803602C, 0x40218904, 0x70014021, 0x6603A002,
+0x66034009, 0xD671616D, 0xE500A004, 0x75016262,
+0x74042422, 0x3213625D, 0xD16D8BF8, 0x0009410B,
+0xE401D66C, 0x84E22641, 0x80E2C9BF, 0x000B4F26,
+0x2FE66EF6, 0xD5687FFC, 0x6250DE61, 0x642C84E2,
+0xCB407404, 0x80E2614D, 0x44216413, 0xD7634421,
+0xE600A004, 0x76016256, 0x27222F22, 0x3243626D,
+0x60138BF8, 0x2008C903, 0x88038912, 0x88028905,
+0x88018906, 0xA0088907, 0xE0070009, 0x8078A005,
+0xA002E003, 0xE0018078, 0x62528078, 0x27222F22,
+0xD650E00F, 0x60618078, 0x8B018801, 0x2621E200,
+0x6060D64F, 0x2600CB08, 0xC93F60E0, 0x7F042E00,
+0x6EF6000B, 0x6021D247, 0x8D188801, 0xD2466143,
+0x22106053, 0x60638021, 0xD4468121, 0xE500A007,
+0x027C605D, 0x364C6603, 0x26207001, 0x625D6503,
+0x3213611C, 0xD6408BF4, 0xC9BF6060, 0x000B2600,
+0x2FD60009, 0x4F222FE6, 0x60437FFC, 0x8D02C820,
+0xBF6A6E43, 0x60E30009, 0x8901C810, 0x0009BF67,
+0xC84060E3, 0xBF8C8901, 0x60E30009, 0x8929C801,
+0x60D0DD32, 0x8D03C802, 0xD6312F00, 0x0009460B,
+0xC80460F0, 0xD62F8902, 0x0009460B, 0x602362F0,
+0x8902C880, 0xC97F60D0, 0x60232D00, 0x8902C801,
+0x420BD229, 0xD5290009, 0x88026052, 0xD2288B03,
+0xA005E604, 0x88012260, 0xD2258B02, 0x2260E601,
+0x2522E200, 0xC88060E3, 0xD2228916, 0x60E36E20,
+0x8902C802, 0x420BD220, 0x60E30009, 0x8902C804,
+0x420BD21E, 0x60E30009, 0x8905C808, 0x7F04D21C,
+0x6EF64F26, 0x6DF6422B, 0x4F267F04, 0x000B6EF6,
+0x00006DF6, 0x001E1020, 0x0020296C, 0x00200DA6,
+0x001E1015, 0x001E10BF, 0x00117D00, 0x001E10FC,
+0x002000F8, 0x002028CC, 0x00117D80, 0x001E10F8,
+0x001E10AE, 0x00117D84, 0x001E1017, 0x001E1021,
+0x00200FD8, 0x00200FFA, 0x00201584, 0x002028D0,
+0x001E100B, 0x001E1028, 0x0020102A, 0x0020103C,
+0x00201048, 0xD6A8644C, 0x346C74FF, 0x2450000B,
+0x644CD6A6, 0x000B346C, 0xD6A52450, 0x346C644C,
+0x2450000B, 0x616D625C, 0x41194208, 0x60194208,
+0x644C4200, 0x324C670E, 0x207DD19E, 0xC90F4200,
+0x000B321C, 0x67632200, 0x4208625C, 0x42004208,
+0x324C644C, 0x4200D198, 0x000B321C, 0x2FE62270,
+0x614C4F12, 0x4100D493, 0x6710314C, 0x2729E29F,
+0x65736E53, 0x4719676D, 0x672E6279, 0x4221227D,
+0x42214221, 0x7601662C, 0xE4014608, 0x34E84608,
+0x644C4600, 0x0E1A0467, 0x215025EB, 0x000B4F16,
+0x4F226EF6, 0xD2857FE8, 0x88016021, 0xD2848B7B,
+0x26686621, 0xD2838B77, 0x26686621, 0xE50F8B73,
+0xE401BFA0, 0xBFA3E501, 0xE586E400, 0xE400655C,
+0x2F50BFA3, 0xBFA0E401, 0xE602E506, 0x60634618,
+0x81F2E401, 0x6543BF9E, 0xE40185F2, 0xBFAA6543,
+0x85F26603, 0x6543E401, 0x6603BFB1, 0xE40265F0,
+0x6053756C, 0x80F8BF7E, 0xBF81E402, 0x84F8E512,
+0x7090E402, 0x6503BF81, 0x4618E602, 0x81F66063,
+0xBF7FE402, 0x85F6E500, 0x6603E402, 0xE500BF8B,
+0xE40285F6, 0xBF926603, 0xE5FEE500, 0xE010655C,
+0xBF5FE403, 0xE5130F54, 0xE40EBF62, 0x05FCE010,
+0xBF62E40E, 0xE5007585, 0xBF63E403, 0xE500E640,
+0xBF70E403, 0xE500E640, 0xBF78E403, 0xE5FFE640,
+0xE014655C, 0xBF45E404, 0xE40F0F54, 0xE504BF48,
+0x05FCE014, 0xBF48E40F, 0xE5017584, 0xBF49E640,
+0xE501E404, 0xBF56E640, 0xE501E404, 0xE404E640,
+0xAF5C7F18, 0x7F184F26, 0x000B4F26, 0x4F220009,
+0xD2427FF0, 0x88016021, 0xD2418B71, 0x26686621,
+0xD2408B6D, 0x26686621, 0xE50F8B69, 0xE401BF1A,
+0xBF1DE501, 0xE586E400, 0xE400655C, 0x2F50BF1D,
+0xBF1AE401, 0xE401E506, 0xBF1B6543, 0xE401E640,
+0xBF286543, 0xE401E640, 0xBF306543, 0x65F0E640,
+0x756CE402, 0xBEFD6053, 0xE40280F4, 0xE512BF00,
+0xE40284F4, 0xBF007090, 0xE6406503, 0xBF01E402,
+0xE640E500, 0xBF0EE402, 0xE640E500, 0xBF16E402,
+0xE5FEE500, 0x6053655C, 0xBEE3E403, 0xE51380F8,
+0xE40EBEE6, 0xE40E84F8, 0xBEE67085, 0xE5006503,
+0xBEE7E640, 0xE500E403, 0xBEF4E640, 0xE500E403,
+0xBEFCE640, 0xE5FFE403, 0x6053655C, 0xBEC9E404,
+0xE40F80FC, 0xE504BECC, 0xE40F84FC, 0xBECC7083,
+0xE5016503, 0xBECDE640, 0xE501E404, 0xBEDAE640,
+0xE501E404, 0xE404E640, 0xAEE07F10, 0x7F104F26,
+0x000B4F26, 0x00000009, 0x001E1030, 0x001E1080,
+0x001E1090, 0x001E103F, 0x001E103E, 0x002028C6,
+0x002028C8, 0x002028CA, 0x0009000B, 0x666CE680,
+0x6563D2A8, 0x7540E700, 0x6473422B, 0x2FB62FA6,
+0x2FD62FC6, 0x4F222FE6, 0x4C18EC01, 0xDAA3DBA2,
+0x65B252B1, 0x89223520, 0xC9036051, 0x891E8801,
+0xD19FDE9D, 0x64E3410B, 0x85036503, 0x670D66A2,
+0xDD9C3762, 0xD49C890A, 0x420BD29C, 0xD19C0009,
+0xE701D49C, 0x21724D0B, 0x0009AFE2, 0x420BD29A,
+0xD69A64E3, 0x4D0BD49A, 0xAFD926C2, 0x4F260009,
+0x6DF66EF6, 0x6BF66CF6, 0x6AF6000B, 0x7FF44F22,
+0xE6818546, 0x85472F01, 0x81F1666C, 0xD2858548,
+0x854281F2, 0x81F367F3, 0xE40C8543, 0x605381F4,
+0x81F56563, 0x7540420B, 0x4F267F0C, 0x0009000B,
+0x2F962F86, 0x2FB62FA6, 0x2FD62FC6, 0x4F222FE6,
+0xDC847FF0, 0xE800A0DD, 0xD2836B13, 0xE0014B08,
+0x4B00420B, 0x1F03DE81, 0x3BEC85F2, 0x2F827E30,
+0x1FE26803, 0x66C2DD7E, 0x362052C1, 0xA0C38B01,
+0x60610009, 0x8801C903, 0xA0BD8B01, 0x85610009,
+0x8965C801, 0xEE105163, 0xDA6A8512, 0xC9036603,
+0x85136403, 0x4021600D, 0xC93F4021, 0x8D1C30E3,
+0xD7706503, 0x62704408, 0x44004408, 0x22284500,
+0x345C8F0A, 0x6043D26C, 0x697D072D, 0x68994919,
+0x697C6E8E, 0x28EDA009, 0x6043D268, 0x697D072D,
+0x68994919, 0x697C6E8E, 0xEEFF28ED, 0x6EEC629D,
+0x8B0F32E0, 0x410BD152, 0x540364C3, 0xBF85E502,
+0xD45F6E03, 0x460BD654, 0xD75E65E3, 0xD45EEE01,
+0x27E2A01D, 0x26E9EEFC, 0x81126063, 0x97888513,
+0x20794208, 0x85128113, 0x8112208B, 0x202B8513,
+0x85148113, 0x4218E208, 0x8114202B, 0x854164C2,
+0x814120E9, 0xD45165C2, 0xCB016051, 0x4A0B2501,
+0x60C20009, 0x52F356F2, 0x2B02CB01, 0x2622AF8B,
+0xD2378561, 0x8D2EC802, 0x420B64C3, 0xD6480009,
+0x5E036503, 0x076EE04C, 0x7701D146, 0x60120676,
+0x8B058801, 0xEA0C85E1, 0x20AB4A18, 0x81E1A007,
+0x88026012, 0x85E18B03, 0x20A9EADF, 0x855181E1,
+0x20A9EAFC, 0x60518151, 0xCB01DA28, 0x4A0B64C3,
+0x56F22501, 0xD73851F3, 0x85EF2612, 0x470B64D3,
+0xAF58650D, 0x420B0009, 0x54030009, 0x85446E03,
+0x4A18EA08, 0x30A020A9, 0x8B03DA1A, 0xE501BF16,
+0x0009A007, 0xD62D8541, 0x2268620D, 0xBF0D8901,
+0xD423E500, 0x420BD218, 0xD72265E3, 0xEE01D428,
+0x27E24A0B, 0x0009AF37, 0x68F26083, 0x780181F2,
+0x618D7C08, 0x31E7EE03, 0xAF1D8901, 0x7F100009,
+0x6EF64F26, 0x6CF66DF6, 0x6AF66BF6, 0x000B69F6,
+0xFE0368F6, 0x00201834, 0x00202884, 0x0020288C,
+0x00200A5C, 0x00200DA6, 0x00202854, 0x00200ADE,
+0x001E2130, 0x00202A70, 0x00200A7A, 0x001C3D30,
+0x00202A74, 0x00202864, 0x00201FD4, 0x001C3D00,
+0x00202A80, 0x00202A8C, 0x00202970, 0x002029F0,
+0x0020285C, 0x001E212C, 0x00202A78, 0x00202A7C,
+0x002027F8, 0x002027F4, 0x00200E06, 0x00008000,
+0x00202A88, 0x4F222FE6, 0x6E22D20D, 0xC84060E3,
+0x22E28D02, 0x0009BE68, 0x4218E240, 0x89012E28,
+0x0009BE64, 0xC80560E3, 0xBEB98901, 0x60E30009,
+0x8902C802, 0xAE614F26, 0x4F266EF6, 0x6EF6000B,
+0x001C3510, 0x080A0C0E, 0x00020406, 0x1A1C1E20,
+0x12141618, 0x2E303234, 0x26282A2C, 0x3A3C3E40,
+0x6C625648, 0x41112F26, 0xE2208F18, 0x890B3123,
+0x321CD204, 0xD1026220, 0x412B312C, 0x00090009,
+0x00201FFE, 0x00201FB4, 0x000BE000, 0x400062F6,
+0x40004000, 0x40004000, 0x40004000, 0x62F6000B,
+0x40004000, 0x40004000, 0x40004000, 0x40184000,
+0x62F6000B, 0x40004000, 0x40004000, 0x40004000,
+0x40284000, 0x62F6000B, 0x40004000, 0x40184000,
+0x000B4028, 0xC90F62F6, 0x40054005, 0x40054005,
+0x62F6000B, 0x4005C907, 0x40054005, 0x62F6000B,
+0x4005C903, 0x000B4005, 0xC90162F6, 0x000B4005,
+0x000062F6, 0x080A0C0E, 0x00020406, 0x1A1C1E20,
+0x12141618, 0x2E303234, 0x26282A2C, 0x3A3C3E40,
+0x6C625648, 0x41112F26, 0xE2208F18, 0x890B3123,
+0x321CD204, 0xD1026220, 0x412B312C, 0x00090009,
+0x002020BE, 0x00202074, 0x000BE000, 0x400162F6,
+0x40014001, 0x40014001, 0x40014001, 0x62F6000B,
+0x40014001, 0x40014001, 0x40014001, 0x40194001,
+0x62F6000B, 0x40014001, 0x40014001, 0x40014001,
+0x40294001, 0x62F6000B, 0x40014001, 0x40194001,
+0x000B4029, 0x400462F6, 0x40044004, 0xC90F4004,
+0x62F6000B, 0x40044004, 0xC9074004, 0x62F6000B,
+0x40044004, 0x000BC903, 0x400462F6, 0x000BC901,
+0x000062F6, 0x3622E218, 0x67438F12, 0x0009A004,
+0x76FF6254, 0x74012420, 0xC8036053, 0x60438BF8,
+0x8902C803, 0x422BD22B, 0xD22B0009, 0x0009422B,
+0x2FE66473, 0x8D4A3450, 0x27786763, 0x62438947,
+0x227B225B, 0xC9016023, 0x8D203452, 0x2EE86E03,
+0x60238B15, 0x8B08C803, 0x47096643, 0x47106256,
+0x8FFB2622, 0xA0327604, 0x47010009, 0x61436673,
+0x46106255, 0x8FFB2121, 0xA0287102, 0x66430009,
+0x47106254, 0x8FFB2620, 0xA0207601, 0x61430009,
+0x2EE8357C, 0x8F15317C, 0x60236653, 0x8B07C803,
+0x76FC4709, 0x47106262, 0x21268FFB, 0x0009A00F,
+0x65634701, 0x75FE6673, 0x46106251, 0x21258FFB,
+0x0009A005, 0x626076FF, 0x8FFB4710, 0x60432124,
+0x6EF6000B, 0x002022A6, 0x00202752, 0xE21E2FE6,
+0x67633626, 0x8D1B6153, 0x3E106E43, 0x3E128916,
+0x65E38908, 0x3672E600, 0x62148910, 0x25207601,
+0x7501AFF9, 0x317C64E3, 0x6513347C, 0xE600A004,
+0x625075FF, 0x24247601, 0x8BF93672, 0x60E3A011,
+0x890831E2, 0x327C6213, 0x8B0432E6, 0x651364E3,
+0xA0086673, 0xD28F6EF6, 0x651364E3, 0x422B6673,
+0x000B6EF6, 0xE2046EF6, 0x67433622, 0x8F10356C,
+0xA004346C, 0x75FF0009, 0x76FF6250, 0x60532424,
+0x8BF8C803, 0xC8036043, 0xA1058901, 0xA2770009,
+0xA2990009, 0x2FB60009, 0x2FD62FC6, 0x7FE42FE6,
+0x6C636043, 0x66521F62, 0xC9037504, 0x1F516E53,
+0x45086503, 0xE1FC6D43, 0x2D194500, 0x1F732558,
+0x1F651F44, 0x2FD28D0B, 0x88086053, 0x88108923,
+0x8818895B, 0xA0898B01, 0xA0BD0009, 0x62630009,
+0x2D22E600, 0x7CFC7D04, 0xEB10A00D, 0xE60064E6,
+0x7CF065E6, 0x62E261E6, 0x1D512D42, 0x1D231D12,
+0x7E047D10, 0x3CB21FE1, 0x1F6589F0, 0x2FD21FC2,
+0xA0A11FE6, 0x64D21FD4, 0x44286263, 0x44294418,
+0x42184419, 0x4629242B, 0x2D424619, 0x65637D04,
+0xA0217CFD, 0x67E6EB10, 0x62E67CF0, 0x64E66673,
+0x256B4618, 0x2D5261E2, 0x65234729, 0x45184719,
+0x4229275B, 0x42191D71, 0x47186743, 0x4429227B,
+0x44196713, 0x247B4718, 0x1D431D22, 0x41194129,
+0x65137D10, 0x1FE17E04, 0x89DC3CB2, 0x1FE67EFF,
+0x1FC21F55, 0xA0672FD2, 0x6CF21FD4, 0x66C257F5,
+0x46286273, 0x42284629, 0x2C62262B, 0x7C045DF2,
+0x7DFE4729, 0xA01CEB10, 0x65E65EF1, 0x66E66273,
+0x47286753, 0x6763227B, 0x452961E6, 0x257B4728,
+0x2C2264E6, 0x65131C51, 0x45284629, 0x1C62265B,
+0x41296643, 0x216B4628, 0x44291C13, 0x67437C10,
+0x3DB27DF0, 0x1FD289E1, 0x7EFEA034, 0x51F56CF2,
+0x621366C2, 0x42284618, 0x42184619, 0x2C62262B,
+0x7C045DF2, 0x7DFF4119, 0xA01FEB10, 0x65E65EF1,
+0x64E67DF0, 0x42286253, 0x421867E6, 0x66E6212B,
+0x61432C12, 0x45194128, 0x251B4118, 0x65731C51,
+0x44194528, 0x245B4518, 0x64631C42, 0x47194428,
+0x274B4418, 0x46191C73, 0x61637C10, 0x89DE3DB2,
+0x7EFD1FD2, 0x1FC41FE6, 0x5DF2E704, 0xA00D5EF6,
+0x62E451F4, 0x66E47DFC, 0x65E464E4, 0x71012120,
+0x71012160, 0x71012140, 0x71012150, 0x89F03D72,
+0x66D357F3, 0x641365E3, 0x6EF67F1C, 0x6CF66DF6,
+0x6BF6A190, 0x00202134, 0x2FC62FB6, 0x2FE62FD6,
+0x60437FE4, 0x6C63C903, 0x66031F62, 0x460875FC,
+0x61526E43, 0x4600E2FC, 0x26682E29, 0x1F441F73,
+0x1F516D53, 0x8D0B1F15, 0x60632FE2, 0x891F8808,
+0x89538810, 0x8B018818, 0x0009A081, 0x0009A0B9,
+0xEB10A00D, 0x52D37DF0, 0x54D156D2, 0x2E1665D2,
+0x2E662E26, 0x2E427EFC, 0x1FD16153, 0x3CB27CF0,
+0x7D0489F0, 0x1F151FD6, 0x2FE21FC2, 0x1FE4A0A1,
+0x621366E2, 0x42294619, 0x42194618, 0x2E62262B,
+0x7CFF4118, 0xEB10A021, 0x54D37DF0, 0x624357D2,
+0x42194229, 0x55D1212B, 0x2E1666D2, 0x41296173,
+0x41194418, 0x2E46241B, 0x44296453, 0x44194718,
+0x2E76274B, 0x47296763, 0x47194518, 0x257B7EFC,
+0x46182E52, 0x1FD16163, 0x3CB27CF0, 0x7D0389DC,
+0x1F151FD6, 0x2FE21FC2, 0x1FE4A06B, 0x57F56EF2,
+0x627366E2, 0x46284629, 0x262B4229, 0x2E625CF2,
+0x7CFE4728, 0xA01BEB10, 0x7DF05DF1, 0x55D251D3,
+0x46296613, 0x54D1276B, 0x2E7662D2, 0x41286753,
+0x217B4729, 0x61432E16, 0x41294528, 0x2E56251B,
+0x44286523, 0x245B4529, 0x42282E46, 0x7CF06723,
+0x89E23CB2, 0x1FD67D02, 0xA03A1FC2, 0x67F21FE4,
+0x657251F5, 0x45296213, 0x45284519, 0x42194518,
+0x5CF2252B, 0x41282752, 0x7CFD4118, 0xA022EB10,
+0x7DF05DF1, 0x54D256D3, 0x45196563, 0x52D14628,
+0x4618215B, 0x6ED26543, 0x45192716, 0x265B4428,
+0x65436163, 0x45186423, 0x42284419, 0x4218254B,
+0x271664E3, 0x44196623, 0x264B2756, 0x4E282766,
+0x61E34E18, 0x3CB27CF0, 0x7D0189DB, 0x1FC21FD6,
+0xE7041F74, 0x51F45DF2, 0x5EF6A00D, 0x84E27EFC,
+0x620364E0, 0x7DFC84E1, 0x84E36503, 0x21646603,
+0x21542124, 0x3D722144, 0x57F389F0, 0x641366D3,
+0x7F1C65E3, 0x6DF66EF6, 0xA09D6CF6, 0x2F866BF6,
+0x2FA62F96, 0x2FC62FB6, 0x2FE62FD6, 0x614374E0,
+0x6A636873, 0x6B56E920, 0x6C567AE0, 0x6D567120,
+0x6E563A92, 0x64566756, 0x62566656, 0x11C121B2,
+0x11E311D2, 0x11451174, 0x8DEC1166, 0x71201127,
+0x6613A004, 0x7AFF6254, 0x76012620, 0x8BF92AA8,
+0x6EF66083, 0x6CF66DF6, 0x6AF66BF6, 0x000B69F6,
+0x2F8668F6, 0x2FA62F96, 0x2FC62FB6, 0x2FE62FD6,
+0x6A636873, 0x75E0E920, 0x56565257, 0x57545155,
+0x5D525E53, 0x6B525C51, 0x24662426, 0x24762416,
+0x7AE024E6, 0x24C624D6, 0x8DEC3A92, 0x66A324B6,
+0x6EF66783, 0x6CF66DF6, 0x6AF66BF6, 0xA04369F6,
+0x2FE668F6, 0xC8046063, 0x8D046E63, 0x62166153,
+0x24227EFC, 0x60E37404, 0x8908C818, 0x71046513,
+0x62526616, 0x24227EF8, 0xAFF41461, 0xE2047408,
+0x65133E22, 0x66E38D02, 0x6EF6A01C, 0x6EF6AF87,
+0xC8046063, 0x61638D04, 0x625275FC, 0x242671FC,
+0xC8186013, 0x75F88906, 0x66525251, 0x24662426,
+0x71F8AFF6, 0x3122E204, 0x66138F02, 0x0009AFA1,
+0x0009A00A, 0x0009A004, 0x76FF6254, 0x74012420,
+0x8BF92668, 0x6073000B, 0x0009A004, 0x625075FF,
+0x242476FF, 0x8BF92668, 0x6073000B, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x544F0D0A,
+0x46205355, 0x00003A57, 0x2072614D, 0x32203232,
+0x20373030, 0x353A3431, 0x33353A34, 0x00000000,
+0x00000D0A, 0x00000043, 0x61766E49, 0x2064696C,
+0x72657375, 0x20726F20, 0x2079656B, 0x00214449,
+0x6E6B6E55, 0x206E776F, 0x6D6D6F63, 0x3D646E61,
+0x00000000, 0x61437748, 0x7262696C, 0x6F697461,
+0x6620206E, 0x0A6C6961, 0x0000000D, 0x73696F4E,
+0x61432065, 0x7262696C, 0x6F697461, 0x6166206E,
+0x21216C69, 0x00000D0A, 0x00000D0A, 0x00000042,
+0x000000FF, 0x00020001, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x010E010D, 0x00020003, 0x01090108, 0x0002010A,
+0x00030002, 0x02020201, 0x02040203, 0x02060205,
+0x02080207, 0x020A0209, 0x020C020B, 0x020E020D,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x010E010D, 0x00FF010F, 0x01090108, 0x010B010A,
+0x00030002, 0x02020201, 0x02040203, 0x02060205,
+0x02080207, 0x020A0209, 0x020C020B, 0x020E020D,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00000072, 0x00205220, 0x00000046, 0x00000059,
+0x73204142, 0x003D7165, 0x00000074, 0x00000000,
+0x02000112, 0x40FFFFFF, 0x12210ACE, 0x20104890,
+0x02090100, 0x0101002E, 0x09FA8000, 0x04000004,
+0x000000FF, 0x02010507, 0x07000200, 0x00028205,
+0x05070002, 0x00400383, 0x04050701, 0x01004003,
+0x002E0209, 0x80000101, 0x000409FA, 0x00FF0400,
+0x05070000, 0x00400201, 0x82050700, 0x00004002,
+0x03830507, 0x07010040, 0x40030405, 0x03040100,
+0x030C0409, 0x0079005A, 0x00410044, 0x03180053,
+0x00530055, 0x00320042, 0x0030002E, 0x00570020,
+0x0041004C, 0x0000004E, 0x00000000, 0x00000000,
+0x00000709, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
+
+const u32_t zcFwImageSize=11104;
diff --git a/drivers/staging/otus/hal/hpfwu_txstream.c b/drivers/staging/otus/hal/hpfwu_txstream.c
new file mode 100644
index 00000000000..2b77cbacc6d
--- /dev/null
+++ b/drivers/staging/otus/hal/hpfwu_txstream.c
@@ -0,0 +1,1017 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include "cprecomp.h"
+
+const u32_t zcFwImage[] = {
+0x0009000B, 0x4F222FE6, 0xDE947FFC, 0xE114D594,
+0x1E13D494, 0x67521E4C, 0xD494D693, 0x37402769,
+0x62528F06, 0x7201D692, 0x60602522, 0x2600C93F,
+0xD7906152, 0x2512611D, 0x264B6652, 0x2562470B,
+0x0009B017, 0xE60095AC, 0xC84060E2, 0x2F028F03,
+0x8FF93652, 0xD4887601, 0x4E0BDE88, 0xD4880009,
+0x00094E0B, 0x4E0BD487, 0x7F040009, 0xA0524F26,
+0x4F226EF6, 0x410BD184, 0xD4840009, 0x0009440B,
+0x450BD583, 0xD7830009, 0xD283E1FF, 0x2712611D,
+0xD4825029, 0xE1FFCB01, 0x1209E501, 0x12112212,
+0xE7202452, 0x4718D57E, 0x2572D27E, 0xD17EE700,
+0xD67FD47E, 0xE2012270, 0x24702172, 0xD67D2620,
+0x2641E4FF, 0xD57CE600, 0x666DE104, 0x76016063,
+0x4000626D, 0x8FF83212, 0xD5780545, 0x2520E201,
+0xD278D777, 0xE480E100, 0x22122710, 0x6613D576,
+0x666D644C, 0x76046763, 0x375C626D, 0x8FF83243,
+0xD5722712, 0xD273D772, 0xE400E101, 0x27102511,
+0x000B4F26, 0x7FCC2242, 0xD170D56F, 0xD271DB70,
+0x1F51D471, 0xD6717508, 0x1F12D771, 0x1F55710C,
+0x1FB975FC, 0x72041F2A, 0x1F13EB10, 0x1F561F44,
+0x1F781F67, 0xD86B1F2B, 0xDD6CD96B, 0xDC6CEA00,
+0xD26DDE6C, 0x89003A22, 0xD15D7A01, 0x88016010,
+0x56F88B03, 0x4218E201, 0xD1682622, 0x0009410B,
+0x440BD467, 0xD5670009, 0x0009450B, 0x6010D150,
+0x8B108801, 0xE650D14F, 0x46186212, 0x8B083266,
+0x56F9D14B, 0x2120E200, 0xCB016062, 0x2602A003,
+0x72012710, 0x60822122, 0x89098801, 0xE2C8D15A,
+0x622C6612, 0x89033626, 0x6010D158, 0x8BC88801,
+0x51F66792, 0x217252F5, 0xD6555191, 0x55FA2212,
+0x52FB6462, 0x55612542, 0x2252E400, 0x61436643,
+0x05DE6013, 0x36CC4608, 0x07DE2652, 0xC9036071,
+0x8B028801, 0x720162E2, 0x74012E22, 0x36B3664C,
+0x71048FEE, 0x66C2D147, 0x45286512, 0x265B4518,
+0x60822C62, 0x89018801, 0x0009A168, 0x6272D742,
+0x8B132228, 0xD42BD741, 0x6772D541, 0x51536242,
+0x312C327C, 0x24222228, 0x15138D05, 0x6262D63D,
+0xB1627201, 0xD6232622, 0x2622E200, 0x52916692,
+0x8B013620, 0x0009A144, 0x6061A06E, 0x001C001C,
+0x001D4020, 0x0000B38E, 0xFFFF0000, 0x12340000,
+0x001E1015, 0x00201274, 0x002039F4, 0x002018A2,
+0x00203A00, 0x00203A18, 0x00201860, 0x0020196C,
+0x00201288, 0x001C3510, 0x001C3624, 0x001E212C,
+0x002038F4, 0x0020348C, 0x002038FC, 0x00203908,
+0x00203914, 0x00203970, 0x00203974, 0x0020391C,
+0x0020391D, 0x00203920, 0x00117700, 0x0020398C,
+0x0020398A, 0x002034F0, 0x00117710, 0x001C3D30,
+0x001C36F8, 0x00117734, 0x001C3684, 0x001C3D00,
+0x001C1000, 0x001C1028, 0x00203504, 0x00203924,
+0x00117600, 0x00117740, 0x7FFFFFFF, 0x00201730,
+0x0020332A, 0x00202334, 0x00203DA4, 0x00203972,
+0x002034FC, 0x00203964, 0x001C3D2C, 0x001C36B0,
+0x00203494, 0x0011775C, 0x8801C90F, 0xA0CF8901,
+0xD1960009, 0x36206212, 0xD4958904, 0x2421E200,
+0x2162A0CC, 0x6211D193, 0x89012228, 0x0009A0C3,
+0xE202D78F, 0x75016571, 0x3123615D, 0x27518D02,
+0x0009A0BC, 0xD28C57F2, 0x62226072, 0x40094019,
+0xC90F4009, 0x8F19880A, 0x52F31F2C, 0x40196022,
+0x40094009, 0x8808C90F, 0xA0A78901, 0x60630009,
+0xCB0154F7, 0xD27E55F2, 0xE7012402, 0xD47FE100,
+0x22112572, 0x72016242, 0x2422A098, 0x8B3F8805,
+0x602252F3, 0x40094019, 0xC90F4009, 0x8B168802,
+0xE4FFD577, 0x644D6752, 0x8B102748, 0x6272D775,
+0x8B0C3260, 0x51F255F7, 0xD26DE701, 0x21722562,
+0xD571E100, 0x64522211, 0xA0777401, 0x52F32542,
+0x40196022, 0x40094009, 0x8805C90F, 0x31B38B6E,
+0xD26A8B6C, 0x672254F4, 0x7701D569, 0x61422272,
+0x1F1CE640, 0x46182159, 0x8B033160, 0x6262D665,
+0x26227201, 0xE200D65A, 0x2621B067, 0x0009A056,
+0x3123E220, 0x88038B52, 0x52F38B1E, 0x40196022,
+0x40094009, 0x8803C90F, 0xD25B8B16, 0x672254F4,
+0x7701D557, 0x61422272, 0x1F1CE640, 0x46182159,
+0x8B033160, 0x6262D655, 0x26227201, 0xE200D648,
+0x2621B043, 0x0009A010, 0xD452D551, 0xD2446752,
+0xE1007701, 0x25723A46, 0x22118F06, 0xEA00D64E,
+0x72016262, 0x2622B031, 0x2FB2D54C, 0x95736652,
+0xD44A5BF1, 0x36205241, 0x60618910, 0x8B01C803,
+0x2B22E201, 0x8FF54510, 0x57F15664, 0x6272E1F0,
+0x41284118, 0x2722221B, 0x6BF2A008, 0x6BF2A006,
+0xE200D62F, 0xD12F2621, 0x2121E200, 0xD13CE201,
+0x66122822, 0x8B012668, 0x0009AE2B, 0x450BD539,
+0xD1390009, 0xAE24E600, 0x2F862160, 0x2FA62F96,
+0x2FC62FB6, 0x2FE62FD6, 0x7FF44F22, 0xDE34D133,
+0x54116212, 0x1F4167E2, 0x2F22D432, 0xD5321F72,
+0xD2326743, 0x58417794, 0x69425A42, 0x5B166C72,
+0x60526D22, 0xCB20E600, 0xE5402502, 0x626D7601,
+0x8BFB3253, 0x55F162F2, 0x11512122, 0xD62855F2,
+0x14812E52, 0x249214A2, 0x27C2D426, 0x26D211B6,
+0xDA256742, 0xE801D925, 0x490B2A72, 0xE2011A8C,
+0x1A2C4218, 0x4F267F0C, 0x6DF66EF6, 0x6BF66CF6,
+0x69F66AF6, 0x68F6000B, 0x000007D1, 0x00203984,
+0x00203988, 0x0020398E, 0x001C3DC0, 0x0011772C,
+0x001C3B88, 0x0020396C, 0x0011773C, 0x00117744,
+0x0000F000, 0x00117764, 0x00117748, 0x00117768,
+0x0011776C, 0x01FFFFFF, 0x0011774C, 0x002034FC,
+0x00203DA4, 0x002024F8, 0x00203972, 0x001C3B9C,
+0x001C3D98, 0x001C3700, 0x001C3500, 0x001C5960,
+0x001C8960, 0x00203504, 0x001C3D00, 0x0020160C,
+0x2F962F86, 0x2FB62FA6, 0x2FD62FC6, 0x4F222FE6,
+0xDE957FAC, 0x61E0E014, 0x0F14D494, 0x710161E3,
+0xE0186210, 0xD2920F24, 0x0009420B, 0x450BD591,
+0x20080009, 0x8F126D03, 0xD28F1F07, 0x6720D48F,
+0x657CDD8F, 0x470BD78F, 0xD18F0009, 0x619C6910,
+0x46086613, 0x36184608, 0x3D6C4608, 0xE0181FD7,
+0xE58004FC, 0x604C66E2, 0x3050655C, 0x2D628F15,
+0x01FCE014, 0xDE85E500, 0x641CA008, 0x6753655D,
+0x607037EC, 0x39DC6953, 0x80947501, 0x3243625D,
+0xD67F8BF4, 0xA34EE200, 0x20082621, 0xE0148B13,
+0xE40001FC, 0xA009DE79, 0x644D671C, 0x35EC6543,
+0x69436652, 0x39DC6262, 0x74041921, 0x3273624D,
+0xA3388BF3, 0x88012D10, 0xE0148B17, 0xE70001FC,
+0x6D1C2D70, 0xDE6D1FD4, 0x32D3627D, 0xA32A8B01,
+0x677D0009, 0x667365E3, 0x61737504, 0x315C36EC,
+0x69126462, 0xAFEF7708, 0x88042492, 0xE0148B18,
+0xE40001FC, 0x671C2D40, 0x624DDE60, 0x8B013273,
+0x0009A311, 0x6943644D, 0x39EC62E3, 0x72046592,
+0x3D2C6D43, 0x615266D2, 0x21697408, 0x2512AFED,
+0x8B188805, 0x01FCE014, 0x2D40E400, 0xDE53671C,
+0x3273624D, 0xA2F68B01, 0x644D0009, 0x62E36943,
+0x659239EC, 0x6D437204, 0x66D23D2C, 0x74086152,
+0xAFED216B, 0x88312512, 0xD44A8B3A, 0x6146D94A,
+0x75046543, 0x67566442, 0x6E531F48, 0x65527E04,
+0x7EE462E2, 0x7E0464E2, 0x6EE21FE9, 0x5EF929E0,
+0x7E04D942, 0x1FEA60E2, 0x2900C901, 0xD9406EE2,
+0x29E04E09, 0x2F562F26, 0x56FAD93E, 0x6513490B,
+0xD13D7F08, 0xE71C6E0D, 0x1DE12D70, 0xDE3B6912,
+0x64E21D92, 0x1D43D13A, 0xD23A6512, 0x67221D54,
+0x1D75D239, 0x1D666622, 0x6262D638, 0x1D27A2AB,
+0x8B398830, 0x6596D92B, 0x67926696, 0x61967904,
+0x74E46493, 0x6E436992, 0x1F9B7E04, 0x1FEC6442,
+0xD9256EE2, 0x5EFC29E0, 0x7E04D924, 0x1FED60E2,
+0x2900C901, 0xD9226EE2, 0x29E04E09, 0x59FC7FFC,
+0xDE272F92, 0x2F164E0B, 0xD41F7F08, 0xE21C610D,
+0x1D112D20, 0xD2206442, 0xD41C1D42, 0x1D536542,
+0x6752D51B, 0xD71B1D74, 0x1D156172, 0x1D666622,
+0x6262D61A, 0x1D27A26F, 0x8B358833, 0x490BD919,
+0xA268EE00, 0x00002DE0, 0x00117800, 0x00203A1C,
+0x002018A2, 0x00202AAC, 0x0020390E, 0x00203A20,
+0x00203534, 0x002018EE, 0x0020390D, 0x00117804,
+0x0020398C, 0x00117810, 0x00203909, 0x0020390A,
+0x0020390B, 0x00200F64, 0x001C5864, 0x001C6864,
+0x001C7864, 0x001C59BC, 0x001C69BC, 0x001C79BC,
+0x00200FBC, 0x00200FB8, 0x89018828, 0x0009A0C0,
+0xE643DEB5, 0x326662E1, 0x1FEE8F02, 0x2E21E240,
+0x622D62E1, 0x8B013267, 0x0009A0AA, 0xE50185E1,
+0x8B013056, 0x0009A0A4, 0x2D10E101, 0x64E1B225,
+0xE64357FE, 0x652D6271, 0x89443567, 0x3563E640,
+0xE6008B05, 0x0F65E040, 0xA00FE11A, 0x615372C0,
+0x41214121, 0x41214121, 0x45214121, 0x45214521,
+0xC9036053, 0xE0406603, 0x71180F65, 0x2209E007,
+0x0F25E03C, 0xE044641D, 0xB2A365F3, 0xE33C0F46,
+0x853233FC, 0x620DDE95, 0x42086031, 0x6023610D,
+0x1323E944, 0x06FE4108, 0xE00F39FC, 0x13144E0B,
+0x67075D91, 0x60D32679, 0x0F6654FE, 0x51928542,
+0x600D4E0B, 0x60D3260B, 0x0F666492, 0x65F3B237,
+0x696156FE, 0xE640659D, 0x89383563, 0xD78359FE,
+0x79066591, 0xC9036053, 0x40004008, 0x61036203,
+0x0F26E050, 0x470BE0FF, 0x6C07600C, 0x6603605D,
+0x46214621, 0x46214621, 0x42006263, 0x4200326C,
+0x40214021, 0x4008C903, 0x6D2D30FC, 0xE8006A03,
+0xB25765F3, 0x6EA264D3, 0x2EC9E050, 0x66942AE2,
+0xD76E01FE, 0x606C470B, 0x2AE22E0B, 0x64D365F3,
+0x7801B1FD, 0xEE06628D, 0x8FE932E3, 0x5EFE7D01,
+0x61E1E400, 0x410085E1, 0x66E3310C, 0x760C711B,
+0xE70465F3, 0x68667401, 0x3A736A4D, 0x8FF92582,
+0x65F37504, 0x641DB1E3, 0x64E1B1A4, 0x0009A17B,
+0xD45B56F7, 0xEC01D25B, 0x26C0420B, 0x0009A173,
+0x06FCE018, 0x8829606C, 0x58F78B08, 0xE400D252,
+0x66222840, 0x646DB171, 0x0009A165, 0x666CE681,
+0x89013060, 0x0009A0AC, 0xD550D14F, 0x62126A56,
+0x212232AC, 0x54116C56, 0x34CC6253, 0x64521141,
+0x72085812, 0xD44A384C, 0x68221182, 0x5A136C42,
+0x3ACC3C8C, 0x11A324C2, 0x6C2272EC, 0x72105814,
+0x118438CC, 0x5A156822, 0x11A53A8C, 0x6A227210,
+0xD6405816, 0x118638AC, 0x52176C62, 0x112732CC,
+0x5A185861, 0x11A83A8C, 0x5C195A62, 0x11C93CAC,
+0x521A5C63, 0x112A32CC, 0x5A1B5864, 0x11AB3A8C,
+0x5C1C5A65, 0x11CC3CAC, 0x521D5C66, 0x112D32CC,
+0x5A1E5867, 0x11AE3A8C, 0x561F5A68, 0x36ACE840,
+0x116FDA2D, 0x6CA2381C, 0x7A946682, 0x286236CC,
+0x5C8162A2, 0x18C13C2C, 0x62A27A44, 0x362C5682,
+0xD6261862, 0x5A856262, 0x3A2C4229, 0x760418A5,
+0x56866262, 0x362C4229, 0x56F71866, 0x2620E238,
+0x16C15C81, 0x16226212, 0xE2005C11, 0x551216C3,
+0x55151654, 0x55131655, 0x55161656, 0x55821657,
+0x65821658, 0x55141659, 0x5584165A, 0x5583165B,
+0x5585165C, 0x5586165D, 0x1821165E, 0x11212122,
+0x11251122, 0x11261123, 0x28221822, 0x18241124,
+0x18251823, 0x1826A0C7, 0x00117804, 0x002033E8,
+0x00203A40, 0x002018A2, 0x00203494, 0x001C36A0,
+0x002034F0, 0x001C3CA0, 0x001C36F4, 0x001C3B88,
+0x666CE682, 0x8B203060, 0xEA2456F7, 0x26A0D194,
+0x16C15C17, 0x16225218, 0x16835819, 0x16A45A1A,
+0x16C55C1B, 0x1626521C, 0xE200581D, 0x551E1687,
+0x551F1658, 0x11271659, 0x11291128, 0x112B112A,
+0x112D112C, 0xA08E112E, 0xE683112F, 0x3060666C,
+0x52F78B0B, 0xEA00D883, 0x658222A0, 0x7804DC82,
+0x62822C52, 0xA07ED681, 0xE6902620, 0x3060666C,
+0xDA7F8B06, 0x00094A0B, 0xE20056F7, 0x2620A073,
+0x666CE691, 0x8B103060, 0x6222D276, 0x2228622C,
+0xD2788904, 0x0009420B, 0x0009A003, 0x420BD276,
+0x56F70009, 0xA05EE200, 0xE6922620, 0x3060666C,
+0xE0188951, 0xE6B00BFC, 0x666C62BC, 0x8B2A3260,
+0x02FCE014, 0x682CEA00, 0x62ADE904, 0x894A3283,
+0x6AADDD64, 0x3CDC6CA3, 0x7D046EC2, 0xDB68D467,
+0x32DC62A3, 0x4B0BDC67, 0x4C0B6D22, 0xD46664E3,
+0x00094B0B, 0x64D34C0B, 0x4B0BD464, 0xE6000009,
+0x666D6BE3, 0x76013B6C, 0x3293626D, 0x8FF72BD0,
+0xAFDA4D19, 0xE6B57A08, 0x3260666C, 0xD45C8B13,
+0x4B0BDB57, 0xD25B0009, 0x6022DB5B, 0xCB20E6FF,
+0x2202666D, 0xDB592B62, 0xE014E200, 0x56F72B20,
+0xA01002FC, 0xD4562620, 0x6542D256, 0x420BD456,
+0xA0080009, 0xDB520009, 0x52B1E600, 0x622CDB53,
+0x52F72B21, 0x7F542260, 0x6EF64F26, 0x6CF66DF6,
+0x6AF66BF6, 0x000B69F6, 0x4F2268F6, 0xE240614D,
+0x89143123, 0x3127E21F, 0x8B09D749, 0xD449614D,
+0xE00171E0, 0x5671440B, 0x26596507, 0x1761A007,
+0xE001D444, 0x6672440B, 0x26596507, 0x4F262762,
+0x0009000B, 0x614D4F22, 0x3123E240, 0xE21F8912,
+0xD73B3127, 0x614D8B08, 0x5671D23A, 0x420B71E0,
+0x260BE001, 0x1761A006, 0x6672D236, 0xE001420B,
+0x2762260B, 0x000B4F26, 0xE6400009, 0x46284618,
+0x6252D531, 0x89FC2268, 0x0009000B, 0x4618E680,
+0xD52D4628, 0x22686252, 0x000B89FC, 0xA0010009,
+0x7201E200, 0x8BFC3242, 0x0009000B, 0x4618E680,
+0xD5264628, 0x22686252, 0x000B8BFC, 0x2FE60009,
+0x7FFC4F22, 0xBFF16E53, 0x61E22F42, 0xE280D620,
+0x54E11615, 0x16464218, 0x422855E2, 0x57E31657,
+0x16786EF2, 0x26E22E2B, 0x4F267F04, 0x6EF6AFCE,
+0x00203494, 0x00117804, 0x002038F4, 0x00203908,
+0x0020050A, 0x00201008, 0x0020102E, 0x00203A58,
+0x002018A2, 0x002018E6, 0x00203A6C, 0x00203A74,
+0x00203A78, 0x001C3500, 0x001C1000, 0x0020398A,
+0x00117800, 0x002018EE, 0x00203A8C, 0x00203990,
+0x001C3704, 0x002033E8, 0x001C373C, 0x001C3700,
+0x001C370C, 0x2FD62FC6, 0x4F222FE6, 0x6C53DD10,
+0x6E43BFA4, 0x2DE2BF89, 0x0009BFA0, 0x2C1251D5,
+0x1C4154D6, 0x1C5255D7, 0x1C6356D8, 0x6EF64F26,
+0x000B6DF6, 0x61636CF6, 0xA004E600, 0x62564109,
+0x24227601, 0x36127404, 0x000B8BF9, 0x00000009,
+0x001C370C, 0x0009A16E, 0x2FE62FD6, 0xDD944F22,
+0xA0049EB2, 0xD4930009, 0x420BD293, 0x62D265D2,
+0x8BF822E8, 0x0009A004, 0xD28FD490, 0x55D1420B,
+0x22E852D1, 0xA0048BF8, 0xD48D0009, 0x420BD28A,
+0x52D255D2, 0x8BF822E8, 0x0009A004, 0xD286D489,
+0x55D3420B, 0x22E852D3, 0xA0048BF8, 0xD4860009,
+0x420BD281, 0x52D455D4, 0x8BF822E8, 0x6EF64F26,
+0x6DF6000B, 0x2FD62FC6, 0x4F222FE6, 0x6E636C73,
+0x6D53B01A, 0x64D357F4, 0xB05F65E3, 0xB07566C3,
+0xB0A40009, 0xB0A80009, 0xB0AC0009, 0xB0AC0009,
+0xB0AF0009, 0xB03154F5, 0x6CCD6C03, 0x4F2660C3,
+0x6DF66EF6, 0x6CF6000B, 0x3412D170, 0xD6700529,
+0x2650D770, 0x2742000B, 0x0009A018, 0x2FD62FC6,
+0x4F222FE6, 0x6E636C73, 0x6D53BFEE, 0x64D357F4,
+0xB03365E3, 0xB08D66C3, 0xB00F54F5, 0x6CCD6C03,
+0x4F2660C3, 0x6DF66EF6, 0x6CF6000B, 0xE503D162,
+0xD763D462, 0x21524518, 0x2472000B, 0xD45FD15E,
+0x2162E600, 0x2462000B, 0xBF734F22, 0xBF73E40A,
+0xD25C0009, 0x4118E104, 0xE40AE500, 0xBF692212,
+0xD7592252, 0xCB206072, 0x000B4F26, 0x4F222702,
+0x410BD156, 0xD556E400, 0x4F26452B, 0xD1552FE6,
+0x66126E63, 0x92104418, 0x44084528, 0x45002629,
+0x265B4408, 0x264B4400, 0x21624708, 0xD14E4708,
+0x217227EB, 0x6EF6000B, 0x1FFF03F0, 0x4F222FE6,
+0xE101DE4A, 0xBF3DE40A, 0x67E32E12, 0xE500776C,
+0xE204E130, 0x2752E40A, 0x27522752, 0x27522752,
+0x27522752, 0x27522752, 0x27522752, 0x27522752,
+0x27522752, 0x27522752, 0x27522752, 0x27222712,
+0x27522752, 0x27522752, 0x27522752, 0x27522752,
+0x175ABF18, 0x2E62E600, 0x000B4F26, 0xD2346EF6,
+0xE441E101, 0x000B2212, 0xD1322242, 0xE605D432,
+0x000B2162, 0x000B2462, 0xD2300009, 0xE40AE601,
+0x2262AF00, 0x2FC62FB6, 0x2FE62FD6, 0x7FFC4F22,
+0x6C43DB2B, 0xED0060B2, 0x2B02CB03, 0xC90360B2,
+0x6E03A008, 0x89073DC2, 0xE46460B2, 0xB07CC903,
+0x7D016E03, 0x8BF52EE8, 0x8F043DC2, 0xD4212FE1,
+0x460BD621, 0x62F10009, 0x6023622D, 0x89FFC801,
+0x7F046023, 0x6EF64F26, 0x6CF66DF6, 0x6BF6000B,
+0x001C3B88, 0x00203AA0, 0x002018EE, 0x00203AA8,
+0x00203AB0, 0x00203AB8, 0x00203AC0, 0x0025E720,
+0x00203DA0, 0x002038F8, 0x001C5968, 0x001C3B40,
+0x000F8000, 0x001D4004, 0x001C3500, 0x002015E0,
+0x0020160C, 0x001C5814, 0x001C59D0, 0x001C5830,
+0x001C6268, 0x001C59A4, 0x001C639C, 0x001C581C,
+0x001C5860, 0x00203AC8, 0x002018A2, 0x8F014411,
+0x6043604B, 0x0009000B, 0x5651D52B, 0x46286052,
+0x306C000B, 0x2FC62FB6, 0x2FE62FD6, 0x4F124F22,
+0xBFF14F02, 0x6B036E43, 0xDD25DC24, 0x0009BFEC,
+0x3C0530B8, 0x4609060A, 0x46014609, 0x020A3D65,
+0x42094209, 0x32E24209, 0x4F068BF0, 0x4F264F16,
+0x6DF66EF6, 0x000B6CF6, 0x2FC66BF6, 0x2FE62FD6,
+0x4F124F22, 0xBFCF4F02, 0x6C036E43, 0xBFCBDD13,
+0x30C80009, 0x060A3D05, 0x46094609, 0x36E24601,
+0x4F068BF5, 0x4F264F16, 0x6DF66EF6, 0x6CF6000B,
+0x4F222FE6, 0xE102DE0B, 0xE403E500, 0xBFB92E12,
+0xE6062E52, 0xE7004618, 0x2E62E403, 0x4F262E72,
+0x6EF6AFB0, 0x0009000B, 0x001C1040, 0xCCCCCCCD,
+0x10624DD3, 0x001D4004, 0x2F962F86, 0x2FB62FA6,
+0x2FD62FC6, 0x4F222FE6, 0xE5007F98, 0x6453E710,
+0x6B534728, 0xEE1ADCBC, 0x6153655D, 0x315C4108,
+0x75014108, 0x6043317C, 0x0F16665D, 0xED0060B3,
+0x21B136E3, 0x81128111, 0x11D28113, 0x11D411D3,
+0x74048FEA, 0xD8B167F2, 0x1871D9B1, 0x58F12872,
+0x1981D1B0, 0x59F22982, 0x5DF45AF3, 0x54F65EF5,
+0x21921191, 0x11A211A3, 0x11D411D5, 0x11E611E7,
+0x11481149, 0xDAA855F7, 0x57F8EE00, 0x52F9DDA7,
+0x64E3D6A7, 0x2A521A51, 0xD8A7D9A6, 0x2D729AD5,
+0x6EED2622, 0x4D086DE3, 0x3DEC61E3, 0x4D084108,
+0x3D9C31EC, 0x410860B3, 0x81D12DB1, 0x4108E050,
+0x4008E7B7, 0x677C4108, 0x60B381D2, 0xE200318C,
+0x81D33472, 0x1D131DD2, 0x8D01D493, 0xD4901D24,
+0xB0B365D3, 0x64ED7E01, 0x8BDA34A2, 0x2FD2DA8C,
+0xDD9268A2, 0x2D824829, 0x7DFC64A2, 0xD287694D,
+0x6E222D92, 0x7D0C4E29, 0x68222DE2, 0x618D6AD3,
+0x2A16D784, 0xD48A6D72, 0x24D2D583, 0xD6895E72,
+0x517414E2, 0x1414EE00, 0xD1875876, 0x59781486,
+0x1498E710, 0x65E36252, 0x26E2142A, 0xE60064E3,
+0x6843644D, 0x384C4808, 0x381C4808, 0x0C866053,
+0x09CE28B1, 0x819160B3, 0x0ACE6053, 0x81A26043,
+0x0DCE6053, 0x81D360B3, 0x08CE6053, 0x18827401,
+0x624D09CE, 0x0ACE19E3, 0x1A643273, 0x75048FE0,
+0xE003D96A, 0x40186C92, 0x6D922CB1, 0x81D1DA6F,
+0x6E92E050, 0x81E24008, 0x60B36192, 0x64928113,
+0x1442E600, 0xD4696792, 0x689217A3, 0x1864E1FF,
+0x6563E703, 0x364C4608, 0x26127501, 0x3673665D,
+0xDC5B8BF8, 0x6DC2E003, 0x2DB14018, 0xD2606EC2,
+0x61C281E1, 0x1112EE00, 0xE02464C2, 0x65C21423,
+0x15E4D45B, 0xE58067C2, 0x68C28172, 0x818366E3,
+0x666D655C, 0x76046963, 0x394C6A6D, 0x8FF83A53,
+0xDB5429E2, 0x24B2DC54, 0x24C27404, 0x4F267F68,
+0x6DF66EF6, 0x6BF66CF6, 0x69F66AF6, 0x68F6000B,
+0x60116142, 0x8F03C803, 0xD23DE500, 0x8B063420,
+0xC9036011, 0x8B068802, 0x3420D239, 0x56128B03,
+0x52646513, 0x000B2422, 0x01136053, 0x2FE62FD6,
+0x7FEC4F22, 0x62536E53, 0x6D43E550, 0x4508E400,
+0xE101A001, 0x60435224, 0x81212211, 0x60538123,
+0x56E28122, 0x8BF53620, 0x16E4D238, 0xE61464F3,
+0x65E3420B, 0xE4FC65E1, 0x2E512549, 0x65F361F1,
+0x2F112149, 0xD13154D1, 0xE614410B, 0x607157D1,
+0x2701CB01, 0x7F141DE1, 0x6EF64F26, 0x6DF6000B,
+0x2FE62FD6, 0x7FEC4F22, 0x66536E53, 0x6D43E5FC,
+0x20596061, 0x2601CB01, 0x326052E2, 0x12E48B06,
+0x31E051E2, 0x52D18B04, 0x1E22A002, 0x5664AFF0,
+0x64F3D21E, 0x420BE614, 0x67E165E3, 0x2719E1FC,
+0x67F12E71, 0x271954D1, 0x65F3D118, 0x410BE614,
+0x52D12F71, 0xCB016021, 0x1DE12201, 0x4F267F14,
+0x000B6EF6, 0x00006DF6, 0x00203924, 0x002034F4,
+0x002034FC, 0x00203504, 0x0020352C, 0x00203910,
+0x00203918, 0x00100208, 0x001017C0, 0x001E210C,
+0x001C3D00, 0x00203964, 0x001000C8, 0x00117880,
+0x00117780, 0x00040020, 0x0026C401, 0x00200ED6,
+0x4F222FE6, 0xDE42624C, 0x42004208, 0x3E2CA005,
+0xD4405252, 0xBF695624, 0x65E22E62, 0x352052E1,
+0xD63D8BF6, 0x4F262622, 0x6EF6000B, 0x2FC62FB6,
+0x2FE62FD6, 0xDC394F22, 0x52C1DB39, 0x362066C2,
+0x6061891C, 0x8801C903, 0xDE348918, 0xBF37DD35,
+0x650364E3, 0x66B28503, 0x3262620D, 0xD4328907,
+0x0009BF76, 0x4D0BD431, 0xAFE60009, 0xBF3D0009,
+0xD42F64E3, 0x00094D0B, 0x0009AFDF, 0x2262D22D,
+0x6EF64F26, 0x6CF66DF6, 0x6BF6000B, 0x2FD62FC6,
+0x4F222FE6, 0xDD29DC28, 0x6E4360C2, 0x04DE4008,
+0xE614D127, 0x65E3410B, 0xD127D726, 0x55E227E2,
+0x35E05254, 0x21228F04, 0x400860C2, 0x122202DE,
+0x605365C2, 0x75014008, 0x0DE606DE, 0xC90F6053,
+0x60632C02, 0x6EF64F26, 0x000B6DF6, 0x85436CF6,
+0x650D5643, 0x622D6262, 0x35277204, 0xE1008F0C,
+0x2268960C, 0xD6158B03, 0x72015261, 0xD6131621,
+0x6262E101, 0x26227201, 0x6013000B, 0x000001FF,
+0x00203504, 0x002034FC, 0x001C3D00, 0x0020352C,
+0x002038F4, 0x002018A2, 0x002034F4, 0x00203AF0,
+0x00203AF4, 0x001C3D28, 0x00203964, 0x00203924,
+0x00200ED6, 0x00203968, 0x0020396C, 0x00117754,
+0x2FC62FB6, 0x2FE62FD6, 0x7FF84F22, 0x6022D237,
+0x8D58C803, 0xDE362F01, 0xDB37DC36, 0x66C252C1,
+0x892F3620, 0xC9036061, 0x892B8801, 0xD233DD31,
+0x64D3420B, 0x1F016503, 0x880160B1, 0xD2308B04,
+0x64D3420B, 0x0009AFEA, 0x85615653, 0x8904C820,
+0xE050D72C, 0x7201027E, 0xD22B0726, 0x6453420B,
+0x89072008, 0x55F1D126, 0x64D3410B, 0xE601D727,
+0x2762AFD4, 0x55F1D226, 0x64E3420B, 0xE601D125,
+0x2162AFCC, 0xDD25DE24, 0xDC26DB25, 0x66D252D1,
+0x89183620, 0xC9036061, 0x89148801, 0xD117D41F,
+0x0009410B, 0x36E05603, 0x65038F04, 0x2B20E201,
+0x2C52AFEC, 0xD712D41C, 0x0009470B, 0xE601D115,
+0xAFE34618, 0x60F12162, 0x8907C804, 0x7F08D217,
+0x6EF64F26, 0x6CF66DF6, 0x6BF6422B, 0x4F267F08,
+0x6DF66EF6, 0x000B6CF6, 0x00006BF6, 0x001E2100,
+0x00203504, 0x002034FC, 0x0020398C, 0x002014A0,
+0x002014CC, 0x00203494, 0x002016BE, 0x001E212C,
+0x00201530, 0x001C3D30, 0x00117880, 0x002034F4,
+0x00203914, 0x00203910, 0x0020352C, 0x00200610,
+0xE601D203, 0x1265D503, 0x000B2252, 0x00001266,
+0x001C1010, 0x0000C34F, 0x0009000B, 0x2FD62FC6,
+0x4F222FE6, 0x6D436C53, 0xEE00A004, 0x7E0164D4,
+0x644CBFF2, 0x8BF93EC2, 0x6EF64F26, 0x000B6DF6,
+0xE5006CF6, 0x6643A002, 0x76017501, 0x22286260,
+0xAFE38BFA, 0x2FE60009, 0x75076253, 0xE1086753,
+0x6043EE0A, 0x4409C90F, 0x650330E2, 0x8D014409,
+0xE630E637, 0x4110365C, 0x8FF22760, 0xE00077FF,
+0x000B8028, 0x000B6EF6, 0x000BE000, 0x2FE6E000,
+0x7FEC4F22, 0x6E436253, 0xBFDC65F3, 0xBFD06423,
+0xBFCE64E3, 0xD40364F3, 0x0009BFCB, 0x4F267F14,
+0x6EF6000B, 0x00203AF8, 0xE4FDD29F, 0xD79F6122,
+0x22122149, 0x74016022, 0x2202CB01, 0xD59C6622,
+0x22622649, 0xC8406070, 0x60528902, 0x2502CB04,
+0xE1F76452, 0x25422419, 0xE7016052, 0x2502CB40,
+0xE6026052, 0x2502C9CF, 0x47186052, 0x2502CB10,
+0xCB036052, 0x15622502, 0x1573000B, 0xD78ED58D,
+0xD48FD28E, 0xE600E100, 0x27112511, 0xAFCB2210,
+0x664C2461, 0x4600D28B, 0x6060362C, 0x000BCB10,
+0x654C2600, 0x4500D287, 0x6650352C, 0x2619E1EF,
+0x2560000B, 0xD284664C, 0x362C4600, 0xCB106060,
+0x2600000B, 0xD280654C, 0x352C4500, 0xE1EF6650,
+0x000B2619, 0x664C2560, 0x4600D27A, 0x6060362C,
+0x000BCB08, 0x654C2600, 0x4500D276, 0x6650352C,
+0x2619E1F7, 0x2560000B, 0xD273664C, 0x362C4600,
+0xCB086060, 0x2600000B, 0xD26F654C, 0x352C4500,
+0xE1F76650, 0x000B2619, 0x624C2560, 0x4200D669,
+0x6020326C, 0x4021C908, 0x40214021, 0x600C000B,
+0xD665624C, 0x326C4200, 0xC9086020, 0x40214021,
+0x000B4021, 0xD161600C, 0x341C644C, 0x000B6240,
+0xD15F602C, 0x341C644C, 0x000B6240, 0x2FE6602C,
+0x6E434F22, 0xE60A645C, 0x89143467, 0x0009BFEB,
+0x60EC640C, 0x8B028801, 0xA002E00F, 0x44092409,
+0x624C4409, 0x3263E60A, 0xBFE28905, 0x620C644C,
+0xC8806023, 0xE2008B00, 0x4F266023, 0x6EF6000B,
+0xD64C4F22, 0x88016062, 0xB2578B03, 0xA0030009,
+0xD2490009, 0x2260E640, 0xE200D648, 0x000B4F26,
+0x4F222622, 0x6062D643, 0x8B018802, 0x0009B2A0,
+0xE200D642, 0x000B4F26, 0xD53E2622, 0xE100D43E,
+0x2512E701, 0x2470000B, 0xE604D23B, 0x2260000B,
+0xD43B4F22, 0x410BD13B, 0xD53B0009, 0x6650E1FD,
+0x2619D23A, 0x2560E700, 0x000B4F26, 0x4F222270,
+0xD238D537, 0xD7386152, 0x2512611D, 0xE6FF6452,
+0x2542242B, 0xD22FD435, 0x420B666D, 0xD52E2762,
+0x6750E1FB, 0x4F262719, 0x2570000B, 0xD4304F22,
+0x410BD128, 0xD5280009, 0x6650E7F7, 0x4F262679,
+0x2560000B, 0x9425D524, 0x22496250, 0x2520000B,
+0xE4BFD521, 0x22496250, 0x2520000B, 0xD2254F22,
+0x600D8522, 0x89112008, 0x89458801, 0x89478803,
+0x89498805, 0x894F8806, 0x89558808, 0x895B8809,
+0x8961880A, 0x8967880B, 0x0009A06E, 0x0009B070,
+0x600CA06B, 0x0000FF7F, 0x001E2148, 0x001E1000,
+0x001E1108, 0x002039C4, 0x002039C6, 0x002039E5,
+0x002039A8, 0x001E103F, 0x001E105F, 0x001E102F,
+0x001E1090, 0x002039CC, 0x001E100B, 0x002039C8,
+0x00203AFC, 0x002018A2, 0x001E1028, 0x002039E4,
+0x001D4020, 0x98760000, 0x001C1000, 0x00203B08,
+0x00203B18, 0x0020399C, 0x0009B04C, 0x600CA035,
+0x0009B055, 0x600CA031, 0x6260D684, 0x8B2B2228,
+0x0009B061, 0x600CA029, 0x6260D680, 0x8B232228,
+0x0009B069, 0x600CA021, 0x6260D67C, 0x8B1B2228,
+0x0009B0C7, 0x600CA019, 0x6260D678, 0x8B132228,
+0x0009B0CD, 0x600CA011, 0x6260D674, 0x8B0B2228,
+0x0009B125, 0x600CA009, 0x6260D670, 0x8B032228,
+0x0009B13D, 0x600CA001, 0x4F26E000, 0x0009000B,
+0xD26CD16B, 0xD56C8412, 0x4000C90F, 0xD76B012D,
+0xE403D66B, 0xE20F611C, 0x2540E001, 0x25202712,
+0x2602000B, 0xE601D262, 0x30668523, 0xE0008D05,
+0xD663D260, 0xE0018122, 0x000B2602, 0xD25C0009,
+0x600D8523, 0x89052008, 0x8B0A8801, 0x6060D65D,
+0x2600CB01, 0xD457D65A, 0xE001E101, 0x000B2612,
+0x000B8142, 0xD152E000, 0x8513E501, 0x640D4518,
+0x66033453, 0xE0008D05, 0xD551D253, 0x2260E001,
+0x000B2502, 0x4F220009, 0x8513D149, 0x6453650D,
+0x62494419, 0x227D672E, 0x8801602C, 0x88028909,
+0x88038910, 0x8806891A, 0x88078935, 0xA04C893B,
+0xD5460009, 0x6652D746, 0x2762D446, 0x622C6261,
+0x2421A038, 0x2228625C, 0xD4438B3F, 0x6642D540,
+0x2562D440, 0x24018561, 0x6203A02C, 0x2008605C,
+0x88108907, 0x88208908, 0x88308909, 0xA02C890A,
+0xD23A0009, 0x6222A008, 0xA005D239, 0xD2396222,
+0x6222A002, 0x6262D638, 0xD432D531, 0x66212522,
+0xA00F626C, 0xD6352421, 0x6261D52D, 0x622CD42D,
+0xA0072562, 0xD6322421, 0x8561D529, 0x2562D429,
+0x62032401, 0x662D8515, 0x3617610D, 0x65038F01,
+0xB0CB2451, 0xA0010009, 0xE000E001, 0x000B4F26,
+0xD6190009, 0xD427E101, 0x65412610, 0xD118D717,
+0xE20F655D, 0x2752E001, 0x000B2620, 0x2FE62102,
+0xD20F4F22, 0x640C8523, 0x8B082448, 0xD511D61D,
+0x2621E200, 0x940F8451, 0xA0482049, 0xDE0D8051,
+0xC84060E0, 0xE2018D32, 0x89443427, 0xD216D615,
+0x2641420B, 0x0009A030, 0x0000FF7F, 0x002039E5,
+0x0020399C, 0x002039A8, 0x001E1100, 0x001E100C,
+0x002039C8, 0x001E1000, 0x001E1001, 0x002039D0,
+0x002039B0, 0x002039B4, 0x002039B8, 0x002039D4,
+0x002039D8, 0x002039DC, 0x002039E0, 0x00203E04,
+0x00203E0E, 0x002039C2, 0x00202886, 0x89123427,
+0xD294D693, 0x2641420B, 0xCB8084E1, 0x80E1B0F5,
+0xD69160E0, 0x2E00CB04, 0xC93F6060, 0xD68F2600,
+0xA001E001, 0xE0002602, 0x000B4F26, 0xD68C6EF6,
+0xC8806060, 0xD2868919, 0x88016021, 0xD2898B15,
+0x8524E501, 0x89103056, 0xE203D187, 0x2120D487,
+0xE00B6541, 0x0656655D, 0xE40FD585, 0x2140E702,
+0xD77E2571, 0x000BE001, 0x000B2702, 0x2FE6E000,
+0xDE804F22, 0xC88084E1, 0xD57A892C, 0x20088554,
+0x61038F28, 0x8553D77C, 0x64036672, 0x8566650C,
+0x3520620C, 0xD6798B1E, 0x651CD774, 0x2651644C,
+0x60E02741, 0x8904C840, 0x420BD275, 0xA0030009,
+0xD2680009, 0x0009420B, 0x0009B09F, 0xE201D167,
+0x60E02122, 0xCB04D464, 0x60402E00, 0x2400C93F,
+0x6023A001, 0x4F26E000, 0x6EF6000B, 0x2FB62FA6,
+0x2FD62FC6, 0xDA622FE6, 0x66A1E240, 0x3622DC5E,
+0x62638900, 0x6ED36D2C, 0x4E2136D8, 0x4E212A61,
+0xDB61D460, 0xE700A00F, 0x770162B2, 0x71026123,
+0x66212B12, 0x71026213, 0x61212B12, 0x651D666D,
+0x356C4528, 0x627C2452, 0x8BED32E3, 0xC90360D3,
+0x8B108803, 0x617367B2, 0x2B127102, 0x71026E13,
+0x2B126571, 0x655D6DE1, 0x422862DD, 0x325CE107,
+0xA00C2C10, 0x88022422, 0xA0038B01, 0x8801E203,
+0xE2018B05, 0x66B22C20, 0x655D6561, 0xE60F2452,
+0x67A12C60, 0x8B052778, 0xDD38DC44, 0xEB01EA00,
+0x2DB22CA2, 0x6DF66EF6, 0x6BF66CF6, 0x6AF6000B,
+0x2FE62FD6, 0xE240DD36, 0x362266D1, 0x62638900,
+0x3678672C, 0x7703DE38, 0x47212D61, 0x64E2D635,
+0xA00E4721, 0x6562E100, 0x62537101, 0x74012450,
+0x24204219, 0x45297401, 0x74012450, 0x24504519,
+0x621C7401, 0x8BEE3273, 0x66E24200, 0x420061D1,
+0x2118362C, 0x2E628F06, 0xDD1CD728, 0xE501E400,
+0x2D522742, 0x000B6EF6, 0x2FD66DF6, 0x4F222FE6,
+0xED0AEE01, 0x64E3BC85, 0xBC8A64E3, 0x62EC7E01,
+0x8BF732D7, 0xBC8DEE01, 0x64E364E3, 0x7E01BC92,
+0x32D762EC, 0x4F268BF7, 0x000B6EF6, 0xD1186DF6,
+0xD418920D, 0x72122122, 0x2422D617, 0xD7177204,
+0x72202622, 0x2722D116, 0x000B7230, 0x137A2122,
+0x002039C2, 0x00202992, 0x001E1015, 0x002039C8,
+0x001E1001, 0x0020399C, 0x001E1100, 0x002039C6,
+0x002039B4, 0x001E1000, 0x002039B8, 0x002039C4,
+0x00202886, 0x001E100C, 0x002039B0, 0x002039CC,
+0x002039D0, 0x002039D4, 0x002039D8, 0x002039DC,
+0x002039E0, 0x4F222FE6, 0xD6707FFC, 0x88016060,
+0xE2018951, 0x2620BFBB, 0xD56ED16D, 0xDE6E6010,
+0x64E36552, 0x7402C840, 0x8D22D16C, 0xD26C7502,
+0xE601D76C, 0xE7042722, 0x76016255, 0x626C2421,
+0x8FF93273, 0xD4637402, 0x6242E601, 0x640D8528,
+0x67494419, 0x275D657E, 0x81E4607C, 0xE417D562,
+0x67557601, 0x3243626C, 0x8FF92171, 0xA0207102,
+0xD25E0009, 0xE601D75B, 0xE7042722, 0x76016255,
+0x626C2421, 0x8FF93273, 0xD4527402, 0x6242E601,
+0x640D8528, 0x67494419, 0x275D657E, 0x81E4607C,
+0xE417D553, 0x67557601, 0x3243626C, 0x8FF92171,
+0x92897102, 0xD2462E21, 0x5E23D74E, 0x64F22FE2,
+0x604365F2, 0x2700C980, 0xC9606043, 0x80716103,
+0xC9036043, 0x80724519, 0x65F2605C, 0x817266F2,
+0x46194629, 0x606C4529, 0x4018645C, 0x8173304C,
+0x21185E23, 0x64F22FE2, 0x6E4C62F2, 0x602C4219,
+0x66F262F2, 0x46294018, 0x461930EC, 0x42298174,
+0x652C606C, 0x305C4018, 0x81758F07, 0x0009BC96,
+0x2228620C, 0xA00A8908, 0x60130009, 0x8B038840,
+0x0009B009, 0x0009A003, 0xE202D62F, 0x7F042622,
+0x000B4F26, 0x4F226EF6, 0x8552D52A, 0x8830600D,
+0x88318903, 0xA0348923, 0x85550009, 0xD428D727,
+0x85532701, 0x610DD627, 0x24124118, 0x460BD426,
+0xD7230009, 0xD226D425, 0x6572420B, 0xE230D120,
+0x42286712, 0x2729E620, 0x37604628, 0xD6218B03,
+0xA016E200, 0xD61F2622, 0xA012E202, 0xD1182622,
+0x6212E530, 0xE6204528, 0x46282259, 0x89083260,
+0xD41AD119, 0xE601D513, 0x2160450B, 0x472BD718,
+0x4F264F26, 0x0009000B, 0x0000060A, 0x002039E4,
+0x001E1000, 0x002039D0, 0x00203E04, 0x00203E10,
+0x00203DA8, 0x002039B8, 0x00203DD8, 0x00203DD6,
+0x00203DAA, 0x0020399C, 0x002039C8, 0x002039B4,
+0x002039B0, 0x002018A2, 0x00203B24, 0x00203B28,
+0x002018EE, 0x002039CC, 0x001E100B, 0x00203B3C,
+0x00114004, 0x4F222FE6, 0xDE967FFC, 0x200884E9,
+0x2F008D06, 0xD695D494, 0x0009460B, 0x64F0B19A,
+0x6620D293, 0x89022668, 0xC9BF60E0, 0x7F042E00,
+0x000B4F26, 0x000B6EF6, 0x2FE60009, 0xDE8D4F22,
+0x60E0D68D, 0xCBC0D48D, 0x62602E00, 0xC803602C,
+0x40218904, 0x70014021, 0x6603A002, 0x66034009,
+0xD687616D, 0xE500A004, 0x75016262, 0x74042422,
+0x3213625D, 0xD2838BF8, 0x0009420B, 0xC9BF84E2,
+0x4F2680E2, 0x6EF6000B, 0x2FE62FD6, 0x7FFC4F22,
+0x6260D67D, 0x89442228, 0xD572E100, 0x60502610,
+0xCB40D47A, 0x2500440B, 0x8D052008, 0x62E06E03,
+0x7104612C, 0x2F11A006, 0xD475D66D, 0xDD756760,
+0x657C4D0B, 0xE23C6D1D, 0x8B033D27, 0xD267D472,
+0x0009420B, 0x4D214D21, 0xA005D770, 0x66E6E400,
+0x357C4508, 0x74012562, 0x35D3654D, 0xD76C8BF7,
+0x6172E003, 0x81114018, 0x6E7260F1, 0x81E2700C,
+0xD4686172, 0xDD688113, 0x4D0BDE68, 0xE2016572,
+0xD4672E22, 0x420BD255, 0xD6560009, 0xC93F6060,
+0x7F042600, 0x6EF64F26, 0x6DF6000B, 0x2FC62FB6,
+0x2FE62FD6, 0xD25F4F22, 0x6B436E73, 0x420B6C53,
+0x20086D63, 0x64038D1C, 0xE50ED149, 0x32526210,
+0x60C38916, 0x804124B0, 0x814160D3, 0xA007E500,
+0x655D61BC, 0x00EC6053, 0x364C6653, 0x80647501,
+0x3213625D, 0xD63B8BF5, 0xC9BF6060, 0x2600A008,
+0xD23AD44D, 0x6EF64F26, 0x6CF66DF6, 0x6BF6422B,
+0x6EF64F26, 0x6CF66DF6, 0x6BF6000B, 0x7FC44F22,
+0x720262F3, 0x22512F41, 0x45297202, 0x60632251,
+0xE5C4E682, 0x67F38121, 0x655C666C, 0xE408BFB6,
+0x4F267F3C, 0x0009000B, 0x2F962F86, 0x2FB62FA6,
+0x2FD62FC6, 0x4F222FE6, 0xE1007FC4, 0x6513ECFF,
+0x6B136CCD, 0xDE36D735, 0xEDFF64F3, 0xD835EA04,
+0x6053655C, 0x027D4000, 0x32C0622D, 0x66038D0D,
+0x09ED6063, 0x2491027D, 0x24217402, 0x698202ED,
+0x3928622D, 0x74022892, 0x75017104, 0x6063625C,
+0x07D532A2, 0x0EB58FE4, 0x2448641C, 0xE6808905,
+0x67F3E5C5, 0xBF79666C, 0x7F3C655C, 0x6EF64F26,
+0x6CF66DF6, 0x6AF66BF6, 0x000B69F6, 0xD11E68F6,
+0x6012D21E, 0xCB20E405, 0x2102E500, 0x000B2242,
+0x00002252, 0x001E1017, 0x00203B40, 0x002018A2,
+0x0020390E, 0x001E1015, 0x001E10BF, 0x00117800,
+0x001E10FC, 0x00200610, 0x00203914, 0x00202AEA,
+0x00203B44, 0x002018EE, 0x00203B60, 0x0011788C,
+0x00203910, 0x002034F4, 0x00201530, 0x001E2130,
+0x00203B68, 0x00202AAC, 0x00203B6C, 0x00203974,
+0x0020397C, 0x00203DA4, 0x001C3500, 0x001D4004,
+0xD564D163, 0xE400D764, 0x2142E20F, 0x17411154,
+0xD5622722, 0x9669D762, 0x15412572, 0x96661562,
+0xE6011565, 0xD55F1165, 0x666CE6F8, 0x25422542,
+0x25422542, 0x25422542, 0x25622542, 0x7601E727,
+0x67632572, 0x25627797, 0xE7042572, 0x2572E248,
+0xE2192522, 0xE2702522, 0x25422542, 0x25422542,
+0x25222542, 0x2522E20C, 0x25422542, 0x25422542,
+0x25422542, 0x25422542, 0x000B154A, 0xE2081145,
+0x0009422B, 0x2FE62FD6, 0x7FFC4F22, 0xC8206043,
+0x6E438D02, 0x0009BE67, 0xC81060E3, 0xBE648901,
+0x60E30009, 0x8901C840, 0x0009BE86, 0xC80160E3,
+0xDD3D8938, 0xC80260D0, 0x2F008D03, 0x460BD63B,
+0x60F00009, 0x8902C804, 0x460BD639, 0x62F00009,
+0xC8806023, 0x60D08902, 0x2D00C97F, 0xC8016023,
+0xD6348906, 0x0009460B, 0x0009A007, 0x51630601,
+0x8902C808, 0x460BD630, 0x60F00009, 0x8902C810,
+0x420BD22E, 0xD52E0009, 0x88026052, 0xD22D8B03,
+0xA005E604, 0x88012260, 0xD22A8B02, 0x2260E601,
+0x2522E200, 0xC88060E3, 0xD227892D, 0x60E36E20,
+0x8902C880, 0x420BD225, 0x60E30009, 0x8902C840,
+0x420BD223, 0x60E30009, 0x8902C802, 0x420BD221,
+0x60E30009, 0x890DC804, 0xDD20D11F, 0x0009410B,
+0x0009BF0D, 0x0009BF4C, 0xD51ED41D, 0x2470E708,
+0x25D2BF85, 0xC80860E3, 0xD21B8905, 0x4F267F04,
+0x422B6EF6, 0x7F046DF6, 0x6EF64F26, 0x6DF6000B,
+0x001C581C, 0xA000A000, 0x001D0100, 0x001D4000,
+0x00040021, 0x001C589C, 0x001E1021, 0x00201A90,
+0x00201AB2, 0x00202114, 0x00201ACA, 0x00201AD8,
+0x002039C8, 0x001E100B, 0x001E1028, 0x00201B44,
+0x00201B50, 0x00201AE0, 0x00201AFE, 0x12345678,
+0x001E1000, 0x0010F100, 0x00201B2C, 0x644CD6A7,
+0x000B346C, 0xD6A62450, 0x346C644C, 0x2450000B,
+0x644CD6A4, 0x000B346C, 0x625C2450, 0x4208616D,
+0x42084119, 0x42006019, 0x670E614C, 0xD49E321C,
+0x4200207D, 0x324CC90F, 0x2200000B, 0x4208625C,
+0x42004208, 0x324C644C, 0x4200D498, 0x000B324C,
+0x2FE62260, 0x614C4F12, 0x4100D493, 0x6710314C,
+0xE29F666D, 0x27294619, 0x6E536269, 0x672E6573,
+0x4221227D, 0x42214221, 0x7601662C, 0xE4014608,
+0x34E84608, 0x644C4600, 0x071A0467, 0x2150257B,
+0x000B4F16, 0x4F226EF6, 0xD2857FE8, 0x88016021,
+0xD2848B7B, 0x26686621, 0xD2838B77, 0x26686621,
+0xE50F8B73, 0xE401BFA2, 0xBFA4E501, 0xE586E400,
+0xE400655C, 0x2F50BFA4, 0xBFA1E401, 0xE602E506,
+0x60634618, 0x81F2E401, 0x6543BF9F, 0xE40185F2,
+0xBFAB6543, 0x85F26603, 0x6543E401, 0x6603BFB1,
+0xE40265F0, 0x6053756C, 0x80F8BF80, 0xBF82E402,
+0x84F8E512, 0x7090E402, 0x6503BF82, 0x4618E602,
+0x81F66063, 0xBF80E402, 0x85F6E500, 0x6603E402,
+0xE500BF8C, 0xE40285F6, 0xBF926603, 0xE5FEE500,
+0xE010655C, 0xBF61E403, 0xE5130F54, 0xE40EBF63,
+0x05FCE010, 0xBF63E40E, 0xE5007585, 0xBF64E403,
+0xE500E640, 0xBF71E403, 0xE500E640, 0xBF78E403,
+0xE5FFE640, 0xE014655C, 0xBF47E404, 0xE40F0F54,
+0xE504BF49, 0x05FCE014, 0xBF49E40F, 0xE5017584,
+0xBF4AE640, 0xE501E404, 0xBF57E640, 0xE501E404,
+0xE404E640, 0xAF5C7F18, 0x7F184F26, 0x000B4F26,
+0x4F220009, 0xD2427FF0, 0x88016021, 0xD2418B71,
+0x26686621, 0xD2408B6D, 0x26686621, 0xE50F8B69,
+0xE401BF1C, 0xBF1EE501, 0xE586E400, 0xE400655C,
+0x2F50BF1E, 0xBF1BE401, 0xE401E506, 0xBF1C6543,
+0xE401E640, 0xBF296543, 0xE401E640, 0xBF306543,
+0x65F0E640, 0x756CE402, 0xBEFF6053, 0xE40280F4,
+0xE512BF01, 0xE40284F4, 0xBF017090, 0xE6406503,
+0xBF02E402, 0xE640E500, 0xBF0FE402, 0xE640E500,
+0xBF16E402, 0xE5FEE500, 0x6053655C, 0xBEE5E403,
+0xE51380F8, 0xE40EBEE7, 0xE40E84F8, 0xBEE77085,
+0xE5006503, 0xBEE8E640, 0xE500E403, 0xBEF5E640,
+0xE500E403, 0xBEFCE640, 0xE5FFE403, 0x6053655C,
+0xBECBE404, 0xE40F80FC, 0xE504BECD, 0xE40F84FC,
+0xBECD7083, 0xE5016503, 0xBECEE640, 0xE501E404,
+0xBEDBE640, 0xE501E404, 0xE404E640, 0xAEE07F10,
+0x7F104F26, 0x000B4F26, 0x00000009, 0x001E102F,
+0x001E1080, 0x001E1090, 0x001E103F, 0x001E103E,
+0x002039C2, 0x002039C4, 0x002039C6, 0xD21DD11C,
+0x66206010, 0x676C7001, 0x3700C90F, 0xE5008D13,
+0x67106210, 0x7701622C, 0x64232170, 0xD6166010,
+0x44084408, 0x3428C90F, 0x62602100, 0x7201D513,
+0x44082620, 0x000B354C, 0xD10F6053, 0x25586510,
+0xE6008D13, 0xD60DD40B, 0x655C6540, 0x47086753,
+0x37584708, 0x47086540, 0x24507501, 0x367C6040,
+0x2400C90F, 0x72FF6210, 0x000B2120, 0x00006063,
+0x0020390D, 0x0020390C, 0x0020390E, 0x00203534,
+0x7FFC4F22, 0xE680D19F, 0x666C6212, 0xD29E2F22,
+0x67F36563, 0x420B7542, 0x7F04E404, 0x000B4F26,
+0xE6800009, 0xD298666C, 0xE7006563, 0x422B7540,
+0xE6806473, 0xD294666C, 0xE7006563, 0x422B7543,
+0x2F866473, 0x2FA62F96, 0x2FC62FB6, 0x2FE62FD6,
+0x7FCC4F22, 0xDC8ED28D, 0x72011F21, 0xDB8D1F22,
+0xD18EDE8D, 0x66125211, 0x8B013620, 0x0009A0E5,
+0xC9036061, 0x8B018801, 0x0009A0DF, 0xD288D487,
+0xED84420B, 0x2F025503, 0x30D0845C, 0xA0B88901,
+0xD1840009, 0x626C6610, 0x88016023, 0xD1828B68,
+0x62101FC3, 0x895B2228, 0xE003D480, 0x40186742,
+0x68421772, 0xD57EE900, 0x81816DB3, 0x7D042190,
+0x67D26AB2, 0x64E26852, 0x1F491F57, 0x740464E3,
+0x1FA46542, 0x65431F5A, 0x625275F8, 0x1F761FD5,
+0x6D531F2B, 0xDA74D773, 0x7D94D274, 0x68D21F88,
+0x6AA26972, 0xD1726022, 0x2202CB20, 0xE1401F1C,
+0x7601E600, 0x3213626D, 0x56F48BFB, 0x52F651F5,
+0x21222B62, 0x52F851F7, 0x212256F9, 0x2E6251FA,
+0x51FB2412, 0x2D822512, 0xD9662792, 0x29A2DD5F,
+0x6AD2D965, 0xD9646892, 0x68D21A84, 0x6081DA63,
+0x2801CB01, 0xD86266D2, 0x2A622962, 0xED015AFC,
+0x2AD2480B, 0x2AD24D18, 0x62D2DD5E, 0x2D227201,
+0xD15056F3, 0xE2026062, 0x2602CB01, 0x2120A03D,
+0x8B3A2228, 0xE401DD58, 0x2140E600, 0xE01C2D62,
+0xC801005C, 0xD4558B0A, 0xE600D755, 0xED7D2472,
+0x626C7601, 0x8BFB32D3, 0x24D2DD52, 0xE2FE68C2,
+0x2C822829, 0x095CE01E, 0xE01F5DF1, 0x0A5C2D90,
+0x751051F2, 0xED0621A0, 0xD74BE600, 0x8456D44B,
+0x27007601, 0x696C6854, 0x248039D3, 0x8FF67401,
+0xDA477701, 0x2A10E194, 0xE2007A01, 0x7A0F2A20,
+0xD130E805, 0x66102A80, 0x6023626C, 0x89088801,
+0xD240D42A, 0x420B65F2, 0xD131ED01, 0xAF304D18,
+0x65F221D2, 0x8553D43C, 0x620D6642, 0x89073262,
+0xD13BD43A, 0x0009410B, 0xE601D73A, 0x2762AF1A,
+0xD134D41E, 0x410B65F2, 0xD125ED01, 0xD637D436,
+0x460B4D18, 0xAF0D21D2, 0x7F340009, 0x6EF64F26,
+0x6CF66DF6, 0x6AF66BF6, 0x000B69F6, 0x4F2268F6,
+0x85467FF4, 0x2F01E681, 0x666C8547, 0x854881F1,
+0x81F2D209, 0x67F38542, 0x854381F3, 0x81F4E40C,
+0x65636053, 0x420B81F5, 0x7F0C7540, 0x000B4F26,
+0x00000009, 0x001C3D9C, 0x0020245C, 0x0011779A,
+0x001C36F8, 0x001C3B9C, 0x001C3704, 0x0020352C,
+0x002014A0, 0x0020391D, 0x0020391C, 0x00203918,
+0x001C3D98, 0x001C3BB4, 0x001C5960, 0x001C3500,
+0x001C3D30, 0x001C8960, 0x00203504, 0x001C3D00,
+0x0020160C, 0x00117730, 0x00203920, 0x001C582C,
+0x2000A000, 0x0000A000, 0x0011778C, 0x00117792,
+0x00117788, 0x002014CC, 0x002038F4, 0x002034F4,
+0x00201530, 0x001E2130, 0x00203D84, 0x002018A2,
+0x2F962F86, 0x2FB62FA6, 0x2FD62FC6, 0x4F222FE6,
+0xD19B7FEC, 0x2F12E000, 0x6103D49A, 0x1F4281F2,
+0xDD9ADA99, 0xD69A6813, 0xE0014808, 0x460BDE99,
+0x38EC4800, 0x65A21F03, 0x352052A1, 0xA23E8B01,
+0x60510009, 0x8801C903, 0xA2388B01, 0x52530009,
+0x32E0DE91, 0xD9918B10, 0x64A3490B, 0x4B0BDB90,
+0xDE906403, 0xD791D690, 0xEC01D591, 0x2E02E100,
+0x271026C0, 0x2502AFDF, 0xC8018551, 0xA1578B01,
+0x62510009, 0x4200622D, 0x5E53366A, 0x85E2226D,
+0xC903642C, 0x85E36603, 0x6053650D, 0x40214021,
+0x4500C93F, 0x322A6703, 0x6053252D, 0xC901D17F,
+0x60106C03, 0x8801D97F, 0xDB7F8B05, 0x2120E200,
+0xCB0160B2, 0xD17D2B02, 0x88016011, 0x65A28B0A,
+0x8D042448, 0x9B9E6251, 0xA00322B9, 0x919B2521,
+0x2521221B, 0x37B3EB10, 0x2448895E, 0xD4738B07,
+0x22286241, 0x60638903, 0xA05781F8, 0xD5706473,
+0x46084608, 0x85E26273, 0x46006B50, 0x362C4200,
+0x2BB8C910, 0x8F1F6463, 0x26686603, 0xD2698911,
+0x062D6043, 0x4119616D, 0x6B0E6019, 0x81F820BD,
+0x880160C3, 0x646C8F2C, 0x880F6073, 0xA0278B1B,
+0xD2610009, 0x052D6043, 0x4119615D, 0x670E6019,
+0x645C207D, 0x81F8A01C, 0x890F2668, 0x6043D25B,
+0x6B5D052D, 0x60B94B19, 0x201D610E, 0x60C381F8,
+0x8F0D8801, 0x6473645C, 0xEC00A00A, 0x6043D254,
+0x625D052D, 0x60294219, 0x207D670E, 0x81F8645C,
+0x880285F8, 0x85E1890A, 0x8D07C820, 0xE6DC6203,
+0x60232269, 0x81E1A002, 0x644CE4FF, 0x6210D149,
+0x89012228, 0x644CE4FF, 0x654DEBFF, 0x35B06BBC,
+0xDB368B2B, 0x64A34B0B, 0x410BD135, 0x54036403,
+0x85446E03, 0xC948DB40, 0xDC408808, 0xBEAE8B01,
+0x64B3E502, 0x65E34C0B, 0xDB3DEC01, 0xD13D2DC2,
+0x621260B2, 0x72017001, 0x21228805, 0x2B028F08,
+0x666CE680, 0x6563D238, 0x7549E700, 0x6473420B,
+0xA030D436, 0x7FFF0009, 0x85E28000, 0x20B9EBFC,
+0x610381E2, 0x942A85E3, 0x62032049, 0x450885F8,
+0x81E2201B, 0xC90160C3, 0x40084018, 0x40084008,
+0x4000225B, 0x6023220B, 0x85E481E3, 0x4118E108,
+0x81E4201B, 0xE40262A2, 0x20B98521, 0x67A28121,
+0xCB016071, 0x85F82701, 0x89033042, 0xECE785E2,
+0x81E220C9, 0x490BD41E, 0xA03B0009, 0x7E030009,
+0x001C3D30, 0x00203D90, 0x00203504, 0x001E212C,
+0x002033E8, 0x001C3D00, 0x00117780, 0x002014A0,
+0x0020166C, 0x0011770C, 0x0020391C, 0x0020391D,
+0x00203918, 0x002018A2, 0x001C36F8, 0x00203990,
+0x00203DA0, 0x00203B84, 0x00203C04, 0x00203C84,
+0x00203D04, 0x00203908, 0x002034FC, 0x002014CC,
+0x00203994, 0x00203998, 0x0020245C, 0x00203D88,
+0x00203D8C, 0x602262F2, 0x40094019, 0xC90F4009,
+0x8B0B880A, 0x60E2DE8C, 0x40094019, 0xC90F4009,
+0x8B038808, 0xCB0160A2, 0x2802A006, 0x65E2DE87,
+0x2E527501, 0x286266A2, 0x52F366F2, 0x2622AE83,
+0xD2838551, 0xDE83C802, 0xA0958B01, 0x420B0009,
+0x4E0B64A3, 0x5E036403, 0x85E46503, 0x4918E908,
+0xD77D209B, 0xE04C81E4, 0xDC7C0B7E, 0x7B01D97C,
+0x61C207B6, 0x71016690, 0x8D062668, 0xD4792C12,
+0x420BD279, 0xA070EB01, 0x62512DB2, 0x4B18EB0F,
+0x22B9E102, 0x32104118, 0x85518B0F, 0x2029E2FC,
+0x60518151, 0xCB0172E0, 0x85E12501, 0x202994A3,
+0x85E481E1, 0xA0522049, 0x675181E4, 0x4719677D,
+0x667E6779, 0x7701276D, 0x6903607C, 0x88014918,
+0x25918F3E, 0x6B12D161, 0x21B27B01, 0x660D85E3,
+0x40216063, 0xC93F4021, 0x6C034600, 0x262D322A,
+0xC8016063, 0xDB5ED15D, 0x967D8901, 0xE6002C6B,
+0x666C67CD, 0x40006063, 0x622D021D, 0x8D0E3270,
+0x60436403, 0xE9FF021D, 0x8B013290, 0x01C5A007,
+0x626C7601, 0x3292E904, 0x646C8BEB, 0x60434400,
+0xD15004BD, 0x0B457401, 0x669D6911, 0x89073670,
+0x602D6211, 0x890388FF, 0xE201DB4B, 0x2B2021C1,
+0xECFC8551, 0x815120C9, 0xCB016051, 0xDC472501,
+0x64A34C0B, 0x51F366F2, 0x85EF2612, 0x54F2D244,
+0x650D420B, 0x0009ADE7, 0xE500DC42, 0x420B2C52,
+0x4E0B64A3, 0x54036403, 0x85446E03, 0x6703E908,
+0x65034918, 0x27998541, 0xDB323790, 0x8F0BD932,
+0x6013610D, 0x8B07C820, 0xC9486053, 0x8B038808,
+0xE501BD4D, 0x0009A005, 0x2128D233, 0xBD468901,
+0x64B3E500, 0x490B65E3, 0xADBCEC01, 0x85F22DC2,
+0x7001EE04, 0x31E7610D, 0x8D0281F2, 0xADA97A08,
+0x7F140009, 0x6EF64F26, 0x6CF66DF6, 0x6AF66BF6,
+0x000B69F6, 0xF7FF68F6, 0x2FE68000, 0xD2234F22,
+0x60E36E22, 0x8D02C840, 0xBBF922E2, 0xE2400009,
+0x2E284218, 0xBC048901, 0x60E30009, 0x8905C810,
+0xD21CD41B, 0x0009420B, 0x0009BC03, 0xC80560E3,
+0xBD6D8901, 0x60E30009, 0x8902C802, 0xAC004F26,
+0x4F266EF6, 0x6EF6000B, 0x001C3D3C, 0x00117760,
+0x002014A0, 0x0020166C, 0x00203494, 0x00203DA4,
+0x00203908, 0x002034FC, 0x002014CC, 0x00203974,
+0x0020397C, 0x00203970, 0x00203972, 0x00201530,
+0x002018EE, 0x00203994, 0x00008000, 0x001C3510,
+0x00203D98, 0x002018A2, 0x080A0C0E, 0x00020406,
+0x1A1C1E20, 0x12141618, 0x2E303234, 0x26282A2C,
+0x3A3C3E40, 0x6C625648, 0x41112F26, 0xE2208F18,
+0x890B3123, 0x321CD204, 0xD1026220, 0x412B312C,
+0x00090009, 0x00203412, 0x002033C8, 0x000BE000,
+0x400062F6, 0x40004000, 0x40004000, 0x40004000,
+0x62F6000B, 0x40004000, 0x40004000, 0x40004000,
+0x40184000, 0x62F6000B, 0x40004000, 0x40004000,
+0x40004000, 0x40284000, 0x62F6000B, 0x40004000,
+0x40184000, 0x000B4028, 0xC90F62F6, 0x40054005,
+0x40054005, 0x62F6000B, 0x4005C907, 0x40054005,
+0x62F6000B, 0x4005C903, 0x000B4005, 0xC90162F6,
+0x000B4005, 0x000062F6, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x544F0D0A, 0x46205355, 0x00003A57,
+0x206C754A, 0x32203120, 0x20383030, 0x323A3132,
+0x34333A38, 0x00000000, 0x00000D0A, 0x00000043,
+0x42707372, 0x3D206675, 0x554E203D, 0x202C4C4C,
+0x6E49677A, 0x4E497274, 0x6D754E51, 0x0000003D,
+0x61766E49, 0x2064696C, 0x72657375, 0x20726F20,
+0x2079656B, 0x00214449, 0x52504545, 0x57204D4F,
+0x65746972, 0x6461202C, 0x003D7264, 0x6C617620,
+0x0000003D, 0x00000A0D, 0x435F4D5A, 0x465F444D,
+0x4C445F57, 0x494E495F, 0x00000054, 0x6E6B6E55,
+0x206E776F, 0x6D6D6F63, 0x3D646E61, 0x00000000,
+0x203A3051, 0x00000020, 0x203A3151, 0x00000020,
+0x203A3251, 0x00000020, 0x203A3351, 0x00000020,
+0x203A3451, 0x00000020, 0x2B434741, 0x73696F4E,
+0x61432065, 0x7262696C, 0x6F697461, 0x6166206E,
+0x6F206C69, 0x6974206E, 0x0D0A656D, 0x00000000,
+0x00000072, 0x00205220, 0x00000D0A, 0x62735576,
+0x7473725F, 0x00000A0D, 0x62735576, 0x7375735F,
+0x646E6570, 0x00000A0D, 0x62735576, 0x7365725F,
+0x000A0D6D, 0x00000044, 0x44387570, 0x72637365,
+0x6F747069, 0x3D584572, 0x00000000, 0x00000047,
+0x00000042, 0x72746E49, 0x6D652051, 0x2C797470,
+0x49677A20, 0x4972746E, 0x754E514E, 0x00003D6D,
+0x654C7245, 0x0000006E, 0x00000049, 0x20746F4E,
+0x756F6E65, 0x49206867, 0x4220514E, 0x0A0D6675,
+0x00000000, 0x000000FF, 0x00020001, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x010E010D, 0x00020003, 0x01090108,
+0x0002010A, 0x02000003, 0x02020201, 0x02040203,
+0x02060205, 0x02020200, 0x02040203, 0x020C020B,
+0x020E020D, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x000000FF, 0x00020001, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x010E010D, 0x00020003, 0x01090108,
+0x0002010A, 0x00030003, 0x02020201, 0x02040203,
+0x02060205, 0x02020200, 0x02040203, 0x020C020B,
+0x020E020D, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x010E010D, 0x00FF010F, 0x01090108,
+0x010B010A, 0x0200010F, 0x02020201, 0x02040203,
+0x02060205, 0x02020200, 0x02040203, 0x020C020B,
+0x020E020D, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x010E010D, 0x00FF010F, 0x01090108,
+0x010B010A, 0x010F010F, 0x02020201, 0x02040203,
+0x02060205, 0x02020200, 0x02040203, 0x020C020B,
+0x020E020D, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF,
+0x00FF00FF, 0x00205220, 0x00000046, 0x00000059,
+0x73204142, 0x003D7165, 0x49544120, 0x0000204D,
+0x00000000, 0x00000000, 0x002E0209, 0x80000101,
+0x000409FA, 0x00FF0400, 0x05070000, 0x02000201,
+0x82050700, 0x00020002, 0x03830507, 0x07010040,
+0x40030405, 0x02090100, 0x0101002E, 0x09FA8000,
+0x04000004, 0x000000FF, 0x02010507, 0x07000040,
+0x40028205, 0x05070000, 0x00400383, 0x04050701,
+0x00004002, 0x00000000, 0x00000000, 0x07090000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
+
+const u32_t zcFwImageSize=15936;
diff --git a/drivers/staging/otus/hal/hpfwuinit.c b/drivers/staging/otus/hal/hpfwuinit.c
new file mode 100644
index 00000000000..ed80ffafaff
--- /dev/null
+++ b/drivers/staging/otus/hal/hpfwuinit.c
@@ -0,0 +1,240 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include "../80211core/cprecomp.h"
+
+const u32_t zcFwImage[] = {
+0x0009000B, 0x7FFC4F22, 0xD695D494, 0x0009460B,
+0xD494E570, 0x4518B01E, 0x89042008, 0xD690D492,
+0x462B7F04, 0xB0124F26, 0xD2900009, 0x420BD490,
+0xE6000009, 0x949AD58F, 0xC8406052, 0x2F028F03,
+0x8FF93642, 0x7F047601, 0x000B4F26, 0xD28A0009,
+0x0009422B, 0x2FD62FC6, 0x4F222FE6, 0xD6877FEC,
+0x626061F3, 0x2F208461, 0x846280F1, 0x80F27110,
+0x6D438463, 0x846480F3, 0x80F46413, 0x6C538465,
+0x846680F5, 0x80F6E500, 0xD77D8467, 0x846880F7,
+0x80F8EE04, 0x80F98469, 0x80FA846A, 0x80FB846B,
+0x80FC846C, 0x80FD846D, 0x80FE846E, 0x80FF846F,
+0x6653655C, 0x7501367C, 0x665C6260, 0x242036E3,
+0x74018FF6, 0x66F32F16, 0xE7107604, 0xB00D65C3,
+0x6E0364D3, 0xD46B7F04, 0x420BD26B, 0x60E36503,
+0x4F267F14, 0x6DF66EF6, 0x6CF6000B, 0x2FB62FA6,
+0x2FD62FC6, 0x4F222FE6, 0x3F3C933A, 0x4108E141,
+0x31FCE200, 0x11733526, 0x21521162, 0x11418D02,
+0xE0FFA098, 0x4A18EA01, 0x262066F3, 0x32A27201,
+0x76018FFB, 0x6BE3EE00, 0xE0446CF3, 0x00FE4008,
+0x450BD556, 0x660361B3, 0x4008E043, 0x6DC004FE,
+0x014C6063, 0x31EC3EDC, 0x60E36E1C, 0x7B0107FC,
+0x2C703BA2, 0x8FE80FD4, 0xE0427C01, 0xEB004008,
+0x70FC07FE, 0x6EB36CB3, 0xA0200AFE, 0x2710EDFF,
+0x7C01FEE0, 0x60C36CCC, 0x657002FC, 0x6BBC3B2C,
+0x01FC60B3, 0x0F1460C3, 0x0F2460B3, 0x04FC60C3,
+0x342C7E01, 0x01FC604C, 0x251A62D3, 0xD43C225A,
+0x2750602C, 0x064E4008, 0x2D6A4D19, 0x3EA27701,
+0x66D78BDF, 0x4018E001, 0x0F646563, 0x70014519,
+0x0F544629, 0x0F647001, 0x70014619, 0x90420F64,
+0xE0450EFE, 0xEA014008, 0xE0460FF6, 0x4A184008,
+0xED0067F3, 0x0FF637AC, 0x0FF67004, 0xE345E104,
+0x7C014308, 0x6CCC33FC, 0x60C36432, 0x5531024C,
+0x6BBC3B2C, 0x045C60B3, 0x60C35A32, 0x60B30A44,
+0x60C30F24, 0x6A7006FC, 0x606C362C, 0x66E005FC,
+0x6A5C64AC, 0x626C24AA, 0x89053420, 0x4D084D08,
+0xCB0460D3, 0x600BA006, 0x7D014110, 0x8FD67701,
+0xE0007E01, 0x3F3C9308, 0x6EF64F26, 0x6CF66DF6,
+0x000B6BF6, 0x01386AF6, 0x00000120, 0x00200D54,
+0x002002BE, 0x00102800, 0x00200D64, 0x0010F00A,
+0x0010F000, 0x001C001C, 0x00103252, 0x00200DA0,
+0x0010FFFC, 0x00200D7C, 0x0020032C, 0x00200370,
+0x00200954, 0x0009000B, 0x2FD62FC6, 0x4F222FE6,
+0x6D436C53, 0xEE00A004, 0x7E0164D4, 0x644CBFF2,
+0x8BF93EC2, 0x6EF64F26, 0x000B6DF6, 0xE5006CF6,
+0x6643A002, 0x76017501, 0x22286260, 0xAFE38BFA,
+0x2FE60009, 0x75076253, 0xE1086753, 0x6043EE0A,
+0x4409C90F, 0x650330E2, 0x8D014409, 0xE630E637,
+0x4110365C, 0x8FF22760, 0xE00077FF, 0x000B8028,
+0x4F226EF6, 0xBFE47FEC, 0xBFD865F3, 0x7F1464F3,
+0x000B4F26, 0x4F22E000, 0xBFDA7FEC, 0x64F365F3,
+0x7406BFCD, 0x4F267F14, 0xE000000B, 0x4F222FE6,
+0x62537FEC, 0x65F36E43, 0x6423BFCB, 0x64E3BFBF,
+0x64F3BFBD, 0xBFBAD403, 0x7F140009, 0x000B4F26,
+0x00006EF6, 0x00200DB0, 0x89004011, 0x4111600B,
+0x4F228906, 0x611BB004, 0x000B4F26, 0x0009600B,
+0x620D2F26, 0x8F413020, 0x40180019, 0x8B0D3016,
+0x31043104, 0x31043104, 0x31043104, 0x31043104,
+0x890062F6, 0x4119310C, 0x6013000B, 0x41296219,
+0x20084018, 0x31048927, 0x31043104, 0x31043104,
+0x31043104, 0x31043104, 0x31043104, 0x31043104,
+0x31043104, 0x61193104, 0x3204221D, 0x32043204,
+0x32043204, 0x32043204, 0x32043204, 0x32043204,
+0x32043204, 0x32043204, 0x89003204, 0x4229320C,
+0x000B6023, 0xE00062F6, 0x62F6000B, 0x42286213,
+0x42244129, 0x42243104, 0x42243104, 0x42243104,
+0x42243104, 0x42243104, 0x42243104, 0x42243104,
+0x42243104, 0x42243104, 0x42243104, 0x42243104,
+0x42243104, 0x42243104, 0x42243104, 0x42243104,
+0x89003104, 0x6013310C, 0x62F6000B, 0x2F262F16,
+0x51F552F3, 0x52F22129, 0x52F41210, 0x212951F6,
+0x121152F2, 0x000B62F6, 0x000061F6, 0x51F32F16,
+0x310050F1, 0x51F48B02, 0x310050F2, 0x000B0029,
+0x000061F6, 0x51F32F16, 0x310050F1, 0x51F48B06,
+0x310050F2, 0xCA010029, 0x61F6000B, 0x000BE001,
+0x000061F6, 0x50F0000B, 0x2F262F16, 0xE10052F2,
+0x12001211, 0x000B62F6, 0x000061F6, 0x2F162F06,
+0x8B264115, 0x3103E040, 0x2F26892B, 0x52F62F36,
+0xE02053F5, 0x8B053103, 0xE3006233, 0x89093100,
+0x3108A002, 0x8B0F2338, 0xD0064F22, 0x6023400B,
+0x4F266203, 0x112151F4, 0x63F61130, 0x61F662F6,
+0x60F6000B, 0x002007F4, 0x4100C709, 0x0123011D,
+0x51F20009, 0x110150F4, 0x110050F3, 0x000B61F6,
+0x51F260F6, 0x1101E000, 0x61F61100, 0x60F6000B,
+0x01300000, 0x0128012C, 0x01200124, 0x0118011C,
+0x0106010A, 0x00FE0102, 0x00E200E6, 0x00DA00DE,
+0x00CC00D0, 0x00C400C8, 0x00A800AC, 0x00A000A4,
+0x008C0090, 0x00840088, 0x0066006A, 0x005E0062,
+0x42244300, 0x42244300, 0x42244300, 0x43286133,
+0x43084318, 0x42284308, 0x42084218, 0x41094208,
+0xAFAF4109, 0x4300221B, 0x43004224, 0x43004224,
+0x61334224, 0x43184328, 0x42184228, 0xAFA14119,
+0x4300221B, 0x43004224, 0x43004224, 0x61334224,
+0x43084328, 0x42284308, 0x42084208, 0x41094119,
+0xAF8F4109, 0x4300221B, 0x43004224, 0x43004224,
+0x61334224, 0x212D4328, 0x6213AF84, 0x42244300,
+0x42244300, 0x42244300, 0x43186133, 0x43084308,
+0x42084218, 0x41294208, 0x41094109, 0x221BAF72,
+0x42244300, 0x42244300, 0x42244300, 0x43186133,
+0x41294218, 0xAF654119, 0x4300221B, 0x43004224,
+0x43004224, 0x43004224, 0x43004224, 0x43004224,
+0x43004224, 0x4224AF56, 0x2F162F06, 0x8B264115,
+0x3103E040, 0x2F26892B, 0x52F62F36, 0xE02053F5,
+0x8B053103, 0xE2006323, 0x89093100, 0x3108A002,
+0x8B0F2228, 0xD0064F22, 0x6033400B, 0x4F266303,
+0x112151F4, 0x63F61130, 0x61F662F6, 0x60F6000B,
+0x002008B4, 0x4100C709, 0x0123011D, 0x51F20009,
+0x110150F4, 0x110050F3, 0x000B61F6, 0x51F260F6,
+0x1101E000, 0x61F61100, 0x60F6000B, 0x012E0000,
+0x0126012A, 0x011E0122, 0x0116011A, 0x01040108,
+0x00FC0100, 0x00E000E4, 0x00D800DC, 0x00CC00D0,
+0x00C400C8, 0x00A800AC, 0x00A000A4, 0x008C0090,
+0x00840088, 0x0066006A, 0x005E0062, 0x43254201,
+0x43254201, 0x43254201, 0x42296123, 0x42094219,
+0x43294209, 0x43094319, 0x41084309, 0xAFAF4108,
+0x4201231B, 0x42014325, 0x42014325, 0x61234325,
+0x42194229, 0x43194329, 0xAFA14118, 0x4201231B,
+0x42014325, 0x42014325, 0x61234325, 0x42094229,
+0x43294209, 0x43094309, 0x41084118, 0xAF8F4108,
+0x4201231B, 0x42014325, 0x42014325, 0x61234325,
+0xAF854229, 0x4201231D, 0x42014325, 0x42014325,
+0x61234325, 0x42094219, 0x43194209, 0x43094309,
+0x41084128, 0xAF734108, 0x4201231B, 0x42014325,
+0x42014325, 0x61234325, 0x43194219, 0x41184128,
+0x231BAF66, 0x43254201, 0x43254201, 0x43254201,
+0x43254201, 0x43254201, 0x43254201, 0xAF574201,
+0x00004325, 0x080A0C0E, 0x00020406, 0x1A1C1E20,
+0x12141618, 0x2E303234, 0x26282A2C, 0x3A3C3E40,
+0x6C625648, 0x41112F26, 0xE2208F18, 0x890B3123,
+0x321CD204, 0xD1026220, 0x412B312C, 0x00090009,
+0x0020081E, 0x002007D4, 0x000BE000, 0x400062F6,
+0x40004000, 0x40004000, 0x40004000, 0x62F6000B,
+0x40004000, 0x40004000, 0x40004000, 0x40184000,
+0x62F6000B, 0x40004000, 0x40004000, 0x40004000,
+0x40284000, 0x62F6000B, 0x40004000, 0x40184000,
+0x000B4028, 0xC90F62F6, 0x40054005, 0x40054005,
+0x62F6000B, 0x4005C907, 0x40054005, 0x62F6000B,
+0x4005C903, 0x000B4005, 0xC90162F6, 0x000B4005,
+0x000062F6, 0x080A0C0E, 0x00020406, 0x1A1C1E20,
+0x12141618, 0x2E303234, 0x26282A2C, 0x3A3C3E40,
+0x6C625648, 0x41112F26, 0xE2208F18, 0x890B3123,
+0x321CD204, 0xD1026220, 0x412B312C, 0x00090009,
+0x002008DE, 0x00200894, 0x000BE000, 0x400162F6,
+0x40014001, 0x40014001, 0x40014001, 0x62F6000B,
+0x40014001, 0x40014001, 0x40014001, 0x40194001,
+0x62F6000B, 0x40014001, 0x40014001, 0x40014001,
+0x40294001, 0x62F6000B, 0x40014001, 0x40194001,
+0x000B4029, 0x400462F6, 0x40044004, 0xC90F4004,
+0x62F6000B, 0x40044004, 0xC9074004, 0x62F6000B,
+0x40044004, 0x000BC903, 0x400462F6, 0x000BC901,
+0x000062F6, 0x00000000, 0x77073096, 0xEE0E612C,
+0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535,
+0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E,
+0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07,
+0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148,
+0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551,
+0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A,
+0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63,
+0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4,
+0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD,
+0xA50AB56B, 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6,
+0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF,
+0xABD13D59, 0x26D930AC, 0x51DE003A, 0xC8D75180,
+0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599,
+0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2,
+0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB,
+0xB6662D3D, 0x76DC4190, 0x01DB7106, 0x98D220BC,
+0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5,
+0xE8B8D433, 0x7807C9A2, 0x0F00F934, 0x9609A88E,
+0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97,
+0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8,
+0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1,
+0xF50FC457, 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA,
+0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3,
+0xFBD44C65, 0x4DB26158, 0x3AB551CE, 0xA3BC0074,
+0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D,
+0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846,
+0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F,
+0xDD0D7CC9, 0x5005713C, 0x270241AA, 0xBE0B1010,
+0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409,
+0xCE61E49F, 0x5EDEF90E, 0x29D9C998, 0xB0D09822,
+0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B,
+0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C,
+0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615,
+0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E,
+0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27,
+0x7D079EB1, 0xF00F9344, 0x8708A3D2, 0x1E01F268,
+0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671,
+0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A,
+0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43,
+0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4,
+0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD,
+0x48B2364B, 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6,
+0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF,
+0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0,
+0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9,
+0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92,
+0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B,
+0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C,
+0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785,
+0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE,
+0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7,
+0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8,
+0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1,
+0x18B74777, 0x88085AE6, 0xFF0F6A70, 0x66063BCA,
+0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3,
+0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354,
+0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D,
+0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66,
+0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F,
+0x30B5FFE9, 0xBDBDF21C, 0xCABAC28A, 0x53B39330,
+0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729,
+0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02,
+0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B,
+0x2D02EF8D, 0x544F0D0A, 0x50205355, 0x20312D48,
+0x003A5746, 0x72636564, 0x69747079, 0x65206E6F,
+0x726F7272, 0x0A0D2121, 0x00000000, 0x6564667A,
+0x70797263, 0x65725F74, 0x616C7567, 0x79726F74,
+0x6261745F, 0x7220656C, 0x203D7465, 0x00000000,
+0x45485441, 0x38731652, 0x89ACFF91, 0xEE55D178,
+0xEE000D0A, };
+
+const u32_t zcFwImageSize=3508;
diff --git a/drivers/staging/otus/hal/hpmain.c b/drivers/staging/otus/hal/hpmain.c
new file mode 100644
index 00000000000..2e65c466aae
--- /dev/null
+++ b/drivers/staging/otus/hal/hpmain.c
@@ -0,0 +1,4643 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include "../80211core/cprecomp.h"
+#include "hpani.h"
+#include "hpusb.h"
+#include "otus.ini"
+
+extern const u32_t zcFwImage[];
+extern const u32_t zcFwImageSize;
+extern const u32_t zcDKFwImage[];
+extern const u32_t zcDKFwImageSize;
+extern const u32_t zcFwImageSPI[];
+extern const u32_t zcFwImageSPISize;
+
+#ifdef ZM_OTUS_LINUX_PHASE_2
+extern const u32_t zcFwBufImage[];
+extern const u32_t zcFwBufImageSize;
+extern const u32_t zcP2FwImage[];
+extern const u32_t zcP2FwImageSize;
+#endif
+extern void zfInitCmdQueue(zdev_t* dev);
+extern u16_t zfIssueCmd(zdev_t* dev, u32_t* cmd, u16_t cmdLen,
+ u16_t src, u8_t* buf);
+extern void zfIdlRsp(zdev_t* dev, u32_t* rsp, u16_t rspLen);
+extern u16_t zfDelayWriteInternalReg(zdev_t* dev, u32_t addr, u32_t val);
+extern u16_t zfFlushDelayWrite(zdev_t* dev);
+extern void zfUsbInit(zdev_t* dev);
+extern u16_t zfFirmwareDownload(zdev_t* dev, u32_t* fw, u32_t len, u32_t offset);
+extern u16_t zfFirmwareDownloadNotJump(zdev_t* dev, u32_t* fw, u32_t len, u32_t offset);
+extern void zfUsbFree(zdev_t* dev);
+extern u16_t zfCwmIsExtChanBusy(u32_t ctlBusy, u32_t extBusy);
+extern void zfCoreCwmBusy(zdev_t* dev, u16_t busy);
+
+/* Prototypes */
+void zfInitRf(zdev_t* dev, u32_t frequency);
+void zfInitPhy(zdev_t* dev, u32_t frequency, u8_t bw40);
+void zfInitMac(zdev_t* dev);
+
+void zfSetPowerCalTable(zdev_t* dev, u32_t frequency, u8_t bw40, u8_t extOffset);
+void zfInitPowerCal(zdev_t* dev);
+
+#ifdef ZM_DRV_INIT_USB_MODE
+void zfInitUsbMode(zdev_t* dev);
+u16_t zfHpUsbReset(zdev_t* dev);
+#endif
+
+/* Bank 0 1 2 3 5 6 7 */
+void zfSetRfRegs(zdev_t* dev, u32_t frequency);
+/* Bank 4 */
+void zfSetBank4AndPowerTable(zdev_t* dev, u32_t frequency, u8_t bw40,
+ u8_t extOffset);
+/* Get param for turnoffdyn */
+void zfGetHwTurnOffdynParam(zdev_t* dev,
+ u32_t frequency, u8_t bw40, u8_t extOffset,
+ int* delta_slope_coeff_exp,
+ int* delta_slope_coeff_man,
+ int* delta_slope_coeff_exp_shgi,
+ int* delta_slope_coeff_man_shgi);
+
+void zfSelAdcClk(zdev_t* dev, u8_t bw40, u32_t frequency);
+u32_t zfHpEchoCommand(zdev_t* dev, u32_t value);
+
+
+
+#define zm_hp_priv(x) (((struct zsHpPriv*)wd->hpPrivate)->x)
+struct zsHpPriv zgHpPriv;
+
+#define ZM_FIRMWARE_WLAN_ADDR 0x200000
+#define ZM_FIRMWARE_SPI_ADDR 0x114000
+/* 0: real chip 1: FPGA test */
+#define ZM_FPGA_PHY 0
+
+#define reg_write(addr, val) zfDelayWriteInternalReg(dev, addr+0x1bc000, val)
+#define zm_min(A, B) ((A>B)? B:A)
+
+
+/******************** Intialization ********************/
+u16_t zfHpInit(zdev_t* dev, u32_t frequency)
+{
+ u16_t ret;
+ zmw_get_wlan_dev(dev);
+
+ /* Initializa HAL Plus private variables */
+ wd->hpPrivate = &zgHpPriv;
+
+ ((struct zsHpPriv*)wd->hpPrivate)->halCapability = ZM_HP_CAP_11N;
+
+ ((struct zsHpPriv*)wd->hpPrivate)->hwFrequency = 0;
+ ((struct zsHpPriv*)wd->hpPrivate)->hwBw40 = 0;
+ ((struct zsHpPriv*)wd->hpPrivate)->hwExtOffset = 0;
+
+ ((struct zsHpPriv*)wd->hpPrivate)->disableDfsCh = 0;
+
+ ((struct zsHpPriv*)wd->hpPrivate)->ledMode[0] = 1;
+ ((struct zsHpPriv*)wd->hpPrivate)->ledMode[1] = 1;
+ ((struct zsHpPriv*)wd->hpPrivate)->strongRSSI = 0;
+ ((struct zsHpPriv*)wd->hpPrivate)->rxStrongRSSI = 0;
+
+ ((struct zsHpPriv*)wd->hpPrivate)->slotType = 1;
+ ((struct zsHpPriv*)wd->hpPrivate)->aggPktNum = 0x10000a;
+
+ ((struct zsHpPriv*)wd->hpPrivate)->eepromImageIndex = 0;
+
+
+ ((struct zsHpPriv*)wd->hpPrivate)->eepromImageRdReq = 0;
+#ifdef ZM_OTUS_RX_STREAM_MODE
+ ((struct zsHpPriv*)wd->hpPrivate)->remainBuf = NULL;
+ ((struct zsHpPriv*)wd->hpPrivate)->usbRxRemainLen = 0;
+ ((struct zsHpPriv*)wd->hpPrivate)->usbRxPktLen = 0;
+ ((struct zsHpPriv*)wd->hpPrivate)->usbRxPadLen = 0;
+ ((struct zsHpPriv*)wd->hpPrivate)->usbRxTransferLen = 0;
+#endif
+
+ ((struct zsHpPriv*)wd->hpPrivate)->enableBBHeavyClip = 1;
+ ((struct zsHpPriv*)wd->hpPrivate)->hwBBHeavyClip = 1; // force enable 8107
+ ((struct zsHpPriv*)wd->hpPrivate)->doBBHeavyClip = 0;
+ ((struct zsHpPriv*)wd->hpPrivate)->setValueHeavyClip = 0;
+
+
+ /* Initialize driver core */
+ zfInitCmdQueue(dev);
+
+ /* Initialize USB */
+ zfUsbInit(dev);
+
+#if ZM_SW_LOOP_BACK != 1
+
+ /* TODO : [Download FW] */
+ if (wd->modeMDKEnable)
+ {
+ /* download the MDK firmware */
+ if ((ret = zfFirmwareDownload(dev, (u32_t*)zcDKFwImage,
+ (u32_t)zcDKFwImageSize, ZM_FIRMWARE_WLAN_ADDR)) != ZM_SUCCESS)
+ {
+ /* TODO : exception handling */
+ //return 1;
+ }
+ }
+ else
+ {
+ #ifndef ZM_OTUS_LINUX_PHASE_2
+ /* donwload the normal frimware */
+ if ((ret = zfFirmwareDownload(dev, (u32_t*)zcFwImage,
+ (u32_t)zcFwImageSize, ZM_FIRMWARE_WLAN_ADDR)) != ZM_SUCCESS)
+ {
+ /* TODO : exception handling */
+ //return 1;
+ }
+ #else
+
+ // 1-PH fw: ReadMac() store some global variable
+ if ((ret = zfFirmwareDownloadNotJump(dev, (u32_t*)zcFwBufImage,
+ (u32_t)zcFwBufImageSize, 0x102800)) != ZM_SUCCESS)
+ {
+ DbgPrint("Dl zcFwBufImage failed!");
+ }
+
+ zfwSleep(dev, 1000);
+
+ if ((ret = zfFirmwareDownload(dev, (u32_t*)zcFwImage,
+ (u32_t)zcFwImageSize, ZM_FIRMWARE_WLAN_ADDR)) != ZM_SUCCESS)
+ {
+ DbgPrint("Dl zcFwBufImage failed!");
+ }
+ #endif
+ }
+#endif
+
+#ifdef ZM_DRV_INIT_USB_MODE
+ /* Init USB Mode */
+ zfInitUsbMode(dev);
+
+ /* Do the USB Reset */
+ zfHpUsbReset(dev);
+#endif
+
+/* Register setting */
+/* ZM_DRIVER_MODEL_TYPE_MDK
+ * 1=>for MDK, disable init RF, PHY, and MAC,
+ * 0=>normal init
+ */
+//#if ((ZM_SW_LOOP_BACK != 1) && (ZM_DRIVER_MODEL_TYPE_MDK !=1))
+#if ZM_SW_LOOP_BACK != 1
+ if(!wd->modeMDKEnable)
+ {
+ /* Init MAC */
+ zfInitMac(dev);
+
+ #if ZM_FW_LOOP_BACK != 1
+ /* Init PHY */
+ zfInitPhy(dev, frequency, 0);
+
+ /* Init RF */
+ zfInitRf(dev, frequency);
+
+ #if ZM_FPGA_PHY == 0
+ /* BringUp issue */
+ //zfDelayWriteInternalReg(dev, 0x9800+0x1bc000, 0x10000007);
+ //zfFlushDelayWrite(dev);
+ #endif
+
+ #endif /* end of ZM_FW_LOOP_BACK != 1 */
+ }
+#endif /* end of ((ZM_SW_LOOP_BACK != 1) && (ZM_DRIVER_MODEL_TYPE_MDK !=1)) */
+
+ zfHpEchoCommand(dev, 0xAABBCCDD);
+
+ return 0;
+}
+
+
+u16_t zfHpReinit(zdev_t* dev, u32_t frequency)
+{
+ u16_t ret;
+ zmw_get_wlan_dev(dev);
+
+ ((struct zsHpPriv*)wd->hpPrivate)->halReInit = 1;
+
+ ((struct zsHpPriv*)wd->hpPrivate)->strongRSSI = 0;
+ ((struct zsHpPriv*)wd->hpPrivate)->rxStrongRSSI = 0;
+
+#ifdef ZM_OTUS_RX_STREAM_MODE
+ if (((struct zsHpPriv*)wd->hpPrivate)->remainBuf != NULL)
+ {
+ zfwBufFree(dev, ((struct zsHpPriv*)wd->hpPrivate)->remainBuf, 0);
+ }
+ ((struct zsHpPriv*)wd->hpPrivate)->remainBuf = NULL;
+ ((struct zsHpPriv*)wd->hpPrivate)->usbRxRemainLen = 0;
+ ((struct zsHpPriv*)wd->hpPrivate)->usbRxPktLen = 0;
+ ((struct zsHpPriv*)wd->hpPrivate)->usbRxPadLen = 0;
+ ((struct zsHpPriv*)wd->hpPrivate)->usbRxTransferLen = 0;
+#endif
+
+ zfInitCmdQueue(dev);
+ zfCoreReinit(dev);
+
+ #ifndef ZM_OTUS_LINUX_PHASE_2
+ /* Download firmware */
+ if ((ret = zfFirmwareDownload(dev, (u32_t*)zcFwImage,
+ (u32_t)zcFwImageSize, ZM_FIRMWARE_WLAN_ADDR)) != ZM_SUCCESS)
+ {
+ /* TODO : exception handling */
+ //return 1;
+ }
+ #else
+ if ((ret = zfFirmwareDownload(dev, (u32_t*)zcP2FwImage,
+ (u32_t)zcP2FwImageSize, ZM_FIRMWARE_WLAN_ADDR)) != ZM_SUCCESS)
+ {
+ /* TODO : exception handling */
+ //return 1;
+ }
+ #endif
+
+#ifdef ZM_DRV_INIT_USB_MODE
+ /* Init USB Mode */
+ zfInitUsbMode(dev);
+
+ /* Do the USB Reset */
+ zfHpUsbReset(dev);
+#endif
+
+ /* Init MAC */
+ zfInitMac(dev);
+
+ /* Init PHY */
+ zfInitPhy(dev, frequency, 0);
+ /* Init RF */
+ zfInitRf(dev, frequency);
+
+ #if ZM_FPGA_PHY == 0
+ /* BringUp issue */
+ //zfDelayWriteInternalReg(dev, 0x9800+0x1bc000, 0x10000007);
+ //zfFlushDelayWrite(dev);
+ #endif
+
+ zfHpEchoCommand(dev, 0xAABBCCDD);
+
+ return 0;
+}
+
+
+u16_t zfHpRelease(zdev_t* dev)
+{
+ /* Free USB resource */
+ zfUsbFree(dev);
+
+ return 0;
+}
+
+/* MDK mode setting for dontRetransmit */
+void zfHpConfigFM(zdev_t* dev, u32_t RxMaxSize, u32_t DontRetransmit)
+{
+ u32_t cmd[3];
+ u16_t ret;
+
+ cmd[0] = 8 | (ZM_CMD_CONFIG << 8);
+ cmd[1] = RxMaxSize; /* zgRxMaxSize */
+ cmd[2] = DontRetransmit; /* zgDontRetransmit */
+
+ ret = zfIssueCmd(dev, cmd, 12, ZM_OID_INTERNAL_WRITE, 0);
+}
+
+const u8_t zcXpdToPd[16] =
+{
+ /* 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF */
+ 0x2, 0x2, 0x2, 0x1, 0x2, 0x2, 0x6, 0x2, 0x2, 0x3, 0x7, 0x2, 0xB, 0x2, 0x2, 0x2
+};
+
+/******************** RF and PHY ********************/
+
+void zfInitPhy(zdev_t* dev, u32_t frequency, u8_t bw40)
+{
+ u16_t i, j, k;
+ u16_t entries;
+ u16_t modesIndex = 0;
+ u16_t freqIndex = 0;
+ u32_t tmp, tmp1;
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+ u32_t eepromBoardData[15][6] = {
+ /* Register A-20 A-20/40 G-20/40 G-20 G-Turbo */
+ {0x9964, 0, 0, 0, 0, 0},
+ {0x9960, 0, 0, 0, 0, 0},
+ {0xb960, 0, 0, 0, 0, 0},
+ {0x9844, 0, 0, 0, 0, 0},
+ {0x9850, 0, 0, 0, 0, 0},
+ {0x9834, 0, 0, 0, 0, 0},
+ {0x9828, 0, 0, 0, 0, 0},
+ {0xc864, 0, 0, 0, 0, 0},
+ {0x9848, 0, 0, 0, 0, 0},
+ {0xb848, 0, 0, 0, 0, 0},
+ {0xa20c, 0, 0, 0, 0, 0},
+ {0xc20c, 0, 0, 0, 0, 0},
+ {0x9920, 0, 0, 0, 0, 0},
+ {0xb920, 0, 0, 0, 0, 0},
+ {0xa258, 0, 0, 0, 0, 0},
+ };
+
+ /* #1 Save the initial value of the related RIFS register settings */
+ //((struct zsHpPriv*)wd->hpPrivate)->isInitialPhy++;
+
+ /*
+ * Setup the indices for the next set of register array writes
+ * PHY mode is static20 / 2040
+ * Frequency is 2.4GHz (B) / 5GHz (A)
+ */
+ if ( frequency > ZM_CH_G_14 )
+ {
+ /* 5GHz */
+ freqIndex = 1;
+ if (bw40)
+ {
+ modesIndex = 2;
+ zm_debug_msg0("init ar5416Modes in 2: A-20/40");
+ }
+ else
+ {
+ modesIndex = 1;
+ zm_debug_msg0("init ar5416Modes in 1: A-20");
+ }
+ }
+ else
+ {
+ /* 2.4GHz */
+ freqIndex = 2;
+ if (bw40)
+ {
+ modesIndex = 3;
+ zm_debug_msg0("init ar5416Modes in 3: G-20/40");
+ }
+ else
+ {
+ modesIndex = 4;
+ zm_debug_msg0("init ar5416Modes in 4: G-20");
+ }
+ }
+
+
+#if ZM_FPGA_PHY == 1
+ /* Starting External Hainan Register Initialization */
+ /* TODO: */
+
+ zfwSleep(dev, 10);
+#endif
+
+ /*
+ *Set correct Baseband to analog shift setting to access analog chips.
+ */
+ //reg_write(PHY_BASE, 0x00000007);
+// reg_write(0x9800, 0x00000007);
+
+ /*
+ * Write addac shifts
+ */
+ // do this in firmware
+
+
+
+ /* Zeroize board data */
+ for (j=0; j<15; j++)
+ {
+ for (k=1; k<=4; k++)
+ {
+ eepromBoardData[j][k] = 0;
+ }
+ }
+ /*
+ * Register setting by mode
+ */
+
+ entries = sizeof(ar5416Modes) / sizeof(*ar5416Modes);
+ zm_msg1_scan(ZM_LV_2, "Modes register setting entries=", entries);
+ for (i=0; i<entries; i++)
+ {
+#if 0
+ if ( ((struct zsHpPriv*)wd->hpPrivate)->hwNotFirstInit && (ar5416Modes[i][0] == 0xa27c) )
+ {
+ /* Force disable CR671 bit20 / 7823 */
+ /* The bug has to do with the polarity of the pdadc offset calibration. There */
+ /* is an initial calibration that is OK, and there is a continuous */
+ /* calibration that updates the pddac with the wrong polarity. Fortunately */
+ /* the second loop can be disabled with a bit called en_pd_dc_offset_thr. */
+
+ reg_write(ar5416Modes[i][0], (ar5416Modes[i][modesIndex]& 0xffefffff) );
+ ((struct zsHpPriv*)wd->hpPrivate)->hwNotFirstInit = 1;
+ }
+ else
+ {
+#endif
+ /* FirstTime Init or not 0xa27c(CR671) */
+ reg_write(ar5416Modes[i][0], ar5416Modes[i][modesIndex]);
+// }
+ /* Initialize board data */
+ for (j=0; j<15; j++)
+ {
+ if (ar5416Modes[i][0] == eepromBoardData[j][0])
+ {
+ for (k=1; k<=4; k++)
+ {
+ eepromBoardData[j][k] = ar5416Modes[i][k];
+ }
+ }
+ }
+ /* #1 Save the initial value of the related RIFS register settings */
+ //if( ((struct zsHpPriv*)wd->hpPrivate)->isInitialPhy == 1 )
+ {
+ switch(ar5416Modes[i][0])
+ {
+ case 0x9850 :
+ ((struct zsHpPriv*)wd->hpPrivate)->initDesiredSigSize = ar5416Modes[i][modesIndex];
+ break;
+ case 0x985c :
+ ((struct zsHpPriv*)wd->hpPrivate)->initAGC = ar5416Modes[i][modesIndex];
+ break;
+ case 0x9860 :
+ ((struct zsHpPriv*)wd->hpPrivate)->initAgcControl = ar5416Modes[i][modesIndex];
+ break;
+ case 0x9918 :
+ ((struct zsHpPriv*)wd->hpPrivate)->initSearchStartDelay = ar5416Modes[i][modesIndex];
+ break;
+ case 0x99ec :
+ ((struct zsHpPriv*)wd->hpPrivate)->initRIFSSearchParams = ar5416Modes[i][modesIndex];
+ break;
+ case 0xa388 :
+ ((struct zsHpPriv*)wd->hpPrivate)->initFastChannelChangeControl = ar5416Modes[i][modesIndex];
+ default :
+ break;
+ }
+ }
+ }
+#if 0
+ zfFlushDelayWrite(dev);
+
+ /*
+ * Common Register setting
+ */
+ entries = sizeof(ar5416Common) / sizeof(*ar5416Common);
+ for (i=0; i<entries; i++)
+ {
+ reg_write(ar5416Common[i][0], ar5416Common[i][1]);
+ }
+ zfFlushDelayWrite(dev);
+
+ /*
+ * RF Gain setting by freqIndex
+ */
+ entries = sizeof(ar5416BB_RfGain) / sizeof(*ar5416BB_RfGain);
+ for (i=0; i<entries; i++)
+ {
+ reg_write(ar5416BB_RfGain[i][0], ar5416BB_RfGain[i][freqIndex]);
+ }
+ zfFlushDelayWrite(dev);
+
+ /*
+ * Moved ar5416InitChainMask() here to ensure the swap bit is set before
+ * the pdadc table is written. Swap must occur before any radio dependent
+ * replicated register access. The pdadc curve addressing in particular
+ * depends on the consistent setting of the swap bit.
+ */
+ //ar5416InitChainMask(pDev);
+
+ /* Setup the transmit power values. */
+ // TODO
+#endif
+
+ /* Update 5G board data */
+ //Ant control common
+ tmp = hpPriv->eepromImage[0x100+0x144*2/4];
+ eepromBoardData[0][1] = tmp;
+ eepromBoardData[0][2] = tmp;
+ //Ant control chain 0
+ tmp = hpPriv->eepromImage[0x100+0x140*2/4];
+ eepromBoardData[1][1] = tmp;
+ eepromBoardData[1][2] = tmp;
+ //Ant control chain 2
+ tmp = hpPriv->eepromImage[0x100+0x142*2/4];
+ eepromBoardData[2][1] = tmp;
+ eepromBoardData[2][2] = tmp;
+ //SwSettle
+ tmp = hpPriv->eepromImage[0x100+0x146*2/4];
+ tmp = (tmp >> 16) & 0x7f;
+ eepromBoardData[3][1] &= (~((u32_t)0x3f80));
+ eepromBoardData[3][1] |= (tmp << 7);
+#if 0
+ //swSettleHt40
+ tmp = hpPriv->eepromImage[0x100+0x158*2/4];
+ tmp = (tmp) & 0x7f;
+ eepromBoardData[3][2] &= (~((u32_t)0x3f80));
+ eepromBoardData[3][2] |= (tmp << 7);
+#endif
+ //adcDesired, pdaDesired
+ tmp = hpPriv->eepromImage[0x100+0x148*2/4];
+ tmp = (tmp >> 24);
+ tmp1 = hpPriv->eepromImage[0x100+0x14a*2/4];
+ tmp1 = tmp1 & 0xff;
+ tmp = tmp + (tmp1<<8);
+ eepromBoardData[4][1] &= (~((u32_t)0xffff));
+ eepromBoardData[4][1] |= tmp;
+ eepromBoardData[4][2] &= (~((u32_t)0xffff));
+ eepromBoardData[4][2] |= tmp;
+ //TxEndToXpaOff, TxFrameToXpaOn
+ tmp = hpPriv->eepromImage[0x100+0x14a*2/4];
+ tmp = (tmp >> 24) & 0xff;
+ tmp1 = hpPriv->eepromImage[0x100+0x14c*2/4];
+ tmp1 = (tmp1 >> 8) & 0xff;
+ tmp = (tmp<<24) + (tmp<<16) + (tmp1<<8) + tmp1;
+ eepromBoardData[5][1] = tmp;
+ eepromBoardData[5][2] = tmp;
+ //TxEnaToRxOm
+ tmp = hpPriv->eepromImage[0x100+0x14c*2/4] & 0xff;
+ eepromBoardData[6][1] &= (~((u32_t)0xff0000));
+ eepromBoardData[6][1] |= (tmp<<16);
+ eepromBoardData[6][2] &= (~((u32_t)0xff0000));
+ eepromBoardData[6][2] |= (tmp<<16);
+ //Thresh62
+ tmp = hpPriv->eepromImage[0x100+0x14c*2/4];
+ tmp = (tmp >> 16) & 0x7f;
+ eepromBoardData[7][1] &= (~((u32_t)0x7f000));
+ eepromBoardData[7][1] |= (tmp<<12);
+ eepromBoardData[7][2] &= (~((u32_t)0x7f000));
+ eepromBoardData[7][2] |= (tmp<<12);
+ //TxRxAtten chain_0
+ tmp = hpPriv->eepromImage[0x100+0x146*2/4];
+ tmp = (tmp >> 24) & 0x3f;
+ eepromBoardData[8][1] &= (~((u32_t)0x3f000));
+ eepromBoardData[8][1] |= (tmp<<12);
+ eepromBoardData[8][2] &= (~((u32_t)0x3f000));
+ eepromBoardData[8][2] |= (tmp<<12);
+ //TxRxAtten chain_2
+ tmp = hpPriv->eepromImage[0x100+0x148*2/4] & 0x3f;
+ eepromBoardData[9][1] &= (~((u32_t)0x3f000));
+ eepromBoardData[9][1] |= (tmp<<12);
+ eepromBoardData[9][2] &= (~((u32_t)0x3f000));
+ eepromBoardData[9][2] |= (tmp<<12);
+ //TxRxMargin chain_0
+ tmp = hpPriv->eepromImage[0x100+0x148*2/4];
+ tmp = (tmp >> 8) & 0x3f;
+ eepromBoardData[10][1] &= (~((u32_t)0xfc0000));
+ eepromBoardData[10][1] |= (tmp<<18);
+ eepromBoardData[10][2] &= (~((u32_t)0xfc0000));
+ eepromBoardData[10][2] |= (tmp<<18);
+ //TxRxMargin chain_2
+ tmp = hpPriv->eepromImage[0x100+0x148*2/4];
+ tmp = (tmp >> 16) & 0x3f;
+ eepromBoardData[11][1] &= (~((u32_t)0xfc0000));
+ eepromBoardData[11][1] |= (tmp<<18);
+ eepromBoardData[11][2] &= (~((u32_t)0xfc0000));
+ eepromBoardData[11][2] |= (tmp<<18);
+ //iqCall chain_0, iqCallQ chain_0
+ tmp = hpPriv->eepromImage[0x100+0x14e*2/4];
+ tmp = (tmp >> 24) & 0x3f;
+ tmp1 = hpPriv->eepromImage[0x100+0x150*2/4];
+ tmp1 = (tmp1 >> 8) & 0x1f;
+ tmp = (tmp<<5) + tmp1;
+ eepromBoardData[12][1] &= (~((u32_t)0x7ff));
+ eepromBoardData[12][1] |= (tmp);
+ eepromBoardData[12][2] &= (~((u32_t)0x7ff));
+ eepromBoardData[12][2] |= (tmp);
+ //iqCall chain_2, iqCallQ chain_2
+ tmp = hpPriv->eepromImage[0x100+0x150*2/4];
+ tmp = tmp & 0x3f;
+ tmp1 = hpPriv->eepromImage[0x100+0x150*2/4];
+ tmp1 = (tmp1 >> 16) & 0x1f;
+ tmp = (tmp<<5) + tmp1;
+ eepromBoardData[13][1] &= (~((u32_t)0x7ff));
+ eepromBoardData[13][1] |= (tmp);
+ eepromBoardData[13][2] &= (~((u32_t)0x7ff));
+ eepromBoardData[13][2] |= (tmp);
+ //bsw_Margin chain_0
+ tmp = hpPriv->eepromImage[0x100+0x156*2/4];
+ tmp = (tmp >> 16) & 0xf;
+ eepromBoardData[10][1] &= (~((u32_t)0x3c00));
+ eepromBoardData[10][1] |= (tmp << 10);
+ eepromBoardData[10][2] &= (~((u32_t)0x3c00));
+ eepromBoardData[10][2] |= (tmp << 10);
+ //xpd gain mask
+ tmp = hpPriv->eepromImage[0x100+0x14e*2/4];
+ tmp = (tmp >> 8) & 0xf;
+ eepromBoardData[14][1] &= (~((u32_t)0xf0000));
+ eepromBoardData[14][1] |= (zcXpdToPd[tmp] << 16);
+ eepromBoardData[14][2] &= (~((u32_t)0xf0000));
+ eepromBoardData[14][2] |= (zcXpdToPd[tmp] << 16);
+#if 0
+ //bsw_Atten chain_0
+ tmp = hpPriv->eepromImage[0x100+0x156*2/4];
+ tmp = (tmp) & 0x1f;
+ eepromBoardData[10][1] &= (~((u32_t)0x1f));
+ eepromBoardData[10][1] |= (tmp);
+ eepromBoardData[10][2] &= (~((u32_t)0x1f));
+ eepromBoardData[10][2] |= (tmp);
+ //bsw_Margin chain_2
+ tmp = hpPriv->eepromImage[0x100+0x156*2/4];
+ tmp = (tmp >> 24) & 0xf;
+ eepromBoardData[11][1] &= (~((u32_t)0x3c00));
+ eepromBoardData[11][1] |= (tmp << 10);
+ eepromBoardData[11][2] &= (~((u32_t)0x3c00));
+ eepromBoardData[11][2] |= (tmp << 10);
+ //bsw_Atten chain_2
+ tmp = hpPriv->eepromImage[0x100+0x156*2/4];
+ tmp = (tmp >> 8) & 0x1f;
+ eepromBoardData[11][1] &= (~((u32_t)0x1f));
+ eepromBoardData[11][1] |= (tmp);
+ eepromBoardData[11][2] &= (~((u32_t)0x1f));
+ eepromBoardData[11][2] |= (tmp);
+#endif
+
+ /* Update 2.4G board data */
+ //Ant control common
+ tmp = hpPriv->eepromImage[0x100+0x170*2/4];
+ tmp = tmp >> 24;
+ tmp1 = hpPriv->eepromImage[0x100+0x172*2/4];
+ tmp = tmp + (tmp1 << 8);
+ eepromBoardData[0][3] = tmp;
+ eepromBoardData[0][4] = tmp;
+ //Ant control chain 0
+ tmp = hpPriv->eepromImage[0x100+0x16c*2/4];
+ tmp = tmp >> 24;
+ tmp1 = hpPriv->eepromImage[0x100+0x16e*2/4];
+ tmp = tmp + (tmp1 << 8);
+ eepromBoardData[1][3] = tmp;
+ eepromBoardData[1][4] = tmp;
+ //Ant control chain 2
+ tmp = hpPriv->eepromImage[0x100+0x16e*2/4];
+ tmp = tmp >> 24;
+ tmp1 = hpPriv->eepromImage[0x100+0x170*2/4];
+ tmp = tmp + (tmp1 << 8);
+ eepromBoardData[2][3] = tmp;
+ eepromBoardData[2][4] = tmp;
+ //SwSettle
+ tmp = hpPriv->eepromImage[0x100+0x174*2/4];
+ tmp = (tmp >> 8) & 0x7f;
+ eepromBoardData[3][4] &= (~((u32_t)0x3f80));
+ eepromBoardData[3][4] |= (tmp << 7);
+#if 0
+ //swSettleHt40
+ tmp = hpPriv->eepromImage[0x100+0x184*2/4];
+ tmp = (tmp >> 24) & 0x7f;
+ eepromBoardData[3][3] &= (~((u32_t)0x3f80));
+ eepromBoardData[3][3] |= (tmp << 7);
+#endif
+ //adcDesired, pdaDesired
+ tmp = hpPriv->eepromImage[0x100+0x176*2/4];
+ tmp = (tmp >> 16) & 0xff;
+ tmp1 = hpPriv->eepromImage[0x100+0x176*2/4];
+ tmp1 = tmp1 >> 24;
+ tmp = tmp + (tmp1<<8);
+ eepromBoardData[4][3] &= (~((u32_t)0xffff));
+ eepromBoardData[4][3] |= tmp;
+ eepromBoardData[4][4] &= (~((u32_t)0xffff));
+ eepromBoardData[4][4] |= tmp;
+ //TxEndToXpaOff, TxFrameToXpaOn
+ tmp = hpPriv->eepromImage[0x100+0x178*2/4];
+ tmp = (tmp >> 16) & 0xff;
+ tmp1 = hpPriv->eepromImage[0x100+0x17a*2/4];
+ tmp1 = tmp1 & 0xff;
+ tmp = (tmp << 24) + (tmp << 16) + (tmp1 << 8) + tmp1;
+ eepromBoardData[5][3] = tmp;
+ eepromBoardData[5][4] = tmp;
+ //TxEnaToRxOm
+ tmp = hpPriv->eepromImage[0x100+0x178*2/4];
+ tmp = (tmp >> 24);
+ eepromBoardData[6][3] &= (~((u32_t)0xff0000));
+ eepromBoardData[6][3] |= (tmp<<16);
+ eepromBoardData[6][4] &= (~((u32_t)0xff0000));
+ eepromBoardData[6][4] |= (tmp<<16);
+ //Thresh62
+ tmp = hpPriv->eepromImage[0x100+0x17a*2/4];
+ tmp = (tmp >> 8) & 0x7f;
+ eepromBoardData[7][3] &= (~((u32_t)0x7f000));
+ eepromBoardData[7][3] |= (tmp<<12);
+ eepromBoardData[7][4] &= (~((u32_t)0x7f000));
+ eepromBoardData[7][4] |= (tmp<<12);
+ //TxRxAtten chain_0
+ tmp = hpPriv->eepromImage[0x100+0x174*2/4];
+ tmp = (tmp >> 16) & 0x3f;
+ eepromBoardData[8][3] &= (~((u32_t)0x3f000));
+ eepromBoardData[8][3] |= (tmp<<12);
+ eepromBoardData[8][4] &= (~((u32_t)0x3f000));
+ eepromBoardData[8][4] |= (tmp<<12);
+ //TxRxAtten chain_2
+ tmp = hpPriv->eepromImage[0x100+0x174*2/4];
+ tmp = (tmp >> 24) & 0x3f;
+ eepromBoardData[9][3] &= (~((u32_t)0x3f000));
+ eepromBoardData[9][3] |= (tmp<<12);
+ eepromBoardData[9][4] &= (~((u32_t)0x3f000));
+ eepromBoardData[9][4] |= (tmp<<12);
+ //TxRxMargin chain_0
+ tmp = hpPriv->eepromImage[0x100+0x176*2/4];
+ tmp = (tmp) & 0x3f;
+ eepromBoardData[10][3] &= (~((u32_t)0xfc0000));
+ eepromBoardData[10][3] |= (tmp<<18);
+ eepromBoardData[10][4] &= (~((u32_t)0xfc0000));
+ eepromBoardData[10][4] |= (tmp<<18);
+ //TxRxMargin chain_2
+ tmp = hpPriv->eepromImage[0x100+0x176*2/4];
+ tmp = (tmp >> 8) & 0x3f;
+ eepromBoardData[11][3] &= (~((u32_t)0xfc0000));
+ eepromBoardData[11][3] |= (tmp<<18);
+ eepromBoardData[11][4] &= (~((u32_t)0xfc0000));
+ eepromBoardData[11][4] |= (tmp<<18);
+ //iqCall chain_0, iqCallQ chain_0
+ tmp = hpPriv->eepromImage[0x100+0x17c*2/4];
+ tmp = (tmp >> 16) & 0x3f;
+ tmp1 = hpPriv->eepromImage[0x100+0x17e*2/4];
+ tmp1 = (tmp1) & 0x1f;
+ tmp = (tmp<<5) + tmp1;
+ eepromBoardData[12][3] &= (~((u32_t)0x7ff));
+ eepromBoardData[12][3] |= (tmp);
+ eepromBoardData[12][4] &= (~((u32_t)0x7ff));
+ eepromBoardData[12][4] |= (tmp);
+ //iqCall chain_2, iqCallQ chain_2
+ tmp = hpPriv->eepromImage[0x100+0x17c*2/4];
+ tmp = (tmp>>24) & 0x3f;
+ tmp1 = hpPriv->eepromImage[0x100+0x17e*2/4];
+ tmp1 = (tmp1 >> 8) & 0x1f;
+ tmp = (tmp<<5) + tmp1;
+ eepromBoardData[13][3] &= (~((u32_t)0x7ff));
+ eepromBoardData[13][3] |= (tmp);
+ eepromBoardData[13][4] &= (~((u32_t)0x7ff));
+ eepromBoardData[13][4] |= (tmp);
+ //xpd gain mask
+ tmp = hpPriv->eepromImage[0x100+0x17c*2/4];
+ tmp = tmp & 0xf;
+ DbgPrint("xpd=0x%x, pd=0x%x\n", tmp, zcXpdToPd[tmp]);
+ eepromBoardData[14][3] &= (~((u32_t)0xf0000));
+ eepromBoardData[14][3] |= (zcXpdToPd[tmp] << 16);
+ eepromBoardData[14][4] &= (~((u32_t)0xf0000));
+ eepromBoardData[14][4] |= (zcXpdToPd[tmp] << 16);
+#if 0
+ //bsw_Margin chain_0
+ tmp = hpPriv->eepromImage[0x100+0x184*2/4];
+ tmp = (tmp >> 8) & 0xf;
+ eepromBoardData[10][3] &= (~((u32_t)0x3c00));
+ eepromBoardData[10][3] |= (tmp << 10);
+ eepromBoardData[10][4] &= (~((u32_t)0x3c00));
+ eepromBoardData[10][4] |= (tmp << 10);
+ //bsw_Atten chain_0
+ tmp = hpPriv->eepromImage[0x100+0x182*2/4];
+ tmp = (tmp>>24) & 0x1f;
+ eepromBoardData[10][3] &= (~((u32_t)0x1f));
+ eepromBoardData[10][3] |= (tmp);
+ eepromBoardData[10][4] &= (~((u32_t)0x1f));
+ eepromBoardData[10][4] |= (tmp);
+ //bsw_Margin chain_2
+ tmp = hpPriv->eepromImage[0x100+0x184*2/4];
+ tmp = (tmp >> 16) & 0xf;
+ eepromBoardData[11][3] &= (~((u32_t)0x3c00));
+ eepromBoardData[11][3] |= (tmp << 10);
+ eepromBoardData[11][4] &= (~((u32_t)0x3c00));
+ eepromBoardData[11][4] |= (tmp << 10);
+ //bsw_Atten chain_2
+ tmp = hpPriv->eepromImage[0x100+0x184*2/4];
+ tmp = (tmp) & 0x1f;
+ eepromBoardData[11][3] &= (~((u32_t)0x1f));
+ eepromBoardData[11][3] |= (tmp);
+ eepromBoardData[11][4] &= (~((u32_t)0x1f));
+ eepromBoardData[11][4] |= (tmp);
+#endif
+
+#if 0
+ for (j=0; j<14; j++)
+ {
+ DbgPrint("%04x, %08x, %08x, %08x, %08x\n", eepromBoardData[j][0], eepromBoardData[j][1], eepromBoardData[j][2], eepromBoardData[j][3], eepromBoardData[j][4]);
+ }
+#endif
+
+ if ((hpPriv->eepromImage[0x100+0x110*2/4]&0xff) == 0x80) //FEM TYPE
+ {
+ /* Update board data to registers */
+ for (j=0; j<15; j++)
+ {
+ reg_write(eepromBoardData[j][0], eepromBoardData[j][modesIndex]);
+
+ /* #1 Save the initial value of the related RIFS register settings */
+ //if( ((struct zsHpPriv*)wd->hpPrivate)->isInitialPhy == 1 )
+ {
+ switch(eepromBoardData[j][0])
+ {
+ case 0x9850 :
+ ((struct zsHpPriv*)wd->hpPrivate)->initDesiredSigSize = eepromBoardData[j][modesIndex];
+ break;
+ case 0x985c :
+ ((struct zsHpPriv*)wd->hpPrivate)->initAGC = eepromBoardData[j][modesIndex];
+ break;
+ case 0x9860 :
+ ((struct zsHpPriv*)wd->hpPrivate)->initAgcControl = eepromBoardData[j][modesIndex];
+ break;
+ case 0x9918 :
+ ((struct zsHpPriv*)wd->hpPrivate)->initSearchStartDelay = eepromBoardData[j][modesIndex];
+ break;
+ case 0x99ec :
+ ((struct zsHpPriv*)wd->hpPrivate)->initRIFSSearchParams = eepromBoardData[j][modesIndex];
+ break;
+ case 0xa388 :
+ ((struct zsHpPriv*)wd->hpPrivate)->initFastChannelChangeControl = eepromBoardData[j][modesIndex];
+ default :
+ break;
+ }
+ }
+ }
+ } /* if ((hpPriv->eepromImage[0x100+0x110*2/4]&0xff) == 0x80) //FEM TYPE */
+
+
+ /* Bringup issue : force tx gain */
+ //reg_write(0xa258, 0x0cc65381);
+ //reg_write(0xa274, 0x0a1a7c15);
+ zfInitPowerCal(dev);
+
+ if(frequency > ZM_CH_G_14)
+ {
+ zfDelayWriteInternalReg(dev, 0x1d4014, 0x5143);
+ }
+ else
+ {
+ zfDelayWriteInternalReg(dev, 0x1d4014, 0x5163);
+ }
+
+ zfFlushDelayWrite(dev);
+}
+
+
+void zfInitRf(zdev_t* dev, u32_t frequency)
+{
+ u32_t cmd[8];
+ u16_t ret;
+ int delta_slope_coeff_exp;
+ int delta_slope_coeff_man;
+ int delta_slope_coeff_exp_shgi;
+ int delta_slope_coeff_man_shgi;
+
+ zmw_get_wlan_dev(dev);
+
+ zm_debug_msg1(" initRf frequency = ", frequency);
+
+ if (frequency == 0)
+ {
+ frequency = 2412;
+ }
+
+ /* Bank 0 1 2 3 5 6 7 */
+ zfSetRfRegs(dev, frequency);
+ /* Bank 4 */
+ zfSetBank4AndPowerTable(dev, frequency, 0, 0);
+
+ /* stroe frequency */
+ ((struct zsHpPriv*)wd->hpPrivate)->hwFrequency = (u16_t)frequency;
+
+ zfGetHwTurnOffdynParam(dev,
+ frequency, 0, 0,
+ &delta_slope_coeff_exp,
+ &delta_slope_coeff_man,
+ &delta_slope_coeff_exp_shgi,
+ &delta_slope_coeff_man_shgi);
+
+ /* related functions */
+ frequency = frequency*1000;
+ cmd[0] = 28 | (ZM_CMD_RF_INIT << 8);
+ cmd[1] = frequency;
+ cmd[2] = 0;//((struct zsHpPriv*)wd->hpPrivate)->hw_DYNAMIC_HT2040_EN;
+ cmd[3] = 1;//((wd->ExtOffset << 2) | ((struct zsHpPriv*)wd->hpPrivate)->hw_HT_ENABLE);
+ cmd[4] = delta_slope_coeff_exp;
+ cmd[5] = delta_slope_coeff_man;
+ cmd[6] = delta_slope_coeff_exp_shgi;
+ cmd[7] = delta_slope_coeff_man_shgi;
+
+ ret = zfIssueCmd(dev, cmd, 32, ZM_OID_INTERNAL_WRITE, 0);
+
+ // delay temporarily, wait for new PHY and RF
+ zfwSleep(dev, 1000);
+}
+
+int tn(int exp)
+{
+ int i;
+ int tmp = 1;
+ for(i=0; i<exp; i++)
+ tmp = tmp*2;
+
+ return tmp;
+}
+
+/*int zfFloor(double indata)
+{
+ if(indata<0)
+ return (int)indata-1;
+ else
+ return (int)indata;
+}
+*/
+u32_t reverse_bits(u32_t chan_sel)
+{
+ /* reverse_bits */
+ u32_t chansel = 0;
+ u8_t i;
+
+ for (i=0; i<8; i++)
+ chansel |= ((chan_sel>>(7-i) & 0x1) << i);
+ return chansel;
+}
+
+/* Bank 0 1 2 3 5 6 7 */
+void zfSetRfRegs(zdev_t* dev, u32_t frequency)
+{
+ u16_t entries;
+ u16_t freqIndex = 0;
+ u16_t i;
+
+ //zmw_get_wlan_dev(dev);
+
+ if ( frequency > ZM_CH_G_14 )
+ {
+ /* 5G */
+ freqIndex = 1;
+ zm_msg0_scan(ZM_LV_2, "Set to 5GHz");
+
+ }
+ else
+ {
+ /* 2.4G */
+ freqIndex = 2;
+ zm_msg0_scan(ZM_LV_2, "Set to 2.4GHz");
+ }
+
+#if 1
+ entries = sizeof(otusBank) / sizeof(*otusBank);
+ for (i=0; i<entries; i++)
+ {
+ reg_write(otusBank[i][0], otusBank[i][freqIndex]);
+ }
+#else
+ /* Bank0 */
+ entries = sizeof(ar5416Bank0) / sizeof(*ar5416Bank0);
+ for (i=0; i<entries; i++)
+ {
+ reg_write(ar5416Bank0[i][0], ar5416Bank0[i][1]);
+ }
+ /* Bank1 */
+ entries = sizeof(ar5416Bank1) / sizeof(*ar5416Bank1);
+ for (i=0; i<entries; i++)
+ {
+ reg_write(ar5416Bank1[i][0], ar5416Bank1[i][1]);
+ }
+ /* Bank2 */
+ entries = sizeof(ar5416Bank2) / sizeof(*ar5416Bank2);
+ for (i=0; i<entries; i++)
+ {
+ reg_write(ar5416Bank2[i][0], ar5416Bank2[i][1]);
+ }
+ /* Bank3 */
+ entries = sizeof(ar5416Bank3) / sizeof(*ar5416Bank3);
+ for (i=0; i<entries; i++)
+ {
+ reg_write(ar5416Bank3[i][0], ar5416Bank3[i][freqIndex]);
+ }
+ /* Bank5 */
+ reg_write (0x98b0, 0x00000013);
+ reg_write (0x98e4, 0x00000002);
+ /* Bank6 */
+ entries = sizeof(ar5416Bank6) / sizeof(*ar5416Bank6);
+ for (i=0; i<entries; i++)
+ {
+ reg_write(ar5416Bank6[i][0], ar5416Bank6[i][freqIndex]);
+ }
+ /* Bank7 */
+ entries = sizeof(ar5416Bank7) / sizeof(*ar5416Bank7);
+ for (i=0; i<entries; i++)
+ {
+ reg_write(ar5416Bank7[i][0], ar5416Bank7[i][1]);
+ }
+#endif
+
+ zfFlushDelayWrite(dev);
+}
+
+/* Bank 4 */
+void zfSetBank4AndPowerTable(zdev_t* dev, u32_t frequency, u8_t bw40,
+ u8_t extOffset)
+{
+ u32_t chup = 1;
+ u32_t bmode_LF_synth_freq = 0;
+ u32_t amode_refsel_1 = 0;
+ u32_t amode_refsel_0 = 1;
+ u32_t addr2 = 1;
+ u32_t addr1 = 0;
+ u32_t addr0 = 0;
+
+ u32_t d1;
+ u32_t d0;
+ u32_t tmp_0;
+ u32_t tmp_1;
+ u32_t data0;
+ u32_t data1;
+
+ u8_t chansel;
+ u8_t chan_sel;
+ u32_t temp_chan_sel;
+
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+
+
+ /* if enable 802.11h, need to record curent channel index in channel array */
+ if (wd->sta.DFSEnable)
+ {
+ for (i = 0; i < wd->regulationTable.allowChannelCnt; i++)
+ {
+ if (wd->regulationTable.allowChannel[i].channel == frequency)
+ break;
+ }
+ wd->regulationTable.CurChIndex = i;
+ }
+
+ if (bw40 == 1)
+ {
+ if (extOffset == 1)
+ {
+ frequency += 10;
+ }
+ else
+ {
+ frequency -= 10;
+ }
+
+ }
+
+
+ if ( frequency > 3000 )
+ {
+ if ( frequency % 10 )
+ {
+ /* 5M */
+ chan_sel = (u8_t)((frequency - 4800)/5);
+ chan_sel = (u8_t)(chan_sel & 0xff);
+ chansel = (u8_t)reverse_bits(chan_sel);
+ }
+ else
+ {
+ /* 10M : improve Tx EVM */
+ chan_sel = (u8_t)((frequency - 4800)/10);
+ chan_sel = (u8_t)(chan_sel & 0xff)<<1;
+ chansel = (u8_t)reverse_bits(chan_sel);
+
+ amode_refsel_1 = 1;
+ amode_refsel_0 = 0;
+ }
+ }
+ else
+ {
+ //temp_chan_sel = (((frequency - 672)*2) - 3040)/10;
+ if (frequency == 2484)
+ {
+ temp_chan_sel = 10 + (frequency - 2274)/5 ;
+ bmode_LF_synth_freq = 1;
+ }
+ else
+ {
+ temp_chan_sel = 16 + (frequency - 2272)/5 ;
+ bmode_LF_synth_freq = 0;
+ }
+ chan_sel = (u8_t)(temp_chan_sel << 2) & 0xff;
+ chansel = (u8_t)reverse_bits(chan_sel);
+ }
+
+ d1 = chansel; //# 8 bits of chan
+ d0 = addr0<<7 | addr1<<6 | addr2<<5
+ | amode_refsel_0<<3 | amode_refsel_1<<2
+ | bmode_LF_synth_freq<<1 | chup;
+
+ tmp_0 = d0 & 0x1f; //# 5-1
+ tmp_1 = d1 & 0x1f; //# 5-1
+ data0 = tmp_1<<5 | tmp_0;
+
+ tmp_0 = d0>>5 & 0x7; //# 8-6
+ tmp_1 = d1>>5 & 0x7; //# 8-6
+ data1 = tmp_1<<5 | tmp_0;
+
+ /* Bank4 */
+ reg_write (0x9800+(0x2c<<2), data0);
+ reg_write (0x9800+(0x3a<<2), data1);
+ //zm_debug_msg1("0x9800+(0x2c<<2 = ", data0);
+ //zm_debug_msg1("0x9800+(0x3a<<2 = ", data1);
+
+
+ zfFlushDelayWrite(dev);
+
+ zfwSleep(dev, 10);
+
+ return;
+}
+
+
+struct zsPhyFreqPara
+{
+ u32_t coeff_exp;
+ u32_t coeff_man;
+ u32_t coeff_exp_shgi;
+ u32_t coeff_man_shgi;
+};
+
+struct zsPhyFreqTable
+{
+ u32_t frequency;
+ struct zsPhyFreqPara FpgaDynamicHT;
+ struct zsPhyFreqPara FpgaStaticHT;
+ struct zsPhyFreqPara ChipST20Mhz;
+ struct zsPhyFreqPara Chip2040Mhz;
+ struct zsPhyFreqPara Chip2040ExtAbove;
+};
+
+const struct zsPhyFreqTable zgPhyFreqCoeff[] =
+{
+/*Index freq FPGA DYNAMIC_HT2040_EN FPGA STATIC_HT20 Real Chip static20MHz Real Chip 2040MHz Real Chip 2040Mhz */
+ /* fclk = 10.8 21.6 40 ext below 40 ext above 40 */
+/* 0 */ {2412, {5, 23476, 5, 21128}, {4, 23476, 4, 21128}, {3, 21737, 3, 19563}, {3, 21827, 3, 19644}, {3, 21647, 3, 19482}},
+/* 1 */ {2417, {5, 23427, 5, 21084}, {4, 23427, 4, 21084}, {3, 21692, 3, 19523}, {3, 21782, 3, 19604}, {3, 21602, 3, 19442}},
+/* 2 */ {2422, {5, 23379, 5, 21041}, {4, 23379, 4, 21041}, {3, 21647, 3, 19482}, {3, 21737, 3, 19563}, {3, 21558, 3, 19402}},
+/* 3 */ {2427, {5, 23330, 5, 20997}, {4, 23330, 4, 20997}, {3, 21602, 3, 19442}, {3, 21692, 3, 19523}, {3, 21514, 3, 19362}},
+/* 4 */ {2432, {5, 23283, 5, 20954}, {4, 23283, 4, 20954}, {3, 21558, 3, 19402}, {3, 21647, 3, 19482}, {3, 21470, 3, 19323}},
+/* 5 */ {2437, {5, 23235, 5, 20911}, {4, 23235, 4, 20911}, {3, 21514, 3, 19362}, {3, 21602, 3, 19442}, {3, 21426, 3, 19283}},
+/* 6 */ {2442, {5, 23187, 5, 20868}, {4, 23187, 4, 20868}, {3, 21470, 3, 19323}, {3, 21558, 3, 19402}, {3, 21382, 3, 19244}},
+/* 7 */ {2447, {5, 23140, 5, 20826}, {4, 23140, 4, 20826}, {3, 21426, 3, 19283}, {3, 21514, 3, 19362}, {3, 21339, 3, 19205}},
+/* 8 */ {2452, {5, 23093, 5, 20783}, {4, 23093, 4, 20783}, {3, 21382, 3, 19244}, {3, 21470, 3, 19323}, {3, 21295, 3, 19166}},
+/* 9 */ {2457, {5, 23046, 5, 20741}, {4, 23046, 4, 20741}, {3, 21339, 3, 19205}, {3, 21426, 3, 19283}, {3, 21252, 3, 19127}},
+/* 10 */ {2462, {5, 22999, 5, 20699}, {4, 22999, 4, 20699}, {3, 21295, 3, 19166}, {3, 21382, 3, 19244}, {3, 21209, 3, 19088}},
+/* 11 */ {2467, {5, 22952, 5, 20657}, {4, 22952, 4, 20657}, {3, 21252, 3, 19127}, {3, 21339, 3, 19205}, {3, 21166, 3, 19050}},
+/* 12 */ {2472, {5, 22906, 5, 20615}, {4, 22906, 4, 20615}, {3, 21209, 3, 19088}, {3, 21295, 3, 19166}, {3, 21124, 3, 19011}},
+/* 13 */ {2484, {5, 22795, 5, 20516}, {4, 22795, 4, 20516}, {3, 21107, 3, 18996}, {3, 21192, 3, 19073}, {3, 21022, 3, 18920}},
+/* 14 */ {4920, {6, 23018, 6, 20716}, {5, 23018, 5, 20716}, {4, 21313, 4, 19181}, {4, 21356, 4, 19220}, {4, 21269, 4, 19142}},
+/* 15 */ {4940, {6, 22924, 6, 20632}, {5, 22924, 5, 20632}, {4, 21226, 4, 19104}, {4, 21269, 4, 19142}, {4, 21183, 4, 19065}},
+/* 16 */ {4960, {6, 22832, 6, 20549}, {5, 22832, 5, 20549}, {4, 21141, 4, 19027}, {4, 21183, 4, 19065}, {4, 21098, 4, 18988}},
+/* 17 */ {4980, {6, 22740, 6, 20466}, {5, 22740, 5, 20466}, {4, 21056, 4, 18950}, {4, 21098, 4, 18988}, {4, 21014, 4, 18912}},
+/* 18 */ {5040, {6, 22469, 6, 20223}, {5, 22469, 5, 20223}, {4, 20805, 4, 18725}, {4, 20846, 4, 18762}, {4, 20764, 4, 18687}},
+/* 19 */ {5060, {6, 22381, 6, 20143}, {5, 22381, 5, 20143}, {4, 20723, 4, 18651}, {4, 20764, 4, 18687}, {4, 20682, 4, 18614}},
+/* 20 */ {5080, {6, 22293, 6, 20063}, {5, 22293, 5, 20063}, {4, 20641, 4, 18577}, {4, 20682, 4, 18614}, {4, 20601, 4, 18541}},
+/* 21 */ {5180, {6, 21862, 6, 19676}, {5, 21862, 5, 19676}, {4, 20243, 4, 18219}, {4, 20282, 4, 18254}, {4, 20204, 4, 18183}},
+/* 22 */ {5200, {6, 21778, 6, 19600}, {5, 21778, 5, 19600}, {4, 20165, 4, 18148}, {4, 20204, 4, 18183}, {4, 20126, 4, 18114}},
+/* 23 */ {5220, {6, 21695, 6, 19525}, {5, 21695, 5, 19525}, {4, 20088, 4, 18079}, {4, 20126, 4, 18114}, {4, 20049, 4, 18044}},
+/* 24 */ {5240, {6, 21612, 6, 19451}, {5, 21612, 5, 19451}, {4, 20011, 4, 18010}, {4, 20049, 4, 18044}, {4, 19973, 4, 17976}},
+/* 25 */ {5260, {6, 21530, 6, 19377}, {5, 21530, 5, 19377}, {4, 19935, 4, 17941}, {4, 19973, 4, 17976}, {4, 19897, 4, 17907}},
+/* 26 */ {5280, {6, 21448, 6, 19303}, {5, 21448, 5, 19303}, {4, 19859, 4, 17873}, {4, 19897, 4, 17907}, {4, 19822, 4, 17840}},
+/* 27 */ {5300, {6, 21367, 6, 19230}, {5, 21367, 5, 19230}, {4, 19784, 4, 17806}, {4, 19822, 4, 17840}, {4, 19747, 4, 17772}},
+/* 28 */ {5320, {6, 21287, 6, 19158}, {5, 21287, 5, 19158}, {4, 19710, 4, 17739}, {4, 19747, 4, 17772}, {4, 19673, 4, 17706}},
+/* 29 */ {5500, {6, 20590, 6, 18531}, {5, 20590, 5, 18531}, {4, 19065, 4, 17159}, {4, 19100, 4, 17190}, {4, 19030, 4, 17127}},
+/* 30 */ {5520, {6, 20516, 6, 18464}, {5, 20516, 5, 18464}, {4, 18996, 4, 17096}, {4, 19030, 4, 17127}, {4, 18962, 4, 17065}},
+/* 31 */ {5540, {6, 20442, 6, 18397}, {5, 20442, 5, 18397}, {4, 18927, 4, 17035}, {4, 18962, 4, 17065}, {4, 18893, 4, 17004}},
+/* 32 */ {5560, {6, 20368, 6, 18331}, {5, 20368, 5, 18331}, {4, 18859, 4, 16973}, {4, 18893, 4, 17004}, {4, 18825, 4, 16943}},
+/* 33 */ {5580, {6, 20295, 6, 18266}, {5, 20295, 5, 18266}, {4, 18792, 4, 16913}, {4, 18825, 4, 16943}, {4, 18758, 4, 16882}},
+/* 34 */ {5600, {6, 20223, 6, 18200}, {5, 20223, 5, 18200}, {4, 18725, 4, 16852}, {4, 18758, 4, 16882}, {4, 18691, 4, 16822}},
+/* 35 */ {5620, {6, 20151, 6, 18136}, {5, 20151, 5, 18136}, {4, 18658, 4, 16792}, {4, 18691, 4, 16822}, {4, 18625, 4, 16762}},
+/* 36 */ {5640, {6, 20079, 6, 18071}, {5, 20079, 5, 18071}, {4, 18592, 4, 16733}, {4, 18625, 4, 16762}, {4, 18559, 4, 16703}},
+/* 37 */ {5660, {6, 20008, 6, 18007}, {5, 20008, 5, 18007}, {4, 18526, 4, 16673}, {4, 18559, 4, 16703}, {4, 18493, 4, 16644}},
+/* 38 */ {5680, {6, 19938, 6, 17944}, {5, 19938, 5, 17944}, {4, 18461, 4, 16615}, {4, 18493, 4, 16644}, {4, 18428, 4, 16586}},
+/* 39 */ {5700, {6, 19868, 6, 17881}, {5, 19868, 5, 17881}, {4, 18396, 4, 16556}, {4, 18428, 4, 16586}, {4, 18364, 4, 16527}},
+/* 40 */ {5745, {6, 19712, 6, 17741}, {5, 19712, 5, 17741}, {4, 18252, 4, 16427}, {4, 18284, 4, 16455}, {4, 18220, 4, 16398}},
+/* 41 */ {5765, {6, 19644, 6, 17679}, {5, 19644, 5, 17679}, {4, 18189, 5, 32740}, {4, 18220, 4, 16398}, {4, 18157, 5, 32683}},
+/* 42 */ {5785, {6, 19576, 6, 17618}, {5, 19576, 5, 17618}, {4, 18126, 5, 32626}, {4, 18157, 5, 32683}, {4, 18094, 5, 32570}},
+/* 43 */ {5805, {6, 19508, 6, 17558}, {5, 19508, 5, 17558}, {4, 18063, 5, 32514}, {4, 18094, 5, 32570}, {4, 18032, 5, 32458}},
+/* 44 */ {5825, {6, 19441, 6, 17497}, {5, 19441, 5, 17497}, {4, 18001, 5, 32402}, {4, 18032, 5, 32458}, {4, 17970, 5, 32347}},
+/* 45 */ {5170, {6, 21904, 6, 19714}, {5, 21904, 5, 19714}, {4, 20282, 4, 18254}, {4, 20321, 4, 18289}, {4, 20243, 4, 18219}},
+/* 46 */ {5190, {6, 21820, 6, 19638}, {5, 21820, 5, 19638}, {4, 20204, 4, 18183}, {4, 20243, 4, 18219}, {4, 20165, 4, 18148}},
+/* 47 */ {5210, {6, 21736, 6, 19563}, {5, 21736, 5, 19563}, {4, 20126, 4, 18114}, {4, 20165, 4, 18148}, {4, 20088, 4, 18079}},
+/* 48 */ {5230, {6, 21653, 6, 19488}, {5, 21653, 5, 19488}, {4, 20049, 4, 18044}, {4, 20088, 4, 18079}, {4, 20011, 4, 18010}}
+};
+/* to reduce search time, please modify this define if you add or delete channel in table */
+#define First5GChannelIndex 14
+
+void zfGetHwTurnOffdynParam(zdev_t* dev,
+ u32_t frequency, u8_t bw40, u8_t extOffset,
+ int* delta_slope_coeff_exp,
+ int* delta_slope_coeff_man,
+ int* delta_slope_coeff_exp_shgi,
+ int* delta_slope_coeff_man_shgi)
+{
+ /* Get param for turnoffdyn */
+ u16_t i, arraySize;
+
+ //zmw_get_wlan_dev(dev);
+
+ arraySize = sizeof(zgPhyFreqCoeff)/sizeof(struct zsPhyFreqTable);
+ if (frequency < 3000)
+ {
+ /* 2.4GHz Channel */
+ for (i = 0; i < First5GChannelIndex; i++)
+ {
+ if (frequency == zgPhyFreqCoeff[i].frequency)
+ break;
+ }
+
+ if (i < First5GChannelIndex)
+ {
+ }
+ else
+ {
+ zm_msg1_scan(ZM_LV_0, "Unsupported 2.4G frequency = ", frequency);
+ return;
+ }
+ }
+ else
+ {
+ /* 5GHz Channel */
+ for (i = First5GChannelIndex; i < arraySize; i++)
+ {
+ if (frequency == zgPhyFreqCoeff[i].frequency)
+ break;
+ }
+
+ if (i < arraySize)
+ {
+ }
+ else
+ {
+ zm_msg1_scan(ZM_LV_0, "Unsupported 5G frequency = ", frequency);
+ return;
+ }
+ }
+
+ /* FPGA DYNAMIC_HT2040_EN fclk = 10.8 */
+ /* FPGA STATIC_HT20_ fclk = 21.6 */
+ /* Real Chip fclk = 40 */
+ #if ZM_FPGA_PHY == 1
+ //fclk = 10.8;
+ *delta_slope_coeff_exp = zgPhyFreqCoeff[i].FpgaDynamicHT.coeff_exp;
+ *delta_slope_coeff_man = zgPhyFreqCoeff[i].FpgaDynamicHT.coeff_man;
+ *delta_slope_coeff_exp_shgi = zgPhyFreqCoeff[i].FpgaDynamicHT.coeff_exp_shgi;
+ *delta_slope_coeff_man_shgi = zgPhyFreqCoeff[i].FpgaDynamicHT.coeff_man_shgi;
+ #else
+ //fclk = 40;
+ if (bw40)
+ {
+ /* ht2040 */
+ if (extOffset == 1) {
+ *delta_slope_coeff_exp = zgPhyFreqCoeff[i].Chip2040ExtAbove.coeff_exp;
+ *delta_slope_coeff_man = zgPhyFreqCoeff[i].Chip2040ExtAbove.coeff_man;
+ *delta_slope_coeff_exp_shgi = zgPhyFreqCoeff[i].Chip2040ExtAbove.coeff_exp_shgi;
+ *delta_slope_coeff_man_shgi = zgPhyFreqCoeff[i].Chip2040ExtAbove.coeff_man_shgi;
+ }
+ else {
+ *delta_slope_coeff_exp = zgPhyFreqCoeff[i].Chip2040Mhz.coeff_exp;
+ *delta_slope_coeff_man = zgPhyFreqCoeff[i].Chip2040Mhz.coeff_man;
+ *delta_slope_coeff_exp_shgi = zgPhyFreqCoeff[i].Chip2040Mhz.coeff_exp_shgi;
+ *delta_slope_coeff_man_shgi = zgPhyFreqCoeff[i].Chip2040Mhz.coeff_man_shgi;
+ }
+ }
+ else
+ {
+ /* static 20 */
+ *delta_slope_coeff_exp = zgPhyFreqCoeff[i].ChipST20Mhz.coeff_exp;
+ *delta_slope_coeff_man = zgPhyFreqCoeff[i].ChipST20Mhz.coeff_man;
+ *delta_slope_coeff_exp_shgi = zgPhyFreqCoeff[i].ChipST20Mhz.coeff_exp_shgi;
+ *delta_slope_coeff_man_shgi = zgPhyFreqCoeff[i].ChipST20Mhz.coeff_man_shgi;
+ }
+ #endif
+}
+
+/* Main routin frequency setting function */
+/* If 2.4G/5G switch, PHY need resetting BB and RF for band switch */
+/* Do the setting switch in zfSendFrequencyCmd() */
+void zfHpSetFrequencyEx(zdev_t* dev, u32_t frequency, u8_t bw40,
+ u8_t extOffset, u8_t initRF)
+{
+ u32_t cmd[9];
+ u32_t cmdB[3];
+ u16_t ret;
+ u8_t old_band;
+ u8_t new_band;
+ u32_t checkLoopCount;
+ u32_t tmpValue;
+
+ int delta_slope_coeff_exp;
+ int delta_slope_coeff_man;
+ int delta_slope_coeff_exp_shgi;
+ int delta_slope_coeff_man_shgi;
+
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv = wd->hpPrivate;
+
+ zm_msg1_scan(ZM_LV_1, "Frequency = ", frequency);
+ zm_msg1_scan(ZM_LV_1, "bw40 = ", bw40);
+ zm_msg1_scan(ZM_LV_1, "extOffset = ", extOffset);
+
+ if ( hpPriv->coldResetNeedFreq )
+ {
+ hpPriv->coldResetNeedFreq = 0;
+ initRF = 2;
+ zm_debug_msg0("zfHpSetFrequencyEx: Do ColdReset ");
+ }
+ if ( hpPriv->isSiteSurvey == 2 )
+ {
+ /* wait time for AGC and noise calibration : not in sitesurvey and connected */
+ checkLoopCount = 2000; /* 2000*100 = 200ms */
+ }
+ else
+ {
+ /* wait time for AGC and noise calibration : in sitesurvey */
+ checkLoopCount = 1000; /* 1000*100 = 100ms */
+ }
+
+ hpPriv->latestFrequency = frequency;
+ hpPriv->latestBw40 = bw40;
+ hpPriv->latestExtOffset = extOffset;
+
+ if ((hpPriv->dot11Mode == ZM_HAL_80211_MODE_IBSS_GENERAL) ||
+ (hpPriv->dot11Mode == ZM_HAL_80211_MODE_IBSS_WPA2PSK))
+ {
+ if ( frequency <= ZM_CH_G_14 )
+ {
+ /* workaround for 11g Ad Hoc beacon distribution */
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_AC0_CW, 0x7f0007);
+ //zfDelayWriteInternalReg(dev, ZM_MAC_REG_AC1_AC0_AIFS, 0x1c04901c);
+ }
+ }
+
+ /* AHB, DAC, ADC clock selection by static20/ht2040 */
+ zfSelAdcClk(dev, bw40, frequency);
+
+ /* clear bb_heavy_clip_enable */
+ reg_write(0x99e0, 0x200);
+ zfFlushDelayWrite(dev);
+
+ /* Set CTS/RTS rate */
+ if ( frequency > ZM_CH_G_14 )
+ {
+ //zfHpSetRTSCTSRate(dev, 0x10b010b); /* OFDM 6M */
+ new_band = 1;
+ }
+ else
+ {
+ //zfHpSetRTSCTSRate(dev, 0x30003); /* CCK 11M */
+ new_band = 0;
+ }
+
+ if (((struct zsHpPriv*)wd->hpPrivate)->hwFrequency > ZM_CH_G_14)
+ old_band = 1;
+ else
+ old_band = 0;
+
+ //Workaround for 2.4GHz only device
+ if ((hpPriv->OpFlags & 0x1) == 0)
+ {
+ if ((((struct zsHpPriv*)wd->hpPrivate)->hwFrequency == ZM_CH_G_1) && (frequency == ZM_CH_G_2))
+ {
+ /* Force to do band switching */
+ old_band = 1;
+ }
+ }
+
+ /* Notify channel switch to firmware */
+ /* TX/RX must be stopped by now */
+ cmd[0] = 0 | (ZM_CMD_FREQ_STRAT << 8);
+ ret = zfIssueCmd(dev, cmd, 8, ZM_OID_INTERNAL_WRITE, 0);
+
+ if ((initRF != 0) || (new_band != old_band)
+ || (((struct zsHpPriv*)wd->hpPrivate)->hwBw40 != bw40))
+ {
+ /* band switch */
+ zm_msg0_scan(ZM_LV_1, "=====band switch=====");
+
+ if (initRF == 2 )
+ {
+ //Cold reset BB/ADDA
+ zfDelayWriteInternalReg(dev, 0x1d4004, 0x800);
+ zfFlushDelayWrite(dev);
+ zm_msg0_scan(ZM_LV_1, "Do cold reset BB/ADDA");
+ }
+ else
+ {
+ //Warm reset BB/ADDA
+ zfDelayWriteInternalReg(dev, 0x1d4004, 0x400);
+ zfFlushDelayWrite(dev);
+ }
+
+ /* reset workaround state to default */
+ hpPriv->rxStrongRSSI = 0;
+ hpPriv->strongRSSI = 0;
+
+ zfDelayWriteInternalReg(dev, 0x1d4004, 0x0);
+ zfFlushDelayWrite(dev);
+
+ zfInitPhy(dev, frequency, bw40);
+
+// zfiCheckRifs(dev);
+
+ /* Bank 0 1 2 3 5 6 7 */
+ zfSetRfRegs(dev, frequency);
+ /* Bank 4 */
+ zfSetBank4AndPowerTable(dev, frequency, bw40, extOffset);
+
+ cmd[0] = 32 | (ZM_CMD_RF_INIT << 8);
+ }
+ else //((new_band == old_band) && !initRF)
+ {
+ /* same band */
+
+ /* Force disable CR671 bit20 / 7823 */
+ /* The bug has to do with the polarity of the pdadc offset calibration. There */
+ /* is an initial calibration that is OK, and there is a continuous */
+ /* calibration that updates the pddac with the wrong polarity. Fortunately */
+ /* the second loop can be disabled with a bit called en_pd_dc_offset_thr. */
+#if 0
+ cmdB[0] = 8 | (ZM_CMD_BITAND << 8);;
+ cmdB[1] = (0xa27c + 0x1bc000);
+ cmdB[2] = 0xffefffff;
+ ret = zfIssueCmd(dev, cmdB, 12, ZM_OID_INTERNAL_WRITE, 0);
+#endif
+
+ /* Bank 4 */
+ zfSetBank4AndPowerTable(dev, frequency, bw40, extOffset);
+
+
+ cmd[0] = 32 | (ZM_CMD_FREQUENCY << 8);
+ }
+
+ /* Compatibility for new layout UB83 */
+ /* Setting code at CR1 here move from the func:zfHwHTEnable() in firmware */
+ if (((struct zsHpPriv*)wd->hpPrivate)->halCapability & ZM_HP_CAP_11N_ONE_TX_STREAM)
+ {
+ /* UB83 : one stream */
+ tmpValue = 0;
+ }
+ else
+ {
+ /* UB81, UB82 : two stream */
+ tmpValue = 0x100;
+ }
+
+ if (1) //if (((struct zsHpPriv*)wd->hpPrivate)->hw_HT_ENABLE == 1)
+ {
+ if (bw40 == 1)
+ {
+ if (extOffset == 1) {
+ reg_write(0x9804, tmpValue | 0x2d4); //3d4 for real
+ }
+ else {
+ reg_write(0x9804, tmpValue | 0x2c4); //3c4 for real
+ }
+ //# Dyn HT2040.Refer to Reg 1.
+ //#[3]:single length (4us) 1st HT long training symbol; use Walsh spatial spreading for 2 chains 2 streams TX
+ //#[c]:allow short GI for HT40 packets; enable HT detection.
+ //#[4]:enable 20/40 MHz channel detection.
+ }
+ else
+ {
+ reg_write(0x9804, tmpValue | 0x240);
+ //# Static HT20
+ //#[3]:single length (4us) 1st HT long training symbol; use Walsh spatial spreading for 2 chains 2 streams TX
+ //#[4]:Otus don't allow short GI for HT20 packets yet; enable HT detection.
+ //#[0]:disable 20/40 MHz channel detection.
+ }
+ }
+ else
+ {
+ reg_write(0x9804, 0x0);
+ //# Legacy;# Direct Mapping for each chain.
+ //#Be modified by Oligo to add dynanic for legacy.
+ if (bw40 == 1)
+ {
+ reg_write(0x9804, 0x4); //# Dyn Legacy .Refer to reg 1.
+ }
+ else
+ {
+ reg_write(0x9804, 0x0); //# Static Legacy
+ }
+ }
+ zfFlushDelayWrite(dev);
+ /* end of ub83 compatibility */
+
+ /* Set Power, TPC, Gain table... */
+ zfSetPowerCalTable(dev, frequency, bw40, extOffset);
+
+
+ /* store frequency */
+ ((struct zsHpPriv*)wd->hpPrivate)->hwFrequency = (u16_t)frequency;
+ ((struct zsHpPriv*)wd->hpPrivate)->hwBw40 = bw40;
+ ((struct zsHpPriv*)wd->hpPrivate)->hwExtOffset = extOffset;
+
+ zfGetHwTurnOffdynParam(dev,
+ frequency, bw40, extOffset,
+ &delta_slope_coeff_exp,
+ &delta_slope_coeff_man,
+ &delta_slope_coeff_exp_shgi,
+ &delta_slope_coeff_man_shgi);
+
+ /* related functions */
+ frequency = frequency*1000;
+ /* len[36] : type[0x30] : seq[?] */
+// cmd[0] = 28 | (ZM_CMD_FREQUENCY << 8);
+ cmd[1] = frequency;
+ cmd[2] = bw40;//((struct zsHpPriv*)wd->hpPrivate)->hw_DYNAMIC_HT2040_EN;
+ cmd[3] = (extOffset<<2)|0x1;//((wd->ExtOffset << 2) | ((struct zsHpPriv*)wd->hpPrivate)->hw_HT_ENABLE);
+ cmd[4] = delta_slope_coeff_exp;
+ cmd[5] = delta_slope_coeff_man;
+ cmd[6] = delta_slope_coeff_exp_shgi;
+ cmd[7] = delta_slope_coeff_man_shgi;
+ cmd[8] = checkLoopCount;
+
+ ret = zfIssueCmd(dev, cmd, 36, ZM_CMD_SET_FREQUENCY, 0);
+
+ // delay temporarily, wait for new PHY and RF
+ //zfwSleep(dev, 1000);
+}
+
+
+/******************** Key ********************/
+
+u16_t zfHpResetKeyCache(zdev_t* dev)
+{
+ u8_t i;
+ u32_t key[4] = {0, 0, 0, 0};
+
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+
+ for(i=0;i<4;i++)
+ {
+ zfHpSetDefaultKey(dev, i, ZM_WEP64, key, NULL);
+ }
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_ROLL_CALL_TBL_L, 0x00);
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_ROLL_CALL_TBL_H, 0x00);
+ zfFlushDelayWrite(dev);
+
+ hpPriv->camRollCallTable = (u64_t) 0;
+
+ return 0;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfSetKey */
+/* Set key. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* 0 : success */
+/* other : fail */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2006.1 */
+/* */
+/************************************************************************/
+/* ! please use zfCoreSetKey() in 80211Core for SetKey */
+u32_t zfHpSetKey(zdev_t* dev, u8_t user, u8_t keyId, u8_t type,
+ u16_t* mac, u32_t* key)
+{
+ u32_t cmd[(ZM_MAX_CMD_SIZE/4)];
+ u16_t ret;
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+
+#if 0 /* remove to zfCoreSetKey() */
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ wd->sta.flagKeyChanging++;
+ zm_debug_msg1(" zfHpSetKey++++ ", wd->sta.flagKeyChanging);
+ zmw_leave_critical_section(dev);
+#endif
+
+ cmd[0] = 0x0000281C;
+ cmd[1] = ((u32_t)keyId<<16) + (u32_t)user;
+ cmd[2] = ((u32_t)mac[0]<<16) + (u32_t)type;
+ cmd[3] = ((u32_t)mac[2]<<16) + ((u32_t)mac[1]);
+
+ for (i=0; i<4; i++)
+ {
+ cmd[4+i] = key[i];
+ }
+
+ if (user < 64)
+ {
+ hpPriv->camRollCallTable |= ((u64_t) 1) << user;
+ }
+
+ //ret = zfIssueCmd(dev, cmd, 32, ZM_OID_INTERNAL_WRITE, NULL);
+ ret = zfIssueCmd(dev, cmd, 32, ZM_CMD_SET_KEY, NULL);
+ return ret;
+}
+
+
+u32_t zfHpSetApPairwiseKey(zdev_t* dev, u16_t* staMacAddr, u8_t type,
+ u32_t* key, u32_t* micKey, u16_t staAid)
+{
+ if ((staAid!=0) && (staAid<64))
+ {
+ zfHpSetKey(dev, (staAid-1), 0, type, staMacAddr, key);
+ if ((type == ZM_TKIP)
+#ifdef ZM_ENABLE_CENC
+ || (type == ZM_CENC)
+#endif //ZM_ENABLE_CENC
+ )
+ zfHpSetKey(dev, (staAid-1), 1, type, staMacAddr, micKey);
+ return 0;
+ }
+ return 1;
+}
+
+u32_t zfHpSetApGroupKey(zdev_t* dev, u16_t* apMacAddr, u8_t type,
+ u32_t* key, u32_t* micKey, u16_t vapId)
+{
+ zfHpSetKey(dev, ZM_USER_KEY_DEFAULT - 1 - vapId, 0, type, apMacAddr, key); // 6D18 modify from 0 to 1 ??
+ if ((type == ZM_TKIP)
+#ifdef ZM_ENABLE_CENC
+ || (type == ZM_CENC)
+#endif //ZM_ENABLE_CENC
+ )
+ zfHpSetKey(dev, ZM_USER_KEY_DEFAULT - 1 - vapId, 1, type, apMacAddr, micKey);
+ return 0;
+}
+
+u32_t zfHpSetDefaultKey(zdev_t* dev, u8_t keyId, u8_t type, u32_t* key, u32_t* micKey)
+{
+ u16_t macAddr[3] = {0, 0, 0};
+
+ #ifdef ZM_ENABLE_IBSS_WPA2PSK
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv = wd->hpPrivate;
+
+ if ( hpPriv->dot11Mode == ZM_HAL_80211_MODE_IBSS_WPA2PSK )
+ { /* If not wpa2psk , use traditional */
+ /* Because the bug of chip , defaultkey should follow the key map rule in register 700 */
+ if ( keyId == 0 )
+ zfHpSetKey(dev, ZM_USER_KEY_DEFAULT+keyId, 0, type, macAddr, key);
+ else
+ zfHpSetKey(dev, ZM_USER_KEY_DEFAULT+keyId, 1, type, macAddr, key);
+ }
+ else
+ zfHpSetKey(dev, ZM_USER_KEY_DEFAULT+keyId, 0, type, macAddr, key);
+ #else
+ zfHpSetKey(dev, ZM_USER_KEY_DEFAULT+keyId, 0, type, macAddr, key);
+ #endif
+ if ((type == ZM_TKIP)
+
+#ifdef ZM_ENABLE_CENC
+ || (type == ZM_CENC)
+#endif //ZM_ENABLE_CENC
+ )
+ {
+ zfHpSetKey(dev, ZM_USER_KEY_DEFAULT+keyId, 1, type, macAddr, micKey);
+ }
+
+ return 0;
+}
+
+u32_t zfHpSetPerUserKey(zdev_t* dev, u8_t user, u8_t keyId, u8_t* mac, u8_t type, u32_t* key, u32_t* micKey)
+{
+#ifdef ZM_ENABLE_IBSS_WPA2PSK
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv = wd->hpPrivate;
+
+ if ( hpPriv->dot11Mode == ZM_HAL_80211_MODE_IBSS_WPA2PSK )
+ { /* If not wpa2psk , use traditional */
+ if(keyId)
+ { /* Set Group Key */
+ zfHpSetKey(dev, user, 1, type, (u16_t *)mac, key);
+ }
+ else if(keyId == 0)
+ { /* Set Pairwise Key */
+ zfHpSetKey(dev, user, 0, type, (u16_t *)mac, key);
+ }
+ }
+ else
+ {
+ zfHpSetKey(dev, user, keyId, type, (u16_t *)mac, key);
+ }
+#else
+ zfHpSetKey(dev, user, keyId, type, (u16_t *)mac, key);
+#endif
+
+ if ((type == ZM_TKIP)
+#ifdef ZM_ENABLE_CENC
+ || (type == ZM_CENC)
+#endif //ZM_ENABLE_CENC
+ )
+ {
+ zfHpSetKey(dev, user, keyId + 1, type, (u16_t *)mac, micKey);
+ }
+ return 0;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfHpRemoveKey */
+/* Remove key. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* 0 : success */
+/* other : fail */
+/* */
+/* AUTHOR */
+/* Yuan-Gu Wei ZyDAS Technology Corporation 2006.6 */
+/* */
+/************************************************************************/
+u16_t zfHpRemoveKey(zdev_t* dev, u16_t user)
+{
+ u32_t cmd[(ZM_MAX_CMD_SIZE/4)];
+ u16_t ret = 0;
+
+ cmd[0] = 0x00002904;
+ cmd[1] = (u32_t)user;
+
+ ret = zfIssueCmd(dev, cmd, 8, ZM_OID_INTERNAL_WRITE, NULL);
+ return ret;
+}
+
+
+
+/******************** DMA ********************/
+u16_t zfHpStartRecv(zdev_t* dev)
+{
+ zfDelayWriteInternalReg(dev, 0x1c3d30, 0x100);
+ zfFlushDelayWrite(dev);
+
+ return 0;
+}
+
+u16_t zfHpStopRecv(zdev_t* dev)
+{
+ return 0;
+}
+
+
+/******************** MAC ********************/
+void zfInitMac(zdev_t* dev)
+{
+ /* ACK extension register */
+ // jhlee temp : change value 0x2c -> 0x40
+ // honda resolve short preamble problem : 0x40 -> 0x75
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_ACK_EXTENSION, 0x40); // 0x28 -> 0x2c 6522:yflee
+
+ /* TxQ0/1/2/3 Retry MAX=2 => transmit 3 times and degrade rate for retry */
+ /* PB42 AP crash issue: */
+ /* Workaround the crash issue by CTS/RTS, set retry max to zero for */
+ /* workaround tx underrun which enable CTS/RTS */
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_RETRY_MAX, 0); // 0x11111 => 0
+
+ /* use hardware MIC check */
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_SNIFFER, 0x2000000);
+
+ /* Set Rx threshold to 1600 */
+#if ZM_LARGEPAYLOAD_TEST == 1
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_RX_THRESHOLD, 0xc4000);
+#else
+ #ifndef ZM_DISABLE_AMSDU8K_SUPPORT
+ /* The maximum A-MSDU length is 3839/7935 */
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_RX_THRESHOLD, 0xc1f80);
+ #else
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_RX_THRESHOLD, 0xc0f80);
+ #endif
+#endif
+
+ //zfDelayWriteInternalReg(dev, ZM_MAC_REG_DYNAMIC_SIFS_ACK, 0x10A);
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_RX_PE_DELAY, 0x70);
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_EIFS_AND_SIFS, 0xa144000);
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_SLOT_TIME, 9<<10);
+
+ /* CF-END mode */
+ zfDelayWriteInternalReg(dev, 0x1c3b2c, 0x19000000);
+
+ //NAV protects ACK only (in TXOP)
+ zfDelayWriteInternalReg(dev, 0x1c3b38, 0x201);
+
+
+ /* Set Beacon PHY CTRL's TPC to 0x7, TA1=1 */
+ /* OTUS set AM to 0x1 */
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_BCN_HT1, 0x8000170);
+
+ /* TODO : wep backoff protection 0x63c */
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_BACKOFF_PROTECT, 0x105);
+
+ /* AGG test code*/
+ /* Aggregation MAX number and timeout */
+ zfDelayWriteInternalReg(dev, 0x1c3b9c, 0x10000a);
+ /* Filter any control frames, BAR is bit 24 */
+ zfDelayWriteInternalReg(dev, 0x1c368c, 0x0500ffff);
+ /* Enable deaggregator */
+ zfDelayWriteInternalReg(dev, 0x1c3c40, 0x1);
+
+ /* Basic rate */
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_BASIC_RATE, 0x150f);
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_MANDATORY_RATE, 0x150f);
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_RTS_CTS_RATE, 0x10b01bb);
+
+ /* MIMO resposne control */
+ zfDelayWriteInternalReg(dev, 0x1c3694, 0x4003C1E);/* bit 26~28 otus-AM */
+
+ /* Enable LED0 and LED1 */
+ zfDelayWriteInternalReg(dev, 0x1d0100, 0x3);
+ zfDelayWriteInternalReg(dev, 0x1d0104, 0x3);
+
+ /* switch MAC to OTUS interface */
+ zfDelayWriteInternalReg(dev, 0x1c3600, 0x3);
+
+ /* RXMAC A-MPDU length threshold */
+ zfDelayWriteInternalReg(dev, 0x1c3c50, 0xffff);
+
+ /* Phy register read timeout */
+ zfDelayWriteInternalReg(dev, 0x1c3680, 0xf00008);
+
+ /* Disable Rx TimeOut : workaround for BB.
+ * OTUS would interrupt the rx frame that sent by OWL TxUnderRun
+ * because OTUS rx timeout behavior, then OTUS would not ack the BA for
+ * this AMPDU from OWL.
+ * Fix by Perry Hwang. 2007/05/10.
+ * 0x1c362c : Rx timeout value : bit 27~16
+ */
+ zfDelayWriteInternalReg(dev, 0x1c362c, 0x0);
+
+ //Set USB Rx stream mode MAX packet number to 2
+ // Max packet number = *0x1e1110 + 1
+ zfDelayWriteInternalReg(dev, 0x1e1110, 0x4);
+ //Set USB Rx stream mode timeout to 10us
+ zfDelayWriteInternalReg(dev, 0x1e1114, 0x80);
+
+ //Set CPU clock frequency to 88/80MHz
+ zfDelayWriteInternalReg(dev, 0x1D4008, 0x73);
+
+ //Set WLAN DMA interrupt mode : generate int per packet
+ zfDelayWriteInternalReg(dev, 0x1c3d7c, 0x110011);
+
+ /* 7807 */
+ /* enable func : Reset FIFO1 and FIFO2 when queue-gnt is low */
+ /* 0x1c3bb0 Bit2 */
+ /* Disable SwReset in firmware for TxHang, enable reset FIFO func. */
+ zfDelayWriteInternalReg(dev, 0x1c3bb0, 0x4);
+
+ /* Disables the CF_END frame */
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_TXOP_NOT_ENOUGH_INDICATION, 0x141E0F48);
+
+ /* Disable the SW Decrypt*/
+ zfDelayWriteInternalReg(dev, 0x1c3678, 0x70);
+ zfFlushDelayWrite(dev);
+ //---------------------
+
+ /* Set TxQs CWMIN, CWMAX, AIFS and TXO to WME STA default. */
+ zfUpdateDefaultQosParameter(dev, 0);
+
+ //zfSelAdcClk(dev, 0);
+
+ return;
+}
+
+
+u16_t zfHpSetSnifferMode(zdev_t* dev, u16_t on)
+{
+ if (on != 0)
+ {
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_SNIFFER, 0x2000001);
+ }
+ else
+ {
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_SNIFFER, 0x2000000);
+ }
+ zfFlushDelayWrite(dev);
+ return 0;
+}
+
+
+u16_t zfHpSetApStaMode(zdev_t* dev, u8_t mode)
+{
+ zmw_get_wlan_dev(dev);
+
+ struct zsHpPriv* hpPriv = wd->hpPrivate;
+ hpPriv->dot11Mode = mode;
+
+ switch(mode)
+ {
+ case ZM_HAL_80211_MODE_AP:
+ zfDelayWriteInternalReg(dev, 0x1c3700, 0x0f0000a1);
+ zfDelayWriteInternalReg(dev, 0x1c3c40, 0x1);
+ break;
+
+ case ZM_HAL_80211_MODE_STA:
+ zfDelayWriteInternalReg(dev, 0x1c3700, 0x0f000002);
+ zfDelayWriteInternalReg(dev, 0x1c3c40, 0x1);
+ break;
+
+ case ZM_HAL_80211_MODE_IBSS_GENERAL:
+ zfDelayWriteInternalReg(dev, 0x1c3700, 0x0f000000);
+ zfDelayWriteInternalReg(dev, 0x1c3c40, 0x1);
+ break;
+
+ case ZM_HAL_80211_MODE_IBSS_WPA2PSK:
+ zfDelayWriteInternalReg(dev, 0x1c3700, 0x0f0000e0);
+ zfDelayWriteInternalReg(dev, 0x1c3c40, 0x41); // for multiple ( > 2 ) stations IBSS network
+ break;
+
+ default:
+ goto skip;
+ }
+
+ zfFlushDelayWrite(dev);
+
+skip:
+ return 0;
+}
+
+
+u16_t zfHpSetBssid(zdev_t* dev, u8_t* bssidSrc)
+{
+ u32_t address;
+ u16_t *bssid = (u16_t *)bssidSrc;
+
+ address = bssid[0] + (((u32_t)bssid[1]) << 16);
+ zfDelayWriteInternalReg(dev, 0x1c3618, address);
+
+ address = (u32_t)bssid[2];
+ zfDelayWriteInternalReg(dev, 0x1c361C, address);
+ zfFlushDelayWrite(dev);
+ return 0;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfHpUpdateQosParameter */
+/* Update TxQs CWMIN, CWMAX, AIFS and TXOP. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* cwminTbl : CWMIN parameter for TxQs */
+/* cwmaxTbl : CWMAX parameter for TxQs */
+/* aifsTbl: AIFS parameter for TxQs */
+/* txopTbl : TXOP parameter for TxQs */
+/* */
+/* OUTPUTS */
+/* none */
+/* */
+/* AUTHOR */
+/* Stephen ZyDAS Technology Corporation 2006.6 */
+/* */
+/************************************************************************/
+u8_t zfHpUpdateQosParameter(zdev_t* dev, u16_t* cwminTbl, u16_t* cwmaxTbl,
+ u16_t* aifsTbl, u16_t* txopTbl)
+{
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv = wd->hpPrivate;
+
+ zm_msg0_mm(ZM_LV_0, "zfHalUpdateQosParameter()");
+
+ /* Note : Do not change cwmin for Q0 in Ad Hoc mode */
+ /* otherwise driver will fail in Wifi beacon distribution */
+ if (hpPriv->dot11Mode == ZM_HAL_80211_MODE_STA)
+ {
+#if 0 //Restore CWmin to improve down link throughput
+ //cheating in BE traffic
+ if (wd->sta.EnableHT == 1)
+ {
+ //cheating in BE traffic
+ cwminTbl[0] = 7;//15;
+ }
+#endif
+ cwmaxTbl[0] = 127;//1023;
+ aifsTbl[0] = 2*9+10;//3 * 9 + 10;
+ }
+
+ /* CWMIN and CWMAX */
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_AC0_CW, cwminTbl[0]
+ + ((u32_t)cwmaxTbl[0]<<16));
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_AC1_CW, cwminTbl[1]
+ + ((u32_t)cwmaxTbl[1]<<16));
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_AC2_CW, cwminTbl[2]
+ + ((u32_t)cwmaxTbl[2]<<16));
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_AC3_CW, cwminTbl[3]
+ + ((u32_t)cwmaxTbl[3]<<16));
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_AC4_CW, cwminTbl[4]
+ + ((u32_t)cwmaxTbl[4]<<16));
+
+ /* AIFS */
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_AC1_AC0_AIFS, aifsTbl[0]
+ +((u32_t)aifsTbl[0]<<12)+((u32_t)aifsTbl[0]<<24));
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_AC3_AC2_AIFS, (aifsTbl[0]>>8)
+ +((u32_t)aifsTbl[0]<<4)+((u32_t)aifsTbl[0]<<16));
+
+ /* TXOP */
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_AC1_AC0_TXOP, txopTbl[0]
+ + ((u32_t)txopTbl[1]<<16));
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_AC3_AC2_TXOP, txopTbl[2]
+ + ((u32_t)txopTbl[3]<<16));
+
+ zfFlushDelayWrite(dev);
+
+ hpPriv->txop[0] = txopTbl[0];
+ hpPriv->txop[1] = txopTbl[1];
+ hpPriv->txop[2] = txopTbl[2];
+ hpPriv->txop[3] = txopTbl[3];
+ hpPriv->cwmin[0] = cwminTbl[0];
+ hpPriv->cwmax[0] = cwmaxTbl[0];
+ hpPriv->cwmin[1] = cwminTbl[1];
+ hpPriv->cwmax[1] = cwmaxTbl[1];
+
+ return 0;
+}
+
+
+void zfHpSetAtimWindow(zdev_t* dev, u16_t atimWin)
+{
+ zm_msg1_mm(ZM_LV_0, "Set ATIM window to ", atimWin);
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_ATIM_WINDOW, atimWin);
+ zfFlushDelayWrite(dev);
+}
+
+
+void zfHpSetBasicRateSet(zdev_t* dev, u16_t bRateBasic, u16_t gRateBasic)
+{
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_BASIC_RATE, bRateBasic
+ | ((u16_t)gRateBasic<<8));
+ zfFlushDelayWrite(dev);
+}
+
+
+/* HT40 send by OFDM 6M */
+/* otherwise use reg 0x638 */
+void zfHpSetRTSCTSRate(zdev_t* dev, u32_t rate)
+{
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_RTS_CTS_RATE, rate);
+ zfFlushDelayWrite(dev);
+}
+
+void zfHpSetMacAddress(zdev_t* dev, u16_t* macAddr, u16_t macAddrId)
+{
+ if (macAddrId == 0)
+ {
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_MAC_ADDR_L,
+ (((u32_t)macAddr[1])<<16) | macAddr[0]);
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_MAC_ADDR_H, macAddr[2]);
+ }
+ else if (macAddrId <= 7)
+ {
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_ACK_TABLE+((macAddrId-1)*8),
+ macAddr[0] + ((u32_t)macAddr[1]<<16));
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_ACK_TABLE+((macAddrId-1)*8)+4,
+ macAddr[2]);
+ }
+ zfFlushDelayWrite(dev);
+}
+
+void zfHpSetMulticastList(zdev_t* dev, u8_t size, u8_t* pList, u8_t bAllMulticast)
+{
+ struct zsMulticastAddr* pMacList = (struct zsMulticastAddr*) pList;
+ u8_t i;
+ u32_t value;
+ u32_t swRegMulHashValueH, swRegMulHashValueL;
+
+ swRegMulHashValueH = 0x80000000;
+ swRegMulHashValueL = 0;
+
+ if ( bAllMulticast )
+ {
+ swRegMulHashValueH = swRegMulHashValueL = ~0;
+ }
+ else
+ {
+ for(i=0; i<size; i++)
+ {
+ value = pMacList[i].addr[5] >> 2;
+
+ if ( value < 32 )
+ {
+ swRegMulHashValueL |= (1 << value);
+ }
+ else
+ {
+ swRegMulHashValueH |= (1 << (value-32));
+ }
+ }
+ }
+
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_GROUP_HASH_TBL_L,
+ swRegMulHashValueL);
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_GROUP_HASH_TBL_H,
+ swRegMulHashValueH);
+ zfFlushDelayWrite(dev);
+ return;
+}
+
+/******************** Beacon ********************/
+void zfHpEnableBeacon(zdev_t* dev, u16_t mode, u16_t bcnInterval, u16_t dtim, u8_t enableAtim)
+{
+ u32_t value;
+
+ zmw_get_wlan_dev(dev);
+
+ /* Beacon Ready */
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_BCN_CTRL, 0);
+ /* Beacon DMA buffer address */
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_BCN_ADDR, ZM_BEACON_BUFFER_ADDRESS);
+
+ value = bcnInterval;
+
+ value |= (((u32_t) dtim) << 16);
+
+ if (mode == ZM_MODE_AP)
+ {
+
+ value |= 0x1000000;
+ }
+ else if (mode == ZM_MODE_IBSS)
+ {
+ value |= 0x2000000;
+
+ if ( enableAtim )
+ {
+ value |= 0x4000000;
+ }
+ ((struct zsHpPriv*)wd->hpPrivate)->ibssBcnEnabled = 1;
+ ((struct zsHpPriv*)wd->hpPrivate)->ibssBcnInterval = value;
+ }
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_PRETBTT, (bcnInterval-6)<<16);
+
+ /* Beacon period and beacon enable */
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_BCN_PERIOD, value);
+ zfFlushDelayWrite(dev);
+}
+
+void zfHpDisableBeacon(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ ((struct zsHpPriv*)wd->hpPrivate)->ibssBcnEnabled = 0;
+
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_BCN_PERIOD, 0);
+ zfFlushDelayWrite(dev);
+}
+
+void zfHpLedCtrl(zdev_t* dev, u16_t ledId, u8_t mode)
+{
+ u16_t state;
+ zmw_get_wlan_dev(dev);
+
+ //zm_debug_msg1("LED ID=", ledId);
+ //zm_debug_msg1("LED mode=", mode);
+ if (ledId < 2)
+ {
+ if (((struct zsHpPriv*)wd->hpPrivate)->ledMode[ledId] != mode)
+ {
+ ((struct zsHpPriv*)wd->hpPrivate)->ledMode[ledId] = mode;
+
+ state = ((struct zsHpPriv*)wd->hpPrivate)->ledMode[0]
+ | (((struct zsHpPriv*)wd->hpPrivate)->ledMode[1]<<1);
+ zfDelayWriteInternalReg(dev, 0x1d0104, state);
+ zfFlushDelayWrite(dev);
+ //zm_debug_msg0("Update LED");
+ }
+ }
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfHpResetTxRx */
+/* Reset Tx and Rx Desc. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* 0 : success */
+/* other : fail */
+/* */
+/* AUTHOR */
+/* Chao-Wen Yang ZyDAS Technology Corporation 2007.3 */
+/* */
+/************************************************************************/
+u16_t zfHpUsbReset(zdev_t* dev)
+{
+ u32_t cmd[(ZM_MAX_CMD_SIZE/4)];
+ u16_t ret = 0;
+
+ //zm_debug_msg0("CWY - Reset Tx and Rx");
+
+ cmd[0] = 0 | (ZM_CMD_RESET << 8);
+
+ ret = zfIssueCmd(dev, cmd, 4, ZM_OID_INTERNAL_WRITE, NULL);
+ return ret;
+}
+
+u16_t zfHpDKReset(zdev_t* dev, u8_t flag)
+{
+ u32_t cmd[(ZM_MAX_CMD_SIZE/4)];
+ u16_t ret = 0;
+
+ //zm_debug_msg0("CWY - Reset Tx and Rx");
+
+ cmd[0] = 4 | (ZM_CMD_DKRESET << 8);
+ cmd[1] = flag;
+
+ ret = zfIssueCmd(dev, cmd, 8, ZM_OID_INTERNAL_WRITE, NULL);
+ return ret;
+}
+
+u32_t zfHpCwmUpdate(zdev_t* dev)
+{
+ //u32_t cmd[3];
+ //u16_t ret;
+ //
+ //cmd[0] = 0x00000008;
+ //cmd[1] = 0x1c36e8;
+ //cmd[2] = 0x1c36ec;
+ //
+ //ret = zfIssueCmd(dev, cmd, 12, ZM_CWM_READ, 0);
+ //return ret;
+ zmw_get_wlan_dev(dev);
+
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+
+ zfCoreCwmBusy(dev, zfCwmIsExtChanBusy(hpPriv->ctlBusy, hpPriv->extBusy));
+
+ hpPriv->ctlBusy = 0;
+ hpPriv->extBusy = 0;
+
+ return 0;
+}
+
+u32_t zfHpAniUpdate(zdev_t* dev)
+{
+ u32_t cmd[5];
+ u16_t ret;
+
+ cmd[0] = 0x00000010;
+ cmd[1] = 0x1c36e8;
+ cmd[2] = 0x1c36ec;
+ cmd[3] = 0x1c3cb4;
+ cmd[4] = 0x1c3cb8;
+
+ ret = zfIssueCmd(dev, cmd, 20, ZM_ANI_READ, 0);
+ return ret;
+}
+
+/*
+ * Update Beacon RSSI in ANI
+ */
+u32_t zfHpAniUpdateRssi(zdev_t* dev, u8_t rssi)
+{
+ zmw_get_wlan_dev(dev);
+
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+
+ hpPriv->stats.ast_nodestats.ns_avgbrssi = rssi;
+
+ return 0;
+}
+
+#define ZM_SEEPROM_MAC_ADDRESS_OFFSET (0x1400 + (0x106<<1))
+#define ZM_SEEPROM_REGDOMAIN_OFFSET (0x1400 + (0x104<<1))
+#define ZM_SEEPROM_VERISON_OFFSET (0x1400 + (0x102<<1))
+#define ZM_SEEPROM_HARDWARE_TYPE_OFFSET (0x1374)
+#define ZM_SEEPROM_HW_HEAVY_CLIP (0x161c)
+
+u32_t zfHpGetMacAddress(zdev_t* dev)
+{
+ u32_t cmd[7];
+ u16_t ret;
+
+ cmd[0] = 0x00000000 | 24;
+ cmd[1] = ZM_SEEPROM_MAC_ADDRESS_OFFSET;
+ cmd[2] = ZM_SEEPROM_MAC_ADDRESS_OFFSET+4;
+ cmd[3] = ZM_SEEPROM_REGDOMAIN_OFFSET;
+ cmd[4] = ZM_SEEPROM_VERISON_OFFSET;
+ cmd[5] = ZM_SEEPROM_HARDWARE_TYPE_OFFSET;
+ cmd[6] = ZM_SEEPROM_HW_HEAVY_CLIP;
+
+ ret = zfIssueCmd(dev, cmd, 28, ZM_MAC_READ, 0);
+ return ret;
+}
+
+u32_t zfHpGetTransmitPower(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ struct zsHpPriv* hpPriv = wd->hpPrivate;
+ u16_t tpc = 0;
+
+ if (hpPriv->hwFrequency < 3000) {
+ tpc = hpPriv->tPow2x2g[0] & 0x3f;
+ wd->maxTxPower2 &= 0x3f;
+ tpc = (tpc > wd->maxTxPower2)? wd->maxTxPower2 : tpc;
+ } else {
+ tpc = hpPriv->tPow2x5g[0] & 0x3f;
+ wd->maxTxPower5 &= 0x3f;
+ tpc = (tpc > wd->maxTxPower5)? wd->maxTxPower5 : tpc;
+ }
+
+ return tpc;
+}
+
+u8_t zfHpGetMinTxPower(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ struct zsHpPriv* hpPriv = wd->hpPrivate;
+ u8_t tpc = 0;
+
+ if (hpPriv->hwFrequency < 3000)
+ {
+ if(wd->BandWidth40)
+ {
+ //40M
+ tpc = (hpPriv->tPow2x2gHt40[7]&0x3f);
+ }
+ else
+ {
+ //20M
+ tpc = (hpPriv->tPow2x2gHt20[7]&0x3f);
+ }
+ }
+ else
+ {
+ if(wd->BandWidth40)
+ {
+ //40M
+ tpc = (hpPriv->tPow2x5gHt40[7]&0x3f);
+ }
+ else
+ {
+ //20M
+ tpc = (hpPriv->tPow2x5gHt20[7]&0x3f);
+ }
+ }
+
+ return tpc;
+}
+
+u8_t zfHpGetMaxTxPower(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ struct zsHpPriv* hpPriv = wd->hpPrivate;
+ u8_t tpc = 0;
+
+ if (hpPriv->hwFrequency < 3000)
+ {
+ tpc = (hpPriv->tPow2xCck[0]&0x3f);
+ }
+ else
+ {
+ tpc =(hpPriv->tPow2x5g[0]&0x3f);
+ }
+
+ return tpc;
+}
+
+u32_t zfHpLoadEEPROMFromFW(zdev_t* dev)
+{
+ u32_t cmd[16];
+ u32_t ret=0, i, j;
+ zmw_get_wlan_dev(dev);
+
+ i = ((struct zsHpPriv*)wd->hpPrivate)->eepromImageRdReq;
+
+ cmd[0] = ZM_HAL_MAX_EEPROM_PRQ*4;
+
+ for (j=0; j<ZM_HAL_MAX_EEPROM_PRQ; j++)
+ {
+ cmd[j+1] = 0x1000 + (((i*ZM_HAL_MAX_EEPROM_PRQ) + j)*4);
+ }
+
+ ret = zfIssueCmd(dev, cmd, (ZM_HAL_MAX_EEPROM_PRQ+1)*4, ZM_EEPROM_READ, 0);
+
+ return ret;
+}
+
+void zfHpHeartBeat(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+ u8_t polluted = 0;
+ u8_t ackTpc;
+
+ /* Workaround : Make OTUS fire more beacon in ad hoc mode in 2.4GHz */
+ if (hpPriv->ibssBcnEnabled != 0)
+ {
+ if (hpPriv->hwFrequency <= ZM_CH_G_14)
+ {
+ if ((wd->tick % 10) == 0)
+ {
+ if ((wd->tick % 40) == 0)
+ {
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_BCN_PERIOD, hpPriv->ibssBcnInterval-1);
+ polluted = 1;
+ }
+ else
+ {
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_BCN_PERIOD, hpPriv->ibssBcnInterval);
+ polluted = 1;
+ }
+ }
+ }
+ }
+
+ if ((wd->tick & 0x3f) == 0x25)
+ {
+ /* Workaround for beacon stuck after SW reset */
+ if (hpPriv->ibssBcnEnabled != 0)
+ {
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_BCN_ADDR, ZM_BEACON_BUFFER_ADDRESS);
+ polluted = 1;
+ }
+
+ //DbgPrint("hpPriv->aggMaxDurationBE=%d", hpPriv->aggMaxDurationBE);
+ //DbgPrint("wd->sta.avgSizeOfReceivePackets=%d", wd->sta.avgSizeOfReceivePackets);
+ if (( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ && (zfStaIsConnected(dev))
+ && (wd->sta.EnableHT == 1) //11n mode
+ && (wd->BandWidth40 == 1) //40MHz mode
+ && (wd->sta.enableDrvBA ==0) //Marvel AP
+ && (hpPriv->aggMaxDurationBE > 2000) //BE TXOP > 2ms
+ && (wd->sta.avgSizeOfReceivePackets > 1420))
+ {
+ zfDelayWriteInternalReg(dev, 0x1c3b9c, 0x8000a);
+ polluted = 1;
+ }
+ else
+ {
+ zfDelayWriteInternalReg(dev, 0x1c3b9c, hpPriv->aggPktNum);
+ polluted = 1;
+ }
+
+ if (wd->dynamicSIFSEnable == 0)
+ {
+ if (( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ && (zfStaIsConnected(dev))
+ && (wd->sta.EnableHT == 1) //11n mode
+ && (wd->BandWidth40 == 0) //20MHz mode
+ && (wd->sta.enableDrvBA ==0)) //Marvel AP
+ {
+ zfDelayWriteInternalReg(dev, 0x1c3698, 0x5144000);
+ polluted = 1;
+ }
+ else
+ {
+ zfDelayWriteInternalReg(dev, 0x1c3698, 0xA144000);
+ polluted = 1;
+ }
+ }
+ else
+ {
+ if (( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ && (zfStaIsConnected(dev))
+ && (wd->sta.EnableHT == 1) //11n mode
+ && (wd->sta.athOwlAp == 1)) //Atheros AP
+ {
+ if (hpPriv->retransmissionEvent)
+ {
+ switch(hpPriv->latestSIFS)
+ {
+ case 0:
+ hpPriv->latestSIFS = 1;
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_EIFS_AND_SIFS, 0x8144000);
+ break;
+ case 1:
+ hpPriv->latestSIFS = 2;
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_EIFS_AND_SIFS, 0xa144000);
+ break;
+ case 2:
+ hpPriv->latestSIFS = 3;
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_EIFS_AND_SIFS, 0xc144000);
+ break;
+ case 3:
+ hpPriv->latestSIFS = 0;
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_EIFS_AND_SIFS, 0xa144000);
+ break;
+ default:
+ hpPriv->latestSIFS = 0;
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_EIFS_AND_SIFS, 0xa144000);
+ break;
+ }
+ polluted = 1;
+ zm_debug_msg1("##### Correct Tx retransmission issue #####, ", hpPriv->latestSIFS);
+ hpPriv->retransmissionEvent = 0;
+ }
+ }
+ else
+ {
+ hpPriv->latestSIFS = 0;
+ hpPriv->retransmissionEvent = 0;
+ zfDelayWriteInternalReg(dev, 0x1c3698, 0xA144000);
+ polluted = 1;
+ }
+ }
+
+ if ((wd->sta.bScheduleScan == FALSE) && (wd->sta.bChannelScan == FALSE))
+ {
+#define ZM_SIGNAL_THRESHOLD 66
+ if (( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ && (zfStaIsConnected(dev))
+ && (wd->SignalStrength > ZM_SIGNAL_THRESHOLD))
+ {
+ /* remove state handle, always rewrite register setting */
+ //if (hpPriv->strongRSSI == 0)
+ {
+ hpPriv->strongRSSI = 1;
+ /* Strong RSSI, set ACK to one Tx stream and lower Tx power 7dbm */
+ if (hpPriv->currentAckRtsTpc > (14+10))
+ {
+ ackTpc = hpPriv->currentAckRtsTpc - 14;
+ }
+ else
+ {
+ ackTpc = 10;
+ }
+ zfDelayWriteInternalReg(dev, 0x1c3694, ((ackTpc) << 20) | (0x1<<26));
+ zfDelayWriteInternalReg(dev, 0x1c3bb4, ((ackTpc) << 5 ) | (0x1<<11) |
+ ((ackTpc) << 21) | (0x1<<27) );
+ polluted = 1;
+ }
+ }
+ else
+ {
+ /* remove state handle, always rewrite register setting */
+ //if (hpPriv->strongRSSI == 1)
+ {
+ hpPriv->strongRSSI = 0;
+ if (hpPriv->halCapability & ZM_HP_CAP_11N_ONE_TX_STREAM)
+ {
+ zfDelayWriteInternalReg(dev, 0x1c3694, ((hpPriv->currentAckRtsTpc&0x3f) << 20) | (0x1<<26));
+ zfDelayWriteInternalReg(dev, 0x1c3bb4, ((hpPriv->currentAckRtsTpc&0x3f) << 5 ) | (0x1<<11) |
+ ((hpPriv->currentAckRtsTpc&0x3f) << 21) | (0x1<<27) );
+ }
+ else
+ {
+ zfDelayWriteInternalReg(dev, 0x1c3694, ((hpPriv->currentAckRtsTpc&0x3f) << 20) | (0x5<<26));
+ zfDelayWriteInternalReg(dev, 0x1c3bb4, ((hpPriv->currentAckRtsTpc&0x3f) << 5 ) | (0x5<<11) |
+ ((hpPriv->currentAckRtsTpc&0x3f) << 21) | (0x5<<27) );
+ }
+ polluted = 1;
+ }
+ }
+#undef ZM_SIGNAL_THRESHOLD
+ }
+
+ if ((hpPriv->halCapability & ZM_HP_CAP_11N_ONE_TX_STREAM) == 0)
+ {
+ if ((wd->sta.bScheduleScan == FALSE) && (wd->sta.bChannelScan == FALSE))
+ {
+ #define ZM_RX_SIGNAL_THRESHOLD_H 71
+ #define ZM_RX_SIGNAL_THRESHOLD_L 66
+ u8_t rxSignalThresholdH = ZM_RX_SIGNAL_THRESHOLD_H;
+ u8_t rxSignalThresholdL = ZM_RX_SIGNAL_THRESHOLD_L;
+ #undef ZM_RX_SIGNAL_THRESHOLD_H
+ #undef ZM_RX_SIGNAL_THRESHOLD_L
+
+ if (( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ && (zfStaIsConnected(dev))
+ && (wd->SignalStrength > rxSignalThresholdH)
+ )//&& (hpPriv->rxStrongRSSI == 0))
+ {
+ hpPriv->rxStrongRSSI = 1;
+ //zfDelayWriteInternalReg(dev, 0x1c5964, 0x1220);
+ //zfDelayWriteInternalReg(dev, 0x1c5960, 0x900);
+ //zfDelayWriteInternalReg(dev, 0x1c6960, 0x900);
+ //zfDelayWriteInternalReg(dev, 0x1c7960, 0x900);
+ if ((hpPriv->eepromImage[0x100+0x110*2/4]&0xff) == 0x80) //FEM TYPE
+ {
+ if (hpPriv->hwFrequency <= ZM_CH_G_14)
+ {
+ zfDelayWriteInternalReg(dev, 0x1c8960, 0x900);
+ }
+ else
+ {
+ zfDelayWriteInternalReg(dev, 0x1c8960, 0x9b49);
+ }
+ }
+ else
+ {
+ zfDelayWriteInternalReg(dev, 0x1c8960, 0x0900);
+ }
+ polluted = 1;
+ }
+ else if (( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ && (zfStaIsConnected(dev))
+ && (wd->SignalStrength > rxSignalThresholdL)
+ )//&& (hpPriv->rxStrongRSSI == 1))
+ {
+ //Do nothing to prevent frequently Rx switching
+ }
+ else
+ {
+ /* remove state handle, always rewrite register setting */
+ //if (hpPriv->rxStrongRSSI == 1)
+ {
+ hpPriv->rxStrongRSSI = 0;
+ //zfDelayWriteInternalReg(dev, 0x1c5964, 0x1120);
+ //zfDelayWriteInternalReg(dev, 0x1c5960, 0x9b40);
+ //zfDelayWriteInternalReg(dev, 0x1c6960, 0x9b40);
+ //zfDelayWriteInternalReg(dev, 0x1c7960, 0x9b40);
+ if ((hpPriv->eepromImage[0x100+0x110*2/4]&0xff) == 0x80) //FEM TYPE
+ {
+ if (hpPriv->hwFrequency <= ZM_CH_G_14)
+ {
+ zfDelayWriteInternalReg(dev, 0x1c8960, 0x9b49);
+ }
+ else
+ {
+ zfDelayWriteInternalReg(dev, 0x1c8960, 0x0900);
+ }
+ }
+ else
+ {
+ zfDelayWriteInternalReg(dev, 0x1c8960, 0x9b40);
+ }
+ polluted = 1;
+ }
+ }
+
+ }
+ }
+
+ if (hpPriv->usbAcSendBytes[3] > (hpPriv->usbAcSendBytes[0]*2))
+ {
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_AC1_AC0_TXOP, hpPriv->txop[3]);
+ polluted = 1;
+ }
+ else if (hpPriv->usbAcSendBytes[2] > (hpPriv->usbAcSendBytes[0]*2))
+ {
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_AC1_AC0_TXOP, hpPriv->txop[2]);
+ polluted = 1;
+ }
+ else if (hpPriv->usbAcSendBytes[1] > (hpPriv->usbAcSendBytes[0]*2))
+ {
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_AC0_CW, hpPriv->cwmin[1]+((u32_t)hpPriv->cwmax[1]<<16));
+ polluted = 1;
+ }
+ else
+ {
+ if (hpPriv->slotType == 1)
+ {
+ if ((wd->sta.enableDrvBA ==0) //Marvel AP
+ && (hpPriv->aggMaxDurationBE > 2000)) //BE TXOP > 2ms
+ {
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_AC0_CW, (hpPriv->cwmin[0]/2)+((u32_t)hpPriv->cwmax[0]<<16));
+ }
+ else
+ {
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_AC0_CW, hpPriv->cwmin[0]+((u32_t)hpPriv->cwmax[0]<<16));
+ }
+ polluted = 1;
+ }
+ else
+ {
+ /* Compensation for 20us slot time */
+ //zfDelayWriteInternalReg(dev, ZM_MAC_REG_AC0_CW, 58+((u32_t)hpPriv->cwmax[0]<<16));
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_AC0_CW, hpPriv->cwmin[0]+((u32_t)hpPriv->cwmax[0]<<16));
+ polluted = 1;
+ }
+
+ if ((wd->sta.SWEncryptEnable & (ZM_SW_TKIP_ENCRY_EN|ZM_SW_WEP_ENCRY_EN)) == 0)
+ {
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_AC1_AC0_TXOP, hpPriv->txop[0]);
+ polluted = 1;
+ }
+ else
+ {
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_AC1_AC0_TXOP, 0x30);
+ polluted = 1;
+ }
+
+ }
+ hpPriv->usbAcSendBytes[3] = 0;
+ hpPriv->usbAcSendBytes[2] = 0;
+ hpPriv->usbAcSendBytes[1] = 0;
+ hpPriv->usbAcSendBytes[0] = 0;
+ }
+
+ if (polluted == 1)
+ {
+ zfFlushDelayWrite(dev);
+ }
+
+ return;
+}
+
+/*
+ * 0x1d4008 : AHB, DAC, ADC clock selection
+ * bit1~0 AHB_CLK : AHB clock selection,
+ * 00 : OSC 40MHz;
+ * 01 : 20MHz in A mode, 22MHz in G mode;
+ * 10 : 40MHz in A mode, 44MHz in G mode;
+ * 11 : 80MHz in A mode, 88MHz in G mode.
+ * bit3~2 CLK_SEL : Select the clock source of clk160 in ADDAC.
+ * 00 : PLL divider's output;
+ * 01 : PLL divider's output divided by 2;
+ * 10 : PLL divider's output divided by 4;
+ * 11 : REFCLK from XTALOSCPAD.
+ */
+void zfSelAdcClk(zdev_t* dev, u8_t bw40, u32_t frequency)
+{
+ if(bw40 == 1)
+ {
+ //zfDelayWriteInternalReg(dev, 0x1D4008, 0x73);
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_DYNAMIC_SIFS_ACK, 0x10A);
+ zfFlushDelayWrite(dev);
+ }
+ else
+ {
+ //zfDelayWriteInternalReg(dev, 0x1D4008, 0x70);
+ if ( frequency <= ZM_CH_G_14 )
+ {
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_DYNAMIC_SIFS_ACK, 0x105);
+ }
+ else
+ {
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_DYNAMIC_SIFS_ACK, 0x104);
+ }
+ zfFlushDelayWrite(dev);
+ }
+}
+
+u32_t zfHpEchoCommand(zdev_t* dev, u32_t value)
+{
+ u32_t cmd[2];
+ u16_t ret;
+
+ cmd[0] = 0x00008004;
+ cmd[1] = value;
+
+ ret = zfIssueCmd(dev, cmd, 8, ZM_CMD_ECHO, NULL);
+ return ret;
+}
+
+#ifdef ZM_DRV_INIT_USB_MODE
+
+#define ZM_USB_US_STREAM_MODE 0x00000000
+#define ZM_USB_US_PACKET_MODE 0x00000008
+#define ZM_USB_DS_ENABLE 0x00000001
+#define ZM_USB_US_ENABLE 0x00000002
+
+#define ZM_USB_RX_STREAM_4K 0x00000000
+#define ZM_USB_RX_STREAM_8K 0x00000010
+#define ZM_USB_RX_STREAM_16K 0x00000020
+#define ZM_USB_RX_STREAM_32K 0x00000030
+
+#define ZM_USB_TX_STREAM_MODE 0x00000040
+
+#define ZM_USB_MODE_CTRL_REG 0x001E1108
+
+void zfInitUsbMode(zdev_t* dev)
+{
+ u32_t mode;
+ zmw_get_wlan_dev(dev);
+
+ /* TODO: Set USB mode by reading registery */
+ mode = ZM_USB_DS_ENABLE | ZM_USB_US_ENABLE | ZM_USB_US_PACKET_MODE;
+
+ zfDelayWriteInternalReg(dev, ZM_USB_MODE_CTRL_REG, mode);
+ zfFlushDelayWrite(dev);
+}
+#endif
+
+void zfDumpEepBandEdges(struct ar5416Eeprom* eepromImage);
+void zfPrintTargetPower2G(u8_t* tPow2xCck, u8_t* tPow2x2g, u8_t* tPow2x2gHt20, u8_t* tPow2x2gHt40);
+void zfPrintTargetPower5G(u8_t* tPow2x5g, u8_t* tPow2x5gHt20, u8_t* tPow2x5gHt40);
+
+
+s32_t zfInterpolateFunc(s32_t x, s32_t x1, s32_t y1, s32_t x2, s32_t y2)
+{
+ s32_t y;
+
+ if (y2 == y1)
+ {
+ y = y1;
+ }
+ else if (x == x1)
+ {
+ y = y1;
+ }
+ else if (x == x2)
+ {
+ y = y2;
+ }
+ else if (x2 != x1)
+ {
+ y = y1 + (((y2-y1) * (x-x1))/(x2-x1));
+ }
+ else
+ {
+ y = y1;
+ }
+
+ return y;
+}
+
+//#define ZM_ENABLE_TPC_WINDOWS_DEBUG
+//#define ZM_ENABLE_BANDEDGES_WINDOWS_DEBUG
+
+/* the tx power offset workaround for ART vs NDIS/MDK */
+#define HALTX_POWER_OFFSET 0
+
+u8_t zfInterpolateFuncX(u8_t x, u8_t x1, u8_t y1, u8_t x2, u8_t y2)
+{
+ s32_t y;
+ s32_t inc;
+
+ #define ZM_MULTIPLIER 8
+ y = zfInterpolateFunc((s32_t)x<<ZM_MULTIPLIER,
+ (s32_t)x1<<ZM_MULTIPLIER,
+ (s32_t)y1<<ZM_MULTIPLIER,
+ (s32_t)x2<<ZM_MULTIPLIER,
+ (s32_t)y2<<ZM_MULTIPLIER);
+
+ inc = (y & (1<<(ZM_MULTIPLIER-1))) >> (ZM_MULTIPLIER-1);
+ y = (y >> ZM_MULTIPLIER) + inc;
+ #undef ZM_MULTIPLIER
+
+ return (u8_t)y;
+}
+
+u8_t zfGetInterpolatedValue(u8_t x, u8_t* x_array, u8_t* y_array)
+{
+ s32_t y;
+ u16_t xIndex;
+
+ if (x <= x_array[1])
+ {
+ xIndex = 0;
+ }
+ else if (x <= x_array[2])
+ {
+ xIndex = 1;
+ }
+ else if (x <= x_array[3])
+ {
+ xIndex = 2;
+ }
+ else //(x > x_array[3])
+ {
+ xIndex = 3;
+ }
+
+ y = zfInterpolateFuncX(x,
+ x_array[xIndex],
+ y_array[xIndex],
+ x_array[xIndex+1],
+ y_array[xIndex+1]);
+
+ return (u8_t)y;
+}
+
+u8_t zfFindFreqIndex(u8_t f, u8_t* fArray, u8_t fArraySize)
+{
+ u8_t i;
+#ifdef ZM_ENABLE_TPC_WINDOWS_DEBUG
+ DbgPrint("f=%d ", f);
+ for (i=0; i<fArraySize; i++)
+ {
+ DbgPrint("%d ", fArray[i]);
+ }
+ DbgPrint("\n");
+#endif
+ i=fArraySize-2;
+ while(1)
+ {
+ if (f >= fArray[i])
+ {
+ return i;
+ }
+ if (i!=0)
+ {
+ i--;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+}
+
+
+
+
+void zfInitPowerCal(zdev_t* dev)
+{
+ //Program PHY Tx power relatives registers
+#define zm_write_phy_reg(cr, val) reg_write((cr*4)+0x9800, val)
+
+ zm_write_phy_reg(79, 0x7f);
+ zm_write_phy_reg(77, 0x3f3f3f3f);
+ zm_write_phy_reg(78, 0x3f3f3f3f);
+ zm_write_phy_reg(653, 0x3f3f3f3f);
+ zm_write_phy_reg(654, 0x3f3f3f3f);
+ zm_write_phy_reg(739, 0x3f3f3f3f);
+ zm_write_phy_reg(740, 0x3f3f3f3f);
+ zm_write_phy_reg(755, 0x3f3f3f3f);
+ zm_write_phy_reg(756, 0x3f3f3f3f);
+ zm_write_phy_reg(757, 0x3f3f3f3f);
+
+#undef zm_write_phy_reg
+}
+
+
+
+void zfPrintTp(u8_t* pwr0, u8_t* vpd0, u8_t* pwr1, u8_t* vpd1)
+{
+ #ifdef ZM_ENABLE_TPC_WINDOWS_DEBUG
+ DbgPrint("pwr0 : %d, %d, %d, %d ,%d\n", pwr0[0], pwr0[1], pwr0[2], pwr0[3], pwr0[4]);
+ DbgPrint("vpd0 : %d, %d, %d, %d ,%d\n", vpd0[0], vpd0[1], vpd0[2], vpd0[3], vpd0[4]);
+ DbgPrint("pwr1 : %d, %d, %d, %d ,%d\n", pwr1[0], pwr1[1], pwr1[2], pwr1[3], pwr1[4]);
+ DbgPrint("vpd1 : %d, %d, %d, %d ,%d\n", vpd1[0], vpd1[1], vpd1[2], vpd1[3], vpd1[4]);
+ #endif
+}
+
+
+/*
+ * To find CTL index(0~23)
+ * return 24(AR5416_NUM_CTLS)=>no desired index found
+ */
+u8_t zfFindCtlEdgesIndex(zdev_t* dev, u8_t desired_CtlIndex)
+{
+ u8_t i;
+ struct zsHpPriv* hpPriv;
+ struct ar5416Eeprom* eepromImage;
+
+ zmw_get_wlan_dev(dev);
+
+ hpPriv = wd->hpPrivate;
+
+ eepromImage = (struct ar5416Eeprom*)&(hpPriv->eepromImage[(1024+512)/4]);
+
+ //for (i = 0; (i < AR5416_NUM_CTLS) && eepromImage->ctlIndex[i]; i++)
+ for (i = 0; i < AR5416_NUM_CTLS; i++)
+ {
+ if(desired_CtlIndex == eepromImage->ctlIndex[i])
+ break;
+ }
+ return i;
+}
+
+/**************************************************************************
+ * fbin2freq
+ *
+ * Get channel value from binary representation held in eeprom
+ * RETURNS: the frequency in MHz
+ */
+u32_t
+fbin2freq(u8_t fbin, u8_t is2GHz)
+{
+ /*
+ * Reserved value 0xFF provides an empty definition both as
+ * an fbin and as a frequency - do not convert
+ */
+ if (fbin == AR5416_BCHAN_UNUSED) {
+ return fbin;
+ }
+
+ return (u32_t)((is2GHz==1) ? (2300 + fbin) : (4800 + 5 * fbin));
+}
+
+
+u8_t zfGetMaxEdgePower(zdev_t* dev, CAL_CTL_EDGES *pCtlEdges, u32_t freq)
+{
+ u8_t i;
+ u8_t maxEdgePower;
+ u8_t is2GHz;
+ struct zsHpPriv* hpPriv;
+ struct ar5416Eeprom* eepromImage;
+
+ zmw_get_wlan_dev(dev);
+
+ hpPriv = wd->hpPrivate;
+
+ eepromImage = (struct ar5416Eeprom*)&(hpPriv->eepromImage[(1024+512)/4]);
+
+ if(freq > ZM_CH_G_14)
+ is2GHz = 0;
+ else
+ is2GHz = 1;
+
+ maxEdgePower = AR5416_MAX_RATE_POWER;
+
+ /* Get the edge power */
+ for (i = 0; (i < AR5416_NUM_BAND_EDGES) && (pCtlEdges[i].bChannel != AR5416_BCHAN_UNUSED) ; i++)
+ {
+ /*
+ * If there's an exact channel match or an inband flag set
+ * on the lower channel use the given rdEdgePower
+ */
+ if (freq == fbin2freq(pCtlEdges[i].bChannel, is2GHz))
+ {
+ maxEdgePower = pCtlEdges[i].tPower;
+ #ifdef ZM_ENABLE_BANDEDGES_WINDOWS_DEBUG
+ zm_dbg(("zfGetMaxEdgePower index i = %d \n", i));
+ #endif
+ break;
+ }
+ else if ((i > 0) && (freq < fbin2freq(pCtlEdges[i].bChannel, is2GHz)))
+ {
+ if (fbin2freq(pCtlEdges[i - 1].bChannel, is2GHz) < freq && pCtlEdges[i - 1].flag)
+ {
+ maxEdgePower = pCtlEdges[i - 1].tPower;
+ #ifdef ZM_ENABLE_BANDEDGES_WINDOWS_DEBUG
+ zm_dbg(("zfGetMaxEdgePower index i-1 = %d \n", i-1));
+ #endif
+ }
+ /* Leave loop - no more affecting edges possible in this monotonic increasing list */
+ break;
+ }
+
+ }
+
+ if( i == AR5416_NUM_BAND_EDGES )
+ {
+ if (freq > fbin2freq(pCtlEdges[i - 1].bChannel, is2GHz) && pCtlEdges[i - 1].flag)
+ {
+ maxEdgePower = pCtlEdges[i - 1].tPower;
+ #ifdef ZM_ENABLE_BANDEDGES_WINDOWS_DEBUG
+ zm_dbg(("zfGetMaxEdgePower index=>i-1 = %d \n", i-1));
+ #endif
+ }
+ }
+
+ zm_assert(maxEdgePower > 0);
+
+ #ifdef ZM_ENABLE_BANDEDGES_WINDOWS_DEBUG
+ if ( maxEdgePower == AR5416_MAX_RATE_POWER )
+ {
+ zm_dbg(("zfGetMaxEdgePower = %d !!!\n", AR5416_MAX_RATE_POWER));
+ }
+ #endif
+ return maxEdgePower;
+}
+
+u32_t zfAdjustHT40FreqOffset(zdev_t* dev, u32_t frequency, u8_t bw40, u8_t extOffset)
+{
+ u32_t newFreq = frequency;
+
+ if (bw40 == 1)
+ {
+ if (extOffset == 1)
+ {
+ newFreq += 10;
+ }
+ else
+ {
+ newFreq -= 10;
+ }
+ }
+ return newFreq;
+}
+
+u32_t zfHpCheckDoHeavyClip(zdev_t* dev, u32_t freq, CAL_CTL_EDGES *pCtlEdges, u8_t bw40)
+{
+ u32_t ret = 0;
+ u8_t i;
+ u8_t is2GHz;
+ struct zsHpPriv* hpPriv;
+
+ zmw_get_wlan_dev(dev);
+
+ hpPriv = wd->hpPrivate;
+
+ if(freq > ZM_CH_G_14)
+ is2GHz = 0;
+ else
+ is2GHz = 1;
+
+ /* HT40 force enable heavy clip */
+ if (bw40)
+ {
+ ret |= 0xf0;
+ }
+#if 1
+ /* HT20 : frequency bandedge */
+ for (i = 0; (i < AR5416_NUM_BAND_EDGES) && (pCtlEdges[i].bChannel != AR5416_BCHAN_UNUSED) ; i++)
+ {
+ if (freq == fbin2freq(pCtlEdges[i].bChannel, is2GHz))
+ {
+ if (pCtlEdges[i].flag == 0)
+ {
+ ret |= 0xf;
+ }
+ break;
+ }
+ }
+#endif
+
+ return ret;
+}
+
+
+void zfSetPowerCalTable(zdev_t* dev, u32_t frequency, u8_t bw40, u8_t extOffset)
+{
+ struct ar5416Eeprom* eepromImage;
+ u8_t pwr0[5];
+ u8_t pwr1[5];
+ u8_t vpd0[5];
+ u8_t vpd1[5];
+ u8_t vpd_chain1[128];
+ u8_t vpd_chain3[128];
+ u16_t boundary1 = 18; //CR 667
+ u16_t powerTxMax = 63; //CR 79
+ u8_t i;
+ struct zsHpPriv* hpPriv;
+ u8_t fbin;
+ u8_t index, max2gIndex, max5gIndex;
+ u8_t chain0pwrPdg0[5];
+ u8_t chain0vpdPdg0[5];
+ u8_t chain0pwrPdg1[5];
+ u8_t chain0vpdPdg1[5];
+ u8_t chain2pwrPdg0[5];
+ u8_t chain2vpdPdg0[5];
+ u8_t chain2pwrPdg1[5];
+ u8_t chain2vpdPdg1[5];
+ u8_t fbinArray[8];
+
+ /* 4 CTL */
+ u8_t ctl_i;
+ u8_t desired_CtlIndex;
+
+ u8_t ctlEdgesMaxPowerCCK = AR5416_MAX_RATE_POWER;
+ u8_t ctlEdgesMaxPower2G = AR5416_MAX_RATE_POWER;
+ u8_t ctlEdgesMaxPower2GHT20 = AR5416_MAX_RATE_POWER;
+ u8_t ctlEdgesMaxPower2GHT40 = AR5416_MAX_RATE_POWER;
+ u8_t ctlEdgesMaxPower5G = AR5416_MAX_RATE_POWER;
+ u8_t ctlEdgesMaxPower5GHT20 = AR5416_MAX_RATE_POWER;
+ u8_t ctlEdgesMaxPower5GHT40 = AR5416_MAX_RATE_POWER;
+
+ u8_t ctlOffset;
+
+ zmw_get_wlan_dev(dev);
+
+ hpPriv = wd->hpPrivate;
+
+ eepromImage = (struct ar5416Eeprom*)&(hpPriv->eepromImage[(1024+512)/4]);
+
+ // Check the total bytes of the EEPROM structure to see the dongle have been calibrated or not.
+ if (eepromImage->baseEepHeader.length == 0xffff)
+ {
+ #ifdef ZM_ENABLE_BANDEDGES_WINDOWS_DEBUG
+ zm_dbg(("Warning! This dongle not been calibrated\n"));
+ #endif
+ return;
+ }
+
+ #ifdef ZM_ENABLE_TPC_WINDOWS_DEBUG
+ DbgPrint("-----zfSetPowerCalTable : frequency=%d-----\n", frequency);
+ #endif
+ /* TODO : 1. boundary1 and powerTxMax should be refered to CR667 and CR79 */
+ /* in otus.ini file */
+
+ #ifdef ZM_ENABLE_TPC_WINDOWS_DEBUG
+ /* 2. Interpolate pwr and vpd test points from frequency */
+ DbgPrint("calFreqPier5G : %d, %d, %d, %d ,%d, %d, %d, %d\n",
+ eepromImage->calFreqPier5G[0]*5+4800,
+ eepromImage->calFreqPier5G[1]*5+4800,
+ eepromImage->calFreqPier5G[2]*5+4800,
+ eepromImage->calFreqPier5G[3]*5+4800,
+ eepromImage->calFreqPier5G[4]*5+4800,
+ eepromImage->calFreqPier5G[5]*5+4800,
+ eepromImage->calFreqPier5G[6]*5+4800,
+ eepromImage->calFreqPier5G[7]*5+4800
+ );
+ DbgPrint("calFreqPier2G : %d, %d, %d, %d\n",
+ eepromImage->calFreqPier2G[0]+2300,
+ eepromImage->calFreqPier2G[1]+2300,
+ eepromImage->calFreqPier2G[2]+2300,
+ eepromImage->calFreqPier2G[3]+2300
+ );
+ #endif
+ if (frequency < 3000)
+ {
+ for (i=0; i<4; i++)
+ {
+ if (eepromImage->calFreqPier2G[i] == 0xff)
+ {
+ break;
+ }
+ }
+ max2gIndex = i;
+ #ifdef ZM_ENABLE_TPC_WINDOWS_DEBUG
+ DbgPrint("max2gIndex : %d\n", max2gIndex);
+ #endif
+ fbin = (u8_t)(frequency - 2300);
+ index = zfFindFreqIndex(fbin, eepromImage->calFreqPier2G, max2gIndex);
+ #ifdef ZM_ENABLE_TPC_WINDOWS_DEBUG
+ DbgPrint("2G index : %d\n", index);
+ DbgPrint("chain 0 index\n");
+ #endif
+ zfPrintTp(&eepromImage->calPierData2G[0][index].pwrPdg[0][0],
+ &eepromImage->calPierData2G[0][index].vpdPdg[0][0],
+ &eepromImage->calPierData2G[0][index].pwrPdg[1][0],
+ &eepromImage->calPierData2G[0][index].vpdPdg[1][0]
+ );
+ #ifdef ZM_ENABLE_TPC_WINDOWS_DEBUG
+ DbgPrint("chain 0 index+1\n");
+ #endif
+ zfPrintTp(&eepromImage->calPierData2G[0][index+1].pwrPdg[0][0],
+ &eepromImage->calPierData2G[0][index+1].vpdPdg[0][0],
+ &eepromImage->calPierData2G[0][index+1].pwrPdg[1][0],
+ &eepromImage->calPierData2G[0][index+1].vpdPdg[1][0]
+ );
+
+ for (i=0; i<5; i++)
+ {
+ chain0pwrPdg0[i] = zfInterpolateFuncX(fbin,
+ eepromImage->calFreqPier2G[index],
+ eepromImage->calPierData2G[0][index].pwrPdg[0][i],
+ eepromImage->calFreqPier2G[index+1],
+ eepromImage->calPierData2G[0][index+1].pwrPdg[0][i]
+ );
+ chain0vpdPdg0[i] = zfInterpolateFuncX(fbin,
+ eepromImage->calFreqPier2G[index],
+ eepromImage->calPierData2G[0][index].vpdPdg[0][i],
+ eepromImage->calFreqPier2G[index+1],
+ eepromImage->calPierData2G[0][index+1].vpdPdg[0][i]
+ );
+ chain0pwrPdg1[i] = zfInterpolateFuncX(fbin,
+ eepromImage->calFreqPier2G[index],
+ eepromImage->calPierData2G[0][index].pwrPdg[1][i],
+ eepromImage->calFreqPier2G[index+1],
+ eepromImage->calPierData2G[0][index+1].pwrPdg[1][i]
+ );
+ chain0vpdPdg1[i] = zfInterpolateFuncX(fbin,
+ eepromImage->calFreqPier2G[index],
+ eepromImage->calPierData2G[0][index].vpdPdg[1][i],
+ eepromImage->calFreqPier2G[index+1],
+ eepromImage->calPierData2G[0][index+1].vpdPdg[1][i]
+ );
+
+ chain2pwrPdg0[i] = zfInterpolateFuncX(fbin,
+ eepromImage->calFreqPier2G[index],
+ eepromImage->calPierData2G[1][index].pwrPdg[0][i],
+ eepromImage->calFreqPier2G[index+1],
+ eepromImage->calPierData2G[1][index+1].pwrPdg[0][i]
+ );
+ chain2vpdPdg0[i] = zfInterpolateFuncX(fbin,
+ eepromImage->calFreqPier2G[index],
+ eepromImage->calPierData2G[1][index].vpdPdg[0][i],
+ eepromImage->calFreqPier2G[index+1],
+ eepromImage->calPierData2G[1][index+1].vpdPdg[0][i]
+ );
+ chain2pwrPdg1[i] = zfInterpolateFuncX(fbin,
+ eepromImage->calFreqPier2G[index],
+ eepromImage->calPierData2G[1][index].pwrPdg[1][i],
+ eepromImage->calFreqPier2G[index+1],
+ eepromImage->calPierData2G[1][index+1].pwrPdg[1][i]
+ );
+ chain2vpdPdg1[i] = zfInterpolateFuncX(fbin,
+ eepromImage->calFreqPier2G[index],
+ eepromImage->calPierData2G[1][index].vpdPdg[1][i],
+ eepromImage->calFreqPier2G[index+1],
+ eepromImage->calPierData2G[1][index+1].vpdPdg[1][i]
+ );
+ }
+ }
+ else
+ {
+ for (i=0; i<8; i++)
+ {
+ if (eepromImage->calFreqPier5G[i] == 0xff)
+ {
+ break;
+ }
+ }
+ max5gIndex = i;
+ #ifdef ZM_ENABLE_TPC_WINDOWS_DEBUG
+ DbgPrint("max5gIndex : %d\n", max5gIndex);
+ #endif
+ fbin = (u8_t)((frequency - 4800)/5);
+ index = zfFindFreqIndex(fbin, eepromImage->calFreqPier5G, max5gIndex);
+ #ifdef ZM_ENABLE_TPC_WINDOWS_DEBUG
+ DbgPrint("5G index : %d\n", index);
+ #endif
+
+ for (i=0; i<5; i++)
+ {
+ chain0pwrPdg0[i] = zfInterpolateFuncX(fbin,
+ eepromImage->calFreqPier5G[index],
+ eepromImage->calPierData5G[0][index].pwrPdg[0][i],
+ eepromImage->calFreqPier5G[index+1],
+ eepromImage->calPierData5G[0][index+1].pwrPdg[0][i]
+ );
+ chain0vpdPdg0[i] = zfInterpolateFuncX(fbin,
+ eepromImage->calFreqPier5G[index],
+ eepromImage->calPierData5G[0][index].vpdPdg[0][i],
+ eepromImage->calFreqPier5G[index+1],
+ eepromImage->calPierData5G[0][index+1].vpdPdg[0][i]
+ );
+ chain0pwrPdg1[i] = zfInterpolateFuncX(fbin,
+ eepromImage->calFreqPier5G[index],
+ eepromImage->calPierData5G[0][index].pwrPdg[1][i],
+ eepromImage->calFreqPier5G[index+1],
+ eepromImage->calPierData5G[0][index+1].pwrPdg[1][i]
+ );
+ chain0vpdPdg1[i] = zfInterpolateFuncX(fbin,
+ eepromImage->calFreqPier5G[index],
+ eepromImage->calPierData5G[0][index].vpdPdg[1][i],
+ eepromImage->calFreqPier5G[index+1],
+ eepromImage->calPierData5G[0][index+1].vpdPdg[1][i]
+ );
+
+ chain2pwrPdg0[i] = zfInterpolateFuncX(fbin,
+ eepromImage->calFreqPier5G[index],
+ eepromImage->calPierData5G[1][index].pwrPdg[0][i],
+ eepromImage->calFreqPier5G[index+1],
+ eepromImage->calPierData5G[1][index+1].pwrPdg[0][i]
+ );
+ chain2vpdPdg0[i] = zfInterpolateFuncX(fbin,
+ eepromImage->calFreqPier5G[index],
+ eepromImage->calPierData5G[1][index].vpdPdg[0][i],
+ eepromImage->calFreqPier5G[index+1],
+ eepromImage->calPierData5G[1][index+1].vpdPdg[0][i]
+ );
+ chain2pwrPdg1[i] = zfInterpolateFuncX(fbin,
+ eepromImage->calFreqPier5G[index],
+ eepromImage->calPierData5G[1][index].pwrPdg[1][i],
+ eepromImage->calFreqPier5G[index+1],
+ eepromImage->calPierData5G[1][index+1].pwrPdg[1][i]
+ );
+ chain2vpdPdg1[i] = zfInterpolateFuncX(fbin,
+ eepromImage->calFreqPier5G[index],
+ eepromImage->calPierData5G[1][index].vpdPdg[1][i],
+ eepromImage->calFreqPier5G[index+1],
+ eepromImage->calPierData5G[1][index+1].vpdPdg[1][i]
+ );
+ }
+
+ }
+
+
+ /* Chain 1 */
+ /* Get pwr and vpd test points from frequency */
+ for (i=0; i<5; i++)
+ {
+ pwr0[i] = chain0pwrPdg0[i]>>1;
+ vpd0[i] = chain0vpdPdg0[i];
+ pwr1[i] = chain0pwrPdg1[i]>>1;
+ vpd1[i] = chain0vpdPdg1[i];
+ }
+ #ifdef ZM_ENABLE_TPC_WINDOWS_DEBUG
+ DbgPrint("Test Points\n");
+ DbgPrint("pwr0 : %d, %d, %d, %d ,%d\n", pwr0[0], pwr0[1], pwr0[2], pwr0[3], pwr0[4]);
+ DbgPrint("vpd0 : %d, %d, %d, %d ,%d\n", vpd0[0], vpd0[1], vpd0[2], vpd0[3], vpd0[4]);
+ DbgPrint("pwr1 : %d, %d, %d, %d ,%d\n", pwr1[0], pwr1[1], pwr1[2], pwr1[3], pwr1[4]);
+ DbgPrint("vpd1 : %d, %d, %d, %d ,%d\n", vpd1[0], vpd1[1], vpd1[2], vpd1[3], vpd1[4]);
+ #endif
+ /* Generate the vpd arrays */
+ for (i=0; i<boundary1+1+6; i++)
+ {
+ vpd_chain1[i] = zfGetInterpolatedValue(i, &pwr0[0], &vpd0[0]);
+ }
+ for (; i<powerTxMax+1+6+6; i++)
+ {
+ vpd_chain1[i] = zfGetInterpolatedValue(i-6-6, &pwr1[0], &vpd1[0]);
+ }
+ #ifdef ZM_ENABLE_TPC_WINDOWS_DEBUG
+ DbgPrint("vpd_chain1\n");
+ for (i=0; i<powerTxMax+1+6+6; i+=10)
+ {
+ DbgPrint("%d, %d, %d, %d ,%d, %d, %d, %d, %d, %d\n",
+ vpd_chain1[i+0], vpd_chain1[i+1], vpd_chain1[i+2], vpd_chain1[i+3], vpd_chain1[i+4],
+ vpd_chain1[i+5], vpd_chain1[i+6], vpd_chain1[i+7], vpd_chain1[i+8], vpd_chain1[i+9]);
+ }
+ #endif
+ /* Write PHY regs 672-703 */
+ for (i=0; i<128; i+=4)
+ {
+ u32_t regAddr = 0x9800 + (672 * 4);
+ u32_t val;
+
+ val = ((u32_t)vpd_chain1[i+3]<<24) |
+ ((u32_t)vpd_chain1[i+2]<<16) |
+ ((u32_t)vpd_chain1[i+1]<<8) |
+ ((u32_t)vpd_chain1[i]);
+
+ #ifndef ZM_OTUS_LINUX_PHASE_2
+ reg_write(regAddr + i, val); /* CR672 */
+ #endif
+ }
+
+ /* Chain 2 */
+ /* Get pwr and vpd test points from frequency */
+ for (i=0; i<5; i++)
+ {
+ pwr0[i] = chain2pwrPdg0[i]>>1;
+ vpd0[i] = chain2vpdPdg0[i];
+ pwr1[i] = chain2pwrPdg1[i]>>1;
+ vpd1[i] = chain2vpdPdg1[i];
+ }
+ #ifdef ZM_ENABLE_TPC_WINDOWS_DEBUG
+ DbgPrint("Test Points\n");
+ DbgPrint("pwr0 : %d, %d, %d, %d ,%d\n", pwr0[0], pwr0[1], pwr0[2], pwr0[3], pwr0[4]);
+ DbgPrint("vpd0 : %d, %d, %d, %d ,%d\n", vpd0[0], vpd0[1], vpd0[2], vpd0[3], vpd0[4]);
+ DbgPrint("pwr1 : %d, %d, %d, %d ,%d\n", pwr1[0], pwr1[1], pwr1[2], pwr1[3], pwr1[4]);
+ DbgPrint("vpd1 : %d, %d, %d, %d ,%d\n", vpd1[0], vpd1[1], vpd1[2], vpd1[3], vpd1[4]);
+ #endif
+ /* Generate the vpd arrays */
+ for (i=0; i<boundary1+1+6; i++)
+ {
+ vpd_chain3[i] = zfGetInterpolatedValue(i, &pwr0[0], &vpd0[0]);
+ }
+ for (; i<powerTxMax+1+6+6; i++)
+ {
+ vpd_chain3[i] = zfGetInterpolatedValue(i-6-6, &pwr1[0], &vpd1[0]);
+ }
+ #ifdef ZM_ENABLE_TPC_WINDOWS_DEBUG
+ DbgPrint("vpd_chain3\n");
+ for (i=0; i<powerTxMax+1+6+6; i+=10)
+ {
+ DbgPrint("%d, %d, %d, %d ,%d, %d, %d, %d, %d, %d\n",
+ vpd_chain3[i+0], vpd_chain3[i+1], vpd_chain3[i+2], vpd_chain3[i+3], vpd_chain3[i+4],
+ vpd_chain3[i+5], vpd_chain3[i+6], vpd_chain3[i+7], vpd_chain3[i+8], vpd_chain3[i+9]);
+ }
+ #endif
+
+ /* Write PHY regs 672-703 + 0x1000 */
+ for (i=0; i<128; i+=4)
+ {
+ u32_t regAddr = 0x9800 + (672 * 4) + 0x1000;
+ u32_t val;
+
+ val = ((u32_t)vpd_chain3[i+3]<<24) |
+ ((u32_t)vpd_chain3[i+2]<<16) |
+ ((u32_t)vpd_chain3[i+1]<<8) |
+ ((u32_t)vpd_chain3[i]);
+
+ #ifndef ZM_OTUS_LINUX_PHASE_2
+ reg_write(regAddr + i, val); /* CR672 */
+ #endif
+ }
+
+ zfFlushDelayWrite(dev);
+
+ /* 3. Generate target power table */
+ if (frequency < 3000)
+ {
+ for (i=0; i<3; i++)
+ {
+ if (eepromImage->calTargetPowerCck[i].bChannel != 0xff)
+ {
+ fbinArray[i] = eepromImage->calTargetPowerCck[i].bChannel;
+ }
+ else
+ {
+ break;
+ }
+
+ }
+ index = zfFindFreqIndex(fbin, fbinArray, i);
+ #ifdef ZM_ENABLE_TPC_WINDOWS_DEBUG
+ DbgPrint("CCK index=%d\n", index);
+ #endif
+ for (i=0; i<4; i++)
+ {
+ hpPriv->tPow2xCck[i] = zfInterpolateFuncX(fbin,
+ eepromImage->calTargetPowerCck[index].bChannel,
+ eepromImage->calTargetPowerCck[index].tPow2x[i],
+ eepromImage->calTargetPowerCck[index+1].bChannel,
+ eepromImage->calTargetPowerCck[index+1].tPow2x[i]
+ );
+ }
+
+ for (i=0; i<4; i++)
+ {
+ if (eepromImage->calTargetPower2G[i].bChannel != 0xff)
+ {
+ fbinArray[i] = eepromImage->calTargetPower2G[i].bChannel;
+ }
+ else
+ {
+ break;
+ }
+
+ }
+ index = zfFindFreqIndex(fbin, fbinArray, i);
+ #ifdef ZM_ENABLE_TPC_WINDOWS_DEBUG
+ DbgPrint("2G index=%d\n", index);
+ #endif
+ for (i=0; i<4; i++)
+ {
+ hpPriv->tPow2x2g[i] = zfInterpolateFuncX(fbin,
+ eepromImage->calTargetPower2G[index].bChannel,
+ eepromImage->calTargetPower2G[index].tPow2x[i],
+ eepromImage->calTargetPower2G[index+1].bChannel,
+ eepromImage->calTargetPower2G[index+1].tPow2x[i]
+ );
+ }
+
+ for (i=0; i<4; i++)
+ {
+ if (eepromImage->calTargetPower2GHT20[i].bChannel != 0xff)
+ {
+ fbinArray[i] = eepromImage->calTargetPower2GHT20[i].bChannel;
+ }
+ else
+ {
+ break;
+ }
+
+ }
+ index = zfFindFreqIndex(fbin, fbinArray, i);
+ #ifdef ZM_ENABLE_TPC_WINDOWS_DEBUG
+ DbgPrint("2G HT20 index=%d\n", index);
+ #endif
+ for (i=0; i<8; i++)
+ {
+ hpPriv->tPow2x2gHt20[i] = zfInterpolateFuncX(fbin,
+ eepromImage->calTargetPower2GHT20[index].bChannel,
+ eepromImage->calTargetPower2GHT20[index].tPow2x[i],
+ eepromImage->calTargetPower2GHT20[index+1].bChannel,
+ eepromImage->calTargetPower2GHT20[index+1].tPow2x[i]
+ );
+ }
+
+ for (i=0; i<4; i++)
+ {
+ if (eepromImage->calTargetPower2GHT40[i].bChannel != 0xff)
+ {
+ fbinArray[i] = eepromImage->calTargetPower2GHT40[i].bChannel;
+ }
+ else
+ {
+ break;
+ }
+
+ }
+ index = zfFindFreqIndex( (u8_t)zfAdjustHT40FreqOffset(dev, fbin, bw40, extOffset), fbinArray, i);
+ #ifdef ZM_ENABLE_TPC_WINDOWS_DEBUG
+ DbgPrint("2G HT40 index=%d\n", index);
+ #endif
+ for (i=0; i<8; i++)
+ {
+ hpPriv->tPow2x2gHt40[i] = zfInterpolateFuncX(
+ (u8_t)zfAdjustHT40FreqOffset(dev, fbin, bw40, extOffset),
+ eepromImage->calTargetPower2GHT40[index].bChannel,
+ eepromImage->calTargetPower2GHT40[index].tPow2x[i],
+ eepromImage->calTargetPower2GHT40[index+1].bChannel,
+ eepromImage->calTargetPower2GHT40[index+1].tPow2x[i]
+ );
+ }
+
+ zfPrintTargetPower2G(hpPriv->tPow2xCck,
+ hpPriv->tPow2x2g,
+ hpPriv->tPow2x2gHt20,
+ hpPriv->tPow2x2gHt40);
+ }
+ else
+ {
+ /* 5G */
+ for (i=0; i<8; i++)
+ {
+ if (eepromImage->calTargetPower5G[i].bChannel != 0xff)
+ {
+ fbinArray[i] = eepromImage->calTargetPower5G[i].bChannel;
+ }
+ else
+ {
+ break;
+ }
+
+ }
+ index = zfFindFreqIndex(fbin, fbinArray, i);
+ #ifdef ZM_ENABLE_TPC_WINDOWS_DEBUG
+ DbgPrint("5G index=%d\n", index);
+ #endif
+ for (i=0; i<4; i++)
+ {
+ hpPriv->tPow2x5g[i] = zfInterpolateFuncX(fbin,
+ eepromImage->calTargetPower5G[index].bChannel,
+ eepromImage->calTargetPower5G[index].tPow2x[i],
+ eepromImage->calTargetPower5G[index+1].bChannel,
+ eepromImage->calTargetPower5G[index+1].tPow2x[i]
+ );
+ }
+
+ for (i=0; i<8; i++)
+ {
+ if (eepromImage->calTargetPower5GHT20[i].bChannel != 0xff)
+ {
+ fbinArray[i] = eepromImage->calTargetPower5GHT20[i].bChannel;
+ }
+ else
+ {
+ break;
+ }
+
+ }
+ index = zfFindFreqIndex(fbin, fbinArray, i);
+ #ifdef ZM_ENABLE_TPC_WINDOWS_DEBUG
+ DbgPrint("5G HT20 index=%d\n", index);
+ #endif
+ for (i=0; i<8; i++)
+ {
+ hpPriv->tPow2x5gHt20[i] = zfInterpolateFuncX(fbin,
+ eepromImage->calTargetPower5GHT20[index].bChannel,
+ eepromImage->calTargetPower5GHT20[index].tPow2x[i],
+ eepromImage->calTargetPower5GHT20[index+1].bChannel,
+ eepromImage->calTargetPower5GHT20[index+1].tPow2x[i]
+ );
+ }
+
+ for (i=0; i<8; i++)
+ {
+ if (eepromImage->calTargetPower5GHT40[i].bChannel != 0xff)
+ {
+ fbinArray[i] = eepromImage->calTargetPower5GHT40[i].bChannel;
+ }
+ else
+ {
+ break;
+ }
+
+ }
+ index = zfFindFreqIndex((u8_t)zfAdjustHT40FreqOffset(dev, fbin, bw40, extOffset), fbinArray, i);
+ #ifdef ZM_ENABLE_TPC_WINDOWS_DEBUG
+ DbgPrint("5G HT40 index=%d\n", index);
+ #endif
+ for (i=0; i<8; i++)
+ {
+ hpPriv->tPow2x5gHt40[i] = zfInterpolateFuncX(
+ (u8_t)zfAdjustHT40FreqOffset(dev, fbin, bw40, extOffset),
+ eepromImage->calTargetPower5GHT40[index].bChannel,
+ eepromImage->calTargetPower5GHT40[index].tPow2x[i],
+ eepromImage->calTargetPower5GHT40[index+1].bChannel,
+ eepromImage->calTargetPower5GHT40[index+1].tPow2x[i]
+ );
+ }
+
+ zfPrintTargetPower5G(
+ hpPriv->tPow2x5g,
+ hpPriv->tPow2x5gHt20,
+ hpPriv->tPow2x5gHt40);
+ }
+
+
+
+ /* 4. CTL */
+ /*
+ * 4.1 Get the bandedges tx power by frequency
+ * 2.4G we get ctlEdgesMaxPowerCCK
+ * ctlEdgesMaxPower2G
+ * ctlEdgesMaxPower2GHT20
+ * ctlEdgesMaxPower2GHT40
+ * 5G we get ctlEdgesMaxPower5G
+ * ctlEdgesMaxPower5GHT20
+ * ctlEdgesMaxPower5GHT40
+ * 4.2 Update (3.) target power table by 4.1
+ * 4.3 Tx power offset for ART - NDIS/MDK
+ * 4.4 Write MAC reg 0x694 for ACK's TPC
+ *
+ */
+
+ //zfDumpEepBandEdges(eepromImage);
+
+ /* get the cfg from Eeprom: regionCode => RegulatoryDomain : 0x10-FFC 0x30-eu 0x40-jap */
+ desired_CtlIndex = zfHpGetRegulatoryDomain(dev);
+ if ((desired_CtlIndex == 0x30) || (desired_CtlIndex == 0x40) || (desired_CtlIndex == 0x0))
+ {
+ /* skip CTL and heavy clip */
+ hpPriv->enableBBHeavyClip = 0;
+ #ifdef ZM_ENABLE_BANDEDGES_WINDOWS_DEBUG
+ zm_dbg(("RegulatoryDomain = 0, skip CTL and heavy clip\n"));
+ #endif
+ }
+ else
+ {
+ hpPriv->enableBBHeavyClip = 1;
+
+ if (desired_CtlIndex == 0xff)
+ {
+ /* desired index not found */
+ desired_CtlIndex = 0x10;
+ }
+
+ /* first part : 2.4G */
+ if (frequency <= ZM_CH_G_14)
+ {
+ /* 2.4G - CTL_11B */
+ ctl_i = zfFindCtlEdgesIndex(dev, desired_CtlIndex|CTL_11B);
+ if(ctl_i<AR5416_NUM_CTLS)
+ {
+ ctlEdgesMaxPowerCCK = zfGetMaxEdgePower(dev, eepromImage->ctlData[ctl_i].ctlEdges[1], frequency);
+ }
+ #ifdef ZM_ENABLE_BANDEDGES_WINDOWS_DEBUG
+ zm_dbg(("CTL_11B ctl_i = %d\n", ctl_i));
+ #endif
+
+ /* 2.4G - CTL_11G */
+ ctl_i = zfFindCtlEdgesIndex(dev, desired_CtlIndex|CTL_11G);
+ if(ctl_i<AR5416_NUM_CTLS)
+ {
+ ctlEdgesMaxPower2G = zfGetMaxEdgePower(dev, eepromImage->ctlData[ctl_i].ctlEdges[1], frequency);
+ }
+ #ifdef ZM_ENABLE_BANDEDGES_WINDOWS_DEBUG
+ zm_dbg(("CTL_11G ctl_i = %d\n", ctl_i));
+ #endif
+
+ /* 2.4G - CTL_2GHT20 */
+ ctl_i = zfFindCtlEdgesIndex(dev, desired_CtlIndex|CTL_2GHT20);
+ if(ctl_i<AR5416_NUM_CTLS)
+ {
+ ctlEdgesMaxPower2GHT20 = zfGetMaxEdgePower(dev, eepromImage->ctlData[ctl_i].ctlEdges[1], frequency);
+ }
+ else
+ {
+ /* workaround for no data in Eeprom, replace by normal 2G */
+ ctlEdgesMaxPower2GHT20 = ctlEdgesMaxPower2G;
+ }
+ #ifdef ZM_ENABLE_BANDEDGES_WINDOWS_DEBUG
+ zm_dbg(("CTL_2GHT20 ctl_i = %d\n", ctl_i));
+ #endif
+
+ /* 2.4G - CTL_2GHT40 */
+ ctl_i = zfFindCtlEdgesIndex(dev, desired_CtlIndex|CTL_2GHT40);
+ if(ctl_i<AR5416_NUM_CTLS)
+ {
+ ctlEdgesMaxPower2GHT40 = zfGetMaxEdgePower(dev, eepromImage->ctlData[ctl_i].ctlEdges[1],
+ zfAdjustHT40FreqOffset(dev, frequency, bw40, extOffset));
+ }
+ else
+ {
+ /* workaround for no data in Eeprom, replace by normal 2G */
+ ctlEdgesMaxPower2GHT40 = ctlEdgesMaxPower2G;
+ }
+ #ifdef ZM_ENABLE_BANDEDGES_WINDOWS_DEBUG
+ zm_dbg(("CTL_2GHT40 ctl_i = %d\n", ctl_i));
+ #endif
+
+
+ /* 7a17 : */
+ /* Max power (dBm) for channel range when using DFS define by madwifi*/
+ for (i=0; i<wd->regulationTable.allowChannelCnt; i++)
+ {
+ if (wd->regulationTable.allowChannel[i].channel == frequency)
+ {
+ if (zfHpIsDfsChannel(dev, (u16_t)frequency))
+ {
+ zm_debug_msg1("frequency use DFS -- ", frequency);
+ ctlEdgesMaxPowerCCK = zm_min(ctlEdgesMaxPowerCCK, wd->regulationTable.allowChannel[i].maxRegTxPower*2);
+ ctlEdgesMaxPower2G = zm_min(ctlEdgesMaxPower2G, wd->regulationTable.allowChannel[i].maxRegTxPower*2);
+ ctlEdgesMaxPower2GHT20 = zm_min(ctlEdgesMaxPower2GHT20, wd->regulationTable.allowChannel[i].maxRegTxPower*2);
+ ctlEdgesMaxPower2GHT40 = zm_min(ctlEdgesMaxPower2GHT40, wd->regulationTable.allowChannel[i].maxRegTxPower*2);
+ }
+ break;
+ }
+ }
+
+ /* Apply ctl mode to correct target power set */
+ #ifdef ZM_ENABLE_BANDEDGES_WINDOWS_DEBUG
+ zm_debug_msg1("ctlEdgesMaxPowerCCK = ", ctlEdgesMaxPowerCCK);
+ zm_debug_msg1("ctlEdgesMaxPower2G = ", ctlEdgesMaxPower2G);
+ zm_debug_msg1("ctlEdgesMaxPower2GHT20 = ", ctlEdgesMaxPower2GHT20);
+ zm_debug_msg1("ctlEdgesMaxPower2GHT40 = ", ctlEdgesMaxPower2GHT40);
+ #endif
+ for (i=0; i<4; i++)
+ {
+ hpPriv->tPow2xCck[i] = zm_min(hpPriv->tPow2xCck[i], ctlEdgesMaxPowerCCK) + HALTX_POWER_OFFSET;
+ }
+ hpPriv->tPow2x2g24HeavyClipOffset = 0;
+ if (hpPriv->enableBBHeavyClip)
+ {
+ ctlOffset = 2;
+ }
+ else
+ {
+ ctlOffset = 0;
+ }
+ for (i=0; i<4; i++)
+ {
+ if (((frequency == 2412) || (frequency == 2462)))
+ {
+ if (i != 0)
+ {
+ hpPriv->tPow2x2g[i] = zm_min(hpPriv->tPow2x2g[i], ctlEdgesMaxPower2G-ctlOffset) + HALTX_POWER_OFFSET;
+ }
+ else
+ {
+ hpPriv->tPow2x2g[i] = zm_min(hpPriv->tPow2x2g[i], ctlEdgesMaxPower2G) + HALTX_POWER_OFFSET;
+ if (hpPriv->tPow2x2g[i] > (ctlEdgesMaxPower2G-ctlOffset))
+ {
+ hpPriv->tPow2x2g24HeavyClipOffset = hpPriv->tPow2x2g[i] - (ctlEdgesMaxPower2G-ctlOffset);
+ }
+ }
+ }
+ else
+ {
+ hpPriv->tPow2x2g[i] = zm_min(hpPriv->tPow2x2g[i], ctlEdgesMaxPower2G) + HALTX_POWER_OFFSET;
+ }
+ }
+ for (i=0; i<8; i++)
+ {
+ if (((frequency == 2412) || (frequency == 2462)) && (i>=3))
+ {
+ hpPriv->tPow2x2gHt20[i] = zm_min(hpPriv->tPow2x2gHt20[i], ctlEdgesMaxPower2GHT20-ctlOffset) + HALTX_POWER_OFFSET;
+ }
+ else
+ {
+ hpPriv->tPow2x2gHt20[i] = zm_min(hpPriv->tPow2x2gHt20[i], ctlEdgesMaxPower2GHT20) + HALTX_POWER_OFFSET;
+ }
+ }
+ for (i=0; i<8; i++)
+ {
+ if ((frequency == 2412) && (i>=3))
+ {
+ hpPriv->tPow2x2gHt40[i] = zm_min(hpPriv->tPow2x2gHt40[i], ctlEdgesMaxPower2GHT40-ctlOffset) + HALTX_POWER_OFFSET;
+ }
+ else if ((frequency == 2462) && (i>=3))
+ {
+ hpPriv->tPow2x2gHt40[i] = zm_min(hpPriv->tPow2x2gHt40[i], ctlEdgesMaxPower2GHT40-(ctlOffset*2)) + HALTX_POWER_OFFSET;
+ }
+ else
+ {
+ hpPriv->tPow2x2gHt40[i] = zm_min(hpPriv->tPow2x2gHt40[i], ctlEdgesMaxPower2GHT40) + HALTX_POWER_OFFSET;
+ }
+ }
+ }
+ else
+ {
+ /* 5G - CTL_11A */
+ ctl_i = zfFindCtlEdgesIndex(dev, desired_CtlIndex|CTL_11A);
+ if(ctl_i<AR5416_NUM_CTLS)
+ {
+ ctlEdgesMaxPower5G = zfGetMaxEdgePower(dev, eepromImage->ctlData[ctl_i].ctlEdges[1], frequency);
+ }
+ #ifdef ZM_ENABLE_BANDEDGES_WINDOWS_DEBUG
+ zm_dbg(("CTL_11A ctl_i = %d\n", ctl_i));
+ #endif
+
+ /* 5G - CTL_5GHT20 */
+ ctl_i = zfFindCtlEdgesIndex(dev, desired_CtlIndex|CTL_5GHT20);
+ if(ctl_i<AR5416_NUM_CTLS)
+ {
+ ctlEdgesMaxPower5GHT20 = zfGetMaxEdgePower(dev, eepromImage->ctlData[ctl_i].ctlEdges[1], frequency);
+ }
+ else
+ {
+ /* workaround for no data in Eeprom, replace by normal 5G */
+ ctlEdgesMaxPower5GHT20 = ctlEdgesMaxPower5G;
+ }
+ #ifdef ZM_ENABLE_BANDEDGES_WINDOWS_DEBUG
+ zm_dbg(("CTL_5GHT20 ctl_i = %d\n", ctl_i));
+ #endif
+
+ /* 5G - CTL_5GHT40 */
+ ctl_i = zfFindCtlEdgesIndex(dev, desired_CtlIndex|CTL_5GHT40);
+ if(ctl_i<AR5416_NUM_CTLS)
+ {
+ ctlEdgesMaxPower5GHT40 = zfGetMaxEdgePower(dev, eepromImage->ctlData[ctl_i].ctlEdges[1],
+ zfAdjustHT40FreqOffset(dev, frequency, bw40, extOffset));
+ }
+ else
+ {
+ /* workaround for no data in Eeprom, replace by normal 5G */
+ ctlEdgesMaxPower5GHT40 = ctlEdgesMaxPower5G;
+ }
+ #ifdef ZM_ENABLE_BANDEDGES_WINDOWS_DEBUG
+ zm_dbg(("CTL_5GHT40 ctl_i = %d\n", ctl_i));
+ #endif
+
+ /* 7a17 : */
+ /* Max power (dBm) for channel range when using DFS define by madwifi*/
+ for (i=0; i<wd->regulationTable.allowChannelCnt; i++)
+ {
+ if (wd->regulationTable.allowChannel[i].channel == frequency)
+ {
+ if (zfHpIsDfsChannel(dev, (u16_t)frequency))
+ {
+ zm_debug_msg1("frequency use DFS -- ", frequency);
+ ctlEdgesMaxPower5G = zm_min(ctlEdgesMaxPower5G, wd->regulationTable.allowChannel[i].maxRegTxPower*2);
+ ctlEdgesMaxPower5GHT20 = zm_min(ctlEdgesMaxPower5GHT20, wd->regulationTable.allowChannel[i].maxRegTxPower*2);
+ ctlEdgesMaxPower5GHT40 = zm_min(ctlEdgesMaxPower5GHT40, wd->regulationTable.allowChannel[i].maxRegTxPower*2);
+ }
+ break;
+ }
+ }
+
+
+ /* Apply ctl mode to correct target power set */
+ #ifdef ZM_ENABLE_BANDEDGES_WINDOWS_DEBUG
+ zm_debug_msg1("ctlEdgesMaxPower5G = ", ctlEdgesMaxPower5G);
+ zm_debug_msg1("ctlEdgesMaxPower5GHT20 = ", ctlEdgesMaxPower5GHT20);
+ zm_debug_msg1("ctlEdgesMaxPower5GHT40 = ", ctlEdgesMaxPower5GHT40);
+ #endif
+ for (i=0; i<4; i++)
+ {
+ hpPriv->tPow2x5g[i] = zm_min(hpPriv->tPow2x5g[i], ctlEdgesMaxPower5G) + HALTX_POWER_OFFSET;
+ }
+ for (i=0; i<8; i++)
+ {
+ hpPriv->tPow2x5gHt20[i] = zm_min(hpPriv->tPow2x5gHt20[i], ctlEdgesMaxPower5GHT20) + HALTX_POWER_OFFSET;
+ }
+ for (i=0; i<8; i++)
+ {
+ hpPriv->tPow2x5gHt40[i] = zm_min(hpPriv->tPow2x5gHt40[i], ctlEdgesMaxPower5GHT40) + HALTX_POWER_OFFSET;
+ }
+
+ }/* end of bandedges of 5G */
+ }/* end of if ((desired_CtlIndex = zfHpGetRegulatoryDomain(dev)) == 0) */
+
+ /* workaround */
+ /* 5. BB heavy clip */
+ /* only 2.4G do heavy clip */
+ if (hpPriv->enableBBHeavyClip && hpPriv->hwBBHeavyClip && (frequency <= ZM_CH_G_14))
+ {
+ if (frequency <= ZM_CH_G_14)
+ {
+ ctl_i = zfFindCtlEdgesIndex(dev, desired_CtlIndex|CTL_11G);
+ }
+ else
+ {
+ ctl_i = zfFindCtlEdgesIndex(dev, desired_CtlIndex|CTL_11A);
+ }
+
+ hpPriv->setValueHeavyClip = zfHpCheckDoHeavyClip(dev, frequency, eepromImage->ctlData[ctl_i].ctlEdges[1], bw40);
+
+ if (hpPriv->setValueHeavyClip)
+ {
+ hpPriv->doBBHeavyClip = 1;
+ }
+ else
+ {
+ hpPriv->doBBHeavyClip = 0;
+ }
+ #ifdef ZM_ENABLE_BANDEDGES_WINDOWS_DEBUG
+ zm_dbg(("zfHpCheckDoHeavyClip ret = %02x, doBBHeavyClip = %d\n",
+ hpPriv->setValueHeavyClip, hpPriv->doBBHeavyClip));
+ #endif
+
+ if (hpPriv->doBBHeavyClip)
+ {
+ if (hpPriv->setValueHeavyClip & 0xf0)
+ {
+ hpPriv->tPow2x2gHt40[0] -= 1;
+ hpPriv->tPow2x2gHt40[1] -= 1;
+ hpPriv->tPow2x2gHt40[2] -= 1;
+ }
+
+ if (hpPriv->setValueHeavyClip & 0xf)
+ {
+ hpPriv->tPow2x2gHt20[0] += 1;
+ hpPriv->tPow2x2gHt20[1] += 1;
+ hpPriv->tPow2x2gHt20[2] += 1;
+ }
+ }
+ }
+ else
+ {
+ hpPriv->doBBHeavyClip = 0;
+ hpPriv->setValueHeavyClip = 0;
+ }
+
+ /* Final : write MAC register for some ctrl frame Tx power */
+ /* first part : 2.4G */
+ if (frequency <= ZM_CH_G_14)
+ {
+ /* Write MAC reg 0x694 for ACK's TPC */
+ /* Write MAC reg 0xbb4 RTS and SF-CTS frame power control */
+ /* Always use two stream for low legacy rate */
+ #if 0
+ //if (hpPriv->halCapability & ZM_HP_CAP_11N_ONE_TX_STREAM)
+ //{
+ zfDelayWriteInternalReg(dev, 0x1c3694, ((hpPriv->tPow2x2g[0]&0x3f) << 20) | (0x1<<26));
+ zfDelayWriteInternalReg(dev, 0x1c3bb4, ((hpPriv->tPow2x2g[0]&0x3f) << 5 ) | (0x1<<11) |
+ ((hpPriv->tPow2x2g[0]&0x3f) << 21) | (0x1<<27) );
+ //}
+ #endif
+ #if 1
+ //else
+ {
+ #ifndef ZM_OTUS_LINUX_PHASE_2
+ zfDelayWriteInternalReg(dev, 0x1c3694, ((hpPriv->tPow2x2g[0]&0x3f) << 20) | (0x5<<26));
+ zfDelayWriteInternalReg(dev, 0x1c3bb4, ((hpPriv->tPow2x2g[0]&0x3f) << 5 ) | (0x5<<11) |
+ ((hpPriv->tPow2x2g[0]&0x3f) << 21) | (0x5<<27) );
+ #endif
+ hpPriv->currentAckRtsTpc = hpPriv->tPow2x2g[0];
+ }
+ #endif
+ zfFlushDelayWrite(dev);
+
+ zfPrintTargetPower2G(hpPriv->tPow2xCck,
+ hpPriv->tPow2x2g,
+ hpPriv->tPow2x2gHt20,
+ hpPriv->tPow2x2gHt40);
+ }
+ else
+ {
+ /* Write MAC reg 0x694 for ACK's TPC */
+ /* Write MAC reg 0xbb4 RTS and SF-CTS frame power control */
+ /* Always use two stream for low legacy rate */
+ if (hpPriv->halCapability & ZM_HP_CAP_11N_ONE_TX_STREAM)
+ {
+ #ifndef ZM_OTUS_LINUX_PHASE_2
+ zfDelayWriteInternalReg(dev, 0x1c3694, ((hpPriv->tPow2x5g[0]&0x3f) << 20) | (0x1<<26));
+ zfDelayWriteInternalReg(dev, 0x1c3bb4, ((hpPriv->tPow2x5g[0]&0x3f) << 5 ) | (0x1<<11) |
+ ((hpPriv->tPow2x5g[0]&0x3f) << 21) | (0x1<<27) );
+ #endif
+ }
+ else
+ {
+ #ifndef ZM_OTUS_LINUX_PHASE_2
+ zfDelayWriteInternalReg(dev, 0x1c3694, ((hpPriv->tPow2x5g[0]&0x3f) << 20) | (0x5<<26));
+ zfDelayWriteInternalReg(dev, 0x1c3bb4, ((hpPriv->tPow2x5g[0]&0x3f) << 5 ) | (0x5<<11) |
+ ((hpPriv->tPow2x5g[0]&0x3f) << 21) | (0x5<<27) );
+ #endif
+ hpPriv->currentAckRtsTpc = hpPriv->tPow2x2g[0];
+ }
+
+
+ zfFlushDelayWrite(dev);
+
+ zfPrintTargetPower5G(
+ hpPriv->tPow2x5g,
+ hpPriv->tPow2x5gHt20,
+ hpPriv->tPow2x5gHt40);
+ }/* end of bandedges of 5G */
+
+}
+
+void zfDumpEepBandEdges(struct ar5416Eeprom* eepromImage)
+{
+ #ifdef ZM_ENABLE_BANDEDGES_WINDOWS_DEBUG
+ u8_t i, j, k;
+
+#if 0
+ zm_dbg(("\n === BandEdges index dump ==== \n"));
+
+ for (i = 0; i < AR5416_NUM_CTLS; i++)
+ {
+ zm_dbg(("%02x ", eepromImage->ctlIndex[i]));
+ }
+
+ zm_dbg(("\n === BandEdges data dump ==== \n"));
+
+ for (i = 0; i < AR5416_NUM_CTLS; i++)
+ {
+ for (j = 0; j < 2; j++)
+ {
+ for(k = 0; k < AR5416_NUM_BAND_EDGES; k++)
+ {
+ u8_t *pdata = (u8_t*)&(eepromImage->ctlData[i].ctlEdges[j][k]);
+ zm_dbg(("(%02x %02x)", pdata[0], pdata[1]));
+ }
+ zm_dbg(("\n"));
+ }
+ }
+#else
+ zm_dbg(("\n === BandEdges index dump ==== \n"));
+ for (i = 0; i < 24; i+=8)
+ {
+ zm_dbg(("%02x %02x %02x %02x %02x %02x %02x %02x",
+ eepromImage->ctlIndex[i+0], eepromImage->ctlIndex[i+1], eepromImage->ctlIndex[i+2], eepromImage->ctlIndex[i+3],
+ eepromImage->ctlIndex[i+4], eepromImage->ctlIndex[i+5], eepromImage->ctlIndex[i+6], eepromImage->ctlIndex[i+7]
+ ));
+ }
+
+ zm_dbg(("\n === BandEdges data dump ==== \n"));
+
+ for (i = 0; i < AR5416_NUM_CTLS; i++)
+ {
+ for (j = 0; j < 2; j++)
+ {
+ u8_t *pdata = (u8_t*)&(eepromImage->ctlData[i].ctlEdges[j]);
+ zm_dbg(("(%03d %02x) (%03d %02x) (%03d %02x) (%03d %02x) \n",
+ pdata[0], pdata[1], pdata[2], pdata[3],
+ pdata[4], pdata[5], pdata[6], pdata[7]
+ ));
+ zm_dbg(("(%03d %02x) (%03d %02x) (%03d %02x) (%03d %02x) \n",
+ pdata[8], pdata[9], pdata[10], pdata[11],
+ pdata[12], pdata[13], pdata[14], pdata[15]
+ ));
+ }
+ }
+#endif
+ #endif
+}
+
+void zfPrintTargetPower2G(u8_t* tPow2xCck, u8_t* tPow2x2g, u8_t* tPow2x2gHt20, u8_t* tPow2x2gHt40)
+{
+ //#ifdef ZM_ENABLE_TPC_WINDOWS_DEBUG
+ #ifdef ZM_ENABLE_BANDEDGES_WINDOWS_DEBUG
+ DbgPrint("targetPwr CCK : %d, %d, %d, %d\n",
+ tPow2xCck[0],
+ tPow2xCck[1],
+ tPow2xCck[2],
+ tPow2xCck[3]
+ );
+ DbgPrint("targetPwr 2G : %d, %d, %d, %d\n",
+ tPow2x2g[0],
+ tPow2x2g[1],
+ tPow2x2g[2],
+ tPow2x2g[3]
+ );
+ DbgPrint("targetPwr 2GHT20 : %d, %d, %d, %d, %d, %d, %d, %d\n",
+ tPow2x2gHt20[0],
+ tPow2x2gHt20[1],
+ tPow2x2gHt20[2],
+ tPow2x2gHt20[3],
+ tPow2x2gHt20[4],
+ tPow2x2gHt20[5],
+ tPow2x2gHt20[6],
+ tPow2x2gHt20[7]
+ );
+ DbgPrint("targetPwr 2GHT40 : %d, %d, %d, %d, %d, %d, %d, %d\n",
+ tPow2x2gHt40[0],
+ tPow2x2gHt40[1],
+ tPow2x2gHt40[2],
+ tPow2x2gHt40[3],
+ tPow2x2gHt40[4],
+ tPow2x2gHt40[5],
+ tPow2x2gHt40[6],
+ tPow2x2gHt40[7]
+ );
+ #endif
+ return;
+}
+
+void zfPrintTargetPower5G(u8_t* tPow2x5g, u8_t* tPow2x5gHt20, u8_t* tPow2x5gHt40)
+{
+ //#ifdef ZM_ENABLE_TPC_WINDOWS_DEBUG
+ #ifdef ZM_ENABLE_BANDEDGES_WINDOWS_DEBUG
+ DbgPrint("targetPwr 5G : %d, %d, %d, %d\n",
+ tPow2x5g[0],
+ tPow2x5g[1],
+ tPow2x5g[2],
+ tPow2x5g[3]
+ );
+ DbgPrint("targetPwr 5GHT20 : %d, %d, %d, %d, %d, %d, %d, %d\n",
+ tPow2x5gHt20[0],
+ tPow2x5gHt20[1],
+ tPow2x5gHt20[2],
+ tPow2x5gHt20[3],
+ tPow2x5gHt20[4],
+ tPow2x5gHt20[5],
+ tPow2x5gHt20[6],
+ tPow2x5gHt20[7]
+ );
+ DbgPrint("targetPwr 5GHT40 : %d, %d, %d, %d, %d, %d, %d, %d\n",
+ tPow2x5gHt40[0],
+ tPow2x5gHt40[1],
+ tPow2x5gHt40[2],
+ tPow2x5gHt40[3],
+ tPow2x5gHt40[4],
+ tPow2x5gHt40[5],
+ tPow2x5gHt40[6],
+ tPow2x5gHt40[7]
+ );
+ #endif
+ return;
+}
+
+void zfHpPowerSaveSetMode(zdev_t* dev, u8_t staMode, u8_t psMode, u16_t bcnInterval)
+{
+ if ( staMode == 0 )
+ {
+ if ( psMode == 0 )
+ {
+ // Turn off pre-TBTT interrupt
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_PRETBTT, 0);
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_BCN_PERIOD, 0);
+ zfFlushDelayWrite(dev);
+ }
+ else
+ {
+ // Turn on pre-TBTT interrupt
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_PRETBTT, (bcnInterval-6)<<16);
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_BCN_PERIOD, bcnInterval);
+ zfFlushDelayWrite(dev);
+ }
+ }
+}
+
+void zfHpPowerSaveSetState(zdev_t* dev, u8_t psState)
+{
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv = wd->hpPrivate;
+
+ //DbgPrint("INTO zfHpPowerSaveSetState");
+
+ if ( psState == 0 ) //power up
+ {
+ //DbgPrint("zfHpPowerSaveSetState Wake up from PS\n");
+ reg_write(0x982C, 0x0000a000); //wake up ADDAC
+ reg_write(0x9808, 0x0); //enable all agc gain and offset updates to a2
+ //# bank 3
+ if (((struct zsHpPriv*)wd->hpPrivate)->hwFrequency <= ZM_CH_G_14)
+ {
+ /* 11g */
+ //reg_write (0x98f0, 0x01c00018);
+ reg_write (0x98f0, 0x01c20098);//syn_on+RX_ON
+ }
+ else
+ {
+ /* 11a */
+ //reg_write (0x98f0, 0x01400018);
+ reg_write (0x98f0, 0x01420098);//syn_on+RX_ON
+ }
+
+ ////#bank 5
+ //reg_write(0x98b0, 0x00000013);
+ //reg_write(0x98e4, 0x00000002);
+
+
+ zfFlushDelayWrite(dev);
+ }
+ else //power down
+ {
+ //DbgPrint("zfHpPowerSaveSetState Go to PS\n");
+ //reg_write(0x982C, 0xa000a000);
+ reg_write(0x9808, 0x8000000); //disable all agc gain and offset updates to a2
+ reg_write(0x982C, 0xa000a000); //power down ADDAC
+ //# bank 3
+ if (((struct zsHpPriv*)wd->hpPrivate)->hwFrequency <= ZM_CH_G_14)
+ {
+ /* 11g */
+ reg_write (0x98f0, 0x00c00018);//syn_off+RX_off
+ }
+ else
+ {
+ /* 11a */
+ reg_write (0x98f0, 0x00400018);//syn_off+RX_off
+ }
+
+ ////#bank 5
+ //reg_write(0x98b0, 0x000e0013);
+ //reg_write(0x98e4, 0x00018002);
+
+
+ zfFlushDelayWrite(dev);
+ }
+}
+
+void zfHpSetAggPktNum(zdev_t* dev, u32_t num)
+{
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv = wd->hpPrivate;
+
+ num = (num << 16) | (0xa);
+
+ hpPriv->aggPktNum = num;
+
+ //aggregation number will be update in HAL heart beat
+ //zfDelayWriteInternalReg(dev, 0x1c3b9c, num);
+ //zfFlushDelayWrite(dev);
+}
+
+void zfHpSetMPDUDensity(zdev_t* dev, u8_t density)
+{
+ u32_t value;
+
+ if (density > ZM_MPDU_DENSITY_8US)
+ {
+ return;
+ }
+
+ /* Default value in this register */
+ value = 0x140A00 | density;
+
+ zfDelayWriteInternalReg(dev, 0x1c3ba0, value);
+ zfFlushDelayWrite(dev);
+ return;
+}
+
+void zfHpSetSlotTime(zdev_t* dev, u8_t type)
+{
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv = wd->hpPrivate;
+
+ if (type == 0)
+ {
+ //normal slot = 20us
+ hpPriv->slotType = 0;
+ }
+ else //if (type == 1)
+ {
+ //short slot = 9us
+ hpPriv->slotType = 1;
+ }
+
+ return;
+}
+
+void zfHpSetSlotTimeRegister(zdev_t* dev, u8_t type)
+{
+ if(type == 0)
+ {
+ //normal slot = 20us
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_SLOT_TIME, 20<<10);
+ }
+ else
+ {
+ //short slot = 9us
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_SLOT_TIME, 9<<10);
+ }
+}
+
+void zfHpSetRifs(zdev_t* dev, u8_t ht_enable, u8_t ht2040, u8_t g_mode)
+{
+ zfDelayWriteInternalReg(dev, 0x1c6388, 0x0c000000);
+
+ zfDelayWriteInternalReg(dev, 0x1c59ec, 0x0cc80caa);
+
+ if (ht_enable)
+ {
+ if (ht2040)
+ {
+ zfDelayWriteInternalReg(dev, 0x1c5918, 40);
+ }
+ else
+ {
+ zfDelayWriteInternalReg(dev, 0x1c5918, 20);
+ }
+ }
+
+ if (g_mode)
+ {
+ zfDelayWriteInternalReg(dev, 0x1c5850, 0xec08b4e2);
+ zfDelayWriteInternalReg(dev, 0x1c585c, 0x313a5d5e);
+ }
+ else
+ {
+ zfDelayWriteInternalReg(dev, 0x1c5850, 0xede8b4e0);
+ zfDelayWriteInternalReg(dev, 0x1c585c, 0x3139605e);
+ }
+
+ zfFlushDelayWrite(dev);
+ return;
+}
+
+void zfHpBeginSiteSurvey(zdev_t* dev, u8_t status)
+{
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+
+ if ( status == 1 )
+ { // Connected
+ hpPriv->isSiteSurvey = 1;
+ }
+ else
+ { // Not connected
+ hpPriv->isSiteSurvey = 0;
+ }
+
+ /* reset workaround state to default */
+// if (hpPriv->rxStrongRSSI == 1)
+ {
+ hpPriv->rxStrongRSSI = 0;
+ if ((hpPriv->eepromImage[0x100+0x110*2/4]&0xff) == 0x80) //FEM TYPE
+ {
+ if (hpPriv->hwFrequency <= ZM_CH_G_14)
+ {
+ zfDelayWriteInternalReg(dev, 0x1c8960, 0x9b49);
+ }
+ else
+ {
+ zfDelayWriteInternalReg(dev, 0x1c8960, 0x0900);
+ }
+ }
+ else
+ {
+ zfDelayWriteInternalReg(dev, 0x1c8960, 0x9b40);
+ }
+ zfFlushDelayWrite(dev);
+ }
+// if (hpPriv->strongRSSI == 1)
+ {
+ hpPriv->strongRSSI = 0;
+ zfDelayWriteInternalReg(dev, 0x1c3694, ((hpPriv->currentAckRtsTpc&0x3f) << 20) | (0x5<<26));
+ zfDelayWriteInternalReg(dev, 0x1c3bb4, ((hpPriv->currentAckRtsTpc&0x3f) << 5 ) | (0x5<<11) |
+ ((hpPriv->currentAckRtsTpc&0x3f) << 21) | (0x5<<27) );
+ zfFlushDelayWrite(dev);
+ }
+}
+
+void zfHpFinishSiteSurvey(zdev_t* dev, u8_t status)
+{
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ if ( status == 1 )
+ {
+ hpPriv->isSiteSurvey = 2;
+ }
+ else
+ {
+ hpPriv->isSiteSurvey = 0;
+ }
+ zmw_leave_critical_section(dev);
+}
+
+u16_t zfFwRetry(zdev_t* dev, u8_t enable)
+{
+ u32_t cmd[(ZM_MAX_CMD_SIZE/4)];
+ u16_t ret = 0;
+
+ cmd[0] = 4 | (0x92 << 8);
+ cmd[1] = (enable == 1) ? 0x01 : 0x00;
+
+ ret = zfIssueCmd(dev, cmd, 8, ZM_OID_INTERNAL_WRITE, NULL);
+ return ret;
+}
+
+u16_t zfHpEnableHwRetry(zdev_t* dev)
+{
+ u16_t ret;
+
+ ret = zfFwRetry(dev, 0);
+
+ zfDelayWriteInternalReg(dev, 0x1c3b28, 0x33333);
+ zfFlushDelayWrite(dev);
+
+ return ret;
+}
+
+u16_t zfHpDisableHwRetry(zdev_t* dev)
+{
+ u16_t ret;
+
+ ret = zfFwRetry(dev, 1);
+
+ zfDelayWriteInternalReg(dev, 0x1c3b28, 0x00000);
+ zfFlushDelayWrite(dev);
+
+ return ret;
+}
+
+/* Download SPI Fw */
+#define ZM_FIRMWARE_WLAN 0
+#define ZM_FIRMWARE_SPI_FLASH 1
+
+
+u16_t zfHpFirmwareDownload(zdev_t* dev, u8_t fwType)
+{
+ u16_t ret = ZM_SUCCESS;
+
+ if (fwType == ZM_FIRMWARE_WLAN)
+ {
+ ret = zfFirmwareDownload(dev, (u32_t*)zcFwImage,
+ (u32_t)zcFwImageSize, ZM_FIRMWARE_WLAN_ADDR);
+ }
+ else if (fwType == ZM_FIRMWARE_SPI_FLASH)
+ {
+ ret = zfFirmwareDownload(dev, (u32_t*)zcFwImageSPI,
+ (u32_t)zcFwImageSPISize, ZM_FIRMWARE_SPI_ADDR);
+ }
+ else
+ {
+ zm_debug_msg1("Unknown firmware type = ", fwType);
+ ret = ZM_ERR_FIRMWARE_WRONG_TYPE;
+ }
+
+ return ret;
+}
+
+/* Enable software decryption */
+void zfHpSWDecrypt(zdev_t* dev, u8_t enable)
+{
+ u32_t value = 0x70;
+
+ /* Bit 4 for enable software decryption */
+ if (enable == 1)
+ {
+ value = 0x78;
+ }
+
+ zfDelayWriteInternalReg(dev, 0x1c3678, value);
+ zfFlushDelayWrite(dev);
+}
+
+/* Enable software encryption */
+void zfHpSWEncrypt(zdev_t* dev, u8_t enable)
+{
+ /* Because encryption by software or hardware is judged by driver in Otus,
+ we don't need to do anything in the HAL layer.
+ */
+}
+
+u32_t zfHpCapability(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+
+ return hpPriv->halCapability;
+}
+
+void zfHpSetRollCallTable(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+
+ if (hpPriv->camRollCallTable != (u64_t) 0)
+ {
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_ROLL_CALL_TBL_L, (u32_t)(hpPriv->camRollCallTable & 0xffffffff));
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_ROLL_CALL_TBL_H, (u32_t)((hpPriv->camRollCallTable >> 32) & 0xffffffff));
+ zfFlushDelayWrite(dev);
+ }
+}
+
+void zfHpSetTTSIFSTime(zdev_t* dev, u8_t sifs_time)
+{
+ u32_t reg_value = 0;
+ zmw_get_wlan_dev(dev);
+
+ sifs_time &= 0x3f;
+ reg_value = 0x14400b | (((u32_t)sifs_time)<<24);
+
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_EIFS_AND_SIFS, reg_value);
+ zfFlushDelayWrite(dev);
+}
+
+/* #3 Enable RIFS function if the RIFS pattern matched ! */
+void zfHpEnableRifs(zdev_t* dev, u8_t mode24g, u8_t modeHt, u8_t modeHt2040)
+{
+
+ /* # Enable Reset TDOMAIN
+ * $rddata = &$phyreg_read(0x9800+(738<<2));
+ * $wrdata = $rddata | (0x1 << 26) | (0x1 << 27);
+ * &$phyreg_write(0x9800+(738<<2), $wrdata);
+ */
+ reg_write (0x9800+(738<<2), 0x08000000 | (0x1 << 26) | (0x1 << 27));
+ //reg_write (0x9800+(738<<2), 0x08000000 | (0x1 << 26));
+
+ /* # reg 123: heavy clip factor, xr / RIFS search parameters */
+ reg_write (0x99ec, 0x0cc80caa);
+
+ /* # Reduce Search Start Delay for RIFS */
+ if (modeHt == 1) /* ($HT_ENABLE == 1) */
+ {
+ if (modeHt2040 == 0x1) /* ($DYNAMIC_HT2040_EN == 0x1) */
+ {
+ reg_write(0x9800+(70<<2), 40);/*40*/
+ }
+ else
+ {
+ reg_write(0x9800+(70<<2), 20);
+ if(mode24g == 0x0)
+ {
+ /* $rddata = &$phyreg_read(0x9800+(24<<2));#0x9860;0x1c5860
+ *$wrdata = ($rddata & 0xffffffc7) | (0x4 << 3);
+ * &$phyreg_write(0x9800+(24<<2), $wrdata);
+ */
+ reg_write(0x9800+(24<<2), (0x0004dd10 & 0xffffffc7) | (0x4 << 3));
+ }
+ }
+ }
+
+ if (mode24g == 0x1)
+ {
+ reg_write(0x9850, 0xece8b4e4);/*org*/
+ //reg_write(0x9850, 0xece8b4e2);
+ reg_write(0x985c, 0x313a5d5e);
+ }
+ else
+ {
+ reg_write(0x9850, 0xede8b4e4);
+ reg_write(0x985c, 0x3139605e);
+ }
+
+ zfFlushDelayWrite(dev);
+
+ return;
+}
+
+/* #4 Disable RIFS function if the RIFS timer is timeout ! */
+void zfHpDisableRifs(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ /* Disable RIFS function is to store these HW register initial value while the device plug-in and
+ re-write to these register if the RIFS function is disabled */
+
+ // reg : 9850
+ reg_write(0x9850, ((struct zsHpPriv*)wd->hpPrivate)->initDesiredSigSize);
+
+ // reg : 985c
+ reg_write(0x985c, ((struct zsHpPriv*)wd->hpPrivate)->initAGC);
+
+ // reg : 9860
+ reg_write(0x9800+(24<<2), ((struct zsHpPriv*)wd->hpPrivate)->initAgcControl);
+
+ // reg : 9918
+ reg_write(0x9800+(70<<2), ((struct zsHpPriv*)wd->hpPrivate)->initSearchStartDelay);
+
+ // reg : 991c
+ reg_write (0x99ec, ((struct zsHpPriv*)wd->hpPrivate)->initRIFSSearchParams);
+
+ // reg : a388
+ reg_write (0x9800+(738<<2), ((struct zsHpPriv*)wd->hpPrivate)->initFastChannelChangeControl);
+
+ zfFlushDelayWrite(dev);
+
+ return;
+}
diff --git a/drivers/staging/otus/hal/hpreg.c b/drivers/staging/otus/hal/hpreg.c
new file mode 100644
index 00000000000..3cfeba8620f
--- /dev/null
+++ b/drivers/staging/otus/hal/hpreg.c
@@ -0,0 +1,2481 @@
+/*
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : hpreg.c */
+/* */
+/* Abstract */
+/* This module contains Regulatory Table and related function. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/************************************************************************/
+#include "../80211core/cprecomp.h"
+#include "hpani.h"
+#include "hpreg.h"
+#include "hpusb.h"
+
+/* used throughout this file... */
+#define N(a) (sizeof (a) / sizeof (a[0]))
+
+#define HAL_MODE_11A_TURBO HAL_MODE_108A
+#define HAL_MODE_11G_TURBO HAL_MODE_108G
+
+#if 0
+enum {
+ /* test groups */
+ FCC = 0x10,
+ MKK = 0x40,
+ ETSI = 0x30,
+ SD_NO_CTL = 0xe0,
+ NO_CTL = 0xff,
+ /* test modes */
+ CTL_MODE_M = 0x0f,
+ CTL_11A = 0,
+ CTL_11B = 1,
+ CTL_11G = 2,
+ CTL_TURBO = 3,
+ CTL_108G = 4,
+ CTL_2GHT20 = 5,
+ CTL_5GHT20 = 6,
+ CTL_2GHT40 = 7,
+ CTL_5GHT40 = 8
+};
+#endif
+
+/*
+ * The following are flags for different requirements per reg domain.
+ * These requirements are either inhereted from the reg domain pair or
+ * from the unitary reg domain if the reg domain pair flags value is
+ * 0
+ */
+
+enum {
+ NO_REQ = 0x00000000,
+ DISALLOW_ADHOC_11A = 0x00000001,
+ DISALLOW_ADHOC_11A_TURB = 0x00000002,
+ NEED_NFC = 0x00000004,
+
+ ADHOC_PER_11D = 0x00000008, /* Start Ad-Hoc mode */
+ ADHOC_NO_11A = 0x00000010,
+
+ PUBLIC_SAFETY_DOMAIN = 0x00000020, /* public safety domain */
+ LIMIT_FRAME_4MS = 0x00000040, /* 4msec limit on the frame length */
+};
+
+#define MKK5GHZ_FLAG1 (DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS)
+#define MKK5GHZ_FLAG2 (DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB | NEED_NFC| LIMIT_FRAME_4MS)
+
+typedef enum {
+ DFS_UNINIT_DOMAIN = 0, /* Uninitialized dfs domain */
+ DFS_FCC_DOMAIN = 1, /* FCC3 dfs domain */
+ DFS_ETSI_DOMAIN = 2, /* ETSI dfs domain */
+} HAL_DFS_DOMAIN;
+
+/*
+ * Used to set the RegDomain bitmask which chooses which frequency
+ * band specs are used.
+ */
+
+#define BMLEN 2 /* Use 2 64 bit uint for channel bitmask
+ NB: Must agree with macro below (BM) */
+#define BMZERO {(u64_t) 0, (u64_t) 0} /* BMLEN zeros */
+
+#if 0
+
+#define BM(_fa, _fb, _fc, _fd, _fe, _ff, _fg, _fh, _fi, _fj, _fk, _fl) \
+ {((((_fa >= 0) && (_fa < 64)) ? (((u64_t) 1) << _fa) : (u64_t) 0) | \
+ (((_fb >= 0) && (_fb < 64)) ? (((u64_t) 1) << _fb) : (u64_t) 0) | \
+ (((_fc >= 0) && (_fc < 64)) ? (((u64_t) 1) << _fc) : (u64_t) 0) | \
+ (((_fd >= 0) && (_fd < 64)) ? (((u64_t) 1) << _fd) : (u64_t) 0) | \
+ (((_fe >= 0) && (_fe < 64)) ? (((u64_t) 1) << _fe) : (u64_t) 0) | \
+ (((_ff >= 0) && (_ff < 64)) ? (((u64_t) 1) << _ff) : (u64_t) 0) | \
+ (((_fg >= 0) && (_fg < 64)) ? (((u64_t) 1) << _fg) : (u64_t) 0) | \
+ (((_fh >= 0) && (_fh < 64)) ? (((u64_t) 1) << _fh) : (u64_t) 0) | \
+ (((_fi >= 0) && (_fi < 64)) ? (((u64_t) 1) << _fi) : (u64_t) 0) | \
+ (((_fj >= 0) && (_fj < 64)) ? (((u64_t) 1) << _fj) : (u64_t) 0) | \
+ (((_fk >= 0) && (_fk < 64)) ? (((u64_t) 1) << _fk) : (u64_t) 0) | \
+ (((_fl >= 0) && (_fl < 64)) ? (((u64_t) 1) << _fl) : (u64_t) 0) | \
+ ((((_fa > 63) && (_fa < 128)) ? (((u64_t) 1) << (_fa - 64)) : (u64_t) 0) | \
+ (((_fb > 63) && (_fb < 128)) ? (((u64_t) 1) << (_fb - 64)) : (u64_t) 0) | \
+ (((_fc > 63) && (_fc < 128)) ? (((u64_t) 1) << (_fc - 64)) : (u64_t) 0) | \
+ (((_fd > 63) && (_fd < 128)) ? (((u64_t) 1) << (_fd - 64)) : (u64_t) 0) | \
+ (((_fe > 63) && (_fe < 128)) ? (((u64_t) 1) << (_fe - 64)) : (u64_t) 0) | \
+ (((_ff > 63) && (_ff < 128)) ? (((u64_t) 1) << (_ff - 64)) : (u64_t) 0) | \
+ (((_fg > 63) && (_fg < 128)) ? (((u64_t) 1) << (_fg - 64)) : (u64_t) 0) | \
+ (((_fh > 63) && (_fh < 128)) ? (((u64_t) 1) << (_fh - 64)) : (u64_t) 0) | \
+ (((_fi > 63) && (_fi < 128)) ? (((u64_t) 1) << (_fi - 64)) : (u64_t) 0) | \
+ (((_fj > 63) && (_fj < 128)) ? (((u64_t) 1) << (_fj - 64)) : (u64_t) 0) | \
+ (((_fk > 63) && (_fk < 128)) ? (((u64_t) 1) << (_fk - 64)) : (u64_t) 0) | \
+ (((_fl > 63) && (_fl < 128)) ? (((u64_t) 1) << (_fl - 64)) : (u64_t) 0)))}
+
+#else
+
+#define BM(_fa, _fb, _fc, _fd, _fe, _ff, _fg, _fh, _fi, _fj, _fk, _fl) \
+ {((((_fa >= 0) && (_fa < 64)) ? (((u64_t) 1) << (_fa&0x3f)) : (u64_t) 0) | \
+ (((_fb >= 0) && (_fb < 64)) ? (((u64_t) 1) << (_fb&0x3f)) : (u64_t) 0) | \
+ (((_fc >= 0) && (_fc < 64)) ? (((u64_t) 1) << (_fc&0x3f)) : (u64_t) 0) | \
+ (((_fd >= 0) && (_fd < 64)) ? (((u64_t) 1) << (_fd&0x3f)) : (u64_t) 0) | \
+ (((_fe >= 0) && (_fe < 64)) ? (((u64_t) 1) << (_fe&0x3f)) : (u64_t) 0) | \
+ (((_ff >= 0) && (_ff < 64)) ? (((u64_t) 1) << (_ff&0x3f)) : (u64_t) 0) | \
+ (((_fg >= 0) && (_fg < 64)) ? (((u64_t) 1) << (_fg&0x3f)) : (u64_t) 0) | \
+ (((_fh >= 0) && (_fh < 64)) ? (((u64_t) 1) << (_fh&0x3f)) : (u64_t) 0) | \
+ (((_fi >= 0) && (_fi < 64)) ? (((u64_t) 1) << (_fi&0x3f)) : (u64_t) 0) | \
+ (((_fj >= 0) && (_fj < 64)) ? (((u64_t) 1) << (_fj&0x3f)) : (u64_t) 0) | \
+ (((_fk >= 0) && (_fk < 64)) ? (((u64_t) 1) << (_fk&0x3f)) : (u64_t) 0) | \
+ (((_fl >= 0) && (_fl < 64)) ? (((u64_t) 1) << (_fl&0x3f)) : (u64_t) 0) | \
+ ((((_fa > 63) && (_fa < 128)) ? (((u64_t) 1) << ((_fa - 64)&0x3f)) : (u64_t) 0) | \
+ (((_fb > 63) && (_fb < 128)) ? (((u64_t) 1) << ((_fb - 64)&0x3f)) : (u64_t) 0) | \
+ (((_fc > 63) && (_fc < 128)) ? (((u64_t) 1) << ((_fc - 64)&0x3f)) : (u64_t) 0) | \
+ (((_fd > 63) && (_fd < 128)) ? (((u64_t) 1) << ((_fd - 64)&0x3f)) : (u64_t) 0) | \
+ (((_fe > 63) && (_fe < 128)) ? (((u64_t) 1) << ((_fe - 64)&0x3f)) : (u64_t) 0) | \
+ (((_ff > 63) && (_ff < 128)) ? (((u64_t) 1) << ((_ff - 64)&0x3f)) : (u64_t) 0) | \
+ (((_fg > 63) && (_fg < 128)) ? (((u64_t) 1) << ((_fg - 64)&0x3f)) : (u64_t) 0) | \
+ (((_fh > 63) && (_fh < 128)) ? (((u64_t) 1) << ((_fh - 64)&0x3f)) : (u64_t) 0) | \
+ (((_fi > 63) && (_fi < 128)) ? (((u64_t) 1) << ((_fi - 64)&0x3f)) : (u64_t) 0) | \
+ (((_fj > 63) && (_fj < 128)) ? (((u64_t) 1) << ((_fj - 64)&0x3f)) : (u64_t) 0) | \
+ (((_fk > 63) && (_fk < 128)) ? (((u64_t) 1) << ((_fk - 64)&0x3f)) : (u64_t) 0) | \
+ (((_fl > 63) && (_fl < 128)) ? (((u64_t) 1) << ((_fl - 64)&0x3f)) : (u64_t) 0)))}
+
+#endif
+
+/* Mask to check whether a domain is a multidomain or a single
+ domain */
+
+#define MULTI_DOMAIN_MASK 0xFF00
+
+
+/*
+ * The following describe the bit masks for different passive scan
+ * capability/requirements per regdomain.
+ */
+#define NO_PSCAN 0x0ULL
+#define PSCAN_FCC 0x0000000000000001ULL
+#define PSCAN_FCC_T 0x0000000000000002ULL
+#define PSCAN_ETSI 0x0000000000000004ULL
+#define PSCAN_MKK1 0x0000000000000008ULL
+#define PSCAN_MKK2 0x0000000000000010ULL
+#define PSCAN_MKKA 0x0000000000000020ULL
+#define PSCAN_MKKA_G 0x0000000000000040ULL
+#define PSCAN_ETSIA 0x0000000000000080ULL
+#define PSCAN_ETSIB 0x0000000000000100ULL
+#define PSCAN_ETSIC 0x0000000000000200ULL
+#define PSCAN_WWR 0x0000000000000400ULL
+#define PSCAN_MKKA1 0x0000000000000800ULL
+#define PSCAN_MKKA1_G 0x0000000000001000ULL
+#define PSCAN_MKKA2 0x0000000000002000ULL
+#define PSCAN_MKKA2_G 0x0000000000004000ULL
+#define PSCAN_MKK3 0x0000000000008000ULL
+#define PSCAN_DEFER 0x7FFFFFFFFFFFFFFFULL
+#define IS_ECM_CHAN 0x8000000000000000ULL
+
+/*
+ * THE following table is the mapping of regdomain pairs specified by
+ * an 8 bit regdomain value to the individual unitary reg domains
+ */
+
+typedef struct reg_dmn_pair_mapping {
+ u16_t regDmnEnum; /* 16 bit reg domain pair */
+ u16_t regDmn5GHz; /* 5GHz reg domain */
+ u16_t regDmn2GHz; /* 2GHz reg domain */
+ u32_t flags5GHz; /* Requirements flags (AdHoc
+ disallow, noise floor cal needed,
+ etc) */
+ u32_t flags2GHz; /* Requirements flags (AdHoc
+ disallow, noise floor cal needed,
+ etc) */
+ u64_t pscanMask; /* Passive Scan flags which
+ can override unitary domain
+ passive scan flags. This
+ value is used as a mask on
+ the unitary flags*/
+ u16_t singleCC; /* Country code of single country if
+ a one-on-one mapping exists */
+} REG_DMN_PAIR_MAPPING;
+
+static REG_DMN_PAIR_MAPPING regDomainPairs[] = {
+ {NO_ENUMRD, FCC2, DEBUG_REG_DMN, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {NULL1_WORLD, NULL1, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {NULL1_ETSIB, NULL1, ETSIB, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {NULL1_ETSIC, NULL1, ETSIC, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+
+ {FCC2_FCCA, FCC2, FCCA, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {FCC2_WORLD, FCC2, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {FCC2_ETSIC, FCC2, ETSIC, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {FCC3_FCCA, FCC3, FCCA, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {FCC3_WORLD, FCC3, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {FCC4_FCCA, FCC4, FCCA, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER, 0 },
+ {FCC5_FCCA, FCC5, FCCA, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER, 0 },
+ {FCC6_FCCA, FCC6, FCCA, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {FCC6_WORLD, FCC6, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+
+ {ETSI1_WORLD, ETSI1, WORLD, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER, 0 },
+ {ETSI2_WORLD, ETSI2, WORLD, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER, 0 },
+ {ETSI3_WORLD, ETSI3, WORLD, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER, 0 },
+ {ETSI4_WORLD, ETSI4, WORLD, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER, 0 },
+ {ETSI5_WORLD, ETSI5, WORLD, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER, 0 },
+ {ETSI6_WORLD, ETSI6, WORLD, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER, 0 },
+
+ {ETSI3_ETSIA, ETSI3, WORLD, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER, 0 },
+ {FRANCE_RES, ETSI3, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+
+ {FCC1_WORLD, FCC1, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {FCC1_FCCA, FCC1, FCCA, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {APL1_WORLD, APL1, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {APL2_WORLD, APL2, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {APL3_WORLD, APL3, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {APL4_WORLD, APL4, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {APL5_WORLD, APL5, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {APL6_WORLD, APL6, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {APL8_WORLD, APL8, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {APL9_WORLD, APL9, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+
+ {APL3_FCCA, APL3, FCCA, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {APL1_ETSIC, APL1, ETSIC, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {APL2_ETSIC, APL2, ETSIC, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {APL2_FCCA, APL2, FCCA, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {APL2_APLD, APL2, APLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
+ {APL7_FCCA, APL7, FCCA, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+
+ {MKK1_MKKA, MKK1, MKKA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKK1 | PSCAN_MKKA, CTRY_JAPAN },
+ {MKK1_MKKB, MKK1, MKKA, MKK5GHZ_FLAG2, NEED_NFC, PSCAN_MKK1 | PSCAN_MKKA | PSCAN_MKKA_G, CTRY_JAPAN1 },
+ {MKK1_FCCA, MKK1, FCCA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKK1, CTRY_JAPAN2 },
+ {MKK1_MKKA1, MKK1, MKKA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKK1 | PSCAN_MKKA1 | PSCAN_MKKA1_G, CTRY_JAPAN4 },
+ {MKK1_MKKA2, MKK1, MKKA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKK1 | PSCAN_MKKA2 | PSCAN_MKKA2_G, CTRY_JAPAN5 },
+ {MKK1_MKKC, MKK1, MKKC, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKK1, CTRY_JAPAN6 },
+
+ /* MKK2 */
+ {MKK2_MKKA, MKK2, MKKA, MKK5GHZ_FLAG2, NEED_NFC, PSCAN_MKK2 | PSCAN_MKKA | PSCAN_MKKA_G, CTRY_JAPAN3 },
+
+ /* MKK3 */
+ {MKK3_MKKA, MKK3, MKKA, MKK5GHZ_FLAG1, NEED_NFC, NO_PSCAN, CTRY_JAPAN25 },
+ {MKK3_MKKB, MKK3, MKKA, MKK5GHZ_FLAG2, NEED_NFC, PSCAN_MKKA | PSCAN_MKKA_G, CTRY_JAPAN7 },
+ {MKK3_MKKA1, MKK3, MKKA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKKA1 | PSCAN_MKKA1_G, CTRY_JAPAN26 },
+ {MKK3_MKKA2, MKK3, MKKA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKKA2 | PSCAN_MKKA2_G, CTRY_JAPAN8 },
+ {MKK3_MKKC, MKK3, MKKC, MKK5GHZ_FLAG1, NEED_NFC, NO_PSCAN, CTRY_JAPAN9 },
+ {MKK3_FCCA, MKK3, FCCA, MKK5GHZ_FLAG1, NEED_NFC, NO_PSCAN, CTRY_JAPAN27 },
+
+ /* MKK4 */
+ {MKK4_MKKB, MKK4, MKKA, MKK5GHZ_FLAG2, NEED_NFC, PSCAN_MKK3 | PSCAN_MKKA | PSCAN_MKKA_G, CTRY_JAPAN10 },
+ {MKK4_MKKA1, MKK4, MKKA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKK3 | PSCAN_MKKA1 | PSCAN_MKKA1_G, CTRY_JAPAN28 },
+ {MKK4_MKKA2, MKK4, MKKA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKK3 |PSCAN_MKKA2 | PSCAN_MKKA2_G, CTRY_JAPAN11 },
+ {MKK4_MKKC, MKK4, MKKC, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKK3, CTRY_JAPAN12 },
+ {MKK4_FCCA, MKK4, FCCA, MKK5GHZ_FLAG1, NEED_NFC, NO_PSCAN, CTRY_JAPAN29 },
+ {MKK4_MKKA, MKK4, MKKA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKK3 | PSCAN_MKKA, CTRY_JAPAN36 },
+
+ /* MKK5 */
+ {MKK5_MKKB, MKK5, MKKA, MKK5GHZ_FLAG2, NEED_NFC, PSCAN_MKK3 | PSCAN_MKKA | PSCAN_MKKA_G, CTRY_JAPAN13 },
+ {MKK5_MKKA2, MKK5, MKKA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKK3 | PSCAN_MKKA2 | PSCAN_MKKA2_G, CTRY_JAPAN14 },
+ {MKK5_MKKC, MKK5, MKKC, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKK3, CTRY_JAPAN15 },
+
+ /* MKK6 */
+ {MKK6_MKKB, MKK6, MKKA, MKK5GHZ_FLAG2, NEED_NFC, PSCAN_MKK1 | PSCAN_MKKA | PSCAN_MKKA_G, CTRY_JAPAN16 },
+ {MKK6_MKKA2, MKK6, MKKA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKK1 | PSCAN_MKKA2 | PSCAN_MKKA2_G, CTRY_JAPAN17 },
+ {MKK6_MKKC, MKK6, MKKC, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKK1, CTRY_JAPAN18 },
+ {MKK6_MKKA1, MKK6, MKKA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKKA1 | PSCAN_MKKA1_G, CTRY_JAPAN30 },
+ {MKK6_FCCA, MKK6, FCCA, MKK5GHZ_FLAG1, NEED_NFC, NO_PSCAN, CTRY_JAPAN31 },
+
+ /* MKK7 */
+ {MKK7_MKKB, MKK7, MKKA, MKK5GHZ_FLAG2, NEED_NFC, PSCAN_MKK1 | PSCAN_MKK3 | PSCAN_MKKA | PSCAN_MKKA_G, CTRY_JAPAN19 },
+ {MKK7_MKKA, MKK7, MKKA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKK1 | PSCAN_MKK3 | PSCAN_MKKA2 | PSCAN_MKKA2_G, CTRY_JAPAN20 },
+ {MKK7_MKKC, MKK7, MKKC, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKK1 | PSCAN_MKK3, CTRY_JAPAN21 },
+ {MKK7_MKKA1, MKK7, MKKA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKKA1 | PSCAN_MKKA1_G, CTRY_JAPAN32 },
+ {MKK7_FCCA, MKK7, FCCA, MKK5GHZ_FLAG1, NEED_NFC, NO_PSCAN, CTRY_JAPAN33 },
+
+ /* MKK8 */
+ {MKK8_MKKB, MKK8, MKKA, MKK5GHZ_FLAG2, NEED_NFC, PSCAN_MKK1 | PSCAN_MKK3 | PSCAN_MKKA | PSCAN_MKKA_G, CTRY_JAPAN22 },
+ {MKK8_MKKA2, MKK8, MKKA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKK1 | PSCAN_MKK3 | PSCAN_MKKA2 | PSCAN_MKKA2_G, CTRY_JAPAN23 },
+ {MKK8_MKKC, MKK8, MKKC, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKK1 | PSCAN_MKK3 , CTRY_JAPAN24 },
+
+ /* MKK9 */
+ {MKK9_MKKA, MKK9, MKKA, MKK5GHZ_FLAG1, NEED_NFC, NO_PSCAN, CTRY_JAPAN34 },
+ {MKK9_FCCA, MKK9, FCCA, MKK5GHZ_FLAG1, NEED_NFC, NO_PSCAN, CTRY_JAPAN37 },
+ {MKK9_MKKA1, MKK9, MKKA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKKA1 | PSCAN_MKKA1_G, CTRY_JAPAN38 },
+ {MKK9_MKKC, MKK9, MKKC, MKK5GHZ_FLAG1, NEED_NFC, NO_PSCAN, CTRY_JAPAN39 },
+ {MKK9_MKKA2, MKK9, MKKA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKK1 | PSCAN_MKK3 | PSCAN_MKKA2 | PSCAN_MKKA2_G, CTRY_JAPAN40 },
+
+ /* MKK10 */
+ {MKK10_MKKA, MKK10, MKKA, MKK5GHZ_FLAG1, NEED_NFC, NO_PSCAN, CTRY_JAPAN35 },
+ {MKK10_FCCA, MKK10, FCCA, MKK5GHZ_FLAG1, NEED_NFC, NO_PSCAN, CTRY_JAPAN41 },
+ {MKK10_MKKA1, MKK10, MKKA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKKA1 | PSCAN_MKKA1_G, CTRY_JAPAN42 },
+ {MKK10_MKKC, MKK10, MKKC, MKK5GHZ_FLAG1, NEED_NFC, NO_PSCAN, CTRY_JAPAN43 },
+ {MKK10_MKKA2, MKK10, MKKA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKK1 | PSCAN_MKK3 | PSCAN_MKKA2 | PSCAN_MKKA2_G, CTRY_JAPAN44 },
+
+ /* MKK11 */
+ {MKK11_MKKA, MKK11, MKKA, MKK5GHZ_FLAG1, NEED_NFC, NO_PSCAN, CTRY_JAPAN45 },
+ {MKK11_FCCA, MKK11, FCCA, MKK5GHZ_FLAG1, NEED_NFC, NO_PSCAN, CTRY_JAPAN46 },
+ {MKK11_MKKA1, MKK11, MKKA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKKA1 | PSCAN_MKKA1_G, CTRY_JAPAN47 },
+ {MKK11_MKKC, MKK11, MKKC, MKK5GHZ_FLAG1, NEED_NFC, NO_PSCAN, CTRY_JAPAN48 },
+ {MKK11_MKKA2, MKK11, MKKA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKK1 | PSCAN_MKK3 | PSCAN_MKKA2 | PSCAN_MKKA2_G, CTRY_JAPAN49 },
+
+ /* MKK12 */
+ {MKK12_MKKA, MKK12, MKKA, MKK5GHZ_FLAG1, NEED_NFC, NO_PSCAN, CTRY_JAPAN50 },
+ {MKK12_FCCA, MKK12, FCCA, MKK5GHZ_FLAG1, NEED_NFC, NO_PSCAN, CTRY_JAPAN51 },
+ {MKK12_MKKA1, MKK12, MKKA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKKA1 | PSCAN_MKKA1_G, CTRY_JAPAN52 },
+ {MKK12_MKKC, MKK12, MKKC, MKK5GHZ_FLAG1, NEED_NFC, NO_PSCAN, CTRY_JAPAN53 },
+ {MKK12_MKKA2, MKK12, MKKA, MKK5GHZ_FLAG1, NEED_NFC, PSCAN_MKK1 | PSCAN_MKK3 | PSCAN_MKKA2 | PSCAN_MKKA2_G, CTRY_JAPAN54 },
+
+
+ /* These are super domains */
+ {WOR0_WORLD, WOR0_WORLD, WOR0_WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {WOR1_WORLD, WOR1_WORLD, WOR1_WORLD, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER, 0 },
+ {WOR2_WORLD, WOR2_WORLD, WOR2_WORLD, DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER, 0 },
+ {WOR3_WORLD, WOR3_WORLD, WOR3_WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {WOR4_WORLD, WOR4_WORLD, WOR4_WORLD, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER, 0 },
+ {WOR5_ETSIC, WOR5_ETSIC, WOR5_ETSIC, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER, 0 },
+ {WOR01_WORLD, WOR01_WORLD, WOR01_WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {WOR02_WORLD, WOR02_WORLD, WOR02_WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {EU1_WORLD, EU1_WORLD, EU1_WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0 },
+ {WOR9_WORLD, WOR9_WORLD, WOR9_WORLD, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER, 0 },
+ {WORA_WORLD, WORA_WORLD, WORA_WORLD, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER, 0 },
+};
+
+/*
+ * The following table is the master list for all different freqeuncy
+ * bands with the complete matrix of all possible flags and settings
+ * for each band if it is used in ANY reg domain.
+ */
+
+#define DEF_REGDMN FCC1_FCCA
+#define DEF_DMN_5 FCC1
+#define DEF_DMN_2 FCCA
+#define COUNTRY_ERD_FLAG 0x8000
+#define WORLDWIDE_ROAMING_FLAG 0x4000
+#define SUPER_DOMAIN_MASK 0x0fff
+#define COUNTRY_CODE_MASK 0x03ff
+#define CF_INTERFERENCE (CHANNEL_CW_INT | CHANNEL_RADAR_INT)
+#define CHANNEL_14 (2484) /* 802.11g operation is not permitted on channel 14 */
+#define IS_11G_CH14(_ch,_cf) \
+ (((_ch) == CHANNEL_14) && ((_cf) == CHANNEL_G))
+
+#define YES TRUE
+#define NO FALSE
+
+enum {
+ CTRY_DEBUG = 0x1ff, /* debug country code */
+ CTRY_DEFAULT = 0 /* default country code */
+};
+
+typedef struct {
+ HAL_CTRY_CODE countryCode;
+ HAL_REG_DOMAIN regDmnEnum;
+ const char* isoName;
+ const char* name;
+ HAL_BOOL allow11g;
+ HAL_BOOL allow11aTurbo;
+ HAL_BOOL allow11gTurbo;
+ HAL_BOOL allow11na; /* HT-40 allowed in 5GHz? */
+ HAL_BOOL allow11ng; /* HT-40 allowed in 2GHz? */
+ u16_t outdoorChanStart;
+} COUNTRY_CODE_TO_ENUM_RD;
+
+static COUNTRY_CODE_TO_ENUM_RD allCountries[] = {
+ {CTRY_DEBUG, NO_ENUMRD, "DB", "DEBUG", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_DEFAULT, DEF_REGDMN, "NA", "NO_COUNTRY_SET", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_ALBANIA, NULL1_WORLD, "AL", "ALBANIA", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_ALGERIA, NULL1_WORLD, "DZ", "ALGERIA", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_ARGENTINA, APL3_WORLD, "AR", "ARGENTINA", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_ARMENIA, ETSI4_WORLD, "AM", "ARMENIA", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_AUSTRALIA, FCC6_WORLD, "AU", "AUSTRALIA", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_AUSTRIA, ETSI2_WORLD, "AT", "AUSTRIA", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_AZERBAIJAN, ETSI4_WORLD, "AZ", "AZERBAIJAN", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_BAHRAIN, APL6_WORLD, "BH", "BAHRAIN", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_BELARUS, ETSI1_WORLD, "BY", "BELARUS", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_BELGIUM, ETSI1_WORLD, "BE", "BELGIUM", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_BELIZE, APL1_ETSIC, "BZ", "BELIZE", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_BOLIVIA, APL1_ETSIC, "BO", "BOLVIA", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_BRAZIL, FCC3_WORLD, "BR", "BRAZIL", NO, NO, NO, NO, NO, 7000 },
+ {CTRY_BRUNEI_DARUSSALAM,APL1_WORLD,"BN", "BRUNEI DARUSSALAM", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_BULGARIA, ETSI6_WORLD, "BG", "BULGARIA", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_CANADA, FCC6_FCCA, "CA", "CANADA", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_CHILE, APL6_WORLD, "CL", "CHILE", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_CHINA, APL1_WORLD, "CN", "CHINA", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_COLOMBIA, FCC1_FCCA, "CO", "COLOMBIA", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_COSTA_RICA, FCC1_WORLD, "CR", "COSTA RICA", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_CROATIA, ETSI3_WORLD, "HR", "CROATIA", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_CYPRUS, ETSI3_WORLD, "CY", "CYPRUS", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_CZECH, ETSI3_WORLD, "CZ", "CZECH REPUBLIC", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_DENMARK, ETSI1_WORLD, "DK", "DENMARK", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_DOMINICAN_REPUBLIC,FCC1_FCCA,"DO", "DOMINICAN REPUBLIC", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_ECUADOR, FCC1_WORLD, "EC", "ECUADOR", YES, NO, NO, NO, YES, 7000 },
+ {CTRY_EGYPT, ETSI3_WORLD, "EG", "EGYPT", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_EL_SALVADOR, FCC1_WORLD, "SV", "EL SALVADOR", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_ESTONIA, ETSI1_WORLD, "EE", "ESTONIA", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_FINLAND, ETSI1_WORLD, "FI", "FINLAND", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_FRANCE, ETSI1_WORLD, "FR", "FRANCE", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_FRANCE2, ETSI3_WORLD, "F2", "FRANCE_RES", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_GEORGIA, ETSI4_WORLD, "GE", "GEORGIA", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_GERMANY, ETSI1_WORLD, "DE", "GERMANY", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_GREECE, ETSI1_WORLD, "GR", "GREECE", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_GUATEMALA, FCC1_FCCA, "GT", "GUATEMALA", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_HONDURAS, NULL1_WORLD, "HN", "HONDURAS", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_HONG_KONG, FCC2_WORLD, "HK", "HONG KONG", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_HUNGARY, ETSI4_WORLD, "HU", "HUNGARY", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_ICELAND, ETSI1_WORLD, "IS", "ICELAND", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_INDIA, APL6_WORLD, "IN", "INDIA", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_INDONESIA, APL1_WORLD, "ID", "INDONESIA", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_IRAN, APL1_WORLD, "IR", "IRAN", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_IRELAND, ETSI1_WORLD, "IE", "IRELAND", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_ISRAEL, ETSI3_WORLD, "IL", "ISRAEL", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_ISRAEL2, NULL1_ETSIB, "ISR","ISRAEL_RES", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_ITALY, ETSI1_WORLD, "IT", "ITALY", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_JAMAICA, ETSI1_WORLD, "JM", "JAMAICA", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_JAPAN, MKK1_MKKA, "JP", "JAPAN", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN1, MKK1_MKKB, "J1", "JAPAN1", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN2, MKK1_FCCA, "J2", "JAPAN2", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN3, MKK2_MKKA, "J3", "JAPAN3", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN4, MKK1_MKKA1, "J4", "JAPAN4", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN5, MKK1_MKKA2, "J5", "JAPAN5", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN6, MKK1_MKKC, "J6", "JAPAN6", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN7, MKK3_MKKB, "J7", "JAPAN7", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN8, MKK3_MKKA2, "J8", "JAPAN8", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN9, MKK3_MKKC, "J9", "JAPAN9", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN10, MKK4_MKKB, "J10", "JAPAN10", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN11, MKK4_MKKA2, "J11", "JAPAN11", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN12, MKK4_MKKC, "J12", "JAPAN12", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN13, MKK5_MKKB, "J13", "JAPAN13", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN14, MKK5_MKKA2, "J14", "JAPAN14", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN15, MKK5_MKKC, "J15", "JAPAN15", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN16, MKK6_MKKB, "J16", "JAPAN16", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN17, MKK6_MKKA2, "J17", "JAPAN17", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN18, MKK6_MKKC, "J18", "JAPAN18", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN19, MKK7_MKKB, "J19", "JAPAN19", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN20, MKK7_MKKA, "J20", "JAPAN20", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN21, MKK7_MKKC, "J21", "JAPAN21", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN22, MKK8_MKKB, "J22", "JAPAN22", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN23, MKK8_MKKA2, "J23", "JAPAN23", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN24, MKK8_MKKC, "J24", "JAPAN24", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN25, MKK3_MKKA, "J25", "JAPAN25", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN26, MKK3_MKKA1, "J26", "JAPAN26", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN27, MKK3_FCCA, "J27", "JAPAN27", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN28, MKK4_MKKA1, "J28", "JAPAN28", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN29, MKK4_FCCA, "J29", "JAPAN29", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN30, MKK6_MKKA1, "J30", "JAPAN30", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN31, MKK6_FCCA, "J31", "JAPAN31", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN32, MKK7_MKKA1, "J32", "JAPAN32", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN33, MKK7_FCCA, "J33", "JAPAN33", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN34, MKK9_MKKA, "J34", "JAPAN34", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN35, MKK10_MKKA, "J35", "JAPAN35", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN36, MKK4_MKKA, "J36", "JAPAN36", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN37, MKK9_FCCA, "J37", "JAPAN37", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN38, MKK9_MKKA1, "J38", "JAPAN38", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN39, MKK9_MKKC, "J39", "JAPAN39", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN40, MKK10_MKKA2, "J40", "JAPAN40", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN41, MKK10_FCCA, "J41", "JAPAN41", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN42, MKK10_MKKA1, "J42", "JAPAN42", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN43, MKK10_MKKC, "J43", "JAPAN43", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN44, MKK10_MKKA2, "J44", "JAPAN44", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN45, MKK11_MKKA, "J45", "JAPAN45", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN46, MKK11_FCCA, "J46", "JAPAN46", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN47, MKK11_MKKA1, "J47", "JAPAN47", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN48, MKK11_MKKC, "J48", "JAPAN48", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN49, MKK11_MKKA2, "J49", "JAPAN49", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN50, MKK12_MKKA, "J50", "JAPAN50", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN51, MKK12_FCCA, "J51", "JAPAN51", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN52, MKK12_MKKA1, "J52", "JAPAN52", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN53, MKK12_MKKC, "J53", "JAPAN53", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JAPAN54, MKK12_MKKA2, "J54", "JAPAN54", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_JORDAN, ETSI2_WORLD, "JO", "JORDAN", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_KAZAKHSTAN, NULL1_WORLD, "KZ", "KAZAKHSTAN", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_KOREA_NORTH, APL9_WORLD, "KP", "NORTH KOREA", YES, NO, NO, YES, YES, 7000 },
+ {CTRY_KOREA_ROC, APL9_WORLD, "KR", "KOREA REPUBLIC", YES, NO, NO, NO, NO, 7000 },
+ {CTRY_KOREA_ROC2, APL2_APLD, "K2", "KOREA REPUBLIC2",YES, NO, NO, NO, NO, 7000 },
+ {CTRY_KOREA_ROC3, APL9_WORLD, "K3", "KOREA REPUBLIC3",YES, NO, NO, NO, NO, 7000 },
+ {CTRY_KUWAIT, NULL1_WORLD, "KW", "KUWAIT", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_LATVIA, ETSI1_WORLD, "LV", "LATVIA", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_LEBANON, NULL1_WORLD, "LB", "LEBANON", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_LIECHTENSTEIN,ETSI1_WORLD, "LI", "LIECHTENSTEIN", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_LITHUANIA, ETSI1_WORLD, "LT", "LITHUANIA", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_LUXEMBOURG, ETSI1_WORLD, "LU", "LUXEMBOURG", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_MACAU, FCC2_WORLD, "MO", "MACAU", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_MACEDONIA, NULL1_WORLD, "MK", "MACEDONIA", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_MALAYSIA, APL8_WORLD, "MY", "MALAYSIA", NO, NO, NO, NO, NO, 7000 },
+ {CTRY_MALTA, ETSI1_WORLD, "MT", "MALTA", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_MEXICO, FCC1_FCCA, "MX", "MEXICO", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_MONACO, ETSI4_WORLD, "MC", "MONACO", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_MOROCCO, NULL1_WORLD, "MA", "MOROCCO", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_NETHERLANDS, ETSI1_WORLD, "NL", "NETHERLANDS", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_NETHERLANDS_ANT, ETSI1_WORLD, "AN", "NETHERLANDS-ANTILLES", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_NEW_ZEALAND, FCC2_ETSIC, "NZ", "NEW ZEALAND", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_NORWAY, ETSI1_WORLD, "NO", "NORWAY", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_OMAN, APL6_WORLD, "OM", "OMAN", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_PAKISTAN, NULL1_WORLD, "PK", "PAKISTAN", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_PANAMA, FCC1_FCCA, "PA", "PANAMA", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_PERU, APL1_WORLD, "PE", "PERU", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_PHILIPPINES, APL1_WORLD, "PH", "PHILIPPINES", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_POLAND, ETSI1_WORLD, "PL", "POLAND", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_PORTUGAL, ETSI1_WORLD, "PT", "PORTUGAL", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_PUERTO_RICO, FCC1_FCCA, "PR", "PUERTO RICO", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_QATAR, NULL1_WORLD, "QA", "QATAR", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_ROMANIA, NULL1_WORLD, "RO", "ROMANIA", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_RUSSIA, NULL1_WORLD, "RU", "RUSSIA", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_SAUDI_ARABIA,NULL1_WORLD, "SA", "SAUDI ARABIA", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_SERBIA_MONT, ETSI1_WORLD, "CS", "SERBIA & MONTENEGRO", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_SINGAPORE, APL6_WORLD, "SG", "SINGAPORE", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_SLOVAKIA, ETSI1_WORLD, "SK", "SLOVAK REPUBLIC",YES, NO, YES, YES, YES, 7000 },
+ {CTRY_SLOVENIA, ETSI1_WORLD, "SI", "SLOVENIA", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_SOUTH_AFRICA,FCC3_WORLD, "ZA", "SOUTH AFRICA", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_SPAIN, ETSI1_WORLD, "ES", "SPAIN", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_SRILANKA, FCC3_WORLD, "LK", "SRI LANKA", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_SWEDEN, ETSI1_WORLD, "SE", "SWEDEN", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_SWITZERLAND, ETSI1_WORLD, "CH", "SWITZERLAND", YES, NO, YES, YES, YES, 7000 },
+ {CTRY_SYRIA, NULL1_WORLD, "SY", "SYRIA", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_TAIWAN, APL3_FCCA, "TW", "TAIWAN", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_THAILAND, NULL1_WORLD, "TH", "THAILAND", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_TRINIDAD_Y_TOBAGO,ETSI4_WORLD,"TT", "TRINIDAD & TOBAGO", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_TUNISIA, ETSI3_WORLD, "TN", "TUNISIA", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_TURKEY, ETSI3_WORLD, "TR", "TURKEY", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_UKRAINE, NULL1_WORLD, "UA", "UKRAINE", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_UAE, NULL1_WORLD, "AE", "UNITED ARAB EMIRATES", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_UNITED_KINGDOM, ETSI1_WORLD,"GB", "UNITED KINGDOM", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_UNITED_STATES, FCC3_FCCA, "US", "UNITED STATES", YES, YES, YES, YES, YES, 5825 },
+ {CTRY_UNITED_STATES_FCC49, FCC4_FCCA, "PS", "UNITED STATES (PUBLIC SAFETY)", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_URUGUAY, FCC1_WORLD, "UY", "URUGUAY", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_UZBEKISTAN, FCC3_FCCA, "UZ", "UZBEKISTAN", YES, YES, YES, YES, YES, 7000 },
+ {CTRY_VENEZUELA, APL2_ETSIC, "VE", "VENEZUELA", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_VIET_NAM, NULL1_WORLD, "VN", "VIET NAM", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_YEMEN, NULL1_WORLD, "YE", "YEMEN", YES, NO, YES, NO, YES, 7000 },
+ {CTRY_ZIMBABWE, NULL1_WORLD, "ZW", "ZIMBABWE", YES, NO, YES, NO, YES, 7000 }
+};
+
+typedef struct RegDmnFreqBand {
+ u16_t lowChannel; /* Low channel center in MHz */
+ u16_t highChannel; /* High Channel center in MHz */
+ u8_t powerDfs; /* Max power (dBm) for channel
+ range when using DFS */
+ u8_t antennaMax; /* Max allowed antenna gain */
+ u8_t channelBW; /* Bandwidth of the channel */
+ u8_t channelSep; /* Channel separation within
+ the band */
+ u64_t useDfs; /* Use DFS in the RegDomain
+ if corresponding bit is set */
+ u64_t usePassScan; /* Use Passive Scan in the RegDomain
+ if corresponding bit is set */
+ u8_t regClassId; /* Regulatory class id */
+ u8_t useExtChanDfs; /* Regulatory class id */
+} REG_DMN_FREQ_BAND;
+
+/* Bit masks for DFS per regdomain */
+
+enum {
+ NO_DFS = 0x0000000000000000ULL,
+ DFS_FCC3 = 0x0000000000000001ULL,
+ DFS_ETSI = 0x0000000000000002ULL,
+ DFS_MKK4 = 0x0000000000000004ULL,
+};
+
+/* The table of frequency bands is indexed by a bitmask. The ordering
+ * must be consistent with the enum below. When adding a new
+ * frequency band, be sure to match the location in the enum with the
+ * comments
+ */
+
+/*
+ * 5GHz 11A channel tags
+ */
+
+enum {
+ F1_4915_4925,
+ F1_4935_4945,
+ F1_4920_4980,
+ F1_4942_4987,
+ F1_4945_4985,
+ F1_4950_4980,
+ F1_5035_5040,
+ F1_5040_5080,
+ F1_5055_5055,
+
+ F1_5120_5240,
+
+ F1_5170_5230,
+ F2_5170_5230,
+
+ F1_5180_5240,
+ F2_5180_5240,
+ F3_5180_5240,
+ F4_5180_5240,
+ F5_5180_5240,
+ F6_5180_5240,
+ F7_5180_5240,
+
+ F1_5180_5320,
+
+ F1_5240_5280,
+
+ F1_5260_5280,
+
+ F1_5260_5320,
+ F2_5260_5320,
+ F3_5260_5320,
+ F4_5260_5320,
+ F5_5260_5320,
+ F6_5260_5320,
+ F7_5260_5320,
+
+ F1_5260_5700,
+
+ F1_5280_5320,
+
+ F1_5500_5580,
+
+ F1_5500_5620,
+
+ F1_5500_5700,
+ F2_5500_5700,
+ F3_5500_5700,
+ F4_5500_5700,
+
+ F1_5660_5700,
+
+ F1_5745_5805,
+ F2_5745_5805,
+ F3_5745_5805,
+
+ F1_5745_5825,
+ F2_5745_5825,
+ F3_5745_5825,
+ F4_5745_5825,
+ F5_5745_5825,
+ F6_5745_5825,
+
+ W1_4920_4980,
+ W1_5040_5080,
+ W1_5170_5230,
+ W1_5180_5240,
+ W1_5260_5320,
+ W1_5745_5825,
+ W1_5500_5700,
+ W2_5260_5320,
+ W2_5180_5240,
+ W2_5825_5825,
+};
+
+static REG_DMN_FREQ_BAND regDmn5GhzFreq[] = {
+ { 4915, 4925, 23, 0, 10, 5, NO_DFS, PSCAN_MKK2, 16, 0 }, /* F1_4915_4925 */
+ { 4935, 4945, 23, 0, 10, 5, NO_DFS, PSCAN_MKK2, 16, 0 }, /* F1_4935_4945 */
+ { 4920, 4980, 23, 0, 20, 20, NO_DFS, PSCAN_MKK2, 7, 0 }, /* F1_4920_4980 */
+ { 4942, 4987, 27, 6, 5, 5, DFS_FCC3, PSCAN_FCC, 0, 0 }, /* F1_4942_4987 */
+ { 4945, 4985, 30, 6, 10, 5, DFS_FCC3, PSCAN_FCC, 0, 0 }, /* F1_4945_4985 */
+ { 4950, 4980, 33, 6, 20, 5, DFS_FCC3, PSCAN_FCC, 0, 0 }, /* F1_4950_4980 */
+ { 5035, 5040, 23, 0, 10, 5, NO_DFS, PSCAN_MKK2, 12, 0 }, /* F1_5035_5040 */
+ { 5040, 5080, 23, 0, 20, 20, NO_DFS, PSCAN_MKK2, 2, 0 }, /* F1_5040_5080 */
+ { 5055, 5055, 23, 0, 10, 5, NO_DFS, PSCAN_MKK2, 12, 0 }, /* F1_5055_5055 */
+
+ { 5120, 5240, 5, 6, 20, 20, NO_DFS, NO_PSCAN, 0, 0 }, /* F1_5120_5240 */
+
+ { 5170, 5230, 23, 0, 20, 20, NO_DFS, PSCAN_MKK1 | PSCAN_MKK2, 1, 0 }, /* F1_5170_5230 */
+ { 5170, 5230, 20, 0, 20, 20, NO_DFS, PSCAN_MKK1 | PSCAN_MKK2, 1, 0 }, /* F2_5170_5230 */
+
+ { 5180, 5240, 15, 0, 20, 20, NO_DFS, PSCAN_FCC | PSCAN_ETSI, 0, 0 }, /* F1_5180_5240 */
+ { 5180, 5240, 17, 6, 20, 20, NO_DFS, PSCAN_FCC, 1, 0 }, /* F2_5180_5240 */
+ { 5180, 5240, 18, 0, 20, 20, NO_DFS, PSCAN_FCC | PSCAN_ETSI, 0, 0 }, /* F3_5180_5240 */
+ { 5180, 5240, 20, 0, 20, 20, NO_DFS, PSCAN_FCC | PSCAN_ETSI, 0, 0 }, /* F4_5180_5240 */
+ { 5180, 5240, 23, 0, 20, 20, NO_DFS, PSCAN_FCC | PSCAN_ETSI, 0, 0 }, /* F5_5180_5240 */
+ { 5180, 5240, 23, 6, 20, 20, NO_DFS, PSCAN_FCC, 0, 0 }, /* F6_5180_5240 */
+ { 5180, 5240, 23, 6, 20, 20, NO_DFS, NO_PSCAN, 0 }, /* F7_5180_5240 */
+
+ { 5180, 5320, 20, 6, 20, 20, DFS_ETSI, PSCAN_ETSI, 0, 0 }, /* F1_5180_5320 */
+
+ { 5240, 5280, 23, 0, 20, 20, DFS_FCC3, PSCAN_FCC | PSCAN_ETSI, 0, 0 }, /* F1_5240_5280 */
+
+ { 5260, 5280, 23, 0, 20, 20, DFS_FCC3 | DFS_ETSI, PSCAN_FCC | PSCAN_ETSI, 0, 0 }, /* F1_5260_5280 */
+
+ { 5260, 5320, 18, 0, 20, 20, DFS_FCC3 | DFS_ETSI, PSCAN_FCC | PSCAN_ETSI, 0, 0 }, /* F1_5260_5320 */
+
+ { 5260, 5320, 20, 0, 20, 20, DFS_FCC3 | DFS_ETSI | DFS_MKK4, PSCAN_FCC | PSCAN_ETSI | PSCAN_MKK3 , 0, 0 },
+ /* F2_5260_5320 */
+
+ { 5260, 5320, 20, 6, 20, 20, DFS_FCC3 | DFS_ETSI, PSCAN_FCC, 2, 0 }, /* F3_5260_5320 */
+ { 5260, 5320, 23, 6, 20, 20, DFS_FCC3 | DFS_ETSI, PSCAN_FCC, 2, 0 }, /* F4_5260_5320 */
+ { 5260, 5320, 23, 6, 20, 20, DFS_FCC3 | DFS_ETSI, PSCAN_FCC, 0, 0 }, /* F5_5260_5320 */
+ { 5260, 5320, 30, 0, 20, 20, NO_DFS, NO_PSCAN, 0, 0 }, /* F6_5260_5320 */
+ { 5260, 5320, 17, 6, 20, 20, DFS_ETSI, PSCAN_ETSI, 0, 0 }, /* F7_5260_5320 */
+
+ { 5260, 5700, 5, 6, 20, 20, DFS_FCC3 | DFS_ETSI, NO_PSCAN, 0, 0 }, /* F1_5260_5700 */
+
+ { 5280, 5320, 17, 6, 20, 20, DFS_FCC3 | DFS_ETSI, PSCAN_FCC, 0, 0 }, /* F1_5280_5320 */
+
+ { 5500, 5580, 23, 6, 20, 20, DFS_FCC3, PSCAN_FCC, 0}, /* F1_5500_5580 */
+
+ { 5500, 5620, 30, 6, 20, 20, DFS_ETSI, PSCAN_ETSI, 0, 0 }, /* F1_5500_5620 */
+
+ { 5500, 5700, 20, 6, 20, 20, DFS_FCC3 | DFS_ETSI, PSCAN_FCC, 4, 0 }, /* F1_5500_5700 */
+ { 5500, 5700, 27, 0, 20, 20, DFS_FCC3 | DFS_ETSI, PSCAN_FCC | PSCAN_ETSI, 0, 0 }, /* F2_5500_5700 */
+ { 5500, 5700, 30, 0, 20, 20, DFS_FCC3 | DFS_ETSI, PSCAN_FCC | PSCAN_ETSI, 0, 0 }, /* F3_5500_5700 */
+ { 5500, 5700, 20, 0, 20, 20, DFS_FCC3 | DFS_ETSI | DFS_MKK4, PSCAN_MKK3 | PSCAN_FCC, 0, 0 },
+ /* F4_5500_5700 */
+
+ { 5660, 5700, 23, 6, 20, 20, DFS_FCC3, PSCAN_FCC, 0}, /* F1_5660_5700 */
+
+ { 5745, 5805, 23, 0, 20, 20, NO_DFS, NO_PSCAN, 0, 0 }, /* F1_5745_5805 */
+ { 5745, 5805, 30, 6, 20, 20, NO_DFS, NO_PSCAN, 0, 0 }, /* F2_5745_5805 */
+ { 5745, 5805, 30, 6, 20, 20, DFS_ETSI, PSCAN_ETSI, 0, 0 }, /* F3_5745_5805 */
+ { 5745, 5825, 5, 6, 20, 20, NO_DFS, NO_PSCAN, 0, 0 }, /* F1_5745_5825 */
+ { 5745, 5825, 17, 0, 20, 20, NO_DFS, NO_PSCAN, 0, 0 }, /* F2_5745_5825 */
+ { 5745, 5825, 20, 0, 20, 20, DFS_ETSI, NO_PSCAN, 0, 0 }, /* F3_5745_5825 */
+ { 5745, 5825, 30, 0, 20, 20, NO_DFS, NO_PSCAN, 0, 0 }, /* F4_5745_5825 */
+ { 5745, 5825, 30, 6, 20, 20, NO_DFS, NO_PSCAN, 3, 0 }, /* F5_5745_5825 */
+ { 5745, 5825, 30, 6, 20, 20, NO_DFS, NO_PSCAN, 0, 0 }, /* F6_5745_5825 */
+
+ /*
+ * Below are the world roaming channels
+ * All WWR domains have no power limit, instead use the card's CTL
+ * or max power settings.
+ */
+ { 4920, 4980, 30, 0, 20, 20, NO_DFS, PSCAN_WWR, 0, 0 }, /* W1_4920_4980 */
+ { 5040, 5080, 30, 0, 20, 20, NO_DFS, PSCAN_WWR, 0 }, /* W1_5040_5080 */
+ { 5170, 5230, 30, 0, 20, 20, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, 0, 0 }, /* W1_5170_5230 */
+ { 5180, 5240, 30, 0, 20, 20, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, 0, 0 }, /* W1_5180_5240 */
+ { 5260, 5320, 30, 0, 20, 20, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, 0, 0 }, /* W1_5260_5320 */
+ { 5745, 5825, 30, 0, 20, 20, NO_DFS, PSCAN_WWR, 0, 0 }, /* W1_5745_5825 */
+ { 5500, 5700, 30, 0, 20, 20, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, 0, 0 }, /* W1_5500_5700 */
+ { 5260, 5320, 30, 0, 20, 20, NO_DFS, NO_PSCAN, 0, 0 }, /* W2_5260_5320 */
+ { 5180, 5240, 30, 0, 20, 20, NO_DFS, NO_PSCAN, 0, 0 }, /* W2_5180_5240 */
+ { 5825, 5825, 30, 0, 20, 20, NO_DFS, PSCAN_WWR, 0, 0 }, /* W2_5825_5825 */
+};
+/*
+ * 5GHz Turbo (dynamic & static) tags
+ */
+
+enum {
+ T1_5130_5210,
+ T1_5250_5330,
+ T1_5370_5490,
+ T1_5530_5650,
+
+ T1_5150_5190,
+ T1_5230_5310,
+ T1_5350_5470,
+ T1_5510_5670,
+
+ T1_5200_5240,
+ T2_5200_5240,
+ T1_5210_5210,
+ T2_5210_5210,
+
+ T1_5280_5280,
+ T2_5280_5280,
+ T1_5250_5250,
+ T1_5290_5290,
+ T1_5250_5290,
+ T2_5250_5290,
+
+ T1_5540_5660,
+ T1_5760_5800,
+ T2_5760_5800,
+
+ T1_5765_5805,
+
+ WT1_5210_5250,
+ WT1_5290_5290,
+ WT1_5540_5660,
+ WT1_5760_5800,
+};
+
+static REG_DMN_FREQ_BAND regDmn5GhzTurboFreq[] = {
+ { 5130, 5210, 5, 6, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* T1_5130_5210 */
+ { 5250, 5330, 5, 6, 40, 40, DFS_FCC3, NO_PSCAN, 0, 0}, /* T1_5250_5330 */
+ { 5370, 5490, 5, 6, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* T1_5370_5490 */
+ { 5530, 5650, 5, 6, 40, 40, DFS_FCC3, NO_PSCAN, 0, 0}, /* T1_5530_5650 */
+
+ { 5150, 5190, 5, 6, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* T1_5150_5190 */
+ { 5230, 5310, 5, 6, 40, 40, DFS_FCC3, NO_PSCAN, 0, 0}, /* T1_5230_5310 */
+ { 5350, 5470, 5, 6, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* T1_5350_5470 */
+ { 5510, 5670, 5, 6, 40, 40, DFS_FCC3, NO_PSCAN, 0, 0}, /* T1_5510_5670 */
+
+ { 5200, 5240, 17, 6, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* T1_5200_5240 */
+ { 5200, 5240, 23, 6, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* T2_5200_5240 */
+ { 5210, 5210, 17, 6, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* T1_5210_5210 */
+ { 5210, 5210, 23, 0, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* T2_5210_5210 */
+
+ { 5280, 5280, 23, 6, 40, 40, DFS_FCC3, PSCAN_FCC_T, 0, 0}, /* T1_5280_5280 */
+ { 5280, 5280, 20, 6, 40, 40, DFS_FCC3, PSCAN_FCC_T, 0, 0}, /* T2_5280_5280 */
+ { 5250, 5250, 17, 0, 40, 40, DFS_FCC3, PSCAN_FCC_T, 0, 0}, /* T1_5250_5250 */
+ { 5290, 5290, 20, 0, 40, 40, DFS_FCC3, PSCAN_FCC_T, 0, 0}, /* T1_5290_5290 */
+ { 5250, 5290, 20, 0, 40, 40, DFS_FCC3, PSCAN_FCC_T, 0, 0}, /* T1_5250_5290 */
+ { 5250, 5290, 23, 6, 40, 40, DFS_FCC3, PSCAN_FCC_T, 0, 0}, /* T2_5250_5290 */
+
+ { 5540, 5660, 20, 6, 40, 40, DFS_FCC3, PSCAN_FCC_T, 0, 0}, /* T1_5540_5660 */
+ { 5760, 5800, 20, 0, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* T1_5760_5800 */
+ { 5760, 5800, 30, 6, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* T2_5760_5800 */
+
+ { 5765, 5805, 30, 6, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* T1_5765_5805 */
+
+ /*
+ * Below are the WWR frequencies
+ */
+
+ { 5210, 5250, 15, 0, 40, 40, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, 0, 0}, /* WT1_5210_5250 */
+ { 5290, 5290, 18, 0, 40, 40, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, 0, 0}, /* WT1_5290_5290 */
+ { 5540, 5660, 20, 0, 40, 40, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, 0, 0}, /* WT1_5540_5660 */
+ { 5760, 5800, 20, 0, 40, 40, NO_DFS, PSCAN_WWR, 0, 0}, /* WT1_5760_5800 */
+};
+
+/*
+ * 2GHz 11b channel tags
+ */
+enum {
+ F1_2312_2372,
+ F2_2312_2372,
+
+ F1_2412_2472,
+ F2_2412_2472,
+ F3_2412_2472,
+
+ F1_2412_2462,
+ F2_2412_2462,
+
+ F1_2432_2442,
+
+ F1_2457_2472,
+
+ F1_2467_2472,
+
+ F1_2484_2484,
+ F2_2484_2484,
+
+ F1_2512_2732,
+
+ W1_2312_2372,
+ W1_2412_2412,
+ W1_2417_2432,
+ W1_2437_2442,
+ W1_2447_2457,
+ W1_2462_2462,
+ W1_2467_2467,
+ W2_2467_2467,
+ W1_2472_2472,
+ W2_2472_2472,
+ W1_2484_2484,
+ W2_2484_2484,
+};
+
+static REG_DMN_FREQ_BAND regDmn2GhzFreq[] = {
+ { 2312, 2372, 5, 6, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* F1_2312_2372 */
+ { 2312, 2372, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* F2_2312_2372 */
+
+ { 2412, 2472, 5, 6, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* F1_2412_2472 */
+ { 2412, 2472, 20, 0, 20, 5, NO_DFS, PSCAN_MKKA, 0, 0}, /* F2_2412_2472 */
+ { 2412, 2472, 30, 0, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* F3_2412_2472 */
+
+ { 2412, 2462, 27, 6, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* F1_2412_2462 */
+ { 2412, 2462, 20, 0, 20, 5, NO_DFS, PSCAN_MKKA, 0, 0}, /* F2_2412_2462 */
+ { 2432, 2442, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* F1_2432_2442 */
+
+ { 2457, 2472, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* F1_2457_2472 */
+
+ { 2467, 2472, 20, 0, 20, 5, NO_DFS, PSCAN_MKKA2 | PSCAN_MKKA, 0, 0}, /* F1_2467_2472 */
+
+ { 2484, 2484, 5, 6, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* F1_2484_2484 */
+ { 2484, 2484, 20, 0, 20, 5, NO_DFS, PSCAN_MKKA | PSCAN_MKKA1 | PSCAN_MKKA2, 0, 0}, /* F2_2484_2484 */
+
+ { 2512, 2732, 5, 6, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* F1_2512_2732 */
+
+ /*
+ * WWR have powers opened up to 20dBm. Limits should often come from CTL/Max powers
+ */
+
+ { 2312, 2372, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* W1_2312_2372 */
+ { 2412, 2412, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* W1_2412_2412 */
+ { 2417, 2432, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* W1_2417_2432 */
+ { 2437, 2442, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* W1_2437_2442 */
+ { 2447, 2457, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* W1_2447_2457 */
+ { 2462, 2462, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* W1_2462_2462 */
+ { 2467, 2467, 20, 0, 20, 5, NO_DFS, PSCAN_WWR | IS_ECM_CHAN, 0, 0}, /* W1_2467_2467 */
+ { 2467, 2467, 20, 0, 20, 5, NO_DFS, NO_PSCAN | IS_ECM_CHAN, 0, 0}, /* W2_2467_2467 */
+ { 2472, 2472, 20, 0, 20, 5, NO_DFS, PSCAN_WWR | IS_ECM_CHAN, 0, 0}, /* W1_2472_2472 */
+ { 2472, 2472, 20, 0, 20, 5, NO_DFS, NO_PSCAN | IS_ECM_CHAN, 0, 0}, /* W2_2472_2472 */
+ { 2484, 2484, 20, 0, 20, 5, NO_DFS, PSCAN_WWR | IS_ECM_CHAN, 0, 0}, /* W1_2484_2484 */
+ { 2484, 2484, 20, 0, 20, 5, NO_DFS, NO_PSCAN | IS_ECM_CHAN, 0, 0}, /* W2_2484_2484 */
+};
+
+
+/*
+ * 2GHz 11g channel tags
+ */
+
+enum {
+ G1_2312_2372,
+ G2_2312_2372,
+
+ G1_2412_2472,
+ G2_2412_2472,
+ G3_2412_2472,
+
+ G1_2412_2462,
+ G2_2412_2462,
+
+ G1_2432_2442,
+
+ G1_2457_2472,
+
+ G1_2512_2732,
+
+ G1_2467_2472 ,
+
+ WG1_2312_2372,
+ WG1_2412_2412,
+ WG1_2417_2432,
+ WG1_2437_2442,
+ WG1_2447_2457,
+ WG1_2462_2462,
+ WG1_2467_2467,
+ WG2_2467_2467,
+ WG1_2472_2472,
+ WG2_2472_2472,
+
+};
+static REG_DMN_FREQ_BAND regDmn2Ghz11gFreq[] = {
+ { 2312, 2372, 5, 6, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* G1_2312_2372 */
+ { 2312, 2372, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* G2_2312_2372 */
+
+ { 2412, 2472, 5, 6, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* G1_2412_2472 */
+ { 2412, 2472, 20, 0, 20, 5, NO_DFS, PSCAN_MKKA_G, 0, 0}, /* G2_2412_2472 */
+ { 2412, 2472, 30, 0, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* G3_2412_2472 */
+
+ { 2412, 2462, 27, 6, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* G1_2412_2462 */
+ { 2412, 2462, 20, 0, 20, 5, NO_DFS, PSCAN_MKKA_G, 0, 0}, /* G2_2412_2462 */
+ { 2432, 2442, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* G1_2432_2442 */
+
+ { 2457, 2472, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* G1_2457_2472 */
+
+ { 2512, 2732, 5, 6, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* G1_2512_2732 */
+
+ { 2467, 2472, 20, 0, 20, 5, NO_DFS, PSCAN_MKKA2 | PSCAN_MKKA, 0, 0 }, /* G1_2467_2472 */
+
+ /*
+ * WWR open up the power to 20dBm
+ */
+
+ { 2312, 2372, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* WG1_2312_2372 */
+ { 2412, 2412, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* WG1_2412_2412 */
+ { 2417, 2432, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* WG1_2417_2432 */
+ { 2437, 2442, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* WG1_2437_2442 */
+ { 2447, 2457, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* WG1_2447_2457 */
+ { 2462, 2462, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* WG1_2462_2462 */
+ { 2467, 2467, 20, 0, 20, 5, NO_DFS, PSCAN_WWR | IS_ECM_CHAN, 0, 0}, /* WG1_2467_2467 */
+ { 2467, 2467, 20, 0, 20, 5, NO_DFS, NO_PSCAN | IS_ECM_CHAN, 0, 0}, /* WG2_2467_2467 */
+ { 2472, 2472, 20, 0, 20, 5, NO_DFS, PSCAN_WWR | IS_ECM_CHAN, 0, 0}, /* WG1_2472_2472 */
+ { 2472, 2472, 20, 0, 20, 5, NO_DFS, NO_PSCAN | IS_ECM_CHAN, 0, 0}, /* WG2_2472_2472 */
+};
+/*
+ * 2GHz Dynamic turbo tags
+ */
+
+enum {
+ T1_2312_2372,
+ T1_2437_2437,
+ T2_2437_2437,
+ T3_2437_2437,
+ T1_2512_2732
+};
+
+static REG_DMN_FREQ_BAND regDmn2Ghz11gTurboFreq[] = {
+ { 2312, 2372, 5, 6, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* T1_2312_2372 */
+ { 2437, 2437, 5, 6, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* T1_2437_2437 */
+ { 2437, 2437, 20, 6, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* T2_2437_2437 */
+ { 2437, 2437, 18, 6, 40, 40, NO_DFS, PSCAN_WWR, 0, 0}, /* T3_2437_2437 */
+ { 2512, 2732, 5, 6, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* T1_2512_2732 */
+};
+
+
+
+/*
+ * 2GHz 11n frequency tags
+ */
+enum {
+ NG1_2422_2452,
+ NG2_2422_2452,
+ NG3_2422_2452,
+
+ NG_DEMO_ALL_CHANNELS,
+};
+
+static REG_DMN_FREQ_BAND regDmn2Ghz11ngFreq[] = {
+ { 2422, 2452, 20, 0, 40, 5, NO_DFS, NO_PSCAN, 0, 0}, /* NG1_2422_2452 */
+ { 2422, 2452, 27, 0, 40, 5, NO_DFS, NO_PSCAN, 0, 0}, /* NG2_2422_2452 */
+ { 2422, 2452, 30, 0, 40, 5, NO_DFS, NO_PSCAN, 0, 0}, /* NG3_2422_2452 */
+
+ { 2312, 2732, 27, 6, 20, 5, NO_DFS, NO_PSCAN, 0, 0}, /* NG_DEMO_ALL_CHANNELS */
+};
+
+
+/*
+ * 5GHz 11n frequency tags
+ */
+enum {
+ NA1_5190_5230,
+ NA2_5190_5230,
+ NA3_5190_5230,
+ NA4_5190_5230,
+ NA5_5190_5230,
+
+ NA1_5270_5270,
+
+ NA1_5270_5310,
+ NA2_5270_5310,
+ NA3_5270_5310,
+ NA4_5270_5310,
+
+ NA1_5310_5310,
+
+ NA1_5510_5630,
+
+ NA1_5510_5670,
+ NA2_5510_5670,
+ NA3_5510_5670,
+
+ NA1_5755_5795,
+ NA2_5755_5795,
+ NA3_5755_5795,
+ NA4_5755_5795,
+ NA5_5755_5795,
+
+ NA1_5795_5795,
+
+ NA_DEMO_ALL_CHANNELS,
+};
+
+static REG_DMN_FREQ_BAND regDmn5Ghz11naFreq[] = {
+ /*
+ * ToDo: This table needs to be completely populated with 5GHz 11n properties
+ */
+ { 5190, 5230, 15, 0, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* NA1_5190_5230 */
+ { 5190, 5230, 17, 6, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* NA2_5190_5230 */
+ { 5190, 5230, 18, 6, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* NA3_5190_5230 */
+ { 5190, 5230, 20, 0, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* NA4_5190_5230 */
+ { 5190, 5230, 23, 6, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* NA5_5190_5230 */
+
+ { 5270, 5270, 23, 6, 40, 40, DFS_FCC3|DFS_ETSI, NO_PSCAN, 0, 1}, /* NA1_5270_5270 */
+
+ { 5270, 5310, 18, 6, 40, 40, DFS_FCC3|DFS_ETSI, NO_PSCAN, 0, 1}, /* NA1_5270_5310 */
+ { 5270, 5310, 20, 0, 40, 40, DFS_FCC3|DFS_ETSI|DFS_MKK4, NO_PSCAN, 0, 1}, /* NA2_5270_5310 */
+ { 5270, 5310, 23, 6, 40, 40, DFS_FCC3|DFS_ETSI, NO_PSCAN, 0, 1}, /* NA3_5270_5310 */
+ { 5270, 5310, 30, 6, 40, 40, DFS_FCC3|DFS_ETSI, NO_PSCAN, 0, 1}, /* NA4_5270_5310 */
+
+ { 5310, 5310, 17, 6, 40, 40, DFS_FCC3|DFS_ETSI, NO_PSCAN, 0, 1}, /* NA1_5310_5310 */
+
+ { 5510, 5630, 30, 6, 40, 40, DFS_FCC3|DFS_ETSI, NO_PSCAN, 0, 1}, /* NA1_5510_5630 */
+
+ { 5510, 5670, 20, 6, 40, 40, DFS_FCC3|DFS_ETSI|DFS_MKK4, NO_PSCAN, 0, 1}, /* NA1_5510_5670 */
+ { 5510, 5670, 27, 0, 40, 40, DFS_FCC3|DFS_ETSI, NO_PSCAN, 0, 1}, /* NA2_5510_5670 */
+ { 5510, 5670, 30, 6, 40, 40, DFS_FCC3, NO_PSCAN, 0, 1}, /* NA3_5510_5670 */
+
+ { 5755, 5795, 17, 0, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* NA1_5755_5795 */
+ { 5755, 5795, 20, 6, 40, 40, DFS_ETSI, NO_PSCAN, 0, 0}, /* NA2_5755_5795 */
+ { 5755, 5795, 23, 0, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* NA3_5755_5795 */
+ { 5755, 5795, 30, 0, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* NA4_5755_5795 */
+ { 5755, 5795, 30, 6, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* NA5_5755_5795 */
+
+ { 5795, 5795, 30, 6, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* NA1_5795_5795 */
+
+ { 4920, 6100, 30, 6, 40, 40, NO_DFS, NO_PSCAN, 0, 0}, /* NA_DEMO_ALL_CHANNELS */
+};
+
+typedef struct regDomain {
+ u16_t regDmnEnum; /* value from EnumRd table */
+ u8_t conformanceTestLimit;
+ u64_t dfsMask; /* DFS bitmask for 5Ghz tables */
+ u64_t pscan; /* Bitmask for passive scan */
+ u32_t flags; /* Requirement flags (AdHoc disallow, noise
+ floor cal needed, etc) */
+ u64_t chan11a[BMLEN];/* 128 bit bitmask for channel/band
+ selection */
+ u64_t chan11a_turbo[BMLEN];/* 128 bit bitmask for channel/band
+ selection */
+ u64_t chan11a_dyn_turbo[BMLEN]; /* 128 bit bitmask for channel/band
+ selection */
+ u64_t chan11b[BMLEN];/* 128 bit bitmask for channel/band
+ selection */
+ u64_t chan11g[BMLEN];/* 128 bit bitmask for channel/band
+ selection */
+ u64_t chan11g_turbo[BMLEN];/* 128 bit bitmask for channel/band
+ selection */
+ u64_t chan11ng[BMLEN];/* 128 bit bitmask for 11n in 2GHz */
+ u64_t chan11na[BMLEN];/* 128 bit bitmask for 11n in 5GHz */
+} REG_DOMAIN;
+
+static REG_DOMAIN regDomains[] = {
+
+ {DEBUG_REG_DMN, FCC, NO_DFS, NO_PSCAN, NO_REQ,
+ BM(F1_5120_5240, F1_5260_5700, F1_5745_5825, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(T1_5130_5210, T1_5250_5330, T1_5370_5490, T1_5530_5650, T1_5150_5190, T1_5230_5310, T1_5350_5470, T1_5510_5670, -1, -1, -1, -1),
+ BM(T1_5200_5240, T1_5280_5280, T1_5540_5660, T1_5765_5805, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(F1_2312_2372, F1_2412_2472, F1_2484_2484, F1_2512_2732, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(G1_2312_2372, G1_2412_2472, G1_2512_2732, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(T1_2312_2372, T1_2437_2437, T1_2512_2732, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(NG_DEMO_ALL_CHANNELS, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(NA_DEMO_ALL_CHANNELS, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ {APL1, ETSI, NO_DFS, NO_PSCAN, NO_REQ,
+ BM(F4_5745_5825, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA4_5755_5795, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ {APL2, ETSI, NO_DFS, NO_PSCAN, NO_REQ,
+ BM(F1_5745_5805, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA3_5755_5795, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ {APL3, FCC, NO_DFS, NO_PSCAN, NO_REQ,
+ BM(F1_5280_5320, F2_5745_5805, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA1_5310_5310, NA4_5755_5795, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ {APL4, ETSI, NO_DFS, NO_PSCAN, NO_REQ,
+ BM(F4_5180_5240, F3_5745_5825, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA4_5190_5230, NA2_5755_5795, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ {APL5, ETSI, NO_DFS, NO_PSCAN, NO_REQ,
+ BM(F2_5745_5825, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA1_5755_5795, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ {APL6, ETSI, DFS_ETSI, PSCAN_FCC_T | PSCAN_FCC , NO_REQ,
+ BM(F4_5180_5240, F2_5260_5320, F3_5745_5825, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(T2_5210_5210, T1_5250_5290, T1_5760_5800, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA4_5190_5230, NA2_5270_5310, NA2_5755_5795, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ {APL7, FCC, NO_DFS, PSCAN_FCC_T | PSCAN_FCC , NO_REQ,
+ BM(F7_5260_5320, F4_5500_5700, F3_5745_5805, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA1_5310_5310, NA2_5755_5795, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+ {APL8, ETSI, NO_DFS, NO_PSCAN, DISALLOW_ADHOC_11A|DISALLOW_ADHOC_11A_TURB,
+ BM(F6_5260_5320, F4_5745_5825, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA4_5270_5310, NA4_5755_5795, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ {APL9, ETSI, DFS_ETSI, PSCAN_ETSI, DISALLOW_ADHOC_11A|DISALLOW_ADHOC_11A_TURB,
+ BM(F1_5180_5320, F1_5500_5620, F3_5745_5805, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA4_5190_5230, NA2_5270_5310, NA1_5510_5630, NA4_5755_5795, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ {ETSI1, ETSI, DFS_ETSI, PSCAN_ETSI, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB,
+ BM(W2_5180_5240, F2_5260_5320, F2_5500_5700, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA4_5190_5230, NA2_5270_5310, NA2_5510_5670, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ {ETSI2, ETSI, DFS_ETSI, PSCAN_ETSI, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB,
+ BM(F3_5180_5240, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA3_5190_5230, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ {ETSI3, ETSI, DFS_ETSI, PSCAN_ETSI, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB,
+ BM(W2_5180_5240, F2_5260_5320, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA4_5190_5230, NA2_5270_5310, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ {ETSI4, ETSI, DFS_ETSI, PSCAN_ETSI, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB,
+ BM(F3_5180_5240, F1_5260_5320, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA3_5190_5230, NA1_5270_5310, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ {ETSI5, ETSI, DFS_ETSI, PSCAN_ETSI, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB,
+ BM(F1_5180_5240, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA1_5190_5230, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ {ETSI6, ETSI, DFS_ETSI, PSCAN_ETSI, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB,
+ BM(F5_5180_5240, F1_5260_5280, F3_5500_5700, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA5_5190_5230, NA1_5270_5270, NA3_5510_5670, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ {FCC1, FCC, NO_DFS, NO_PSCAN, NO_REQ,
+ BM(F2_5180_5240, F4_5260_5320, F5_5745_5825, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(T1_5210_5210, T2_5250_5290, T2_5760_5800, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(T1_5200_5240, T1_5280_5280, T1_5765_5805, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA2_5190_5230, NA3_5270_5310, NA4_5755_5795, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ {FCC2, FCC, NO_DFS, NO_PSCAN, NO_REQ,
+ BM(F6_5180_5240, F5_5260_5320, F6_5745_5825, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(T2_5200_5240, T1_5280_5280, T1_5765_5805, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA5_5190_5230, NA3_5270_5310, NA4_5755_5795, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ {FCC3, FCC, DFS_FCC3, PSCAN_FCC | PSCAN_FCC_T, NO_REQ,
+ BM(F2_5180_5240, F3_5260_5320, F1_5500_5700, F5_5745_5825, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(T1_5210_5210, T1_5250_5250, T1_5290_5290, T2_5760_5800, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(T1_5200_5240, T2_5280_5280, T1_5540_5660, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA2_5190_5230, NA2_5270_5310, NA3_5510_5670, NA4_5755_5795, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ {FCC4, FCC, DFS_FCC3, PSCAN_FCC | PSCAN_FCC_T, NO_REQ,
+ BM(F1_4942_4987, F1_4945_4985, F1_4950_4980, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO},
+
+ {FCC5, FCC, NO_DFS, NO_PSCAN, NO_REQ,
+ BM(F2_5180_5240, F5_5745_5825, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA2_5190_5230, NA4_5755_5795, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ {FCC6, FCC, DFS_FCC3, PSCAN_FCC, NO_REQ,
+ BM(F7_5180_5240, F5_5260_5320, F1_5500_5580, F1_5660_5700, F6_5745_5825, -1, -1, -1, -1, -1, -1, -1),
+ BM(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(T2_5200_5240, T1_5280_5280, T1_5765_5805, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA5_5190_5230, NA5_5755_5795, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ {MKK1, MKK, NO_DFS, PSCAN_MKK1, DISALLOW_ADHOC_11A_TURB,
+ BM(F1_5170_5230, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO},
+
+ {MKK2, MKK, NO_DFS, PSCAN_MKK2, DISALLOW_ADHOC_11A_TURB,
+ BM(F1_4915_4925, F1_4935_4945, F1_4920_4980, F1_5035_5040, F1_5055_5055, F1_5040_5080, F1_5170_5230, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO},
+
+ /* UNI-1 even */
+ {MKK3, MKK, NO_DFS, PSCAN_MKK3, DISALLOW_ADHOC_11A_TURB,
+ BM(F4_5180_5240, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA4_5190_5230, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ /* UNI-1 even + UNI-2 */
+ {MKK4, MKK, DFS_MKK4, PSCAN_MKK3, DISALLOW_ADHOC_11A_TURB,
+ BM(F4_5180_5240, F2_5260_5320, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA4_5190_5230, NA2_5270_5310, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ /* UNI-1 even + UNI-2 + mid-band */
+ {MKK5, MKK, DFS_MKK4, PSCAN_MKK3, DISALLOW_ADHOC_11A_TURB,
+ BM(F4_5180_5240, F2_5260_5320, F4_5500_5700, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA4_5190_5230, NA2_5270_5310, NA1_5510_5670, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ /* UNI-1 odd + even */
+ {MKK6, MKK, DFS_MKK4, PSCAN_MKK1, DISALLOW_ADHOC_11A_TURB,
+ BM(F2_5170_5230, F4_5180_5240, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA4_5190_5230, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ /* UNI-1 odd + UNI-1 even + UNI-2 */
+ {MKK7, MKK, DFS_MKK4, PSCAN_MKK1 | PSCAN_MKK3 , DISALLOW_ADHOC_11A_TURB,
+ BM(F2_5170_5230, F4_5180_5240, F2_5260_5320, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA4_5190_5230, NA2_5270_5310, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ /* UNI-1 odd + UNI-1 even + UNI-2 + mid-band */
+ {MKK8, MKK, DFS_MKK4, PSCAN_MKK1 | PSCAN_MKK3 , DISALLOW_ADHOC_11A_TURB,
+ BM(F2_5170_5230, F4_5180_5240, F2_5260_5320, F4_5500_5700, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(NA4_5190_5230, NA2_5270_5310, NA1_5510_5670, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
+
+ /* UNI-1 even + 4.9 GHZ */
+ {MKK9, MKK, NO_DFS, NO_PSCAN, DISALLOW_ADHOC_11A_TURB,
+ BM(F1_4915_4925, F1_4935_4945, F1_4920_4980, F1_5035_5040, F1_5055_5055, F1_5040_5080, F4_5180_5240, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO},
+
+ /* UNI-1 even + UNI-2 + 4.9 GHZ */
+ {MKK10, MKK, DFS_MKK4, PSCAN_MKK3, DISALLOW_ADHOC_11A_TURB,
+ BM(F1_4915_4925, F1_4935_4945, F1_4920_4980, F1_5035_5040, F1_5055_5055, F1_5040_5080, F4_5180_5240, F2_5260_5320, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO},
+
+ /* UNI-1 even + UNI-2 + 4.9 GHZ + mid-band */
+ {MKK11, MKK, DFS_MKK4, PSCAN_MKK3, DISALLOW_ADHOC_11A_TURB,
+ BM(F1_4915_4925, F1_4935_4945, F1_4920_4980, F1_5035_5040, F1_5055_5055, F1_5040_5080, F4_5180_5240, F2_5260_5320, F4_5500_5700, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO},
+
+ /* UNI-1 even + UNI-1 odd + UNI-2 + 4.9 GHZ + mid-band */
+ {MKK12, MKK, DFS_MKK4, PSCAN_MKK3, DISALLOW_ADHOC_11A_TURB,
+ BM(F1_4915_4925, F1_4935_4945, F1_4920_4980, F1_5035_5040, F1_5055_5055, F1_5040_5080, F1_5170_5230, F4_5180_5240, F2_5260_5320, F4_5500_5700, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO},
+
+ /* Defined here to use when 2G channels are authorised for country K2 */
+ {APLD, NO_CTL, NO_DFS, NO_PSCAN, NO_REQ,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(F2_2312_2372,F2_2412_2472, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(G2_2312_2372,G2_2412_2472, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BMZERO},
+
+ {ETSIA, NO_CTL, NO_DFS, PSCAN_ETSIA, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(F1_2457_2472,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(G1_2457_2472,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(T2_2437_2437,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO},
+
+ {ETSIB, ETSI, NO_DFS, PSCAN_ETSIB, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(F1_2432_2442,-1,-1,-1,-1,-1,-1,-1, -1, -1, -1, -1),
+ BM(G1_2432_2442,-1,-1,-1,-1,-1,-1,-1, -1, -1, -1, -1),
+ BM(T2_2437_2437,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO},
+
+ {ETSIC, ETSI, NO_DFS, PSCAN_ETSIC, DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(F3_2412_2472,-1,-1,-1,-1,-1,-1,-1, -1, -1, -1, -1),
+ BM(G3_2412_2472,-1,-1,-1,-1,-1,-1,-1, -1, -1, -1, -1),
+ BM(T2_2437_2437,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO},
+
+ {FCCA, FCC, NO_DFS, NO_PSCAN, NO_REQ,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(F1_2412_2462,-1,-1,-1,-1,-1,-1,-1, -1, -1, -1, -1),
+ BM(G1_2412_2462,-1,-1,-1,-1,-1,-1,-1, -1, -1, -1, -1),
+ BM(T2_2437_2437,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(NG2_2422_2452,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO},
+
+ {MKKA, MKK, NO_DFS, PSCAN_MKKA | PSCAN_MKKA_G | PSCAN_MKKA1 | PSCAN_MKKA1_G | PSCAN_MKKA2 | PSCAN_MKKA2_G, DISALLOW_ADHOC_11A_TURB,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(F2_2412_2462, F1_2467_2472, F2_2484_2484, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(G2_2412_2462, G1_2467_2472, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(T2_2437_2437,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(NG1_2422_2452,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO},
+
+ {MKKC, MKK, NO_DFS, NO_PSCAN, NO_REQ,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(F2_2412_2472,-1,-1,-1,-1,-1,-1,-1, -1, -1, -1, -1),
+ BM(G2_2412_2472,-1,-1,-1,-1,-1,-1,-1, -1, -1, -1, -1),
+ BM(T2_2437_2437,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(NG1_2422_2452,-1,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO},
+
+ {WORLD, ETSI, NO_DFS, NO_PSCAN, NO_REQ,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BM(F2_2412_2472,-1,-1,-1,-1,-1,-1,-1, -1, -1, -1, -1),
+ BM(G2_2412_2472,-1,-1,-1,-1,-1,-1,-1, -1, -1, -1, -1),
+ BM(T2_2437_2437,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(NG1_2422_2452,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO},
+
+ {WOR0_WORLD, NO_CTL, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, ADHOC_PER_11D,
+ BM(W1_5260_5320, W1_5180_5240, W1_5170_5230, W1_5745_5825, W1_5500_5700, -1, -1, -1, -1, -1, -1, -1),
+ BM(WT1_5210_5250, WT1_5290_5290, WT1_5760_5800, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BM(W1_2412_2412,W1_2437_2442,W1_2462_2462,W1_2472_2472,W1_2417_2432, W1_2447_2457, W1_2467_2467, W1_2484_2484, -1, -1, -1, -1),
+ BM(WG1_2412_2412,WG1_2437_2442,WG1_2462_2462,WG1_2472_2472,WG1_2417_2432,WG1_2447_2457,WG1_2467_2467, -1, -1, -1, -1, -1),
+ BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO},
+
+ {WOR01_WORLD, NO_CTL, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, ADHOC_PER_11D,
+ BM(W1_5260_5320, W1_5180_5240, W1_5170_5230, W1_5745_5825, W1_5500_5700, -1, -1, -1, -1, -1, -1, -1),
+ BM(WT1_5210_5250, WT1_5290_5290, WT1_5760_5800, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BM(W1_2412_2412, W1_2437_2442, W1_2462_2462, W1_2417_2432, W1_2447_2457, -1, -1, -1, -1, -1, -1, -1),
+ BM(WG1_2412_2412, WG1_2437_2442, WG1_2462_2462, WG1_2417_2432, WG1_2447_2457, -1, -1, -1, -1, -1, -1, -1),
+ BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO},
+
+ {WOR02_WORLD, NO_CTL, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, ADHOC_PER_11D,
+ BM(W1_5260_5320, W1_5180_5240,W1_5170_5230,W1_5745_5825,W1_5500_5700, -1, -1, -1, -1, -1, -1, -1),
+ BM(WT1_5210_5250, WT1_5290_5290, WT1_5760_5800, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BM(W1_2412_2412,W1_2437_2442,W1_2462_2462, W1_2472_2472,W1_2417_2432, W1_2447_2457, W1_2467_2467, -1, -1, -1, -1, -1),
+ BM(WG1_2412_2412,WG1_2437_2442,WG1_2462_2462, WG1_2472_2472,WG1_2417_2432, WG1_2447_2457, WG1_2467_2467, -1, -1, -1, -1, -1),
+ BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO},
+
+ {EU1_WORLD, NO_CTL, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, ADHOC_PER_11D,
+ BM(W1_5260_5320, W1_5180_5240,W1_5170_5230,W1_5745_5825,W1_5500_5700, -1, -1, -1, -1, -1, -1, -1),
+ BM(WT1_5210_5250, WT1_5290_5290, WT1_5760_5800, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BM(W1_2412_2412,W1_2437_2442,W1_2462_2462, W2_2472_2472,W1_2417_2432, W1_2447_2457, W2_2467_2467, -1, -1, -1, -1, -1),
+ BM(WG1_2412_2412,WG1_2437_2442,WG1_2462_2462, WG2_2472_2472,WG1_2417_2432, WG1_2447_2457, WG2_2467_2467, -1, -1, -1, -1, -1),
+ BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO},
+
+ {WOR1_WORLD, NO_CTL, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, ADHOC_NO_11A,
+ BM(W1_5260_5320, W1_5180_5240, W1_5170_5230, W1_5745_5825, W1_5500_5700, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BM(W1_2412_2412,W1_2437_2442,W1_2462_2462,W1_2472_2472,W1_2417_2432, W1_2447_2457, W1_2467_2467, W1_2484_2484, -1, -1, -1, -1),
+ BM(WG1_2412_2412,WG1_2437_2442,WG1_2462_2462,WG1_2472_2472,WG1_2417_2432,WG1_2447_2457,WG1_2467_2467, -1, -1, -1, -1, -1),
+ BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO},
+
+ {WOR2_WORLD, NO_CTL, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, ADHOC_NO_11A,
+ BM(W1_5260_5320, W1_5180_5240, W1_5170_5230, W1_5745_5825, W1_5500_5700, -1, -1, -1, -1, -1, -1, -1),
+ BM(WT1_5210_5250, WT1_5290_5290, WT1_5760_5800, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BM(W1_2412_2412,W1_2437_2442,W1_2462_2462,W1_2472_2472,W1_2417_2432, W1_2447_2457, W1_2467_2467, W1_2484_2484, -1, -1, -1, -1),
+ BM(WG1_2412_2412,WG1_2437_2442,WG1_2462_2462,WG1_2472_2472,WG1_2417_2432,WG1_2447_2457,WG1_2467_2467, -1, -1, -1, -1, -1),
+ BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO},
+
+ {WOR3_WORLD, NO_CTL, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, ADHOC_PER_11D,
+ BM(W1_5260_5320, W1_5180_5240, W1_5170_5230, W1_5745_5825, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(WT1_5210_5250, WT1_5290_5290, WT1_5760_5800, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BM(W1_2412_2412,W1_2437_2442,W1_2462_2462,W1_2472_2472,W1_2417_2432, W1_2447_2457, W1_2467_2467, -1, -1, -1, -1, -1),
+ BM(WG1_2412_2412,WG1_2437_2442,WG1_2462_2462,WG1_2472_2472,WG1_2417_2432,WG1_2447_2457,WG1_2467_2467,-1, -1, -1, -1, -1),
+ BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO},
+
+ {WOR4_WORLD, NO_CTL, DFS_FCC3, PSCAN_WWR, ADHOC_NO_11A,
+ BM(W2_5260_5320, W2_5180_5240, F2_5745_5805, W2_5825_5825, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(WT1_5210_5250, WT1_5290_5290, WT1_5760_5800, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BM(W1_2412_2412,W1_2437_2442,W1_2462_2462, W1_2417_2432,W1_2447_2457,-1, -1, -1, -1, -1, -1, -1),
+ BM(WG1_2412_2412,WG1_2437_2442,WG1_2462_2462, WG1_2417_2432,WG1_2447_2457,-1, -1, -1, -1, -1, -1, -1),
+ BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO},
+
+ {WOR5_ETSIC, NO_CTL, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, ADHOC_NO_11A,
+ BM(W1_5260_5320, W2_5180_5240, F6_5745_5825, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BM(W1_2412_2412, W1_2437_2442, W1_2462_2462, W2_2472_2472, W1_2417_2432, W1_2447_2457, W2_2467_2467, -1, -1, -1, -1, -1),
+ BM(WG1_2412_2412, WG1_2437_2442, WG1_2462_2462, WG1_2472_2472, WG1_2417_2432, WG1_2447_2457, WG1_2467_2467, -1, -1, -1, -1, -1),
+ BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO},
+
+ {WOR9_WORLD, NO_CTL, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, ADHOC_NO_11A,
+ BM(W1_5260_5320, W1_5180_5240, W1_5745_5825, W1_5500_5700, -1, -1, -1, -1, -1, -1, -1, -1),
+ BM(WT1_5210_5250, WT1_5290_5290, WT1_5760_5800, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BM(W1_2412_2412, W1_2437_2442, W1_2462_2462, W1_2417_2432, W1_2447_2457, -1, -1, -1, -1, -1, -1, -1),
+ BM(WG1_2412_2412, WG1_2437_2442, WG1_2462_2462, WG1_2417_2432, WG1_2447_2457, -1, -1, -1, -1, -1, -1, -1),
+ BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO},
+
+ {WORA_WORLD, NO_CTL, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, ADHOC_NO_11A,
+ BM(W1_5260_5320, W1_5180_5240, W1_5745_5825, W1_5500_5700, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO,
+ BM(W1_2412_2412, W1_2437_2442, W1_2462_2462, W1_2472_2472, W1_2417_2432, W1_2447_2457, W1_2467_2467, -1, -1, -1, -1, -1),
+ BM(WG1_2412_2412, WG1_2437_2442, WG1_2462_2462, WG1_2472_2472, WG1_2417_2432, WG1_2447_2457, WG1_2467_2467, -1, -1, -1, -1, -1),
+ BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
+ BMZERO,
+ BMZERO},
+
+ {NULL1, NO_CTL, NO_DFS, NO_PSCAN, NO_REQ,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO,
+ BMZERO},
+};
+
+struct cmode {
+ u16_t mode;
+ u32_t flags;
+};
+
+static const struct cmode modes[] = {
+ { HAL_MODE_TURBO, CHANNEL_ST}, /* TURBO means 11a Static Turbo */
+ { HAL_MODE_11A, CHANNEL_A},
+ { HAL_MODE_11B, CHANNEL_B},
+ { HAL_MODE_11G, CHANNEL_G},
+ { HAL_MODE_11G_TURBO, CHANNEL_108G},
+ { HAL_MODE_11A_TURBO, CHANNEL_108A},
+ { HAL_MODE_11NA, CHANNEL_A_HT40},
+ { HAL_MODE_11NA, CHANNEL_A_HT20},
+ { HAL_MODE_11NG, CHANNEL_G_HT40},
+ { HAL_MODE_11NG, CHANNEL_G_HT20},
+};
+
+/*
+ * Return the Wireless Mode Regulatory Domain based
+ * on the country code and the wireless mode.
+ */
+u8_t GetWmRD(u16_t regionCode, u16_t channelFlag, REG_DOMAIN *rd)
+{
+ s16_t i, found, regDmn;
+ u64_t flags=NO_REQ;
+ REG_DMN_PAIR_MAPPING *regPair=NULL;
+
+ for (i=0, found=0; (i<N(regDomainPairs))&&(!found); i++)
+ {
+ if (regDomainPairs[i].regDmnEnum == regionCode)
+ {
+ regPair = &regDomainPairs[i];
+ found = 1;
+ }
+ }
+ if (!found)
+ {
+ zm_debug_msg1("Failed to find reg domain pair ", regionCode);
+ return FALSE;
+ }
+
+ if (channelFlag & ZM_REG_FLAG_CHANNEL_2GHZ)
+ {
+ regDmn = regPair->regDmn2GHz;
+ flags = regPair->flags2GHz;
+ }
+ else
+ {
+ regDmn = regPair->regDmn5GHz;
+ flags = regPair->flags5GHz;
+ }
+
+ /*
+ * We either started with a unitary reg domain or we've found the
+ * unitary reg domain of the pair
+ */
+
+ for (i=0;i<N(regDomains); i++)
+ {
+ if (regDomains[i].regDmnEnum == regDmn)
+ {
+ if (rd != NULL)
+ {
+ zfMemoryCopy((u8_t *)rd, (u8_t *)&regDomains[i],
+ sizeof(REG_DOMAIN));
+ }
+ }
+ }
+ rd->pscan &= regPair->pscanMask;
+ rd->flags = (u32_t)flags;
+ return TRUE;
+}
+
+/*
+ * Test to see if the bitmask array is all zeros
+ */
+u8_t isChanBitMaskZero(u64_t *bitmask)
+{
+ u16_t i;
+
+ for (i=0; i<BMLEN; i++) {
+ if (bitmask[i] != 0)
+ return FALSE;
+ }
+ return TRUE;
+}
+
+u8_t IS_BIT_SET(u32_t bit, u64_t *bitmask)
+{
+ u32_t byteOffset, bitnum;
+ u64_t val;
+
+ byteOffset = bit/64;
+ bitnum = bit - byteOffset*64;
+ val = ((u64_t) 1) << bitnum;
+ if (bitmask[byteOffset] & val)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+
+void zfHpGetRegulationTable(zdev_t* dev, u16_t regionCode, u16_t c_lo, u16_t c_hi)
+{
+ REG_DOMAIN rd5GHz, rd2GHz;
+ const struct cmode *cm;
+ s16_t next=0,b;
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+
+ zmw_declare_for_critical_section();
+
+ if (!GetWmRD(regionCode, ~ZM_REG_FLAG_CHANNEL_2GHZ, &rd5GHz))
+ {
+ zm_debug_msg1("couldn't find unitary 5GHz reg domain for Region Code ", regionCode);
+ return;
+ }
+ if (!GetWmRD(regionCode, ZM_REG_FLAG_CHANNEL_2GHZ, &rd2GHz))
+ {
+ zm_debug_msg1("couldn't find unitary 2GHz reg domain for Region Code ", regionCode);
+ return;
+ }
+ if (wd->regulationTable.regionCode == regionCode)
+ {
+ zm_debug_msg1("current region code is the same with Region Code ", regionCode);
+ return;
+ }
+ else
+ {
+ wd->regulationTable.regionCode = regionCode;
+ }
+
+ next = 0;
+
+ zmw_enter_critical_section(dev);
+
+ for (cm = modes; cm < &modes[N(modes)]; cm++)
+ {
+ u16_t c;
+ u64_t *channelBM=NULL;
+ REG_DOMAIN *rd=NULL;
+ REG_DMN_FREQ_BAND *fband=NULL,*freqs=NULL;
+
+ switch (cm->mode)
+ {
+ case HAL_MODE_TURBO:
+ //we don't have turbo mode so we disable it
+ //zm_debug_msg0("CWY - HAL_MODE_TURBO");
+ channelBM = NULL;
+ //rd = &rd5GHz;
+ //channelBM = rd->chan11a_turbo;
+ //freqs = &regDmn5GhzTurboFreq[0];
+ //ctl = rd->conformanceTestLimit | CTL_TURBO;
+ break;
+ case HAL_MODE_11A:
+ if ((hpPriv->OpFlags & 0x1) != 0)
+ {
+ rd = &rd5GHz;
+ channelBM = rd->chan11a;
+ freqs = &regDmn5GhzFreq[0];
+ c_lo = 4920; //from channel 184
+ c_hi = 5825; //to channel 165
+ //ctl = rd->conformanceTestLimit;
+ //zm_debug_msg2("CWY - HAL_MODE_11A, channelBM = 0x", *channelBM);
+ }
+ //else
+ {
+ //channelBM = NULL;
+ }
+ break;
+ case HAL_MODE_11B:
+ //Disable 11B mode because it only has difference with 11G in PowerDFS Data,
+ //and we don't use this now.
+ //zm_debug_msg0("CWY - HAL_MODE_11B");
+ channelBM = NULL;
+ //rd = &rd2GHz;
+ //channelBM = rd->chan11b;
+ //freqs = &regDmn2GhzFreq[0];
+ //ctl = rd->conformanceTestLimit | CTL_11B;
+ //zm_debug_msg2("CWY - HAL_MODE_11B, channelBM = 0x", *channelBM);
+ break;
+ case HAL_MODE_11G:
+ if ((hpPriv->OpFlags & 0x2) != 0)
+ {
+ rd = &rd2GHz;
+ channelBM = rd->chan11g;
+ freqs = &regDmn2Ghz11gFreq[0];
+ c_lo = 2412; //from channel 1
+ //c_hi = 2462; //to channel 11
+ c_hi = 2472; //to channel 13
+ //ctl = rd->conformanceTestLimit | CTL_11G;
+ //zm_debug_msg2("CWY - HAL_MODE_11G, channelBM = 0x", *channelBM);
+ }
+ //else
+ {
+ //channelBM = NULL;
+ }
+ break;
+ case HAL_MODE_11G_TURBO:
+ //we don't have turbo mode so we disable it
+ //zm_debug_msg0("CWY - HAL_MODE_11G_TURBO");
+ channelBM = NULL;
+ //rd = &rd2GHz;
+ //channelBM = rd->chan11g_turbo;
+ //freqs = &regDmn2Ghz11gTurboFreq[0];
+ //ctl = rd->conformanceTestLimit | CTL_108G;
+ break;
+ case HAL_MODE_11A_TURBO:
+ //we don't have turbo mode so we disable it
+ //zm_debug_msg0("CWY - HAL_MODE_11A_TURBO");
+ channelBM = NULL;
+ //rd = &rd5GHz;
+ //channelBM = rd->chan11a_dyn_turbo;
+ //freqs = &regDmn5GhzTurboFreq[0];
+ //ctl = rd->conformanceTestLimit | CTL_108G;
+ break;
+ default:
+ zm_debug_msg1("Unkonwn HAL mode ", cm->mode);
+ continue;
+ }
+ if (channelBM == NULL)
+ {
+ //zm_debug_msg0("CWY - channelBM is NULL");
+ continue;
+ }
+ if (isChanBitMaskZero(channelBM))
+ {
+ //zm_debug_msg0("CWY - BitMask is Zero");
+ continue;
+ }
+
+ // RAY:Is it ok??
+ if (freqs == NULL )
+ {
+ continue;
+ }
+
+ for (b=0;b<64*BMLEN; b++)
+ {
+ if (IS_BIT_SET(b,channelBM))
+ {
+ fband = &freqs[b];
+
+ //zm_debug_msg1("CWY - lowChannel = ", fband->lowChannel);
+ //zm_debug_msg1("CWY - highChannel = ", fband->highChannel);
+ //zm_debug_msg1("CWY - channelSep = ", fband->channelSep);
+ for (c=fband->lowChannel; c <= fband->highChannel;
+ c += fband->channelSep)
+ {
+ ZM_HAL_CHANNEL icv;
+
+ //Disable all DFS channel
+ if ((hpPriv->disableDfsCh==0) || (!(fband->useDfs & rd->dfsMask)))
+ {
+ if( fband->channelBW < 20 )
+ {
+ /**************************************************************/
+ /* */
+ /* Temporary discard channel that BW < 20MHz (5 or 10MHz) */
+ /* Our architecture does not implemnt it !!! */
+ /* */
+ /**************************************************************/
+ continue;
+ }
+ if ((c >= c_lo) && (c <= c_hi))
+ {
+ icv.channel = c;
+ icv.channelFlags = cm->flags;
+ icv.maxRegTxPower = fband->powerDfs;
+ if (fband->usePassScan & rd->pscan)
+ icv.channelFlags |= ZM_REG_FLAG_CHANNEL_PASSIVE;
+ else
+ icv.channelFlags &= ~ZM_REG_FLAG_CHANNEL_PASSIVE;
+ if (fband->useDfs & rd->dfsMask)
+ icv.privFlags = ZM_REG_FLAG_CHANNEL_DFS;
+ else
+ icv.privFlags = 0;
+
+ /* For now disable radar for FCC3 */
+ if (fband->useDfs & rd->dfsMask & DFS_FCC3)
+ {
+ icv.privFlags &= ~ZM_REG_FLAG_CHANNEL_DFS;
+ icv.privFlags |= ZM_REG_FLAG_CHANNEL_DFS_CLEAR;
+ }
+
+ if(rd->flags & LIMIT_FRAME_4MS)
+ icv.privFlags |= ZM_REG_FLAG_CHANNEL_DFS_CLEAR;
+
+ icv.minTxPower = 0;
+ icv.maxTxPower = 0;
+
+ zm_assert(next < 60);
+
+ wd->regulationTable.allowChannel[next++] = icv;
+ }
+ }
+ }
+ }
+ }
+ }
+ wd->regulationTable.allowChannelCnt = next;
+
+ #if 0
+ {
+ /* debug print */
+ u32_t i;
+ DbgPrint("\n-------------------------------------------\n");
+ DbgPrint("zfHpGetRegulationTable print all channel info regincode = 0x%x\n", wd->regulationTable.regionCode);
+ DbgPrint("index channel channelFlags maxRegTxPower privFlags useDFS\n");
+
+ for (i=0; i<wd->regulationTable.allowChannelCnt; i++)
+ {
+ DbgPrint("%02d %d %04x %02d %x %x\n",
+ i,
+ wd->regulationTable.allowChannel[i].channel,
+ wd->regulationTable.allowChannel[i].channelFlags,
+ wd->regulationTable.allowChannel[i].maxRegTxPower,
+ wd->regulationTable.allowChannel[i].privFlags,
+ wd->regulationTable.allowChannel[i].privFlags & ZM_REG_FLAG_CHANNEL_DFS);
+ }
+ }
+ #endif
+
+ zmw_leave_critical_section(dev);
+}
+
+void zfHpGetRegulationTablefromRegionCode(zdev_t* dev, u16_t regionCode)
+{
+ u16_t c_lo = 2000, c_hi = 6000; //default channel is all enable
+ u8_t isoName[3] = {'N', 'A', 0};
+
+ zfCoreSetIsoName(dev, isoName);
+
+ zfHpGetRegulationTable(dev, regionCode, c_lo, c_hi);
+}
+
+void zfHpGetRegulationTablefromCountry(zdev_t* dev, u16_t CountryCode)
+{
+ u16_t i;
+ u16_t c_lo = 2000, c_hi = 6000; //default channel is all enable
+ u16_t RegDomain;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ for (i = 0; i < N(allCountries); i++)
+ {
+ if (CountryCode == allCountries[i].countryCode)
+ {
+ RegDomain = allCountries[i].regDmnEnum;
+
+ // read the ACU country code from EEPROM
+ zfCoreSetIsoName(dev, (u8_t*)allCountries[i].isoName);
+
+ //zm_debug_msg_s("CWY - Country Name = ", allCountries[i].name);
+
+ if (wd->regulationTable.regionCode != RegDomain)
+ {
+ //zm_debug_msg0("CWY - Change regulatory table");
+
+ zfHpGetRegulationTable(dev, RegDomain, c_lo, c_hi);
+ }
+ return;
+ }
+ }
+ zm_debug_msg1("Invalid CountryCode = ", CountryCode);
+}
+
+u8_t zfHpGetRegulationTablefromISO(zdev_t* dev, u8_t *countryInfo, u8_t length)
+{
+ u16_t i;
+ u16_t RegDomain;
+ u16_t c_lo = 2000, c_hi = 6000; //default channel is all enable
+ //u8_t strLen = 2;
+
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ if (countryInfo[4] != 0x20)
+ { // with (I)ndoor/(O)utdoor info
+ //strLen = 3;
+ }
+ //zm_debug_msg_s("Desired iso name = ", isoName);
+ for (i = 0; i < N(allCountries); i++)
+ {
+ //zm_debug_msg_s("Current iso name = ", allCountries[i].isoName);
+ if (zfMemoryIsEqual((u8_t *)allCountries[i].isoName, (u8_t *)&countryInfo[2], length-1))
+ {
+ //DbgPrint("Set current iso name = %s\n", allCountries[i].isoName);
+ //zm_debug_msg0("iso name hit!!");
+
+ RegDomain = allCountries[i].regDmnEnum;
+
+ if (wd->regulationTable.regionCode != RegDomain)
+ {
+ zfHpGetRegulationTable(dev, RegDomain, c_lo, c_hi);
+ }
+
+ //while (index < (countryInfo[1]+2))
+ //{
+ // if (countryInfo[index] <= 14)
+ // {
+ // /* calculate 2.4GHz low boundary channel frequency */
+ // ch = countryInfo[index];
+ // if ( ch == 14 )
+ // c_lo = ZM_CH_G_14;
+ // else
+ // c_lo = ZM_CH_G_1 + (ch - 1) * 5;
+ // /* calculate 2.4GHz high boundary channel frequency */
+ // ch = countryInfo[index] + countryInfo[index + 1] - 1;
+ // if ( ch == 14 )
+ // c_hi = ZM_CH_G_14;
+ // else
+ // c_hi = ZM_CH_G_1 + (ch - 1) * 5;
+ // }
+ // else
+ // {
+ // /* calculate 5GHz low boundary channel frequency */
+ // ch = countryInfo[index];
+ // if ( (ch >= 184)&&(ch <= 196) )
+ // c_lo = 4000 + ch*5;
+ // else
+ // c_lo = 5000 + ch*5;
+ // /* calculate 5GHz high boundary channel frequency */
+ // ch = countryInfo[index] + countryInfo[index + 1] - 1;
+ // if ( (ch >= 184)&&(ch <= 196) )
+ // c_hi = 4000 + ch*5;
+ // else
+ // c_hi = 5000 + ch*5;
+ // }
+ //
+ // zfHpGetRegulationTable(dev, RegDomain, c_lo, c_hi);
+ //
+ // index+=3;
+ //}
+
+ return 0;
+ }
+ }
+ //zm_debug_msg_s("Invalid iso name = ", &countryInfo[2]);
+ return 1;
+}
+
+const char* zfHpGetisoNamefromregionCode(zdev_t* dev, u16_t regionCode)
+{
+ u16_t i;
+
+ for (i = 0; i < N(allCountries); i++)
+ {
+ if (allCountries[i].regDmnEnum == regionCode)
+ {
+ return allCountries[i].isoName;
+ }
+ }
+ /* no matching item, return default */
+ return allCountries[0].isoName;
+}
+
+u16_t zfHpGetRegionCodeFromIsoName(zdev_t* dev, u8_t *countryIsoName)
+{
+ u16_t i;
+ u16_t regionCode;
+
+ /* if no matching item, return default */
+ regionCode = DEF_REGDMN;
+
+ for (i = 0; i < N(allCountries); i++)
+ {
+ if (zfMemoryIsEqual((u8_t *)allCountries[i].isoName, countryIsoName, 2))
+ {
+ regionCode = allCountries[i].regDmnEnum;
+ break;
+ }
+ }
+
+ return regionCode;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfHpDeleteAllowChannel */
+/* Delete Allow Channel. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* freq : frequency */
+/* */
+/* OUTPUTS */
+/* 0 : success */
+/* other : fail */
+/* */
+/* AUTHOR */
+/* Chao-Wen Yang ZyDAS Technology Corporation 2007.3 */
+/* */
+/************************************************************************/
+u16_t zfHpDeleteAllowChannel(zdev_t* dev, u16_t freq)
+{
+ u16_t i, bandIndex = 0;
+ u16_t dfs5GBand[][2] = {{5150, 5240}, {5260, 5350}, {5450, 5700}, {5725, 5825}};
+
+ zmw_get_wlan_dev(dev);
+ /* Find which band does this frequency belong */
+ for (i = 0; i < 4; i++)
+ {
+ if ((freq >= dfs5GBand[i][0]) && (freq <= dfs5GBand[i][1]))
+ bandIndex = i + 1;
+ }
+
+ if (bandIndex == 0)
+ {
+ /* 2.4G, don't care */
+ return 0;
+ }
+ else
+ {
+ bandIndex--;
+ }
+ /* Set all channels in this band to passive scan */
+ for (i = 0; i < wd->regulationTable.allowChannelCnt; i++)
+ {
+ if ((wd->regulationTable.allowChannel[i].channel >= dfs5GBand[bandIndex][0]) &&
+ (wd->regulationTable.allowChannel[i].channel <= dfs5GBand[bandIndex][1]))
+ {
+ /* if channel is not passive, set it to be passive and mark it */
+ if ((wd->regulationTable.allowChannel[i].channelFlags &
+ ZM_REG_FLAG_CHANNEL_PASSIVE) == 0)
+ {
+ wd->regulationTable.allowChannel[i].channelFlags |=
+ (ZM_REG_FLAG_CHANNEL_PASSIVE | ZM_REG_FLAG_CHANNEL_CSA);
+ }
+ }
+ }
+
+ return 0;
+}
+
+u16_t zfHpAddAllowChannel(zdev_t* dev, u16_t freq)
+{
+ u16_t i, j, arrayIndex;
+
+ zmw_get_wlan_dev(dev);
+
+ for (i = 0; i < wd->regulationTable.allowChannelCnt; i++)
+ {
+ if (wd->regulationTable.allowChannel[i].channel == freq)
+ break;
+ }
+
+ if ( i == wd->regulationTable.allowChannelCnt)
+ {
+ for (j = 0; j < wd->regulationTable.allowChannelCnt; j++)
+ {
+ if (wd->regulationTable.allowChannel[j].channel > freq)
+ break;
+ }
+
+ //zm_debug_msg1("CWY - add frequency = ", freq);
+ //zm_debug_msg1("CWY - channel array index = ", j);
+
+ arrayIndex = j;
+
+ if (arrayIndex < wd->regulationTable.allowChannelCnt)
+ {
+ for (j = wd->regulationTable.allowChannelCnt; j > arrayIndex; j--)
+ wd->regulationTable.allowChannel[j] = wd->regulationTable.allowChannel[j - 1];
+ }
+ wd->regulationTable.allowChannel[arrayIndex].channel = freq;
+
+ wd->regulationTable.allowChannelCnt++;
+ }
+
+ return 0;
+}
+
+u16_t zfHpIsDfsChannelNCS(zdev_t* dev, u16_t freq)
+{
+ u8_t flag = ZM_REG_FLAG_CHANNEL_DFS;
+ u16_t i;
+ zmw_get_wlan_dev(dev);
+
+ for (i = 0; i < wd->regulationTable.allowChannelCnt; i++)
+ {
+ //DbgPrint("DFS:freq=%d, chan=%d", freq, wd->regulationTable.allowChannel[i].channel);
+ if (wd->regulationTable.allowChannel[i].channel == freq)
+ {
+ flag = wd->regulationTable.allowChannel[i].privFlags;
+ break;
+ }
+ }
+
+ return (flag & (ZM_REG_FLAG_CHANNEL_DFS|ZM_REG_FLAG_CHANNEL_DFS_CLEAR));
+}
+
+u16_t zfHpIsDfsChannel(zdev_t* dev, u16_t freq)
+{
+ u8_t flag = ZM_REG_FLAG_CHANNEL_DFS;
+ u16_t i;
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ for (i = 0; i < wd->regulationTable.allowChannelCnt; i++)
+ {
+ //DbgPrint("DFS:freq=%d, chan=%d", freq, wd->regulationTable.allowChannel[i].channel);
+ if (wd->regulationTable.allowChannel[i].channel == freq)
+ {
+ flag = wd->regulationTable.allowChannel[i].privFlags;
+ break;
+ }
+ }
+
+ zmw_leave_critical_section(dev);
+
+ return (flag & (ZM_REG_FLAG_CHANNEL_DFS|ZM_REG_FLAG_CHANNEL_DFS_CLEAR));
+}
+
+u16_t zfHpIsAllowedChannel(zdev_t* dev, u16_t freq)
+{
+ u16_t i;
+ zmw_get_wlan_dev(dev);
+
+ for (i = 0; i < wd->regulationTable.allowChannelCnt; i++)
+ {
+ if (wd->regulationTable.allowChannel[i].channel == freq)
+ {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+u16_t zfHpFindFirstNonDfsChannel(zdev_t* dev, u16_t aBand)
+{
+ u16_t chan = 2412;
+ u16_t i;
+ zmw_get_wlan_dev(dev);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ for (i = 0; i < wd->regulationTable.allowChannelCnt; i++)
+ {
+ if ((wd->regulationTable.allowChannel[i].privFlags & ZM_REG_FLAG_CHANNEL_DFS) != 0)
+ {
+ if (aBand)
+ {
+ if (wd->regulationTable.allowChannel[i].channel > 3000)
+ {
+ chan = wd->regulationTable.allowChannel[i].channel;
+ break;
+ }
+ }
+ else
+ {
+ if (wd->regulationTable.allowChannel[i].channel < 3000)
+ {
+ chan = wd->regulationTable.allowChannel[i].channel;
+ break;
+ }
+ }
+ }
+ }
+
+ zmw_leave_critical_section(dev);
+
+ return chan;
+}
+
+
+/* porting from ACU */
+/* save RegulatoryDomain in hpriv */
+u8_t zfHpGetRegulatoryDomain(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+
+ switch (wd->regulationTable.regionCode)
+ {
+ case NO_ENUMRD:
+ return 0;
+ break;
+ case FCC1_FCCA:
+ case FCC1_WORLD:
+ case FCC4_FCCA:
+ case FCC5_FCCA:
+ case FCC2_WORLD:
+ case FCC2_ETSIC:
+ case FCC3_FCCA:
+ case FCC3_WORLD:
+ case FCC1:
+ case FCC2:
+ case FCC3:
+ case FCC4:
+ case FCC5:
+ case FCCA:
+ return 0x10;//WG_AMERICAS DOT11_REG_DOMAIN_FCC United States
+ break;
+
+ case FCC2_FCCA:
+ return 0x20;//DOT11_REG_DOMAIN_DOC Canada
+ break;
+
+ case ETSI1_WORLD:
+ case ETSI3_ETSIA:
+ case ETSI2_WORLD:
+ case ETSI3_WORLD:
+ case ETSI4_WORLD:
+ case ETSI4_ETSIC:
+ case ETSI5_WORLD:
+ case ETSI6_WORLD:
+ case ETSI_RESERVED:
+ case ETSI1:
+ case ETSI2:
+ case ETSI3:
+ case ETSI4:
+ case ETSI5:
+ case ETSI6:
+ case ETSIA:
+ case ETSIB:
+ case ETSIC:
+ return 0x30;//WG_EMEA DOT11_REG_DOMAIN_ETSI Most of Europe
+ break;
+
+ case MKK1_MKKA:
+ case MKK1_MKKB:
+ case MKK2_MKKA:
+ case MKK1_FCCA:
+ case MKK1_MKKA1:
+ case MKK1_MKKA2:
+ case MKK1_MKKC:
+ case MKK3_MKKB:
+ case MKK3_MKKA2:
+ case MKK3_MKKC:
+ case MKK4_MKKB:
+ case MKK4_MKKA2:
+ case MKK4_MKKC:
+ case MKK5_MKKB:
+ case MKK5_MKKA2:
+ case MKK5_MKKC:
+ case MKK6_MKKB:
+ case MKK6_MKKA2:
+ case MKK6_MKKC:
+ case MKK7_MKKB:
+ case MKK7_MKKA:
+ case MKK7_MKKC:
+ case MKK8_MKKB:
+ case MKK8_MKKA2:
+ case MKK8_MKKC:
+ case MKK6_MKKA1:
+ case MKK6_FCCA:
+ case MKK7_MKKA1:
+ case MKK7_FCCA:
+ case MKK9_FCCA:
+ case MKK9_MKKA1:
+ case MKK9_MKKC:
+ case MKK9_MKKA2:
+ case MKK10_FCCA:
+ case MKK10_MKKA1:
+ case MKK10_MKKC:
+ case MKK10_MKKA2:
+ case MKK11_MKKA:
+ case MKK11_FCCA:
+ case MKK11_MKKA1:
+ case MKK11_MKKC:
+ case MKK11_MKKA2:
+ case MKK12_MKKA:
+ case MKK12_FCCA:
+ case MKK12_MKKA1:
+ case MKK12_MKKC:
+ case MKK12_MKKA2:
+ case MKK3_MKKA:
+ case MKK3_MKKA1:
+ case MKK3_FCCA:
+ case MKK4_MKKA:
+ case MKK4_MKKA1:
+ case MKK4_FCCA:
+ case MKK9_MKKA:
+ case MKK10_MKKA:
+ case MKK1:
+ case MKK2:
+ case MKK3:
+ case MKK4:
+ case MKK5:
+ case MKK6:
+ case MKK7:
+ case MKK8:
+ case MKK9:
+ case MKK10:
+ case MKK11:
+ case MKK12:
+ case MKKA:
+ case MKKC:
+ return 0x40;//WG_JAPAN DOT11_REG_DOMAIN_MKK Japan
+ break;
+
+ default:
+ break;
+ }
+ return 0xFF;// Didn't input RegDmn by mean to distinguish by customer
+
+}
+
+
+void zfHpDisableDfsChannel(zdev_t* dev, u8_t disableFlag)
+{
+ zmw_get_wlan_dev(dev);
+
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+ hpPriv->disableDfsCh = disableFlag;
+ return;
+}
diff --git a/drivers/staging/otus/hal/hpreg.h b/drivers/staging/otus/hal/hpreg.h
new file mode 100644
index 00000000000..6f8c73fd42c
--- /dev/null
+++ b/drivers/staging/otus/hal/hpreg.h
@@ -0,0 +1,524 @@
+/*
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* Module Name : hpreg.h */
+/* */
+/* Abstract */
+/* This module contains Regulatory Table definitions. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/************************************************************************/
+
+#ifndef _HPREG_H
+#define _HPREG_H
+
+typedef u16_t HAL_CTRY_CODE; /* country code */
+typedef u16_t HAL_REG_DOMAIN; /* regulatory domain code */
+typedef enum {
+ AH_FALSE = 0, /* NB: lots of code assumes false is zero */
+ AH_TRUE = 1,
+} HAL_BOOL;
+
+
+/*
+ * Country/Region Codes from MS WINNLS.H
+ * Numbering from ISO 3166
+ */
+enum CountryCode {
+ CTRY_ALBANIA = 8, /* Albania */
+ CTRY_ALGERIA = 12, /* Algeria */
+ CTRY_ARGENTINA = 32, /* Argentina */
+ CTRY_ARMENIA = 51, /* Armenia */
+ CTRY_AUSTRALIA = 36, /* Australia */
+ CTRY_AUSTRIA = 40, /* Austria */
+ CTRY_AZERBAIJAN = 31, /* Azerbaijan */
+ CTRY_BAHRAIN = 48, /* Bahrain */
+ CTRY_BELARUS = 112, /* Belarus */
+ CTRY_BELGIUM = 56, /* Belgium */
+ CTRY_BELIZE = 84, /* Belize */
+ CTRY_BOLIVIA = 68, /* Bolivia */
+ CTRY_BOSNIA = 70, /* Bosnia */
+ CTRY_BRAZIL = 76, /* Brazil */
+ CTRY_BRUNEI_DARUSSALAM = 96, /* Brunei Darussalam */
+ CTRY_BULGARIA = 100, /* Bulgaria */
+ CTRY_CANADA = 124, /* Canada */
+ CTRY_CHILE = 152, /* Chile */
+ CTRY_CHINA = 156, /* People's Republic of China */
+ CTRY_COLOMBIA = 170, /* Colombia */
+ CTRY_COSTA_RICA = 188, /* Costa Rica */
+ CTRY_CROATIA = 191, /* Croatia */
+ CTRY_CYPRUS = 196, /* Cyprus */
+ CTRY_CZECH = 203, /* Czech Republic */
+ CTRY_DENMARK = 208, /* Denmark */
+ CTRY_DOMINICAN_REPUBLIC = 214, /* Dominican Republic */
+ CTRY_ECUADOR = 218, /* Ecuador */
+ CTRY_EGYPT = 818, /* Egypt */
+ CTRY_EL_SALVADOR = 222, /* El Salvador */
+ CTRY_ESTONIA = 233, /* Estonia */
+ CTRY_FAEROE_ISLANDS = 234, /* Faeroe Islands */
+ CTRY_FINLAND = 246, /* Finland */
+ CTRY_FRANCE = 250, /* France */
+ CTRY_FRANCE2 = 255, /* France2 */
+ CTRY_GEORGIA = 268, /* Georgia */
+ CTRY_GERMANY = 276, /* Germany */
+ CTRY_GREECE = 300, /* Greece */
+ CTRY_GUATEMALA = 320, /* Guatemala */
+ CTRY_HONDURAS = 340, /* Honduras */
+ CTRY_HONG_KONG = 344, /* Hong Kong S.A.R., P.R.C. */
+ CTRY_HUNGARY = 348, /* Hungary */
+ CTRY_ICELAND = 352, /* Iceland */
+ CTRY_INDIA = 356, /* India */
+ CTRY_INDONESIA = 360, /* Indonesia */
+ CTRY_IRAN = 364, /* Iran */
+ CTRY_IRAQ = 368, /* Iraq */
+ CTRY_IRELAND = 372, /* Ireland */
+ CTRY_ISRAEL = 376, /* Israel */
+ CTRY_ISRAEL2 = 377, /* Israel2 */
+ CTRY_ITALY = 380, /* Italy */
+ CTRY_JAMAICA = 388, /* Jamaica */
+ CTRY_JAPAN = 392, /* Japan */
+ CTRY_JAPAN1 = 393, /* Japan (JP1) */
+ CTRY_JAPAN2 = 394, /* Japan (JP0) */
+ CTRY_JAPAN3 = 395, /* Japan (JP1-1) */
+ CTRY_JAPAN4 = 396, /* Japan (JE1) */
+ CTRY_JAPAN5 = 397, /* Japan (JE2) */
+ CTRY_JAPAN6 = 399, /* Japan (JP6) */
+
+ CTRY_JAPAN7 = 4007, /* Japan (J7) */
+ CTRY_JAPAN8 = 4008, /* Japan (J8) */
+ CTRY_JAPAN9 = 4009, /* Japan (J9) */
+
+ CTRY_JAPAN10 = 4010, /* Japan (J10) */
+ CTRY_JAPAN11 = 4011, /* Japan (J11) */
+ CTRY_JAPAN12 = 4012, /* Japan (J12) */
+
+ CTRY_JAPAN13 = 4013, /* Japan (J13) */
+ CTRY_JAPAN14 = 4014, /* Japan (J14) */
+ CTRY_JAPAN15 = 4015, /* Japan (J15) */
+
+ CTRY_JAPAN16 = 4016, /* Japan (J16) */
+ CTRY_JAPAN17 = 4017, /* Japan (J17) */
+ CTRY_JAPAN18 = 4018, /* Japan (J18) */
+
+ CTRY_JAPAN19 = 4019, /* Japan (J19) */
+ CTRY_JAPAN20 = 4020, /* Japan (J20) */
+ CTRY_JAPAN21 = 4021, /* Japan (J21) */
+
+ CTRY_JAPAN22 = 4022, /* Japan (J22) */
+ CTRY_JAPAN23 = 4023, /* Japan (J23) */
+ CTRY_JAPAN24 = 4024, /* Japan (J24) */
+
+ CTRY_JAPAN25 = 4025, /* Japan (J25) */
+ CTRY_JAPAN26 = 4026, /* Japan (J26) */
+ CTRY_JAPAN27 = 4027, /* Japan (J27) */
+
+ CTRY_JAPAN28 = 4028, /* Japan (J28) */
+ CTRY_JAPAN29 = 4029, /* Japan (J29) */
+ CTRY_JAPAN30 = 4030, /* Japan (J30) */
+
+ CTRY_JAPAN31 = 4031, /* Japan (J31) */
+ CTRY_JAPAN32 = 4032, /* Japan (J32) */
+ CTRY_JAPAN33 = 4033, /* Japan (J33) */
+
+ CTRY_JAPAN34 = 4034, /* Japan (J34) */
+ CTRY_JAPAN35 = 4035, /* Japan (J35) */
+ CTRY_JAPAN36 = 4036, /* Japan (J36) */
+
+ CTRY_JAPAN37 = 4037, /* Japan (J37) */
+ CTRY_JAPAN38 = 4038, /* Japan (J38) */
+ CTRY_JAPAN39 = 4039, /* Japan (J39) */
+
+ CTRY_JAPAN40 = 4040, /* Japan (J40) */
+ CTRY_JAPAN41 = 4041, /* Japan (J41) */
+ CTRY_JAPAN42 = 4042, /* Japan (J42) */
+ CTRY_JAPAN43 = 4043, /* Japan (J43) */
+ CTRY_JAPAN44 = 4044, /* Japan (J44) */
+ CTRY_JAPAN45 = 4045, /* Japan (J45) */
+ CTRY_JAPAN46 = 4046, /* Japan (J46) */
+ CTRY_JAPAN47 = 4047, /* Japan (J47) */
+ CTRY_JAPAN48 = 4048, /* Japan (J48) */
+ CTRY_JAPAN49 = 4049, /* Japan (J49) */
+
+ CTRY_JAPAN50 = 4050, /* Japan (J50) */
+ CTRY_JAPAN51 = 4051, /* Japan (J51) */
+ CTRY_JAPAN52 = 4052, /* Japan (J52) */
+ CTRY_JAPAN53 = 4053, /* Japan (J53) */
+ CTRY_JAPAN54 = 4054, /* Japan (J54) */
+
+ CTRY_JORDAN = 400, /* Jordan */
+ CTRY_KAZAKHSTAN = 398, /* Kazakhstan */
+ CTRY_KENYA = 404, /* Kenya */
+ CTRY_KOREA_NORTH = 408, /* North Korea */
+ CTRY_KOREA_ROC = 410, /* South Korea */
+ CTRY_KOREA_ROC2 = 411, /* South Korea */
+ CTRY_KOREA_ROC3 = 412, /* South Korea */
+ CTRY_KUWAIT = 414, /* Kuwait */
+ CTRY_LATVIA = 428, /* Latvia */
+ CTRY_LEBANON = 422, /* Lebanon */
+ CTRY_LIBYA = 434, /* Libya */
+ CTRY_LIECHTENSTEIN = 438, /* Liechtenstein */
+ CTRY_LITHUANIA = 440, /* Lithuania */
+ CTRY_LUXEMBOURG = 442, /* Luxembourg */
+ CTRY_MACAU = 446, /* Macau */
+ CTRY_MACEDONIA = 807, /* the Former Yugoslav Republic of Macedonia */
+ CTRY_MALAYSIA = 458, /* Malaysia */
+ CTRY_MALTA = 470, /* Malta */
+ CTRY_MEXICO = 484, /* Mexico */
+ CTRY_MONACO = 492, /* Principality of Monaco */
+ CTRY_MOROCCO = 504, /* Morocco */
+ CTRY_NETHERLANDS = 528, /* Netherlands */
+ CTRY_NETHERLANDS_ANT = 530, /* Netherlands-Antellis */
+ CTRY_NEW_ZEALAND = 554, /* New Zealand */
+ CTRY_NICARAGUA = 558, /* Nicaragua */
+ CTRY_NORWAY = 578, /* Norway */
+ CTRY_OMAN = 512, /* Oman */
+ CTRY_PAKISTAN = 586, /* Islamic Republic of Pakistan */
+ CTRY_PANAMA = 591, /* Panama */
+ CTRY_PARAGUAY = 600, /* Paraguay */
+ CTRY_PERU = 604, /* Peru */
+ CTRY_PHILIPPINES = 608, /* Republic of the Philippines */
+ CTRY_POLAND = 616, /* Poland */
+ CTRY_PORTUGAL = 620, /* Portugal */
+ CTRY_PUERTO_RICO = 630, /* Puerto Rico */
+ CTRY_QATAR = 634, /* Qatar */
+ CTRY_ROMANIA = 642, /* Romania */
+ CTRY_RUSSIA = 643, /* Russia */
+ CTRY_SAUDI_ARABIA = 682, /* Saudi Arabia */
+ CTRY_SERBIA_MONT = 891, /* Serbia and Montenegro */
+ CTRY_SINGAPORE = 702, /* Singapore */
+ CTRY_SLOVAKIA = 703, /* Slovak Republic */
+ CTRY_SLOVENIA = 705, /* Slovenia */
+ CTRY_SOUTH_AFRICA = 710, /* South Africa */
+ CTRY_SPAIN = 724, /* Spain */
+ CTRY_SRILANKA = 144, /* Srilanka */
+ CTRY_SWEDEN = 752, /* Sweden */
+ CTRY_SWITZERLAND = 756, /* Switzerland */
+ CTRY_SYRIA = 760, /* Syria */
+ CTRY_TAIWAN = 158, /* Taiwan */
+ CTRY_THAILAND = 764, /* Thailand */
+ CTRY_TRINIDAD_Y_TOBAGO = 780, /* Trinidad y Tobago */
+ CTRY_TUNISIA = 788, /* Tunisia */
+ CTRY_TURKEY = 792, /* Turkey */
+ CTRY_UAE = 784, /* U.A.E. */
+ CTRY_UKRAINE = 804, /* Ukraine */
+ CTRY_UNITED_KINGDOM = 826, /* United Kingdom */
+ CTRY_UNITED_STATES = 840, /* United States */
+ CTRY_UNITED_STATES_FCC49 = 842, /* United States (Public Safety)*/
+ CTRY_URUGUAY = 858, /* Uruguay */
+ CTRY_UZBEKISTAN = 860, /* Uzbekistan */
+ CTRY_VENEZUELA = 862, /* Venezuela */
+ CTRY_VIET_NAM = 704, /* Viet Nam */
+ CTRY_YEMEN = 887, /* Yemen */
+ CTRY_ZIMBABWE = 716 /* Zimbabwe */
+};
+
+/* Enumerated Regulatory Domain Information 8 bit values indicate that
+ * the regdomain is really a pair of unitary regdomains. 12 bit values
+ * are the real unitary regdomains and are the only ones which have the
+ * frequency bitmasks and flags set.
+ */
+enum EnumRd {
+ /*
+ * The following regulatory domain definitions are
+ * found in the EEPROM. Each regulatory domain
+ * can operate in either a 5GHz or 2.4GHz wireless mode or
+ * both 5GHz and 2.4GHz wireless modes.
+ * In general, the value holds no special
+ * meaning and is used to decode into either specific
+ * 2.4GHz or 5GHz wireless mode for that particular
+ * regulatory domain.
+ */
+ NO_ENUMRD = 0x00,
+ NULL1_WORLD = 0x03, /* For 11b-only countries (no 11a allowed) */
+ NULL1_ETSIB = 0x07, /* Israel */
+ NULL1_ETSIC = 0x08,
+ FCC1_FCCA = 0x10, /* USA */
+ FCC1_WORLD = 0x11, /* Hong Kong */
+ FCC4_FCCA = 0x12, /* USA - Public Safety */
+ FCC5_FCCA = 0x13, /* USA - with no DFS (UNII-1 + UNII-3 only) */
+ FCC6_FCCA = 0x14, /* Canada */
+
+ FCC2_FCCA = 0x20, /* Canada */
+ FCC2_WORLD = 0x21, /* Australia & HK */
+ FCC2_ETSIC = 0x22,
+ FCC6_WORLD = 0x23, /* Australia */
+
+ FRANCE_RES = 0x31, /* Legacy France for OEM */
+ FCC3_FCCA = 0x3A, /* USA & Canada w/5470 band, 11h, DFS enabled */
+ FCC3_WORLD = 0x3B, /* USA & Canada w/5470 band, 11h, DFS enabled */
+
+ ETSI1_WORLD = 0x37,
+ ETSI3_ETSIA = 0x32, /* France (optional) */
+ ETSI2_WORLD = 0x35, /* Hungary & others */
+ ETSI3_WORLD = 0x36, /* France & others */
+ ETSI4_WORLD = 0x30,
+ ETSI4_ETSIC = 0x38,
+ ETSI5_WORLD = 0x39,
+ ETSI6_WORLD = 0x34, /* Bulgaria */
+ ETSI_RESERVED = 0x33, /* Reserved (Do not used) */
+
+ MKK1_MKKA = 0x40, /* Japan (JP1) */
+ MKK1_MKKB = 0x41, /* Japan (JP0) */
+ APL4_WORLD = 0x42, /* Singapore */
+ MKK2_MKKA = 0x43, /* Japan with 4.9G channels */
+ APL_RESERVED = 0x44, /* Reserved (Do not used) */
+ APL2_WORLD = 0x45, /* Korea */
+ APL2_APLC = 0x46,
+ APL3_WORLD = 0x47,
+ MKK1_FCCA = 0x48, /* Japan (JP1-1) */
+ APL2_APLD = 0x49, /* Korea with 2.3G channels */
+ MKK1_MKKA1 = 0x4A, /* Japan (JE1) */
+ MKK1_MKKA2 = 0x4B, /* Japan (JE2) */
+ MKK1_MKKC = 0x4C, /* Japan (MKK1_MKKA,except Ch14) */
+
+ APL3_FCCA = 0x50,
+ APL1_WORLD = 0x52, /* Latin America */
+ APL1_FCCA = 0x53,
+ APL1_APLA = 0x54,
+ APL1_ETSIC = 0x55,
+ APL2_ETSIC = 0x56, /* Venezuela */
+ APL2_FCCA = 0x57, /* new Latin America */
+ APL5_WORLD = 0x58, /* Chile */
+ APL6_WORLD = 0x5B, /* Singapore */
+ APL7_FCCA = 0x5C, /* Taiwan 5.47 Band */
+ APL8_WORLD = 0x5D, /* Malaysia 5GHz */
+ APL9_WORLD = 0x5E, /* Korea 5GHz */
+
+ /*
+ * World mode SKUs
+ */
+ WOR0_WORLD = 0x60, /* World0 (WO0 SKU) */
+ WOR1_WORLD = 0x61, /* World1 (WO1 SKU) */
+ WOR2_WORLD = 0x62, /* World2 (WO2 SKU) */
+ WOR3_WORLD = 0x63, /* World3 (WO3 SKU) */
+ WOR4_WORLD = 0x64, /* World4 (WO4 SKU) */
+ WOR5_ETSIC = 0x65, /* World5 (WO5 SKU) */
+
+ WOR01_WORLD = 0x66, /* World0-1 (WW0-1 SKU) */
+ WOR02_WORLD = 0x67, /* World0-2 (WW0-2 SKU) */
+ EU1_WORLD = 0x68, /* Same as World0-2 (WW0-2 SKU), except active scan ch1-13. No ch14 */
+
+ WOR9_WORLD = 0x69, /* World9 (WO9 SKU) */
+ WORA_WORLD = 0x6A, /* WorldA (WOA SKU) */
+
+ MKK3_MKKB = 0x80, /* Japan UNI-1 even + MKKB */
+ MKK3_MKKA2 = 0x81, /* Japan UNI-1 even + MKKA2 */
+ MKK3_MKKC = 0x82, /* Japan UNI-1 even + MKKC */
+
+ MKK4_MKKB = 0x83, /* Japan UNI-1 even + UNI-2 + MKKB */
+ MKK4_MKKA2 = 0x84, /* Japan UNI-1 even + UNI-2 + MKKA2 */
+ MKK4_MKKC = 0x85, /* Japan UNI-1 even + UNI-2 + MKKC */
+
+ MKK5_MKKB = 0x86, /* Japan UNI-1 even + UNI-2 + mid-band + MKKB */
+ MKK5_MKKA2 = 0x87, /* Japan UNI-1 even + UNI-2 + mid-band + MKKA2 */
+ MKK5_MKKC = 0x88, /* Japan UNI-1 even + UNI-2 + mid-band + MKKC */
+
+ MKK6_MKKB = 0x89, /* Japan UNI-1 even + UNI-1 odd MKKB */
+ MKK6_MKKA2 = 0x8A, /* Japan UNI-1 even + UNI-1 odd + MKKA2 */
+ MKK6_MKKC = 0x8B, /* Japan UNI-1 even + UNI-1 odd + MKKC */
+
+ MKK7_MKKB = 0x8C, /* Japan UNI-1 even + UNI-1 odd + UNI-2 + MKKB */
+ MKK7_MKKA = 0x8D, /* Japan UNI-1 even + UNI-1 odd + UNI-2 + MKKA2 */
+ MKK7_MKKC = 0x8E, /* Japan UNI-1 even + UNI-1 odd + UNI-2 + MKKC */
+
+ MKK8_MKKB = 0x8F, /* Japan UNI-1 even + UNI-1 odd + UNI-2 + mid-band + MKKB */
+ MKK8_MKKA2 = 0x90, /* Japan UNI-1 even + UNI-1 odd + UNI-2 + mid-band + MKKA2 */
+ MKK8_MKKC = 0x91, /* Japan UNI-1 even + UNI-1 odd + UNI-2 + mid-band + MKKC */
+
+ MKK6_MKKA1 = 0xF8, /* Japan UNI-1 even + UNI-1 odd + MKKA1 */
+ MKK6_FCCA = 0xF9, /* Japan UNI-1 even + UNI-1 odd + FCCA */
+ MKK7_MKKA1 = 0xFA, /* Japan UNI-1 even + UNI-1 odd + UNI-2 + MKKA1 */
+ MKK7_FCCA = 0xFB, /* Japan UNI-1 even + UNI-1 odd + UNI-2 + FCCA */
+ MKK9_FCCA = 0xFC, /* Japan UNI-1 even + 4.9GHz + FCCA */
+ MKK9_MKKA1 = 0xFD, /* Japan UNI-1 even + 4.9GHz + MKKA1 */
+ MKK9_MKKC = 0xFE, /* Japan UNI-1 even + 4.9GHz + MKKC */
+ MKK9_MKKA2 = 0xFF, /* Japan UNI-1 even + 4.9GHz + MKKA2 */
+
+ MKK10_FCCA = 0xD0, /* Japan UNI-1 even + UNI-2 + 4.9GHz + FCCA */
+ MKK10_MKKA1 = 0xD1, /* Japan UNI-1 even + UNI-2 + 4.9GHz + MKKA1 */
+ MKK10_MKKC = 0xD2, /* Japan UNI-1 even + UNI-2 + 4.9GHz + MKKC */
+ MKK10_MKKA2 = 0xD3, /* Japan UNI-1 even + UNI-2 + 4.9GHz + MKKA2 */
+
+ MKK11_MKKA = 0xD4, /* Japan UNI-1 even + UNI-2 + Midband + 4.9GHz + MKKA */
+ MKK11_FCCA = 0xD5, /* Japan UNI-1 even + UNI-2 + Midband + 4.9GHz + FCCA */
+ MKK11_MKKA1 = 0xD6, /* Japan UNI-1 even + UNI-2 + Midband + 4.9GHz + MKKA1 */
+ MKK11_MKKC = 0xD7, /* Japan UNI-1 even + UNI-2 + Midband + 4.9GHz + MKKC */
+ MKK11_MKKA2 = 0xD8, /* Japan UNI-1 even + UNI-2 + Midband + 4.9GHz + MKKA2 */
+
+ MKK12_MKKA = 0xD9, /* Japan UNI-1 even + UNI-1 odd + UNI-2 + Midband + 4.9GHz + MKKA */
+ MKK12_FCCA = 0xDA, /* Japan UNI-1 even + UNI-1 odd + UNI-2 + Midband + 4.9GHz + FCCA */
+ MKK12_MKKA1 = 0xDB, /* Japan UNI-1 even + UNI-1 odd + UNI-2 + Midband + 4.9GHz + MKKA1 */
+ MKK12_MKKC = 0xDC, /* Japan UNI-1 even + UNI-1 odd + UNI-2 + Midband + 4.9GHz + MKKC */
+ MKK12_MKKA2 = 0xDD, /* Japan UNI-1 even + UNI-1 odd + UNI-2 + Midband + 4.9GHz + MKKA2 */
+
+ /* Following definitions are used only by s/w to map old
+ * Japan SKUs.
+ */
+ MKK3_MKKA = 0xF0, /* Japan UNI-1 even + MKKA */
+ MKK3_MKKA1 = 0xF1, /* Japan UNI-1 even + MKKA1 */
+ MKK3_FCCA = 0xF2, /* Japan UNI-1 even + FCCA */
+ MKK4_MKKA = 0xF3, /* Japan UNI-1 even + UNI-2 + MKKA */
+ MKK4_MKKA1 = 0xF4, /* Japan UNI-1 even + UNI-2 + MKKA1 */
+ MKK4_FCCA = 0xF5, /* Japan UNI-1 even + UNI-2 + FCCA */
+ MKK9_MKKA = 0xF6, /* Japan UNI-1 even + 4.9GHz + MKKA*/
+ MKK10_MKKA = 0xF7, /* Japan UNI-1 even + UNI-2 + 4.9GHz + MKKA */
+
+ /*
+ * Regulator domains ending in a number (e.g. APL1,
+ * MK1, ETSI4, etc) apply to 5GHz channel and power
+ * information. Regulator domains ending in a letter
+ * (e.g. APLA, FCCA, etc) apply to 2.4GHz channel and
+ * power information.
+ */
+ APL1 = 0x0150, /* LAT & Asia */
+ APL2 = 0x0250, /* LAT & Asia */
+ APL3 = 0x0350, /* Taiwan */
+ APL4 = 0x0450, /* Jordan */
+ APL5 = 0x0550, /* Chile */
+ APL6 = 0x0650, /* Singapore */
+ APL7 = 0x0750, /* Taiwan Middle */
+ APL8 = 0x0850, /* Malaysia */
+ APL9 = 0x0950, /* Korea (South) ROC 3 */
+
+ ETSI1 = 0x0130, /* Europe & others */
+ ETSI2 = 0x0230, /* Europe & others */
+ ETSI3 = 0x0330, /* Europe & others */
+ ETSI4 = 0x0430, /* Europe & others */
+ ETSI5 = 0x0530, /* Europe & others */
+ ETSI6 = 0x0630, /* Europe & others */
+ ETSIA = 0x0A30, /* France */
+ ETSIB = 0x0B30, /* Israel */
+ ETSIC = 0x0C30, /* Latin America */
+
+ FCC1 = 0x0110, /* US & others */
+ FCC2 = 0x0120, /* Canada, Australia & New Zealand */
+ FCC3 = 0x0160, /* US w/new middle band & DFS */
+ FCC4 = 0x0165, /* US Public Safety */
+ FCC5 = 0x0510, /* US no DFS */
+ FCC6 = 0x0610, /* Canada & Australia */
+
+ FCCA = 0x0A10,
+
+ APLD = 0x0D50, /* South Korea */
+
+ MKK1 = 0x0140, /* Japan (UNI-1 odd)*/
+ MKK2 = 0x0240, /* Japan (4.9 GHz + UNI-1 odd) */
+ MKK3 = 0x0340, /* Japan (UNI-1 even) */
+ MKK4 = 0x0440, /* Japan (UNI-1 even + UNI-2) */
+ MKK5 = 0x0540, /* Japan (UNI-1 even + UNI-2 + mid-band) */
+ MKK6 = 0x0640, /* Japan (UNI-1 odd + UNI-1 even) */
+ MKK7 = 0x0740, /* Japan (UNI-1 odd + UNI-1 even + UNI-2 */
+ MKK8 = 0x0840, /* Japan (UNI-1 odd + UNI-1 even + UNI-2 + mid-band) */
+ MKK9 = 0x0940, /* Japan (UNI-1 even + 4.9 GHZ) */
+ MKK10 = 0x0B40, /* Japan (UNI-1 even + UNI-2 + 4.9 GHZ) */
+ MKK11 = 0x1140, /* Japan (UNI-1 even + UNI-2 + mid-band + 4.9 GHZ) */
+ MKK12 = 0x1240, /* Japan (UNI-1 even + UNI-1 odd + UNI-2 + mid-band + 4.9 GHZ) */
+ MKKA = 0x0A40, /* Japan */
+ MKKC = 0x0A50,
+
+ NULL1 = 0x0198,
+ WORLD = 0x0199,
+ DEBUG_REG_DMN = 0x01ff,
+};
+
+/* channelFlags */
+#define ZM_REG_FLAG_CHANNEL_CW_INT 0x0002 /* CW interference detected on channel */
+#define ZM_REG_FLAG_CHANNEL_TURBO 0x0010 /* Turbo Channel */
+#define ZM_REG_FLAG_CHANNEL_CCK 0x0020 /* CCK channel */
+#define ZM_REG_FLAG_CHANNEL_OFDM 0x0040 /* OFDM channel */
+#define ZM_REG_FLAG_CHANNEL_2GHZ 0x0080 /* 2 GHz spectrum channel. */
+#define ZM_REG_FLAG_CHANNEL_5GHZ 0x0100 /* 5 GHz spectrum channel */
+#define ZM_REG_FLAG_CHANNEL_PASSIVE 0x0200 /* Only passive scan allowed in the channel */
+#define ZM_REG_FLAG_CHANNEL_DYN 0x0400 /* dynamic CCK-OFDM channel */
+#define ZM_REG_FLAG_CHANNEL_XR 0x0800 /* XR channel */
+#define ZM_REG_FLAG_CHANNEL_CSA 0x1000 /* Channel by CSA(Channel Switch Announcement) */
+#define ZM_REG_FLAG_CHANNEL_STURBO 0x2000 /* Static turbo, no 11a-only usage */
+#define ZM_REG_FLAG_CHANNEL_HALF 0x4000 /* Half rate channel */
+#define ZM_REG_FLAG_CHANNEL_QUARTER 0x8000 /* Quarter rate channel */
+
+/* channelFlags */
+#define CHANNEL_CW_INT 0x0002 /* CW interference detected on channel */
+#define CHANNEL_TURBO 0x0010 /* Turbo Channel */
+#define CHANNEL_CCK 0x0020 /* CCK channel */
+#define CHANNEL_OFDM 0x0040 /* OFDM channel */
+#define CHANNEL_2GHZ 0x0080 /* 2 GHz spectrum channel. */
+#define CHANNEL_5GHZ 0x0100 /* 5 GHz spectrum channel */
+#define CHANNEL_PASSIVE 0x0200 /* Only passive scan allowed in the channel */
+#define CHANNEL_DYN 0x0400 /* dynamic CCK-OFDM channel */
+#define CHANNEL_XR 0x0800 /* XR channel */
+#define CHANNEL_STURBO 0x2000 /* Static turbo, no 11a-only usage */
+#define CHANNEL_HALF 0x4000 /* Half rate channel */
+#define CHANNEL_QUARTER 0x8000 /* Quarter rate channel */
+#define CHANNEL_HT20 0x10000 /* HT20 channel */
+#define CHANNEL_HT40 0x20000 /* HT40 channel */
+#define CHANNEL_HT40U 0x40000 /* control channel can be upper channel */
+#define CHANNEL_HT40L 0x80000 /* control channel can be lower channel */
+
+/* privFlags */
+#define ZM_REG_FLAG_CHANNEL_INTERFERENCE 0x01 /* Software use: channel interference
+ used for as AR as well as RADAR
+ interference detection */
+#define ZM_REG_FLAG_CHANNEL_DFS 0x02 /* DFS required on channel */
+#define ZM_REG_FLAG_CHANNEL_4MS_LIMIT 0x04 /* 4msec packet limit on this channel */
+#define ZM_REG_FLAG_CHANNEL_DFS_CLEAR 0x08 /* if channel has been checked for DFS */
+
+#define CHANNEL_A (CHANNEL_5GHZ|CHANNEL_OFDM)
+#define CHANNEL_B (CHANNEL_2GHZ|CHANNEL_CCK)
+#define CHANNEL_PUREG (CHANNEL_2GHZ|CHANNEL_OFDM)
+#ifdef notdef
+#define CHANNEL_G (CHANNEL_2GHZ|CHANNEL_DYN)
+#else
+#define CHANNEL_G (CHANNEL_2GHZ|CHANNEL_OFDM)
+#endif
+#define CHANNEL_T (CHANNEL_5GHZ|CHANNEL_OFDM|CHANNEL_TURBO)
+#define CHANNEL_ST (CHANNEL_T|CHANNEL_STURBO)
+#define CHANNEL_108G (CHANNEL_2GHZ|CHANNEL_OFDM|CHANNEL_TURBO)
+#define CHANNEL_108A CHANNEL_T
+#define CHANNEL_X (CHANNEL_5GHZ|CHANNEL_OFDM|CHANNEL_XR)
+#define CHANNEL_G_HT (CHANNEL_2GHZ | CHANNEL_OFDM | CHANNEL_HT20)
+#define CHANNEL_A_HT (CHANNEL_5GHZ | CHANNEL_OFDM | CHANNEL_HT20)
+
+#define CHANNEL_G_HT20 (CHANNEL_2GHZ|CHANNEL_HT20)
+#define CHANNEL_A_HT20 (CHANNEL_5GHZ|CHANNEL_HT20)
+#define CHANNEL_G_HT40 (CHANNEL_2GHZ|CHANNEL_HT20|CHANNEL_HT40)
+#define CHANNEL_A_HT40 (CHANNEL_5GHZ|CHANNEL_HT20|CHANNEL_HT40)
+#define CHANNEL_ALL \
+ (CHANNEL_OFDM|CHANNEL_CCK| CHANNEL_2GHZ | CHANNEL_5GHZ | CHANNEL_TURBO | CHANNEL_HT20 | CHANNEL_HT40)
+#define CHANNEL_ALL_NOTURBO (CHANNEL_ALL &~ CHANNEL_TURBO)
+
+enum {
+ HAL_MODE_11A = 0x001, /* 11a channels */
+ HAL_MODE_TURBO = 0x002, /* 11a turbo-only channels */
+ HAL_MODE_11B = 0x004, /* 11b channels */
+ HAL_MODE_PUREG = 0x008, /* 11g channels (OFDM only) */
+#ifdef notdef
+ HAL_MODE_11G = 0x010, /* 11g channels (OFDM/CCK) */
+#else
+ HAL_MODE_11G = 0x008, /* XXX historical */
+#endif
+ HAL_MODE_108G = 0x020, /* 11a+Turbo channels */
+ HAL_MODE_108A = 0x040, /* 11g+Turbo channels */
+ HAL_MODE_XR = 0x100, /* XR channels */
+ HAL_MODE_11A_HALF_RATE = 0x200, /* 11A half rate channels */
+ HAL_MODE_11A_QUARTER_RATE = 0x400, /* 11A quarter rate channels */
+ HAL_MODE_11NG = 0x4000, /* 11ng channels */
+ HAL_MODE_11NA = 0x8000, /* 11na channels */
+ HAL_MODE_ALL = 0xffff
+};
+
+#endif /* #ifndef _HPREG_H */
diff --git a/drivers/staging/otus/hal/hprw.c b/drivers/staging/otus/hal/hprw.c
new file mode 100644
index 00000000000..db7d4957645
--- /dev/null
+++ b/drivers/staging/otus/hal/hprw.c
@@ -0,0 +1,1557 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include "../80211core/cprecomp.h"
+#include "hpani.h"
+#include "hpusb.h"
+#include "hpreg.h"
+#include "../80211core/ratectrl.h"
+
+extern void zfIdlCmd(zdev_t* dev, u32_t* cmd, u16_t cmdLen);
+
+extern void zfCoreCwmBusy(zdev_t* dev, u16_t busy);
+u16_t zfDelayWriteInternalReg(zdev_t* dev, u32_t addr, u32_t val);
+u16_t zfFlushDelayWrite(zdev_t* dev);
+
+//#define zm_hp_priv(x) struct zsHpPriv* hpPriv=zgWlanDev.hpPrivate;
+
+void zfInitCmdQueue(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv = (struct zsHpPriv*)(wd->hpPrivate);
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+#ifdef ZM_XP_USB_MULTCMD
+ hpPriv->cmdTail = hpPriv->cmdHead = hpPriv->cmdSend = 0;
+#else
+ hpPriv->cmdTail = hpPriv->cmdHead = 0;
+#endif
+ hpPriv->cmdPending = 0;
+ hpPriv->cmd.delayWcmdCount = 0;
+ zmw_leave_critical_section(dev);
+}
+
+u16_t zfPutCmd(zdev_t* dev, u32_t* cmd, u16_t cmdLen, u16_t src, u8_t* buf)
+{
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+
+ /* Make sure command length < ZM_MAX_CMD_SIZE */
+ zm_assert(cmdLen <= ZM_MAX_CMD_SIZE);
+ /* Make sure command queue not full */
+ //zm_assert(((hpPriv->cmdTail+1) & (ZM_CMD_QUEUE_SIZE-1)) != hpPriv->cmdHead);
+ if (((hpPriv->cmdTail+1) & (ZM_CMD_QUEUE_SIZE-1)) == hpPriv->cmdHead ) {
+ zm_debug_msg0("CMD queue full!!");
+ return 0;
+ }
+
+ hpPriv->cmdQ[hpPriv->cmdTail].cmdLen = cmdLen;
+ hpPriv->cmdQ[hpPriv->cmdTail].src = src;
+ hpPriv->cmdQ[hpPriv->cmdTail].buf = buf;
+ for (i=0; i<(cmdLen>>2); i++)
+ {
+ hpPriv->cmdQ[hpPriv->cmdTail].cmd[i] = cmd[i];
+ }
+
+ hpPriv->cmdTail = (hpPriv->cmdTail+1) & (ZM_CMD_QUEUE_SIZE-1);
+
+ return 0;
+}
+
+u16_t zfGetCmd(zdev_t* dev, u32_t* cmd, u16_t* cmdLen, u16_t* src, u8_t** buf)
+{
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+
+ if (hpPriv->cmdTail == hpPriv->cmdHead)
+ {
+ return 3;
+ }
+
+ *cmdLen = hpPriv->cmdQ[hpPriv->cmdHead].cmdLen;
+ *src = hpPriv->cmdQ[hpPriv->cmdHead].src;
+ *buf = hpPriv->cmdQ[hpPriv->cmdHead].buf;
+ for (i=0; i<((*cmdLen)>>2); i++)
+ {
+ cmd[i] = hpPriv->cmdQ[hpPriv->cmdHead].cmd[i];
+ }
+
+ hpPriv->cmdHead = (hpPriv->cmdHead+1) & (ZM_CMD_QUEUE_SIZE-1);
+
+ return 0;
+}
+
+#ifdef ZM_XP_USB_MULTCMD
+void zfSendCmdEx(zdev_t* dev)
+{
+ u32_t ncmd[ZM_MAX_CMD_SIZE/4];
+ u16_t ncmdLen = 0;
+ u16_t cmdFlag = 0;
+ u16_t i;
+
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ if (hpPriv->cmdPending == 0)
+ {
+ if (hpPriv->cmdTail != hpPriv->cmdSend)
+ {
+ cmdFlag = 1;
+ /* Get queueing command */
+ ncmdLen= hpPriv->cmdQ[hpPriv->cmdSend].cmdLen;
+ for (i=0; i<(ncmdLen>>2); i++)
+ {
+ ncmd[i] = hpPriv->cmdQ[hpPriv->cmdSend].cmd[i];
+ }
+ hpPriv->cmdSend = (hpPriv->cmdSend+1) & (ZM_CMD_QUEUE_SIZE-1);
+
+ hpPriv->cmdPending = 1;
+ }
+ }
+
+ zmw_leave_critical_section(dev);
+
+ if ((cmdFlag == 1))
+ {
+ zfIdlCmd(dev, ncmd, ncmdLen);
+ }
+}
+
+void zfiSendCmdComp(zdev_t* dev)
+{
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+ hpPriv->cmdPending = 0;
+ zmw_leave_critical_section(dev);
+
+ zfSendCmdEx(dev);
+}
+#endif
+
+u16_t zfIssueCmd(zdev_t* dev, u32_t* cmd, u16_t cmdLen, u16_t src, u8_t* buf)
+{
+ u16_t cmdFlag = 0;
+ u16_t ret;
+
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+
+ zmw_declare_for_critical_section();
+
+ zm_msg2_mm(ZM_LV_1, "cmdLen=", cmdLen);
+
+ zmw_enter_critical_section(dev);
+
+#ifdef ZM_XP_USB_MULTCMD
+ ret = zfPutCmd(dev, cmd, cmdLen, src, buf);
+ zmw_leave_critical_section(dev);
+
+ if (ret != 0)
+ {
+ return 1;
+ }
+
+ zfSendCmdEx(dev);
+#else
+ if (hpPriv->cmdPending == 0)
+ {
+ hpPriv->cmdPending = 1;
+ cmdFlag = 1;
+ }
+ ret = zfPutCmd(dev, cmd, cmdLen, src, buf);
+
+ zmw_leave_critical_section(dev);
+
+ if (ret != 0)
+ {
+ return 1;
+ }
+
+ if (cmdFlag == 1)
+ {
+ zfIdlCmd(dev, cmd, cmdLen);
+ }
+#endif
+ return 0;
+}
+
+void zfIdlRsp(zdev_t* dev, u32_t* rsp, u16_t rspLen)
+{
+ u32_t cmd[ZM_MAX_CMD_SIZE/4];
+ u16_t cmdLen;
+ u16_t src;
+ u8_t* buf;
+ u32_t ncmd[ZM_MAX_CMD_SIZE/4];
+ u16_t ncmdLen = 0;
+ u16_t ret;
+ u16_t cmdFlag = 0;
+ u16_t i;
+ s32_t nf;
+ s32_t noisefloor[4];
+
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+
+
+ zmw_declare_for_critical_section();
+
+ zmw_enter_critical_section(dev);
+
+ ret = zfGetCmd(dev, cmd, &cmdLen, &src, &buf);
+ #if 0
+ zm_assert(ret == 0);
+ #else
+ if (ret != 0)
+ {
+ zm_debug_msg0("Error IdlRsp because none cmd!!\n");
+ #ifndef ZM_XP_USB_MULTCMD
+ zmw_leave_critical_section(dev);
+ return;
+ #endif
+ }
+ #endif
+#ifdef ZM_XP_USB_MULTCMD
+ zmw_leave_critical_section(dev);
+#else
+ if (hpPriv->cmdTail != hpPriv->cmdHead)
+ {
+ cmdFlag = 1;
+ /* Get queueing command */
+ ncmdLen= hpPriv->cmdQ[hpPriv->cmdHead].cmdLen;
+ for (i=0; i<(ncmdLen>>2); i++)
+ {
+ ncmd[i] = hpPriv->cmdQ[hpPriv->cmdHead].cmd[i];
+ }
+ }
+ else
+ {
+ hpPriv->cmdPending = 0;
+ }
+
+ zmw_leave_critical_section(dev);
+
+ if (cmdFlag == 1)
+ {
+ zfIdlCmd(dev, ncmd, ncmdLen);
+ }
+#endif
+ if (src == ZM_OID_READ)
+ {
+ ZM_PERFORMANCE_REG(dev, 0x11772c, rsp[1]);
+ zfwDbgReadRegDone(dev, cmd[1], rsp[1]);
+ }
+ else if (src == ZM_OID_FLASH_CHKSUM)
+ {
+ zfwDbgGetFlashChkSumDone(dev, rsp+1);
+ }
+ else if (src == ZM_OID_FLASH_READ)
+ {
+ u32_t datalen;
+ u16_t i;
+
+ datalen = (rsp[0] & 255);
+
+ zfwDbgReadFlashDone(dev, cmd[1], rsp+1, datalen);
+ }
+ else if (src == ZM_OID_FLASH_PROGRAM)
+ {
+ /* Non do */
+ }
+ else if (src == ZM_OID_WRITE)
+ {
+ zfwDbgWriteRegDone(dev, cmd[1], cmd[2]);
+ }
+ else if (src == ZM_OID_TALLY)
+ {
+ zfCollectHWTally(dev, rsp, 0);
+ }
+ else if (src == ZM_OID_TALLY_APD)
+ {
+ zfCollectHWTally(dev, rsp, 1);
+ zfwDbgReadTallyDone(dev);
+#ifdef ZM_ENABLE_BA_RATECTRL
+ zfRateCtrlAggrSta(dev);
+#endif
+ }
+ else if (src == ZM_OID_DKTX_STATUS)
+ {
+ zm_debug_msg0("src = zm_OID_DKTX_STATUS");
+ zfwDbgQueryHwTxBusyDone(dev, rsp[1]);
+ }
+ else if (src == ZM_CMD_SET_FREQUENCY)
+ {
+
+//#ifdef ZM_OTUS_ENABLE_RETRY_FREQ_CHANGE
+#if 0
+ zm_debug_msg1("Retry Set Frequency = ", rsp[1]);
+
+ #if 1
+ // Read the Noise Floor value !
+ nf = ((rsp[2]>>19) & 0x1ff);
+ if ((nf & 0x100) != 0x0)
+ {
+ noisefloor[0] = 0 - ((nf ^ 0x1ff) + 1);
+ }
+ else
+ {
+ noisefloor[0] = nf;
+ }
+
+ zm_debug_msg1("Noise Floor[1] = ", noisefloor[0]);
+
+ nf = ((rsp[3]>>19) & 0x1ff);
+ if ((nf & 0x100) != 0x0)
+ {
+ noisefloor[1] = 0 - ((nf ^ 0x1ff) + 1);
+ }
+ else
+ {
+ noisefloor[1] = nf;
+ }
+
+ zm_debug_msg1("Noise Floor[2] = ", noisefloor[1]);
+ zm_debug_msg1("Is Site Survey = ", hpPriv->isSiteSurvey);
+ #endif
+
+ if ( (rsp[1] && hpPriv->freqRetryCounter == 0) ||
+ (((noisefloor[0]>-60)||(noisefloor[1]>-60)) && hpPriv->freqRetryCounter==0) ||
+ ((abs(noisefloor[0]-noisefloor[1])>=9) && hpPriv->freqRetryCounter==0) )
+ {
+ zm_debug_msg0("Retry to issue the frequency change command");
+
+ if ( hpPriv->recordFreqRetryCounter == 1 )
+ {
+ zm_debug_msg0("Cold Reset");
+
+ zfHpSetFrequencyEx(dev, hpPriv->latestFrequency,
+ hpPriv->latestBw40,
+ hpPriv->latestExtOffset,
+ 2);
+
+ if ( hpPriv->isSiteSurvey != 2 )
+ {
+ hpPriv->freqRetryCounter++;
+ }
+ hpPriv->recordFreqRetryCounter = 0;
+ }
+ else
+ {
+ zfHpSetFrequencyEx(dev, hpPriv->latestFrequency,
+ hpPriv->latestBw40,
+ hpPriv->latestExtOffset,
+ 0);
+ }
+ hpPriv->recordFreqRetryCounter++;
+ }
+ else
+#endif
+
+/* ret: Bit0: AGC calibration 0=>finish 1=>unfinish */
+/* Bit1: Noise calibration 0=>finish 1=>unfinish */
+/* Bit2: Noise calibration finish, but NF value unexcepted => 1 */
+ if ( (rsp[1] & 0x1) || (rsp[1] & 0x4) )
+ {
+ zm_debug_msg1("Set Frequency fail : ret = ", rsp[1]);
+
+ /* 1. AGC Calibration fail */
+ /* 2. Noise Calibration finish but error NoiseFloor value */
+ /* and not in sitesurvey, try more twice */
+ if ( hpPriv->isSiteSurvey == 2 )
+ {
+ if ( hpPriv->recordFreqRetryCounter < 2 )
+ {
+ /* cold reset */
+ zfHpSetFrequencyEx(dev, hpPriv->latestFrequency,
+ hpPriv->latestBw40,
+ hpPriv->latestExtOffset,
+ 2);
+ hpPriv->recordFreqRetryCounter++;
+ zm_debug_msg1("Retry to issue the frequency change command(cold reset) counter = ", hpPriv->recordFreqRetryCounter);
+ }
+ else
+ {
+ /* Fail : we would not accept this result! */
+ zm_debug_msg0("\n\n\n\n Fail twice cold reset \n\n\n\n");
+ hpPriv->coldResetNeedFreq = 0;
+ hpPriv->recordFreqRetryCounter = 0;
+ zfCoreSetFrequencyComplete(dev);
+ }
+ }
+ else
+ {
+ /* in sitesurvey, coldreset in next channel */
+ hpPriv->coldResetNeedFreq = 1;
+ hpPriv->recordFreqRetryCounter = 0;
+ zfCoreSetFrequencyComplete(dev);
+ }
+ }
+ else if (rsp[1] & 0x2)
+ {
+ zm_debug_msg1("Set Frequency fail 2 : ret = ", rsp[1]);
+
+ /* Noise Calibration un-finish */
+ /* and not in sitesurvey, try more once */
+ if ( hpPriv->isSiteSurvey == 2 )
+ {
+ if ( hpPriv->recordFreqRetryCounter < 1 )
+ {
+ /* cold reset */
+ zfHpSetFrequencyEx(dev, hpPriv->latestFrequency,
+ hpPriv->latestBw40,
+ hpPriv->latestExtOffset,
+ 2);
+ hpPriv->recordFreqRetryCounter++;
+ zm_debug_msg1("2 Retry to issue the frequency change command(cold reset) counter = ", hpPriv->recordFreqRetryCounter);
+ }
+ else
+ {
+ /* Fail : we would not accept this result! */
+ zm_debug_msg0("\n\n\n\n 2 Fail twice cold reset \n\n\n\n");
+ hpPriv->coldResetNeedFreq = 0;
+ hpPriv->recordFreqRetryCounter = 0;
+ zfCoreSetFrequencyComplete(dev);
+ }
+ }
+ else
+ {
+ /* in sitesurvey, skip this frequency */
+ hpPriv->coldResetNeedFreq = 0;
+ hpPriv->recordFreqRetryCounter = 0;
+ zfCoreSetFrequencyComplete(dev);
+ }
+ }
+ //else if (rsp[1] & 0x4)
+ //{
+ // zm_debug_msg1("Set Frequency fail 3 : ret = ", rsp[1]);
+ // hpPriv->coldResetNeedFreq = 0;
+ // hpPriv->recordFreqRetryCounter = 0;
+ // zfCoreSetFrequencyComplete(dev);
+ //}
+ else
+ {
+ //hpPriv->freqRetryCounter = 0;
+ zm_debug_msg2(" return complete, ret = ", rsp[1]);
+
+ /* set bb_heavy_clip_enable */
+ if (hpPriv->enableBBHeavyClip && hpPriv->hwBBHeavyClip &&
+ hpPriv->doBBHeavyClip)
+ {
+ u32_t setValue = 0x200;
+
+ setValue |= hpPriv->setValueHeavyClip;
+
+ //zm_dbg(("Do heavy clip setValue = %d\n", setValue));
+
+ zfDelayWriteInternalReg(dev, 0x99e0+0x1bc000, setValue);
+ zfFlushDelayWrite(dev);
+ }
+
+ hpPriv->coldResetNeedFreq = 0;
+ hpPriv->recordFreqRetryCounter = 0;
+ zfCoreSetFrequencyComplete(dev);
+ }
+
+ #if 1
+ // Read the Noise Floor value !
+ nf = ((rsp[2]>>19) & 0x1ff);
+ if ((nf & 0x100) != 0x0)
+ {
+ noisefloor[0] = 0 - ((nf ^ 0x1ff) + 1);
+ }
+ else
+ {
+ noisefloor[0] = nf;
+ }
+
+ //zm_debug_msg1("Noise Floor[1] = ", noisefloor[0]);
+
+ nf = ((rsp[3]>>19) & 0x1ff);
+ if ((nf & 0x100) != 0x0)
+ {
+ noisefloor[1] = 0 - ((nf ^ 0x1ff) + 1);
+ }
+ else
+ {
+ noisefloor[1] = nf;
+ }
+
+ //zm_debug_msg1("Noise Floor[2] = ", noisefloor[1]);
+
+ nf = ((rsp[5]>>23) & 0x1ff);
+ if ((nf & 0x100) != 0x0)
+ {
+ noisefloor[2] = 0 - ((nf ^ 0x1ff) + 1);
+ }
+ else
+ {
+ noisefloor[2] = nf;
+ }
+
+ //zm_debug_msg1("Noise Floor ext[1] = ", noisefloor[2]);
+
+ nf = ((rsp[6]>>23) & 0x1ff);
+ if ((nf & 0x100) != 0x0)
+ {
+ noisefloor[3] = 0 - ((nf ^ 0x1ff) + 1);
+ }
+ else
+ {
+ noisefloor[3] = nf;
+ }
+
+ //zm_debug_msg1("Noise Floor ext[2] = ", noisefloor[3]);
+
+ //zm_debug_msg1("Is Site Survey = ", hpPriv->isSiteSurvey);
+ #endif
+ }
+ else if (src == ZM_CMD_SET_KEY)
+ {
+ zfCoreSetKeyComplete(dev);
+ }
+ else if (src == ZM_CWM_READ)
+ {
+ zm_msg2_mm(ZM_LV_0, "CWM rsp[1]=", rsp[1]);
+ zm_msg2_mm(ZM_LV_0, "CWM rsp[2]=", rsp[2]);
+ zfCoreCwmBusy(dev, zfCwmIsExtChanBusy(rsp[1], rsp[2]));
+ }
+ else if (src == ZM_MAC_READ)
+ {
+ /* rsp[1] = ZM_SEEPROM_MAC_ADDRESS_OFFSET; */
+ /* rsp[2] = ZM_SEEPROM_MAC_ADDRESS_OFFSET+4; */
+ /* rsp[3] = ZM_SEEPROM_REGDOMAIN_OFFSET; */
+ /* rsp[4] = ZM_SEEPROM_VERISON_OFFSET; */
+ /* rsp[5] = ZM_SEEPROM_HARDWARE_TYPE_OFFSET; */
+ /* rsp[6] = ZM_SEEPROM_HW_HEAVY_CLIP; */
+
+ u8_t addr[6], CCS, WWR;
+ u16_t CountryDomainCode;
+
+ /* BB heavy clip */
+ //hpPriv->eepromHeavyClipFlag = (u8_t)((rsp[6]>>24) & 0xff); // force enable 8107
+ //zm_msg2_mm(ZM_LV_0, "eepromHeavyClipFlag", hpPriv->eepromHeavyClipFlag);
+ #if 0
+ if (hpPriv->hwBBHeavyClip)
+ {
+ zm_msg0_mm(ZM_LV_0, "enable BB Heavy Clip");
+ }
+ else
+ {
+ zm_msg0_mm(ZM_LV_0, "Not enable BB Heavy Clip");
+ }
+ #endif
+ zm_msg2_mm(ZM_LV_0, "MAC rsp[1]=", rsp[1]);
+ zm_msg2_mm(ZM_LV_0, "MAC rsp[2]=", rsp[2]);
+
+ addr[0] = (u8_t)(rsp[1] & 0xff);
+ addr[1] = (u8_t)((rsp[1]>>8) & 0xff);
+ addr[2] = (u8_t)((rsp[1]>>16) & 0xff);
+ addr[3] = (u8_t)((rsp[1]>>24) & 0xff);
+ addr[4] = (u8_t)(rsp[2] & 0xff);
+ addr[5] = (u8_t)((rsp[2]>>8) & 0xff);
+/*#ifdef ZM_FB50
+ addr[0] = (u8_t)(0 & 0xff);
+ addr[1] = (u8_t)(3 & 0xff);
+ addr[2] = (u8_t)(127 & 0xff);
+ addr[3] = (u8_t)(0 & 0xff);
+ addr[4] = (u8_t)(9 & 0xff);
+ addr[5] = (u8_t)(11 & 0xff);
+#endif*/
+
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_MAC_ADDR_L,
+ ((((u32_t)addr[3])<<24) | (((u32_t)addr[2])<<16) | (((u32_t)addr[1])<<8) | addr[0]));
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_MAC_ADDR_H,
+ ((((u32_t)addr[5])<<8) | addr[4]));
+ zfFlushDelayWrite(dev);
+
+ wd->ledStruct.ledMode[0] = (u16_t)(rsp[5]&0xffff);
+ wd->ledStruct.ledMode[1] = (u16_t)(rsp[5]>>16);
+ zm_msg2_mm(ZM_LV_0, "ledMode[0]=", wd->ledStruct.ledMode[0]);
+ zm_msg2_mm(ZM_LV_0, "ledMode[1]=", wd->ledStruct.ledMode[1]);
+
+ /* Regulatory Related Setting */
+ zm_msg2_mm(ZM_LV_0, "RegDomain rsp=", rsp[3]);
+ zm_msg2_mm(ZM_LV_0, "OpFlags+EepMisc=", rsp[4]);
+ hpPriv->OpFlags = (u8_t)((rsp[4]>>16) & 0xff);
+ if ((rsp[2] >> 24) == 0x1) //Tx mask == 0x1
+ {
+ zm_msg0_mm(ZM_LV_0, "OTUS 1x2");
+ hpPriv->halCapability |= ZM_HP_CAP_11N_ONE_TX_STREAM;
+ }
+ else
+ {
+ zm_msg0_mm(ZM_LV_0, "OTUS 2x2");
+ }
+ if (hpPriv->OpFlags & 0x1)
+ {
+ hpPriv->halCapability |= ZM_HP_CAP_5G;
+ }
+ if (hpPriv->OpFlags & 0x2)
+ {
+ hpPriv->halCapability |= ZM_HP_CAP_2G;
+ }
+
+
+ CCS = (u8_t)((rsp[3] & 0x8000) >> 15);
+ WWR = (u8_t)((rsp[3] & 0x4000) >> 14);
+ CountryDomainCode = (u16_t)(rsp[3] & 0x3FFF);
+
+ if (rsp[3] != 0xffffffff)
+ {
+ if (CCS)
+ {
+ //zm_debug_msg0("CWY - Get Regulation Table from Country Code");
+ zfHpGetRegulationTablefromCountry(dev, CountryDomainCode);
+ }
+ else
+ {
+ //zm_debug_msg0("CWY - Get Regulation Table from Reg Domain");
+ zfHpGetRegulationTablefromRegionCode(dev, CountryDomainCode);
+ }
+ if (WWR)
+ {
+ //zm_debug_msg0("CWY - Enable 802.11d");
+ /* below line shall be unmarked after A band is ready */
+ //zfiWlanSetDot11DMode(dev, 1);
+ }
+ }
+ else
+ {
+ zfHpGetRegulationTablefromRegionCode(dev, NO_ENUMRD);
+ }
+
+ zfCoreMacAddressNotify(dev, addr);
+
+ }
+ else if (src == ZM_EEPROM_READ)
+ {
+#if 0
+ u8_t addr[6], CCS, WWR;
+ u16_t CountryDomainCode;
+#endif
+ for (i=0; i<ZM_HAL_MAX_EEPROM_PRQ; i++)
+ {
+ if (hpPriv->eepromImageIndex < 1024)
+ {
+ hpPriv->eepromImage[hpPriv->eepromImageIndex++] = rsp[i+1];
+ }
+ }
+
+ if (hpPriv->eepromImageIndex == (ZM_HAL_MAX_EEPROM_REQ*ZM_HAL_MAX_EEPROM_PRQ))
+ {
+ #if 0
+ for (i=0; i<1024; i++)
+ {
+ zm_msg2_mm(ZM_LV_0, "index=", i);
+ zm_msg2_mm(ZM_LV_0, "eepromImage=", hpPriv->eepromImage[i]);
+ }
+ #endif
+ zm_msg2_mm(ZM_LV_0, "MAC [1]=", hpPriv->eepromImage[0x20c/4]);
+ zm_msg2_mm(ZM_LV_0, "MAC [2]=", hpPriv->eepromImage[0x210/4]);
+#if 0
+ addr[0] = (u8_t)(hpPriv->eepromImage[0x20c/4] & 0xff);
+ addr[1] = (u8_t)((hpPriv->eepromImage[0x20c/4]>>8) & 0xff);
+ addr[2] = (u8_t)((hpPriv->eepromImage[0x20c/4]>>16) & 0xff);
+ addr[3] = (u8_t)((hpPriv->eepromImage[0x20c/4]>>24) & 0xff);
+ addr[4] = (u8_t)(hpPriv->eepromImage[0x210/4] & 0xff);
+ addr[5] = (u8_t)((hpPriv->eepromImage[0x210/4]>>8) & 0xff);
+
+ zfCoreMacAddressNotify(dev, addr);
+
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_MAC_ADDR_L,
+ ((((u32_t)addr[3])<<24) | (((u32_t)addr[2])<<16) | (((u32_t)addr[1])<<8) | addr[0]));
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_MAC_ADDR_H,
+ ((((u32_t)addr[5])<<8) | addr[4]));
+ zfFlushDelayWrite(dev);
+
+ /* Regulatory Related Setting */
+ zm_msg2_mm(ZM_LV_0, "RegDomain =", hpPriv->eepromImage[0x208/4]);
+ CCS = (u8_t)((hpPriv->eepromImage[0x208/4] & 0x8000) >> 15);
+ WWR = (u8_t)((hpPriv->eepromImage[0x208/4] & 0x4000) >> 14);
+ /* below line shall be unmarked after A band is ready */
+ //CountryDomainCode = (u16_t)(hpPriv->eepromImage[0x208/4] & 0x3FFF);
+ CountryDomainCode = 8;
+ if (CCS)
+ {
+ //zm_debug_msg0("CWY - Get Regulation Table from Country Code");
+ zfHpGetRegulationTablefromCountry(dev, CountryDomainCode);
+ }
+ else
+ {
+ //zm_debug_msg0("CWY - Get Regulation Table from Reg Domain");
+ zfHpGetRegulationTablefromRegionCode(dev, CountryDomainCode);
+ }
+ if (WWR)
+ {
+ //zm_debug_msg0("CWY - Enable 802.11d");
+ /* below line shall be unmarked after A band is ready */
+ //zfiWlanSetDot11DMode(dev, 1);
+ }
+#endif
+ zfCoreHalInitComplete(dev);
+ }
+ else
+ {
+ hpPriv->eepromImageRdReq++;
+ zfHpLoadEEPROMFromFW(dev);
+ }
+ }
+ else if (src == ZM_EEPROM_WRITE)
+ {
+ zfwDbgWriteEepromDone(dev, cmd[1], cmd[2]);
+ }
+ else if (src == ZM_ANI_READ)
+ {
+ u32_t cycleTime, ctlClear;
+
+ zm_msg2_mm(ZM_LV_0, "ANI rsp[1]=", rsp[1]);
+ zm_msg2_mm(ZM_LV_0, "ANI rsp[2]=", rsp[2]);
+ zm_msg2_mm(ZM_LV_0, "ANI rsp[3]=", rsp[3]);
+ zm_msg2_mm(ZM_LV_0, "ANI rsp[4]=", rsp[4]);
+
+ hpPriv->ctlBusy += rsp[1];
+ hpPriv->extBusy += rsp[2];
+
+ cycleTime = 100000; //100 miniseconds
+
+ if (cycleTime > rsp[1])
+ {
+ ctlClear = (cycleTime - rsp[1]) / 100;
+ }
+ else
+ {
+ ctlClear = 0;
+ }
+ if (wd->aniEnable)
+ zfHpAniArPoll(dev, ctlClear, rsp[3], rsp[4]);
+ }
+ else if (src == ZM_CMD_ECHO)
+ {
+ if ( ((struct zsHpPriv*)wd->hpPrivate)->halReInit )
+ {
+ zfCoreHalInitComplete(dev);
+ ((struct zsHpPriv*)wd->hpPrivate)->halReInit = 0;
+ }
+ else
+ {
+ zfHpLoadEEPROMFromFW(dev);
+ }
+ }
+ else if (src == ZM_OID_FW_DL_INIT)
+ {
+ zfwDbgDownloadFwInitDone(dev);
+ }
+ return;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfWriteRegInternalReg */
+/* Write on chip internal register immediately. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* addr : register address */
+/* val : value */
+/* */
+/* OUTPUTS */
+/* 0 : success */
+/* other : fail */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.11 */
+/* */
+/************************************************************************/
+u32_t zfWriteRegInternalReg(zdev_t* dev, u32_t addr, u32_t val)
+{
+ u32_t cmd[3];
+ u16_t ret;
+
+ cmd[0] = 0x00000108;
+ cmd[1] = addr;
+ cmd[2] = val;
+
+ ret = zfIssueCmd(dev, cmd, 12, ZM_OID_INTERNAL_WRITE, NULL);
+ return ret;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfDelayWriteInternalReg */
+/* Write on chip internal register, write operation may be */
+/* postponed to form a multiple write command. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* addr : register address */
+/* val : value */
+/* */
+/* OUTPUTS */
+/* 0 : command been postponed */
+/* 1 : commands been executed */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.11 */
+/* */
+/************************************************************************/
+u16_t zfDelayWriteInternalReg(zdev_t* dev, u32_t addr, u32_t val)
+{
+ u32_t cmd[(ZM_MAX_CMD_SIZE/4)];
+ u16_t i;
+ u16_t ret;
+
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+
+ zmw_declare_for_critical_section();
+
+ /* enter critical section */
+ zmw_enter_critical_section(dev);
+
+ /* Store command to global buffer */
+ hpPriv->cmd.delayWcmdAddr[hpPriv->cmd.delayWcmdCount] = addr;
+ hpPriv->cmd.delayWcmdVal[hpPriv->cmd.delayWcmdCount++] = val;
+
+ /* If pending command reach size limit */
+ if ((hpPriv->cmd.delayWcmdCount) >= ((ZM_MAX_CMD_SIZE - 4) >> 3))
+ {
+ cmd[0] = 0x00000100 + (hpPriv->cmd.delayWcmdCount<<3);
+
+ /* copy command to cmd buffer */
+ for (i=0; i<hpPriv->cmd.delayWcmdCount; i++)
+ {
+ cmd[1+(i<<1)] = hpPriv->cmd.delayWcmdAddr[i];
+ cmd[2+(i<<1)] = hpPriv->cmd.delayWcmdVal[i];
+ }
+ /* reset pending command */
+ hpPriv->cmd.delayWcmdCount = 0;
+
+ /* leave critical section */
+ zmw_leave_critical_section(dev);
+
+ /* issue write command */
+ ret = zfIssueCmd(dev, cmd, 4+(i<<3), ZM_OID_INTERNAL_WRITE, NULL);
+
+ return 1;
+ }
+ else
+ {
+ /* leave critical section */
+ zmw_leave_critical_section(dev);
+
+ return 0;
+ }
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfFlushDelayWrite */
+/* Flush pending write command. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* 0 : no pending command */
+/* 1 : commands been executed */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.11 */
+/* */
+/************************************************************************/
+u16_t zfFlushDelayWrite(zdev_t* dev)
+{
+ u32_t cmd[(ZM_MAX_CMD_SIZE/4)];
+ u16_t i;
+ u16_t ret;
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+
+ zmw_declare_for_critical_section();
+
+ /* enter critical section */
+ zmw_enter_critical_section(dev);
+
+ /* If there is pending command */
+ if (hpPriv->cmd.delayWcmdCount > 0)
+ {
+ cmd[0] = 0x00000100 + (hpPriv->cmd.delayWcmdCount<<3);
+
+ /* copy command to cmd buffer */
+ for (i=0; i<hpPriv->cmd.delayWcmdCount; i++)
+ {
+ cmd[1+(i<<1)] = hpPriv->cmd.delayWcmdAddr[i];
+ cmd[2+(i<<1)] = hpPriv->cmd.delayWcmdVal[i];
+ }
+ /* reset pending command */
+ hpPriv->cmd.delayWcmdCount = 0;
+
+ /* leave critical section */
+ zmw_leave_critical_section(dev);
+
+ /* issue write command */
+ ret = zfIssueCmd(dev, cmd, 4+(i<<3), ZM_OID_INTERNAL_WRITE, NULL);
+
+ return 1;
+ }
+ else
+ {
+ /* leave critical section */
+ zmw_leave_critical_section(dev);
+
+ return 0;
+ }
+}
+
+
+u32_t zfiDbgDelayWriteReg(zdev_t* dev, u32_t addr, u32_t val)
+{
+ zfDelayWriteInternalReg(dev, addr, val);
+ return 0;
+}
+
+u32_t zfiDbgFlushDelayWrite(zdev_t* dev)
+{
+ zfFlushDelayWrite(dev);
+ return 0;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfiDbgWriteReg */
+/* Write register. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* addr : register address */
+/* val : value */
+/* */
+/* OUTPUTS */
+/* 0 : success */
+/* other : fail */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+u32_t zfiDbgWriteReg(zdev_t* dev, u32_t addr, u32_t val)
+{
+ u32_t cmd[3];
+ u16_t ret;
+
+ cmd[0] = 0x00000108;
+ cmd[1] = addr;
+ cmd[2] = val;
+
+ ret = zfIssueCmd(dev, cmd, 12, ZM_OID_WRITE, 0);
+ return ret;
+}
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfiDbgWriteFlash */
+/* Write flash. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* addr : register address */
+/* val : value */
+/* */
+/* OUTPUTS */
+/* 0 : success */
+/* other : fail */
+/* */
+/* AUTHOR */
+/* Yjsung ZyDAS Technology Corporation 2007.02 */
+/* */
+/************************************************************************/
+u32_t zfiDbgWriteFlash(zdev_t* dev, u32_t addr, u32_t val)
+{
+ u32_t cmd[3];
+ u16_t ret;
+
+ //cmd[0] = 0x0000B008;
+ /* len[0] : type[0xB0] : seq[?] */
+ cmd[0] = 8 | (ZM_CMD_WFLASH << 8);
+ cmd[1] = addr;
+ cmd[2] = val;
+
+ ret = zfIssueCmd(dev, cmd, 12, ZM_OID_WRITE, 0);
+ return ret;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfiDbgWriteEeprom */
+/* Write EEPROM. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* addr : register address */
+/* val : value */
+/* */
+/* OUTPUTS */
+/* 0 : success */
+/* other : fail */
+/* */
+/* AUTHOR */
+/* Paul ZyDAS Technology Corporation 2007.06 */
+/* */
+/************************************************************************/
+u32_t zfiDbgWriteEeprom(zdev_t* dev, u32_t addr, u32_t val)
+{
+ u32_t cmd[3];
+ u16_t ret;
+
+ //cmd[0] = 0x0000B008;
+ /* len[0] : type[0xB0] : seq[?] */
+ cmd[0] = 8 | (ZM_CMD_WREEPROM << 8);
+ cmd[1] = addr;
+ cmd[2] = val;
+
+ ret = zfIssueCmd(dev, cmd, 12, ZM_EEPROM_WRITE, 0);
+ return ret;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfiDbgBlockWriteEeprom */
+/* Block Write Eeprom. */
+/* */
+/* p.s: now,it will write 16 bytes register data per block (N=4) */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* addr : register address */
+/* buf : input data buffer pointer */
+/* */
+/* OUTPUTS */
+/* 0 : success */
+/* other : fail */
+/* */
+/* AUTHOR */
+/* Paul ZyDAS Technology Corporation 2007.06 */
+/* */
+/************************************************************************/
+//#define N buflen/4
+//#define SIZE (2*N+1)
+
+u32_t zfiDbgBlockWriteEeprom(zdev_t* dev, u32_t addr, u32_t* buf)
+{
+ u32_t cmd[9]; //2N+1
+ u16_t ret,i;
+
+ //cmd[0] = 0x0000B008;
+ /* len[0] : type[0xB0] : seq[?] */
+
+ //cmd[0] = (8*N) | (ZM_CMD_WFLASH << 8);
+ cmd[0] = 32 | (ZM_CMD_WREEPROM << 8); //8N
+
+ for (i=0; i<4; i++) // i<N
+ {
+ cmd[(2*i)+1] = addr+(4*i);
+ cmd[(2*i)+2] = *(buf+i);
+ }
+
+ ret = zfIssueCmd(dev, cmd, 36, ZM_EEPROM_WRITE, 0); //8N+4
+
+ // added for EEPROMUpdate, wait a moment for prevent cmd queue full!
+ //zfwSleep(dev, 1);
+
+ return ret;
+}
+
+
+/* write EEPROM with wrlen : wrlen must be 4*n */
+/* command format : cmd_info(4) + addr(4) + eeprom(wrlen) */
+u32_t zfiDbgBlockWriteEeprom_v2(zdev_t* dev, u32_t addr, u32_t* buf, u32_t wrlen)
+{
+ u32_t cmd[16];
+ u16_t ret,i;
+
+ /* len[0] : type[0xB0] : seq[?] */
+ /* len = addr(4) + eeprom_block(wrlen) */
+ cmd[0] = (wrlen+4) | (ZM_CMD_MEM_WREEPROM << 8);
+ cmd[1] = addr;
+
+ for (i=0; i<(wrlen/4); i++) // i<wrlen/4
+ {
+ cmd[2+i] = *(buf+i);
+ }
+ /* cmd_info(4) + addr(4) + eeprom(wrlen) */
+ ret = zfIssueCmd(dev, cmd, (u16_t)(wrlen+8), ZM_EEPROM_WRITE, 0);
+
+ return ret;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfDbgOpenEeprom */
+/* Open EEPROM. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* */
+/* AUTHOR */
+/* Paul ZyDAS Technology Corporation 2007.06 */
+/* */
+/************************************************************************/
+void zfDbgOpenEeprom(zdev_t* dev)
+{
+ // unlock EEPROM
+ zfDelayWriteInternalReg(dev, 0x1D1400, 0x12345678);
+ zfDelayWriteInternalReg(dev, 0x1D1404, 0x55aa00ff);
+ zfDelayWriteInternalReg(dev, 0x1D1408, 0x13579ace);
+ zfDelayWriteInternalReg(dev, 0x1D1414, 0x0);
+ zfFlushDelayWrite(dev);
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfDbgCloseEeprom */
+/* Close EEPROM. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* */
+/* AUTHOR */
+/* Paul ZyDAS Technology Corporation 2007.05 */
+/* */
+/************************************************************************/
+void zfDbgCloseEeprom(zdev_t* dev)
+{
+ // lock EEPROM
+ zfDelayWriteInternalReg(dev, 0x1D1400, 0x87654321);
+ //zfDelayWriteInternalReg(dev, 0x1D1404, 0xffffffff);
+ //zfDelayWriteInternalReg(dev, 0x1D1408, 0xffffffff);
+ //zfDelayWriteInternalReg(dev, 0x1D1414, 0x100);
+ zfFlushDelayWrite(dev);
+}
+#if 0
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfiSeriallyWriteEeprom */
+/* Write EEPROM Serially. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* addr : start address of writing EEPROM */
+/* buf : input data buffer */
+/* buflen : size of input data buffer */
+/* (length of data write into EEPROM) */
+/* */
+/* OUTPUTS */
+/* */
+/* */
+/* */
+/* AUTHOR */
+/* Paul ZyDAS Technology Corporation 2007.06 */
+/* */
+/************************************************************************/
+u32_t zfiSeriallyWriteEeprom(zdev_t* dev, u32_t addr, u32_t* buf, u32_t buflen)
+{
+ u32_t count;
+ u16_t i,ret,blocksize;
+ u8_t temp[2];
+
+ // per 4 bytes = 1 count
+ count = buflen/4;
+
+ // Open EEPROM
+ zfDbgOpenEeprom(dev);
+
+ // Write EEPROM
+ for (i=0; i<count; i++)
+ {
+ if (zfwWriteEeprom(dev, (addr+(4*i)), *(buf+i), 0) != 0)
+ {
+ // Update failed, Close EEPROM
+ zm_debug_msg0("zfwWriteEeprom failed \n");
+ zfDbgCloseEeprom(dev);
+ return 1;
+ }
+ }
+
+ // Close EEPROM
+ zfDbgCloseEeprom(dev);
+ return 0;
+}
+#endif
+#if 0
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfiSeriallyBlockWriteEeprom */
+/* Block Write EEPROM Serially. */
+/* (BlockWrite: per 16bytes write EEPROM once) */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* addr : register address */
+/* buf : input data buffer */
+/* buflen : access data size of buf */
+/* */
+/* OUTPUTS */
+/* 0 : success */
+/* other : fail */
+/* */
+/* AUTHOR */
+/* Paul ZyDAS Technology Corporation 2007.05 */
+/* */
+/************************************************************************/
+u32_t zfiSeriallyBlockWriteEeprom(zdev_t* dev, u32_t addr, u32_t* buf, u32_t buflen)
+{
+ u32_t count;
+ u16_t i,ret,blocksize;
+ u8_t temp[2];
+
+ // per 4 bytes = 1 count
+ count = buflen/4;
+
+ // Open EEPROM
+ zfDbgOpenEeprom(dev);
+
+ // Write EEPROM
+ // EEPROM Write start address from: 0x1000!?
+ // per 16bytes(N=4) block write EEPROM once
+ for (i=0; i<(count/4); i++) // count/N
+ {
+ //zfiDbgBlockWriteEeprom(dev, (addr+(4*N*i)), buf+(N*i));
+ //zfiDbgBlockWriteEeprom(dev, (addr+(16*i)), buf+(4*i));
+ if (zfwBlockWriteEeprom(dev, (addr+(16*i)), buf+(4*i), 0) != 0)
+ {
+ zm_debug_msg0("zfiDbgBlockWriteEeprom failed \n");
+ // Close EEPROM
+ zfDbgCloseEeprom(dev);
+ return 1;
+ }
+ }
+
+ // Close EEPROM
+ zfDbgCloseEeprom(dev);
+ return 0;
+}
+#endif
+#if 0
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfiDbgDumpEeprom */
+/* Dump EEPROM. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* addr : start address of dumping EEPROM */
+/* datalen : length of access EEPROM data */
+/* buf : point of buffer, the buffer saved dump data */
+/* */
+/* OUTPUTS */
+/* 0 : success */
+/* other : fail */
+/* */
+/* AUTHOR */
+/* Paul ZyDAS Technology Corporation 2007.06 */
+/* */
+/************************************************************************/
+u32_t zfiDbgDumpEeprom(zdev_t* dev, u32_t addr, u32_t datalen, u32_t* buf)
+{
+ u32_t count;
+ u16_t i,ret;
+
+ count = datalen/4;
+
+ // over EEPROM length
+ if(datalen > 0x2000)
+ {
+ return 1;
+ }
+
+ for(i=0; i<count; i++)
+ {
+ buf[i] = zfwReadEeprom(dev, addr+(4*i));
+ }
+
+ return 0;
+}
+#endif
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfiDbgReadReg */
+/* Read register. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* addr : register address */
+/* */
+/* OUTPUTS */
+/* 0 : success */
+/* other : fail */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+u32_t zfiDbgReadReg(zdev_t* dev, u32_t addr)
+{
+ u32_t cmd[2];
+ u16_t ret;
+
+ cmd[0] = 0x00000004;
+ cmd[1] = addr;
+
+ ret = zfIssueCmd(dev, cmd, 8, ZM_OID_READ, 0);
+ return ret;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfiDbgReadTally */
+/* Read register. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* 0 : success */
+/* other : fail */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+u32_t zfiDbgReadTally(zdev_t* dev)
+{
+ u32_t cmd[1];
+ u16_t ret;
+ zmw_get_wlan_dev(dev);
+
+ if ( ((struct zsHpPriv*)wd->hpPrivate)->halReInit )
+ {
+ return 1;
+ }
+
+ /* len[0] : type[0x81] : seq[?] */
+ cmd[0] = 0 | (ZM_CMD_TALLY << 8);
+ ret = zfIssueCmd(dev, cmd, 4, ZM_OID_TALLY, 0);
+
+ /* len[0] : type[0x82] : seq[?] */
+ cmd[0] = 0 | (ZM_CMD_TALLY_APD << 8);
+ ret = zfIssueCmd(dev, cmd, 4, ZM_OID_TALLY_APD, 0);
+
+ return ret;
+}
+
+
+u32_t zfiDbgSetIFSynthesizer(zdev_t* dev, u32_t value)
+{
+ u32_t cmd[2];
+ u16_t ret;
+
+ /* len[4] : type[0x32] : seq[?] */
+ cmd[0] = 0x4 | (ZM_OID_SYNTH << 8);
+ cmd[1] = value;
+
+ ret = zfIssueCmd(dev, cmd, 8, ZM_OID_SYNTH, 0);
+ return ret;
+}
+
+u32_t zfiDbgQueryHwTxBusy(zdev_t* dev)
+{
+ u32_t cmd[1];
+ u16_t ret;
+
+ /* len[4] : type[0xC0] : seq[?] */
+ cmd[0] = 0 | (ZM_CMD_DKTX_STATUS << 8);
+
+ ret = zfIssueCmd(dev, cmd, 4, ZM_OID_DKTX_STATUS, 0);
+ return ret;
+}
+
+//Paul++
+#if 0
+u16_t zfHpBlockEraseFlash(zdev_t *dev, u32_t addr)
+{
+ u32_t cmd[(ZM_MAX_CMD_SIZE/4)];
+ u16_t ret;
+
+ cmd[0] = 0x00000004 | (ZM_CMD_FLASH_ERASE << 8);
+ cmd[1] = addr;
+
+ ret = zfIssueCmd(dev, cmd, 8, ZM_OID_INTERNAL_WRITE, NULL);
+ return ret;
+}
+#endif
+
+#if 0
+u16_t zfiDbgProgramFlash(zdev_t *dev, u32_t offset, u32_t len, u32_t *data)
+{
+ u32_t cmd[(ZM_MAX_CMD_SIZE/4)];
+ u16_t ret;
+ u16_t i;
+
+
+ cmd[0] = (ZM_CMD_FLASH_PROG << 8) | ((len+8) & 0xff);
+ cmd[1] = offset;
+ cmd[2] = len;
+
+ for (i = 0; i < (len >> 2); i++)
+ {
+ cmd[3+i] = data[i];
+ }
+
+ ret = zfIssueCmd(dev, cmd, 12, ZM_OID_FLASH_PROGRAM, NULL);
+
+ return ret;
+}
+#endif
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfiDbgChipEraseFlash */
+/* Chip Erase Flash. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* 0 : success */
+/* other : fail */
+/* */
+/* AUTHOR */
+/* Paul Atheros Technology Corporation 2007.09 */
+/* */
+/************************************************************************/
+u16_t zfiDbgChipEraseFlash(zdev_t *dev)
+{
+ u32_t cmd[(ZM_MAX_CMD_SIZE/4)];
+ u16_t ret;
+
+ cmd[0] = 0x00000000 | (ZM_CMD_FLASH_ERASE << 8);
+
+ ret = zfIssueCmd(dev, cmd, 4, ZM_OID_INTERNAL_WRITE, NULL);
+ return ret;
+}
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfiDbgGetFlashCheckSum */
+/* Get FlashCheckSum. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* addr : Start address of getchksum */
+/* len : total lenth of calculate getchksum */
+/* */
+/* OUTPUTS */
+/* 0 : success */
+/* other : fail */
+/* */
+/* AUTHOR */
+/* Paul Atheros Technology Corporation 2007.08 */
+/* */
+/************************************************************************/
+u32_t zfiDbgGetFlashCheckSum(zdev_t *dev, u32_t addr, u32_t len)
+{
+ u32_t cmd[(ZM_MAX_CMD_SIZE/4)];
+ u32_t ret;
+
+ cmd[0] = 0x00000008 | (ZM_CMD_FLASH_CHKSUM << 8);
+ cmd[1] = addr;
+ cmd[2] = len;
+
+ ret = zfIssueCmd(dev, cmd, 12, ZM_OID_FLASH_CHKSUM, NULL);
+
+ return ret;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfiDbgReadFlash */
+/* Read Flash. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* addr : Start address of read flash */
+/* len : total lenth of read flash data */
+/* */
+/* OUTPUTS */
+/* 0 : success */
+/* other : fail */
+/* */
+/* AUTHOR */
+/* Paul Atheros Technology Corporation 2007.09 */
+/* */
+/************************************************************************/
+u32_t zfiDbgReadFlash(zdev_t *dev, u32_t addr, u32_t len)
+{
+ u32_t cmd[(ZM_MAX_CMD_SIZE/4)];
+ u32_t ret;
+
+ cmd[0] = len | (ZM_CMD_FLASH_READ << 8);
+ cmd[1] = addr;
+
+ ret = zfIssueCmd(dev, cmd, 8, ZM_OID_FLASH_READ, NULL);
+ return ret;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfiDownloadFwSet */
+/* Before Download FW, */
+/* Command FW to Software reset and close watch dog control. */
+/* */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* 0 : success */
+/* other : fail */
+/* */
+/* AUTHOR */
+/* Paul Atheros Technology Corporation 2007.09 */
+/* */
+/************************************************************************/
+u32_t zfiDownloadFwSet(zdev_t *dev)
+{
+//softwarereset
+//close watch dog
+ u32_t cmd[(ZM_MAX_CMD_SIZE/4)];
+ u32_t ret;
+
+ cmd[0] = 0x00000008 | (ZM_CMD_FW_DL_INIT << 8);
+
+ ret = zfIssueCmd(dev, cmd, 12, ZM_OID_FW_DL_INIT, NULL);
+
+ return ret;
+}
+//Paul--
diff --git a/drivers/staging/otus/hal/hpusb.c b/drivers/staging/otus/hal/hpusb.c
new file mode 100644
index 00000000000..4b76de93fff
--- /dev/null
+++ b/drivers/staging/otus/hal/hpusb.c
@@ -0,0 +1,1584 @@
+/*
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : ud.c */
+/* */
+/* Abstract */
+/* This module contains USB descriptor functions. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/************************************************************************/
+#include "../80211core/cprecomp.h"
+#include "hpani.h"
+#include "hpusb.h"
+
+extern void zfwUsbCmd(zdev_t* dev, u8_t endpt, u32_t* cmd, u16_t cmdLen);
+
+extern void zfIdlRsp(zdev_t* dev, u32_t* rsp, u16_t rspLen);
+extern u16_t zfDelayWriteInternalReg(zdev_t* dev, u32_t addr, u32_t val);
+extern u16_t zfFlushDelayWrite(zdev_t* dev);
+
+
+#define USB_ENDPOINT_TX_INDEX 1
+#define USB_ENDPOINT_RX_INDEX 2
+#define USB_ENDPOINT_INT_INDEX 3
+#define USB_ENDPOINT_CMD_INDEX 4
+
+void zfIdlCmd(zdev_t* dev, u32_t* cmd, u16_t cmdLen)
+{
+#if ZM_SW_LOOP_BACK != 1
+ zfwUsbCmd(dev, USB_ENDPOINT_CMD_INDEX, cmd, cmdLen);
+#endif
+
+ return;
+}
+
+
+/* zfAdjustCtrlSetting: fit OUTS format */
+/* convert MIMO2 to OUTS */
+void zfAdjustCtrlSetting(zdev_t* dev, u16_t* header, zbuf_t* buf)
+{
+ /* MIMO2 => OUTS FB-50 */
+ /* length not change, only modify format */
+
+ u32_t oldMT;
+ u32_t oldMCS;
+
+ u32_t phyCtrl;
+ u32_t oldPhyCtrl;
+
+ u16_t tpc = 0;
+
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+
+ /* mm */
+ if (header == NULL)
+ {
+ oldPhyCtrl = zmw_buf_readh(dev, buf, 4) | ((u32_t)zmw_buf_readh(dev, buf, 6) << 16);
+ }
+ else
+ {
+ oldPhyCtrl = header[2] | ((u32_t)header[3] <<16);
+ }
+
+ phyCtrl = 0;
+
+
+ /* MT : Bit[1~0] */
+ oldMT = oldPhyCtrl&0x3;
+ phyCtrl |= oldMT;
+ if ( oldMT == 0x3 ) /* DL-OFDM (Duplicate Legacy OFDM) */
+ phyCtrl |= 0x1;
+
+
+ /* PT : Bit[2] HT PT: 0 Mixed mode 1 Green field */
+ phyCtrl |= (oldPhyCtrl&0x4);
+
+ /* Bandwidth control : Bit[4~3] */
+ if ( oldPhyCtrl&0x800000 ) /* Bit23 : 40M */
+ {
+ #if 0
+ if (oldMT == 0x3) /* DL-OFDM */
+ phyCtrl |= (0x3<<3); /* 40M duplicate */
+ else
+ phyCtrl |= (0x2<<3); /* 40M shared */
+ #else
+ if (oldMT == 0x2 && ((struct zsHpPriv*)wd->hpPrivate)->hwBw40)
+ {
+ phyCtrl |= (0x2<<3); /* 40M shared */
+ }
+ #endif
+ }
+ else {
+ oldPhyCtrl &= ~0x80000000;
+ }
+
+ /* MCS : Bit[24~18] */
+ oldMCS = (oldPhyCtrl&0x7f0000)>>16; /* Bit[22~16] */
+ phyCtrl |= (oldMCS<<18);
+
+ /* Short GI : Bit[31]*/
+ phyCtrl |= (oldPhyCtrl&0x80000000);
+
+ /* AM : Antenna mask */
+ //if ((oldMT == 2) && (oldMCS > 7))
+ if (hpPriv->halCapability & ZM_HP_CAP_11N_ONE_TX_STREAM)
+ {
+ phyCtrl |= (0x1<<15);
+ }
+ else
+ {
+ /* HT Tx 2 chain */
+ /* OFDM 6M/9M/12M/18M/24M Tx 2 chain */
+ /* OFDM 36M/48M/54M/ Tx 1 chain */
+ /* CCK Tx 2 chain */
+ if ((oldMT == 2) || (oldMT == 3))
+ {
+ phyCtrl |= (0x5<<15);
+ }
+ else if (oldMT == 1)
+ {
+ if ((oldMCS == 0xb) || (oldMCS == 0xf) ||
+ (oldMCS == 0xa) || (oldMCS == 0xe) ||
+ (oldMCS == 0x9)) //6M/9M/12M/18M/24M
+ {
+ phyCtrl |= (0x5<<15);
+ }
+ else
+ {
+ phyCtrl |= (0x1<<15);
+ }
+ }
+ else //(oldMT==0)
+ {
+ phyCtrl |= (0x5<<15);
+ }
+ }
+ //else
+ // phyCtrl |= (0x1<<15);
+
+ /* TPC */
+ /* TODO : accelerating these code */
+ if (hpPriv->hwFrequency < 3000)
+ {
+ if (oldMT == 0)
+ {
+ /* CCK */
+ tpc = (hpPriv->tPow2xCck[oldMCS]&0x3f);
+ }
+ else if (oldMT == 1)
+ {
+ /* OFDM */
+ if (oldMCS == 0xc)
+ {
+ tpc = (hpPriv->tPow2x2g[3]&0x3f);
+ }
+ else if (oldMCS == 0x8)
+ {
+ tpc = (hpPriv->tPow2x2g[2]&0x3f);
+ }
+ else if (oldMCS == 0xd)
+ {
+ tpc = (hpPriv->tPow2x2g[1]&0x3f);
+ }
+ else if (oldMCS == 0x9)
+ {
+ tpc = ((hpPriv->tPow2x2g[0]-hpPriv->tPow2x2g24HeavyClipOffset)&0x3f);
+ }
+ else
+ {
+ tpc = (hpPriv->tPow2x2g[0]&0x3f);
+ }
+ }
+ else if (oldMT == 2)
+ {
+ if ( oldPhyCtrl&0x800000 ) /* Bit23 : 40M */
+ {
+ /* HT 40 */
+ tpc = (hpPriv->tPow2x2gHt40[oldMCS&0x7]&0x3f);
+ }
+ else
+ {
+ /* HT 20 */
+ tpc = (hpPriv->tPow2x2gHt20[oldMCS&0x7]&0x3f);
+ }
+ }
+ }
+ else //5GHz
+ {
+ if (oldMT == 1)
+ {
+ /* OFDM */
+ if (oldMCS == 0xc)
+ {
+ tpc = (hpPriv->tPow2x5g[3]&0x3f);
+ }
+ else if (oldMCS == 0x8)
+ {
+ tpc = (hpPriv->tPow2x5g[2]&0x3f);
+ }
+ else if (oldMCS == 0xd)
+ {
+ tpc = (hpPriv->tPow2x5g[1]&0x3f);
+ }
+ else
+ {
+ tpc = (hpPriv->tPow2x5g[0]&0x3f);
+ }
+ }
+ else if (oldMT == 2)
+ {
+ if ( oldPhyCtrl&0x800000 ) /* Bit23 : 40M */
+ {
+ /* HT 40 */
+ tpc = (hpPriv->tPow2x5gHt40[oldMCS&0x7]&0x3f);
+ }
+ else
+ {
+ /* HT 20 */
+ tpc = (hpPriv->tPow2x5gHt20[oldMCS&0x7]&0x3f);
+ }
+ }
+ }
+
+ /* Tx power adjust for HT40 */
+ /* HT40 +1dBm */
+ if ((oldMT==2) && (oldPhyCtrl&0x800000) )
+ {
+ tpc += 2;
+ }
+ tpc &= 0x3f;
+
+ /* Evl force tx TPC */
+ if(wd->forceTxTPC)
+ {
+ tpc = (u16_t)(wd->forceTxTPC & 0x3f);
+ }
+
+ if (hpPriv->hwFrequency < 3000) {
+ wd->maxTxPower2 &= 0x3f;
+ tpc = (tpc > wd->maxTxPower2)? wd->maxTxPower2 : tpc;
+ } else {
+ wd->maxTxPower5 &= 0x3f;
+ tpc = (tpc > wd->maxTxPower5)? wd->maxTxPower5 : tpc;
+ }
+
+
+#define ZM_MIN_TPC 5
+#define ZM_TPC_OFFSET 5
+#define ZM_SIGNAL_THRESHOLD 56
+ if ((wd->sta.bScheduleScan == FALSE) && (wd->sta.bChannelScan == FALSE))
+ {
+ if (( wd->wlanMode == ZM_MODE_INFRASTRUCTURE )
+ && (zfStaIsConnected(dev))
+ && (wd->SignalStrength > ZM_SIGNAL_THRESHOLD))
+ {
+ if (tpc > ((ZM_MIN_TPC+ZM_TPC_OFFSET)*2))
+ {
+ tpc -= (ZM_TPC_OFFSET*2);
+ }
+ else if (tpc > (ZM_MIN_TPC*2))
+ {
+ tpc = (ZM_MIN_TPC*2);
+ }
+ }
+ }
+#undef ZM_MIN_TPC
+#undef ZM_TPC_OFFSET
+#undef ZM_SIGNAL_THRESHOLD
+
+ #ifndef ZM_OTUS_LINUX_PHASE_2
+ phyCtrl |= (tpc & 0x3f) << 9;
+ #endif
+
+ /* Set bits[8:6]BF-MCS for heavy clip */
+ if ((phyCtrl&0x3) == 2)
+ {
+ phyCtrl |= ((phyCtrl >> 12) & 0x1c0);
+ }
+
+ /* PHY control */
+ if (header == NULL)
+ {
+ zmw_buf_writeh(dev, buf, 4, (u16_t) (phyCtrl&0xffff));
+ zmw_buf_writeh(dev, buf, 6, (u16_t) (phyCtrl>>16));
+ }
+ else
+ {
+ //PHY control L
+ header[2] = (u16_t) (phyCtrl&0xffff);
+ //PHY control H
+ header[3] = (u16_t) (phyCtrl>>16);
+ }
+
+ zm_msg2_tx(ZM_LV_2, "old phy ctrl = ", oldPhyCtrl);
+ zm_msg2_tx(ZM_LV_2, "new phy ctrl = ", phyCtrl);
+ //DbgPrint("old phy ctrl =%08x \n", oldPhyCtrl);
+ //DbgPrint("new phy ctrl =%08x \n", phyCtrl);
+}
+
+
+#define EXTRA_INFO_LEN 24 //RSSI(7) + EVM(12) + PHY(1) + MACStatus(4)
+u16_t zfHpSend(zdev_t* dev, u16_t* header, u16_t headerLen,
+ u16_t* snap, u16_t snapLen,
+ u16_t* tail, u16_t tailLen, zbuf_t* buf, u16_t offset,
+ u16_t bufType, u8_t ac, u8_t keyIdx)
+{
+#if ZM_SW_LOOP_BACK == 1
+ zbuf_t *rxbuf;
+ u8_t *puRxBuf;
+ u8_t *pHdr;
+ u8_t *psnap;
+ u16_t plcplen = 12;
+ u16_t i;
+ u16_t swlpOffset;
+#endif /* #if ZM_SW_LOOP_BACK == 1 */
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+
+ zm_msg1_tx(ZM_LV_1, "zfHpSend(), len = ", 12 + headerLen-8 + snapLen + zfwBufGetSize(dev, buf) + 4 + 8);
+
+ /* Adjust ctrl setting : 6N14 yjsung */
+ zfAdjustCtrlSetting(dev, header, buf);
+
+#if ZM_SW_LOOP_BACK != 1
+ hpPriv->usbSendBytes += zfwBufGetSize(dev, buf);
+ hpPriv->usbAcSendBytes[ac&0x3] += zfwBufGetSize(dev, buf);
+
+ /* Submit USB Out Urb */
+ zfwUsbSend(dev, USB_ENDPOINT_TX_INDEX, (u8_t *)header, headerLen,
+ (u8_t *)snap, snapLen, (u8_t *)tail, tailLen, buf, offset);
+#endif
+
+#if ZM_SW_LOOP_BACK == 1
+
+ rxbuf = zfwBufAllocate(dev, plcplen + headerLen-8 + snapLen + (zfwBufGetSize(dev, buf)-offset) + 4 + EXTRA_INFO_LEN);
+ pHdr = (u8_t *) header+8;
+ psnap = (u8_t *) snap;
+
+ zmw_enter_critical_section(dev);
+ /* software loop back */
+ /* Copy WLAN header and packet buffer */
+ swlpOffset = plcplen;
+
+ for(i = 0; i < headerLen-8; i++)
+ {
+ zmw_rx_buf_writeb(dev, rxbuf, swlpOffset+i, pHdr[i]);
+ }
+
+ swlpOffset += headerLen-8;
+
+ /* Copy SNAP header */
+ for(i = 0; i < snapLen; i++)
+ {
+ zmw_rx_buf_writeb(dev, rxbuf, swlpOffset+i, psnap[i]);
+ }
+
+ swlpOffset += snapLen;
+
+ /* Copy body from tx buf to rxbuf */
+ for(i = 0; i < (zfwBufGetSize(dev, buf)-offset); i++)
+ {
+ u8_t value = zmw_rx_buf_readb(dev, buf, i+offset);
+ zmw_rx_buf_writeb(dev, rxbuf, swlpOffset+i, value);
+ }
+
+ /* total length = PLCP + MacHeader + Payload + FCS + RXstatus */
+ /* 12 + headerLen-8 + snapLen + buf length + 4 + 8 */
+ zfwSetBufSetSize(dev, rxbuf, swlpOffset + (zfwBufGetSize(dev, buf)-offset) + 4 + EXTRA_INFO_LEN );
+
+ zmw_leave_critical_section(dev);
+
+ zfwBufFree(dev, buf, 0);
+
+ //zfwDumpBuf(dev, rxbuf);
+ //-------------------------------------------------
+
+ //zfCoreRecv(dev, rxbuf);
+
+#endif /* #if ZM_SW_LOOP_BACK */
+
+ return ZM_SUCCESS;
+}
+
+/* Report moniter Hal rx information about rssi, evm, bandwidth, SG etc */
+void zfHpQueryMonHalRxInfo(zdev_t* dev, u8_t *monHalRxInfo)
+{
+ zmw_get_wlan_dev(dev);
+ zfMemoryCopy(monHalRxInfo,
+ (u8_t*)&(((struct zsHpPriv*)wd->hpPrivate)->halRxInfo),
+ sizeof(struct zsHalRxInfo));
+}
+
+
+u8_t zfIsDataFrame(zdev_t* dev, zbuf_t* buf)
+{
+ u8_t frameType;
+ u8_t mpduInd;
+
+ mpduInd = zmw_rx_buf_readb(dev, buf, zfwBufGetSize(dev, buf)-1);
+
+ /* sinlge or First */
+ if ((mpduInd & 0x30) == 0x00 || (mpduInd & 0x30) == 0x20)
+ {
+ frameType = zmw_rx_buf_readb(dev, buf, 12);
+ }
+ else
+ {
+ frameType = zmw_rx_buf_readb(dev, buf, 0);
+ }
+
+ if((frameType & 0xf) == ZM_WLAN_DATA_FRAME)
+ return 1;
+ else
+ return 0;
+}
+
+u32_t zfcConvertRateOFDM(zdev_t* dev, zbuf_t* buf)
+{
+ // What's the default value??
+ u32_t MCS = 0;
+
+ switch(zmw_rx_buf_readb(dev, buf, 0)& 0xf)
+ {
+ case 0xb:
+ MCS = 0x4;
+ break;
+ case 0xf:
+ MCS = 0x5;
+ break;
+ case 0xa:
+ MCS = 0x6;
+ break;
+ case 0xe:
+ MCS = 0x7;
+ break;
+ case 0x9:
+ MCS = 0x8;
+ break;
+ case 0xd:
+ MCS = 0x9;
+ break;
+ case 0x8:
+ MCS = 0xa;
+ break;
+ case 0xc:
+ MCS = 0xb;
+ break;
+ }
+ return MCS;
+}
+
+u16_t zfHpGetPayloadLen(zdev_t* dev,
+ zbuf_t* buf,
+ u16_t len,
+ u16_t plcpHdrLen,
+ u32_t *rxMT,
+ u32_t *rxMCS,
+ u32_t *rxBW,
+ u32_t *rxSG
+ )
+{
+ u8_t modulation,mpduInd;
+ u16_t low, high, msb;
+ s16_t payloadLen = 0;
+
+ zmw_get_wlan_dev(dev);
+
+ mpduInd = zmw_rx_buf_readb(dev, buf, len-1);
+ modulation = zmw_rx_buf_readb(dev, buf, (len-1)) & 0x3;
+ *rxMT = modulation;
+
+ //zm_debug_msg1(" modulation= ", modulation);
+ switch (modulation) {
+ case 0: /* CCK Mode */
+ low = zmw_rx_buf_readb(dev, buf, 2);
+ high = zmw_rx_buf_readb(dev, buf, 3);
+ payloadLen = (low | high << 8) - 4;
+ if (wd->enableHALDbgInfo)
+ {
+ *rxMCS = zmw_rx_buf_readb(dev, buf, 0);
+ *rxBW = 0;
+ *rxSG = 0;
+ }
+ break;
+ case 1: /* Legacy-OFDM mode */
+ low = zmw_rx_buf_readb(dev, buf, 0) >> 5;
+ high = zmw_rx_buf_readb(dev, buf, 1);
+ msb = zmw_rx_buf_readb(dev, buf, 2) & 0x1;
+ payloadLen = (low | (high << 3) | (msb << 11)) - 4;
+ if (wd->enableHALDbgInfo)
+ {
+ *rxMCS = zfcConvertRateOFDM(dev, buf);
+ *rxBW = 0;
+ *rxSG = 0;
+ }
+ break;
+ case 2: /* HT OFDM mode */
+ //zm_debug_msg1("aggregation= ", (zmw_rx_buf_readb(dev, buf, 6) >> 3) &0x1 );
+ if ((mpduInd & 0x30) == 0x00 || (mpduInd & 0x30) == 0x10) //single or last mpdu
+ payloadLen = len - 24 - 4 - plcpHdrLen; // - rxStatus - fcs
+ else {
+ payloadLen = len - 4 - 4 - plcpHdrLen; // - rxStatus - fcs
+ //zm_debug_msg1("first or middle mpdu, plcpHdrLen= ", plcpHdrLen);
+ }
+ if (wd->enableHALDbgInfo)
+ {
+ *rxMCS = zmw_rx_buf_readb(dev, buf, 3) & 0x7f;
+ *rxBW = (zmw_rx_buf_readb(dev, buf, 3) >> 7) & 0x1;
+ *rxSG = (zmw_rx_buf_readb(dev, buf, 6) >> 7) & 0x1;
+ }
+ break;
+ default:
+ break;
+
+ }
+ /* return the payload length - FCS */
+ if (payloadLen < 0) payloadLen = 0;
+ return payloadLen;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfiUsbRecv */
+/* Callback function for USB IN Transfer. */
+/* */
+/* INPUTS */
+/* dev: device pointer */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Yuan-Gu Wei ZyDAS Technology Corporation 2005.10 */
+/* */
+/************************************************************************/
+#define ZM_INT_USE_EP2 1
+#define ZM_INT_USE_EP2_HEADER_SIZE 12
+
+#if ZM_INT_USE_EP2 == 1
+void zfiUsbRegIn(zdev_t* dev, u32_t* rsp, u16_t rspLen);
+#endif
+
+#ifdef ZM_OTUS_RX_STREAM_MODE
+void zfiUsbRecvPerPkt(zdev_t *dev, zbuf_t *buf)
+#else
+void zfiUsbRecv(zdev_t *dev, zbuf_t *buf)
+#endif
+{
+
+
+#if ZM_FW_LOOP_BACK != 1
+ u8_t mpduInd;
+ u16_t plcpHdrLen;
+ u16_t crcPlusRxStatusLen;
+ u16_t len, payloadLen=0;
+ u16_t i; //CWYang(+)
+ struct zsAdditionInfo addInfo;
+ u32_t rxMT;
+ u32_t rxMCS;
+ u32_t rxBW;
+ u32_t rxSG;
+ zmw_get_wlan_dev(dev);
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+
+ //zm_msg0_rx(ZM_LV_0, "zfiUsbRecv()");
+
+#if ZM_INT_USE_EP2 == 1
+
+ for (i=0; i<(ZM_INT_USE_EP2_HEADER_SIZE>>1); i++)
+ {
+ if (zmw_rx_buf_readh(dev, buf, i*2) != 0xffff)
+ break;
+ }
+
+ if (i==(ZM_INT_USE_EP2_HEADER_SIZE>>1))
+ {
+ u32_t rsp[ZM_USB_MAX_EPINT_BUFFER/4];
+ u16_t rspLen;
+ u32_t rspi;
+ u8_t* pdst = (u8_t*)rsp;
+
+ /* Interrupt Rsp */
+ rspLen = (u16_t) zfwBufGetSize(dev, buf)-ZM_INT_USE_EP2_HEADER_SIZE;
+
+ if (rspLen > 60)
+ {
+ zm_debug_msg1("Get error len by EP2 = \n", rspLen);
+ /* free USB buf */
+ zfwBufFree(dev, buf, 0);
+ return;
+ }
+
+ for (rspi=0; rspi<rspLen; rspi++)
+ {
+ *pdst = zmw_rx_buf_readb(dev, buf, rspi+ZM_INT_USE_EP2_HEADER_SIZE);
+ pdst++;
+ }
+
+ //if (adapter->zfcbUsbRegIn)
+ // adapter->zfcbUsbRegIn(adapter, rsp, rspLen);
+ zfiUsbRegIn(dev, rsp, rspLen);
+
+ /* free USB buf */
+ zfwBufFree(dev, buf, 0);
+ return;
+ }
+#endif /* end of #if ZM_INT_USE_EP2 == 1 */
+
+ ZM_PERFORMANCE_RX_MPDU(dev, buf);
+
+ if (wd->swSniffer)
+ {
+ /* airopeek: Report everything up */
+ if (wd->zfcbRecv80211 != NULL)
+ {
+ wd->zfcbRecv80211(dev, buf, NULL);
+ }
+ }
+
+ /* Read the last byte */
+ len = zfwBufGetSize(dev, buf);
+ mpduInd = zmw_rx_buf_readb(dev, buf, len-1);
+
+ /* First MPDU */
+ if((mpduInd & 0x30) == 0x20)
+ {
+ u16_t duration;
+ if (zmw_rx_buf_readb(dev, buf, 36) == 0) //AC = BE
+ {
+ duration = zmw_rx_buf_readh(dev, buf, 14);
+ if (duration > hpPriv->aggMaxDurationBE)
+ {
+ hpPriv->aggMaxDurationBE = duration;
+ }
+ else
+ {
+ if (hpPriv->aggMaxDurationBE > 10)
+ {
+ hpPriv->aggMaxDurationBE--;
+ }
+ }
+ //DbgPrint("aggMaxDurationBE=%d", hpPriv->aggMaxDurationBE);
+ }
+ }
+
+#if 1
+ /* First MPDU or Single MPDU */
+ if(((mpduInd & 0x30) == 0x00) || ((mpduInd & 0x30) == 0x20))
+ //if ((mpduInd & 0x10) == 0x00)
+ {
+ plcpHdrLen = 12; // PLCP header length
+ }
+ else
+ {
+ if (zmw_rx_buf_readh(dev, buf, 4) == wd->macAddr[0] &&
+ zmw_rx_buf_readh(dev, buf, 6) == wd->macAddr[1] &&
+ zmw_rx_buf_readh(dev, buf, 8) == wd->macAddr[2]) {
+ plcpHdrLen = 0;
+ }
+ else if (zmw_rx_buf_readh(dev, buf, 16) == wd->macAddr[0] &&
+ zmw_rx_buf_readh(dev, buf, 18) == wd->macAddr[1] &&
+ zmw_rx_buf_readh(dev, buf, 20) == wd->macAddr[2]){
+ plcpHdrLen = 12;
+ }
+ else {
+ plcpHdrLen = 0;
+ }
+ }
+
+ /* Last MPDU or Single MPDU */
+ if ((mpduInd & 0x30) == 0x00 || (mpduInd & 0x30) == 0x10)
+ {
+ crcPlusRxStatusLen = EXTRA_INFO_LEN + 4; // Extra bytes + FCS
+ }
+ else
+ {
+ crcPlusRxStatusLen = 4 + 4; // Extra 4 bytes + FCS
+ }
+#else
+ plcpHdrLen = 12;
+ crcPlusRxStatusLen = EXTRA_INFO_LEN + 4; // Extra bytes + FCS
+#endif
+
+ if (len < (plcpHdrLen+10+crcPlusRxStatusLen))
+ {
+ zm_msg1_rx(ZM_LV_0, "Invalid Rx length=", len);
+ //zfwDumpBuf(dev, buf);
+
+ zfwBufFree(dev, buf, 0);
+ return;
+ }
+
+ /* display RSSI combined */
+ /*
+ * 
+ *  PLCP Header  MPDU  RSSI  EVM  PHY Err  MAC Status 
+ * 
+ *  12  n  7  12  1  4 
+ * 
+ * RSSI filed (From BB and MAC just pass them to host)
+ * Byte1: RSSI for antenna 0.
+ * Byte2: RSSI for antenna 1.
+ * Byte3: RSSI for antenna 2.
+ * Byte4: RSSI for antenna 0 extension.
+ * Byte5: RSSI for antenna 1 extension.
+ * Byte6: RSSI for antenna 2 extension.
+ * Byte7: RSSI for antenna combined.
+ */
+
+ //zm_debug_msg1(" recv RSSI = ", zmw_rx_buf_readb(dev, buf, (len-1)-17));
+
+ payloadLen = zfHpGetPayloadLen(dev, buf, len, plcpHdrLen, &rxMT, &rxMCS, &rxBW, &rxSG);
+
+ /* Hal Rx info */
+ /* First MPDU or Single MPDU */
+ if(((mpduInd & 0x30) == 0x00) || ((mpduInd & 0x30) == 0x20))
+ {
+ if (wd->enableHALDbgInfo && zfIsDataFrame(dev, buf))
+ {
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxDataMT = rxMT;
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxDataMCS = rxMCS;
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxDataBW = rxBW;
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxDataSG = rxSG;
+ }
+ }
+
+ if ((plcpHdrLen + payloadLen) > len) {
+ zm_msg1_rx(ZM_LV_0, "Invalid payload length=", payloadLen);
+ zfwBufFree(dev, buf, 0);
+ return;
+ }
+
+ //Store Rx Tail Infomation before Remove--CWYang(+)
+
+#if 0
+ for (i = 0; i < crcPlusRxStatusLen-4; i++)
+ {
+ addInfo.Tail.Byte[i] =
+ zmw_rx_buf_readb(dev, buf, len - crcPlusRxStatusLen + 4 + i);
+ }
+#else
+/*
+* Brief format of OUTS chip
+* 
+*  PLCP Header  MPDU  RSSI  EVM  PHY Err  MAC Status 
+* 
+*  12  n  7  12  1  4 
+* 
+* RSSI:
+* Byte 1 antenna 0
+* Byte 2 antenna 1
+* Byte 3 antenna 2
+* Byte 4 antenna 0 extension
+* Byte 5 antenna 1 extension
+* Byte 6 antenna 2 extension
+* Byte 7 antenna combined
+* EVM:
+* Byte 1 Stream 0 pilot 0
+* Byte 2 Stream 0 pilot 1
+* Byte 3 Stream 0 pilot 2
+* Byte 4 Stream 0 pilot 3
+* Byte 5 Stream 0 pilot 4
+* Byte 6 Stream 0 pilot 5
+* Byte 7 Stream 1 pilot 0
+* Byte 8 Stream 1 pilot 1
+* Byte 9 Stream 1 pilot 2
+* Byte 10 Stream 1 pilot 3
+* Byte 11 Stream 1 pilot 4
+* Byte 12 Stream 1 pilot 5
+*/
+
+ /* Fill the Tail information */
+ /* Last MPDU or Single MPDU */
+ if ((mpduInd & 0x30) == 0x00 || (mpduInd & 0x30) == 0x10)
+ {
+#define ZM_RX_RSSI_COMPENSATION 27
+ u8_t zm_rx_rssi_compensation = ZM_RX_RSSI_COMPENSATION;
+
+ /* RSSI information */
+ addInfo.Tail.Data.SignalStrength1 = zmw_rx_buf_readb(dev, buf,
+ (len-1) - 17) + ((hpPriv->rxStrongRSSI == 1)?zm_rx_rssi_compensation:0);
+#undef ZM_RX_RSSI_COMPENSATION
+
+ /* EVM */
+
+ /* TODO: for RD/BB debug message */
+ /* save current rx hw infomration, report to DrvCore/Application */
+ if (wd->enableHALDbgInfo && zfIsDataFrame(dev, buf))
+ {
+ u8_t trssi;
+ for (i=0; i<7; i++)
+ {
+ trssi = zmw_rx_buf_readb(dev, buf, (len-1) - 23 + i);
+ if (trssi&0x80)
+ {
+ trssi = ((~((u8_t)trssi) & 0x7f) + 1) & 0x7f;
+ }
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRSSI[i] = trssi;
+
+ }
+ if (rxMT==2)
+ {
+ //if (rxBW)
+ //{
+ for (i=0; i<12; i++)
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[i] =
+ zmw_rx_buf_readb(dev, buf, (len-1) - 16 + i);
+ //}
+ //else
+ //{
+ // for (i=0; i<4; i++)
+ // ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[i] =
+ // zmw_rx_buf_readb(dev, buf, (len-1) - 16 + i);
+ //}
+ }
+
+ #if 0
+ /* print */
+ 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",
+ rxMT,
+ rxMCS,
+ rxBW,
+ rxSG,
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRSSI[0],
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRSSI[1],
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRSSI[2],
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRSSI[3],
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRSSI[4],
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRSSI[5],
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRSSI[6],
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[0],
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[1],
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[2],
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[3],
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[4],
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[5],
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[6],
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[7],
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[8],
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[9],
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[10],
+ ((struct zsHpPriv*)wd->hpPrivate)->halRxInfo.currentRxEVM[11]
+ ));
+ #endif
+ } /* if (wd->enableHALDbgInfo && zfIsDataFrame(dev, buf)) */
+
+ }
+ else
+ {
+ /* Mid or First aggregate frame without phy rx information */
+ addInfo.Tail.Data.SignalStrength1 = 0;
+ }
+
+ addInfo.Tail.Data.SignalStrength2 = 0;
+ addInfo.Tail.Data.SignalStrength3 = 0;
+ addInfo.Tail.Data.SignalQuality = 0;
+
+ addInfo.Tail.Data.SAIndex = zmw_rx_buf_readb(dev, buf, len - 4);
+ addInfo.Tail.Data.DAIndex = zmw_rx_buf_readb(dev, buf, len - 3);
+ addInfo.Tail.Data.ErrorIndication = zmw_rx_buf_readb(dev, buf, len - 2);
+ addInfo.Tail.Data.RxMacStatus = zmw_rx_buf_readb(dev, buf, len - 1);
+
+#endif
+ /* Remove CRC and Rx Status */
+ zfwBufSetSize(dev, buf, (len-crcPlusRxStatusLen));
+ //zfwBufSetSize(dev, buf, payloadLen + plcpHdrLen); /* payloadLen + PLCP 12 - FCS 4*/
+
+ //Store PLCP Header Infomation before Remove--CWYang(+)
+ if (plcpHdrLen != 0)
+ {
+ for (i = 0; i < plcpHdrLen; i++)
+ {
+ addInfo.PlcpHeader[i] = zmw_rx_buf_readb(dev, buf, i);
+ }
+ }
+ else
+ {
+ addInfo.PlcpHeader[0] = 0;
+ }
+ /* Remove PLCP header */
+ zfwBufRemoveHead(dev, buf, plcpHdrLen);
+
+ /* handle 802.11 frame */
+ zfCoreRecv(dev, buf, &addInfo);
+
+#else
+ /* Firmware loopback: Rx frame = Tx frame */
+ /* convert Rx frame to fit receive frame format */
+ zbuf_t *new_buf;
+ u8_t ctrl_offset = 8;
+ u8_t PLCP_Len = 12;
+ u8_t data;
+ u8_t i;
+
+
+ /* Tx: | ctrl_setting | Mac hdr | data | */
+ /* 8 24 x */
+
+ /* Rx: | PLCP | Mac hdr | data | FCS | Rxstatus | */
+ /* 12 24 x 4 8 */
+
+ /* new allocate a rx format size buf */
+ new_buf = zfwBufAllocate(dev, zfwBufGetSize(dev, buf)-8+12+4+EXTRA_INFO_LEN);
+
+ for (i=0; i<zfwBufGetSize(dev, buf)-ctrl_offset; i++)
+ {
+ data = zmw_rx_buf_readb(dev, buf, ctrl_offset+i);
+ zmw_rx_buf_writeb(dev, new_buf, PLCP_Len+i, data);
+ }
+
+ zfwBufSetSize(dev, new_buf, zfwBufGetSize(dev, buf)-8+12+4+EXTRA_INFO_LEN);
+
+ zfwBufFree(dev, buf, 0);
+
+ /* receive the new_buf */
+ //zfCoreRecv(dev, new_buf);
+
+#endif
+
+}
+
+#ifdef ZM_OTUS_RX_STREAM_MODE
+void zfiUsbRecv(zdev_t *dev, zbuf_t *buf)
+{
+ u16_t index = 0;
+ u16_t chkIdx;
+ u32_t status = 0;
+ u16_t ii;
+ zbuf_t *newBuf;
+ zbuf_t *rxBufPool[8];
+ u16_t rxBufPoolIndex = 0;
+ struct zsHpPriv *halPriv;
+ u8_t *srcBufPtr;
+ u32_t bufferLength;
+ u16_t usbRxRemainLen;
+ u16_t usbRxPktLen;
+
+ zmw_get_wlan_dev(dev);
+
+ halPriv = (struct zsHpPriv*)wd->hpPrivate;
+ srcBufPtr = zmw_buf_get_buffer(dev, buf);
+
+ bufferLength = zfwBufGetSize(dev, buf);
+
+ /* Zero Length Transfer */
+ if (!bufferLength)
+ {
+ zfwBufFree(dev, buf, 0);
+ return;
+ }
+
+ usbRxRemainLen = halPriv->usbRxRemainLen;
+ usbRxPktLen = halPriv->usbRxTransferLen;
+
+ /* Check whether there is any data in the last transfer */
+ if (usbRxRemainLen != 0 )
+ {
+ zbuf_t *remainBufPtr = halPriv->remainBuf;
+ u8_t* BufPtr = NULL;
+
+ if ( remainBufPtr != NULL )
+ {
+ BufPtr = zmw_buf_get_buffer(dev, remainBufPtr);
+ }
+
+ index = usbRxRemainLen;
+ usbRxRemainLen -= halPriv->usbRxPadLen;
+
+ /* Copy data */
+ if ( BufPtr != NULL )
+ {
+ zfwMemoryCopy(&(BufPtr[usbRxPktLen]), srcBufPtr, usbRxRemainLen);
+ }
+
+ usbRxPktLen += usbRxRemainLen;
+ halPriv->usbRxRemainLen = 0;
+
+ if ( remainBufPtr != NULL )
+ {
+ zfwBufSetSize(dev, remainBufPtr, usbRxPktLen);
+ rxBufPool[rxBufPoolIndex++] = remainBufPtr;
+ }
+ halPriv->remainBuf = NULL;
+ }
+
+ //zm_debug_msg1("length: %d\n", (int)pUsbRxTransfer->pRxUrb->UrbBulkOrInterruptTransfer.TransferBufferLength);
+
+ bufferLength = zfwBufGetSize(dev, buf);
+//printk("bufferLength %d\n", bufferLength);
+ while(index < bufferLength)
+ {
+ u16_t pktLen;
+ u16_t pktTag;
+ //u8_t *ptr = (u8_t*)((struct zsBuffer*)pUsbRxTransfer->buf)->data;
+ u8_t *ptr = srcBufPtr;
+
+ /* Retrieve packet length and tag */
+ pktLen = ptr[index] + (ptr[index+1] << 8);
+ pktTag = ptr[index+2] + (ptr[index+3] << 8);
+
+ if (pktTag == ZM_USB_STREAM_MODE_TAG)
+ {
+ u16_t padLen;
+
+ zm_assert(pktLen < ZM_WLAN_MAX_RX_SIZE);
+
+ //printk("Get a packet, pktLen: 0x%04x\n", pktLen);
+ #if 0
+ /* Dump data */
+ for (ii = index; ii < pkt_len+4;)
+ {
+ DbgPrint("0x%02x ",
+ (zmw_rx_buf_readb(adapter, pUsbRxTransfer->buf, ii) & 0xff));
+
+ if ((++ii % 16) == 0)
+ DbgPrint("\n");
+ }
+
+ DbgPrint("\n");
+ #endif
+
+ /* Calcuate the padding length, in the current design,
+ the length should be padded to 4 byte boundray. */
+ padLen = ZM_USB_STREAM_MODE_TAG_LEN - (pktLen & 0x3);
+
+ if(padLen == ZM_USB_STREAM_MODE_TAG_LEN)
+ padLen = 0;
+
+ chkIdx = index;
+ index = index + ZM_USB_STREAM_MODE_TAG_LEN + pktLen + padLen;
+
+ if (chkIdx > ZM_MAX_USB_IN_TRANSFER_SIZE)
+ {
+ zm_debug_msg1("chkIdx is too large, chkIdx: %d\n", chkIdx);
+ zm_assert(0);
+ status = 1;
+ break;
+ }
+
+ if (index > ZM_MAX_USB_IN_TRANSFER_SIZE)
+ {
+ //struct zsBuffer* BufPtr;
+ //struct zsBuffer* UsbBufPtr;
+ u8_t *BufPtr;
+ u8_t *UsbBufPtr;
+
+ halPriv->usbRxRemainLen = index - ZM_MAX_USB_IN_TRANSFER_SIZE; // - padLen;
+ halPriv->usbRxTransferLen = ZM_MAX_USB_IN_TRANSFER_SIZE -
+ chkIdx - ZM_USB_STREAM_MODE_TAG_LEN;
+ halPriv->usbRxPadLen = padLen;
+ //check_index = index;
+
+ if (halPriv->usbRxTransferLen > ZM_WLAN_MAX_RX_SIZE)
+ {
+ zm_debug_msg1("check_len is too large, chk_len: %d\n",
+ halPriv->usbRxTransferLen);
+ status = 1;
+ break;
+ }
+
+ /* Allocate a skb buffer */
+ newBuf = zfwBufAllocate(dev, ZM_WLAN_MAX_RX_SIZE);
+
+ if ( newBuf != NULL )
+ {
+ BufPtr = zmw_buf_get_buffer(dev, newBuf);
+ UsbBufPtr = srcBufPtr;
+
+ /* Copy the buffer */
+ zfwMemoryCopy(BufPtr, &(UsbBufPtr[chkIdx+ZM_USB_STREAM_MODE_TAG_LEN]), halPriv->usbRxTransferLen);
+
+ /* Record the buffer pointer */
+ halPriv->remainBuf = newBuf;
+ }
+ }
+ else
+ {
+ u8_t* BufPtr;
+ u8_t* UsbBufPtr;
+
+ /* Allocate a skb buffer */
+ newBuf = zfwBufAllocate(dev, ZM_WLAN_MAX_RX_SIZE);
+ if ( newBuf != NULL )
+ {
+ BufPtr = zmw_buf_get_buffer(dev, newBuf);
+ UsbBufPtr = srcBufPtr;
+
+ /* Copy the buffer */
+ zfwMemoryCopy(BufPtr, &(UsbBufPtr[chkIdx+ZM_USB_STREAM_MODE_TAG_LEN]), pktLen);
+
+ zfwBufSetSize(dev, newBuf, pktLen);
+ rxBufPool[rxBufPoolIndex++] = newBuf;
+ }
+ }
+ }
+ else
+ {
+ u16_t i;
+
+ DbgPrint("Can't find tag, pkt_len: 0x%04x, tag: 0x%04x\n",
+ pktLen, pktTag);
+
+ #if 0
+ for(i = 0; i < 32; i++)
+ {
+ DbgPrint("%02x ", buf->data[index-16+i]);
+
+ if ((i & 0xf) == 0xf)
+ DbgPrint("\n");
+ }
+ #endif
+
+ break;
+ }
+ }
+
+ /* Free buffer */
+ //zfwBufFree(adapter, pUsbRxTransfer->buf, 0);
+ zfwBufFree(dev, buf, 0);
+
+ for(ii = 0; ii < rxBufPoolIndex; ii++)
+ {
+ zfiUsbRecvPerPkt(dev, rxBufPool[ii]);
+ }
+}
+#endif
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfUsbInit */
+/* Initialize USB resource. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.12 */
+/* */
+/************************************************************************/
+void zfUsbInit(zdev_t* dev)
+{
+ /* Initialize Rx & INT endpoint for receiving data & interrupt */
+ zfwUsbEnableRxEpt(dev, USB_ENDPOINT_RX_INDEX);
+ zfwUsbEnableIntEpt(dev, USB_ENDPOINT_INT_INDEX);
+
+ return;
+}
+
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfUsbFree */
+/* Free PCI resource. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen Chen ZyDAS Technology Corporation 2005.12 */
+/* */
+/************************************************************************/
+void zfUsbFree(zdev_t* dev)
+{
+ struct zsHpPriv *halPriv;
+
+ zmw_get_wlan_dev(dev);
+
+ halPriv = (struct zsHpPriv*)wd->hpPrivate;
+
+#ifdef ZM_OTUS_RX_STREAM_MODE
+ if ( halPriv->remainBuf != NULL )
+ {
+ zfwBufFree(dev, halPriv->remainBuf, 0);
+ }
+#endif
+
+ return;
+}
+
+void zfHpSendBeacon(zdev_t* dev, zbuf_t* buf, u16_t len)
+{
+ u32_t hw, lw;
+ u16_t i;
+ zmw_get_wlan_dev(dev);
+
+ /* Write to beacon buffer (ZM_BEACON_BUFFER_ADDRESS) */
+ for (i = 0; i<len; i+=4)
+ {
+ lw = zmw_tx_buf_readh(dev, buf, i);
+ hw = zmw_tx_buf_readh(dev, buf, i+2);
+
+ zfDelayWriteInternalReg(dev, ZM_BEACON_BUFFER_ADDRESS+i, (hw<<16)+lw);
+ }
+
+ /* Beacon PCLP header */
+ if (((struct zsHpPriv*)wd->hpPrivate)->hwFrequency < 3000)
+ {
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_BCN_PLCP, ((len+4)<<(3+16))+0x0400);
+ }
+ else
+ {
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_BCN_PLCP, ((len+4)<<(16))+0x001b);
+ }
+
+ /* Beacon length (include CRC32) */
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_BCN_LENGTH, len+4);
+
+ /* Beacon Ready */
+ zfDelayWriteInternalReg(dev, ZM_MAC_REG_BCN_CTRL, 1);
+ zfFlushDelayWrite(dev);
+
+ /* Free beacon buf */
+ zfwBufFree(dev, buf, 0);
+
+ return;
+}
+
+
+#define ZM_STATUS_TX_COMP 0x00
+#define ZM_STATUS_RETRY_COMP 0x01
+#define ZM_STATUS_TX_FAILED 0x02
+void zfiUsbRegIn(zdev_t* dev, u32_t* rsp, u16_t rspLen)
+{
+ //u8_t len, type, i;
+ u8_t type;
+ u8_t *u8rsp;
+ u16_t status;
+ u32_t bitmap;
+ zmw_get_wlan_dev(dev);
+
+ zm_msg0_mm(ZM_LV_3, "zfiUsbRegIn()");
+
+ u8rsp = (u8_t *)rsp;
+
+ //len = *u8rsp;
+ type = *(u8rsp+1);
+ u8rsp = u8rsp+4;
+
+
+ /* Interrupt event */
+ if ((type & 0xC0) == 0xC0)
+ {
+ if (type == 0xC0)
+ {
+ zfCoreEvent(dev, 0, u8rsp);
+
+ }
+ else if (type == 0xC1)
+ {
+#if 0
+ {
+ u16_t i;
+ DbgPrint("rspLen=%d\n", rspLen);
+ for (i=0; i<(rspLen/4); i++)
+ {
+ DbgPrint("rsp[%d]=0x%lx\n", i, rsp[i]);
+ }
+ }
+#endif
+ status = (u16_t)(rsp[3] >> 16);
+
+ ////6789
+ rsp[8] = rsp[8] >> 2 | (rsp[9] & 0x1) << 6;
+ switch (status)
+ {
+ case ZM_STATUS_RETRY_COMP :
+ zfCoreEvent(dev, 1, u8rsp);
+ break;
+ case ZM_STATUS_TX_FAILED :
+ zfCoreEvent(dev, 2, u8rsp);
+ break;
+ case ZM_STATUS_TX_COMP :
+ zfCoreEvent(dev, 3, u8rsp);
+ break;
+ }
+ }
+ else if (type == 0xC2)
+ {
+ zfBeaconCfgInterrupt(dev, u8rsp);
+ }
+ else if (type == 0xC3)
+ {
+ zfEndOfAtimWindowInterrupt(dev);
+ }
+ else if (type == 0xC4)
+ {
+#if 0
+ {
+ u16_t i;
+ DbgPrint("0xC2:rspLen=%d\n", rspLen);
+ for (i=0; i<(rspLen/4); i++)
+ {
+ DbgPrint("0xC2:rsp[%d]=0x%lx\n", i, rsp[i]);
+ }
+ }
+#endif
+ bitmap = (rsp[1] >> 16) + ((rsp[2] & 0xFFFF) << 16 );
+ //zfBawCore(dev, (u16_t)rsp[1] & 0xFFFF, bitmap, (u16_t)(rsp[2] >> 16) & 0xFF);
+ }
+ else if (type == 0xC5)
+ {
+ u16_t i;
+#if 0
+
+ for (i=0; i<(rspLen/4); i++) {
+ DbgPrint("0xC5:rsp[%d]=0x%lx\n", i, rsp[i]);
+ }
+#endif
+ for (i=1; i<(rspLen/4); i++) {
+ u8rsp = (u8_t *)(rsp+i);
+ //DbgPrint("0xC5:rsp[%d]=0x%lx\n", i, ((u32_t*)u8rsp)[0]);
+ zfCoreEvent(dev, 4, u8rsp);
+ }
+ }
+ else if (type == 0xC6)
+ {
+ zm_debug_msg0("\n\n WatchDog interrupt!!! : 0xC6 \n\n");
+ if (wd->zfcbHwWatchDogNotify != NULL)
+ {
+ wd->zfcbHwWatchDogNotify(dev);
+ }
+ }
+ else if (type == 0xC8)
+ {
+ //PZSW_ADAPTER adapter;
+
+ // for SPI flash program chk Flag
+ zfwDbgProgrameFlashChkDone(dev);
+ }
+ else if (type == 0xC9)
+ {
+ struct zsHpPriv* hpPriv=wd->hpPrivate;
+
+ zm_debug_msg0("##### Tx retransmission 5 times event #####");
+
+ /* correct tx retransmission issue */
+ hpPriv->retransmissionEvent = 1;
+ }
+ }
+ else
+ {
+ zfIdlRsp(dev, rsp, rspLen);
+ }
+}
+
+
+#define ZM_PROGRAM_RAM_ADDR 0x200000 //0x1000 //0x700000
+#define FIRMWARE_DOWNLOAD 0x30
+#define FIRMWARE_DOWNLOAD_COMP 0x31
+#define FIRMWARE_CONFIRM 0x32
+
+u16_t zfFirmwareDownload(zdev_t* dev, u32_t* fw, u32_t len, u32_t offset)
+{
+ u16_t ret = ZM_SUCCESS;
+ u32_t uCodeOfst = offset;
+ u8_t *image, *ptr;
+ u32_t result;
+
+ image = (u8_t*) fw;
+ ptr = image;
+
+ while (len > 0)
+ {
+ u32_t translen = (len > 4096) ? 4096 : len;
+
+ result = zfwUsbSubmitControl(dev, FIRMWARE_DOWNLOAD,
+ (u16_t) (uCodeOfst >> 8),
+ 0, image, translen);
+
+ if (result != ZM_SUCCESS)
+ {
+ zm_msg0_init(ZM_LV_0, "FIRMWARE_DOWNLOAD failed");
+ ret = 1;
+ goto exit;
+ }
+
+ len -= translen;
+ image += translen;
+ uCodeOfst += translen; // in Word (16 bit)
+
+ result = 0;
+ }
+
+ /* If download firmware success, issue a command to firmware */
+ if (ret == 0)
+ {
+ result = zfwUsbSubmitControl(dev, FIRMWARE_DOWNLOAD_COMP,
+ 0, 0, NULL, 0);
+
+ if (result != ZM_SUCCESS)
+ {
+ zm_msg0_init(ZM_LV_0, "FIRMWARE_DOWNLOAD_COMP failed");
+ ret = 1;
+ goto exit;
+ }
+ }
+
+#if 0
+ /* PCI code */
+ /* Wait for firmware ready */
+ result = zfwUsbSubmitControl(dev, FIRMWARE_CONFIRM, USB_DIR_IN | 0x40,
+ 0, 0, &ret_value, sizeof(ret_value), HZ);
+
+ if (result != 0)
+ {
+ zm_msg0_init(ZM_LV_0, "Can't receive firmware ready: ", result);
+ ret = 1;
+ }
+#endif
+
+exit:
+
+ return ret;
+
+}
+
+u16_t zfFirmwareDownloadNotJump(zdev_t* dev, u32_t* fw, u32_t len, u32_t offset)
+{
+ u16_t ret = ZM_SUCCESS;
+ u32_t uCodeOfst = offset;
+ u8_t *image, *ptr;
+ u32_t result;
+
+ image = (u8_t*) fw;
+ ptr = image;
+
+ while (len > 0)
+ {
+ u32_t translen = (len > 4096) ? 4096 : len;
+
+ result = zfwUsbSubmitControl(dev, FIRMWARE_DOWNLOAD,
+ (u16_t) (uCodeOfst >> 8),
+ 0, image, translen);
+
+ if (result != ZM_SUCCESS)
+ {
+ zm_msg0_init(ZM_LV_0, "FIRMWARE_DOWNLOAD failed");
+ ret = 1;
+ goto exit;
+ }
+
+ len -= translen;
+ image += translen;
+ uCodeOfst += translen; // in Word (16 bit)
+
+ result = 0;
+ }
+
+exit:
+
+ return ret;
+
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfIdlGetFreeTxdCount */
+/* Get free PCI PCI TxD count. */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* None */
+/* */
+/* AUTHOR */
+/* Stephen ZyDAS Technology Corporation 2006.6 */
+/* */
+/************************************************************************/
+u32_t zfHpGetFreeTxdCount(zdev_t* dev)
+{
+ return zfwUsbGetFreeTxQSize(dev);
+}
+
+u32_t zfHpGetMaxTxdCount(zdev_t* dev)
+{
+ //return 8;
+ return zfwUsbGetMaxTxQSize(dev);
+}
+
+void zfiUsbRegOutComplete(zdev_t* dev)
+{
+ return;
+}
+
+extern void zfPushVtxq(zdev_t* dev);
+
+void zfiUsbOutComplete(zdev_t* dev, zbuf_t *buf, u8_t status, u8_t *hdr) {
+#ifndef ZM_ENABLE_AGGREGATION
+ if (buf) {
+ zfwBufFree(dev, buf, 0);
+ }
+#else
+ #ifdef ZM_BYPASS_AGGR_SCHEDULING
+ //Simply free the buf since BA retransmission is done in the firmware
+ if (buf)
+ {
+ zfwBufFree(dev, buf, 0);
+ }
+ zfPushVtxq(dev);
+ #else
+ zmw_get_wlan_dev(dev);
+
+ #ifdef ZM_ENABLE_FW_BA_RETRANSMISSION
+ //Simply free the buf since BA retransmission is done in the firmware
+ if (buf)
+ {
+ zfwBufFree(dev, buf, 0);
+ }
+ #else
+ u8_t agg;
+ u16_t frameType;
+
+ if(!hdr && buf) {
+ zfwBufFree(dev, buf, 0);
+ //zm_debug_msg0("buf Free due to hdr == NULL");
+ return;
+ }
+
+ if(hdr && buf) {
+ frameType = hdr[8] & 0xf;
+ agg = (u8_t)(hdr[2] >> 5 ) & 0x1;
+ //zm_debug_msg1("AGG=", agg);
+
+ if (!status) {
+ if (agg) {
+ //delete buf in ba fail queue??
+ //not ganna happen?
+ }
+ else {
+ zfwBufFree(dev, buf, 0);
+ }
+ }
+ else {
+ if (agg) {
+ //don't do anything
+ //zfwBufFree(dev, buf, 0);
+ }
+ else {
+ zfwBufFree(dev, buf, 0);
+ }
+ }
+ }
+ #endif
+
+ if (wd->state != ZM_WLAN_STATE_ENABLED) {
+ return;
+ }
+
+ if( (wd->wlanMode == ZM_MODE_AP) ||
+ (wd->wlanMode == ZM_MODE_INFRASTRUCTURE && wd->sta.EnableHT) ||
+ (wd->wlanMode == ZM_MODE_PSEUDO) ) {
+ zfAggTxScheduler(dev, 0);
+ }
+ #endif
+#endif
+
+ return;
+
+}
+
diff --git a/drivers/staging/otus/hal/hpusb.h b/drivers/staging/otus/hal/hpusb.h
new file mode 100644
index 00000000000..35a0c5668ce
--- /dev/null
+++ b/drivers/staging/otus/hal/hpusb.h
@@ -0,0 +1,437 @@
+/*
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* Module Name : ud_defs.h */
+/* */
+/* Abstract */
+/* This module contains USB data structure definitions. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/************************************************************************/
+
+#ifndef _HPUSB_H
+#define _HPUSB_H
+
+#define ZM_OTUS_ENABLE_RETRY_FREQ_CHANGE
+#define ZM_BEACON_BUFFER_ADDRESS 0x117900
+
+#define ZM_MAX_CMD_SIZE 64
+#define ZM_HAL_MAX_EEPROM_REQ 510
+#define ZM_HAL_MAX_EEPROM_PRQ 2
+
+/* For USB STREAM mode */
+#ifdef ZM_DISABLE_AMSDU8K_SUPPORT
+#define ZM_MAX_USB_IN_TRANSFER_SIZE 4096
+#else
+#define ZM_MAX_USB_IN_TRANSFER_SIZE 8192
+#endif
+#define ZM_USB_STREAM_MODE_TAG_LEN 4
+#define ZM_USB_STREAM_MODE_TAG 0x4e00
+#define ZM_USB_MAX_EPINT_BUFFER 64
+
+struct zsCmdQ
+{
+ u16_t src;
+ u16_t cmdLen;
+ u8_t* buf;
+ u32_t cmd[ZM_MAX_CMD_SIZE/4];
+};
+
+struct zsCommand
+{
+ u16_t delayWcmdCount;
+ u32_t delayWcmdAddr[(ZM_CMD_QUEUE_SIZE-4)/4];
+ u32_t delayWcmdVal[(ZM_CMD_QUEUE_SIZE-4)/4];
+};
+
+struct zsHalRxInfo
+{
+ u32_t currentRSSI[7]; /* RSSI combined */
+ u32_t currentRxEVM[14];
+ u32_t currentRxDataMT;
+ u32_t currentRxDataMCS;
+ u32_t currentRxDataBW;
+ u32_t currentRxDataSG;
+};
+
+struct zsHpPriv
+{
+ u16_t hwFrequency;
+ u8_t hwBw40;
+ u8_t hwExtOffset;
+
+ u8_t disableDfsCh;
+
+ u32_t halCapability;
+
+ /* Fortunately the second loop can be disabled with a bit */
+ /* called en_pd_dc_offset_thr */
+ u8_t hwNotFirstInit;
+
+ /* command queue */
+ u16_t cmdHead;
+ u16_t cmdTail;
+#ifdef ZM_XP_USB_MULTCMD
+ u16_t cmdSend; // Used for Mult send USB cmd
+#endif
+ struct zsCmdQ cmdQ[ZM_CMD_QUEUE_SIZE];
+ u16_t cmdPending;
+ struct zsCommand cmd; /* buffer for delayed commands */
+ u8_t ledMode[2];
+ u32_t ctlBusy;
+ u32_t extBusy;
+
+ /*
+ * ANI & Radar support.
+ */
+ u32_t procPhyErr; /* Process Phy errs */
+ u8_t hasHwPhyCounters; /* Hardware has phy counters */
+ u32_t aniPeriod; /* ani update list period */
+ struct zsAniStats stats; /* various statistics */
+ struct zsAniState *curani; /* cached last reference */
+ struct zsAniState ani[50]; /* per-channel state */
+
+ /*
+ * Ani tables that change between the 5416 and 5312.
+ * These get set at attach time.
+ * XXX don't belong here
+ * XXX need better explanation
+ */
+ s32_t totalSizeDesired[5];
+ s32_t coarseHigh[5];
+ s32_t coarseLow[5];
+ s32_t firpwr[5];
+
+ /*
+ * ANI related PHY register value.
+ */
+ u32_t regPHYDesiredSZ;
+ u32_t regPHYFindSig;
+ u32_t regPHYAgcCtl1;
+ u32_t regPHYSfcorr;
+ u32_t regPHYSfcorrLow;
+ u32_t regPHYTiming5;
+ u32_t regPHYCckDetect;
+
+ u32_t eepromImage[1024];
+ u32_t eepromImageIndex;
+ u32_t eepromImageRdReq;
+
+ u8_t halReInit;
+
+ u8_t OpFlags;
+
+ u8_t tPow2xCck[4];
+ u8_t tPow2x2g[4];
+ u8_t tPow2x2g24HeavyClipOffset;
+ u8_t tPow2x2gHt20[8];
+ u8_t tPow2x2gHt40[8];
+ u8_t tPow2x5g[4];
+ u8_t tPow2x5gHt20[8];
+ u8_t tPow2x5gHt40[8];
+
+ /* hwBBHeavyClip : used compatibility */
+ /* 0 : dongle not support. */
+ /* !0: support heavy clip. */
+ u8_t hwBBHeavyClip;
+ u8_t enableBBHeavyClip; /* 0=>force disable 1=>enable */
+ u8_t doBBHeavyClip; /* set 1 if heavy clip need by each frequency switch */
+ u32_t setValueHeavyClip; /* save setting value for heavy clip when completed routine */
+
+ /*
+ * Rxdata RSSI, EVM, Rate etc...
+ */
+ struct zsHalRxInfo halRxInfo;
+
+ u32_t usbSendBytes;
+ u32_t usbAcSendBytes[4];
+
+ u16_t aggMaxDurationBE;
+ u32_t aggPktNum;
+
+ u16_t txop[4];
+ u16_t cwmin[4];
+ u16_t cwmax[4];
+ u8_t strongRSSI;
+ u8_t rxStrongRSSI;
+
+ u8_t slotType; //0->20us, 1=>9us
+
+#ifdef ZM_OTUS_RX_STREAM_MODE
+ u16_t usbRxRemainLen;
+ u16_t usbRxPktLen;
+ u16_t usbRxPadLen;
+ u16_t usbRxTransferLen;
+ zbuf_t *remainBuf;
+#endif
+
+ u8_t dot11Mode;
+
+ u8_t ibssBcnEnabled;
+ u32_t ibssBcnInterval;
+
+ // For re-issue the frequency change command
+ u32_t latestFrequency;
+ u8_t latestBw40;
+ u8_t latestExtOffset;
+ u8_t freqRetryCounter;
+
+ u8_t recordFreqRetryCounter;
+ u8_t isSiteSurvey;
+ u8_t coldResetNeedFreq;
+
+ u64_t camRollCallTable;
+ u8_t currentAckRtsTpc;
+
+ /* #1 Save the initial value of the related RIFS register settings */
+ //u32_t isInitialPhy;
+ u32_t initDesiredSigSize;
+ u32_t initAGC;
+ u32_t initAgcControl;
+ u32_t initSearchStartDelay;
+ u32_t initRIFSSearchParams;
+ u32_t initFastChannelChangeControl;
+
+ /* Dynamic SIFS for retransmission event */
+ u8_t retransmissionEvent;
+ u8_t latestSIFS;
+};
+
+extern u32_t zfHpLoadEEPROMFromFW(zdev_t* dev);
+
+
+typedef u8_t A_UINT8;
+typedef s8_t A_INT8;
+typedef u16_t A_UINT16;
+typedef u32_t A_UINT32;
+#define __ATTRIB_PACK
+
+#pragma pack (push, 1)
+
+#define AR5416_EEP_VER 0xE
+#define AR5416_EEP_VER_MINOR_MASK 0xFFF
+#define AR5416_EEP_NO_BACK_VER 0x1
+#define AR5416_EEP_MINOR_VER_2 0x2 // Adds modal params txFrameToPaOn, txFrametoDataStart, ht40PowerInc
+#define AR5416_EEP_MINOR_VER_3 0x3 // Adds modal params bswAtten, bswMargin, swSettle and base OpFlags for HT20/40 Disable
+
+// 16-bit offset location start of calibration struct
+#define AR5416_EEP_START_LOC 256
+#define AR5416_NUM_5G_CAL_PIERS 8
+#define AR5416_NUM_2G_CAL_PIERS 4
+#define AR5416_NUM_5G_20_TARGET_POWERS 8
+#define AR5416_NUM_5G_40_TARGET_POWERS 8
+#define AR5416_NUM_2G_CCK_TARGET_POWERS 3
+#define AR5416_NUM_2G_20_TARGET_POWERS 4
+#define AR5416_NUM_2G_40_TARGET_POWERS 4
+#define AR5416_NUM_CTLS 24
+#define AR5416_NUM_BAND_EDGES 8
+#define AR5416_NUM_PD_GAINS 4
+#define AR5416_PD_GAINS_IN_MASK 4
+#define AR5416_PD_GAIN_ICEPTS 5
+#define AR5416_EEPROM_MODAL_SPURS 5
+#define AR5416_MAX_RATE_POWER 63
+#define AR5416_NUM_PDADC_VALUES 128
+#define AR5416_NUM_RATES 16
+#define AR5416_BCHAN_UNUSED 0xFF
+#define AR5416_MAX_PWR_RANGE_IN_HALF_DB 64
+#define AR5416_OPFLAGS_11A 0x01
+#define AR5416_OPFLAGS_11G 0x02
+#define AR5416_OPFLAGS_5G_HT40 0x04
+#define AR5416_OPFLAGS_2G_HT40 0x08
+#define AR5416_OPFLAGS_5G_HT20 0x10
+#define AR5416_OPFLAGS_2G_HT20 0x20
+#define AR5416_EEPMISC_BIG_ENDIAN 0x01
+#define FREQ2FBIN(x,y) ((y) ? ((x) - 2300) : (((x) - 4800) / 5))
+#define AR5416_MAX_CHAINS 2
+#define AR5416_ANT_16S 25
+
+#define AR5416_NUM_ANT_CHAIN_FIELDS 7
+#define AR5416_NUM_ANT_COMMON_FIELDS 4
+#define AR5416_SIZE_ANT_CHAIN_FIELD 3
+#define AR5416_SIZE_ANT_COMMON_FIELD 4
+#define AR5416_ANT_CHAIN_MASK 0x7
+#define AR5416_ANT_COMMON_MASK 0xf
+#define AR5416_CHAIN_0_IDX 0
+#define AR5416_CHAIN_1_IDX 1
+#define AR5416_CHAIN_2_IDX 2
+
+
+/* Capabilities Enum */
+typedef enum {
+ EEPCAP_COMPRESS_DIS = 0x0001,
+ EEPCAP_AES_DIS = 0x0002,
+ EEPCAP_FASTFRAME_DIS = 0x0004,
+ EEPCAP_BURST_DIS = 0x0008,
+ EEPCAP_MAXQCU_M = 0x01F0,
+ EEPCAP_MAXQCU_S = 4,
+ EEPCAP_HEAVY_CLIP_EN = 0x0200,
+ EEPCAP_KC_ENTRIES_M = 0xF000,
+ EEPCAP_KC_ENTRIES_S = 12,
+} EEPROM_CAPABILITIES;
+
+typedef enum Ar5416_Rates {
+ rate6mb, rate9mb, rate12mb, rate18mb,
+ rate24mb, rate36mb, rate48mb, rate54mb,
+ rate1l, rate2l, rate2s, rate5_5l,
+ rate5_5s, rate11l, rate11s, rateXr,
+ rateHt20_0, rateHt20_1, rateHt20_2, rateHt20_3,
+ rateHt20_4, rateHt20_5, rateHt20_6, rateHt20_7,
+ rateHt40_0, rateHt40_1, rateHt40_2, rateHt40_3,
+ rateHt40_4, rateHt40_5, rateHt40_6, rateHt40_7,
+ rateDupCck, rateDupOfdm, rateExtCck, rateExtOfdm,
+ Ar5416RateSize
+} AR5416_RATES;
+
+typedef struct eepFlags {
+ A_UINT8 opFlags;
+ A_UINT8 eepMisc;
+} __ATTRIB_PACK EEP_FLAGS;
+
+#define AR5416_CHECKSUM_LOCATION (AR5416_EEP_START_LOC + 1)
+typedef struct BaseEepHeader {
+ A_UINT16 length;
+ A_UINT16 checksum;
+ A_UINT16 version;
+ EEP_FLAGS opCapFlags;
+ A_UINT16 regDmn[2];
+ A_UINT8 macAddr[6];
+ A_UINT8 rxMask;
+ A_UINT8 txMask;
+ A_UINT16 rfSilent;
+ A_UINT16 blueToothOptions;
+ A_UINT16 deviceCap;
+ A_UINT32 binBuildNumber;
+ A_UINT8 deviceType;
+ A_UINT8 futureBase[33];
+} __ATTRIB_PACK BASE_EEP_HEADER; // 64 B
+
+typedef struct spurChanStruct {
+ A_UINT16 spurChan;
+ A_UINT8 spurRangeLow;
+ A_UINT8 spurRangeHigh;
+} __ATTRIB_PACK SPUR_CHAN;
+
+typedef struct ModalEepHeader {
+ A_UINT32 antCtrlChain[AR5416_MAX_CHAINS]; // 12
+ A_UINT32 antCtrlCommon; // 4
+ A_INT8 antennaGainCh[AR5416_MAX_CHAINS]; // 3
+ A_UINT8 switchSettling; // 1
+ A_UINT8 txRxAttenCh[AR5416_MAX_CHAINS]; // 3
+ A_UINT8 rxTxMarginCh[AR5416_MAX_CHAINS]; // 3
+ A_INT8 adcDesiredSize; // 1
+ A_INT8 pgaDesiredSize; // 1
+ A_UINT8 xlnaGainCh[AR5416_MAX_CHAINS]; // 3
+ A_UINT8 txEndToXpaOff; // 1
+ A_UINT8 txEndToRxOn; // 1
+ A_UINT8 txFrameToXpaOn; // 1
+ A_UINT8 thresh62; // 1
+ A_INT8 noiseFloorThreshCh[AR5416_MAX_CHAINS]; // 3
+ A_UINT8 xpdGain; // 1
+ A_UINT8 xpd; // 1
+ A_INT8 iqCalICh[AR5416_MAX_CHAINS]; // 1
+ A_INT8 iqCalQCh[AR5416_MAX_CHAINS]; // 1
+ A_UINT8 pdGainOverlap; // 1
+ A_UINT8 ob; // 1
+ A_UINT8 db; // 1
+ A_UINT8 xpaBiasLvl; // 1
+ A_UINT8 pwrDecreaseFor2Chain; // 1
+ A_UINT8 pwrDecreaseFor3Chain; // 1 -> 48 B
+ A_UINT8 txFrameToDataStart; // 1
+ A_UINT8 txFrameToPaOn; // 1
+ A_UINT8 ht40PowerIncForPdadc; // 1
+ A_UINT8 bswAtten[AR5416_MAX_CHAINS]; // 3
+ A_UINT8 bswMargin[AR5416_MAX_CHAINS]; // 3
+ A_UINT8 swSettleHt40; // 1
+ A_UINT8 futureModal[22]; //
+ SPUR_CHAN spurChans[AR5416_EEPROM_MODAL_SPURS]; // 20 B
+} __ATTRIB_PACK MODAL_EEP_HEADER; // == 100 B
+
+typedef struct calDataPerFreq {
+ A_UINT8 pwrPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
+ A_UINT8 vpdPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
+} __ATTRIB_PACK CAL_DATA_PER_FREQ;
+
+typedef struct CalTargetPowerLegacy {
+ A_UINT8 bChannel;
+ A_UINT8 tPow2x[4];
+} __ATTRIB_PACK CAL_TARGET_POWER_LEG;
+
+typedef struct CalTargetPowerHt {
+ A_UINT8 bChannel;
+ A_UINT8 tPow2x[8];
+} __ATTRIB_PACK CAL_TARGET_POWER_HT;
+
+#if defined(ARCH_BIG_ENDIAN) || defined(BIG_ENDIAN)
+typedef struct CalCtlEdges {
+ A_UINT8 bChannel;
+ A_UINT8 flag :2,
+ tPower :6;
+} __ATTRIB_PACK CAL_CTL_EDGES;
+#else
+typedef struct CalCtlEdges {
+ A_UINT8 bChannel;
+ A_UINT8 tPower :6,
+ flag :2;
+} __ATTRIB_PACK CAL_CTL_EDGES;
+#endif
+
+typedef struct CalCtlData {
+ CAL_CTL_EDGES ctlEdges[AR5416_MAX_CHAINS][AR5416_NUM_BAND_EDGES];
+} __ATTRIB_PACK CAL_CTL_DATA;
+
+typedef struct ar5416Eeprom {
+ BASE_EEP_HEADER baseEepHeader; // 64 B
+ A_UINT8 custData[64]; // 64 B
+ MODAL_EEP_HEADER modalHeader[2]; // 200 B
+ A_UINT8 calFreqPier5G[AR5416_NUM_5G_CAL_PIERS];
+ A_UINT8 calFreqPier2G[AR5416_NUM_2G_CAL_PIERS];
+ CAL_DATA_PER_FREQ calPierData5G[AR5416_MAX_CHAINS][AR5416_NUM_5G_CAL_PIERS];
+ CAL_DATA_PER_FREQ calPierData2G[AR5416_MAX_CHAINS][AR5416_NUM_2G_CAL_PIERS];
+ CAL_TARGET_POWER_LEG calTargetPower5G[AR5416_NUM_5G_20_TARGET_POWERS];
+ CAL_TARGET_POWER_HT calTargetPower5GHT20[AR5416_NUM_5G_20_TARGET_POWERS];
+ CAL_TARGET_POWER_HT calTargetPower5GHT40[AR5416_NUM_5G_40_TARGET_POWERS];
+ CAL_TARGET_POWER_LEG calTargetPowerCck[AR5416_NUM_2G_CCK_TARGET_POWERS];
+ CAL_TARGET_POWER_LEG calTargetPower2G[AR5416_NUM_2G_20_TARGET_POWERS];
+ CAL_TARGET_POWER_HT calTargetPower2GHT20[AR5416_NUM_2G_20_TARGET_POWERS];
+ CAL_TARGET_POWER_HT calTargetPower2GHT40[AR5416_NUM_2G_40_TARGET_POWERS];
+ A_UINT8 ctlIndex[AR5416_NUM_CTLS];
+ CAL_CTL_DATA ctlData[AR5416_NUM_CTLS];
+ A_UINT8 padding;
+} __ATTRIB_PACK AR5416_EEPROM;
+
+#pragma pack (pop)
+
+typedef enum ConformanceTestLimits {
+ FCC = 0x10,
+ MKK = 0x40,
+ ETSI = 0x30,
+ SD_NO_CTL = 0xE0,
+ NO_CTL = 0xFF,
+ CTL_MODE_M = 0xF,
+ CTL_11A = 0,
+ CTL_11B = 1,
+ CTL_11G = 2,
+ CTL_TURBO = 3,
+ CTL_108G = 4,
+ CTL_2GHT20 = 5,
+ CTL_5GHT20 = 6,
+ CTL_2GHT40 = 7,
+ CTL_5GHT40 = 8,
+} ATH_CTLS;
+
+#endif /* #ifndef _HPUSB_H */
diff --git a/drivers/staging/otus/hal/otus.ini b/drivers/staging/otus/hal/otus.ini
new file mode 100644
index 00000000000..34efeb6c285
--- /dev/null
+++ b/drivers/staging/otus/hal/otus.ini
@@ -0,0 +1,414 @@
+/* 8602 : update mismatch register between NDIS and ART */
+static const u32_t ar5416Modes[][6] = {
+/* Register A-20 A-20/40 G-20/40 G-20 G-Turbo */
+ {0x9800, 0x00000007, 0x00000007, 0x00000007, 0x00000007, 0},
+ {0x9804, 0x00000300, 0x000003c4, 0x000003c4, 0x00000300, 0},
+ {0x9808, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x980c, 0xad848e19, 0xad848e19, 0xad848e19, 0xad848e19, 0},
+ {0x9810, 0x7d14e000, 0x7d14e000, 0x7d14e000, 0x7d14e000, 0},
+ {0x9814, 0x9c0a9f6b, 0x9c0a9f6b, 0x9c0a9f6b, 0x9c0a9f6b, 0},
+ {0x9818, 0x00000090, 0x00000090, 0x00000090, 0x00000090, 0},
+ {0x981c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9820, 0x02020200, 0x02020200, 0x02020200, 0x02020200, 0},
+ {0x9824, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0},
+ {0x9828, 0x0a020001, 0x0a020001, 0x0a020001, 0x0a020001, 0},
+ {0x982c, 0x0000a000, 0x0000a000, 0x0000a000, 0x0000a000, 0},
+ {0x9830, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9834, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0},
+ {0x9838, 0x00000007, 0x00000007, 0x00000007, 0x00000007, 0},
+ {0x983c, 0x00200400, 0x00200400, 0x00200400, 0x00200400, 0},
+ {0x9840, 0x206a002e, 0x206a002e, 0x206a002e, 0x206a002e, 0},
+ {0x9844, 0x1372161e, 0x13721c1e, 0x13721c24, 0x137216a4, 0},
+ {0x9848, 0x001a6a65, 0x001a6a65, 0x00197a68, 0x00197a68, 0},
+ {0x984c, 0x1284233c, 0x1284233c, 0x1284233c, 0x1284233c, 0},
+ {0x9850, 0x6c48b4e4, 0x6c48b4e4, 0x6c48b0e4, 0x6c48b0e4, 0},
+ {0x9854, 0x00000859, 0x00000859, 0x00000859, 0x00000859, 0},
+ {0x9858, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0},
+ {0x985c, 0x31395c5e, 0x31395c5e, 0x31395c5e, 0x31395c5e, 0},
+ {0x9860, 0x0004dd10, 0x0004dd10, 0x0004dd20, 0x0004dd20, 0},
+ {0x9868, 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190, 0},
+ {0x986c, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0},
+ {0x9900, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9904, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9908, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x990c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9914, 0x000007d0, 0x000007d0, 0x00000898, 0x00000898, 0},
+ {0x9918, 0x00000118, 0x00000230, 0x00000268, 0x00000134, 0},
+ {0x991c, 0x10000fff, 0x10000fff, 0x10000fff, 0x10000fff, 0},
+ {0x9920, 0x0510081c, 0x0510081c, 0x0510001c, 0x0510001c, 0},
+ {0x9924, 0xd0058a15, 0xd0058a15, 0xd0058a15, 0xd0058a15, 0},
+ {0x9928, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0},
+ {0x992c, 0x00000004, 0x00000004, 0x00000004, 0x00000004, 0},
+ {0x9934, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0},
+ {0x9938, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0},
+ {0x993c, 0x0000007f, 0x0000007f, 0x0000007f, 0x0000007f, 0},
+ {0x9944, 0xdfb81020, 0xdfb81020, 0xdfb81020, 0xdfb81020, 0},
+ {0x9948, 0x9280b212, 0x9280b212, 0x9280b212, 0x9280b212, 0},
+ {0x994c, 0x00020028, 0x00020028, 0x00020028, 0x00020028, 0},
+ {0x9954, 0x5d50e188, 0x5d50e188, 0x5d50e188, 0x5d50e188, 0},
+ {0x9958, 0x00081fff, 0x00081fff, 0x00081fff, 0x00081fff, 0},
+ {0x9960, 0x00009b40, 0x00009b40, 0x00009b40, 0x00009b40, 0},
+ {0x9964, 0x00001120, 0x00001120, 0x00001120, 0x00001120, 0},
+ {0x9970, 0x190fb515, 0x190fb515, 0x190fb515, 0x190fb515, 0},
+ {0x9974, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9978, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0},
+ {0x997c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9980, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9984, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9988, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x998c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9990, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9994, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9998, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x999c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x99a0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x99a4, 0x00000007, 0x00000007, 0x00000007, 0x00000007, 0},
+ {0x99a8, 0x001fff00, 0x001fff00, 0x001fff00, 0x001fff00, 0},
+ {0x99ac, 0x006f00c4, 0x006f00c4, 0x006f00c4, 0x006f00c4, 0},
+ {0x99b0, 0x03051000, 0x03051000, 0x03051000, 0x03051000, 0},
+ {0x99b4, 0x00000820, 0x00000820, 0x00000820, 0x00000820, 0},
+ {0x99c0, 0x038919be, 0x038919be, 0x038919be, 0x038919be, 0},
+ {0x99c4, 0x06336f77, 0x06336f77, 0x06336f77, 0x06336f77, 0},
+ {0x99c8, 0x60f6532c, 0x60f6532c, 0x60f6532c, 0x60f6532c, 0},
+ {0x99cc, 0x08f186c8, 0x08f186c8, 0x08f186c8, 0x08f186c8, 0},
+ {0x99d0, 0x00046384, 0x00046384, 0x00046384, 0x00046384, 0},
+ {0x99d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x99d8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x99dc, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x99e0, 0x00000200, 0x00000200, 0x00000200, 0x00000200, 0},
+ {0x99e4, 0x64646464, 0x64646464, 0x64646464, 0x64646464, 0},
+ {0x99e8, 0x3c787878, 0x3c787878, 0x3c787878, 0x3c787878, 0},
+ {0x99ec, 0x000000aa, 0x000000aa, 0x000000aa, 0x000000aa, 0},
+ {0x99f0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x99fc, 0x00001042, 0x00001042, 0x00001042, 0x00001042, 0},
+ {0x9a00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9a04, 0x00000040, 0x00000040, 0x00000040, 0x00000040, 0},
+ {0x9a08, 0x00000080, 0x00000080, 0x00000080, 0x00000080, 0},
+ {0x9a0c, 0x000001a1, 0x000001a1, 0x00000141, 0x00000141, 0},
+ {0x9a10, 0x000001e1, 0x000001e1, 0x00000181, 0x00000181, 0},
+ {0x9a14, 0x00000021, 0x00000021, 0x000001c1, 0x000001c1, 0},
+ {0x9a18, 0x00000061, 0x00000061, 0x00000001, 0x00000001, 0},
+ {0x9a1c, 0x00000168, 0x00000168, 0x00000041, 0x00000041, 0},
+ {0x9a20, 0x000001a8, 0x000001a8, 0x000001a8, 0x000001a8, 0},
+ {0x9a24, 0x000001e8, 0x000001e8, 0x000001e8, 0x000001e8, 0},
+ {0x9a28, 0x00000028, 0x00000028, 0x00000028, 0x00000028, 0},
+ {0x9a2c, 0x00000068, 0x00000068, 0x00000068, 0x00000068, 0},
+ {0x9a30, 0x00000189, 0x00000189, 0x000000a8, 0x000000a8, 0},
+ {0x9a34, 0x000001c9, 0x000001c9, 0x00000169, 0x00000169, 0},
+ {0x9a38, 0x00000009, 0x00000009, 0x000001a9, 0x000001a9, 0},
+ {0x9a3c, 0x00000049, 0x00000049, 0x000001e9, 0x000001e9, 0},
+ {0x9a40, 0x00000089, 0x00000089, 0x00000029, 0x00000029, 0},
+ {0x9a44, 0x00000170, 0x00000170, 0x00000069, 0x00000069, 0},
+ {0x9a48, 0x000001b0, 0x000001b0, 0x00000190, 0x00000190, 0},
+ {0x9a4c, 0x000001f0, 0x000001f0, 0x000001d0, 0x000001d0, 0},
+ {0x9a50, 0x00000030, 0x00000030, 0x00000010, 0x00000010, 0},
+ {0x9a54, 0x00000070, 0x00000070, 0x00000050, 0x00000050, 0},
+ {0x9a58, 0x00000191, 0x00000191, 0x00000090, 0x00000090, 0},
+ {0x9a5c, 0x000001d1, 0x000001d1, 0x00000151, 0x00000151, 0},
+ {0x9a60, 0x00000011, 0x00000011, 0x00000191, 0x00000191, 0},
+ {0x9a64, 0x00000051, 0x00000051, 0x000001d1, 0x000001d1, 0},
+ {0x9a68, 0x00000091, 0x00000091, 0x00000011, 0x00000011, 0},
+ {0x9a6c, 0x000001b8, 0x000001b8, 0x00000051, 0x00000051, 0},
+ {0x9a70, 0x000001f8, 0x000001f8, 0x00000198, 0x00000198, 0},
+ {0x9a74, 0x00000038, 0x00000038, 0x000001d8, 0x000001d8, 0},
+ {0x9a78, 0x00000078, 0x00000078, 0x00000018, 0x00000018, 0},
+ {0x9a7c, 0x00000199, 0x00000199, 0x00000058, 0x00000058, 0},
+ {0x9a80, 0x000001d9, 0x000001d9, 0x00000098, 0x00000098, 0},
+ {0x9a84, 0x00000019, 0x00000019, 0x00000159, 0x00000159, 0},
+ {0x9a88, 0x00000059, 0x00000059, 0x00000199, 0x00000199, 0},
+ {0x9a8c, 0x00000099, 0x00000099, 0x000001d9, 0x000001d9, 0},
+ {0x9a90, 0x000000d9, 0x000000d9, 0x00000019, 0x00000019, 0},
+ {0x9a94, 0x000000f9, 0x000000f9, 0x00000059, 0x00000059, 0},
+ {0x9a98, 0x000000f9, 0x000000f9, 0x00000099, 0x00000099, 0},
+ {0x9a9c, 0x000000f9, 0x000000f9, 0x000000d9, 0x000000d9, 0},
+ {0x9aa0, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9aa4, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9aa8, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9aac, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9ab0, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9ab4, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9ab8, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9abc, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9ac0, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9ac4, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9ac8, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9acc, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9ad0, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9ad4, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9ad8, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9adc, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9ae0, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9ae4, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9ae8, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9aec, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9af0, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9af4, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9af8, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9afc, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0},
+ {0x9b00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9b04, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0},
+ {0x9b08, 0x00000002, 0x00000002, 0x00000002, 0x00000002, 0},
+ {0x9b0c, 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0},
+ {0x9b10, 0x00000004, 0x00000004, 0x00000004, 0x00000004, 0},
+ {0x9b14, 0x00000005, 0x00000005, 0x00000005, 0x00000005, 0},
+ {0x9b18, 0x00000008, 0x00000008, 0x00000008, 0x00000008, 0},
+ {0x9b1c, 0x00000009, 0x00000009, 0x00000009, 0x00000009, 0},
+ {0x9b20, 0x0000000a, 0x0000000a, 0x0000000a, 0x0000000a, 0},
+ {0x9b24, 0x0000000b, 0x0000000b, 0x0000000b, 0x0000000b, 0},
+ {0x9b28, 0x0000000c, 0x0000000c, 0x0000000c, 0x0000000c, 0},
+ {0x9b2c, 0x0000000d, 0x0000000d, 0x0000000d, 0x0000000d, 0},
+ {0x9b30, 0x00000010, 0x00000010, 0x00000010, 0x00000010, 0},
+ {0x9b34, 0x00000011, 0x00000011, 0x00000011, 0x00000011, 0},
+ {0x9b38, 0x00000012, 0x00000012, 0x00000012, 0x00000012, 0},
+ {0x9b3c, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0},
+ {0x9b40, 0x00000014, 0x00000014, 0x00000014, 0x00000014, 0},
+ {0x9b44, 0x00000015, 0x00000015, 0x00000015, 0x00000015, 0},
+ {0x9b48, 0x00000018, 0x00000018, 0x00000018, 0x00000018, 0},
+ {0x9b4c, 0x00000019, 0x00000019, 0x00000019, 0x00000019, 0},
+ {0x9b50, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a, 0},
+ {0x9b54, 0x0000001b, 0x0000001b, 0x0000001b, 0x0000001b, 0},
+ {0x9b58, 0x0000001c, 0x0000001c, 0x0000001c, 0x0000001c, 0},
+ {0x9b5c, 0x0000001d, 0x0000001d, 0x0000001d, 0x0000001d, 0},
+ {0x9b60, 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0},
+ {0x9b64, 0x00000021, 0x00000021, 0x00000021, 0x00000021, 0},
+ {0x9b68, 0x00000022, 0x00000022, 0x00000022, 0x00000022, 0},
+ {0x9b6c, 0x00000023, 0x00000023, 0x00000023, 0x00000023, 0},
+ {0x9b70, 0x00000024, 0x00000024, 0x00000024, 0x00000024, 0},
+ {0x9b74, 0x00000025, 0x00000025, 0x00000025, 0x00000025, 0},
+ {0x9b78, 0x00000028, 0x00000028, 0x00000028, 0x00000028, 0},
+ {0x9b7c, 0x00000029, 0x00000029, 0x00000029, 0x00000029, 0},
+ {0x9b80, 0x0000002a, 0x0000002a, 0x0000002a, 0x0000002a, 0},
+ {0x9b84, 0x0000002b, 0x0000002b, 0x0000002b, 0x0000002b, 0},
+ {0x9b88, 0x0000002c, 0x0000002c, 0x0000002c, 0x0000002c, 0},
+ {0x9b8c, 0x0000002d, 0x0000002d, 0x0000002d, 0x0000002d, 0},
+ {0x9b90, 0x00000030, 0x00000030, 0x00000030, 0x00000030, 0},
+ {0x9b94, 0x00000031, 0x00000031, 0x00000031, 0x00000031, 0},
+ {0x9b98, 0x00000032, 0x00000032, 0x00000032, 0x00000032, 0},
+ {0x9b9c, 0x00000033, 0x00000033, 0x00000033, 0x00000033, 0},
+ {0x9ba0, 0x00000034, 0x00000034, 0x00000034, 0x00000034, 0},
+ {0x9ba4, 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0},
+ {0x9ba8, 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0},
+ {0x9bac, 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0},
+ {0x9bb0, 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0},
+ {0x9bb4, 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0},
+ {0x9bb8, 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0},
+ {0x9bbc, 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0},
+ {0x9bc0, 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0},
+ {0x9bc4, 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0},
+ {0x9bc8, 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0},
+ {0x9bcc, 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0},
+ {0x9bd0, 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0},
+ {0x9bd4, 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0},
+ {0x9bd8, 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0},
+ {0x9bdc, 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0},
+ {0x9be0, 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0},
+ {0x9be4, 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0},
+ {0x9be8, 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0},
+ {0x9bec, 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0},
+ {0x9bf0, 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0},
+ {0x9bf4, 0x00000035, 0x00000035, 0x00000035, 0x00000035, 0},
+ {0x9bf8, 0x00000010, 0x00000010, 0x00000010, 0x00000010, 0},
+ {0x9bfc, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a, 0},
+ {0x9c00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9c0c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9c10, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9c14, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9c18, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9c1c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9c20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9c24, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9c28, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9c2c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9c30, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9c34, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9c38, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9c3c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9cf0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9cf4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9cf8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0x9cfc, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa200, 0x00000008, 0x00000008, 0x0000000e, 0x0000000e, 0},
+ {0xa204, 0x00000440, 0x00000440, 0x00000440, 0x00000440, 0},
+ {0xa208, 0xd6be4788, 0xd6be4788, 0xd03e4788, 0xd03e4788, 0},
+ {0xa20c, 0x012e8160, 0x012e8160, 0x012a8160, 0x012a8160, 0},
+ {0xa210, 0x40806333, 0x40806333, 0x40806333, 0x40806333, 0},
+ {0xa214, 0x00106c10, 0x00106c10, 0x00106c10, 0x00106c10, 0},
+ {0xa218, 0x009c4060, 0x009c4060, 0x009c4060, 0x009c4060, 0},
+ {0xa21c, 0x1883800a, 0x1883800a, 0x1883800a, 0x1883800a, 0},
+ {0xa220, 0x018830c6, 0x018830c6, 0x018830c6, 0x018830c6, 0},
+ {0xa224, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0},
+ {0xa228, 0x000009b5, 0x000009b5, 0x000009b5, 0x000009b5, 0},
+ {0xa22c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa230, 0x00000108, 0x00000210, 0x00000210, 0x00000108, 0},
+ {0xa234, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0},
+ {0xa238, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0},
+ {0xa23c, 0x13c889af, 0x13c889af, 0x13c889af, 0x13c889af, 0},
+ {0xa240, 0x38490a20, 0x38490a20, 0x38490a20, 0x38490a20, 0},
+ {0xa244, 0x00007bb6, 0x00007bb6, 0x00007bb6, 0x00007bb6, 0},
+ {0xa248, 0x0fff3ffc, 0x0fff3ffc, 0x0fff3ffc, 0x0fff3ffc, 0},
+ {0xa24c, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0},
+ {0xa250, 0x0000a000, 0x0000a000, 0x0000a000, 0x0000a000, 0},
+ {0xa254, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa258, 0x0cc75380, 0x0cc75380, 0x0cc75380, 0x0cc75380, 0},
+ {0xa25c, 0x0f0f0f01, 0x0f0f0f01, 0x0f0f0f01, 0x0f0f0f01, 0},
+ {0xa260, 0xdfa91f01, 0xdfa91f01, 0xdfa91f01, 0xdfa91f01, 0},
+ {0xa264, 0x00418a11, 0x00418a11, 0x00418a11, 0x00418a11, 0},
+ {0xa268, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa26c, 0x09249126, 0x09249126, 0x09249126, 0x09249126, 0},
+ {0xa274, 0x0a1a9caa, 0x0a1a9caa, 0x0a1a7caa, 0x0a1a7caa, 0},
+ {0xa278, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce, 0},
+ {0xa27c, 0x051701ce, 0x051701ce, 0x051701ce, 0x051701ce, 0},
+ {0xa300, 0x18010000, 0x18010000, 0x18010000, 0x18010000, 0},
+ {0xa304, 0x30032602, 0x30032602, 0x2e032402, 0x2e032402, 0},
+ {0xa308, 0x48073e06, 0x48073e06, 0x4a0a3c06, 0x4a0a3c06, 0},
+ {0xa30c, 0x560b4c0a, 0x560b4c0a, 0x621a540b, 0x621a540b, 0},
+ {0xa310, 0x641a600f, 0x641a600f, 0x764f6c1b, 0x764f6c1b, 0},
+ {0xa314, 0x7a4f6e1b, 0x7a4f6e1b, 0x845b7a5a, 0x845b7a5a, 0},
+ {0xa318, 0x8c5b7e5a, 0x8c5b7e5a, 0x950f8ccf, 0x950f8ccf, 0},
+ {0xa31c, 0x9d0f96cf, 0x9d0f96cf, 0xa5cf9b4f, 0xa5cf9b4f, 0},
+ {0xa320, 0xb51fa69f, 0xb51fa69f, 0xbddfaf1f, 0xbddfaf1f, 0},
+ {0xa324, 0xcb3fbd07, 0xcb3fbcbf, 0xd1ffc93f, 0xd1ffc93f, 0},
+ {0xa328, 0x0000d7bf, 0x0000d7bf, 0x00000000, 0x00000000, 0},
+ {0xa32c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa330, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa334, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa338, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa33c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa340, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa344, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa348, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0},
+ {0xa34c, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0},
+ {0xa350, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0},
+ {0xa354, 0x0003ffff, 0x0003ffff, 0x0003ffff, 0x0003ffff, 0},
+ {0xa358, 0x79a8aa1f, 0x79a8aa1f, 0x79a8aa1f, 0x79a8aa1f, 0},
+ {0xa388, 0x08000000, 0x08000000, 0x08000000, 0x08000000, 0},
+ {0xa38c, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0},
+ {0xa390, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0},
+ {0xa394, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce, 0},
+ {0xa398, 0x000001ce, 0x000001ce, 0x000001ce, 0x000001ce, 0},
+ {0xa39c, 0x00000007, 0x00000007, 0x00000007, 0x00000007, 0},
+ {0xa3a0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa3a4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa3a8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa3ac, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa3b0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa3b4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa3b8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa3bc, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa3c0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa3c4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa3c8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa3cc, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0},
+ {0xa3d0, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0},
+ {0xa3d4, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0},
+ {0xa3d8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0},
+ {0xa3dc, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce, 0},
+ {0xa3e0, 0x000000c0, 0x000000c0, 0x000000c0, 0x000000c0, 0},
+ {0xa848, 0x00180a65, 0x00180a65, 0x00180a68, 0x00180a68, 0},
+ {0xa920, 0x0510001c, 0x0510001c, 0x0510001c, 0x0510001c, 0},
+ {0xa960, 0x00009b40, 0x00009b40, 0x00009b40, 0x00009b40, 0},
+ {0xb20c, 0x012e8160, 0x012e8160, 0x012a8160, 0x012a8160, 0},
+ {0xb26c, 0x09249126, 0x09249126, 0x09249126, 0x09249126, 0},
+ {0xb848, 0x00180a65, 0x00180a65, 0x00180a68, 0x00180a68, 0},
+ {0xb920, 0x0510001c, 0x0510001c, 0x0510001c, 0x0510001c, 0},
+ {0xb960, 0x00009b40, 0x00009b40, 0x00009b40, 0x00009b40, 0},
+ {0xc20c, 0x012e8160, 0x012e8160, 0x012a8160, 0x012a8160, 0},
+ {0xc26c, 0x09249126, 0x09249126, 0x09249126, 0x09249126, 0},
+ //{0xc864, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0},
+ {0xc864, 0x0001c600, 0x0001c600, 0x0001c600, 0x0001c600, 0},
+ {0xc95c, 0x004b6a8e, 0x004b6a8e, 0x004b6a8e, 0x004b6a8e, 0},
+ {0xc968, 0x000003ce, 0x000003ce, 0x000003ce, 0x000003ce, 0},
+ {0xc9bc, 0x00181400, 0x00181400, 0x00181400, 0x00181400, 0},
+ {0xd270, 0x00820820, 0x00820820, 0x00820820, 0x00820820, 0},
+ {0xd35c, 0x066c420f, 0x066c420f, 0x066c420f, 0x066c420f, 0},
+ {0xd360, 0x0f282207, 0x0f282207, 0x0f282207, 0x0f282207, 0},
+ {0xd364, 0x17601685, 0x17601685, 0x17601685, 0x17601685, 0},
+ {0xd368, 0x1f801104, 0x1f801104, 0x1f801104, 0x1f801104, 0},
+ {0xd36c, 0x37a00c03, 0x37a00c03, 0x37a00c03, 0x37a00c03, 0},
+ {0xd370, 0x3fc40883, 0x3fc40883, 0x3fc40883, 0x3fc40883, 0},
+ {0xd374, 0x57c00803, 0x57c00803, 0x57c00803, 0x57c00803, 0},
+ {0xd378, 0x5fd80682, 0x5fd80682, 0x5fd80682, 0x5fd80682, 0},
+ {0xd37c, 0x7fe00482, 0x7fe00482, 0x7fe00482, 0x7fe00482, 0},
+ {0xd380, 0x7f3c7bba, 0x7f3c7bba, 0x7f3c7bba, 0x7f3c7bba, 0},
+ {0xd384, 0xf3307ff0, 0xf3307ff0, 0xf3307ff0, 0xf3307ff0, 0}
+};
+
+
+static const u32_t otusBank[][3] = {
+ //# bank 0
+ {0x98b0, 0x1e5795e5, 0x1e5795e5},
+ {0x98e0, 0x02008020, 0x02008020},
+ //# bank 1
+ {0x98b0, 0x02108421, 0x02108421},
+ {0x98ec, 0x00000008, 0x00000008},
+ //# bank 2
+ {0x98b0, 0x0e73ff17, 0x0e73ff17},
+ {0x98e0, 0x00000420, 0x00000420},
+ //# bank 3
+ {0x98f0, 0x01400018, 0x01c00018},
+ //# bank 4
+ {0x98b0, 0x000001a1, 0x000001a1},
+ {0x98e8, 0x00000001, 0x00000001},
+ //# bank 5
+ {0x98b0, 0x00000013, 0x00000013},
+ {0x98e4, 0x00000002, 0x00000002},
+ //# bank 6
+ {0x98b0, 0x00000000, 0x00000000},
+ {0x98b0, 0x00000000, 0x00000000},
+ {0x98b0, 0x00000000, 0x00000000},
+ {0x98b0, 0x00000000, 0x00000000},
+ {0x98b0, 0x00000000, 0x00000000},
+ {0x98b0, 0x00004000, 0x00004000},
+ {0x98b0, 0x00006c00, 0x00006c00},
+ {0x98b0, 0x00002c00, 0x00002c00},
+ {0x98b0, 0x00004800, 0x00004800},
+ {0x98b0, 0x00004000, 0x00004000},
+ {0x98b0, 0x00006000, 0x00006000},
+ {0x98b0, 0x00001000, 0x00001000},
+ {0x98b0, 0x00004000, 0x00004000},
+ {0x98b0, 0x00007c00, 0x00007c00},
+ {0x98b0, 0x00007c00, 0x00007c00},
+ {0x98b0, 0x00007c00, 0x00007c00},
+ {0x98b0, 0x00007c00, 0x00007c00},
+ {0x98b0, 0x00007c00, 0x00007c00},
+ {0x98b0, 0x00087c00, 0x00087c00},
+ {0x98b0, 0x00007c00, 0x00007c00},
+ {0x98b0, 0x00005400, 0x00005400},
+ {0x98b0, 0x00000c00, 0x00000c00},
+ {0x98b0, 0x00001800, 0x00001800},
+ {0x98b0, 0x00007c00, 0x00007c00},
+ {0x98b0, 0x00006c00, 0x00006c00},
+ {0x98b0, 0x00006c00, 0x00006c00},
+ {0x98b0, 0x00007c00, 0x00007c00},
+ {0x98b0, 0x00002c00, 0x00002c00},
+ {0x98b0, 0x00003c00, 0x00003c00},
+ {0x98b0, 0x00003800, 0x00003800},
+ {0x98b0, 0x00001c00, 0x00001c00},
+ {0x98b0, 0x00000800, 0x00000800},
+ {0x98b0, 0x00000408, 0x00000408},
+ {0x98b0, 0x00004c15, 0x00004c15},
+ {0x98b0, 0x00004188, 0x00004188},
+ {0x98b0, 0x0000201e, 0x0000201e},
+ {0x98b0, 0x00010408, 0x00010408},
+ {0x98b0, 0x00000801, 0x00000801},
+ {0x98b0, 0x00000c08, 0x00000c08},
+ {0x98b0, 0x0000181e, 0x0000181e},
+ {0x98b0, 0x00001016, 0x00001016},
+ {0x98b0, 0x00002800, 0x00002800},
+ {0x98b0, 0x00004010, 0x00004010},
+ {0x98b0, 0x0000081c, 0x0000081c},
+ {0x98b0, 0x00000115, 0x00000115},
+ {0x98b0, 0x00000015, 0x00000015},
+ {0x98b0, 0x00000066, 0x00000066},
+ {0x98b0, 0x0000001c, 0x0000001c},
+ {0x98b0, 0x00000000, 0x00000000},
+ {0x98b0, 0x00000004, 0x00000004},
+ {0x98b0, 0x00000015, 0x00000015},
+ {0x98b0, 0x0000001f, 0x0000001f},
+ {0x98e0, 0x00000000, 0x00000400},
+ //# bank 7
+ {0x98b0, 0x000000a0, 0x000000a0},
+ {0x98b0, 0x00000000, 0x00000000},
+ {0x98b0, 0x00000040, 0x00000040},
+ {0x98f0, 0x0000001c, 0x0000001c}
+};
diff --git a/drivers/staging/otus/ioctl.c b/drivers/staging/otus/ioctl.c
new file mode 100644
index 00000000000..7a5c1e876b0
--- /dev/null
+++ b/drivers/staging/otus/ioctl.c
@@ -0,0 +1,2913 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : ioctl.c */
+/* */
+/* Abstract */
+/* This module contains Linux wireless extension related functons. */
+/* */
+/* NOTES */
+/* Platform dependent. */
+/* */
+/************************************************************************/
+#include <linux/module.h>
+#include <linux/if_arp.h>
+#include <asm/uaccess.h>
+
+#include "usbdrv.h"
+
+#define ZD_IOCTL_WPA (SIOCDEVPRIVATE + 1)
+#define ZD_IOCTL_PARAM (SIOCDEVPRIVATE + 2)
+#define ZD_IOCTL_GETWPAIE (SIOCDEVPRIVATE + 3)
+#ifdef ZM_ENABLE_CENC
+#define ZM_IOCTL_CENC (SIOCDEVPRIVATE + 4)
+#endif //ZM_ENABLE_CENC
+#define ZD_PARAM_ROAMING 0x0001
+#define ZD_PARAM_PRIVACY 0x0002
+#define ZD_PARAM_WPA 0x0003
+#define ZD_PARAM_COUNTERMEASURES 0x0004
+#define ZD_PARAM_DROPUNENCRYPTED 0x0005
+#define ZD_PARAM_AUTH_ALGS 0x0006
+#define ZD_PARAM_WPS_FILTER 0x0007
+
+#ifdef ZM_ENABLE_CENC
+#define P80211_PACKET_CENCFLAG 0x0001
+#endif //ZM_ENABLE_CENC
+#define P80211_PACKET_SETKEY 0x0003
+
+#define ZD_CMD_SET_ENCRYPT_KEY 0x0001
+#define ZD_CMD_SET_MLME 0x0002
+#define ZD_CMD_SCAN_REQ 0x0003
+#define ZD_CMD_SET_GENERIC_ELEMENT 0x0004
+#define ZD_CMD_GET_TSC 0x0005
+
+#define ZD_CRYPT_ALG_NAME_LEN 16
+#define ZD_MAX_KEY_SIZE 32
+#define ZD_MAX_GENERIC_SIZE 64
+
+#if WIRELESS_EXT > 12
+#include <net/iw_handler.h>
+#endif
+
+extern u16_t zfLnxGetVapId(zdev_t* dev);
+
+static const u32_t channel_frequency_11A[] =
+{
+//Even element for Channel Number, Odd for Frequency
+ 36,5180,
+ 40,5200,
+ 44,5220,
+ 48,5240,
+ 52,5260,
+ 56,5280,
+ 60,5300,
+ 64,5320,
+ 100,5500,
+ 104,5520,
+ 108,5540,
+ 112,5560,
+ 116,5580,
+ 120,5600,
+ 124,5620,
+ 128,5640,
+ 132,5660,
+ 136,5680,
+ 140,5700,
+//
+ 184,4920,
+ 188,4940,
+ 192,4960,
+ 196,4980,
+ 8,5040,
+ 12,5060,
+ 16,5080,
+ 34,5170,
+ 38,5190,
+ 42,5210,
+ 46,5230,
+//
+ 149,5745,
+ 153,5765,
+ 157,5785,
+ 161,5805,
+ 165,5825
+//
+};
+
+int usbdrv_freq2chan(u32_t freq)
+{
+ /* 2.4G Hz */
+ if (freq > 2400 && freq < 3000)
+ {
+ return ((freq-2412)/5) + 1;
+ }
+ else
+ {
+ u16_t ii;
+ u16_t num_chan = sizeof(channel_frequency_11A)/sizeof(u32_t);
+
+ for(ii = 1; ii < num_chan; ii += 2)
+ {
+ if (channel_frequency_11A[ii] == freq)
+ return channel_frequency_11A[ii-1];
+ }
+ }
+
+ return 0;
+}
+
+int usbdrv_chan2freq(int chan)
+{
+ int freq;
+
+ /* If channel number is out of range */
+ if (chan > 165 || chan <= 0)
+ return -1;
+
+ /* 2.4G band */
+ if (chan >= 1 && chan <= 13)
+ {
+ freq = (2412 + (chan - 1) * 5);
+ return freq;
+ }
+ else if (chan >= 36 && chan <= 165)
+ {
+ u16_t ii;
+ u16_t num_chan = sizeof(channel_frequency_11A)/sizeof(u32_t);
+
+ for(ii = 0; ii < num_chan; ii += 2)
+ {
+ if (channel_frequency_11A[ii] == chan)
+ return channel_frequency_11A[ii+1];
+ }
+
+ /* Can't find desired frequency */
+ if (ii == num_chan)
+ return -1;
+ }
+
+ /* Can't find deisred frequency */
+ return -1;
+}
+
+int usbdrv_ioctl_setessid(struct net_device *dev, struct iw_point *erq)
+{
+#ifdef ZM_HOSTAPD_SUPPORT
+ //struct usbdrv_private *macp = dev->ml_priv;
+ char essidbuf[IW_ESSID_MAX_SIZE+1];
+ int i;
+
+ if(!netif_running(dev))
+ return -EINVAL;
+
+ memset(essidbuf, 0, sizeof(essidbuf));
+
+ printk(KERN_ERR "usbdrv_ioctl_setessid\n");
+
+ //printk("ssidlen=%d\n", erq->length); //for any, it is 1.
+ if (erq->flags) {
+ if (erq->length > (IW_ESSID_MAX_SIZE+1))
+ return -E2BIG;
+
+ if (copy_from_user(essidbuf, erq->pointer, erq->length))
+ return -EFAULT;
+ }
+
+ //zd_DisasocAll(2);
+ //wait_ms(100);
+
+ printk(KERN_ERR "essidbuf: ");
+
+ for(i = 0; i < erq->length; i++)
+ {
+ printk(KERN_ERR "%02x ", essidbuf[i]);
+ }
+
+ printk(KERN_ERR "\n");
+
+ essidbuf[erq->length] = '\0';
+ //memcpy(macp->wd.ws.ssid, essidbuf, erq->length);
+ //macp->wd.ws.ssidLen = strlen(essidbuf)+2;
+ //macp->wd.ws.ssid[1] = strlen(essidbuf); // Update ssid length
+
+ zfiWlanSetSSID(dev, essidbuf, erq->length);
+#if 0
+ printk(KERN_ERR "macp->wd.ws.ssid: ");
+
+ for(i = 0; i < macp->wd.ws.ssidLen; i++)
+ {
+ printk(KERN_ERR "%02x ", macp->wd.ws.ssid[i]);
+ }
+
+ printk(KERN_ERR "\n");
+#endif
+ zfiWlanDisable(dev, 0);
+ zfiWlanEnable(dev);
+
+#endif
+
+ return 0;
+}
+
+int usbdrv_ioctl_getessid(struct net_device *dev, struct iw_point *erq)
+{
+ //struct usbdrv_private *macp = dev->ml_priv;
+ u8_t essidbuf[IW_ESSID_MAX_SIZE+1];
+ u8_t len;
+ u8_t i;
+
+
+ //len = macp->wd.ws.ssidLen;
+ //memcpy(essidbuf, macp->wd.ws.ssid, macp->wd.ws.ssidLen);
+ zfiWlanQuerySSID(dev, essidbuf, &len);
+
+ essidbuf[len] = 0;
+
+ printk(KERN_ERR "ESSID: ");
+
+ for(i = 0; i < len; i++)
+ {
+ printk(KERN_ERR "%c", essidbuf[i]);
+ }
+
+ printk(KERN_ERR "\n");
+
+ erq->flags= 1;
+ erq->length = strlen(essidbuf) + 1;
+
+ if (erq->pointer)
+ if (copy_to_user(erq->pointer, essidbuf, erq->length))
+ return -EFAULT;
+
+ return 0;
+}
+
+
+int usbdrv_ioctl_setrts(struct net_device *dev, struct iw_param *rrq)
+{
+
+ return 0;
+}
+
+#if WIRELESS_EXT > 14
+/*
+ * Encode a WPA or RSN information element as a custom
+ * element using the hostap format.
+ */
+u32 encode_ie(void *buf, u32 bufsize, const u8 *ie, u32 ielen, const u8 *leader, u32 leader_len)
+{
+ u8 *p;
+ u32 i;
+
+ if (bufsize < leader_len)
+ return 0;
+ p = buf;
+ memcpy(p, leader, leader_len);
+ bufsize -= leader_len;
+ p += leader_len;
+ for (i = 0; i < ielen && bufsize > 2; i++)
+ p += sprintf(p, "%02x", ie[i]);
+ return (i == ielen ? p - (u8 *)buf : 0);
+}
+#endif /* WIRELESS_EXT > 14 */
+
+/*------------------------------------------------------------------*/
+/*
+ * Translate scan data returned from the card to a card independent
+ * format that the Wireless Tools will understand
+ */
+char *usbdrv_translate_scan(struct net_device *dev,
+ struct iw_request_info *info, char *current_ev,
+ char *end_buf, struct zsBssInfo *list)
+{
+ struct iw_event iwe; /* Temporary buffer */
+ u16_t capabilities;
+ char *current_val; /* For rates */
+ char *last_ev;
+ int i;
+#if WIRELESS_EXT > 14
+ char buf[64*2 + 30];
+#endif
+
+ last_ev = current_ev;
+
+/* First entry *MUST* be the AP MAC address */
+ iwe.cmd = SIOCGIWAP;
+ iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
+ memcpy(iwe.u.ap_addr.sa_data, list->bssid, ETH_ALEN);
+ current_ev = iwe_stream_add_event(
+ info,
+ current_ev,
+ end_buf, &iwe, IW_EV_ADDR_LEN);
+
+ /* Ran out of buffer */
+ if (last_ev == current_ev)
+ {
+ return end_buf;
+ }
+
+ last_ev = current_ev;
+
+/* Other entries will be displayed in the order we give them */
+
+/* Add the ESSID */
+ iwe.u.data.length = list->ssid[1];
+ if(iwe.u.data.length > 32)
+ iwe.u.data.length = 32;
+ iwe.cmd = SIOCGIWESSID;
+ iwe.u.data.flags = 1;
+ current_ev = iwe_stream_add_point(
+ info,
+ current_ev, end_buf, &iwe, &list->ssid[2]);
+
+ /* Ran out of buffer */
+ if (last_ev == current_ev)
+ {
+ return end_buf;
+ }
+
+ last_ev = current_ev;
+
+/* Add mode */
+ iwe.cmd = SIOCGIWMODE;
+ capabilities = (list->capability[1] << 8) + list->capability[0];
+ if(capabilities & (0x01 | 0x02))
+ {
+ if(capabilities & 0x01)
+ iwe.u.mode = IW_MODE_MASTER;
+ else
+ iwe.u.mode = IW_MODE_ADHOC;
+ current_ev = iwe_stream_add_event(
+ info,
+ current_ev, end_buf, &iwe, IW_EV_UINT_LEN);
+ }
+
+ /* Ran out of buffer */
+ if (last_ev == current_ev)
+ {
+ return end_buf;
+ }
+
+ last_ev = current_ev;
+
+/* Add frequency */
+ iwe.cmd = SIOCGIWFREQ;
+ iwe.u.freq.m = list->channel;
+/* Channel frequency in KHz */
+ if (iwe.u.freq.m > 14)
+ {
+ if ((184 <= iwe.u.freq.m) && (iwe.u.freq.m<=196))
+ iwe.u.freq.m = 4000 + iwe.u.freq.m * 5;
+ else
+ iwe.u.freq.m = 5000 + iwe.u.freq.m * 5;
+ }
+ else
+ {
+ if (iwe.u.freq.m == 14)
+ iwe.u.freq.m = 2484;
+ else
+ iwe.u.freq.m = 2412 + (iwe.u.freq.m - 1) * 5;
+ }
+ iwe.u.freq.e = 6;
+ current_ev = iwe_stream_add_event(
+ info,
+ current_ev, end_buf, &iwe, IW_EV_FREQ_LEN);
+
+ /* Ran out of buffer */
+ if (last_ev == current_ev)
+ {
+ return end_buf;
+ }
+
+ last_ev = current_ev;
+
+/* Add quality statistics */
+ iwe.cmd = IWEVQUAL;
+#if WIRELESS_EXT > 18
+ iwe.u.qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED
+ |IW_QUAL_NOISE_UPDATED;
+#endif
+ iwe.u.qual.level = list->signalStrength;
+ iwe.u.qual.noise = 0;
+ iwe.u.qual.qual = list->signalQuality;
+ current_ev = iwe_stream_add_event(
+ info,
+ current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
+
+ /* Ran out of buffer */
+ if (last_ev == current_ev)
+ {
+ return end_buf;
+ }
+
+ last_ev = current_ev;
+
+/* Add encryption capability */
+
+ iwe.cmd = SIOCGIWENCODE;
+ if(capabilities & 0x10)
+ iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
+ else
+ iwe.u.data.flags = IW_ENCODE_DISABLED;
+
+ iwe.u.data.length = 0;
+ current_ev = iwe_stream_add_point(
+ info,
+ current_ev, end_buf, &iwe, list->ssid);
+
+ /* Ran out of buffer */
+ if (last_ev == current_ev)
+ {
+ return end_buf;
+ }
+
+ last_ev = current_ev;
+
+/* Rate : stuffing multiple values in a single event require a bit
+ * more of magic */
+ current_val = current_ev + IW_EV_LCP_LEN;
+
+ iwe.cmd = SIOCGIWRATE;
+/* Those two flags are ignored... */
+ iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
+
+ for(i = 0 ; i < list->supportedRates[1] ; i++)
+ {
+/* Bit rate given in 500 kb/s units (+ 0x80) */
+ iwe.u.bitrate.value = ((list->supportedRates[i+2] & 0x7f) * 500000);
+/* Add new value to event */
+ current_val = iwe_stream_add_value(
+ info,
+ current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
+
+ /* Ran out of buffer */
+ if (last_ev == current_val)
+ {
+ return end_buf;
+ }
+
+ last_ev = current_val;
+ }
+
+ for (i = 0 ; i < list->extSupportedRates[1] ; i++)
+ {
+/* Bit rate given in 500 kb/s units (+ 0x80) */
+ iwe.u.bitrate.value = ((list->extSupportedRates[i+2] & 0x7f) * 500000);
+/* Add new value to event */
+ current_val = iwe_stream_add_value(
+ info,
+ current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
+
+ /* Ran out of buffer */
+ if (last_ev == current_val)
+ {
+ return end_buf;
+ }
+
+ last_ev = current_ev;
+ }
+
+/* Check if we added any event */
+ if((current_val - current_ev) > IW_EV_LCP_LEN)
+ current_ev = current_val;
+#if WIRELESS_EXT > 14
+#define IEEE80211_ELEMID_RSN 0x30
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = IWEVCUSTOM;
+ snprintf(buf, sizeof(buf), "bcn_int=%d", (list->beaconInterval[1] << 8) + list->beaconInterval[0]);
+ iwe.u.data.length = strlen(buf);
+ current_ev = iwe_stream_add_point(
+ info,
+ current_ev, end_buf, &iwe, buf);
+
+ /* Ran out of buffer */
+ if (last_ev == current_ev)
+ {
+ return end_buf;
+ }
+
+ last_ev = current_ev;
+
+ if (list->wpaIe[1] != 0)
+ {
+ static const char rsn_leader[] = "rsn_ie=";
+ static const char wpa_leader[] = "wpa_ie=";
+
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = IWEVCUSTOM;
+ if (list->wpaIe[0] == IEEE80211_ELEMID_RSN)
+ iwe.u.data.length = encode_ie(buf, sizeof(buf),
+ list->wpaIe, list->wpaIe[1]+2,
+ rsn_leader, sizeof(rsn_leader)-1);
+ else
+ iwe.u.data.length = encode_ie(buf, sizeof(buf),
+ list->wpaIe, list->wpaIe[1]+2,
+ wpa_leader, sizeof(wpa_leader)-1);
+
+ if (iwe.u.data.length != 0)
+ current_ev = iwe_stream_add_point(
+ info,
+ current_ev, end_buf, &iwe, buf);
+
+ /* Ran out of buffer */
+ if (last_ev == current_ev)
+ {
+ return end_buf;
+ }
+
+ last_ev = current_ev;
+ }
+ if (list->rsnIe[1] != 0)
+ {
+ static const char rsn_leader[] = "rsn_ie=";
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = IWEVCUSTOM;
+
+ if (list->rsnIe[0] == IEEE80211_ELEMID_RSN)
+ {
+ iwe.u.data.length = encode_ie(buf, sizeof(buf),
+ list->rsnIe, list->rsnIe[1]+2,
+ rsn_leader, sizeof(rsn_leader)-1);
+ if (iwe.u.data.length != 0)
+ current_ev = iwe_stream_add_point(
+ info,
+ current_ev, end_buf, &iwe, buf);
+
+ /* Ran out of buffer */
+ if (last_ev == current_ev)
+ {
+ return end_buf;
+ }
+
+ last_ev = current_ev;
+ }
+ }
+#endif
+/* The other data in the scan result are not really
+ * interesting, so for now drop it */
+ return current_ev;
+}
+
+int usbdrvwext_giwname(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrq, char *extra)
+{
+ //struct usbdrv_private *macp = dev->ml_priv;
+
+ strcpy(wrq->name, "IEEE 802.11-MIMO");
+
+ return 0;
+}
+
+int usbdrvwext_siwfreq(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_freq *freq, char *extra)
+{
+ u32_t FreqKHz;
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ if(!netif_running(dev))
+ return -EINVAL;
+
+ if (freq->e > 1)
+ return -EINVAL;
+
+ if (freq->e == 1)
+ {
+ FreqKHz = (freq->m / 100000);
+
+ if (FreqKHz > 4000000)
+ {
+ if (FreqKHz > 5825000)
+ FreqKHz = 5825000;
+ else if (FreqKHz < 4920000)
+ FreqKHz = 4920000;
+ else if (FreqKHz < 5000000)
+ FreqKHz = (((FreqKHz - 4000000) / 5000) * 5000) + 4000000;
+ else
+ FreqKHz = (((FreqKHz - 5000000) / 5000) * 5000) + 5000000;
+ }
+ else
+ {
+ if (FreqKHz > 2484000)
+ FreqKHz = 2484000;
+ else if (FreqKHz < 2412000)
+ FreqKHz = 2412000;
+ else
+ FreqKHz = (((FreqKHz - 2412000) / 5000) * 5000) + 2412000;
+ }
+
+ }
+ else
+ {
+ FreqKHz = usbdrv_chan2freq(freq->m);
+
+ if (FreqKHz != -1)
+ FreqKHz *= 1000;
+ else
+ FreqKHz = 2412000;
+ }
+
+ //printk("freq->m: %d, freq->e: %d\n", freq->m, freq->e);
+ //printk("FreqKHz: %d\n", FreqKHz);
+
+ if (macp->DeviceOpened == 1)
+ {
+ zfiWlanSetFrequency(dev, FreqKHz, 0); // Immediate
+ //u8_t wpaieLen,wpaie[50];
+ //zfiWlanQueryWpaIe(dev, wpaie, &wpaieLen);
+ zfiWlanDisable(dev, 0);
+ zfiWlanEnable(dev);
+ //if (wpaieLen > 2)
+ // zfiWlanSetWpaIe(dev, wpaie, wpaieLen);
+ }
+
+ return 0;
+}
+
+int usbdrvwext_giwfreq(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_freq *freq, char *extra)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ if (macp->DeviceOpened != 1)
+ return 0;
+
+ freq->m = zfiWlanQueryFrequency(dev);
+ freq->e = 3;
+
+ return 0;
+}
+
+int usbdrvwext_siwmode(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrq, char *extra)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ u8_t WlanMode;
+
+ if(!netif_running(dev))
+ return -EINVAL;
+
+ if (macp->DeviceOpened != 1)
+ return 0;
+
+ switch(wrq->mode)
+ {
+ case IW_MODE_MASTER:
+ WlanMode = ZM_MODE_AP;
+ break;
+ case IW_MODE_INFRA:
+ WlanMode = ZM_MODE_INFRASTRUCTURE;
+ break;
+ case IW_MODE_ADHOC:
+ WlanMode = ZM_MODE_IBSS;
+ break;
+ default:
+ WlanMode = ZM_MODE_IBSS;
+ break;
+ }
+
+ zfiWlanSetWlanMode(dev,WlanMode);
+ zfiWlanDisable(dev, 1);
+ zfiWlanEnable(dev);
+
+ return 0;
+}
+
+int usbdrvwext_giwmode(struct net_device *dev,
+ struct iw_request_info *info,
+ __u32 *mode, char *extra)
+{
+ unsigned long irqFlag;
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ if(!netif_running(dev))
+ return -EINVAL;
+
+ if (macp->DeviceOpened != 1)
+ return 0;
+
+ spin_lock_irqsave(&macp->cs_lock, irqFlag);
+
+ switch(zfiWlanQueryWlanMode(dev))
+ {
+ case ZM_MODE_AP:
+ *mode = IW_MODE_MASTER;
+ break;
+ case ZM_MODE_INFRASTRUCTURE:
+ *mode = IW_MODE_INFRA;
+ break;
+ case ZM_MODE_IBSS:
+ *mode = IW_MODE_ADHOC;
+ break;
+ default:
+ *mode = IW_MODE_ADHOC;
+ break;
+ }
+
+ spin_unlock_irqrestore(&macp->cs_lock, irqFlag);
+
+ return 0;
+}
+
+int usbdrvwext_siwsens(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_param *sens, char *extra)
+{
+ return 0;
+}
+
+int usbdrvwext_giwsens(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_param *sens, char *extra)
+{
+ sens->value = 0;
+ sens->fixed = 1;
+
+ return 0;
+}
+
+int usbdrvwext_giwrange(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_point *data, char *extra)
+{
+ struct iw_range *range = (struct iw_range *) extra;
+ int i, val;
+ //int num_band_a;
+ u16_t channels[60];
+ u16_t channel_num;
+
+ if(!netif_running(dev))
+ return -EINVAL;
+
+#if WIRELESS_EXT > 9
+ range->txpower_capa = IW_TXPOW_DBM;
+// XXX what about min/max_pmp, min/max_pmt, etc.
+#endif
+
+#if WIRELESS_EXT > 10
+ range->we_version_compiled = WIRELESS_EXT;
+ range->we_version_source = 13;
+
+ range->retry_capa = IW_RETRY_LIMIT;
+ range->retry_flags = IW_RETRY_LIMIT;
+ range->min_retry = 0;
+ range->max_retry = 255;
+#endif /* WIRELESS_EXT > 10 */
+
+ channel_num = zfiWlanQueryAllowChannels(dev, channels);
+
+ /* Gurantee reported channel numbers is less or equal to IW_MAX_FREQUENCIES */
+ if (channel_num > IW_MAX_FREQUENCIES)
+ channel_num = IW_MAX_FREQUENCIES;
+
+ val = 0;
+
+ for (i = 0; i < channel_num; i++)
+ {
+ range->freq[val].i = usbdrv_freq2chan(channels[i]);
+ range->freq[val].m = channels[i];
+ range->freq[val].e = 6;
+ val++;
+ }
+
+ range->num_channels = channel_num;
+ range->num_frequency = channel_num;
+
+#if 0
+ range->num_channels = 14; // Only 2.4G
+
+/* XXX need to filter against the regulatory domain &| active set */
+ val = 0;
+ for (i = 1; i <= 14; i++) // B,G Bands
+ {
+ range->freq[val].i = i;
+ if (i == 14)
+ range->freq[val].m = 2484000;
+ else
+ range->freq[val].m = (2412+(i-1)*5)*1000;
+ range->freq[val].e = 3;
+ val++;
+ }
+
+ num_band_a = (IW_MAX_FREQUENCIES - val);
+
+ for (i = 0; i < num_band_a; i++) // A Bands
+ {
+ range->freq[val].i = channel_frequency_11A[2 * i];
+ range->freq[val].m = channel_frequency_11A[2 * i + 1] * 1000;
+ range->freq[val].e = 3;
+ val++;
+ }
+ // MIMO Rate Not Defined Now
+ //For 802.11a, there are too more frequency. We can't return them all
+ range->num_frequency = val;
+#endif
+
+/* Max of /proc/net/wireless */
+ range->max_qual.qual = 100; //?? //92;
+ range->max_qual.level = 154; //??
+ range->max_qual.noise = 154; //??
+ range->sensitivity = 3; //??
+
+// XXX these need to be nsd-specific!
+ range->min_rts = 0;
+ range->max_rts = 2347;
+ range->min_frag = 256;
+ range->max_frag = 2346;
+ range->max_encoding_tokens = 4/*NUM_WEPKEYS*/; //??
+ range->num_encoding_sizes = 2; //??
+
+ range->encoding_size[0] = 5; //?? //WEP Key Encoding Size
+ range->encoding_size[1] = 13;//??
+
+// XXX what about num_bitrates/throughput?
+ range->num_bitrates = 0; //??
+
+/* estimated max throughput */
+// XXX need to cap it if we're running at ~2Mbps..
+
+ range->throughput = 300000000;
+
+ return 0;
+}
+
+int usbdrvwext_siwap(struct net_device *dev, struct iw_request_info *info,
+ struct sockaddr *MacAddr, char *extra)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ if(!netif_running(dev))
+ return -EINVAL;
+
+ if (zfiWlanQueryWlanMode(dev) == ZM_MODE_AP) // AP Mode
+ zfiWlanSetMacAddress(dev,(u16_t *)&MacAddr->sa_data[0]);
+ else //STA Mode
+ zfiWlanSetBssid(dev,&MacAddr->sa_data[0]);
+
+ if (macp->DeviceOpened == 1)
+ {
+ //u8_t wpaieLen,wpaie[80];
+ //zfiWlanQueryWpaIe(dev, wpaie, &wpaieLen);
+ zfiWlanDisable(dev, 0);
+ zfiWlanEnable(dev);
+ //if (wpaieLen > 2)
+ // zfiWlanSetWpaIe(dev, wpaie, wpaieLen);
+ }
+
+ return 0;
+}
+
+int usbdrvwext_giwap(struct net_device *dev,
+ struct iw_request_info *info,
+ struct sockaddr *MacAddr, char *extra)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ if (macp->DeviceOpened != 1)
+ return 0;
+
+ if (zfiWlanQueryWlanMode(dev) == ZM_MODE_AP) // AP Mode
+ zfiWlanQueryMacAddress(dev, &MacAddr->sa_data[0]);
+ else //STA Mode
+ {
+ if (macp->adapterState == ZM_STATUS_MEDIA_CONNECT)
+ {
+ zfiWlanQueryBssid(dev, &MacAddr->sa_data[0]);
+ }
+ else
+ {
+ u8_t zero_addr[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ memcpy(&MacAddr->sa_data[0], zero_addr, sizeof(zero_addr));
+ }
+ }
+
+ return 0;
+}
+
+int usbdrvwext_iwaplist(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_point *data, char *extra)
+{
+ //Don't know how to do yet--CWYang(+)
+ return 0;
+
+}
+
+int usbdrvwext_siwscan(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *data, char *extra)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ if (macp->DeviceOpened != 1)
+ return 0;
+
+ printk("CWY - usbdrvwext_siwscan\n");
+
+ zfiWlanScan(dev);
+
+ return 0;
+}
+
+int usbdrvwext_giwscan(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_point *data, char *extra)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ //struct zsWlanDev* wd = (struct zsWlanDev*) zmw_wlan_dev(dev);
+ char *current_ev = extra;
+ char *end_buf;
+ int i;
+ //struct zsBssList BssList;
+ struct zsBssListV1 *pBssList = kmalloc(sizeof(struct zsBssListV1), GFP_KERNEL);
+ //BssList = wd->sta.pBssList;
+ //zmw_get_wlan_dev(dev);
+
+ if (macp->DeviceOpened != 1)
+ return 0;
+
+ if (data->length == 0)
+ {
+ end_buf = extra + IW_SCAN_MAX_DATA;
+ }
+ else
+ {
+ end_buf = extra + data->length;
+ }
+
+ printk("giwscan - Report Scan Results\n");
+ //printk("giwscan - BssList Sreucture Len : %d\n", sizeof(BssList));
+ //printk("giwscan - BssList Count : %d\n", wd->sta.pBssList->bssCount);
+ //printk("giwscan - UpdateBssList Count : %d\n", wd->sta.pUpdateBssList->bssCount);
+ zfiWlanQueryBssListV1(dev, pBssList);
+ //zfiWlanQueryBssList(dev, &BssList);
+
+/* Read and parse all entries */
+ printk("giwscan - pBssList->bssCount : %d\n", pBssList->bssCount);
+ //printk("giwscan - BssList.bssCount : %d\n", BssList.bssCount);
+
+ for (i = 0; i < pBssList->bssCount; i++)
+ {
+/* Translate to WE format this entry */
+ //current_ev = usbdrv_translate_scan(dev, info, current_ev,
+ // extra + IW_SCAN_MAX_DATA, &pBssList->bssInfo[i]);
+ current_ev = usbdrv_translate_scan(dev, info, current_ev,
+ end_buf, &pBssList->bssInfo[i]);
+
+#if WIRELESS_EXT > 16
+ if (current_ev == end_buf)
+ {
+ kfree(pBssList);
+ data->length = current_ev - extra;
+ return -E2BIG;
+ }
+#endif
+ }
+
+/* Length of data */
+ data->length = (current_ev - extra);
+ data->flags = 0; /* todo */
+
+ kfree(pBssList);
+
+ return 0;
+}
+
+int usbdrvwext_siwessid(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_point *essid, char *extra)
+{
+ char EssidBuf[IW_ESSID_MAX_SIZE+1];
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ if(!netif_running(dev))
+ return -EINVAL;
+
+ if (essid->flags == 1)
+ {
+ if (essid->length > (IW_ESSID_MAX_SIZE+1))
+ return -E2BIG;
+
+ if (copy_from_user(&EssidBuf, essid->pointer, essid->length))
+ return -EFAULT;
+
+ EssidBuf[essid->length] = '\0';
+ //printk("siwessid - Set Essid : %s\n",EssidBuf);
+ //printk("siwessid - Essid Len : %d\n",essid->length);
+ //printk("siwessid - Essid Flag : %x\n",essid->flags);
+ if (macp->DeviceOpened == 1)
+ {
+ zfiWlanSetSSID(dev, EssidBuf, strlen(EssidBuf));
+ zfiWlanSetFrequency(dev, zfiWlanQueryFrequency(dev), FALSE);
+ zfiWlanSetEncryMode(dev, zfiWlanQueryEncryMode(dev));
+ //u8_t wpaieLen,wpaie[50];
+ //zfiWlanQueryWpaIe(dev, wpaie, &wpaieLen);
+ zfiWlanDisable(dev, 0);
+ zfiWlanEnable(dev);
+ //if (wpaieLen > 2)
+ // zfiWlanSetWpaIe(dev, wpaie, wpaieLen);
+ }
+ }
+
+ return 0;
+}
+
+int usbdrvwext_giwessid(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_point *essid, char *extra)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ u8_t EssidLen;
+ char EssidBuf[IW_ESSID_MAX_SIZE+1];
+ int ssid_len;
+
+ if(!netif_running(dev))
+ return -EINVAL;
+
+ if (macp->DeviceOpened != 1)
+ return 0;
+
+ zfiWlanQuerySSID(dev, &EssidBuf[0], &EssidLen);
+
+ /* Convert type from unsigned char to char */
+ ssid_len = (int)EssidLen;
+
+ /* Make sure the essid length is not greater than IW_ESSID_MAX_SIZE */
+ if (ssid_len > IW_ESSID_MAX_SIZE)
+ ssid_len = IW_ESSID_MAX_SIZE;
+
+ EssidBuf[ssid_len] = '\0';
+
+ essid->flags = 1;
+ essid->length = strlen(EssidBuf);
+
+ memcpy(extra, EssidBuf, essid->length);
+ // wireless.c in Kernel would handle copy_to_user -- line 679
+ /*if (essid->pointer)
+ {
+ if ( copy_to_user(essid->pointer, EssidBuf, essid->length) )
+ {
+ printk("giwessid - copy_to_user Fail\n");
+ return -EFAULT;
+ }
+ }*/
+
+ return 0;
+}
+
+int usbdrvwext_siwnickn(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_point *data, char *nickname)
+{
+ //Exist but junk--CWYang(+)
+ return 0;
+}
+
+int usbdrvwext_giwnickn(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_point *data, char *nickname)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ u8_t EssidLen;
+ char EssidBuf[IW_ESSID_MAX_SIZE+1];
+
+ if (macp->DeviceOpened != 1)
+ return 0;
+
+ zfiWlanQuerySSID(dev, &EssidBuf[0], &EssidLen);
+ EssidBuf[EssidLen] = 0;
+
+ data->flags = 1;
+ data->length = strlen(EssidBuf);
+
+ memcpy(nickname, EssidBuf, data->length);
+
+ return 0;
+}
+
+int usbdrvwext_siwrate(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_param *frq, char *extra)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ //Array to Define Rate Number that Send to Driver
+ u16_t zcIndextoRateBG[16] = {1000, 2000, 5500, 11000, 0, 0, 0, 0, 48000,
+ 24000, 12000, 6000, 54000, 36000, 18000, 9000};
+ u16_t zcRateToMCS[] = {0xff, 0, 1, 2, 3, 0xb, 0xf, 0xa, 0xe, 0x9, 0xd,
+ 0x8, 0xc};
+ u8_t i,RateIndex = 4;
+ u16_t RateKbps;
+
+ //printk("frq->disabled : 0x%x\n",frq->disabled);
+ //printk("frq->value : 0x%x\n",frq->value);
+
+ RateKbps = frq->value / 1000;
+ //printk("RateKbps : %d\n", RateKbps);
+ for (i = 0; i < 16; i++)
+ {
+ if (RateKbps == zcIndextoRateBG[i])
+ RateIndex = i;
+ }
+ if (zcIndextoRateBG[RateIndex] == 0)
+ RateIndex = 0xff;
+ //printk("RateIndex : %x\n", RateIndex);
+ for (i = 0; i < 13; i++)
+ if (RateIndex == zcRateToMCS[i])
+ break;
+ //printk("Index : %x\n", i);
+ if (RateKbps == 65000)
+ {
+ RateIndex = 20;
+ printk("RateIndex : %d\n", RateIndex);
+ }
+ if (macp->DeviceOpened == 1)
+ {
+ zfiWlanSetTxRate(dev, i);
+ //zfiWlanDisable(dev);
+ //zfiWlanEnable(dev);
+ }
+
+ return 0;
+}
+
+int usbdrvwext_giwrate(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_param *frq, char *extra)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ if(!netif_running(dev))
+ return -EINVAL;
+
+ if (macp->DeviceOpened != 1)
+ return 0;
+
+ frq->fixed = 0;
+ frq->disabled = 0;
+ frq->value = zfiWlanQueryRxRate(dev) * 1000;
+
+ return 0;
+}
+
+int usbdrvwext_siwrts(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_param *rts, char *extra)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ int val = rts->value;
+
+ if (macp->DeviceOpened != 1)
+ return 0;
+
+ if (rts->disabled)
+ val = 2347;
+
+ if ((val < 0) || (val > 2347))
+ return -EINVAL;
+
+ zfiWlanSetRtsThreshold(dev,val);
+
+ return 0;
+}
+
+int usbdrvwext_giwrts(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_param *rts, char *extra)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ if(!netif_running(dev))
+ return -EINVAL;
+
+ if (macp->DeviceOpened != 1)
+ return 0;
+
+ rts->value = zfiWlanQueryRtsThreshold(dev);
+ rts->disabled = (rts->value >= 2347);
+ rts->fixed = 1;
+
+ return 0;
+
+}
+
+int usbdrvwext_siwfrag(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_param *frag, char *extra)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ u16_t fragThreshold;
+
+ if (macp->DeviceOpened != 1)
+ return 0;
+
+ if (frag->disabled)
+ fragThreshold = 0;
+ else
+ fragThreshold = frag->value;
+
+ zfiWlanSetFragThreshold(dev,fragThreshold);
+
+ return 0;
+}
+
+int usbdrvwext_giwfrag(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_param *frag, char *extra)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ u16 val;
+ unsigned long irqFlag;
+
+ if(!netif_running(dev))
+ return -EINVAL;
+
+ if (macp->DeviceOpened != 1)
+ return 0;
+
+ spin_lock_irqsave(&macp->cs_lock, irqFlag);
+
+ val = zfiWlanQueryFragThreshold(dev);
+
+ frag->value = val;
+
+ frag->disabled = (val >= 2346);
+ frag->fixed = 1;
+
+ spin_unlock_irqrestore(&macp->cs_lock, irqFlag);
+
+ return 0;
+}
+
+int usbdrvwext_siwtxpow(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_param *rrq, char *extra)
+{
+ //Not support yet--CWYng(+)
+ return 0;
+}
+
+int usbdrvwext_giwtxpow(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_param *rrq, char *extra)
+{
+ //Not support yet--CWYng(+)
+ return 0;
+}
+
+int usbdrvwext_siwretry(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_param *rrq, char *extra)
+{
+ //Do nothing--CWYang(+)
+ return 0;
+}
+
+int usbdrvwext_giwretry(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_param *rrq, char *extra)
+{
+ //Do nothing--CWYang(+)
+ return 0;
+}
+
+int usbdrvwext_siwencode(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_point *erq, char *key)
+{
+ struct zsKeyInfo keyInfo;
+ int i, WepState = ZM_ENCRYPTION_WEP_DISABLED;
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ if(!netif_running(dev))
+ return -EINVAL;
+
+ if ((erq->flags & IW_ENCODE_DISABLED) == 0)
+ {
+ keyInfo.key = key;
+ keyInfo.keyLength = erq->length;
+ keyInfo.keyIndex = (erq->flags & IW_ENCODE_INDEX) - 1;
+ if (keyInfo.keyIndex >= 4)
+ keyInfo.keyIndex = 0;
+ keyInfo.flag = ZM_KEY_FLAG_DEFAULT_KEY;
+
+ zfiWlanSetKey(dev, keyInfo);
+ WepState = ZM_ENCRYPTION_WEP_ENABLED;
+ }
+ else
+ {
+ for (i = 1; i < 4; i++)
+ zfiWlanRemoveKey(dev, 0, i);
+ WepState = ZM_ENCRYPTION_WEP_DISABLED;
+ //zfiWlanSetEncryMode(dev, ZM_NO_WEP);
+ }
+
+ if (macp->DeviceOpened == 1)
+ {
+ zfiWlanSetWepStatus(dev, WepState);
+ zfiWlanSetFrequency(dev, zfiWlanQueryFrequency(dev), FALSE);
+ //zfiWlanSetEncryMode(dev, zfiWlanQueryEncryMode(dev));
+ //u8_t wpaieLen,wpaie[50];
+ //zfiWlanQueryWpaIe(dev, wpaie, &wpaieLen);
+ zfiWlanDisable(dev, 0);
+ zfiWlanEnable(dev);
+ //if (wpaieLen > 2)
+ // zfiWlanSetWpaIe(dev, wpaie, wpaieLen);
+ }
+
+ return 0;
+}
+
+int usbdrvwext_giwencode(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_point *erq, char *key)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ u8_t EncryptionMode;
+ u8_t keyLen = 0;
+
+ if (macp->DeviceOpened != 1)
+ return 0;
+
+ EncryptionMode = zfiWlanQueryEncryMode(dev);
+
+ if (EncryptionMode)
+ {
+ erq->flags = IW_ENCODE_ENABLED;
+ }
+ else
+ {
+ erq->flags = IW_ENCODE_DISABLED;
+ }
+
+/* We can't return the key, so set the proper flag and return zero */
+ erq->flags |= IW_ENCODE_NOKEY;
+ memset(key, 0, 16);
+
+/* Copy the key to the user buffer */
+ switch(EncryptionMode)
+ {
+ case ZM_WEP64:
+ keyLen = 5;
+ break;
+ case ZM_WEP128:
+ keyLen = 13;
+ break;
+ case ZM_WEP256:
+ keyLen = 29;
+ break;
+ case ZM_AES:
+ keyLen = 16;
+ break;
+ case ZM_TKIP:
+ keyLen = 32;
+ break;
+#ifdef ZM_ENABLE_CENC
+ case ZM_CENC:
+ keyLen = 32;
+ break;
+#endif //ZM_ENABLE_CENC
+ case ZM_NO_WEP:
+ keyLen = 0;
+ break;
+ default :
+ keyLen = 0;
+ printk("Unknown EncryMode\n");
+ break;
+
+ }
+ erq->length = keyLen;
+
+ return 0;
+}
+
+int usbdrvwext_siwpower(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_param *frq, char *extra)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ u8_t PSMode;
+
+ if (macp->DeviceOpened != 1)
+ return 0;
+
+ if (frq->disabled)
+ PSMode = ZM_STA_PS_NONE;
+ else
+ PSMode = ZM_STA_PS_MAX;
+
+ zfiWlanSetPowerSaveMode(dev,PSMode);
+
+ return 0;
+}
+
+int usbdrvwext_giwpower(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_param *frq, char *extra)
+{
+ unsigned long irqFlag;
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ if (macp->DeviceOpened != 1)
+ return 0;
+
+ spin_lock_irqsave(&macp->cs_lock, irqFlag);
+
+ if (zfiWlanQueryPowerSaveMode(dev) == ZM_STA_PS_NONE)
+ frq->disabled = 1;
+ else
+ frq->disabled = 0;
+
+ spin_unlock_irqrestore(&macp->cs_lock, irqFlag);
+
+ return 0;
+}
+
+//int usbdrvwext_setparam(struct net_device *dev, struct iw_request_info *info,
+// void *w, char *extra)
+//{
+// struct ieee80211vap *vap = dev->ml_priv;
+// struct ieee80211com *ic = vap->iv_ic;
+// struct ieee80211_rsnparms *rsn = &vap->iv_bss->ni_rsn;
+// int *i = (int *) extra;
+// int param = i[0]; /* parameter id is 1st */
+// int value = i[1]; /* NB: most values are TYPE_INT */
+// int retv = 0;
+// int j, caps;
+// const struct ieee80211_authenticator *auth;
+// const struct ieee80211_aclator *acl;
+//
+// switch (param) {
+// case IEEE80211_PARAM_AUTHMODE:
+// switch (value) {
+// case IEEE80211_AUTH_WPA: /* WPA */
+// case IEEE80211_AUTH_8021X: /* 802.1x */
+// case IEEE80211_AUTH_OPEN: /* open */
+// case IEEE80211_AUTH_SHARED: /* shared-key */
+// case IEEE80211_AUTH_AUTO: /* auto */
+// auth = ieee80211_authenticator_get(value);
+// if (auth == NULL)
+// return -EINVAL;
+// break;
+// default:
+// return -EINVAL;
+// }
+// switch (value) {
+// case IEEE80211_AUTH_WPA: /* WPA w/ 802.1x */
+// vap->iv_flags |= IEEE80211_F_PRIVACY;
+// value = IEEE80211_AUTH_8021X;
+// break;
+// case IEEE80211_AUTH_OPEN: /* open */
+// vap->iv_flags &= ~(IEEE80211_F_WPA|IEEE80211_F_PRIVACY);
+// break;
+// case IEEE80211_AUTH_SHARED: /* shared-key */
+// case IEEE80211_AUTH_AUTO: /* auto */
+// case IEEE80211_AUTH_8021X: /* 802.1x */
+// vap->iv_flags &= ~IEEE80211_F_WPA;
+// /* both require a key so mark the PRIVACY capability */
+// vap->iv_flags |= IEEE80211_F_PRIVACY;
+// break;
+// }
+// /* NB: authenticator attach/detach happens on state change */
+// vap->iv_bss->ni_authmode = value;
+// /* XXX mixed/mode/usage? */
+// vap->iv_auth = auth;
+// retv = ENETRESET;
+// break;
+// case IEEE80211_PARAM_PROTMODE:
+// if (value > IEEE80211_PROT_RTSCTS)
+// return -EINVAL;
+// ic->ic_protmode = value;
+// /* NB: if not operating in 11g this can wait */
+// if (ic->ic_bsschan != IEEE80211_CHAN_ANYC &&
+// IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan))
+// retv = ENETRESET;
+// break;
+// case IEEE80211_PARAM_MCASTCIPHER:
+// if ((vap->iv_caps & cipher2cap(value)) == 0 &&
+// !ieee80211_crypto_available(value))
+// return -EINVAL;
+// rsn->rsn_mcastcipher = value;
+// if (vap->iv_flags & IEEE80211_F_WPA)
+// retv = ENETRESET;
+// break;
+// case IEEE80211_PARAM_MCASTKEYLEN:
+// if (!(0 < value && value < IEEE80211_KEYBUF_SIZE))
+// return -EINVAL;
+// /* XXX no way to verify driver capability */
+// rsn->rsn_mcastkeylen = value;
+// if (vap->iv_flags & IEEE80211_F_WPA)
+// retv = ENETRESET;
+// break;
+// case IEEE80211_PARAM_UCASTCIPHERS:
+// /*
+// * Convert cipher set to equivalent capabilities.
+// * NB: this logic intentionally ignores unknown and
+// * unsupported ciphers so folks can specify 0xff or
+// * similar and get all available ciphers.
+// */
+// caps = 0;
+// for (j = 1; j < 32; j++) /* NB: skip WEP */
+// if ((value & (1<<j)) &&
+// ((vap->iv_caps & cipher2cap(j)) ||
+// ieee80211_crypto_available(j)))
+// caps |= 1<<j;
+// if (caps == 0) /* nothing available */
+// return -EINVAL;
+// /* XXX verify ciphers ok for unicast use? */
+// /* XXX disallow if running as it'll have no effect */
+// rsn->rsn_ucastcipherset = caps;
+// if (vap->iv_flags & IEEE80211_F_WPA)
+// retv = ENETRESET;
+// break;
+// case IEEE80211_PARAM_UCASTCIPHER:
+// if ((rsn->rsn_ucastcipherset & cipher2cap(value)) == 0)
+// return -EINVAL;
+// rsn->rsn_ucastcipher = value;
+// break;
+// case IEEE80211_PARAM_UCASTKEYLEN:
+// if (!(0 < value && value < IEEE80211_KEYBUF_SIZE))
+// return -EINVAL;
+// /* XXX no way to verify driver capability */
+// rsn->rsn_ucastkeylen = value;
+// break;
+// case IEEE80211_PARAM_KEYMGTALGS:
+// /* XXX check */
+// rsn->rsn_keymgmtset = value;
+// if (vap->iv_flags & IEEE80211_F_WPA)
+// retv = ENETRESET;
+// break;
+// case IEEE80211_PARAM_RSNCAPS:
+// /* XXX check */
+// rsn->rsn_caps = value;
+// if (vap->iv_flags & IEEE80211_F_WPA)
+// retv = ENETRESET;
+// break;
+// case IEEE80211_PARAM_WPA:
+// if (value > 3)
+// return -EINVAL;
+// /* XXX verify ciphers available */
+// vap->iv_flags &= ~IEEE80211_F_WPA;
+// switch (value) {
+// case 1:
+// vap->iv_flags |= IEEE80211_F_WPA1;
+// break;
+// case 2:
+// vap->iv_flags |= IEEE80211_F_WPA2;
+// break;
+// case 3:
+// vap->iv_flags |= IEEE80211_F_WPA1 | IEEE80211_F_WPA2;
+// break;
+// }
+// retv = ENETRESET; /* XXX? */
+// break;
+// case IEEE80211_PARAM_ROAMING:
+// if (!(IEEE80211_ROAMING_DEVICE <= value &&
+// value <= IEEE80211_ROAMING_MANUAL))
+// return -EINVAL;
+// ic->ic_roaming = value;
+// break;
+// case IEEE80211_PARAM_PRIVACY:
+// if (value) {
+// /* XXX check for key state? */
+// vap->iv_flags |= IEEE80211_F_PRIVACY;
+// } else
+// vap->iv_flags &= ~IEEE80211_F_PRIVACY;
+// break;
+// case IEEE80211_PARAM_DROPUNENCRYPTED:
+// if (value)
+// vap->iv_flags |= IEEE80211_F_DROPUNENC;
+// else
+// vap->iv_flags &= ~IEEE80211_F_DROPUNENC;
+// break;
+// case IEEE80211_PARAM_COUNTERMEASURES:
+// if (value) {
+// if ((vap->iv_flags & IEEE80211_F_WPA) == 0)
+// return -EINVAL;
+// vap->iv_flags |= IEEE80211_F_COUNTERM;
+// } else
+// vap->iv_flags &= ~IEEE80211_F_COUNTERM;
+// break;
+// case IEEE80211_PARAM_DRIVER_CAPS:
+// vap->iv_caps = value; /* NB: for testing */
+// break;
+// case IEEE80211_PARAM_MACCMD:
+// acl = vap->iv_acl;
+// switch (value) {
+// case IEEE80211_MACCMD_POLICY_OPEN:
+// case IEEE80211_MACCMD_POLICY_ALLOW:
+// case IEEE80211_MACCMD_POLICY_DENY:
+// if (acl == NULL) {
+// acl = ieee80211_aclator_get("mac");
+// if (acl == NULL || !acl->iac_attach(vap))
+// return -EINVAL;
+// vap->iv_acl = acl;
+// }
+// acl->iac_setpolicy(vap, value);
+// break;
+// case IEEE80211_MACCMD_FLUSH:
+// if (acl != NULL)
+// acl->iac_flush(vap);
+// /* NB: silently ignore when not in use */
+// break;
+// case IEEE80211_MACCMD_DETACH:
+// if (acl != NULL) {
+// vap->iv_acl = NULL;
+// acl->iac_detach(vap);
+// }
+// break;
+// }
+// break;
+// case IEEE80211_PARAM_WMM:
+// if (ic->ic_caps & IEEE80211_C_WME){
+// if (value) {
+// vap->iv_flags |= IEEE80211_F_WME;
+// vap->iv_ic->ic_flags |= IEEE80211_F_WME; /* XXX needed by ic_reset */
+// }
+// else {
+// vap->iv_flags &= ~IEEE80211_F_WME;
+// vap->iv_ic->ic_flags &= ~IEEE80211_F_WME; /* XXX needed by ic_reset */
+// }
+// retv = ENETRESET; /* Renegotiate for capabilities */
+// }
+// break;
+// case IEEE80211_PARAM_HIDESSID:
+// if (value)
+// vap->iv_flags |= IEEE80211_F_HIDESSID;
+// else
+// vap->iv_flags &= ~IEEE80211_F_HIDESSID;
+// retv = ENETRESET;
+// break;
+// case IEEE80211_PARAM_APBRIDGE:
+// if (value == 0)
+// vap->iv_flags |= IEEE80211_F_NOBRIDGE;
+// else
+// vap->iv_flags &= ~IEEE80211_F_NOBRIDGE;
+// break;
+// case IEEE80211_PARAM_INACT:
+// vap->iv_inact_run = value / IEEE80211_INACT_WAIT;
+// break;
+// case IEEE80211_PARAM_INACT_AUTH:
+// vap->iv_inact_auth = value / IEEE80211_INACT_WAIT;
+// break;
+// case IEEE80211_PARAM_INACT_INIT:
+// vap->iv_inact_init = value / IEEE80211_INACT_WAIT;
+// break;
+// case IEEE80211_PARAM_ABOLT:
+// caps = 0;
+// /*
+// * Map abolt settings to capability bits;
+// * this also strips unknown/unwanted bits.
+// */
+// if (value & IEEE80211_ABOLT_TURBO_PRIME)
+// caps |= IEEE80211_ATHC_TURBOP;
+// if (value & IEEE80211_ABOLT_COMPRESSION)
+// caps |= IEEE80211_ATHC_COMP;
+// if (value & IEEE80211_ABOLT_FAST_FRAME)
+// caps |= IEEE80211_ATHC_FF;
+// if (value & IEEE80211_ABOLT_XR)
+// caps |= IEEE80211_ATHC_XR;
+// if (value & IEEE80211_ABOLT_AR)
+// caps |= IEEE80211_ATHC_AR;
+// if (value & IEEE80211_ABOLT_BURST)
+// caps |= IEEE80211_ATHC_BURST;
+// if (value & IEEE80211_ABOLT_WME_ELE)
+// caps |= IEEE80211_ATHC_WME;
+// /* verify requested capabilities are supported */
+// if ((caps & ic->ic_ath_cap) != caps)
+// return -EINVAL;
+// if (vap->iv_ath_cap != caps) {
+// if ((vap->iv_ath_cap ^ caps) & IEEE80211_ATHC_TURBOP) {
+// if (ieee80211_set_turbo(dev, caps & IEEE80211_ATHC_TURBOP))
+// return -EINVAL;
+// ieee80211_scan_flush(ic);
+// }
+// vap->iv_ath_cap = caps;
+// ic->ic_athcapsetup(vap->iv_ic, vap->iv_ath_cap);
+// retv = ENETRESET;
+// }
+// break;
+// case IEEE80211_PARAM_DTIM_PERIOD:
+// if (vap->iv_opmode != IEEE80211_M_HOSTAP &&
+// vap->iv_opmode != IEEE80211_M_IBSS)
+// return -EINVAL;
+// if (IEEE80211_DTIM_MIN <= value &&
+// value <= IEEE80211_DTIM_MAX) {
+// vap->iv_dtim_period = value;
+// retv = ENETRESET; /* requires restart */
+// } else
+// retv = EINVAL;
+// break;
+// case IEEE80211_PARAM_BEACON_INTERVAL:
+// if (vap->iv_opmode != IEEE80211_M_HOSTAP &&
+// vap->iv_opmode != IEEE80211_M_IBSS)
+// return -EINVAL;
+// if (IEEE80211_BINTVAL_MIN <= value &&
+// value <= IEEE80211_BINTVAL_MAX) {
+// ic->ic_lintval = value; /* XXX multi-bss */
+// retv = ENETRESET; /* requires restart */
+// } else
+// retv = EINVAL;
+// break;
+// case IEEE80211_PARAM_DOTH:
+// if (value) {
+// ic->ic_flags |= IEEE80211_F_DOTH;
+// }
+// else
+// ic->ic_flags &= ~IEEE80211_F_DOTH;
+// retv = ENETRESET; /* XXX: need something this drastic? */
+// break;
+// case IEEE80211_PARAM_PWRTARGET:
+// ic->ic_curchanmaxpwr = value;
+// break;
+// case IEEE80211_PARAM_GENREASSOC:
+// IEEE80211_SEND_MGMT(vap->iv_bss, IEEE80211_FC0_SUBTYPE_REASSOC_REQ, 0);
+// break;
+// case IEEE80211_PARAM_COMPRESSION:
+// retv = ieee80211_setathcap(vap, IEEE80211_ATHC_COMP, value);
+// break;
+// case IEEE80211_PARAM_WMM_AGGRMODE:
+// retv = ieee80211_setathcap(vap, IEEE80211_ATHC_WME, value);
+// break;
+// case IEEE80211_PARAM_FF:
+// retv = ieee80211_setathcap(vap, IEEE80211_ATHC_FF, value);
+// break;
+// case IEEE80211_PARAM_TURBO:
+// retv = ieee80211_setathcap(vap, IEEE80211_ATHC_TURBOP, value);
+// if (retv == ENETRESET) {
+// if(ieee80211_set_turbo(dev,value))
+// return -EINVAL;
+// ieee80211_scan_flush(ic);
+// }
+// break;
+// case IEEE80211_PARAM_XR:
+// retv = ieee80211_setathcap(vap, IEEE80211_ATHC_XR, value);
+// break;
+// case IEEE80211_PARAM_BURST:
+// retv = ieee80211_setathcap(vap, IEEE80211_ATHC_BURST, value);
+// break;
+// case IEEE80211_PARAM_AR:
+// retv = ieee80211_setathcap(vap, IEEE80211_ATHC_AR, value);
+// break;
+// case IEEE80211_PARAM_PUREG:
+// if (value)
+// vap->iv_flags |= IEEE80211_F_PUREG;
+// else
+// vap->iv_flags &= ~IEEE80211_F_PUREG;
+// /* NB: reset only if we're operating on an 11g channel */
+// if (ic->ic_bsschan != IEEE80211_CHAN_ANYC &&
+// IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan))
+// retv = ENETRESET;
+// break;
+// case IEEE80211_PARAM_WDS:
+// if (value)
+// vap->iv_flags_ext |= IEEE80211_FEXT_WDS;
+// else
+// vap->iv_flags_ext &= ~IEEE80211_FEXT_WDS;
+// break;
+// case IEEE80211_PARAM_BGSCAN:
+// if (value) {
+// if ((vap->iv_caps & IEEE80211_C_BGSCAN) == 0)
+// return -EINVAL;
+// vap->iv_flags |= IEEE80211_F_BGSCAN;
+// } else {
+// /* XXX racey? */
+// vap->iv_flags &= ~IEEE80211_F_BGSCAN;
+// ieee80211_cancel_scan(vap); /* anything current */
+// }
+// break;
+// case IEEE80211_PARAM_BGSCAN_IDLE:
+// if (value >= IEEE80211_BGSCAN_IDLE_MIN)
+// vap->iv_bgscanidle = value*HZ/1000;
+// else
+// retv = EINVAL;
+// break;
+// case IEEE80211_PARAM_BGSCAN_INTERVAL:
+// if (value >= IEEE80211_BGSCAN_INTVAL_MIN)
+// vap->iv_bgscanintvl = value*HZ;
+// else
+// retv = EINVAL;
+// break;
+// case IEEE80211_PARAM_MCAST_RATE:
+// /* units are in KILObits per second */
+// if (value >= 256 && value <= 54000)
+// vap->iv_mcast_rate = value;
+// else
+// retv = EINVAL;
+// break;
+// case IEEE80211_PARAM_COVERAGE_CLASS:
+// if (value >= 0 && value <= IEEE80211_COVERAGE_CLASS_MAX) {
+// ic->ic_coverageclass = value;
+// if (IS_UP_AUTO(vap))
+// ieee80211_new_state(vap, IEEE80211_S_SCAN, 0);
+// retv = 0;
+// }
+// else
+// retv = EINVAL;
+// break;
+// case IEEE80211_PARAM_COUNTRY_IE:
+// if (value)
+// ic->ic_flags_ext |= IEEE80211_FEXT_COUNTRYIE;
+// else
+// ic->ic_flags_ext &= ~IEEE80211_FEXT_COUNTRYIE;
+// retv = ENETRESET;
+// break;
+// case IEEE80211_PARAM_REGCLASS:
+// if (value)
+// ic->ic_flags_ext |= IEEE80211_FEXT_REGCLASS;
+// else
+// ic->ic_flags_ext &= ~IEEE80211_FEXT_REGCLASS;
+// retv = ENETRESET;
+// break;
+// case IEEE80211_PARAM_SCANVALID:
+// vap->iv_scanvalid = value*HZ;
+// break;
+// case IEEE80211_PARAM_ROAM_RSSI_11A:
+// vap->iv_roam.rssi11a = value;
+// break;
+// case IEEE80211_PARAM_ROAM_RSSI_11B:
+// vap->iv_roam.rssi11bOnly = value;
+// break;
+// case IEEE80211_PARAM_ROAM_RSSI_11G:
+// vap->iv_roam.rssi11b = value;
+// break;
+// case IEEE80211_PARAM_ROAM_RATE_11A:
+// vap->iv_roam.rate11a = value;
+// break;
+// case IEEE80211_PARAM_ROAM_RATE_11B:
+// vap->iv_roam.rate11bOnly = value;
+// break;
+// case IEEE80211_PARAM_ROAM_RATE_11G:
+// vap->iv_roam.rate11b = value;
+// break;
+// case IEEE80211_PARAM_UAPSDINFO:
+// if (vap->iv_opmode == IEEE80211_M_HOSTAP) {
+// if (ic->ic_caps & IEEE80211_C_UAPSD) {
+// if (value)
+// IEEE80211_VAP_UAPSD_ENABLE(vap);
+// else
+// IEEE80211_VAP_UAPSD_DISABLE(vap);
+// retv = ENETRESET;
+// }
+// }
+// else if (vap->iv_opmode == IEEE80211_M_STA) {
+// vap->iv_uapsdinfo = value;
+// IEEE80211_VAP_UAPSD_ENABLE(vap);
+// retv = ENETRESET;
+// }
+// break;
+// case IEEE80211_PARAM_SLEEP:
+// /* XXX: Forced sleep for testing. Does not actually place the
+// * HW in sleep mode yet. this only makes sense for STAs.
+// */
+// if (value) {
+// /* goto sleep */
+// IEEE80211_VAP_GOTOSLEEP(vap);
+// }
+// else {
+// /* wakeup */
+// IEEE80211_VAP_WAKEUP(vap);
+// }
+// ieee80211_send_nulldata(ieee80211_ref_node(vap->iv_bss));
+// break;
+// case IEEE80211_PARAM_QOSNULL:
+// /* Force a QoS Null for testing. */
+// ieee80211_send_qosnulldata(vap->iv_bss, value);
+// break;
+// case IEEE80211_PARAM_PSPOLL:
+// /* Force a PS-POLL for testing. */
+// ieee80211_send_pspoll(vap->iv_bss);
+// break;
+// case IEEE80211_PARAM_EOSPDROP:
+// if (vap->iv_opmode == IEEE80211_M_HOSTAP) {
+// if (value) IEEE80211_VAP_EOSPDROP_ENABLE(vap);
+// else IEEE80211_VAP_EOSPDROP_DISABLE(vap);
+// }
+// break;
+// case IEEE80211_PARAM_MARKDFS:
+// if (value)
+// ic->ic_flags_ext |= IEEE80211_FEXT_MARKDFS;
+// else
+// ic->ic_flags_ext &= ~IEEE80211_FEXT_MARKDFS;
+// break;
+// case IEEE80211_PARAM_CHANBW:
+// switch (value) {
+// case 0:
+// ic->ic_chanbwflag = 0;
+// break;
+// case 1:
+// ic->ic_chanbwflag = IEEE80211_CHAN_HALF;
+// break;
+// case 2:
+// ic->ic_chanbwflag = IEEE80211_CHAN_QUARTER;
+// break;
+// default:
+// retv = EINVAL;
+// break;
+// }
+// break;
+// case IEEE80211_PARAM_SHORTPREAMBLE:
+// if (value) {
+// ic->ic_caps |= IEEE80211_C_SHPREAMBLE;
+// } else {
+// ic->ic_caps &= ~IEEE80211_C_SHPREAMBLE;
+// }
+// retv = ENETRESET;
+// break;
+// default:
+// retv = EOPNOTSUPP;
+// break;
+// }
+// /* XXX should any of these cause a rescan? */
+// if (retv == ENETRESET)
+// retv = IS_UP_AUTO(vap) ? ieee80211_open(vap->iv_dev) : 0;
+// return -retv;
+//}
+
+int usbdrvwext_setmode(struct net_device *dev, struct iw_request_info *info,
+ void *w, char *extra)
+{
+ return 0;
+}
+
+int usbdrvwext_getmode(struct net_device *dev, struct iw_request_info *info,
+ void *w, char *extra)
+{
+ //struct usbdrv_private *macp = dev->ml_priv;
+ struct iw_point *wri = (struct iw_point *)extra;
+ char mode[8];
+
+ strcpy(mode,"11g");
+ return (copy_to_user(wri->pointer, mode, 6) ? -EFAULT : 0);
+}
+
+int zfLnxPrivateIoctl(struct net_device *dev, struct zdap_ioctl* zdreq)
+{
+ //void* regp = macp->regp;
+ u16_t cmd;
+ //u32_t temp;
+ u32_t* p;
+ u32_t i;
+
+ cmd = zdreq->cmd;
+ switch(cmd)
+ {
+ case ZM_IOCTL_REG_READ:
+ zfiDbgReadReg(dev, zdreq->addr);
+ break;
+
+ case ZM_IOCTL_REG_WRITE:
+ zfiDbgWriteReg(dev, zdreq->addr, zdreq->value);
+ break;
+
+ case ZM_IOCTL_MEM_READ:
+ p = (u32_t *) bus_to_virt(zdreq->addr);
+ printk(KERN_DEBUG "usbdrv: read memory addr: 0x%08x value: 0x%08x\n", zdreq->addr, *p);
+ break;
+
+ case ZM_IOCTL_MEM_WRITE:
+ p = (u32_t *) bus_to_virt(zdreq->addr);
+ *p = zdreq->value;
+ printk(KERN_DEBUG "usbdrv: write value: 0x%08x to memory addr: 0x%08x\n", zdreq->value, zdreq->addr);
+ break;
+
+ case ZM_IOCTL_TALLY :
+ zfiWlanShowTally(dev);
+ if (zdreq->addr)
+ zfiWlanResetTally(dev);
+ break;
+
+ case ZM_IOCTL_TEST :
+ printk(KERN_DEBUG "ZM_IOCTL_TEST:len=%d\n", zdreq->addr);
+ //zfiWlanReadReg(dev, 0x10f400);
+ //zfiWlanReadReg(dev, 0x10f404);
+ printk("IOCTL TEST\n");
+ #if 1
+ //print packet
+ for (i=0; i<zdreq->addr; i++)
+ {
+ if ((i&0x7) == 0)
+ {
+ printk("\n");
+ }
+ printk("%02X ", (unsigned char)zdreq->data[i]);
+ }
+ printk("\n");
+ #endif
+
+
+ #if 0 //For Test?? 1 to 0 by CWYang(-)
+ {
+ struct sk_buff* s;
+
+ /* Allocate a skb */
+ s = alloc_skb(2000, GFP_ATOMIC);
+
+ /* Copy data to skb */
+ for (i=0; i<zdreq->addr; i++)
+ {
+ s->data[i] = zdreq->data[i];
+ }
+ s->len = zdreq->addr;
+
+ /* Call zfIdlRecv() */
+ zfiRecv80211(dev, s, NULL);
+ }
+ #endif
+
+ break;
+
+
+/****************************** ZDCONFIG ******************************/
+ case ZM_IOCTL_FRAG :
+ zfiWlanSetFragThreshold(dev, zdreq->addr);
+ break;
+
+ case ZM_IOCTL_RTS :
+ zfiWlanSetRtsThreshold(dev, zdreq->addr);
+ break;
+
+ case ZM_IOCTL_SCAN :
+ zfiWlanScan(dev);
+ break;
+
+ case ZM_IOCTL_KEY :
+ {
+ u8_t key[29];
+ struct zsKeyInfo keyInfo;
+ u32_t i;
+
+ for (i=0; i<29; i++)
+ {
+ key[i] = 0;
+ }
+
+ for (i=0; i<zdreq->addr; i++)
+ {
+ key[i] = zdreq->data[i];
+ }
+
+ printk("key len=%d, key=%02x%02x%02x%02x%02x...\n",
+ zdreq->addr, key[0], key[1], key[2], key[3], key[4]);
+
+ keyInfo.keyLength = zdreq->addr;
+ keyInfo.keyIndex = 0;
+ keyInfo.flag = 0;
+ keyInfo.key = key;
+ zfiWlanSetKey(dev, keyInfo);
+ }
+ break;
+
+ case ZM_IOCTL_RATE :
+ zfiWlanSetTxRate(dev, zdreq->addr);
+ break;
+
+ case ZM_IOCTL_ENCRYPTION_MODE :
+ zfiWlanSetEncryMode(dev, zdreq->addr);
+
+ zfiWlanDisable(dev, 0);
+ zfiWlanEnable(dev);
+ break;
+ //CWYang(+)
+ case ZM_IOCTL_SIGNAL_STRENGTH :
+ {
+ u8_t buffer[2];
+ zfiWlanQuerySignalInfo(dev, &buffer[0]);
+ printk("Current Signal Strength : %02d\n", buffer[0]);
+ }
+ break;
+ //CWYang(+)
+ case ZM_IOCTL_SIGNAL_QUALITY :
+ {
+ u8_t buffer[2];
+ zfiWlanQuerySignalInfo(dev, &buffer[0]);
+ printk("Current Signal Quality : %02d\n", buffer[1]);
+ }
+ break;
+
+ case ZM_IOCTL_SET_PIBSS_MODE:
+ if (zdreq->addr == 1)
+ zfiWlanSetWlanMode(dev, ZM_MODE_PSEUDO);
+ else
+ zfiWlanSetWlanMode(dev, ZM_MODE_INFRASTRUCTURE);
+
+ zfiWlanDisable(dev, 0);
+ zfiWlanEnable(dev);
+
+ break;
+/****************************** ZDCONFIG ******************************/
+
+ default :
+ printk(KERN_ERR "usbdrv: error command = %x\n", cmd);
+ break;
+ }
+
+ return 0;
+}
+
+int usbdrv_wpa_ioctl(struct net_device *dev, struct athr_wlan_param *zdparm)
+{
+ int ret = 0;
+ u8_t bc_addr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+ u8_t mac_addr[80];
+ struct zsKeyInfo keyInfo;
+ struct usbdrv_private *macp = dev->ml_priv;
+ u16_t vapId = 0;
+
+ //zmw_get_wlan_dev(dev);
+
+ switch(zdparm->cmd)
+ {
+ case ZD_CMD_SET_ENCRYPT_KEY:
+
+ /* Set up key information */
+ keyInfo.keyLength = zdparm->u.crypt.key_len;
+ keyInfo.keyIndex = zdparm->u.crypt.idx;
+ if (zfiWlanQueryWlanMode(dev) == ZM_MODE_AP) // AP Mode
+ keyInfo.flag = ZM_KEY_FLAG_AUTHENTICATOR;
+ else
+ keyInfo.flag = 0;
+ keyInfo.key = zdparm->u.crypt.key;
+ keyInfo.initIv = zdparm->u.crypt.seq;
+ keyInfo.macAddr = (u16_t *)zdparm->sta_addr;
+
+ /* Identify the MAC address information */
+ if (memcmp(zdparm->sta_addr, bc_addr, sizeof(bc_addr)) == 0)
+ {
+ keyInfo.flag |= ZM_KEY_FLAG_GK;
+ }
+ else
+ {
+ keyInfo.flag |= ZM_KEY_FLAG_PK;
+ }
+
+ if (!strcmp(zdparm->u.crypt.alg, "NONE"))
+ {
+ //u8_t zero_mac[]={0,0,0,0,0,0};
+
+ /* Set key length to zero */
+ keyInfo.keyLength = 0;
+
+ if (zdparm->sta_addr[0] & 1)//del group key
+ {
+ //if (macp->cardSetting.WPAIeLen==0)
+ //{//802.1x dynamic WEP
+ // mDynKeyMode = 0;
+ // mKeyFormat[0] = 0;
+ // mPrivacyInvoked[0]=FALSE;
+ // mCap[0] &= ~CAP_PRIVACY;
+ // macp->cardSetting.EncryOnOff[0]=0;
+ //}
+ //mWpaBcKeyLen = mGkInstalled = 0;
+ }
+ else
+ {
+ //if (memcmp(zero_mac,zdparm->sta_addr, 6)==0)
+ //{
+ // mDynKeyMode=0;
+ // mKeyFormat[0]=0;
+ // pSetting->DynKeyMode=0;
+ // pSetting->EncryMode[0]=0;
+ // mDynKeyMode=0;
+ //}
+ }
+
+ printk(KERN_ERR "Set Encryption Type NONE\n");
+ return ret;
+ }
+ else if (!strcmp(zdparm->u.crypt.alg, "TKIP"))
+ {
+ zfiWlanSetEncryMode(dev, ZM_TKIP);
+ //Linux Supplicant will inverse Tx/Rx key
+ //So we inverse it back //CWYang(+)
+ //zfMemoryCopy(&temp[0], &keyInfo.key[16], 8);
+ //zfMemoryCopy(&keyInfo.key[16], keyInfo.key[24], 8);
+ //zfMemoryCopy(&keyInfo.key[24], &temp[0], 8);
+ //u8_t temp;
+ //int k;
+ //for (k = 0; k < 8; k++)
+ //{
+ // temp = keyInfo.key[16 + k];
+ // keyInfo.key[16 + k] = keyInfo.key[24 + k];
+ // keyInfo.key[24 + k] = temp;
+ //}
+ //CamEncryType = ZM_TKIP;
+ ////if (idx == 0)
+ //{// Pairwise key
+ // mKeyFormat[0] = CamEncryType;
+ // mDynKeyMode = pSetting->DynKeyMode = DYN_KEY_TKIP;
+ //}
+ }
+ else if (!strcmp(zdparm->u.crypt.alg, "CCMP"))
+ {
+ zfiWlanSetEncryMode(dev, ZM_AES);
+ //CamEncryType = ZM_AES;
+ ////if (idx == 0)
+ //{// Pairwise key
+ // mKeyFormat[0] = CamEncryType;
+ // mDynKeyMode = pSetting->DynKeyMode = DYN_KEY_AES;
+ //}
+ }
+ else if (!strcmp(zdparm->u.crypt.alg, "WEP"))
+ {
+ if (keyInfo.keyLength == 5)
+ { // WEP 64
+ zfiWlanSetEncryMode(dev, ZM_WEP64);
+ // CamEncryType = ZM_WEP64;
+ // tmpDynKeyMode=DYN_KEY_WEP64;
+ }
+ else if (keyInfo.keyLength == 13)
+ {//keylen=13, WEP 128
+ zfiWlanSetEncryMode(dev, ZM_WEP128);
+ // CamEncryType = ZM_WEP128;
+ // tmpDynKeyMode=DYN_KEY_WEP128;
+ }
+ else
+ {
+ zfiWlanSetEncryMode(dev, ZM_WEP256);
+ }
+
+ // For Dynamic WEP key (Non-WPA Radius), the key ID range: 0-3
+ // In WPA/RSN mode, the key ID range: 1-3, usually, a broadcast key.
+ // For WEP key setting: we set mDynKeyMode and mKeyFormat in following case:
+ // 1. For 802.1x dynamically generated WEP key method.
+ // 2. For WPA/RSN mode, but key id == 0. (But this is an impossible case)
+ // So, only check case 1.
+ //if (macp->cardSetting.WPAIeLen==0)
+ //{
+ // mKeyFormat[0] = CamEncryType;
+ // mDynKeyMode = pSetting->DynKeyMode = tmpDynKeyMode;
+ // mPrivacyInvoked[0]=TRUE;
+ // mCap[0] |= CAP_PRIVACY;
+ // macp->cardSetting.EncryOnOff[0]=1;
+ //}
+ }
+
+ /* DUMP key context */
+//#ifdef WPA_DEBUG
+ if (keyInfo.keyLength > 0)
+ {
+ int ii;
+ printk("Otus: Key Context:\n");
+ for(ii = 0; ii < keyInfo.keyLength;)
+ {
+ printk("0x%02x ", keyInfo.key[ii]);
+ if((++ii % 16) == 0)
+ printk("\n");
+ }
+ printk("\n");
+ }
+//#endif
+
+ /* Set encrypt mode */
+ //zfiWlanSetEncryMode(dev, CamEncryType);
+ vapId = zfLnxGetVapId(dev);
+ if (vapId == 0xffff)
+ keyInfo.vapId = 0;
+ else
+ keyInfo.vapId = vapId + 1;
+ keyInfo.vapAddr[0] = keyInfo.macAddr[0];
+ keyInfo.vapAddr[1] = keyInfo.macAddr[1];
+ keyInfo.vapAddr[2] = keyInfo.macAddr[2];
+
+ zfiWlanSetKey(dev, keyInfo);
+
+ //zfiWlanDisable(dev);
+ //zfiWlanEnable(dev);
+ break;
+
+ case ZD_CMD_SET_MLME:
+ printk(KERN_ERR "usbdrv_wpa_ioctl: ZD_CMD_SET_MLME\n");
+
+ /* Translate STA's address */
+ sprintf(mac_addr, "%02x:%02x:%02x:%02x:%02x:%02x", zdparm->sta_addr[0], zdparm->sta_addr[1],
+ zdparm->sta_addr[2], zdparm->sta_addr[3], zdparm->sta_addr[4], zdparm->sta_addr[5]);
+
+ switch(zdparm->u.mlme.cmd)
+ {
+ case MLME_STA_DEAUTH:
+ printk(" -------Call zfiWlanDeauth, reason:%d\n",zdparm->u.mlme.reason_code);
+ if(zfiWlanDeauth(dev, (u16_t*) zdparm->sta_addr, zdparm->u.mlme.reason_code) != 0)
+ printk(KERN_ERR "Can't deauthencate STA: %s\n", mac_addr);
+ else
+ printk(KERN_ERR "Deauthenticate STA: %s with reason code: %d\n", mac_addr, zdparm->u.mlme.reason_code);
+ break;
+
+ case MLME_STA_DISASSOC:
+ printk(" -------Call zfiWlanDeauth, reason:%d\n",zdparm->u.mlme.reason_code);
+ if(zfiWlanDeauth(dev, (u16_t*) zdparm->sta_addr, zdparm->u.mlme.reason_code) != 0)
+ printk(KERN_ERR "Can't disassociate STA: %s\n", mac_addr);
+ else
+ printk(KERN_ERR "Disassociate STA: %s with reason code: %d\n", mac_addr, zdparm->u.mlme.reason_code);
+ break;
+
+ default:
+ printk(KERN_ERR "MLME command: 0x%04x not support\n", zdparm->u.mlme.cmd);
+ break;
+ }
+
+ break;
+
+ case ZD_CMD_SCAN_REQ:
+ printk(KERN_ERR "usbdrv_wpa_ioctl: ZD_CMD_SCAN_REQ\n");
+ break;
+
+ case ZD_CMD_SET_GENERIC_ELEMENT:
+ printk(KERN_ERR "usbdrv_wpa_ioctl: ZD_CMD_SET_GENERIC_ELEMENT\n");
+
+ /* Copy the WPA IE */
+ //zm_msg1_mm(ZM_LV_0, "CWY - wpaie Length : ", zdparm->u.generic_elem.len);
+ printk(KERN_ERR "wpaie Length : %d\n", zdparm->u.generic_elem.len);
+ if (zfiWlanQueryWlanMode(dev) == ZM_MODE_AP) // AP Mode
+ {
+ zfiWlanSetWpaIe(dev, zdparm->u.generic_elem.data, zdparm->u.generic_elem.len);
+ }
+ else
+ {
+ macp->supLen = zdparm->u.generic_elem.len;
+ memcpy(macp->supIe, zdparm->u.generic_elem.data, zdparm->u.generic_elem.len);
+ }
+ zfiWlanSetWpaSupport(dev, 1);
+ //zfiWlanSetWpaIe(dev, zdparm->u.generic_elem.data, zdparm->u.generic_elem.len);
+ {
+ int ii;
+ u8_t len = zdparm->u.generic_elem.len;
+ u8_t *wpaie = (u8_t *)zdparm->u.generic_elem.data;
+
+ printk(KERN_ERR "wd->ap.wpaLen: %d\n", len);
+
+ /* DUMP WPA IE */
+ for(ii = 0; ii < len;)
+ {
+ printk(KERN_ERR "0x%02x ", wpaie[ii]);
+
+ if((++ii % 16) == 0)
+ printk(KERN_ERR "\n");
+ }
+ printk(KERN_ERR "\n");
+ }
+
+// #ifdef ZM_HOSTAPD_SUPPORT
+ //if (wd->wlanMode == ZM_MODE_AP)
+ //{// Update Beacon FIFO in the next TBTT.
+ // memcpy(&mWPAIe, pSetting->WPAIe, pSetting->WPAIeLen);
+ // printk(KERN_ERR "Copy WPA IE into mWPAIe\n");
+ //}
+// #endif
+ break;
+
+// #ifdef ZM_HOSTAPD_SUPPORT
+ case ZD_CMD_GET_TSC:
+ printk(KERN_ERR "usbdrv_wpa_ioctl: ZD_CMD_GET_TSC\n");
+ break;
+// #endif
+
+ default:
+ printk(KERN_ERR "usbdrv_wpa_ioctl default: 0x%04x\n", zdparm->cmd);
+ ret = -EINVAL;
+ break;
+ }
+
+ return ret;
+}
+
+#ifdef ZM_ENABLE_CENC
+int usbdrv_cenc_ioctl(struct net_device *dev, struct zydas_cenc_param *zdparm)
+{
+ //struct usbdrv_private *macp = dev->ml_priv;
+ struct zsKeyInfo keyInfo;
+ u16_t apId;
+ u8_t bc_addr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+ int ret = 0;
+ int ii;
+
+ /* Get the AP Id */
+ apId = zfLnxGetVapId(dev);
+
+ if (apId == 0xffff)
+ {
+ apId = 0;
+ }
+ else
+ {
+ apId = apId+1;
+ }
+
+ switch (zdparm->cmd)
+ {
+ case ZM_CMD_CENC_SETCENC:
+ printk(KERN_ERR "ZM_CMD_CENC_SETCENC\n");
+ printk(KERN_ERR "length: %d\n", zdparm->len);
+ printk(KERN_ERR "policy: %d\n", zdparm->u.info.cenc_policy);
+ break;
+ case ZM_CMD_CENC_SETKEY:
+ //ret = wai_ioctl_setkey(vap, ioctl_msg);
+ printk(KERN_ERR "ZM_CMD_CENC_SETKEY\n");
+
+ printk(KERN_ERR "MAC address= ");
+ for(ii = 0; ii < 6; ii++)
+ {
+ printk(KERN_ERR "0x%02x ", zdparm->u.crypt.sta_addr[ii]);
+ }
+ printk(KERN_ERR "\n");
+
+ printk(KERN_ERR "Key Index: %d\n", zdparm->u.crypt.keyid);
+ printk(KERN_ERR "Encryption key= ");
+ for(ii = 0; ii < 16; ii++)
+ {
+ printk(KERN_ERR "0x%02x ", zdparm->u.crypt.key[ii]);
+ }
+ printk(KERN_ERR "\n");
+
+ printk(KERN_ERR "MIC key= ");
+ for(ii = 16; ii < ZM_CENC_KEY_SIZE; ii++)
+ {
+ printk(KERN_ERR "0x%02x ", zdparm->u.crypt.key[ii]);
+ }
+ printk(KERN_ERR "\n");
+
+ /* Set up key information */
+ keyInfo.keyLength = ZM_CENC_KEY_SIZE;
+ keyInfo.keyIndex = zdparm->u.crypt.keyid;
+ keyInfo.flag = ZM_KEY_FLAG_AUTHENTICATOR | ZM_KEY_FLAG_CENC;
+ keyInfo.key = zdparm->u.crypt.key;
+ keyInfo.macAddr = (u16_t *)zdparm->u.crypt.sta_addr;
+
+ /* Identify the MAC address information */
+ if (memcmp(zdparm->u.crypt.sta_addr, bc_addr, sizeof(bc_addr)) == 0)
+ {
+ keyInfo.flag |= ZM_KEY_FLAG_GK;
+ keyInfo.vapId = apId;
+ memcpy(keyInfo.vapAddr, dev->dev_addr, ETH_ALEN);
+ }
+ else
+ {
+ keyInfo.flag |= ZM_KEY_FLAG_PK;
+ }
+
+ zfiWlanSetKey(dev, keyInfo);
+
+ break;
+ case ZM_CMD_CENC_REKEY:
+ //ret = wai_ioctl_rekey(vap, ioctl_msg);
+ printk(KERN_ERR "ZM_CMD_CENC_REKEY\n");
+ break;
+ default:
+ ret = -EOPNOTSUPP;
+ break;
+
+ }
+
+ //if (retv == ENETRESET)
+ // retv = IS_UP_AUTO(vap) ? ieee80211_open(vap->iv_dev) : 0;
+
+ return ret;
+}
+#endif //ZM_ENABLE_CENC
+/////////////////////////////////////////
+int usbdrv_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+{
+// struct usbdrv_private *macp;
+// void *regp;
+ struct zdap_ioctl zdreq;
+ struct iwreq *wrq = (struct iwreq *)ifr;
+ struct athr_wlan_param zdparm;
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ int err = 0;
+ int changed = 0;
+
+// regp = macp->regp;
+
+ if(!netif_running(dev))
+ return -EINVAL;
+
+ switch (cmd)
+ {
+ case SIOCGIWNAME:
+ strcpy(wrq->u.name, "IEEE 802.11-DS");
+ break;
+
+ case SIOCGIWAP:
+ err = usbdrvwext_giwap(dev, NULL, &wrq->u.ap_addr, NULL);
+ break;
+
+
+ case SIOCSIWAP:
+ err = usbdrvwext_siwap(dev, NULL, &wrq->u.ap_addr, NULL);
+ break;
+
+
+ case SIOCGIWMODE:
+ err = usbdrvwext_giwmode(dev, NULL, &wrq->u.mode, NULL);
+ break;
+
+
+ case SIOCSIWESSID:
+ printk(KERN_ERR "CWY - usbdrvwext_siwessid\n");
+ //err = usbdrv_ioctl_setessid(dev, &wrq->u.essid);
+ err = usbdrvwext_siwessid(dev, NULL, &wrq->u.essid, NULL);
+
+ if (! err)
+ changed = 1;
+ break;
+
+
+ case SIOCGIWESSID:
+ err = usbdrvwext_giwessid(dev, NULL, &wrq->u.essid, NULL);
+ break;
+
+
+ case SIOCSIWRTS:
+
+ err = usbdrv_ioctl_setrts(dev, &wrq->u.rts);
+ if (! err)
+ changed = 1;
+ break;
+
+
+ case SIOCIWFIRSTPRIV + 0x2: /* set_auth */
+ {
+ //printk("CWY - SIOCIWFIRSTPRIV + 0x2 (set_auth)\n");
+ if (! capable(CAP_NET_ADMIN))
+ {
+ err = -EPERM;
+ break;
+ }
+ {
+ int val = *( (int *) wrq->u.name );
+ if ((val < 0) || (val > 2))
+ {
+ err = -EINVAL;
+ break;
+ }
+ else
+ {
+ zfiWlanSetAuthenticationMode(dev, val);
+
+ if (macp->DeviceOpened == 1)
+ {
+ zfiWlanDisable(dev, 0);
+ zfiWlanEnable(dev);
+ }
+
+ err = 0;
+ changed = 1;
+ }
+ }
+ }
+ break;
+
+ case SIOCIWFIRSTPRIV + 0x3: /* get_auth */
+ {
+ int AuthMode = ZM_AUTH_MODE_OPEN;
+
+ //printk("CWY - SIOCIWFIRSTPRIV + 0x3 (get_auth)\n");
+
+ if (wrq->u.data.pointer)
+ {
+ wrq->u.data.flags = 1;
+
+ AuthMode = zfiWlanQueryAuthenticationMode(dev, 0);
+ if (AuthMode == ZM_AUTH_MODE_OPEN)
+ {
+ wrq->u.data.length = 12;
+
+ if (copy_to_user(wrq->u.data.pointer, "open system", 12))
+ {
+ return -EFAULT;
+ }
+ }
+ else if (AuthMode == ZM_AUTH_MODE_SHARED_KEY)
+ {
+ wrq->u.data.length = 11;
+
+ if (copy_to_user(wrq->u.data.pointer, "shared key", 11))
+ {
+ return -EFAULT;
+ }
+ }
+ else if (AuthMode == ZM_AUTH_MODE_AUTO)
+ {
+ wrq->u.data.length = 10;
+
+ if (copy_to_user(wrq->u.data.pointer, "auto mode", 10))
+ {
+ return -EFAULT;
+ }
+ }
+ else
+ {
+ return -EFAULT;
+ }
+ }
+ }
+ break;
+
+
+ case ZDAPIOCTL: //debug command
+ if (copy_from_user(&zdreq, ifr->ifr_data, sizeof (zdreq)))
+ {
+ printk(KERN_ERR "usbdrv: copy_from_user error\n");
+ return -EFAULT;
+ }
+
+ //printk(KERN_DEBUG "usbdrv: cmd=%2x, reg=0x%04lx, value=0x%08lx\n",
+ // zdreq.cmd, zdreq.addr, zdreq.value);
+
+ zfLnxPrivateIoctl(dev, &zdreq);
+
+ err = 0;
+ break;
+
+ case ZD_IOCTL_WPA:
+ if (copy_from_user(&zdparm, ifr->ifr_data, sizeof(struct athr_wlan_param)))
+ {
+ printk(KERN_ERR "usbdrv: copy_from_user error\n");
+ return -EFAULT;
+ }
+
+ usbdrv_wpa_ioctl(dev, &zdparm);
+ err = 0;
+ break;
+
+ case ZD_IOCTL_PARAM:
+ {
+ int *p;
+ int op;
+ int arg;
+
+ /* Point to the name field and retrieve the
+ * op and arg elements. */
+ p = (int *)wrq->u.name;
+ op = *p++;
+ arg = *p;
+
+ if(op == ZD_PARAM_ROAMING)
+ {
+ printk(KERN_ERR "************* ZD_PARAM_ROAMING: %d\n", arg);
+ //macp->cardSetting.ap_scan=(U8)arg;
+ }
+ if(op == ZD_PARAM_PRIVACY)
+ {
+ printk(KERN_ERR "ZD_IOCTL_PRIVACY: ");
+
+ /* Turn on the privacy invoke flag */
+ if(arg)
+ {
+ // mCap[0] |= CAP_PRIVACY;
+ // macp->cardSetting.EncryOnOff[0] = 1;
+ printk(KERN_ERR "enable\n");
+
+ }
+ else
+ {
+ // mCap[0] &= ~CAP_PRIVACY;
+ // macp->cardSetting.EncryOnOff[0] = 0;
+ printk(KERN_ERR "disable\n");
+ }
+ //changed=1;
+ }
+ if(op == ZD_PARAM_WPA)
+ {
+ printk(KERN_ERR "ZD_PARAM_WPA: ");
+
+ if(arg)
+ {
+ printk(KERN_ERR "enable\n");
+
+ if (zfiWlanQueryWlanMode(dev) != ZM_MODE_AP)
+ {
+ printk(KERN_ERR "Station Mode\n");
+ //zfiWlanQueryWpaIe(dev, (u8_t *)&wpaIe, &wpalen);
+ //printk("wpaIe : %2x,%2x,%2x\n", wpaIe[21], wpaIe[22], wpaIe[23]);
+ //printk("rsnIe : %2x,%2x,%2x\n", wpaIe[17], wpaIe[18], wpaIe[19]);
+ if ((macp->supIe[21] == 0x50) &&
+ (macp->supIe[22] == 0xf2) &&
+ (macp->supIe[23] == 0x2))
+ {
+ printk(KERN_ERR "wd->sta.authMode = ZM_AUTH_MODE_WPAPSK\n");
+ //wd->sta.authMode = ZM_AUTH_MODE_WPAPSK;
+ //wd->ws.authMode = ZM_AUTH_MODE_WPAPSK;
+ zfiWlanSetAuthenticationMode(dev, ZM_AUTH_MODE_WPAPSK);
+ }
+ else if ((macp->supIe[21] == 0x50) &&
+ (macp->supIe[22] == 0xf2) &&
+ (macp->supIe[23] == 0x1))
+ {
+ printk(KERN_ERR "wd->sta.authMode = ZM_AUTH_MODE_WPA\n");
+ //wd->sta.authMode = ZM_AUTH_MODE_WPA;
+ //wd->ws.authMode = ZM_AUTH_MODE_WPA;
+ zfiWlanSetAuthenticationMode(dev, ZM_AUTH_MODE_WPA);
+ }
+ else if ((macp->supIe[17] == 0xf) &&
+ (macp->supIe[18] == 0xac) &&
+ (macp->supIe[19] == 0x2))
+ {
+ printk(KERN_ERR "wd->sta.authMode = ZM_AUTH_MODE_WPA2PSK\n");
+ //wd->sta.authMode = ZM_AUTH_MODE_WPA2PSK;
+ //wd->ws.authMode = ZM_AUTH_MODE_WPA2PSK;
+ zfiWlanSetAuthenticationMode(dev, ZM_AUTH_MODE_WPA2PSK);
+ }
+ else if ((macp->supIe[17] == 0xf) &&
+ (macp->supIe[18] == 0xac) &&
+ (macp->supIe[19] == 0x1))
+ {
+ printk(KERN_ERR "wd->sta.authMode = ZM_AUTH_MODE_WPA2\n");
+ //wd->sta.authMode = ZM_AUTH_MODE_WPA2;
+ //wd->ws.authMode = ZM_AUTH_MODE_WPA2;
+ zfiWlanSetAuthenticationMode(dev, ZM_AUTH_MODE_WPA2);
+ }
+ if ((macp->supIe[21] == 0x50) || (macp->supIe[22] == 0xf2))//WPA or WPAPSK
+ {
+ if (macp->supIe[11] == 0x2)
+ {
+ printk(KERN_ERR "wd->sta.wepStatus = ZM_ENCRYPTION_TKIP\n");
+ //wd->sta.wepStatus = ZM_ENCRYPTION_TKIP;
+ //wd->ws.wepStatus = ZM_ENCRYPTION_TKIP;
+ zfiWlanSetWepStatus(dev, ZM_ENCRYPTION_TKIP);
+ }
+ else
+ {
+ printk(KERN_ERR "wd->sta.wepStatus = ZM_ENCRYPTION_AES\n");
+ //wd->sta.wepStatus = ZM_ENCRYPTION_AES;
+ //wd->ws.wepStatus = ZM_ENCRYPTION_AES;
+ zfiWlanSetWepStatus(dev, ZM_ENCRYPTION_AES);
+ }
+ }
+ if ((macp->supIe[17] == 0xf) || (macp->supIe[18] == 0xac)) //WPA2 or WPA2PSK
+ {
+ if (macp->supIe[13] == 0x2)
+ {
+ printk(KERN_ERR "wd->sta.wepStatus = ZM_ENCRYPTION_TKIP\n");
+ //wd->sta.wepStatus = ZM_ENCRYPTION_TKIP;
+ //wd->ws.wepStatus = ZM_ENCRYPTION_TKIP;
+ zfiWlanSetWepStatus(dev, ZM_ENCRYPTION_TKIP);
+ }
+ else
+ {
+ printk(KERN_ERR "wd->sta.wepStatus = ZM_ENCRYPTION_AES\n");
+ //wd->sta.wepStatus = ZM_ENCRYPTION_AES;
+ //wd->ws.wepStatus = ZM_ENCRYPTION_AES;
+ zfiWlanSetWepStatus(dev, ZM_ENCRYPTION_AES);
+ }
+ }
+ }
+ zfiWlanSetWpaSupport(dev, 1);
+ }
+ else
+ {
+ /* Reset the WPA related variables */
+ printk(KERN_ERR "disable\n");
+
+ zfiWlanSetWpaSupport(dev, 0);
+ zfiWlanSetAuthenticationMode(dev, ZM_AUTH_MODE_OPEN);
+ zfiWlanSetWepStatus(dev, ZM_ENCRYPTION_WEP_DISABLED);
+
+ /* Now we only set the length in the WPA IE
+ * field to zero. */
+ //macp->cardSetting.WPAIe[1] = 0;
+ }
+ }
+ if(op == ZD_PARAM_COUNTERMEASURES)
+ {
+ printk(KERN_ERR "================ZD_PARAM_COUNTERMEASURES: ");
+
+ if(arg)
+ {
+ // mCounterMeasureState=1;
+ printk(KERN_ERR "enable\n");
+ }
+ else
+ {
+ // mCounterMeasureState=0;
+ printk(KERN_ERR "disable\n");
+ }
+ }
+ if(op == ZD_PARAM_DROPUNENCRYPTED)
+ {
+ printk(KERN_ERR "ZD_PARAM_DROPUNENCRYPTED: ");
+
+ if(arg)
+ {
+ printk(KERN_ERR "enable\n");
+ }
+ else
+ {
+ printk(KERN_ERR "disable\n");
+ }
+ }
+ if(op == ZD_PARAM_AUTH_ALGS)
+ {
+ printk(KERN_ERR "ZD_PARAM_AUTH_ALGS: ");
+
+ if(arg == 0)
+ {
+ printk(KERN_ERR "OPEN_SYSTEM\n");
+ }
+ else
+ {
+ printk(KERN_ERR "SHARED_KEY\n");
+ }
+ }
+ if(op == ZD_PARAM_WPS_FILTER)
+ {
+ printk(KERN_ERR "ZD_PARAM_WPS_FILTER: ");
+
+ if(arg)
+ {
+ // mCounterMeasureState=1;
+ macp->forwardMgmt = 1;
+ printk(KERN_ERR "enable\n");
+ }
+ else
+ {
+ // mCounterMeasureState=0;
+ macp->forwardMgmt = 0;
+ printk(KERN_ERR "disable\n");
+ }
+ }
+ }
+ err = 0;
+ break;
+
+ case ZD_IOCTL_GETWPAIE:
+ {
+ struct ieee80211req_wpaie req_wpaie;
+ u16_t apId, i, j;
+
+ /* Get the AP Id */
+ apId = zfLnxGetVapId(dev);
+
+ if (apId == 0xffff)
+ {
+ apId = 0;
+ }
+ else
+ {
+ apId = apId+1;
+ }
+
+ if (copy_from_user(&req_wpaie, ifr->ifr_data, sizeof(struct ieee80211req_wpaie))){
+ printk(KERN_ERR "usbdrv: copy_from_user error\n");
+ return -EFAULT;
+ }
+
+ for(i = 0; i < ZM_OAL_MAX_STA_SUPPORT; i++)
+ {
+ for(j = 0; j < IEEE80211_ADDR_LEN; j++)
+ {
+ if (macp->stawpaie[i].wpa_macaddr[j] != req_wpaie.wpa_macaddr[j])
+ break;
+ }
+ if (j == 6)
+ break;
+ }
+ if (i < ZM_OAL_MAX_STA_SUPPORT)
+ {
+ //printk("ZD_IOCTL_GETWPAIE - sta index = %d\n", i);
+ memcpy(req_wpaie.wpa_ie, macp->stawpaie[i].wpa_ie, IEEE80211_MAX_IE_SIZE);
+ }
+
+ if (copy_to_user(wrq->u.data.pointer, &req_wpaie, sizeof(struct ieee80211req_wpaie)))
+ {
+ return -EFAULT;
+ }
+ }
+
+ err = 0;
+ break;
+#ifdef ZM_ENABLE_CENC
+ case ZM_IOCTL_CENC:
+ if (copy_from_user(&macp->zd_wpa_req, ifr->ifr_data, sizeof(struct athr_wlan_param)))
+ {
+ printk(KERN_ERR "usbdrv: copy_from_user error\n");
+ return -EFAULT;
+ }
+
+ usbdrv_cenc_ioctl(dev, (struct zydas_cenc_param *)&macp->zd_wpa_req);
+ err = 0;
+ break;
+#endif //ZM_ENABLE_CENC
+ default:
+ err = -EOPNOTSUPP;
+ break;
+ }
+
+
+ return err;
+}
diff --git a/drivers/staging/otus/oal_dt.h b/drivers/staging/otus/oal_dt.h
new file mode 100644
index 00000000000..e82b9770fca
--- /dev/null
+++ b/drivers/staging/otus/oal_dt.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* Module Name : oal_dt.h */
+/* */
+/* Abstract */
+/* This module contains data type definition. */
+/* */
+/* NOTES */
+/* Platform dependent. */
+/* */
+/************************************************************************/
+
+#ifndef _OAL_DT_H
+#define _OAL_DT_H
+
+/* Please include header files for buffer type in the beginning of this file */
+/* Please include header files for device type here */
+#include <linux/netdevice.h>
+
+typedef unsigned long long u64_t;
+typedef unsigned int u32_t;
+typedef unsigned short u16_t;
+typedef unsigned char u8_t;
+typedef long long s64_t;
+typedef long s32_t;
+typedef short s16_t;
+typedef char s8_t;
+
+#ifndef TRUE
+#define TRUE (1==1)
+#endif
+
+#ifndef FALSE
+#define FALSE (1==0)
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+/* Please include header files for buffer type in the beginning of this file */
+typedef struct sk_buff zbuf_t;
+
+/* Please include header files for device type in the beginning of this file */
+typedef struct net_device zdev_t;
+
+#endif /* #ifndef _OAL_DT_H */
diff --git a/drivers/staging/otus/oal_marc.h b/drivers/staging/otus/oal_marc.h
new file mode 100644
index 00000000000..206111616a0
--- /dev/null
+++ b/drivers/staging/otus/oal_marc.h
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* Module Name : oal_marc.h */
+/* */
+/* Abstract */
+/* This module contains warpper definitions. */
+/* */
+/* NOTES */
+/* Platform dependent. */
+/* */
+/************************************************************************/
+
+#ifndef _OAL_MARC_H
+#define _OAL_MARC_H
+
+#include "oal_dt.h"
+#include "usbdrv.h"
+
+#define ZM_OS_LINUX_FUNC
+
+/***** Critical section *****/
+/* Declare for critical section */
+#ifndef ZM_HALPLUS_LOCK
+#define zmw_get_wlan_dev(dev) struct zsWlanDev *wd = (struct zsWlanDev*) ((((struct usbdrv_private*)dev->priv)->wd))
+
+#define zmw_declare_for_critical_section() unsigned long irqFlag;
+
+/* Enter critical section */
+#define zmw_enter_critical_section(dev) \
+ spin_lock_irqsave(&(((struct usbdrv_private *)(dev->priv))->cs_lock), irqFlag);
+
+/* leave critical section */
+#define zmw_leave_critical_section(dev) \
+ spin_unlock_irqrestore(&(((struct usbdrv_private *)(dev->priv))->cs_lock), irqFlag);
+#else
+#define zmw_get_wlan_dev(dev) struct zsWlanDev *wd = zfwGetWlanDev(dev);
+
+/* Declare for critical section */
+#define zmw_declare_for_critical_section()
+
+/* Enter critical section */
+#define zmw_enter_critical_section(dev) \
+ zfwEnterCriticalSection(dev);
+
+/* leave critical section */
+#define zmw_leave_critical_section(dev) \
+ zfwLeaveCriticalSection(dev);
+#endif
+
+/***** Byte order converting *****/
+#ifdef ZM_CONFIG_BIG_ENDIAN
+#define zmw_cpu_to_le32(v) (((v & 0xff000000) >> 24) | \
+ ((v & 0x00ff0000) >> 8) | \
+ ((v & 0x0000ff00) << 8) | \
+ ((v & 0x000000ff) << 24))
+
+#define zmw_le32_to_cpu(v) (((v & 0xff000000) >> 24) | \
+ ((v & 0x00ff0000) >> 8) | \
+ ((v & 0x0000ff00) << 8) | \
+ ((v & 0x000000ff) << 24))
+
+#define zmw_cpu_to_le16(v) (((v & 0xff00) >> 8) | \
+ ((v & 0x00ff) << 8))
+
+#define zmw_le16_to_cpu(v) (((v & 0xff00) >> 8) | \
+ ((v & 0x00ff) << 8))
+#else
+#define zmw_cpu_to_le32(v) (v)
+#define zmw_le32_to_cpu(v) (v)
+#define zmw_cpu_to_le16(v) (v)
+#define zmw_le16_to_cpu(v) (v)
+#endif
+
+/***** Buffer access *****/
+/* Called to read/write buffer */
+#ifndef ZM_HALPLUS_LOCK
+
+#define zmw_buf_readb(dev, buf, offset) *(u8_t*)((u8_t*)buf->data+offset)
+#define zmw_buf_readh(dev, buf, offset) zmw_cpu_to_le16(*(u16_t*)((u8_t*)buf->data+offset))
+#define zmw_buf_writeb(dev, buf, offset, value) *(u8_t*)((u8_t*)buf->data+offset) = value
+#define zmw_buf_writeh(dev, buf, offset, value) *(u16_t*)((u8_t*)buf->data+offset) = zmw_cpu_to_le16(value)
+#define zmw_buf_get_buffer(dev, buf) (u8_t*)(buf->data)
+
+#else
+
+#define zmw_buf_readb(dev, buf, offset) zfwBufReadByte(dev, buf, offset)
+#define zmw_buf_readh(dev, buf, offset) zfwBufReadHalfWord(dev, buf, offset)
+#define zmw_buf_writeb(dev, buf, offset, value) zfwBufWriteByte(dev, buf, offset, value)
+#define zmw_buf_writeh(dev, buf, offset, value) zfwBufWriteHalfWord(dev, buf, offset, value)
+#define zmw_buf_get_buffer(dev, buf) zfwGetBuffer(dev, buf)
+
+#endif
+
+/***** Debug message *****/
+#if 0
+#define zm_debug_msg0(msg) printk("%s:%s\n", __func__, msg);
+#define zm_debug_msg1(msg, val) printk("%s:%s%ld\n", __func__, \
+ msg, (u32_t)val);
+#define zm_debug_msg2(msg, val) printk("%s:%s%lxh\n", __func__, \
+ msg, (u32_t)val);
+#define zm_debug_msg_s(msg, val) printk("%s:%s%s\n", __func__, \
+ msg, val);
+#define zm_debug_msg_p(msg, val1, val2) printk("%s:%s%01ld.%02ld\n", __func__, \
+ msg, (val1/val2), (((val1*100)/val2)%100));
+#define zm_dbg(S) printk S
+#else
+#define zm_debug_msg0(msg)
+#define zm_debug_msg1(msg, val)
+#define zm_debug_msg2(msg, val)
+#define zm_debug_msg_s(msg, val)
+#define zm_debug_msg_p(msg, val1, val2)
+#define zm_dbg(S)
+#endif
+
+#define zm_assert(expr) if(!(expr)) { \
+ printk( "Atheors Assertion failed! %s,%s,%s,line=%d\n", \
+ #expr,__FILE__,__func__,__LINE__); \
+ }
+
+#define DbgPrint printk
+
+#endif /* #ifndef _OAL_MARC_H */
diff --git a/drivers/staging/otus/usbdrv.c b/drivers/staging/otus/usbdrv.c
new file mode 100644
index 00000000000..dfe07072011
--- /dev/null
+++ b/drivers/staging/otus/usbdrv.c
@@ -0,0 +1,1148 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* Module Name : usbdrv.c */
+/* */
+/* Abstract */
+/* This module contains network interface up/down related functions.*/
+/* */
+/* NOTES */
+/* Platform dependent. */
+/* */
+/************************************************************************/
+
+/* src/usbdrv.c */
+
+#define ZM_PIBSS_MODE 0
+#define ZM_AP_MODE 0
+#define ZM_CHANNEL 11
+#define ZM_WEP_MOME 0
+#define ZM_SHARE_AUTH 0
+#define ZM_DISABLE_XMIT 0
+
+#include "usbdrv.h"
+#include "oal_dt.h"
+#include "80211core/pub_zfi.h"
+
+#include "linux/netlink.h"
+#include "linux/rtnetlink.h"
+
+#if WIRELESS_EXT > 12
+#include <net/iw_handler.h>
+#endif
+
+#ifdef ZM_HOSTAPD_SUPPORT
+#include "athr_common.h"
+#endif
+
+extern void zfDumpDescriptor(zdev_t* dev, u16_t type);
+//extern void zfiWlanQueryMacAddress(zdev_t* dev, u8_t* addr);
+
+// ISR handler
+irqreturn_t usbdrv_intr(int, void *, struct pt_regs *);
+
+// Network Device interface related function
+int usbdrv_open(struct net_device *);
+int usbdrv_close(struct net_device *);
+int usbdrv_change_mtu(struct net_device *, int);
+int usbdrv_set_mac(struct net_device *, void *);
+int usbdrv_xmit_frame(struct sk_buff *, struct net_device *);
+void usbdrv_set_multi(struct net_device *);
+struct net_device_stats *usbdrv_get_stats(struct net_device *);
+
+//wireless extension helper functions
+int usbdrv_ioctl_setessid(struct net_device *dev, struct iw_point *erq);
+int usbdrv_ioctl_getessid(struct net_device *dev, struct iw_point *erq);
+int usbdrv_ioctl_setrts(struct net_device *dev, struct iw_param *rrq);
+/* Wireless Extension Handler functions */
+int usbdrvwext_giwmode(struct net_device *dev, struct iw_request_info* info,
+ __u32 *mode, char *extra);
+int zfLnxPrivateIoctl(struct usbdrv_private *macp, struct zdap_ioctl *zdreq);
+
+void zfLnx10msTimer(struct net_device* dev);
+int zfUnregisterWdsDev(struct net_device* parentDev, u16_t wdsId);
+int zfRegisterWdsDev(struct net_device* parentDev, u16_t wdsId);
+int zfWdsOpen(struct net_device *dev);
+int zfWdsClose(struct net_device *dev);
+int zfLnxVapOpen(struct net_device *dev);
+int zfLnxVapClose(struct net_device *dev);
+int zfLnxVapXmitFrame(struct sk_buff *skb, struct net_device *dev);
+int zfLnxRegisterVapDev(struct net_device* parentDev, u16_t vapId);
+int usbdrv_wpa_ioctl(struct net_device *dev, struct athr_wlan_param *zdparm);
+extern u16_t zfLnxGetVapId(zdev_t* dev);
+extern u16_t zfLnxCheckTxBufferCnt(zdev_t *dev);
+extern UsbTxQ_t *zfLnxGetUsbTxBuffer(zdev_t *dev);
+
+extern u16_t zfLnxAuthNotify(zdev_t* dev, u16_t* macAddr);
+extern u16_t zfLnxAsocNotify(zdev_t* dev, u16_t* macAddr, u8_t* body, u16_t bodySize, u16_t port);
+extern u16_t zfLnxDisAsocNotify(zdev_t* dev, u8_t* macAddr, u16_t port);
+extern u16_t zfLnxApConnectNotify(zdev_t* dev, u8_t* macAddr, u16_t port);
+extern void zfLnxConnectNotify(zdev_t* dev, u16_t status, u16_t* bssid);
+extern void zfLnxScanNotify(zdev_t* dev, struct zsScanResult* result);
+extern void zfLnxStatisticsNotify(zdev_t* dev, struct zsStastics* result);
+extern void zfLnxMicFailureNotify(zdev_t* dev, u16_t* addr, u16_t status);
+extern void zfLnxApMicFailureNotify(zdev_t* dev, u8_t* addr, zbuf_t* buf);
+extern void zfLnxIbssPartnerNotify(zdev_t* dev, u16_t status, struct zsPartnerNotifyEvent *event);
+extern void zfLnxMacAddressNotify(zdev_t* dev, u8_t* addr);
+extern void zfLnxSendCompleteIndication(zdev_t* dev, zbuf_t* buf);
+extern void zfLnxRecvEth(zdev_t* dev, zbuf_t* buf, u16_t port);
+extern void zfLnxRestoreBufData(zdev_t* dev, zbuf_t* buf);
+#ifdef ZM_ENABLE_CENC
+extern u16_t zfLnxCencAsocNotify(zdev_t* dev, u16_t* macAddr, u8_t* body, u16_t bodySize, u16_t port);
+#endif //ZM_ENABLE_CENC
+extern void zfLnxWatchDogNotify(zdev_t* dev);
+extern void zfLnxRecv80211(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo);
+extern u8_t zfLnxCreateThread(zdev_t *dev);
+
+/******************************************************************************
+* P U B L I C D A T A
+*******************************************************************************
+*/
+
+/* Definition of Wireless Extension */
+
+#if WIRELESS_EXT > 12
+#include <net/iw_handler.h>
+#endif
+//wireless extension helper functions
+extern int usbdrv_ioctl_setessid(struct net_device *dev, struct iw_point *erq);
+extern int usbdrv_ioctl_setrts(struct net_device *dev, struct iw_param *rrq);
+/* Wireless Extension Handler functions */
+extern int usbdrvwext_giwname(struct net_device *dev, struct iw_request_info *info,
+ union iwreq_data *wrq, char *extra);
+extern int usbdrvwext_siwfreq(struct net_device *dev, struct iw_request_info *info,
+ struct iw_freq *freq, char *extra);
+extern int usbdrvwext_giwfreq(struct net_device *dev, struct iw_request_info *info,
+ struct iw_freq *freq, char *extra);
+extern int usbdrvwext_siwmode(struct net_device *dev, struct iw_request_info *info,
+ union iwreq_data *wrq, char *extra);
+extern int usbdrvwext_giwmode(struct net_device *dev, struct iw_request_info *info,
+ __u32 *mode, char *extra);
+extern int usbdrvwext_siwsens(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *sens, char *extra);
+extern int usbdrvwext_giwsens(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *sens, char *extra);
+extern int usbdrvwext_giwrange(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *data, char *extra);
+extern int usbdrvwext_siwap(struct net_device *dev, struct iw_request_info *info,
+ struct sockaddr *MacAddr, char *extra);
+extern int usbdrvwext_giwap(struct net_device *dev, struct iw_request_info *info,
+ struct sockaddr *MacAddr, char *extra);
+extern int usbdrvwext_iwaplist(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *data, char *extra);
+extern int usbdrvwext_siwscan(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *data, char *extra);
+extern int usbdrvwext_giwscan(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *data, char *extra);
+extern int usbdrvwext_siwessid(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *essid, char *extra);
+extern int usbdrvwext_giwessid(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *essid, char *extra);
+extern int usbdrvwext_siwnickn(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *data, char *nickname);
+extern int usbdrvwext_giwnickn(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *data, char *nickname);
+extern int usbdrvwext_siwrate(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *frq, char *extra);
+extern int usbdrvwext_giwrate(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *frq, char *extra);
+extern int usbdrvwext_siwrts(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *rts, char *extra);
+extern int usbdrvwext_giwrts(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *rts, char *extra);
+extern int usbdrvwext_siwfrag(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *frag, char *extra);
+extern int usbdrvwext_giwfrag(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *frag, char *extra);
+extern int usbdrvwext_siwtxpow(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *rrq, char *extra);
+extern int usbdrvwext_giwtxpow(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *rrq, char *extra);
+extern int usbdrvwext_siwretry(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *rrq, char *extra);
+extern int usbdrvwext_giwretry(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *rrq, char *extra);
+extern int usbdrvwext_siwencode(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *erq, char *key);
+extern int usbdrvwext_giwencode(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *erq, char *key);
+extern int usbdrvwext_siwpower(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *frq, char *extra);
+extern int usbdrvwext_giwpower(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *frq, char *extra);
+extern int usbdrv_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
+/*
+ * Structures to export the Wireless Handlers
+ */
+
+struct iw_priv_args usbdrv_private_args[] = {
+// { SIOCIWFIRSTPRIV + 0x0, 0, 0, "list_bss" },
+// { SIOCIWFIRSTPRIV + 0x1, 0, 0, "card_reset" },
+ { SIOCIWFIRSTPRIV + 0x2, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_auth" }, /* 0 - open, 1 - shared key */
+ { SIOCIWFIRSTPRIV + 0x3, 0, IW_PRIV_TYPE_CHAR | 12, "get_auth" },
+// { SIOCIWFIRSTPRIV + 0x4, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_preamble" }, /* 0 - long, 1 - short */
+// { SIOCIWFIRSTPRIV + 0x5, 0, IW_PRIV_TYPE_CHAR | 6, "get_preamble" },
+// { SIOCIWFIRSTPRIV + 0x6, 0, 0, "cnt" },
+// { SIOCIWFIRSTPRIV + 0x7, 0, 0, "regs" },
+// { SIOCIWFIRSTPRIV + 0x8, 0, 0, "probe" },
+// { SIOCIWFIRSTPRIV + 0x9, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "dbg_flag" },
+// { SIOCIWFIRSTPRIV + 0xA, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "connect" },
+// { SIOCIWFIRSTPRIV + 0xB, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_mac_mode" },
+// { SIOCIWFIRSTPRIV + 0xC, 0, IW_PRIV_TYPE_CHAR | 12, "get_mac_mode" },
+};
+
+#if WIRELESS_EXT > 12
+static iw_handler usbdrvwext_handler[] = {
+ (iw_handler) NULL, /* SIOCSIWCOMMIT */
+ (iw_handler) usbdrvwext_giwname, /* SIOCGIWNAME */
+ (iw_handler) NULL, /* SIOCSIWNWID */
+ (iw_handler) NULL, /* SIOCGIWNWID */
+ (iw_handler) usbdrvwext_siwfreq, /* SIOCSIWFREQ */
+ (iw_handler) usbdrvwext_giwfreq, /* SIOCGIWFREQ */
+ (iw_handler) usbdrvwext_siwmode, /* SIOCSIWMODE */
+ (iw_handler) usbdrvwext_giwmode, /* SIOCGIWMODE */
+ (iw_handler) usbdrvwext_siwsens, /* SIOCSIWSENS */
+ (iw_handler) usbdrvwext_giwsens, /* SIOCGIWSENS */
+ (iw_handler) NULL, /* not used */ /* SIOCSIWRANGE */
+ (iw_handler) usbdrvwext_giwrange, /* SIOCGIWRANGE */
+ (iw_handler) NULL, /* not used */ /* SIOCSIWPRIV */
+ (iw_handler) NULL, /* kernel code */ /* SIOCGIWPRIV */
+ (iw_handler) NULL, /* not used */ /* SIOCSIWSTATS */
+ (iw_handler) NULL, /* kernel code */ /* SIOCGIWSTATS */
+ (iw_handler) NULL, /* SIOCSIWSPY */
+ (iw_handler) NULL, /* SIOCGIWSPY */
+ (iw_handler) NULL, /* -- hole -- */
+ (iw_handler) NULL, /* -- hole -- */
+ (iw_handler) usbdrvwext_siwap, /* SIOCSIWAP */
+ (iw_handler) usbdrvwext_giwap, /* SIOCGIWAP */
+ (iw_handler) NULL, /* -- hole -- */
+ (iw_handler) usbdrvwext_iwaplist, /* SIOCGIWAPLIST */
+#if WIRELESS_EXT > 13
+ (iw_handler) usbdrvwext_siwscan, /* SIOCSIWSCAN */
+ (iw_handler) usbdrvwext_giwscan, /* SIOCGIWSCAN */
+#else /* WIRELESS_EXT > 13 */
+ (iw_handler) NULL, /* null */ /* SIOCSIWSCAN */
+ (iw_handler) NULL, /* null */ /* SIOCGIWSCAN */
+#endif /* WIRELESS_EXT > 13 */
+ (iw_handler) usbdrvwext_siwessid, /* SIOCSIWESSID */
+ (iw_handler) usbdrvwext_giwessid, /* SIOCGIWESSID */
+
+ (iw_handler) usbdrvwext_siwnickn, /* SIOCSIWNICKN */
+ (iw_handler) usbdrvwext_giwnickn, /* SIOCGIWNICKN */
+ (iw_handler) NULL, /* -- hole -- */
+ (iw_handler) NULL, /* -- hole -- */
+ (iw_handler) usbdrvwext_siwrate, /* SIOCSIWRATE */
+ (iw_handler) usbdrvwext_giwrate, /* SIOCGIWRATE */
+ (iw_handler) usbdrvwext_siwrts, /* SIOCSIWRTS */
+ (iw_handler) usbdrvwext_giwrts, /* SIOCGIWRTS */
+ (iw_handler) usbdrvwext_siwfrag, /* SIOCSIWFRAG */
+ (iw_handler) usbdrvwext_giwfrag, /* SIOCGIWFRAG */
+ (iw_handler) usbdrvwext_siwtxpow, /* SIOCSIWTXPOW */
+ (iw_handler) usbdrvwext_giwtxpow, /* SIOCGIWTXPOW */
+ (iw_handler) usbdrvwext_siwretry, /* SIOCSIWRETRY */
+ (iw_handler) usbdrvwext_giwretry, /* SIOCGIWRETRY */
+ (iw_handler) usbdrvwext_siwencode, /* SIOCSIWENCODE */
+ (iw_handler) usbdrvwext_giwencode, /* SIOCGIWENCODE */
+ (iw_handler) usbdrvwext_siwpower, /* SIOCSIWPOWER */
+ (iw_handler) usbdrvwext_giwpower, /* SIOCGIWPOWER */
+};
+
+static const iw_handler usbdrv_private_handler[] =
+{
+ //(iw_handler) usbdrvwext_setparam, /* SIOCWFIRSTPRIV+0 */
+ //(iw_handler) usbdrvwext_getparam, /* SIOCWFIRSTPRIV+1 */
+ //(iw_handler) usbdrvwext_setkey, /* SIOCWFIRSTPRIV+2 */
+ //(iw_handler) usbdrvwext_setwmmparams, /* SIOCWFIRSTPRIV+3 */
+ //(iw_handler) usbdrvwext_delkey, /* SIOCWFIRSTPRIV+4 */
+ //(iw_handler) usbdrvwext_getwmmparams, /* SIOCWFIRSTPRIV+5 */
+ //(iw_handler) usbdrvwext_setmlme, /* SIOCWFIRSTPRIV+6 */
+ //(iw_handler) usbdrvwext_getchaninfo, /* SIOCWFIRSTPRIV+7 */
+ //(iw_handler) usbdrvwext_setoptie, /* SIOCWFIRSTPRIV+8 */
+ //(iw_handler) usbdrvwext_getoptie, /* SIOCWFIRSTPRIV+9 */
+ //(iw_handler) usbdrvwext_addmac, /* SIOCWFIRSTPRIV+10 */
+ //(iw_handler) usbdrvwext_getscanresults, /* SIOCWFIRSTPRIV+11 */
+ //(iw_handler) usbdrvwext_delmac, /* SIOCWFIRSTPRIV+12 */
+ //(iw_handler) usbdrvwext_getchanlist, /* SIOCWFIRSTPRIV+13 */
+ //(iw_handler) usbdrvwext_setchanlist, /* SIOCWFIRSTPRIV+14 */
+ //(iw_handler) NULL, /* SIOCWFIRSTPRIV+15 */
+ //(iw_handler) usbdrvwext_chanswitch, /* SIOCWFIRSTPRIV+16 */
+ //(iw_handler) usbdrvwext_setmode, /* SIOCWFIRSTPRIV+17 */
+ //(iw_handler) usbdrvwext_getmode, /* SIOCWFIRSTPRIV+18 */
+ NULL, /* SIOCIWFIRSTPRIV */
+};
+
+static struct iw_handler_def p80211wext_handler_def = {
+ .num_standard = sizeof(usbdrvwext_handler) / sizeof(iw_handler),
+ .num_private = sizeof(usbdrv_private_handler)/sizeof(iw_handler),
+ .num_private_args = sizeof(usbdrv_private_args)/sizeof(struct iw_priv_args),
+ .standard = usbdrvwext_handler,
+ .private = (iw_handler *) usbdrv_private_handler,
+ .private_args = (struct iw_priv_args *) usbdrv_private_args
+};
+#endif
+
+/* WDS */
+//struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER];
+//void zfInitWdsStruct(void);
+
+/* VAP */
+struct zsVapStruct vap[ZM_VAP_PORT_NUMBER];
+void zfLnxInitVapStruct(void);
+
+
+/**
+ * usbdrv_intr - interrupt handler
+ * @irq: the IRQ number
+ * @dev_inst: the net_device struct
+ * @regs: registers (unused)
+ *
+ * This routine is the ISR for the usbdrv board. It services
+ * the RX & TX queues & starts the RU if it has stopped due
+ * to no resources.
+ */
+irqreturn_t usbdrv_intr(int irq, void *dev_inst, struct pt_regs *regs)
+{
+ struct net_device *dev;
+ struct usbdrv_private *macp;
+
+ dev = dev_inst;
+ macp = dev->ml_priv;
+
+
+ /* Read register error, card may be unpluged */
+ if (0)//(intr_status == -1)
+ return IRQ_NONE;
+
+ /* the device is closed, don't continue or else bad things may happen. */
+ if (!netif_running(dev)) {
+ return IRQ_NONE;
+ }
+
+ if (macp->driver_isolated) {
+ return IRQ_NONE;
+ }
+
+#if (WLAN_HOSTIF == WLAN_PCI)
+ //zfiIsrPci(dev);
+#endif
+
+ return IRQ_HANDLED;
+}
+
+int usbdrv_open(struct net_device *dev)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ int rc = 0;
+ u16_t size;
+ void* mem;
+ //unsigned char addr[6];
+ struct zsCbFuncTbl cbFuncTbl;
+
+ printk("Enter open()\n");
+
+//#ifndef CONFIG_SMP
+// read_lock(&(macp->isolate_lock));
+//#endif
+ if (macp->driver_isolated) {
+ rc = -EBUSY;
+ goto exit;
+ }
+
+ size = zfiGlobalDataSize(dev);
+ if ((mem = kmalloc(size, GFP_KERNEL)) == NULL)
+ {
+ rc = -EBUSY;
+ goto exit;
+ }
+ macp->wd = mem;
+
+ memset(&cbFuncTbl, 0, sizeof(struct zsCbFuncTbl));
+ cbFuncTbl.zfcbAuthNotify = zfLnxAuthNotify;
+ cbFuncTbl.zfcbAuthNotify = zfLnxAuthNotify;
+ cbFuncTbl.zfcbAsocNotify = zfLnxAsocNotify;
+ cbFuncTbl.zfcbDisAsocNotify = zfLnxDisAsocNotify;
+ cbFuncTbl.zfcbApConnectNotify = zfLnxApConnectNotify;
+ cbFuncTbl.zfcbConnectNotify = zfLnxConnectNotify;
+ cbFuncTbl.zfcbScanNotify = zfLnxScanNotify;
+ cbFuncTbl.zfcbMicFailureNotify = zfLnxMicFailureNotify;
+ cbFuncTbl.zfcbApMicFailureNotify = zfLnxApMicFailureNotify;
+ cbFuncTbl.zfcbIbssPartnerNotify = zfLnxIbssPartnerNotify;
+ cbFuncTbl.zfcbMacAddressNotify = zfLnxMacAddressNotify;
+ cbFuncTbl.zfcbSendCompleteIndication = zfLnxSendCompleteIndication;
+ cbFuncTbl.zfcbRecvEth = zfLnxRecvEth;
+ cbFuncTbl.zfcbRecv80211 = zfLnxRecv80211;
+ cbFuncTbl.zfcbRestoreBufData = zfLnxRestoreBufData;
+#ifdef ZM_ENABLE_CENC
+ cbFuncTbl.zfcbCencAsocNotify = zfLnxCencAsocNotify;
+#endif //ZM_ENABLE_CENC
+ cbFuncTbl.zfcbHwWatchDogNotify = zfLnxWatchDogNotify;
+ zfiWlanOpen(dev, &cbFuncTbl);
+
+#if 0
+ {
+ //u16_t mac[3] = {0x1300, 0xb6d4, 0x5aaf};
+ u16_t mac[3] = {0x8000, 0x00ab, 0x0000};
+ //zfiWlanSetMacAddress(dev, mac);
+ }
+ /* MAC address */
+ zfiWlanQueryMacAddress(dev, addr);
+ dev->dev_addr[0] = addr[0];
+ dev->dev_addr[1] = addr[1];
+ dev->dev_addr[2] = addr[2];
+ dev->dev_addr[3] = addr[3];
+ dev->dev_addr[4] = addr[4];
+ dev->dev_addr[5] = addr[5];
+#endif
+ //zfwMacAddressNotify() will be called to setup dev->dev_addr[]
+
+ zfLnxCreateThread(dev);
+
+ mod_timer(&(macp->hbTimer10ms), jiffies + (1*HZ)/100); //10 ms
+
+ netif_carrier_on(dev);
+
+ netif_start_queue(dev);
+
+#if ZM_AP_MODE == 1
+ zfiWlanSetWlanMode(dev, ZM_MODE_AP);
+ zfiWlanSetBasicRate(dev, 0xf, 0, 0);
+ zfiWlanSetSSID(dev, "OTUS_CWY", 8);
+ zfiWlanSetDtimCount(dev, 3);
+
+ #if ZM_WEP_MOME == 1
+ {
+ u8_t key[16] = {0x12, 0x34, 0x56, 0x78, 0x90};
+ struct zsKeyInfo keyInfo;
+
+ keyInfo.keyLength = 5;
+ keyInfo.keyIndex = 0;
+ keyInfo.flag = 0;
+ keyInfo.key = key;
+ zfiWlanSetKey(dev, keyInfo);
+
+ zfiWlanSetEncryMode(dev, ZM_WEP64);
+ }
+
+ #if ZM_SHARE_AUTH == 1
+ zfiWlanSetAuthenticationMode(dev, 1);
+ #endif //#if ZM_SHARE_AUTH == 1
+ #endif //#if ZM_WEP_MOME == 1
+
+#elif ZM_PIBSS_MODE == 1
+ zfiWlanSetWlanMode(dev, ZM_MODE_PSEUDO);
+#else
+ zfiWlanSetWlanMode(dev, ZM_MODE_INFRASTRUCTURE);
+#endif
+ //zfiWlanSetChannel(dev, ZM_CHANNEL, FALSE);
+ zfiWlanSetFrequency(dev, 2462000, FALSE);
+ zfiWlanSetRtsThreshold(dev, 32767);
+ zfiWlanSetFragThreshold(dev, 0);
+
+ zfiWlanEnable(dev);
+
+#ifdef ZM_ENABLE_CENC
+ macp->netlink_sk = netlink_kernel_create(NETLINK_USERSOCK, 1, NULL, THIS_MODULE);
+
+ if (macp->netlink_sk == NULL)
+ {
+ printk(KERN_ERR "Can't create NETLINK socket\n");
+ }
+#endif
+
+ macp->DeviceOpened = 1;
+exit:
+//#ifndef CONFIG_SMP
+// read_unlock(&(macp->isolate_lock));
+//#endif
+ //zfRegisterWdsDev(dev, 0);
+ //zfLnxRegisterVapDev(dev, 0);
+
+ return rc;
+}
+
+
+
+
+/**
+ * usbdrv_get_stats - get driver statistics
+ * @dev: adapter's net_device struct
+ *
+ * This routine is called when the OS wants the adapter's stats returned.
+ * It returns the address of the net_device_stats stucture for the device.
+ * If the statistics are currently being updated, then they might be incorrect
+ * for a short while. However, since this cannot actually cause damage, no
+ * locking is used.
+ */
+
+struct net_device_stats * usbdrv_get_stats(struct net_device *dev)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ macp->drv_stats.net_stats.tx_errors =
+ macp->drv_stats.net_stats.tx_carrier_errors +
+ macp->drv_stats.net_stats.tx_aborted_errors;
+
+ macp->drv_stats.net_stats.rx_errors =
+ macp->drv_stats.net_stats.rx_crc_errors +
+ macp->drv_stats.net_stats.rx_frame_errors +
+ macp->drv_stats.net_stats.rx_length_errors;
+
+
+ return &(macp->drv_stats.net_stats);
+}
+
+
+/**
+ * usbdrv_set_mac - set the MAC address
+ * @dev: adapter's net_device struct
+ * @addr: the new address
+ *
+ * This routine sets the ethernet address of the board
+ * Returns:
+ * 0 - if successful
+ * -1 - otherwise
+ */
+
+int usbdrv_set_mac(struct net_device *dev, void *addr)
+{
+ struct usbdrv_private *macp;
+ int rc = -1;
+
+ macp = dev->ml_priv;
+ read_lock(&(macp->isolate_lock));
+
+ if (macp->driver_isolated) {
+ goto exit;
+ }
+
+ rc = 0;
+
+
+exit:
+ read_unlock(&(macp->isolate_lock));
+ return rc;
+}
+
+
+
+void
+usbdrv_isolate_driver(struct usbdrv_private *macp)
+{
+#ifndef CONFIG_SMP
+ write_lock_irq(&(macp->isolate_lock));
+#endif
+ macp->driver_isolated = TRUE;
+#ifndef CONFIG_SMP
+ write_unlock_irq(&(macp->isolate_lock));
+#endif
+
+ if (netif_running(macp->device))
+ {
+ netif_carrier_off(macp->device);
+ netif_stop_queue(macp->device);
+ }
+}
+
+#define VLAN_SIZE 4
+int usbdrv_change_mtu(struct net_device *dev, int new_mtu)
+{
+ if ((new_mtu < 68) || (new_mtu > (ETH_DATA_LEN + VLAN_SIZE)))
+ return -EINVAL;
+
+ dev->mtu = new_mtu;
+ return 0;
+}
+
+void zfLnxUnlinkAllUrbs(struct usbdrv_private *macp);
+
+int usbdrv_close(struct net_device *dev)
+{
+extern void zfHpLedCtrl(struct net_device *dev, u16_t ledId, u8_t mode);
+
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ printk(KERN_DEBUG "usbdrv_close\n");
+
+ netif_carrier_off(macp->device);
+
+ del_timer_sync(&macp->hbTimer10ms);
+
+ printk(KERN_DEBUG "usbdrv_netif_carrier_off\n");
+
+ usbdrv_isolate_driver(macp);
+
+ printk(KERN_DEBUG "usbdrv_isolate_driver\n");
+
+ netif_carrier_off(macp->device);
+#ifdef ZM_ENABLE_CENC
+ /* CENC */
+ if (macp->netlink_sk != NULL)
+ {
+ // sock_release(macp->netlink_sk);
+ printk(KERN_ERR "usbdrv close netlink socket\n");
+ }
+#endif //ZM_ENABLE_CENC
+#if (WLAN_HOSTIF == WLAN_PCI)
+ //free_irq(dev->irq, dev);
+#endif
+
+ /* Turn off LED */
+ zfHpLedCtrl(dev, 0, 0);
+ zfHpLedCtrl(dev, 1, 0);
+
+ /* Delay for a while */
+ mdelay(10);
+
+ /* clear WPA/RSN IE */
+ macp->supIe[1] = 0;
+
+ /* set the isolate flag to false, so usbdrv_open can be called */
+ macp->driver_isolated = FALSE;
+
+ zfiWlanClose(dev);
+ kfree(macp->wd);
+
+ zfLnxUnlinkAllUrbs(macp);
+
+ return 0;
+}
+
+
+
+
+int usbdrv_xmit_frame(struct sk_buff *skb, struct net_device *dev)
+{
+ int notify_stop = FALSE;
+ struct usbdrv_private *macp = dev->ml_priv;
+
+#if 0
+ /* Test code */
+ {
+ struct sk_buff* s;
+
+ s = skb_copy_expand(skb, 8, 0, GFP_ATOMIC);
+ skb_push(s, 8);
+ s->data[0] = 'z';
+ s->data[1] = 'y';
+ s->data[2] = 'd';
+ s->data[3] = 'a';
+ s->data[4] = 's';
+ printk("len1=%d, len2=%d", skb->len, s->len);
+ netlink_broadcast(rtnl, s, 0, RTMGRP_LINK, GFP_ATOMIC);
+ }
+#endif
+
+#if ZM_DISABLE_XMIT
+ dev_kfree_skb_irq(skb);
+#else
+ zfiTxSendEth(dev, skb, 0);
+#endif
+ macp->drv_stats.net_stats.tx_bytes += skb->len;
+ macp->drv_stats.net_stats.tx_packets++;
+
+ //dev_kfree_skb_irq(skb);
+
+ if (notify_stop) {
+ netif_carrier_off(dev);
+ netif_stop_queue(dev);
+ }
+
+ return 0;
+}
+
+
+
+
+void usbdrv_set_multi(struct net_device *dev)
+{
+
+
+ if (!(dev->flags & IFF_UP))
+ return;
+
+ return;
+
+}
+
+
+
+/**
+ * usbdrv_clear_structs - free resources
+
+ * @dev: adapter's net_device struct
+ *
+ * Free all device specific structs, unmap i/o address, etc.
+ */
+void usbdrv_clear_structs(struct net_device *dev)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+
+
+#if (WLAN_HOSTIF == WLAN_PCI)
+ iounmap(macp->regp);
+
+ pci_release_regions(macp->pdev);
+ pci_disable_device(macp->pdev);
+ pci_set_drvdata(macp->pdev, NULL);
+#endif
+
+ kfree(macp);
+
+ kfree(dev);
+
+}
+
+void usbdrv_remove1(struct pci_dev *pcid)
+{
+ struct net_device *dev;
+ struct usbdrv_private *macp;
+
+ if (!(dev = (struct net_device *) pci_get_drvdata(pcid)))
+ return;
+
+ macp = dev->ml_priv;
+ unregister_netdev(dev);
+
+ usbdrv_clear_structs(dev);
+}
+
+
+void zfLnx10msTimer(struct net_device* dev)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ mod_timer(&(macp->hbTimer10ms), jiffies + (1*HZ)/100); //10 ms
+ zfiHeartBeat(dev);
+ return;
+}
+
+void zfLnxInitVapStruct(void)
+{
+ u16_t i;
+
+ for (i=0; i<ZM_VAP_PORT_NUMBER; i++)
+ {
+ vap[i].dev = NULL;
+ vap[i].openFlag = 0;
+ }
+}
+
+int zfLnxVapOpen(struct net_device *dev)
+{
+ u16_t vapId;
+
+ vapId = zfLnxGetVapId(dev);
+
+ if (vap[vapId].openFlag == 0)
+ {
+ vap[vapId].openFlag = 1;
+ printk("zfLnxVapOpen : device name=%s, vap ID=%d\n", dev->name, vapId);
+ zfiWlanSetSSID(dev, "vap1", 4);
+ zfiWlanEnable(dev);
+ netif_start_queue(dev);
+ }
+ else
+ {
+ printk("VAP opened error : vap ID=%d\n", vapId);
+ }
+ return 0;
+}
+
+int zfLnxVapClose(struct net_device *dev)
+{
+ u16_t vapId;
+
+ vapId = zfLnxGetVapId(dev);
+
+ if (vapId != 0xffff)
+ {
+ if (vap[vapId].openFlag == 1)
+ {
+ printk("zfLnxVapClose: device name=%s, vap ID=%d\n", dev->name, vapId);
+
+ netif_stop_queue(dev);
+ vap[vapId].openFlag = 0;
+ }
+ else
+ {
+ printk("VAP port was not opened : vap ID=%d\n", vapId);
+ }
+ }
+ return 0;
+}
+
+int zfLnxVapXmitFrame(struct sk_buff *skb, struct net_device *dev)
+{
+ int notify_stop = FALSE;
+ struct usbdrv_private *macp = dev->ml_priv;
+ u16_t vapId;
+
+ vapId = zfLnxGetVapId(dev);
+ //printk("zfLnxVapXmitFrame: vap ID=%d\n", vapId);
+ //printk("zfLnxVapXmitFrame(), skb=%lxh\n", (u32_t)skb);
+
+ if (vapId >= ZM_VAP_PORT_NUMBER)
+ {
+ dev_kfree_skb_irq(skb);
+ return 0;
+ }
+#if 1
+ if (vap[vapId].openFlag == 0)
+ {
+ dev_kfree_skb_irq(skb);
+ return 0;
+ }
+#endif
+
+
+ zfiTxSendEth(dev, skb, 0x1);
+
+ macp->drv_stats.net_stats.tx_bytes += skb->len;
+ macp->drv_stats.net_stats.tx_packets++;
+
+ //dev_kfree_skb_irq(skb);
+
+ if (notify_stop) {
+ netif_carrier_off(dev);
+ netif_stop_queue(dev);
+ }
+
+ return 0;
+}
+
+int zfLnxRegisterVapDev(struct net_device* parentDev, u16_t vapId)
+{
+ /* Allocate net device structure */
+ vap[vapId].dev = alloc_etherdev(0);
+ printk("Register vap dev=%x\n", (u32_t)vap[vapId].dev);
+
+ if(vap[vapId].dev == NULL) {
+ printk("alloc_etherdev fail\n");
+ return -ENOMEM;
+ }
+
+ /* Setup the default settings */
+ ether_setup(vap[vapId].dev);
+
+ /* MAC address */
+ memcpy(vap[vapId].dev->dev_addr, parentDev->dev_addr, ETH_ALEN);
+
+ vap[vapId].dev->irq = parentDev->irq;
+ vap[vapId].dev->base_addr = parentDev->base_addr;
+ vap[vapId].dev->mem_start = parentDev->mem_start;
+ vap[vapId].dev->mem_end = parentDev->mem_end;
+ vap[vapId].dev->ml_priv = parentDev->ml_priv;
+
+ //dev->hard_start_xmit = &zd1212_wds_xmit_frame;
+ vap[vapId].dev->hard_start_xmit = &zfLnxVapXmitFrame;
+ vap[vapId].dev->open = &zfLnxVapOpen;
+ vap[vapId].dev->stop = &zfLnxVapClose;
+ vap[vapId].dev->get_stats = &usbdrv_get_stats;
+ vap[vapId].dev->change_mtu = &usbdrv_change_mtu;
+#ifdef ZM_HOSTAPD_SUPPORT
+ vap[vapId].dev->do_ioctl = usbdrv_ioctl;
+#else
+ vap[vapId].dev->do_ioctl = NULL;
+#endif
+ vap[vapId].dev->destructor = free_netdev;
+
+ vap[vapId].dev->tx_queue_len = 0;
+
+ vap[vapId].dev->dev_addr[0] = parentDev->dev_addr[0];
+ vap[vapId].dev->dev_addr[1] = parentDev->dev_addr[1];
+ vap[vapId].dev->dev_addr[2] = parentDev->dev_addr[2];
+ vap[vapId].dev->dev_addr[3] = parentDev->dev_addr[3];
+ vap[vapId].dev->dev_addr[4] = parentDev->dev_addr[4];
+ vap[vapId].dev->dev_addr[5] = parentDev->dev_addr[5] + (vapId+1);
+
+ /* Stop the network queue first */
+ netif_stop_queue(vap[vapId].dev);
+
+ sprintf(vap[vapId].dev->name, "vap%d", vapId);
+ printk("Register VAP dev success : %s\n", vap[vapId].dev->name);
+
+ if(register_netdevice(vap[vapId].dev) != 0) {
+ printk("register VAP device fail\n");
+ vap[vapId].dev = NULL;
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+int zfLnxUnregisterVapDev(struct net_device* parentDev, u16_t vapId)
+{
+ int ret = 0;
+
+ printk("Unregister VAP dev : %s\n", vap[vapId].dev->name);
+
+ if(vap[vapId].dev != NULL) {
+ printk("Unregister vap dev=%x\n", (u32_t)vap[vapId].dev);
+ //
+ //unregister_netdevice(wds[wdsId].dev);
+ unregister_netdev(vap[vapId].dev);
+
+ printk("VAP unregister_netdevice\n");
+ vap[vapId].dev = NULL;
+ }
+ else {
+ printk("unregister VAP device: %d fail\n", vapId);
+ ret = -EINVAL;
+ }
+
+ return ret;
+}
+
+
+
+# define SUBMIT_URB(u,f) usb_submit_urb(u,f)
+# define USB_ALLOC_URB(u,f) usb_alloc_urb(u,f)
+
+//extern void zfiWlanQueryMacAddress(zdev_t* dev, u8_t* addr);
+
+extern int usbdrv_open(struct net_device *dev);
+extern int usbdrv_close(struct net_device *dev);
+extern int usbdrv_xmit_frame(struct sk_buff *skb, struct net_device *dev);
+extern int usbdrv_xmit_frame(struct sk_buff *skb, struct net_device *dev);
+extern int usbdrv_change_mtu(struct net_device *dev, int new_mtu);
+extern void usbdrv_set_multi(struct net_device *dev);
+extern int usbdrv_set_mac(struct net_device *dev, void *addr);
+extern struct net_device_stats * usbdrv_get_stats(struct net_device *dev);
+extern int usbdrv_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
+extern UsbTxQ_t *zfLnxGetUsbTxBuffer(struct net_device *dev);
+
+int zfLnxAllocAllUrbs(struct usbdrv_private *macp)
+{
+ struct usb_interface *interface = macp->interface;
+ struct usb_host_interface *iface_desc = &interface->altsetting[0];
+
+ struct usb_endpoint_descriptor *endpoint;
+ int i;
+
+ /* descriptor matches, let's find the endpoints needed */
+ /* check out the endpoints */
+ for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i)
+ {
+ endpoint = &iface_desc->endpoint[i].desc;
+ if ((endpoint->bEndpointAddress & 0x80) &&
+ ((endpoint->bmAttributes & 3) == 0x02))
+ {
+ /* we found a bulk in endpoint */
+ printk(KERN_ERR "bulk in: wMaxPacketSize = %x\n", le16_to_cpu(endpoint->wMaxPacketSize));
+ }
+
+ if (((endpoint->bEndpointAddress & 0x80) == 0x00) &&
+ ((endpoint->bmAttributes & 3) == 0x02))
+ {
+ /* we found a bulk out endpoint */
+ printk(KERN_ERR "bulk out: wMaxPacketSize = %x\n", le16_to_cpu(endpoint->wMaxPacketSize));
+ }
+
+ if ((endpoint->bEndpointAddress & 0x80) &&
+ ((endpoint->bmAttributes & 3) == 0x03))
+ {
+ /* we found a interrupt in endpoint */
+ printk(KERN_ERR "interrupt in: wMaxPacketSize = %x\n", le16_to_cpu(endpoint->wMaxPacketSize));
+ printk(KERN_ERR "interrupt in: int_interval = %d\n", endpoint->bInterval);
+ }
+
+ if (((endpoint->bEndpointAddress & 0x80) == 0x00) &&
+ ((endpoint->bmAttributes & 3) == 0x03))
+ {
+ /* we found a interrupt out endpoint */
+ printk(KERN_ERR "interrupt out: wMaxPacketSize = %x\n", le16_to_cpu(endpoint->wMaxPacketSize));
+ printk(KERN_ERR "interrupt out: int_interval = %d\n", endpoint->bInterval);
+ }
+ }
+
+ /* Allocate all Tx URBs */
+ for (i = 0; i < ZM_MAX_TX_URB_NUM; i++)
+ {
+ macp->WlanTxDataUrb[i] = USB_ALLOC_URB(0, GFP_KERNEL);
+
+ if (macp->WlanTxDataUrb[i] == 0)
+ {
+ int j;
+
+ /* Free all urbs */
+ for (j = 0; j < i; j++)
+ {
+ usb_free_urb(macp->WlanTxDataUrb[j]);
+ }
+
+ return 0;
+ }
+ }
+
+ /* Allocate all Rx URBs */
+ for (i = 0; i < ZM_MAX_RX_URB_NUM; i++)
+ {
+ macp->WlanRxDataUrb[i] = USB_ALLOC_URB(0, GFP_KERNEL);
+
+ if (macp->WlanRxDataUrb[i] == 0)
+ {
+ int j;
+
+ /* Free all urbs */
+ for (j = 0; j < i; j++)
+ {
+ usb_free_urb(macp->WlanRxDataUrb[j]);
+ }
+
+ for (j = 0; j < ZM_MAX_TX_URB_NUM; j++)
+ {
+ usb_free_urb(macp->WlanTxDataUrb[j]);
+ }
+
+ return 0;
+ }
+ }
+
+ /* Allocate Register Read/Write USB */
+ macp->RegOutUrb = USB_ALLOC_URB(0, GFP_KERNEL);
+ macp->RegInUrb = USB_ALLOC_URB(0, GFP_KERNEL);
+
+ return 1;
+}
+
+void zfLnxFreeAllUrbs(struct usbdrv_private *macp)
+{
+ int i;
+
+ /* Free all Tx URBs */
+ for (i = 0; i < ZM_MAX_TX_URB_NUM; i++)
+ {
+ if (macp->WlanTxDataUrb[i] != NULL)
+ {
+ usb_free_urb(macp->WlanTxDataUrb[i]);
+ }
+ }
+
+ /* Free all Rx URBs */
+ for (i = 0; i < ZM_MAX_RX_URB_NUM; i++)
+ {
+ if (macp->WlanRxDataUrb[i] != NULL)
+ {
+ usb_free_urb(macp->WlanRxDataUrb[i]);
+ }
+ }
+
+ /* Free USB Register Read/Write URB */
+ usb_free_urb(macp->RegOutUrb);
+ usb_free_urb(macp->RegInUrb);
+}
+
+void zfLnxUnlinkAllUrbs(struct usbdrv_private *macp)
+{
+ int i;
+
+ /* Unlink all Tx URBs */
+ for (i = 0; i < ZM_MAX_TX_URB_NUM; i++)
+ {
+ if (macp->WlanTxDataUrb[i] != NULL)
+ {
+ usb_unlink_urb(macp->WlanTxDataUrb[i]);
+ }
+ }
+
+ /* Unlink all Rx URBs */
+ for (i = 0; i < ZM_MAX_RX_URB_NUM; i++)
+ {
+ if (macp->WlanRxDataUrb[i] != NULL)
+ {
+ usb_unlink_urb(macp->WlanRxDataUrb[i]);
+ }
+ }
+
+ /* Unlink USB Register Read/Write URB */
+ usb_unlink_urb(macp->RegOutUrb);
+
+ usb_unlink_urb(macp->RegInUrb);
+}
+
+u8_t zfLnxInitSetup(struct net_device *dev, struct usbdrv_private *macp)
+{
+ //unsigned char addr[6];
+
+ //init_MUTEX(&macp->ps_sem);
+ //init_MUTEX(&macp->reg_sem);
+ //init_MUTEX(&macp->bcn_sem);
+ //init_MUTEX(&macp->config_sem);
+
+ spin_lock_init(&(macp->cs_lock));
+#if 0
+ /* MAC address */
+ zfiWlanQueryMacAddress(dev, addr);
+ dev->dev_addr[0] = addr[0];
+ dev->dev_addr[1] = addr[1];
+ dev->dev_addr[2] = addr[2];
+ dev->dev_addr[3] = addr[3];
+ dev->dev_addr[4] = addr[4];
+ dev->dev_addr[5] = addr[5];
+#endif
+#if WIRELESS_EXT > 12
+ dev->wireless_handlers = (struct iw_handler_def *)&p80211wext_handler_def;
+#endif
+
+ dev->open = usbdrv_open;
+ dev->hard_start_xmit = usbdrv_xmit_frame;
+ dev->stop = usbdrv_close;
+ dev->change_mtu = &usbdrv_change_mtu;
+ dev->get_stats = usbdrv_get_stats;
+ dev->set_multicast_list = usbdrv_set_multi;
+ dev->set_mac_address = usbdrv_set_mac;
+ dev->do_ioctl = usbdrv_ioctl;
+
+ dev->flags |= IFF_MULTICAST;
+
+ dev->dev_addr[0] = 0x00;
+ dev->dev_addr[1] = 0x03;
+ dev->dev_addr[2] = 0x7f;
+ dev->dev_addr[3] = 0x11;
+ dev->dev_addr[4] = 0x22;
+ dev->dev_addr[5] = 0x33;
+
+ /* Initialize Heart Beat timer */
+ init_timer(&macp->hbTimer10ms);
+ macp->hbTimer10ms.data = (unsigned long)dev;
+ macp->hbTimer10ms.function = (void *)&zfLnx10msTimer;
+
+ /* Initialize WDS and VAP data structure */
+ //zfInitWdsStruct();
+ zfLnxInitVapStruct();
+
+ return 1;
+}
+
+u8_t zfLnxClearStructs(struct net_device *dev)
+{
+ u16_t ii;
+ u16_t TxQCnt;
+
+ TxQCnt = zfLnxCheckTxBufferCnt(dev);
+
+ printk(KERN_ERR "TxQCnt: %d\n", TxQCnt);
+
+ for(ii = 0; ii < TxQCnt; ii++)
+ {
+ UsbTxQ_t *TxQ = zfLnxGetUsbTxBuffer(dev);
+
+ printk(KERN_ERR "dev_kfree_skb_any\n");
+ /* Free buffer */
+ dev_kfree_skb_any(TxQ->buf);
+ }
+
+ return 0;
+}
diff --git a/drivers/staging/otus/usbdrv.h b/drivers/staging/otus/usbdrv.h
new file mode 100644
index 00000000000..a11b3b36a90
--- /dev/null
+++ b/drivers/staging/otus/usbdrv.h
@@ -0,0 +1,252 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : usbdrv.h */
+/* */
+/* Abstract */
+/* This module contains network interface up/down related definition*/
+/* */
+/* NOTES */
+/* Platform dependent. */
+/* */
+/************************************************************************/
+
+#ifndef _USBDRV_H
+#define _USBDRV_H
+
+#define WLAN_USB 0
+#define WLAN_PCI 1
+
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/skbuff.h>
+#include <linux/uaccess.h>
+#include <linux/wireless.h>
+#include <linux/if_arp.h>
+#include <linux/io.h>
+
+#include "zdcompat.h"
+
+#include "oal_dt.h"
+#include "oal_marc.h"
+#include "80211core/pub_zfi.h"
+//#include "pub_zfw.h"
+#include "80211core/pub_usb.h"
+
+#include <linux/usb.h>
+/* Please include header files for device type in the beginning of this file */
+#define urb_t struct urb
+
+#define usb_complete_t usb_complete_t
+#define pipe_t u32_t
+
+/* USB Endpoint definition */
+#define USB_WLAN_TX_PIPE 1
+#define USB_WLAN_RX_PIPE 2
+#define USB_REG_IN_PIPE 3
+#define USB_REG_OUT_PIPE 4
+
+#if (WLAN_HOSTIF == WLAN_USB)
+#include <linux/usb.h>
+#endif
+
+#ifdef ZM_HOSTAPD_SUPPORT
+#include "athr_common.h"
+#endif
+
+/**************************************************************************
+** Descriptor Data Structure
+***************************************************************************/
+struct driver_stats {
+ struct net_device_stats net_stats;
+};
+
+#define ZM_MAX_RX_BUFFER_SIZE 8192
+
+#if ZM_USB_TX_STREAM_MODE == 1
+#define ZM_MAX_TX_AGGREGATE_NUM 4
+#define ZM_USB_TX_BUF_SIZE 8096
+#define ZM_MAX_TX_URB_NUM 4
+#else
+#define ZM_USB_TX_BUF_SIZE 2048
+#define ZM_MAX_TX_URB_NUM 8
+#endif
+#define ZM_USB_REG_MAX_BUF_SIZE 64
+#define ZM_MAX_RX_URB_NUM 16
+#define ZM_MAX_TX_BUF_NUM 128
+
+typedef struct UsbTxQ
+{
+ zbuf_t *buf;
+ u8_t hdr[80];
+ u16_t hdrlen;
+ u8_t snap[8];
+ u16_t snapLen;
+ u8_t tail[16];
+ u16_t tailLen;
+ u16_t offset;
+} UsbTxQ_t;
+
+
+struct zdap_ioctl {
+ u16_t cmd; /* Command to run */
+ u32_t addr; /* Length of the data buffer */
+ u32_t value; /* Pointer to the data buffer */
+ u8_t data[0x100];
+};
+
+#define ZM_OAL_MAX_STA_SUPPORT 16
+
+struct usbdrv_private
+{
+ //linux used
+ struct net_device *device;
+#if (WLAN_HOSTIF == WLAN_PCI)
+ struct pci_dev *pdev;
+#endif
+#if (WLAN_HOSTIF == WLAN_USB)
+ struct usb_device *udev;
+ struct usb_interface *interface;
+#endif
+ struct driver_stats drv_stats;
+ char ifname[IFNAMSIZ];
+ int using_dac;
+ u8_t rev_id; /* adapter PCI revision ID */
+ rwlock_t isolate_lock;
+ spinlock_t cs_lock;
+ int driver_isolated;
+#if (WLAN_HOSTIF == WLAN_PCI)
+ void *regp;
+#endif
+
+ /* timer for heart beat */
+ struct timer_list hbTimer10ms;
+
+ /* For driver core */
+ void* wd;
+
+#if (WLAN_HOSTIF == WLAN_USB)
+ u8_t txUsbBuf[ZM_MAX_TX_URB_NUM][ZM_USB_TX_BUF_SIZE];
+ u8_t regUsbReadBuf[ZM_USB_REG_MAX_BUF_SIZE];
+ u8_t regUsbWriteBuf[ZM_USB_REG_MAX_BUF_SIZE];
+ urb_t *WlanTxDataUrb[ZM_MAX_TX_URB_NUM];
+ urb_t *WlanRxDataUrb[ZM_MAX_RX_URB_NUM];
+ urb_t *RegOutUrb;
+ urb_t *RegInUrb;
+ UsbTxQ_t UsbTxBufQ[ZM_MAX_TX_BUF_NUM];
+ zbuf_t *UsbRxBufQ[ZM_MAX_RX_URB_NUM];
+ u16_t TxBufHead;
+ u16_t TxBufTail;
+ u16_t TxBufCnt;
+ u16_t TxUrbHead;
+ u16_t TxUrbTail;
+ u16_t TxUrbCnt;
+ u16_t RxBufHead;
+ u16_t RxBufTail;
+ u16_t RxBufCnt;
+#endif
+
+#if ZM_USB_STREAM_MODE == 1
+ zbuf_t *reamin_buf;
+#endif
+
+#ifdef ZM_HOSTAPD_SUPPORT
+ struct athr_wlan_param athr_wpa_req;
+#endif
+ struct sock *netlink_sk;
+ u8_t DeviceOpened; //CWYang(+)
+ u8_t supIe[50];
+ u8_t supLen;
+ struct ieee80211req_wpaie stawpaie[ZM_OAL_MAX_STA_SUPPORT];
+ u8_t forwardMgmt;
+
+ struct zfCbUsbFuncTbl usbCbFunctions;
+
+ /* For keventd */
+ u32_t flags;
+ unsigned long kevent_flags;
+ u16_t kevent_ready;
+
+ struct semaphore ioctl_sem;
+ struct work_struct kevent;
+ wait_queue_head_t wait_queue_event;
+#ifdef ZM_HALPLUS_LOCK
+ unsigned long hal_irqFlag;
+#endif
+ u16_t adapterState;
+};
+
+/* WDS */
+#define ZM_WDS_PORT_NUMBER 6
+
+struct zsWdsStruct
+{
+ struct net_device* dev;
+ u16_t openFlag;
+};
+
+/* VAP */
+#define ZM_VAP_PORT_NUMBER 7
+
+struct zsVapStruct
+{
+ struct net_device* dev;
+ u16_t openFlag;
+};
+
+/***************************************/
+
+#define ZM_IOCTL_REG_READ 0x01
+#define ZM_IOCTL_REG_WRITE 0x02
+#define ZM_IOCTL_MEM_DUMP 0x03
+#define ZM_IOCTL_REG_DUMP 0x05
+#define ZM_IOCTL_TXD_DUMP 0x06
+#define ZM_IOCTL_RXD_DUMP 0x07
+#define ZM_IOCTL_MEM_READ 0x0B
+#define ZM_IOCTL_MEM_WRITE 0x0C
+#define ZM_IOCTL_DMA_TEST 0x10
+#define ZM_IOCTL_REG_TEST 0x11
+#define ZM_IOCTL_TEST 0x80
+#define ZM_IOCTL_TALLY 0x81 //CWYang(+)
+#define ZM_IOCTL_RTS 0xA0
+#define ZM_IOCTL_MIX_MODE 0xA1
+#define ZM_IOCTL_FRAG 0xA2
+#define ZM_IOCTL_SCAN 0xA3
+#define ZM_IOCTL_KEY 0xA4
+#define ZM_IOCTL_RATE 0xA5
+#define ZM_IOCTL_ENCRYPTION_MODE 0xA6
+#define ZM_IOCTL_GET_TXCNT 0xA7
+#define ZM_IOCTL_GET_DEAGG_CNT 0xA8
+#define ZM_IOCTL_DURATION_MODE 0xA9
+#define ZM_IOCTL_SET_AES_KEY 0xAA
+#define ZM_IOCTL_SET_AES_MODE 0xAB
+#define ZM_IOCTL_SIGNAL_STRENGTH 0xAC //CWYang(+)
+#define ZM_IOCTL_SIGNAL_QUALITY 0xAD //CWYang(+)
+#define ZM_IOCTL_SET_PIBSS_MODE 0xAE
+
+#define ZDAPIOCTL SIOCDEVPRIVATE
+
+enum devState {
+ Opened,
+ Enabled,
+ Disabled,
+ Closed
+};
+
+#endif /* _USBDRV_H */
+
diff --git a/drivers/staging/otus/wrap_buf.c b/drivers/staging/otus/wrap_buf.c
new file mode 100644
index 00000000000..62496a0f8e3
--- /dev/null
+++ b/drivers/staging/otus/wrap_buf.c
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : wrap_buf.c */
+/* */
+/* Abstract */
+/* This module contains wrapper functions for buffer management */
+/* */
+/* NOTES */
+/* Platform dependent. */
+/* */
+/************************************************************************/
+
+#include "oal_dt.h"
+#include "usbdrv.h"
+
+
+#include <linux/netlink.h>
+
+#if WIRELESS_EXT > 12
+#include <net/iw_handler.h>
+#endif
+
+
+
+/* Called to allocate buffer, must return a continue buffer space */
+zbuf_t* zfwBufAllocate(zdev_t* dev, u16_t len)
+{
+ zbuf_t* buf;
+
+ /* Allocate SKB for packet*/
+ buf = dev_alloc_skb(len);
+
+ return buf;
+}
+
+
+/* Called to free buffer, replace below 3 functions */
+void zfwBufFree(zdev_t* dev, zbuf_t* buf, u16_t status)
+{
+ dev_kfree_skb_any(buf);
+}
+
+/* Called to adjust buffer size and head pointer */
+u16_t zfwBufRemoveHead(zdev_t* dev, zbuf_t* buf, u16_t size)
+{
+ //zm_assert(buf->len > size);
+
+ buf->data += size;
+ buf->len -= size;
+ return 0;
+}
+
+
+
+
+/* return tail if head==NULL, called to chain multiple buffer together */
+/* Used to chain Rx buffer to form a frame. if the prepared Rx buffer */
+/* is greater than an ethernet frame(1518+32 byte), then this function */
+/* will only be called with head=NULL. */
+u16_t zfwBufChain(zdev_t* dev, zbuf_t** head, zbuf_t* tail)
+{
+
+ *head = tail;
+ return 0;
+}
+
+
+/* Called when doing infra-bss forwarding */
+u16_t zfwBufCopy(zdev_t* dev, zbuf_t* dst, zbuf_t* src)
+{
+ memcpy(dst->data, src->data, src->len);
+ dst->tail = dst->data;
+ skb_put(dst, src->len);
+ return 0;
+}
+
+
+/* Called to adjust buffer size and tail pointer */
+u16_t zfwBufSetSize(zdev_t* dev, zbuf_t* buf, u16_t size)
+{
+#ifdef NET_SKBUFF_DATA_USES_OFFSET
+ buf->tail = 0;
+ buf->len = 0;
+#else
+ buf->tail = buf->data;
+ buf->len = 0;
+#endif
+
+ skb_put(buf, size);
+ return 0;
+}
+
+u16_t zfwBufGetSize(zdev_t* dev, zbuf_t* buf)
+{
+ return buf->len;
+}
+
+void zfwCopyBufContext(zdev_t* dev, zbuf_t* source, zbuf_t* dst)
+{
+}
diff --git a/drivers/staging/otus/wrap_dbg.c b/drivers/staging/otus/wrap_dbg.c
new file mode 100644
index 00000000000..53763d9d2d8
--- /dev/null
+++ b/drivers/staging/otus/wrap_dbg.c
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* Module Name : wrap_dbg.c */
+/* */
+/* Abstract */
+/* This module contains wrapper functions for debug functions */
+/* */
+/* NOTES */
+/* Platform dependent. */
+/* */
+/************************************************************************/
+
+#include "oal_dt.h"
+#include "usbdrv.h"
+
+#include <linux/netlink.h>
+
+#if WIRELESS_EXT > 12
+#include <net/iw_handler.h>
+#endif
+
+void zfwDumpBuf(zdev_t* dev, zbuf_t* buf)
+{
+ u16_t i;
+
+ for (i=0; i<buf->len; i++)
+ {
+ printk("%02x ", *(((u8_t*)buf->data)+i));
+ if ((i&0xf)==0xf)
+ {
+ printk("\n");
+ }
+ }
+ printk("\n");
+}
+
+
+void zfwDbgReadRegDone(zdev_t* dev, u32_t addr, u32_t val)
+{
+ printk("Read addr:%x = %x\n", addr, val);
+}
+
+void zfwDbgWriteRegDone(zdev_t* dev, u32_t addr, u32_t val)
+{
+ printk("Write addr:%x = %x\n", addr, val);
+}
+
+void zfwDbgReadTallyDone(zdev_t* dev)
+{
+ //printk("Read Tall Done\n");
+}
+
+void zfwDbgWriteEepromDone(zdev_t* dev, u32_t addr, u32_t val)
+{
+}
+
+void zfwDbgQueryHwTxBusyDone(zdev_t* dev, u32_t val)
+{
+}
+
+//For Evl ++
+void zfwDbgReadFlashDone(zdev_t* dev, u32_t addr, u32_t* rspdata, u32_t datalen)
+{
+ printk("Read Flash addr:%x length:%x\n", addr, datalen);
+}
+
+void zfwDbgProgrameFlashDone(zdev_t* dev)
+{
+ printk("Program Flash Done\n");
+}
+
+void zfwDbgProgrameFlashChkDone(zdev_t* dev)
+{
+ printk("Program Flash Done\n");
+}
+
+void zfwDbgGetFlashChkSumDone(zdev_t* dev, u32_t* rspdata)
+{
+ printk("Get Flash ChkSum Done\n");
+}
+
+void zfwDbgDownloadFwInitDone(zdev_t* dev)
+{
+ printk("Download FW Init Done\n");
+}
+//For Evl --
+
+/* Leave an empty line below to remove warning message on some compiler */
diff --git a/drivers/staging/otus/wrap_ev.c b/drivers/staging/otus/wrap_ev.c
new file mode 100644
index 00000000000..966b787eef6
--- /dev/null
+++ b/drivers/staging/otus/wrap_ev.c
@@ -0,0 +1,283 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : wrap_ev.c */
+/* */
+/* Abstract */
+/* This module contains wrapper functions for events */
+/* */
+/* NOTES */
+/* Platform dependent. */
+/* */
+/************************************************************************/
+
+#include "oal_dt.h"
+#include "usbdrv.h"
+
+#include <linux/netlink.h>
+
+#if WIRELESS_EXT > 12
+#include <net/iw_handler.h>
+#endif
+
+
+/***** Management *****/
+u16_t zfLnxAuthNotify(zdev_t* dev, u16_t* macAddr)
+{
+ return 0;
+}
+
+u16_t zfLnxAsocNotify(zdev_t* dev, u16_t* macAddr, u8_t* body, u16_t bodySize, u16_t port)
+{
+//#ifdef ZM_HOSTAPD_SUPPORT
+ struct usbdrv_private *macp = dev->ml_priv;
+ union iwreq_data wreq;
+ u8_t *addr = (u8_t *) macAddr;
+ u16_t i, j;
+
+ memset(&wreq, 0, sizeof(wreq));
+ memcpy(wreq.addr.sa_data, macAddr, ETH_ALEN);
+ wreq.addr.sa_family = ARPHRD_ETHER;
+ printk(KERN_DEBUG "join_event of MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
+ addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
+
+ for(i = 0; i < ZM_OAL_MAX_STA_SUPPORT; i++)
+ {
+ for(j = 0; j < IEEE80211_ADDR_LEN; j++)
+ {
+ if ((macp->stawpaie[i].wpa_macaddr[j] != 0) &&
+ (macp->stawpaie[i].wpa_macaddr[j] != addr[j]))
+ break;
+ }
+ if (j == 6)
+ break;
+ }
+ if (i < ZM_OAL_MAX_STA_SUPPORT)
+ {
+ //printk("zfwAsocNotify - store wpa ie in macp, index = %d\n", i);
+ memcpy(macp->stawpaie[i].wpa_macaddr, macAddr, IEEE80211_ADDR_LEN);
+ memcpy(macp->stawpaie[i].wpa_ie, body, bodySize);
+ }
+ //if(macp->cardSetting.BssType == INFRASTRUCTURE_BSS) {
+ // //wireless_send_event(macp->device, SIOCGIWSCAN, &wreq, NULL);
+ // wireless_send_event(macp->device, SIOCGIWAP, &wreq, NULL);
+ //}
+#if WIRELESS_EXT >= 15
+ //else if(macp->cardSetting.BssType == AP_BSS) {
+// if (port == 0)
+// {
+ wireless_send_event(dev, IWEVREGISTERED, &wreq, NULL);
+// }
+// else
+// {
+// /* Check whether the VAP device is valid */
+// if (vap[port].dev != NULL)
+// {
+// wireless_send_event(vap[port].dev, IWEVREGISTERED, &wreq, NULL);
+// }
+// else
+// {
+// printk(KERN_ERR "Can' find a valid VAP device, port: %d\n", port);
+// }
+// }
+ //}
+#endif
+//#endif
+
+ return 0;
+}
+
+
+/* Notification that a STA is disassociated from AP */
+/* AP mode only */
+u16_t zfLnxDisAsocNotify(zdev_t* dev, u8_t* macAddr, u16_t port)
+{
+ union iwreq_data wreq;
+ u8_t *addr = (u8_t *) macAddr;
+
+ memset(&wreq, 0, sizeof(wreq));
+ memcpy(wreq.addr.sa_data, macAddr, ETH_ALEN);
+ wreq.addr.sa_family = ARPHRD_ETHER;
+ printk(KERN_DEBUG "zfwDisAsocNotify(), MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
+ addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
+
+
+ return 0;
+}
+
+/* Notification that a STA is connect to AP */
+/* AP mode only */
+u16_t zfLnxApConnectNotify(zdev_t* dev, u8_t* macAddr, u16_t port)
+{
+ union iwreq_data wreq;
+ u8_t *addr = (u8_t *) macAddr;
+
+ memset(&wreq, 0, sizeof(wreq));
+ memcpy(wreq.addr.sa_data, macAddr, ETH_ALEN);
+ wreq.addr.sa_family = ARPHRD_ETHER;
+ printk(KERN_DEBUG "zfwApConnectNotify(), MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
+ addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
+
+
+ return 0;
+}
+
+
+
+void zfLnxConnectNotify(zdev_t* dev, u16_t status, u16_t* bssid)
+{
+ union iwreq_data wreq;
+ u8_t *addr = (u8_t *) bssid;
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ if (bssid != NULL)
+ {
+ memset(&wreq, 0, sizeof(wreq));
+ if (status == ZM_STATUS_MEDIA_CONNECT)
+ memcpy(wreq.addr.sa_data, bssid, ETH_ALEN);
+ wreq.addr.sa_family = ARPHRD_ETHER;
+
+ if (status == ZM_STATUS_MEDIA_CONNECT)
+ {
+#ifdef ZM_CONFIG_BIG_ENDIAN
+ printk(KERN_DEBUG "Connected to AP, MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
+ addr[1], addr[0], addr[3], addr[2], addr[5], addr[4]);
+#else
+ printk(KERN_DEBUG "Connected to AP, MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
+ addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
+#endif
+
+ netif_start_queue(dev);
+ }
+ else if ((status == ZM_STATUS_MEDIA_DISCONNECT) ||
+ (status == ZM_STATUS_MEDIA_DISABLED) ||
+ (status == ZM_STATUS_MEDIA_CONNECTION_DISABLED) ||
+ (status == ZM_STATUS_MEDIA_CONNECTION_RESET) ||
+ (status == ZM_STATUS_MEDIA_RESET) ||
+ (status == ZM_STATUS_MEDIA_DISCONNECT_DEAUTH) ||
+ (status == ZM_STATUS_MEDIA_DISCONNECT_DISASOC) ||
+ (status == ZM_STATUS_MEDIA_DISCONNECT_BEACON_MISS) ||
+ (status == ZM_STATUS_MEDIA_DISCONNECT_NOT_FOUND) ||
+ (status == ZM_STATUS_MEDIA_DISCONNECT_TIMEOUT))
+ {
+ printk(KERN_DEBUG "Disconnection Notify\n");
+
+ netif_stop_queue(dev);
+ }
+
+ /* Save the connected status */
+ macp->adapterState = status;
+
+ if(zfiWlanQueryWlanMode(dev) == ZM_MODE_INFRASTRUCTURE) {
+ // //wireless_send_event(dev, SIOCGIWSCAN, &wreq, NULL);
+ wireless_send_event(dev, SIOCGIWAP, &wreq, NULL);
+ }
+#if WIRELESS_EXT >= 15
+ else if(zfiWlanQueryWlanMode(dev) == ZM_MODE_AP) {
+ //if (port == 0)
+ //{
+ wireless_send_event(dev, IWEVREGISTERED, &wreq, NULL);
+ //}
+ //else
+ //{
+ // /* Check whether the VAP device is valid */
+ // if (vap[port].dev != NULL)
+ // {
+ // wireless_send_event(vap[port].dev, IWEVREGISTERED, &wreq, NULL);
+ // }
+ // else
+ // {
+ // printk(KERN_ERR "Can' find a valid VAP device, port: %d\n", port);
+ // }
+ //}
+ }
+#endif
+ }
+ //return 0;
+}
+
+void zfLnxScanNotify(zdev_t* dev, struct zsScanResult* result)
+{
+ return;
+}
+
+void zfLnxStatisticsNotify(zdev_t* dev, struct zsStastics* result)
+{
+ return;
+}
+
+//void zfwMicFailureNotify(zdev_t* dev, u8_t* message, u16_t event)
+void zfLnxMicFailureNotify(zdev_t* dev, u16_t* addr, u16_t status)
+{
+ static const char *tag = "MLME-MICHAELMICFAILURE.indication";
+ union iwreq_data wrqu;
+ char buf[128];
+
+ /* TODO: needed parameters: count, type, src address */
+ //snprintf(buf, sizeof(buf), "%s(%scast addr=%s)", tag,
+ // (status == ZM_MIC_GROUP_ERROR) ? "broad" : "uni",
+ // ether_sprintf((u8_t *)addr));
+
+ if (zfiWlanQueryWlanMode(dev) == ZM_MODE_INFRASTRUCTURE)
+ {
+ strcpy(buf, tag);
+ }
+
+ memset(&wrqu, 0, sizeof(wrqu));
+ wrqu.data.length = strlen(buf);
+ wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
+}
+
+
+void zfLnxApMicFailureNotify(zdev_t* dev, u8_t* addr, zbuf_t* buf)
+{
+ union iwreq_data wreq;
+
+ memset(&wreq, 0, sizeof(wreq));
+ memcpy(wreq.addr.sa_data, addr, ETH_ALEN);
+ wreq.addr.sa_family = ARPHRD_ETHER;
+ printk(KERN_DEBUG "zfwApMicFailureNotify(), MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
+ addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
+
+ return;
+}
+
+// status = 0 => partner lost
+// = 1 => partner alive
+//void zfwIbssPartnerNotify(zdev_t* dev, u8_t status)
+void zfLnxIbssPartnerNotify(zdev_t* dev, u16_t status, struct zsPartnerNotifyEvent *event)
+{
+}
+
+void zfLnxMacAddressNotify(zdev_t* dev, u8_t* addr)
+{
+ dev->dev_addr[0] = addr[0];
+ dev->dev_addr[1] = addr[1];
+ dev->dev_addr[2] = addr[2];
+ dev->dev_addr[3] = addr[3];
+ dev->dev_addr[4] = addr[4];
+ dev->dev_addr[5] = addr[5];
+}
+
+void zfLnxSendCompleteIndication(zdev_t* dev, zbuf_t* buf)
+{
+}
+
+
+void zfLnxRestoreBufData(zdev_t* dev, zbuf_t* buf) {
+
+}
+/* Leave an empty line below to remove warning message on some compiler */
diff --git a/drivers/staging/otus/wrap_mem.c b/drivers/staging/otus/wrap_mem.c
new file mode 100644
index 00000000000..8081bb2f887
--- /dev/null
+++ b/drivers/staging/otus/wrap_mem.c
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* Module Name : wrap_mem.c */
+/* */
+/* Abstract */
+/* This module contains wrapper functions for memory management */
+/* */
+/* NOTES */
+/* Platform dependent. */
+/* */
+/************************************************************************/
+
+#include "oal_dt.h"
+#include "usbdrv.h"
+
+#include <linux/netlink.h>
+
+#if WIRELESS_EXT > 12
+#include <net/iw_handler.h>
+#endif
+
+/* Memory management */
+/* Called to allocate uncached memory, allocated memory must */
+/* in 4-byte boundary */
+void* zfwMemAllocate(zdev_t* dev, u32_t size)
+{
+ void* mem = NULL;
+ mem = kmalloc(size, GFP_ATOMIC);
+ return mem;
+}
+
+
+/* Called to free allocated memory */
+void zfwMemFree(zdev_t* dev, void* mem, u32_t size)
+{
+ kfree(mem);
+ return;
+}
+
+void zfwMemoryCopy(u8_t* dst, u8_t* src, u16_t length)
+{
+ //u16_t i;
+
+ memcpy(dst, src, length);
+ //for(i=0; i<length; i++)
+ //{
+ // dst[i] = src[i];
+ //}
+ return;
+}
+
+void zfwZeroMemory(u8_t* va, u16_t length)
+{
+ //u16_t i;
+ memset(va, 0, length);
+ //for(i=0; i<length; i++)
+ //{
+ // va[i] = 0;
+ //}
+ return;
+}
+
+void zfwMemoryMove(u8_t* dst, u8_t* src, u16_t length)
+{
+ memcpy(dst, src, length);
+ return;
+}
+
+u8_t zfwMemoryIsEqual(u8_t* m1, u8_t* m2, u16_t length)
+{
+ //u16_t i;
+ int ret;
+
+ ret = memcmp(m1, m2, length);
+
+ return ((ret==0)?TRUE:FALSE);
+ //for(i=0; i<length; i++)
+ //{
+ // if ( m1[i] != m2[i] )
+ // {
+ // return FALSE;
+ // }
+ //}
+
+ //return TRUE;
+}
+
+/* Leave an empty line below to remove warning message on some compiler */
diff --git a/drivers/staging/otus/wrap_mis.c b/drivers/staging/otus/wrap_mis.c
new file mode 100644
index 00000000000..337918b9de9
--- /dev/null
+++ b/drivers/staging/otus/wrap_mis.c
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : wrap_mis.c */
+/* */
+/* Abstract */
+/* This module contains wrapper functions for misc functions */
+/* */
+/* NOTES */
+/* Platform dependent. */
+/* */
+/************************************************************************/
+
+#include "oal_dt.h"
+#include "usbdrv.h"
+
+#include <linux/netlink.h>
+
+#if WIRELESS_EXT > 12
+#include <net/iw_handler.h>
+#endif
+
+//extern struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER];
+extern struct zsVapStruct vap[ZM_VAP_PORT_NUMBER];
+extern u16_t zfLnxGetVapId(zdev_t* dev);
+
+/* Simply return 0xffff if VAP function is not supported */
+u16_t zfwGetVapId(zdev_t* dev)
+{
+ return zfLnxGetVapId(dev);
+}
+
+void zfwSleep(zdev_t* dev, u32_t ms)
+{
+ if (in_interrupt() == 0)
+ {
+ mdelay(ms);
+ }
+ else
+ {
+ int ii;
+ int iter = 100000 * ms;
+
+ for (ii = 0; ii < iter; ii++)
+ {
+
+ }
+ }
+}
+
+#ifdef ZM_HALPLUS_LOCK
+asmlinkage struct zsWlanDev *zfwGetWlanDev(zdev_t* dev)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ return macp->wd;
+}
+
+asmlinkage void zfwEnterCriticalSection(zdev_t* dev)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ spin_lock_irqsave(&macp->cs_lock, macp->hal_irqFlag);
+}
+
+asmlinkage void zfwLeaveCriticalSection(zdev_t* dev)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ spin_unlock_irqrestore(&macp->cs_lock, macp->hal_irqFlag);
+}
+
+asmlinkage u8_t zfwBufReadByte(zdev_t* dev, zbuf_t* buf, u16_t offset)
+{
+ return *(u8_t*)((u8_t*)buf->data+offset);
+}
+
+asmlinkage u16_t zfwBufReadHalfWord(zdev_t* dev, zbuf_t* buf, u16_t offset)
+{
+ return zmw_cpu_to_le16(*(u16_t*)((u8_t*)buf->data+offset));
+}
+
+asmlinkage void zfwBufWriteByte(zdev_t* dev, zbuf_t* buf, u16_t offset, u8_t value)
+{
+ *(u8_t*)((u8_t*)buf->data+offset) = value;
+}
+
+asmlinkage void zfwBufWriteHalfWord(zdev_t* dev, zbuf_t* buf, u16_t offset, u16_t value)
+{
+ *(u16_t*)((u8_t*)buf->data+offset) = zmw_cpu_to_le16(value);
+}
+
+asmlinkage u8_t *zfwGetBuffer(zdev_t* dev, zbuf_t* buf)
+{
+ return (u8_t*)(buf->data);
+}
+#endif
+
+/* Leave an empty line below to remove warning message on some compiler */
diff --git a/drivers/staging/otus/wrap_pkt.c b/drivers/staging/otus/wrap_pkt.c
new file mode 100644
index 00000000000..5db0004c873
--- /dev/null
+++ b/drivers/staging/otus/wrap_pkt.c
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : wrap_pkt.c */
+/* */
+/* Abstract */
+/* This module contains wrapper functions for packet handling */
+/* */
+/* NOTES */
+/* Platform dependent. */
+/* */
+/************************************************************************/
+
+#include "oal_dt.h"
+#include "usbdrv.h"
+
+#include <linux/netlink.h>
+
+#if WIRELESS_EXT > 12
+#include <net/iw_handler.h>
+#endif
+
+
+
+//extern struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER];
+extern struct zsVapStruct vap[ZM_VAP_PORT_NUMBER];
+
+
+/***** Rx *****/
+void zfLnxRecv80211(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo)
+{
+ u16_t frameType;
+ u16_t frameCtrl;
+ u16_t frameSubtype;
+ zbuf_t *skb1;
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ //frameCtrl = zmw_buf_readb(dev, buf, 0);
+ frameCtrl = *(u8_t*)((u8_t*)buf->data);
+ frameType = frameCtrl & 0xf;
+ frameSubtype = frameCtrl & 0xf0;
+
+ if ((frameType == 0x0) && (macp->forwardMgmt))
+ {
+ switch (frameSubtype)
+ {
+ /* Beacon */
+ case 0x80 :
+ /* Probe response */
+ case 0x50 :
+ skb1 = skb_copy(buf, GFP_ATOMIC);
+ if(skb1 != NULL)
+ {
+ skb1->dev = dev;
+ skb1->mac_header = skb1->data;
+ skb1->ip_summed = CHECKSUM_NONE;
+ skb1->pkt_type = PACKET_OTHERHOST;
+ skb1->protocol = __constant_htons(0x0019); /* ETH_P_80211_RAW */
+ netif_rx(skb1);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ zfiRecv80211(dev, buf, addInfo);
+ return;
+}
+
+#define ZM_AVOID_UDP_LARGE_PACKET_FAIL
+void zfLnxRecvEth(zdev_t* dev, zbuf_t* buf, u16_t port)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+#ifdef ZM_AVOID_UDP_LARGE_PACKET_FAIL
+ zbuf_t *new_buf;
+
+ //new_buf = dev_alloc_skb(2048);
+ new_buf = dev_alloc_skb(buf->len);
+
+#ifdef NET_SKBUFF_DATA_USES_OFFSET
+ new_buf->tail = 0;
+ new_buf->len = 0;
+#else
+ new_buf->tail = new_buf->data;
+ new_buf->len = 0;
+#endif
+
+ skb_put(new_buf, buf->len);
+ memcpy(new_buf->data, buf->data, buf->len);
+
+ /* Free buffer */
+ dev_kfree_skb_any(buf);
+
+ if (port == 0)
+ {
+ new_buf->dev = dev;
+ new_buf->protocol = eth_type_trans(new_buf, dev);
+ }
+ else
+ {
+ /* VAP */
+ if (vap[0].dev != NULL)
+ {
+ new_buf->dev = vap[0].dev;
+ new_buf->protocol = eth_type_trans(new_buf, vap[0].dev);
+ }
+ else
+ {
+ new_buf->dev = dev;
+ new_buf->protocol = eth_type_trans(new_buf, dev);
+ }
+ }
+
+ new_buf->ip_summed = CHECKSUM_NONE;
+ dev->last_rx = jiffies;
+
+ switch(netif_rx(new_buf))
+#else
+ if (port == 0)
+ {
+ buf->dev = dev;
+ buf->protocol = eth_type_trans(buf, dev);
+ }
+ else
+ {
+ /* VAP */
+ if (vap[0].dev != NULL)
+ {
+ buf->dev = vap[0].dev;
+ buf->protocol = eth_type_trans(buf, vap[0].dev);
+ }
+ else
+ {
+ buf->dev = dev;
+ buf->protocol = eth_type_trans(buf, dev);
+ }
+ }
+
+ buf->ip_summed = CHECKSUM_NONE;
+ dev->last_rx = jiffies;
+
+ switch(netif_rx(buf))
+#endif
+ {
+ case NET_RX_BAD:
+ case NET_RX_DROP:
+ case NET_RX_CN_MOD:
+ case NET_RX_CN_HIGH:
+ break;
+ default:
+ macp->drv_stats.net_stats.rx_packets++;
+ macp->drv_stats.net_stats.rx_bytes += buf->len;
+ break;
+ }
+
+ return;
+}
+
+/* Leave an empty line below to remove warning message on some compiler */
diff --git a/drivers/staging/otus/wrap_sec.c b/drivers/staging/otus/wrap_sec.c
new file mode 100644
index 00000000000..f688d064175
--- /dev/null
+++ b/drivers/staging/otus/wrap_sec.c
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : wrap_sec.c */
+/* */
+/* Abstract */
+/* This module contains wrapper functions for CENC. */
+/* */
+/* NOTES */
+/* Platform dependent. */
+/* */
+/************************************************************************/
+
+#include "oal_dt.h"
+#include "usbdrv.h"
+
+#include <linux/netlink.h>
+
+#if WIRELESS_EXT > 12
+#include <net/iw_handler.h>
+#endif
+
+#ifdef ZM_ENABLE_CENC
+extern int zfLnxCencSendMsg(struct sock *netlink_sk, u_int8_t *msg, int len);
+
+u16_t zfLnxCencAsocNotify(zdev_t* dev, u16_t* macAddr, u8_t* body, u16_t bodySize, u16_t port)
+{
+ struct usbdrv_private *macp = (struct usbdrv_private *)dev->priv;
+ struct zydas_cenc_sta_info cenc_info;
+ //struct sock *netlink_sk;
+ u8_t ie_len;
+ int ii;
+
+ /* Create NETLINK socket */
+ //netlink_sk = netlink_kernel_create(NETLINK_USERSOCK, NULL);
+
+ if (macp->netlink_sk == NULL)
+ {
+ printk(KERN_ERR "NETLINK Socket is NULL\n");
+ return -1;
+ }
+
+ memset(&cenc_info, 0, sizeof(cenc_info));
+
+ //memcpy(cenc_info.gsn, vap->iv_cencmsk_keys.wk_txiv, ZM_CENC_IV_LEN);
+ zfiWlanQueryGSN(dev, cenc_info.gsn, port);
+ cenc_info.datalen += ZM_CENC_IV_LEN;
+ ie_len = body[1] + 2;
+ memcpy(cenc_info.wie, body, ie_len);
+ cenc_info.datalen += ie_len;
+
+ memcpy(cenc_info.sta_mac, macAddr, 6);
+ cenc_info.msg_type = ZM_CENC_WAI_REQUEST;
+ cenc_info.datalen += 6 + 2;
+
+ printk(KERN_ERR "===== zfwCencSendMsg, bodySize: %d =====\n", bodySize);
+
+ for(ii = 0; ii < bodySize; ii++)
+ {
+ printk(KERN_ERR "%02x ", body[ii]);
+
+ if ((ii & 0xf) == 0xf)
+ {
+ printk(KERN_ERR "\n");
+ }
+ }
+
+ zfLnxCencSendMsg(macp->netlink_sk, (u8_t *)&cenc_info, cenc_info.datalen+4);
+
+ /* Close NETLINK socket */
+ //sock_release(netlink_sk);
+
+ return 0;
+}
+#endif //ZM_ENABLE_CENC
+
+u8_t zfwCencHandleBeaconProbrespon(zdev_t* dev, u8_t *pWIEc,
+ u8_t *pPeerSSIDc, u8_t *pPeerAddrc)
+{
+ return 0;
+}
+
+u8_t zfwGetPktEncExemptionActionType(zdev_t* dev, zbuf_t* buf)
+{
+ return ZM_ENCRYPTION_EXEMPT_NO_EXEMPTION;
+}
+
+void copyToIntTxBuffer(zdev_t* dev, zbuf_t* buf, u8_t* src,
+ u16_t offset, u16_t length)
+{
+ u16_t i;
+
+ for(i=0; i<length;i++)
+ {
+ //zmw_tx_buf_writeb(dev, buf, offset+i, src[i]);
+ *(u8_t*)((u8_t*)buf->data+offset+i) = src[i];
+ }
+}
+
+u16_t zfwStaAddIeWpaRsn(zdev_t* dev, zbuf_t* buf, u16_t offset, u8_t frameType)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ //zm_msg1_mm(ZM_LV_0, "CWY - add wpaie content Length : ", macp->supIe[1]);
+ if (macp->supIe[1] != 0)
+ {
+ copyToIntTxBuffer(dev, buf, macp->supIe, offset, macp->supIe[1]+2);
+ //memcpy(buf->data[offset], macp->supIe, macp->supIe[1]+2);
+ offset += (macp->supIe[1]+2);
+ }
+
+ return offset;
+}
+
+/* Leave an empty line below to remove warning message on some compiler */
diff --git a/drivers/staging/otus/wrap_usb.c b/drivers/staging/otus/wrap_usb.c
new file mode 100644
index 00000000000..c076e564522
--- /dev/null
+++ b/drivers/staging/otus/wrap_usb.c
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : wrap_usb.c */
+/* */
+/* Abstract */
+/* This module contains wrapper functions for USB management */
+/* */
+/* NOTES */
+/* Platform dependent. */
+/* */
+/************************************************************************/
+
+#include "oal_dt.h"
+#include "usbdrv.h"
+
+#include <linux/netlink.h>
+
+#if WIRELESS_EXT > 12
+#include <net/iw_handler.h>
+#endif
+
+extern void zfLnxInitUsbTxQ(zdev_t* dev);
+extern void zfLnxInitUsbRxQ(zdev_t* dev);
+extern u32_t zfLnxSubmitRegInUrb(zdev_t *dev);
+u32_t zfLnxUsbOut(zdev_t* dev, u8_t *hdr, u16_t hdrlen, u8_t *snap, u16_t snapLen,
+ u8_t *tail, u16_t tailLen, zbuf_t *buf, u16_t offset);
+u32_t zfLnxUsbWriteReg(zdev_t* dev, u32_t* cmd, u16_t cmdLen);
+
+void zfwUsbRegisterCallBack(zdev_t* dev, struct zfCbUsbFuncTbl *zfUsbFunc) {
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ macp->usbCbFunctions.zfcbUsbRecv = zfUsbFunc->zfcbUsbRecv;
+ macp->usbCbFunctions.zfcbUsbRegIn = zfUsbFunc->zfcbUsbRegIn;
+ macp->usbCbFunctions.zfcbUsbOutComplete = zfUsbFunc->zfcbUsbOutComplete;
+
+ return;
+}
+
+u32_t zfwUsbGetFreeTxQSize(zdev_t* dev)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ u32_t freeTxQSize;
+ unsigned long irqFlag;
+ //zmw_declare_for_critical_section();
+
+ //zmw_enter_critical_section(dev);
+ spin_lock_irqsave(&macp->cs_lock, irqFlag);
+
+ freeTxQSize = ZM_MAX_TX_BUF_NUM - macp->TxBufCnt;
+
+ //zmw_leave_critical_section(dev);
+ spin_unlock_irqrestore(&macp->cs_lock, irqFlag);
+
+ return freeTxQSize;
+}
+
+u32_t zfwUsbGetMaxTxQSize(zdev_t* dev)
+{
+ return ZM_MAX_TX_BUF_NUM;
+}
+
+u32_t zfwUsbEnableIntEpt(zdev_t *dev, u8_t endpt)
+{
+ /* Initialize USB TxQ */
+ zfLnxInitUsbTxQ(dev);
+
+ /* Initialize USB RxQ */
+ zfLnxInitUsbRxQ(dev);
+
+ /* Initialize USB Register In URB */
+ //zfwUsbSubmitRegIn(dev);
+ /* Initialize USB Register In URB */
+ zfLnxSubmitRegInUrb(dev);
+
+ return 0;
+}
+
+int zfwUsbEnableRxEpt(zdev_t* dev, u8_t endpt)
+{
+ return 0;
+}
+
+u32_t zfwUsbSubmitControl(zdev_t* dev, u8_t req, u16_t value, u16_t index, void *data, u32_t size)
+{
+ int result = 0;
+ u32_t ret = 0;
+ struct usbdrv_private *macp = dev->ml_priv;
+ u8_t* buf;
+
+ if (size > 0)
+ {
+ buf = kmalloc(size, GFP_KERNEL);
+ memcpy(buf, (u8_t*)data, size);
+ }
+ else
+ {
+ buf = NULL;
+ }
+
+#if 0
+ printk(KERN_ERR "req = 0x%02x\n", req);
+ printk(KERN_ERR "value = 0x%04x\n", value);
+ printk(KERN_ERR "index = 0x%04x\n", index);
+ printk(KERN_ERR "data = 0x%lx\n", (u32_t) data);
+ printk(KERN_ERR "size = %ld\n", size);
+#endif
+
+ result = usb_control_msg(macp->udev, usb_sndctrlpipe(macp->udev, 0),
+ req, USB_DIR_OUT | 0x40, value, index, buf, size, HZ);
+
+ if (result < 0)
+ {
+ printk("zfwUsbSubmitControl() failed, result=0x%x\n", result);
+ ret = 1;
+ }
+ kfree(buf);
+
+ return ret;
+}
+
+void zfwUsbCmd(zdev_t* dev, u8_t endpt, u32_t* cmd, u16_t cmdLen)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ u32_t ret;
+
+ //MPUsbCommand(dev, endpt, cmd, cmdLen);
+ ret = zfLnxUsbWriteReg(dev, cmd, cmdLen);
+
+ /* if zfLnxUsbWriteReg() return error, free and allocate urb, resend again */
+ if (ret != 0)
+ {
+ usb_free_urb(macp->RegOutUrb);
+ macp->RegOutUrb = usb_alloc_urb(0, GFP_ATOMIC);
+ ret = zfLnxUsbWriteReg(dev, cmd, cmdLen);
+ }
+}
+
+u32_t zfwUsbSend(zdev_t* dev, u8_t endpt, u8_t *hdr, u16_t hdrlen, u8_t *snap, u16_t snapLen,
+ u8_t *tail, u16_t tailLen, zbuf_t *buf, u16_t offset)
+{
+ u32_t status;
+
+#ifdef ZM_CONFIG_BIG_ENDIAN
+ u32_t ii = 0;
+ u16_t *pc = NULL;
+
+ pc = (u16_t *)hdr;
+ for(ii=0; ii<(hdrlen>>1); ii++)
+ {
+ pc[ii] = cpu_to_le16(pc[ii]);
+ }
+
+ pc = (u16_t *)snap;
+ for(ii=0; ii<(snapLen>>1); ii++)
+ {
+ pc[ii] = cpu_to_le16(pc[ii]);
+ }
+
+ pc = (u16_t *)tail;
+ for(ii=0; ii<(tailLen>>1); ii++)
+ {
+ pc[ii] = cpu_to_le16(pc[ii]);
+ }
+#endif
+
+ status = zfLnxUsbOut(dev, hdr, hdrlen, snap, snapLen, tail, tailLen, buf, offset);
+ if ( status == 0 )
+ {
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+}
+
+/* Leave an empty line below to remove warning message on some compiler */
diff --git a/drivers/staging/otus/wwrap.c b/drivers/staging/otus/wwrap.c
new file mode 100644
index 00000000000..1bb5f596d6c
--- /dev/null
+++ b/drivers/staging/otus/wwrap.c
@@ -0,0 +1,1134 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* Module Name : wwrap.c */
+/* Abstract */
+/* This module contains wrapper functions. */
+/* */
+/* NOTES */
+/* Platform dependent. */
+/* */
+
+/* Please include your header files here */
+#include "oal_dt.h"
+#include "usbdrv.h"
+
+#include <linux/netlink.h>
+
+#if WIRELESS_EXT > 12
+#include <net/iw_handler.h>
+#endif
+
+extern void zfiRecv80211(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo);
+extern void zfCoreRecv(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo);
+extern void zfIdlChkRsp(zdev_t* dev, u32_t* rsp, u16_t rspLen);
+extern void zfIdlRsp(zdev_t* dev, u32_t *rsp, u16_t rspLen);
+
+
+
+//extern struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER];
+extern struct zsVapStruct vap[ZM_VAP_PORT_NUMBER];
+
+u32_t zfLnxUsbSubmitTxData(zdev_t* dev);
+u32_t zfLnxUsbIn(zdev_t* dev, urb_t *urb, zbuf_t *buf);
+u32_t zfLnxSubmitRegInUrb(zdev_t *dev);
+u32_t zfLnxUsbSubmitBulkUrb(urb_t *urb, struct usb_device *usb, u16_t epnum, u16_t direction,
+ void *transfer_buffer, int buffer_length, usb_complete_t complete, void *context);
+u32_t zfLnxUsbSubmitIntUrb(urb_t *urb, struct usb_device *usb, u16_t epnum, u16_t direction,
+ void *transfer_buffer, int buffer_length, usb_complete_t complete, void *context,
+ u32_t interval);
+
+u16_t zfLnxGetFreeTxUrb(zdev_t *dev)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ u16_t idx;
+ unsigned long irqFlag;
+
+ spin_lock_irqsave(&macp->cs_lock, irqFlag);
+
+ //idx = ((macp->TxUrbTail + 1) & (ZM_MAX_TX_URB_NUM - 1));
+
+ //if (idx != macp->TxUrbHead)
+ if (macp->TxUrbCnt != 0)
+ {
+ idx = macp->TxUrbTail;
+ macp->TxUrbTail = ((macp->TxUrbTail + 1) & (ZM_MAX_TX_URB_NUM - 1));
+ macp->TxUrbCnt--;
+ }
+ else
+ {
+ //printk(KERN_ERR "macp->TxUrbCnt: %d\n", macp->TxUrbCnt);
+ idx = 0xffff;
+ }
+
+ spin_unlock_irqrestore(&macp->cs_lock, irqFlag);
+ return idx;
+}
+
+void zfLnxPutTxUrb(zdev_t *dev)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ u16_t idx;
+ unsigned long irqFlag;
+
+ spin_lock_irqsave(&macp->cs_lock, irqFlag);
+
+ idx = ((macp->TxUrbHead + 1) & (ZM_MAX_TX_URB_NUM - 1));
+
+ //if (idx != macp->TxUrbTail)
+ if (macp->TxUrbCnt < ZM_MAX_TX_URB_NUM)
+ {
+ macp->TxUrbHead = idx;
+ macp->TxUrbCnt++;
+ }
+ else
+ {
+ printk("UsbTxUrbQ inconsistent: TxUrbHead: %d, TxUrbTail: %d\n",
+ macp->TxUrbHead, macp->TxUrbTail);
+ }
+
+ spin_unlock_irqrestore(&macp->cs_lock, irqFlag);
+}
+
+u16_t zfLnxCheckTxBufferCnt(zdev_t *dev)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ u16_t TxBufCnt;
+ unsigned long irqFlag;
+
+ spin_lock_irqsave(&macp->cs_lock, irqFlag);
+
+ TxBufCnt = macp->TxBufCnt;
+
+ spin_unlock_irqrestore(&macp->cs_lock, irqFlag);
+ return TxBufCnt;
+}
+
+UsbTxQ_t *zfLnxGetUsbTxBuffer(zdev_t *dev)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ u16_t idx;
+ UsbTxQ_t *TxQ;
+ unsigned long irqFlag;
+
+ spin_lock_irqsave(&macp->cs_lock, irqFlag);
+
+ idx = ((macp->TxBufHead+1) & (ZM_MAX_TX_BUF_NUM - 1));
+
+ //if (idx != macp->TxBufTail)
+ if (macp->TxBufCnt > 0)
+ {
+ //printk("CWY - zfwGetUsbTxBuffer ,macp->TxBufCnt = %d\n", macp->TxBufCnt);
+ TxQ = (UsbTxQ_t *)&(macp->UsbTxBufQ[macp->TxBufHead]);
+ macp->TxBufHead = ((macp->TxBufHead+1) & (ZM_MAX_TX_BUF_NUM - 1));
+ macp->TxBufCnt--;
+ }
+ else
+ {
+ if (macp->TxBufHead != macp->TxBufTail)
+ {
+ printk(KERN_ERR "zfwGetUsbTxBuf UsbTxBufQ inconsistent: TxBufHead: %d, TxBufTail: %d\n",
+ macp->TxBufHead, macp->TxBufTail);
+ }
+
+ spin_unlock_irqrestore(&macp->cs_lock, irqFlag);
+ return NULL;
+ }
+
+ spin_unlock_irqrestore(&macp->cs_lock, irqFlag);
+ return TxQ;
+}
+
+u16_t zfLnxPutUsbTxBuffer(zdev_t *dev, u8_t *hdr, u16_t hdrlen,
+ u8_t *snap, u16_t snapLen, u8_t *tail, u16_t tailLen,
+ zbuf_t *buf, u16_t offset)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ u16_t idx;
+ UsbTxQ_t *TxQ;
+ unsigned long irqFlag;
+
+ spin_lock_irqsave(&macp->cs_lock, irqFlag);
+
+ idx = ((macp->TxBufTail+1) & (ZM_MAX_TX_BUF_NUM - 1));
+
+ /* For Tx debug */
+ //zm_assert(macp->TxBufCnt >= 0); // deleted because of always true
+
+ //if (idx != macp->TxBufHead)
+ if (macp->TxBufCnt < ZM_MAX_TX_BUF_NUM)
+ {
+ //printk("CWY - zfwPutUsbTxBuffer ,macp->TxBufCnt = %d\n", macp->TxBufCnt);
+ TxQ = (UsbTxQ_t *)&(macp->UsbTxBufQ[macp->TxBufTail]);
+ memcpy(TxQ->hdr, hdr, hdrlen);
+ TxQ->hdrlen = hdrlen;
+ memcpy(TxQ->snap, snap, snapLen);
+ TxQ->snapLen = snapLen;
+ memcpy(TxQ->tail, tail, tailLen);
+ TxQ->tailLen = tailLen;
+ TxQ->buf = buf;
+ TxQ->offset = offset;
+
+ macp->TxBufTail = ((macp->TxBufTail+1) & (ZM_MAX_TX_BUF_NUM - 1));
+ macp->TxBufCnt++;
+ }
+ else
+ {
+ printk(KERN_ERR "zfLnxPutUsbTxBuffer UsbTxBufQ inconsistent: TxBufHead: %d, TxBufTail: %d, TxBufCnt: %d\n",
+ macp->TxBufHead, macp->TxBufTail, macp->TxBufCnt);
+ spin_unlock_irqrestore(&macp->cs_lock, irqFlag);
+ return 0xffff;
+ }
+
+ spin_unlock_irqrestore(&macp->cs_lock, irqFlag);
+ return 0;
+}
+
+zbuf_t *zfLnxGetUsbRxBuffer(zdev_t *dev)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ //u16_t idx;
+ zbuf_t *buf;
+ unsigned long irqFlag;
+
+ spin_lock_irqsave(&macp->cs_lock, irqFlag);
+
+ //idx = ((macp->RxBufHead+1) & (ZM_MAX_RX_URB_NUM - 1));
+
+ //if (idx != macp->RxBufTail)
+ if (macp->RxBufCnt != 0)
+ {
+ buf = macp->UsbRxBufQ[macp->RxBufHead];
+ macp->RxBufHead = ((macp->RxBufHead+1) & (ZM_MAX_RX_URB_NUM - 1));
+ macp->RxBufCnt--;
+ }
+ else
+ {
+ printk("RxBufQ inconsistent: RxBufHead: %d, RxBufTail: %d\n",
+ macp->RxBufHead, macp->RxBufTail);
+ spin_unlock_irqrestore(&macp->cs_lock, irqFlag);
+ return NULL;
+ }
+
+ spin_unlock_irqrestore(&macp->cs_lock, irqFlag);
+ return buf;
+}
+
+u32_t zfLnxPutUsbRxBuffer(zdev_t *dev, zbuf_t *buf)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ u16_t idx;
+ unsigned long irqFlag;
+
+ spin_lock_irqsave(&macp->cs_lock, irqFlag);
+
+ idx = ((macp->RxBufTail+1) & (ZM_MAX_RX_URB_NUM - 1));
+
+ //if (idx != macp->RxBufHead)
+ if (macp->RxBufCnt != ZM_MAX_RX_URB_NUM)
+ {
+ macp->UsbRxBufQ[macp->RxBufTail] = buf;
+ macp->RxBufTail = idx;
+ macp->RxBufCnt++;
+ }
+ else
+ {
+ printk("RxBufQ inconsistent: RxBufHead: %d, RxBufTail: %d\n",
+ macp->RxBufHead, macp->RxBufTail);
+ spin_unlock_irqrestore(&macp->cs_lock, irqFlag);
+ return 0xffff;
+ }
+
+ spin_unlock_irqrestore(&macp->cs_lock, irqFlag);
+ return 0;
+}
+
+void zfLnxUsbDataOut_callback(urb_t *urb)
+{
+ zdev_t* dev = urb->context;
+ //UsbTxQ_t *TxData;
+
+ /* Give the urb back */
+ zfLnxPutTxUrb(dev);
+
+ /* Check whether there is any pending buffer needed */
+ /* to be sent */
+ if (zfLnxCheckTxBufferCnt(dev) != 0)
+ {
+ //TxData = zfwGetUsbTxBuffer(dev);
+
+ //if (TxData == NULL)
+ //{
+ // printk("Get a NULL buffer from zfwGetUsbTxBuffer\n");
+ // return;
+ //}
+ //else
+ //{
+ zfLnxUsbSubmitTxData(dev);
+ //}
+ }
+}
+
+void zfLnxUsbDataIn_callback(urb_t *urb)
+{
+ zdev_t* dev = urb->context;
+ struct usbdrv_private *macp = dev->ml_priv;
+ zbuf_t *buf;
+ zbuf_t *new_buf;
+ int status;
+
+#if ZM_USB_STREAM_MODE == 1
+ static int remain_len = 0, check_pad = 0, check_len = 0;
+ int index = 0;
+ int chk_idx;
+ u16_t pkt_len;
+ u16_t pkt_tag;
+ u16_t ii;
+ zbuf_t *rxBufPool[8];
+ u16_t rxBufPoolIndex = 0;
+#endif
+
+ /* Check status for URB */
+ if (urb->status != 0){
+ printk("zfLnxUsbDataIn_callback() : status=0x%x\n", urb->status);
+ if ((urb->status != -ENOENT) && (urb->status != -ECONNRESET)
+ && (urb->status != -ESHUTDOWN))
+ {
+ if (urb->status == -EPIPE){
+ //printk(KERN_ERR "nonzero read bulk status received: -EPIPE");
+ status = -1;
+ }
+
+ if (urb->status == -EPROTO){
+ //printk(KERN_ERR "nonzero read bulk status received: -EPROTO");
+ status = -1;
+ }
+ }
+
+ //printk(KERN_ERR "urb->status: 0x%08x\n", urb->status);
+
+ /* Dequeue skb buffer */
+ buf = zfLnxGetUsbRxBuffer(dev);
+ dev_kfree_skb_any(buf);
+ #if 0
+ /* Enqueue skb buffer */
+ zfLnxPutUsbRxBuffer(dev, buf);
+
+ /* Submit a Rx urb */
+ zfLnxUsbIn(dev, urb, buf);
+ #endif
+ return;
+ }
+
+ if (urb->actual_length == 0)
+ {
+ printk(KERN_ERR "Get an URB whose length is zero");
+ status = -1;
+ }
+
+ /* Dequeue skb buffer */
+ buf = zfLnxGetUsbRxBuffer(dev);
+
+ //zfwBufSetSize(dev, buf, urb->actual_length);
+#ifdef NET_SKBUFF_DATA_USES_OFFSET
+ buf->tail = 0;
+ buf->len = 0;
+#else
+ buf->tail = buf->data;
+ buf->len = 0;
+#endif
+
+ if ((buf->tail + urb->actual_length) > buf->end)
+ BUG();
+
+ skb_put(buf, urb->actual_length);
+
+#if ZM_USB_STREAM_MODE == 1
+ if (remain_len != 0)
+ {
+ zbuf_t *remain_buf = macp->reamin_buf;
+
+ index = remain_len;
+ remain_len -= check_pad;
+
+ /* Copy data */
+ memcpy(&(remain_buf->data[check_len]), buf->data, remain_len);
+ check_len += remain_len;
+ remain_len = 0;
+
+ rxBufPool[rxBufPoolIndex++] = remain_buf;
+ }
+
+ while(index < urb->actual_length)
+ {
+ pkt_len = buf->data[index] + (buf->data[index+1] << 8);
+ pkt_tag = buf->data[index+2] + (buf->data[index+3] << 8);
+
+ if (pkt_tag == 0x4e00)
+ {
+ int pad_len;
+
+ //printk("Get a packet, index: %d, pkt_len: 0x%04x\n", index, pkt_len);
+ #if 0
+ /* Dump data */
+ for (ii = index; ii < pkt_len+4;)
+ {
+ printk("%02x ", (buf->data[ii] & 0xff));
+
+ if ((++ii % 16) == 0)
+ printk("\n");
+ }
+
+ printk("\n");
+ #endif
+
+ pad_len = 4 - (pkt_len & 0x3);
+
+ if(pad_len == 4)
+ pad_len = 0;
+
+ chk_idx = index;
+ index = index + 4 + pkt_len + pad_len;
+
+ if (index > ZM_MAX_RX_BUFFER_SIZE)
+ {
+ remain_len = index - ZM_MAX_RX_BUFFER_SIZE; // - pad_len;
+ check_len = ZM_MAX_RX_BUFFER_SIZE - chk_idx - 4;
+ check_pad = pad_len;
+
+ /* Allocate a skb buffer */
+ //new_buf = zfwBufAllocate(dev, ZM_MAX_RX_BUFFER_SIZE);
+ new_buf = dev_alloc_skb(ZM_MAX_RX_BUFFER_SIZE);
+
+ /* Set skb buffer length */
+ #ifdef NET_SKBUFF_DATA_USES_OFFSET
+ new_buf->tail = 0;
+ new_buf->len = 0;
+ #else
+ new_buf->tail = new_buf->data;
+ new_buf->len = 0;
+ #endif
+
+ skb_put(new_buf, pkt_len);
+
+ /* Copy the buffer */
+ memcpy(new_buf->data, &(buf->data[chk_idx+4]), check_len);
+
+ /* Record the buffer pointer */
+ macp->reamin_buf = new_buf;
+ }
+ else
+ {
+ #ifdef ZM_DONT_COPY_RX_BUFFER
+ if (rxBufPoolIndex == 0)
+ {
+ new_buf = skb_clone(buf, GFP_ATOMIC);
+
+ new_buf->data = &(buf->data[chk_idx+4]);
+ new_buf->len = pkt_len;
+ }
+ else
+ {
+ #endif
+ /* Allocate a skb buffer */
+ new_buf = dev_alloc_skb(ZM_MAX_RX_BUFFER_SIZE);
+
+ /* Set skb buffer length */
+ #ifdef NET_SKBUFF_DATA_USES_OFFSET
+ new_buf->tail = 0;
+ new_buf->len = 0;
+ #else
+ new_buf->tail = new_buf->data;
+ new_buf->len = 0;
+ #endif
+
+ skb_put(new_buf, pkt_len);
+
+ /* Copy the buffer */
+ memcpy(new_buf->data, &(buf->data[chk_idx+4]), pkt_len);
+
+ #ifdef ZM_DONT_COPY_RX_BUFFER
+ }
+ #endif
+ rxBufPool[rxBufPoolIndex++] = new_buf;
+ }
+ }
+ else
+ {
+ printk(KERN_ERR "Can't find tag, pkt_len: 0x%04x, tag: 0x%04x\n", pkt_len, pkt_tag);
+
+ /* Free buffer */
+ dev_kfree_skb_any(buf);
+
+ /* Allocate a skb buffer */
+ new_buf = dev_alloc_skb(ZM_MAX_RX_BUFFER_SIZE);
+
+ /* Enqueue skb buffer */
+ zfLnxPutUsbRxBuffer(dev, new_buf);
+
+ /* Submit a Rx urb */
+ zfLnxUsbIn(dev, urb, new_buf);
+
+ return;
+ }
+ }
+
+ /* Free buffer */
+ dev_kfree_skb_any(buf);
+#endif
+
+ /* Allocate a skb buffer */
+ new_buf = dev_alloc_skb(ZM_MAX_RX_BUFFER_SIZE);
+
+ /* Enqueue skb buffer */
+ zfLnxPutUsbRxBuffer(dev, new_buf);
+
+ /* Submit a Rx urb */
+ zfLnxUsbIn(dev, urb, new_buf);
+
+#if ZM_USB_STREAM_MODE == 1
+ for(ii = 0; ii < rxBufPoolIndex; ii++)
+ {
+ macp->usbCbFunctions.zfcbUsbRecv(dev, rxBufPool[ii]);
+ }
+#else
+ /* pass data to upper layer */
+ macp->usbCbFunctions.zfcbUsbRecv(dev, buf);
+#endif
+}
+
+void zfLnxUsbRegOut_callback(urb_t *urb)
+{
+ //dev_t* dev = urb->context;
+
+ //printk(KERN_ERR "zfwUsbRegOut_callback\n");
+}
+
+void zfLnxUsbRegIn_callback(urb_t *urb)
+{
+ zdev_t* dev = urb->context;
+ u32_t rsp[64/4];
+ int status;
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ /* Check status for URB */
+ if (urb->status != 0){
+ printk("zfLnxUsbRegIn_callback() : status=0x%x\n", urb->status);
+ if ((urb->status != -ENOENT) && (urb->status != -ECONNRESET)
+ && (urb->status != -ESHUTDOWN))
+ {
+ if (urb->status == -EPIPE){
+ //printk(KERN_ERR "nonzero read bulk status received: -EPIPE");
+ status = -1;
+ }
+
+ if (urb->status == -EPROTO){
+ //printk(KERN_ERR "nonzero read bulk status received: -EPROTO");
+ status = -1;
+ }
+ }
+
+ //printk(KERN_ERR "urb->status: 0x%08x\n", urb->status);
+ return;
+ }
+
+ if (urb->actual_length == 0)
+ {
+ printk(KERN_ERR "Get an URB whose length is zero");
+ status = -1;
+ }
+
+ /* Copy data into respone buffer */
+ memcpy(rsp, macp->regUsbReadBuf, urb->actual_length);
+
+ /* Notify to upper layer */
+ //zfIdlChkRsp(dev, rsp, (u16_t)urb->actual_length);
+ //zfiUsbRegIn(dev, rsp, (u16_t)urb->actual_length);
+ macp->usbCbFunctions.zfcbUsbRegIn(dev, rsp, (u16_t)urb->actual_length);
+
+ /* Issue another USB IN URB */
+ zfLnxSubmitRegInUrb(dev);
+}
+
+u32_t zfLnxSubmitRegInUrb(zdev_t *dev)
+{
+ u32_t ret;
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ /* Submit a rx urb */
+ //ret = zfLnxUsbSubmitBulkUrb(macp->RegInUrb, macp->udev,
+ // USB_REG_IN_PIPE, USB_DIR_IN, macp->regUsbReadBuf,
+ // ZM_USB_REG_MAX_BUF_SIZE, zfLnxUsbRegIn_callback, dev);
+ //CWYang(-)
+ //if (ret != 0)
+ // printk("zfwUsbSubmitBulkUrb fail, status: 0x%08x\n", (int)ret);
+
+ ret = zfLnxUsbSubmitIntUrb(macp->RegInUrb, macp->udev,
+ USB_REG_IN_PIPE, USB_DIR_IN, macp->regUsbReadBuf,
+ ZM_USB_REG_MAX_BUF_SIZE, zfLnxUsbRegIn_callback, dev, 1);
+
+ return ret;
+}
+
+u32_t zfLnxUsbSubmitTxData(zdev_t* dev)
+{
+ u32_t i;
+ u32_t ret;
+ u16_t freeTxUrb;
+ u8_t *puTxBuf = NULL;
+ UsbTxQ_t *TxData;
+ int len = 0;
+ struct usbdrv_private *macp = dev->ml_priv;
+#if ZM_USB_TX_STREAM_MODE == 1
+ u8_t ii;
+ u16_t offset = 0;
+ u16_t usbTxAggCnt;
+ u16_t *pUsbTxHdr;
+ UsbTxQ_t *TxQPool[ZM_MAX_TX_AGGREGATE_NUM];
+#endif
+
+ /* First check whether there is a free URB */
+ freeTxUrb = zfLnxGetFreeTxUrb(dev);
+
+ /* If there is no any free Tx Urb */
+ if (freeTxUrb == 0xffff)
+ {
+ //printk(KERN_ERR "Can't get free Tx Urb\n");
+ //printk("CWY - Can't get free Tx Urb\n");
+ return 0xffff;
+ }
+
+#if ZM_USB_TX_STREAM_MODE == 1
+ usbTxAggCnt = zfLnxCheckTxBufferCnt(dev);
+
+ if (usbTxAggCnt >= ZM_MAX_TX_AGGREGATE_NUM)
+ {
+ usbTxAggCnt = ZM_MAX_TX_AGGREGATE_NUM;
+ }
+ else
+ {
+ usbTxAggCnt = 1;
+ }
+
+ //printk("usbTxAggCnt: %d\n", usbTxAggCnt);
+#endif
+
+#if ZM_USB_TX_STREAM_MODE == 1
+ for(ii = 0; ii < usbTxAggCnt; ii++)
+ {
+#endif
+ /* Dequeue the packet from UsbTxBufQ */
+ TxData = zfLnxGetUsbTxBuffer(dev);
+ if (TxData == NULL)
+ {
+ /* Give the urb back */
+ zfLnxPutTxUrb(dev);
+ return 0xffff;
+ }
+
+ /* Point to the freeTxUrb buffer */
+ puTxBuf = macp->txUsbBuf[freeTxUrb];
+
+#if ZM_USB_TX_STREAM_MODE == 1
+ puTxBuf += offset;
+ pUsbTxHdr = (u16_t *)puTxBuf;
+
+ /* Add the packet length and tag information */
+ *pUsbTxHdr++ = TxData->hdrlen + TxData->snapLen +
+ (TxData->buf->len - TxData->offset) + TxData->tailLen;
+
+ *pUsbTxHdr++ = 0x697e;
+
+ puTxBuf += 4;
+#endif // #ifdef ZM_USB_TX_STREAM_MODE
+
+ /* Copy WLAN header and packet buffer into USB buffer */
+ for(i = 0; i < TxData->hdrlen; i++)
+ {
+ *puTxBuf++ = TxData->hdr[i];
+ }
+
+ /* Copy SNAP header */
+ for(i = 0; i < TxData->snapLen; i++)
+ {
+ *puTxBuf++ = TxData->snap[i];
+ }
+
+ /* Copy packet buffer */
+ for(i = 0; i < TxData->buf->len - TxData->offset; i++)
+ {
+ //*puTxBuf++ = zmw_rx_buf_readb(dev, TxData->buf, i);
+ *puTxBuf++ = *(u8_t*)((u8_t*)TxData->buf->data+i+TxData->offset);
+ }
+
+ /* Copy tail */
+ for(i = 0; i < TxData->tailLen; i++)
+ {
+ *puTxBuf++ = TxData->tail[i];
+ }
+
+ len = TxData->hdrlen+TxData->snapLen+TxData->buf->len+TxData->tailLen-TxData->offset;
+
+ #if 0
+ if (TxData->hdrlen != 0)
+ {
+ puTxBuf = macp->txUsbBuf[freeTxUrb];
+ for (i = 0; i < len; i++)
+ {
+ printk("%02x ", puTxBuf[i]);
+ if (i % 16 == 15)
+ printk("\n");
+ }
+ printk("\n");
+ }
+ #endif
+ #if 0
+ /* For debug purpose */
+ if(TxData->hdr[9] & 0x40)
+ {
+ int i;
+ u16_t ctrlLen = TxData->hdr[0] + (TxData->hdr[1] << 8);
+
+ if (ctrlLen != len + 4)
+ {
+ /* Dump control setting */
+ for(i = 0; i < 8; i++)
+ {
+ printk(KERN_ERR "0x%02x ", TxData->hdr[i]);
+ }
+ printk(KERN_ERR "\n");
+
+ printk(KERN_ERR "ctrLen: %d, hdrLen: %d, snapLen: %d\n", ctrlLen, TxData->hdrlen, TxData->snapLen);
+ printk(KERN_ERR "bufLen: %d, tailLen: %d, len: %d\n", TxData->buf->len, TxData->tailLen, len);
+ }
+ }
+ #endif
+
+#if ZM_USB_TX_STREAM_MODE == 1
+ // Add the Length and Tag
+ len += 4;
+
+ //printk("%d packet, length: %d\n", ii+1, len);
+
+ if (ii < (ZM_MAX_TX_AGGREGATE_NUM-1))
+ {
+ /* Pad the buffer to firmware descriptor boundary */
+ offset += (((len-1) / 4) + 1) * 4;
+ }
+
+ if (ii == (ZM_MAX_TX_AGGREGATE_NUM-1))
+ {
+ len += offset;
+ }
+
+ TxQPool[ii] = TxData;
+
+ //DbgPrint("%d packet, offset: %d\n", ii+1, pUsbTxTransfer->offset);
+
+ /* free packet */
+ //zfBufFree(dev, txData->buf);
+ }
+#endif
+ //printk("CWY - call zfwUsbSubmitBulkUrb(), len = 0x%d\n", len);
+ /* Submit a tx urb */
+ ret = zfLnxUsbSubmitBulkUrb(macp->WlanTxDataUrb[freeTxUrb], macp->udev,
+ USB_WLAN_TX_PIPE, USB_DIR_OUT, macp->txUsbBuf[freeTxUrb],
+ len, zfLnxUsbDataOut_callback, dev);
+ //CWYang(-)
+ //if (ret != 0)
+ // printk("zfwUsbSubmitBulkUrb fail, status: 0x%08x\n", (int)ret);
+
+ /* free packet */
+ //dev_kfree_skb_any(TxData->buf);
+#if ZM_USB_TX_STREAM_MODE == 1
+ for(ii = 0; ii < usbTxAggCnt; ii++)
+ macp->usbCbFunctions.zfcbUsbOutComplete(dev, TxQPool[ii]->buf, 1, TxQPool[ii]->hdr);
+#else
+ macp->usbCbFunctions.zfcbUsbOutComplete(dev, TxData->buf, 1, TxData->hdr);
+#endif
+
+ return ret;
+}
+
+
+
+u32_t zfLnxUsbIn(zdev_t* dev, urb_t *urb, zbuf_t *buf)
+{
+ u32_t ret;
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ /* Submit a rx urb */
+ ret = zfLnxUsbSubmitBulkUrb(urb, macp->udev, USB_WLAN_RX_PIPE,
+ USB_DIR_IN, buf->data, ZM_MAX_RX_BUFFER_SIZE,
+ zfLnxUsbDataIn_callback, dev);
+ //CWYang(-)
+ //if (ret != 0)
+ // printk("zfwUsbSubmitBulkUrb fail, status: 0x%08x\n", (int)ret);
+
+ return ret;
+}
+
+u32_t zfLnxUsbWriteReg(zdev_t* dev, u32_t* cmd, u16_t cmdLen)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+ u32_t ret;
+
+#ifdef ZM_CONFIG_BIG_ENDIAN
+ int ii = 0;
+
+ for(ii=0; ii<(cmdLen>>2); ii++)
+ cmd[ii] = cpu_to_le32(cmd[ii]);
+#endif
+
+ memcpy(macp->regUsbWriteBuf, cmd, cmdLen);
+
+ /* Issue an USB Out transfer */
+ /* Submit a tx urb */
+ ret = zfLnxUsbSubmitIntUrb(macp->RegOutUrb, macp->udev,
+ USB_REG_OUT_PIPE, USB_DIR_OUT, macp->regUsbWriteBuf,
+ cmdLen, zfLnxUsbRegOut_callback, dev, 1);
+
+ return ret;
+}
+
+
+u32_t zfLnxUsbOut(zdev_t* dev, u8_t *hdr, u16_t hdrlen, u8_t *snap, u16_t snapLen,
+ u8_t *tail, u16_t tailLen, zbuf_t *buf, u16_t offset)
+{
+ u32_t ret;
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ /* Check length of tail buffer */
+ //zm_assert((tailLen <= 16));
+
+ /* Enqueue the packet into UsbTxBufQ */
+ if (zfLnxPutUsbTxBuffer(dev, hdr, hdrlen, snap, snapLen, tail, tailLen, buf, offset) == 0xffff)
+ {
+ /* free packet */
+ //printk("CWY - zfwPutUsbTxBuffer Error, free packet\n");
+ //dev_kfree_skb_any(buf);
+ macp->usbCbFunctions.zfcbUsbOutComplete(dev, buf, 0, hdr);
+ return 0xffff;
+ }
+
+ //return 0;
+ //printk("CWY - call zfwUsbSubmitTxData()\n");
+ ret = zfLnxUsbSubmitTxData(dev);
+ return ret;
+}
+
+void zfLnxInitUsbTxQ(zdev_t* dev)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ printk(KERN_ERR "zfwInitUsbTxQ\n");
+
+ /* Zero memory for UsbTxBufQ */
+ memset(macp->UsbTxBufQ, 0, sizeof(UsbTxQ_t) * ZM_MAX_TX_URB_NUM);
+
+ macp->TxBufHead = 0;
+ macp->TxBufTail = 0;
+ macp->TxUrbHead = 0;
+ macp->TxUrbTail = 0;
+ macp->TxUrbCnt = ZM_MAX_TX_URB_NUM;
+}
+
+void zfLnxInitUsbRxQ(zdev_t* dev)
+{
+ u16_t i;
+ zbuf_t *buf;
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ /* Zero memory for UsbRxBufQ */
+ memset(macp->UsbRxBufQ, 0, sizeof(zbuf_t *) * ZM_MAX_RX_URB_NUM);
+
+ macp->RxBufHead = 0;
+
+ for (i = 0; i < ZM_MAX_RX_URB_NUM; i++)
+ {
+ //buf = zfwBufAllocate(dev, ZM_MAX_RX_BUFFER_SIZE);
+ buf = dev_alloc_skb(ZM_MAX_RX_BUFFER_SIZE);
+ macp->UsbRxBufQ[i] = buf;
+ }
+
+ //macp->RxBufTail = ZM_MAX_RX_URB_NUM - 1;
+ macp->RxBufTail = 0;
+
+ /* Submit all Rx urbs */
+ for (i = 0; i < ZM_MAX_RX_URB_NUM; i++)
+ {
+ zfLnxPutUsbRxBuffer(dev, macp->UsbRxBufQ[i]);
+ zfLnxUsbIn(dev, macp->WlanRxDataUrb[i], macp->UsbRxBufQ[i]);
+ }
+}
+
+
+
+u32_t zfLnxUsbSubmitBulkUrb(urb_t *urb, struct usb_device *usb, u16_t epnum, u16_t direction,
+ void *transfer_buffer, int buffer_length, usb_complete_t complete, void *context)
+{
+ u32_t ret;
+
+ if(direction == USB_DIR_OUT)
+ {
+ usb_fill_bulk_urb(urb, usb, usb_sndbulkpipe(usb, epnum),
+ transfer_buffer, buffer_length, complete, context);
+
+ urb->transfer_flags |= URB_ZERO_PACKET;
+ }
+ else
+ {
+ usb_fill_bulk_urb(urb, usb, usb_rcvbulkpipe(usb, epnum),
+ transfer_buffer, buffer_length, complete, context);
+ }
+
+ if (epnum == 4)
+ {
+ if (urb->hcpriv)
+ {
+ //printk("CWY - urb->hcpriv set by unknown reason, reset it\n");
+ //urb->hcpriv = 0;
+ }
+ }
+
+ ret = usb_submit_urb(urb, GFP_ATOMIC);
+ if ((epnum == 4) & (ret != 0))
+ {
+ //printk("CWY - ret = %x\n", ret);
+ }
+ return ret;
+}
+
+u32_t zfLnxUsbSubmitIntUrb(urb_t *urb, struct usb_device *usb, u16_t epnum, u16_t direction,
+ void *transfer_buffer, int buffer_length, usb_complete_t complete, void *context,
+ u32_t interval)
+{
+ u32_t ret;
+
+ if(direction == USB_DIR_OUT)
+ {
+ usb_fill_int_urb(urb, usb, usb_sndbulkpipe(usb, epnum),
+ transfer_buffer, buffer_length, complete, context, interval);
+ }
+ else
+ {
+ usb_fill_int_urb(urb, usb, usb_rcvbulkpipe(usb, epnum),
+ transfer_buffer, buffer_length, complete, context, interval);
+ }
+
+ ret = usb_submit_urb(urb, GFP_ATOMIC);
+
+ return ret;
+}
+
+#ifdef ZM_ENABLE_CENC
+int zfLnxCencSendMsg(struct sock *netlink_sk, u_int8_t *msg, int len)
+{
+#define COMMTYPE_GROUP 8
+#define WAI_K_MSG 0x11
+
+ int ret = -1;
+ int size;
+ unsigned char *old_tail;
+ struct sk_buff *skb;
+ struct nlmsghdr *nlh;
+ char *pos = NULL;
+
+ size = NLMSG_SPACE(len);
+ skb = alloc_skb(size, GFP_ATOMIC);
+
+ if(skb == NULL)
+ {
+ printk("dev_alloc_skb failure \n");
+ goto out;
+ }
+ old_tail = skb->tail;
+
+ /*填写数据报相关信息*/
+ nlh = NLMSG_PUT(skb, 0, 0, WAI_K_MSG, size-sizeof(*nlh));
+ pos = NLMSG_DATA(nlh);
+ memset(pos, 0, len);
+
+ /*传输到用户空间的数据*/
+ memcpy(pos, msg, len);
+ /*计算经过字节对其后的数据实际长度*/
+ nlh->nlmsg_len = skb->tail - old_tail;
+ NETLINK_CB(skb).dst_group = COMMTYPE_GROUP;
+ netlink_broadcast(netlink_sk, skb, 0, COMMTYPE_GROUP, GFP_ATOMIC);
+ ret = 0;
+out:
+ return ret;
+nlmsg_failure: /*NLMSG_PUT 失败,则撤销套接字缓存*/
+ if(skb)
+ kfree_skb(skb);
+ goto out;
+
+#undef COMMTYPE_GROUP
+#undef WAI_K_MSG
+}
+#endif //ZM_ENABLE_CENC
+
+/* Simply return 0xffff if VAP function is not supported */
+u16_t zfLnxGetVapId(zdev_t* dev)
+{
+ u16_t i;
+
+ for (i=0; i<ZM_VAP_PORT_NUMBER; i++)
+ {
+ if (vap[i].dev == dev)
+ {
+ return i;
+ }
+ }
+ return 0xffff;
+}
+
+u32_t zfwReadReg(zdev_t* dev, u32_t offset)
+{
+ return 0;
+}
+
+#ifndef INIT_WORK
+#define work_struct tq_struct
+
+#define schedule_work(a) schedule_task(a)
+
+#define flush_scheduled_work flush_scheduled_tasks
+#define INIT_WORK(_wq, _routine, _data) INIT_TQUEUE(_wq, _routine, _data)
+#define PREPARE_WORK(_wq, _routine, _data) PREPARE_TQUEUE(_wq, _routine, _data)
+#endif
+
+#define KEVENT_WATCHDOG 0x00000001
+
+u32_t smp_kevent_Lock = 0;
+
+void kevent(struct work_struct *work)
+{
+ struct usbdrv_private *macp =
+ container_of(work, struct usbdrv_private, kevent);
+ zdev_t *dev = macp->device;
+
+ if (macp == NULL)
+ {
+ return;
+ }
+
+ if (test_and_set_bit(0, (void *)&smp_kevent_Lock))
+ {
+ //schedule_work(&macp->kevent);
+ return;
+ }
+
+ down(&macp->ioctl_sem);
+
+ if (test_and_clear_bit(KEVENT_WATCHDOG, &macp->kevent_flags))
+ {
+ extern u16_t zfHpStartRecv(zdev_t *dev);
+ //zfiHwWatchDogReinit(dev);
+ printk(("\n ************ Hw watchDog occur!! ************** \n"));
+ zfiWlanSuspend(dev);
+ zfiWlanResume(dev,0);
+ zfHpStartRecv(dev);
+ }
+
+ clear_bit(0, (void *)&smp_kevent_Lock);
+ up(&macp->ioctl_sem);
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfLnxCreateThread */
+/* Create a Thread */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* */
+/* OUTPUTS */
+/* always 0 */
+/* */
+/* AUTHOR */
+/* Yuan-Gu Wei Atheros Communications, INC. 2007.3 */
+/* */
+/************************************************************************/
+u8_t zfLnxCreateThread(zdev_t *dev)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ /* Create Mutex and keventd */
+ INIT_WORK(&macp->kevent, kevent);
+ init_MUTEX(&macp->ioctl_sem);
+
+ return 0;
+}
+
+/************************************************************************/
+/* */
+/* FUNCTION DESCRIPTION zfLnxSignalThread */
+/* Signal Thread with Flag */
+/* */
+/* INPUTS */
+/* dev : device pointer */
+/* flag : signal thread flag */
+/* */
+/* OUTPUTS */
+/* none */
+/* */
+/* AUTHOR */
+/* Yuan-Gu Wei Atheros Communications, INC. 2007.3 */
+/* */
+/************************************************************************/
+void zfLnxSignalThread(zdev_t *dev, int flag)
+{
+ struct usbdrv_private *macp = dev->ml_priv;
+
+ if (macp == NULL)
+ {
+ printk("macp is NULL\n");
+ return;
+ }
+
+ if (0 && macp->kevent_ready != 1)
+ {
+ printk("Kevent not ready\n");
+ return;
+ }
+
+ set_bit(flag, &macp->kevent_flags);
+
+ if (!schedule_work(&macp->kevent))
+ {
+ //Fails is Normal
+ //printk(KERN_ERR "schedule_task failed, flag = %x\n", flag);
+ }
+}
+
+/* Notify wrapper todo redownload firmware and reinit procedure when */
+/* hardware watchdog occur : zfiHwWatchDogReinit() */
+void zfLnxWatchDogNotify(zdev_t* dev)
+{
+ zfLnxSignalThread(dev, KEVENT_WATCHDOG);
+}
+
+/* Query Durantion of Active Scan */
+void zfwGetActiveScanDur(zdev_t* dev, u8_t* Dur)
+{
+ *Dur = 30; // default 30 ms
+}
+
+void zfwGetShowZeroLengthSSID(zdev_t* dev, u8_t* Dur)
+{
+ *Dur = 0;
+}
+
diff --git a/drivers/staging/otus/zdcompat.h b/drivers/staging/otus/zdcompat.h
new file mode 100644
index 00000000000..8acf400fbc0
--- /dev/null
+++ b/drivers/staging/otus/zdcompat.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : zdcompat.h */
+/* */
+/* Abstract */
+/* This module contains function defintion for compatibility. */
+/* */
+/* NOTES */
+/* Platform dependent. */
+/* */
+/************************************************************************/
+
+#ifndef _ZDCOMPAT_H
+#define _ZDCOMPAT_H
+
+
+#ifndef DECLARE_TASKLET
+#define tasklet_schedule(a) schedule_task(a)
+#endif
+
+#undef netdevice_t
+typedef struct net_device netdevice_t;
+
+#ifdef WIRELESS_EXT
+#if (WIRELESS_EXT < 13)
+struct iw_request_info
+{
+ __u16 cmd; /* Wireless Extension command */
+ __u16 flags; /* More to come ;-) */
+};
+#endif
+#endif
+
+#ifndef IRQ_NONE
+typedef void irqreturn_t;
+#define IRQ_NONE
+#define IRQ_HANDLED
+#define IRQ_RETVAL(x)
+#endif
+
+#ifndef in_atomic
+#define in_atomic() 0
+#endif
+
+#define USB_QUEUE_BULK 0
+
+
+#endif
diff --git a/drivers/staging/otus/zdusb.c b/drivers/staging/otus/zdusb.c
new file mode 100644
index 00000000000..78f1d2224fa
--- /dev/null
+++ b/drivers/staging/otus/zdusb.c
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : zdusb.c */
+/* */
+/* Abstract */
+/* This module contains plug and play handling for USB device driver*/
+/* */
+/* NOTES */
+/* Platform dependent. */
+/* */
+/************************************************************************/
+
+#ifdef MODVERSIONS
+#include <linux/modversions.h>
+#endif
+
+#include <linux/module.h>
+#include <linux/usb.h>
+
+#include "usbdrv.h"
+#include "zdusb.h"
+
+int zfLnxAllocAllUrbs(struct usbdrv_private *macp);
+void zfLnxFreeAllUrbs(struct usbdrv_private *macp);
+void zfLnxUnlinkAllUrbs(struct usbdrv_private *macp);
+
+MODULE_AUTHOR("Atheros Communications");
+MODULE_DESCRIPTION("Atheros 802.11n Wireless LAN adapter");
+MODULE_LICENSE("Dual BSD/GPL");
+
+static const char driver_name[] = "Otus";
+
+/* table of devices that work with this driver */
+static struct usb_device_id zd1221_ids [] = {
+ { USB_DEVICE(VENDOR_ATHR, PRODUCT_AR9170) },
+ { USB_DEVICE(VENDOR_DLINK, PRODUCT_DWA160A) },
+ { USB_DEVICE(0x0846, 0x9010) },
+ { } /* Terminating entry */
+};
+
+MODULE_DEVICE_TABLE(usb, zd1221_ids);
+
+extern u8_t zfLnxInitSetup(struct net_device *dev, struct usbdrv_private *macp);
+extern int usbdrv_close(struct net_device *dev);
+extern u8_t zfLnxClearStructs(struct net_device *dev);
+extern int zfWdsClose(struct net_device *dev);
+extern int zfUnregisterWdsDev(struct net_device* parentDev, u16_t wdsId);
+extern int zfLnxVapClose(struct net_device *dev);
+extern int zfLnxUnregisterVapDev(struct net_device* parentDev, u16_t vapId);
+
+/* WDS */
+extern struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER];
+
+/* VAP */
+extern struct zsVapStruct vap[ZM_VAP_PORT_NUMBER];
+
+static int zfLnxProbe(struct usb_interface *interface,
+ const struct usb_device_id *id)
+{
+ struct usb_device *dev = interface_to_usbdev(interface);
+
+ struct net_device *net = NULL;
+ struct usbdrv_private *macp = NULL;
+ int vendor_id, product_id;
+ int result = 0;
+
+ usb_get_dev(dev);
+
+ vendor_id = dev->descriptor.idVendor;
+ product_id = dev->descriptor.idProduct;
+
+#ifdef HMAC_DEBUG
+ printk(KERN_NOTICE "vendor_id = %04x\n", vendor_id);
+ printk(KERN_NOTICE "product_id = %04x\n", product_id);
+
+ if (dev->speed == USB_SPEED_HIGH)
+ printk(KERN_NOTICE "USB 2.0 Host\n");
+ else
+ printk(KERN_NOTICE "USB 1.1 Host\n");
+#endif
+
+ if (!(macp = kmalloc(sizeof(struct usbdrv_private), GFP_KERNEL)))
+ {
+ printk(KERN_ERR "out of memory allocating device structure\n");
+ result = -ENOMEM;
+ goto fail;
+ }
+
+ /* Zero the memory */
+ memset(macp, 0, sizeof(struct usbdrv_private));
+
+ net = alloc_etherdev(0);
+
+ if (net == NULL)
+ {
+ printk(KERN_ERR "zfLnxProbe: Not able to alloc etherdev struct\n");
+ result = -ENOMEM;
+ goto fail1;
+ }
+
+ strcpy(net->name, "ath%d");
+
+ net->ml_priv = macp; //kernel 2.6
+ macp->udev = dev;
+ macp->device = net;
+
+ /* set up the endpoint information */
+ /* check out the endpoints */
+ macp->interface = interface;
+
+ //init_waitqueue_head(&macp->regSet_wait);
+ //init_waitqueue_head(&macp->iorwRsp_wait);
+ //init_waitqueue_head(&macp->term_wait);
+
+ if (!zfLnxAllocAllUrbs(macp))
+ {
+ result = -ENOMEM;
+ goto fail2;
+ }
+
+ if (!zfLnxInitSetup(net, macp))
+ {
+ result = -EIO;
+ goto fail3;
+ }
+ else
+ {
+ usb_set_intfdata(interface, macp);
+ SET_NETDEV_DEV(net, &interface->dev);
+
+ if (register_netdev(net) != 0)
+ {
+ usb_set_intfdata(interface, NULL);
+ goto fail3;
+ }
+ }
+
+ netif_carrier_off(net);
+ goto done;
+
+fail3:
+ zfLnxFreeAllUrbs(macp);
+fail2:
+ free_netdev(net); //kernel 2.6
+fail1:
+ kfree(macp);
+
+fail:
+ usb_put_dev(dev);
+ macp = NULL;
+
+done:
+ return result;
+}
+
+static void zfLnxDisconnect(struct usb_interface *interface)
+{
+ struct usbdrv_private *macp = (struct usbdrv_private *) usb_get_intfdata(interface);
+
+ printk(KERN_DEBUG "zfLnxDisconnect\n");
+
+ if (!macp)
+ {
+ printk(KERN_ERR "unregistering non-existant device\n");
+ return;
+ }
+
+ if (macp->driver_isolated)
+ {
+ if (macp->device->flags & IFF_UP)
+ usbdrv_close(macp->device);
+ }
+
+#if 0
+ /* Close WDS */
+ //zfWdsClose(wds[0].dev);
+ /* Unregister WDS */
+ //zfUnregisterWdsDev(macp->device, 0);
+
+ /* Close VAP */
+ zfLnxVapClose(vap[0].dev);
+ /* Unregister VAP */
+ zfLnxUnregisterVapDev(macp->device, 0);
+#endif
+
+ zfLnxClearStructs(macp->device);
+
+ unregister_netdev(macp->device);
+
+ usb_put_dev(interface_to_usbdev(interface));
+
+ //printk(KERN_ERR "3. zfLnxUnlinkAllUrbs\n");
+ //zfLnxUnlinkAllUrbs(macp);
+
+ /* Free network interface */
+ free_netdev(macp->device);
+
+ zfLnxFreeAllUrbs(macp);
+ //zfLnxClearStructs(macp->device);
+ kfree(macp);
+ macp = NULL;
+
+ usb_set_intfdata(interface, NULL);
+}
+
+static struct usb_driver zd1221_driver = {
+ .name = driver_name,
+ .probe = zfLnxProbe,
+ .disconnect = zfLnxDisconnect,
+ .id_table = zd1221_ids,
+};
+
+int __init zfLnxIinit(void)
+{
+ printk(KERN_NOTICE "%s - version %s\n", DRIVER_NAME, VERSIONID);
+ return usb_register(&zd1221_driver);
+}
+
+void __exit zfLnxExit(void)
+{
+ usb_deregister(&zd1221_driver);
+}
+
+module_init(zfLnxIinit);
+module_exit(zfLnxExit);
diff --git a/drivers/staging/otus/zdusb.h b/drivers/staging/otus/zdusb.h
new file mode 100644
index 00000000000..656dc212ade
--- /dev/null
+++ b/drivers/staging/otus/zdusb.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2007-2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* */
+/* Module Name : zdusb.h */
+/* */
+/* Abstract */
+/* This module contains definitions for USB device driver */
+/* */
+/* NOTES */
+/* Platform dependent. */
+/* */
+/************************************************************************/
+
+#ifndef _ZDUSB_H
+#define _ZDUSB_H
+
+#ifndef DRIVER_NAME
+#define DRIVER_NAME "arusb"
+#endif
+
+#define VERSIONID "0.0.0.999"
+
+/* Define these values to match your device */
+#define VENDOR_ATHR 0x0CF3 //Atheros
+#define PRODUCT_AR9170 0x9170
+
+#define VENDOR_DLINK 0x07D1 //Dlink
+#define PRODUCT_DWA160A 0x3C10
+
+#endif