?? test.c.bacup
字號:
/* test.c - contians an example test harness using the manufacturing library */
/* Copyright (c) 2000 Atheros Communications, Inc., All Rights Reserved */
#ident "ACI $Id: //depot/sw/branches/ART_V53_dragon/sw/src/dk/mdk/devmld/test.c#21 $, $Header: //depot/sw/branches/ART_V53_dragon/sw/src/dk/mdk/devmld/test.c#21 $"
#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__
#ifndef REGULATORY_REL
#ifdef _WINDOWS
#include <windows.h>
#endif
#include "common_hw.h"
#ifdef JUNGO
#include "mld.h"
#endif
#ifdef LINUX
#include "linux_ansi.h"
#endif
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#ifndef LINUX
#include <conio.h>
#include <io.h>
#endif
#include <string.h>
#include <ctype.h>
#include "wlantype.h"
#include "wlanproto.h"
#include "athreg.h"
#include "manlib.h" /* The Manufacturing Library */
#include "manlibInst.h" /* The Manufacturing Library Instrument Library extension */
#include "art_if.h"
#include "pci.h" /* PCI Config Space definitions */
#include "art_ani.h"
#include "test.h"
#include "cmdTest.h"
#include "parse.h"
#include "dynamic_optimizations.h"
#include "maui_cal.h"
#include "ar5523defs.h"
#include "ar2413reg.h"
#include "rate_constants.h"
#include "stats_routines.h"
#ifndef __ATH_DJGPPDOS__
#include "MLIBif.h" /* Manufacturing Library low level driver support functions */
#include "dk_cmds.h"
#else
#include "mlibif_dos.h"
#endif
#ifdef LINUX
#include <unistd.h>
#endif
#define EEPROM_BLOCK_SIZE 256
#define OFDM_11G_IDX 20
#define CCK_11G_IDX 5
#define OFDM_CCK_DEF_IDX 0
#include "ear_externs.h"
A_UINT32 sent_bytes=0, received_bytes=0;
extern A_UINT16 curr_pwr_index_offset;
extern GAIN_OPTIMIZATION_LADDER gainLadder;
extern GAIN_OPTIMIZATION_LADDER gainLadder_derby2;
extern GAIN_OPTIMIZATION_LADDER gainLadder_derby1;
GAIN_OPTIMIZATION_LADDER *pCurrGainLadder;
extern A_BOOL printLocalInfo;
// extern declarations for dut-golden sync
extern ART_SOCK_INFO *artSockInfo;
extern ART_SOCK_INFO *pArtPrimarySock;
extern ART_SOCK_INFO *pArtSecondarySock;
extern A_UINT32 **EEPROM_DATA_BUFFER;
/* === Functional Declarations === */
static A_BOOL parseCmdLine(A_INT32 argc,A_CHAR *argv[]);
static void contMenu(A_UINT32 devNum);
static void contRxMenu(A_UINT32 devNum);
static void linkMenu(A_UINT32 devNum);
static void utilityMenu(A_UINT32 devNum);
static void changeDomain(A_UINT32 devNum);
static A_BOOL parseConfig(void);
static A_BOOL processCommonOptions( A_UINT32 devNum, A_INT16 inputKey);
static A_BOOL setRxGain(A_UINT32 devNum);
static A_BOOL setRxGain_11bg(A_UINT32 devNum);
static void setRegistersFromConfig(A_UINT32 devNum);
static void updateConfigFromRegValues(A_UINT32 devNum);
static A_BOOL initTest(A_UINT32 devNum);
static A_BOOL setupMode(void);
static void printDeviceInfo(A_UINT32 devNum);
A_BOOL EEPROM_Routine(A_UINT32 devNum);
static void eraseBlock(A_UINT32 devNum);
void Display_EEPROM_menu(void);
static A_UINT16 promptForCardType(A_UINT16 *pSubSystemID);
static A_BOOL parseCmdChannelList(A_CHAR *listString);
static A_BOOL updateStructFromLabel(void);
#ifndef __ATH_DJGPPDOS__
void progBlankEEPROM(A_UINT32 devNum);
A_BOOL setEepFile(A_UINT32 devNum);
A_BOOL addToCfgTable(A_UINT16 subSystemID,A_CHAR *pFilename, A_CHAR *pEarFilename);
#endif //__ATH_DJGPPDOS__
void printConfigSettings(A_UINT32 devNum);
A_BOOL supportMultiModes(SUPPORTED_MODES *pModes);
void throughputMenu(A_UINT32 devNum);
void compute_EEPROM_Checksum(A_UINT32 devNum,A_UINT32 location);
void getSupportedModes (A_UINT32 devNum, SUPPORTED_MODES *pModes);
A_UINT32 getNextMode (SUPPORTED_MODES *pModes);
A_UINT32 getFirstMode (SUPPORTED_MODES *pModes);
extern void topCalibrationEntry(A_UINT32 *pdevNum_inst1, A_UINT32 *pdevNum_inst2) ;
extern void displayDomain(A_UINT32 domain);
extern void writeAr6000Label(A_UINT32 devNum);
extern YIELD_LOG_STRUCT yldStruct;
#ifdef __ATH_DJGPPDOS__
#define _makepath(path,drive,dir,name,ext)\
fnmerge(path,drive,dir,name,ext)
#endif
static A_UCHAR bssID[6] = {0x50, 0x55, 0x55, 0x55, 0x55, 0x05};
static A_UCHAR rxStation[6] = {0x10, 0x11, 0x11, 0x11, 0x11, 0x01}; // DUT
static A_UCHAR txStation[6] = {0x20, 0x22, 0x22, 0x22, 0x22, 0x02}; // Golden
// 1L 2L 2S 5.5L 5.5S 11L 11S
A_UCHAR DataRate[] = {6, 9, 12, 18, 24, 36, 48, 54, 0xb1, 0xb2, 0xd2, 0xb5, 0xd5, 0xbb, 0xdb,
// XR0.25 XR0.5 XR1 XR2 XR3
0xea, 0xeb, 0xe1, 0xe2, 0xe3};
// 1L 2L 2S 5.5L 5.5S 11L 11S
const A_UCHAR DataRateCode[] = {11, 15, 10, 14, 9, 13, 8, 12,
// 1L 2L 2S 5.5L 5.5S 11L 11S
0x1b,0x1a,0x1e,0x19,0x1d,0x18,0x1c,
// 0.25 0.5 1 2 3
3, 7, 2, 6, 1
};
const A_CHAR *DataRateStr[] = {" 6 Mbps", " 9 Mbps", "12 Mbps",
"18 Mbps", "24 Mbps", "36 Mbps", "48 Mbps", "54 Mbps",
"1 Mbps long", "2 Mbps long", "2 Mbps short",
"5.5 Mbps long", "5.5 Mbps short", "11 Mbps long", "11 Mbps short",
"XR 0.25 Mbps", "XR 0.5 Mbps", "XR 1 Mbps", "XR 2 Mbps", "XR 3 Mbps"};
const A_CHAR *DataRateStrTurbo[] = {" 12 Mbps", " 18 Mbps", "24 Mbps",
"36 Mbps", "48 Mbps", "72 Mbps", "96 Mbps", "108 Mbps",
"1 Mbps long", "2 Mbps long", "2 Mbps short",
"5.5 Mbps long", "5.5 Mbps short", "11 Mbps long", "11 Mbps short",
// "2 Mbps long", "4 Mbps long", "4 Mbps short",
// "11 Mbps long", "11 Mbps short", "22 Mbps long", "22 Mbps short",
"XR 0.5 Mbps", "XR 1 Mbps", "XR 2 Mbps", "XR 4 Mbps", "XR 6 Mbps"};
const A_CHAR *DataRateStrHalf[] = {" 3 Mbps", " 4.5 Mbps", "6 Mbps",
"9 Mbps", "12 Mbps", "18 Mbps", "24 Mbps", "27 Mbps",
"0.5 Mbps long", "1 Mbps long", "1 Mbps short",
"2.75 Mbps long", "2.75 Mbps short", "5.5 Mbps long", "5.5 Mbps short",
"XR 0.125 Mbps", "XR 0.25 Mbps", "XR 0.5 Mbps", "XR 1 Mbps", "XR 1.5 Mbps"};
const A_CHAR *DataRateStrQuarter[] = {" 1.5 Mbps", " 2.75 Mbps", "3 Mbps",
"4.5 Mbps", "6 Mbps", "9 Mbps", "12 Mbps", "13.5 Mbps",
"0.25 Mbps long", ".5 Mbps long", ".5 Mbps short",
"1.375 Mbps long", "1.375 Mbps short", "2.75 Mbps long", "2.75 Mbps short",
"XR 0.065 Mbps", "XR 0.125 Mbps", "XR 0.25 Mbps", "XR .5 Mbps", "XR .75 Mbps"};
const A_CHAR *DataRate_11b[] = {"1 Mbps long", "1 Mbps long",
"2 Mbps long", "2 Mbps short",
"5.5 Mbps long", "5.5 Mbps short",
"11 Mbps long", "11 Mbps short"};
A_UINT32 swDeviceID;
A_UINT32 hwDeviceID;
A_UINT32 subSystemID;
A_UINT32 macRev;
A_UINT32 bbRev;
A_UINT32 analogProdRev;
WLAN_MACADDR macAddr;
A_BOOL printLocalInfo;
A_BOOL progProm = 0;
A_UINT16 gainIMax = GAINI_MAX;
A_UINT16 gainIMin = GAINI_MIN;
A_BOOL thin_client = FALSE;
A_BOOL usb_client = FALSE;
A_BOOL sdio_client = FALSE;
A_UINT32 userEepromSize = 0x400;
A_BOOL sizeWarning;
A_CHAR calsetupFileName[128] = "";
char *machName = NULL;
A_UINT32 checkSumLength=0x400; //default to 16k
A_UINT32 eepromSize=0;
A_UINT32 glbl_devNum=0;
//Arrays needed for calculating the rx gain
//static double antennaArr[] = {4.7, -6.3};
//static double rfvgaGaindBArr[] = {2.73, -9.15, 19.32, 18.57}; // [rfgain1,rfatten0]
//static double ifvgaGaindBArr[] = {-1.66, 2.42, 7.23, 11.9, 16.3, 16.3, 16.3, -6.09};
//static A_INT32 pga1GainArr[] = {0, 6, 12, 18};
//static A_INT32 pga2GainArr[] = {0, 6, 12, 18};
//static A_INT32 pga3GainArr[] = {0, 1, 2, 3, 4, 5};
//defaults for initial configuration, although a lot of these will be overwritten
//based on the contents of the external configuration file and the register file.
MLD_CONFIG configSetup =
{
5360, //channel
0, //eeprom load
0, //eeprom load override
0, //eeprom Header load
"", //create fez config file
"", //maui sombrero config file
"", //maui sombrero beanie config file
"", //oahu sombrero config file
"", //venice sombrero config file
NULL, //pointer to current config file
MAX_SOM_CHANNEL, //max channel 5G
MIN_CHANNEL, //min channel 5G
MAX_2G_CHANNEL, //Max channel 2G
MIN_2G_CHANNEL, //Min channel 2G
0, //power override on or off
0, //external power on or off
0, //xpdGainIndex
// 3, //xpdGainIndex2
0, //xpdGainIndex2
1, //applyXpdGain
0, //data rate index
6, //data rate index throughput
USE_REG_FILE, //pcdac value, initially use values in reg file
NO_PWR_CTL, //power control method. start with none.
1, //ob
1, //db
1, //b_ob
1, //b_db
50, //gainI
CONT_TX99, //continuous mode
USE_DESC_ANT | DESC_ANT_A, //antenna
PN9_PATTERN, //data pattern
1, //turbo
USE_REG_FILE, //rxGain
0, //rf_gainBoost
0, //overwriteRxGain
0, //remote
1, //remote_exec
".", //machname
1, //instance
0, //user instance override
1, //validInstance
MODE_11A, //mode
0, //use_init
5360, //channel5
2412, //channel2_4
USE_REG_FILE, //power output
USE_REG_FILE, //rxGain 5GHz
USE_REG_FILE, //rxGain 2.4GHz
1, //packet interleave
0, //logging
"", //log file
0x0000, // dut SSID. an illegal value as default.
// "BLANK", //dut card type
// "BLANK", //cmd line dut card type
0, //don't open all 2GHz channels
0xff, //rate mask
"", //eep File Directory
0, //cfg table num elements
NULL, //cfg table ptr current
NULL, //cfg table ptr elements
0, //blank eep subsystemID
0, //cmd line subsystemID
0, //cmd line subsystemID
1500, //packet size for throughput
MIN_NUM_RETRIES, //num retries for throughput
MAX_NUM_PKTS, //num packets for throughput
0, //use unicast packets for throughput
0, //init primary ART to not AP
1, //enablePrint
0, //num slots
0, //eeprom contains valid calibration data
0, // use target powers
FALSE, //cmd line Test
0, //cmd line test mask
NULL, //test channel list
0, //Num test channels
ANTENNA_A_MASK, //antenna Mask
ANTENNA_A_MASK, //gold antenna mask
0, //iterations
"", //beacon bssid
0, //range Logging
"", //range Logfile
1000, //link packet size
100, //link num packets
100, //Signal generator number of packet
100, //SIgnal generetor number of Loopcount
REF_CLK_DYNAMIC, //default refClock
0, //beanie2928Mode
5, //5gChannelStep size
0, //enable XR
0, //load ear
0, //eep file version
0, //ear file version
0, //ear file identifier <filename_1.ear ==> 1>
DO_OFSET_CAL | DO_NF_CAL, //hw calibration
// ART_ANI_ENABLED, //ART ANI enabled by default
ART_ANI_DISABLED, //ART ANI disabled initially
ART_ANI_REUSE_ON, //ART ANI levels reuse on by default
{0,0,0}, //ART ANI levels
100, // max RX gain
0, // min RX gain
FALSE, // userDutIdOverride
0x00, // eeprom2StartLocation
0, // computeCalsetupName
"", // eep backup filename
"", // eep restore filename
0, // compare single value
0, // apply ctl limit
0, // ctl to apply
0, // debugInfo flag
"INVALID", // manufName
"", // yieldLogFile
0, // enable label scheme
0, // Scramble mode on by default
0, // print pci writes
0, //quarter channel
"atheros-eep.txt", // EEP file for cb/mb cards.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -