[GITLAB] - UPGRADE TO v12 on Wednesday the 18th of December at 11.30AM

[TOCHEC] Adapted the UE input buffer memory loop to be used with storaged IQ files (int16+int16)

parent d03d70a6
......@@ -2453,6 +2453,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac
#endif
//printf("subframe_rx(%d),slot_rx(%d)\n",subframe_rx,slot_rx);
if (phy_vars_ue->lte_frame_parms.Ncp == 0) { // normal prefix
pilot1 = 4;
pilot2 = 7;
......@@ -2470,7 +2471,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac
else
n_symb = 0;
} else {
/*
/*
if (is_pmch_subframe(frame_rx,subframe_rx,&phy_vars_ue->lte_frame_parms)) {
if ((slot_rx%2)==0) {
n_symb=2;
......@@ -2480,7 +2481,8 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac
n_symb=0;
}
else*/
n_symb = phy_vars_ue->lte_frame_parms.symbols_per_tti/2;
n_symb = phy_vars_ue->lte_frame_parms.symbols_per_tti/2;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
......@@ -3101,6 +3103,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac
// rt_printk("[PDCCH] Frame %d, slot %d, start %llu\n",frame_rx,slot_rx,rt_get_time_ns());
if (lte_ue_pdcch_procedures(eNB_id,phy_vars_ue,abstraction_flag) == -1) {
LOG_E(PHY,"[UE %d] Frame %d, slot %d: Error in pdcch procedures\n",phy_vars_ue->Mod_id,frame_rx,slot_rx);
#ifdef DEBUG_PHY_PROC
LOG_E(PHY,"[UE %d] Frame %d, slot %d: Error in pdcch procedures\n",phy_vars_ue->Mod_id,frame_rx,slot_rx);
#endif
......
......@@ -251,6 +251,8 @@ int UE_scan_carrier = 0;
runmode_t mode = normal_txrx;
FILE *input_fd=NULL;
input_file= NULL;
input_buffer_l = 0;
#ifdef EXMIMO
......@@ -2104,8 +2106,11 @@ static void get_options (int argc, char **argv)
case LONG_OPTION_LOOPMEMORY:
mode=loop_through_memory;
input_file = (char*)malloc(sizeof(char)*100);
strcpy(input_file,optarg);
input_fd = fopen(optarg,"r");
AssertFatal(input_fd != NULL,"Please provide an input file\n");
printf("%s\n",input_file);
break;
case LONG_OPTION_DUMP_FRAME:
......@@ -3111,11 +3116,14 @@ openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
}
if (input_fd) {
printf("Reading in from file to antenna buffer %d\n",0);
printf("Reading in from file to antenna buffer %d, buffer_size %d\n",input_fd,frame_parms[0]->samples_per_tti*10);
//fseek(input_fd, 7680000/2,0);
fread(UE[0]->lte_ue_common_vars.rxdata[0],
sizeof(int32_t),
frame_parms[0]->samples_per_tti*10,
input_fd);
input_buffer_l = ftell(input_fd);
fclose(input_fd);
}
//p_exmimo_config->framing.tdd_config = TXRXSWITCH_TESTRX;
} else {
......
......@@ -119,6 +119,9 @@ extern int oai_exit;
extern int32_t **rxdata;
extern int32_t **txdata;
extern char * input_file;
extern int input_buffer_l;
//extern unsigned int tx_forward_nsamps;
//extern int tx_delay;
......@@ -1188,9 +1191,43 @@ void *UE_thread(void *arg)
LOG_D(HW,"signalled rx thread to wake up, hw_frame %d, hw_subframe %d (time %lli)\n", frame, hw_subframe, rt_get_time_ns()-T0 );
if (UE->mode == loop_through_memory) {
printf("Processing subframe %d",UE->slot_rx>>1);
if (pthread_mutex_lock(&UE->mutex_rx) != 0) {
LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RX thread\n" );
exit_fun("nothing to add");
return &UE_thread_retval;
}
printf(" Processing subframe %d",UE->slot_rx>>1);
if( input_file){
if( (UE->slot_rx>>1) == 9 ){
FILE * in_fd = fopen(input_file,"r");
AssertFatal(in_fd != NULL,"Please provide an input file\n");
if(in_fd){
fseek(in_fd,0,SEEK_END);
int numbytes = ftell(in_fd);
fseek(in_fd,0,SEEK_SET);
printf("input_file:%s, numbytes(%d)\n",input_file,numbytes);
if( input_buffer_l + sizeof(int32_t)* UE->lte_frame_parms.samples_per_tti*10 > numbytes )
input_buffer_l = 0;
LOG_W(PHY,"Reading in from file to antenna buffer, buffer_size %d ,dessired position %d\n", UE->lte_frame_parms.samples_per_tti*10*sizeof(int32_t),input_buffer_l);
fseek(in_fd,input_buffer_l,0);
fread(UE->lte_ue_common_vars.rxdata[0],
sizeof(int32_t),
UE->lte_frame_parms.samples_per_tti*10,
in_fd);
input_buffer_l+=ftell(in_fd);
fclose(in_fd);
LOG_W(PHY,"Buffer left %d\n",numbytes - input_buffer_l);
}
}
}
LOG_D(PHY,"Unlocking mutex_rx (IC %d)\n",instance_cnt_rx);
if (pthread_mutex_unlock(&UE->mutex_rx) != 0) {
LOG_E( PHY, "[SCHED][UE] error unlocking mutex for UE RX thread\n" );
exit_fun("nothing to add");
return &UE_thread_retval;
}
getchar();
}
}
if (UE->mode == rx_calib_ue) {
if (frame == 10) {
......@@ -1901,6 +1938,13 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg,
free(phy_vars_ue[CC_id]->lte_ue_common_vars.txdata[i]);
phy_vars_ue[CC_id]->lte_ue_common_vars.txdata[i] = (int32_t*) openair0_exmimo_pci[rf_map[CC_id].card].dac_head[rf_map[CC_id].chain+i];
if (phy_vars_ue[CC_id]->mode == loop_through_memory) {
if( !phy_vars_ue[CC_id]->lte_ue_common_vars.txdata[i] ){
LOG_W(PHY,"mode:loop_through_memory -- lte_ue_common_vars.txdata buffer no init by exmimo driver ... proceed with a local malloc\n");
phy_vars_ue[CC_id]->lte_ue_common_vars.txdata[i] = (int32_t*)malloc16_clear( 307200*sizeof(int32_t) );
}
}
if (openair0_cfg[rf_map[CC_id].card].tx_freq[rf_map[CC_id].chain+i]) {
printf("Error with rf_map! A channel has already been allocated!\n");
return(-1);
......
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