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

📄 test.c.bacup

📁 Atheros AP Test with Agilent N4010A source code
💻 BACUP
📖 第 1 页 / 共 5 页
字号:
            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.
        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;

⌨️ 快捷键说明

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