Merge remote-tracking branch 'origin/nr_ue_multiple_rf' into integration_2026_w05 (!3593)
NR UE: add support for multiple RF frontends
This MR adds basic support for multiple RF-frontends at the UE.
There are multiple reasons why we might want this:
1. There might be different antennas needed for different bands (e.g. NTN or
TN antennas). These antennas might be connected to different RF-frontends.
In case of Handover, the UE needs to dynamically switch between these
RF-frontends.
2. Each rf-simulator connection carries baseband I/Q samples. To be able to
perform a handover between two cells at different frequencies, there must
be two rf-simulator connections, as the baseband channels should not
interfere and thus cannot simply be added.
3. When we want to support multiple UE simulation within one instance of
nr-uesoftmodem, and allow multiple cells and probably even handover between
these cells, we need either:
1. dedicated RF-frontends for each simulated UE, or
2. dedicated RF-frontends for each connected cell and dynamically assign
simulated UEs accordingly.
This MR implements what is needed for 1., 2. and 3.1.
This commit is contained in:
+10
-13
@@ -212,8 +212,8 @@ void cb(void * userData, ORI_IndicationType_e type, ORI_IndicationValue_u value)
|
||||
printf("<============\n");
|
||||
}
|
||||
|
||||
int aw2s_oricleanup(openair0_device *device) {
|
||||
|
||||
int aw2s_oricleanup(openair0_device_t *device)
|
||||
{
|
||||
ORI_s * ori = (ORI_s*)device->thirdparty_priv;
|
||||
|
||||
ORI_Disconnect(ori);
|
||||
@@ -222,8 +222,8 @@ int aw2s_oricleanup(openair0_device *device) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
int aw2s_startstreaming(openair0_device *device) {
|
||||
|
||||
int aw2s_startstreaming(openair0_device_t *device)
|
||||
{
|
||||
ORI_s * ori = (ORI_s*)device->thirdparty_priv;
|
||||
ORI_Result_e result;
|
||||
ORI_Result_e RE_result;
|
||||
@@ -413,9 +413,8 @@ int aw2s_startstreaming(openair0_device *device) {
|
||||
printf("ORI_ObjectStateModify: %s\n", ORI_Result_Print(RE_result));
|
||||
}
|
||||
|
||||
device->fhstate.active=1;
|
||||
return(0);
|
||||
|
||||
device->fhstate.active = 1;
|
||||
return (0);
|
||||
}
|
||||
|
||||
uint32_t to_nrarfcn(int nr_bandP,
|
||||
@@ -423,9 +422,8 @@ uint32_t to_nrarfcn(int nr_bandP,
|
||||
uint8_t scs_index,
|
||||
uint32_t bw);
|
||||
|
||||
int aw2s_oriinit(openair0_device *device) {
|
||||
|
||||
|
||||
int aw2s_oriinit(openair0_device_t *device)
|
||||
{
|
||||
ORI_s * ori;
|
||||
ORI_Result_e result;
|
||||
ORI_Result_e RE_result;
|
||||
@@ -892,9 +890,8 @@ int aw2s_oriinit(openair0_device *device) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t * eth_params ) {
|
||||
|
||||
int transport_init(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params)
|
||||
{
|
||||
printf("Initializing AW2S (%p,%p,%p)\n",aw2s_oriinit,aw2s_oricleanup,aw2s_startstreaming);
|
||||
device->thirdparty_init = aw2s_oriinit;
|
||||
device->thirdparty_cleanup = aw2s_oricleanup;
|
||||
|
||||
+16
-28
@@ -46,7 +46,7 @@ int num_devices=0;
|
||||
* \param device RF frontend parameters set by application
|
||||
* \returns 0 on success
|
||||
*/
|
||||
int trx_brf_init(openair0_device *device)
|
||||
int trx_brf_init(openair0_device_t *device)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -57,8 +57,7 @@ int trx_brf_init(openair0_device *device)
|
||||
*\param module the bladeRf module
|
||||
*\returns timestamp of BladeRF
|
||||
*/
|
||||
openair0_timestamp trx_get_timestamp(openair0_device *device,
|
||||
bladerf_module module)
|
||||
openair0_timestamp_t trx_get_timestamp(openair0_device_t *device, bladerf_module module)
|
||||
{
|
||||
int status;
|
||||
struct bladerf_metadata meta;
|
||||
@@ -78,7 +77,7 @@ openair0_timestamp trx_get_timestamp(openair0_device *device,
|
||||
* \param device the hardware to use
|
||||
* \returns 0 on success
|
||||
*/
|
||||
int trx_brf_start(openair0_device *device)
|
||||
int trx_brf_start(openair0_device_t *device)
|
||||
{
|
||||
brf_state_t *brf = (brf_state_t*)device->priv;
|
||||
int status;
|
||||
@@ -127,12 +126,7 @@ int trx_brf_start(openair0_device *device)
|
||||
\param flags Ignored for the moment
|
||||
\returns 0 on success
|
||||
*/
|
||||
static int trx_brf_write(openair0_device *device,
|
||||
openair0_timestamp ptimestamp,
|
||||
void **buff,
|
||||
int nsamps,
|
||||
int cc,
|
||||
int flags)
|
||||
static int trx_brf_write(openair0_device_t *device, openair0_timestamp_t ptimestamp, void **buff, int nsamps, int cc, int flags)
|
||||
{
|
||||
int status;
|
||||
brf_state_t *brf = (brf_state_t*)device->priv;
|
||||
@@ -185,11 +179,7 @@ static int trx_brf_write(openair0_device *device,
|
||||
* \param cc Index of component carrier
|
||||
* \returns number of samples read
|
||||
*/
|
||||
static int trx_brf_read(openair0_device *device,
|
||||
openair0_timestamp *ptimestamp,
|
||||
void **buff,
|
||||
int nsamps,
|
||||
int cc)
|
||||
static int trx_brf_read(openair0_device_t *device, openair0_timestamp_t *ptimestamp, void **buff, int nsamps, int cc)
|
||||
{
|
||||
int status=0;
|
||||
brf_state_t *brf = (brf_state_t*)device->priv;
|
||||
@@ -235,7 +225,7 @@ static int trx_brf_read(openair0_device *device,
|
||||
/*! \brief Terminate operation of the BladeRF transceiver -- free all associated resources
|
||||
* \param device the hardware to use
|
||||
*/
|
||||
void trx_brf_end(openair0_device *device)
|
||||
void trx_brf_end(openair0_device_t *device)
|
||||
{
|
||||
int status;
|
||||
brf_state_t *brf = (brf_state_t*)device->priv;
|
||||
@@ -255,7 +245,7 @@ void trx_brf_end(openair0_device *device)
|
||||
* \param device the hardware to use
|
||||
* \returns 0 on success
|
||||
*/
|
||||
int trx_brf_get_stats(openair0_device* device)
|
||||
int trx_brf_get_stats(openair0_device_t *device)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
@@ -265,7 +255,7 @@ int trx_brf_get_stats(openair0_device* device)
|
||||
* \param device the hardware to use
|
||||
* \returns 0 on success
|
||||
*/
|
||||
int trx_brf_reset_stats(openair0_device* device)
|
||||
int trx_brf_reset_stats(openair0_device_t *device)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
@@ -275,7 +265,7 @@ int trx_brf_reset_stats(openair0_device* device)
|
||||
* \param card the hardware to use
|
||||
* \returns 0 in success
|
||||
*/
|
||||
int trx_brf_stop(openair0_device* device)
|
||||
int trx_brf_stop(openair0_device_t *device)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
@@ -286,7 +276,7 @@ int trx_brf_stop(openair0_device* device)
|
||||
* \param openair0_cfg1 openair0 Config structure (ignored. It is there to comply with RF common API)
|
||||
* \returns 0 in success
|
||||
*/
|
||||
int trx_brf_set_freq(openair0_device* device, openair0_config_t *openair0_cfg1)
|
||||
int trx_brf_set_freq(openair0_device_t *device, openair0_config_t *openair0_cfg1)
|
||||
{
|
||||
int status;
|
||||
brf_state_t *brf = (brf_state_t *)device->priv;
|
||||
@@ -315,12 +305,11 @@ int trx_brf_set_freq(openair0_device* device, openair0_config_t *openair0_cfg1)
|
||||
* \param openair0_cfg openair0 Config structure
|
||||
* \returns 0 in success
|
||||
*/
|
||||
int trx_brf_set_gains(openair0_device* device,
|
||||
openair0_config_t *openair0_cfg)
|
||||
int trx_brf_set_gains(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
int trx_brf_write_init(openair0_device *device)
|
||||
int trx_brf_write_init(openair0_device_t *device)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -368,13 +357,13 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg,
|
||||
/*! \brief Calibrate LMSSDR RF
|
||||
* \param device the hardware to use
|
||||
*/
|
||||
void calibrate_rf(openair0_device *device)
|
||||
void calibrate_rf(openair0_device_t *device)
|
||||
{
|
||||
/* TODO: this function does not seem to work. Disabled until fixed. */
|
||||
return;
|
||||
|
||||
brf_state_t *brf = (brf_state_t *)device->priv;
|
||||
openair0_timestamp ptimestamp;
|
||||
openair0_timestamp_t ptimestamp;
|
||||
int16_t *calib_buffp,*calib_tx_buffp;
|
||||
int16_t calib_buff[2*RXDCLENGTH];
|
||||
int16_t calib_tx_buff[2*RXDCLENGTH];
|
||||
@@ -948,8 +937,7 @@ void calibrate_rf(openair0_device *device)
|
||||
* \param openair0_cfg RF frontend parameters set by application
|
||||
* \returns 0 on success
|
||||
*/
|
||||
int device_init(openair0_device *device,
|
||||
openair0_config_t *openair0_cfg)
|
||||
int device_init(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
int status;
|
||||
brf_state_t *brf = (brf_state_t*)malloc(sizeof(brf_state_t));
|
||||
@@ -1138,7 +1126,7 @@ int device_init(openair0_device *device,
|
||||
*/
|
||||
bladerf_log_set_verbosity(BLADERF_LOG_LEVEL_INFO);
|
||||
|
||||
printf("BLADERF: Initializing openair0_device\n");
|
||||
printf("BLADERF: Initializing openair0_device_t\n");
|
||||
device->Mod_id = num_devices++;
|
||||
device->type = BLADERF_DEV;
|
||||
device->trx_start_func = trx_brf_start;
|
||||
|
||||
@@ -94,7 +94,7 @@ typedef struct {
|
||||
//! number of RX count
|
||||
uint64_t rx_count;
|
||||
//! timestamp of RX packet
|
||||
openair0_timestamp rx_timestamp;
|
||||
openair0_timestamp_t rx_timestamp;
|
||||
|
||||
} brf_state_t;
|
||||
/*
|
||||
@@ -103,13 +103,13 @@ typedef struct {
|
||||
/*! \brief BladeRF Init function (not used at the moment)
|
||||
* \param device RF frontend parameters set by application
|
||||
*/
|
||||
int trx_brf_init(openair0_device *device);
|
||||
int trx_brf_init(openair0_device_t *device);
|
||||
|
||||
/*! \brief get current timestamp
|
||||
*\param device the hardware to use
|
||||
*\param module the bladeRf module
|
||||
*/
|
||||
openair0_timestamp trx_get_timestamp(openair0_device *device, bladerf_module module);
|
||||
openair0_timestamp_t trx_get_timestamp(openair0_device_t *device, bladerf_module module);
|
||||
|
||||
/*! \brief bladeRF error report
|
||||
* \param status
|
||||
|
||||
+39
-26
@@ -53,7 +53,7 @@ const char *get_devname(int devtype) {
|
||||
return "none";
|
||||
}
|
||||
|
||||
int set_device(openair0_device *device)
|
||||
int set_device(openair0_device_t *device)
|
||||
{
|
||||
const char *devname = get_devname(device->type);
|
||||
if (strcmp(devname,"none") != 0) {
|
||||
@@ -65,7 +65,7 @@ int set_device(openair0_device *device)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int set_transport(openair0_device *device)
|
||||
int set_transport(openair0_device_t *device)
|
||||
{
|
||||
switch (device->transp_type) {
|
||||
case ETHERNET_TP:
|
||||
@@ -85,14 +85,10 @@ int set_transport(openair0_device *device)
|
||||
}
|
||||
}
|
||||
|
||||
typedef int(*devfunc_t)(openair0_device *, openair0_config_t *, eth_params_t *);
|
||||
|
||||
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 *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 *cfg, uint8_t flag)
|
||||
{
|
||||
loader_shlibfunc_t shlib_fdesc[1];
|
||||
int ret=0;
|
||||
@@ -139,9 +135,7 @@ int load_lib(openair0_device *device,
|
||||
return ((devfunc_t)shlib_fdesc[0].fptr)(device,openair0_cfg,cfg);
|
||||
}
|
||||
|
||||
|
||||
int openair0_device_load(openair0_device *device,
|
||||
openair0_config_t *openair0_cfg)
|
||||
int openair0_device_load(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
int rc=0;
|
||||
rc=load_lib(device, openair0_cfg, NULL,RAU_LOCAL_RADIO_HEAD );
|
||||
@@ -157,10 +151,7 @@ int openair0_device_load(openair0_device *device,
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
int openair0_transport_load(openair0_device *device,
|
||||
openair0_config_t *openair0_cfg,
|
||||
eth_params_t *eth_params)
|
||||
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);
|
||||
@@ -175,7 +166,7 @@ int openair0_transport_load(openair0_device *device,
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void writerEnqueue(re_order_t *ctx, openair0_timestamp timestamp, void **txp, int nsamps, int nbAnt, int flags)
|
||||
static void writerEnqueue(re_order_t *ctx, openair0_timestamp_t timestamp, void **txp, int nsamps, int nbAnt, int flags)
|
||||
{
|
||||
pthread_mutex_lock(&ctx->mutex_store);
|
||||
LOG_D(HW, "Enqueue write for TS: %lu\n", timestamp);
|
||||
@@ -196,7 +187,10 @@ static void writerEnqueue(re_order_t *ctx, openair0_timestamp timestamp, void **
|
||||
pthread_mutex_unlock(&ctx->mutex_store);
|
||||
}
|
||||
|
||||
static void writerProcessWaitingQueue(openair0_device *device)
|
||||
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;
|
||||
re_order_t *ctx = &device->reOrder;
|
||||
@@ -205,7 +199,7 @@ static void writerProcessWaitingQueue(openair0_device *device)
|
||||
pthread_mutex_lock(&ctx->mutex_store);
|
||||
for (int i = 0; i < WRITE_QUEUE_SZ; i++) {
|
||||
if (ctx->queue[i].active && llabs(ctx->queue[i].timestamp - ctx->nextTS) < MAX_GAP) {
|
||||
openair0_timestamp timestamp = ctx->queue[i].timestamp;
|
||||
openair0_timestamp_t timestamp = ctx->queue[i].timestamp;
|
||||
LOG_D(HW, "Dequeue write for TS: %lu\n", timestamp);
|
||||
int nsamps = ctx->queue[i].nsamps;
|
||||
int nbAnt = ctx->queue[i].nbAnt;
|
||||
@@ -218,7 +212,11 @@ static void writerProcessWaitingQueue(openair0_device *device)
|
||||
pthread_mutex_unlock(&ctx->mutex_store);
|
||||
found = true;
|
||||
if (flags || IS_SOFTMODEM_RFSIM) {
|
||||
int wroteSamples = device->trx_write_func(device, timestamp, txp, nsamps, nbAnt, flags);
|
||||
int wroteSamples;
|
||||
if (nrue_ru_write)
|
||||
wroteSamples = nrue_ru_write(UE, timestamp, txp, nsamps, nbAnt, flags);
|
||||
else
|
||||
wroteSamples = device->trx_write_func(device, timestamp, txp, nsamps, nbAnt, flags);
|
||||
if (wroteSamples != nsamps)
|
||||
LOG_E(HW, "Failed to write to rf\n");
|
||||
}
|
||||
@@ -235,7 +233,14 @@ static void writerProcessWaitingQueue(openair0_device *device)
|
||||
// but to make zerocopy and agnostic design, we need to make a proper ring buffer with mutex protection
|
||||
// mutex (or atomic flags) will be mandatory because this out order system root cause is there are several writer threads
|
||||
|
||||
int openair0_write_reorder(openair0_device *device, openair0_timestamp 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 wroteSamples = 0;
|
||||
re_order_t *ctx = &device->reOrder;
|
||||
@@ -249,28 +254,36 @@ int openair0_write_reorder(openair0_device *device, openair0_timestamp timestamp
|
||||
if (pthread_mutex_trylock(&ctx->mutex_write) == 0) {
|
||||
// We have the write exclusivity
|
||||
if (llabs(timestamp - ctx->nextTS) < MAX_GAP) { // We are writing in sequence of the previous write
|
||||
if (flags || IS_SOFTMODEM_RFSIM)
|
||||
wroteSamples = device->trx_write_func(device, timestamp, txp, nsamps, nbAnt, flags);
|
||||
else
|
||||
if (flags || IS_SOFTMODEM_RFSIM) {
|
||||
if (nrue_ru_write)
|
||||
wroteSamples = nrue_ru_write(UE, timestamp, txp, nsamps, nbAnt, flags);
|
||||
else
|
||||
wroteSamples = device->trx_write_func(device, timestamp, txp, nsamps, nbAnt, flags);
|
||||
} else
|
||||
wroteSamples = nsamps;
|
||||
ctx->nextTS = timestamp + nsamps;
|
||||
|
||||
} else {
|
||||
writerEnqueue(ctx, timestamp, txp, nsamps, nbAnt, flags);
|
||||
}
|
||||
writerProcessWaitingQueue(device);
|
||||
writerProcessWaitingQueue(nrue_ru_write, UE, device);
|
||||
pthread_mutex_unlock(&ctx->mutex_write);
|
||||
return wroteSamples ? wroteSamples : nsamps;
|
||||
}
|
||||
writerEnqueue(ctx, timestamp, txp, nsamps, nbAnt, flags);
|
||||
if (pthread_mutex_trylock(&ctx->mutex_write) == 0) {
|
||||
writerProcessWaitingQueue(device);
|
||||
writerProcessWaitingQueue(nrue_ru_write, UE, device);
|
||||
pthread_mutex_unlock(&ctx->mutex_write);
|
||||
}
|
||||
return nsamps;
|
||||
}
|
||||
|
||||
void openair0_write_reorder_clear_context(openair0_device *device)
|
||||
int openair0_write_reorder(openair0_device_t *device, openair0_timestamp_t timestamp, void **txp, int nsamps, int nbAnt, int flags)
|
||||
{
|
||||
return openair0_write_reorder_common(NULL, NULL, device, timestamp, txp, nsamps, nbAnt, flags);
|
||||
}
|
||||
|
||||
void openair0_write_reorder_clear_context(openair0_device_t *device)
|
||||
{
|
||||
LOG_I(HW, "received write reorder clear context\n");
|
||||
re_order_t *ctx = &device->reOrder;
|
||||
|
||||
+71
-68
@@ -56,14 +56,13 @@
|
||||
#define RAU_REMOTE_THIRDPARTY_RADIO_HEAD 2
|
||||
#define MAX_WRITE_THREAD_PACKAGE 10
|
||||
#define MAX_WRITE_THREAD_BUFFER_SIZE 8
|
||||
#define MAX_CARDS 8
|
||||
|
||||
typedef int64_t openair0_timestamp;
|
||||
typedef volatile int64_t openair0_vtimestamp;
|
||||
#define MAX_CARDS 10
|
||||
|
||||
typedef int64_t openair0_timestamp_t;
|
||||
typedef volatile int64_t openair0_vtimestamp_t;
|
||||
|
||||
/*!\brief structure holds the parameters to configure USRP devices*/
|
||||
typedef struct openair0_device_t openair0_device;
|
||||
typedef struct openair0_device openair0_device_t;
|
||||
|
||||
//#define USRP_GAIN_OFFSET (56.0) // 86 calibrated for USRP B210 @ 2.6 GHz to get equivalent RS EPRE in OAI to SMBV100 output
|
||||
|
||||
@@ -167,7 +166,7 @@ typedef enum {
|
||||
|
||||
/*! \brief Structure used for initializing UDP read threads */
|
||||
typedef struct {
|
||||
openair0_device *device;
|
||||
openair0_device_t *device;
|
||||
int thread_id;
|
||||
pthread_t pthread;
|
||||
notifiedFIFO_t *resp;
|
||||
@@ -213,6 +212,8 @@ typedef struct split7_config {
|
||||
typedef struct openair0_config {
|
||||
//! Module ID for this configuration
|
||||
int Mod_id;
|
||||
//! RU ID of this device
|
||||
int ru_id;
|
||||
//! duplexing mode
|
||||
duplex_mode_t duplex_mode;
|
||||
//! number of downlink resource blocks
|
||||
@@ -278,23 +279,11 @@ typedef struct openair0_config {
|
||||
int autocal[8];
|
||||
//! Configuration file for LMS7002M
|
||||
char *configFilename;
|
||||
//! remote IP/MAC addr for Ethernet interface
|
||||
char *remote_addr;
|
||||
//! remote port number for Ethernet interface
|
||||
unsigned int remote_port;
|
||||
//! local IP/MAC addr for Ethernet interface (eNB/BBU, UE)
|
||||
char *my_addr;
|
||||
//! local port number for Ethernet interface (eNB/BBU, UE)
|
||||
unsigned int my_port;
|
||||
//! record player configuration, definition in record_player.h
|
||||
uint32_t recplay_mode;
|
||||
recplay_conf_t *recplay_conf;
|
||||
//! number of samples per tti
|
||||
unsigned int samples_per_tti;
|
||||
//! the sample rate for receive.
|
||||
double rx_sample_rate;
|
||||
//! the sample rate for transmit.
|
||||
double tx_sample_rate;
|
||||
//! Flag to indicate this configuration is for NR
|
||||
int nr_flag;
|
||||
//! NR band number
|
||||
@@ -317,8 +306,7 @@ typedef struct {
|
||||
int card;
|
||||
//! rf chain id
|
||||
int chain;
|
||||
} openair0_rf_map;
|
||||
|
||||
} openair0_rf_map_t;
|
||||
|
||||
typedef struct {
|
||||
char *remote_addr;
|
||||
@@ -350,7 +338,7 @@ typedef struct {
|
||||
} if_buffer_t;
|
||||
|
||||
typedef struct {
|
||||
openair0_timestamp timestamp;
|
||||
openair0_timestamp_t timestamp;
|
||||
void *buff[MAX_WRITE_THREAD_BUFFER_SIZE];// buffer to be write;
|
||||
int nsamps;
|
||||
int cc;
|
||||
@@ -378,11 +366,11 @@ typedef struct {
|
||||
} openair0_thread_t;
|
||||
|
||||
typedef struct fhstate_s {
|
||||
openair0_timestamp TS[8];
|
||||
openair0_timestamp TS0;
|
||||
openair0_timestamp olddeltaTS[8];
|
||||
openair0_timestamp oldTS[8];
|
||||
openair0_timestamp TS_read;
|
||||
openair0_timestamp_t TS[8];
|
||||
openair0_timestamp_t TS0;
|
||||
openair0_timestamp_t olddeltaTS[8];
|
||||
openair0_timestamp_t oldTS[8];
|
||||
openair0_timestamp_t TS_read;
|
||||
int first_read;
|
||||
uint32_t *buff[8];
|
||||
uint32_t buff_size;
|
||||
@@ -395,10 +383,10 @@ typedef struct {
|
||||
bool initDone;
|
||||
pthread_mutex_t mutex_write;
|
||||
pthread_mutex_t mutex_store;
|
||||
openair0_timestamp nextTS;
|
||||
openair0_timestamp_t nextTS;
|
||||
struct {
|
||||
bool active;
|
||||
openair0_timestamp timestamp;
|
||||
openair0_timestamp_t timestamp;
|
||||
void *txp[NB_ANTENNAS_TX];
|
||||
int nsamps;
|
||||
int nbAnt;
|
||||
@@ -407,7 +395,7 @@ typedef struct {
|
||||
} re_order_t;
|
||||
|
||||
/*!\brief structure holds the parameters to configure USRP devices */
|
||||
struct openair0_device_t {
|
||||
struct openair0_device {
|
||||
/*!tx write thread*/
|
||||
openair0_thread_t write_thread;
|
||||
|
||||
@@ -429,6 +417,12 @@ struct openair0_device_t {
|
||||
/* !brief RF frontend parameters set by application */
|
||||
openair0_config_t *openair0_cfg;
|
||||
|
||||
/* !brief timestamp of first read */
|
||||
openair0_timestamp_t firstTS;
|
||||
|
||||
/* !brief flag indicating that firstTS was initialized */
|
||||
bool firstTS_initialized;
|
||||
|
||||
/* !brief ETH params set by application */
|
||||
eth_params_t *eth_params;
|
||||
//! record player data, definition in record_player.h
|
||||
@@ -463,28 +457,27 @@ struct openair0_device_t {
|
||||
/*! \brief Called to start the transceiver. Return 0 if OK, < 0 if error
|
||||
@param device pointer to the device structure specific to the RF hardware target
|
||||
*/
|
||||
int (*trx_start_func)(openair0_device *device);
|
||||
int (*trx_start_func)(openair0_device_t *device);
|
||||
|
||||
/*! \brief Called to configure the device
|
||||
@param device pointer to the device structure specific to the RF hardware target
|
||||
*/
|
||||
/*! \brief Called to configure the device
|
||||
@param device pointer to the device structure specific to the RF hardware target
|
||||
*/
|
||||
|
||||
|
||||
int (*trx_config_func)(openair0_device* device, openair0_config_t *openair0_cfg);
|
||||
int (*trx_config_func)(openair0_device_t *device, openair0_config_t *openair0_cfg);
|
||||
|
||||
/*! \brief Called to send a request message between RAU-RRU on control port
|
||||
@param device pointer to the device structure specific to the RF hardware target
|
||||
@param msg pointer to the message structure passed between RAU-RRU
|
||||
@param msg_len length of the message
|
||||
*/
|
||||
int (*trx_ctlsend_func)(openair0_device *device, void *msg, ssize_t msg_len);
|
||||
int (*trx_ctlsend_func)(openair0_device_t *device, void *msg, ssize_t msg_len);
|
||||
|
||||
/*! \brief Called to receive a reply message between RAU-RRU on control port
|
||||
@param device pointer to the device structure specific to the RF hardware target
|
||||
@param msg pointer to the message structure passed between RAU-RRU
|
||||
@param msg_len length of the message
|
||||
*/
|
||||
int (*trx_ctlrecv_func)(openair0_device *device, void *msg, ssize_t msg_len);
|
||||
int (*trx_ctlrecv_func)(openair0_device_t *device, void *msg, ssize_t msg_len);
|
||||
|
||||
/*! \brief Called to send samples to the RF target
|
||||
@param device pointer to the device structure specific to the RF hardware target
|
||||
@@ -495,8 +488,8 @@ struct openair0_device_t {
|
||||
@param num_beams number of beams
|
||||
@param flags flags must be set to true if timestamp parameter needs to be applied
|
||||
*/
|
||||
int (*trx_write_beams_func)(openair0_device *device,
|
||||
openair0_timestamp timestamp,
|
||||
int (*trx_write_beams_func)(openair0_device_t *device,
|
||||
openair0_timestamp_t timestamp,
|
||||
void ***buff,
|
||||
int nsamps,
|
||||
int nb_antennas_tx,
|
||||
@@ -511,7 +504,12 @@ struct openair0_device_t {
|
||||
@param nb_antennas_tx number of antennas
|
||||
@param flags flags must be set to true if timestamp parameter needs to be applied
|
||||
*/
|
||||
int (*trx_write_func)(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int nb_antennas_tx, int flags);
|
||||
int (*trx_write_func)(openair0_device_t *device,
|
||||
openair0_timestamp_t timestamp,
|
||||
void **buff,
|
||||
int nsamps,
|
||||
int nb_antennas_tx,
|
||||
int flags);
|
||||
|
||||
/*! \brief Called to send samples to the RF target
|
||||
@param device pointer to the device structure specific to the RF hardware target
|
||||
@@ -520,7 +518,13 @@ struct openair0_device_t {
|
||||
@param nsamps number of samples to be sent
|
||||
@param flags flags must be set to true if timestamp parameter needs to be applied
|
||||
*/
|
||||
int (*trx_write_func2)(openair0_device *device, openair0_timestamp timestamp, void **buff, int fd_ind,int nsamps, int flags,int nant);
|
||||
int (*trx_write_func2)(openair0_device_t *device,
|
||||
openair0_timestamp_t timestamp,
|
||||
void **buff,
|
||||
int fd_ind,
|
||||
int nsamps,
|
||||
int flags,
|
||||
int nant);
|
||||
|
||||
/*! \brief Receive samples from hardware.
|
||||
* Read nsamps samples from each channel to buffers. buff[0] is the array for
|
||||
@@ -533,7 +537,7 @@ struct openair0_device_t {
|
||||
* antennas from which to receive samples \returns the number of sample read
|
||||
*/
|
||||
|
||||
int (*trx_read_func)(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int num_antennas);
|
||||
int (*trx_read_func)(openair0_device_t *device, openair0_timestamp_t *ptimestamp, void **buff, int nsamps, int num_antennas);
|
||||
|
||||
/*! \brief Receive samples from hardware.
|
||||
* Read nsamps samples from each channel to buffers. buff[0] is the array for
|
||||
@@ -548,8 +552,8 @@ struct openair0_device_t {
|
||||
* \param num_beams number of beams from which to receive samples
|
||||
* \returns the number of sample read
|
||||
*/
|
||||
int (*trx_read_beams_func)(openair0_device *device,
|
||||
openair0_timestamp *ptimestamp,
|
||||
int (*trx_read_beams_func)(openair0_device_t *device,
|
||||
openair0_timestamp_t *ptimestamp,
|
||||
void ***buff,
|
||||
int nsamps,
|
||||
int num_antennas,
|
||||
@@ -567,28 +571,28 @@ struct openair0_device_t {
|
||||
* \param antenna_id Index of antenna from which samples were received
|
||||
* \returns the number of sample read
|
||||
*/
|
||||
int (*trx_read_func2)(openair0_device *device, openair0_timestamp *ptimestamp, uint32_t **buff, int nsamps);
|
||||
int (*trx_read_func2)(openair0_device_t *device, openair0_timestamp_t *ptimestamp, uint32_t **buff, int nsamps);
|
||||
|
||||
/*! \brief print the device statistics
|
||||
* \param device the hardware to use
|
||||
* \returns 0 on success
|
||||
*/
|
||||
int (*trx_get_stats_func)(openair0_device *device);
|
||||
int (*trx_get_stats_func)(openair0_device_t *device);
|
||||
|
||||
/*! \brief Reset device statistics
|
||||
* \param device the hardware to use
|
||||
* \returns 0 in success
|
||||
*/
|
||||
int (*trx_reset_stats_func)(openair0_device *device);
|
||||
int (*trx_reset_stats_func)(openair0_device_t *device);
|
||||
|
||||
/*! \brief Terminate operation of the transceiver -- free all associated resources
|
||||
* \param device the hardware to use
|
||||
*/
|
||||
void (*trx_end_func)(openair0_device *device);
|
||||
void (*trx_end_func)(openair0_device_t *device);
|
||||
|
||||
/*! \brief Stop operation of the transceiver
|
||||
*/
|
||||
int (*trx_stop_func)(openair0_device *device);
|
||||
int (*trx_stop_func)(openair0_device_t *device);
|
||||
|
||||
/* Functions API related to UE*/
|
||||
|
||||
@@ -597,14 +601,14 @@ struct openair0_device_t {
|
||||
* \param openair0_cfg RF frontend parameters set by application
|
||||
* \returns 0 in success
|
||||
*/
|
||||
int (*trx_set_freq_func)(openair0_device *device, openair0_config_t *openair0_cfg);
|
||||
int (*trx_set_freq_func)(openair0_device_t *device, openair0_config_t *openair0_cfg);
|
||||
|
||||
/*! \brief Set gains
|
||||
* \param device the hardware to use
|
||||
* \param openair0_cfg RF frontend parameters set by application
|
||||
* \returns 0 in success
|
||||
*/
|
||||
int (*trx_set_gains_func)(openair0_device *device, openair0_config_t *openair0_cfg);
|
||||
int (*trx_set_gains_func)(openair0_device_t *device, openair0_config_t *openair0_cfg);
|
||||
|
||||
/*! \brief Set tx/rx beams
|
||||
*
|
||||
@@ -619,9 +623,9 @@ struct openair0_device_t {
|
||||
* \param beam_map the beams to receive
|
||||
* \return 0 on success
|
||||
*/
|
||||
int (*trx_set_beams)(openair0_device *device, uint64_t beam_map, openair0_timestamp timestamp);
|
||||
int (*trx_set_beams)(openair0_device_t *device, uint64_t beam_map, openair0_timestamp_t timestamp);
|
||||
|
||||
/*! \brief Set tx/rx beams
|
||||
/*! \brief Set tx/rx beams
|
||||
*
|
||||
* Set the tx/rx beams. This has to be done in advance of the reception in order to
|
||||
* allow the underlying device to change receiver configuration. The exact time depends
|
||||
@@ -635,7 +639,7 @@ struct openair0_device_t {
|
||||
* \param num_beams number of beams
|
||||
* \return 0 on success
|
||||
*/
|
||||
int (*trx_set_beams2)(openair0_device *device, int* beams, int num_beams, openair0_timestamp timestamp);
|
||||
int (*trx_set_beams2)(openair0_device_t *device, int *beams, int num_beams, openair0_timestamp_t timestamp);
|
||||
|
||||
/*! \brief RRU Configuration callback
|
||||
* \param idx RU index
|
||||
@@ -651,22 +655,22 @@ struct openair0_device_t {
|
||||
/*! \brief Callback for Third-party RRU Initialization routine
|
||||
\param device the hardware configuration to use
|
||||
*/
|
||||
int (*thirdparty_init)(openair0_device *device);
|
||||
int (*thirdparty_init)(openair0_device_t *device);
|
||||
/*! \brief Callback for Third-party RRU Cleanup routine
|
||||
\param device the hardware configuration to use
|
||||
*/
|
||||
int (*thirdparty_cleanup)(openair0_device *device);
|
||||
int (*thirdparty_cleanup)(openair0_device_t *device);
|
||||
|
||||
/*! \brief Callback for Third-party start streaming routine
|
||||
\param device the hardware configuration to use
|
||||
*/
|
||||
int (*thirdparty_startstreaming)(openair0_device *device);
|
||||
int (*thirdparty_startstreaming)(openair0_device_t *device);
|
||||
|
||||
/*! \brief RRU Configuration callback
|
||||
* \param idx RU index
|
||||
* \param arg pointer to capabilities or configuration
|
||||
*/
|
||||
int (*trx_write_init)(openair0_device *device);
|
||||
int (*trx_write_init)(openair0_device_t *device);
|
||||
/* \brief Get internal parameter
|
||||
* \param id parameter to get
|
||||
* \return a pointer to the parameter
|
||||
@@ -679,9 +683,9 @@ struct openair0_device_t {
|
||||
};
|
||||
|
||||
/* type of device init function, implemented in shared lib */
|
||||
typedef int(*oai_device_initfunc_t)(openair0_device *device, openair0_config_t *openair0_cfg);
|
||||
typedef int (*oai_device_initfunc_t)(openair0_device_t *device, openair0_config_t *openair0_cfg);
|
||||
/* type of transport init function, implemented in shared lib */
|
||||
typedef int(*oai_transport_initfunc_t)(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params);
|
||||
typedef int (*oai_transport_initfunc_t)(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params);
|
||||
|
||||
#define OPTION_LZ4 0x00000001 // LZ4 compression (option_value is set to compressed size)
|
||||
|
||||
@@ -723,30 +727,29 @@ extern "C"
|
||||
/*! \brief get device name from device type */
|
||||
const char *get_devname(int devtype);
|
||||
/*! \brief Initialize openair RF target. It returns 0 if OK */
|
||||
int openair0_device_load(openair0_device *device, openair0_config_t *openair0_cfg);
|
||||
int openair0_device_load(openair0_device_t *device, openair0_config_t *openair0_cfg);
|
||||
/*! \brief Initialize transport protocol . It returns 0 if OK */
|
||||
int openair0_transport_load(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params);
|
||||
|
||||
int openair0_transport_load(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params);
|
||||
|
||||
/*! \brief Get current timestamp of USRP
|
||||
* \param device the hardware to use
|
||||
*/
|
||||
openair0_timestamp get_usrp_time(openair0_device *device);
|
||||
openair0_timestamp_t get_usrp_time(openair0_device_t *device);
|
||||
|
||||
/*! \brief Set RX frequencies
|
||||
* \param device the hardware to use
|
||||
* \param openair0_cfg RF frontend parameters set by application
|
||||
* \returns 0 in success
|
||||
*/
|
||||
int openair0_set_rx_frequencies(openair0_device *device, openair0_config_t *openair0_cfg);
|
||||
int openair0_set_rx_frequencies(openair0_device_t *device, openair0_config_t *openair0_cfg);
|
||||
/*! \brief read the iq record-player configuration */
|
||||
extern int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_state);
|
||||
|
||||
/*! \brief store recorded iqs from memory to file. */
|
||||
extern void iqrecorder_end(openair0_device *device);
|
||||
extern void iqrecorder_end(openair0_device_t *device);
|
||||
|
||||
int openair0_write_reorder(openair0_device *device, openair0_timestamp timestamp, void **txp, int nsamps, int nbAnt, int flags);
|
||||
void openair0_write_reorder_clear_context(openair0_device *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)
|
||||
|
||||
@@ -78,7 +78,8 @@ int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_
|
||||
* used in record mode
|
||||
* \param device the hardware used
|
||||
*/
|
||||
void iqrecorder_end(openair0_device *device) {
|
||||
void iqrecorder_end(openair0_device_t *device)
|
||||
{
|
||||
if (device->recplay_state != NULL) { // subframes store
|
||||
iqfile_header_t fh = {device->type,device->openair0_cfg->tx_sample_advance, device->openair0_cfg->rx_bw,0,OAIIQFILE_ID};
|
||||
recplay_state_t *rs = device->recplay_state;
|
||||
|
||||
+31
-40
@@ -52,8 +52,8 @@
|
||||
//int addr_len[MAX_INST];
|
||||
//struct ifreq if_index[MAX_INST];
|
||||
|
||||
int eth_socket_init_raw(openair0_device *device) {
|
||||
|
||||
int eth_socket_init_raw(openair0_device_t *device)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
const char *local_mac, *remote_mac;
|
||||
int sock_dom=0;
|
||||
@@ -125,8 +125,8 @@ int eth_socket_init_raw(openair0_device *device) {
|
||||
}
|
||||
|
||||
/* 09/03/2019: fix obvious inconsistencies, but this code hasn't be tested for sure */
|
||||
int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags) {
|
||||
|
||||
int trx_eth_write_raw(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags)
|
||||
{
|
||||
int bytes_sent=0;
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
int sendto_flag =0;
|
||||
@@ -148,12 +148,12 @@ int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, voi
|
||||
/* we don't want to ovewrite with the header info the previous tx buffer data so we store it*/
|
||||
struct ether_header temp = *(struct ether_header *)buff2;
|
||||
int32_t temp0 = *(int32_t *)(buff2 + MAC_HEADER_SIZE_BYTES);
|
||||
openair0_timestamp temp1 = *(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t));
|
||||
|
||||
openair0_timestamp_t temp1 = *(openair0_timestamp_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t));
|
||||
|
||||
bytes_sent = 0;
|
||||
memcpy(buff2,(void*)ð->ehd,MAC_HEADER_SIZE_BYTES);
|
||||
*(int16_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int16_t))=1+(i<<1);
|
||||
*(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)) = timestamp;
|
||||
*(openair0_timestamp_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)) = timestamp;
|
||||
|
||||
/*printf("[RRU]write mod_%d %d , len %d, buff %p \n",
|
||||
Mod_id,eth->sockfd[Mod_id],RAW_PACKET_SIZE_BYTES(nsamps), buff2);*/
|
||||
@@ -180,15 +180,13 @@ int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, voi
|
||||
/* tx buffer values restored */
|
||||
*(struct ether_header *)buff2 = temp;
|
||||
*(int32_t *)(buff2 + MAC_HEADER_SIZE_BYTES) = temp0;
|
||||
*(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)) = temp1;
|
||||
*(openair0_timestamp_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)) = temp1;
|
||||
}
|
||||
return (bytes_sent-APP_HEADER_SIZE_BYTES-MAC_HEADER_SIZE_BYTES)>>2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int trx_eth_write_raw_IF4p5(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
|
||||
|
||||
int trx_eth_write_raw_IF4p5(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags)
|
||||
{
|
||||
int nblocks = nsamps;
|
||||
int bytes_sent = 0;
|
||||
|
||||
@@ -225,13 +223,11 @@ int trx_eth_write_raw_IF4p5(openair0_device *device, openair0_timestamp timestam
|
||||
eth->tx_count++;
|
||||
}
|
||||
|
||||
return (bytes_sent-MAC_HEADER_SIZE_BYTES);
|
||||
return (bytes_sent-MAC_HEADER_SIZE_BYTES);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) {
|
||||
|
||||
int trx_eth_read_raw(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc)
|
||||
{
|
||||
int ret;
|
||||
int bytes_received=0;
|
||||
int i=0;
|
||||
@@ -251,7 +247,7 @@ int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, voi
|
||||
/* we don't want to ovewrite with the header info the previous rx buffer data so we store it*/
|
||||
struct ether_header temp = *(struct ether_header *)buff2;
|
||||
int32_t temp0 = *(int32_t *)(buff2 + MAC_HEADER_SIZE_BYTES);
|
||||
openair0_timestamp temp1 = *(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t));
|
||||
openair0_timestamp_t temp1 = *(openair0_timestamp_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t));
|
||||
|
||||
bytes_received=0;
|
||||
int receive_bytes;
|
||||
@@ -299,18 +295,18 @@ int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, voi
|
||||
} else {
|
||||
bytes_received+=ret;
|
||||
/* store the timestamp value from packet's header */
|
||||
*timestamp = *(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t));
|
||||
*timestamp = *(openair0_timestamp_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t));
|
||||
eth->rx_actual_nsamps=bytes_received>>2;
|
||||
eth->rx_count++;
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
printf("------- RX------: nu=%x an_id=%d ts%d bytes_recv=%d \n",
|
||||
*(uint8_t *)(buff2+ETH_ALEN),
|
||||
*(int16_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int16_t)),
|
||||
*(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)),
|
||||
bytes_received);
|
||||
*(uint8_t *)(buff2 + ETH_ALEN),
|
||||
*(int16_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int16_t)),
|
||||
*(openair0_timestamp_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)),
|
||||
bytes_received);
|
||||
|
||||
dump_packet((device->host_type == RAU_HOST)? "RAU":"RRU", buff2, RAW_PACKET_SIZE_BYTES(nsamps),RX_FLAG);
|
||||
|
||||
@@ -319,15 +315,13 @@ int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, voi
|
||||
/* tx buffer values restored */
|
||||
*(struct ether_header *)buff2 = temp;
|
||||
*(int32_t *)(buff2 + MAC_HEADER_SIZE_BYTES) = temp0;
|
||||
*(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)) = temp1;
|
||||
*(openair0_timestamp_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)) = temp1;
|
||||
}
|
||||
return (bytes_received-APP_HEADER_SIZE_BYTES-MAC_HEADER_SIZE_BYTES)>>2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int trx_eth_read_raw_IF4p5(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) {
|
||||
|
||||
int trx_eth_read_raw_IF4p5(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc)
|
||||
{
|
||||
int ret;
|
||||
// Read nblocks info from packet itself
|
||||
int nblocks = nsamps;
|
||||
@@ -413,9 +407,8 @@ int trx_eth_read_raw_IF4p5(openair0_device *device, openair0_timestamp *timestam
|
||||
return(bytes_received);
|
||||
}
|
||||
|
||||
|
||||
int eth_set_dev_conf_raw(openair0_device *device) {
|
||||
|
||||
int eth_set_dev_conf_raw(openair0_device_t *device)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
void *msg;
|
||||
ssize_t msg_len;
|
||||
@@ -443,9 +436,8 @@ int eth_set_dev_conf_raw(openair0_device *device) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int eth_set_dev_conf_raw_IF4p5(openair0_device *device) {
|
||||
int eth_set_dev_conf_raw_IF4p5(openair0_device_t *device)
|
||||
{
|
||||
// use for cc_id info
|
||||
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
@@ -475,9 +467,8 @@ int eth_set_dev_conf_raw_IF4p5(openair0_device *device) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int eth_get_dev_conf_raw(openair0_device *device) {
|
||||
|
||||
int eth_get_dev_conf_raw(openair0_device_t *device)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
void *msg;
|
||||
ssize_t msg_len;
|
||||
@@ -503,8 +494,8 @@ int eth_get_dev_conf_raw(openair0_device *device) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int eth_get_dev_conf_raw_IF4p5(openair0_device *device) {
|
||||
int eth_get_dev_conf_raw_IF4p5(openair0_device_t *device)
|
||||
{
|
||||
// use for cc_id info
|
||||
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
|
||||
+29
-28
@@ -58,8 +58,8 @@ uint16_t pck_seq_num = 1;
|
||||
uint16_t pck_seq_num_cur=0;
|
||||
uint16_t pck_seq_num_prev=0;
|
||||
|
||||
int eth_socket_init_udp(openair0_device *device) {
|
||||
|
||||
int eth_socket_init_udp(openair0_device_t *device)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
eth_params_t *eth_params = device->eth_params;
|
||||
|
||||
@@ -192,8 +192,8 @@ int eth_socket_init_udp(openair0_device *device) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int trx_eth_read_udp_IF4p5(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) {
|
||||
|
||||
int trx_eth_read_udp_IF4p5(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc)
|
||||
{
|
||||
// Read nblocks info from packet itself
|
||||
int nblocks = nsamps;
|
||||
int bytes_received=-1;
|
||||
@@ -244,8 +244,8 @@ int trx_eth_read_udp_IF4p5(openair0_device *device, openair0_timestamp *timestam
|
||||
return(bytes_received);
|
||||
}
|
||||
|
||||
int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
|
||||
|
||||
int trx_eth_write_udp_IF4p5(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags)
|
||||
{
|
||||
int nblocks = nsamps;
|
||||
int bytes_sent = 0;
|
||||
|
||||
@@ -294,10 +294,10 @@ int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestam
|
||||
|
||||
|
||||
|
||||
void *trx_eth_write_udp_cmd(udpTXelem_t *udpTXelem) {
|
||||
|
||||
openair0_device *device=udpTXelem->device;
|
||||
openair0_timestamp timestamp = udpTXelem->timestamp;
|
||||
void *trx_eth_write_udp_cmd(udpTXelem_t *udpTXelem)
|
||||
{
|
||||
openair0_device_t *device=udpTXelem->device;
|
||||
openair0_timestamp_t timestamp = udpTXelem->timestamp;
|
||||
void **buff = udpTXelem->buff;
|
||||
int nsamps = udpTXelem->nsamps;
|
||||
int nant = udpTXelem->nant;
|
||||
@@ -331,7 +331,7 @@ void *trx_eth_write_udp_cmd(udpTXelem_t *udpTXelem) {
|
||||
// ECPRI Message type (1 byte)
|
||||
*(uint8_t *)(buff2 + 1) = 64;
|
||||
|
||||
openair0_timestamp TS = timestamp + fhstate->TS0;
|
||||
openair0_timestamp_t TS = timestamp + fhstate->TS0;
|
||||
TS = (6*device->sampling_rate_ratio_d*TS)/device->sampling_rate_ratio_n;
|
||||
TS -= device->txrx_offset;
|
||||
int TSinc = (6*256*device->sampling_rate_ratio_d)/device->sampling_rate_ratio_n;
|
||||
@@ -386,8 +386,8 @@ void *trx_eth_write_udp_cmd(udpTXelem_t *udpTXelem) {
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, void **buff, int fd_ind, int nsamps, int flags, int nant) {
|
||||
|
||||
int trx_eth_write_udp(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int fd_ind, int nsamps, int flags, int nant)
|
||||
{
|
||||
union udpTXReqUnion id = {.s={(uint64_t)timestamp,nsamps,0}};
|
||||
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(udpTXelem_t), id.p, device->utx[fd_ind]->resp,NULL);
|
||||
udpTXelem_t * udptxelem=(udpTXelem_t *) NotifiedFifoData(req);
|
||||
@@ -425,12 +425,13 @@ void *udp_write_thread(void *arg) {
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
void *udp_read_thread(void *arg) {
|
||||
openair0_timestamp TS;
|
||||
void *udp_read_thread(void *arg)
|
||||
{
|
||||
openair0_timestamp_t TS;
|
||||
|
||||
int aid;
|
||||
udp_ctx_t *u = (udp_ctx_t *)arg;
|
||||
openair0_device *device=u->device;
|
||||
openair0_device_t *device=u->device;
|
||||
fhstate_t *fhstate = &device->fhstate;
|
||||
char buffer[UDP_PACKET_SIZE_BYTES(256)];
|
||||
int first_read=0;
|
||||
@@ -457,7 +458,7 @@ void *udp_read_thread(void *arg) {
|
||||
if (oai_exit)
|
||||
break;
|
||||
aid = *(uint16_t*)(&buffer[ECPRICOMMON_BYTES]);
|
||||
TS = *(openair0_timestamp *)(&buffer[ECPRICOMMON_BYTES+ECPRIPCID_BYTES]);
|
||||
TS = *(openair0_timestamp_t *)(&buffer[ECPRICOMMON_BYTES+ECPRIPCID_BYTES]);
|
||||
// convert TS to samples, /6 for AW2S @ 30.72 Ms/s, this is converted for other sample rates in OAI application
|
||||
TS = (device->sampling_rate_ratio_n*TS)/(device->sampling_rate_ratio_d*6);
|
||||
AssertFatal(aid < 8,"Cannot handle more than 8 antennas, got aid %d\n",aid);
|
||||
@@ -487,24 +488,24 @@ void *udp_read_thread(void *arg) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, uint32_t **buff, int nsamps) {
|
||||
|
||||
int trx_eth_read_udp(openair0_device_t *device, openair0_timestamp_t *timestamp, uint32_t **buff, int nsamps)
|
||||
{
|
||||
fhstate_t *fhstate = &device->fhstate;
|
||||
openair0_timestamp prev_read_TS= fhstate->TS_read;
|
||||
volatile openair0_timestamp min_TS;
|
||||
openair0_timestamp_t prev_read_TS= fhstate->TS_read;
|
||||
volatile openair0_timestamp_t min_TS;
|
||||
// block until FH is ready
|
||||
while (fhstate->r[0] == 0 || fhstate->r[1] == 0 || fhstate->r[2] == 0 || fhstate->r[3] == 0 ||
|
||||
fhstate->r[4] == 0 || fhstate->r[5] == 0 || fhstate->r[6] == 0 || fhstate->r[7] == 0) usleep(100);
|
||||
|
||||
// get minimum TS over all antennas
|
||||
min_TS = (volatile openair0_timestamp)fhstate->TS[0];
|
||||
min_TS = (volatile openair0_timestamp_t)fhstate->TS[0];
|
||||
for (int i=1;i<device->openair0_cfg->rx_num_channels;i++) min_TS = min(min_TS,fhstate->TS[i]);
|
||||
// poll/sleep until we accumulated enough samples on each antenna port
|
||||
int count=0;
|
||||
while (fhstate->first_read == 1 && min_TS < (fhstate->TS0+prev_read_TS + nsamps)) {
|
||||
usleep(10);
|
||||
min_TS = (volatile openair0_timestamp)fhstate->TS[0];
|
||||
for (int i=1;i<device->openair0_cfg->rx_num_channels;i++) min_TS = min(min_TS,(volatile openair0_timestamp)fhstate->TS[i]);
|
||||
min_TS = (volatile openair0_timestamp_t)fhstate->TS[0];
|
||||
for (int i=1;i<device->openair0_cfg->rx_num_channels;i++) min_TS = min(min_TS,(volatile openair0_timestamp_t)fhstate->TS[i]);
|
||||
count++;
|
||||
}
|
||||
if (fhstate->first_read == 0) {
|
||||
@@ -524,8 +525,8 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, uin
|
||||
|
||||
|
||||
|
||||
int trx_eth_ctlsend_udp(openair0_device *device, void *msg, ssize_t msg_len) {
|
||||
|
||||
int trx_eth_ctlsend_udp(openair0_device_t *device, void *msg, ssize_t msg_len)
|
||||
{
|
||||
return(sendto(((eth_state_t*)device->priv)->sockfdc,
|
||||
msg,
|
||||
msg_len,
|
||||
@@ -535,8 +536,8 @@ int trx_eth_ctlsend_udp(openair0_device *device, void *msg, ssize_t msg_len) {
|
||||
}
|
||||
|
||||
|
||||
int trx_eth_ctlrecv_udp(openair0_device *device, void *msg, ssize_t msg_len) {
|
||||
|
||||
int trx_eth_ctlrecv_udp(openair0_device_t *device, void *msg, ssize_t msg_len)
|
||||
{
|
||||
return (recvfrom(((eth_state_t*)device->priv)->sockfdc,
|
||||
msg,
|
||||
msg_len,
|
||||
|
||||
@@ -51,12 +51,9 @@ int num_devices_eth = 0;
|
||||
struct sockaddr_in dest_addr[MAX_INST];
|
||||
int dest_addr_len[MAX_INST];
|
||||
|
||||
int load_lib(openair0_device *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 *cfg, uint8_t flag);
|
||||
|
||||
int trx_eth_start(openair0_device *device)
|
||||
int trx_eth_start(openair0_device_t *device)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
|
||||
@@ -225,8 +222,7 @@ int trx_eth_start(openair0_device *device)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void trx_eth_end(openair0_device *device)
|
||||
void trx_eth_end(openair0_device_t *device)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
/* destroys socket only for the processes that call the eth_end fuction-- shutdown() for beaking the pipe */
|
||||
@@ -239,9 +235,8 @@ void trx_eth_end(openair0_device *device)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int trx_eth_stop(openair0_device *device) {
|
||||
int trx_eth_stop(openair0_device_t *device)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
|
||||
if (eth->flags == ETH_UDP_IF5_ECPRI_MODE) {
|
||||
@@ -251,38 +246,32 @@ int trx_eth_stop(openair0_device *device) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int trx_eth_set_freq(openair0_device* device, openair0_config_t *openair0_cfg)
|
||||
int trx_eth_set_freq(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int trx_eth_set_gains(openair0_device* device, openair0_config_t *openair0_cfg)
|
||||
int trx_eth_set_gains(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int trx_eth_get_stats(openair0_device* device)
|
||||
int trx_eth_get_stats(openair0_device_t *device)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int trx_eth_reset_stats(openair0_device* device)
|
||||
int trx_eth_reset_stats(openair0_device_t *device)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
int trx_eth_write_init(openair0_device *device)
|
||||
int trx_eth_write_init(openair0_device_t *device)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ethernet_tune(openair0_device *device,
|
||||
unsigned int option,
|
||||
int value)
|
||||
int ethernet_tune(openair0_device_t *device, unsigned int option, int value)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
struct timeval timeout;
|
||||
@@ -471,10 +460,7 @@ int ethernet_tune(openair0_device *device,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int transport_init(openair0_device *device,
|
||||
openair0_config_t *openair0_cfg,
|
||||
eth_params_t * eth_params )
|
||||
int transport_init(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)malloc(sizeof(eth_state_t));
|
||||
memset(eth, 0, sizeof(eth_state_t));
|
||||
@@ -496,7 +482,7 @@ int transport_init(openair0_device *device,
|
||||
|
||||
eth->num_fd = 1;
|
||||
|
||||
printf("[ETHERNET]: Initializing openair0_device for %s ...\n", ((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
||||
printf("[ETHERNET]: Initializing openair0_device_t for %s ...\n", ((device->host_type == RAU_HOST) ? "RAU" : "RRU"));
|
||||
printf("[ETHERNET]: num_fd %d\n",eth->num_fd);
|
||||
device->Mod_id = 0;//num_devices_eth++;
|
||||
device->transp_type = ETHERNET_TP;
|
||||
@@ -577,8 +563,7 @@ unsigned short calc_csum (unsigned short *buf,
|
||||
return ~sum;
|
||||
}
|
||||
|
||||
|
||||
void dump_dev(openair0_device *device)
|
||||
void dump_dev(openair0_device_t *device)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
|
||||
@@ -594,27 +579,21 @@ void dump_dev(openair0_device *device)
|
||||
|
||||
}
|
||||
|
||||
|
||||
void inline dump_txcounters(openair0_device *device)
|
||||
void inline dump_txcounters(openair0_device_t *device)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
printf(" Ethernet device interface %i, tx counters:\n" ,device->openair0_cfg->Mod_id);
|
||||
printf(" Sent packets: %llu send errors: %i\n", (long long unsigned int)eth->tx_count, eth->num_tx_errors);
|
||||
}
|
||||
|
||||
|
||||
void inline dump_rxcounters(openair0_device *device)
|
||||
void inline dump_rxcounters(openair0_device_t *device)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
printf(" Ethernet device interface %i rx counters:\n" ,device->openair0_cfg->Mod_id);
|
||||
printf(" Received packets: %llu missed packets errors: %i\n", (long long unsigned int)eth->rx_count, eth->num_underflows);
|
||||
}
|
||||
|
||||
|
||||
void inline dump_buff(openair0_device *device,
|
||||
char *buff,
|
||||
unsigned int tx_rx_flag,
|
||||
int nsamps)
|
||||
void inline dump_buff(openair0_device_t *device, char *buff, unsigned int tx_rx_flag, int nsamps)
|
||||
{
|
||||
char *strptr;
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
#include "if_defs.h"
|
||||
#define ECPRICOMMON_BYTES 4
|
||||
#define ECPRIPCID_BYTES 2
|
||||
#define APP_HEADER_SIZE_BYTES (ECPRICOMMON_BYTES + ECPRIPCID_BYTES + sizeof(openair0_timestamp))
|
||||
#define APP_HEADER_SIZE_BYTES (ECPRICOMMON_BYTES + ECPRIPCID_BYTES + sizeof(openair0_timestamp_t))
|
||||
#define ECPRIREV 1 // ECPRI Version 1, C=0 - single ECPRI message per OAI TX packet
|
||||
|
||||
/*!\brief opaque ethernet data structure */
|
||||
@@ -111,11 +111,11 @@ typedef struct {
|
||||
int num_rx_errors;
|
||||
/*!\brief number of errors in interface's transmitter */
|
||||
int num_tx_errors;
|
||||
|
||||
/*!\brief current TX timestamp */
|
||||
openair0_timestamp tx_current_ts;
|
||||
/*!\brief socket file desc */
|
||||
openair0_timestamp rx_current_ts;
|
||||
|
||||
/*!\brief current TX timestamp */
|
||||
openair0_timestamp_t tx_current_ts;
|
||||
/*!\brief socket file desc */
|
||||
openair0_timestamp_t rx_current_ts;
|
||||
/*!\brief actual number of samples transmitted */
|
||||
uint64_t tx_actual_nsamps;
|
||||
/*!\brief actual number of samples received */
|
||||
@@ -150,8 +150,8 @@ typedef struct {
|
||||
uint16_t seq_num ;
|
||||
/*!\brief antenna port used to resynchronize */
|
||||
uint16_t antenna_id;
|
||||
/*!\brief packet's timestamp */
|
||||
openair0_timestamp timestamp;
|
||||
/*!\brief packet's timestamp */
|
||||
openair0_timestamp_t timestamp;
|
||||
} header_t;
|
||||
|
||||
/*!\brief different options for ethernet tuning in socket and driver level */
|
||||
@@ -204,8 +204,8 @@ typedef struct {
|
||||
} iqoai_t ;
|
||||
|
||||
typedef struct udpTXelem_s {
|
||||
openair0_device *device;
|
||||
openair0_timestamp timestamp;
|
||||
openair0_device_t *device;
|
||||
openair0_timestamp_t timestamp;
|
||||
void **buff;
|
||||
int fd_ind;
|
||||
int nant;
|
||||
@@ -227,17 +227,17 @@ union udpTXReqUnion {
|
||||
|
||||
void dump_packet(char *title, unsigned char* pkt, int bytes, unsigned int tx_rx_flag);
|
||||
unsigned short calc_csum (unsigned short *buf, int nwords);
|
||||
void dump_dev(openair0_device *device);
|
||||
/*void inline dump_buff(openair0_device *device, char *buff,unsigned int tx_rx_flag,int nsamps);
|
||||
void inline dump_rxcounters(openair0_device *device);
|
||||
void inline dump_txcounters(openair0_device *device);
|
||||
void dump_dev(openair0_device_t *device);
|
||||
/*void inline dump_buff(openair0_device_t *device, char *buff,unsigned int tx_rx_flag,int nsamps);
|
||||
void inline dump_rxcounters(openair0_device_t *device);
|
||||
void inline dump_txcounters(openair0_device_t *device);
|
||||
*/
|
||||
void dump_iqs(char * buff, int iq_cnt);
|
||||
|
||||
void *udp_read_thread(void *arg);
|
||||
void *udp_write_thread(void *arg);
|
||||
|
||||
/*! \fn int ethernet_tune (openair0_device *device, unsigned int option, int value);
|
||||
/*! \fn int ethernet_tune (openair0_device_t *device, unsigned int option, int value);
|
||||
* \brief this function allows you to configure certain ethernet parameters in socket or device level
|
||||
* \param[in] device device which bears the socket
|
||||
* \param[in] option of parameter to configure
|
||||
@@ -246,34 +246,39 @@ void *udp_write_thread(void *arg);
|
||||
* \note
|
||||
* @ingroup _oai
|
||||
*/
|
||||
int ethernet_tune(openair0_device *device, unsigned int option, int value);
|
||||
int ethernet_tune(openair0_device_t *device, unsigned int option, int value);
|
||||
|
||||
/*! \fn int eth_socket_init_udp(openair0_device *device)
|
||||
/*! \fn int eth_socket_init_udp(openair0_device_t *device)
|
||||
* \brief initialization of UDP Socket to communicate with one destination
|
||||
* \param[in] device openair device for which the socket will be created
|
||||
* \return 0 on success, otherwise -1
|
||||
* \note
|
||||
* @ingroup _oai
|
||||
*/
|
||||
int eth_socket_init_udp(openair0_device *device);
|
||||
int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, void **buf, int fd_ind, int nsamps, int flags,int nant);
|
||||
int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, uint32_t **buff, int nsamps);
|
||||
int eth_socket_init_udp(openair0_device_t *device);
|
||||
int trx_eth_write_udp(openair0_device_t *device,
|
||||
openair0_timestamp_t timestamp,
|
||||
void **buf,
|
||||
int fd_ind,
|
||||
int nsamps,
|
||||
int flags,
|
||||
int nant);
|
||||
int trx_eth_read_udp(openair0_device_t *device, openair0_timestamp_t *timestamp, uint32_t **buff, int nsamps);
|
||||
|
||||
int eth_socket_init_raw(openair0_device_t *device);
|
||||
int trx_eth_write_raw(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags);
|
||||
int trx_eth_read_raw(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc);
|
||||
int trx_eth_write_raw_IF4p5(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags);
|
||||
int trx_eth_read_raw_IF4p5(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc);
|
||||
int trx_eth_read_raw_IF5_mobipass(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc);
|
||||
int trx_eth_write_udp_IF4p5(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags);
|
||||
int trx_eth_read_udp_IF4p5(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc);
|
||||
int trx_eth_ctlsend_udp(openair0_device_t *device, void *msg, ssize_t msg_len);
|
||||
int trx_eth_ctlrecv_udp(openair0_device_t *device, void *msg, ssize_t msg_len);
|
||||
|
||||
int eth_socket_init_raw(openair0_device *device);
|
||||
int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags);
|
||||
int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc);
|
||||
int trx_eth_write_raw_IF4p5(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags);
|
||||
int trx_eth_read_raw_IF4p5(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc);
|
||||
int trx_eth_read_raw_IF5_mobipass(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc);
|
||||
int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags);
|
||||
int trx_eth_read_udp_IF4p5(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc);
|
||||
int trx_eth_ctlsend_udp(openair0_device *device, void *msg, ssize_t msg_len);
|
||||
int trx_eth_ctlrecv_udp(openair0_device *device, void *msg, ssize_t msg_len);
|
||||
|
||||
int eth_get_dev_conf_raw(openair0_device *device);
|
||||
int eth_set_dev_conf_raw(openair0_device *device);
|
||||
int eth_get_dev_conf_raw_IF4p5(openair0_device *device);
|
||||
int eth_set_dev_conf_raw_IF4p5(openair0_device *device);
|
||||
int eth_get_dev_conf_raw(openair0_device_t *device);
|
||||
int eth_set_dev_conf_raw(openair0_device_t *device);
|
||||
int eth_get_dev_conf_raw_IF4p5(openair0_device_t *device);
|
||||
int eth_set_dev_conf_raw_IF4p5(openair0_device_t *device);
|
||||
|
||||
#endif
|
||||
|
||||
+24
-21
@@ -71,14 +71,15 @@ extern "C" {
|
||||
//! rx count
|
||||
int64_t rx_count;
|
||||
//! timestamp of RX packet
|
||||
openair0_timestamp rx_timestamp;
|
||||
openair0_timestamp_t rx_timestamp;
|
||||
|
||||
} iris_state_t;
|
||||
}
|
||||
/*! \brief Called to start the Iris lime transceiver. Return 0 if OK, < 0 if error
|
||||
@param device pointer to the device structure specific to the RF hardware target
|
||||
*/
|
||||
static int trx_iris_start(openair0_device *device) {
|
||||
static int trx_iris_start(openair0_device_t *device)
|
||||
{
|
||||
iris_state_t *s = (iris_state_t *) device->priv;
|
||||
|
||||
long long timeNs = s->iris[0]->getHardwareTime("") + 500000;
|
||||
@@ -97,7 +98,8 @@ static int trx_iris_start(openair0_device *device) {
|
||||
/*! \brief Stop Iris
|
||||
* \param card refers to the hardware index to use
|
||||
*/
|
||||
int trx_iris_stop(openair0_device *device) {
|
||||
int trx_iris_stop(openair0_device_t *device)
|
||||
{
|
||||
iris_state_t *s = (iris_state_t *) device->priv;
|
||||
int r;
|
||||
for (r = 0; r < s->device_num; r++) {
|
||||
@@ -110,7 +112,8 @@ int trx_iris_stop(openair0_device *device) {
|
||||
/*! \brief Terminate operation of the Iris lime transceiver -- free all associated resources
|
||||
* \param device the hardware to use
|
||||
*/
|
||||
static void trx_iris_end(openair0_device *device) {
|
||||
static void trx_iris_end(openair0_device_t *device)
|
||||
{
|
||||
LOG_I(HW, "Closing Iris device.\n");
|
||||
trx_iris_stop(device);
|
||||
iris_state_t *s = (iris_state_t *) device->priv;
|
||||
@@ -133,7 +136,7 @@ static void trx_iris_end(openair0_device *device) {
|
||||
|
||||
|
||||
static int
|
||||
trx_iris_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags)
|
||||
trx_iris_write(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags)
|
||||
{
|
||||
using namespace std::chrono;
|
||||
|
||||
@@ -209,7 +212,8 @@ trx_iris_write(openair0_device *device, openair0_timestamp timestamp, void **buf
|
||||
* \param antenna_id Index of antenna for which to receive samples
|
||||
* \returns the number of sample read
|
||||
*/
|
||||
static int trx_iris_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) {
|
||||
static int trx_iris_read(openair0_device_t *device, openair0_timestamp_t *ptimestamp, void **buff, int nsamps, int cc)
|
||||
{
|
||||
int ret = 0;
|
||||
static long long nextTime;
|
||||
static bool nextTimeValid = false;
|
||||
@@ -304,7 +308,8 @@ static int trx_iris_read(openair0_device *device, openair0_timestamp *ptimestamp
|
||||
/*! \brief Get current timestamp of Iris
|
||||
* \param device the hardware to use
|
||||
*/
|
||||
openair0_timestamp get_iris_time(openair0_device *device) {
|
||||
openair0_timestamp_t get_iris_time(openair0_device_t *device)
|
||||
{
|
||||
iris_state_t *s = (iris_state_t *) device->priv;
|
||||
return SoapySDR::timeNsToTicks(s->iris[0]->getHardwareTime(""), s->sample_rate);
|
||||
}
|
||||
@@ -317,9 +322,9 @@ static bool is_equal(double a, double b) {
|
||||
return std::fabs(a - b) < std::numeric_limits<double>::epsilon();
|
||||
}
|
||||
|
||||
void *set_freq_thread(void *arg) {
|
||||
|
||||
openair0_device *device = (openair0_device *) arg;
|
||||
void *set_freq_thread(void *arg)
|
||||
{
|
||||
openair0_device_t *device = (openair0_device_t *) arg;
|
||||
iris_state_t *s = (iris_state_t *) device->priv;
|
||||
int r, i;
|
||||
printf("Setting Iris TX Freq %f, RX Freq %f\n", device->openair0_cfg[0].tx_freq[0],
|
||||
@@ -344,7 +349,7 @@ void *set_freq_thread(void *arg) {
|
||||
* \param dummy dummy variable not used
|
||||
* \returns 0 in success
|
||||
*/
|
||||
int trx_iris_set_freq(openair0_device *device, openair0_config_t *openair0_cfg)
|
||||
int trx_iris_set_freq(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
iris_state_t *s = (iris_state_t *)device->priv;
|
||||
int r, i;
|
||||
@@ -369,7 +374,7 @@ int trx_iris_set_freq(openair0_device *device, openair0_config_t *openair0_cfg)
|
||||
* \param openair0_cfg RF frontend parameters set by application
|
||||
* \returns 0 in success
|
||||
*/
|
||||
int trx_iris_set_gains(openair0_device *device,
|
||||
int trx_iris_set_gains(openair0_device_t *device,
|
||||
openair0_config_t *openair0_cfg) {
|
||||
iris_state_t *s = (iris_state_t *) device->priv;
|
||||
int r;
|
||||
@@ -448,23 +453,21 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index, int bw
|
||||
* \param device the hardware to use
|
||||
* \returns 0 on success
|
||||
*/
|
||||
int trx_iris_get_stats(openair0_device *device) {
|
||||
|
||||
int trx_iris_get_stats(openair0_device_t *device)
|
||||
{
|
||||
return (0);
|
||||
|
||||
}
|
||||
|
||||
/*! \brief Reset the Iris statistics
|
||||
* \param device the hardware to use
|
||||
* \returns 0 on success
|
||||
*/
|
||||
int trx_iris_reset_stats(openair0_device *device) {
|
||||
|
||||
int trx_iris_reset_stats(openair0_device_t *device)
|
||||
{
|
||||
return (0);
|
||||
|
||||
}
|
||||
|
||||
int trx_iris_write_init(openair0_device *device)
|
||||
int trx_iris_write_init(openair0_device_t *device)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -475,8 +478,8 @@ extern "C" {
|
||||
* \param device the hardware to use
|
||||
* \param openair0_cfg RF frontend parameters set by application
|
||||
*/
|
||||
int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
|
||||
|
||||
int device_init(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
int bw_gain_adjust = 0;
|
||||
openair0_cfg[0].rx_gain_calib_table = calib_table_iris;
|
||||
iris_state_t *s = (iris_state_t *) calloc(1, sizeof(*s));
|
||||
|
||||
+23
-21
@@ -72,7 +72,8 @@ int write_output(const char *fname,const char *vname,void *data,int length,int d
|
||||
\param flags Ignored for the moment
|
||||
\returns 0 on success
|
||||
*/
|
||||
int trx_lms_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int antenna_id, int flags) {
|
||||
int trx_lms_write(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int antenna_id, int flags)
|
||||
{
|
||||
timestamp -= device->openair0_cfg->command_line_sample_advance - device->openair0_cfg->tx_sample_advance;
|
||||
lms_stream_meta_t meta;
|
||||
meta.waitForTimestamp = true;
|
||||
@@ -93,8 +94,8 @@ int trx_lms_write(openair0_device *device, openair0_timestamp timestamp, void **
|
||||
* \param antenna_id Index of antenna port
|
||||
* \returns number of samples read
|
||||
*/
|
||||
int trx_lms_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int antenna_id) {
|
||||
|
||||
int trx_lms_read(openair0_device_t *device, openair0_timestamp_t *ptimestamp, void **buff, int nsamps, int antenna_id)
|
||||
{
|
||||
lms_stream_meta_t meta;
|
||||
meta.waitForTimestamp = false;
|
||||
meta.flushPartialPacket = false;
|
||||
@@ -140,7 +141,8 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index) {
|
||||
* \param openair0_cfg openair0 Config structure
|
||||
* \returns 0 in success, -1 on error
|
||||
*/
|
||||
int trx_lms_set_gains(openair0_device* device, openair0_config_t *openair0_cfg) {
|
||||
int trx_lms_set_gains(openair0_device_t* device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (openair0_cfg->rx_gain[0] > 70+openair0_cfg->rx_gain_offset[0]) {
|
||||
@@ -158,8 +160,8 @@ int trx_lms_set_gains(openair0_device* device, openair0_config_t *openair0_cfg)
|
||||
* \param device the hardware to use
|
||||
* \returns 0 on success
|
||||
*/
|
||||
int trx_lms_start(openair0_device *device){
|
||||
|
||||
int trx_lms_start(openair0_device_t *device)
|
||||
{
|
||||
lms_info_str_t list[16]={0};
|
||||
|
||||
int n= LMS_GetDeviceList(list);
|
||||
@@ -269,7 +271,8 @@ int trx_lms_start(openair0_device *device){
|
||||
* \param card Index of the RF card to use
|
||||
* \returns 0 on success
|
||||
*/
|
||||
int trx_lms_stop(openair0_device *device) {
|
||||
int trx_lms_stop(openair0_device_t *device)
|
||||
{
|
||||
LMS_StopStream(&rx_stream);
|
||||
LMS_StopStream(&tx_stream);
|
||||
LMS_DestroyStream(lms_device,&rx_stream);
|
||||
@@ -283,7 +286,8 @@ int trx_lms_stop(openair0_device *device) {
|
||||
* \param openair0_cfg openair0 Config structure (ignored. It is there to comply with RF common API)
|
||||
* \returns 0 in success
|
||||
*/
|
||||
int trx_lms_set_freq(openair0_device* device, openair0_config_t *openair0_cfg) {
|
||||
int trx_lms_set_freq(openair0_device_t* device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
//Control port must be connected
|
||||
LMS_SetLOFrequency(lms_device,LMS_CH_TX,0,openair0_cfg->tx_freq[0]);
|
||||
LMS_SetLOFrequency(lms_device,LMS_CH_RX,0,openair0_cfg->rx_freq[0]);
|
||||
@@ -322,45 +326,43 @@ rx_gain_calib_table_t calib_table_lmssdr[] = {
|
||||
* \returns 0 in success
|
||||
*/
|
||||
|
||||
int trx_lms_get_stats(openair0_device* device) {
|
||||
|
||||
int trx_lms_get_stats(openair0_device_t* device)
|
||||
{
|
||||
return(0);
|
||||
|
||||
}
|
||||
|
||||
/*! \brief Reset LMSSDR Statistics
|
||||
* \param device the hardware to use
|
||||
* \returns 0 in success
|
||||
*/
|
||||
int trx_lms_reset_stats(openair0_device* device) {
|
||||
|
||||
int trx_lms_reset_stats(openair0_device_t* device)
|
||||
{
|
||||
return(0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Terminate operation of the LMSSDR transceiver -- free all associated resources
|
||||
* \param device the hardware to use
|
||||
*/
|
||||
void trx_lms_end(openair0_device *device) {
|
||||
|
||||
|
||||
void trx_lms_end(openair0_device_t *device)
|
||||
{
|
||||
}
|
||||
|
||||
int trx_lms_write_init(openair0_device *device)
|
||||
int trx_lms_write_init(openair0_device_t *device)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
/*! \brief Initialize Openair LMSSDR target. It returns 0 if OK
|
||||
* \param device the hardware to use
|
||||
* \param openair0_cfg RF frontend parameters set by application
|
||||
*/
|
||||
int device_init(openair0_device *device, openair0_config_t *openair0_cfg){
|
||||
|
||||
int device_init(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
device->type=LMSSDR_DEV;
|
||||
|
||||
printf("LMSSDR: Initializing openair0_device for %s ...\n", ((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
||||
printf("LMSSDR: Initializing openair0_device_t for %s ...\n", ((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
||||
|
||||
switch ((int)openair0_cfg[0].sample_rate) {
|
||||
case 30720000:
|
||||
|
||||
+21
-27
@@ -87,7 +87,7 @@ typedef struct
|
||||
|
||||
int64_t tx_count;
|
||||
int64_t rx_count;
|
||||
openair0_timestamp rx_timestamp;
|
||||
openair0_timestamp_t rx_timestamp;
|
||||
|
||||
} sodera_t;
|
||||
|
||||
@@ -131,7 +131,7 @@ uint16_t SPI_read(LMScomms* dataPort, uint16_t address)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int trx_sodera_start(openair0_device *device)
|
||||
static int trx_sodera_start(openair0_device_t *device)
|
||||
{
|
||||
sodera_t *s = (sodera_t*)device->priv;
|
||||
|
||||
@@ -182,7 +182,7 @@ static int trx_sodera_start(openair0_device *device)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void trx_sodera_end(openair0_device *device)
|
||||
static void trx_sodera_end(openair0_device_t *device)
|
||||
{
|
||||
sodera_t *s = (sodera_t*)device->priv;
|
||||
|
||||
@@ -193,7 +193,7 @@ static void trx_sodera_end(openair0_device *device)
|
||||
|
||||
}
|
||||
|
||||
static int trx_sodera_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags)
|
||||
static int trx_sodera_write(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags)
|
||||
{
|
||||
sodera_t *s = (sodera_t*)device->priv;
|
||||
|
||||
@@ -203,7 +203,7 @@ static int trx_sodera_write(openair0_device *device, openair0_timestamp timestam
|
||||
|
||||
#define DEBUG_READ 1
|
||||
|
||||
static int trx_sodera_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc)
|
||||
static int trx_sodera_read(openair0_device_t *device, openair0_timestamp_t *ptimestamp, void **buff, int nsamps, int cc)
|
||||
{
|
||||
sodera_t *s = (sodera_t*)device->priv;
|
||||
int samples_received=0,i,j;
|
||||
@@ -350,19 +350,18 @@ static bool is_equal(double a, double b)
|
||||
return fabs(a-b) < 1e-6;
|
||||
}
|
||||
|
||||
int trx_sodera_set_freq(openair0_device* device, openair0_config_t *openair0_cfg, int dummy) {
|
||||
|
||||
int trx_sodera_set_freq(openair0_device_t *device, openair0_config_t *openair0_cfg, int dummy)
|
||||
{
|
||||
sodera_t *s = (sodera_t*)device->priv;
|
||||
|
||||
// s->usrp->set_tx_freq(openair0_cfg[0].tx_freq[0]);
|
||||
// s->usrp->set_rx_freq(openair0_cfg[0].rx_freq[0]);
|
||||
|
||||
return(0);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int openair0_set_rx_frequencies(openair0_device* device, openair0_config_t *openair0_cfg) {
|
||||
|
||||
int openair0_set_rx_frequencies(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
sodera_t *s = (sodera_t*)device->priv;
|
||||
static int first_call=1;
|
||||
static double rf_freq,diff;
|
||||
@@ -374,13 +373,11 @@ int openair0_set_rx_frequencies(openair0_device* device, openair0_config_t *open
|
||||
// rf_freq=openair0_cfg[0].rx_freq[0];
|
||||
// s->usrp->set_rx_freq(rx_tune_req);
|
||||
|
||||
return(0);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int trx_sodera_set_gains(openair0_device* device,
|
||||
openair0_config_t *openair0_cfg) {
|
||||
|
||||
int trx_sodera_set_gains(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
sodera_t *s = (sodera_t*)device->priv;
|
||||
|
||||
// s->usrp->set_tx_gain(openair0_cfg[0].tx_gain[0]);
|
||||
@@ -456,20 +453,17 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index,int bw_
|
||||
|
||||
}
|
||||
|
||||
|
||||
int trx_sodera_get_stats(openair0_device* device) {
|
||||
|
||||
return(0);
|
||||
|
||||
}
|
||||
int trx_sodera_reset_stats(openair0_device* device) {
|
||||
|
||||
return(0);
|
||||
|
||||
int trx_sodera_get_stats(openair0_device_t *device)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
int trx_sodera_reset_stats(openair0_device_t *device)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
int openair0_dev_init_sodera(openair0_device* device, openair0_config_t *openair0_cfg)
|
||||
int openair0_dev_init_sodera(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
|
||||
sodera_t *s=&sodera_state;
|
||||
|
||||
+42
-30
@@ -104,7 +104,7 @@ typedef struct {
|
||||
//int first_tx;
|
||||
//int first_rx;
|
||||
//! timestamp of RX packet
|
||||
openair0_timestamp rx_timestamp;
|
||||
openair0_timestamp_t rx_timestamp;
|
||||
} usrp_state_t;
|
||||
|
||||
//void print_notes(void)
|
||||
@@ -145,7 +145,8 @@ int check_ref_locked(usrp_state_t *s,size_t mboard) {
|
||||
return ref_locked;
|
||||
}
|
||||
|
||||
static int sync_to_gps(openair0_device *device) {
|
||||
static int sync_to_gps(openair0_device_t *device)
|
||||
{
|
||||
//uhd::set_thread_priority_safe();
|
||||
//std::string args;
|
||||
//Set up program options
|
||||
@@ -266,7 +267,7 @@ static int sync_to_gps(openair0_device *device) {
|
||||
#define ATR_XX 0x20 //data[5]
|
||||
#define MAN_MASK ATR_MASK ^ 0xFFF // manually controlled pins
|
||||
|
||||
static void trx_usrp_start_interdigital_gpio(openair0_device *device, usrp_state_t *s)
|
||||
static void trx_usrp_start_interdigital_gpio(openair0_device_t *device, usrp_state_t *s)
|
||||
{
|
||||
AssertFatal(device->type == USRP_X400_DEV,
|
||||
"interdigital frontend device for beam management can only be used together with an X400\n");
|
||||
@@ -280,7 +281,7 @@ static void trx_usrp_start_interdigital_gpio(openair0_device *device, usrp_state
|
||||
s->usrp->set_gpio_attr(s->gpio_bank, "OUT", (1 << 4), 0x1c);
|
||||
}
|
||||
|
||||
static void trx_usrp_start_generic_gpio(openair0_device *device, usrp_state_t *s)
|
||||
static void trx_usrp_start_generic_gpio(openair0_device_t *device, usrp_state_t *s)
|
||||
{
|
||||
// setup GPIO for TDD, GPIO(4) = ATR_RX
|
||||
// set data direction register (DDR) to output
|
||||
@@ -299,7 +300,8 @@ static void trx_usrp_start_generic_gpio(openair0_device *device, usrp_state_t *s
|
||||
/*! \brief Called to start the USRP transceiver. Return 0 if OK, < 0 if error
|
||||
@param device pointer to the device structure specific to the RF hardware target
|
||||
*/
|
||||
static int trx_usrp_start(openair0_device *device) {
|
||||
static int trx_usrp_start(openair0_device_t *device)
|
||||
{
|
||||
usrp_state_t *s = (usrp_state_t *)device->priv;
|
||||
|
||||
s->gpio_bank = (char *) "FP0"; //good for B210, X310 and N310
|
||||
@@ -383,7 +385,8 @@ static void trx_usrp_write_reset(openair0_thread_t *wt);
|
||||
/*! \brief Terminate operation of the USRP transceiver -- free all associated resources
|
||||
* \param device the hardware to use
|
||||
*/
|
||||
static void trx_usrp_end(openair0_device *device) {
|
||||
static void trx_usrp_end(openair0_device_t *device)
|
||||
{
|
||||
if (device == NULL)
|
||||
return;
|
||||
|
||||
@@ -423,12 +426,13 @@ static void trx_usrp_end(openair0_device *device) {
|
||||
@param antenna_id index of the antenna if the device has multiple antennas
|
||||
@param flags flags must be set to true if timestamp parameter needs to be applied
|
||||
*/
|
||||
static int trx_usrp_write(openair0_device *device,
|
||||
openair0_timestamp timestamp,
|
||||
static int trx_usrp_write(openair0_device_t *device,
|
||||
openair0_timestamp_t timestamp,
|
||||
void **buff,
|
||||
int nsamps,
|
||||
int cc,
|
||||
int flags) {
|
||||
int flags)
|
||||
{
|
||||
int ret=0;
|
||||
usrp_state_t *s = (usrp_state_t *)device->priv;
|
||||
timestamp -= device->openair0_cfg->command_line_sample_advance + device->openair0_cfg->tx_sample_advance;
|
||||
@@ -562,22 +566,23 @@ static int trx_usrp_write(openair0_device *device,
|
||||
@param antenna_id index of the antenna if the device has multiple antennas
|
||||
@param flags flags must be set to true if timestamp parameter needs to be applied
|
||||
*/
|
||||
void *trx_usrp_write_thread(void * arg){
|
||||
void *trx_usrp_write_thread(void * arg)
|
||||
{
|
||||
int ret=0;
|
||||
openair0_device *device=(openair0_device *)arg;
|
||||
openair0_device_t *device=(openair0_device_t *)arg;
|
||||
openair0_thread_t *write_thread = &device->write_thread;
|
||||
openair0_write_package_t *write_package = write_thread->write_package;
|
||||
|
||||
usrp_state_t *s;
|
||||
int nsamps2; // aligned to upper 32 or 16 byte boundary
|
||||
int start;
|
||||
openair0_timestamp timestamp;
|
||||
void **buff;
|
||||
int nsamps;
|
||||
int cc;
|
||||
signed char first_packet;
|
||||
signed char last_packet;
|
||||
int flags_gpio;
|
||||
openair0_timestamp_t timestamp;
|
||||
void **buff;
|
||||
int nsamps;
|
||||
int cc;
|
||||
signed char first_packet;
|
||||
signed char last_packet;
|
||||
int flags_gpio;
|
||||
|
||||
printf("trx_usrp_write_thread started on cpu %d\n",sched_getcpu());
|
||||
while(1){
|
||||
@@ -659,8 +664,8 @@ void *trx_usrp_write_thread(void * arg){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int trx_usrp_write_init(openair0_device *device){
|
||||
|
||||
int trx_usrp_write_init(openair0_device_t *device)
|
||||
{
|
||||
//uhd::set_thread_priority_safe(1.0);
|
||||
openair0_thread_t *write_thread = &device->write_thread;
|
||||
printf("initializing tx write thread\n");
|
||||
@@ -705,7 +710,8 @@ static void trx_usrp_write_reset(openair0_thread_t *wt) {
|
||||
* \param antenna_id Index of antenna for which to receive samples
|
||||
* \returns the number of sample read
|
||||
*/
|
||||
static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) {
|
||||
static int trx_usrp_read(openair0_device_t *device, openair0_timestamp_t *ptimestamp, void **buff, int nsamps, int cc)
|
||||
{
|
||||
usrp_state_t *s = (usrp_state_t *)device->priv;
|
||||
int samples_received=0;
|
||||
int nsamps2; // aligned to upper 32 or 16 byte boundary
|
||||
@@ -817,7 +823,7 @@ static bool is_equal(double a, double b) {
|
||||
}
|
||||
|
||||
void *freq_thread(void *arg) {
|
||||
openair0_device *device=(openair0_device *)arg;
|
||||
openair0_device_t *device=(openair0_device_t *)arg;
|
||||
usrp_state_t *s = (usrp_state_t *)device->priv;
|
||||
uhd::tune_request_t tx_tune_req(device->openair0_cfg[0].tx_freq[0],
|
||||
device->openair0_cfg[0].tune_offset);
|
||||
@@ -833,7 +839,7 @@ void *freq_thread(void *arg) {
|
||||
* \param dummy dummy variable not used
|
||||
* \returns 0 in success
|
||||
*/
|
||||
int trx_usrp_set_freq(openair0_device *device, openair0_config_t *openair0_cfg)
|
||||
int trx_usrp_set_freq(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
usrp_state_t *s = (usrp_state_t *)device->priv;
|
||||
printf("Setting USRP TX Freq %f, RX Freq %f, tune_offset: %f\n", openair0_cfg[0].tx_freq[0], openair0_cfg[0].rx_freq[0], openair0_cfg[0].tune_offset);
|
||||
@@ -851,7 +857,8 @@ int trx_usrp_set_freq(openair0_device *device, openair0_config_t *openair0_cfg)
|
||||
* \param openair0_cfg RF frontend parameters set by application
|
||||
* \returns 0 in success
|
||||
*/
|
||||
int openair0_set_rx_frequencies(openair0_device *device, openair0_config_t *openair0_cfg) {
|
||||
int openair0_set_rx_frequencies(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
usrp_state_t *s = (usrp_state_t *)device->priv;
|
||||
uhd::tune_request_t rx_tune_req(openair0_cfg[0].rx_freq[0], openair0_cfg[0].tune_offset);
|
||||
printf("In openair0_set_rx_frequencies, freq: %f, tune offset: %f\n",
|
||||
@@ -867,8 +874,9 @@ int openair0_set_rx_frequencies(openair0_device *device, openair0_config_t *open
|
||||
* \param openair0_cfg RF frontend parameters set by application
|
||||
* \returns 0 in success
|
||||
*/
|
||||
int trx_usrp_set_gains(openair0_device *device,
|
||||
openair0_config_t *openair0_cfg) {
|
||||
int trx_usrp_set_gains(openair0_device_t *device,
|
||||
openair0_config_t *openair0_cfg)
|
||||
{
|
||||
usrp_state_t *s = (usrp_state_t *)device->priv;
|
||||
::uhd::gain_range_t gain_range_tx = s->usrp->get_tx_gain_range(0);
|
||||
s->usrp->set_tx_gain(gain_range_tx.stop()-openair0_cfg[0].tx_gain[0]);
|
||||
@@ -892,7 +900,8 @@ int trx_usrp_set_gains(openair0_device *device,
|
||||
/*! \brief Stop USRP
|
||||
* \param card refers to the hardware index to use
|
||||
*/
|
||||
int trx_usrp_stop(openair0_device *device) {
|
||||
int trx_usrp_stop(openair0_device_t *device)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -1012,7 +1021,8 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index,int bw_
|
||||
* \param device the hardware to use
|
||||
* \returns 0 on success
|
||||
*/
|
||||
int trx_usrp_get_stats(openair0_device *device) {
|
||||
int trx_usrp_get_stats(openair0_device_t *device)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -1020,7 +1030,8 @@ int trx_usrp_get_stats(openair0_device *device) {
|
||||
* \param device the hardware to use
|
||||
* \returns 0 on success
|
||||
*/
|
||||
int trx_usrp_reset_stats(openair0_device *device) {
|
||||
int trx_usrp_reset_stats(openair0_device_t *device)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -1047,7 +1058,8 @@ static void usrp_sync_pps(usrp_state_t *s)
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
|
||||
int device_init(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
LOG_I(HW, "openair0_cfg[0].sdr_addrs == '%s'\n", openair0_cfg[0].sdr_addrs);
|
||||
LOG_I(HW, "openair0_cfg[0].clock_source == '%d' (internal = %d, external = %d)\n", openair0_cfg[0].clock_source,internal,external);
|
||||
usrp_state_t *s ;
|
||||
|
||||
@@ -115,7 +115,7 @@ static void *emulator_timing_job(void *arg)
|
||||
/*! \brief Called to start the RF transceiver. Return 0 if OK, < 0 if error
|
||||
* \param device pointer to the device structure specific to the RF hardware target
|
||||
*/
|
||||
static int emulator_start(openair0_device *device)
|
||||
static int emulator_start(openair0_device_t *device)
|
||||
{
|
||||
// Start the timing thread and the noise device
|
||||
emulator_state_t *emulator_state = (emulator_state_t *)device->priv;
|
||||
@@ -163,7 +163,7 @@ static int emulator_start(openair0_device *device)
|
||||
* \param device pointer to the device structure specific to the RF hardware target
|
||||
* \returns 0 on success
|
||||
*/
|
||||
int emulator_get_stats(openair0_device *device)
|
||||
int emulator_get_stats(openair0_device_t *device)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
@@ -172,7 +172,7 @@ int emulator_get_stats(openair0_device *device)
|
||||
* \param device pointer to the device structure specific to the RF hardware target
|
||||
* \returns 0 on success
|
||||
*/
|
||||
int emulator_reset_stats(openair0_device *device)
|
||||
int emulator_reset_stats(openair0_device_t *device)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
@@ -180,7 +180,7 @@ int emulator_reset_stats(openair0_device *device)
|
||||
/*! \brief Terminate operation of the RF transceiver -- free all associated resources (if any)
|
||||
* \param pointer to the device structure specific to the RF hardware target
|
||||
*/
|
||||
static void emulator_end(openair0_device *device)
|
||||
static void emulator_end(openair0_device_t *device)
|
||||
{
|
||||
// Stop the timing thread and the noise device
|
||||
emulator_state_t *emulator_state = (emulator_state_t *)device->priv;
|
||||
@@ -197,7 +197,7 @@ static void emulator_end(openair0_device *device)
|
||||
/*! \brief Stop RF
|
||||
* \param device pointer to the device structure specific to the RF hardware target
|
||||
*/
|
||||
int emulator_stop(openair0_device *device)
|
||||
int emulator_stop(openair0_device_t *device)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
@@ -207,7 +207,7 @@ int emulator_stop(openair0_device *device)
|
||||
* \param openair0_cfg RF frontend parameters set by application
|
||||
* \returns 0 in success
|
||||
*/
|
||||
int emulator_set_gains(openair0_device *device, openair0_config_t *openair0_cfg)
|
||||
int emulator_set_gains(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
@@ -217,12 +217,12 @@ int emulator_set_gains(openair0_device *device, openair0_config_t *openair0_cfg)
|
||||
* \param openair0_cfg RF frontend parameters set by application
|
||||
* \returns 0 in success
|
||||
*/
|
||||
int emulator_set_freq(openair0_device *device, openair0_config_t *openair0_cfg)
|
||||
int emulator_set_freq(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
int emulator_write_init(openair0_device *device)
|
||||
int emulator_write_init(openair0_device_t *device)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
@@ -235,7 +235,7 @@ int emulator_write_init(openair0_device *device)
|
||||
* \param nbAnt number of antennas
|
||||
* \param flags flags must be set to true if timestamp parameter needs to be applied
|
||||
*/
|
||||
static int emulator_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int nbAnt, int flags)
|
||||
static int emulator_write(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int nbAnt, int flags)
|
||||
{
|
||||
emulator_state_t *emulator_state = (emulator_state_t *)device->priv;
|
||||
|
||||
@@ -297,7 +297,7 @@ static void read_noise(void *buff, int nsamps)
|
||||
* \param nbAnt number of antennas
|
||||
* \returns the number of samples read
|
||||
*/
|
||||
static int emulator_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int nbAnt)
|
||||
static int emulator_read(openair0_device_t *device, openair0_timestamp_t *ptimestamp, void **buff, int nsamps, int nbAnt)
|
||||
{
|
||||
emulator_state_t *emulator_state = (emulator_state_t *)device->priv;
|
||||
|
||||
@@ -339,7 +339,7 @@ static void emulator_readconfig(emulator_state_t *emulator_state)
|
||||
AssertFatal(ret >= 0, "configuration couldn't be performed\n");
|
||||
}
|
||||
|
||||
int device_init(openair0_device *device, openair0_config_t *openair0_cfg)
|
||||
int device_init(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
LOG_I(HW, "This is emulator RF that does nothing\n");
|
||||
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ void oran_fh_if4p5_south_out(RU_t *ru, int frame, int slot, uint64_t timestamp);
|
||||
|
||||
void oran_fh_if4p5_south_in(RU_t *ru, int *frame, int *slot);
|
||||
|
||||
int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params);
|
||||
int transport_init(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params);
|
||||
|
||||
typedef struct {
|
||||
eth_state_t e;
|
||||
|
||||
+13
-13
@@ -55,7 +55,7 @@ typedef struct {
|
||||
|
||||
notifiedFIFO_t oran_sync_fifo;
|
||||
|
||||
int trx_oran_start(openair0_device *device)
|
||||
int trx_oran_start(openair0_device_t *device)
|
||||
{
|
||||
printf("ORAN: %s\n", __FUNCTION__);
|
||||
|
||||
@@ -71,14 +71,14 @@ int trx_oran_start(openair0_device *device)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void trx_oran_end(openair0_device *device)
|
||||
void trx_oran_end(openair0_device_t *device)
|
||||
{
|
||||
printf("ORAN: %s\n", __FUNCTION__);
|
||||
oran_eth_state_t *s = device->priv;
|
||||
xran_close(s->oran_priv);
|
||||
}
|
||||
|
||||
int trx_oran_stop(openair0_device *device)
|
||||
int trx_oran_stop(openair0_device_t *device)
|
||||
{
|
||||
printf("ORAN: %s\n", __FUNCTION__);
|
||||
oran_eth_state_t *s = device->priv;
|
||||
@@ -91,19 +91,19 @@ int trx_oran_stop(openair0_device *device)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int trx_oran_set_freq(openair0_device *device, openair0_config_t *openair0_cfg)
|
||||
int trx_oran_set_freq(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
printf("ORAN: %s\n", __FUNCTION__);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int trx_oran_set_gains(openair0_device *device, openair0_config_t *openair0_cfg)
|
||||
int trx_oran_set_gains(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
printf("ORAN: %s\n", __FUNCTION__);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int trx_oran_get_stats(openair0_device *device)
|
||||
int trx_oran_get_stats(openair0_device_t *device)
|
||||
{
|
||||
uint64_t total_time, used_time;
|
||||
uint32_t num_core_used, core_used[64];
|
||||
@@ -114,25 +114,25 @@ int trx_oran_get_stats(openair0_device *device)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int trx_oran_reset_stats(openair0_device *device)
|
||||
int trx_oran_reset_stats(openair0_device_t *device)
|
||||
{
|
||||
printf("ORAN: %s\n", __FUNCTION__);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int ethernet_tune(openair0_device *device, unsigned int option, int value)
|
||||
int ethernet_tune(openair0_device_t *device, unsigned int option, int value)
|
||||
{
|
||||
printf("ORAN: %s\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int trx_oran_write_raw(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags)
|
||||
int trx_oran_write_raw(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags)
|
||||
{
|
||||
printf("ORAN: %s\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int trx_oran_read_raw(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc)
|
||||
int trx_oran_read_raw(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc)
|
||||
{
|
||||
printf("ORAN: %s\n", __FUNCTION__);
|
||||
return 0;
|
||||
@@ -160,7 +160,7 @@ char *msg_type(int t)
|
||||
return s[t];
|
||||
}
|
||||
|
||||
int trx_oran_ctlsend(openair0_device *device, void *msg, ssize_t msg_len)
|
||||
int trx_oran_ctlsend(openair0_device_t *device, void *msg, ssize_t msg_len)
|
||||
{
|
||||
RRU_CONFIG_msg_t *rru_config_msg = msg;
|
||||
oran_eth_state_t *s = device->priv;
|
||||
@@ -174,7 +174,7 @@ int trx_oran_ctlsend(openair0_device *device, void *msg, ssize_t msg_len)
|
||||
return msg_len;
|
||||
}
|
||||
|
||||
int trx_oran_ctlrecv(openair0_device *device, void *msg, ssize_t msg_len)
|
||||
int trx_oran_ctlrecv(openair0_device_t *device, void *msg, ssize_t msg_len)
|
||||
{
|
||||
RRU_CONFIG_msg_t *rru_config_msg = msg;
|
||||
oran_eth_state_t *s = device->priv;
|
||||
@@ -316,7 +316,7 @@ void *get_internal_parameter(char *name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
__attribute__((__visibility__("default"))) int transport_init(openair0_device *device,
|
||||
__attribute__((__visibility__("default"))) int transport_init(openair0_device_t *device,
|
||||
openair0_config_t *openair0_cfg,
|
||||
eth_params_t *eth_params)
|
||||
{
|
||||
|
||||
@@ -57,7 +57,8 @@ static void busy_wait(uint32_t usecs) {
|
||||
//LOG_I(HW, "Expected: %d Elapsed: %d us\n", usecs, elapsed_usecs);
|
||||
}
|
||||
|
||||
static void parse_iqfile_header(openair0_device *device, iqfile_header_t *iq_fh) {
|
||||
static void parse_iqfile_header(openair0_device_t *device, iqfile_header_t *iq_fh)
|
||||
{
|
||||
char tmp[4]=OAIIQFILE_ID;
|
||||
AssertFatal((memcmp(iq_fh->oaiid,tmp,sizeof(iq_fh->oaiid)) == 0),
|
||||
"iqfile doesn't seem to be compatible with oai (invalid id %.4s in header)\n",
|
||||
@@ -69,11 +70,11 @@ static void parse_iqfile_header(openair0_device *device, iqfile_header_t *iq_fh)
|
||||
LOG_UI(HW,"Replay iqs from %s device, bandwidth %e\n",get_devname(iq_fh->devtype),iq_fh->bw);
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Called to start the iqplayer device. Return 0 if OK, < 0 if error
|
||||
@param device pointer to the device structure specific to the RF hardware target
|
||||
*/
|
||||
static int iqplayer_loadfile(openair0_device *device, openair0_config_t *openair0_cfg) {
|
||||
static int iqplayer_loadfile(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
recplay_state_t *s = device->recplay_state;
|
||||
recplay_conf_t *c = openair0_cfg->recplay_conf;
|
||||
|
||||
@@ -142,7 +143,7 @@ static int iqplayer_loadfile(openair0_device *device, openair0_config_t *openair
|
||||
* \param device the hardware to use
|
||||
* \returns 0 on success
|
||||
*/
|
||||
static int trx_iqplayer_get_stats(openair0_device *device)
|
||||
static int trx_iqplayer_get_stats(openair0_device_t *device)
|
||||
{
|
||||
LOG_I(HW, "trx_iqplayer_get_stats() called, not implemented\n");
|
||||
return 0;
|
||||
@@ -152,7 +153,7 @@ static int trx_iqplayer_get_stats(openair0_device *device)
|
||||
* \param device the hardware to use
|
||||
* \returns 0 in success
|
||||
*/
|
||||
static int trx_iqplayer_reset_stats(openair0_device *device)
|
||||
static int trx_iqplayer_reset_stats(openair0_device_t *device)
|
||||
{
|
||||
LOG_I(HW, "trx_iqplayer_reset_stats() called, not implemented\n");
|
||||
return 0;
|
||||
@@ -160,7 +161,7 @@ static int trx_iqplayer_reset_stats(openair0_device *device)
|
||||
|
||||
/*! \brief Stop operation of the transceiver
|
||||
*/
|
||||
static int trx_iqplayer_stop(openair0_device *device)
|
||||
static int trx_iqplayer_stop(openair0_device_t *device)
|
||||
{
|
||||
LOG_I(HW, "trx_iqplayer_stop() called, not implemented\n");
|
||||
return 0;
|
||||
@@ -171,7 +172,7 @@ static int trx_iqplayer_stop(openair0_device *device)
|
||||
* \param openair0_cfg RF frontend parameters set by application
|
||||
* \returns 0 in success
|
||||
*/
|
||||
static int trx_iqplayer_set_freq(openair0_device *device, openair0_config_t *openair0_cfg)
|
||||
static int trx_iqplayer_set_freq(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
LOG_I(HW, "trx_iqplayer_set_freq() called, not implemented\n");
|
||||
return 0;
|
||||
@@ -182,7 +183,7 @@ static int trx_iqplayer_set_freq(openair0_device *device, openair0_config_t *ope
|
||||
* \param openair0_cfg RF frontend parameters set by application
|
||||
* \returns 0 in success
|
||||
*/
|
||||
static int trx_iqplayer_set_gains(openair0_device *device, openair0_config_t *openair0_cfg)
|
||||
static int trx_iqplayer_set_gains(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
LOG_I(HW, "trx_iqplayer_set_gains() called, not implemented\n");
|
||||
return 0;
|
||||
@@ -191,14 +192,16 @@ static int trx_iqplayer_set_gains(openair0_device *device, openair0_config_t *op
|
||||
/*! \brief start the oai iq player
|
||||
* \param device, the hardware used
|
||||
*/
|
||||
static int trx_iqplayer_start(openair0_device *device) {
|
||||
static int trx_iqplayer_start(openair0_device_t *device)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*! \brief Terminate operation of the oai iq player
|
||||
* \param device, the hardware used
|
||||
*/
|
||||
static void trx_iqplayer_end(openair0_device *device) {
|
||||
static void trx_iqplayer_end(openair0_device_t *device)
|
||||
{
|
||||
if (device == NULL)
|
||||
return;
|
||||
if (device->recplay_state == NULL)
|
||||
@@ -218,7 +221,6 @@ static void trx_iqplayer_end(openair0_device *device) {
|
||||
close(device->recplay_state->fd);
|
||||
device->recplay_state->fd = -1;
|
||||
}
|
||||
|
||||
}
|
||||
/*! \brief Write iqs function when in replay mode, just introduce a delay, as configured at init time,
|
||||
@param device pointer to the device structure specific to the RF hardware target
|
||||
@@ -228,7 +230,8 @@ static void trx_iqplayer_end(openair0_device *device) {
|
||||
@param antenna_id index of the antenna if the device has multiple antennas
|
||||
@param flags flags must be set to true if timestamp parameter needs to be applied
|
||||
*/
|
||||
static int trx_iqplayer_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
|
||||
static int trx_iqplayer_write(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags)
|
||||
{
|
||||
struct timespec req;
|
||||
req.tv_sec = 0;
|
||||
req.tv_nsec = device->openair0_cfg->recplay_conf->u_sf_write_delay * 1000;
|
||||
@@ -247,7 +250,8 @@ static int trx_iqplayer_write(openair0_device *device, openair0_timestamp timest
|
||||
* \param antenna_id Index of antenna for which to receive samples
|
||||
* \returns the number of sample read
|
||||
*/
|
||||
static int trx_iqplayer_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) {
|
||||
static int trx_iqplayer_read(openair0_device_t *device, openair0_timestamp_t *ptimestamp, void **buff, int nsamps, int cc)
|
||||
{
|
||||
recplay_state_t *s = device->recplay_state;
|
||||
static struct timeval tprev;
|
||||
static int read_count = 0;
|
||||
@@ -324,7 +328,8 @@ static int trx_iqplayer_read(openair0_device *device, openair0_timestamp *ptimes
|
||||
return nsamps;
|
||||
}
|
||||
|
||||
int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
|
||||
int device_init(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
device->openair0_cfg = openair0_cfg;
|
||||
device->trx_start_func = trx_iqplayer_start;
|
||||
device->trx_get_stats_func = trx_iqplayer_get_stats;
|
||||
|
||||
+29
-27
@@ -64,42 +64,44 @@ This is equivalent to using `-w SIMU` when running the `build_oai` script.
|
||||
To use the RF simulator add the `--rfsim` option to the command line. By
|
||||
default the RF simulator device will try to connect to host 127.0.0.1, port
|
||||
4043, which is usually the behavior for the UE. For the eNB/gNB, you either
|
||||
have to pass `--rfsimulator.serveraddr server` on the command line, or specify
|
||||
have to pass `--rfsimulator.[0].serveraddr server` on the command line, or specify
|
||||
the corresponding section in the configuration file.
|
||||
|
||||
The RF simulator is using the configuration module, and its parameters are defined in a specific section called "rfsimulator". Add the following options to the command line in order to enable different RFSim features:
|
||||
|
||||
| CL option | usage | default |
|
||||
|:--------------------- |:-------------------------------------------------------------------------------|----: |
|
||||
|`--rfsimulator.serveraddr <addr>` | IPv4v6 address or DNS name to connect to, or `server` to behave as a IPv4v6 TCP server | 127.0.0.1 |
|
||||
|`--rfsimulator.serverport <port>` | port number to connect to or to listen on (eNB, which behaves as a tcp server) | 4043 |
|
||||
|`--rfsimulator.options` | list of comma separated run-time options, two are supported: `chanmod`, `saviq`| all options disabled |
|
||||
|`--rfsimulator.options saviq` | store IQs to a file for future replay | disabled |
|
||||
|`--rfsimulator.options chanmod` | enable the channel model | disabled |
|
||||
|`--rfsimulator.IQfile <file>` | path to a file to store the IQ samples to (only with `saviq`) | `/tmp/rfsimulator.iqs` |
|
||||
|`--rfsimulator.prop_delay` | simulated receive-path (gNB: UL, UE: DL) propagation delay in ms | 0 |
|
||||
|`--rfsimulator.wait_timeout` | wait timeout when no UE is connected | 1 |
|
||||
| CL option | usage | default |
|
||||
|:-------------------------------------|:-------------------------------------------------------------------------------|----: |
|
||||
|`--rfsimulator.[0].serveraddr <addr>` | IPv4v6 address or DNS name to connect to, or `server` to behave as a IPv4v6 TCP server | 127.0.0.1 |
|
||||
|`--rfsimulator.[0].serverport <port>` | port number to connect to or to listen on (eNB, which behaves as a tcp server) | 4043 |
|
||||
|`--rfsimulator.[0].options` | list of comma separated run-time options, two are supported: `chanmod`, `saviq`| all options disabled |
|
||||
|`--rfsimulator.[0].options saviq` | store IQs to a file for future replay | disabled |
|
||||
|`--rfsimulator.[0].options chanmod` | enable the channel model | disabled |
|
||||
|`--rfsimulator.[0].IQfile <file>` | path to a file to store the IQ samples to (only with `saviq`) | `/tmp/rfsimulator.iqs` |
|
||||
|`--rfsimulator.[0].prop_delay` | simulated receive-path (gNB: UL, UE: DL) propagation delay in ms | 0 |
|
||||
|`--rfsimulator.[0].wait_timeout` | wait timeout when no UE is connected | 1 |
|
||||
|
||||
Please refer to this document [`SIMULATION/TOOLS/DOC/channel_simulation.md`](../../openair1/SIMULATION/TOOLS/DOC/channel_simulation.md) for information about using the RFSimulator options to run the simulator with a channel model.
|
||||
|
||||
## 4G case
|
||||
|
||||
For the eNB, use a valid configuration file setup for the USRP board tests and start the softmodem with the `--rfsim` and `--rfsimulator.serveraddr server` options.
|
||||
For the eNB, use a valid configuration file setup for the USRP board tests and start the softmodem with the `--rfsim` and `--rfsimulator.[0].serveraddr server` options.
|
||||
```bash
|
||||
sudo ./lte-softmodem -O <config file> --rfsim --rfsimulator.serveraddr server
|
||||
sudo ./lte-softmodem -O <config file> --rfsim --rfsimulator.[0].serveraddr server
|
||||
```
|
||||
Often, configuration files define the corresponding `rfsimulator` section, in
|
||||
which case you might omit `--rfsimulator.serveraddr server`. Example:
|
||||
which case you might omit `--rfsimulator.[0].serveraddr server`. Example:
|
||||
```
|
||||
rfsimulator : {
|
||||
serveraddr = "server";
|
||||
};
|
||||
rfsimulator = (
|
||||
{
|
||||
serveraddr = "server";
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
For the UE, it should be set to the IP address of the eNB. For instance, if the
|
||||
eNB runs on another host with IP `192.168.2.200`, do
|
||||
```bash
|
||||
sudo ./lte-uesoftmodem -C 2685000000 -r 50 --rfsim --rfsimulator.serveraddr 192.168.2.200
|
||||
sudo ./lte-uesoftmodem -C 2685000000 -r 50 --rfsim --rfsimulator.[0].serveraddr 192.168.2.200
|
||||
```
|
||||
For running on the same host, only `--rfsim` is necessary.
|
||||
|
||||
@@ -117,7 +119,7 @@ Similarly as for 4G, first launch the gNB, here in an example for the phytest:
|
||||
run gNB:
|
||||
|
||||
```bash
|
||||
sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf --gNBs.[0].min_rxtxtime 6 --phy-test --rfsim --rfsimulator.serveraddr server
|
||||
sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf --gNBs.[0].min_rxtxtime 6 --phy-test --rfsim --rfsimulator.[0].serveraddr server
|
||||
```
|
||||
|
||||
where `--gNBs.[0].min_rxtxtime 6` is due to the UE not being able to handle shorter
|
||||
@@ -127,19 +129,19 @@ in the config file.
|
||||
and run UE:
|
||||
|
||||
```bash
|
||||
sudo ./nr-uesoftmodem --rfsim --phy-test --rfsimulator.serveraddr <TARGET_GNB_IP_ADDRESS>
|
||||
sudo ./nr-uesoftmodem --rfsim --phy-test --rfsimulator.[0].serveraddr <TARGET_GNB_IP_ADDRESS>
|
||||
```
|
||||
|
||||
To run OAI RFSimulator for SA mode, gNB:
|
||||
|
||||
```bash
|
||||
sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --rfsim --rfsimulator.serveraddr server
|
||||
sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --rfsim --rfsimulator.[0].serveraddr server
|
||||
```
|
||||
|
||||
and UE:
|
||||
|
||||
```bash
|
||||
sudo ./nr-uesoftmodem --rfsim --rfsimulator.serveraddr <TARGET_GNB_IP_ADDRESS>
|
||||
sudo ./nr-uesoftmodem --rfsim --rfsimulator.[0].serveraddr <TARGET_GNB_IP_ADDRESS>
|
||||
```
|
||||
|
||||
In the commands for the UE, `TARGET_GNB_IP_ADDRESS` can be 127.0.0.1 if both UE and gNB run on the same machine.
|
||||
@@ -182,7 +184,7 @@ In case of a transparent GEO satellite, the minumum one-way propagation delay (D
|
||||
So, additionally to other parameters, this parameter should be given when executing the gNB and the UE executables:
|
||||
|
||||
```
|
||||
--rfsimulator.prop_delay 238.74
|
||||
--rfsimulator.[0].prop_delay 238.74
|
||||
```
|
||||
|
||||
Note:
|
||||
@@ -218,8 +220,8 @@ RFsimulator supports beam domain simulation.
|
||||
|
||||
Several new CLI parameters were added
|
||||
|
||||
* `--rfsimulator.enable_beams` : enable beam domain simulation. Should match on server and all clients.
|
||||
* `--rfsimulator.beam_gains <comma separated list>` : define a matrix of additional pathloss values (in dB)
|
||||
* `--rfsimulator.[0].enable_beams` : enable beam domain simulation. Should match on server and all clients.
|
||||
* `--rfsimulator.[0].beam_gains <comma separated list>` : define a matrix of additional pathloss values (in dB)
|
||||
to simulate the effect of different beam combinations in the RF simulator. You provide a comma-separated
|
||||
list of numbers, which forms the first row of a square matrix. The rest of the matrix is filled by projecting
|
||||
these values onto the diagonals, making it symmetric.
|
||||
@@ -236,10 +238,10 @@ these values onto the diagonals, making it symmetric.
|
||||
Using the example above, if gNB is receiving in beam 1 and the UE is transmitting in beam 1, an additional
|
||||
2 dB pathloss will be applied on top of the pathloss from the channel model (if present).
|
||||
|
||||
* `--rfsimulator.beam_map <beam_map>` : where `<beam_map>` is a `uint64_t` value where each bit is an enabled TX/RX beam.
|
||||
* `--rfsimulator.[0].beam_map <beam_map>` : where `<beam_map>` is a `uint64_t` value where each bit is an enabled TX/RX beam.
|
||||
For gNB: Initial beam_map, i.e. which beams gNB transmits/receives before calling beam APIs.
|
||||
For UE: Beam position in beam space in the simulation. The UE is not expected to use the beam APIs for now.
|
||||
* `--rfsimulator.beam_ids <beam_ids>` : where `<beam_ids>` is a comma separated list. Same as above but added for convenience.
|
||||
* `--rfsimulator.[0].beam_ids <beam_ids>` : where `<beam_ids>` is a comma separated list. Same as above but added for convenience.
|
||||
|
||||
## Runtime commands
|
||||
|
||||
|
||||
@@ -27,9 +27,8 @@
|
||||
#include "openair2/LAYER2/NR_MAC_gNB/mac_config.h"
|
||||
#include "rfsimulator.h"
|
||||
|
||||
void update_channel_model(channel_desc_t *channelDesc, uint64_t TS)
|
||||
void update_channel_model(channel_desc_t *channelDesc, int nbSamples, uint64_t TS)
|
||||
{
|
||||
static uint64_t last_TS = 0;
|
||||
if ((channelDesc->sat_height > 0)
|
||||
&& (channelDesc->enable_dynamic_delay
|
||||
|| channelDesc->enable_dynamic_Doppler)) { // model for transparent satellite on circular orbit
|
||||
@@ -137,8 +136,7 @@ void update_channel_model(channel_desc_t *channelDesc, uint64_t TS)
|
||||
if (channelDesc->enable_dynamic_Doppler)
|
||||
channelDesc->Doppler_phase_inc = 2 * M_PI * f_Doppler_shift_ue_sat / channelDesc->sampling_rate;
|
||||
|
||||
if (TS - last_TS >= channelDesc->sampling_rate) {
|
||||
last_TS = TS;
|
||||
if (TS / (unsigned int)channelDesc->sampling_rate != (TS + nbSamples) / (unsigned int)channelDesc->sampling_rate) {
|
||||
LOG_I(HW,
|
||||
"Satellite orbit: time %f s, Position = (%f, %f, %f), Velocity = (%f, %f, %f)\n",
|
||||
t,
|
||||
@@ -204,8 +202,7 @@ void update_channel_model(channel_desc_t *channelDesc, uint64_t TS)
|
||||
if (channelDesc->enable_dynamic_Doppler)
|
||||
channelDesc->Doppler_phase_inc = 2 * M_PI * f_Doppler_shift_sat_ue / channelDesc->sampling_rate;
|
||||
|
||||
if (TS - last_TS >= channelDesc->sampling_rate) {
|
||||
last_TS = TS;
|
||||
if (TS / (unsigned int)channelDesc->sampling_rate != (TS + nbSamples) / (unsigned int)channelDesc->sampling_rate) {
|
||||
LOG_I(HW,
|
||||
"Satellite orbit: time %f s, Position = (%f, %f, %f), Velocity = (%f, %f, %f)\n",
|
||||
t,
|
||||
|
||||
@@ -30,5 +30,5 @@ void rxAddInput(c16_t **input_sig,
|
||||
channel_desc_t *channelDesc,
|
||||
int nbSamples,
|
||||
uint64_t TS);
|
||||
void update_channel_model(channel_desc_t *channelDesc, uint64_t TS);
|
||||
void update_channel_model(channel_desc_t *channelDesc, int nbSamples, uint64_t TS);
|
||||
#endif
|
||||
|
||||
+104
-63
@@ -81,7 +81,19 @@ typedef enum { SIMU_ROLE_SERVER = 1, SIMU_ROLE_CLIENT } simuRole;
|
||||
//
|
||||
|
||||
#define RFSIMU_SECTION "rfsimulator"
|
||||
#define RFSIMU_SERVER_ADDR "serveraddr"
|
||||
#define RFSIMU_SERVER_PORT "serverport"
|
||||
#define RFSIMU_OPTIONS_PARAMNAME "options"
|
||||
#define RFSIMU_IQFILE "IQfile"
|
||||
#define RFSIMU_MODELNAME "modelname"
|
||||
#define RFSIMU_PLOSS "ploss"
|
||||
#define RFSIMU_FORGETFACT "forgetfact"
|
||||
#define RFSIMU_OFFSET "offset"
|
||||
#define RFSIMU_PROP_DELAY "prop_delay"
|
||||
#define RFSIMU_WAIT_TIMEOUT "wait_timeout"
|
||||
#define RFSIMU_ENABLE_BEAMS "enable_beams"
|
||||
#define RFSIMU_NUM_CONCURRENT_BEAMS "num_concurrent_beams"
|
||||
#define RFSIMU_BEAM_MAP "beam_map"
|
||||
#define RFSIMU_BEAM_GAINS "beam_gains"
|
||||
#define RFSIMU_BEAM_IDS "beam_ids"
|
||||
|
||||
@@ -98,19 +110,19 @@ typedef enum { SIMU_ROLE_SERVER = 1, SIMU_ROLE_CLIENT } simuRole;
|
||||
/* optname helpstr paramflags XXXptr defXXXval */
|
||||
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#define RFSIMULATOR_PARAMS_DESC { \
|
||||
STRINGPARAM("serveraddr", "<ip address to connect to>\n", simOpt, &rfsimulator->ip, "127.0.0.1"), \
|
||||
UINT16PARAM("serverport", "<port to connect to>\n", simOpt, &rfsimulator->port, PORT), \
|
||||
STRINGPARAM(RFSIMU_SERVER_ADDR, "<ip address to connect to>\n", simOpt, NULL, "127.0.0.1"), \
|
||||
UINT16PARAM(RFSIMU_SERVER_PORT, "<port to connect to>\n", simOpt, NULL, PORT), \
|
||||
STRLISTPARAM(RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS, simOpt, NULL, NULL), \
|
||||
STRINGPARAM("IQfile", "<file path to use when saving IQs>\n", simOpt, &saveF, "/tmp/rfsimulator.iqs"),\
|
||||
STRINGPARAM("modelname", "<channel model name>\n", simOpt, &modelname, "AWGN"), \
|
||||
DOUBLEPARAM("ploss", "<channel path loss in dB>\n", simOpt, &rfsimulator->chan_pathloss, 0), \
|
||||
DOUBLEPARAM("forgetfact", "<channel forget factor ((0 to 1)>\n", simOpt, &rfsimulator->chan_forgetfact, 0), \
|
||||
UINT64PARAM("offset", "<channel offset in samps>\n", simOpt, &rfsimulator->chan_offset, 0L), \
|
||||
DOUBLEPARAM("prop_delay", "<propagation delay in ms>\n", simOpt, &(rfsimulator->prop_delay_ms), 0.0), \
|
||||
INTPARAM("wait_timeout", "<wait timeout if no UE connected>\n", simOpt, &rfsimulator->wait_timeout, 1), \
|
||||
BOOLPARAM("enable_beams", "<enable simplified beam simulation>\n", simBool,&(beam_ctrl->enable_beams), 0), \
|
||||
INTPARAM("num_concurrent_beams", "<number of concurrent beams supported>\n", simOpt, &beam_ctrl->num_concurrent_beams, 1), \
|
||||
UINT64PARAM("beam_map", "<initial beam map>\n", simOpt, &beam_map, 1), \
|
||||
STRINGPARAM(RFSIMU_IQFILE, "<file path to use when saving IQs>\n", simOpt, NULL, "/tmp/rfsimulator.iqs"),\
|
||||
STRINGPARAM(RFSIMU_MODELNAME, "<channel model name>\n", simOpt, NULL, "AWGN"), \
|
||||
DOUBLEPARAM(RFSIMU_PLOSS, "<channel path loss in dB>\n", simOpt, NULL, 0), \
|
||||
DOUBLEPARAM(RFSIMU_FORGETFACT, "<channel forget factor ((0 to 1)>\n", simOpt, NULL, 0), \
|
||||
UINT64PARAM(RFSIMU_OFFSET, "<channel offset in samps>\n", simOpt, NULL, 0L), \
|
||||
DOUBLEPARAM(RFSIMU_PROP_DELAY, "<propagation delay in ms>\n", simOpt, NULL, 0.0), \
|
||||
INTPARAM(RFSIMU_WAIT_TIMEOUT, "<wait timeout if no UE connected>\n", simOpt, NULL, 1), \
|
||||
BOOLPARAM(RFSIMU_ENABLE_BEAMS, "<enable simplified beam simulation>\n", simBool,NULL, 0), \
|
||||
INTPARAM(RFSIMU_NUM_CONCURRENT_BEAMS, "<number of concurrent beams supported>\n", simOpt, NULL, 1), \
|
||||
UINT64PARAM(RFSIMU_BEAM_MAP, "<initial beam map>\n", simOpt, NULL, 1), \
|
||||
STRINGPARAM(RFSIMU_BEAM_IDS, "<initial beam ids>\n", simOpt, NULL, NULL), \
|
||||
STRINGPARAM(RFSIMU_BEAM_GAINS, "<beam gain matrix in toeplitz form>\n", simOpt, NULL, NULL), \
|
||||
};
|
||||
@@ -141,7 +153,7 @@ typedef c16_t sample_t; // 2*16 bits complex number
|
||||
|
||||
typedef struct beam_switch_command_t {
|
||||
std::vector<int> beams;
|
||||
openair0_timestamp timestamp;
|
||||
openair0_timestamp_t timestamp;
|
||||
} beam_switch_command_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -157,7 +169,7 @@ typedef struct {
|
||||
|
||||
typedef struct buffer_s {
|
||||
int conn_sock;
|
||||
openair0_timestamp lastReceivedTS;
|
||||
openair0_timestamp_t lastReceivedTS;
|
||||
bool headerMode;
|
||||
bool trashingPacket;
|
||||
samplesBlockHeader_t th;
|
||||
@@ -182,9 +194,10 @@ typedef struct {
|
||||
typedef struct {
|
||||
int listen_sock, epollfd;
|
||||
pthread_mutex_t Sockmutex;
|
||||
int ru_id;
|
||||
unsigned int nb_cnx;
|
||||
openair0_timestamp nextRxTstamp;
|
||||
openair0_timestamp lastWroteTS;
|
||||
openair0_timestamp_t nextRxTstamp;
|
||||
openair0_timestamp_t lastWroteTS;
|
||||
simuRole role;
|
||||
char *ip;
|
||||
uint16_t port;
|
||||
@@ -218,7 +231,7 @@ typedef struct {
|
||||
* @param nsamps_out output pointer to receive the number of samples until the next beam switch.
|
||||
* @return The beam map (uint64_t) valid for the given timestamp.
|
||||
*/
|
||||
static std::vector<int> get_beams(beam_state_t *beam_state, openair0_timestamp timestamp, uint32_t nsamps, uint32_t *nsamps_out)
|
||||
static std::vector<int> get_beams(beam_state_t *beam_state, openair0_timestamp_t timestamp, uint32_t nsamps, uint32_t *nsamps_out)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(beam_state->mutex);
|
||||
std::vector<int> current_beams = beam_state->beams;
|
||||
@@ -284,7 +297,7 @@ static uint64_t beams_to_beam_map(const std::vector<int> &beam_ids)
|
||||
* @param beam_state Pointer to the beam_state_t structure containing the command queue and current beam map.
|
||||
* @param timestamp The timestamp up to which commands should be processed and removed.
|
||||
*/
|
||||
static void clear_beam_queue(beam_state_t *beam_state, openair0_timestamp timestamp)
|
||||
static void clear_beam_queue(beam_state_t *beam_state, openair0_timestamp_t timestamp)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(beam_state->mutex);
|
||||
while (!beam_state->cmd_queue.empty()) {
|
||||
@@ -354,7 +367,7 @@ static buffer_t *allocCirBuf(rfsimulator_state_t *bridge, int sock)
|
||||
sizeofArray(modelname),
|
||||
"rfsimu_channel_%s%d",
|
||||
(bridge->role == SIMU_ROLE_SERVER) ? "ue" : "enB",
|
||||
bridge->nb_cnx - 1);
|
||||
(bridge->role == SIMU_ROLE_SERVER) ? bridge->nb_cnx - 1 : bridge->ru_id);
|
||||
ptr->channel_model = find_channel_desc_fromname(modelname); // path_loss in dB
|
||||
if (!ptr->channel_model) {
|
||||
// Use legacy method to find channel model - this will use the same channel model for all clients
|
||||
@@ -472,7 +485,7 @@ static float get_rx_gain_db(rfsimulator_state_t *rfsimulator, uint rx_beam, uint
|
||||
return rfsimulator->beam_ctrl->beam_gains[rx_beam][tx_beam];
|
||||
}
|
||||
|
||||
static int rfsimulator_set_beams(openair0_device *device, uint64_t beam_map, openair0_timestamp timestamp)
|
||||
static int rfsimulator_set_beams(openair0_device_t *device, uint64_t beam_map, openair0_timestamp_t timestamp)
|
||||
{
|
||||
rfsimulator_state_t *s = static_cast<rfsimulator_state_t *>(device->priv);
|
||||
rfsim_beam_ctrl_t *beam_ctrl = s->beam_ctrl;
|
||||
@@ -484,7 +497,7 @@ static int rfsimulator_set_beams(openair0_device *device, uint64_t beam_map, ope
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rfsimulator_set_beams_vector(openair0_device *device, int* beams, int num_beams, openair0_timestamp timestamp)
|
||||
static int rfsimulator_set_beams_vector(openair0_device_t *device, int *beams, int num_beams, openair0_timestamp_t timestamp)
|
||||
{
|
||||
rfsimulator_state_t *s = static_cast<rfsimulator_state_t *>(device->priv);
|
||||
rfsim_beam_ctrl_t *beam_ctrl = s->beam_ctrl;
|
||||
@@ -520,19 +533,45 @@ static void process_gains(char *str, rfsim_beam_ctrl_t *beam_ctrl)
|
||||
|
||||
static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator)
|
||||
{
|
||||
char *saveF = NULL;
|
||||
char *modelname = NULL;
|
||||
configmodule_interface_t *cfg = config_get_if();
|
||||
paramdef_t *rfsimuParam;
|
||||
paramdef_t rfsimuParams[] = RFSIMULATOR_PARAMS_DESC;
|
||||
paramlist_def_t rfsimuParamList = {RFSIMU_SECTION, NULL, 0};
|
||||
int ret = config_getlist(cfg, &rfsimuParamList, rfsimuParams, sizeofArray(rfsimuParams), NULL);
|
||||
if (ret < 0 || rfsimuParamList.numelt <= 0) {
|
||||
ret = config_get(cfg, rfsimuParams, sizeofArray(rfsimuParams), RFSIMU_SECTION);
|
||||
AssertFatal(ret >= 0, "configuration couldn't be performed\n");
|
||||
LOG_W(HW, "Warning: rfsimulator parameters should be provided as array elements!\n");
|
||||
rfsimuParam = rfsimuParams;
|
||||
} else {
|
||||
int ru_id = rfsimulator->ru_id;
|
||||
AssertFatal(rfsimuParamList.numelt > ru_id,
|
||||
"no rfsimulator parameters (numelt %d) specified for card %d\n",
|
||||
rfsimuParamList.numelt,
|
||||
ru_id);
|
||||
rfsimuParam = rfsimuParamList.paramarray[ru_id];
|
||||
}
|
||||
|
||||
rfsimulator->ip = strdup(*(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_SERVER_ADDR)->strptr));
|
||||
rfsimulator->port = *(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_SERVER_PORT)->u16ptr);
|
||||
char *saveF = strdup(*(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_IQFILE)->strptr));
|
||||
//char *modelname = strdup(*(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_MODELNAME)->strptr));
|
||||
rfsimulator->chan_pathloss = *(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_PLOSS)->dblptr);
|
||||
rfsimulator->chan_forgetfact = *(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_FORGETFACT)->dblptr);
|
||||
rfsimulator->chan_offset = *(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_OFFSET)->u64ptr);
|
||||
rfsimulator->prop_delay_ms = *(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_PROP_DELAY)->dblptr);
|
||||
rfsimulator->wait_timeout = *(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_WAIT_TIMEOUT)->iptr);
|
||||
|
||||
rfsim_beam_ctrl_t *beam_ctrl = rfsimulator->beam_ctrl;
|
||||
uint64_t beam_map = 1;
|
||||
paramdef_t rfsimu_params[] = RFSIMULATOR_PARAMS_DESC;
|
||||
int p = config_paramidx_fromname(rfsimu_params, sizeofArray(rfsimu_params), RFSIMU_OPTIONS_PARAMNAME);
|
||||
int ret = config_get(config_get_if(), rfsimu_params, sizeofArray(rfsimu_params), RFSIMU_SECTION);
|
||||
AssertFatal(ret >= 0, "configuration couldn't be performed\n");
|
||||
beam_ctrl->enable_beams = *(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_ENABLE_BEAMS)->iptr);
|
||||
beam_ctrl->num_concurrent_beams = *(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_NUM_CONCURRENT_BEAMS)->iptr);
|
||||
uint64_t beam_map = *(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_BEAM_MAP)->u64ptr);
|
||||
|
||||
rfsimulator->saveIQfile = -1;
|
||||
|
||||
for (int i = 0; i < rfsimu_params[p].numelt; i++) {
|
||||
if (strcmp(rfsimu_params[p].strlistptr[i], "saviq") == 0) {
|
||||
int p = config_paramidx_fromname(rfsimuParams, sizeofArray(rfsimuParams), RFSIMU_OPTIONS_PARAMNAME);
|
||||
for (int i = 0; i < rfsimuParam[p].numelt; i++) {
|
||||
if (strcmp(rfsimuParam[p].strlistptr[i], "saviq") == 0) {
|
||||
rfsimulator->saveIQfile = open(saveF, O_APPEND | O_CREAT | O_TRUNC | O_WRONLY, 0666);
|
||||
|
||||
if (rfsimulator->saveIQfile != -1)
|
||||
@@ -543,7 +582,7 @@ static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator)
|
||||
}
|
||||
|
||||
break;
|
||||
} else if (strcmp(rfsimu_params[p].strlistptr[i], "chanmod") == 0) {
|
||||
} else if (strcmp(rfsimuParam[p].strlistptr[i], "chanmod") == 0) {
|
||||
init_channelmod();
|
||||
load_channellist(rfsimulator->tx_num_channels,
|
||||
rfsimulator->rx_num_channels,
|
||||
@@ -552,24 +591,24 @@ static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator)
|
||||
rfsimulator->tx_bw);
|
||||
rfsimulator->channelmod = true;
|
||||
} else {
|
||||
fprintf(stderr, "unknown rfsimulator option: %s\n", rfsimu_params[p].strlistptr[i]);
|
||||
fprintf(stderr, "unknown rfsimulator option: %s\n", rfsimuParam[p].strlistptr[i]);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
int beam_gains_param_index = config_paramidx_fromname(rfsimu_params, sizeofArray(rfsimu_params), RFSIMU_BEAM_GAINS);
|
||||
if (rfsimu_params[beam_gains_param_index].strptr) {
|
||||
process_gains(*rfsimu_params[beam_gains_param_index].strptr, beam_ctrl);
|
||||
int beam_gains_param_index = config_paramidx_fromname(rfsimuParams, sizeofArray(rfsimuParams), RFSIMU_BEAM_GAINS);
|
||||
if (rfsimuParam[beam_gains_param_index].strptr) {
|
||||
process_gains(*rfsimuParam[beam_gains_param_index].strptr, beam_ctrl);
|
||||
}
|
||||
|
||||
std::vector<int> initial_beams = beam_map_to_beams(beam_map);
|
||||
beam_ctrl->rx.beams = initial_beams;
|
||||
beam_ctrl->tx.beams = initial_beams;
|
||||
|
||||
int beam_ids_param_index = config_paramidx_fromname(rfsimu_params, sizeofArray(rfsimu_params), RFSIMU_BEAM_IDS);
|
||||
if (rfsimu_params[beam_ids_param_index].strptr) {
|
||||
int beam_ids_param_index = config_paramidx_fromname(rfsimuParams, sizeofArray(rfsimuParams), RFSIMU_BEAM_IDS);
|
||||
if (rfsimuParam[beam_ids_param_index].strptr) {
|
||||
std::vector<int> beam_ids;
|
||||
std::stringstream ss(*rfsimu_params[beam_ids_param_index].strptr);
|
||||
std::stringstream ss(*rfsimuParam[beam_ids_param_index].strptr);
|
||||
std::string token;
|
||||
while (std::getline(ss, token, ',')) {
|
||||
beam_ids.push_back(std::stoi(token));
|
||||
@@ -769,13 +808,13 @@ static int rfsimu_getdistance_cmd(char *buff, int debug, telnet_printfunc_t prnt
|
||||
static int rfsimu_vtime_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg)
|
||||
{
|
||||
rfsimulator_state_t *t = (rfsimulator_state_t *)arg;
|
||||
const openair0_timestamp ts = t->nextRxTstamp;
|
||||
const openair0_timestamp_t ts = t->nextRxTstamp;
|
||||
const double sample_rate = t->sample_rate;
|
||||
prnt("%s: vtime measurement: TS %llu sample_rate %.3f\n", __func__, ts, sample_rate);
|
||||
return CMDSTATUS_FOUND;
|
||||
}
|
||||
|
||||
static int startServer(openair0_device *device)
|
||||
static int startServer(openair0_device_t *device)
|
||||
{
|
||||
int sock = -1;
|
||||
struct addrinfo *results = NULL;
|
||||
@@ -885,7 +924,7 @@ static int client_try_connect(const char *host, uint16_t port)
|
||||
return sock;
|
||||
}
|
||||
|
||||
static int startClient(openair0_device *device)
|
||||
static int startClient(openair0_device_t *device)
|
||||
{
|
||||
rfsimulator_state_t *t = static_cast<rfsimulator_state_t *>(device->priv);
|
||||
t->role = SIMU_ROLE_CLIENT;
|
||||
@@ -928,7 +967,7 @@ static int startClient(openair0_device *device)
|
||||
}
|
||||
|
||||
static int rfsimulator_write_internal(rfsimulator_state_t *t,
|
||||
openair0_timestamp timestamp,
|
||||
openair0_timestamp_t timestamp,
|
||||
void ***samplesVoid,
|
||||
int nsamps,
|
||||
int nbAnt,
|
||||
@@ -986,8 +1025,8 @@ static int rfsimulator_write_internal(rfsimulator_state_t *t,
|
||||
return nsamps;
|
||||
}
|
||||
|
||||
static int rfsimulator_write_beams(openair0_device *device,
|
||||
openair0_timestamp timestamp,
|
||||
static int rfsimulator_write_beams(openair0_device_t *device,
|
||||
openair0_timestamp_t timestamp,
|
||||
void ***samplesVoid,
|
||||
int nsamps,
|
||||
int nbAnt,
|
||||
@@ -1022,7 +1061,7 @@ static int rfsimulator_write_beams(openair0_device *device,
|
||||
return nsamps_initial;
|
||||
}
|
||||
|
||||
static int rfsimulator_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags)
|
||||
static int rfsimulator_write(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags)
|
||||
{
|
||||
void **tmp = buff;
|
||||
return rfsimulator_write_beams(device, timestamp, &tmp, nsamps, cc, 1, flags);
|
||||
@@ -1253,7 +1292,7 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, bool first_time)
|
||||
|
||||
static void rfsimulator_read_internal(rfsimulator_state_t *t,
|
||||
c16_t **samples,
|
||||
openair0_timestamp timestamp,
|
||||
openair0_timestamp_t timestamp,
|
||||
int nsamps,
|
||||
int nbAnt,
|
||||
int rx_beam_id,
|
||||
@@ -1355,8 +1394,8 @@ static void rfsimulator_read_internal(rfsimulator_state_t *t,
|
||||
}
|
||||
}
|
||||
|
||||
static int rfsimulator_read_beams(openair0_device *device,
|
||||
openair0_timestamp *ptimestamp,
|
||||
static int rfsimulator_read_beams(openair0_device_t *device,
|
||||
openair0_timestamp_t *ptimestamp,
|
||||
void ***samplesVoid,
|
||||
int nsamps,
|
||||
int nbAnt,
|
||||
@@ -1426,7 +1465,7 @@ static int rfsimulator_read_beams(openair0_device *device,
|
||||
buffer_t *ptr = &t->buf[sock];
|
||||
|
||||
if (ptr->conn_sock != -1 && ptr->channel_model != NULL) {
|
||||
update_channel_model(ptr->channel_model, t->nextRxTstamp);
|
||||
update_channel_model(ptr->channel_model, nsamps, t->nextRxTstamp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1438,7 +1477,7 @@ static int rfsimulator_read_beams(openair0_device *device,
|
||||
for (int a = 0; a < nbAnt; a++)
|
||||
memset(samplesVoid[beam][a], 0, sampleToByte(nsamps, 1));
|
||||
|
||||
openair0_timestamp timestamp = t->nextRxTstamp;
|
||||
openair0_timestamp_t timestamp = t->nextRxTstamp;
|
||||
int nsamps_to_process = nsamps;
|
||||
while (nsamps_to_process > 0) {
|
||||
uint32_t nsamps_beam_map;
|
||||
@@ -1488,7 +1527,7 @@ static int rfsimulator_read_beams(openair0_device *device,
|
||||
buffer_t *ptr = &t->buf[sock];
|
||||
|
||||
if (ptr->conn_sock != -1 && !ptr->received_packets.empty()) {
|
||||
openair0_timestamp timestamp_to_free = t->nextRxTstamp - 1;
|
||||
openair0_timestamp_t timestamp_to_free = t->nextRxTstamp - 1;
|
||||
if (ptr->channel_model) {
|
||||
timestamp_to_free -=
|
||||
(ptr->channel_model->channel_length - 1) + std::max(ptr->channel_model->channel_offset, t->chan_offset);
|
||||
@@ -1502,20 +1541,20 @@ static int rfsimulator_read_beams(openair0_device *device,
|
||||
return nsamps;
|
||||
}
|
||||
|
||||
static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, void **samplesVoid, int nsamps, int nbAnt)
|
||||
static int rfsimulator_read(openair0_device_t *device, openair0_timestamp_t *ptimestamp, void **samplesVoid, int nsamps, int nbAnt)
|
||||
{
|
||||
return rfsimulator_read_beams(device, ptimestamp, &samplesVoid, nsamps, nbAnt, 1);
|
||||
}
|
||||
|
||||
static int rfsimulator_get_stats(openair0_device *device)
|
||||
static int rfsimulator_get_stats(openair0_device_t *device)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static int rfsimulator_reset_stats(openair0_device *device)
|
||||
static int rfsimulator_reset_stats(openair0_device_t *device)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static void rfsimulator_end(openair0_device *device)
|
||||
static void rfsimulator_end(openair0_device_t *device)
|
||||
{
|
||||
rfsimulator_state_t *s = static_cast<rfsimulator_state_t *>(device->priv);
|
||||
for (int i = 0; i < MAX_FD_RFSIMU; i++) {
|
||||
@@ -1529,7 +1568,8 @@ static void rfsimulator_end(openair0_device *device)
|
||||
close(s->epollfd);
|
||||
free(s);
|
||||
}
|
||||
static void stopServer(openair0_device *device)
|
||||
|
||||
static void stopServer(openair0_device_t *device)
|
||||
{
|
||||
rfsimulator_state_t *t = (rfsimulator_state_t *)device->priv;
|
||||
DevAssert(t != NULL);
|
||||
@@ -1537,31 +1577,32 @@ static void stopServer(openair0_device *device)
|
||||
rfsimulator_end(device);
|
||||
}
|
||||
|
||||
static int rfsimulator_stop(openair0_device *device)
|
||||
static int rfsimulator_stop(openair0_device_t *device)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static int rfsimulator_set_freq(openair0_device *device, openair0_config_t *openair0_cfg)
|
||||
static int rfsimulator_set_freq(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
rfsimulator_state_t *s = static_cast<rfsimulator_state_t *>(device->priv);
|
||||
s->rx_freq = openair0_cfg->rx_freq[0];
|
||||
return 0;
|
||||
}
|
||||
static int rfsimulator_set_gains(openair0_device *device, openair0_config_t *openair0_cfg)
|
||||
static int rfsimulator_set_gains(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static int rfsimulator_write_init(openair0_device *device)
|
||||
static int rfsimulator_write_init(openair0_device_t *device)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" __attribute__((__visibility__("default"))) int device_init(openair0_device *device, openair0_config_t *openair0_cfg)
|
||||
extern "C" __attribute__((__visibility__("default"))) int device_init(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
// to change the log level, use this on command line
|
||||
// --log_config.hw_log_level debug
|
||||
rfsimulator_state_t *rfsimulator = static_cast<rfsimulator_state_t *>(calloc(sizeof(rfsimulator_state_t), 1));
|
||||
// initialize channel simulation
|
||||
rfsimulator->ru_id = openair0_cfg->ru_id;
|
||||
rfsimulator->tx_num_channels = openair0_cfg->tx_num_channels;
|
||||
rfsimulator->rx_num_channels = openair0_cfg->rx_num_channels;
|
||||
rfsimulator->sample_rate = openair0_cfg->sample_rate;
|
||||
@@ -1595,8 +1636,8 @@ extern "C" __attribute__((__visibility__("default"))) int device_init(openair0_d
|
||||
}
|
||||
/* let's pretend to be a b2x0 */
|
||||
device->type = RFSIMULATOR;
|
||||
openair0_cfg[0].rx_gain[0] = 0;
|
||||
device->openair0_cfg = &openair0_cfg[0];
|
||||
openair0_cfg->rx_gain[0] = 0;
|
||||
device->openair0_cfg = openair0_cfg;
|
||||
device->priv = rfsimulator;
|
||||
device->trx_write_init = rfsimulator_write_init;
|
||||
device->trx_set_beams = rfsimulator_set_beams;
|
||||
|
||||
+25
-19
@@ -271,7 +271,7 @@ static client_info_t client_read_info(char *descriptor_file)
|
||||
return client_info;
|
||||
}
|
||||
|
||||
static int vrtsim_connect(openair0_device *device)
|
||||
static int vrtsim_connect(openair0_device_t *device)
|
||||
{
|
||||
vrtsim_state_t *vrtsim_state = (vrtsim_state_t *)device->priv;
|
||||
|
||||
@@ -332,7 +332,7 @@ static int vrtsim_connect(openair0_device *device)
|
||||
}
|
||||
|
||||
static int vrtsim_write_internal(vrtsim_state_t *vrtsim_state,
|
||||
openair0_timestamp timestamp,
|
||||
openair0_timestamp_t timestamp,
|
||||
c16_t *samples,
|
||||
int nsamps,
|
||||
int aarx,
|
||||
@@ -361,7 +361,7 @@ static int vrtsim_write_internal(vrtsim_state_t *vrtsim_state,
|
||||
|
||||
typedef struct {
|
||||
vrtsim_state_t *vrtsim_state;
|
||||
openair0_timestamp timestamp;
|
||||
openair0_timestamp_t timestamp;
|
||||
c16_t *samples[MAX_NUM_ANTENNAS_TX];
|
||||
int nsamps;
|
||||
int nbAnt;
|
||||
@@ -464,7 +464,7 @@ static void perform_channel_modelling(void *arg)
|
||||
}
|
||||
|
||||
static int vrtsim_write_with_chanmod(vrtsim_state_t *vrtsim_state,
|
||||
openair0_timestamp timestamp,
|
||||
openair0_timestamp_t timestamp,
|
||||
void **samplesVoid,
|
||||
int nsamps,
|
||||
int nbAnt,
|
||||
@@ -473,7 +473,7 @@ static int vrtsim_write_with_chanmod(vrtsim_state_t *vrtsim_state,
|
||||
// Sample history for channel impulse response
|
||||
static c16_t saved_samples[MAX_NUM_ANTENNAS_TX][SAVED_SAMPLES_LEN] __attribute__((aligned(32))) = {0};
|
||||
// Indicates what samples are saves in saved_samples
|
||||
static openair0_timestamp last_timestamp = 0;
|
||||
static openair0_timestamp_t last_timestamp = 0;
|
||||
const int batch_size = 4096;
|
||||
|
||||
AssertFatal(nbAnt <= MAX_NUM_ANTENNAS_TX, "Number of antennas %d exceeds maximum %d\n", nbAnt, MAX_NUM_ANTENNAS_TX);
|
||||
@@ -528,7 +528,12 @@ static int vrtsim_write_with_chanmod(vrtsim_state_t *vrtsim_state,
|
||||
return nsamps;
|
||||
}
|
||||
|
||||
static int vrtsim_write(openair0_device *device, openair0_timestamp timestamp, void **samplesVoid, int nsamps, int nbAnt, int flags)
|
||||
static int vrtsim_write(openair0_device_t *device,
|
||||
openair0_timestamp_t timestamp,
|
||||
void **samplesVoid,
|
||||
int nsamps,
|
||||
int nbAnt,
|
||||
int flags)
|
||||
{
|
||||
AssertFatal(nsamps > 0, "Number of samples must be greater than 0\n");
|
||||
AssertFatal(nbAnt > 0 && nbAnt <= MAX_NUM_ANTENNAS_TX,
|
||||
@@ -543,8 +548,8 @@ static int vrtsim_write(openair0_device *device, openair0_timestamp timestamp, v
|
||||
: vrtsim_write_internal(vrtsim_state, timestamp, (c16_t *)samplesVoid[0], nsamps, 0, flags, 0);
|
||||
}
|
||||
|
||||
static int vrtsim_write_beams(openair0_device *device,
|
||||
openair0_timestamp timestamp,
|
||||
static int vrtsim_write_beams(openair0_device_t *device,
|
||||
openair0_timestamp_t timestamp,
|
||||
void ***buff,
|
||||
int nsamps,
|
||||
int nb_antennas_tx,
|
||||
@@ -555,7 +560,7 @@ static int vrtsim_write_beams(openair0_device *device,
|
||||
return nsamps;
|
||||
}
|
||||
|
||||
static int vrtsim_read(openair0_device *device, openair0_timestamp *ptimestamp, void **samplesVoid, int nsamps, int nbAnt)
|
||||
static int vrtsim_read(openair0_device_t *device, openair0_timestamp_t *ptimestamp, void **samplesVoid, int nsamps, int nbAnt)
|
||||
{
|
||||
vrtsim_state_t *vrtsim_state = (vrtsim_state_t *)device->priv;
|
||||
if (shm_td_iq_channel_is_aborted(vrtsim_state->channel)) {
|
||||
@@ -594,7 +599,7 @@ static int vrtsim_read(openair0_device *device, openair0_timestamp *ptimestamp,
|
||||
return nsamps;
|
||||
}
|
||||
|
||||
static void vrtsim_end(openair0_device *device)
|
||||
static void vrtsim_end(openair0_device_t *device)
|
||||
{
|
||||
vrtsim_state_t *vrtsim_state = (vrtsim_state_t *)device->priv;
|
||||
if (vrtsim_state->role == ROLE_SERVER && vrtsim_state->run_timing_thread) {
|
||||
@@ -648,33 +653,34 @@ static void vrtsim_end(openair0_device *device)
|
||||
}
|
||||
}
|
||||
|
||||
static int vrtsim_stub(openair0_device *device)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static int vrtsim_stub2(openair0_device *device, openair0_config_t *openair0_cfg)
|
||||
static int vrtsim_stub(openair0_device_t *device)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vrtsim_set_freq(openair0_device *device, openair0_config_t *openair0_cfg)
|
||||
static int vrtsim_stub2(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vrtsim_set_freq(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
vrtsim_state_t *s = device->priv;
|
||||
s->rx_freq = openair0_cfg->rx_freq[0];
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vrtsim_set_beams(openair0_device *device, uint64_t beam_map, openair0_timestamp timestamp)
|
||||
static int vrtsim_set_beams(openair0_device_t *device, uint64_t beam_map, openair0_timestamp_t timestamp)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vrtsim_set_beams2(openair0_device *device, int *beam_ids, int num_beams, openair0_timestamp timestamp)
|
||||
static int vrtsim_set_beams2(openair0_device_t *device, int *beam_ids, int num_beams, openair0_timestamp_t timestamp)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
__attribute__((__visibility__("default"))) int device_init(openair0_device *device, openair0_config_t *openair0_cfg)
|
||||
__attribute__((__visibility__("default"))) int device_init(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
randominit();
|
||||
vrtsim_state_t *vrtsim_state = calloc_or_fail(1, sizeof(vrtsim_state_t));
|
||||
|
||||
Reference in New Issue
Block a user