Cleanup common_lib.h

This change reduces the number of dependecies of common_lib.h and simplifies
the task of implementing an external OAI radio library.
This commit is contained in:
Bartosz Podrygajlo
2026-03-31 11:50:35 +02:00
parent af4b0d53e9
commit e4d2d2b827
33 changed files with 77 additions and 50 deletions
+9 -1
View File
@@ -17,6 +17,9 @@
#include "common/utils/load_module_shlib.h"
#include "common/utils/LOG/log.h"
#include "executables/softmodem-common.h"
#include "common/config/config_paramdesc.h"
#include "common/config/config_userapi.h"
#include "common/cmake_defs.h"
#define MAX_GAP 100ULL
const char *const devtype_names[MAX_RF_DEV_TYPE] =
@@ -224,6 +227,9 @@ int openair0_write_reorder_common(nrue_ru_write_t nrue_ru_write,
ctx->nextTS = timestamp;
pthread_mutex_init(&ctx->mutex_write, NULL);
pthread_mutex_init(&ctx->mutex_store, NULL);
for (int i = 0; i < WRITE_QUEUE_SZ; i++) {
ctx->queue[i].txp = malloc(sizeof(void *) * NB_ANTENNAS_TX);
}
ctx->initDone = true;
}
if (pthread_mutex_trylock(&ctx->mutex_write) == 0) {
@@ -270,8 +276,10 @@ void openair0_write_reorder_clear_context(openair0_device_t *device)
LOG_E(HW, "write_reorder_clear_context call while still writing on the device\n");
pthread_mutex_destroy(&ctx->mutex_write);
pthread_mutex_lock(&ctx->mutex_store);
for (int i = 0; i < WRITE_QUEUE_SZ; i++)
for (int i = 0; i < WRITE_QUEUE_SZ; i++) {
ctx->queue[i].active = false;
free(ctx->queue[i].txp);
}
pthread_mutex_unlock(&ctx->mutex_store);
pthread_mutex_destroy(&ctx->mutex_store);
ctx->initDone = false;
+2 -20
View File
@@ -11,10 +11,8 @@
#include <stdint.h>
#include <stdio.h>
#include <sys/types.h>
#include "common/cmake_defs.h"
#include <openair1/PHY/TOOLS/tools_defs.h>
#include <stdbool.h>
#include "record_player.h"
#include "common/utils/threadPool/notified_fifo.h"
/* default name of shared library implementing the radio front end */
#define OAI_RF_LIBNAME "oai_device"
@@ -140,14 +138,6 @@ typedef enum {
TX_GPIO_CHANGE = 0x1000,
} radio_tx_gpio_flag_t;
/*! \brief Structure used for initializing UDP read threads */
typedef struct {
openair0_device_t *device;
int thread_id;
pthread_t pthread;
notifiedFIFO_t *resp;
} udp_ctx_t;
typedef enum {
RU_GPIO_CONTROL_NONE,
RU_GPIO_CONTROL_GENERIC,
@@ -351,7 +341,7 @@ typedef struct {
struct {
bool active;
openair0_timestamp_t timestamp;
void *txp[NB_ANTENNAS_TX];
void **txp;
int nsamps;
int nbAnt;
int flags;
@@ -393,9 +383,6 @@ struct openair0_device {
/*!brief pointer to FH state, used in ECPRI split 8*/
fhstate_t fhstate;
/*!brief UDP TX thread context*/
udp_ctx_t **utx;
/*!brief Used in ECPRI split 8 to indicate numerator of sampling rate ratio*/
int sampling_rate_ratio_n;
@@ -631,7 +618,6 @@ struct openair0_device {
void *(*get_internal_parameter)(char *id);
/* \brief timing statistics for TX fronthaul (ethernet)
*/
time_stats_t tx_fhaul;
re_order_t reOrder;
};
@@ -689,10 +675,6 @@ extern void iqrecorder_end(openair0_device_t *device);
int openair0_write_reorder(openair0_device_t *device, openair0_timestamp_t timestamp, void **txp, int nsamps, int nbAnt, int flags);
void openair0_write_reorder_clear_context(openair0_device_t *device);
#include <unistd.h>
#ifndef gettid
#define gettid() syscall(__NR_gettid)
#endif
/**@}*/
#ifdef __cplusplus
+2
View File
@@ -11,6 +11,8 @@
#include "assertions.h"
#include "common_lib.h"
#include "record_player.h"
#include "common/config/config_paramdesc.h"
#include "common/config/config_userapi.h"
/*! \brief read the oai recorder or player configuration, called from common device code
* \param recplay_conf: store parameters
-2
View File
@@ -9,8 +9,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "common/config/config_paramdesc.h"
#include "common/config/config_userapi.h"
#ifdef __cplusplus
extern "C"