Commit Graph

96 Commits

Author SHA1 Message Date
Pau Espin 985694175d computeCI: Document hardcoded multiplier
Logarithm change of base rule is used. Document it so it's clear where
it comes from.

Change-Id: Ia588e8dafda4e1abe0721f12491661949339a1ba
2021-09-03 13:52:02 +02:00
Pau Espin e16d0e1330 cosmetic: Fix typo in comment
Change-Id: I33f4253cecab8d92eec75af49e1671874b8cc111
2021-09-01 20:43:03 +02:00
Pau Espin e6fdf8fcad detectGeneralBurst(): Increase log level about clipping to INFO
There's another related logging line also at INFO level in the caller
path in  Transceiver.cpp, but it only prints if detectBurst() failed.
Let's print this one as INFO too, which proved to be a good logging
level. This way user also notices gain is too high despite osmo-trx is
still able to decode bursts.

Change-Id: Ieca4f19ae1099a430e9b838f8b6780b1c61a87a9
2021-09-01 20:36:33 +02:00
Pau Espin cdd77a447d computeCI(): Constify read-only variable
Change-Id: Ia157b970db92eef252c3657b35607307b7ebf988
2021-09-01 20:10:04 +02:00
Pau Espin 7f696801ae computeCI(): Rename verbose repeated getter to constant
Change-Id: I9b426d01a282f572c0b915c5666642dce4c60475
2021-09-01 20:08:55 +02:00
Pau Espin d16eb314ed computeCI(): Constify param and pass it as reference
Change-Id: Icba5fce57c858bd16196ae3012c100c7e4134335
2021-09-01 19:51:28 +02:00
Pau Espin 27bd2f6dd1 detectBurst(): constify parameter
Change-Id: I3d8738b492a175f2ef0c570579e335e7b7695694
2021-09-01 19:46:43 +02:00
Pau Espin 8803f923f9 detectBurst(): Clear downsampling code path
downsampleBurst() and the Resampler below it clearly only support or are
confgiured for 1<->4 setup currently.

Change-Id: Iebaff7a34bd24e56627f148182859918accbfa82
2021-09-01 19:43:11 +02:00
Sylvain Munaut ad202d72e1 sigProcLib: fix C/I computation for 8-PSK modulated bursts
Change-Id: I860af60bc0fbd36dfb38316fad65ddd3a5827a8f
Related: Ib4ceec553f2e5f77bf3f6777724968456a180f5e
Related: OS#4006, OS#4373
2021-02-04 20:44:51 +01:00
Martin Hauke 066fd04f47 Fix common misspellings and typos
Change-Id: I4ec7accb1912c052b446be7c399bed32a8c62253
2019-10-17 08:06:19 +00:00
Pau Espin 21d03d3912 Add SPDX annotation
Related: OS#3515
Change-Id: I3719bd8dc015569ecd81928fc079e27593cdca09
2019-07-22 12:06:26 +02:00
Harald Welte 5c6ca1739f CorrelationSequence: fix initialization of class members
Change-Id: Ia72395f8805e9e2cd700ad1e559a8aa62124aaec
Closes: CID#149371
2019-07-21 15:46:04 +00:00
Sylvain Munaut b49a42e70b sigProcLib: Add C/I (Carrier-to-Interference ratio) computation
Related: OS#4006
Change-Id: Ib4ceec553f2e5f77bf3f6777724968456a180f5e
2019-07-19 11:44:13 +00:00
Pau Espin c3d68c159f sigProcLib: detectAnyBurst(): make TSC used to detect burst available to caller
This value will be sent in TRXDv1 protocol.

Related: OS#4006
Change-Id: I603b7b52f957cf897b036dbaeb22c01a55de08c3
2019-07-19 11:44:13 +00:00
Pau Espin 7ee2d10113 sigProcLib: detectAnyBurst() family: Use struct to gather all out params
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-19 11:44:13 +00:00
Pau Espin 7dc07b9425 Transceiver: Get rid of SoftVector in struct trx_ul_burst_ind
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-07-02 15:05:17 +02:00
Sylvain Munaut a3934a11a4 convolve: Remove support for step, offset parameters
- 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>
2019-01-21 10:34:51 +01:00
Pau Espin f7331764ac SigProcLib: Improve Vector buffer allocation mess
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-12-05 19:41:34 +00:00
Vadim Yanitskiy 444ff34396 sigProcLib: add a CorrType for extended (11-bit) RACH
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-24 19:28:47 +00:00
Vadim Yanitskiy a79bc70737 sigProcLib: introduce both TS1 and TS2 RACH synch. sequences
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-10-24 19:28:47 +00:00
Pau Espin 21ce05c54f cosmetic: Fix trailing whitespace in several files
Change-Id: Ibf5a69f0a3a309e87814635fd903b114fe68890c
2018-09-10 10:30:06 +02:00
Pau Espin 5e68cde779 SigProcLib: Use available copyTo Vector API instead of memcopy
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
2018-09-10 10:30:06 +02:00
Tom Tsou 354741326c sigProcLib: Specify standard namespace for isnan()
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-22 18:03:29 +00:00
Tom Tsou a3dce85ffc sigProcLib: Use explicit NaN check in sinc table generation
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-19 17:04:04 +00:00
Tom Tsou bb0c68ae61 sigProcLib: Remove trigonometric tables
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-19 17:03:11 +00:00
Tom Tsou 7278a87767 sigProcLib: Remove heap based signal vector allocations
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-16 17:11:27 +00:00
Tom Tsou 63eef9faf2 sigProcLib: Fix complex/real vector flag in Laurent modulator
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-16 17:09:09 +00:00
Tom Tsou 70134a01eb sigProcLib: Remove unused functions from public interface
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-06-14 16:30:28 +00:00
Alexander Chemeris 5e65b531e0 sigProcLib: Fix number of tail bits in random Normal Bursts and zero 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-29 15:15:36 +03:00
Tom Tsou d6ae8648ff radioInterface: Remove UmTRX 'diversity' option
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-05-19 17:25:44 +00:00
Tom Tsou 2af14407a8 sigProcLib: Fix negative value check on unsigned value
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-31 21:43:31 +00:00
Tom Tsou 92bdfb86ac sigProcLib: Check return status on downsampling
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-31 21:41:04 +00:00
Tom Tsou ae91f13ecb sigProcLib: Remove unreachable code and no-effect checks
Unreachable path and negative value inspection on unsigned
types.

Change-Id: If53b4b03550b0a7656c808cfe96806252153eb2f
Fixes: Coverity CID 165239, 165238, 165236
2017-03-31 21:41:03 +00:00
Alexander Chemeris e0c12189d4 sigProcLib: Constify demodulation functions burst argument.
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-28 14:24:22 +00:00
Alexander Chemeris 1470fcdb5a sigProcLib: constify signalVector arguments for detectBurst() functions.
Change-Id: Ic033371a387353eb12b1827a0eb16c00c07da88a
2017-03-28 14:24:07 +00:00
Alexander Chemeris 6e1dffd486 Move Transceiver::demodulate() to sigProcLib to make it reusable.
Change-Id: I2cad47160e53f65612bd1da8998c83a0a22bce9b
2017-03-28 14:23:56 +00:00
Alexander Chemeris f7717acd0c sigProcLib: Add operator<< to print CorrType to a string.
Change-Id: I3d68cbdab8fb504d7f155029654a576d318a201e
2017-03-28 14:23:35 +00:00
Alexander Chemeris 4e6c938024 Move Transceiver::detectBurst() to sigProcLib to make it reusable.
Change-Id: I3cbe8e6e4f39dde02c945e6c9086c040e276845c
2017-03-24 14:59:24 -07:00
Alexander Chemeris b61c610cd9 Call vectorSlicer() right before packing bits for transmission to osmo-bts.
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-22 18:31:07 +00:00
Alexander Chemeris 132fb247b1 sigProcLib: Slice SoftVector instead of signalVector for GMSK demod.
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-22 18:31:03 +00:00
Alexander Chemeris 1c0b8b355c sigProcLib: Rename demodulateBurst() to demodGmskBurst() for clarity.
Change-Id: Ibcef8d7d4a2c06865bed7e4091ccc8dbbd494d77
2017-03-22 18:30:53 +00:00
Alexander Chemeris 1dd05cf35a sigProcLib: make energyDetect() simpler by returning actual energy.
Change-Id: I9bf97f2dc03fea9bebcf43198dfb05f6e4694e9c
2017-03-22 18:09:00 +00:00
Alexander Chemeris 14d13b67dc sigProcLib: Fix documentation, sync argument names in .cpp and .h files.
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-20 18:42:32 +00:00
Alexander Chemeris 9270a5aa2e sigProcLib: Typo sybols -> symbols
Change-Id: I8cbef852374d0458c4f4ad4be0df0aa998e3796a
2017-03-20 17:36:06 +00:00
Tom Tsou aa15d62a8c sigproc: Match differential GMSK start/end bits to tail bits
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-08-11 14:44:57 -07:00
Tom Tsou 06676ead63 sigproc: Fix missing 8-PSK tail symbols
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 d2b070369d
"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-19 12:56:24 -07:00
Tom Tsou a84e162672 sigproc: Adjust burst detection threshold criteria
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-01 03:14:29 -07:00
Tom Tsou 7676427816 mcbts: Add multi-ARFCN radio support
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-01 03:14:15 -07:00
Tom Tsou 28670fb5da iface: Add inner ring-buffer implementation
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-07-01 03:03:11 -07:00
Alexander Chemeris 37c52c79cf transceiver: Add an option to emulate a RACH delay in random filler mode.
Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-06-22 15:18:13 -07:00