emulated RF using seperate thread condition signal every time period
This commit is contained in:
+14
-4
@@ -331,8 +331,10 @@ typedef struct RU_proc_t_s {
|
||||
int instance_cnt_asynch_rxtx;
|
||||
/// \internal This variable is protected by \ref mutex_fep
|
||||
int instance_cnt_fep;
|
||||
/// \internal This variable is protected by \ref mutex_fep
|
||||
/// \internal This variable is protected by \ref mutex_feptx
|
||||
int instance_cnt_feptx;
|
||||
/// This varible is protected by \ref mutex_emulatedRF
|
||||
int instance_cnt_emulateRF;
|
||||
/// pthread structure for RU FH processing thread
|
||||
pthread_t pthread_FH;
|
||||
pthread_t pthread_FH1;
|
||||
@@ -346,8 +348,10 @@ typedef struct RU_proc_t_s {
|
||||
pthread_t pthread_synch;
|
||||
/// pthread struct for RU RX FEP worker thread
|
||||
pthread_t pthread_fep;
|
||||
/// pthread struct for RU RX FEPTX worker thread
|
||||
/// pthread struct for RU TX FEP worker thread
|
||||
pthread_t pthread_feptx;
|
||||
/// pthread struct for emulated RF
|
||||
pthread_t pthread_emulateRF;
|
||||
/// pthread structure for asychronous RX/TX processing thread
|
||||
pthread_t pthread_asynch_rxtx;
|
||||
/// flag to indicate first RX acquisition
|
||||
@@ -371,6 +375,8 @@ typedef struct RU_proc_t_s {
|
||||
pthread_attr_t attr_fep;
|
||||
/// pthread attributes for worker feptx thread
|
||||
pthread_attr_t attr_feptx;
|
||||
/// pthread attributes for emulated RF
|
||||
pthread_attr_t attr_emulateRF;
|
||||
/// scheduling parameters for RU FH thread
|
||||
struct sched_param sched_param_FH;
|
||||
struct sched_param sched_param_FH1;
|
||||
@@ -397,10 +403,12 @@ typedef struct RU_proc_t_s {
|
||||
pthread_cond_t cond_synch;
|
||||
/// condition variable for asynch RX/TX thread
|
||||
pthread_cond_t cond_asynch_rxtx;
|
||||
/// condition varaible for RU RX FEP thread
|
||||
/// condition varible for RU RX FEP thread
|
||||
pthread_cond_t cond_fep;
|
||||
/// condition varaible for RU RX FEPTX thread
|
||||
/// condition varible for RU TX FEP thread
|
||||
pthread_cond_t cond_feptx;
|
||||
/// condition varible for emulated RF
|
||||
pthread_cond_t cond_emulateRF;
|
||||
/// condition variable for eNB signal
|
||||
pthread_cond_t cond_eNBs;
|
||||
/// mutex for RU FH
|
||||
@@ -422,6 +430,8 @@ typedef struct RU_proc_t_s {
|
||||
pthread_mutex_t mutex_fep;
|
||||
/// mutex for fep TX worker thread
|
||||
pthread_mutex_t mutex_feptx;
|
||||
/// mutex for emulated RF thread
|
||||
pthread_mutex_t mutex_emulateRF;
|
||||
/// symbol mask for IF4p5 reception per subframe
|
||||
uint32_t symbol_mask[10];
|
||||
/// number of slave threads
|
||||
|
||||
+34
-11
@@ -683,6 +683,24 @@ void fh_if4p5_north_out(RU_t *ru) {
|
||||
|
||||
if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 0 );
|
||||
}
|
||||
|
||||
static void* emulatedRF_thread(void* param) {
|
||||
RU_proc_t *proc = (RU_proc_t *) param;
|
||||
int microsec = 500; // length of time to sleep, in miliseconds
|
||||
struct timespec req = {0};
|
||||
req.tv_sec = 0;
|
||||
req.tv_nsec = microsec * 1000L;
|
||||
wait_sync("emulatedRF_thread");
|
||||
while(!oai_exit){
|
||||
nanosleep(&req, (struct timespec *)NULL);
|
||||
pthread_mutex_lock(&proc->mutex_emulateRF);
|
||||
++proc->instance_cnt_emulateRF;
|
||||
pthread_mutex_unlock(&proc->mutex_emulateRF);
|
||||
pthread_cond_signal(&proc->cond_emulateRF);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void rx_rf(RU_t *ru,int *frame,int *subframe) {
|
||||
|
||||
RU_proc_t *proc = &ru->proc;
|
||||
@@ -699,11 +717,8 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
|
||||
|
||||
old_ts = proc->timestamp_rx;
|
||||
#ifdef EMULATE_RF
|
||||
int microsec = 450; // length of time to sleep, in miliseconds
|
||||
struct timespec req = {0};
|
||||
req.tv_sec = 0;
|
||||
req.tv_nsec = microsec * 1000L;
|
||||
nanosleep(&req, (struct timespec *)NULL);
|
||||
wait_on_condition(&proc->mutex_emulateRF,&proc->cond_emulateRF,&proc->instance_cnt_emulateRF,"emulatedRF_thread");
|
||||
release_thread(&proc->mutex_emulateRF,&proc->instance_cnt_emulateRF,"emulatedRF_thread");
|
||||
rxs = fp->samples_per_tti;
|
||||
#else
|
||||
rxs = ru->rfdevice.trx_read_func(&ru->rfdevice,
|
||||
@@ -715,7 +730,7 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 0 );
|
||||
|
||||
proc->timestamp_rx = -ru->ts_offset;//ts-ru->ts_offset;
|
||||
proc->timestamp_rx = ts-ru->ts_offset;
|
||||
|
||||
if (rxs != fp->samples_per_tti)
|
||||
LOG_E(PHY,"rx_rf: Asked for %d samples, got %d from USRP\n",fp->samples_per_tti,rxs);
|
||||
@@ -728,7 +743,7 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
|
||||
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);
|
||||
ru->ts_offset += (proc->timestamp_rx - old_ts - fp->samples_per_tti);
|
||||
proc->timestamp_rx = -ru->ts_offset;//ts-ru->ts_offset;
|
||||
proc->timestamp_rx = ts-ru->ts_offset;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1405,7 +1420,7 @@ static void* ru_thread_tx( void* param ) {
|
||||
}
|
||||
LOG_D(PHY,"ru_thread_tx: Waiting for TX processing\n");
|
||||
// wait until eNBs are finished subframe RX n and TX n+4
|
||||
wait_on_condition(&proc->mutex_eNBs,&proc->cond_eNBs,&proc->instance_cnt_eNBs,"ru_thread");
|
||||
wait_on_condition(&proc->mutex_eNBs,&proc->cond_eNBs,&proc->instance_cnt_eNBs,"ru_thread_tx");
|
||||
//printf("//////////////////instance_cnt_eNBs = %d\n",proc->instance_cnt_eNBs);//////////////////*********
|
||||
|
||||
#ifdef EMULATE_RF
|
||||
@@ -1421,7 +1436,7 @@ static void* ru_thread_tx( void* param ) {
|
||||
if (ru->fh_north_out) ru->fh_north_out(ru);
|
||||
#endif
|
||||
|
||||
release_thread(&proc->mutex_eNBs,&proc->instance_cnt_eNBs,"ru_thread");
|
||||
release_thread(&proc->mutex_eNBs,&proc->instance_cnt_eNBs,"ru_thread_tx");
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1706,7 +1721,7 @@ void init_RU_proc(RU_t *ru) {
|
||||
|
||||
int i=0;
|
||||
RU_proc_t *proc;
|
||||
pthread_attr_t *attr_FH=NULL,*attr_FH1=NULL,*attr_prach=NULL,*attr_asynch=NULL,*attr_synch=NULL;
|
||||
pthread_attr_t *attr_FH=NULL,*attr_FH1=NULL,*attr_prach=NULL,*attr_asynch=NULL,*attr_synch=NULL,*attr_emulateRF=NULL;
|
||||
//pthread_attr_t *attr_fep=NULL;
|
||||
#ifdef Rel14
|
||||
pthread_attr_t *attr_prach_br=NULL;
|
||||
@@ -1724,6 +1739,7 @@ void init_RU_proc(RU_t *ru) {
|
||||
proc->instance_cnt_synch = -1;
|
||||
proc->instance_cnt_FH = -1;
|
||||
proc->instance_cnt_FH1 = -1;
|
||||
proc->instance_cnt_emulateRF = -1;
|
||||
proc->instance_cnt_asynch_rxtx = -1;
|
||||
proc->instance_cnt_eNBs = -1;
|
||||
proc->first_rx = 1;
|
||||
@@ -1739,15 +1755,18 @@ void init_RU_proc(RU_t *ru) {
|
||||
pthread_mutex_init( &proc->mutex_synch,NULL);
|
||||
pthread_mutex_init( &proc->mutex_FH,NULL);
|
||||
pthread_mutex_init( &proc->mutex_FH1,NULL);
|
||||
pthread_mutex_init( &proc->mutex_emulateRF,NULL);
|
||||
|
||||
pthread_cond_init( &proc->cond_prach, NULL);
|
||||
pthread_cond_init( &proc->cond_FH, NULL);
|
||||
pthread_cond_init( &proc->cond_FH1, NULL);
|
||||
pthread_cond_init( &proc->cond_emulateRF, NULL);
|
||||
pthread_cond_init( &proc->cond_asynch_rxtx, NULL);
|
||||
pthread_cond_init( &proc->cond_synch,NULL);
|
||||
|
||||
pthread_attr_init( &proc->attr_FH);
|
||||
pthread_attr_init( &proc->attr_FH1);
|
||||
pthread_attr_init( &proc->attr_emulateRF);
|
||||
pthread_attr_init( &proc->attr_prach);
|
||||
pthread_attr_init( &proc->attr_synch);
|
||||
pthread_attr_init( &proc->attr_asynch_rxtx);
|
||||
@@ -1766,12 +1785,16 @@ void init_RU_proc(RU_t *ru) {
|
||||
attr_prach = &proc->attr_prach;
|
||||
attr_synch = &proc->attr_synch;
|
||||
attr_asynch = &proc->attr_asynch_rxtx;
|
||||
attr_emulateRF = &proc->attr_emulateRF;
|
||||
#ifdef Rel14
|
||||
attr_prach_br = &proc->attr_prach_br;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
pthread_create( &proc->pthread_FH, attr_FH, ru_thread, (void*)ru );\
|
||||
pthread_create( &proc->pthread_FH, attr_FH, ru_thread, (void*)ru );
|
||||
#ifdef EMULATE_RF
|
||||
pthread_create( &proc->pthread_emulateRF, attr_emulateRF, emulatedRF_thread, (void*)proc );
|
||||
#endif
|
||||
|
||||
if (fh_two_thread==1)
|
||||
pthread_create( &proc->pthread_FH1, attr_FH1, ru_thread_tx, (void*)ru );
|
||||
|
||||
Reference in New Issue
Block a user