laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/42811?usp=email )
Change subject: trx-usrp1: make single daughterboard VTY configurable ......................................................................
trx-usrp1: make single daughterboard VTY configurable
Adds the usrp1-singledb enable/disable option to specify the daughterboard configuration on USRP1 devices. This will allow users to use single-daughterboard devices without compliling from source to use the --with-singledb configure option. Also removed some daughterboard configuration related code that wasn't being used. More info in the modified trx-backends.adoc
Change-Id: I618fdcc7fec1ca1e87249992798c265430c177a0 --- M CommonLibs/config_defs.h M CommonLibs/trx_vty.c M Transceiver52M/device/usrp1/USRPDevice.cpp M configure.ac M doc/manuals/chapters/trx-backends.adoc 5 files changed, 27 insertions(+), 39 deletions(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved fixeria: Looks good to me, but someone else must approve
diff --git a/CommonLibs/config_defs.h b/CommonLibs/config_defs.h index 07a3981..3b21fcb 100644 --- a/CommonLibs/config_defs.h +++ b/CommonLibs/config_defs.h @@ -68,4 +68,5 @@ double dl_gain; } overrides; bool use_va; + bool usrp1_singledb; }; diff --git a/CommonLibs/trx_vty.c b/CommonLibs/trx_vty.c index b70b3fa..47ac90b 100644 --- a/CommonLibs/trx_vty.c +++ b/CommonLibs/trx_vty.c @@ -632,6 +632,19 @@ return CMD_SUCCESS; }
+DEFUN(cfg_usrp1_singledb, cfg_usrp1_singledb_cmd, + "usrp1-singledb (disable|enable)", + "Use single daughterboard on USRP1 (default=disable)\n" + "Use dual daughterboard configuration (TX on DB A, RX on DB B)\n" + "Use single daughterboard configuration (TX/RX on DB A)\n") +{ + struct trx_ctx *trx = trx_from_vty(vty); + + trx->cfg.usrp1_singledb = (strcmp(argv[0], "enable") == 0); + + return CMD_SUCCESS; +} + DEFUN(cfg_chan_rx_path, cfg_chan_rx_path_cmd, "rx-path NAME", "Set the Rx Path\n" @@ -727,6 +740,8 @@ vty_out(vty, " ul-gain-override %f%s", trx->cfg.overrides.ul_gain, VTY_NEWLINE); if (trx->cfg.use_va) vty_out(vty, " viterbi-eq %s%s", trx->cfg.use_va ? "enable" : "disable", VTY_NEWLINE); + if (trx->cfg.usrp1_singledb) + vty_out(vty, " usrp1-singledb %s%s", trx->cfg.usrp1_singledb ? "enable" : "disable", VTY_NEWLINE); trx_rate_ctr_threshold_write_config(vty, " ");
for (i = 0; i < trx->cfg.num_chans; i++) { @@ -765,6 +780,7 @@ vty_out(vty, " Real Time Priority: %u (%s)%s", trx->cfg.sched_rr, trx->cfg.sched_rr ? "Enabled" : "Disabled", VTY_NEWLINE); vty_out(vty, " Stack size per Thread in BYTE (0 = OS default): %u%s", trx->cfg.stack_size, VTY_NEWLINE); + vty_out(vty, " Single daughterboard (for USRP1): %s%s", trx->cfg.usrp1_singledb ? "Enabled" : "Disabled", VTY_NEWLINE); vty_out(vty, " Channels: %u%s", trx->cfg.num_chans, VTY_NEWLINE); for (i = 0; i < trx->cfg.num_chans; i++) { chan = &trx->cfg.chans[i]; @@ -877,6 +893,7 @@ install_element(TRX_NODE, &cfg_ctr_error_threshold_cmd); install_element(TRX_NODE, &cfg_no_ctr_error_threshold_cmd); install_element(TRX_NODE, &cfg_stack_size_cmd); + install_element(TRX_NODE, &cfg_usrp1_singledb_cmd);
install_element(TRX_NODE, &cfg_chan_cmd); install_element(TRX_NODE, &cfg_ul_fn_offset_cmd); diff --git a/Transceiver52M/device/usrp1/USRPDevice.cpp b/Transceiver52M/device/usrp1/USRPDevice.cpp index 21cbd7e..4b23892 100644 --- a/Transceiver52M/device/usrp1/USRPDevice.cpp +++ b/Transceiver52M/device/usrp1/USRPDevice.cpp @@ -45,19 +45,6 @@
using namespace std;
-enum dboardConfigType { - TXA_RXB, - TXB_RXA, - TXA_RXA, - TXB_RXB -}; - -#ifdef SINGLEDB -const dboardConfigType dboardConfig = TXA_RXA; -#else -const dboardConfigType dboardConfig = TXA_RXB; -#endif - const double USRPDevice::masterClockRate = 52.0e6;
USRPDevice::USRPDevice(InterfaceType iface, const struct trx_cfg *cfg) : RadioDevice(iface, cfg) @@ -148,24 +135,10 @@
#endif
- switch (dboardConfig) { - case TXA_RXB: - txSubdevSpec = usrp_subdev_spec(0,0); - rxSubdevSpec = usrp_subdev_spec(1,0); - break; - case TXB_RXA: - txSubdevSpec = usrp_subdev_spec(1,0); - rxSubdevSpec = usrp_subdev_spec(0,0); - break; - case TXA_RXA: + if (cfg->usrp1_singledb) { txSubdevSpec = usrp_subdev_spec(0,0); rxSubdevSpec = usrp_subdev_spec(0,0); - break; - case TXB_RXB: - txSubdevSpec = usrp_subdev_spec(1,0); - rxSubdevSpec = usrp_subdev_spec(1,0); - break; - default: + } else { txSubdevSpec = usrp_subdev_spec(0,0); rxSubdevSpec = usrp_subdev_spec(1,0); } diff --git a/configure.ac b/configure.ac index 01b2f34..a384495 100644 --- a/configure.ac +++ b/configure.ac @@ -149,11 +149,6 @@ [enable MS TRX]) ])
-AC_ARG_WITH(singledb, [ - AS_HELP_STRING([--with-singledb], - [enable single daughterboard use on USRP1]) -]) - AC_ARG_WITH(neon, [ AS_HELP_STRING([--with-neon], [enable ARM NEON support]) @@ -229,10 +224,6 @@ AC_MSG_RESULT([no]) ])
-AS_IF([test "x$with_singledb" = "xyes"], [ - AC_DEFINE(SINGLEDB, 1, Define to 1 for single daughterboard) -]) - # Find and define supported SIMD extensions AS_IF([test "x$with_sse" != "xno"], [ AX_SSE diff --git a/doc/manuals/chapters/trx-backends.adoc b/doc/manuals/chapters/trx-backends.adoc index 021c6f4..57e49d6 100644 --- a/doc/manuals/chapters/trx-backends.adoc +++ b/doc/manuals/chapters/trx-backends.adoc @@ -66,6 +66,12 @@ through a simple energy detector, a RACH or midamble correlator, and a DFE-based demodulator.
+By default, osmo-trx-usrp1 will use daughterboard A for transmitting and +daughterboard B for receiving. Some USRP1 configurations use only a single +daughterboard for both TX and RX, and thus the receiver will not work as +daughterboard B does not exist. Daughterboard A can be configured to be used +for both TX and RX with `usrp1-singledb enable`. + NOTE: There's a `SWLOOPBACK` #define statement, where the USRP is replaced with a memory buffer. In this mode, data written to the USRP is actually stored in a buffer, and read commands to the USRP simply pull data from this buffer. @@ -170,4 +176,4 @@ the code on their implemented _Driver_ program no matter it being proprietary or under an open license. However, care must be taken with external dependencies, as for instance shm.c uses the talloc memory allocator, which is GPL licensed -and hence cannot be used in a proprietary driver. \ No newline at end of file +and hence cannot be used in a proprietary driver.