Commit f02c1f20 authored by Raymond Knopp's avatar Raymond Knopp

frame synchronization mechanism and robustification of if4p5 packet handling...

frame synchronization mechanism and robustification of if4p5 packet handling for out-of-order asynchronous reception (PDLFFT)
parent 09a2fa65
...@@ -229,7 +229,7 @@ void recv_IF4p5(PHY_VARS_eNB *eNB, int *frame, int *subframe, uint16_t *packet_t ...@@ -229,7 +229,7 @@ void recv_IF4p5(PHY_VARS_eNB *eNB, int *frame, int *subframe, uint16_t *packet_t
*packet_type = packet_header->sub_type; *packet_type = packet_header->sub_type;
// printf("CC_id %d : frame %d, subframe %d\n",eNB->CC_id,*frame,*subframe); // LOG_I(PHY,"CC_id %d : frame %d, subframe %d\n",eNB->CC_id,*frame,*subframe);
if (*packet_type == IF4p5_PDLFFT) { if (*packet_type == IF4p5_PDLFFT) {
*symbol_number = ((packet_header->frame_status)>>26)&0x000f; *symbol_number = ((packet_header->frame_status)>>26)&0x000f;
......
...@@ -238,6 +238,8 @@ typedef struct eNB_proc_t_s { ...@@ -238,6 +238,8 @@ typedef struct eNB_proc_t_s {
openair0_timestamp timestamp_tx; openair0_timestamp timestamp_tx;
/// subframe to act upon for reception /// subframe to act upon for reception
int subframe_rx; int subframe_rx;
/// symbol mask for IF4p5 reception per subframe
uint32_t symbol_mask[10];
/// subframe to act upon for PRACH /// subframe to act upon for PRACH
int subframe_prach; int subframe_prach;
/// frame to act upon for reception /// frame to act upon for reception
......
...@@ -360,19 +360,34 @@ static bool is_equal(double a, double b) ...@@ -360,19 +360,34 @@ static bool is_equal(double a, double b)
return std::fabs(a-b) < std::numeric_limits<double>::epsilon(); return std::fabs(a-b) < std::numeric_limits<double>::epsilon();
} }
/*! \brief Set frequencies (TX/RX) void *freq_thread(void *arg) {
openair0_device *device=(openair0_device *)arg;
usrp_state_t *s = (usrp_state_t*)device->priv;
s->usrp->set_tx_freq(device->openair0_cfg[0].tx_freq[0]);
s->usrp->set_rx_freq(device->openair0_cfg[0].rx_freq[0]);
}
/*! \brief Set frequencies (TX/RX). Spawns a thread to handle the frequency change to not block the calling thread
* \param device the hardware to use * \param device the hardware to use
* \param openair0_cfg RF frontend parameters set by application * \param openair0_cfg RF frontend parameters set by application
* \param dummy dummy variable not used * \param dummy dummy variable not used
* \returns 0 in success * \returns 0 in success
*/ */
int trx_usrp_set_freq(openair0_device* device, openair0_config_t *openair0_cfg, int dummy) { int trx_usrp_set_freq(openair0_device* device, openair0_config_t *openair0_cfg, int dont_block) {
usrp_state_t *s = (usrp_state_t*)device->priv; usrp_state_t *s = (usrp_state_t*)device->priv;
pthread_t f_thread;
printf("Setting USRP TX Freq %f, RX Freq %f\n",openair0_cfg[0].tx_freq[0],openair0_cfg[0].rx_freq[0]); printf("Setting USRP TX Freq %f, RX Freq %f\n",openair0_cfg[0].tx_freq[0],openair0_cfg[0].rx_freq[0]);
s->usrp->set_tx_freq(openair0_cfg[0].tx_freq[0]);
s->usrp->set_rx_freq(openair0_cfg[0].rx_freq[0]); // spawn a thread to handle the frequency change to not block the calling thread
if (dont_block == 1)
pthread_create(&f_thread,NULL,freq_thread,(void*)device);
else {
s->usrp->set_tx_freq(device->openair0_cfg[0].tx_freq[0]);
s->usrp->set_rx_freq(device->openair0_cfg[0].rx_freq[0]);
}
return(0); return(0);
......
...@@ -744,11 +744,10 @@ void fh_if4p5_asynch_DL(PHY_VARS_eNB *eNB,int *frame,int *subframe) { ...@@ -744,11 +744,10 @@ void fh_if4p5_asynch_DL(PHY_VARS_eNB *eNB,int *frame,int *subframe) {
eNB_proc_t *proc = &eNB->proc; eNB_proc_t *proc = &eNB->proc;
uint16_t packet_type; uint16_t packet_type;
uint32_t symbol_number,symbol_mask,symbol_mask_full; uint32_t symbol_number,symbol_mask_full;
int subframe_tx,frame_tx; int subframe_tx,frame_tx;
symbol_number = 0; symbol_number = 0;
symbol_mask = 0;
symbol_mask_full = (1<<fp->symbols_per_tti)-1; symbol_mask_full = (1<<fp->symbols_per_tti)-1;
do { // Blocking, we need a timeout on this !!!!!!!!!!!!!!!!!!!!!!! do { // Blocking, we need a timeout on this !!!!!!!!!!!!!!!!!!!!!!!
...@@ -765,21 +764,24 @@ void fh_if4p5_asynch_DL(PHY_VARS_eNB *eNB,int *frame,int *subframe) { ...@@ -765,21 +764,24 @@ void fh_if4p5_asynch_DL(PHY_VARS_eNB *eNB,int *frame,int *subframe) {
// exit_fun("Exiting"); // exit_fun("Exiting");
} }
if (subframe_tx != *subframe) { if (subframe_tx != *subframe) {
LOG_E(PHY,"fh_if4p5_asynch_DL: subframe_tx %d is not what we expect %d\n",subframe_tx,*subframe); LOG_E(PHY,"fh_if4p5_asynch_DL: (frame %d) subframe_tx %d is not what we expect %d\n",frame_tx,subframe_tx,*subframe);
*subframe = subframe_tx; //*subframe = subframe_tx;
// exit_fun("Exiting"); //exit_fun("Exiting");
} }
} }
if (packet_type == IF4p5_PDLFFT) { if (packet_type == IF4p5_PDLFFT) {
symbol_mask = symbol_mask | (1<<symbol_number); proc->symbol_mask[subframe_tx] =proc->symbol_mask[subframe_tx] | (1<<symbol_number);
} }
else { else {
LOG_E(PHY,"Illegal IF4p5 packet type (should only be IF4p5_PDLFFT%d\n",packet_type); LOG_E(PHY,"Illegal IF4p5 packet type (should only be IF4p5_PDLFFT%d\n",packet_type);
exit_fun("Exiting"); exit_fun("Exiting");
} }
} while (symbol_mask != symbol_mask_full); } while (proc->symbol_mask[*subframe] != symbol_mask_full);
// intialize this to zero after we're done with the subframe
proc->symbol_mask[*subframe] = 0;
do_OFDM_mod_rt(subframe_tx, eNB); do_OFDM_mod_rt(*subframe, eNB);
} }
/*! /*!
...@@ -1463,7 +1465,7 @@ static void* eNB_thread_single( void* param ) { ...@@ -1463,7 +1465,7 @@ static void* eNB_thread_single( void* param ) {
eNB->rfdevice.openair0_cfg->rx_freq[i] = temp_freq1; eNB->rfdevice.openair0_cfg->rx_freq[i] = temp_freq1;
eNB->rfdevice.openair0_cfg->tx_freq[i] = temp_freq2; eNB->rfdevice.openair0_cfg->tx_freq[i] = temp_freq2;
} }
eNB->rfdevice.trx_set_freq_func(&eNB->rfdevice,eNB->rfdevice.openair0_cfg,0); eNB->rfdevice.trx_set_freq_func(&eNB->rfdevice,eNB->rfdevice.openair0_cfg,1);
} // if RRU and slave } // if RRU and slave
...@@ -1540,6 +1542,8 @@ void init_eNB_proc(int inst) { ...@@ -1540,6 +1542,8 @@ void init_eNB_proc(int inst) {
proc->first_rx=1; proc->first_rx=1;
proc->first_tx=1; proc->first_tx=1;
for (i=0;i<10;i++) proc->symbol_mask[i]=0;
pthread_mutex_init( &proc_rxtx[0].mutex_rxtx, NULL); pthread_mutex_init( &proc_rxtx[0].mutex_rxtx, NULL);
pthread_mutex_init( &proc_rxtx[1].mutex_rxtx, NULL); pthread_mutex_init( &proc_rxtx[1].mutex_rxtx, NULL);
pthread_cond_init( &proc_rxtx[0].cond_rxtx, NULL); pthread_cond_init( &proc_rxtx[0].cond_rxtx, NULL);
......
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