From af75d546df7f2dd7bca94ea1d431100a6ecf2bbe Mon Sep 17 00:00:00 2001 From: magounak Date: Tue, 9 Oct 2018 11:22:16 +0200 Subject: [PATCH] fixing bugs for dmrssync --- common/utils/LOG/vcd_signal_dumper.c | 4 +++ common/utils/LOG/vcd_signal_dumper.h | 4 +++ common/utils/T/T_defs.h | 2 +- common/utils/T/T_messages.txt | 20 +++++++++++ openair1/PHY/LTE_ESTIMATION/lte_sync_time.c | 11 ++++-- openair1/PHY/LTE_TRANSPORT/if4_tools.c | 3 +- openair1/SCHED/ru_procedures.c | 27 +++++++++++--- targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c | 2 +- targets/RT/USER/lte-ru.c | 35 ++++++++++++------- 9 files changed, 85 insertions(+), 23 deletions(-) diff --git a/common/utils/LOG/vcd_signal_dumper.c b/common/utils/LOG/vcd_signal_dumper.c index cfd3f029f3..e0beea7d79 100644 --- a/common/utils/LOG/vcd_signal_dumper.c +++ b/common/utils/LOG/vcd_signal_dumper.c @@ -79,6 +79,10 @@ const char* eurecomVariablesNames[] = { "subframe_number_TX1_RU", "subframe_number_RX0_RU", "subframe_number_RX1_RU", + "subframe_number_if4p5_north_out", + "frame_number_if4p5_north_out", + "subframe_number_if4p5_north_asynch_in", + "frame_number_if4p5_north_asynch_in", "runtime_TX_eNB", "runtime_RX_eNB", "frame_number_TX0_UE", diff --git a/common/utils/LOG/vcd_signal_dumper.h b/common/utils/LOG/vcd_signal_dumper.h index f184fb020a..a7f8021d81 100644 --- a/common/utils/LOG/vcd_signal_dumper.h +++ b/common/utils/LOG/vcd_signal_dumper.h @@ -55,6 +55,10 @@ typedef enum { VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX1_RU, VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_RU, VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX1_RU, + VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_IF4P5_NORTH_OUT, + VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_NORTH_OUT, + VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_IF4P5_NORTH_ASYNCH_IN, + VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_NORTH_ASYNCH_IN, VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_TX_ENB, VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_RX_ENB, VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_UE, diff --git a/common/utils/T/T_defs.h b/common/utils/T/T_defs.h index a5c7987dc5..d451f1df0b 100644 --- a/common/utils/T/T_defs.h +++ b/common/utils/T/T_defs.h @@ -44,7 +44,7 @@ typedef struct { #define VCD_NUM_FUNCTIONS (218) /* number of VCD variables (to be kept up to date! see in T_messages.txt) */ -#define VCD_NUM_VARIABLES (128) +#define VCD_NUM_VARIABLES (132)/*(128)*/ /* first VCD function (to be kept up to date! see in T_messages.txt) */ #define VCD_FIRST_FUNCTION ((uintptr_t)T_VCD_FUNCTION_RT_SLEEP) diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index 0f6044b99f..70f87306e6 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -1010,6 +1010,26 @@ ID = VCD_VARIABLE_SUBFRAME_NUMBER_RX1_RU GROUP = ALL:VCD:ENB:VCD_VARIABLE FORMAT = ulong,value VCD_NAME = subframe_number_RX1_RU +ID = VCD_VARIABLE_SUBFRAME_NUMBER_IF4P5_NORTH_OUT + DESC = VCD variable SUBFRAME_NUMBER_IF4P5_NORTH_OUT + GROUP = ALL:VCD:ENB:VCD_VARIABLE + FORMAT = ulong,value + VCD_NAME = subframe_number_if4p5_north_out +ID = VCD_VARIABLE_FRAME_NUMBER_IF4P5_NORTH_OUT + DESC = VCD variable FRAME_NUMBER_IF4P5_NORTH_OUT + GROUP = ALL:VCD:ENB:VCD_VARIABLE + FORMAT = ulong,value + VCD_NAME = frame_number_if4p5_north_out +ID = VCD_VARIABLE_SUBFRAME_NUMBER_IF4P5_NORTH_ASYNCH_IN + DESC = VCD variable SUBFRAME_NUMBER_IF4P5_NORTH_ASYNCH_IN + GROUP = ALL:VCD:ENB:VCD_VARIABLE + FORMAT = ulong,value + VCD_NAME = subframe_number_if4p5_north_asynch_in +ID = VCD_VARIABLE_FRAME_NUMBER_IF4P5_NORTH_ASYNCH_IN + DESC = VCD variable FRAME_NUMBER_IF4P5_NORTH_ASYNCH_IN + GROUP = ALL:VCD:ENB:VCD_VARIABLE + FORMAT = ulong,value + VCD_NAME = frame_number_if4p5_north_asynch_in ID = VCD_VARIABLE_RUNTIME_TX_ENB DESC = VCD variable RUNTIME_TX_ENB GROUP = ALL:VCD:ENB:VCD_VARIABLE diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c index de29baa68f..1735ff23fb 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c @@ -477,13 +477,20 @@ LOG_M_END int ru_sync_time_init(RU_t *ru) // LTE_UE_COMMON *common_vars { + /* int16_t dmrs[2048]; int16_t *dmrsp[2] = {dmrs,NULL}; + */ + int32_t dmrs[ru->frame_parms.ofdm_symbol_size*14] __attribute__((aligned(32))); + int32_t *dmrsp[2] = {&dmrs[(3-ru->frame_parms.Ncp)*ru->frame_parms.ofdm_symbol_size],NULL}; + + generate_ul_ref_sigs(); + ru->dmrssync = (int16_t*)malloc16_clear(ru->frame_parms.N_RB_DL*2*sizeof(int16_t)); generate_drs_pusch(NULL,NULL, &ru->frame_parms, - (int32_t**)dmrsp, + dmrsp,/*(int32_t**)dmrsp,*/ 0, AMP, 0, @@ -503,7 +510,7 @@ int ru_sync_time_init(RU_t *ru) // LTE_UE_COMMON *common_vars 1); break; case 50: - idft1024(dmrs, + idft1024((int16_t*)dmrsp,/*dmrs,*/ ru->dmrssync, /// complex output 1); break; diff --git a/openair1/PHY/LTE_TRANSPORT/if4_tools.c b/openair1/PHY/LTE_TRANSPORT/if4_tools.c index f81e423cd3..579d7728d3 100644 --- a/openair1/PHY/LTE_TRANSPORT/if4_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/if4_tools.c @@ -215,7 +215,7 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) { } else if (packet_type >= IF4p5_PRACH && packet_type <= IF4p5_PRACH+4) { // FIX: hard coded prach samples length - LOG_D(PHY,"IF4p5_PRACH: frame %d, subframe %d,packet type %x\n",frame,subframe,packet_type); + if (frame < 10) LOG_I(PHY,"IF4p5_PRACH: frame %d, subframe %d,packet type %x\n",frame,subframe,packet_type); db_fulllength = PRACH_NUM_SAMPLES; if (eth->flags == ETH_RAW_IF4p5_MODE) { @@ -249,6 +249,7 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) { (void *)rxF, PRACH_BLOCK_SIZE_BYTES); } + if (frame == 0) LOG_I(PHY,"signal energy prach %d\n",dB_fixed(signal_energy(rxF,839))); } if (ru->idx<=1) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_IF0+ru->idx, 1 ); if ((ru->ifdevice.trx_write_func(&ru->ifdevice, diff --git a/openair1/SCHED/ru_procedures.c b/openair1/SCHED/ru_procedures.c index 6fd5518d44..c1ccd3cddd 100644 --- a/openair1/SCHED/ru_procedures.c +++ b/openair1/SCHED/ru_procedures.c @@ -97,27 +97,44 @@ void feptx0(RU_t *ru,int slot) { fp->nb_prefix_samples, CYCLIC_PREFIX); else { - AssertFatal(ru->generate_dmrs_sync==1 && (fp->frame_type != TDD || ru->is_slave == 1), + /* AssertFatal(ru->generate_dmrs_sync==1 && (fp->frame_type != TDD || ru->is_slave == 1), "ru->generate_dmrs_sync should not be set, frame_type %d, is_slave %d\n", fp->frame_type,ru->is_slave); - +*/ if (ru->generate_dmrs_sync == 1 && slot == 0 && subframe == 1 && aa==0) { + int32_t dmrs[ru->frame_parms.ofdm_symbol_size*14] __attribute__((aligned(32))); + int32_t *dmrsp[2] = {&dmrs[(3-ru->frame_parms.Ncp)*ru->frame_parms.ofdm_symbol_size],NULL}; + + generate_ul_ref_sigs(); + + ru->dmrssync = (int16_t*)malloc16_clear(ru->frame_parms.ofdm_symbol_size*2*sizeof(int16_t)); generate_drs_pusch((PHY_VARS_UE *)NULL, (UE_rxtx_proc_t*)NULL, fp, - ru->common.txdataF_BF, + dmrsp,//ru->common.txdataF_BF, 0, AMP, 1, 0, fp->N_RB_DL, aa); - } + + idft1024((int16_t*)dmrsp[0], + (int16_t*)&ru->common.txdata[aa][slot_offset], + 1); + + /*normal_prefix_mod((int16_t*)dmrsp[0], + (int*)&ru->common.txdata[aa][slot_offset], + 1, + fp); + */ + } else { normal_prefix_mod(&ru->common.txdataF_BF[aa][slot*slot_sizeF], (int*)&ru->common.txdata[aa][slot_offset], 7, fp); - } + } + } /* len = fp->samples_per_tti>>1; diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c b/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c index ccf39f95aa..2336e079eb 100644 --- a/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c +++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c @@ -245,7 +245,7 @@ int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestam } eth->tx_nsamps = nblocks; - // printf("Sending %d bytes to %s:%d\n",packet_size,str,ntohs(eth->local_addrd.sin_port)); + //printf("Sending %d bytes to %s:%d\n",packet_size,str,ntohs(eth->local_addrd.sin_port)); bytes_sent = sendto(eth->sockfdd, buff[0], diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 4871964879..79c3fd041a 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -154,7 +154,7 @@ static inline void fh_if5_south_out(RU_t *ru) { // southbound IF4p5 fronthaul static inline void fh_if4p5_south_out(RU_t *ru) { if (ru == RC.ru[0]) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, ru->proc.timestamp_tx&0xffffffff ); - LOG_D(PHY,"Sending IF4p5 for frame %d subframe %d\n",ru->proc.frame_tx,ru->proc.subframe_tx); + LOG_I(PHY,"Sending IF4p5 for frame %d subframe %d\n",ru->proc.frame_tx,ru->proc.subframe_tx); if (subframe_select(&ru->frame_parms,ru->proc.subframe_tx)!=SF_UL) { send_IF4p5(ru,ru->proc.frame_tx, ru->proc.subframe_tx, IF4p5_PDLFFT); ru->south_out_cnt++; @@ -211,7 +211,7 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) { symbol_mask_full = (1<ul_symbols_in_S_subframe)-1; else symbol_mask_full = (1<symbols_per_tti)-1; - + LOG_I(PHY,"fh_if4p5_south_in: RU %d, frame %d, subframe %d\n",ru->idx,*frame,*subframe); AssertFatal(proc->symbol_mask[*subframe]==0,"rx_fh_if4p5: proc->symbol_mask[%d] = %x\n",*subframe,proc->symbol_mask[*subframe]); do { recv_IF4p5(ru, &f, &sf, &packet_type, &symbol_number); @@ -228,7 +228,7 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) { LOG_D(PHY,"rx_fh_if4p5: subframe %d symbol mask %x\n",*subframe,proc->symbol_mask[*subframe]); } while(proc->symbol_mask[*subframe] != symbol_mask_full); - //caculate timestamp_rx, timestamp_tx based on frame and subframe + //calculate timestamp_rx, timestamp_tx based on frame and subframe proc->subframe_rx = sf; proc->frame_rx = f; proc->timestamp_rx = ((proc->frame_rx * 10) + proc->subframe_rx ) * fp->samples_per_tti ; @@ -352,12 +352,12 @@ void fh_if4p5_north_in(RU_t *ru,int *frame,int *subframe) { symbol_number = 0; symbol_mask = 0; symbol_mask_full = (1<frame_parms.symbols_per_tti)-1; - + LOG_I(PHY,"fh_if4p5_north_in: frame %d, subframe %d\n",*frame,*subframe); do { recv_IF4p5(ru, frame, subframe, &packet_type, &symbol_number); symbol_mask = symbol_mask | (1<dl_symbols_in_S_subframe) : (1<symbols_per_tti))-1; + LOG_I(PHY,"fh_if4p5_north_asynch_in: RU %d, frame %d, subframe %d\n",ru->idx,*frame,*subframe); do { recv_IF4p5(ru, &frame_tx, &subframe_tx, &packet_type, &symbol_number); if (ru->cmd == STOP_RU){ @@ -449,8 +450,11 @@ void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *subframe) { LOG_D(PHY,"RU %d/%d TST %llu, frame %d, subframe %d\n",ru->idx,0,(long long unsigned int)proc->timestamp_tx,frame_tx,subframe_tx); // dump VCD output for first RU in list if (ru == RC.ru[0]) { - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, frame_tx ); + /*VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, frame_tx ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_RU, subframe_tx ); + */ + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_NORTH_ASYNCH_IN,frame_tx); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_IF4P5_NORTH_ASYNCH_IN,subframe_tx); } @@ -477,9 +481,11 @@ void fh_if4p5_north_out(RU_t *ru) { RU_proc_t *proc=&ru->proc; LTE_DL_FRAME_PARMS *fp = &ru->frame_parms; const int subframe = proc->subframe_rx; - if (ru->idx==0) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_RU, proc->subframe_rx ); - - LOG_D(PHY,"Sending IF4p5_PULFFT SFN.SF %d.%d\n",proc->frame_rx,proc->subframe_rx); + if (ru->idx==0){ + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_IF4P5_NORTH_OUT, proc->subframe_rx ); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_NORTH_OUT, proc->frame_rx ); + } + LOG_D(PHY,"fh_if4p5_north_out: Sending IF4p5_PULFFT SFN.SF %d.%d\n",proc->frame_rx,proc->subframe_rx); if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)!=SF_UL)) { /// **** in TDD during DL send_IF4 of ULTICK to RCC **** /// send_IF4p5(ru, proc->frame_rx, proc->subframe_rx, IF4p5_PULTICK); @@ -628,7 +634,7 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) { #endif } - LOG_D(PHY,"RU %d/%d TS %llu (off %d), frame %d, subframe %d\n", + LOG_D(PHY,"south_in/rx_rf: RU %d/%d TS %llu (off %d), frame %d, subframe %d\n", ru->idx, 0, (unsigned long long int)proc->timestamp_rx, @@ -691,6 +697,8 @@ void tx_rf(RU_t *ru) { lte_subframe_t prevSF_type = subframe_select(fp,(proc->subframe_tx+9)%10); lte_subframe_t nextSF_type = subframe_select(fp,(proc->subframe_tx+1)%10); int sf_extension = 0; + + LOG_I(PHY,"south_out/tx_rf: frame %d, subframe %d\n",proc->frame_tx,proc->subframe_tx); if ((SF_type == SF_DL) || (SF_type == SF_S)) { @@ -767,7 +775,8 @@ void tx_rf(RU_t *ru) { VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (proc->timestamp_tx-ru->openair0_cfg.tx_sample_advance)&0xffffffff ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 ); // prepare tx buffer pointers - + + txs = ru->rfdevice.trx_write_func(&ru->rfdevice, proc->timestamp_tx+ru->ts_offset-ru->openair0_cfg.tx_sample_advance-sf_extension, txp, @@ -775,7 +784,7 @@ void tx_rf(RU_t *ru) { ru->nb_tx, flags); - LOG_D(PHY,"[TXPATH] RU %d tx_rf, writing to TS %llu, frame %d, unwrapped_frame %d, subframe %d\n",ru->idx, + LOG_I(PHY,"[TXPATH] RU %d tx_rf, writing to TS %llu, frame %d, unwrapped_frame %d, subframe %d\n",ru->idx, (long long unsigned int)proc->timestamp_tx,proc->frame_tx,proc->frame_tx_unwrap,proc->subframe_tx); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 ); @@ -2575,7 +2584,7 @@ void init_RU(char *rf_config_file, clock_source_t clock_source,clock_source_t ti // NOTE: multiple CC_id are not handled here yet! ru->openair0_cfg.clock_source = clock_source; ru->openair0_cfg.time_source = time_source; - ; + ru->generate_dmrs_sync = (ru->is_slave == 0) ? 1 : 0; eNB0 = ru->eNB_list[0]; LOG_D(PHY, "RU FUnction:%d ru->if_south:%d\n", ru->function, ru->if_south);