remove duplicated function declaration in .c files, some code styles fixes

Signed-off-by: Laurent THOMAS <laurent.thomas@open-cells.com>
This commit is contained in:
Laurent THOMAS
2026-06-01 13:36:51 +02:00
parent 29251f7e5b
commit c54342881e
6 changed files with 52 additions and 53 deletions

View File

@@ -1533,7 +1533,8 @@ static void *ru_thread( void *param ) {
init_frame_parms(ru->frame_parms,1);
ru->frame_parms->nb_antennas_rx = ru->nb_rx;
if (ru->if_south == LOCAL_RF) openair0_device_load(&ru->rfdevice,&ru->openair0_cfg);
if (ru->if_south == LOCAL_RF)
openair0_device_load(&ru->rfdevice, &ru->openair0_cfg);
phy_init_RU(ru);

View File

@@ -498,16 +498,6 @@ int nrue_ru_write(PHY_VARS_NR_UE *UE, openair0_timestamp_t timestamp, void **buf
return ret;
}
typedef int (*nrue_ru_write_t)(PHY_VARS_NR_UE *UE, openair0_timestamp_t timestamp, void **txp, int nsamps, int nbAnt, int flags);
int openair0_write_reorder_common(nrue_ru_write_t nrue_ru_write,
PHY_VARS_NR_UE *UE,
openair0_device_t *device,
openair0_timestamp_t timestamp,
void **txp,
int nsamps,
int nbAnt,
int flags);
int nrue_ru_write_reorder(PHY_VARS_NR_UE *UE, openair0_timestamp_t timestamp, void **txp, int nsamps, int nbAnt, int flags)
{
openair0_device_t *device = &openair0_dev[UE->rf_map.card];

View File

@@ -562,10 +562,13 @@ void* ru_thread_control( void* param )
//if (ru->is_slave == 1) lte_sync_time_init(&ru->frame_parms);
if (ru->rfdevice.is_init != 1) openair0_device_load(&ru->rfdevice,&ru->openair0_cfg);
if (ru->rfdevice.is_init != 1)
openair0_device_load(&ru->rfdevice, &ru->openair0_cfg);
if (ru->rfdevice.trx_config_func) AssertFatal((ru->rfdevice.trx_config_func(&ru->rfdevice,&ru->openair0_cfg)==0),
"Failed to configure RF device for RU %d\n",ru->idx);
if (ru->rfdevice.trx_config_func)
AssertFatal((ru->rfdevice.trx_config_func(&ru->rfdevice, &ru->openair0_cfg) == 0),
"Failed to configure RF device for RU %d\n",
ru->idx);
if (setup_RU_buffers(ru)!=0) {
printf("Exiting, cannot initialize RU Buffers\n");

View File

@@ -32,46 +32,45 @@ const char *get_devname(int devtype) {
return "none";
}
int set_device(openair0_device_t *device)
static int set_device(openair0_device_t *device)
{
char *dev_type = device->host_type == RAU_HOST ? "RAU" : "RRU";
const char *devname = get_devname(device->type);
if (strcmp(devname,"none") != 0) {
LOG_I(HW,"[%s] has loaded %s device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"),devname);
} else {
LOG_E(HW,"[%s] invalid HW device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
return -1;
}
if (strcmp(devname, "none") != 0) {
LOG_I(HW, "[%s] has loaded %s device.\n", dev_type, devname);
return 0;
}
LOG_E(HW, "[%s] invalid HW device.\n", dev_type);
return -1;
}
int set_transport(openair0_device_t *device)
static int set_transport(openair0_device_t *device)
{
char *dev_type = device->host_type == RAU_HOST ? "RAU" : "RRU";
switch (device->transp_type) {
case ETHERNET_TP:
LOG_I(HW,"[%s] has loaded ETHERNET trasport protocol.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
LOG_I(HW, "[%s] has loaded ETHERNET trasport protocol.\n", dev_type);
return 0;
break;
case NONE_TP:
LOG_I(HW,"[%s] has not loaded a transport protocol.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
LOG_I(HW, "[%s] has not loaded a transport protocol.\n", dev_type);
return 0;
break;
default:
LOG_E(HW,"[%s] invalid transport protocol.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
LOG_E(HW, "[%s] invalid transport protocol.\n", dev_type);
return -1;
break;
}
}
typedef int (*devfunc_t)(openair0_device_t *, openair0_config_t *, eth_params_t *);
/* look for the interface library and load it */
int load_lib(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_params_t *cfg, uint8_t flag)
int load_lib(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_params_t *eth_cfg, rau_type_t rau_type)
{
openair0_cfg->command_line_sample_advance = get_softmodem_params()->command_line_sample_advance;
openair0_cfg->recplay_mode = read_recplayconfig(&(openair0_cfg->recplay_conf),&(device->recplay_state));
openair0_cfg->recplay_mode = read_recplayconfig(&openair0_cfg->recplay_conf, &device->recplay_state);
// softmodem has to know we use the iqrecorder to workaround randomized algorithms
IS_SOFTMODEM_IQRECORDER = openair0_cfg->recplay_mode == RECPLAY_RECORDMODE;
@@ -81,7 +80,7 @@ int load_lib(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_par
deflibname=OAI_IQPLAYER_LIBNAME;
IS_SOFTMODEM_IQPLAYER = true; // softmodem has to know we use the iqplayer to workaround randomized algorithms
} else {
switch (flag) {
switch (rau_type) {
case RAU_LOCAL_RADIO_HEAD:
if (IS_SOFTMODEM_RFSIM)
deflibname = OAI_RFSIM_LIBNAME;
@@ -90,9 +89,12 @@ int load_lib(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_par
deflibname = OAI_THIRDPARTY_TP_LIBNAME;
shlib_fdesc.fname = "transport_init";
break;
default:
case RAU_REMOTE_RADIO_HEAD:
deflibname = OAI_TP_LIBNAME;
shlib_fdesc.fname = "transport_init";
break;
default:
AssertFatal(false, "impossible radio head\n");
}
}
@@ -101,10 +103,9 @@ int load_lib(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_par
config_get(config_get_if(), &device_params, 1, DEVICE_SECTION);
int ret = load_module_shlib(devname, &shlib_fdesc, 1, NULL);
AssertFatal( (ret >= 0),
"Library %s couldn't be loaded\n",devname);
return ((devfunc_t)shlib_fdesc.fptr)(device,openair0_cfg,cfg);
AssertFatal(ret >= 0, "Library %s couldn't be loaded\n", devname);
typedef int (*devfunc_t)(openair0_device_t *, openair0_config_t *, eth_params_t *);
return ((devfunc_t)shlib_fdesc.fptr)(device, openair0_cfg, eth_cfg);
}
int openair0_device_load(openair0_device_t *device, openair0_config_t *openair0_cfg)
@@ -117,9 +118,9 @@ int openair0_device_load(openair0_device_t *device, openair0_config_t *openair0_
LOG_E(HW, "%s %d:Unsupported radio head\n", __FILE__, __LINE__);
return -1;
}
} else
} else {
AssertFatal(false, "can't open the radio device: %s\n", get_devname(device->type));
}
pthread_mutex_init(&device->reOrder.mutex_store, NULL);
pthread_mutex_init(&device->reOrder.mutex_write, NULL);
return rc;
@@ -127,8 +128,7 @@ int openair0_device_load(openair0_device_t *device, openair0_config_t *openair0_
int openair0_transport_load(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params)
{
int rc;
rc=load_lib(device, openair0_cfg, eth_params, RAU_REMOTE_RADIO_HEAD);
int rc = load_lib(device, openair0_cfg, eth_params, RAU_REMOTE_RADIO_HEAD);
if ( rc >= 0) {
if ( set_transport(device) < 0) {
@@ -161,9 +161,6 @@ static void writerEnqueue(re_order_t *ctx, openair0_timestamp_t timestamp, void
pthread_mutex_unlock(&ctx->mutex_store);
}
typedef struct PHY_VARS_NR_UE_s PHY_VARS_NR_UE;
typedef int (*nrue_ru_write_t)(PHY_VARS_NR_UE *UE, openair0_timestamp_t timestamp, void **txp, int nsamps, int nbAnt, int flags);
static void writerProcessWaitingQueue(nrue_ru_write_t nrue_ru_write, PHY_VARS_NR_UE *UE, openair0_device_t *device)
{
bool found = false;

View File

@@ -26,9 +26,8 @@
#define OAI_IQPLAYER_LIBNAME "oai_iqplayer"
/* flags for BBU to determine whether the attached radio head is local or remote */
#define RAU_LOCAL_RADIO_HEAD 0
#define RAU_REMOTE_RADIO_HEAD 1
#define RAU_REMOTE_THIRDPARTY_RADIO_HEAD 2
typedef enum { RAU_LOCAL_RADIO_HEAD, RAU_REMOTE_RADIO_HEAD, RAU_REMOTE_THIRDPARTY_RADIO_HEAD } rau_type_t;
#define MAX_WRITE_THREAD_PACKAGE 10
#define MAX_WRITE_THREAD_BUFFER_SIZE 8
#define MAX_CARDS 10
@@ -639,7 +638,18 @@ extern "C"
{
#endif
int load_lib(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_params_t *eth_cfg, rau_type_t rau_type);
typedef struct PHY_VARS_NR_UE_s PHY_VARS_NR_UE;
typedef int (*nrue_ru_write_t)(PHY_VARS_NR_UE *UE, openair0_timestamp_t timestamp, void **txp, int nsamps, int nbAnt, int flags);
int openair0_write_reorder_common(nrue_ru_write_t nrue_ru_write,
PHY_VARS_NR_UE *UE,
openair0_device_t *device,
openair0_timestamp_t timestamp,
void **txp,
int nsamps,
int nbAnt,
int flags);
#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"
/*! \brief get device name from device type */

View File

@@ -28,8 +28,6 @@ int num_devices_eth = 0;
struct sockaddr_in dest_addr[MAX_INST];
int dest_addr_len[MAX_INST];
int load_lib(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_params_t *cfg, uint8_t flag);
int trx_eth_start(openair0_device_t *device)
{
eth_state_t *eth = (eth_state_t*)device->priv;
@@ -452,8 +450,8 @@ int transport_init(openair0_device_t *device, openair0_config_t *openair0_cfg, e
eth->flags = eth_params->transp_preference;
// load third-party driver
if (eth->flags == ETH_UDP_IF5_ECPRI_MODE) load_lib(device,openair0_cfg,eth_params,RAU_REMOTE_THIRDPARTY_RADIO_HEAD);
if (eth->flags == ETH_UDP_IF5_ECPRI_MODE)
load_lib(device, openair0_cfg, eth_params, RAU_REMOTE_THIRDPARTY_RADIO_HEAD);
if (eth_params->if_compress == 0) {
eth->compression = NO_COMPRESS;