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

📄 test.c

📁 Atheros AP Test with Agilent N4010A source code
💻 C
📖 第 1 页 / 共 5 页
字号:
	"MB32", NO_CHIP_IDENTIFIER, 3, 0x2031, 0, 1,	"MB31", NO_CHIP_IDENTIFIER, 4, 0x2030, 0, 1,	"AP30", NO_CHIP_IDENTIFIER, 6, 0xa034, 1, 2,	"AP31", NO_CHIP_IDENTIFIER, 7, 0xa033, 1, 1,	"AP33", NO_CHIP_IDENTIFIER, 8, 0xa037, 1, 1,	"AP36", NO_CHIP_IDENTIFIER, 9, 0xa038, 1, 1,	"AP38", NO_CHIP_IDENTIFIER, 10, 0xa035, 1, 1,	"AP39", NO_CHIP_IDENTIFIER, 11, 0xa036, 1, 1,	"CB42", NO_CHIP_IDENTIFIER, 26, 0x1042, 0, 1,	"CB41", NO_CHIP_IDENTIFIER, 27, 0x1041, 0, 1,	"CB43", NO_CHIP_IDENTIFIER, 28, 0x1043, 0, 1,	"MB42", NO_CHIP_IDENTIFIER, 29, 0x2042, 0, 1,	"MB41", NO_CHIP_IDENTIFIER, 30, 0x2041, 0, 1,	"AP43", NO_CHIP_IDENTIFIER, 31, 0xa043, 1, 1,	"AP48", NO_CHIP_IDENTIFIER, 32, 0xa048, 1, 1,	"AP41", NO_CHIP_IDENTIFIER, 33, 0xa041, 1, 1,	"MB43", NO_CHIP_IDENTIFIER, 36, 0x2043, 0, 1,	"MB44", NO_CHIP_IDENTIFIER, 37, 0x2044, 0, 1,	"TB91", NO_CHIP_IDENTIFIER, 38, 0x2049, 0, 1,	"UB51", NO_CHIP_IDENTIFIER, 44, 0xb051, 0, 1,	"UB52", NO_CHIP_IDENTIFIER, 43, 0xb052, 0, 1,	"AV10", NO_CHIP_IDENTIFIER, 42, 0x2052, 0, 1,	"CB51", 4, 40, 0x1051, 0, 1,    //griffin	"CB51", 9, 54, 0x1051, 0, 1,    //griffin	"CB51", 0, 46, 0x1052, 0, 1,    //griffin lite	"CB53", 4, 45, 0x1053, 0, 1,    //griffin	"CB53", 0, 47, 0x1054, 0, 1,    //griffin lite	"CB53", 2, 48, 0x1055, 0, 1,    //lion	"MB51", 4, 41, 0x2051, 0, 1,    //griffin	"MB51", 9, 53, 0x2051, 0, 1,    //griffin	"MB51", 0, 49, 0x2052, 0, 1,    //griffin lite	"MB53", 4, 50, 0x2053, 0, 1,    //griffin	"MB53", 0, 51, 0x2054, 0, 1,    //griffin lite	"MB53", 2, 52, 0x2055, 0, 1,    //lion	"CU63", NO_CHIP_IDENTIFIER, 66, 0xb063, 0, 1,	"MB62", 9, 55, 0x2062, 0, 1,    //eagle	"MB62", 4, 58, 0x2062, 0, 1,    //eagle	"CB62", 4, 57, 0x1062, 0, 1,    //eagle	"MB62", 0, 60, 0x2063, 0, 1,    //eagle-lite	"CB62", 0, 61, 0x1063, 0, 1,    //eagle-lite	"AP51", 4, 56, 0xa051, 1, 1,    //cobra	"AP51", 0, 62, 0xa052, 1, 1,    //cobra-lite	"XB62", 0, 68, 0x3063, 1, 1,    //condor-lite	"XB62", 4, 67, 0x3062, 1, 1,    //condor	"QQ85",  0, 65, 0x4051, 0, 1,    //griffin lite - apple board	"SD10",  0, 10, 0x6010, 0, 1,    //SD10 card	"SD11",  0, 11, 0x6011, 0, 1,    //SD10 card	"TB11",  0, 12, 0x6022, 0, 1,    //tb111 card};A_UINT32 sizeLabelTable = sizeof(labelTable)/sizeof(LABEL_INFO_STRUCT);//#ifndef __ATH_DJGPPDOS__ART_SOCK_INFO *artSockInfo = NULL;ART_SOCK_INFO *pArtPrimarySock = NULL;ART_SOCK_INFO *pArtSecondarySock = NULL;//#else//void *artSockInfo = NULL;//#endifstatic RX_GAIN_REGS_11bg rxGainValues_11bg[] ={#include  "AR5111_rx_gain_2ghz.tbl"} ;static RX_GAIN_REGS rxGainValues[] ={#include  "AR5111_rx_gain_5ghz.tbl"};static RX_GAIN_REGS_AR5112 rxGainValues_derby[] ={#include  "AR5112_rx_gain_5ghz.tbl"};static RX_GAIN_REGS_AR5112 rxGainValues_derby_11bg[] ={#include  "AR5112_rx_gain_2ghz.tbl"};static RX_GAIN_REGS_AR5112 rxGainValues_dragon[] ={#include  "AR6000_rx_gain_5ghz.tbl"};static RX_GAIN_REGS_AR5112 rxGainValues_dragon_11g[] ={#include  "AR6000_rx_gain_2ghz.tbl"};static XPD_GAIN_INFO xpdGainValues[] ={	18,        7,	12,        11,	6,        13,	0,        14};static XPD_GAIN_INFO xpdGainValues_derby[] ={	18,        3,	12,        2,	6,        1,	0,        0};XPD_GAIN_INFO *gainValues;static char delimiters[]   = " \t";#ifndef __ATH_DJGPPDOS__void findEepFile(){	A_INT32 tempDevNum;	A_UINT32 tempDevID;	A_UINT32 local_tmp_index=0;	SUB_DEV_INFO devStruct;	tempDevNum = art_setupDevice(configSetup.instance);	if(tempDevNum < 0) {		uiPrintf("main: Error attaching to the device - ending test\n");		closeEnvironment();		exit(0);	}	//do a cfg read to determine which device is safe to access	tempDevID = art_cfgRead(tempDevNum, 0);	if(((tempDevID >> 16) & 0xffff) == 0xa017) {		if(configSetup.instance != 2) {		//should use the second radio		art_teardownDevice(tempDevNum);		//attempt to setup second device		tempDevNum = art_setupDevice(2);		if(tempDevNum < 0) {			uiPrintf("main: Error attaching to the device - ending test\n");			closeEnvironment();			exit(0);		}	}	}	//parse the correct eep file	if(!setEepFile(tempDevNum)) {		art_teardownDevice(tempDevNum);		closeEnvironment();		exit(0);	}	//get the deviceID from the library and use the swDevID	art_getDeviceInfo(tempDevNum, &devStruct);	swDeviceID = devStruct.swDevID;	hwDeviceID = devStruct.hwDevID;	//parse the cal section of the eep file//    load_eep_vals(tempDevNum);	parseSetup(tempDevNum);	// calsetup and .eep files have been parsed so far	if ( configSetup.remote  &&		 ( (CalSetup.modeMaskForRadio[0] & 0x2) == 2) &&		 ( (CalSetup.modeMaskForRadio[1] & 0x2) == 2) ) {		// if both radios support 11a operation		//configSetup.eeprom2StartLocation = 0x400;		  configSetup.eeprom2StartLocation = checkSumLength;	}	//cleanup and let the main code setup the correct devices based on findings in eep file	art_teardownDevice(tempDevNum);//    Sleep(100);  added for condor emulation}#endif//** the following added by ccshiang#include "..\..\..\..\ART.Common\frequencyPiersMeasurement.h"long nRet;//** the above added by ccshiangmain(int argc,char *argv[]) {	A_BOOL exitLoop = FALSE;	A_INT32  tempDevNum;	A_UINT32 devNumInst[3];  //start from 1, ignore 0	A_UINT32 devNum=INVALID_INSTANCE;	A_UINT32 devNum_2g=0;	A_UINT32 devNum_5g=0;	SUPPORTED_MODES supportedModes;	A_CHAR commentBuffer[MAX_SIZE_COMMENT_BUFFER] = {'a', 'b', 'c'};	A_UINT32 tempBackoff[3];	SUB_DEV_INFO devStruct;	A_UINT32 returnCode;	A_UINT32 i, sleep_enable = 0;//TONYint checkConnectionCounter = 0;FILE *fStream;//TONYBORDID_ARGV = argv[3];MAC_ARGV = argv[4];WRITE_MAC_ADDRESS = argv[5];DeleteFile("ArtLog.txt");if(argc < 6){	printf("\nUsage: art.exe \\remote=<ip> \\id=6011 <Board ID> <MAC Address> <1 (write MAC address after calibration) or 0>");	exit(0);}		printf("[TONY] ARGV 0: %s\n", argv[0]);printf("[TONY] ARGV 1: %s\n", argv[1]);printf("[TONY] ARGV 2: %s\n", argv[2]);printf("[TONY] Board ID: %s\n", BORDID_ARGV);printf("[TONY] Mac ID: %s\n", MAC_ARGV);printf("[TONY] Write MAC Address? (1/0): %s\n", WRITE_MAC_ADDRESS);//Sleep(100000);//TONYprintf("\nWaiting for device");	while ((!(checkConnection(&(argv[1][8])))) && (checkConnectionCounter<25))	{		printf(".");		Sleep(1000);		checkConnectionCounter++;	}if (25 == checkConnectionCounter){	printf("USB Link Failed! - Please check USB connection\n");	if( (fStream = fopen("ArtLog.txt", "w+")) == NULL ) {                        printf("\nFailed to open ArtLog.txt\n");            return;        }	fputc((int)'1',fStream);	fputc((int)'1',fStream);	fputc((int)'1',fStream);	fputc((int)'1',fStream);	fputc((int)'1',fStream);	fputc((int)'1',fStream);	fputc((int)'1',fStream);	fputc((int)'1',fStream);	fclose(fStream);	exit(0);}	printf("Device Connected!\n");//TONYargc = 3;#ifdef _DEBUG	//printf("&&argv[1]= %s\n",argv[1]);	//printf("&&argv[2]= %s\n",argv[2]);	 //argv[1] ="\\remote=192.168.1.111";	 //argv[2] ="\\id=0x6011";	 argc = 3;	 configSetup.remote= TRUE;#endif#ifdef LINUX	char *tmp;	tmp = getenv("HOSTNAME");	machName = strtok(tmp, ".");#else	machName = getenv("COMPUTERNAME");#endif	devNumInst[1] = INVALID_INSTANCE;	devNumInst[2] = INVALID_INSTANCE;	if (parseCmdLine(argc,argv) == FALSE) {		uiPrintf("main: Failed to parse command line arguments \n");		exit (0);	}	if(initializeEnvironment(configSetup.remote) == FALSE) {		uiPrintf("main: Failed to initialize the Driver Environment\n");		exit(0);	}	//set the printLocalInfo flag dependent on whether already printed by lib	//or if have a remove client	printLocalInfo = 0;#ifdef NO_LIB_PRINT	printLocalInfo = 1;#endif	if(configSetup.remote) {		printLocalInfo = 1;	}#ifndef CUSTOMER_REL	uiPrintf("Using %d card \n",configSetup.instance);#endif	if(!parseConfig()) {		uiPrintf("Problem parsing %s, exiting...\n", CONFIGSETUP_FILE);		exit(0);	}#ifndef __ATH_DJGPPDOS__	Sleep(1000);	if(configSetup.enableLabelScheme) {		//first try to get the label with auto detect		if(!promptForLabel(0)) {			//if auto detect doesn't work,  continue to prompt for entry			while (!promptForLabel(0));		}	}	else {		if (configSetup.computeCalsetupName > 0) {			if (machName) {				sprintf(calsetupFileName, "calsetup_%s_%c%c", strlwr(machName),												tolower(yldStruct.cardLabel[0]),												tolower(yldStruct.cardLabel[1]));				if(yldStruct.chipIdentifier != NO_CHIP_IDENTIFIER) {					sprintf(calsetupFileName, "%s_%1d.txt", calsetupFileName,														yldStruct.chipIdentifier);				}				else {					sprintf(calsetupFileName, "%s.txt", calsetupFileName);				}			} else {				uiPrintf("Fatal Error : Could Not Retrieve Machine Name\n");				exit(0);			}		} else {			sprintf(calsetupFileName, "calsetup.txt");		}	}	uiPrintf("Calsetupfile Used : %s\n", calsetupFileName);//#ifndef CONDOR_HACK//    findEepFile();//#endif	if(configSetup.userInstanceOverride) {		devNum = art_setupDevice(configSetup.instance);		if(devNum < 0) {			uiPrintf("main: Error attaching to the device - ending test\n");			closeEnvironment();			exit(0);		}		art_configureLibParams(devNum);	   //printf("SNOOP:::before reset device::Sent bytes = %d::Received bytes=%d\n", sent_bytes, received_bytes);		//sent_bytes=0;received_bytes=0;		art_resetDevice(devNum, txStation, bssID, configSetup.channel, configSetup.turbo);		//printf("SNOOP:::after reset device::Sent bytes = %d::Received bytes=%d\n", sent_bytes, received_bytes);		uiPrintf("Attached to the Device for instance = %d\n", configSetup.instance);		//for now make the assumption that both a and g are supported		devNum_5g = devNum;		devNum_2g = devNum;	}	else {		//enable the instances that are valid		if(CalSetup.modeMaskForRadio[0] != 0) {			devNumInst[1] = art_setupDevice(1);			if(devNumInst[1] < 0) {				uiPrintf("main: Error attaching to the device - ending test\n");				closeEnvironment();				exit(0);			}//#ifdef CONDOR_HACK			//parse the correct eep file			if(!setEepFile(devNumInst[1])) {				art_teardownDevice(devNumInst[1]);				closeEnvironment();				exit(0);			}			//get the deviceID from the library and use the swDevID			art_getDeviceInfo(devNumInst[1], &devStruct);			swDeviceID = devStruct.swDevID;			hwDeviceID = devStruct.hwDevID;			//parse the cal section of the eep file		//    load_eep_vals(tempDevNum);			parseSetup(devNumInst[1]);//#endif			// calsetup and .eep files have been parsed so far			if ( configSetup.remote  &&				 ( (CalSetup.modeMaskForRadio[0] & 0x2) == 2) &&				 ( (CalSetup.modeMaskForRadio[1] & 0x2) == 2) ) {				// if both radios support 11a operation				//configSetup.eeprom2StartLocation = 0x400;				  configSetup.eeprom2StartLocation = checkSumLength;			}			art_configureLibParams(devNumInst[1]);			art_resetDevice(devNumInst[1], txStation, bssID, configSetup.channel, configSetup.turbo);			uiPrintf("Attached to the Device for instance = %d\n", 1);		}		if(CalSetup.modeMaskForRadio[1] != 0) {			devNumInst[2] = art_setupDevice(2);			if(devNumInst[2] < 0) {				uiPrintf("main: Error attaching to the device - ending test\n");				closeEnvironment();				exit(0);			}			art_configureLibParams(devNumInst[2]);			art_resetDevice(devNumInst[2], txStation, bssID, configSetup.channel, configSetup.turbo);			uiPrintf("Attached to the Device for instance = %d\n", 2);		}		//Setup the 2g and 5g instances		devNum_5g = devNumInst[CalSetup.instanceForMode[MODE_11a]];		devNum_2g = devNumInst[CalSetup.instanceForMode[MODE_11g]];		//check that we have legal devNums for both.  If not, point to a valid		//devNum, manufacturing expects 2 devNums to be valid		//if all board text files are setup correctly, should not use it.

⌨️ 快捷键说明

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