?? cal_com.c
字號:
#ifdef __ATH_DJGPPDOS__
#include <unistd.h>
#ifndef EILSEQ
#define EILSEQ EIO
#endif // EILSEQ
#define __int64 long long
#define HANDLE long
typedef unsigned long DWORD;
#define Sleep delay
#include <bios.h>
#include <dir.h>
#endif // #ifdef __ATH_DJGPPDOS__
//Added FOr Wince
/*
#ifdef _WINDOWS
#include <windows.h>
#endif
*/
#include <stdio.h>
#ifndef LINUX
#include <conio.h>
#endif
#include <windows.h>
#include <string.h>
#include <math.h>
#include <malloc.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdarg.h>
#include "wlantype.h" /* typedefs for A_UINT16 etc.. */
#include "wlanproto.h"
#include "athreg.h"
#include "manlib.h" /* The Manufacturing Library */
#include "MLIBif.h" /* Manufacturing Library low level driver support functions */
#ifdef JUNGO
#include "mld.h" /* Low level driver information */
#endif
#include "common_hw.h"
#ifdef __ATH_DJGPPDOS__
#include "mlibif_dos.h"
#endif
#include "manlibInst.h" /* The Manufacturing Library Instrument Library extension */
#include "mEeprom.h" /* Definitions for the data structure */
#include "test.h"
#include "parse.h"
#include "dynArray.h"
#include "art_if.h"
#include "dynamic_optimizations.h"
#include "maui_cal.h" /* Definitions for the Calibration Library */
#include "dk_ver.h"
// non-ansi functions are mapped to some equivalent functions
#ifdef LINUX
#include "linux_ansi.h"
#endif
extern A_UINT32 eepromSize;
A_UINT16 numRAWChannels_2p4 = 3;
GOLDEN_PARAMS goldenParams = { 4900,5850,20,70,0,63, 1,
11,{0,10,20,30,40,50,60,70,80,90,100} } ;
CAL_SETUP CalSetup = {42, 0, ATHEROS_CB22, 0x01, EEPROM_SIZE_16K, 0x168C,
0, 0, 0x010, // country code, WWR, default domain 0x010 (FCC)
0, // calpower
0, // useFastCal
0, 0, 0, 0, 0, 0, 0, 0, // 11a test flags
{0,0,0}, .5, 1.0, // target power test flags: g/b/a modes
// {-68, -68, -68, -68, -68, -68, -68, -68}, //target 11a sensitivity at 54 mbps
0, 3, 11.0, // 11a golden power cal data
{3,3}, {-2.0, -2.0}, // 11g and 11b golden pcdacs and power
//** the following remarked by ccshiang
/***
PM_436A, 13, // PM_model number and GPIB addresses
SPA_E4404B, 18, // SA_model number and GPIB addresses
ATT_11713A, 6, // ATT_model number and GPIB addresses
***/
//** the above remarked by ccshiang
//** the following added by ccshiang
PM_436A, // PM_model number and GPIB addresses
SPA_E4404B, // SA_model number and GPIB addresses
ATT_11713A, // ATT_model number and GPIB addresses
//** the above added by ccshiang
11.3,11.3, 50, // attenuation factors
{10.0, 10.0},{10.0, 10.0}, {30.0, 30.0}, //2.5G atten factors
1, // numEthernetPorts
0, // startEthernetPort
0, 0, 0, // turbo_disable, turbo_disable_11g, rf_silent
1, // deviceType
15, 15, // turboMaxPwr_5G, TurboMaxPower_11g
1,0,0, // Amode, Bmode, Gmode
0,0, // antennaGain5G and 2.5G
// 11a parameters
0x2D, 0xB, 2, 2, 2,2, 1,2, 1,2, 0x1C, 0, 0, 0xE, 1, 13, 14, -85, -32, -72,
{0,0,0,0,0,0,0,0,0,0,0},
{0, 0, 0}, // fixed_bias
TRUE, // do_iq_cal
{0, 0, 0}, // iqcal_i_corr
{0, 0, 0}, // iqcal_q_corr
//ofdm@2.4 and 11b parameters
{0x2D,0x2D}, {0xB, 0xB},
{2,2}, {2,2}, {3,3}, {3,3}, // ob/db, b_ob/b_db
{0x1C, 0x1C}, {0,0}, {0,0},
{0xE, 0xE}, {1,1}, {13,13}, {13,13}, {-70,-75}, {-32,-32}, {-72,-72},
{{0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0}},
0, "cal_AR5211_power.log", // readFromFile
0, // customrDebug
0, // showTimingReport
FALSE, // endTestOnFail
"L:\\ART\\macid.txt",
"",
0, {0,0}, 0, // force piers, list, num_piers
{0,0}, {{2312, 2412, 2484}, {2412, 2442, 2484}}, {3,3}, // force piers info for 11g, 11b
FALSE, // useOneCal for 11g/11b
// 40, // pcdac_5dB
"calTargetPower_cb21.txt",
{FALSE, FALSE},
{"cal_AR5211_Power_11g.log", "cal_AR5211_Power_11b.log"},
// {FALSE, FALSE}, // was calpower_11g, 11b
// {1,1},
{FALSE, FALSE},
{FALSE, FALSE},
{FALSE, FALSE},
{FALSE, FALSE}, // no turbo mode available in 11b, though
{FALSE, FALSE, FALSE}, // testTempMargin
FALSE, // test32KHzSleepCrystal
{FALSE, FALSE, FALSE}, // testDataIntegrity
{FALSE, FALSE, FALSE}, // testThroughput
FALSE, // testTXPER_margin
{{-68, -68, -68}, {-88, -88},{-68, -68, -68, -68, -68, -68, -68, -68}}, // target sensitivity for 11g, 11b and 11a modes
//{{4, 1, 1, 0}, {4, 1, 1, 0}, {4, 1, 1, 0}, {4, 1, 1, 0}},
"0.0.0.0", // golden IP address
45, // case Temperature
{0, 0, 0}, // falsedetect backoff for all modes
90, 90, 9, -9, 7, -7, 0, // test limits
{30.0, 30.0, 30.0}, // maxPowerCap for 11a/11g/11b modes
1.5, // cck_ofdm_delta in dB
1.5, // ch14_filter_cck_delta in dB
3, // maxRetestIters
{INVALID_FG, INVALID_FG, INVALID_FG},
0, // eeprom_map 0 - gen2, 1 - gen3
{0x9, 0x9, 0x9}, // cal_mult_xpd_gain_mask
0x2BF, // EAR start addr
0, // EAR Len
0, // UartPciCfgLen
0x1A5, // TrgtPwr start
0x150, //calStart address
{100, 100, 100}, // number of packets to use for sensitivity
10, // txperBackoff
0, // Enable_32khz - enable sleep crystal.
0, // Enable_WOW - enable Wake_On_WLAN
{16, 16, 11}, // rxtx_margin_2ghz for all modes
7.5, // ofdm_cck_gain_delta
{1, 1, 1}, // instanceForMode
{0x3, 0}, // modeMaskForRadio
0, 0, 0, 0, // iq_coeffs for 5G 2G
FALSE, // atherosLoggingScheme
0, //ftpdownload info, disable ftpdownload
"", "", "", "", "", //hostname, username, password, remote and local filename
{0x2D,0x2D, 0x2D}, // switchSettling_Turbo
{0xB, 0xB, 0xB}, // txrxAtten_Turbo
{-32,-32, -32}, // adcDesiredSize_Turbo
{-72,-72, -72}, // pgaDesiredSize_Turbo
{16, 16, 11}, // rxtx_margin_2ghz for all modes Turbo
0, 0, 0, //uart enable. compression disable, fast frame disable
0, 0, //bursting disble, AES disable
0, 0, //max num QCU - 0 defaults to current max, key cache size - 0 defaults to current max
0, //enableHeavyClip
0, //xr disable
0, 0, 0, 0, 0, 0, //new japan flags
1, // enableDynamicEAR
1, // numDynamicEARChannels
{2442,0,0,0,0,0,0,0}, // dynamicEARChannels
0x2000, // dynamicEARVersion
0,
63, // 11a max pcdac
63, // 11b max pcdac
63, // 11g max pcdac
2, // numPdGains
{22, 48, 48, 48}, // pdGainBoundary
10, // pdGainOverlap
0, // 11a attempt power if max pcdac < 63 does not get there
0, // 11b attempt power
0, // 11g attempt power
};
YIELD_LOG_STRUCT yldStruct = { {0xFFFF, 0xFFFF, 0xFFFF},
{0xFFFF, 0xFFFF, 0xFFFF},
{0xFFFF, 0xFFFF, 0xFFFF},
{0xFFFF, 0xFFFF, 0xFFFF},
{0xFFFF, 0xFFFF, 0xFFFF},
{0xFFFF, 0xFFFF, 0xFFFF},
{0xFFFF, 0xFFFF, 0xFFFF},
{0xFFFF, 0xFFFF, 0xFFFF},
"CB42", // cardType
35, // cardRev
9999, // cardNum
"unk", // testName
9999.9, // param1
9999.9, // param2
9999.9, // param3
"unk", // result
"unk", // measName
9999.9, // target
9999.9, // meas
"unk", // measUnit
"unk", // meas2Name
9999.9, // meas2
"unk", // meas2Unit
"unk", // mode
9999, // devNum
"A", // manufID
"a0", // reworkID
0xF000, // label format version
"unk" // card_label
};
TARGETS_SET TargetsSet ;
TARGETS_SET TargetsSet_11b ;
TARGETS_SET TargetsSet_11g ;
TARGETS_SET *pTargetsSet = &TargetsSet ;
TARGETS_SET *pTargetsSet_2p4[2] = {&TargetsSet_11g, &TargetsSet_11b} ;
extern A_UCHAR calsetupFileName[];
extern A_UINT32 VERIFY_DATA_PACKET_LEN;
extern A_UINT32 **EEPROM_DATA_BUFFER;
extern A_BOOL usb_client;
TEST_GROUP_SET TG_Set ;
TEST_GROUP_SET *pTestGroupSet= &TG_Set ;
TEST_SET TestSet_11g ;
TEST_SET TestSet_11b ;
TEST_SET TestSet_11a ;
TEST_SET *pTestSet[3] = {&TestSet_11g, &TestSet_11b, &TestSet_11a} ;
char modeName[3][122] = {"11g", "11b", "11a"};
double ofdm_gain[] = {-30, -12, -6, -2.5, 0, 2, 3.5, 5};
double cck_gain[] = {0, -6, -12};
//extern GOLDEN_PARAMS goldenParams ;
A_UINT16 global_prev_gainf = 0;
static void remapPCIConfigInfo
(
A_UINT32 devNum,
A_UINT32 *eepromData
);
static void write_spur_info
(
A_UINT32 devNum,
A_UINT32 *common_eeprom_data
);
void load_cal_section(void)
{
FILE *fStream;
char lineBuf[122], *pLine;
A_UINT32 testVal;
A_UINT16 ii ;
A_BOOL parsingCal = FALSE ;
A_UINT16 parsingLine1 = 1;
char delimiters[] = " \t\n\r;=" ;
char *eep_file = configSetup.cfgTable.pCurrentElement->eepFilename;
// uiPrintf("\nSNOOP: Reading in Cal Section from %s\n", eep_file);
// printf("FILE NAME IS %s\n",eep_file);
if( (fStream = fopen( eep_file, "r")) == NULL ) {
uiPrintf("Failed to open %s - using Defaults\n", eep_file);
return;
}
while(fgets(lineBuf, 120, fStream) != NULL) {
pLine = lineBuf;
while(isspace(*pLine)) pLine++;
if(strnicmp("@cal_section_begin", pLine, strlen("@cal_section_begin")) == 0) {
parsingCal = TRUE;
ii = 0;
continue;
}
// skip comments
if(*pLine == '#') {
continue;
}
while(parsingCal && (fgets(lineBuf, 120, fStream) != NULL)) {
pLine = lineBuf;
// pLine = strtok(pLine, delimiters);
// while(isspace(*pLine)) pLine++;
if(pLine == NULL) continue;
if(strnicmp("@cal_section_end", pLine, strlen("@cal_section_end")) == 0) {
parsingCal = FALSE;
}
if (pLine[0] == '#') {
continue ;
}
else if((strnicmp("TARGET_POWER_FILENAME", pLine, strlen("TARGET_POWER_FILENAME")) == 0) &&
((pLine[strlen("TARGET_POWER_FILENAME")] == ' ') ||
(pLine[strlen("TARGET_POWER_FILENAME")] == '\t') ) ){
pLine = strchr(pLine, '=');
pLine = strtok(pLine, delimiters);
if(!sscanf(pLine, "%s", CalSetup.tgtPwrFilename)) {
uiPrintf("Unable to read the TARGET_POWER_FILENAME from %s\n", eep_file);
}
}
else if(strnicmp("EEPROM_MAP_TYPE", pLine, strlen("EEPROM_MAP_TYPE")) == 0) {
pLine = strchr(pLine, '=');
pLine = strtok(pLine, delimiters);
if(!sscanf(pLine, "%d", &CalSetup.eeprom_map)) {
uiPrintf("Unable to read the EEPROM_MAP_TYPE from %s\n", eep_file);
}
}
else if(strnicmp("SUBSYSTEM_ID", pLine, strlen("SUBSYSTEM_ID")) == 0) {
pLine = strchr(pLine, '=');
pLine = strtok(pLine, delimiters);
CalSetup.subsystemID = (A_UINT16) strtoul(pLine, NULL, 0);
}
else if(strnicmp("PRODUCT_ID", pLine, strlen("PRODUCT_ID")) == 0) {
pLine = strchr(pLine, '=');
pLine = strtok(pLine, delimiters);
CalSetup.productID = (A_UINT16) strtoul(pLine, NULL, 0);
}
else if(strnicmp("EEPROM_SIZE", pLine, strlen("EEPROM_SIZE")) == 0) {
pLine = strchr(pLine, '=');
pLine = strtok(pLine, delimiters);
CalSetup.eepromLength = (A_UINT32) strtoul(pLine, NULL, 0);
if(CalSetup.eepromLength == 0)
{
userEepromSize = 0x400;
}
else
userEepromSize = (CalSetup.eepromLength*1024)/16;
}
else if(strnicmp("NUM_ETHERNET_PORTS", pLine, strlen("NUM_ETHERNET_PORTS")) == 0) {
pLine = strchr(pLine, '=');
pLine = strtok(pLine, delimiters);
if(!sscanf(pLine, "%d", &CalSetup.numEthernetPorts)) {
uiPrintf("Unable to read the NUM_ETHERNET_PORTS from %s\n", eep_file);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -