Commit bda26020 authored by laurent's avatar laurent

fix nr_slot_fep

parent 30e06d16
......@@ -478,6 +478,7 @@ void logRecord_mt(const char *file, const char *func, int line, int comp, int le
log_header(log_buffer,MAX_LOG_TOTAL ,comp, level,format);
g_log->log_component[comp].vprint(g_log->log_component[comp].stream,log_buffer, args);
fflush(g_log->log_component[comp].stream);
va_end(args);
......
......@@ -53,6 +53,7 @@
#endif
#include <pthread.h>
#include "T.h"
#include <common/utils/utils.h>
/*----------------------------------------------------------------------------*/
#ifdef __cplusplus
......
......@@ -3,6 +3,9 @@
#include <stdint.h>
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
void *calloc_or_fail(size_t size);
void *malloc_or_fail(size_t size);
......@@ -14,4 +17,17 @@ int hex_string_to_hex_value (uint8_t *hex_value, const char *hex_string, int siz
char *itoa(int i);
#define findInList(keY, result, list, element_type) {\
int i;\
for (i=0; i<sizeof(list)/sizeof(element_type) ; i++)\
if (list[i].key==keY) {\
result=list[i].val;\
break;\
}\
AssertFatal(i < sizeof(list)/sizeof(element_type), "List %s doesn't contain %s\n",#list, #keY); \
}
#ifdef __cplusplus
}
#endif
#endif
......@@ -510,7 +510,7 @@ void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) {
for(int x=0; x<10; x++) {
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
rxp[i] = ((void *)&UE->common_vars.rxdata[i][0]) + 4*x*UE->frame_parms.samples_per_subframe;
rxp[i] = ((void *)&UE->common_vars.rxdataTime[i][0]) + 4*x*UE->frame_parms.samples_per_subframe;
AssertFatal( UE->frame_parms.samples_per_subframe ==
UE->rfdevice.trx_read_func(&UE->rfdevice,
......@@ -564,7 +564,7 @@ void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) {
AssertFatal(unitTransfer ==
UE->rfdevice.trx_read_func(&UE->rfdevice,
timestamp,
(void **)UE->common_vars.rxdata,
(void **)UE->common_vars.rxdataTime,
unitTransfer,
UE->frame_parms.nb_antennas_rx),"");
}
......@@ -650,7 +650,7 @@ void *UE_thread(void *arg) {
AssertFatal (UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0 ==
UE->rfdevice.trx_read_func(&UE->rfdevice,
&timestamp,
(void **)UE->common_vars.rxdata,
(void **)UE->common_vars.rxdataTime,
UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0,
UE->frame_parms.nb_antennas_rx),"");
continue;
......@@ -671,7 +671,7 @@ void *UE_thread(void *arg) {
LOG_D(PHY,"Process slot %d thread Idx %d \n", slot_nr, thread_idx);
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
rxp[i] = (void *)&UE->common_vars.rxdata[i][UE->frame_parms.ofdm_symbol_size+
rxp[i] = (void *)&UE->common_vars.rxdataTime[i][UE->frame_parms.ofdm_symbol_size+
UE->frame_parms.nb_prefix_samples0+
slot_nr*UE->frame_parms.samples_per_slot];
......@@ -718,7 +718,7 @@ void *UE_thread(void *arg) {
AssertFatal(first_symbols ==
UE->rfdevice.trx_read_func(&UE->rfdevice,
&timestamp,
(void **)UE->common_vars.rxdata,
(void **)UE->common_vars.rxdataTime,
first_symbols,
UE->frame_parms.nb_antennas_rx),"");
else
......
......@@ -19,7 +19,7 @@
* contact@openairinterface.org
*/
#include "phy_init.h"
#include "PHY/INIT/phy_init.h"
#include "SCHED_UE/sched_UE.h"
#include "PHY/phy_extern_nr_ue.h"
//#include "SIMULATION/TOOLS/sim.h"
......@@ -34,7 +34,6 @@
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
//#include "PHY/LTE_REFSIG/lte_refsig.h"
#include "PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h"
#include "PHY/INIT/phy_init.h"
#include "PHY/NR_REFSIG/pss_nr.h"
#include "openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h"
......@@ -706,13 +705,13 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
// init RX buffers
common_vars->rxdata = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
common_vars->rxdataTime = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
common_vars->common_vars_rx_data_per_thread[th_id].rxdataF = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
}
for (i=0; i<fp->nb_antennas_rx; i++) {
common_vars->rxdata[i] = (int32_t*) malloc16_clear( (fp->samples_per_subframe*10+2048)*sizeof(int32_t) );
common_vars->rxdataTime[i] = (int32_t*) malloc16_clear( (fp->samples_per_subframe*10+2048)*sizeof(int32_t) );
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
common_vars->common_vars_rx_data_per_thread[th_id].rxdataF[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->ofdm_symbol_size*14) );
}
......
This diff is collapsed.
......@@ -76,7 +76,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
0,
1,
NR_PBCH_EST);
//memset(&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[0]].rxdataF[0][ue->frame_parms.ofdm_symbol_size*1], 0, ue->frame_parms.ofdm_symbol_size*4);
//symbol 2
nr_slot_fep(ue,
2,
......@@ -85,6 +85,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
0,
1,
NR_PBCH_EST);
//memset(&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[0]].rxdataF[0][ue->frame_parms.ofdm_symbol_size*2], 0, ue->frame_parms.ofdm_symbol_size*4);
//symbol 3
nr_slot_fep(ue,
......@@ -94,6 +95,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
0,
1,
NR_PBCH_EST);
//memset(&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[0]].rxdataF[0][ue->frame_parms.ofdm_symbol_size*3], 0, ue->frame_parms.ofdm_symbol_size*4);
//put back nb_prefix_samples0
frame_parms->nb_prefix_samples0 = nb_prefix_samples0;
......@@ -190,7 +192,7 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
ue->rx_offset = ue->ssb_offset - sync_pos_slot;
//write_output("rxdata1.m","rxd1",ue->common_vars.rxdata[0],10*fp->samples_per_subframe,1,1);
//write_output("rxdata1.m","rxd1",ue->common_vars.rxdataTime[0],10*fp->samples_per_subframe,1,1);
#ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d\n", ue->Mod_id, sync_pos,ue->common_vars.eNb_id);
......@@ -207,10 +209,10 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
for(int n=start; n<end; n++){
for (int ar=0; ar<fp->nb_antennas_rx; ar++) {
re = ((double)(((short *)ue->common_vars.rxdata[ar]))[2*n]);
im = ((double)(((short *)ue->common_vars.rxdata[ar]))[2*n+1]);
((short *)ue->common_vars.rxdata[ar])[2*n] = (short)(round(re*cos(n*off_angle) - im*sin(n*off_angle)));
((short *)ue->common_vars.rxdata[ar])[2*n+1] = (short)(round(re*sin(n*off_angle) + im*cos(n*off_angle)));
re = ((double)(((short *)ue->common_vars.rxdataTime[ar]))[2*n]);
im = ((double)(((short *)ue->common_vars.rxdataTime[ar]))[2*n+1]);
((short *)ue->common_vars.rxdataTime[ar])[2*n] = (short)(round(re*cos(n*off_angle) - im*sin(n*off_angle)));
((short *)ue->common_vars.rxdataTime[ar])[2*n+1] = (short)(round(re*sin(n*off_angle) + im*cos(n*off_angle)));
}
}
}
......
......@@ -419,7 +419,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
int max_h=0;
int symbol;
//uint8_t pbch_a[64];
uint8_t *pbch_a = malloc(sizeof(uint8_t) * 32);
uint8_t *pbch_a = calloc(NR_POLAR_PBCH_PAYLOAD_BITS,sizeof(*pbch_a));
//uint32_t pbch_a_prime;
int16_t *pbch_e_rx;
uint8_t *decoded_output = nr_ue_pbch_vars->decoded_output;
......@@ -433,12 +433,11 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
//uint8_t decoderListSize = 8, pathMetricAppr = 0;
//time_stats_t polar_decoder_init,polar_rate_matching,decoding,bit_extraction,deinterleaving;
//time_stats_t path_metric,sorting,update_LLR;
memset(&pbch_a[0], 0, sizeof(uint8_t) * NR_POLAR_PBCH_PAYLOAD_BITS);
//printf("nr_pbch_ue nid_cell %d\n",frame_parms->Nid_cell);
pbch_e_rx = &nr_ue_pbch_vars->llr[0];
pbch_e_rx = nr_ue_pbch_vars->llr;
// clear LLR buffer
memset(nr_ue_pbch_vars->llr,0,NR_POLAR_PBCH_E);
memset(nr_ue_pbch_vars->llr,0,NR_POLAR_PBCH_E * sizeof(*nr_ue_pbch_vars->llr));
int symbol_offset=1;
if (ue->is_synchronized > 0)
......@@ -499,12 +498,12 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
*/
if (symbol==1) {
nr_pbch_quantize(pbch_e_rx,
(short *)&(nr_ue_pbch_vars->rxdataF_comp[0][symbol*240]),
(short *)&(nr_ue_pbch_vars->rxdataF_ext[0][symbol*240]),
144);
pbch_e_rx+=144;
} else {
nr_pbch_quantize(pbch_e_rx,
(short *)&(nr_ue_pbch_vars->rxdataF_comp[0][symbol*240]),
(short *)&(nr_ue_pbch_vars->rxdataF_ext[0][symbol*240]),
360);
pbch_e_rx+=360;
}
......
......@@ -626,11 +626,11 @@ void decimation_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int rate_change, int **r
/* build with cic filter does not work properly. Performances are significantly deteriorated */
#ifdef CIC_DECIMATOR
cic_decimator((int16_t *)&(PHY_vars_UE->common_vars.rxdata[0][0]), (int16_t *)&(rxdata[0][0]),
cic_decimator((int16_t *)&(PHY_vars_UE->common_vars.rxdataTime[0][0]), (int16_t *)&(rxdata[0][0]),
samples_for_frame, rate_change, CIC_FILTER_STAGE_NUMBER, 0, FIR_RATE_CHANGE);
#else
fir_decimator((int16_t *)&(PHY_vars_UE->common_vars.rxdata[0][0]), (int16_t *)&(rxdata[0][0]),
fir_decimator((int16_t *)&(PHY_vars_UE->common_vars.rxdataTime[0][0]), (int16_t *)&(rxdata[0][0]),
samples_for_frame, rate_change, 0);
#endif
......@@ -669,7 +669,7 @@ int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int rate_change)
int samples_for_frame = frame_parms->samples_per_subframe*NR_NUMBER_OF_SUBFRAMES_PER_FRAME;
LOG_M("rxdata0_rand.m","rxd0_rand", &PHY_vars_UE->common_vars.rxdata[0][0], samples_for_frame, 1, 1);
LOG_M("rxdata0_rand.m","rxd0_rand", &PHY_vars_UE->common_vars.rxdataTime[0][0], samples_for_frame, 1, 1);
#endif
......@@ -688,7 +688,7 @@ int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int rate_change)
}
else {
rxdata = PHY_vars_UE->common_vars.rxdata;
rxdata = PHY_vars_UE->common_vars.rxdataTime;
}
#ifdef DBG_PSS_NR
......
......@@ -582,7 +582,7 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
llr_pdcch = (float*) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float)); // init to zero
bit_pdcch = (float*) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float));
rxsig_t = (int16_t**) phy_vars_ue->common_vars.rxdata;
rxsig_t = (int16_t**) phy_vars_ue->common_vars.rxdataTime;
rxsig_t_dB = calloc(nb_antennas_rx,sizeof(float*));
for (arx=0; arx<nb_antennas_rx; arx++) {
rxsig_t_dB[arx] = (float*) calloc(samples_per_frame,sizeof(float));
......
......@@ -147,4 +147,15 @@ static inline void copy_meas(time_stats_t *dst_ts,time_stats_t *src_ts)
dst_ts->max=src_ts->max;
}
}
#if UE_TIMING_TRACE
#define UE_meas(meaS, funC) \
start_meas(&meaS);\
funC;\
stop_meas(&meaS);
#else
#define UE_meas(meaS, funC) \
funC;
#endif
#endif
......@@ -407,7 +407,7 @@ typedef struct {
/// Should point to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER.
/// - first index: rx antenna [0..nb_antennas_rx[
/// - second index: sample [0..FRAME_LENGTH_COMPLEX_SAMPLES+2048[
int32_t **rxdata;
int32_t **rxdataTime;
NR_UE_COMMON_PER_THREAD common_vars_rx_data_per_thread[RX_NB_TH_MAX];
......
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