📄 maui_cal.c
字号:
} } if (CalSetup.useFastCal) { if ( (!setup_raw_datasets()) || (!setup_raw_datasets_2p4(MODE_11g)) || (!setup_raw_datasets_2p4(MODE_11b)) ) { uiPrintf("Could not setup raw datasets. Exiting...\n"); closeEnvironment(); exit(0); } } if ((CalSetup.eeprom_map == CAL_FORMAT_GEN3) || (CalSetup.eeprom_map == CAL_FORMAT_GEN5) ) { CalSetup.TrgtPwrStartAddr = 0x150; if(CalSetup.eeprom_map == CAL_FORMAT_GEN5) { //add extra dummy bytes to calculation of ear start CalSetup.TrgtPwrStartAddr += NUM_DUMMY_EEP_MAP1_LOCATIONS; CalSetup.calStartAddr = CalSetup.TrgtPwrStartAddr; } if (CalSetup.cal_mult_xpd_gain_mask[MODE_11a] == 0) { CalSetup.xgain = 1 << CalSetup.xgain ; } else { CalSetup.xgain = CalSetup.cal_mult_xpd_gain_mask[MODE_11a]; } if (CalSetup.cal_mult_xpd_gain_mask[MODE_11b] == 0) { CalSetup.xgain_2p4[MODE_11b] = 1 << CalSetup.xgain_2p4[MODE_11b] ; } else { CalSetup.xgain_2p4[MODE_11b] = CalSetup.cal_mult_xpd_gain_mask[MODE_11b]; } if (CalSetup.cal_mult_xpd_gain_mask[MODE_11g] == 0) { CalSetup.xgain_2p4[MODE_11g] = 1 << CalSetup.xgain_2p4[MODE_11g] ; } else { CalSetup.xgain_2p4[MODE_11g] = CalSetup.cal_mult_xpd_gain_mask[MODE_11g]; } } while(exitLoop == FALSE) { printf("\n"); printf("=============================================\n"); printf("| Manufacturing Test & Calibration Options: |\n"); printf("| d - (D)evice Under Test Begin |\n"); printf("| g - (G)olden Unit Test Begin |\n"); if (CalSetup.useFastCal) { printf("| f - Fastcal Cal - start (f)irst on GU |\n"); printf("| s - Fastcal Cal - start (s)econd on DUT |\n"); } printf("| q - (Q)uit |\n"); printf("=============================================\n");//TONY automatic calibration// switch(toupper(getch())) // { switch('D') { case 'D': dutBegin();//** the following added by ccshiang agiRestoreTestingItems();//** the above added by ccshiang break; case 'G': goldenTest(); break; case 'F': if (CalSetup.useFastCal) fastCalMenu_GU(devNum); break; case 'S': if (CalSetup.useFastCal) fastCalMenu_DUT(devNum); break; case 0x1b: case 'Q': exitLoop = TRUE; uiPrintf("exiting\n"); break; default: uiPrintf("Unknown command\n"); break; } } for( i =0; i < NUMEEPBLK; i++) free(EEPROM_DATA_BUFFER[i]); free(EEPROM_DATA_BUFFER);}void dutBegin(){ A_BOOL exitLoop = FALSE; A_UINT32 tmpVal, ii; A_UINT32 attenVal; A_UINT32 dual_11a_devNum; A_UINT32 i=0,k=0; SUB_DEV_INFO devStruct; testnum = 0;//** the following added by ccshiang if (AgN4010.boolCheckSSID) {//** the above added by ccshiang if ( configSetup.dutSSID < 1 ) { uiPrintf("please specify appropriate DUT_CARD_SSID in artsetup.txt\n"); exit(0); } else if (configSetup.dutSSID != configSetup.cfgTable.pCurrentElement->subsystemID) { uiPrintf("DUT_CARD_SSID specified in artsetup.txt (%x) does not match with the SSID of this card: (%x). ",configSetup.dutSSID , configSetup.cfgTable.pCurrentElement->subsystemID); uiPrintf("Set the 'DUT_CARD_SSID' in artsetup.txt appropriately to calibrate the desired card.\n"); exit(0); }//** the following added by ccshiang }//** the above added by ccshiang // setup the channel lists setupChannelLists(); if(!parseTargets()) { uiPrintf("An error occured while parsing the file %s. Pl. check for format errors.\n", CalSetup.tgtPwrFilename); } eepromType = (A_UINT16) CalSetup.dutPromSize ; if (CalSetup.atherosLoggingScheme) { setupAtherosCalLogging(); } uiPrintf("\n======================================="); uiPrintf("\nPlug in DUT (Device Under Test) "); uiPrintf("\nPress any key to start or <ESC> to quit"); uiPrintf("\n=======================================\n");//TONY removed for automatic test// while (!kbhit())// ; globalteststarttime = milliTime();//TONY removed for automatic test// if(getch() == 0x1b)// exitLoop = TRUE;/* devNumArr[MODE_11a] = devNum_def; if ((swDeviceID == 0xa014)||(swDeviceID == 0xa016)) { devNumArr[MODE_11b] = art_setupDevice(2); // get devNum for instance = 2 for freedom2 for 2.5G devNumArr[MODE_11g] = devNumArr[MODE_11b]; art_resetDevice(devNumArr[MODE_11b], rxStation, bssID, 2412, 0); } else { devNumArr[MODE_11b] = devNum_def; devNumArr[MODE_11g] = devNum_def; }*/ while (!exitLoop) {//** the following added by ccshiang #include "..\..\..\..\ART.Common\agiDutBeginLoopHeader.h"//** the above added by ccshiang REWIND_TEST = FALSE; TestFail = FALSE; for (ii=0; ii<30; ii++) failTest[ii] = 0; // initialize test fail flags configSetup.eepromLoad = 0; if ( CalSetup.useFastCal || CalSetup.testTXPER || CalSetup.testRXSEN || CalSetup.testTXPER_2p4[MODE_11b] || CalSetup.testRXSEN_2p4[MODE_11b] || CalSetup.testTXPER_2p4[MODE_11g] || CalSetup.testRXSEN_2p4[MODE_11g] || CalSetup.testDataIntegrity[MODE_11a] || CalSetup.testDataIntegrity[MODE_11g] || CalSetup.testDataIntegrity[MODE_11b] || (CalSetup.do_iq_cal) || CalSetup.testThroughput[MODE_11a] || CalSetup.testThroughput[MODE_11g] || CalSetup.testThroughput[MODE_11b])// ((swDeviceID & 0xFF) >= 0x14)) {//** the following remarked by ccshiang /*** sendSync(devNumArr[MODE_11a], CalSetup.goldenIPAddr, CalSetup.customerDebug); waitForAck(CalSetup.customerDebug); ***///** the above remarked by ccshiang //if we are using the label scheme, we need an extra sync to send the ssid to the golden if(configSetup.enableLabelScheme) { sendAck(devNumArr[MODE_11a], "Sending DUT SSID", configSetup.dutSSID, 0, 0, CalSetup.customerDebug); } if(configSetup.computeCalsetupName) { sendAck(devNumArr[MODE_11a], (A_CHAR *)calsetupFileName, 0, 0, 0, CalSetup.customerDebug); } } if (REWIND_TEST) { exitLoop = prepare_for_next_card(&(devNumArr[0])); continue; } if(isDragon_sd(swDeviceID) && CalSetup.Bmode) {// uiPrintf("Information: AR6000 does not support B mode. Disabling this mode\n");// CalSetup.Bmode = 0; } if(CalSetup.useInstruments && (!REWIND_TEST)) { timestart = milliTime();//** the following remarked by ccshiang /*** uiPrintf("\nSetting up Power Meter"); devPM = pmInit(CalSetup.pmGPIBaddr, CalSetup.pmModel); if ((CalSetup.pmModel == PM_E4416A) && !(SETUP_PM_MODEL2_ONCE)) { gpibWrite(devPM, "*rst\n"); Sleep(100); //gpibWrite(devPM, "*cls;*rcl 7\n"); pmPreset(devPM, -20, -4e-6, 860e-6, 2.6e-3, 3.43e-3); Sleep(100); gpibWrite(devPM, "*cls;:sens:det:func aver\n"); Sleep(100); //exit(0); SETUP_PM_MODEL2_ONCE = TRUE; } uiPrintf("\nSetting up Spectrum Analyzer"); devSA = spaInit(CalSetup.saGPIBaddr, CalSetup.saModel); uiPrintf("\nSetting up Attenuator\n");#ifdef LINUX devATT = attInit(CalSetup.attGPIBaddr, ATT_11713A_110);#else devATT = attInit(CalSetup.attGPIBaddr, CalSetup.attModel);#endif ***///** the above remarked by ccshiang attSet(devATT, 81); //set to max strcpy(testname[testnum],"instrument setup"); testtime[testnum++] = milliTime() - timestart; } if (CalSetup.calPower && CalSetup.do_iq_cal && (((swDeviceID & 0xFF) == 0x14)||((swDeviceID & 0xFF) >= 0x16))) { // Set attenuator if(CalSetup.useInstruments) { attenVal = (A_INT32)(5 - CalSetup.attenDutGolden - (-35));//** the following added by ccshiang attenVal += (A_UINT32) (agiGetCableLost(2412) + 0.5);//** the above added by ccshiang attSet(devATT, attenVal); } Sleep(200); if ((CalSetup.Amode) && (CalSetup.calPower) && (!REWIND_TEST)) { timestart = milliTime(); strcpy(testname[testnum],"IQ_cal for 11a"); configSetup.eepromLoad = 0; art_setResetParams(devNumArr[MODE_11a], configSetup.pCfgFile, (A_BOOL)configSetup.eepromLoad, (A_BOOL)configSetup.eepromHeaderLoad, MODE_11A, configSetup.use_init); dut_iq_cal(devNumArr[MODE_11a], MODE_11A, 5260); testtime[testnum++] = milliTime() - timestart; } if ((CalSetup.Gmode) && (CalSetup.calPower) && (!REWIND_TEST)) { printf("ENTERED The CalPowre IN G MODE \n"); timestart = milliTime(); strcpy(testname[testnum],"IQ_cal for 11g"); configSetup.eepromLoad = 0; art_setResetParams(devNumArr[MODE_11g], configSetup.pCfgFile, (A_BOOL)configSetup.eepromLoad, (A_BOOL)configSetup.eepromHeaderLoad, MODE_11G, configSetup.use_init); dut_iq_cal(devNumArr[MODE_11g], MODE_11G, 2442); testtime[testnum++] = milliTime() - timestart; } if (REWIND_TEST) { exitLoop = prepare_for_next_card(&(devNumArr[0])); continue; } sendAck(devNumArr[MODE_11a], "Done with iq_cal", 0, 0, 0, CalSetup.customerDebug); if(CalSetup.useInstruments) { attSet(devATT, 81); } } else { CalSetup.iqcal_i_corr[MODE_11a] = CalSetup.i_coeff_5G; CalSetup.iqcal_q_corr[MODE_11a] = CalSetup.q_coeff_5G; CalSetup.iqcal_i_corr[MODE_11g] = CalSetup.i_coeff_2G; CalSetup.iqcal_q_corr[MODE_11g] = CalSetup.q_coeff_2G; if (CalSetup.do_iq_cal) { sendAck(devNumArr[MODE_11a], "Done with iq_cal", 0, 0, 0, CalSetup.customerDebug); } } if ((CalSetup.cal_fixed_gain[MODE_11a] != INVALID_FG) && CalSetup.Amode) { if (CalSetup.cal_fixed_gain[MODE_11a] > (pCurrGainLadder->numStepsInLadder-1)) { uiPrintf("ERROR: Invalid CAL_FIXED_GAIN specified in calsetup.txt for mode "); uiPrintf("11a [%d] : Valid range 0..%d\n", CalSetup.cal_fixed_gain[MODE_11a], (pCurrGainLadder->numStepsInLadder-1)); exit(0); } optGainLadderIndex[MODE_11a] = (pCurrGainLadder->numStepsInLadder -1) - CalSetup.cal_fixed_gain[MODE_11a]; uiPrintf("\nusing cal fixed gain for mode 11a from calsetup.txt ... FG%d\n", CalSetup.cal_fixed_gain[MODE_11a]); NEED_GAIN_OPT_FOR_MODE[MODE_11a] = TRUE; } else if (CalSetup.calPower && CalSetup.Amode && (!REWIND_TEST)) { if ( ((swDeviceID & 0xFF) == 0x12) || ((swDeviceID & 0xFF) == 0x13) || ((swDeviceID & 0xFF) == 0x15) ) { tmpVal = art_getFieldForMode(devNumArr[MODE_11a], "rf_rfgain_step", MODE_11A, 0); if(tmpVal == 0x3f) { NEED_GAIN_OPT_FOR_MODE[MODE_11a] = TRUE; } } else if (!isGriffin(swDeviceID) && !isEagle(swDeviceID)) { // for derby 2.0 tmpVal = art_getFieldForMode(devNumArr[MODE_11a], "rf_mixvga_ovr", MODE_11A, 0); if(tmpVal == 1) { NEED_GAIN_OPT_FOR_MODE[MODE_11a] = TRUE; } } if(NEED_GAIN_OPT_FOR_MODE[MODE_11a] && CalSetup.Amode && CalSetup.useInstruments) { uiPrintf("\noptimum fixed gain for mode 11a found to be ... "); timestart = milliTime(); strcpy(testname[testnum],"Optimum fixed gain for 11a"); configSetup.eepromLoad = 0; art_setResetParams(devNumArr[MODE_11a], configSetup.pCfgFile, (A_BOOL)configSetup.eepromLoad, (A_BOOL)configSetup.eepromHeaderLoad, MODE_11A, configSetup.use_init); optGainLadderIndex[MODE_11a] = optimal_fixed_gain(devNumArr[MODE_11a], pCurrGainLadder, MODE_11a); uiPrintf(" : %d dB\n", pCurrGainLadder->optStep[optGainLadderIndex[MODE_11a]].stepGain); testtime[testnum++] = milliTime() - timestart; } else { optGainLadderIndex[MODE_11a] = pCurrGainLadder->defaultStepNum; } } if ((CalSetup.cal_fixed_gain[MODE_11b] != INVALID_FG) && CalSetup.Bmode) { if (CalSetup.cal_fixed_gain[MODE_11b] >= pCurrGainLadder->numStepsInLadder) { uiPrintf("ERROR: Invalid CAL_FIXED_GAIN specified in calsetup.txt for mode "); uiPrintf("11b [%d] : Valid range 0..%d\n", CalSetup.cal_fixed_gain[MODE_11b], (pCurrGainLadder->numStepsInLadder-1)); exit(0); } optGainLadderIndex[MODE_11b] = (pCurrGainLadder->numStepsInLadder -1) - CalSetup.cal_fixed_gain[MODE_11b]; NEED_GAIN_OPT_FOR_MODE[MODE_11b] = TRUE; uiPrintf("\nusing cal fixed gain for mode 11b from calsetup.txt ... FG%d\n", CalSetup.cal_fixed_gain[MODE_11b]); } else if (CalSetup.calPower && CalSetup.Bmode && (!REWIND_TEST)) { if ( ((swDeviceID & 0xFF) == 0x12) || ((swDeviceID & 0xFF) == 0x13) || ((swDeviceID & 0xFF) == 0x15) ) { tmpVal = art_getFieldForMode(devNumArr[MODE_11b], "rf_rfgain_step", MODE_11B, 0); if(tmpVal == 0x3f) { NEED_GAIN_OPT_FOR_MODE[MODE_11b] = TRUE; } } else if (!isGriffin(swDeviceID) && !isEagle(swDeviceID)) { // for derby 2.0 tmpVal = art_getFieldForMode(devNumArr[MODE_11b], "rf_mixvga_ovr", MODE_11B, 0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -