Commit 52bbda0c authored by masayuki.harada's avatar masayuki.harada

Add rf debug command.

parent b8054b3b
......@@ -117,6 +117,42 @@ telnetshell_cmddef_t telnet_cmdarray[] = {
};
/* functions for telnet support, when telnet server is loaded */
int telnet_rf_test_cmd=0;
int telnet_rf_test_time=200;
int telnet_rf_test_offset=10;
void set_rf_test(int cmd,int time,int offset);
int rf_setmod_cmd(char *buff, int debug, telnet_printfunc_t prnt)
{
if (debug > 0)
prnt( "rf_set_cmd received %s\n",buff);
if (strcasestr(buff,"stop") != NULL) {
telnet_rf_test_cmd=1;
} else if (strcasestr(buff,"down") != NULL) {
telnet_rf_test_cmd=2;
} else if (strcasestr(buff,"up") != NULL) {
telnet_rf_test_cmd=3;
} else {
prnt("%s: wrong setmod parameter...\n",buff);
}
set_rf_test(telnet_rf_test_cmd,telnet_rf_test_time,telnet_rf_test_offset);
prnt("rf current set: mode %d time %d offset %d\n",telnet_rf_test_cmd,telnet_rf_test_time,telnet_rf_test_offset);
return 0;
}
telnetshell_vardef_t rf_vardef[] = {
{"time",TELNET_VARTYPE_INT32,&telnet_rf_test_time},
{"offset",TELNET_VARTYPE_INT32,&telnet_rf_test_offset},
{"",0,NULL}
};
static telnetshell_cmddef_t rf_cmdarray[] = {
{"test","[stop,down,up]",rf_setmod_cmd},
{"","",NULL},
};
void client_printf(const char *message, ...) {
va_list va_args;
va_start(va_args, message);
......@@ -709,6 +745,9 @@ int add_sharedmodules(void) {
return ret;
}
int telnetsrv_autoinit(void) {
memset(&telnetparams,0,sizeof(telnetparams));
config_get( telnetoptions,sizeof(telnetoptions)/sizeof(paramdef_t),"telnetsrv");
......@@ -719,6 +758,7 @@ int telnetsrv_autoinit(void) {
}
add_telnetcmd("telnet", telnet_vardef, telnet_cmdarray);
add_telnetcmd("rf", rf_vardef, rf_cmdarray);
add_embeddedmodules();
return 0;
}
......@@ -774,3 +814,4 @@ int telnetsrv_getfarray(loader_shlibfunc_t **farray) {
(*farray)[0].fptr=(int (*)(void) )add_telnetcmd;
return 1;
}
......@@ -69,8 +69,8 @@
#define LTEMAC_UEMEASURE \
{ \
{"dlsch_mcs1", &(macuestatptr->dlsch_mcs1),TELNET_VARTYPE_INT8,0},\
{"dlsch_mcs2", &(macuestatptr->dlsch_mcs2),TELNET_VARTYPE_INT8,0},\
{"dlsch_mcs1", &(macuestatptr->dlsch_mcs[TB1]),TELNET_VARTYPE_INT8,0},\
{"dlsch_mcs2", &(macuestatptr->dlsch_mcs[TB2]),TELNET_VARTYPE_INT8,0},\
{"rbs_used", &(macuestatptr->rbs_used),TELNET_VARTYPE_INT32,0},\
{"rbs_used_retx", &(macuestatptr->rbs_used_retx),TELNET_VARTYPE_INT16,0},\
{"total_rbs_used", &(macuestatptr->total_rbs_used),TELNET_VARTYPE_INT16,0},\
......
......@@ -562,6 +562,16 @@ static void *emulatedRF_thread(void *param) {
return 0;
}
volatile int rf_test_cmd=0;
int rf_test_time=100;
int rf_test_offset=10;
void set_rf_test(int cmd,int time,int offset){
rf_test_cmd=cmd;
rf_test_time=time;
rf_test_offset=offset;
}
void rx_rf(RU_t *ru,int *frame,int *subframe) {
RU_proc_t *proc = &ru->proc;
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
......@@ -574,6 +584,40 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
openair0_timestamp ts=0,old_ts=0;
openair0_config_t *cfg = &ru->openair0_cfg;
static int rf_test_stop_cnt=-1;
if(rf_test_cmd!=0){
if(rf_test_cmd==1){
if(rf_test_stop_cnt==-1) {
rf_test_stop_cnt=rf_test_time;
LOG_I(PHY,"stop tx for %d ms\n",rf_test_stop_cnt);
}else if(rf_test_stop_cnt==0) {
rf_test_cmd=0;
rf_test_stop_cnt=-1;
}else{
if((late_control==STATE_BURST_STOP_2)||(late_control==STATE_BURST_STOP_1)){
late_control=STATE_BURST_STOP_1;
}else{
late_control=STATE_BURST_TERMINATE;
}
rf_test_stop_cnt--;
}
}else if(rf_test_cmd==2){
for (i=0; i<ru->nb_tx; i++) {
cfg->tx_gain[i] = (double)ru->att_tx+rf_test_offset;
}
LOG_I(PHY,"set tx_att = %d\n",ru->att_tx+rf_test_offset);
ru->rfdevice.trx_set_gains_func(&ru->rfdevice,cfg);
rf_test_cmd=0;
}else if(rf_test_cmd==3){
for (i=0; i<ru->nb_tx; i++) {
cfg->tx_gain[i] = (double)ru->att_tx;
}
LOG_I(PHY,"set tx_att = %d\n",ru->att_tx);
ru->rfdevice.trx_set_gains_func(&ru->rfdevice,cfg);
rf_test_cmd=0;
}
}
for (i=0; i<ru->nb_rx; i++)
rxp[i] = (void *)&ru->common.rxdata[i][*subframe*fp->samples_per_tti];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment