Commit 5b970ac4 authored by Guy De Souza's avatar Guy De Souza

lte-softmodem NB_timing fix

parent 7e5ee477
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "PHY/phy_extern.h" #include "PHY/phy_extern.h"
#include "PHY/sse_intrin.h" #include "PHY/sse_intrin.h"
#define DEBUG_PBCH //#define DEBUG_PBCH
short nr_mod_table[MOD_TABLE_SIZE_SHORT] = {0,0,23170,23170,-23170,-23170}; short nr_mod_table[MOD_TABLE_SIZE_SHORT] = {0,0,23170,23170,-23170,-23170};
......
...@@ -388,8 +388,8 @@ typedef struct RU_t_s{ ...@@ -388,8 +388,8 @@ typedef struct RU_t_s{
#endif #endif
/// function pointer to NB entry routine /// function pointer to NB entry routine
void (*eNB_top)(struct PHY_VARS_eNB_s *eNB, int frame_rx, int subframe_rx, char *string); void (*eNB_top)(struct PHY_VARS_eNB_s *eNB, int frame_rx, int subframe_rx, char *string, struct RU_t_s *ru);
void (*gNB_top)(struct PHY_VARS_gNB_s *eNB, int frame_rx, int subframe_rx, char *string); void (*gNB_top)(struct PHY_VARS_gNB_s *gNB, int frame_rx, int subframe_rx, char *string, struct RU_t_s *ru);
/// Timing statistics /// Timing statistics
time_stats_t ofdm_demod_stats; time_stats_t ofdm_demod_stats;
......
...@@ -448,7 +448,7 @@ void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string,RU_t ...@@ -448,7 +448,7 @@ void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string,RU_t
{ {
eNB_proc_t *proc = &eNB->proc; eNB_proc_t *proc = &eNB->proc;
eNB_rxtx_proc_t *proc_rxtx = &proc->proc_rxtx[0]; eNB_rxtx_proc_t *proc_rxtx = &proc->proc_rxtx[0];
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms; LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
RU_proc_t *ru_proc=&ru->proc; RU_proc_t *ru_proc=&ru->proc;
proc->frame_rx = frame_rx; proc->frame_rx = frame_rx;
......
...@@ -322,7 +322,7 @@ static inline void fh_if5_mobipass_south_out(RU_t *ru) { ...@@ -322,7 +322,7 @@ static inline void fh_if5_mobipass_south_out(RU_t *ru) {
static inline void fh_if4p5_south_out(RU_t *ru) { 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 ); 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_D(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) 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); send_IF4p5(ru,ru->proc.frame_tx, ru->proc.subframe_tx, IF4p5_PDLFFT);
} }
...@@ -332,7 +332,7 @@ static inline void fh_if4p5_south_out(RU_t *ru) { ...@@ -332,7 +332,7 @@ static inline void fh_if4p5_south_out(RU_t *ru) {
// Synchronous if5 from south // Synchronous if5 from south
void fh_if5_south_in(RU_t *ru,int *frame, int *subframe) { void fh_if5_south_in(RU_t *ru,int *frame, int *subframe) {
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms; LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
RU_proc_t *proc = &ru->proc; RU_proc_t *proc = &ru->proc;
recv_IF5(ru, &proc->timestamp_rx, *subframe, IF5_RRH_GW_UL); recv_IF5(ru, &proc->timestamp_rx, *subframe, IF5_RRH_GW_UL);
...@@ -363,7 +363,7 @@ void fh_if5_south_in(RU_t *ru,int *frame, int *subframe) { ...@@ -363,7 +363,7 @@ void fh_if5_south_in(RU_t *ru,int *frame, int *subframe) {
// Synchronous if4p5 from south // Synchronous if4p5 from south
void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) { void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) {
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms; LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
RU_proc_t *proc = &ru->proc; RU_proc_t *proc = &ru->proc;
int f,sf; int f,sf;
...@@ -447,7 +447,7 @@ void fh_slave_south_in(RU_t *ru,int *frame,int *subframe) { ...@@ -447,7 +447,7 @@ void fh_slave_south_in(RU_t *ru,int *frame,int *subframe) {
void fh_if5_south_asynch_in_mobipass(RU_t *ru,int *frame,int *subframe) { void fh_if5_south_asynch_in_mobipass(RU_t *ru,int *frame,int *subframe) {
RU_proc_t *proc = &ru->proc; RU_proc_t *proc = &ru->proc;
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms; LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
recv_IF5(ru, &proc->timestamp_rx, *subframe, IF5_MOBIPASS); recv_IF5(ru, &proc->timestamp_rx, *subframe, IF5_MOBIPASS);
pthread_mutex_lock(&proc->mutex_asynch_rxtx); pthread_mutex_lock(&proc->mutex_asynch_rxtx);
...@@ -489,7 +489,7 @@ void fh_if5_south_asynch_in_mobipass(RU_t *ru,int *frame,int *subframe) { ...@@ -489,7 +489,7 @@ void fh_if5_south_asynch_in_mobipass(RU_t *ru,int *frame,int *subframe) {
// asynchronous inbound if4p5 fronthaul from south // asynchronous inbound if4p5 fronthaul from south
void fh_if4p5_south_asynch_in(RU_t *ru,int *frame,int *subframe) { void fh_if4p5_south_asynch_in(RU_t *ru,int *frame,int *subframe) {
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms; LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
RU_proc_t *proc = &ru->proc; RU_proc_t *proc = &ru->proc;
uint16_t packet_type; uint16_t packet_type;
...@@ -568,7 +568,7 @@ void fh_if4p5_north_in(RU_t *ru,int *frame,int *subframe) { ...@@ -568,7 +568,7 @@ void fh_if4p5_north_in(RU_t *ru,int *frame,int *subframe) {
void fh_if5_north_asynch_in(RU_t *ru,int *frame,int *subframe) { void fh_if5_north_asynch_in(RU_t *ru,int *frame,int *subframe) {
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms; LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
RU_proc_t *proc = &ru->proc; RU_proc_t *proc = &ru->proc;
int subframe_tx,frame_tx; int subframe_tx,frame_tx;
openair0_timestamp timestamp_tx; openair0_timestamp timestamp_tx;
...@@ -594,7 +594,7 @@ void fh_if5_north_asynch_in(RU_t *ru,int *frame,int *subframe) { ...@@ -594,7 +594,7 @@ void fh_if5_north_asynch_in(RU_t *ru,int *frame,int *subframe) {
void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *subframe) { void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *subframe) {
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms; LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
RU_proc_t *proc = &ru->proc; RU_proc_t *proc = &ru->proc;
uint16_t packet_type; uint16_t packet_type;
...@@ -664,7 +664,7 @@ void fh_if5_north_out(RU_t *ru) { ...@@ -664,7 +664,7 @@ void fh_if5_north_out(RU_t *ru) {
void fh_if4p5_north_out(RU_t *ru) { void fh_if4p5_north_out(RU_t *ru) {
RU_proc_t *proc=&ru->proc; RU_proc_t *proc=&ru->proc;
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms; LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
const int subframe = proc->subframe_rx; 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 ); if (ru->idx==0) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_RU, proc->subframe_rx );
...@@ -711,7 +711,7 @@ static void* emulatedRF_thread(void* param) { ...@@ -711,7 +711,7 @@ static void* emulatedRF_thread(void* param) {
void rx_rf(RU_t *ru,int *frame,int *subframe) { void rx_rf(RU_t *ru,int *frame,int *subframe) {
RU_proc_t *proc = &ru->proc; RU_proc_t *proc = &ru->proc;
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms; LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
void *rxp[ru->nb_rx]; void *rxp[ru->nb_rx];
unsigned int rxs; unsigned int rxs;
int i; int i;
...@@ -807,7 +807,7 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) { ...@@ -807,7 +807,7 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
void tx_rf(RU_t *ru) { void tx_rf(RU_t *ru) {
RU_proc_t *proc = &ru->proc; RU_proc_t *proc = &ru->proc;
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms; LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
void *txp[ru->nb_tx]; void *txp[ru->nb_tx];
unsigned int txs; unsigned int txs;
int i; int i;
...@@ -920,7 +920,7 @@ static void* ru_thread_asynch_rxtx( void* param ) { ...@@ -920,7 +920,7 @@ static void* ru_thread_asynch_rxtx( void* param ) {
if (ru->fh_south_asynch_in) ru->fh_south_asynch_in(ru,&frame,&subframe); if (ru->fh_south_asynch_in) ru->fh_south_asynch_in(ru,&frame,&subframe);
// asynchronous receive from north (RRU IF4/IF5) // asynchronous receive from north (RRU IF4/IF5)
else if (ru->fh_north_asynch_in) { else if (ru->fh_north_asynch_in) {
if (subframe_select(&ru->frame_parms,subframe)!=SF_UL) if (subframe_select(ru->frame_parms,subframe)!=SF_UL)
ru->fh_north_asynch_in(ru,&frame,&subframe); ru->fh_north_asynch_in(ru,&frame,&subframe);
} }
else AssertFatal(1==0,"Unknown function in ru_thread_asynch_rxtx\n"); else AssertFatal(1==0,"Unknown function in ru_thread_asynch_rxtx\n");
...@@ -1102,7 +1102,7 @@ int wakeup_synch(RU_t *ru){ ...@@ -1102,7 +1102,7 @@ int wakeup_synch(RU_t *ru){
void do_ru_synch(RU_t *ru) { void do_ru_synch(RU_t *ru) {
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms; LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
RU_proc_t *proc = &ru->proc; RU_proc_t *proc = &ru->proc;
int i; int i;
void *rxp[2],*rxp2[2]; void *rxp[2],*rxp2[2];
...@@ -1268,7 +1268,7 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) { ...@@ -1268,7 +1268,7 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) {
int i; int i;
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms; LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
openair0_config_t *cfg = &ru->openair0_cfg; openair0_config_t *cfg = &ru->openair0_cfg;
//printf("////////////////numerology in config = %d\n",numerology); //printf("////////////////numerology in config = %d\n",numerology);
...@@ -1362,7 +1362,7 @@ int setup_RU_buffers(RU_t *ru) { ...@@ -1362,7 +1362,7 @@ int setup_RU_buffers(RU_t *ru) {
LTE_DL_FRAME_PARMS *frame_parms; LTE_DL_FRAME_PARMS *frame_parms;
if (ru) { if (ru) {
frame_parms = &ru->frame_parms; frame_parms = ru->frame_parms;
printf("setup_RU_buffers: frame_parms = %p\n",frame_parms); printf("setup_RU_buffers: frame_parms = %p\n",frame_parms);
} else { } else {
printf("RU[%d] not initialized\n", ru->idx); printf("RU[%d] not initialized\n", ru->idx);
...@@ -2113,7 +2113,7 @@ void configure_ru(int idx, ...@@ -2113,7 +2113,7 @@ void configure_ru(int idx,
#endif #endif
} }
init_frame_parms(&ru->frame_parms,1); init_frame_parms(ru->frame_parms,1);
phy_init_RU(ru); phy_init_RU(ru);
} }
...@@ -2156,7 +2156,7 @@ void configure_rru(int idx, ...@@ -2156,7 +2156,7 @@ void configure_rru(int idx,
#endif #endif
} }
init_frame_parms(&ru->frame_parms,1); init_frame_parms(ru->frame_parms,1);
fill_rf_config(ru,ru->rf_config_file); fill_rf_config(ru,ru->rf_config_file);
...@@ -2270,7 +2270,7 @@ void set_function_spec_param(RU_t *ru) ...@@ -2270,7 +2270,7 @@ void set_function_spec_param(RU_t *ru)
/* /*
if (ru->function == eNodeB_3GPP) { // configure RF parameters only for 3GPP eNodeB, we need to get them from RAU otherwise if (ru->function == eNodeB_3GPP) { // configure RF parameters only for 3GPP eNodeB, we need to get them from RAU otherwise
fill_rf_config(ru,rf_config_file); fill_rf_config(ru,rf_config_file);
init_frame_parms(&ru->frame_parms,1); init_frame_parms(ru->frame_parms,1);
phy_init_RU(ru); phy_init_RU(ru);
} }
...@@ -2418,7 +2418,7 @@ void init_RU(char *rf_config_file) { ...@@ -2418,7 +2418,7 @@ void init_RU(char *rf_config_file) {
} }
} }
} }
LOG_I(PHY,"Initializing RRU descriptor %d : (%s,%s,%d)\n",ru_id,ru_if_types[ru->if_south],eNB_timing[ru->if_timing],ru->function); LOG_I(PHY,"Initializing RRU descriptor %d : (%s,%s,%d)\n",ru_id,ru_if_types[ru->if_south],NB_timing[ru->if_timing],ru->function);
set_function_spec_param(ru); set_function_spec_param(ru);
LOG_I(PHY,"Starting ru_thread %d\n",ru_id); LOG_I(PHY,"Starting ru_thread %d\n",ru_id);
......
...@@ -357,10 +357,12 @@ static void wait_system_ready (char *message, volatile int *start_flag) { ...@@ -357,10 +357,12 @@ static void wait_system_ready (char *message, volatile int *start_flag) {
void gNB_top(PHY_VARS_gNB *gNB, int frame_rx, int subframe_rx, char *string) void gNB_top(PHY_VARS_gNB *gNB, int frame_rx, int subframe_rx, char *string, struct RU_t_s *ru)
{ {
gNB_proc_t *proc = &gNB->proc; gNB_proc_t *proc = &gNB->proc;
gNB_rxtx_proc_t *proc_rxtx = &proc->proc_rxtx[0]; gNB_rxtx_proc_t *proc_rxtx = &proc->proc_rxtx[0];
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
RU_proc_t *ru_proc=&ru->proc;
proc->frame_rx = frame_rx; proc->frame_rx = frame_rx;
proc->subframe_rx = subframe_rx; proc->subframe_rx = subframe_rx;
...@@ -368,14 +370,16 @@ void gNB_top(PHY_VARS_gNB *gNB, int frame_rx, int subframe_rx, char *string) ...@@ -368,14 +370,16 @@ void gNB_top(PHY_VARS_gNB *gNB, int frame_rx, int subframe_rx, char *string)
if (!oai_exit) { if (!oai_exit) {
T(T_ENB_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx), T_INT(proc->subframe_rx)); T(T_ENB_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx), T_INT(proc->subframe_rx));
proc_rxtx->subframe_rx = proc->subframe_rx; proc_rxtx->timestamp_tx = ru_proc->timestamp_rx + (sf_ahead*fp->samples_per_subframe);
proc_rxtx->frame_rx = proc->frame_rx; proc_rxtx->frame_rx = ru_proc->frame_rx;
proc_rxtx->subframe_tx = (proc->subframe_rx+sf_ahead)%10; proc_rxtx->subframe_rx = ru_proc->subframe_rx;
proc_rxtx->frame_tx = (proc->subframe_rx>(9-sf_ahead)) ? (1+proc->frame_rx)&1023 : proc->frame_rx; proc_rxtx->frame_tx = (proc_rxtx->subframe_rx > (9-sf_ahead)) ? (proc_rxtx->frame_rx+1)&1023 : proc_rxtx->frame_rx;
proc->frame_tx = proc_rxtx->frame_tx; proc_rxtx->subframe_tx = (proc_rxtx->subframe_rx + sf_ahead)%10;
proc_rxtx->timestamp_tx = proc->timestamp_tx;
if (rxtx(gNB,proc_rxtx,string) < 0) LOG_E(PHY,"gNB %d CC_id %d failed during execution\n",gNB->Mod_id,gNB->CC_id); if (rxtx(gNB,proc_rxtx,string) < 0) LOG_E(PHY,"gNB %d CC_id %d failed during execution\n",gNB->Mod_id,gNB->CC_id);
ru_proc->timestamp_tx = proc_rxtx->timestamp_tx;
ru_proc->subframe_tx = proc_rxtx->subframe_tx;
ru_proc->frame_tx = proc_rxtx->frame_tx;
} }
} }
......
...@@ -1122,7 +1122,7 @@ void wakeup_gNBs(RU_t *ru) { ...@@ -1122,7 +1122,7 @@ void wakeup_gNBs(RU_t *ru) {
char string[20]; char string[20];
sprintf(string,"Incoming RU %d",ru->idx); sprintf(string,"Incoming RU %d",ru->idx);
LOG_D(PHY,"RU %d Call gNB_top\n",ru->idx); LOG_D(PHY,"RU %d Call gNB_top\n",ru->idx);
ru->gNB_top(gNB_list[0],ru->proc.frame_rx,ru->proc.subframe_rx,string); ru->gNB_top(gNB_list[0],ru->proc.frame_rx,ru->proc.subframe_rx,string,ru);
} }
else { else {
......
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