move ldpc coder/decoder into a shared lib dymically loaded. Also fix a record player bug

This commit is contained in:
frtabu
2020-03-11 17:32:13 +01:00
parent 6c8938d584
commit 8928cfe57d
30 changed files with 888 additions and 1062 deletions
+21 -14
View File
@@ -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);
}
+18
View File
@@ -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 */
+1 -14
View File
@@ -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
+12 -2
View File
@@ -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;
+3 -1
View File
@@ -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;
}