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

📄 cal_com.c

📁 Atheros AP Test with Agilent N4010A source code
💻 C
📖 第 1 页 / 共 5 页
字号:
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%d", &testVal)) {
				uiPrintf("Unable to read the 11g_TEST_TARGET_POWER from %s\n", calsetupFileName);
			}
			else {
				CalSetup.testTargetPowerControl[MODE_11g] = (testVal) ? TRUE : FALSE;
			}
		}
		else if(strnicmp("TARGET_POWER_TOLERANCE_UPPER", pLine, strlen("TARGET_POWER_TOLERANCE_UPPER")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%lf", &CalSetup.targetPowerToleranceUpper)) {
				uiPrintf("Unable to read the TARGET_POWER_TOLERANCE_UPPER from %s\n", calsetupFileName);
			}
		}
		else if(strnicmp("TARGET_POWER_TOLERANCE_LOWER", pLine, strlen("TARGET_POWER_TOLERANCE_LOWER")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%lf", &CalSetup.targetPowerToleranceLower)) {
				uiPrintf("Unable to read the TARGET_POWER_TOLERANCE_LOWER from %s\n", calsetupFileName);
			}
		}

// 11b test setup
		else if(strnicmp("11b_TEST_SPEC_MASK", pLine, strlen("11b_TEST_SPEC_MASK")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%d", &testVal)) {
				uiPrintf("Unable to read the 11b_TEST_SPEC_MASK from %s\n", calsetupFileName);
			}
			else {
				CalSetup.testSpecMask_2p4[MODE_11b] = (testVal) ? TRUE : FALSE;
			}
		}
		else if(strnicmp("11b_TEST_TXPER", pLine, strlen("11b_TEST_TXPER")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%d", &testVal)) {
				uiPrintf("Unable to read the 11b_TEST_TXPER from %s\n", calsetupFileName);
			}
			else {
				CalSetup.testTXPER_2p4[MODE_11b] = (testVal) ? TRUE : FALSE;
			}
		}
		else if(strnicmp("11b_TEST_RXSEN", pLine, strlen("11b_TEST_RXSEN")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%d", &testVal)) {
				uiPrintf("Unable to read the 11b_TEST_RXSEN from %s\n", calsetupFileName);
			}
			else {
				CalSetup.testRXSEN_2p4[MODE_11b] = (testVal) ? TRUE : FALSE;
			}
		}

// ofdm@2p4 test setup
		else if(strnicmp("11g_TEST_SPEC_MASK", pLine, strlen("11g_TEST_SPEC_MASK")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%d", &testVal)) {
				uiPrintf("Unable to read the 11g_TEST_SPEC_MASK from %s\n", calsetupFileName);
			}
			else {
				CalSetup.testSpecMask_2p4[MODE_11g] = (testVal) ? TRUE : FALSE;
			}
		}
		else if(strnicmp("11g_TEST_TXPER", pLine, strlen("11g_TEST_TXPER")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%d", &testVal)) {
				uiPrintf("Unable to read the 11g_TEST_TXPER from %s\n", calsetupFileName);
			}
			else {
				CalSetup.testTXPER_2p4[MODE_11g] = (testVal) ? TRUE : FALSE;
			}
		}
		else if(strnicmp("11g_TEST_RXSEN", pLine, strlen("11g_TEST_RXSEN")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%d", &testVal)) {
				uiPrintf("Unable to read the 11g_TEST_RXSEN from %s\n", calsetupFileName);
			}
			else {
				CalSetup.testRXSEN_2p4[MODE_11g] = (testVal) ? TRUE : FALSE;
			}
		}
		else if(strnicmp("SUB_VENDOR_ID", pLine, strlen("SUB_VENDOR_ID")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%x", &CalSetup.subVendorID)) {
				uiPrintf("Unable to read the SUB_VENDOR_ID from %s\n", calsetupFileName);
			}
		}
		else if(strnicmp("GOLDEN_PPM", pLine, strlen("GOLDEN_PPM")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%ld", &CalSetup.goldenPPM)) {
				uiPrintf("Unable to read the GOLDEN_PPM from %s\n", calsetupFileName);
			}
		}
//snoop: take it out. debug only.
		else if(strnicmp("VERIFY_DATA_PACKET_LEN", pLine, strlen("VERIFY_DATA_PACKET_LEN")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%d", &VERIFY_DATA_PACKET_LEN)) {
				uiPrintf("Unable to read the VERIFY_DATA_PACKET_LEN from %s\n", calsetupFileName);
			}
		}
		else if(strnicmp("GOLDEN_TX_POWER", pLine, strlen("GOLDEN_TX_POWER")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%lf", &CalSetup.goldenTXPower)) {
				uiPrintf("Unable to read the GOLDEN_TX_POWER from %s\n", calsetupFileName);
			}
		}
		else if(strnicmp("11b_GOLDEN_TX_POWER", pLine, strlen("11b_GOLDEN_TX_POWER")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%lf", &CalSetup.goldenTXPower_2p4[MODE_11b])) {
				uiPrintf("Unable to read the 11b_GOLDEN_TX_POWER from %s\n", calsetupFileName);
			}
		}
		else if(strnicmp("11g_GOLDEN_TX_POWER", pLine, strlen("11g_GOLDEN_TX_POWER")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%lf", &CalSetup.goldenTXPower_2p4[MODE_11g])) {
				uiPrintf("Unable to read the 11g_GOLDEN_TX_POWER from %s\n", calsetupFileName);
			}
		}
		else if((strnicmp("PM_MODEL", pLine, strlen("PM_MODEL")) == 0) &&
				((pLine[strlen("PM_MODEL")] == ' ') ||
				 (pLine[strlen("PM_MODEL")] == '\t') ) ){

				pLine = strchr(pLine, '=');
				pLine = strtok(pLine, delimiters);
				pLine = strtok(pLine," ;#");
				if(!sscanf(pLine, "%d", &testVal)) {
				uiPrintf("Unable to read the PM_MODEL from %s\n", calsetupFileName);
				}
				switch (testVal) {
				case 1:
					CalSetup.pmModel = PM_436A;
					break;
				case 2:
					CalSetup.pmModel= PM_E4416A;
					break;
				case 3:
					CalSetup.pmModel = PM_4531;
					break;
				case 4:
					CalSetup.pmModel = NRP_Z11;
					break;
				default:
					uiPrintf("ERROR parsing PM_MODEL:\nIllegal value %d. Choose from 1, 2 or 3\n", testVal);
					uiPrintf("Using the default power meter model HP436A\n");
					CalSetup.pmModel = PM_436A;
				}
		}
		else if((strnicmp("ATTEN_MODEL", pLine, strlen("ATTEN_MODEL")) == 0) &&
				((pLine[strlen("ATTEN_MODEL")] == ' ') ||
				 (pLine[strlen("ATTEN_MODEL")] == '\t') ) ){

				pLine = strchr(pLine, '=');
				pLine = strtok(pLine, delimiters);
				pLine = strtok(pLine," ;#");
				if(!sscanf(pLine, "%d", &testVal)) {
				uiPrintf("Unable to read the ATTEN_MODEL from %s\n", calsetupFileName);
				}
				switch (testVal) {
				case 0:
					CalSetup.attModel = ATT_11713A;
					break;
				case 1:
					CalSetup.attModel= ATT_11713A_110;
					break;
				default:
					uiPrintf("ERROR parsing ATTEN_MODEL:\nIllegal value %d. Choose from 0 or 1\n", testVal);
					uiPrintf("Using the default attenuator model ATT_11713A\n");
					CalSetup.pmModel = ATT_11713A;
				}
//				printf("#################SNOOP: attenModel in calcommon = %d\n", CalSetup.attModel);
		}
//** the following remarked by ccshiang
		/*
		else if(strnicmp("PM_GPIB_ADDR", pLine, strlen("PM_GPIB_ADDR")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%d", &CalSetup.pmGPIBaddr)) {
				uiPrintf("Unable to read the PM_GPIB_ADDR from %s\n", calsetupFileName);
			}
		}
		*/
//** the above remarked by ccshiang
		else if((strnicmp("SA_MODEL", pLine, strlen("SA_MODEL")) == 0) &&
				((pLine[strlen("SA_MODEL")] == ' ') ||
				 (pLine[strlen("SA_MODEL")] == '\t') ) ){

				pLine = strchr(pLine, '=');
				pLine = strtok(pLine, delimiters);
				pLine = strtok(pLine," ;#");
				if(!sscanf(pLine, "%d", &testVal)) {
				uiPrintf("Unable to read the SA_MODEL from %s\n", calsetupFileName);
				}
				switch (testVal) {
				case 1:
					CalSetup.saModel= SPA_E4404B;
					break;
				case 2:
					CalSetup.saModel= SPA_8595E;
					break;
				default:
					uiPrintf("ERROR parsing SA_MODEL:\nIllegal value %d. Choose from 1 or 2 \n", testVal);
					uiPrintf("Using the default spectrum analyzer model SPA_E4404B\n");
					CalSetup.saModel = SPA_E4404B;
				}
		}
//** the following remarked by ccshiang
		/*
		else if(strnicmp("SA_GPIB_ADDR", pLine, strlen("SA_GPIB_ADDR")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%d", &CalSetup.saGPIBaddr)) {
				uiPrintf("Unable to read the SA_GPIB_ADDR from %s\n", calsetupFileName);
			}
		}
		*/
//** the above remarked by ccshiang
		else if((strnicmp("ATT_MODEL", pLine, strlen("ATT_MODEL")) == 0) &&
				((pLine[strlen("SA_MODEL")] == ' ') ||
				 (pLine[strlen("SA_MODEL")] == '\t') ) ){

				pLine = strchr(pLine, '=');
				pLine = strtok(pLine, delimiters);
				pLine = strtok(pLine," ;#");
				if(!sscanf(pLine, "%d", &testVal)) {
				uiPrintf("Unable to read the SA_MODEL from %s\n", calsetupFileName);
				}
				switch (testVal) {
				case 1:
					CalSetup.saModel= SPA_E4404B;
					break;
				case 2:
					CalSetup.saModel= SPA_8595E;
					break;
				default:
					uiPrintf("ERROR parsing SA_MODEL:\nIllegal value %d. Choose from 1 or 2 \n", testVal);
					uiPrintf("Using the default spectrum analyzer model SPA_E4404B\n");
					CalSetup.saModel = SPA_E4404B;
				}
		}
//** the following remarked by ccshiang
		/*
		else if(strnicmp("ATT_GPIB_ADDR", pLine, strlen("ATT_GPIB_ADDR")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%d", &CalSetup.attGPIBaddr)) {
				uiPrintf("Unable to read the ATT_GPIB_ADDR from %s\n", calsetupFileName);
			}
		}
		*/
//** the above remarked by ccshiang
	   else if(strnicmp("ATTEN_DUT_PM", pLine, strlen("ATTEN_DUT_PM")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%lf", &CalSetup.attenDutPM)) {
				uiPrintf("Unable to read the ATTEN_DUT_PM from %s\n", calsetupFileName);
			}
		}
	   else if(strnicmp("ATTEN_DUT_SA", pLine, strlen("ATTEN_DUT_SA")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%lf", &CalSetup.attenDutSA)) {
				uiPrintf("Unable to read the ATTEN_DUT_SA from %s\n", calsetupFileName);
			}
		}
	   else if(strnicmp("ATTEN_FIXED_DUT_GOLDEN", pLine, strlen("ATTEN_FIXED_DUT_GOLDEN")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%lf", &CalSetup.attenDutGolden)) {
				uiPrintf("Unable to read the ATTEN_FIXED_DUT_GOLDEN from %s\n", calsetupFileName);
			}
		}
	   else if(strnicmp("11b_ATTEN_DUT_PM", pLine, strlen("11b_ATTEN_DUT_PM")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%lf", &CalSetup.attenDutPM_2p4[MODE_11b])) {
				uiPrintf("Unable to read the 11b_ATTEN_DUT_PM from %s\n", calsetupFileName);
			} else
			{
				CalSetup.attenDutPM_2p4[MODE_11g] = CalSetup.attenDutPM_2p4[MODE_11b];
			}
		}
	   else if(strnicmp("11b_ATTEN_DUT_SA", pLine, strlen("11b_ATTEN_DUT_SA")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%lf", &CalSetup.attenDutSA_2p4[MODE_11b])) {
				uiPrintf("Unable to read the 11b_ATTEN_DUT_SA from %s\n", calsetupFileName);
			}else
			{
				CalSetup.attenDutSA_2p4[MODE_11g] = CalSetup.attenDutSA_2p4[MODE_11b];
			}
		}
	   else if(strnicmp("11b_ATTEN_FIXED_DUT_GOLDEN", pLine, strlen("11b_ATTEN_FIXED_DUT_GOLDEN")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%lf", &CalSetup.attenDutGolden_2p4[MODE_11b])) {
				uiPrintf("Unable to read the 11b_ATTEN_FIXED_DUT_GOLDEN from %s\n", calsetupFileName);
			}else
			{
				CalSetup.attenDutGolden_2p4[MODE_11g] = CalSetup.attenDutGolden_2p4[MODE_11b];
				//uiPrintf("CalSetup.goldenTXPower_2p4 = %d, %f\n",CalSetup.attenDutGolden_2p4[MODE_11g], CalSetup.attenDutGolden_2p4[MODE_11b]);
			}
		}
	   else if(strnicmp("11b_MAX_POWER_CAP", pLine, strlen("11b_MAX_POWER_CAP")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%lf", &CalSetup.maxPowerCap[MODE_11b])) {
				uiPrintf("Unable to read the 11b_MAX_POWER_CAP from %s\n", calsetupFileName);
			}
		}
	   else if(strnicmp("MAX_POWER_CAP", pLine, strlen("MAX_POWER_CAP")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%lf", &CalSetup.maxPowerCap[MODE_11a])) {
				uiPrintf("Unable to read the MAX_POWER_CAP from %s\n", calsetupFileName);
			}
		}
	   else if(strnicmp("11g_MAX_POWER_CAP", pLine, strlen("11g_MAX_POWER_CAP")) == 0) {
			pLine = strchr(pLine, '=');
			pLine = strtok(pLine, delimiters);
			if(!sscanf(pLine, "%lf", &CalSetup.maxPowerCap[MODE_11g])) {
				uiPrintf("Unable to read the 11g_MAX_POWER_CAP from %s\n", calsetupFileName);
			}
		}
	   else if(strnicmp("11b_NUM_SENS_PACKETS", pLine, strlen("11b_NUM_SENS_PACKETS")) == 0) {
				pLine = strchr(pLine, '=');
				pLine = strtok(pLine, delimiters);
				if(!sscanf(pLine, "%d", &CalSetup.numSensPackets[MODE_11b])) {
				uiPrintf("Unable to read the 11b_NUM_SENS_PACKETS from %s\n", calsetupFileName);
				}
		}
	   else if(strnicmp("11g_NUM_SENS_PACKETS", pLine, strlen("11g_NUM_SENS_PACKETS")) == 0) {
				pLine = strchr(pLine, '=');
				pLine = strtok(pLine, delimiters);
				if(!sscanf(pLine, "%d", &CalSetup.numSensPackets[MODE_11g])) {
				uiPrintf("Unable to read the 11g_NUM_SENS_PACKETS from %s\n", calsetupFileName);
				}
		}
	   else if(strnicmp("NUM_SENS_PACKETS", pLine, strlen("NUM_SENS_PACKETS")) == 0) {
				pLine = strchr(pLine, '=');
				pLine = strtok(pLine, delimiters);
				if(!sscanf(pLine, "%d", &CalSetup.numSensPackets[MODE_11a])) {
				uiPrintf("Unable to read the NUM_SENS_PACKETS from %s\n", calsetupFileName);
				}
		}
	   else if(strnicmp("TXPER_BACKOFF_ATTEN", pLine, strlen("TXPER_BACKOFF_ATTEN")) == 0) {
				pLine = str

⌨️ 快捷键说明

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