Commit 8369af09 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 1fcc7837 20b0aae9
......@@ -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
unsigned int n, ar, peak_val, peak_pos, mean_val;
unsigned int n, ar, peak_val, peak_pos;
uint64_t mean_val;
int result;
short *primary_synch_time;
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);
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);
}
......@@ -542,7 +543,7 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
break;
default:
msg("[SYNC TIME] Illegal eNB_id!\n");
LOG_E(PHY,"[SYNC TIME] Illegal eNB_id!\n");
return (-1);
}
......@@ -574,7 +575,7 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
peak_val);
}
*/
mean_val += (sync_corr_eNB[n]>>10);
mean_val += sync_corr_eNB[n];
if (sync_corr_eNB[n]>peak_val) {
peak_val = sync_corr_eNB[n];
......@@ -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;
if (peak_val <= (40*mean_val)) {
#ifdef DEBUG_PHY
msg("[SYNC TIME] No peak found (%u,%u,%u,%u)\n",peak_pos,peak_val,mean_val,40*mean_val);
#endif
if (peak_val <= (40*(uint32_t)mean_val)) {
LOG_D(PHY,"[SYNC TIME] No peak found (%u,%u,%u,%u)\n",peak_pos,peak_val,mean_val,40*mean_val);
return(-1);
} else {
#ifdef DEBUG_PHY
msg("[SYNC TIME] Peak found at pos %u, val = %u, mean_val = %u\n",peak_pos,peak_val,mean_val);
#endif
LOG_D(PHY,"[SYNC TIME] Peak found at pos %u, val = %u, mean_val = %u\n",peak_pos,peak_val,mean_val);
return(peak_pos);
}
......
......@@ -256,6 +256,8 @@ typedef struct eNB_proc_t_s {
/// \brief Instance count for rx processing thread.
/// \internal This variable is protected by \ref mutex_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.
int instance_cnt_asynch_rxtx;
/// pthread structure for FH processing thread
......@@ -280,6 +282,8 @@ typedef struct eNB_proc_t_s {
pthread_attr_t attr_single;
/// pthread attributes for prach processing thread
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_attr_t attr_asynch_rxtx;
/// scheduling parameters for parallel fep thread
......@@ -294,6 +298,8 @@ typedef struct eNB_proc_t_s {
struct sched_param sched_param_single;
/// scheduling parameters for prach thread
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
struct sched_param sched_param_asynch_rxtx;
/// pthread structure for parallel fep thread
......@@ -304,6 +310,8 @@ typedef struct eNB_proc_t_s {
pthread_t pthread_te;
/// pthread structure for PRACH thread
pthread_t pthread_prach;
/// pthread structure for eNB synch thread
pthread_t pthread_synch;
/// condition variable for parallel fep thread
pthread_cond_t cond_fep;
/// condition variable for parallel turbo-decoder thread
......@@ -314,6 +322,8 @@ typedef struct eNB_proc_t_s {
pthread_cond_t cond_FH;
/// condition variable for PRACH processing thread;
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
pthread_cond_t cond_asynch_rxtx;
/// mutex for parallel fep thread
......@@ -326,6 +336,8 @@ typedef struct eNB_proc_t_s {
pthread_mutex_t mutex_FH;
/// mutex for PRACH thread
pthread_mutex_t mutex_prach;
// mutex for over-the-air eNB synchronization
pthread_mutex_t mutex_synch;
/// mutex for asynch RX/TX thread
pthread_mutex_t mutex_asynch_rxtx;
/// parameters for turbo-decoding worker thread
......@@ -411,6 +423,10 @@ typedef struct PHY_VARS_eNB_s {
openair0_rf_map rf_map;
int abstraction_flag;
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 (*fep)(struct PHY_VARS_eNB_s *eNB);
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);
// In lte-enb.c
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 kill_eNB_proc(void);
......@@ -170,6 +170,8 @@ volatile int oai_exit = 0;
static clock_source_t clock_source = internal;
static wait_for_sync = 0;
static char UE_flag=0;
unsigned int mmapped_dma=0;
int single_thread_flag=0;
......@@ -696,6 +698,7 @@ static void get_options (int argc, char **argv)
LONG_OPTION_MMAPPED_DMA,
LONG_OPTION_SINGLE_THREAD,
LONG_OPTION_EXTERNAL_CLOCK,
LONG_OPTION_WAIT_FOR_SYNC,
#if T_TRACER
LONG_OPTION_T_PORT,
LONG_OPTION_T_NOWAIT,
......@@ -722,6 +725,7 @@ static void get_options (int argc, char **argv)
{"mmapped-dma", no_argument, NULL, LONG_OPTION_MMAPPED_DMA},
{"single-thread", no_argument, NULL, LONG_OPTION_SINGLE_THREAD},
{"external-clock", no_argument, NULL, LONG_OPTION_EXTERNAL_CLOCK},
{"wait-for-sync", no_argument, NULL, LONG_OPTION_WAIT_FOR_SYNC},
#if T_TRACER
{"T_port", required_argument, 0, LONG_OPTION_T_PORT},
{"T_nowait", no_argument, 0, LONG_OPTION_T_NOWAIT},
......@@ -827,6 +831,10 @@ static void get_options (int argc, char **argv)
clock_source = external;
break;
case LONG_OPTION_WAIT_FOR_SYNC:
wait_for_sync = 1;
break;
#if T_TRACER
case LONG_OPTION_T_PORT: {
extern int T_port;
......@@ -1808,7 +1816,7 @@ int main( int argc, char **argv )
// start the main thread
if (UE_flag == 1) init_UE(1);
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
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