Merge remote-tracking branch 'origin/develop' into NR_RRCConfiguration
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "common_lib.h"
|
||||
#include "assertions.h"
|
||||
#include "common/utils/load_module_shlib.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "targets/RT/USER/lte-softmodem.h"
|
||||
@@ -91,38 +92,44 @@ int load_lib(openair0_device *device,
|
||||
{
|
||||
loader_shlibfunc_t shlib_fdesc[1];
|
||||
int ret=0;
|
||||
char *libname;
|
||||
char *deflibname=OAI_RF_LIBNAME;
|
||||
|
||||
openair0_cfg->recplay_mode = read_recplayconfig(&(openair0_cfg->recplay_conf),&(device->recplay_state));
|
||||
|
||||
if ( openair0_cfg->recplay_mode == RECPLAY_REPLAYMODE ) {
|
||||
libname=OAI_IQPLAYER_LIBNAME;
|
||||
deflibname=OAI_IQPLAYER_LIBNAME;
|
||||
shlib_fdesc[0].fname="device_init";
|
||||
set_softmodem_optmask(SOFTMODEM_RECPLAY_BIT); // softmodem has to know we use the iqplayer to workaround randomized algorithms
|
||||
} else if ( IS_SOFTMODEM_BASICSIM ) {
|
||||
libname=OAI_BASICSIM_LIBNAME;
|
||||
deflibname=OAI_BASICSIM_LIBNAME;
|
||||
shlib_fdesc[0].fname="device_init";
|
||||
} else if (IS_SOFTMODEM_RFSIM && flag == RAU_LOCAL_RADIO_HEAD) {
|
||||
libname=OAI_RFSIM_LIBNAME;
|
||||
deflibname=OAI_RFSIM_LIBNAME;
|
||||
shlib_fdesc[0].fname="device_init";
|
||||
} else if (flag == RAU_LOCAL_RADIO_HEAD) {
|
||||
if (IS_SOFTMODEM_RFSIM)
|
||||
libname="rfsimulator";
|
||||
deflibname="rfsimulator";
|
||||
else
|
||||
libname=OAI_RF_LIBNAME;
|
||||
deflibname=OAI_RF_LIBNAME;
|
||||
shlib_fdesc[0].fname="device_init";
|
||||
} else {
|
||||
libname=OAI_TP_LIBNAME;
|
||||
deflibname=OAI_TP_LIBNAME;
|
||||
shlib_fdesc[0].fname="transport_init";
|
||||
}
|
||||
ret=load_module_shlib(libname,shlib_fdesc,1,NULL);
|
||||
|
||||
char *devname=NULL;
|
||||
paramdef_t device_params[]=DEVICE_PARAMS_DESC ;
|
||||
int numparams = sizeof(device_params)/sizeof(paramdef_t);
|
||||
int devname_pidx = config_paramidx_fromname(device_params,numparams, CONFIG_DEVICEOPT_NAME);
|
||||
device_params[devname_pidx].defstrval=deflibname;
|
||||
|
||||
config_get(device_params,numparams,DEVICE_SECTION);
|
||||
|
||||
ret=load_module_shlib(devname,shlib_fdesc,1,NULL);
|
||||
AssertFatal( (ret >= 0),
|
||||
"Library %s couldn't be loaded\n",devname);
|
||||
|
||||
if (ret < 0) {
|
||||
LOG_E(HW,"Library %s couldn't be loaded\n",libname);
|
||||
} else {
|
||||
ret=((devfunc_t)shlib_fdesc[0].fptr)(device,openair0_cfg,cfg);
|
||||
}
|
||||
return ret;
|
||||
return ((devfunc_t)shlib_fdesc[0].fptr)(device,openair0_cfg,cfg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -448,6 +448,24 @@ typedef struct {
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
#define DEVICE_SECTION "device"
|
||||
#define CONFIG_HLP_DEVICE "Identifies the oai device (the interface to RF) to use, the shared lib \"lib_<name>.so\" will be loaded"
|
||||
|
||||
#define CONFIG_DEVICEOPT_NAME "name"
|
||||
|
||||
/* inclusion for device configuration */
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* config parameters for oai device */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#define DEVICE_PARAMS_DESC {\
|
||||
{ CONFIG_DEVICEOPT_NAME, CONFIG_HLP_DEVICE, 0, strptr:&devname, defstrval:NULL, TYPE_STRING, 0}\
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*! \brief get device name from device type */
|
||||
char *get_devname(int devtype);
|
||||
/*! \brief Initialize openair RF target. It returns 0 if OK */
|
||||
|
||||
@@ -37,19 +37,6 @@
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
#define CONFIG_OPT_RECPLAY "enable_recplay"
|
||||
|
||||
#define CONFIG_HLP_RECPLAY "Allow record player"
|
||||
#define USRP_SECTION "device.usrp"
|
||||
/* inclusion for device configuration */
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* command line parameters for USRP record/playback */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#define DEVICE_PARAMS_DESC { \
|
||||
{CONFIG_OPT_RECPLAY, CONFIG_HLP_RECPLAY, PARAMFLAG_BOOL, uptr:&enable_recplay, defuintval:0, TYPE_UINT, 0} \
|
||||
}
|
||||
|
||||
|
||||
/* inclusions for record player */
|
||||
#define RECPLAY_DISABLED 0
|
||||
@@ -114,7 +101,7 @@ typedef struct {
|
||||
{CONFIG_OPT_SF_LOOPS, CONFIG_HLP_SF_LOOPS, 0, uptr:&((*recplay_conf)->u_sf_loops), defintval:DEF_SF_NB_LOOP, TYPE_UINT, 0}, \
|
||||
{CONFIG_OPT_SF_RDELAY, CONFIG_HLP_SF_RDELAY, 0, uptr:&((*recplay_conf)->u_sf_read_delay), defintval:DEF_SF_DELAY_READ, TYPE_UINT, 0}, \
|
||||
{CONFIG_OPT_SF_WDELAY, CONFIG_HLP_SF_WDELAY, 0, uptr:&((*recplay_conf)->u_sf_write_delay), defintval:DEF_SF_DELAY_WRITE, TYPE_UINT, 0}, \
|
||||
}/*! \brief USRP Configuration and state */
|
||||
}/*! \brief Record Player Configuration and state */
|
||||
typedef struct {
|
||||
char u_sf_filename[1024]; // subframes file path
|
||||
unsigned int u_sf_max ; // max number of recorded subframes
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
#define _LARGEFILE_SOURCE
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
#define NB_ANTENNAS_RX 2
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
@@ -45,7 +46,9 @@
|
||||
|
||||
|
||||
static void parse_iqfile_header(openair0_device *device, iqfile_header_t *iq_fh) {
|
||||
AssertFatal((memcmp(iq_fh->oaiid,OAIIQFILE_ID,sizeof(OAIIQFILE_ID)) == 0),"iqfile doesn't seem to be compatible with oai (invalid id in header)\n");
|
||||
AssertFatal((memcmp(iq_fh->oaiid,OAIIQFILE_ID,sizeof(OAIIQFILE_ID)) == 0),
|
||||
"iqfile doesn't seem to be compatible with oai (invalid id %.4s in header)\n",
|
||||
iq_fh->oaiid);
|
||||
device->type = iq_fh->devtype;
|
||||
device->openair0_cfg[0].tx_sample_advance=iq_fh->tx_sample_advance;
|
||||
device->openair0_cfg[0].tx_bw = device->openair0_cfg[0].rx_bw = iq_fh->bw;
|
||||
@@ -138,6 +141,13 @@ static int iqplayer_loadfile(openair0_device *device, openair0_config_t *openair
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*! \brief start the oai iq player
|
||||
* \param device, the hardware used
|
||||
*/
|
||||
static int trx_iqplayer_start(openair0_device *device){
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*! \brief Terminate operation of the oai iq player
|
||||
* \param device, the hardware used
|
||||
*/
|
||||
@@ -287,7 +297,7 @@ static int trx_iqplayer_read(openair0_device *device, openair0_timestamp *ptimes
|
||||
|
||||
int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
|
||||
device->openair0_cfg = openair0_cfg;
|
||||
device->trx_start_func = NULL;
|
||||
device->trx_start_func = trx_iqplayer_start;
|
||||
device->trx_get_stats_func = NULL;
|
||||
device->trx_reset_stats_func = NULL;
|
||||
device->trx_end_func = trx_iqplayer_end;
|
||||
|
||||
@@ -2194,7 +2194,9 @@ int start_rf(RU_t *ru) {
|
||||
}
|
||||
|
||||
int stop_rf(RU_t *ru) {
|
||||
ru->rfdevice.trx_end_func(&ru->rfdevice);
|
||||
if(ru->rfdevice.trx_end_func != NULL) {
|
||||
ru->rfdevice.trx_end_func(&ru->rfdevice);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2342,11 +2344,15 @@ void init_RU_proc(RU_t *ru) {
|
||||
init_frame_parms(ru->frame_parms,1);
|
||||
ru->frame_parms->nb_antennas_rx = ru->nb_rx;
|
||||
phy_init_RU(ru);
|
||||
openair0_device_load(&ru->rfdevice,&ru->openair0_cfg);
|
||||
ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg);
|
||||
if (ret < 0) {
|
||||
LOG_I(PHY,"Exiting, cannot load device. Make sure that your SDR board is connected!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (setup_RU_buffers(ru)!=0) {
|
||||
printf("Exiting, cannot initialize RU Buffers\n");
|
||||
exit(-1);
|
||||
LOG_I(PHY,"Exiting, cannot initialize RU Buffers\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+42
-39
@@ -88,7 +88,7 @@ extern void oai_subframe_ind(uint16_t sfn, uint16_t sf);
|
||||
extern void multicast_link_start(void (*rx_handlerP) (unsigned int, char *),
|
||||
unsigned char _multicast_group, char *multicast_ifname);
|
||||
extern int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind);
|
||||
extern int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind);
|
||||
extern int oai_nfapi_cqi_indication(nfapi_cqi_indication_t *cqi_ind);
|
||||
extern int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind);
|
||||
extern int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind);
|
||||
extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind);
|
||||
@@ -992,6 +992,19 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
|
||||
phy_stub_ticking->num_single_thread[ue_thread_id] = -1;
|
||||
UE = rtd->UE;
|
||||
|
||||
UL_INFO = (UL_IND_t *)malloc(sizeof(UL_IND_t));
|
||||
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_rx_indication_pdu_t));
|
||||
UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0;
|
||||
UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_crc_indication_pdu_t));
|
||||
UL_INFO->crc_ind.crc_indication_body.number_of_crcs = 0;
|
||||
UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_harq_indication_pdu_t));
|
||||
UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0;
|
||||
UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_sr_indication_pdu_t));
|
||||
UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0;
|
||||
UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_cqi_indication_pdu_t));
|
||||
UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_cqi_indication_raw_pdu_t));
|
||||
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0;
|
||||
|
||||
if(ue_thread_id == 0) {
|
||||
phy_stub_ticking->ticking_var = -1;
|
||||
proc->subframe_rx=proc->sub_frame_start;
|
||||
@@ -1064,20 +1077,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
|
||||
initRefTimes(t3);
|
||||
pickTime(current);
|
||||
updateTimes(proc->gotIQs, &t2, 10000, "Delay to wake up UE_Thread_Rx (case 2)");*/
|
||||
// Not sure whether we should put the memory allocation here and not sure how much memory
|
||||
//we should allocate for each subframe cycle.
|
||||
UL_INFO = (UL_IND_t *)malloc(sizeof(UL_IND_t));
|
||||
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = (nfapi_rx_indication_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_rx_indication_pdu_t));
|
||||
UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0;
|
||||
UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = (nfapi_crc_indication_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_crc_indication_pdu_t));
|
||||
UL_INFO->crc_ind.crc_indication_body.number_of_crcs = 0;
|
||||
UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = (nfapi_harq_indication_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_harq_indication_pdu_t));
|
||||
UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0;
|
||||
UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = (nfapi_sr_indication_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_sr_indication_pdu_t));
|
||||
UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0;
|
||||
UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = (nfapi_cqi_indication_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_cqi_indication_pdu_t));
|
||||
UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = (nfapi_cqi_indication_raw_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_cqi_indication_raw_pdu_t));
|
||||
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0;
|
||||
|
||||
if (pthread_mutex_lock(&phy_stub_ticking->mutex_single_thread) != 0) {
|
||||
LOG_E( MAC, "[SCHED][UE] error locking mutex for ue_thread_id %d (mutex_single_thread)\n",ue_thread_id);
|
||||
@@ -1253,6 +1252,11 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
|
||||
UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0;
|
||||
}
|
||||
|
||||
if (UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis > 0) {
|
||||
oai_nfapi_cqi_indication(&UL_INFO->cqi_ind);
|
||||
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0;
|
||||
}
|
||||
|
||||
if(UL_INFO->harq_ind.harq_indication_body.number_of_harqs>0) {
|
||||
//LOG_D(MAC, "ul_config_req_UE_MAC 2.4, SFN/SF of PNF counter:%d.%d, number_of_harqs: %d \n", timer_frame, timer_subframe, UL_INFO->harq_ind.harq_indication_body.number_of_harqs);
|
||||
oai_nfapi_harq_indication(&UL_INFO->harq_ind);
|
||||
@@ -1267,30 +1271,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
|
||||
UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0;
|
||||
}
|
||||
|
||||
// Free UL_INFO messages
|
||||
//if(UL_INFO->crc_ind.crc_indication_body.crc_pdu_list != NULL){
|
||||
free(UL_INFO->crc_ind.crc_indication_body.crc_pdu_list);
|
||||
UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = NULL;
|
||||
//}
|
||||
//if(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list != NULL){
|
||||
free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list);
|
||||
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = NULL;
|
||||
//}
|
||||
//if(UL_INFO->harq_ind.harq_indication_body.harq_pdu_list !=NULL){
|
||||
free(UL_INFO->harq_ind.harq_indication_body.harq_pdu_list);
|
||||
UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = NULL;
|
||||
//}
|
||||
//if(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list!=NULL){
|
||||
free(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list);
|
||||
UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = NULL;
|
||||
//}
|
||||
free(UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list);
|
||||
UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = NULL;
|
||||
free(UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list);
|
||||
UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = NULL;
|
||||
free(UL_INFO);
|
||||
UL_INFO = NULL;
|
||||
|
||||
// De-allocate memory of nfapi requests copies before next subframe round
|
||||
if(dl_config_req!=NULL) {
|
||||
if(dl_config_req->vendor_extension!=NULL) {
|
||||
@@ -1308,6 +1288,13 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
|
||||
}
|
||||
|
||||
if(tx_request_pdu_list!=NULL) {
|
||||
for (int i = 0; i < tx_req_num_elems; i++) {
|
||||
for (int j = 0; j < tx_request_pdu_list[i].num_segments; j++) {
|
||||
free(tx_request_pdu_list[i].segments[j].segment_data);
|
||||
tx_request_pdu_list[i].segments[j].segment_data = NULL;
|
||||
}
|
||||
}
|
||||
tx_req_num_elems = 0;
|
||||
free(tx_request_pdu_list);
|
||||
tx_request_pdu_list = NULL;
|
||||
}
|
||||
@@ -1334,6 +1321,22 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
// Free UL_INFO messages
|
||||
free(UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list);
|
||||
UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = NULL;
|
||||
free(UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list);
|
||||
UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = NULL;
|
||||
free(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list);
|
||||
UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = NULL;
|
||||
free(UL_INFO->harq_ind.harq_indication_body.harq_pdu_list);
|
||||
UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = NULL;
|
||||
free(UL_INFO->crc_ind.crc_indication_body.crc_pdu_list);
|
||||
UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = NULL;
|
||||
free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list);
|
||||
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = NULL;
|
||||
free(UL_INFO);
|
||||
UL_INFO = NULL;
|
||||
|
||||
// thread finished
|
||||
free(arg);
|
||||
return &UE_thread_rxtx_retval;
|
||||
|
||||
Reference in New Issue
Block a user