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

📄 cal_gen6.c

📁 Atheros AP Test with Agilent N4010A source code
💻 C
📖 第 1 页 / 共 3 页
字号:
    if(numPiers < AR6000_NUM_11G_CAL_PIERS) {        for(jj = ii ; jj < AR6000_NUM_11G_CAL_PIERS; jj++) {            //pEepStruct->calFreqPier11G[jj] = (A_UINT8)(freq2fbin(CalSetup.piersList_2p4[MODE_11g][ii - 1]));            pEepStruct->calFreqPier11G[jj] = 0xff;            //pCalCh = &(pRawDataset_gen5[MODE_11g]->pDataPerChannel[ii - 1]);            //fill the 11g calibration values            //fillPwrVpdData(pEepStruct->calPierData11G, pCalCh, jj);                    }    }}void fillPwrVpdData ( CAL_DATA_PER_FREQ *pCalData, RAW_DATA_PER_CHANNEL_GEN5 *pCalCh, A_UINT32 pierIndex){    A_UINT16 IndexPdg1, ii;        if(pCalCh->numPdGains == AR6000_NUM_PD_GAINS) {        //only fill pdg0 if there are 2 pdgains        pCalData[pierIndex].pwrPdg0[0] = (A_UINT8)(pCalCh->pDataPerPDGain[0].pwr_t4[0]);        pCalData[pierIndex].vpdPdg0[0] = (A_UINT8)(pCalCh->pDataPerPDGain[0].Vpd[0]);        pCalData[pierIndex].pwrPdg0[1] = (A_UINT8)(pCalCh->pDataPerPDGain[0].pwr_t4[1]);        pCalData[pierIndex].vpdPdg0[1] = (A_UINT8)(pCalCh->pDataPerPDGain[0].Vpd[1]);        pCalData[pierIndex].pwrPdg0[2] = (A_UINT8)(pCalCh->pDataPerPDGain[0].pwr_t4[2]);        pCalData[pierIndex].vpdPdg0[2] = (A_UINT8)(pCalCh->pDataPerPDGain[0].Vpd[2]);                pCalData[pierIndex].pwrPdg0[3] = (A_UINT8)(pCalCh->pDataPerPDGain[0].pwr_t4[3]);        pCalData[pierIndex].vpdPdg0[3] = (A_UINT8)(pCalCh->pDataPerPDGain[0].Vpd[3]);        /*        //note that the cal structures hold the delta pwr and Vpd, but ar6000 eeprom        //struct holds the absolute value, so need to do the addition of the delta here        pEepStruct->calPierData11A[pierIndex].pwrPdg0[1] =             pEepStruct->calPierData11A[pierIndex].pwrPdg0[0] + pCalCh->pwr_delta_t2[0][0];        pEepStruct->calPierData11A[pierIndex].vpdPdg0[1] =             pEepStruct->calPierData11A[pierIndex].vpdPdg0[0] + pCalCh->Vpd_delta[0][0];        pEepStruct->calPierData11A[pierIndex].pwrPdg0[2] =             pEepStruct->calPierData11A[pierIndex].pwrPdg0[1] + pCalCh->pwr_delta_t2[1][0];        pEepStruct->calPierData11A[pierIndex].vpdPdg0[2] =             pEepStruct->calPierData11A[pierIndex].vpdPdg0[1] + pCalCh->Vpd_delta[1][0];        pEepStruct->calPierData11A[pierIndex].pwrPdg0[3] =             pEepStruct->calPierData11A[pierIndex].pwrPdg0[2] + pCalCh->pwr_delta_t2[2][0];        pEepStruct->calPierData11A[pierIndex].vpdPdg0[3] =             pEepStruct->calPierData11A[pierIndex].vpdPdg0[2] + pCalCh->Vpd_delta[2][0];*/        IndexPdg1 = 1;    }    else {        //only fill the second pdg        IndexPdg1 = 0;    }    //fill in the 5 point cal values    for(ii = 0; ii< 5; ii++) {        pCalData[pierIndex].pwrPdg1[ii] = (A_UINT8)(pCalCh->pDataPerPDGain[IndexPdg1].pwr_t4[ii]);        pCalData[pierIndex].vpdPdg1[ii] = (A_UINT8)(pCalCh->pDataPerPDGain[IndexPdg1].Vpd[ii]);    }/*    pEepStruct->calPierData11A[pierIndex].pwrPdg1[1] =         pEepStruct->calPierData11A[pierIndex].pwrPdg0[0] + pCalCh->pwr_delta_t2[0][IndexPdg1];    pEepStruct->calPierData11A[pierIndex].vpdPdg1[1] =         pEepStruct->calPierData11A[pierIndex].vpdPdg0[0] + pCalCh->Vpd_delta[0][IndexPdg1];    pEepStruct->calPierData11A[pierIndex].pwrPdg1[2] =         pEepStruct->calPierData11A[pierIndex].pwrPdg0[1] + pCalCh->pwr_delta_t2[1][IndexPdg1];    pEepStruct->calPierData11A[pierIndex].vpdPdg1[2] =         pEepStruct->calPierData11A[pierIndex].vpdPdg0[1] + pCalCh->Vpd_delta[1][IndexPdg1];    pEepStruct->calPierData11A[pierIndex].pwrPdg1[3] =         pEepStruct->calPierData11A[pierIndex].pwrPdg0[2] + pCalCh->pwr_delta_t2[2][IndexPdg1];    pEepStruct->calPierData11A[pierIndex].vpdPdg1[3] =         pEepStruct->calPierData11A[pierIndex].vpdPdg0[2] + pCalCh->Vpd_delta[2][IndexPdg1];    pEepStruct->calPierData11A[pierIndex].pwrPdg1[4] =         pEepStruct->calPierData11A[pierIndex].pwrPdg0[3] + pCalCh->pwr_delta_t2[3][IndexPdg1];    pEepStruct->calPierData11A[pierIndex].vpdPdg1[4] =         pEepStruct->calPierData11A[pierIndex].vpdPdg0[3] + pCalCh->Vpd_delta[3][IndexPdg1];*/}void writeAr6000Label(A_UINT32 devNum) {    AR6K_EEPROM tempEepStruct;	A_UINT32 labelData[20];	A_UINT16  *pLabelArea;	A_UINT16  i;	fillAR6000EepromLabel(devNum, &tempEepStruct);	 pLabelArea = (A_UINT16 *)(&tempEepStruct.baseEepHeader.custData[2]);	//write block expects the data in array of 32 bits	for(i = 0; i < 10; i++) {		labelData[i] = *(pLabelArea + i);	}	art_eepromWriteBlock(devNum, 0x08, 10, labelData);	}void writeAr6000MacAddress(A_UINT32 devNum, A_UCHAR *pMacAddr_arr) {	A_UINT16 i;	void *pTempPtr;	AR6K_EEPROM eepStruct;		/*	if(!eepStructValid) {		art_eepromReadLocs(	devNum, 0, 512, (A_UCHAR *)(&eepStruct) );		eepStructValid = TRUE;	}*/	    art_GetEepromStruct(devNum, EEP_AR6000, &pTempPtr);	memcpy(&eepStruct, pTempPtr, sizeof(eepStruct));    eepStruct.baseEepHeader.checksum = 0x0000;		for(i = 0; i < 6; i++){	    eepStruct.baseEepHeader.macAddr[i] = pMacAddr_arr[i];	}			//Compute checksum once all other areas are filled.    computeChecksum(&eepStruct);    //write struct to eeprom     writeEepromStruct(devNum, &eepStruct);	} void fillAR6000EepromLabel (A_UINT32 devNum,  AR6K_EEPROM *pEepStruct) {	A_UINT32  tmpWord;	A_CHAR    tmpStr[10];	A_UINT32 labelData[20];	A_UINT32  word[0xF];	A_UINT32  ii, chksum;	A_UINT16  *pLabelArea = (A_UINT16 *)(&pEepStruct->baseEepHeader.custData[2]);	// Example Label : MB42_035_E_1234_a0	*(pLabelArea + 8) = yldStruct.labelFormatID;	tmpWord = ( (((yldStruct.cardType[1]) & 0xFF) << 8) |  // "B"		        ((yldStruct.cardType[0]) & 0xFF) );        // "M"	*pLabelArea = tmpWord;//	virtual_eeprom0Write(devNum, 0xb0, tmpWord);	tmpWord = ( (((yldStruct.cardType[3]) & 0xFF) << 8) |  // "2"		        ((yldStruct.cardType[2]) & 0xFF) );        // "4"	*(pLabelArea + 1) = tmpWord;//	virtual_eeprom0Write(devNum, 0xb1, tmpWord);	sprintf(tmpStr, "%2d", yldStruct.cardRev);		tmpWord = ( (tmpStr[1] << 8) |   // "5"		         tmpStr[0] );                                // "3"	*(pLabelArea + 2) = tmpWord;//	virtual_eeprom0Write(devNum, 0xb2, tmpWord);	tmpWord = ( (('_' & 0xFF) << 8) |    // "_" placeholder for spare s/n spill-over		         ((yldStruct.mfgID[0]) & 0xFF)); // "E"	*(pLabelArea + 3) = tmpWord;//	virtual_eeprom0Write(devNum, 0xb3, tmpWord);	sprintf(tmpStr, "%04d", yldStruct.cardNum);			tmpWord = ( (tmpStr[1] << 8) |          // "2"				 tmpStr[0] );               // "1"	*(pLabelArea + 4) = tmpWord;//	virtual_eeprom0Write(devNum, 0xb4, tmpWord);		tmpWord = ( (tmpStr[3] << 8) |          // "4"				 tmpStr[2] );               // "3"	*(pLabelArea + 5) = tmpWord;//	virtual_eeprom0Write(devNum, 0xb5, tmpWord);		tmpWord = ( (((yldStruct.reworkID[1]) & 0xFF) << 8) | 		        ((yldStruct.reworkID[0]) & 0xFF) );	*(pLabelArea + 6) = tmpWord;//	virtual_eeprom0Write(devNum, 0xb6, tmpWord);		sprintf(tmpStr, "-%d", yldStruct.chipIdentifier);			tmpWord = ( (tmpStr[0] << 8) |   //"-" spare		         tmpStr[1] );        //0                      	*(pLabelArea + 7) = tmpWord;//	virtual_eeprom0Write(devNum, 0xb7, tmpWord);		for(ii = 0; ii < 10; ii++) {		labelData[ii] = *(pLabelArea + ii);	}	chksum = dataArr_get_checksum(devNum, 0, 9, labelData);	*(pLabelArea + 9) = chksum;//	virtual_eeprom0Write(devNum, 0xbe, chksum);}void fillTargetPowerData ( AR6K_EEPROM *pEepStruct){    A_UINT16 ii;    for (ii=0; ii<AR6000_NUM_11A_TARGET_POWERS; ii++)    {        pEepStruct->calTargetPower11A[ii].bChannel = freq2fbin(pTargetsSet->pTargetChannel[ii].channelValue) & 0xff;        pEepStruct->calTargetPower11A[ii].tPow6to24 = (A_UINT16)(2*pTargetsSet->pTargetChannel[ii].Target24) & 0x3f;        pEepStruct->calTargetPower11A[ii].tPow36 = (A_UINT16)(2*pTargetsSet->pTargetChannel[ii].Target36) & 0x3f;        pEepStruct->calTargetPower11A[ii].tPow48 = (A_UINT16)(2*pTargetsSet->pTargetChannel[ii].Target48) & 0x3f;        pEepStruct->calTargetPower11A[ii].tPow54 = (A_UINT16)(2*pTargetsSet->pTargetChannel[ii].Target54) & 0x3f;    }    for (ii=0; ii<AR6000_NUM_11B_TARGET_POWERS; ii++)    {        pEepStruct->calTargetPower11B[ii].bChannel = freq2fbin(pTargetsSet_2p4[MODE_11b]->pTargetChannel[ii].channelValue) & 0xff;        pEepStruct->calTargetPower11B[ii].tPow6to24 = (A_UINT16)(2*pTargetsSet_2p4[MODE_11b]->pTargetChannel[ii].Target24) & 0x3f;        pEepStruct->calTargetPower11B[ii].tPow36 = (A_UINT16)(2*pTargetsSet_2p4[MODE_11b]->pTargetChannel[ii].Target36) & 0x3f;        pEepStruct->calTargetPower11B[ii].tPow48 = (A_UINT16)(2*pTargetsSet_2p4[MODE_11b]->pTargetChannel[ii].Target48) & 0x3f;        pEepStruct->calTargetPower11B[ii].tPow54 = (A_UINT16)(2*pTargetsSet_2p4[MODE_11b]->pTargetChannel[ii].Target54) & 0x3f;    }    for (ii=0; ii<AR6000_NUM_11G_TARGET_POWERS; ii++)    {        pEepStruct->calTargetPower11G[ii].bChannel = freq2fbin(pTargetsSet_2p4[MODE_11g]->pTargetChannel[ii].channelValue) & 0xff;        pEepStruct->calTargetPower11G[ii].tPow6to24 = (A_UINT16)(2*pTargetsSet_2p4[MODE_11g]->pTargetChannel[ii].Target24) & 0x3f;        pEepStruct->calTargetPower11G[ii].tPow36 = (A_UINT16)(2*pTargetsSet_2p4[MODE_11g]->pTargetChannel[ii].Target36) & 0x3f;        pEepStruct->calTargetPower11G[ii].tPow48 = (A_UINT16)(2*pTargetsSet_2p4[MODE_11g]->pTargetChannel[ii].Target48) & 0x3f;        pEepStruct->calTargetPower11G[ii].tPow54 = (A_UINT16)(2*pTargetsSet_2p4[MODE_11g]->pTargetChannel[ii].Target54) & 0x3f;    }}void fillCtlData ( AR6K_EEPROM *pEepStruct){    A_UINT16 ii, jj;     if(pTestGroupSet->numTestGroupsDefined > AR6000_NUM_CTLS) {        uiPrintf("Number of CTLs must be less than or equal to %d for AR6000.  Exiting", AR6000_NUM_CTLS);        exit(0);    }    for (ii=0; ii<pTestGroupSet->numTestGroupsDefined; ii++)    {        //the index value        pEepStruct->ctlIndex[ii] = pTestGroupSet->pTestGroup[ii].TG_Code & 0xff;        //band edge information        for(jj = 0; jj < AR6000_NUM_BAND_EDGES; jj++) {            pEepStruct->ctlData[ii].ctlEdges[jj].bChannel =                 freq2fbin(pTestGroupSet->pTestGroup[ii].BandEdge[jj]) & 0xff;            pEepStruct->ctlData[ii].ctlEdges[jj].tPower =                 (A_UINT16)(2*pTestGroupSet->pTestGroup[ii].maxEdgePower[jj]) & 0x3f;            pEepStruct->ctlData[ii].ctlEdges[jj].flag =                 pTestGroupSet->pTestGroup[ii].inBandFlag[jj] & 0x01;        }    }}void computeChecksum ( AR6K_EEPROM *pEepStruct){    A_UINT16 sum = 0, *pHalf, i;        pHalf = (A_UINT16 *)pEepStruct;    for (i = 0; i < sizeof(AR6K_EEPROM)/2; i++) {        sum ^= *pHalf++;    }    pEepStruct->baseEepHeader.checksum = 0xFFFF ^ sum;}static A_UINT32 newEepromArea[512];void writeEepromStruct ( A_UINT32 devNum, AR6K_EEPROM *pEepStruct){    A_UINT32 jj;    A_UINT16 *pTempPtr = (A_UINT16 *)pEepStruct;            for(jj = 0; jj < 512; jj++) {            newEepromArea[jj] = *(pTempPtr + jj);        }    art_eepromWriteBlock(devNum, 0, 256, newEepromArea);}void printAR6000Eeprom(A_UINT32 devNum) {    void *pTempPtr;        art_GetEepromStruct(devNum, EEP_AR6000, &pTempPtr);

⌨️ 快捷键说明

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