Transceiver52M: Verify global config sanity before using

The configuration table is instantiated as a global variable with
no means to check constructor status. This means various types
of database failure conditions (e.g. file existence, permissions,
etc.) are not reported. This patch performs a small number of
checks to make sure that the configuration is sane.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
Transceiver52M: Disable equalization

Does not show reliable operation during testing at 1 SPS, and is
not supported at higher SPS values.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
Transceiver52M: Remove redundant file existence check
Transceiver52M: Rename samples-per-symbol variable names

Because repeatedly typing mSamplesPerSymbol is giving me
carpal tunnel syndrome. Replace with the much shorter,
easier to type, and just as clear name of 'sps'.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
Transceiver52M: Make GSM pulse filter internal to implementation

There is no reason expose the pulse shaping filter outside of the
signal processing calls. The main transceiver object makes no use
of the filter and there's no reason to pass it around.

Initialize the pulse shape with the signal processing library, and
maintain an internal static member like many of the other library
variables. Similarly destroy the object when the library is closed.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
Transceiver52M: Add destructors to correlation seqeunce objects

Add destructor calls so we can avoid the nested vector deallocations.
Also remove the unnecessary pointer NULL checks prior to destruction.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
Transceiver52M: Remove logging from signal processing core

The only logging outputs in the the signal processing library
are debug lines that generate copious amounts of output while
providing little useful information to the user. The relevant
information (time-of-arrival, channel gains, etc.) can and
should be logged from transceiver instance itself.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
Transceiver52M: Generate RACH correlation sequence at initialization

There is no temporal dependency on when the RACH sequence is generated,
so there is no need for transceiver to create it in response to a
command from GSM core. If we power on the transceiver, we will need
the RACH sequence, so just allocate it during initialization.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
Transceiver52M: Replace convolve and related calls with SSE implementation

This large patch replaced the convolve() call with an SSE vector
enabled version. The lower C and SSE intrinsic based code operates
on fixed and aligned vectors for the filter taps. The storage format
of interleaved I/Q for both complex and real vectors is maintained.

SSE filter tap values must:

  1. Start 16-byte aligned
  2. Number with a multiple of 4 between 4 and 20 for real taps
  3. Number with a multiple of 4 for complex taps

Non-compliant values will fall back to non-SSE usage. Fixed length
iterators mean that head and tail cases may require reallocation of
the input vector, which is automatically handled by the upper C++
interface.

Other calls are affected by these changes and adjusted or rewritten
accordingly. The underlying algorithms, however, are unchanged.

  generateGSMPulse()
  analyzeTrafficBurst()
  detectRACHBurst()

Intel SSE configuration is automatically detected and configured at
build time with Autoconf macros.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
Transceiver52M: Reverse storage of convolution vectors

With convolution changes, we now assume that tap values for
filterting are stored in reverse. Along the same lines,
the tap values used during correlation are no longer stored
in reverse, however, they are still assumed to be conjugated.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
Transceiver52M: Replace resampler with SSE enabled implementation

Replace the polyphase filter and resampler with a separate
implementation using SSE enabled convolution. The USRP2 (including
derived devices N200, N210) are the only supported devices that
require sample rate conversion, so set the default resampling
parameters for the 100 MHz FPGA clock. This changes the previous
resampling ratios.

  270.833 kHz -> 400 kHz      (65 / 96)
  270.833 kHz -> 390.625 kHz  (52 / 75)

The new resampling factor uses a USRP resampling factor of 256
instead of 250. On the device, this allows two halfband filters to
be used rather than one. The end result is reduced distortial and
aliasing effecits from CIC filter rolloff.

B100 and USRP1 will no be supported at 400 ksps with these changes.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
Transceiver52M: Add SSE floating point / integer conversion

Convertions are performed in multiples of 4 or 8. All loads are
considered unaligned.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
Transceiver52M: Disable energy detector at 1 sample-per-symbol

The adaptive energy threshold gating suffers a near-far problem
at certain gain levels. This is due to exponential threshold
raising, but linear decreases. A large signal level followed by
a period low signal level causes (comparatively) weak signals to
go undetected. Additionally, the algorithm performs differently
at multiple RF gain levels.

This patch switches solely to correlation based gating for burst
detection. At one SPS, the main computational load with this
approach is sub-sample width peak interpolation, which we disable
for intial detection.

This option is only enabled for one SPS.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
Transceiver52M: Add 4 samples-per-symbol Laurent pulse shape

When 4 samples-per-symbol operation is selected, replace the
existing pulse approximation, which becomes inaccurate with
non-unit oversampling, with the primary pulse, C0, from the
Laurent linear pulse approximation.

Pierre Laurent, "Exact and Approximate Construction of Digital Phase
  Modulations by Superposition of Amplitude Modulated Pulses", IEEE
  Transactions of Communications, Vol. 34, No. 2, Feb 1986.

Octave pulse generation code for the first three pulses of the
linear approximation are included.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
Transceiver52M: Add UmTRX support

Requires Fairwaves UHD driver.

  https://github.com/chemeris/UHD-Fairwaves.git

Signed-off-by: Thomas Tsou <tom@tsou.cc>
Transceiver52M: Refactor RACH and normal burst detection

Both RACH and normal bursts are detected with the same approach of
midamble correlation combined with peak-to-average ratio. The
difference is the midamble placements and lengths. Thus, there is
no reason to have independent implementations.

This patch creates a common call burstDetect(), while leaving the
correlation window indexing in the original calls.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
Transceiver52M: Increase normal and RACH correlation thresholds

Because we can. New threshold values obtained by from bench testing
with generated noise and modulated PN sequences. Detection still
achievable near noise floor.

Signal source: Rohde & Schwarz SMIQ

Signed-off-by: Thomas Tsou <tom@tsou.cc>
Transceiver52M: Widen resampling filter width by about 25 percent

This patch only applies to use at 4 samples-per-symbol. By widening
the resampling filter we achieve slightly better total distortion
on USRP2 testing. At 4 samples-per-symbol this gives us roughly an
additional 0.5 degree RMS of improved phase error on Agilent E4406A
testing. This comes at a slight expense of amplitude error, but
given phase or ampltude accuracy, we'll take the phase.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
Transceiver52M: Check that sample rates are sane before using

If there is an error in the sample rate determination, noted
by a negative return sample rate value, error directly and
don't try to set the device rate.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
Transceiver52M: Add B200 support

Currently only supported at 4 samples-per-symbol.

Signed-off-by: Thomas Tsou <tom@tsou.cc>