Files
smod_atsc_app/atsc_app/adrv9009/ad9009_fun.c
T

3469 lines
86 KiB
C
Executable File

#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
#include <fcntl.h>
//#include "../common.h"
#include "../inc/type.h"
#include "talise_config.h"
#include "ad9009_fun.h"
#include "adrv9009_config.h"
#include "adrv9009.h"
//#define ENSYSREFS 1
#define RSTSYSREFS 1
#define DDAS_CONFIG
#define SEL_CHIPS 1
#define ARGC_CMD_INDEX 2
#define ARGC (argc - 1)
#define ARGV (argvv + 1)
extern char argvarr[8][32];
//extern char * argvarr[8];
extern int argc;
extern char *argvv[8];
extern taliseDevice_t myTaliseDevice;
extern taliseDevice_t *p_myTaliseDevice ;//= &myTaliseDevice;
extern taliseDevice_t *p_myTaliseDevice_shm;
extern taliseInit_t myTalInit;
extern taliseInit_t *p_myTalInit;
char **argv_2;
char **argv_3;
char **argv_4;
//--------------------------------------------------------------------------------
void usr_printf_radiooff(char *pstr){
printf("> radioOff by %s\n", pstr);
}
/*******************************************************************
fuction: str2digit
description: convert a string in "str" to a int "digit" according to the given "base".
return value: return 0 if successed, -1 otherwise.
*******************************************************************/
int str2digit(const char *str, unsigned *digit, int base)
{
int ret = ERROR;
int temp = 0;
char *endptr;
if(NULL != str)
{
temp = strtoul(str, &endptr, base);
if(0 == *endptr)
{
*digit = temp;
ret = OK;
}
}
return ret;
}
/*******************************************************************
fuction: str2digit
description: convert a string in "str" to a int "digit" according to the given "base".
return value: return 0 if successed, -1 otherwise.
*******************************************************************/
int str2digit_u64(const char *str, uint64_t *digit, int base)
{
int ret = ERROR;
uint64_t temp = 0;
char *endptr;
if(NULL != str)
{
#if 0 //@ccTEST
temp = strtouq(str, &endptr, base);
#else
temp = strtoull(str, &endptr, base);
#endif
if(0 == *endptr)
{
*digit = temp;
ret = OK;
}
}
return ret;
}
int str2digit_s32(const char *str, int *digit, int base)
{
int ret = ERROR;
int temp = 0;
char *endptr;
if(NULL != str)
{
temp = strtol(str, &endptr, base);
if(0== *endptr)
{
*digit = temp;
ret = OK;
}
}
return ret;
}
//--------------------------------------------------------------------------------
static const AD9009_CMD_STRUCT AD9009_CMDTAB[] =
{
{"help", 2,2, ad9009_help, "ad9009 command help",
"usage: ad9009 help "},
{"ver", 2,2, ad9009_ver_print, "ad9009 version",
"usage: ad9009 ver "},
{"api_ver", 2,2, ad9009_api_ver_print, "ad9009 api_ver",
"usage: ad9009 <num> api version "},
{"init_dev", 2,2, ad9009_TALISE_init, "init AD9009",
"usage: ad9009 <num> init_dev "},
// {"init_clk", 2,2, TALISE_initClocks, "init ad9009 clocks",
// "usage: ad9009 <num> init_clk "},
//{"rd", 4,4,ad9009_rd,"read ad9009 reg",
// "usage: ad9009 <num> rd <addr(hex)> <count(hex)> "},
//{"wr", 4,4,ad9009_wr,"write ad9009 reg",
// "usage: ad9009 <num> wr <addr(hex)> <value(hex)> "},
{ "set_freq", 4, 4, ad9009_TALISE_setRfPllFreq,"set pll freq",
"usage: ad9009 <num> set_freq <1:RF,2:AUX> <freq> "},
{"get_freq", 3,3,ad9009_TALISE_getRfPllFreq,"get pll freq",
"usage: ad9009 <num> get_freq <0:CLK,1:RF,2:AUX> "},
{"check_pll_lock", 2,2, ad9009_TALISE_checkRfPllLock, "Check plls lock",
"usage: ad9009 <num> check_pll_lock "},
//10
#if 0
{"check_arm_state", 2,2, TALISE_chkArmState, "Check arm state",
"usage: ad9009 <num> check_arm_state "},
#endif
{"get_arm_ver", 2,2, ad9009_TALISE_gtArmVersion, "get arm version",
"usage: ad9009 <num> get_arm_ver "},
{"run_cals", 3,3, ad9009_TALISE_runInitCalsManual, "run init cals",
"usage: ad9009 <num> run_cals <enableMask:32bit> "},
{"rst_ext_lol_ch", 3,3, ad9009_TALISE_rstExtTxLolChannel, "rstExtTxLolChannel",
"usage: ad9009 <num> rst_ext_lol_ch <ch:0/1/2/3--TXOFF/TX1/TX2/TX1_TX2>"},
{"radio_switch", 3,3, ad9009_TALISE_radioSwitch,"set radio switch on or off",
"usage: ad9009 <num> radio_switch <1:on,0:off> "},
{"radio_state", 2,2, ad9009_TALISE_getRadioStatus, "get radio state",
"usage: ad9009 <num> radio_state "},
{"en_track_cals", 3,3, ad9009_TALISE_enTrackingCals, "en track cals",
"usage: ad9009 <num> en_track_cals <enableMask:10bit> "},
{"reschedule_trackingcal", 3,3, ad9009_TALISE_rescheduleTrkingCal, "reschedule_TrackingCal",
"usage: ad9009 <num> reschedule_trackingcal <trackingCal:16bit> "},
{"get_trackingcals",2,2, ad9009_TALISE_getTrackingCals, "get enabled trackingCals",
"usage: ad9009 <num> get_trackingcals "},
{"get_pdtrackingcals",2,2, ad9009_TALISE_getPdingTrackingCals, "get pending trackingCals",
"usage: ad9009 <num> get_pdtrackingcals "},
//20
{"get_txlolStatus", 3,3, ad9009_TALISE_gtTxLolStatus, " get TxLolStatus",
"usage: ad9009 <num> get_txlolStatus <txChannel:1/2-tx1/tx2> "},
{"get_txqecstatus", 3,3, ad9009_TALISE_gtTxQecStatus, " get TxQecStatus",
"usage: ad9009 <num> get_txqecstatus <txChannel:1/2-tx1/tx2> "},
{"get_rxqecstatus", 3,3, ad9009_TALISE_gtRxQecStatus, " get RxQecStatus",
"usage: ad9009 <num> get_rxqecstatus <rxChannel:1/2-rx1/rx2> "},
{"get_orxqecstatus", 3,3, ad9009_TALISE_gtOrxQecStatus, " get OrxQecStatus",
"usage: ad9009 <num> get_orxqecstatus <orxChannel:1(5)/2(6)-OBS_RX1_TXLO(OBS_RX1_SNIFFERLO)/RX2>"},
{"read_armcmdstatus",2,2, ad9009_TALISE_rdArmCmdStatus, "read_armCmdStatus",
"usage: ad9009 <num> read_armcmdstatus "},
#if 0
{"rst_deframer", 2,2, TALISE_rstDeframer, "reset deframer",
"usage: ad9009 <num> rst_deframer "},
#endif
{"setup_serializers", 2,2, ad9009_TALISE_stupSerializers, "setup Serializers",
"usage: ad9009 <num> setup_serializers "},
{"setup_deserializers", 2,2, ad9009_TALISE_stupDeserializers, "setup deserializers",
"usage: ad9009 <num> setup_deserializers "},
{"setup_framer", 4,4, ad9009_TALISE_setupJesd204b, "setup jesd204b <framer,Deframer> <FRAMER_A,FRAMER_B,FRAMER_AandB>",
"usage: ad9009 <num> setup_framer <0:framer,1:Deframer> <0:FRAMER_A,1:FRAMER_B,2:FRAMER_AandB>"},
{"en_link", 5,5, ad9009_TALISE_enableLink, "enable RxFramer or ObsRxFramer link",
"usage: ad9009 <num> en_link <0:RxFramer,1:ObsRxFramer><0:disable,1:enable><0:FRAMER_A,1:FRAMER_B,2:FRAMER_AandB>"},
//30
{"enable_multichipsync",3,3, (int32_t (*)(int32_t, char **))TALISE_enableMultichipSync, "enable MultichipSync",
"usage: ad9009 <num> enable_multichipsync <enableMcs> "},
{"en_sysref", 5,5, ad9009_TALISE_enableSysref, "enable sysref to RxFramer or DeFramer",
"usage: ad9009 <num> en_sysref <0:RxFramer,1:Deframer><0:disable,1:enable> <0:FRAMER_A,1:FRAMER_B,2:FRAMER_AandB> "},
{"rd_framer_status", 4,4, ad9009_TALISE_read_framerStatus, "read framer status",
"usage: ad9009 <num> rd_framer_status <0:RxFramer,1:Deframer><0:FRAMER_A,1:FRAMER_B,2:FRAMER_AandB>"},
{"get_fifodepth", 2,2, ad9009_TALISE_gtDeframerFifoDepth, "get Deframer Fifo Depth",
"usage: ad9009 <num> get_fifodepth "},
{"en_f_prbs", 5,5, ad9009_TALISE_enFramerPrbs, "enable rx obsrx framer",
"usage: ad9009 <num> en_f_prbs <0:rxframer,1:obsRxframer><order 0:PRBS7,1:PRBS15,2:PRBS31><disen:0,en:1>"},
{"en_inject_test", 5,5, ad9009_TALISE_enTestFramerPrbsData, "enable tx obsrx framer",
"usage: ad9009 <num> en_inject_test <FramerSel:0:frm_A,1:frm_A 2:A_B><rDataSource 0:PRBS7,1:PRBS15,2:PRBS31><InjectPoint:0,en:1>"},
{"inject_prbs", 3,3, ad9009_TALISE_InjectPrbsError, "rx & obsrx Inject Prbs Error",
"usage: ad9009 <num> inject_prbs <0:RxFramer,1:ObsRxFramer> "},
{"en_def_prbs", 4,4, ad9009_TALISE_enDeFramerPrbs, "enable deframer prbs",
"usage: ad9009 <num> en_def_prbs <order 0:PRBS,1:PRBS7,2:PRBS15,3:PRBS31><0:LANEDATAen,1:SAMPLEDATA>"},
{"clear_prbs", 2,2, ad9009_TALISE_clrDeframerPrbsCounters, "clear Deframer Prbs Counters",
"usage: ad9009 <num> clear_prbs "},
{"read_prbs", 3,3, ad9009_TALISE_rdDeframerPrbsCounters, "read Deframer Prbs Counters",
"usage: ad9009 <num> read_prbs <counterSelect:0-3> "},
{"ilas_check", 2,2, ad9009_TALISE_IlasCheck, "jesd 204b Ilas Check",
"usage: ad9009 <num> ilas_check "},
//40
{"set_data", 4,4, ad9009_TALISE_setFramerDataSource, "set rx or obsRx Framer Data Source",
"usage: ad9009 <num> set_data <0:rxFramer,1:obsRxFramer> <value:0-disable or 1-enable>"},
{"set_rx_gain", 4,4, ad9009_TALISE_setRxManualGain, "set Rx ManualGain",
"usage: ad9009 <num> set_rx_gain <1:TAL_RX1,2:TAL_RX2> <value:200-255> "},
{"get_rx_gain", 3,3, ad9009_TALISE_getRxGain, "get Rx Gain",
"usage: ad9009 <num> get_rx_gain <1:TAL_RX1,2:TAL_RX2> "},
{"en_gain_pluse", 4,4, ad9009_TALISE_enGainCtrSyncPulse, "enable Gain Ctr SyncPulse",
"usage: ad9009 <num> en_gain_pluse <0:rxGain,1:obsGain><enableBit:0/1> "},
{"set_gain_mode", 4,4, ad9009_TALISE_stGainControlMode, "set Gain Control Mode",
"usage: ad9009 <num> set_gain_mode <0:rxGain,1:obsGain><0:MGC,2:AGC,3:HYBRID>"},
{"get_dec_pwr", 3,3, ad9009_TALISE_getRxDecPower, "get rx decPower ",
"usage: ad9009 <num> get_dec_pwr <ch:0-off,1-rx1,2-rx2 ,3:rx1rx2> "},
{"set_obsrx_path", 3,3, ad9009_TALISE_setObsRxPath, "set ObsRx Path Source",
"usage: ad9009 <num> set_obsrx_path <path:0-off,1-rx1_lo,2rx2_lo,3-interCal> "},
{"get_obsrx_path", 2,2, ad9009_TALISE_gtObsRxPath, "set ObsRx Path Source",
"usage: ad9009 <num> get_obsrx_path "},
{"set_obs_gain", 4,4, ad9009_TALISE_setObsManualGain,"set ObsRx ch Gain",
"usage: ad9009 <num> set_obs_gain <ch:0-off,1-rx1,2-rx2> <value:200-255(dec)>"},
{"set_tx_att", 4,4, ad9009_TALISE_setTxAttenuation, "set Tx Attenuation",
"usage: ad9009 <num> set_tx_att <0:tXOFF,1:tX1,2:tX2,3:tX1tX2><value:0-41950mdB> "},
//50
{"get_tx_att", 3,3, ad9009_TALISE_getTxAttenuation, "get Tx Attenuation",
"usage: ad9009 <num> get_tx_att <0:tXOFF,1:tX1,2:tX2,3:tX1tX2> "},
{"en_tx_nco", 5,5, ad9009_TALISE_enTxNco, "en Tx Nco",
"usage: ad9009 <num> en_tx_nco <0:dis,1:en><tx1Freq_kHz dec><tx2Freq_kHz dec>"},
{"rd_dac_power", 3,3, ad9009_TALISE_readDacPower, "read Dac Power",
"usage: ad9009 <num> rd_dac_power <1:tx1,2:tx2> "},
{"set_armgpio", 2,2, ad9009_TALISE_stArmGpioPins, "set Arm Gpio Pins",
"usage: ad9009 <num> set_armgpio "},
{"set_radiopin_mode", 2,2, ad9009_TALISE_stRadioControlPinMode, "set RadioControlPinMode",
"usage: ad9009 <num> set_radiopin_mode "},
{"setup_adc", 4,4, ad9009_TALISE_setupAdc, "setup Aux Adcs",
"usage: ad9009 <num> setup_adc <adcDecimation:0-7><enable:0,1> "},
{"set_adc_ch", 3,3, ad9009_TALISE_setAdcChannel, "set AuxAdc Channel",
"usage: ad9009 <num> set_adc_ch <channel:0-3,15 tempCh> "},
{"rd_auxadc", 2,2, ad9009_TALISE_readAdc, "read AuxAdc",
"usage: ad9009 <num> rd_auxadc "},
{"set_obs_g_mode", 3,3, ad9009_TALISE_setObsGainControlMode,"set ObsRx Gain ctrl mode",
"usage: ad9009 <num> set_obs_g_mode <value:0-m,2-auto,3-f> "},
//60
{"get_obs_gain", 2,2, ad9009_TALISE_getObsRxGainValue,"get ObsRx Gain",
"usage: ad9009 <num> get_obs_gain "},
{"wr_auxdac", 4,4, ad9009_TALISE_wrAuxDac, "write Aux Dac,Index[0,9],Code[0,1023]",
"usage: ad9009 <num> wr_auxdac<auxDacIndex><auxDacCode> "},
{"extlol", 2,2, ad9009_TALISE_enable_extlol, "enable_extlol",
"usage: ad9009 <num> extlol "},
{"extlol_rmoff", 2,2, ad9009_TALISE_enable_extlol_rmOff, "enable_extlol_rmoff",
"usage: ad9009 <num> extlol_rmoff "},
{"extlol_track", 2,2, ad9009_TALISE_enable_extlol_justTrack, "enable_extlol_justtrack",
"usage: ad9009 <num> extlol_track "},
{ "set_rfpllfreq", 4, 4, ad9009_TALISE_setRfPllFreq_1,"set rf pll freq",
"usage: ad9009 <num> set_rfpllfreq <1:RF,2:AUX> <freq> "},
{"run_cals_manual", 2,2, ad9009_TALISE_runInitCalsManual_1, "run init cals",
"usage: ad9009 <num> run_cals_manual "},
{"set_rxgainpin", 8,8, ad9009_TALISE_stRx1GainCtrlPin, "TALISE_stRx1GainCtrlPin",
"usage: ad9009 <num> set_rx1gainpin <channel incstep decstep rx1Incpin rx1Decpin enable>"},
{ "get_temp", 2, 2, ad9009_TALISE_getTempStatus, "TALISE_getTempStatus", "usage: ad9009 <num> get_temp " },
{ "set_trackCal", 4, 4, ad9009_TALISE_setTrackCal, "TALISE_setTrackCal", "usage: ad9009 <num> set_trackCal <subTrack,trackCals> " },
{ "get_trackCal", 2, 2, ad9009_TALISE_getTrackCal, "TALISE_getTrackCal", "usage: ad9009 <num> get_trackCal " },
{ "ad9009_extlol1", 2, 2, ad9009_TALISE_Ext_LOL_Cal_1, "TALISE_Ext_LOL_Cal_TX1", "usage: ad9009 <num> ad9009_extlol1 " },
{ "ad9009_extlol2", 2, 2, ad9009_TALISE_Ext_LOL_Cal_2, "TALISE_Ext_LOL_Cal_TX2", "usage: ad9009 <num> ad9009_extlol2 " },
{ "test1", 2, 2, ad9009_TALISE_Test, "TALISE_Test", "usage: ad9009 <num> test1 " },
{ "set_rfpllfreq_cals", 4, 4, ad9009_TALISE_setRfPllFreq_cals,"set rf pll freq and init cals",
"usage: ad9009 <num> set_rfpllfreq_cals <1:RF> <freq> "},
};
#define AD9009_CMDTAB_SIZE (sizeof(AD9009_CMDTAB)/sizeof(AD9009_CMD_STRUCT))
const int AD9009_CMD_NUM = AD9009_CMDTAB_SIZE;
#define AD9009_MAX_CHIPS 2
struct ad9009Info
{
int bandType;
taliseDeviceInfo *ptaliseDeviceInfo[2];
};
static struct ad9009Info ad9009Info[] = {
{1800, {&taliseDeviceInfo1, &taliseDeviceInfo2}},
};
static int ad9009InfoMaxCnt = sizeof(ad9009Info) / sizeof(ad9009Info[0]);
#ifdef USE_CPP_LIBDRIVER
Ad93xx *gAd93xx[10] = { 0 };
#endif
//int ad9009_main(void)
int ad9009_main(int argc,char *argv[])
{
/* int i,j;
u32 sel_chips;
int which_9009;
struct ad9009Info *pAd9009Info;
taliseDeviceInfo *pTaliseDeviceInfo;
// void *Ad93xx_instance = NULL;
argv_2=NULL;
if (argc <= ARGC_CMD_INDEX)
{
ad9009_help(0, NULL);
return OK;
}
//printf("ad9009_main:AD9009_CMD_NUM=%d.argc=%d.argv:\r\n",AD9009_CMD_NUM,argc);
for (i = 2; i < AD9009_CMD_NUM; i++)
{
if (0 == strcmp(argv[ARGC_CMD_INDEX], AD9009_CMDTAB[i].cmd))
{
printf("## %s ##\r\n", AD9009_CMDTAB[i].description);
if ((ARGC < AD9009_CMDTAB[i].min_args) || (ARGC > AD9009_CMDTAB[i].max_args))
{
printf("ERR: parameter numbers(%d),%s \r\n", ARGC, AD9009_CMDTAB[i].syntax);
break;
}
sel_chips = 0;
// DIGITALDAS RU ONLY HAVE ONE AD9009
if (OK != str2digit(argv[1], &sel_chips, 16))
return ERROR;
which_9009 =sel_chips%256;
printf("ad9009_main:which_9009=%d.\r\n",which_9009);
//memcpy(p_myTaliseDevice_shm, p_myTaliseDevice, sizeof(taliseDevice_t));
if(which_9009==ADRV9009_0)
{
p_myTaliseDevice_shm = taliseDeviceInfo1.ptalDevice;
memcpy(p_myTalInit, (taliseDeviceInfo1.ptalInit), sizeof(myTalInit));
}
else
{
p_myTaliseDevice_shm = taliseDeviceInfo2.ptalDevice;
memcpy(p_myTalInit, (taliseDeviceInfo2.ptalInit), sizeof(myTalInit));
}
// memcpy(&tempStatus, (pBandSet->pTempStatus), sizeof(tempStatus));
for(j=0;j<argc-1;j++)
{
//argv_2[i]=&argvv[i+1];
argv_2[j] = (char *)&argvarr[j+1];// oneshu 20201012
//printf("argv_2[%d]:%s.\r\n",j,argv_2[j]);
//argv_3[j]=argvv[j+1];
//printf("argv_3[%d]:%s.\r\n",j,argv_3[j]);
//*(argv_4+j)=argvv[j+1];
//printf("argv_4[%d]:%s.\r\n",j,*(argv_4+j));
}
if (AD9009_CMDTAB[i].func(ARGC, argv_2) == 0)
{
printf("AD9009_SUCCESS: %s.\r\n",AD9009_CMDTAB[i].description);
printf("AD9009_SUCCESS!\r\n");
} else
{
printf("AD9009_FAIL!\r\n");
}
break;
} else
{
//NULL
}
}
if (i >= AD9009_CMD_NUM)
{
printf("This command(%s) is not supported.\r\n",argv[ARGC_CMD_INDEX]);
}
// Ad93xx_destory(Ad93xx_instance); // c_api
*/
return OK;
}
int ad9009_ver_print(int argc, char *argv[])
{
printf("================================================\r\n");
printf("==================VERSION LIST==================\r\n");
printf(" PROJECT: %s!\r\n", PROJECT_VER);
printf(" VERSION: %s.%s%s\r\n", AD9009_VERSION_X, AD9009_VERSION_Y, AD9009_VERSION_Z);
printf("================================================\r\n");
return OK;
}
int ad9009_api_ver_print(int argc, char *argv[])
{
u32 siVer, majorVer, minorVer, buildVer;
//DATE_TIME_T date_time;
int ret = 0;
if (argc < 2)
{
printf("WARRING: please specify the num of prama!! \r\n");
} else
{
ret = TALISE_getApiVersion(p_myTaliseDevice_shm, &siVer, &majorVer, &minorVer, &buildVer);
}
printf("api_version:%d.%d.%d.%d\r\n", siVer, majorVer, minorVer, buildVer);
return ret;
}
int ad9009_help(int32_t argc, char *argv[])
{
int32_t i;
printf(" ### AD9009 test command list: ###\r\n");
for (i = 0; i < AD9009_CMD_NUM; i++)
{
printf(" %2d. %s ", (i + 1), AD9009_CMDTAB[i].syntax);
printf("--%s\n", AD9009_CMDTAB[i].description);
}
printf("\n");
printf(" ### AD9009 band setting list: ###\r\n ");
printf(" ### BAND,CHIP: ###\r\n ");
for (i = 0; i < ad9009InfoMaxCnt; i++)
{
printf("%d: %d ", i + 1, ad9009Info[i].bandType);
}
printf("\r\n");
return OK;
}
/*
int ad9009_rd(int argc, char *argv[])
{
int ret = ERROR;
u32 addr = 0;
u32 count = 0;
int *pChipNo;
if (argc < 4)
{
printf("WARRING: please specify the num of pragma! \r\n");
} else
{
if ((OK == str2digit(argv[2], &addr, 16)) && (OK == str2digit(argv[3], &count, 16)))
{
//int *pChipNo = (int *)p_myTaliseDevice->devHalInfo;
pChipNo = (int *)p_myTaliseDevice_shm->devHalInfo;
ret = read_ad9009(*pChipNo, addr, count);
} else
{
printf("ERROR: \"addr\" %s or \"count\" %s is not a hex digit!\r\n", argv[2], argv[3]);
}
}
return ret;
}*/
/*
int ad9009_wr(int argc, char *argv[])
{
int ret = ERROR;
u32 addr = 0;
u32 data = 0;
int *pChipNo;
if (argc < 4)
{
printf("WARRING: please specify the num of pragma! \r\n");
} else
{
if ((OK == str2digit(argv[2], &addr, 16)) && (OK == str2digit(argv[3], &data, 16)))
{
//int *pChipNo = (int *)p_myTaliseDevice->devHalInfo;
pChipNo = (int *)p_myTaliseDevice_shm->devHalInfo;
ret = write_ad9009(*pChipNo, addr, data);
} else
{
printf("ERROR: \"addr\" %s or \"count\" %s is not a hex digit!\r\n", argv[2], argv[3]);
}
}
return ret;
}
*/
int ad9009_TALISE_init(int argc, char *argv[])
{
int ret = ERROR;
if (argc < 2)
{
printf("WARRING: please specify the num of prama!! \r\n");
} else
{
ret = TALISE_initialize(p_myTaliseDevice_shm, p_myTalInit);
}
if (ret == OK)
{
printf("SUCCESS:ad9009 init succeed! \r\n");
} else
{
printf("FAIL: ad9009 init failed! \r\n");
}
return ret;
}
int ad9009_TALISE_getTempStatus(int argc, char *argv[])
{
int ret = ERROR;
#if 0
uint8_t channel = 16;
int8_t i;
if (argc < 2)
{
printf("WARRING: please specify the num of prama!! \r\n");
return ret;
} else
{
ret = TALISE_setAuxAdcChannel(p_myTaliseDevice_shm, (mykonosAuxAdcChannels_t) channel);
}
if (ret == OK)
{
printf("SUCCESS:set auxAdcchannel = 0x%x succeed! \r\n", channel);
} else
{
printf("FAIL: set auxAdcchannel ! \r\n");
return ret;
}
ret = TALISE_startTempMeasurement(p_myTaliseDevice_shm);
if (ret != OK)
{
printf("fail:TALISE_startTempMeasurement errorcode= 0x%x ! \r\n", ret);
return ret;
}
for (i = 0; i < 10; i++)
{
printf("TALISE_readTempSensor read time = 0x%x ! \r\n", i);
usleep(10000);
ret = TALISE_readTempSensor(p_myTaliseDevice_shm, &tempStatus);
if (ret != OK)
{
printf("fail:TALISE_readTempSensor errorcode= 0x%x ! \r\n", ret);
return ret;
}
printf("tempStatus ->tempcode =%d,tempStatus .windowExceeded=%d, tempStatus ->windowHiLo=%d,, tempStatus ->tempValid=%d \r\n", tempStatus.tempCode,
tempStatus.windowExceeded, tempStatus.windowHiLo, tempStatus.tempValid);
if (tempStatus.windowExceeded == 1)
{
printf("FAIL:TALISE_readTempSensor temp is greater than rang!read agaiin \r\n");
continue;
}TALISE_getArmVersion
if (tempStatus.tempValid == 1)
{
printf("SUCCESS:TALISE_readTempSensor \r\n");
break;
}
}
if (i == 10)
{
printf("FAIL:TALISE_readTempSensor %d\n", ret);
}
#endif
return ret;
}
int ad9009_TALISE_setRfPllFreq(int argc, char *argv[])
{
/*
int ret = ERROR;
unsigned int channel;
uint64_t freqValue;
if (argc < 4)
{
printf("WARRING: please specify the num of prama!! \r\n");
} else
{
if ((OK == str2digit(argv[2], &channel, 16)) && (OK == str2digit_u64(argv[3], &freqValue, 10)))
{
if ((channel < TAL_RF_PLL) || (channel > TAL_AUX_PLL))
{
printf("FAIL: channel value beyond limit! \r\n");
return ERROR;
}
ret = TALISE_setRfPllFrequency(p_myTaliseDevice_shm, (taliseRfPllName_t) channel, freqValue);
}
}
if (ret == OK)
{
printf("SUCCESS:ad9009 init clocks succeed! \r\n");
} else
{
printf("FAIL: ad9009 init clocks failed!ERROR code = %d.\n", ret);
}
return ret;
*/
}
int ad9009_set_rf_pll_freq( unsigned int channel ,uint64_t freqValue)
{
int ret = ERROR;
if ((channel < TAL_RF_PLL) || (channel > TAL_AUX_PLL))
{
printf("FAIL: channel value beyond limit! \r\n");
return ERROR;
}
ret = TALISE_setRfPllFrequency(p_myTaliseDevice_shm, (taliseRfPllName_t) channel, freqValue);
if (ret == OK)
{
printf("SUCCESS:ad9009 init clocks succeed! \r\n");
} else
{
printf("FAIL: ad9009 init clocks failed!ERROR code = %d.\n", ret);
}
}
int ad9009_TALISE_getRfPllFreq(int argc, char *argv[])
{
/*
int ret = ERROR;
unsigned int pllName;
uint64_t rfPllLoFrequency_Hz;
//int freqValue;
if (argc < 3)
{
printf("WARRING: please specify the num of prama!! \r\n");
} else
{
if (OK == str2digit(argv[2], &pllName, 16))
{
if ((pllName < TAL_CLK_PLL) || (pllName > TAL_AUX_PLL))
{
printf("FAIL: pllName value beyond limit! \r\n");
return ERROR;
}
//printf("ad9009_TALISE_getRfPllFreq1:pllName=%d.\r\n",pllName);
//ret = TALISE_setRfPllFrequency(p_myTaliseDevice_shm,channel,freqValue);
ret = TALISE_getRfPllFrequency(p_myTaliseDevice_shm, (taliseRfPllName_t) pllName, &rfPllLoFrequency_Hz);
}
else
{
printf("ad9009_TALISE_getRfPllFreq2:pllName=%d.\r\n",pllName);
}
}
if (ret == OK)
{
printf("SUCCESS:TALISE_getRfPllFreq pll=%d,freq=%llu! \r\n", pllName, rfPllLoFrequency_Hz);
} else
{
printf("FAIL: TALISE_getRfPllFreq failed! \r\n");
}
return ret;
*/
}
int ad9009_TALISE_checkRfPllLock(int argc, char *argv[])
{
int ret = ERROR;
uint8_t pllLockStatus = 0;
if (argc < 2)
{
printf("WARRING: please specify the num of prama! \r\n");
} else
{
//ret = TALISE_checkPllsLockStatus(p_myTaliseDevice_shm, &pllLockStatus);
ret = TALISE_getPllsLockStatus(p_myTaliseDevice_shm, &pllLockStatus);
}
if (ret == OK)
{
printf("SUCCESS:pllLockStatus = 0x%x! \r\n", pllLockStatus);
printf("SUCCESS:checkRfPllLock succeed! \r\n");
} else
{
printf("FAIL: checkRfPllLock failed! \r\n");
}
return ret;
}
int ad9009_TALISE_chkArmState(int argc, char *argv[])
{
int ret = ERROR;
//mykonosArmState_t armStatus = MYK_ARM_POWERUP;
talApiArmErr_t armStatus = TALAPI_ARMERR_BOOTUP_TIMEOUT_ERROR;
#if 0
if (argc < 2)
{
printf("WARRING: please specify the num of prama! \r\n");
} else
{
ret = TALISE_checkArmState(p_myTaliseDevice_shm, armStatus);
}
if (ret == OK)
{
printf("SUCCESS:armState = 0x%02x! \r\n", armStatus);
} else
{
printf("FAIL: armState failed! \r\n");
}
#endif
return ret;
}
int ad9009_TALISE_gtArmVersion(int argc, char *argv[])
{
int ret = ERROR;
uint8_t majorVer, minorVer, rcVer;
if (argc < 2)
{
printf("WARRING: please specify the num of prama! \r\n");
} else
{
ret = TALISE_getArmVersion(p_myTaliseDevice_shm, &majorVer, &minorVer, &rcVer);
}
if (ret == OK)
{
printf("SUCCESS:armVersion:%d.%d.%d \r\n", majorVer, minorVer, rcVer);
} else
{
printf("FAIL: armVersion failed! \r\n");
}
return ret;
}
int ad9009_TALISE_radioSwitch(int argc, char *argv[])
{
int ret = ERROR;
unsigned int switchState;
if (argc < 3)
{
printf("WARRING: please specify the num of prama! \r\n");
} else
{
if ((OK == str2digit(argv[2], &switchState, 16)))
{
if (1 == switchState)
{
ret = TALISE_radioOn(p_myTaliseDevice_shm);
} else if (0 == switchState)
{
ret = TALISE_radioOff(p_myTaliseDevice_shm);
} else
{
printf("FAIL:please put in right switch state 0\1 \r\n!");
return ret;
}
}
}
if (ret == OK)
{
printf("SUCCESS:set radioSwitch %d succeed! \r\n", switchState);
} else
{
printf("FAIL: set radioSwitch %d failed! \r\n", switchState);
}
return ret;
}
int ad9009_TALISE_getRadioStatus(int argc, char *argv[])
{
int ret = ERROR;
unsigned int radioState;
if (argc < 2)
{
printf("WARRING: please specify the num of prama!! \r\n");
} else
{
ret = TALISE_getRadioState(p_myTaliseDevice_shm, &radioState);
}
if (ret == OK)
{
printf("SUCCESS:get radioState = 0x%x succeed! \r\n", radioState);
} else
{
printf("FAIL: get radioSwitch failed! \r\n");
}
return ret;
}
int ad9009_TALISE_enTrackingCals(int argc, char *argv[])
{
int ret = ERROR;
unsigned int enableMask;
if (argc < 3)
{
printf("WARRING: please specify the num of prama!! \r\n");
} else
{
if ((OK == str2digit(argv[2], &enableMask, 16)))
ret = TALISE_enableTrackingCals(p_myTaliseDevice_shm, (u32) enableMask);
}
if (ret == OK)
{
printf("SUCCESS:set enableMask = 0x%x succeed! \r\n", enableMask);
} else
{
printf("FAIL: set enableMask failed! \r\n");
}
return ret;
}
int ad9009_TALISE_rescheduleTrkingCal(int argc, char *argv[])
{
int ret = ERROR;
unsigned int trackingCal;
if (argc < 3)
{
printf("WARRING: please specify the num of prama!! \r\n");
} else
{
if ((OK == str2digit(argv[2], &trackingCal, 16)))
ret = TALISE_rescheduleTrackingCal(p_myTaliseDevice_shm, (taliseTrackingCalibrations_t) trackingCal);
}
if (ret == OK)
{
printf("SUCCESS:rescheduleTrkingCal ! \r\n");
} else
{
printf("FAIL: rescheduleTrkingCal! \r\n");
}
return ret;
}
int ad9009_TALISE_setSnifferCh(int argc, char *argv[])
{
int ret = ERROR;
u32 snifferCh;
#if 0
if (argc < 3)
{
printf("WARRING: please specify the num of prama!! \r\n");
} else
{
if ((OK == str2digit(argv[2], &snifferCh, 16)))
{
if ((SNIFFER_A > snifferCh) || ((snifferCh > SNIFFER_C)))
{
printf("FAIL: set setSnifferCh ch=0x%x beyond the limit! \r\n", snifferCh);
return ret;
}
}
ret = TALISE_setSnifferChannel(p_myTaliseDevice_shm, (mykonosSnifferChannel_t) snifferCh);
}
if (ret == OK)
{
printf("SUCCESS:setSnifferCh = 0x%x succeed! \r\n", snifferCh);
} else
{
printf("FAIL:setSnifferCh failed! \r\n");
}
#endif
return ret;
}
int ad9009_TALISE_rstDeframer(int argc, char *argv[])
{
int ret = ERROR;
// int radioState;
#if 0
if (argc < 2)
{
printf("WARRING: please specify the num of prama!! \r\n");
} else
{
ret = TALISE_resetDeframer(p_myTaliseDevice_shm);
}
if (ret == OK)
{
printf("SUCCESS:rstDeframer succeed! \r\n");
} else
{
printf("FAIL:rstDeframer failed! \r\n");
}
#endif
return ret;
}
int ad9009_TALISE_stupSerializers(int argc, char *argv[])
{
int ret = ERROR;
if (argc < 2)
{
printf("WARRING: please specify the num of prama!! \r\n");
} else
{
ret = TALISE_setupSerializers(p_myTaliseDevice_shm,&myTalInit);
}
if (ret == OK)
{
printf("SUCCESS:setupSerializers! \r\n");
} else
{
printf("FAIL:setupSerializers! \r\n");
}
return ret;
}
int ad9009_TALISE_stupDeserializers(int argc, char *argv[])
{
int ret = ERROR;
if (argc < 2)
{
printf("WARRING: please specify the num of prama!! \r\n");
} else
{
ret = TALISE_setupDeserializers(p_myTaliseDevice_shm,&myTalInit);
}
if (ret == OK)
{
printf("SUCCESS:setupDeserializers! \r\n");
} else
{
printf("FAIL:setupDeserializers! \r\n");
}
return ret;
}
int ad9009_TALISE_setupJesd204b(int argc, char *argv[])
{
int ret = ERROR;
u32 framerCh;
u32 fremerSl;
if (argc < 4)
{
printf("WARRING: please specify the num of prama! \r\n");
} else
{
if ((OK == str2digit(argv[2], &framerCh, 16)) &&(OK == str2digit(argv[3], &fremerSl, 16)))
{
if (0 == framerCh)
{
ret = TALISE_setupJesd204bFramer(p_myTaliseDevice_shm,&myTalInit,(taliseFramerSel_t)fremerSl);
} else if (1 == framerCh)
{
ret = TALISE_setupJesd204bDeframer(p_myTaliseDevice_shm,&myTalInit,(taliseDeframerSel_t)fremerSl);
} else
{
printf("FAIL:please put in right framer channel value 0:RxFramer 1:ObsRxFramer 1:DeFramer \r\n!");
return ret;
}
}
}
if (ret == OK)
{
printf("SUCCESS:enableLink ch=%d succeed! \r\n", framerCh);
} else
{
printf("FAIL: enableLink ch=%d failed! \r\n", framerCh);
}
return ret;
}
int ad9009_TALISE_enableLink(int argc, char *argv[])
{
int ret = ERROR;
u32 framerCh;
u32 enableValue;
u32 framerSl;
if (argc < 5)
{
printf("WARRING: please specify the num of prama! \r\n");
} else
{
printf("SUCCESS:enableLink ch=%d,enableValue=%d succeed! \r\n",framerCh,enableValue);
if ((OK == str2digit(argv[2], &framerCh, 16)) && (OK == str2digit(argv[3], &enableValue, 16))&&(OK == str2digit(argv[4], &framerSl, 16)))
{
printf("SUCCESS:enableLink ch=%d,enableValue=%d succeed! \r\n",framerCh,enableValue);
if (0 == framerCh)
{
ret = TALISE_enableFramerLink(p_myTaliseDevice_shm, (taliseFramerSel_t)framerSl,(uint8_t) enableValue);//ret = TALISE_enableRxFramerLink(p_myTaliseDevice_shm, (uint8_t) enableValue);
} else if (1 == framerCh)
{
ret = TALISE_enableDeframerLink(p_myTaliseDevice_shm,(taliseDeframerSel_t)framerSl, (uint8_t) enableValue);//ret = TALISE_enableObsRxFramerLink(p_myTaliseDevice_shm, (uint8_t) enableValue);
} else
{
printf("FAIL:please put in right framer channel value 1:for RxFramer 2:for ObsRxFramer \r\n!");
return ret;
}
}
}
if (ret == OK)
{
printf("SUCCESS:enableLink ch=%d,enableValue=%d succeed! \r\n", framerCh, enableValue);
} else
{
printf("FAIL: enableLink ch=%d,enableValue=%d failed! \r\n", framerCh, enableValue);
}
return ret;
}
int ad9009_TALISE_enableSysref(int argc, char *argv[])
{
int ret = ERROR;
u32 framerCh;
u32 enableValue;
u32 framerSl;
if (argc < 5)
{
printf("WARRING: please specify the num of prama! \r\n");
} else
{
if ((OK == str2digit(argv[2], &framerCh, 16)) && (OK == str2digit(argv[3], &enableValue, 16))&&(OK == str2digit(argv[4], &framerSl, 16)))
{
if (0 == framerCh)
{
ret = TALISE_enableSysrefToFramer(p_myTaliseDevice_shm,(taliseFramerSel_t)framerSl, (uint8_t) enableValue);
} else if (1 == framerCh)
{
ret = TALISE_enableSysrefToDeframer(p_myTaliseDevice_shm,(taliseDeframerSel_t)framerSl, (uint8_t) enableValue);
}else
{
printf("FAIL:please put in right framer channel value 1:for RxFramer 2:for ObsRxFramer 3:for DeFramer! \r\n");
return ret;
}
}
}
if (ret == OK)
{
printf("SUCCESS:enableSysref ch=%d,succeed! \r\n", framerCh);
} else
{
printf("FAIL: enableSysref ch=%d failed! \r\n", framerCh);
}
return ret;
}
int ad9009_TALISE_read_framerStatus(int argc, char *argv[])
{
int ret = ERROR;
u32 framerCh;
uint16_t framerState;
u32 framerSl;
if (argc < 4)
{
printf("WARRING: please specify the num of prama!! \r\n");
} else
{
if ((OK == str2digit(argv[2], &framerCh, 16))&&(OK == str2digit(argv[3], &framerCh, 16)))
{
if (0 == framerCh)
{
ret = TALISE_readFramerStatus(p_myTaliseDevice_shm,(taliseFramerSel_t)framerSl, (uint8_t *)&framerState);
} else if (1 == framerCh)
{
ret = TALISE_readDeframerStatus(p_myTaliseDevice_shm, (taliseDeframerSel_t)framerSl,&framerState);
} else
{
printf("FAIL:please put in right framer channel value 1:for RxFramer 2:for ObsRxFramer 3:for DeFramer! \r\n");
return ret;
}
}
}
if (ret == OK)
{
printf("SUCCESS:get framerState ch=0x%x,value=0x%x succeed! \r\n", framerCh, framerState);
} else
{
printf("FAIL: get framerState failed! \r\n");
}
return ret;
}
int ad9009_TALISE_enFramerPrbs(int argc, char *argv[])
{
int ret = ERROR;
u32 framerOrDeframer, order, enableState;
// uint8_t framerState;
#if 0
if (argc < 5)
{
printf("WARRING: please specify the num of prama!! \r\n");
} else
{
if ((OK == str2digit(argv[2], &framerOrDeframer, 16)))
{
if ((0 == framerOrDeframer) || (1 == framerOrDeframer)) //0:rx 1:obsRx
{
if ((OK == str2digit(argv[3], &order, 16)))
{
if ((order >= 0) && (2 >= order)) //slecte order
{
if ((OK == str2digit(argv[4], &enableState, 16)))
{
if ((0 == enableState) || (1 == enableState))
{
if (framerOrDeframer)
{
ret = TALISE_enableObsRxFramerPrbs(p_myTaliseDevice_shm, (mykonosPrbsOrder_t) order, (uint8_t) enableState);
} else
{
ret = TALISE_enableRxFramerPrbs(p_myTaliseDevice_shm, (mykonosPrbsOrder_t) order, (uint8_t) enableState);
}
} else
{
printf("WARRING: please put in right enable value!\n");
return ERROR;
}
}
} else
{
printf("WARRING: please put in right order value!\n");
return ERROR;
}
}
} else
{
printf("WARRING: please put in right framer channle!\n");
return ERROR;
}
}
}
if (ret == OK)
{
printf("SUCCESS:enFramerPrbs!\r\n");
} else
{
printf("FAIL: enFramerPrbs failed! \r\n");
}
#endif
return ret;
}
int ad9009_TALISE_enTestFramerPrbsData(int argc, char *argv[])
{
int ret = ERROR;
u32 framerOrDeframer, order, enableState;
// uint8_t framerState;
if (argc < 5)
{
printf("WARRING: please specify the num of prama!! \r\n");
} else
{
if ((OK == str2digit(argv[2], &framerOrDeframer, 16)))
{
if ((0 <= framerOrDeframer) || (2 >= framerOrDeframer)) //0:rx 1:obsRx
{
if ((OK == str2digit(argv[3], &order, 16)))
{
if ((order >= 0) && (8 >= order)) //slecte order
{
if ((OK == str2digit(argv[4], &enableState, 16)))
{
if ((0 <= enableState) || (2 >= enableState))
{
ret = TALISE_enableFramerTestData(p_myTaliseDevice_shm, (taliseFramerSel_t) framerOrDeframer, (taliseFramerDataSource_t) order,(taliseFramerInjectPoint_t)enableState);
} else
{
printf("WARRING: please put in right enable value!\n");
return ERROR;
}
}
} else
{
printf("WARRING: please put in right order value!\n");
return ERROR;
}
}
} else
{
printf("WARRING: please put in right framer channle!\n");
return ERROR;
}
}
}
if (ret == OK)
{
printf("SUCCESS:enFramerPrbs!\r\n");
} else
{
printf("FAIL: enFramerPrbs failed! \r\n");
}
return ret;
}
int ad9009_TALISE_enDeFramerPrbs(int argc, char *argv[])
{
int ret = ERROR;
u32 order, enableState;
// uint8_t framerState;
if (argc < 4)
{
printf("WARRING: please specify the num of prama!!\r\n");
}
else
{
if ((OK == str2digit(argv[2], &order, 16)))
{
if ((order >= 0) && (3 >= order)) //slecte order
{
if ((OK == str2digit(argv[3], &enableState, 16)))
{
if ((0 == enableState) || (1 == enableState))
{
ret = TALISE_enableDeframerPrbsChecker(p_myTaliseDevice_shm, (taliseDeframerPrbsOrder_t) order, (taliseDefPrbsCheckLoc_t) enableState);
} else
{
printf("WARRING: please put in right enable value!\n");
return ERROR;
}
}
} else
{
printf("WARRING: please put in right order value!\n");
return ERROR;
}
}
}
if (ret == OK)
{
printf("SUCCESS:enDeFramerPrbs!\r\n");
} else
{
printf("FAIL: enDeFramerPrbs failed! \r\n");
}
return ret;
}
int ad9009_TALISE_InjectPrbsError(int argc, char *argv[])
{
int ret = ERROR;
u32 framerCh;
// uint8_t framerState;
#if 0
if (argc < 3)
{
printf("WARRING: please specify the num of prama!! \r\n");
} else
{
if ((OK == str2digit(argv[2], &framerCh, 16)))
{
if (0 == framerCh)
{
ret = TALISE_rxInjectPrbsError(p_myTaliseDevice_shm);
} else if (1 == framerCh)
{
ret = TALISE_obsRxInjectPrbsError(p_myTaliseDevice_shm);
} else
{
printf("FAIL:please put in right framer channel value 0:for RxFramer 1:for ObsRxFramer!\r\n");
return ret;
}
}
}
if (ret == OK)
{
printf("SUCCESS:rxInjectPrbsError succeed! \r\n");
} else
{
printf("FAIL: rxInjectPrbsError failed! \r\n");
}
#endif
return ret;
}
int ad9009_TALISE_clrDeframerPrbsCounters(int argc, char *argv[])
{
int ret = ERROR;
if (argc < 2)
{
printf("WARRING: please specify the num of prama!! \r\n");
} else
{
ret = TALISE_clearDeframerPrbsCounters(p_myTaliseDevice_shm);
}
if (ret == OK)
{
printf("SUCCESS:clearDeframerPrbsCounters succeed! \r\n");
} else
{
printf("FAIL: clearDeframerPrbsCounters failed! \r\n");
}
return ret;
}
int ad9009_TALISE_rdDeframerPrbsCounters(int argc, char *argv[])
{
int ret = ERROR;
u32 counterSelect;
uint8_t prbsErrorCount;
uint8_t rbsInvertedStatus;
if (argc < 3)
{
printf("WARRING: please specify the num of prama!! \r\n");
} else
{
if ((OK == str2digit(argv[2], &counterSelect, 16)))
{
ret = TALISE_readDeframerPrbsCounters(p_myTaliseDevice_shm, (uint8_t) counterSelect, &prbsErrorCount,&rbsInvertedStatus);
}
}
if (ret == OK)
{
printf("SUCCESS:readDeframerPrbsCounters succeed,prbsErrorCount=0x%x rbsInvertedStatus=0x%x! \r\n", prbsErrorCount,rbsInvertedStatus);
} else
{
printf("FAIL: readDeframerPrbsCounters failed! \r\n");
}
return ret;
}
int ad9009_TALISE_setFramerDataSource(int argc, char *argv[])
{
int ret = ERROR;
u32 channel;
u32 setValue;
#if 0
if (argc < 4)
{
printf("WARRING: please specify the num of prama!! \r\n");
} else
{
if ((OK == str2digit(argv[2], &channel, 16)) && (OK == str2digit(argv[3], &setValue, 16)))
{
if (0 == channel)
{
ret = TALISE_setRxFramerDataSource(p_myTaliseDevice_shm, (uint8_t) setValue);
} else if (1 == channel)
{
ret = TALISE_setObsRxFramerDataSource(p_myTaliseDevice_shm, (uint8_t) setValue);
} else
{
printf("FAIL: channel value beyond limit! \r\n");
return ERROR;
}
}
}
if (ret == OK)
{
printf("SUCCESS:ad9009 setFramerDataSource! \r\n");
} else
{
printf("FAIL: ad9009 setFramerDataSource! \r\n");
}
#endif
return ret;
}
int ad9009_TALISE_setRxManualGain(int argc, char *argv[])
{
int ret = ERROR;
u32 channel;
u32 gainIndex;
if (argc < 4)
{
printf("WARRING: please specify the num of prama!! \r\n");
} else
{
if ((OK == str2digit(argv[2], &channel, 16)) && (OK == str2digit(argv[3], &gainIndex, 10)))
{
if (0 <= channel&&channel<=3)
{
ret = TALISE_setRxManualGain(p_myTaliseDevice_shm,(taliseRxChannels_t)channel, (uint8_t) gainIndex);
}else
{
printf("FAIL: channel value beyond limit! \r\n");
return ERROR;
}
}
}
if (ret == OK)
{
printf("SUCCESS:ad9009 setRxManualGain! \r\n");
} else
{
printf("FAIL: ad9009 setRxManualGain! \r\n");
}
return ret;
}
int ad9009_TALISE_getRxGain(int argc, char *argv[])
{
int ret = ERROR;
u32 channel;
uint8_t rxGainIndex;
if (argc < 3)
{
printf("WARRING: please specify the num of prama!! \r\n");
} else
{
if ((OK == str2digit(argv[2], &channel, 16)))
{
if (0 <= channel&&channel<=3)
{
ret = TALISE_getRxGain(p_myTaliseDevice_shm, (taliseRxChannels_t)channel,&rxGainIndex);
}else
{
printf("FAIL: channel value beyond limit! \r\n");
return ERROR;
}
}
}
if (ret == OK)
{
printf("SUCCESS:ad9009 setRxManualGain,rxGain=0x%x!\r\n", rxGainIndex);
} else
{
printf("FAIL: ad9009 setRxManualGain! \r\n");
}
return ret;
}
int ad9009_tx1_initTxAttenuation(uint16_t att)
{
int ret = ERROR;
//u32 channel;
// init
p_myTaliseDevice_shm = taliseDeviceInfo1.ptalDevice;
memcpy(p_myTalInit, (taliseDeviceInfo1.ptalInit), sizeof(myTalInit));
ret = TALISE_setTxAttenuation(p_myTaliseDevice_shm, TAL_TX1,(uint16_t) att);
if (ret == OK)
{
printf("\n==SUCCESS:ad9009 setTxAttenuation to val=%d !\n",att);
} else
{
printf("\n==FAIL: ad9009 setTxAttenuation to val=%d !\n",att);
}
return ret;
}
int ad9009_TALISE_setTxAttenuation(int argc, char *argv[])
{
int ret = ERROR;
u32 channel;
u32 txAttenuation_mdB;
if (argc < 4)
{
printf("WARRING: please specify the num of prama!! \r\n");
} else
{
if ((OK == str2digit(argv[2], &channel, 16)) && (OK == str2digit(argv[3], &txAttenuation_mdB, 10))) //?????????10????????????????
{
if (0 <= channel&&channel<=3)
{
ret = TALISE_setTxAttenuation(p_myTaliseDevice_shm, (taliseTxChannels_t)channel,(uint16_t) txAttenuation_mdB);
} else
{
printf("FAIL: channel value beyond limit! \r\n");
return ERROR;
}
}
}
if (ret == OK)
{
printf("SUCCESS:ad9009 setTxAttenuation! \r\n");
} else
{
printf("FAIL: ad9009 setTxAttenuation! \r\n");
}
return ret;
}
#if 1
int usr_set_ad9009_tx1_TxAttenuation(uint16_t att)
{
int ret = ERROR;
//u32 channel;
// init
p_myTaliseDevice_shm = taliseDeviceInfo1.ptalDevice;
memcpy(p_myTalInit, (taliseDeviceInfo1.ptalInit), sizeof(myTalInit));
ret = TALISE_setTxAttenuation(p_myTaliseDevice_shm, TAL_TX1,(uint16_t) att);
if (ret == OK)
{
printf("\n==SUCCESS:ad9009 setTx1 Attenuation to val=%d !\n",att);
} else
{
printf("\n==FAIL: ad9009 setTx1 Attenuation to val=%d !\n",att);
}
return ret;
}
int usr_get_ad9009_tx1_getTxAttenuation(void)
{
int ret = ERROR;
u32 channel = TAL_TX1;
uint16_t txAttenuation_mdB;
{
if (0 <= channel&&channel<=3)
{
ret = TALISE_getTxAttenuation(p_myTaliseDevice_shm, (taliseTxChannels_t)channel,&txAttenuation_mdB);
} else
{
printf("FAIL: channel value beyond limit! \r\n");
return ERROR;
}
}
if (ret == OK)
{
printf(" SUCCESS:ad9009 getTx1 ManualGain,txAtt=0x%x,%d!\r\n", txAttenuation_mdB, txAttenuation_mdB);
} else
{
printf(" FAIL: ad9009 getTx1 ManualGain! \r\n");
}
return ret;
}
int usr_set_ad9009_TxAttenuation(uint16_t att,uint8_t channel)
{
int ret = ERROR;
p_myTaliseDevice_shm = taliseDeviceInfo1.ptalDevice;
memcpy(p_myTalInit, (taliseDeviceInfo1.ptalInit), sizeof(myTalInit));
if(channel==TAL_TX1||channel==TAL_TX2)
{
ret = TALISE_setTxAttenuation(p_myTaliseDevice_shm, channel,(uint16_t) att);
if (ret == OK)
{
printf("\n==SUCCESS:ad9009 setTx%d Attenuation to val=%d !\n",channel,att);
}
else
{
printf("\n==FAIL: ad9009 setTx%d Attenuation to val=%d !\n",channel,att);
}
}
else
{
printf("==Invalid Tx channel selected for usr_set_ad9009_TxAttenuation.%d\n",channel);
}
return ret;
}
int usr_get_ad9009_getTxAttenuation(uint8_t channel)
{
int ret = ERROR;
uint16_t txAttenuation_mdB;
if(channel==TAL_TX1||channel==TAL_TX2)
{
ret = TALISE_getTxAttenuation(p_myTaliseDevice_shm, (taliseTxChannels_t)channel,&txAttenuation_mdB);
if (ret == OK)
{
printf(" SUCCESS:ad9009 getTx%d ManualGain,txAtt=0x%x,%d!\r\n", channel,txAttenuation_mdB, txAttenuation_mdB);
} else
{
printf(" FAIL: ad9009 getTx%d ManualGain! \r\n",channel);
}
}
else
{
printf("==Invalid Tx channel selected for usr_get_ad9009_getTxAttenuation.%d\n",channel);
return ERROR;
}
return ret;
}
//ad9009_TALISE_setRxManualGain
//usr_set_ad9009_RxGain
int usr_set_ad9009_RxGain(uint8_t gainIndex, uint8_t channel)
{
int ret;
if (0 <= channel&&channel<=3)
{
ret = TALISE_setRxManualGain(p_myTaliseDevice_shm,(taliseRxChannels_t)channel, (uint8_t) gainIndex);
}else
{
printf("FAIL: [usr_set_ad9009_RxGain] channel value beyond limit! \r\n");
return ERROR;
}
if (ret == OK)
{
printf("SUCCESS:[usr_set_ad9009_RxGain] ad9009 setRxManualGain! \r\n");
} else
{
printf("FAIL: [usr_set_ad9009_RxGain] ad9009 setRxManualGain! \r\n");
}
return ret;
}
//usr_get_ad9009_RxGain
//ad9009_TALISE_getRxGain
int usr_get_ad9009_RxGain(uint8_t *prxGainIndex, uint8_t channel)
{
int ret;
if (0 <= channel&&channel<=3)
{
ret = TALISE_getRxGain(p_myTaliseDevice_shm, (taliseRxChannels_t)channel,prxGainIndex);
}else
{
printf("FAIL: [usr_get_ad9009_RxGain] channel value beyond limit! \r\n");
return ERROR;
}
if (ret == OK)
{
printf("SUCCESS:[usr_get_ad9009_RxGain] ad9009 getRxGain,rxGain=0x%x!\r\n", *prxGainIndex);
} else
{
printf("FAIL: [usr_get_ad9009_RxGain] ad9009 getRxGain! \r\n");
}
return ret;
}
#endif
int ad9009_TALISE_getTxAttenuation(int argc, char *argv[])
{
int ret = ERROR;
u32 channel;
uint16_t txAttenuation_mdB;
if (argc < 3)
{
printf("WARRING: please specify the num of prama!! \r\n");
} else
{
if ((OK == str2digit(argv[2], &channel, 16)))
{
if (0 <= channel&&channel<=3)
{
ret = TALISE_getTxAttenuation(p_myTaliseDevice_shm, (taliseTxChannels_t)channel,&txAttenuation_mdB);
} else
{
printf("FAIL: channel value beyond limit! \r\n");
return ERROR;
}
}
}
if (ret == OK)
{
printf("SUCCESS:ad9009 getRxManualGain,txAtt=0x%x,%d!\r\n", txAttenuation_mdB, txAttenuation_mdB);
} else
{
printf("FAIL: ad9009 getRxManualGain! \r\n");
}
return ret;
}
int ad9009_TALISE_readDacPower(int argc, char *argv[])
{
int ret = ERROR;
u32 channel;
uint16_t channelPower;
#if 0
if (argc < 3)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
if ((OK == str2digit(argv[2], &channel, 16)))
{
if ((1 == channel) || (2 == channel))
{
ret = TALISE_getDacPower(p_myTaliseDevice_shm, (mykonosTxChannels_t) channel, &channelPower);
} else
{
printf("FAIL: channel value beyond limit! \r\n");
return ERROR;
}
}
}
if (ret == OK)
{
printf("SUCCESS:ad9009 readDacPower,DacPower=0x%x,%d!\r\n", channelPower, channelPower);
} else
{
printf("FAIL: ad9009 readDacPower! \r\n");
}
#endif
return ret;
}
int ad9009_TALISE_enTxNco(int argc, char *argv[])
{
int ret = ERROR;
u32 enValue;
u32 tx1Nco_khz, tx2Nco_khz;
if (argc < 5)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
if ((OK == str2digit(argv[2], &enValue, 16)) && (OK == str2digit(argv[3], &tx1Nco_khz, 10)) && (OK == str2digit(argv[4], &tx2Nco_khz, 10))) //?????????10????????????????
{
myTaliseDevice.devStateInfo.profilesValid = 0x01;//Tx = 0x01, Rx = 0x02, Orx = 0x04 */
taliseTxNcoTestToneCfg_t xNcoTestToneCfg_t;
xNcoTestToneCfg_t.enable=enValue;
xNcoTestToneCfg_t.tx1ToneFreq_kHz=tx1Nco_khz;
xNcoTestToneCfg_t.tx2ToneFreq_kHz=tx2Nco_khz;
ret = TALISE_enableTxNco(p_myTaliseDevice_shm, &xNcoTestToneCfg_t);
printf("111 ret = %d ! \r\n",ret);
}
printf("222! \r\n");
}
if (ret == OK)
{
printf("SUCCESS:ad9009 enTxNco! \r\n");
} else
{
printf("FAIL: ad9009 enTxNco! \r\n");
}
return ret;
}
int ad9009_TALISE_setObsRxPath(int argc, char *argv[])
{
int ret = ERROR;
u32 channel;
#if 0
if (argc < 3)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
if ((OK == str2digit(argv[2], &channel, 16)))
{
ret = TALISE_setObsRxPathSource(p_myTaliseDevice_shm, (mykonosObsRxChannels_t) channel);
}
}
if (ret == OK)
{
printf("SUCCESS:ad9009 setObsRxPathSource path=0x%x!\r\n", channel);
} else
{
printf("FAIL: ad9009 setObsRxPathSource!errorcode=0x%x \r\n", ret);
}
#endif
return ret;
}
int ad9009_TALISE_IlasCheck(int argc, char *argv[])
{
int ret = ERROR;
uint16_t mismatch;
#if 0
if (argc < 2)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
ret = TALISE_jesd204bIlasCheck(p_myTaliseDevice_shm, &mismatch);
}
if (ret == OK)
{
printf("SUCCESS:ad9009 jesd204bIlasCheck mismatch=0x%x!\r\n", mismatch);
} else
{
printf("FAIL: ad9009 jesd204bIlasCheck! \r\n");
}
#endif
return ret;
}
/*AUX ADC*/
int ad9009_TALISE_setupAdc(int argc, char *argv[])
{
int ret = ERROR;
//int channel;
u32 adcDecimation, enable;
#if 0
if (argc < 4)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
if ((OK == str2digit(argv[2], &adcDecimation, 10)) && (OK == str2digit(argv[3], &enable, 16)))
{
ret = TALISE_setupAuxAdcs(p_myTaliseDevice_shm, (uint8_t) adcDecimation, (uint8_t) enable);
}
}
if (ret == OK)
{
printf("SUCCESS:ad9009 setupAdcs !\r\n");
} else
{
printf("FAIL: ad9009 setupAdcs! \r\n");
}
#endif
return ret;
}
int ad9009_TALISE_setAdcChannel(int argc, char *argv[]) //too hard TALISE_startAuxAdc
{
int ret = ERROR;
u32 channel;
#if 0
if (argc < 3)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
if ((OK == str2digit(argv[2], &channel, 10)))
{
ret = TALISE_setAuxAdcChannel(p_myTaliseDevice_shm, (mykonosAuxAdcChannels_t) channel); //TALISE_startAuxAdc
}
}
if (ret == OK)
{
printf("SUCCESS:ad9009 setAuxAdcChannel !\r\n");
} else
{
printf("FAIL: ad9009 setAuxAdcChannel! \r\n");
}
#endif
return ret;
}
int ad9009_TALISE_readAdc(int argc, char *argv[])
{
int ret = ERROR;
//int channel;
uint16_t readValue;
taliseAuxAdcResult_t AuxAdcResult;
if (argc < 2)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
ret = TALISE_readAuxAdc(p_myTaliseDevice_shm, &AuxAdcResult);
}
if (ret == OK)
{
printf("SUCCESS:ad9009 readAuxAdc samples averaged=0x%x,Flag to indicate=0x%x,12-bit Average of AuxADC A/D=0x%x!\r\n", AuxAdcResult.numSamples, AuxAdcResult.completeIndicator,AuxAdcResult.auxAdcCodeAvg);
} else
{
printf("FAIL: ad9009 readAuxAdc! \r\n");
}
return ret;
}
int ad9009_TALISE_wrAuxDac(int argc, char *argv[])
{
int ret = ERROR;
//int channel;
u32 auxDacIndex, auxDacCode;
if (argc < 4)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
if ((OK == str2digit(argv[2], &auxDacIndex, 10)) && (OK == str2digit(argv[3], &auxDacCode, 10)))
{
ret = TALISE_writeAuxDac(p_myTaliseDevice_shm, (uint8_t) auxDacIndex, (uint16_t) auxDacCode);
}
}
/*
if(ret == OK)
{
printf("SUCCESS:ad9009 writeAuxDac !\r\n");
}
else
{
printf("FAIL: ad9009 writeAuxDac! \r\n");
}*/
return ret;
}
int ad9009_TALISE_enable_extlol(int argc, char *argv[])
{
uint8_t errorFlag = 0;
uint8_t errorCode = 0;
int i;
u32 enableMask = 0xF3;
u32 initCalMask = 0x0200;
taliseErr_t mykError = TAL_ERR_OK;
//TALISE_runInitCals(p_myTaliseDevice_shm,initCalMask);
if (argc < 2)
{
printf("WARRING: please specify the num of prama!!\r\n");
return -1;
}
usr_printf_radiooff("ad9009_TALISE_enable_extlol");
TALISE_radioOff(p_myTaliseDevice_shm);
for (i = 0; i < 3; i++)
{
mykError = (taliseErr_t)TALISE_runInitCals(p_myTaliseDevice_shm, initCalMask);
printf("cfg 9009 70,%d! \r\n",mykError);
mykError = (taliseErr_t)TALISE_waitInitCals(p_myTaliseDevice_shm, 60000, &errorFlag);
printf("cfg 9009 71,%d! \r\n",mykError);
if (errorFlag)
{
printf("FAIL: runInitCals time %d fail,errorFlag=0x%x! \r\n", i, errorFlag);
} else if (errorCode)
{
printf("FAIL: runInitCals time %d fail,errorCode=0x%x! \r\n", i, errorCode);
} else
{
break;
}
}
if (i >= 3)
{
printf("FAIL: runInitCals beyond 3 times fail! \r\n");
return mykError;
}
/* enable tracking calibrations,????????????enableMask? */
TALISE_enableTrackingCals(p_myTaliseDevice_shm, enableMask);
/* enable radio on */
TALISE_radioOn(p_myTaliseDevice_shm);
// TALISE_setObsRxPathSource(p_myTaliseDevice_shm, OBS_INTERNALCALS);
printf("come in enable_extlol! \r\n");
return mykError;
}
int ad9009_enable_extlol(void)
{
uint8_t errorFlag = 0;
uint8_t errorCode = 0;
int i;
u32 enableMask = 0xFF;
u32 initCalMask = 0x0200;
taliseErr_t mykError = TAL_ERR_OK;
usr_printf_radiooff("ad9009_enable_extlol");
TALISE_radioOff(p_myTaliseDevice_shm);
for (i = 0; i < 3; i++)
{
mykError = (taliseErr_t)TALISE_runInitCals(p_myTaliseDevice_shm, initCalMask);
printf("cfg 9009 70,%d! \r\n",mykError);
mykError = (taliseErr_t)TALISE_waitInitCals(p_myTaliseDevice_shm, 60000, &errorFlag);
printf("cfg 9009 71,%d! \r\n",mykError);
if (errorFlag)
{
printf("FAIL: runInitCals time %d fail,errorFlag=0x%x! \r\n", i, errorFlag);
} else if (errorCode)
{
printf("FAIL: runInitCals time %d fail,errorCode=0x%x! \r\n", i, errorCode);
} else
{
break;
}
}
if (i >= 3)
{
printf("FAIL: runInitCals beyond 3 times fail! \r\n");
return mykError;
}
/* enable tracking calibrations,????????????enableMask? */
TALISE_enableTrackingCals(p_myTaliseDevice_shm, enableMask);
/* enable radio on */
TALISE_radioOn(p_myTaliseDevice_shm);
//TALISE_setObsRxPathSource(p_myTaliseDevice_shm, OBS_INTERNALCALS);
printf("come in enable_extlol! \r\n");
return mykError;
}
int ad9009_TALISE_enable_extlol_rmOff(int argc, char *argv[])
{
uint8_t errorFlag = 0;
uint8_t errorCode = 0;
int i;
u32 enableMask = 0xF3;
u32 initCalMask = 0x0200;
taliseErr_t mykError = TAL_ERR_OK;
if (argc < 2)
{
printf("WARRING: please specify the num of prama!!\r\n");
return -1;
}
//TALISE_radioOff(p_myTaliseDevice_shm);
for (i = 0; i < 3; i++)
{
mykError =(taliseErr_t) TALISE_runInitCals(p_myTaliseDevice_shm, initCalMask);
printf("cfg 9009 70,%d! \r\n",mykError);
mykError = (taliseErr_t)TALISE_waitInitCals(p_myTaliseDevice_shm, 60000, &errorFlag);
printf("cfg 9009 71,%d! \r\n",mykError);
if (errorFlag)
{
printf("FAIL: runInitCals time %d fail,errorFlag=0x%x! \r\n", i, errorFlag);
} else if (errorCode)
{
printf("FAIL: runInitCals time %d fail,errorCode=0x%x! \r\n", i, errorCode);
} else
{
break;
}
}
if (i >= 3)
{
printf("FAIL: runInitCals beyond 3 times fail! \r\n");
return mykError;
}
/* enable tracking calibrations,????????????enableMask? */
TALISE_enableTrackingCals(p_myTaliseDevice_shm, enableMask);
/* enable radio on */
//TALISE_radioOn(p_myTaliseDevice_shm);
//TALISE_setObsRxPathSource(p_myTaliseDevice_shm, OBS_INTERNALCALS);
printf("come in enable_extlol! \r\n");
return mykError;
}
int ad9009_TALISE_enable_extlol_justTrack(int argc, char *argv[])
{
// uint8_t errorFlag = 0;
// uint8_t errorCode = 0;
// int i;
u32 enableMask = 0xF3;
// u32 initCalMask = 0x0200;
taliseErr_t mykError = TAL_ERR_OK;
//TALISE_runInitCals(p_myTaliseDevice_shm,initCalMask);
if (argc < 2)
{
printf("WARRING: please specify the num of prama!!\r\n");
return -1;
}
#if 0
TALISE_radioOff(p_myTaliseDevice_shm);
for(i=0;i<3;i++)
{
mykError = TALISE_runInitCals(p_myTaliseDevice_shm,initCalMask);
printf("cfg 9009 70,%d! \r\n",mykError);
mykError = TALISE_waitInitCals(p_myTaliseDevice_shm,60000,&errorFlag,&errorCode);
printf("cfg 9009 71,%d! \r\n",mykError);
if(errorFlag)
{
printf("FAIL: runInitCals time %d fail,errorFlag=0x%x! \r\n",i,errorFlag);
}
else if(errorCode)
{
printf("FAIL: runInitCals time %d fail,errorCode=0x%x! \r\n",i,errorCode);
}
else
{
break;
}
}
if(i >= 3)
{
printf("FAIL: runInitCals beyond 3 times fail! \r\n");
return mykError;
}
#endif
/* enable tracking calibrations,????????????enableMask? */
TALISE_enableTrackingCals(p_myTaliseDevice_shm, enableMask);
/* enable radio on */
//TALISE_radioOn(p_myTaliseDevice_shm);
//TALISE_setObsRxPathSource(p_myTaliseDevice_shm, OBS_INTERNALCALS);
printf("come in enable_extlol! \r\n");
return mykError;
}
int ad9009_TALISE_runInitCalsManual(int argc, char *argv[])
{
int ret = ERROR;
u32 enableMask;
uint8_t errorFlag, errorCode;
int i;
if (argc < 3)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
if ((OK == str2digit(argv[2], &enableMask, 16)))
{
//ret = TALISE_runInitCals(p_myTaliseDevice_shm,(uint8_t)enableMask);
for (i = 0; i < 3; i++)
{
ret = TALISE_runInitCals(p_myTaliseDevice_shm, enableMask);
printf("TALISE_runInitCals,ret=%d! \r\n", ret);
ret = TALISE_waitInitCals(p_myTaliseDevice_shm, 20000, &errorFlag);
printf("TALISE_waitInitCals,ret=%d! \r\n", ret);
if (errorFlag)
{
printf("FAIL: runInitCals time %d fail,errorFlag=0x%x! \r\n", i, errorFlag);
} else if (errorCode)
{
printf("FAIL: runInitCals time %d fail,errorCode=0x%x! \r\n", i, errorCode);
} else
{
break;
}
}
if (i >= 3)
{
printf("FAIL: runInitCals beyond 3 times fail! \r\n");
return ret;
}
}
}
if (ret == OK)
{
printf("SUCCESS:ad9009 TALISE_runInitCals !\r\n");
} else
{
printf("FAIL: ad9009 TALISE_runInitCals! \r\n");
}
return ret;
}
int ad9009_TALISE_rstExtTxLolChannel(int argc, char *argv[])
{
int ret = ERROR;
// int enableMask;
u32 ch;
// int i;
if (argc < 3)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
if ((OK == str2digit(argv[2], &ch, 10)))
{
if (ch == 0)
ret = TALISE_resetExtTxLolChannel(p_myTaliseDevice_shm, TAL_TXOFF);
else if (ch == 1)
ret = TALISE_resetExtTxLolChannel(p_myTaliseDevice_shm, TAL_TX1);
else if (ch == 2)
ret = TALISE_resetExtTxLolChannel(p_myTaliseDevice_shm, TAL_TX2);
else if (ch == 3)
ret = TALISE_resetExtTxLolChannel(p_myTaliseDevice_shm, TAL_TX1TX2);
}
}
if (ret == OK)
{
printf("SUCCESS:ad9009 TALISE_rstExtTxLolChannel !\r\n");
} else
{
printf("FAIL: ad9009 TALISE_rstExtTxLolChannel! \r\n");
}
return ret;
}
int ad9009_TALISE_stRx1GainCtrlPin(int argc, char *argv[])
{
int ret = ERROR;
//int channel;
u32 incStep, decStep, rx1GainIncPin, rx1GainDecPin, enable,channel;
if (argc < 8)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
if ((OK == str2digit(argv[3], &incStep, 10)) &&
(OK == str2digit(argv[4], &decStep, 10)) &&
(OK == str2digit(argv[5], &rx1GainIncPin, 10)) &&
(OK == str2digit(argv[6], &rx1GainDecPin, 10)) &&
(OK == str2digit(argv[7], &enable, 10)) &&
(OK == str2digit(argv[2], &channel, 10)))
{
taliseRxGainCtrlPin_t RxGainCtrlPin_t;
RxGainCtrlPin_t.decStep = decStep;
RxGainCtrlPin_t.enable = enable;
RxGainCtrlPin_t.incStep = incStep;
RxGainCtrlPin_t.rxGainDecPin = (taliseGpioPinSel_t)rx1GainDecPin;
RxGainCtrlPin_t.rxGainIncPin = (taliseGpioPinSel_t)rx1GainIncPin;
ret = TALISE_setRxGainCtrlPin(p_myTaliseDevice_shm,(taliseRxChannels_t)channel, &RxGainCtrlPin_t);
}
}
printf("TALISE_stRx1GainCtrlPin! err=%d\r\n", ret);
return ret;
}
int ad9009_TALISE_setObsGainControlMode(int argc, char *argv[])
{
int ret = ERROR;
u32 mode;
// int gainIndex;
#if 0
if (argc < 3)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
if ((OK == str2digit(argv[2], &mode, 16)))
{
ret = TALISE_setObsRxGainControlMode(p_myTaliseDevice_shm, (mykonosGainMode_t) mode);
}
}
if (ret == OK)
{
printf("SUCCESS:ad9009 setObsRxGainControlMode! \r\n");
} else
{
printf("FAIL: ad9009 setObsRxGainControlMode! \r\n");
}
#endif
return ret;
}
int ad9009_TALISE_setObsManualGain(int argc, char *argv[])
{
int ret = ERROR;
u32 channel;
u32 gainIndex;
#if 1 //uncommented @cc20190604
if (argc < 4)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
if ((OK == str2digit(argv[2], &channel, 16)) && (OK == str2digit(argv[3], &gainIndex, 10)))
{
ret = TALISE_setObsRxManualGain(p_myTaliseDevice_shm, (taliseObsRxChannels_t) channel, (uint8_t) gainIndex);
}
}
if (ret == OK)
{
printf("SUCCESS:ad9009 setObsManualGain! \r\n");
} else
{
printf("FAIL: ad9009 setObsRxManualGain!errorcode =%d \r\n", ret);
}
#endif
return ret;
}
int ad9009_TALISE_resetObsManualGain(int channel)
{
int ret = ERROR;
ret = TALISE_setObsRxManualGain(p_myTaliseDevice_shm, (taliseObsRxChannels_t) channel, (uint8_t) 200);
return ret;
}
int ad9009_TALISE_getObsRxGainValue(int argc, char *argv[])
{
int ret = ERROR;
// u32 channel;
uint8_t obsRxGainIndex;
#if 0
if (argc < 2)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
ret = TALISE_getObsRxGain(p_myTaliseDevice_shm, &obsRxGainIndex);
}
if (ret == OK)
{
printf("SUCCESS:ad9009 getObsRxGainValue,obsRxGain=0x%x!\r\n", obsRxGainIndex);
} else
{
printf("FAIL: ad9009 getObsRxGainValue!ret=%d, \r\n", ret);
}
#endif
return ret;
}
int ad9009_TALISE_getRxDecPower(int argc, char *argv[])
{
int ret = ERROR;
uint16_t DecPower_mdBFS;
u32 channelSlc;
if (argc < 3)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
if ((OK == str2digit(argv[2], &channelSlc, 10)))
{
#if 0
switch (channelSlc)
{
case 0: //rx1
ret = TALISE_getRx1DecPower(p_myTaliseDevice_shm, &DecPower_mdBFS);
break;
case 1: //rx2
ret = TALISE_getRx2DecPower(p_myTaliseDevice_shm, &DecPower_mdBFS);
break;
case 2: //obs rx
ret = TALISE_getObsRxDecPower(p_myTaliseDevice_shm, &DecPower_mdBFS);
break;
default:
return -1;
#endif
if(channelSlc>=0&&channelSlc<=3)
{
TALISE_getRxDecPower(p_myTaliseDevice_shm,(taliseRxChannels_t)channelSlc,&DecPower_mdBFS);
}
}
}
if (ret == OK)
{
printf("SUCCESS:ad9009 getRxDecPower DecPower_mdBFS=%d!\r\n", DecPower_mdBFS);
} else
{
printf("FAIL: ad9009 getRxDecPower! \r\n");
}
return ret;
}
int ad9009_TALISE_getTrackingCals(int argc, char *argv[])
{
int ret = ERROR;
u32 enableMask;
if (argc < 2)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
ret = TALISE_getEnabledTrackingCals(p_myTaliseDevice_shm, (u32*) &enableMask);
}
if (ret == OK)
{
printf("SUCCESS:ad9009 enableMask=0x%x !\r\n", enableMask);
} else
{
printf("FAIL: ad9009 getTrackingCals! \r\n");
}
return ret;
}
int ad9009_TALISE_getPdingTrackingCals(int argc, char *argv[])
{
int ret = ERROR;
u32 pendingCalMask;
if (argc < 2)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
ret = TALISE_getPendingTrackingCals(p_myTaliseDevice_shm, (u32*) &pendingCalMask);
}
if (ret == OK)
{
printf("SUCCESS:ad9009 pendingCalMask=0x%x !\r\n", pendingCalMask);
} else
{
printf("FAIL: ad9009 getPdingTrackingCals! \r\n");
}
return ret;
}
int ad9009_TALISE_gtTxLolStatus(int argc, char *argv[])
{
int ret = ERROR;
u32 txChannel;
taliseTxLolStatus_t result;
if (argc < 3)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
if ((OK == str2digit(argv[2], &txChannel, 10)))
{
if (txChannel>=0&&txChannel<=3)
ret = TALISE_getTxLolStatus(p_myTaliseDevice_shm, (taliseTxChannels_t)txChannel, &result);
}
}
if (ret == OK)
{
printf(
"SUCCESS:getTxLolStatus:ch=tx%d,errorCode=0x%04X,percentComplete=0x%04X, \
performanceMetric=0x%04X,iterCount=0x%04X,updateCount=0x%04X! \r\n",txChannel,
result.errorCode, result.percentComplete, result.varianceMetric, result.iterCount, result.updateCount);
} else
{
printf("FAIL: getTxLolStatus! \r\n");
}
return ret;
}
int ad9009_TALISE_gtTxQecStatus(int argc, char *argv[])
{
int ret = ERROR;
u32 txChannel;
taliseTxQecStatus_t result;
if (argc < 3)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
if ((OK == str2digit(argv[2], &txChannel, 10)))
{
if (txChannel>=0&&txChannel<=3)
ret = TALISE_getTxQecStatus(p_myTaliseDevice_shm, (taliseTxChannels_t)txChannel, &result);
}
}
if (ret == OK)
{
printf(
"SUCCESS:getTxQecStatus:ch=tx%d,errorCode=0x%04X,percentComplete=0x%04X, \
performanceMetric=0x%04X,iterCount=0x%04X,updateCount=0x%04X! \r\n",txChannel,
result.errorCode, result.percentComplete, result.correctionMetric, result.iterCount, result.updateCount);
} else
{
printf("FAIL: getTxQecStatus! \r\n");
}
return ret;
}
int ad9009_TALISE_gtRxQecStatus(int argc, char *argv[])
{
int ret = ERROR;
u32 rxChannel;
#if 0
mykonosRxQecStatus_t result;
if (argc < 3)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
if ((OK == str2digit(argv[2], &rxChannel, 10)))
{
if (rxChannel == 1)
ret = TALISE_getRxQecStatus(p_myTaliseDevice_shm, RX1, &result);
else if (rxChannel == 2)
ret = TALISE_getRxQecStatus(p_myTaliseDevice_shm, RX2, &result);
}
}
if (ret == OK)
{
if (rxChannel == 1)
printf(
"SUCCESS:getRxQecStatus:rx1,errorCode=0x%04X,percentComplete=0x%04X, \
selfcheckIrrDb=0x%04X,iterCount=0x%04X,updateCount=0x%04X! \r\n",
result.errorCode, result.percentComplete, result.selfcheckIrrDb, result.iterCount, result.updateCount);
else if (rxChannel == 2)
printf(
"SUCCESS:getRxQecStatus:rx2,errorCode=0x%04X,percentComplete=0x%04X, \
selfcheckIrrDb=0x%04X,iterCount=0x%04X,updateCount=0x%04X! \r\n",
result.errorCode, result.percentComplete, result.selfcheckIrrDb, result.iterCount, result.updateCount);
} else
{
printf("FAIL: getTxQecStatus! \r\n");
}
#endif
return ret;
}
int ad9009_TALISE_gtOrxQecStatus(int argc, char *argv[])
{
int ret = ERROR;
u32 orxChannel;
#if 0
mykonosOrxQecStatus_t result;
if (argc < 3)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
if ((OK == str2digit(argv[2], &orxChannel, 10)))
{
if ((orxChannel == 1) || (orxChannel == 5))
ret = TALISE_getOrxQecStatus(p_myTaliseDevice_shm, OBS_RX1_TXLO, &result);
else if ((orxChannel == 2) || (orxChannel == 6))
ret = TALISE_getOrxQecStatus(p_myTaliseDevice_shm, OBS_RX2_TXLO, &result);
}
}
if (ret == OK)
{
if ((orxChannel == 1) || (orxChannel == 5))
printf(
"SUCCESS:getOrxQecStatus:ch=rx1,errorCode=0x%04X,percentComplete=0x%04X, \
selfcheckIrrDb=0x%04X,iterCount=0x%04X,updateCount=0x%04X! \r\n",
result.errorCode, result.percentComplete, result.selfcheckIrrDb, result.iterCount, result.updateCount);
else if ((orxChannel == 2) || (orxChannel == 6))
printf(
"SUCCESS:getOrxQecStatus:ch=rx2,errorCode=0x%04X,percentComplete=0x%04X, \
selfcheckIrrDb=0x%04X,iterCount=0x%04X,updateCount=0x%04X! \r\n",
result.errorCode, result.percentComplete, result.selfcheckIrrDb, result.iterCount, result.updateCount);
} else
{
printf("FAIL: getOrxQecStatus! \r\n");
}
#endif
return ret;
}
int ad9009_TALISE_rdArmCmdStatus(int argc, char *argv[])
{
int ret = ERROR;
int i;
uint16_t errorWord[8], statusWord[8];
if (argc < 2)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
ret = TALISE_readArmCmdStatus(p_myTaliseDevice_shm, errorWord, statusWord);
}
if (ret == OK)
{
for (i = 0; i <= 7; i++)
{
printf("errorword[%d]=0x%04X,statusword[%d]=0x%04X\r\n", i, errorWord[i], i, statusWord[i]);
}
} else
{
printf("FAIL: ad9009 readArmCmdStatus! \r\n");
}
return ret;
}
int ad9009_TALISE_enbleMultichipSync(int argc, char *argv[])
{
int ret = ERROR;
u32 enableMcs;
uint8_t mcsStatus;
if (argc < 3)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
if ((OK == str2digit(argv[2], &enableMcs, 10)))
{
ret = TALISE_enableMultichipSync(p_myTaliseDevice_shm, (uint8_t) (enableMcs), &mcsStatus);
}
}
if (ret == OK)
{
printf("SUCCESS:enableMultichipSync mcsStatus=0x%X! \r\n", mcsStatus);
} else
{
printf("FAIL: enableMultichipSync! \r\n");
}
// return ret;
}
int ad9009_TALISE_gtDeframerFifoDepth(int argc, char *argv[])
{
int ret = ERROR;
#if 0
uint8_t fifoDepth, readEnLmfcCount;
if (argc < 2)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
ret = TALISE_getDeframerFifoDepth(p_myTaliseDevice_shm, &fifoDepth, &readEnLmfcCount);
}
if (ret == OK)
{
printf("SUCCESS:fifoDepth=0x%02X,enLmfcCount=0x%02X! \r\n", fifoDepth, readEnLmfcCount);
} else
{
printf("FAIL:setupDeserializers! \r\n");
}
#endif
return ret;
}
int ad9009_TALISE_enGainCtrSyncPulse(int argc, char *argv[])
{
int ret = ERROR;
u32 ch;
u32 enable;
#if 0
if (argc < 4)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
if ((OK == str2digit(argv[2], &ch, 16)) && (OK == str2digit(argv[3], &enable, 16)))
{
if (ch == 0)
ret = TALISE_enableRxGainCtrSyncPulse(p_myTaliseDevice_shm, (uint8_t) enable);
else if (ch == 1)
ret = TALISE_enableObsRxGainCtrSyncPulse(p_myTaliseDevice_shm, (uint8_t) enable);
}
}
if (ret == OK)
{
printf("SUCCESS:ad9009 enRxGainCtrSyncPulse!\r\n");
} else
{
printf("FAIL: ad9009 enRxGainCtrSyncPulse! \r\n");
}
#endif
return ret;
}
int ad9009_TALISE_stGainControlMode(int argc, char *argv[])
{
int ret = ERROR;
u32 mode;
u32 ch;
#if 0
if (argc < 4)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
if ((OK == str2digit(argv[2], &ch, 16)) && (OK == str2digit(argv[3], &mode, 16)))
{
if (ch == 0)
{
if (mode == 0)
ret = TALISE_setRxGainControlMode(p_myTaliseDevice_shm, MGC);
else if (mode == 2)
ret = TALISE_setRxGainControlMode(p_myTaliseDevice_shm, AGC);
else if (mode == 3)
ret = TALISE_setRxGainControlMode(p_myTaliseDevice_shm, HYBRID);
} else if (ch == 1)
{
if (mode == 0)
ret = TALISE_setObsRxGainControlMode(p_myTaliseDevice_shm, MGC);
else if (mode == 2)
ret = TALISE_setObsRxGainControlMode(p_myTaliseDevice_shm, AGC);
else if (mode == 3)
ret = TALISE_setObsRxGainControlMode(p_myTaliseDevice_shm, HYBRID);
} else
printf("FAIL: ad9009 enRxGainCtrSyncPulse! \r\n");
}
}
if (ret == OK)
{
printf("SUCCESS:ad9009 setRxGainControlMode!\r\n");
} else
{
printf("FAIL: ad9009 setRxGainControlMode! \r\n");
}
#endif
return ret;
}
int ad9009_TALISE_gtObsRxPath(int argc, char *argv[])
{
int ret = ERROR;
#if 0
mykonosObsRxChannels_t channel;
if (argc < 2)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
ret = TALISE_getObsRxPathSource(p_myTaliseDevice_shm, &channel);
}
if (ret == OK)
{
printf("SUCCESS:ad9009 getObsRxPathSource path=0x%x!\r\n", channel);
} else
{
printf("FAIL: ad9009 setObsRxPathSource! \r\n");
}
#endif
return ret;
}
int ad9009_TALISE_stArmGpioPins(int argc, char *argv[])
{
int ret = ERROR;
// mykonosObsRxChannels_t channel;
#if 0
if (argc < 2)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
ret = TALISE_setArmGpioPins(p_myTaliseDevice_shm);
}
if (ret == OK)
{
printf("SUCCESS:ad9009 setArmGpioPins\r\n");
} else
{
printf("FAIL: ad9009 setArmGpioPins! \r\n");
}
#endif
return ret;
}
int ad9009_TALISE_stRadioControlPinMode(int argc, char *argv[])
{
int ret = ERROR;
// mykonosObsRxChannels_t channel;
#if 0
if (argc < 2)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
ret = TALISE_setRadioControlPinMode(p_myTaliseDevice_shm);
}
if (ret == OK)
{
printf("SUCCESS:ad9009 setRadioControlPinMode\r\n");
} else
{
printf("FAIL: ad9009 setRadioControlPinMode! \r\n");
}
#endif
return ret;
}
int ad9009_TALISE_Test(int argc, char *argv[])
{
int ret = ERROR;
int talAction=ERROR;
uint8_t pllLockStatus = 0;
int i;
printf("------test1 start ------\n");
for(i=0;i<1000;i++)
{
printf("test cnt=%d.\r\n", i);
ret = TALISE_radioOff(p_myTaliseDevice_shm);
if (ret != TALACT_NO_ACTION)
{
/*** < User: decide what to do based on Talise recovery action returned > ***/
printf("TALISE_radioOff error!\n");
}
sleep(1);
if(i%2>0)
{
talAction = TALISE_setRfPllFrequency(p_myTaliseDevice_shm, TAL_RF_PLL, 2400000000);
}
else
{
talAction = TALISE_setRfPllFrequency(p_myTaliseDevice_shm, TAL_RF_PLL, 5800000000);
}
usleep(200*1000);
/* CLKPLL lock status check */
pllLockStatus = 0;
talAction = TALISE_getPllsLockStatus(p_myTaliseDevice_shm, &pllLockStatus);
//printf("pll lockStatus=0x%x\n", pllLockStatus);
if (0x07 != (pllLockStatus & 0x07))
{
printf("ERROR:pll unlocked,pllLockStatus=0x%x\n",pllLockStatus);
}
usleep(100*1000);
ret = TALISE_radioOn(p_myTaliseDevice_shm);
if (talAction != TALACT_NO_ACTION)
{
/*** < User: decide what to do based on Talise recovery action returned > ***/
printf("TALISE_radioOn error!\n");
}
sleep(1);
}
printf("------test1 finish------\n");
}
int ad9009_TALISE_runInitCalsManual_1(int argc, char *argv[])
{
int ret = ERROR;
//u32 enableMask;
uint8_t errorFlag, errorCode;
int i;
u32 initCalMask = TAL_TX_BB_FILTER | TAL_ADC_TUNER | TAL_TIA_3DB_CORNER
| TAL_DC_OFFSET | TAL_TX_ATTENUATION_DELAY | TAL_RX_GAIN_DELAY | TAL_FLASH_CAL |
TAL_PATH_DELAY | TAL_TX_LO_LEAKAGE_INTERNAL | TAL_TX_QEC_INIT |
TAL_LOOPBACK_RX_LO_DELAY | TAL_LOOPBACK_RX_RX_QEC_INIT |
TAL_RX_LO_DELAY | TAL_RX_QEC_INIT|TAL_ADC_STITCHING;
if (argc < 2)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
//if ((OK == str2digit(argv[2], &enableMask, 16)))
{
//ret = TALISE_runInitCals(p_myTaliseDevice_shm,(uint8_t)enableMask);
ret = TALISE_radioOff(p_myTaliseDevice_shm);
if (ret != TALACT_NO_ACTION)
{
/*** < User: decide what to do based on Talise recovery action returned > ***/
printf("TALISE_runInitCalsManual_1:TALISE_radioOff error!\n");
return ERROR;
}
for (i = 0; i < 3; i++)
{
ret = TALISE_runInitCals(p_myTaliseDevice_shm, initCalMask);
printf("TALISE_runInitCals,ret=%d! \r\n", ret);
ret = TALISE_waitInitCals(p_myTaliseDevice_shm, 20000, &errorFlag);
printf("TALISE_waitInitCals,ret=%d! \r\n", ret);
if (errorFlag)
{
printf("FAIL: runInitCals time %d fail,errorFlag=0x%x! \r\n", i, errorFlag);
} else if (errorCode)
{
printf("FAIL: runInitCals time %d fail,errorCode=0x%x! \r\n", i, errorCode);
} else
{
break;
}
}
ret = TALISE_radioOn(p_myTaliseDevice_shm);
if (ret != TALACT_NO_ACTION)
{
/*** < User: decide what to do based on Talise recovery action returned > ***/
printf("TALISE_runInitCalsManual_1:TALISE_radioOn error!\n");
}
if (i >= 3)
{
printf("FAIL: runInitCals beyond 3 times fail! \r\n");
return ret;
}
}
}
if (ret == OK)
{
printf("SUCCESS:ad9009 TALISE_runInitCals !\r\n");
} else
{
printf("FAIL: ad9009 TALISE_runInitCals! \r\n");
}
return ret;
}
int ad9009_TALISE_setRfPllFreq_1(int argc, char *argv[])
{
int ret = ERROR;
unsigned int channel;
uint64_t freqValue;
uint8_t pllLockStatus = 0;
uint8_t i;
if (argc < 4)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
if ((OK == str2digit(argv[2], &channel, 16)) && (OK == str2digit_u64(argv[3], &freqValue, 10)))
{
if ((channel < TAL_RF_PLL) || (channel > TAL_AUX_PLL))
{
printf("FAIL: channel value beyond limit! \r\n");
return ERROR;
}
ret = TALISE_radioOff(p_myTaliseDevice_shm);
if (ret != TALACT_NO_ACTION)
{
/*** < User: decide what to do based on Talise recovery action returned > ***/
printf("TALISE_setRfPllFreq_1:TALISE_radioOff error!\n");
return ERROR;
}
for(i=0;i<3;i++)
{
ret = TALISE_setRfPllFrequency(p_myTaliseDevice_shm, (taliseRfPllName_t) channel, freqValue);
if (ret == OK)
{
printf("SUCCESS:ad9009 set rf pll freq succeed!\r\n");
} else
{
printf("FAIL: ad9009 set rf pll freq failed!ERROR code = %d.\n", ret);
}
usleep(200*1000);
/* CLKPLL lock status check */
pllLockStatus = 0;
ret = TALISE_getPllsLockStatus(p_myTaliseDevice_shm, &pllLockStatus);
printf("pll lockStatus=0x%x\r\n", pllLockStatus);
if (0x07 == (pllLockStatus & 0x07))
{
break;
}
}
ret = TALISE_radioOn(p_myTaliseDevice_shm);
if (ret != TALACT_NO_ACTION)
{
/*** < User: decide what to do based on Talise recovery action returned > ***/
printf("TALISE_setRfPllFreq_1:TALISE_radioOn error!\n");
}
if (i >= 3)
{
printf("FAIL: setRfPllFrequency beyond 3 times fail,!\r\n");
return ERROR;
}
}
}
return ret;
}
int ad9009_TALISE_setRfPllFreq_cals(int argc, char *argv[])
{
int ret = ERROR;
unsigned int channel;
uint64_t freqValue;
uint8_t pllLockStatus = 0;
uint8_t i,errorFlag;
uint64_t freq;
u32 initCalMask = TAL_TX_BB_FILTER | TAL_ADC_TUNER | TAL_TIA_3DB_CORNER
| TAL_DC_OFFSET | TAL_TX_ATTENUATION_DELAY | TAL_RX_GAIN_DELAY | TAL_FLASH_CAL |
TAL_PATH_DELAY | TAL_TX_LO_LEAKAGE_INTERNAL | TAL_TX_QEC_INIT |
TAL_LOOPBACK_RX_LO_DELAY | TAL_LOOPBACK_RX_RX_QEC_INIT |
TAL_RX_LO_DELAY | TAL_RX_QEC_INIT|TAL_ADC_STITCHING;
if (argc < 4)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
if ((OK == str2digit(argv[2], &channel, 16)) && (OK == str2digit_u64(argv[3], &freqValue, 10)))
{
if ((channel < TAL_RF_PLL) || (channel > TAL_AUX_PLL))
{
printf("FAIL: channel value beyond limit! \r\n");
return ERROR;
}
ret = TALISE_radioOff(p_myTaliseDevice_shm);
freq = freqValue;
if (ret != TALACT_NO_ACTION)
{
/*** < User: decide what to do based on Talise recovery action returned > ***/
printf("TALISE_setRfPllFreq_1:TALISE_radioOff error!\n");
return ERROR;
}
for(i=0;i<3;i++)
{
ret = TALISE_setRfPllFrequency(p_myTaliseDevice_shm, (taliseRfPllName_t) channel, freq);
if (ret == OK)
{
printf("SUCCESS:ad9009 set rf pll freq succeed!\r\n");
} else
{
printf("FAIL: ad9009 set rf pll freq failed!ERROR code = %d.\n", ret);
}
usleep(200*1000);
/* CLKPLL lock status check */
pllLockStatus = 0;
ret = TALISE_getPllsLockStatus(p_myTaliseDevice_shm, &pllLockStatus);
printf("pll lockStatus=0x%x\r\n", pllLockStatus);
if (0x07 == (pllLockStatus & 0x07))
{
break;
}
}
if (i >= 3)
{
printf("FAIL: setRfPllFrequency beyond 3 times fail,!\r\n");
//return ERROR;
}
/* runInitCals */
for (i = 0; i < 3; i++)
{
ret = TALISE_runInitCals(p_myTaliseDevice_shm, initCalMask);
if (ret != TALACT_NO_ACTION)
{
printf("cfg 9009 70,%d! \r\n", ret);
}
//mykError = TALISE_waitInitCals(p_myTaliseDevice_shm,20000,&errorFlag,&errorCode);
ret = TALISE_waitInitCals(p_myTaliseDevice_shm, 20000, &errorFlag);
if (ret != TALACT_NO_ACTION)
{
printf("cfg 9009 71,%d! \r\n", ret);
}
if (ret != TALACT_NO_ACTION)
{
printf("FAIL: runInitCals time %d fail,errorFlag=0x%x! \r\n", i, ret);
}
else
{
break;
}
}
if (i >= 3)
{
printf("FAIL: runInitCals beyond 3 times fail! \r\n");
//return mykError;
}
ret = TALISE_radioOn(p_myTaliseDevice_shm);
if (ret != TALACT_NO_ACTION)
{
/*** < User: decide what to do based on Talise recovery action returned > ***/
printf("TALISE_setRfPllFreq_1:TALISE_radioOn error!\n");
}
}
}
return ret;
}
int ad9009_TALISE_setTrackCal(int argc, char *argv[])
{
int ret = ERROR;
u32 trackCals;
u32 subTrackCals;
if (argc < 4)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
if (OK == str2digit(argv[2], &subTrackCals, 16))
{
if (OK == str2digit(argv[3], &trackCals, 16))
ret = TALISE_setAllTrackCalState(p_myTaliseDevice_shm, subTrackCals,trackCals);
}
}
if (ret == OK)
{
printf("SUCCESS:ad9009 setAllTrackCalState\r\n");
} else
{
printf("FAIL: ad9009 setAllTrackCalState! ret = %d\r\n", ret);
}
return ret;
}
int ad9009_TALISE_getTrackCal(int argc, char *argv[])
{
int ret = ERROR;
u32 trackCals = 0;
if (argc < 2)
{
printf("WARRING: please specify the num of prama!!\r\n");
} else
{
ret = TALISE_getAllTrackCalState(p_myTaliseDevice_shm, &trackCals);
}
if (ret == OK)
{
printf("SUCCESS:ad9009 getAllTrackCalState, trackCals = 0x%x\r\n", trackCals);
} else
{
printf("FAIL: ad9009 getAllTrackCalState! ret = %d\r\n", ret);
}
return ret;
}
int ad9009_TALISE_Ext_LOL_Cal_1(int argc, char *argv[])
{
uint8_t errorFlag = 0;
uint8_t errorCode = 0;
int i;
//u32 enableMask = 0xF3;
u32 initCalMask = 0x0200;
taliseErr_t mykError = TAL_ERR_OK;
//TALISE_runInitCals(p_myTaliseDevice_shm,initCalMask);
printf("come in TALISE_Ext_LOL_Cal_1! \r\n");
if (argc < 2)
{
printf("TALISE_Ext_LOL_Cal_1 -WARRING: please specify the num of prama!!\r\n");
return -1;
}
//swtich setting,tx connect to orx
TALISE_radioOff(p_myTaliseDevice_shm);
TALISE_setTxToOrxMapping(p_myTaliseDevice_shm,1,TAL_MAP_TX1_ORX,TAL_MAP_NONE);
for (i = 0; i < 3; i++)
{
mykError = (taliseErr_t)TALISE_runInitCals(p_myTaliseDevice_shm, initCalMask);
printf("cfg 9009 70,%d! \r\n",mykError);
mykError = (taliseErr_t)TALISE_waitInitCals(p_myTaliseDevice_shm, 60000, &errorFlag);
printf("cfg 9009 71,%d! \r\n",mykError);
if (errorFlag)
{
printf("FAIL: runInitCals time %d fail,errorFlag=0x%x! \r\n", i, errorFlag);
} else if (errorCode)
{
printf("FAIL: runInitCals time %d fail,errorCode=0x%x! \r\n", i, errorCode);
} else
{
break;
}
}
if (i >= 3)
{
TALISE_radioOn(p_myTaliseDevice_shm);
printf("FAIL: runInitCals beyond 3 times fail! \r\n");
return mykError;
}
/* enable tracking calibrations,锟斤拷锟绞碉拷锟斤拷锟斤拷确锟斤拷enableMask值 */
//TALISE_enableTrackingCals(p_myTaliseDevice_shm, enableMask);
/* enable radio on */
TALISE_radioOn(p_myTaliseDevice_shm);
// TALISE_setObsRxPathSource(p_myTaliseDevice_shm, OBS_INTERNALCALS);
printf("TALISE_Ext_LOL_Cal_1 finish! \r\n");
return mykError;
}
int ad9009_TALISE_Ext_LOL_Cal_2(int argc, char *argv[])
{
uint8_t errorFlag = 0;
uint8_t errorCode = 0;
int i;
//u32 enableMask = 0xF3;
u32 initCalMask = 0x0200;
taliseErr_t mykError = TAL_ERR_OK;
//TALISE_runInitCals(p_myTaliseDevice_shm,initCalMask);
printf("come in TALISE_Ext_LOL_Cal_2! \r\n");
if (argc < 2)
{
printf("TALISE_Ext_LOL_Cal_2 -WARRING: please specify the num of prama!!\r\n");
return -1;
}
//swtich setting,tx connect to orx
TALISE_radioOff(p_myTaliseDevice_shm);
TALISE_setTxToOrxMapping(p_myTaliseDevice_shm,1,TAL_MAP_NONE,TAL_MAP_TX2_ORX);
//TALISE_setTxToOrxMapping(p_myTaliseDevice_shm,1,TAL_MAP_TX2_ORX,TAL_MAP_NONE);
for (i = 0; i < 3; i++)
{
mykError = (taliseErr_t)TALISE_runInitCals(p_myTaliseDevice_shm, initCalMask);
printf("cfg 9009 Ext_LOL_Cal 1,%d! \r\n",mykError);
mykError = (taliseErr_t)TALISE_waitInitCals(p_myTaliseDevice_shm, 60000, &errorFlag);
printf("cfg 9009 Ext_LOL_Cal 2,%d! \r\n",mykError);
if (errorFlag)
{
printf("FAIL: runInitCals time %d fail,errorFlag=0x%x! \r\n", i, errorFlag);
} else if (errorCode)
{
printf("FAIL: runInitCals time %d fail,errorCode=0x%x! \r\n", i, errorCode);
} else
{
break;
}
}
if (i >= 3)
{
TALISE_radioOn(p_myTaliseDevice_shm);
printf("FAIL: runInitCals beyond 3 times fail! \r\n");
return mykError;
}
/* enable tracking calibrations,锟斤拷锟绞碉拷锟斤拷锟斤拷确锟斤拷enableMask值 */
//TALISE_enableTrackingCals(p_myTaliseDevice_shm, enableMask);
/* enable radio on */
TALISE_radioOn(p_myTaliseDevice_shm);
// TALISE_setObsRxPathSource(p_myTaliseDevice_shm, OBS_INTERNALCALS);
printf("TALISE_Ext_LOL_Cal_2 finish! \r\n");
return mykError;
}
/* end of file */