Commit c4fdf44d authored by laurent's avatar laurent

test on simulator

parent cac65016
......@@ -316,7 +316,8 @@ void gNB_top(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, char *string, struct
L1_proc->frame_tx = (L1_proc->slot_rx > (fp->slots_per_frame-1-sl_ahead)) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx;
L1_proc->slot_tx = (L1_proc->slot_rx + sl_ahead)%fp->slots_per_frame;
if (rxtx(gNB,L1_proc,string) < 0) LOG_E(PHY,"gNB %d CC_id %d failed during execution\n",gNB->Mod_id,gNB->CC_id);
if (rxtx(gNB,L1_proc,string) < 0)
LOG_E(PHY,"gNB %d CC_id %d failed during execution\n",gNB->Mod_id,gNB->CC_id);
ru_proc->timestamp_tx = L1_proc->timestamp_tx;
ru_proc->tti_tx = L1_proc->slot_tx;
......@@ -441,6 +442,7 @@ static void *ru_thread_prach( void *param ) {
ru_thread_prach_status = 0;
return &ru_thread_prach_status;
}
void fill_rf_config(RU_t *ru, char *rf_config_file) {
int i;
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
......@@ -744,7 +746,6 @@ static void *ru_thread( void *param ) {
AssertFatal(setup_RU_buffers(ru),"Exiting, cannot initialize RU Buffers\n");
// Start RF device if any
if (ru->start_rf) {
if (ru->start_rf(ru) != 0)
......@@ -752,16 +753,19 @@ static void *ru_thread( void *param ) {
else LOG_I(PHY,"RU %d rf device ready\n",ru->idx);
} else LOG_I(PHY,"RU %d no rf device\n",ru->idx);
// The RU initializationis in the middle of gNB one
// so , we signal and wait the gNB finishes it's init
// before running the main loop
static notifiedFIFO_t ruThreadFIFO;
initNotifiedFIFO(&ruThreadFIFO);
LOG_I(PHY, "Signaling main thread that RU %d is ready\n",ru->idx);
notifiedFIFO_elt_t * msg=newNotifiedFIFO_elt(0,doneInitRU,&ruThreadFIFO,NULL);
notifiedFIFO_elt_t *msg=newNotifiedFIFO_elt(0,doneInitRU,&ruThreadFIFO,NULL);
pushNotifiedFIFO(&mainThreadFIFO,msg);
LOG_I(PHY, "wait main thread that RU %d is ready\n",ru->idx);
delNotifiedFIFO_elt(pullNotifiedFIFO(&ruThreadFIFO));
// This is a forever while loop, it loops over subframes which are scheduled by incoming samples from HW devices
while (!oai_exit) {
// these are local subframe/frame counters to check that we are in synch with the fronthaul timing.
// They are set on the first rx/tx in the underly FH routines.
......@@ -776,7 +780,6 @@ static void *ru_thread( void *param ) {
// synchronization on input FH interface, acquire signals/data and block
AssertFatal(ru->fh_south_in, "No fronthaul interface at south port");
ru->fh_south_in(ru,&frame,&slot);
LOG_D(PHY,"AFTER fh_south_in - SFN/SL:%d%d RU->proc[RX:%d.%d TX:%d.%d] RC.gNB[0][0]:[RX:%d%d TX(SFN):%d]\n",
frame,slot,
proc->frame_rx,proc->tti_rx,
......@@ -825,7 +828,8 @@ static void *ru_thread( void *param ) {
ru->fh_north_out(ru);
}
}
notifiedFIFO_elt_t * msg2=newNotifiedFIFO_elt(0,AbortRU,NULL,NULL);
notifiedFIFO_elt_t *msg2=newNotifiedFIFO_elt(0,AbortRU,NULL,NULL);
pushNotifiedFIFO(&mainThreadFIFO,msg2);
return NULL;
}
......@@ -1295,19 +1299,28 @@ int main( int argc, char **argv ) {
f(&p);
}
// Fixme: a sleep is needed because some external (thread?)
// has to populate something
// remove the sleep, you will see the assert
sleep(1);
number_of_cards = 1;
init_gNB(single_thread_flag,wait_for_sync);
init_RU(rf_config_file);
notifiedFIFO_elt_t * msg=pullNotifiedFIFO(&mainThreadFIFO);
notifiedFIFO_elt_t *msgs[RC.nb_RU];
for (int ru=0; ru<RC.nb_RU; ru++)
msgs[ru]=pullNotifiedFIFO(&mainThreadFIFO);
init_eNB_afterRU();
pushNotifiedFIFO(msg->reponseFifo, msg);
for (int ru=0; ru<RC.nb_RU; ru++)
pushNotifiedFIFO(msgs[ru]->reponseFifo, msgs[ru]);
pthread_mutex_lock(&sync_mutex);
sync_var=0;
pthread_cond_broadcast(&sync_cond);
pthread_mutex_unlock(&sync_mutex);
while (oai_exit==0)
sleep(1);
// When threads leaves, they send a final message to main
notifiedFIFO_elt_t *msg=pullNotifiedFIFO(&mainThreadFIFO);
return 0;
}
......@@ -457,6 +457,7 @@ int rfsimulator_set_gains(openair0_device *device, openair0_config_t *openair0_c
__attribute__((__visibility__("default")))
int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
//set_log(HW,OAILOG_DEBUG);
set_log(TMR,OAILOG_DEBUG);
//set_log(PHY,OAILOG_DEBUG);
rfsimulator_state_t *rfsimulator = (rfsimulator_state_t *)calloc(sizeof(rfsimulator_state_t),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