📄 test.c
字号:
if((devNum_5g == INVALID_INSTANCE)&& (devNum_2g == INVALID_INSTANCE)) { uiPrintf("Unable to allocate a valid devNum, exiting\n"); closeEnvironment(); exit(0); } else if (devNum_5g == INVALID_INSTANCE) { devNum_5g = devNum_2g; } else if (devNum_2g == INVALID_INSTANCE) { devNum_2g = devNum_5g; } } //setup devnum correctly if(configSetup.mode == MODE_11A) { if(devNum_5g != INVALID_INSTANCE) { devNum = devNum_5g; } else { //assume 11g devNum = devNum_2g; } } else { if(devNum_2g != INVALID_INSTANCE) { devNum = devNum_2g; } else { //assume 11a devNum = devNum_5g; } }#endif#ifdef __ATH_DJGPPDOS__ tempDevNum = art_setupDevice(configSetup.instance); if(tempDevNum < 0) { uiPrintf("main: Error attaching to the device - ending test\n"); closeEnvironment(); exit(0); } devNum = tempDevNum; art_configureLibParams(devNum); art_resetDevice(devNum, txStation, bssID, configSetup.channel, configSetup.turbo); uiPrintf("Attached to the Device\n");#endif glbl_devNum = devNum; //extra safety check if(devNum == INVALID_INSTANCE) { uiPrintf("Unable to get allocate a valid devNum, exiting\n"); closeEnvironment(); exit(0); } //get the deviceID from the library and use the swDevID art_getDeviceInfo(devNum, &devStruct); swDeviceID = devStruct.swDevID; hwDeviceID = devStruct.hwDevID; if(!get_eeprom_size(devNum,&eepromSize,&checkSumLength)) // To read eeprom size and caluculates checksum length uiPrintf("BOARD PARAMETERS EEPROM_SIZE = %x checkSumLength = %x\n",eepromSize,checkSumLength); else uiPrintf("BOOTING EEPROM_SIZE = %x checkSumLength = %x\n",eepromSize,checkSumLength); if (isDragon_sd(swDeviceID)) { eepromSize = 0x100; checkSumLength = 0x100; uiPrintf("!!!!BOARD PARAMETERS EEPROM_SIZE = %x checkSumLength = %x\n",eepromSize,checkSumLength); }#ifndef __ATH_DJGPPDOS__ checkUserSize(devNum);#endif// uiPrintf("EEPROM_SIZE = %x checkSumLength = %x\n",eepromSize,checkSumLength);#ifndef __ATH_DJGPPDOS__ if(!setEepFile(devNum)) { art_teardownDevice(devNum); closeEnvironment(); exit(0); } parseSetup(devNum); if (!configSetup.userInstanceOverride) { if (CalSetup.Amode) { if (CalSetup.Gmode) { if ((CalSetup.instanceForMode[MODE_11a] != 1) && (CalSetup.instanceForMode[MODE_11g] != 1)) { configSetup.validInstance = 2; } } else { if (CalSetup.instanceForMode[MODE_11a] != 1) { configSetup.validInstance = 2; } } } else if (CalSetup.Gmode) { if (CalSetup.instanceForMode[MODE_11g] != 1) { configSetup.validInstance = 2; } } }#else devNum_5g = devNum; devNum_2g = devNum;#endif //__ATH_DJGPPDOS__ if ((swDeviceID & 0xff) >= 0x14) { // venice or hainan with derby 1/2 //if (((swDeviceID & 0xFF) == 0x16) && (((devStruct.aRevID >> 4) & 0xf) >= 5)) { if ((swDeviceID & 0xFF) >= 0x16) { pCurrGainLadder = &(gainLadder_derby2); } else { pCurrGainLadder = &(gainLadder_derby1); } } else { pCurrGainLadder = &(gainLadder); }#ifdef __ATH_DJGPPDOS__ if(!configSetup.eepromLoad) { uiPrintf("EEPROM must be loaded, enabling loading\n"); configSetup.eepromLoad = 1; }#endif if(configSetup.mode == MODE_11B) { configSetup.turbo = 0; } gainValues = xpdGainValues; //setup the params prior to reset if ((swDeviceID == 0x0007) || (swDeviceID == 0x0005) ) { configSetup.pCfgFile = configSetup.creteFezCfg; configSetup.maxChannel5G = MAX_FEZ_CHANNEL; } else if (swDeviceID == 0x0011) { configSetup.pCfgFile = configSetup.qmacSombreroCfg; configSetup.maxChannel5G = MAX_SOM_CHANNEL; } else if (swDeviceID == 0xe011) { configSetup.pCfgFile = configSetup.qmacSombreroBeanieCfg; configSetup.maxChannel5G = MAX_SOM_CHANNEL; } else if ((swDeviceID & 0xff) == 0x0012) { configSetup.pCfgFile = configSetup.oahuCfg; configSetup.maxChannel5G = MAX_SOM_CHANNEL; configSetup.maxChannel2G = MAX_2G_CHANNEL; configSetup.minChannel2G = MIN_2G_CHANNEL; } else if (((swDeviceID & 0xff) == 0x0013) || ((swDeviceID & 0xff) == 0x0015)){ configSetup.pCfgFile = configSetup.veniceCfg; configSetup.maxChannel5G = MAX_SOM_CHANNEL; configSetup.maxChannel2G = MAX_2G_CHANNEL; configSetup.minChannel2G = MIN_2G_CHANNEL; } else if (((swDeviceID & 0xff) >= 0x0014)&&((swDeviceID & 0xff) != 0x0015)) { configSetup.pCfgFile = configSetup.veniceCfg; configSetup.minChannel5G = MIN_CHANNEL_DERBY; configSetup.maxChannel5G = MAX_SOM_CHANNEL; gainValues = xpdGainValues_derby; gainIMax = DERBY_GAINI_MAX; configSetup.maxChannel2G = MAX_2G_CHANNEL_DERBY; configSetup.minChannel2G = MIN_2G_CHANNEL_DERBY; } if(isEagle(swDeviceID)) { gainIMax = GRIFFIN_GAIN_MAX; } //turn on logging if needed if(configSetup.logging) { if(configSetup.logFile[0] == '\0') { uiPrintf("\nPlease enter filename for logging: "); scanf("%s", configSetup.logFile); }#ifndef __ATH_DJGPPDOS__ uilog(configSetup.logFile, 1);#endif } if((hwDeviceID == 0xff12) || (hwDeviceID >= 0xff13)) { //need to indicate eeprom size art_writeField(devNum, "mc_eeprom_size_ovr", 3); }//#ifndef __ATH_DJGPPDOS__ if (!configSetup.eepromLoadOverride) { if (eeprom_verify_checksum(devNum)) { configSetup.validCalData = TRUE; configSetup.eepromLoad = 1; } else { configSetup.validCalData = FALSE; configSetup.eepromLoad = 0; invalidEepromMessage(2000); } } else { configSetup.eepromLoad = 0; }//#else //assume for now.// configSetup.validCalData = TRUE;// configSetup.eepromLoad = 1;//#endif //__ATH_DJGPPDOS__ //setup the hw calibration per artsetup.txt art_enableHwCal(devNum, configSetup.enableCal); if ((((swDeviceID & 0xff) >= 0x0014) && ((swDeviceID & 0xff) != 0x0015)) && (configSetup.eepromLoad)) { //xpdgain gets set by devlib, don't want to apply here unless there //is an override. configSetup.applyXpdGain = 0; } // Siva //art_setResetParams(devNum, configSetup.pCfgFile, (A_BOOL)configSetup.eepromLoad, // (A_BOOL)1, (A_UCHAR)configSetup.mode, configSetup.use_init); art_resetDevice(devNum, txStation, bssID, configSetup.channel, configSetup.turbo);// if(!setEepFile(devNum)) {// closeEnvironment();// exit(0);// }#ifndef __ATH_DJGPPDOS__ if(!setEepFile(devNum)) { art_teardownDevice(devNum); closeEnvironment(); exit(0); } if((devNum_5g != devNum_2g)&&(!configSetup.userInstanceOverride)) { tempDevNum = ((devNum == devNum_5g) ? devNum_2g : devNum_5g); if(tempDevNum != INVALID_INSTANCE) { if(!setEepFile(tempDevNum)) { art_teardownDevice(tempDevNum); closeEnvironment(); exit(0); } } }// parseSetup(devNum); //push down the false detect values //need to map the mode specific backoffs in the correct order tempBackoff[MODE_11A] = CalSetup.falseDetectBackoff[MODE_11a]; tempBackoff[MODE_11B] = CalSetup.falseDetectBackoff[MODE_11b]; tempBackoff[MODE_11G] = CalSetup.falseDetectBackoff[MODE_11g]; art_supplyFalseDetectbackoff(devNum, tempBackoff);#endif //__ATH_DJGPPDOS__#ifndef __ATH_DJGPPDOS__ if (progProm) { progBlankEEPROM(devNum); uiPrintf("Press any key to continue or <ESC> to exit\n"); if(getch() == 0x1b) { art_teardownDevice(devNum); closeEnvironment(); exit(0); } }#endif //__ATH_DJGPPDOS__ //setup the mode getSupportedModes(devNum, &supportedModes); configSetup.mode = getFirstMode(&supportedModes); if(!setupMode()) { uiPrintf("Illegal mode value set in %s - exiting\n"); art_teardownDevice(devNum); closeEnvironment(); exit(0); } //check if the mode changed and we need to change the devNum if(configSetup.mode == MODE_11A) { devNum = devNum_5g; } else { devNum = devNum_2g; } //spot check if(devNum == INVALID_INSTANCE) { uiPrintf("Unable to get devNum for selected mode\n"); closeEnvironment(); exit(0); } //check to see if turbo has been disabled in eep file. //if so, don't let turbo be set through artsetup.txt if(CalSetup.turboDisable || CalSetup.turboDisable_11g) { if(configSetup.turbo) { configSetup.turbo = 0; } } art_setResetParams(devNum, configSetup.pCfgFile, (A_BOOL)configSetup.eepromLoad, (A_BOOL)configSetup.eepromHeaderLoad, (A_UCHAR)configSetup.mode, configSetup.use_init); //this is needed incase we changed modes art_resetDevice(devNum, txStation, bssID, configSetup.channel, configSetup.turbo); //test card/installation if(!initTest(devNum)) { uiPrintf("::main: Error testing device - exiting\n"); art_teardownDevice(devNum); closeEnvironment(); exit(0); } if (configSetup.cmdLineTest) { //just perform the command line tests then get out setInitialPowerControlMode(devNum, configSetup.dataRateIndex); returnCode = performCmdLineTests(devNum); uiPrintf("closing device\n"); art_teardownDevice(devNum); uiPrintf("closing environment\n"); closeEnvironment(); uiPrintf("exiting\n"); exit(returnCode); } #ifndef __ATH_DJGPPDOS__ if(configSetup.enableLabelScheme) { show_eep_label(devNum, (A_BOOL)(configSetup.enableLabelScheme)); }#endif//** the following added by ccshiang #include "..\..\..\..\ART.Common\init_AgN4010.h"//** the above added by ccshiang //Read register values read in from resetDevice updateConfigFromRegValues(devNum); //printf("SNOOP:::Sent bytes = %d::Received bytes=%d\n", sent_bytes, received_bytes); sent_bytes = 0; received_bytes = 0; if(configSetup.mode == MODE_11A) { configSetup.maxRxGain = RX_GAIN_MAX_AR6000; configSetup.minRxGain = RX_GAIN_MIN_AR6000; } else { configSetup.maxRxGain = RX_GAIN_MAX_AR6000_11g; configSetup.minRxGain = RX_GAIN_MIN_AR6000_11g; } if (isDragon_sd(swDeviceID)) { printf("Ref clk speed = %d\n", art_getRefClkSpeed(devNum)); }//SNOOP// for (i = 0; i < 28; i++) {// if ((i % 4 == 0) && ( i != 0)) {// printf("\n");// }// printf("0x%08x ", art_cfgRead(devNum, i*4));// }// i = art_cfgRead(devNum, 0x44);// art_cfgWrite(devNum, 0x44, i | 0x200);// printf("0x44 = 0x%08x\n",art_cfgRead(devNum, 0x44));//END SNOOP//TONY//Read EEPROM sprintf(READ_MAC, "%04X%04X%04X\0", art_eepromRead(devNum, 0x05), art_eepromRead(devNum, 0x04), art_eepromRead(devNum, 0x03)); strupr(READ_MAC); //TONY while(exitLoop == FALSE) { printf("\n"); printf("============================================\n"); printf("| Test Harness Main Options: |\n");#ifndef CUSTOMER_REL printf("| n - Toggle i(N)it code use |\n");#endif if (supportMultiModes(&supportedModes)) { printf("| o - Toggle M(o)de |\n"); }#ifndef __ATH_DJGPPDOS__ if(configSetup.eepromLoad) { printf("| e - Ignore (E)EPROM Calibration |\n"); } else { printf("| e - Load (E)EPROM Calibration |\n"); }#endif // __ATH_DJGPPDOS__ printf("| c - (C)ontinuous transmit mode |\n"); printf("| r - Continuous RF (R)eceive mode |\n"); printf("| l - (L)ink test menu |\n"); printf("| t - (T)hroughput test menu |\n"); printf("| p - EE(P)ROM function |\n");#ifndef __ATH_DJGPPDOS__ if (!isDragon_sd(swDeviceID)) { printf("| s - (S)witch test card |\n"); } printf("| m - (M)anufacturing/Calibration Test |\n");#endif // __ATH_DJGPPDOS__ if(configSetup.logging) { printf("| g - Disable lo(g)ging |\n"); printf("| w - (W)rite Comment to Log File |\n"); } else { printf("| g - Enable lo(g)ging |\n"); } printf("| u - (U)tility Menu |\n"); printf("| i - (N)oise Immunity Menu |\n"); if (isDragon_sd(swDeviceID)) { if (sleep_enable) { printf("| d - Wake UP|\n");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -