📄 test.c.bacup
字号:
"atheros-usb-eep.txt", // EEP file for UB cards.
"atheros-express-eep.txt", // EEP file for PCI_express
0, // override pll value
0, // pll value
0, // no eeprom unlock (ie default to allow write).
};
//lookup table for when mapping the the pci config space first time
EEPROM_PCICONFIG_MAP fullMapping[] = {
0x00, 0x00, 0x01, //deviceID, vendorID
0x08, 0x02, 0x03, //23:8 of class code, 7:0 of class code and revisionID
0x28, 0x06, 0x05, //bits 31:16 of cis_ptr, bits 15:0 cis_ptr
0x2c, 0x07, 0x08, //subsystemID, subvendorID
0x3c, 0x09, 0x0a, //max_lat and min_gnt, int_pin, reserved
0x40, 0x0c, READ_CONFIG, //pm_capabilities, keep default config value
};
A_UINT32 numMappings = sizeof(fullMapping)/sizeof(EEPROM_PCICONFIG_MAP);
typedef struct {
A_CHAR cardName[20];
A_UINT32 chipID;
A_UINT32 productID;
A_UINT32 subsystemID;
A_UINT32 numEthMacs;
A_UINT32 numWlanMacs;
} LABEL_INFO_STRUCT;
//for now create a static array of card label lookups. Need to replace this with
//an array parsed from the label.txt file
LABEL_INFO_STRUCT labelTable[] = {
"CB32", NO_CHIP_IDENTIFIER, 0, 0x1031, 0, 1,
"CB31", NO_CHIP_IDENTIFIER, 1, 0x1030, 0, 1,
"MB32", NO_CHIP_IDENTIFIER, 3, 0x2031, 0, 1,
"MB31", NO_CHIP_IDENTIFIER, 4, 0x2030, 0, 1,
"AP30", NO_CHIP_IDENTIFIER, 6, 0xa034, 1, 2,
"AP31", NO_CHIP_IDENTIFIER, 7, 0xa033, 1, 1,
"AP33", NO_CHIP_IDENTIFIER, 8, 0xa037, 1, 1,
"AP36", NO_CHIP_IDENTIFIER, 9, 0xa038, 1, 1,
"AP38", NO_CHIP_IDENTIFIER, 10, 0xa035, 1, 1,
"AP39", NO_CHIP_IDENTIFIER, 11, 0xa036, 1, 1,
"CB42", NO_CHIP_IDENTIFIER, 26, 0x1042, 0, 1,
"CB41", NO_CHIP_IDENTIFIER, 27, 0x1041, 0, 1,
"CB43", NO_CHIP_IDENTIFIER, 28, 0x1043, 0, 1,
"MB42", NO_CHIP_IDENTIFIER, 29, 0x2042, 0, 1,
"MB41", NO_CHIP_IDENTIFIER, 30, 0x2041, 0, 1,
"AP43", NO_CHIP_IDENTIFIER, 31, 0xa043, 1, 1,
"AP48", NO_CHIP_IDENTIFIER, 32, 0xa048, 1, 1,
"AP41", NO_CHIP_IDENTIFIER, 33, 0xa041, 1, 1,
"MB43", NO_CHIP_IDENTIFIER, 36, 0x2043, 0, 1,
"MB44", NO_CHIP_IDENTIFIER, 37, 0x2044, 0, 1,
"TB91", NO_CHIP_IDENTIFIER, 38, 0x2049, 0, 1,
"UB51", NO_CHIP_IDENTIFIER, 44, 0xb051, 0, 1,
"UB52", NO_CHIP_IDENTIFIER, 43, 0xb052, 0, 1,
"AV10", NO_CHIP_IDENTIFIER, 42, 0x2052, 0, 1,
"CB51", 4, 40, 0x1051, 0, 1, //griffin
"CB51", 9, 54, 0x1051, 0, 1, //griffin
"CB51", 0, 46, 0x1052, 0, 1, //griffin lite
"CB53", 4, 45, 0x1053, 0, 1, //griffin
"CB53", 0, 47, 0x1054, 0, 1, //griffin lite
"CB53", 2, 48, 0x1055, 0, 1, //lion
"MB51", 4, 41, 0x2051, 0, 1, //griffin
"MB51", 9, 53, 0x2051, 0, 1, //griffin
"MB51", 0, 49, 0x2052, 0, 1, //griffin lite
"MB53", 4, 50, 0x2053, 0, 1, //griffin
"MB53", 0, 51, 0x2054, 0, 1, //griffin lite
"MB53", 2, 52, 0x2055, 0, 1, //lion
"CU63", NO_CHIP_IDENTIFIER, 66, 0xb063, 0, 1,
"MB62", 9, 55, 0x2062, 0, 1, //eagle
"MB62", 4, 58, 0x2062, 0, 1, //eagle
"CB62", 4, 57, 0x1062, 0, 1, //eagle
"MB62", 0, 60, 0x2063, 0, 1, //eagle-lite
"CB62", 0, 61, 0x1063, 0, 1, //eagle-lite
"AP51", 4, 56, 0xa051, 1, 1, //cobra
"AP51", 0, 62, 0xa052, 1, 1, //cobra-lite
"XB62", 0, 68, 0x3063, 1, 1, //condor-lite
"XB62", 4, 67, 0x3062, 1, 1, //condor
"QQ85", 0, 65, 0x4051, 0, 1, //griffin lite - apple board
"SD10", 0, 10, 0x6010, 0, 1, //SD10 card
"SD11", 0, 11, 0x6011, 0, 1, //SD10 card
"TB11", 0, 12, 0x6022, 0, 1, //tb111 card
};
A_UINT32 sizeLabelTable = sizeof(labelTable)/sizeof(LABEL_INFO_STRUCT);
//#ifndef __ATH_DJGPPDOS__
ART_SOCK_INFO *artSockInfo = NULL;
ART_SOCK_INFO *pArtPrimarySock = NULL;
ART_SOCK_INFO *pArtSecondarySock = NULL;
//#else
//void *artSockInfo = NULL;
//#endif
static RX_GAIN_REGS_11bg rxGainValues_11bg[] =
{
#include "AR5111_rx_gain_2ghz.tbl"
} ;
static RX_GAIN_REGS rxGainValues[] =
{
#include "AR5111_rx_gain_5ghz.tbl"
};
static RX_GAIN_REGS_AR5112 rxGainValues_derby[] =
{
#include "AR5112_rx_gain_5ghz.tbl"
};
static RX_GAIN_REGS_AR5112 rxGainValues_derby_11bg[] =
{
#include "AR5112_rx_gain_2ghz.tbl"
};
static RX_GAIN_REGS_AR5112 rxGainValues_dragon[] =
{
#include "AR6000_rx_gain_5ghz.tbl"
};
static RX_GAIN_REGS_AR5112 rxGainValues_dragon_11g[] =
{
#include "AR6000_rx_gain_2ghz.tbl"
};
static XPD_GAIN_INFO xpdGainValues[] =
{
18, 7,
12, 11,
6, 13,
0, 14
};
static XPD_GAIN_INFO xpdGainValues_derby[] =
{
18, 3,
12, 2,
6, 1,
0, 0
};
XPD_GAIN_INFO *gainValues;
static char delimiters[] = " \t";
#ifndef __ATH_DJGPPDOS__
void findEepFile()
{
A_INT32 tempDevNum;
A_UINT32 tempDevID;
A_UINT32 local_tmp_index=0;
SUB_DEV_INFO devStruct;
tempDevNum = art_setupDevice(configSetup.instance);
if(tempDevNum < 0) {
uiPrintf("main: Error attaching to the device - ending test\n");
closeEnvironment();
exit(0);
}
//do a cfg read to determine which device is safe to access
tempDevID = art_cfgRead(tempDevNum, 0);
if(((tempDevID >> 16) & 0xffff) == 0xa017) {
if(configSetup.instance != 2) {
//should use the second radio
art_teardownDevice(tempDevNum);
//attempt to setup second device
tempDevNum = art_setupDevice(2);
if(tempDevNum < 0) {
uiPrintf("main: Error attaching to the device - ending test\n");
closeEnvironment();
exit(0);
}
}
}
//parse the correct eep file
if(!setEepFile(tempDevNum)) {
art_teardownDevice(tempDevNum);
closeEnvironment();
exit(0);
}
//get the deviceID from the library and use the swDevID
art_getDeviceInfo(tempDevNum, &devStruct);
swDeviceID = devStruct.swDevID;
hwDeviceID = devStruct.hwDevID;
//parse the cal section of the eep file
// load_eep_vals(tempDevNum);
parseSetup(tempDevNum);
// 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;
}
//cleanup and let the main code setup the correct devices based on findings in eep file
art_teardownDevice(tempDevNum);
// Sleep(100); added for condor emulation
}
#endif
main(int argc,char *argv[]) {
A_BOOL exitLoop = FALSE;
A_INT32 tempDevNum;
A_UINT32 devNumInst[3]; //start from 1, ignore 0
A_UINT32 devNum=INVALID_INSTANCE;
A_UINT32 devNum_2g=0;
A_UINT32 devNum_5g=0;
SUPPORTED_MODES supportedModes;
A_CHAR commentBuffer[MAX_SIZE_COMMENT_BUFFER] = {'a', 'b', 'c'};
A_UINT32 tempBackoff[3];
SUB_DEV_INFO devStruct;
A_UINT32 returnCode;
A_UINT32 sleep_enable = 0;
#ifdef _DEBUG
//Added to test for Debug version
//argv[1] ="\\remote=192.168.1.11";
// argv[2] ="\\id=0x6011";
#endif _DEBUG
#ifdef LINUX
char *tmp;
tmp = getenv("HOSTNAME");
machName = strtok(tmp, ".");
#else
machName = getenv("COMPUTERNAME");
#endif
devNumInst[1] = INVALID_INSTANCE;
devNumInst[2] = INVALID_INSTANCE;
if (parseCmdLine(argc,argv) == FALSE) {
uiPrintf("main: Failed to parse command line arguments \n");
exit (0);
}
if(initializeEnvironment(configSetup.remote) == FALSE) {
uiPrintf("main: Failed to initialize the Driver Environment\n");
exit(0);
}
//set the printLocalInfo flag dependent on whether already printed by lib
//or if have a remove client
printLocalInfo = 0;
#ifdef NO_LIB_PRINT
printLocalInfo = 1;
#endif
if(configSetup.remote) {
printLocalInfo = 1;
}
#ifndef CUSTOMER_REL
uiPrintf("Using %d card \n",configSetup.instance);
#endif
if(!parseConfig()) {
uiPrintf("Problem parsing %s, exiting...\n", CONFIGSETUP_FILE);
exit(0);
}
#ifndef __ATH_DJGPPDOS__
Sleep(1000);
if(configSetup.enableLabelScheme) {
//first try to get the label with auto detect
if(!promptForLabel(0)) {
//if auto detect doesn't work, continue to prompt for entry
while (!promptForLabel(0));
}
}
else {
if (configSetup.computeCalsetupName > 0) {
if (machName) {
sprintf(calsetupFileName, "calsetup_%s_%c%c", strlwr(machName),
tolower(yldStruct.cardLabel[0]),
tolower(yldStruct.cardLabel[1]));
if(yldStruct.chipIdentifier != NO_CHIP_IDENTIFIER) {
sprintf(calsetupFileName, "%s_%1d.txt", calsetupFileName,
yldStruct.chipIdentifier);
}
else {
sprintf(calsetupFileName, "%s.txt", calsetupFileName);
}
} else {
uiPrintf("Fatal Error : Could Not Retrieve Machine Name\n");
exit(0);
}
} else {
sprintf(calsetupFileName, "calsetup.txt");
}
}
uiPrintf("Calsetupfile Used : %s\n", calsetupFileName);
//#ifndef CONDOR_HACK
// findEepFile();
//#endif
if(configSetup.userInstanceOverride) {
devNum = art_setupDevice(configSetup.instance);
if(devNum < 0) {
uiPrintf("main: Error attaching to the device - ending test\n");
closeEnvironment();
exit(0);
}
art_configureLibParams(devNum);
//printf("SNOOP:::before reset device::Sent bytes = %d::Received bytes=%d\n", sent_bytes, received_bytes);
//sent_bytes=0;received_bytes=0;
art_resetDevice(devNum, txStation, bssID, configSetup.channel, configSetup.turbo);
//printf("SNOOP:::after reset device::Sent bytes = %d::Received bytes=%d\n", sent_bytes, received_bytes);
uiPrintf("Attached to the Device for instance = %d\n", configSetup.instance);
//for now make the assumption that both a and g are supported
devNum_5g = devNum;
devNum_2g = devNum;
}
else {
//enable the instances that are valid
if(CalSetup.modeMaskForRadio[0] != 0) {
devNumInst[1] = art_setupDevice(1);
if(devNumInst[1] < 0) {
uiPrintf("main: Error attaching to the device - ending test\n");
closeEnvironment();
exit(0);
}
//#ifdef CONDOR_HACK
//parse the correct eep file
if(!setEepFile(devNumInst[1])) {
art_teardownDevice(devNumInst[1]);
closeEnvironment();
exit(0);
}
//get the deviceID from the library and use the swDevID
art_getDeviceInfo(devNumInst[1], &devStruct);
swDeviceID = devStruct.swDevID;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -