Commit a4660d32 authored by Younes's avatar Younes

minor changes in RRU portion for frame resynch

parent 4afeaaf2
...@@ -784,6 +784,7 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) { ...@@ -784,6 +784,7 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
unsigned int rxs; unsigned int rxs;
int i; int i;
openair0_timestamp ts,old_ts; openair0_timestamp ts,old_ts;
int resynch=0;
for (i=0; i<ru->nb_rx; i++) for (i=0; i<ru->nb_rx; i++)
rxp[i] = (void*)&ru->common.rxdata[i][*subframe*fp->samples_per_tti]; rxp[i] = (void*)&ru->common.rxdata[i][*subframe*fp->samples_per_tti];
...@@ -801,9 +802,12 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) { ...@@ -801,9 +802,12 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 0 );
if (ru->cmd==RU_FRAME_RESYNCH) { if (ru->cmd==RU_FRAME_RESYNCH) {
ru->ts_offset += (proc->frame_rx - ru->cmdval)*fp->samples_per_tti*10; LOG_I(PHY,"Applying frame resynch %d => %d\n",*frame,ru->cmdval);
if (proc->frame_rx>ru->cmdval) ru->ts_offset += (proc->frame_rx - ru->cmdval)*fp->samples_per_tti*10;
else ru->ts_offset -= (-proc->frame_rx + ru->cmdval)*fp->samples_per_tti*10;
*frame = ru->cmdval; *frame = ru->cmdval;
ru->cmd=EMPTY; ru->cmd=EMPTY;
resynch=1;
} }
proc->timestamp_rx = ts-ru->ts_offset; proc->timestamp_rx = ts-ru->ts_offset;
...@@ -816,14 +820,12 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) { ...@@ -816,14 +820,12 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
ru->ts_offset = proc->timestamp_rx; ru->ts_offset = proc->timestamp_rx;
proc->timestamp_rx = 0; proc->timestamp_rx = 0;
} }
else { else if (resynch==0 && (proc->timestamp_rx - old_ts != fp->samples_per_tti)) {
if (proc->timestamp_rx - old_ts != fp->samples_per_tti) {
LOG_I(PHY,"rx_rf: rfdevice timing drift of %"PRId64" samples (ts_off %"PRId64")\n",proc->timestamp_rx - old_ts - fp->samples_per_tti,ru->ts_offset); LOG_I(PHY,"rx_rf: rfdevice timing drift of %"PRId64" samples (ts_off %"PRId64")\n",proc->timestamp_rx - old_ts - fp->samples_per_tti,ru->ts_offset);
ru->ts_offset += (proc->timestamp_rx - old_ts - fp->samples_per_tti); ru->ts_offset += (proc->timestamp_rx - old_ts - fp->samples_per_tti);
proc->timestamp_rx = ts-ru->ts_offset; proc->timestamp_rx = ts-ru->ts_offset;
} }
}
proc->frame_rx = (proc->timestamp_rx / (fp->samples_per_tti*10))&1023; proc->frame_rx = (proc->timestamp_rx / (fp->samples_per_tti*10))&1023;
proc->subframe_rx = (proc->timestamp_rx / fp->samples_per_tti)%10; proc->subframe_rx = (proc->timestamp_rx / fp->samples_per_tti)%10;
// synchronize first reception to frame 0 subframe 0 // synchronize first reception to frame 0 subframe 0
...@@ -1747,6 +1749,7 @@ static void* ru_thread_control( void* param ) { ...@@ -1747,6 +1749,7 @@ static void* ru_thread_control( void* param ) {
case RRU_frame_resynch: //RRU case RRU_frame_resynch: //RRU
if (ru->if_south != LOCAL_RF) LOG_E(PHY,"Received RRU frame resynch message, should not happen in RAU\n"); if (ru->if_south != LOCAL_RF) LOG_E(PHY,"Received RRU frame resynch message, should not happen in RAU\n");
else { else {
LOG_I(PHY,"Received RRU_frame_resynch command\n");
ru->cmd = RU_FRAME_RESYNCH; ru->cmd = RU_FRAME_RESYNCH;
ru->cmdval = ((uint16_t*)&rru_config_msg.msg[0])[0]; ru->cmdval = ((uint16_t*)&rru_config_msg.msg[0])[0];
} }
......
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