示例#1
0
void kevent(struct work_struct *work)
{
    struct usbdrv_private *macp =
               container_of(work, struct usbdrv_private, kevent);
    zdev_t *dev = macp->device;

    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);
}
示例#2
0
/* 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;
}