Commit 90256529 authored by Raymond Knopp's avatar Raymond Knopp

Merge branch 'enhancement-10-harmony' of...

Merge branch 'enhancement-10-harmony' of https://gitlab.eurecom.fr/oai/openairinterface5g into enhancement-10-harmony
parents ef0d386a fdcad369
...@@ -517,14 +517,15 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain ...@@ -517,14 +517,15 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
// perform a time domain correlation using the oversampled sync sequence // perform a time domain correlation using the oversampled sync sequence
unsigned int n, ar, peak_val, peak_pos, mean_val; unsigned int n, ar, peak_val, peak_pos;
uint64_t mean_val;
int result; int result;
short *primary_synch_time; short *primary_synch_time;
int eNB_id = frame_parms->Nid_cell%3; int eNB_id = frame_parms->Nid_cell%3;
// msg("[SYNC TIME] Calling sync_time_eNB(%p,%p,%d,%d)\n",rxdata,frame_parms,eNB_id,length); // msg("[SYNC TIME] Calling sync_time_eNB(%p,%p,%d,%d)\n",rxdata,frame_parms,eNB_id,length);
if (sync_corr_eNB == NULL) { if (sync_corr_eNB == NULL) {
msg("[SYNC TIME] sync_corr_eNB not yet allocated! Exiting.\n"); LOG_E(PHY,"[SYNC TIME] sync_corr_eNB not yet allocated! Exiting.\n");
return(-1); return(-1);
} }
...@@ -542,7 +543,7 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain ...@@ -542,7 +543,7 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
break; break;
default: default:
msg("[SYNC TIME] Illegal eNB_id!\n"); LOG_E(PHY,"[SYNC TIME] Illegal eNB_id!\n");
return (-1); return (-1);
} }
...@@ -574,7 +575,7 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain ...@@ -574,7 +575,7 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
peak_val); peak_val);
} }
*/ */
mean_val += (sync_corr_eNB[n]>>10); mean_val += sync_corr_eNB[n];
if (sync_corr_eNB[n]>peak_val) { if (sync_corr_eNB[n]>peak_val) {
peak_val = sync_corr_eNB[n]; peak_val = sync_corr_eNB[n];
...@@ -582,17 +583,15 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain ...@@ -582,17 +583,15 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
} }
} }
mean_val/=length;
*peak_val_out = peak_val; *peak_val_out = peak_val;
if (peak_val <= (40*mean_val)) { if (peak_val <= (40*(uint32_t)mean_val)) {
#ifdef DEBUG_PHY LOG_D(PHY,"[SYNC TIME] No peak found (%u,%u,%u,%u)\n",peak_pos,peak_val,mean_val,40*mean_val);
msg("[SYNC TIME] No peak found (%u,%u,%u,%u)\n",peak_pos,peak_val,mean_val,40*mean_val);
#endif
return(-1); return(-1);
} else { } else {
#ifdef DEBUG_PHY LOG_D(PHY,"[SYNC TIME] Peak found at pos %u, val = %u, mean_val = %u\n",peak_pos,peak_val,mean_val);
msg("[SYNC TIME] Peak found at pos %u, val = %u, mean_val = %u\n",peak_pos,peak_val,mean_val);
#endif
return(peak_pos); return(peak_pos);
} }
......
...@@ -256,6 +256,8 @@ typedef struct eNB_proc_t_s { ...@@ -256,6 +256,8 @@ typedef struct eNB_proc_t_s {
/// \brief Instance count for rx processing thread. /// \brief Instance count for rx processing thread.
/// \internal This variable is protected by \ref mutex_prach. /// \internal This variable is protected by \ref mutex_prach.
int instance_cnt_prach; int instance_cnt_prach;
// instance count for over-the-air eNB synchronization
int instance_cnt_synch;
/// \internal This variable is protected by \ref mutex_asynch_rxtx. /// \internal This variable is protected by \ref mutex_asynch_rxtx.
int instance_cnt_asynch_rxtx; int instance_cnt_asynch_rxtx;
/// pthread structure for FH processing thread /// pthread structure for FH processing thread
...@@ -280,6 +282,8 @@ typedef struct eNB_proc_t_s { ...@@ -280,6 +282,8 @@ typedef struct eNB_proc_t_s {
pthread_attr_t attr_single; pthread_attr_t attr_single;
/// pthread attributes for prach processing thread /// pthread attributes for prach processing thread
pthread_attr_t attr_prach; pthread_attr_t attr_prach;
/// pthread attributes for over-the-air synch thread
pthread_attr_t attr_synch;
/// pthread attributes for asynchronous RX thread /// pthread attributes for asynchronous RX thread
pthread_attr_t attr_asynch_rxtx; pthread_attr_t attr_asynch_rxtx;
/// scheduling parameters for parallel fep thread /// scheduling parameters for parallel fep thread
...@@ -294,6 +298,8 @@ typedef struct eNB_proc_t_s { ...@@ -294,6 +298,8 @@ typedef struct eNB_proc_t_s {
struct sched_param sched_param_single; struct sched_param sched_param_single;
/// scheduling parameters for prach thread /// scheduling parameters for prach thread
struct sched_param sched_param_prach; struct sched_param sched_param_prach;
/// scheduling parameters for over-the-air synchronization thread
struct sched_param sched_param_synch;
/// scheduling parameters for asynch_rxtx thread /// scheduling parameters for asynch_rxtx thread
struct sched_param sched_param_asynch_rxtx; struct sched_param sched_param_asynch_rxtx;
/// pthread structure for parallel fep thread /// pthread structure for parallel fep thread
...@@ -304,6 +310,8 @@ typedef struct eNB_proc_t_s { ...@@ -304,6 +310,8 @@ typedef struct eNB_proc_t_s {
pthread_t pthread_te; pthread_t pthread_te;
/// pthread structure for PRACH thread /// pthread structure for PRACH thread
pthread_t pthread_prach; pthread_t pthread_prach;
/// pthread structure for eNB synch thread
pthread_t pthread_synch;
/// condition variable for parallel fep thread /// condition variable for parallel fep thread
pthread_cond_t cond_fep; pthread_cond_t cond_fep;
/// condition variable for parallel turbo-decoder thread /// condition variable for parallel turbo-decoder thread
...@@ -314,6 +322,8 @@ typedef struct eNB_proc_t_s { ...@@ -314,6 +322,8 @@ typedef struct eNB_proc_t_s {
pthread_cond_t cond_FH; pthread_cond_t cond_FH;
/// condition variable for PRACH processing thread; /// condition variable for PRACH processing thread;
pthread_cond_t cond_prach; pthread_cond_t cond_prach;
// condition variable for over-the-air eNB synchronization
pthread_cond_t cond_synch;
/// condition variable for asynch RX/TX thread /// condition variable for asynch RX/TX thread
pthread_cond_t cond_asynch_rxtx; pthread_cond_t cond_asynch_rxtx;
/// mutex for parallel fep thread /// mutex for parallel fep thread
...@@ -326,6 +336,8 @@ typedef struct eNB_proc_t_s { ...@@ -326,6 +336,8 @@ typedef struct eNB_proc_t_s {
pthread_mutex_t mutex_FH; pthread_mutex_t mutex_FH;
/// mutex for PRACH thread /// mutex for PRACH thread
pthread_mutex_t mutex_prach; pthread_mutex_t mutex_prach;
// mutex for over-the-air eNB synchronization
pthread_mutex_t mutex_synch;
/// mutex for asynch RX/TX thread /// mutex for asynch RX/TX thread
pthread_mutex_t mutex_asynch_rxtx; pthread_mutex_t mutex_asynch_rxtx;
/// parameters for turbo-decoding worker thread /// parameters for turbo-decoding worker thread
...@@ -411,6 +423,10 @@ typedef struct PHY_VARS_eNB_s { ...@@ -411,6 +423,10 @@ typedef struct PHY_VARS_eNB_s {
openair0_rf_map rf_map; openair0_rf_map rf_map;
int abstraction_flag; int abstraction_flag;
openair0_timestamp ts_offset; openair0_timestamp ts_offset;
// indicator for synchronization state of eNB
int in_synch;
// indicator for master/slave (RRU)
int is_slave;
void (*do_prach)(struct PHY_VARS_eNB_s *eNB); void (*do_prach)(struct PHY_VARS_eNB_s *eNB);
void (*fep)(struct PHY_VARS_eNB_s *eNB); void (*fep)(struct PHY_VARS_eNB_s *eNB);
int (*td)(struct PHY_VARS_eNB_s *eNB,int UE_id,int harq_pid,int llr8_flag); int (*td)(struct PHY_VARS_eNB_s *eNB,int UE_id,int harq_pid,int llr8_flag);
......
This diff is collapsed.
...@@ -120,7 +120,7 @@ extern int netlink_init(void); ...@@ -120,7 +120,7 @@ extern int netlink_init(void);
// In lte-enb.c // In lte-enb.c
extern int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_cfg); extern int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_cfg);
extern void init_eNB(eNB_func_t *, eNB_timing_t *,int,eth_params_t *,int); extern void init_eNB(eNB_func_t *, eNB_timing_t *,int,eth_params_t *,int,int);
extern void stop_eNB(int); extern void stop_eNB(int);
extern void kill_eNB_proc(void); extern void kill_eNB_proc(void);
...@@ -170,6 +170,8 @@ volatile int oai_exit = 0; ...@@ -170,6 +170,8 @@ volatile int oai_exit = 0;
static clock_source_t clock_source = internal; static clock_source_t clock_source = internal;
static wait_for_sync = 0;
static char UE_flag=0; static char UE_flag=0;
unsigned int mmapped_dma=0; unsigned int mmapped_dma=0;
int single_thread_flag=0; int single_thread_flag=0;
...@@ -696,6 +698,7 @@ static void get_options (int argc, char **argv) ...@@ -696,6 +698,7 @@ static void get_options (int argc, char **argv)
LONG_OPTION_MMAPPED_DMA, LONG_OPTION_MMAPPED_DMA,
LONG_OPTION_SINGLE_THREAD, LONG_OPTION_SINGLE_THREAD,
LONG_OPTION_EXTERNAL_CLOCK, LONG_OPTION_EXTERNAL_CLOCK,
LONG_OPTION_WAIT_FOR_SYNC,
#if T_TRACER #if T_TRACER
LONG_OPTION_T_PORT, LONG_OPTION_T_PORT,
LONG_OPTION_T_NOWAIT, LONG_OPTION_T_NOWAIT,
...@@ -722,6 +725,7 @@ static void get_options (int argc, char **argv) ...@@ -722,6 +725,7 @@ static void get_options (int argc, char **argv)
{"mmapped-dma", no_argument, NULL, LONG_OPTION_MMAPPED_DMA}, {"mmapped-dma", no_argument, NULL, LONG_OPTION_MMAPPED_DMA},
{"single-thread", no_argument, NULL, LONG_OPTION_SINGLE_THREAD}, {"single-thread", no_argument, NULL, LONG_OPTION_SINGLE_THREAD},
{"external-clock", no_argument, NULL, LONG_OPTION_EXTERNAL_CLOCK}, {"external-clock", no_argument, NULL, LONG_OPTION_EXTERNAL_CLOCK},
{"wait-for-sync", no_argument, NULL, LONG_OPTION_WAIT_FOR_SYNC},
#if T_TRACER #if T_TRACER
{"T_port", required_argument, 0, LONG_OPTION_T_PORT}, {"T_port", required_argument, 0, LONG_OPTION_T_PORT},
{"T_nowait", no_argument, 0, LONG_OPTION_T_NOWAIT}, {"T_nowait", no_argument, 0, LONG_OPTION_T_NOWAIT},
...@@ -827,6 +831,10 @@ static void get_options (int argc, char **argv) ...@@ -827,6 +831,10 @@ static void get_options (int argc, char **argv)
clock_source = external; clock_source = external;
break; break;
case LONG_OPTION_WAIT_FOR_SYNC:
wait_for_sync = 1;
break;
#if T_TRACER #if T_TRACER
case LONG_OPTION_T_PORT: { case LONG_OPTION_T_PORT: {
extern int T_port; extern int T_port;
...@@ -1808,7 +1816,7 @@ int main( int argc, char **argv ) ...@@ -1808,7 +1816,7 @@ int main( int argc, char **argv )
// start the main thread // start the main thread
if (UE_flag == 1) init_UE(1); if (UE_flag == 1) init_UE(1);
else { else {
init_eNB(node_function,node_timing,1,eth_params,single_thread_flag); init_eNB(node_function,node_timing,1,eth_params,single_thread_flag,wait_for_sync);
// Sleep to allow all threads to setup // Sleep to allow all threads to setup
number_of_cards = 1; number_of_cards = 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