From 8f0ccf618d553b2731caa24a2575a48065917959 Mon Sep 17 00:00:00 2001 From: Tom Tsou Date: Wed, 20 Jul 2016 16:35:03 -0700 Subject: uhd: Update USRP2/N200/N210 for 4 SPS Rx Requires changing the radioInterface API to pass in Rx side SPS value. Update the (deprecated) diversity configuration to match as well. Signed-off-by: Tom Tsou --- Transceiver52M/UHDDevice.cpp | 4 +-- Transceiver52M/osmo-trx.cpp | 58 ++++++++++++++++++------------ Transceiver52M/radioInterface.h | 8 ++--- Transceiver52M/radioInterfaceDiversity.cpp | 4 +-- Transceiver52M/radioInterfaceResamp.cpp | 21 +++-------- 5 files changed, 47 insertions(+), 48 deletions(-) (limited to 'Transceiver52M') diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp index 4ed539e..89ca2a3 100644 --- a/Transceiver52M/UHDDevice.cpp +++ b/Transceiver52M/UHDDevice.cpp @@ -108,7 +108,7 @@ static struct uhd_dev_offset uhd_offsets[] = { { USRP1, 1, 1, 0.0, "USRP1 not supported" }, { USRP1, 4, 1, 0.0, "USRP1 not supported"}, { USRP2, 1, 1, 1.2184e-4, "N2XX 1 SPS" }, - { USRP2, 4, 1, 8.0230e-5, "N2XX 4 SPS" }, + { USRP2, 4, 1, 7.6547e-5, "N2XX 4/1 SPS" }, { B100, 1, 1, 1.2104e-4, "B100 1 SPS" }, { B100, 4, 1, 7.9307e-5, "B100 4 SPS" }, { B200, 1, 1, B2XX_TIMING_1SPS, "B200 1 SPS" }, @@ -124,7 +124,7 @@ static struct uhd_dev_offset uhd_offsets[] = { { X3XX, 4, 1, 1.1264e-4, "X3XX 4/1 Tx/Rx SPS"}, { UMTRX, 1, 1, 9.9692e-5, "UmTRX 1 SPS" }, { UMTRX, 4, 1, 7.3846e-5, "UmTRX 4/1 Tx/Rx SPS" }, - { B200, 4, 4, B2XX_TIMING_4_4SPS, "B200/B210 4 SPS" }, + { USRP2, 4, 4, 4.6080e-5, "N2XX 4 SPS" }, { B210, 4, 4, B2XX_TIMING_4_4SPS, "B200/B210 4 SPS" }, { UMTRX, 4, 4, 5.1503e-5, "UmTRX 4 SPS" }, { LIMESDR, 4, 4, 16.5/GSMRATE, "STREAM/LimeSDR (4 SPS TX/RX)" }, diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp index a13ec1b..5e81586 100644 --- a/Transceiver52M/osmo-trx.cpp +++ b/Transceiver52M/osmo-trx.cpp @@ -173,16 +173,6 @@ bool trx_setup_config(struct trx_config *config) return false; } - /* Diversity only supported on 2 channels without multi-carrier */ - if (config->diversity && config->mcbts) { - std::cout << "Multi-carrier diversity unsupported" << std::endl; - return false; - } - if (config->diversity && (config->chans != 2)) { - std::cout << "Setting channels to 2 for diversity" << std::endl; - config->chans = 2; - } - edgestr = config->edge ? "Enabled" : "Disabled"; divstr = config->diversity ? "Enabled" : "Disabled"; mcstr = config->mcbts ? "Enabled" : "Disabled"; @@ -254,9 +244,11 @@ RadioInterface *makeRadioInterface(struct trx_config *config, case RadioDevice::RESAMP_64M: case RadioDevice::RESAMP_100M: radio = new RadioInterfaceResamp(usrp, config->tx_sps, - config->chans); + config->rx_sps); break; case RadioDevice::DIVERSITY: + + radio = new RadioInterfaceDiversity(usrp, config->tx_sps, config->chans); break; @@ -442,39 +434,59 @@ static void handle_options(int argc, char **argv, struct trx_config *config) } } - if (config->gpsref && config->extref) { - printf("External and GPSDO references unavailable at the same time\n\n"); - print_help(); - exit(0); - } - /* Force 4 SPS for EDGE or multi-ARFCN configurations */ if ((config->edge) || (config->mcbts)) { config->tx_sps = 4; config->rx_sps = 4; } + if (config->gpsref && config->extref) { + printf("External and GPSDO references unavailable at the same time\n\n"); + goto bad_config; + } + + /* Special restrictions on (deprecated) diversity configuration */ + if (config->diversity) { + if (config->mcbts || config->edge) { + std::cout << "Multi-carrier/EDGE diversity unsupported" << std::endl; + goto bad_config; + } + + if (config->rx_sps != 1) { + std::cout << "Diversity only supported with 1 SPS" << std::endl; + goto bad_config; + } + + if (config->chans != 2) { + std::cout << "Diversity only supported with 2 channels" << std::endl; + goto bad_config; + } + } + if (config->edge && (config->filler == Transceiver::FILLER_NORM_RAND)) config->filler = Transceiver::FILLER_EDGE_RAND; if ((config->tx_sps != 1) && (config->tx_sps != 4) && (config->rx_sps != 1) && (config->rx_sps != 4)) { printf("Unsupported samples-per-symbol %i\n\n", config->tx_sps); - print_help(); - exit(0); + goto bad_config; } if (config->rtsc > 7) { printf("Invalid training sequence %i\n\n", config->rtsc); - print_help(); - exit(0); + goto bad_config; } if (config->rach_delay > 68) { printf("RACH delay is too big %i\n\n", config->rach_delay); - print_help(); - exit(0); + goto bad_config; } + + return; + +bad_config: + print_help(); + exit(0); } int main(int argc, char *argv[]) diff --git a/Transceiver52M/radioInterface.h b/Transceiver52M/radioInterface.h index b63cc4c..f77cf9e 100644 --- a/Transceiver52M/radioInterface.h +++ b/Transceiver52M/radioInterface.h @@ -85,8 +85,7 @@ public: virtual void close(); /** constructor */ - RadioInterface(RadioDevice* wRadio = NULL, - size_t tx_sps = 4, size_t rx_sps = 1, + RadioInterface(RadioDevice* wRadio, size_t tx_sps, size_t rx_sps, size_t chans = 1, size_t diversity = 1, int receiveOffset = 3, GSM::Time wStartTime = GSM::Time(0)); @@ -159,7 +158,7 @@ private: void pullBuffer(); public: - RadioInterfaceResamp(RadioDevice* wRadio, size_t wSPS = 4, size_t chans = 1); + RadioInterfaceResamp(RadioDevice* wRadio, size_t tx_sps, size_t rx_sps); ~RadioInterfaceResamp(); bool init(int type); @@ -196,8 +195,7 @@ public: class RadioInterfaceDiversity : public RadioInterface { public: - RadioInterfaceDiversity(RadioDevice* wRadio, - size_t sps = 4, size_t chans = 2); + RadioInterfaceDiversity(RadioDevice* wRadio, size_t tx_sps, size_t chans); ~RadioInterfaceDiversity(); diff --git a/Transceiver52M/radioInterfaceDiversity.cpp b/Transceiver52M/radioInterfaceDiversity.cpp index b3973e5..c78310c 100644 --- a/Transceiver52M/radioInterfaceDiversity.cpp +++ b/Transceiver52M/radioInterfaceDiversity.cpp @@ -51,8 +51,8 @@ static size_t resamp_outrate = 0; static size_t resamp_outchunk = 0; RadioInterfaceDiversity::RadioInterfaceDiversity(RadioDevice *wRadio, - size_t sps, size_t chans) - : RadioInterface(wRadio, sps, chans, 2), outerRecvBuffer(NULL), + size_t tx_sps, size_t chans) + : RadioInterface(wRadio, tx_sps, 1, chans, 2), outerRecvBuffer(NULL), mDiversity(false), mFreqSpacing(0.0) { } diff --git a/Transceiver52M/radioInterfaceResamp.cpp b/Transceiver52M/radioInterfaceResamp.cpp index 26dd40b..b0f799e 100644 --- a/Transceiver52M/radioInterfaceResamp.cpp +++ b/Transceiver52M/radioInterfaceResamp.cpp @@ -58,10 +58,9 @@ static size_t resamp_outrate = 0; static size_t resamp_outchunk = 0; RadioInterfaceResamp::RadioInterfaceResamp(RadioDevice *wRadio, - size_t sps, size_t chans) - : RadioInterface(wRadio, sps, chans), - outerSendBuffer(NULL), - outerRecvBuffer(NULL) + size_t tx_sps, size_t rx_sps) + : RadioInterface(wRadio, tx_sps, rx_sps, 1), + outerSendBuffer(NULL), outerRecvBuffer(NULL) { } @@ -97,11 +96,6 @@ bool RadioInterfaceResamp::init(int type) { float cutoff = 1.0f; - if (mChans != 1) { - LOG(ALERT) << "Unsupported channel configuration " << mChans; - return false; - } - close(); sendBuffer.resize(1); @@ -126,13 +120,8 @@ bool RadioInterfaceResamp::init(int type) return false; } - resamp_inchunk = resamp_inrate * 4; - resamp_outchunk = resamp_outrate * 4; - - if (resamp_inchunk * NUMCHUNKS < 157 * mSPSTx * 2) { - LOG(ALERT) << "Invalid inner chunk size " << resamp_inchunk; - return false; - } + resamp_inchunk = resamp_inrate * 4 * mSPSRx; + resamp_outchunk = resamp_outrate * 4 * mSPSRx; if (mSPSTx == 4) cutoff = RESAMP_TX4_FILTER; -- cgit v1.2.3