aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M/sigProcLib.cpp
AgeCommit message (Collapse)AuthorFilesLines
2019-10-17Fix common misspellings and typosMartin Hauke1-2/+2
Change-Id: I4ec7accb1912c052b446be7c399bed32a8c62253
2019-07-22Add SPDX annotationPau Espin Pedrol1-0/+2
Related: OS#3515 Change-Id: I3719bd8dc015569ecd81928fc079e27593cdca09
2019-07-21CorrelationSequence: fix initialization of class membersHarald Welte1-1/+1
Change-Id: Ia72395f8805e9e2cd700ad1e559a8aa62124aaec Closes: CID#149371
2019-07-19sigProcLib: Add C/I (Carrier-to-Interference ratio) computationSylvain Munaut1-13/+50
Related: OS#4006 Change-Id: Ib4ceec553f2e5f77bf3f6777724968456a180f5e
2019-07-19sigProcLib: detectAnyBurst(): make TSC used to detect burst available to callerPau Espin Pedrol1-1/+5
This value will be sent in TRXDv1 protocol. Related: OS#4006 Change-Id: I603b7b52f957cf897b036dbaeb22c01a55de08c3
2019-07-19sigProcLib: detectAnyBurst() family: Use struct to gather all out paramsPau Espin Pedrol1-35/+28
Currently we have 2 out parameters, but in forthcoming commits will add a third one. All those functions already have too many parameters, so let's put together all the output params in a struct to pass them easily and make it easier to understand they are the estimated output values. Related: OS#4006 Change-Id: I05cfa0ceaa2e633a5e6e404e2eae497ff4442dea
2019-07-02Transceiver: Get rid of SoftVector in struct trx_ul_burst_indPau Espin Pedrol1-12/+10
Make the interface using trx_ul_burst_ind more implementation agnostic as well as easier to use. For instance, we don't care about SoftVector size one returned from pullRadioVector(); we want to use nbits instead. As a result, we no longer spend time normalizing guard periods. While at it, change vectorSLicer to return void since it always returns true. Change-Id: I726e5a98a43367a22c9a4ca5cbd9eb87e6765c7a
2019-01-21convolve: Remove support for step, offset parametersSylvain Munaut1-7/+6
- Those are not used any where - Those are not supported by the sse/neon accelerated versions - And I see very little use cases for those. Change-Id: Ic850269a0ed5d98c0ea68980afd31016ed555b48 Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2018-12-05SigProcLib: Improve Vector buffer allocation messPau Espin Pedrol1-24/+10
Original issue: In order to use SSE instructions, 16-byte aligned memory chunks are needed, and C++ version < C++11 doesn't provide for a native new/delete store. For that reason, memalign() must be used in the implementation of convolve_h_alloc() for some buffers. On the other side, The C++ code relies on C++ "new T[]" operator to allocate a chunk of memory containing an array of class instances. As classes are complex types, they cannot be allocated through C structures (calling malloc). Experimentally can be seen too that it's unreliable and the process will crash during startup if malloc() is used and then a Complex<> deferred from it. Previous implementation allowed for use of convolve_h_alloc or new[] based on how the (signal)Vector is called, because then the buffer is not going to be managed internally. But that's unreliable since resize() calling resize() on it could use "delete" operator on a malloc'ed buffer, and end up having a new new[] allocated buffer. It was also found that some of the callers were actually leaking memory through ASan (because the buffer is not managed by the Vector instance). IMHO best option would be to rewrite all this code using C structures and malloc/free exclusively, since it would make all this cod eeasier to maintain. But for now, let's extend the Vector class to allow specifying an external alloc/free function and let the Vector instance take care of the ownership of the buffer in all scenarios. Change-Id: Ie484a4762a7f77fe1b105188ea03a6f025730b82
2018-10-24sigProcLib: add a CorrType for extended (11-bit) RACHVadim Yanitskiy1-6/+11
This is a preparatory change that enables a possibility to choose the amount of synch. sequences to be used for Access Burst (RACH) detection. The VTY flag will be introduced in further changes. There are two correlation types now: - RACH (default) - TS0 only; - EXT_RACH - all TS0, TS1, and TS2 together. Change-Id: Ia4f20524350bb8c380d7e10360758eddae8b03e9 Related: OS#3054
2018-10-24sigProcLib: introduce both TS1 and TS2 RACH synch. sequencesVadim Yanitskiy1-16/+23
According to 3GPP TS 05.02, section 5.2.7, there are three synch. sequences for Access Bursts: - TS0: GSM, GMSK (default), - TS1: EGPRS, 8-PSK, - TS2: EGPRS, GMSK. Let's prepare everythyng to be able to detect all TS0-3 synch. sequences, but keep detection of both TS1 and TS2 disabled until the corresponding VTY option is introduced. Change-Id: I838c21db29c54f1924dd478c2b34b46b70aab2cd Related: OS#3054
2018-09-10cosmetic: Fix trailing whitespace in several filesPau Espin Pedrol1-9/+9
Change-Id: Ibf5a69f0a3a309e87814635fd903b114fe68890c
2018-09-10SigProcLib: Use available copyTo Vector API instead of memcopyPau Espin Pedrol1-6/+4
This change allows to remove some wrong use of code as per compilation warning: osmo-trx/Transceiver52M/sigProcLib.cpp:1266:40: error: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of non-trivially copyable type ‘class Complex<float>’; use copy-assignment or copy-initialization instead [-Werror=class-memaccess] midMidamble->size() * sizeof(complex)); Change-Id: Id446711349bec70fa4e7c8efe0f7f9faf7e4f277
2017-06-22sigProcLib: Specify standard namespace for isnan()Tom Tsou1-1/+1
In commit a3dce85f "sigProcLib: Use explicit NaN check in sinc table generation" Use of std::isnan(double) was added without namespace specifier, which may cause build issues depending on whether the C version isnan() call is available. Add standard namespace to force C++ call usage and potential build issues. Change-Id: I49328c43fdd690a4e6a2b2e949411aaf5674ead1
2017-06-19sigProcLib: Use explicit NaN check in sinc table generationTom Tsou1-9/+3
Using "x < 0.01" is a crude check for detecting NaN condition, which occurs in a sinc call when x = 0 due to divide-by-zero. Use stdlib isnan() call for this purpose. Also, as the table is created only once during initialization, use double floats for table value generation. Change-Id: I3a838fe3139fa977dfe906246020a14451185714
2017-06-19sigProcLib: Remove trigonometric tablesTom Tsou1-36/+8
Trigonometric sin/cos tables are unused after initialization. There is no benefit to implementing lookup tables for run-once operations. Also perform initial calculations in double width because there is no penalty for doing so. Change-Id: I45bba5daf8610cbba6af95b92c2142f2256491ff
2017-06-16sigProcLib: Remove heap based signal vector allocationsTom Tsou1-84/+51
The osmo-trx internals rely heavily on dynamic alloction of I/Q signal vectors. In a number of cases there is no reason to to use dynamic rather than stack based allocation. Convert these cases accordingly. Change-Id: If53da1bf77b5944b6117765fa98ce12e1ccdeede
2017-06-16sigProcLib: Fix complex/real vector flag in Laurent modulatorTom Tsou1-1/+0
The modulator vector to be shaped by Laurent C1 pulse is complex, but was set as real. The error does not affect behaviour because we only support complex-complex and complex-real calculations; real-real convolution is not supported. So in this case the data vector was already assumed to be complex despite the improper flag setting. Change-Id: I03afc6a93a01fde7a9a02e4eb9d201d3ee37d21a
2017-06-14sigProcLib: Remove unused functions from public interfaceTom Tsou1-264/+52
Also remove entirely completely unused calls. Most of these calls have been around since OpenBTS conception. Nearly a decade is long enough time for deprecation. Change-Id: Ifc122aaff23414c363b4b00f99061eed8a6902d0
2017-05-29sigProcLib: Fix number of tail bits in random Normal Bursts and zero ↵Alexander Chemeris1-3/+9
Stealing Bits. This bug only affects generation of normal bursts filled with random bits which are used in test mode. It doesn't affect operation of osmo-trx during normal operation. That's why it has stayed unnoticed for so long. Each Normal Burst has 3 tail bits, not 4. Also it's better to set stealing bits to 0 for maximum compatibility. We may want to introduce a selector for each bit whether to set it to 0, to 1 or to a random number. Change-Id: I0377029556c8b681b3ba3b635bf19572b34546ea
2017-05-19radioInterface: Remove UmTRX 'diversity' optionTom Tsou1-45/+0
The 'diversity' option was an experimental 2 antenna receiver implementation for UmTRX. The implementation has not been maintained and current working status is unknown. In addition to code rot, Coverity is triggering errors in the associated code sections. Removal of code cleans up many cases of special handling that were necessary to accommodate the implementation. Change-Id: I46752ccf5dbcffbec806081dec03e69a0fbdcdb7
2017-03-31sigProcLib: Fix negative value check on unsigned valueTom Tsou1-1/+1
Convert negative value check on unsigned value to zero check to avoid potential divide-by-zero error condition. Change-Id: Ib0d7d1bceb5fe66e69345db93a74e3e0773a2257 Fixes: Coverity CID 165059
2017-03-31sigProcLib: Check return status on downsamplingTom Tsou1-2/+6
Improper length values will cause the polyphase resampler rotation to fail. Check return and return NULL on error. Change-Id: I3ad22f9fd7a20754f589c04258dcca3770474a9b Fixes: Coverity CID 165235
2017-03-31sigProcLib: Remove unreachable code and no-effect checksTom Tsou1-6/+2
Unreachable path and negative value inspection on unsigned types. Change-Id: If53b4b03550b0a7656c808cfe96806252153eb2f Fixes: Coverity CID 165239, 165238, 165236
2017-03-28sigProcLib: Constify demodulation functions burst argument.Alexander Chemeris1-6/+6
demodCommon() used to scale input vector in place which changed original data. That's a bad practice and is not really necessary, so I've changed the code to scale burst after it's copied to a new vector during a delay operation. Change-Id: Ic45f71b634e48808356d68925bb9f5783e0bf0d3
2017-03-28sigProcLib: constify signalVector arguments for detectBurst() functions.Alexander Chemeris1-17/+18
Change-Id: Ic033371a387353eb12b1827a0eb16c00c07da88a
2017-03-28Move Transceiver::demodulate() to sigProcLib to make it reusable.Alexander Chemeris1-0/+9
Change-Id: I2cad47160e53f65612bd1da8998c83a0a22bce9b
2017-03-28sigProcLib: Add operator<< to print CorrType to a string.Alexander Chemeris1-0/+23
Change-Id: I3d68cbdab8fb504d7f155029654a576d318a201e
2017-03-24Move Transceiver::detectBurst() to sigProcLib to make it reusable.Alexander Chemeris1-0/+32
Change-Id: I3cbe8e6e4f39dde02c945e6c9086c040e276845c
2017-03-22Call vectorSlicer() right before packing bits for transmission to osmo-bts.Alexander Chemeris1-3/+0
vectorSlicer() converts soft-bits from -1..+1 to 0..1 while we want to keep SoftVector in -1..+1 mode until the last minute, because at some point we'll want to transmit -1..+1 to osmo-bts instead of converting it from 0..1 back to -1..+1 on the osmo-bts side. Plus it removes code duplication - we call it once instead of twice. Change-Id: Idd6ddd7ac219afb0df055a692632678b66373764
2017-03-22sigProcLib: Slice SoftVector instead of signalVector for GMSK demod.Alexander Chemeris1-24/+20
This makes it similar to 8-PSK demod and also saves a bit of lines ofcode and should give us a tiny improvement in performance. Ideally we need to remove vector slicing at all, because in osmo-bts-trx we convert back to +-1.0 again (actually to +-127, but it doesn't mater). So we should rather transmit +-1.0 values to avoid double conversion. Change-Id: If9ed6f0f80fbe88c994b2f9c3cae91d0d57f4442
2017-03-22sigProcLib: Rename demodulateBurst() to demodGmskBurst() for clarity.Alexander Chemeris1-1/+1
Change-Id: Ibcef8d7d4a2c06865bed7e4091ccc8dbbd494d77
2017-03-22sigProcLib: make energyDetect() simpler by returning actual energy.Alexander Chemeris1-6/+2
Change-Id: I9bf97f2dc03fea9bebcf43198dfb05f6e4694e9c
2017-03-20sigProcLib: Fix documentation, sync argument names in .cpp and .h files.Alexander Chemeris1-12/+12
Documentation in sigProcLib.h was noticeably out of sync with the actual implementation - e.g. not all arguments were documented and arguments which are already removed are still in the documentation. Also argument names were different between declaration in .h and implementation in .cpp which was confusing. I've fixed this for detect*Burst() functions. Change-Id: I4dfd07125d9a1e9a42a78b79faff539f003deb16
2017-03-20sigProcLib: Typo sybols -> symbolsAlexander Chemeris1-1/+1
Change-Id: I8cbef852374d0458c4f4ad4be0df0aa998e3796a
2016-08-11sigproc: Match differential GMSK start/end bits to tail bitsTom Tsou1-4/+4
Invert the initial and trailing diffential bits in the 4 sps GMSK modulator to fix power-time mask irregularity at start and end of burst. GSM tail bits are always zero, so we can safely use fixed bit values. Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-07-19sigproc: Fix missing 8-PSK tail symbolsTom Tsou1-1/+1
Agilent E4406A measurement of TSC synchronized RF envelope measurement. showed failing power levels at the tail end of EDGE bursts. Regression traced back to following commit. Commit d2b070369dd5341ac42ec091370d8bcd5a8ac5ee "uhd: Correct timing alignment in 8-PSK and GMSK downlink bursts" In the patch, the EDGE burst was delayed one symbol, but erroneously truncated at the tail end causing the failing RF envelope measurement. The missing tail symbol did not appear to affect end-to-end EGPRS tests. This patch corrects the truncation. Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-07-01sigproc: Adjust burst detection threshold criteriaTom Tsou1-2/+13
Reduce the burst detection threshold to pass more bursts to upper layers, but force stricter requirements on the computation itself. For the latter, we now require at least 5 samples (rather than 2) to compute a peak-to-average value. End result is increased burst detection at low SNR conditions with a small increase in false positive bursts when no signal is present. Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-07-01mcbts: Add multi-ARFCN radio supportTom Tsou1-9/+7
Add new radio interface "radioInterfaceMulti" for multi-carrier support. Only USRP B200/B210 devices are supported because of sample rate requirements (3.2 Msps). Only 4 SPS operation Tx/RX is supported. 8-PSK is supported. Other options may be added at a later time Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-07-01iface: Add inner ring-buffer implementationTom Tsou1-1/+0
Two buffers, inner and outer, are used in the transceiver implementation. The outer buffer interfaces with the device receive interface to guarantee timestamp aligned and contiguously allocated sample buffers. The inner buffer absorbs vector size differences between GSM bursts (156 or 157 samples) and the resampler interface (typically fixed multiples of 65). Reimplement the inner buffer with a ring buffer that allows fixed size segments on the outer (resampler) portion and variable lengths (GSM side) on the inner side. Compared to the previous stack-like version, this implementation removes unnecessary copying of buffer contents. Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-06-22transceiver: Add an option to emulate a RACH delay in random filler mode.Alexander Chemeris1-6/+12
Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-06-21sigproc: Expand RACH, TSC, and EDGE correlation windowsTom Tsou1-10/+10
Slightly widen the search range to accommodate timing jitter on certain classes of devices. The expanded range minimizes the possibility of missing bursts that arrive too early or too late due to timing error. Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-04-26EDGE: Fix demodulation slicer inputTom Tsou1-1/+1
EDGE 8-PSK soft slicer was receiving input from the output of the downsampler. Equalization and derotation were missing causing the soft symbol output to be invalid. Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-04-26uhd: Correct timing alignment in 8-PSK and GMSK downlink burstsTom Tsou1-5/+14
Delay the EDGE downlink bursts by one symbol in order to match GMSK pulse shaping group delay. The difference in group delay arises from the dual pulse filter combination of the GMSK Laurent represenation whereas 8-PSK uses a single pulse linear filter. Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-04-20transceiver: Add an option to generate random Access Bursts.Alexander Chemeris1-0/+33
2016-04-20transceiver: Properly handle MAXDLY.Alexander Chemeris1-4/+5
Previously MAXDLY value was applied to Normal Bursts, which was nice when working with sloppy test equipment like CMD57, but useless for real world usage. At the same time documentation and de facto usage of MAXDLY in OsmoBTS and OpenBTS assumed that it actually applies to Access Bursts (RACH). So this patch changes osmo-rx behavior to apply MAXDLY to RACH bursts and introduces a new command MAXDLYNB for the old behavior.
2016-03-08EDGE: Combine shared GMSK and 8-PSK demodulator sectionsTom Tsou1-22/+35
Timing recovery and single tap channel compensation are identical in both GMSK and EDGE receivers. This is the section ahead of and including the optional 4-1 downsampler. GMSK and EDGE specific sections operate at 1 SPS. Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-03-08sigproc: Add various GSM burst generatorsTom Tsou1-0/+62
Setup generators for empty, random, and dummy bursts. This moves error prone burst length handling out of the Transceiver and into the signal processing core. Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-03-08sigproc: Always use 625 sample length bursts with 4 SPSTom Tsou1-12/+12
At 4 samples per symbol, we don't need to maintain the 156/157 sample slot structure to account for the GSM 156.25 sample burst length. Set the 4 SPS Laurent modulator to ignore the guard interval setting and always output 625 sample sized bursts. The EDGE 8-PSK modulator already has this behavior. Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-03-06EDGE: Add 8-PSK modulator and demodulatorTom Tsou1-25/+465
Setup correlator and detection process similar to the GMSK receiver chain. Require 4 SPS sampling on both Rx and Tx paths as 1 SPS sampling adds too much distoration for 8-PSK recovery. Core receiver operations still run at 1 SPS with the exception of fractional delay filtering, which runs at the higher rate. Perform linear equalization to handle the Gaussian pulse induced ISI. The fixed impulse response used for equalizer tap calculation consists of combined EDGE pulse shape filter and effects of the downsampling filter. Note that the non-adaptive equalizer corrects for modulation induced band limiting and does not account for or compensate for fading channel effects. Signed-off-by: Tom Tsou <tom.tsou@ettus.com>