From 2570c2ce77818c2144074003a06e0152bf289262 Mon Sep 17 00:00:00 2001 From: Robert Falkenberg Date: Fri, 18 Feb 2022 09:45:26 +0100 Subject: [PATCH] srsran_rf: cosmetic changes --- lib/src/phy/rf/rf_dev.h | 7 ++--- lib/src/phy/rf/rf_file_imp.h | 3 +- lib/src/phy/rf/rf_plugin.h | 2 +- lib/src/phy/rf/rf_soapy_imp.c | 4 +-- lib/src/phy/rf/rf_zmq_imp.c | 2 +- lib/src/phy/rf/rf_zmq_test.c | 57 +++++++++++++++++------------------ 6 files changed, 37 insertions(+), 38 deletions(-) diff --git a/lib/src/phy/rf/rf_dev.h b/lib/src/phy/rf/rf_dev.h index 2e2a1c099..2900e5816 100644 --- a/lib/src/phy/rf/rf_dev.h +++ b/lib/src/phy/rf/rf_dev.h @@ -19,7 +19,7 @@ static srsran_rf_plugin_t plugin_uhd = {"libsrsran_rf_uhd.so", NULL, NULL}; #else #include "rf_uhd_imp.h" -static srsran_rf_plugin_t plugin_uhd = {"", NULL, &srsran_rf_dev_uhd}; +static srsran_rf_plugin_t plugin_uhd = {"", NULL, &srsran_rf_dev_uhd}; #endif #endif @@ -49,7 +49,7 @@ static srsran_rf_plugin_t plugin_soapy = {"", NULL, &srsran_rf_dev_soapy}; static srsran_rf_plugin_t plugin_zmq = {"libsrsran_rf_zmq.so", NULL, NULL}; #else #include "rf_zmq_imp.h" -static srsran_rf_plugin_t plugin_zmq = {"", NULL, &srsran_rf_dev_zmq}; +static srsran_rf_plugin_t plugin_zmq = {"", NULL, &srsran_rf_dev_zmq}; #endif #endif @@ -63,7 +63,7 @@ static srsran_rf_plugin_t plugin_file = {"", NULL, &srsran_rf_dev_file}; static srsran_rf_plugin_t plugin_skiq = {"libsrsran_rf_skiq.so", NULL, NULL}; #else #include "rf_skiq_imp.h" -static srsran_rf_plugin_t plugin_skiq = {"", NULL, &srsran_rf_dev_skiq}; +static srsran_rf_plugin_t plugin_skiq = {"", NULL, &srsran_rf_dev_skiq}; #endif #endif @@ -85,7 +85,6 @@ static srsran_rf_plugin_t plugin_dummy = {"", NULL, &srsran_rf_dev_dummy}; #endif - /** * Collection of all currently available RF plugins */ diff --git a/lib/src/phy/rf/rf_file_imp.h b/lib/src/phy/rf/rf_file_imp.h index 439ec6ec3..c1856993e 100644 --- a/lib/src/phy/rf/rf_file_imp.h +++ b/lib/src/phy/rf/rf_file_imp.h @@ -129,6 +129,7 @@ SRSRAN_API int rf_file_send_timed_multi(void* h, * @param[in] base_srate Sample rate of RX and TX files * @return SRSRAN_SUCCESS on success, otherwise error code */ -SRSRAN_API int rf_file_open_file(void** h, FILE** rx_files, FILE** tx_files, uint32_t nof_channels, uint32_t base_srate); +SRSRAN_API int +rf_file_open_file(void** h, FILE** rx_files, FILE** tx_files, uint32_t nof_channels, uint32_t base_srate); #endif // SRSRAN_RF_FILE_IMP_H diff --git a/lib/src/phy/rf/rf_plugin.h b/lib/src/phy/rf/rf_plugin.h index 6e0f83106..177f4eef0 100644 --- a/lib/src/phy/rf/rf_plugin.h +++ b/lib/src/phy/rf/rf_plugin.h @@ -19,7 +19,7 @@ extern "C" { #endif -SRSRAN_API int register_plugin(rf_dev_t **rf_api); +SRSRAN_API int register_plugin(rf_dev_t** rf_api); #ifdef __cplusplus } diff --git a/lib/src/phy/rf/rf_soapy_imp.c b/lib/src/phy/rf/rf_soapy_imp.c index cb0148081..73664771e 100644 --- a/lib/src/phy/rf/rf_soapy_imp.c +++ b/lib/src/phy/rf/rf_soapy_imp.c @@ -26,8 +26,8 @@ #include #include #include -#include #include +#include #define HAVE_ASYNC_THREAD 0 @@ -854,7 +854,7 @@ int rf_soapy_recv_with_time_multi(void* h, int rf_soapy_recv_with_time(void* h, void* data, uint32_t nsamples, bool blocking, time_t* secs, double* frac_secs) { void* data_multi[SRSRAN_MAX_PORTS] = {NULL}; - data_multi[0] = data; + data_multi[0] = data; return rf_soapy_recv_with_time_multi(h, data_multi, nsamples, blocking, secs, frac_secs); } diff --git a/lib/src/phy/rf/rf_zmq_imp.c b/lib/src/phy/rf/rf_zmq_imp.c index 048ec9f0d..0ed634eab 100644 --- a/lib/src/phy/rf/rf_zmq_imp.c +++ b/lib/src/phy/rf/rf_zmq_imp.c @@ -962,7 +962,7 @@ int rf_zmq_send_timed_multi(void* h, } // Scale according to current gain - srsran_vec_sc_prod_cfc(buf, tx_gain, buf, nsamples_baseband); + srsran_vec_sc_prod_cfc(buf, tx_gain, buf, nsamples_baseband); // Finally, transmit baseband int n = rf_zmq_tx_baseband(&handler->transmitter[i], buf, nsamples_baseband); diff --git a/lib/src/phy/rf/rf_zmq_test.c b/lib/src/phy/rf/rf_zmq_test.c index 261acbf4f..be42022e5 100644 --- a/lib/src/phy/rf/rf_zmq_test.c +++ b/lib/src/phy/rf/rf_zmq_test.c @@ -93,12 +93,11 @@ void enb_tx_function(const char* tx_args, bool timed_tx) // send data subframe per subframe uint32_t num_txed_samples = 0; - // initial transmission without ts void* data_ptr[SRSRAN_MAX_PORTS] = {NULL}; - cf_t tx_buffer[NOF_RX_ANT][SF_LEN]; + cf_t tx_buffer[NOF_RX_ANT][SF_LEN]; for (int c = 0; c < NOF_RX_ANT; c++) { - memcpy(&tx_buffer[c], &enb_tx_buffer[c][num_txed_samples], SF_LEN * sizeof (cf_t)); + memcpy(&tx_buffer[c], &enb_tx_buffer[c][num_txed_samples], SF_LEN * sizeof(cf_t)); data_ptr[c] = &tx_buffer[c][0]; } int ret = srsran_rf_send_multi(&enb_radio, (void**)data_ptr, SF_LEN, true, true, false); @@ -116,7 +115,7 @@ void enb_tx_function(const char* tx_args, bool timed_tx) // prepare data buffer for (int c = 0; c < NOF_RX_ANT; c++) { - memcpy(&tx_buffer[c], &enb_tx_buffer[c][num_txed_samples], SF_LEN * sizeof (cf_t)); + memcpy(&tx_buffer[c], &enb_tx_buffer[c][num_txed_samples], SF_LEN * sizeof(cf_t)); data_ptr[c] = &tx_buffer[c][0]; } @@ -235,34 +234,34 @@ int param_test(const char* args_param, const int num_channels) int main() { srsran_rf_load_plugins(); -// // two Rx ports -// if (param_test("rx_port=ipc://dl0,rx_port1=ipc://dl1", 2)) { -// fprintf(stderr, "Param test failed!\n"); -// return SRSRAN_ERROR; -// } + // // two Rx ports + // if (param_test("rx_port=ipc://dl0,rx_port1=ipc://dl1", 2)) { + // fprintf(stderr, "Param test failed!\n"); + // return SRSRAN_ERROR; + // } -// // multiple rx ports, no channel index provided -// if (param_test("rx_port=ipc://dl0,rx_port=ipc://dl1,rx_port=ipc://dl2,rx_port=ipc://dl3,base_srate=1.92e6", 4)) { -// fprintf(stderr, "Param test failed!\n"); -// return SRSRAN_ERROR; -// } + // // multiple rx ports, no channel index provided + // if (param_test("rx_port=ipc://dl0,rx_port=ipc://dl1,rx_port=ipc://dl2,rx_port=ipc://dl3,base_srate=1.92e6", 4)) { + // fprintf(stderr, "Param test failed!\n"); + // return SRSRAN_ERROR; + // } -// // One Rx, one Tx and all generic options -// if (param_test("rx_port0=tcp://" -// "localhost:2000,rx_format=sc16,tx_format=sc16,tx_type=pub,rx_type=sub,base_srate=1.92e6,id=test", -// 1)) { -// fprintf(stderr, "Param test failed!\n"); -// return SRSRAN_ERROR; -// } + // // One Rx, one Tx and all generic options + // if (param_test("rx_port0=tcp://" + // "localhost:2000,rx_format=sc16,tx_format=sc16,tx_type=pub,rx_type=sub,base_srate=1.92e6,id=test", + // 1)) { + // fprintf(stderr, "Param test failed!\n"); + // return SRSRAN_ERROR; + // } -// // 1 port, 2 antennas, MIMO freq config -// if (param_test( -// "tx_port0=tcp://*:2001,tx_port1=tcp://*:2003,rx_port0=tcp://localhost:2000,rx_port1=tcp://" -// "localhost:2002,id=ue,base_srate=23.04e6,tx_freq0=2510e6,tx_freq1=2510e6,rx_freq0=2630e6,,rx_freq1=2630e6", -// 2)) { -// fprintf(stderr, "Param test failed!\n"); -// return SRSRAN_ERROR; -// } + // // 1 port, 2 antennas, MIMO freq config + // if (param_test( + // "tx_port0=tcp://*:2001,tx_port1=tcp://*:2003,rx_port0=tcp://localhost:2000,rx_port1=tcp://" + // "localhost:2002,id=ue,base_srate=23.04e6,tx_freq0=2510e6,tx_freq1=2510e6,rx_freq0=2630e6,,rx_freq1=2630e6", + // 2)) { + // fprintf(stderr, "Param test failed!\n"); + // return SRSRAN_ERROR; + // } #if NOF_RX_ANT == 1 // single tx, single rx with continuous transmissions (no timed tx) using IPC transport