⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zddebug.c

📁 ZD1211 source code, based on linux 2.44 or linux 2.
💻 C
📖 第 1 页 / 共 4 页
字号:
                                                printk(" -------Call zd_CmdDeauth, reason:%d\n",zdparm->u.mlme.reason_code);
                        if(zd_CmdDeauth((MacAddr_t *) zdparm->sta_addr, zdparm->u.mlme.reason_code) == FALSE)
                            WPADEBUG("Can't deauthencate STA: %s\n", mac_addr);
                        else
                            WPADEBUG("Deauthenticate STA: %s with reason code: %d\n", mac_addr, zdparm->u.mlme.reason_code);
                        break;

                    case MLME_STA_DISASSOC:
                        if(zd_CmdDisasoc((MacAddr_t *) zdparm->sta_addr, zdparm->u.mlme.reason_code) == FALSE)
                            WPADEBUG("Can't disassociate STA: %s\n", mac_addr);
                        else
                            WPADEBUG("Disassociate STA: %s with reason code: %d\n", mac_addr, zdparm->u.mlme.reason_code);
                        break;

                    default:
                        WPADEBUG("MLME command: 0x%04x not support\n", zdparm->u.mlme.cmd);
                        break;
                }


				break;

		case ZD_CMD_SCAN_REQ:
				WPADEBUG("zd1205_wpa_ioctl: ZD_CMD_SCAN_REQ\n");
				break;

		case ZD_CMD_SET_GENERIC_ELEMENT:
				WPADEBUG("zd1205_wpa_ioctl: ZD_CMD_SET_GENERIC_ELEMENT\n");
				
				/* Copy the WPA IE */
				pSetting->WPAIeLen = zdparm->u.generic_elem.len;
				memcpy(&pSetting->WPAIe, zdparm->u.generic_elem.data, pSetting->WPAIeLen);

				{
					int ii;
					
					WPADEBUG("pSetting->WPAIeLen: %d\n", pSetting->WPAIeLen);

					/* DUMP WPA IE */
					for(ii = 0; ii < pSetting->WPAIeLen;) {
						WPADEBUG("0x%02x ", pSetting->WPAIe[ii]);
						
						if((++ii % 16) == 0)
							WPADEBUG("\n");
					}
					WPADEBUG("\n");
				}
			#ifdef HOSTAPD_SUPPORT
#if ZDCONF_AP_SUPPORT == 1
				if (pSetting->BssType == AP_BSS)
				{// Update Beacon FIFO in the next TBTT.
					memcpy(&mWPAIe, pSetting->WPAIe, pSetting->WPAIeLen);
					WPADEBUG("Copy WPA IE into mWPAIe\n");
				}
#endif
			#endif

				break;

		default:
				WPADEBUG("zd1205_wpa_ioctl: default\n");
				ret = -EINVAL;
				break;
	}

	return ret;
}
#if PRODUCTION == 1
int zd1205_cont_tx(struct zd1205_private *macp, u8 rate) 
{
			void *reg = dot11Obj.reg;
                    printk(KERN_ERR "ZDContinuousTx\n");
/*
                    if (le32_to_cpu(pZDRD->ZDRdLength) < sizeof(ZD_RD_STRUCT))
                    {
                        pZDRD->ZDRdLength = cpu_to_le32(sizeof(ZD_RD_STRUCT));
                        *BytesNeeded = sizeof(ZD_RD_STRUCT);
                        *BytesRead = 0;
                        Status = NDIS_STATUS_BUFFER_TOO_SHORT;
                        break;
                    }
*/

//                    macp->bContinueTxMode = le32_to_cpu(pZDRD->Buffer[0]);
//                    macp->bContinueTx = le32_to_cpu(pZDRD->Buffer[1]);
                    macp->bContinueTx = rate>0xB ? 0:1;

/* Use the Fixed Rate instead of LastSentTxRate */
//macp->LastZDContinuousTxRate = macp->cardSetting.LastSentTxRate;
                    macp->LastZDContinuousTxRate = rate;//macp->cardSetting.FixedRate;

                                        if ((macp->RF_Mode == AL7230B_RF) && (mMacMode != PURE_A_MODE)) {
                                                if (macp->LastZDContinuousTxRate > 3) {
                                                        HW_Set_IF_Synthesizer(&dot11Obj, 0x00093c);
                                                }
                                                else if (macp->LastZDContinuousTxRate <= 3) {
                                                        HW_Set_IF_Synthesizer(&dot11Obj, 0x000abc);
                                                }
                                        }
#ifdef ZDCONF_BANDEDGE_ADJUST
//                                      if((macp->RF_Mode == AL7230B_RF) &&
//                                              (mMacMode == PURE_A_MODE) &&
//                                              (macp->LastZDContinuousTxRate  == 4) &&
//                                              (macp->PHY_36M_Setpoint_Flag == 0)
//                                      )
//                                              macp->PHY_36M_Setpoint_Flag = 1;
//                                  else if((macp->RF_Mode == AL7230B_RF) &&
//                                              (mMacMode == PURE_A_MODE) &&
//                                              (macp->LastZDContinuousTxRate != 4) &&
//                                              (macp->PHY_36M_Setpoint_Flag == 2)
//                                      )
//                                              macp->PHY_36M_Setpoint_Flag = 3;

                        if(dot11Obj.HWFeature & BIT_21) { //band edge adjust for calibration, the production test tool must do integration value /set point compensation for other channels which are not calibrated
				if( (macp->RF_Mode == AL7230B_RF) &&
						((4 <= macp->LastZDContinuousTxRate) && (macp->LastZDContinuousTxRate <= 9)) &&
						(mMacMode != PURE_A_MODE) &&
						(macp->cardSetting.Channel == 1 || macp->cardSetting.Channel == 11)
				  )
				{
					if(macp->cardSetting.Channel == 1)
						HW_Set_IF_Synthesizer(&dot11Obj, 0x000abc);
					LockPhyReg(&dot11Obj);
					dot11Obj.SetReg(dot11Obj.reg, ZD_CR128, 0x10);
					dot11Obj.SetReg(dot11Obj.reg, ZD_CR129, 0x10);
					UnLockPhyReg(&dot11Obj);
				}
				else if((macp->RF_Mode == AL7230B_RF) &&
						(macp->LastZDContinuousTxRate > 3) &&
						(mMacMode != PURE_A_MODE))
				{
					if((macp->LastZDContinuousTxRate > 9) ||
							(macp->cardSetting.Channel != 1 &&
							 macp->cardSetting.Channel != 11))
					{
						if(macp->cardSetting.Channel == 1)
							HW_Set_IF_Synthesizer(&dot11Obj, 0x00093c);
						LockPhyReg(&dot11Obj);
						dot11Obj.SetReg(&dot11Obj.reg, ZD_CR128, 0x14);
						dot11Obj.SetReg(&dot11Obj, ZD_CR129, 0x12);
						UnLockPhyReg(&dot11Obj);
					}
				}
				else if((macp->RF_Mode == AL7230B_RF) &&
						(macp->LastZDContinuousTxRate <=3) &&
						(mMacMode != PURE_A_MODE))
				{
					LockPhyReg(&dot11Obj);
					dot11Obj.SetReg(&dot11Obj.reg, ZD_CR128, 0x14);
					dot11Obj.SetReg(&dot11Obj, ZD_CR129, 0x12);
					UnLockPhyReg(&dot11Obj);
				}
			}

#elif !defined(ZDCONF_BANDEDGE_ADJUST)
#error "Undefined ZDCONF_BANDEDGE_ADJUST"
#endif
			// Roger 2004-11-10 , Set for Dr.Wang request , set 0x0001c4 when CCK mode with AL2230
#ifdef ZDCONF_RF_AL2230_SUPPORT
			if (dot11Obj.rfMode == AL2230_RF || dot11Obj.rfMode == AL2230S_RF)
			{
				//if (macp->cardSetting.LastSentTxRate > 3) {
				if (macp->LastZDContinuousTxRate > 3)
				{
					HW_Set_IF_Synthesizer(&dot11Obj, 0x0005a4);
				}
				else if (macp->LastZDContinuousTxRate <= 3)
				{
					HW_Set_IF_Synthesizer(&dot11Obj, 0x0001c4);
				}
			}
#endif

                    printk("ZDContinuousTx TxMode=%d TxStart=%d TxRate=0x%x\r\n",
                        macp->bContinueTxMode,
                        macp->bContinueTx,
                        macp->LastZDContinuousTxRate);

// Start
                    //if(le32_to_cpu(pZDRD->Buffer[1]) == ContTx_Start)
                    if(rate <= RATE_54M)
                    {
                        U8   tmpChr = 0;
                        U16    RateTmp= 0;
                        U32 tmpvalue;
                        U32   nLoop;
                        LockPhyReg(&dot11Obj);
                        dot11Obj.SetReg(reg, ZD1205_CR2, 0x3F);
                        dot11Obj.SetReg(reg, ZD1205_CR138, 0x28);
                        dot11Obj.SetReg(reg, ZD1205_CR33, 0x20);
// Query CR60 until change to 0x04
                        nLoop = 20;
                        while(nLoop--)
                        {
                            dot11Obj.DelayUs(10*1000);// sleep 10ms
                            tmpvalue = dot11Obj.GetReg(reg, ZD1205_CR60);

                            if(tmpvalue == 0x04)
                                break;
                        }
                        if(nLoop == 0) printk("nLoop count down to zero. But it still fails\n");

                        UnLockPhyReg(&dot11Obj);
                        //switch(le32_to_cpu(pZDRD->Buffer[0]))
			            if(1)
                        {
                            //case ContTx_Normal:   // Normal continous transmit

                                printk("Start ContTx_Normal\n");

                                macp->bContinueTx = 1;
                                LockPhyReg(&dot11Obj);
                                macp->PHYTestTimer = 0;
//ZD1205_WRITE_REGISTER(Adapter,CR122, 0xFF);  2004/10/22 mark
                                UnLockPhyReg(&dot11Obj);

                                LockPhyReg(&dot11Obj);
/* In order to avoid the uninitial length problem,
   force to set length to 0x20.
 */
                                dot11Obj.SetReg(reg, ZD1205_CR134, 0x20);

                                switch (macp->LastZDContinuousTxRate)
                                {
                                    case 4:       //6M
                                        RateTmp = 0xB;
                                        break;
                                    case 5:       //9M
                                        RateTmp = 0xF;
                                        break;
                                    case 6:       //12M
                                        RateTmp = 0xA;
                                        break;
                                    case 7:       //18M
                                        RateTmp = 0xE;
                                        break;
                                    case 8:       //24M
                                        RateTmp = 0x9;
                                        break;
                                    case 9:       //36M
                                        RateTmp = 0xD;
                                        break;

                                    case 0xA:     //48M
                                        RateTmp = 0x8;
                                        break;

                                    case 0xB:     //54M
                                        RateTmp = 0xC;
                                        break;

                                    default:
                                        RateTmp = 0;
                                        break;
                                }

                                printk("RateTmp=0x%08x\n", RateTmp);

                                if (RateTmp)
                                {
                                    dot11Obj.SetReg(reg, ZD1205_CR132, RateTmp);

//AcquireCtrOfPhyReg(Adapter);
                                    tmpvalue = dot11Obj.GetReg(reg, ZD1205_CR159);
                                    tmpvalue &= ~(BIT_0 + BIT_1 );
                                    tmpvalue |= BIT_2;
                                    dot11Obj.SetReg(reg, ZD1205_CR159, tmpvalue);

                                    UnLockPhyReg(&dot11Obj);

                                    dot11Obj.SetReg(reg, 0x644, 7);

                                    tmpvalue = dot11Obj.GetReg(reg, 0x648);
                                    tmpvalue &= ~BIT_0;
                                    dot11Obj.SetReg(reg, 0x648, tmpvalue);
                                    printk("OFDM type\n");
                                    return 0;
                                }
                             else
                                printk("CCK type\n");
                                tmpChr = macp->LastZDContinuousTxRate;
//                                printk("tmpChr=0x%x\n", tmpChr);

#if 0
                                if (macp->preambleMode == 1)
                                    macp->cardSetting.PreambleType = 0x00;
                                else if (macp->preambleMode == 2)
                                    macp->cardSetting.PreambleType = 0x20;
#endif

                                if (macp->cardSetting.PreambleType == SHORT_PREAMBLE)
                                {
// short premable
                                    tmpChr |= BIT_5;
                                }
                                else
                                {
// long premable
                                    tmpChr &= ~BIT_5;
                                }

                                if (macp->RegionCode == 0x10)
                                    tmpChr &= ~BIT_6;//USA
                                if (macp->RegionCode == 0x40)
                                    tmpChr |= BIT_6;//japan

                                dot11Obj.SetReg(reg, ZD1205_CR5, tmpChr);
                                UnLockPhyReg(&dot11Obj);

                                dot11Obj.SetReg(reg, 0x644, 3);
                             //   break;

                            //default:
                            //    printk("Continuous Tx mode: %d not support\n", pZDRD->Buffer[0]);
                            //    break;
                        }
                    }
                    else
                    {
                        U32 tmpvalue;

// Roger 2004-11-10 , Set for Dr.Wang request , set 0x0001c4 when CCK mode with AL2230
#ifdef ZDCONF_RF_AL2230_SUPPORT
                        if (dot11Obj.rfMode == AL2230_RF || dot11Obj.rfMode == AL2230S_RF)
                        {
                            HW_Set_IF_Synthesizer(&dot11Obj, 0x0005a4);
                        }
#endif

                        LockPhyReg(&dot11Obj);
                        dot11Obj.SetReg(reg, ZD1205_CR2, 0x26);
                        dot11Obj.SetReg(reg, ZD1205_CR138, 0xA8);
                        dot11Obj.SetReg(reg, ZD1205_CR33, 0x08);
                        UnLockPhyReg(&dot11Obj);
                        //switch(pZDRD->Buffer[0])
			            if(1)
                        {
                            //case ContTx_Normal:   // Normal continous transmit
                                printk("Stop Normal Continuous Transmit\n");

                                macp->bContinueTx = 0;
                                LockPhyReg(&dot11Obj);
                                macp->PHYTestTimer = 30;
//                                              ZD1205_WRITE_REGISTER(Adapter,CR122, 0x0);
                                UnLockPhyReg(&dot11Obj);

                                if (macp->LastZDContinuousTxRate >= 4)
                                {
                                    LockPhyReg(&dot11Obj);
                                    tmpvalue = dot11Obj.GetReg(reg, ZD1205_CR159);
                                    tmpvalue &= ~(BIT_0 + BIT_1 + BIT_2 );
                                    dot11Obj.SetReg(reg, ZD1205_CR159, tmpvalue);
                                    UnLockPhyReg(&dot11Obj);

                                    dot11Obj.SetReg(reg, 0x644, 0);

                                    tmpvalue = dot11Obj.GetReg(reg, 0x648);
                                    tmpvalue |= BIT_0;
                                    dot11Obj.SetReg(reg, 0x648, tmpvalue);

                                }
                                else
                                {

                                    dot11Obj.SetReg(reg, 0x644, 0);

                                    tmpvalue = dot11Obj.GetReg(reg, 0x648);
                                    tmpvalue |= BIT_0;
                                    dot11Obj.SetReg(reg, 0x648, tmpvalue);
                                }

                             //   break;
                        }

//dot11Obj.SetReg(reg, ZD_PS_Ctrl, 0x1);
//Roger 2004-11-16 SoftwareReset here to solve RX fail after TxContinue problem
                        zd1205_device_reset(macp);
                    //}
            }

}
#endif

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -