diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.band7.tm1.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.band7.tm1.usrpb210.conf index f828dfb1c7478083fda844ce653076d62f55ab46..5fbdad1fa6dd29a8f3d35d823b5e2cb012e88492 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.band7.tm1.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.band7.tm1.usrpb210.conf @@ -23,7 +23,7 @@ eNBs = component_carriers = ( { - node_function = "NGFI_RRU_IF4"; + node_function = "NGFI_RRU_IF4p5"; node_timing = "synch_to_ext_device"; node_synch_ref = 0; frame_type = "FDD"; diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index 43ae984197a39a84ed2490a34f8ed0b0a8b7c433..5f0c033826d04715a4993ecc5fe931740a361f40 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -159,7 +159,7 @@ static struct { void exit_fun(const char* s); -void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst); +void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst,eth_params_t *); void stop_eNB(int nb_inst); @@ -1218,16 +1218,17 @@ static void* eNB_thread_FH( void* param ) { wait_system_ready ("Waiting for eNB application to be ready %s\r", &start_eNB); #endif - // Start RF device if any - if (eNB->start_rf) - if (eNB->start_rf(eNB) != 0) - LOG_E(HW,"Could not start the RF device\n"); // Start IF device if any if (eNB->start_if) if (eNB->start_if(eNB) != 0) LOG_E(HW,"Could not start the IF device\n"); + // Start RF device if any + if (eNB->start_rf) + if (eNB->start_rf(eNB) != 0) + LOG_E(HW,"Could not start the RF device\n"); + // This is a forever while loop, it loops over subframes which are scheduled by incoming samples from HW devices while (!oai_exit) { @@ -1743,11 +1744,13 @@ extern void eNB_fep_rru_if5(PHY_VARS_eNB *eNB,eNB_proc_t *proc); extern void eNB_fep_full(PHY_VARS_eNB *eNB,eNB_proc_t *proc); extern void do_prach(PHY_VARS_eNB *eNB,eNB_proc_t *proc); -void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst) { +void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst,eth_params_t *eth_params) { int CC_id; int inst; PHY_VARS_eNB *eNB; + int ret; + for (inst=0;inst<nb_inst;inst++) { for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) { eNB = PHY_vars_eNB_g[inst][CC_id]; @@ -1755,37 +1758,73 @@ void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst eNB->node_timing = node_timing[CC_id]; eNB->abstraction_flag = 0; LOG_I(PHY,"Initializing eNB %d CC_id %d : (%s,%s)\n",inst,CC_id,eNB_functions[node_function[CC_id]],eNB_timing[node_timing[CC_id]]); + switch (node_function[CC_id]) { case NGFI_RRU_IF5: - eNB->do_prach = NULL; - eNB->fep = eNB_fep_rru_if5; - eNB->proc_uespec_rx = NULL; - eNB->proc_tx = NULL; - eNB->tx_fh = NULL; - eNB->rx_fh = rx_rf; - eNB->start_rf = start_rf; - eNB->start_if = start_if; + eNB->do_prach = NULL; + eNB->fep = eNB_fep_rru_if5; + eNB->proc_uespec_rx = NULL; + eNB->proc_tx = proc_tx_rru_if5;; + eNB->tx_fh = NULL; + eNB->rx_fh = rx_rf; + eNB->start_rf = start_rf; + eNB->start_if = start_if; + ret = openair0_device_load(&eNB->rfdevice, &openair0_cfg[0]); + if (ret<0) { + printf("Exiting, cannot initialize rf device\n"); + exit(-1); + } + eNB->rfdevice.host_type = RRH_HOST; + eNB->ifdevice.host_type = RRH_HOST; + ret = openair0_transport_load(&eNB->ifdevice, &openair0_cfg[0], (eth_params+CC_id)); + printf("openair0_transport_init returns %d for CC_id %d\n",ret,CC_id); + if (ret<0) { + printf("Exiting, cannot initialize transport protocol\n"); + exit(-1); + } break; case NGFI_RRU_IF4p5: - eNB->do_prach = do_prach; - eNB->fep = eNB_fep_full; - eNB->proc_uespec_rx = NULL; - eNB->proc_tx = proc_tx_rru_if4p5; - eNB->tx_fh = NULL; - eNB->rx_fh = rx_rf; - eNB->start_rf = start_rf; - eNB->start_if = start_if; + eNB->do_prach = do_prach; + eNB->fep = eNB_fep_full; + eNB->proc_uespec_rx = NULL; + eNB->proc_tx = proc_tx_rru_if4p5; + eNB->tx_fh = NULL; + eNB->rx_fh = rx_rf; + eNB->start_rf = start_rf; + eNB->start_if = start_if; + ret = openair0_device_load(&eNB->rfdevice, &openair0_cfg[0]); + if (ret<0) { + printf("Exiting, cannot initialize rf device\n"); + exit(-1); + } + eNB->rfdevice.host_type = RRH_HOST; + eNB->ifdevice.host_type = RRH_HOST; + ret = openair0_transport_load(&eNB->ifdevice, &openair0_cfg[0], (eth_params+CC_id)); + printf("openair0_transport_init returns %d for CC_id %d\n",ret,CC_id); + if (ret<0) { + printf("Exiting, cannot initialize transport protocol\n"); + exit(-1); + } + malloc_IF4p5_buffer(eNB); + break; case eNodeB_3GPP: - eNB->do_prach = do_prach; - eNB->fep = eNB_fep_full; - eNB->proc_uespec_rx = phy_procedures_eNB_uespec_RX; - eNB->proc_tx = proc_tx_full; - eNB->tx_fh = NULL; - eNB->rx_fh = rx_rf; - eNB->start_rf = start_rf; - eNB->start_if = NULL; + eNB->do_prach = do_prach; + eNB->fep = eNB_fep_full; + eNB->proc_uespec_rx = phy_procedures_eNB_uespec_RX; + eNB->proc_tx = proc_tx_full; + eNB->tx_fh = NULL; + eNB->rx_fh = rx_rf; + eNB->start_rf = start_rf; + eNB->start_if = NULL; + ret = openair0_device_load(&eNB->rfdevice, &openair0_cfg[0]); + if (ret<0) { + printf("Exiting, cannot initialize rf device\n"); + exit(-1); + } + eNB->rfdevice.host_type = BBU_HOST; + eNB->ifdevice.host_type = BBU_HOST; break; case eNodeB_3GPP_BBU: eNB->do_prach = do_prach; @@ -1796,6 +1835,15 @@ void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst eNB->rx_fh = rx_fh_if5; eNB->start_rf = NULL; eNB->start_if = start_if; + eNB->rfdevice.host_type = BBU_HOST; + + eNB->ifdevice.host_type = BBU_HOST; + ret = openair0_transport_load(&eNB->ifdevice, &openair0_cfg[0], (eth_params+CC_id)); + printf("openair0_transport_init returns %d for CC_id %d\n",ret,CC_id); + if (ret<0) { + printf("Exiting, cannot initialize transport protocol\n"); + exit(-1); + } break; case NGFI_RCC_IF4p5: eNB->do_prach = do_prach; @@ -1806,7 +1854,16 @@ void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst eNB->rx_fh = rx_fh_if4p5; eNB->start_rf = NULL; eNB->start_if = start_if; + eNB->rfdevice.host_type = BBU_HOST; + eNB->ifdevice.host_type = BBU_HOST; + ret = openair0_transport_load(&eNB->ifdevice, &openair0_cfg[0], (eth_params+CC_id)); + printf("openair0_transport_init returns %d for CC_id %d\n",ret,CC_id); + if (ret<0) { + printf("Exiting, cannot initialize transport protocol\n"); + exit(-1); + } malloc_IF4p5_buffer(eNB); + break; case NGFI_RAU_IF4p5: eNB->do_prach = do_prach; @@ -1817,8 +1874,18 @@ void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst eNB->rx_fh = rx_fh_if4p5; eNB->start_rf = NULL; eNB->start_if = start_if; - malloc_IF4p5_buffer(eNB); + + eNB->rfdevice.host_type = BBU_HOST; + eNB->ifdevice.host_type = BBU_HOST; + ret = openair0_transport_load(&eNB->ifdevice, &openair0_cfg[0], (eth_params+CC_id)); + printf("openair0_transport_init returns %d for CC_id %d\n",ret,CC_id); + if (ret<0) { + printf("Exiting, cannot initialize transport protocol\n"); + exit(-1); + } break; + malloc_IF4p5_buffer(eNB); + } } diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 38c95a4122b5b5c7f590ddd605a2e03d1fc31b45..f2c3614850e20178a0b013b4e960299ec9efa857 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -119,7 +119,7 @@ unsigned short config_frames[4] = {2,9,11,13}; // In lte-enb.c extern int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_cfg, openair0_rf_map rf_map[MAX_NUM_CCs]); -extern void init_eNB(eNB_func_t *, eNB_timing_t *,int); +extern void init_eNB(eNB_func_t *, eNB_timing_t *,int,eth_params_t *); extern void stop_eNB(int); extern void kill_eNB_proc(void); @@ -1643,64 +1643,6 @@ int main( int argc, char **argv ) openair0_cfg[0].log_level = glog_level; - if (UE_flag == 0) { - for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { - if (node_function[CC_id] == NGFI_RRU_IF4p5 || node_function[CC_id] == NGFI_RRU_IF5) { - PHY_vars_eNB_g[0][CC_id]->rfdevice.host_type = RRH_HOST; - PHY_vars_eNB_g[0][CC_id]->ifdevice.host_type = RRH_HOST; - } else { - PHY_vars_eNB_g[0][CC_id]->rfdevice.host_type = BBU_HOST; - PHY_vars_eNB_g[0][CC_id]->ifdevice.host_type = BBU_HOST; - } - } - } - else { - /* device host type is set*/ - PHY_vars_UE_g[0][0]->rfdevice.host_type = BBU_HOST; - /* device type is initialized NONE_DEV (no RF device) when the RF device will be initiated device type will be set */ - PHY_vars_UE_g[0][0]->rfdevice.type = NONE_DEV; - /* transport type is initialized NONE_TP (no transport protocol) when the transport protocol will be initiated transport protocol type will be set */ - PHY_vars_UE_g[0][0]->rfdevice.transp_type = NONE_TP; - } - - int returns=-1; - - // Load RF device and initialize - for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { - if (node_function[CC_id] == NGFI_RRU_IF5 || node_function[CC_id] == NGFI_RRU_IF4p5 || node_function[CC_id] == eNodeB_3GPP) { - if (mode!=loop_through_memory) { - returns= (UE_flag == 0) ? - openair0_device_load(&(PHY_vars_eNB_g[0][CC_id]->rfdevice), &openair0_cfg[0]) : - openair0_device_load(&(PHY_vars_UE_g[0][CC_id]->rfdevice), &openair0_cfg[0]); - - printf("openair0_device_init returns %d for CC_id %d\n",returns,CC_id); - if (returns<0) { - printf("Exiting, cannot initialize device\n"); - exit(-1); - } - } else if (mode==loop_through_memory) { - - } - } - } - - // Load transport protocol and initialize - for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { - if ((UE_flag==0) && (node_function[CC_id] != eNodeB_3GPP)) { - if (mode!=loop_through_memory) { - returns = openair0_transport_load(&(PHY_vars_eNB_g[0][CC_id]->ifdevice), &openair0_cfg[0], (eth_params+CC_id)); - printf("openair0_transport_init returns %d for CC_id %d\n",returns,CC_id); - if (returns<0) { - printf("Exiting, cannot initialize transport protocol\n"); - exit(-1); - } - } else if (mode==loop_through_memory) { - - } - } - } - - printf("Done initializing RF and IF devices\n"); mac_xface = malloc(sizeof(MAC_xface)); @@ -1854,7 +1796,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); + else init_eNB(node_function,node_timing,1,eth_params); // Sleep to allow all threads to setup sleep(3); diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 73e919758837d45ba92de12ac285b574047f4fee..3fda5d735f31c68638938d1943f3124f9004b4a1 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -179,12 +179,17 @@ void init_UE(int nb_inst) { int error_code; int inst; PHY_VARS_UE *UE; + int ret; for (inst=0;inst<nb_inst;inst++) { printf("Intializing UE Threads for instance %d ...\n",inst); init_UE_threads(inst); sleep(1); UE = PHY_vars_UE_g[inst][0]; + + ret = openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]); + UE->rfdevice.host_type = BBU_HOST; + UE->rfdevice.type = NONE_DEV; error_code = pthread_create(&UE->proc.pthread_ue, &UE->proc.attr_ue, UE_thread, NULL); if (error_code!= 0) {