Commit Graph

679 Commits

Author SHA1 Message Date
Pau Espin 88f86a14ba Bind CTRL port to IP addr specified in VTY config
Before this commit, osmo-trx was always setting its CTRL socket to
listen on 127.0.0.1.

Change-Id: I61a06c1b9c20a906e7030f824a93370d041be7b9
2019-07-22 22:15:24 +00:00
Pau Espin 21d03d3912 Add SPDX annotation
Related: OS#3515
Change-Id: I3719bd8dc015569ecd81928fc079e27593cdca09
2019-07-22 12:06:26 +02:00
Pau Espin bdb970e495 cosmetic: Fix trailing whitespace in several files
Change-Id: Ifafb68353960fc5046661854ccfb8d783b0efb14
2019-07-22 12:03:39 +02:00
Harald Welte 2896cecefb radioInterface.cpp: Fix missing member initialization of RadioInterface()
Change-Id: I7264ef35dbe6d3522858eae5b47d150aa1ffe334
Closes: CID#169594
2019-07-21 15:46:06 +00:00
Harald Welte 5c6ca1739f CorrelationSequence: fix initialization of class members
Change-Id: Ia72395f8805e9e2cd700ad1e559a8aa62124aaec
Closes: CID#149371
2019-07-21 15:46:04 +00:00
Harald Welte 80ca1de44a ChannelizerBase: fix initialization of class members
Change-Id: I8c047c8f98e928a62dca1d7b8c003502727c086e
Closes: CID#149374
2019-07-21 15:46:01 +00:00
Vadim Yanitskiy 6fa906c280 trxd_fill_common(): fix TRXD header version coding
The header version field is 4 bit long, so the mask 0x07 == 0b111
is wrong, it should actually be 0x0f == 0b1111.

Change-Id: I290931559ce01cf6e43470b18855c46808d6c2a5
2019-07-20 19:39:18 +07:00
Harald Welte a7ba484fb2 proto_trxd.c: Use bit-wise AND, not boolean AND
Change-Id: I974c91be7cc119b44c2fb0c53d08009c87de7bf1
Related: CID#202038
2019-07-20 10:13:18 +02:00
Pau Espin 758381bad4 Transceiver: Initialize mExtRACH in constructor
Doing so should make Coverity happy:
>>>     CID 200212:  Uninitialized members  (UNINIT_CTOR)
>>>     Non-static class member "mExtRACH" is not initialized in this constructor nor in any functions that it calls.

The current status is actually harmless since the field will be set
during init() time, and the variable is never used before init() is
called.

Fixes: Coverity CID#200212
Change-Id: I17286570a9a6db695a75147e5cbb18c9da7d0fe6
2019-07-19 14:58:32 +02:00
Vadim Yanitskiy 56c5f2959b driveTxPriorityQueue(): enrich logging message
Change-Id: If25c2171f7d1ab98d65f0dbf93d0d8a5a635caf7
2019-07-19 14:58:32 +02:00
Vadim Yanitskiy dd571c6db1 driveTxPriorityQueue(): check if message header format is supported
Change-Id: I17abf95f5e23236abccc50476cd59931580f5cd3
2019-07-19 14:58:32 +02:00
Vadim Yanitskiy b31232537a driveTxPriorityQueue(): use trxd_hdr_common for message parsing
Change-Id: If6a93e2b7fc9ada55edbdd16352cd4f7040e3d2a
2019-07-19 14:58:32 +02:00
Vadim Yanitskiy 8d771d24e7 driveTxPriorityQueue(): cosmetic: use proper type for TDMA TN
Change-Id: I8396004616754f84fb465c972fde9e91b18cc49b
2019-07-19 14:58:32 +02:00
Pau Espin cf6113b2fe Transceiver: Support TRXD v1
Related: OS#4006
Change-Id: I53db2678458a7377c87875b58b58b76a1b900517
2019-07-19 14:58:29 +02:00
Pau Espin 13c81098f8 Transceiver: Support SETFORMAT command
Only old v0 is supported so far.

Related: OS#4006
Change-Id: If9fc22f9987238a5ff870df7718de4efc9e04289
2019-07-19 11:44:13 +00:00
Pau Espin 15fa64bce4 Transceiver: Move out TRXD socket send code to prepare for TRXDv1
Only old v0 is supported so far. TRXD protocol related data/logic is
moved to its own file out of Transceiver class. Code is refactored so it
can be re-used later by TRXDv1.

Related: OS#4006
Change-Id: I5786dd44b076202c6f1a6e82405670e8605797ed
2019-07-19 11:44:13 +00:00
Pau Espin c9202ab0be Logger: global Log mutex is now available from C code
This way the C++ logging API can still be used while allowing for C
files to use the same mutex.

Change-Id: I473e57479f8ae98a84ad00b76ff338f79f732236
2019-07-19 11:44:13 +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
Ruben Undheim 252564b50e Fix spelling discovered by lintian
Change-Id: I5ab9b9c7c47d0d6e674c1f5242e2b3a05006293e
2019-07-17 10:58:22 +00:00
Pau Espin 95c8318d5d Transceiver: Support pulling idle frames in pullRadioVector()
This logic will be used once we support TRXDv1, where idle indications
are sent through the socket.

Related: OS#4006
Change-Id: I46404f6e4055b6d3af3afffb0dfe4a19502917aa
2019-07-03 16:03:21 +02:00
Pau Espin 9bb24a1103 Transceiver: pullRadioVector(): Move initialization of var to start of function
This will be needed upon forthcoming refactor to support idle frames,
which will add a goto return. Otherwise compiler complains:

error: jump to label ret_idle [-fpermissive]
note:   crosses initialization of unsigned int max_toa

Change-Id: Icd2793adc7b73a795184639b95fb5da336909b59
2019-07-03 15:49:38 +02:00
Pau Espin d6dbb1b987 Transceiver: Simplify code on early error return when calling detectAnyBurst
We get rid of one branch and simplify code logic.

Change-Id: I026e35262bfe42c3d23ebdc06d84e4908a8380e2
2019-07-03 15:49:38 +02:00
Pau Espin be9cd66020 Transceiver: Avoid noise calculation formula in 2 branches in pullRadioVector
Makes code easier to follow and will help in forthcoming refactoring
once idle frames are supported.

Change-Id: I56c84e9684ca460efd6c983d7e95d8e455bcac69
2019-07-03 15:49:38 +02:00
Pau Espin b9d2515704 Transceiver: replace UDPSocket with libosmocore socket API
We have a good socket API in libosmocore, let's drop osmo-trx socket API
and use libosmocore's one instead of maintaining the two of them.

Change-Id: Ib19856a3e0a7607f63436c4a80b1381a3f318764
2019-07-02 15:07:25 +02: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
Pau Espin 07ddce5c1f Transceiver: Drop use of GSM::Time from trx_ul_burst_ind
Use of that class is really not needed since we don't need to do any
calculation with those values, so we can simply store the final values
in the struct.

Related: OS#4006
Change-Id: Iadf2683d7f52138a2248598641f3b702252f325d
2019-07-02 15:05:17 +02:00
Pau Espin 25ae190dc6 Transceiver: Move soft bits normalization to pullRadioVector()
That's where all the filling logic happens, while in driveReceiveFIFO we
mostly want to take the burst, generate a message and sent it over the
socket.

Related: OS#4006
Change-Id: Ibfb48877af4ff5ef0f56390901669c8353beaf48
2019-07-02 15:05:10 +02:00
Pau Espin 607a414967 Transceiver: Move calculation of normalized values (rssiOffset) to pullRadioVector()
That's where all the filling logic happens, while in driveReceiveFIFO we
mostly want to take the burst, generate a message and sent it over the
socket.
In pullRadioVector this way we always provide normalized values based on
user configuration (VTY rssi-offset).

Related: OS#4006
Change-Id: I1ee28daf21dc287bec564d45d58086d63655c0f6
2019-07-02 15:04:40 +02:00
Pau Espin 0e67cf24eb Transceiver: Move nbits burst size calculation to pullRadioVector()
That's where all the filling logic happens, while in driveReceiveFIFO we
mostly want to take the burst, generate a message and sent it over the
socket.

Related: OS#4006
Change-Id: Ib1df10c40d737954904290f57d58b1c77d65f82e
2019-07-02 15:04:29 +02:00
Pau Espin ff6aeb7f62 Transceiver: Drop unused rssi_valid struct field
That field is actually never used. Furthermore, if pullRadioVector()
returns false, then the caller should consider the 'trx_ul_burst_ind'
structure as uninitialized. Moreover, RSSI is mandatory - we cannot send
burst indications without it.

Related: OS#4006
Change-Id: Ia109298aebe8ba4750a39338ba7962555903cd82
2019-07-02 15:04:24 +02:00
Pau Espin ddd18a5e33 Transceiver: refactor: gather uplink burst parameters in struct
A new struct trx_ul_burst_ind is introduced, which will handle
information filled by lower layers upon decoding of uplink bursts.

Methods pullRadioVector() and logRxBurst() are adapted to use that
struct. This way it's easier to understand in/out parameters and it's
also easier to add further parameters to be filled in in the future.

Related: OS#4006
Change-Id: I7e590fb1c0901de627e782f183251c20f4f68d48
2019-07-01 16:13:21 +02:00
Pau Espin 778b30a530 Introduce structs to encode TRXD packets
This will ease adding new protocol versions in the future.

Related: OS#4006
Change-Id: I67ffede171eddde436f9057191ed76015a8ea6eb
2019-07-01 16:13:10 +02:00
Eric Wild ac0487eb66 Add option to set stack size in config file, default == 0 == OS default
Change-Id: Id752f6b5ce9a96a67cd1ff835687ce0e03d3a50d
2019-06-17 14:41:34 +02:00
Pau Espin bde55afd29 lms: Fix stream_stats checks with overrun/underrun
It was initially thought that underruns/overrun fields were
increasing-over-time values.
However, after reading LimeSuite code, it seems overrun and
underrun fields are actually reset upon every call to
LMS_GetStreamStatus().

Related: osmo-trx.git 9281771256
Related: https://github.com/myriadrf/LimeSuite/issues/265
Change-Id: I677232a7b12ee83d26aa34d92f76a91d4b5a63a6
2019-06-09 06:55:13 +00:00
Pau Espin 4c50bf435b lms: Drop unusued variable masterClockRate
Change-Id: I19192925d008046f474615a0476b52ddee9a9d78
2019-06-06 19:44:22 +00:00
Pau Espin b426e4abb4 Rename and move STOP signal from Transceiver to main
The callback actually belongs there, since it's the code/thread in main the one
actually in charge of stopping everything. It simplifies current code,
and more important, allows for new clients of this signal to use it.
This callback will also be used in forthcoming commits by code
controlling rate_ctr thresholds to stop the process if the VTY
configured threshold is used.

Change-Id: Id4159e64225c6606fef34a74b24f37c3a071aceb
2019-06-05 12:50:38 +02:00
Pau Espin 4456b6f132 Add rate_ctr support to store/retrieve SDR errors through VTY
Introduce a unified implementation-agnostic interface for radioDevice to
signal SDR error counters to upper layers and manage them.
This patch only implements counters for osmo-trx-lms (other devices will
show all counters unchanged during time).

Sample use through VTY:
"""
OsmoTRX> show rate-counters
osmo-trx statistics 0:
   device:rx_underruns:          0 (0/s 0/m 0/h 0/d) Number of Rx underruns
    device:rx_overruns:          0 (0/s 0/m 0/h 0/d) Number of Rx overruns
   device:tx_underruns:          0 (0/s 0/m 0/h 0/d) Number of Tx underruns
 device:rx_drop_events:          4 (0/s 2/m 3/h 0/d) Number of times Rx samples were dropped by HW
device:rx_drop_samples:        513 (0/s 196/m 425/h 0/d) Number of Rx samples dropped by HW
"""

Change-Id: I78b158141697e5714d04db8b9ccc96f31f34f439
2019-06-05 12:50:38 +02:00
Pau Espin 9281771256 lms: Fix stream_stats checks with droppedPackets
Existing code had a typo (value was assigned from wrong variable).
Furthermore, it was experimentally found that:
while underrun/overrun are documented as "FIFO overrun
count" in LimeSuite.h, it seems droppedPackets ("Number of dropped
packets by HW") is not actually an incrementing counter like the others,
but simply a value set every time LMS_RecvStream() is called. Since we
are actually interested in keeping the count over time, adjust code to
achieve that.

Change-Id: Id93d33400e11360b9536f56a31904328549cfbbf
2019-05-24 17:01:13 +02:00
Pau Espin dcbcfa58e4 lms: Use smpl_buf to recover from timestamp jumps
Also take the chance to make sure we handle properly short reads (keep
reading again).

Both scenarios can be tested by running osmo-trx-lms and then using
on a terminal:
sudo kill -STOP `pidof osmo-trx-lms`; sleep 0.5; sudo kill -CONT `pidof osmo-trx-lms`

Fixes: OS#3339
Change-Id: Idfc4e69acc30afb11440b6b9cbdcfa09ff920265
2019-05-06 11:23:36 +02:00
Pau Espin b5def414b8 smpl_buf: Move it to device/common and create libdevice_common.la
Since in next commit osmo-trx-lms starts using smpl_buf.cpp, it seems
some automake step doesn't like including a cpp file twice from a
different directory, since race conditions can occur building it.
Instead we define the dependency by first building a static lib and then
using it on each libdevice.la (one per device type).

We already do the similar under arch/ subdir, where we have a common/
subdir and then one subdir and lib per architecture.

Change-Id: I465ad0f6d5569bb3006d711c8fd0df14391fcf35
2019-05-06 11:23:18 +02:00
Pau Espin fc73c073a1 Introduce LOGCHAN macro to standarize logging channel info
Change-Id: I67d869499aa16af58c863ca7b74c356bcd979936
2019-05-06 11:21:43 +02:00
Pau Espin a7919265f5 smpl_buf: Remove dbg log line with duplicated info
Change-Id: Ia2423707210a364fa6827b92cca087ced99b088b
2019-05-04 20:36:07 +02:00
Pau Espin 9b394e0cc0 smpl_buf: Remove unused clk_rt variable (fixup)
Last commit removed use of the clkr_rt variable but forgot to remove the
variable itself.

Fixes: 580c48b7d5
Fixes: Coverity CID 198370
Change-Id: Ida1fc5b7b338fbeb2a7c6258f36b02da93ff2186
2019-05-04 20:05:06 +02:00
Pau Espin 580c48b7d5 smpl_buf: Remove unused clk_rt variable
During 87b7d098e5 we dropped support for
UHD specific functionalitites, and so clk_rt is not needed anymore.

Change-Id: I37403e085ed6a541bbdecf64f1f9a821ff2753a4
2019-05-03 14:38:51 +02:00
Pau Espin 7214fde085 device: Drop unused numberRead/numberWritten APIs
It's really not used, so let's drop unused code and simplify work for
new to come device drivers implementation.

Change-Id: I0d18f9c2584771e2f7b3d5c6b016e764e02855ff
2019-05-03 13:50:50 +02:00
Pau Espin 51509b3895 Move smpl_buf out of uhd dir to re-use it in other devices
Change-Id: I39ac8435072cff8d4dac786b31ff4af9b61a77fe
2019-05-03 13:50:50 +02:00
Pau Espin ef192d303c uhd: Avoid reallocation of buffers every read
Buffer size is based on num of chans and rxBuffer size is based on num
of chans and rx_spp, and both are available and set during open(), so no
need to waste time allocating and freeing them everytime we read from
the device.

Change-Id: I8c881c9c303c80f323825d85a924d74b76d2ce47
2019-05-03 13:50:50 +02:00
Pau Espin ac927b2690 cosmetic: uhd: Use loglevel ERROR instead of ERR
ERR is osmo-trx legacy level, which actually converts to osmocom's
ERROR, so let's use that one directly.

Change-Id: I82f6f89a725bea7f7acfa455c20cf922cc3f8a00
2019-05-03 13:50:50 +02:00
Pau Espin 3e9179a55e uhd: smpl_buf: Use TIMESTAMP type in str_status
Other related functions use "TIMESTAMP timestamp" so let's use same
stuff in that function.

Change-Id: I016b1a7f8db379caebc1409ca11e5ae8b759d2d4
2019-05-03 13:50:50 +02:00
Pau Espin 87b7d098e5 uhd: smpl_buf: Drop UHD specifics out back to UHDDevice
This way smpl_buf can be re-used later by other non-UHD drivers.

Change-Id: I94061328d46a550d4147121d85baffa29c700c45
2019-05-03 13:50:50 +02:00
Pau Espin 7bef2346c4 cosmetic: uhd: Move smpl_buf out of UHDDevice, move UHDDevice class definition to .h
* move class definition to .h file, like we do for other devices.
* move smpl_buf class to a different file inside uhd/.
* Preparation work to have smpl_buf being used in a generic way for
devices other than UHD (LMS).

Change-Id: Ib4594320da9bb7f6e9f52e7d70d11ecd11106aae
2019-05-03 13:50:47 +02:00
Pau Espin 2876785f50 lms: Catch and log dropped packets by HW during recv
Change-Id: I23554d95b0aff585024610fc12920c9da4f3ba9e
2019-04-25 20:16:10 +02:00
Pau Espin 713b4d81cd lms: Remove unused var m_last_tx_overruns
Change-Id: I2104205b2af7cd6c86075d5cc4f0f36bde5e5311
2019-04-25 20:16:10 +02:00
Pau Espin b96d9ddee3 lms: Remove references to ALERT loglevel
ALERT log level is not Osmocom standard level, it's just a define in
osmo-trx to keep compatibility with old code.

Same goes for one reference to "ERR" intead of "ERROR".

Change-Id: I0e171a8ac8a8bfa804ac97fba3d73efcfa6424b4
2019-04-25 20:16:10 +02:00
Pau Espin 048c3ba300 lms: Log underrun/overrun events
Change-Id: I8c6b1d3e8515153e5d4079cc6620901ef8ce2449
2019-04-25 20:16:10 +02:00
Pau Espin 75cb0b9dd6 Move duplicated thread_enable_cancel to CommonLibs
Change-Id: I1a479b59bdda01233273dfa919bd678edbe34708
2019-04-25 19:33:58 +02:00
Pau Espin bab1583a2c lms: Improve log during flush recv error
Change-Id: Id45d42599738efd6a5d89787c75779838a979330
2019-04-25 19:26:24 +02:00
Pau Espin 541496b65b lms: flush_recv: alloc buf on stack instead of heap
No need to use the heap here since buffer is only used as a temporary
trash. Using the stack is quicker.

Change-Id: Iede8dc0903ee3865a52c8e2fd811bcde444fee33
2019-04-25 19:22:11 +02:00
Joachim Steiger c785fb130a lms: properly call close if set_antennas() fails, add some comments
Change-Id: I9ebe986ee3a15842a15853424ee98e9a2fa6a5df
2019-04-17 18:24:11 +00:00
Joachim Steiger 2875290d95 lms: add device type detection and device specific gains
add device dependant max gain setup - limesdr mini and limenet micro need slightly reduced maximum gains to get a PASS on phase error measurements
rework clock reference setup - external clock needs to be selected before calling LMS_Init(), internal can only be set after.
remove now unused compat_LMS_VCTCXO* functions - we do not set the VCTXCO directly anymore

Change-Id: I3cf905b0a84bc1ec200891762a6646141ee37181
2019-04-17 18:24:11 +00:00
Joachim Steiger 4ce4555d0e lms: move LMS_GetLPFBWRange and LMS_Calibrate calls from open to start
bandwidth, freqency, gain stages need to be set before calibration can be successful

Change-Id: I1090effdf0f43e5183a402e4c1a1ffe5abdefd37
2019-04-17 18:24:11 +00:00
Joachim Steiger 2d130fb15d lms: move LMS_EnableChannel from Start/Stop to Open/Close device
move enable: it is important that channels are actually enabled before applying any configuration (besides external clock)
move disable: move to close, so channels are not disabled and not enabled again while osmotrx is active.

Change-Id: I82878913254ce15a85db8d006e13d5eb639793e9
2019-04-17 18:24:11 +00:00
Joachim Steiger 6c5f4bae46 lms: Remove wrong unused code copied from -uhd
Change-Id: I2bc7fcfa429d1f82c2d8e95d31dfed367f2b3f9d
2019-04-17 18:24:11 +00:00
Harald Welte 71df42550a use BSC_FD_READ and not OSMO_FD_READ
We haven't even released any tagged version of libosmocore yet which
includes support for the renamed OSMO_FD_READ constant.  Let's avoid
any breakage and use the new constants only with considerable delay,
at the very least only when released libosmocore versions provide it.

Change-Id: Idb57077b2a4b2a71dd5d75a24ded8bb5887da188
2019-04-16 17:18:58 +02:00
Tom Tsou d280045884 multi-ARFCN: fix maximum number of carriers limitation
Maximum number of carriers is fixed to 3 channels on a single
physical RF channel in multi-ARFCN mode. For some reason, it
was limited to 5.

Let's fix this, and also follow this limitation in the
following VTY command handlers:

  - cfg_multi_arfcn_cmd,
  - cfg_chan_cmd.

Change-Id: I66a1462f368458afd313ee6f0bc0abc496dde817
2019-04-11 07:33:40 +00:00
Pau Espin 5e6f3e0cad osmo-trx: Check return code of osmo_fd_register
Fixes Coverity CID 197513.
Change-Id: I93fbcb062439a547379aaecba283d107fdc9cb59
2019-04-02 11:45:06 +02:00
Pau Espin 21032b75c0 osmo-trx: Use signalfd to serialize signals in main thread ctx
This should avoid prolematic scenarios where different signal handlers
are running on different thread in parallel. Furthermore, we make sure
those signals are always run by main loop thread.

Change-Id: I9b9d9793be9af11dbe433e0ce09b7ac57a3bdfb5
2019-03-29 19:20:08 +01:00
Pau Espin d01c7b98b6 osmo-trx: Avoid handling signals after shutdown triggered
Recently a blocked osmo-trx process was found after ending SIGTERM to
it.
Apparently one thread was handling SIGTERM and calling fprintf()
(grabbing libc lock) while another thread was handling another signal
and also grabbing similar lock. Both thread looked deadlocked there.
Probably this change doesn't fix the block on its own, but at least
simplifies scenarios inside signal ctx which can go wrong.

Change-Id: If91621913b8b03d8a0f4c863be0b0d479f97e8a1
2019-03-29 18:51:28 +01:00
Vadim Yanitskiy a8b3565246 VTY: add extended (11-bit) RACH detection toggle
Since I838c21db29c54f1924dd478c2b34b46b70aab2cd we have both TS1
and TS2 synch. sequences, in addition to "default" TS0. Let's
finally introduce the VTY configuration parameter, that can
be used to toggle optional detection of both TS1 and TS2.

Note: we keep this optional because of potentially bad impact on
performance. There's no point in paying the performance penalty
unless upper levels (BTS, PCU) actually make use of it.

Change-Id: I1aee998d83b06692d76a83f79748f9129a2547e8
Related: OS#3054
2019-01-24 15:47:48 +01: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
Sylvain Munaut acf804c034 arm/convolve: Fix the vfp4 real convolution for h_len=12
Change-Id: Ic73f0746edd3f1f22bb1d79d4c64aa740691dd48
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2019-01-21 10:34:51 +01:00
Harald Welte 77e18352fb cosmetic: Don't call the SDR "USRP" in error message
Transceiver.cpp is used for all SDR hardware we support, not just USRP.

Change-Id: I9b7ddb0d679f111407704048ef3ddd964db49441
2019-01-11 22:42:29 +01:00
Harald Welte f97d75b355 usrp1: Fix formatting of log message (missing space)
Change-Id: I378a8081a224acda3ee2af9b6aa0d680de884695
2019-01-11 22:42:29 +01:00
Harald Welte a944001873 usrp1: Remove uninitialized skipRx logic
There appears to have been some logic to operate a USRP1 in
transmit-only GSM mode.  This is achieved using the skipRx member
of the transceiver object.  However, there's nobody that ever
initializes it properly, and hence the feature is not possible to
use anyway.

I don't think this has any valid use case, so let's remove it.

Change-Id: I616193f1e9aaefbf4ceb26761657811093f28b6f
2019-01-11 21:46:45 +01:00
Pau Espin 03b11620d9 lms: Fix build against LimeSuite > 18.10
LimeSuite dc124e4e2ed9b549b142410af172f0592f9f0c23 > 18.10 broke API
compatibility.

OS#3729
Change-Id: Idf500a5b39a857233f728c6a4316c00a99374556
2018-12-14 13:30:07 +01:00
Oliver Smith 871713bf6a LMSDevice: make use of dev-args in osmo-trx.cfg
Allow selecting a specific LimeSDR device by setting dev-args in the
config file. Split up the given dev-args address by comma and select
the device where all substrings can be found.

I could not test this with real hardware, but I have added a test case
to make sure this works as expected.

Related: OS#3654
Change-Id: Ib9aaa066a01bf9de3f78234d7ada884d6f28c852
2018-12-13 11:07:02 +01:00
Oliver Smith 8d9a05ce5b osmo-trx.cpp: move comma_delimited_to_vector() to Utils.cpp
Make the "opt" argument const. This function will also be used by
LMSDevice.cpp in a follow-up commit.

Related: OS#3654
Change-Id: If3f0f682ca453c2b0a06175ec9626567932cfce6
2018-12-12 17:26:32 +01:00
Pau Espin fe865f45d7 lms: Do {under,over}run checks even if LMS_RecvStream fails
Under failure, it could still be that stream status is updated, so let's
father that in all cases.

Change-Id: I4e2b8be06d2993db1bab233948a8ee774b8ac4ee
2018-12-07 11:18:32 +01:00
Pau Espin e5b6664419 lms: Move {under,over}run checks into separate method
Change-Id: I7f450aa79f6285d14826c40ecfdd9490d00509ef
2018-12-07 11:18:28 +01:00
Pau Espin 1595ddaa5f transceiver: Log TRXCTRL iface responses towards osmo-bts-trx
Change-Id: I8128c42e63ab1fcd2a58812f3b7cf94435b5bbd8
2018-12-07 11:15:10 +01:00
Pau Espin 441d82add9 Add TRXCTRL log category
This log category is applied to messages related to TRX CTRL socket
interface, and it's printed in yellow, same color used in osmo-bts-trx
for TRX category (so same messages are printed with same color in both
sides).

Change-Id: I98ec5e416272783ad3fbadf70478a4e48ae64983
2018-12-07 11:15:02 +01:00
Pau Espin 2f53ea4cf2 transceiver: log chan on CTRL command received
Change-Id: Ia3b2a35e03a8aaddd6efebc8db2ccca872f51f20
2018-12-05 19:43:46 +00:00
Pau Espin 138caaf09d lms: Improve Set{Rx,Tx}{Gain,Freq} logging
Change-Id: I6713a27c5f74beb7fcfdd712fcf695afccbc3d76
2018-12-05 19:43:46 +00:00
Pau Espin 3fadcad33e lms: Allow setting Tx/RxFreq for lchan!=0
Related: OS#3346
Change-Id: I9dd0bb41d1863111d28947fc0d7c7e7ecfaf5fa8
2018-12-05 19:43:46 +00:00
Pau Espin eaa0144dcb lms: Allow setting Tx/RxGain for chan!=0
Related: OS#3346
Change-Id: I5fae92a7ed5e2d92be12b9dfd33fc56195030c0b
2018-12-05 19:43:46 +00: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
Pau Espin ed361f9912 lms: Close device on LMS_Init failure
Change-Id: I0b307452a9e122a0ea39a46f096423c9a5293d30
2018-12-04 15:57:37 +00:00
Pau Espin 2d085e290b osmo-trx: Change some lines to use libosmocore logging instead of cout
Change-Id: I66e3c37014ba12cd002e5b678bc0a6026f5dfc7e
2018-12-04 15:57:37 +00:00
Pau Espin 5cea18e5cb lms: Make sure LMS_Close is called when Device is torn down
This change fixes lots of memory leaks inside libLimeSuite as
announced by ASan after exiting the osmo-trx process (throgh
CTRL+C for instance).

This way also we make sure libLimeSuite can communicate with the HW and
close whatever subsystems were enabled during LMS_Open time.

Change-Id: I56ffb87079e34aa2d0322fd2ca6429742f9f7640
2018-12-04 15:57:37 +00:00
Pau Espin 39e0bbacca radioInterface: Fix memleak during close()
destructors of pointers created through "new" must be destroyed manually
through "delete".

Change-Id: I10d37579f16bec89cc762f200a8951218305c708
2018-12-03 12:20:07 +01:00
Pau Espin b4ea7b5211 lms: Destroy streams on device stop
They are recreated during start(). Actually, if they are not stopped
here, during start() after stop(), LMS_SetupStream() will fail because
it will detect the streams are already opened.

Change-Id: I70d47c287aabdabc5dc1304a942d130aeb10bdc5
2018-12-03 11:34:25 +01:00
Pau Espin 69869bd58f lms: Fix start after stop of device
Change-Id: I56358a1d1601853bc6dd2e6bb5f80798d0ba84b2
2018-12-03 11:19:52 +01:00
d0gtail ebb37693a5 UHDDevice: log exception information on device open failure
Change-Id: Ia84ddcf50cc83f9326b22bfdfb4f259b4e0bc5f1
2018-12-02 20:01:26 +00:00
Harald Welte 55928f23cb lms: Set Rx gain to midpoint, as comment suggests.
So far, the Rx gain was set to 34 dB, wile the comment stated it
would be set to half-point, which is 73/2=36dB.  Let's adjust the
code to match the comment.

Change-Id: Idc646def53b83faf4e6c011fb595fa436e223b32
2018-11-29 13:26:37 +01:00
Harald Welte 0277b58f6d lms: User correct scale factor for transmit samples
Due to (I believe) a copy+paste mistake from the USRP1 code,
we were using only a scale range of up to 9830 when transmitting
samples, rather than the full 16 bit signed integer range up to
32767.

As a result, we were loosing almost two bits (MSBs) of resolution
as well as a lot of transmit power.

This changes the scale factor to 0.707 (1/sqrt(2)).

Please note that the much higher DAC output level means that the analog
gain should be reduced.  The theoretic range of up to 73dB should not
be used, but Lime Microsystems suggest a value of 61..67 dB.  This can
be achieved by using a "osmotrx tx-attenuation" value of 6..12 inside
the osmo-bts-trx configuration file.

Related: OS#3341
Related: OS#3342
Change-Id: I71702feaa11f53e7614a6938a984dd748405474a
2018-11-29 13:23:08 +01:00
Pau Espin 1e2c0105e2 lms: Apply LMS->OSMO log level conversion
Change-Id: I3a8fbcc7cacebc7038c60175a8ae43b21f713cbb
2018-11-23 14:39:51 +01:00
Pau Espin 32b3c2e4b2 lms: Use LimeSuite.h log level defines instead of hardcoded values
Change-Id: Iee693da1a0fa1db23deafa8d3845c04171e24799
2018-11-23 14:39:06 +01:00
Pau Espin 1c4bbadda6 UHDDevice: setRxGain on chan 0 when using multi-arfcn
When using multi-arfcn feature, several logical channels (arfcn) are multiplxed
into one physical transceiver, as can be seen in
uhd_device::set_channels.

As a result, when multi-arfcn is enabled some properties are actually
shared for those logical channels, and internally mapped to the first
(only existing) channel, and per-channel internal array variables are allocated
accordingly (size() == 1).

When setting RxGain, we need to set the correct existing physical
channel. Same check is done in getRxGain, and then we apply the RxGain correctly and
we avoid outputing an error "Requested non-existent channel" immediatelly after.

Change-Id: I5b02bb1ef6450dc48be7b8058d96a5691847d3cc
2018-11-19 11:47:37 +01:00
Pau Espin 08dfe237c8 ChannelizerBase: Fix ASan alloc-dealloc-mismatch
Fixes following Adress Sanitizer warning:
=================================================================
==27120==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs operator delete) on 0x60c00003d900
    #0 0x7f2f216de421 in operator delete(void*, unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cc:151
    #1 0x561641ce18b7 in ChannelizerBase::~ChannelizerBase() (/build/new/out/bin/osmo-trx-uhd+0x4a8b7)
    #2 0x561641ce1cad in Channelizer::~Channelizer() (/build/new/out/bin/osmo-trx-uhd+0x4acad)
    #3 0x561641cd5160 in RadioInterfaceMulti::close() (/build/new/out/bin/osmo-trx-uhd+0x3e160)
    #4 0x561641cd5047 in RadioInterfaceMulti::~RadioInterfaceMulti() (/build/new/out/bin/osmo-trx-uhd+0x3e047)
    #5 0x561641cd5093 in RadioInterfaceMulti::~RadioInterfaceMulti() (/build/new/out/bin/osmo-trx-uhd+0x3e093)
    #6 0x561641ca3fdd in trx_stop() (/build/new/out/bin/osmo-trx-uhd+0xcfdd)
    #7 0x561641ca4b32 in main (/build/new/out/bin/osmo-trx-uhd+0xdb32)
    #8 0x7f2f1f555222 in __libc_start_main (/usr/lib/libc.so.6+0x24222)
    #9 0x561641ca195d in _start (/build/new/out/bin/osmo-trx-uhd+0xa95d)

0x60c00003d900 is located 0 bytes inside of 128-byte region [0x60c00003d900,0x60c00003d980)
allocated by thread T0 here:
    #0 0x7f2f216dcf19 in operator new[](unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cc:93
    #1 0x561641ce142d in ChannelizerBase::init() (/build/new/out/bin/osmo-trx-uhd+0x4a42d)
    #2 0x561641cd5865 in RadioInterfaceMulti::init(int) (/build/new/out/bin/osmo-trx-uhd+0x3e865)
    #3 0x561641ca1cb7 in makeRadioInterface(trx_ctx*, RadioDevice*, int) (/build/new/out/bin/osmo-trx-uhd+0xacb7)
    #4 0x561641ca44c6 in trx_start(trx_ctx*) (/build/new/out/bin/osmo-trx-uhd+0xd4c6)
    #5 0x561641ca4b05 in main (/build/new/out/bin/osmo-trx-uhd+0xdb05)
    #6 0x7f2f1f555222 in __libc_start_main (/usr/lib/libc.so.6+0x24222)

SUMMARY: AddressSanitizer: alloc-dealloc-mismatch /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cc:151 in operator delete(void*, unsigned long)
==27120==HINT: if you don't care about these errors you may set ASAN_OPTIONS=alloc_dealloc_mismatch=0
==27120==ABORTING

Change-Id: Ib7c98ae478f319573dd86a0d2cb264f676bb3859
2018-11-01 18:23:32 +01: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
Oliver Smith a439fed166 Add long parameters (--help, --version, ...)
Makes osmo-trx-* more consistent with other Osmocom programs, and
allows an unified test for not having "UNKNOWN" in --version.

Related: OS#3578
Change-Id: I90cf01d972aa10b48c59b67a1e7f82a4255ef526
2018-10-23 11:34:43 +00:00
Harald Welte 8fb0c3dce4 trx_validate_config(): Fix validation of rx_sps
Change-Id: I7e932cff59335add09c76caba6f9ac1e7cf69022
Fixes: Coverity CID#188871
2018-10-21 13:48:26 +02:00
Pau Espin 74bcc562a9 Transciever: Log values causing Tx underrun
Change-Id: I68e18075eade55034567d96fc774d00a794afeeb
2018-10-02 17:30:28 +02:00
Pau Espin 5b60c98769 Use pthread_setname_np to name threads
osmo-trx can start a considerable amount of threads that can make
debugging it challenging at least. By using phtread_setname_np, the
system sets a meaningful name to the thread which can be seen while
debugging with gdb or by printing /proc/$pid/task/$tid/comm.

Now we also log system TID when setting the name so we can identify
different tasks in /proc even if pthread_setname_np fails.

Change-Id: I84711739c3e224cb383fd12b6db933785b28209e
2018-09-28 23:17:57 +00:00
Vadim Yanitskiy 92fc186450 device/lms/LMSDevice.cpp: fix compilation warning
The following warning was observed with GCC 4.8.5:

  make[4]: Entering directory `.../osmo-trx/Transceiver52M/device/lms'
    CXX      LMSDevice.lo
  LMSDevice.cpp: In member function 'LMSDevice::writeSamples()':
  LMSDevice.cpp:582:22: warning: 'rc' may be used uninitialized
                        in this function [-Wmaybe-uninitialized]
    samplesWritten += rc;

Let's fix this by zero-initializing 'rc'.

Change-Id: I4b4a061fc12e5fd1db8d1087d8e0c46ff1e23412
2018-09-20 16:17:19 +07:00
Pau Espin 4d179abfd0 cosmetic: Use proper whitespace in several for loops
Change-Id: I82bdeb8a3fa38f3d125e8cbccc3eddbf2b8d8f58
2018-09-13 14:27:48 +00:00
Pau Espin e62555370e Vector: Copy arrays in a sane way for non-trivially copyable types
Avoids this type of compilation warnings:
‘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]

Change-Id: I9724454dfb7b87f74f39074e4004580ac3b5fe5c
2018-09-10 10:33:34 +02:00
Pau Espin 1f15152968 radioInterfaceMulti:pullBuffer: Sanely convert float array to complex array
Fixes this type of compilation warning:
‘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]

Change-Id: Ibb2380a0a335ce798fe87221519fbbebade53054
2018-09-10 10:30:06 +02: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
Pau Espin 1f4a009c67 UHHDDevice: Replace deprecated header uhd/utils/thread_priority.hpp
Fixes compilation warning:
In file included from osmo-trx/Transceiver52M/device/uhd/UHDDevice.cpp:31:
/usr/include/uhd/utils/thread_priority.hpp:10:17: note: #pragma message: This header is deprecated - please use <uhd/utils/thread.hpp> instead.

Header was moved in uhd.git c33928d2bbdd27688c3475e77fc461e7d16eba5a.

Change-Id: I6299df48a5e14c54eaa07288d166c705eb9ebdbe
2018-09-10 10:30:06 +02:00
Pau Espin 970096932e radioInterface: Fix variable storing integer return value
Change-Id: I0a0a06a6d16a228cfcb7bd746bab2d79f10ce244
2018-09-04 16:35:27 +02:00
Pau Espin db936b9b55 osmo-trx: Add osmo_signal to stop whole transceiver chain correctly on error
Transceiver::stop() can only be called from either CTRL iface thread or
from main thread (running osmocom loop). That's because stop attempts to
cancel and then join all the other threads, which would then lock if
attempting to stop from some of them.
As a result, the best option is to indicate to the user of the
transceiver option (osmo-trx.cpp) to stop it in a correct fashion by
destroying the object from the main thread.

Change-Id: Iac1d2dbe2328e735db2d4b933cb67b1af1babca1
2018-09-04 16:35:23 +02:00
Pau Espin 49ad759072 lms: Return error on device read timeout
If LImeSDR device is unplugged or its fw crashes during operation,
reading from the device will fail and will first receive short reads and
finally 0 byte reads. Let's quickly notify these events to upper layers
instead of trying to process the buffer and checking timestamps for
something we know it's already not useful.

Related: OS#3340
Change-Id: Ib1af8cdd6cdadf581b039882add4049eea45a0f7
2018-09-03 18:53:52 +02:00
Pau Espin 8e498bfd35 radioInterface: forward errors from RadioDevice to Transceiver in recv path
Change-Id: Id7b08b19d6575c79b4d57db656a17ff05bb61ee9
2018-09-03 18:53:52 +02:00
Pau Espin 46444637c6 cosmetic: Fix trailing whitespace
Change-Id: Ia647cfed0acb35adeb9b3b7824170d06c0369ef7
2018-09-03 18:53:41 +02:00
Harald Welte 5cc8858d8f logging: Introduce new "DDEV" category for device-specific code
The DMAIN category got too overloaded.  Let's have the code in
Transceive52M/device/* use the new DDEV category.

Also, in some cases the log levels have been adjusted to ensure
that enabling INFO level should not result in a complete overflow
of messages during normal operation.

Change-Id: I844fe4a75bf277cd3cc5bd8fa06e06ad97b2ea95
2018-08-17 19:57:40 +02:00
Pau Espin 58c89fb8d6 lms: Allow values diff than 34dB to be set by setRxGain()
Until now, setRxGain in LMSDevice did not take into account the setter
parameter and was always using hardcoded 34dB, which was experimentally
found to be a good default value.

Let's force that value during initialization, but still allow the upper
layers (controlled by BTS) to set different values. osmo-bts only sends
a SETRXGAIN command (which calls setRxGain in osmo-trx) if a value is
explicitly set in its VTY config, so we are on the safe side if the user
doesn't explicitly configure a desired dB.

Change-Id: I5684e675281a3f581855dbb56d199a6fe238a712
2018-06-20 07:41:16 +00:00
Pau Espin 16e7e20f85 Add -V param to print version
Change-Id: I9f2d6c4b1a508aceb1ccc0559f0902eedf2ec5af
2018-06-20 07:38:36 +00:00
Harald Welte b229439b31 usrp1: Fail in case of unsupported configuration
There might be some configuration that's not supported by osmo-bts-usrp1,
and we should reject that properly.

Change-Id: Ic7308ce0c57439fe97668bd31801c4bf76b797ad
Closes: OS#3348
2018-06-14 12:38:09 +02:00
Harald Welte ffb3301bd8 lms: Fail in case of unsupported configuration
There might be some configuration that's not supported by osmo-bts-lms,
and we should reject that properly.

Change-Id: I6f82edce589030a4407f6150fb7e8abe6417c1f2
Closes: OS#3347
2018-06-14 12:38:09 +02:00
Harald Welte 62b7900fd7 lms: Fix coding style
In Change-Id Ib2fca81b76d027b08e2891056fa076d071597783 we introduced
some coding style violations.  Let's make newly-added code follows
standard Osmocom coding style.

Change-Id: Ib7ddd275014f03a2eed3cddc02b1356e2b00c0bc
2018-06-14 12:38:09 +02:00
Harald Welte 61707e8b23 radioDevice: better encapsulation in base class
It's not good style to have the derived classes initialize members
inherited from the base class using "this->foo = bar".  Rather, let's
make the base class have a constructor, and call that constructor to
initialize the members of the base class.

While doing this
* rename 'offset' to 'lo_offset' to avoid confusion with timestamp offset
* move 'InterfaceType' into the base class
* move 'chans' into the base class
* move 'rx_sps' into the base class
* mark base class members as 'protected'

Change-Id: Ib885675a7612a392aa7f75fca81269ddcff2f6ab
2018-06-14 12:38:04 +02:00
Harald Welte ce70ba529c radioDevice: Move tx_sps from derived into base class
All three derived classes use a tx_sps member, let's move this into
the base class.

Change-Id: I73b4aa2705c5049561e2d7b21301a0d2b3c96ced
2018-06-13 23:46:27 +02:00
Harald Welte cfb9dac70d lms: Call set_antennas() during open() method
Without this call, the antenna/path configuration is not applied.

Change-Id: I0bca58266b59f1315ec72b6407fe4f4495aff678
2018-06-13 23:46:27 +02:00
Harald Welte 105a61e689 lms: Fix support for rx_paths / tx_paths
Before this patch, any configuration in osmo-trx.cfg regarding the rx
and tx "antenna" (path) would have been completely ignored, as the
radioDevice::make() function would simply drop those arguments to the
floor.

Change-Id: Ie50f854abbc9dcf351cddc052d10206382e1d5d3
2018-06-13 23:46:27 +02:00
Harald Welte 2407314f2e move set_antennas() from UHD to generic radioDevice base class
Change-Id: I806143e9db21f0be4dcc6a376b3a630be7aeb3ba
2018-06-13 23:46:27 +02:00
Zydrunas Tamosevicius ff4418539c lms: Reduce Rx gain from 47 to 34 dB
Initially, Rx gain was hardcoded to be 47. This was too high for our
setup and we were constantly getting "clipping detected" messages.

Reducing Rx gain to 34 solved the issue. However, it looks like gains
should be controlled through configuration files.

Change-Id: I30580f18c4ad630c09f725b1d24c125fc3119809
2018-06-13 21:45:32 +00:00
Zydrunas Tamosevicius 0494d05916 lms: fix LMS_StartStream() handling for multiple channels
LMS_StartStream() (in LMSDevice::start()) was moved to separate loop. It
is because LMS_SetupStream() would fail for second channel if streaming
has already been started (LMS_StartStream()) for single channel
configuration.

Change-Id: I6704bb92864aa81417507c4ae24a22f41dc529c1
2018-06-13 21:45:32 +00:00
Zydrunas Tamosevicius fd268b6f5a lms: Reduce log level of "send buffer of len ..."
Log level of "send buffer of len ..." messages was changed as it was
causing problems on some machines.

Change-Id: I605d50e81966c7bd169b27788d62af6fb54c84e1
2018-06-13 21:45:32 +00:00
Zydrunas Tamosevicius 43f3678b40 lms: Use same timestamp offset like when using LimeSDR via UHD
The tx timestamp offset was not set. We set it to the same value as it
was in UHD interface for LimeSDR

Change-Id: I78bc40cd575097f71a5f82b63467fa81c3f8d837
2018-06-13 21:45:32 +00:00
Pau Espin 6493dc838b lms: Check LPBFW to set is within supported range
As of LimeSuite 618fbb9c3188b36d75ad5785a97b8887dcc468f6, it seems 5e6
is within the returned range, but LMS_SetLPFBW fails anyway.

See for more information: https://github.com/myriadrf/LimeSuite/issues/184

Change-Id: I967e7da7c0e3e8138b76733ee4a0e6311d20b62e
2018-06-13 21:45:32 +00:00
Pau Espin f7905ac548 lms: Makefile.am: Reorder params to fix link issue
It seems the order in which static code and -lfoo is passed to the
linker matters.

This commit is a lms specific follow-up of commit
2a8183bdf0.

Change-Id: I59c20d268ecac4c22689124165c47295bd9176d4
2018-06-13 21:45:32 +00:00
Pau Espin 0c27938d44 LMSDevice: Fix setup failure with LimeSuite > 18.04.1
Fixes: https://github.com/myriadrf/LimeSuite/issues/184

Change-Id: Ia9f37995cd10d19d6820e3e12b8ee8f3efbff5d4
2018-06-13 21:45:32 +00:00
Pau Espin 587916e810 LMSDevice: Set correct values for Max{Tx,Rx}Gain
Change-Id: I3b3a7080a69e15d8d6770186810d922227439099
2018-06-13 21:45:32 +00:00
Harald Welte 79024867de LMSDevice: Reduce Rx logging verbosity: Only log unexpected timestamps
Change-Id: I06b35efb7368616b9f4d348da574cd524ffe3ea6
2018-06-13 21:45:32 +00:00
Harald Welte 4aec1f1cf5 LMS_Device: Set ts_offset to 0.
I'm not quite sure what the ts_offset is for, but by using "0"
we are now receiving exactly the timestamp that we're expecting:

LMSDevice.cpp:486 [tid=140576250332928] chan 0 recv buffer of len 2500 expect 305ed0 got 305ed0 (305ed0) diff=0

Change-Id: I270c94945b1af9662cfc468cfda1ae3af3ac0a27
2018-06-13 21:45:32 +00:00
Harald Welte 68f054169b LMSDevice: Fix initial timestamp offset of 2500
ts_initial must not point to the timestamp of the first sample
in the last "flush" sample buffer, but to the first timestamp we
expect in the next buffer.

Change-Id: I23af62870544d4c6cf5f6e2d6578936603bceb91
2018-06-13 21:45:32 +00:00
Harald Welte ea8be22e50 LMSDevice: Set low-pass filters to smallest possible option
Rx 1.4 MHz, Tx 5MHz.  Both massively too wide for GSM, but there's
no smaller band-width available.

Change-Id: I9723c9a2ea77f65bfa9d796d7c44adc2417e89cf
2018-06-13 21:45:32 +00:00
Harald Welte a5054b398b LMSDevice: Typo fix: s/Internal/External
Change-Id: Icacfe6da90a89c7f00d62c580948fb913998eaa7
2018-06-13 21:45:32 +00:00
Harald Welte a438114173 LMSDevice: Print sample rate range + actual sample rate after setting it
Change-Id: I19c1a5b2d2431b8d39e277244e313f6e559e4d25
2018-06-13 21:45:32 +00:00
Harald Welte 9cb4f27112 LMSDevice: Call LMS_Init() before setting sample rate
LMS_Init() will override basically all device settings with their
default value, including the sample rate.  We hence have to make sure
to call it before any other API function that changes the device config
such as sample rate, frequency, filter bandwidth, ...

Change-Id: I4cdbae8406b5e1e93da491e90f8bad41d4be748b
2018-06-13 21:45:32 +00:00
Pau Espin 1f50fedb5f build: Add support for LimeSuite device backend
Change-Id: I239e1b37263a62b374d84974c9347e3654072e87
2018-06-13 21:45:32 +00:00
Pau Espin c7a0bf1ffc lms: Several improvements and compilation/runtime fixes
Continuation of initial work done on LimeSuite support from Harald.

Change-Id: Ib2fca81b76d027b08e2891056fa076d071597783
2018-06-13 21:45:32 +00:00
Harald Welte 940738e86a Initial work towards direct LimeSuite support in OsmoTRX
This is work in progress towards a direct LimeSuite driver in OsmoTRX,
bypassing the currently rather complex stack of wrappers by going
through UHD, SoapyUHD, SoapySDR and LimeSuite.

Change-Id: Iaef29c4c2585ef8c2f94866c9591919f538c1a2d
2018-06-13 21:45:32 +00:00
Pau Espin 55df1e43e3 UHDDevice: Fix setup failure with LimeSuite > 18.04.1
Fixes: https://github.com/myriadrf/LimeSuite/issues/184

Change-Id: I48ead8b8996981263297b66c0c7d3d0972261316
2018-05-08 20:49:04 +02:00
Harald Welte fad2e09840 osmo-trx: s/GSM Core Address/GSM BTS Address/
The TRX connects to the BTS, not to the "Core".  The Core network
is miles away...

Change-Id: I6de2f708fc7a7df7dea16314b7dfa4ab82f15b2c
2018-04-28 21:43:40 +02:00
Pau Espin 2a8183bdf0 build: More OBS build failure fixes
It seems the order in which static code and -lfoo is passed to the
linker matters.

Change-Id: I3b25be0154053ae8eb5f0a24c39fb9a229130fcf
2018-04-28 01:38:30 +02:00
Pau Espin 478f82f47e build: Fix make distcheck
Change-Id: I1fa5e34b44331cd56408ea7ad4483dcf6443b259
2018-04-27 11:34:11 +02:00
Pau Espin f37b0ad652 Transceiver: log timing info of stale bursts
Change-Id: I043fd8199253bdf3912c7aec2ccf98f8cbe54251
2018-04-25 20:14:55 +02:00
Pau Espin f3d7f443a0 Build one osmo-trx binary for each device support enabled
Same way as we do in osmo-bts. After this commit, osmo-trx no longer
exists. Instead, osmo-trx-uhd and osmo-trx-usrp1 are generated based on
configure flags enabled.

A new flag --with(out)-uhd has been added to enable/disable build of
osmo-trx with UHD backend. It is left enabled by default to keep
compatibility with older build scripts. Binary with USRP1 backend must
still be manually enabled with --with-usrp1 flag.

Change-Id: Iea8c0d7434762713a53440d29bf3ebd84accb262
2018-04-24 19:17:22 +02:00
Pau Espin e564f0fd84 Transceiver: Move device specific code to radioDevice class
Change-Id: Ibcf258d8bf8595e286682e0bc59391b239ea7642
2018-04-24 18:46:48 +02:00
Pau Espin 0fc20d14b3 Move device specific code out of radioInterface
This way code of radioInterface is independent of the device and doesn't
need to be rebuild for each device.

Change-Id: Id104e1edef02f863b6465ced5b4241050dc188f9
2018-04-24 18:46:48 +02:00
Pau Espin a4316ee4c5 Change configure define USRP1 to DEVICE_USRP1
Similar as we do for ARCH_*, it's easier to find those are related to
device support features.

Change-Id: Iba238bff689b8f944af76120402c0fa2e29a70de
2018-04-24 18:46:48 +02:00
Pau Espin 2128a308eb Move device specific files to device subdir
Change-Id: Ib42fef14bf4c7b779f44d99711a35c18b32a4c21
2018-04-24 18:46:48 +02:00
Pau Espin 43fedb656b Move arch specific fiels to arch subdir
Take the chance to update some includes using files available in that
subdir to have them ina more uniform way.

Change-Id: Ibda3c54fd4dc3f6b845cc373f1a1e6b758c1ea82
2018-04-24 15:22:59 +02:00
Pau Espin e1977fcd22 use osmo_init_logging2()
Change-Id: I2c28e6e6e3eb9f587680b34330e03408e32c2b94
2018-04-16 14:50:55 +02:00
Vadim Yanitskiy c0c6d70fe9 Transceiver.cpp: prevent out-of-range array access
There was no a simple range check for both (NO)HANDOVER commands,
so an out-of-range access was possible. For example, a command:

  CMD HANDOVER 0 -3

might enable EDGE at run-time, because:

  a[i] == *(a + i)

Let's fix this.

Change-Id: I24a5f70e8e8097f218d7cbdef8cb10df2c35416f
2018-03-14 21:12:32 +00:00
Vadim Yanitskiy 8c6c5d2bcd Transceiver.cpp: fix incorrect format string for SETTSC
Change-Id: If69a478121a31aa7df945548cc17271c476d6a6b
2018-03-14 21:12:32 +00:00
Vadim Yanitskiy a62fcf786a Transceiver.cpp: use pointer arithmetics for CMD parsing
It looks like the author of control command parsing code was not
familar with simple pointer arithmetics, so excessive amount of
memory and useless memcopying was used to parse a single command.

Let's introduce two pointers, one of which will point to the
beginning of a command, another to the beginning of its arguments.
Also, let's simplify the command matching by using a separate
function called 'MATCH_CMD'.

Change-Id: I226ca0771e63228cf5e04ef9766057d4107fdd11
2018-03-14 21:12:31 +00:00
Vadim Yanitskiy 4d9b59c3ef Transceiver.cpp: properly zero-terminate received commands
Previously it was assumed that a sender should zero-terminate
each command being sent. Otherwise, this could cause to printing
garbage. Let's do this manually, using the length of received
data as a position for '\0'.

Change-Id: I69f413f33156c38a853efc5a8cdc66fbfb0ca6af
2018-03-14 21:12:30 +00:00
Vadim Yanitskiy bd0efb0bea Transceiver.cpp: use a define for the MAX_PACKET_LENGTH
No need to keep this value on stack.

Change-Id: If9ffb03b9e7b642f45732ba5938977bca271f1c7
2018-03-14 21:12:30 +00:00
Pau Espin 8fbbd656c7 Build Transceiver52M/common as an .la lib
Stop picking files from that directory on different places as it causes
dependency issues during make distclean/maintainer-clean.

Fixes: OS#3029

Change-Id: I81bb4251d18fce978d27849b621b20f541caab0b
2018-03-08 14:53:13 +01:00
Pau Espin b35cba613a Makefile.am: Avoid using subdir if arch is not required
There's no need in going a level deeper if we already know nothing's
going to be done. This way we also get cleaner make outputs.

Reference: https://www.gnu.org/software/automake/manual/html_node/Conditional-Subdirectories.html#Conditional-Subdirectories

Related: OS#3029

Change-Id: I3ff57ab14edc575904e8137929a0ef02c95e03af
2018-03-07 19:46:42 +01:00
Pau Espin 8dffadb8da osmo-trx: Re-introduce -l cmd line parameter
Parameter -l to set the terminal logging levle was removed in
3da1f8352e, but afterwards it was decided
to keep the cmd line options for a bit more to easy migration to VTY
cfg.

The command line no longer accepts keywords ("DEBUG", "INFO", etc.) but
log level numbers, due to libosmocore APIs log_parse_level and
log_level_str being marked as deprecated and for internal use only.

Keep in mind the log level is overridden by VTY cfg if any line sets log
levels for log stderr in there.

Explicit cast to unsigned int for loglvel is issued to avoid iostream
printing it as a char.

Change-Id: I91c35ecded177b7976045d9b693855adb9e18f8a
2018-03-06 18:41:29 +01:00
Pau Espin 408f25081e osmo-trx: Use VTY cfg structures while still allowing cmd line options
Existing cmd line options are kept for a while to give people some time
to move to use VTY cfg. All new cfg options should be set only through
VTY. VTY options take preference (override) over cmd line options.
Deprecated options are removed from help message to dissuade users from
keep using them.

Steps to drop cmd line options in the future:
- Drop comma_delimited_to_vector, print_deprecated
- Drop all options in handle_options marked with print_deprecated.
- Set "-c" param to do the same as "-C", to keep compatibility with old
param and still use same naming as all other osmocom projects.
- Remove the hack in main() to set 1 channel implicitly by default.

Change-Id: Ib8de1a5da4b3c0b6a49e00033f616e1d66656adf
2018-03-05 20:12:40 +01:00
Pau Espin a3ab8c263d vty: Implement VTY cfg parsing for current parameters
At this stage, osmo-trx still uses the cmdline parameters top run the
device, but it is already able to parse all the same parameters from a
cfg file through the VTY and filling a trx_ctx structure which will be
later used to drive the device. Device config can be printed in the VTY
with "show trx".

Change-Id: Ie084c1b30b63f91c6e7640832ec1797d9e813832
2018-03-05 19:55:02 +01:00
Pau Espin efac20b6bb Move enums required by VTY to a separate header
This patch is a preparation for next patches, which add full VTY cfg
support.

Change-Id: I3d5b0576aa96869756f1629a40306c0043b6304b
2018-03-05 17:16:05 +01:00
Pau Espin 0bbd8922ea osmo-trx.cpp: Move trx start and stop to helper functions
Make main() smaller, and make it easier to replace cmdline parameters in
following commits.

Change-Id: I10eaaafe38ace2b7bb095a0ad1db70d6c06ee03b
2018-03-05 17:14:32 +01:00
Alexander Huemer 3f52f0e6c5 Fix USRP1 build with support for setting Rx/TxAntenna
The USRP1 build was broken by commit 77ce99ac67.

Commit 77ce99ac67 broke the USRP1 build

Change-Id: I28585947d5662cdd580a814cce54a5d9aa30eeb8
2018-02-27 22:35:37 +01:00
Pau Espin 3da1f8352e Logger: Use libosmocore logging system
We still need an intermediate class Logger due to osmo-trx being
multi-threaded and requiring to have a lock to use libosmocore, which is
not thread safe.

Change-Id: I30baac89f53e927f8699d0586b43cccf88ecd493
2018-02-27 07:11:11 +00:00
Pau Espin 5ea1817dc2 Add initial support for logging, vty, ctrl
Up to this point, the logging system, vty and ctrl are initialized and
can be used fine, though they don't have a lot of use yet.

Depends on libosmocore Change-Id Ib79cdb62d45d8c78445c7b064e58eb7e9faeccf9

Related: OS#2184

Change-Id: I08982c37b4f873966304b3cfb38a10ee86eb3dad
2018-02-27 07:10:50 +00:00
Pau Espin 3a3b220751 osmo-trx: Set up talloc ctx
Change-Id: I67f1980fc615ab74371cbe1c4f83e987381299bc
2018-02-22 20:04:47 +01:00
Pau Espin ab22f4c421 osmo-trx: set up signals using libosmocore helpers
Change-Id: I86e78cd6054d0deff1b1aa061299d9f307e2a352
2018-02-22 20:04:47 +01:00
Pau Espin 8b843e5bed Depend on libosmocore
Change-Id: If345c89293fcd7d1ad4f17214eea339951f25a5d
2018-02-22 20:04:47 +01:00
Pau Espin 11d50d950c Logger: Drop syslog support
This feature is currently not being used, so let's drop it to make it
easier to integrate into libosmocore logging system in the future.

Change-Id: I8282745ef0282d41599eaf94fe460a1d29b18e2a
2018-02-20 20:32:21 +01:00
Pau Espin b7095c7bc5 UHDDevice: Initialize async_event_thrd in constructor
Fixes coverity CID 182757.
It's actually a false warning because "async_event_thrd" member is
protected by other member "started", so in practice it's never going to
be used before being initialized in start().

Change-Id: I5d5739bc9d08fe533e4d44c3992005a14e568a4f
2018-02-09 16:20:39 +01:00
Pau Espin 77ce99ac67 Add support to set Rx/TxAntenna
Some devices have different Rx or Tx ports with different RF characteristics.
For instance LimeSDR has H (High), L (Low) and W (Wide) band Rx ports,
each of one being more suitable to a specific range of frequencies.

In case one wants to support several GSM bands, the best option is to
use the WideBand port and connect the antenna physically to that port in
the board. Then the firmware must be instructed ro read from that port.
Support for Rx/Tx port configuration is already in there for all the
layers (Limesuite, SoapySDR, SoapyUHD, UHD), but we are missing the
required bits in osmo-trx to make use of the available UHD API. This
commit addresses it.

Before this patch, the Rx/Tx paths configured could be changed by means
of the LimeSuiteGUI app, but after running osmo-trx, the values were
changed to the default ones.

One can now start using osmo-trx with 1 channel and specific Rx/Tx ports
by using for instance: osmo-trx -c 1 -y BAND1 -z LNAW

Default behaviour if no specific path or an empry path is passed ("") is
to do the same as preiously, ie. nothing by not calling the
set{T,R}xAntenna APIs.

One can also configure only specific channels, for instance to configure
only the first Tx channel and the second Rx channel:
osmo-trx -c 2 -y BAND1, -z ,LNAW

Change-Id: I1735e6ab05a05b0312d6d679b16ebd4a2260fa23
2018-02-07 13:43:42 +01:00
Pau Espin f58cd8ac83 Fix whitespace
Change-Id: Icda84caa998614ce6c15d5118f8c5c1568ba9a79
2018-02-05 13:04:41 +01:00
Pau Espin 89be118a3b Remove unneeded libdl dependency
Closes: OS#1929

Change-Id: I0caea2a2a8e6bd07432fd73bae72b42b1ce022cd
2018-01-23 18:15:24 +00:00
Alexander Huemer 6fafd33b13 Unbreak `./configure --with-usrp1` build
Change-Id: I49b385594271ae64a48d4d39ee9fe26d7c95bd30
2018-01-20 23:24:20 +01:00
Pau Espin 4a25d6b8f6 arm/convert.c: Add missing convert_init implementation
osmo-trx.cpp calls convert_init, which in case of building using
--with-neon is not implemented and the compiler stops with an error.

Error was introduced in 7e07cf2346.

Related: OS#2720

Change-Id: I9840d374d13b525b97f978ea0c5ed9e8421072a0
2018-01-11 18:45:12 +01:00
Pau Espin 79baee3a8f arm/convert.c: Fix compilation error
Commit fe9769833f aiming at cleaning stuff
introduced a compilation error.

Related: OS#2720

Change-Id: I6ce6e5ec3fdb1e3e8818e2cb674470ad54e38afb
2018-01-11 18:45:12 +01:00
Pau Espin 611212676b Move ARCH_LA to Makefile.common
It will later be used by other directories too (tests/Transceiver52M).

Change-Id: I0ca9b7fc5e1377db971cb7da0b3496ba8d61c716
2018-01-10 12:32:33 +01:00
Pau Espin caf2abc58f Remove Configuration module and libsqlite dependency
Change-Id: I823aea91367d586507bbf352f1b6f25bdd635baa
2018-01-09 15:26:50 +01:00
Pau Espin de1685f6d7 Drop use of ConfigurationTable gConfig
After latest changes, it is not being used anymore.

Change-Id: I43a49aee94e3239194ad9742fb6374324acac0de
2018-01-09 15:26:50 +01:00
Pau Espin 82f83ced73 cosmetic: Remove trailing whitespace
Change-Id: I64c8dbad3fc42bcb8dd4ac9b16bbd9c59a0cf5d5
2018-01-09 15:26:49 +01:00
Max d09843c692 Remove unused headers
Change-Id: Idadb17aeb85b011d114ffc1d81c920544bac1989
2018-01-04 14:31:54 +01:00
Piotr Krysik aa60dda99a UHDDevice.cpp: add USRP B205mini support
The B205mini is similar to the B200mini and runs OsmoTRX just
fine, so let's make OsmoTRX recogonize and support it too.

Change-Id: Iee575121248ea541f7abc49055e49ec2d30904c0
2017-12-04 00:32:33 +07:00
Pau Espin 8c80095017 Add -j option to bind to specific address
Before this patch, the binding of the listening sockets was hardcoded to
a local IP.

Change-Id: I9ba184a1251c823e413a9230943ed263e52142ec
2017-08-16 17:06:54 +02:00
Harald Welte 81486e053c Add '-t' command line option to enable SCHED_RR
SCHED_RR allows us to operate osmo-trx reliable even under exceptionally
high system load, as the realtime scheduler priority will have higher
priority than the other "regular" tasks on the system.

Change-Id: Ia2452b9763960b2be37fbeee9d832554da68a53f
Closes: OS#2344
2017-07-20 18:36:01 +00:00
ignasj 28d8081e25 LimeSDR: Fix sample value range
when "sc16" stream arg is passed to SoapyUHD sample value range is -32768 to 32767

Change-Id: I58b8b6b71648bd9cbc105ddaaa9a7cf0a31b3d47
2017-07-10 11:45:06 +02:00
ignasj 87ed77b937 LimeSDR: change tx window type to TX_WINDOW_FIXED
It seems that TX_WINDOW_USRP1 is for devices that do not support tx
sync to timestamp. LimeSDR supports it. Changing to TX_WINDOW_FIXED
greatly reduces number of "dumping stale buffer" messages

Modified to match current master by Harald Welte.

Change-Id: I8de5b165ccd72a62b0f16655618e24ca740d9637
2017-07-10 09:34:58 +00:00
ignasj f9d996813d LimeSDR: Change device detection to work with USB and PCIe versions
Modified to match current master by Harald Welte.

Change-Id: Ie43610de0b2196d84caf09717ec8c8ca75ab926d
2017-07-10 09:34:32 +00:00
Pau Espin 934da48618 transceiver: Avoid sending clock indications when trx is not powered on
Stop calling writeClockInterface() when receiving commands in Transceiver::driveControl,
otherwise it fools osmo-bts-trx clock skew check because it is always sending a clock
indication with the same fn when it issues any commands during the time in between
CMD POWEROFF and RSP POWERON, because fn is not increased during that period.

Also use mForceClockInterface flag to delay delivery of first IND CLOCK until we start
serving frames, otherwise the first one is sent and only after a long period of time
the next clock indications are sent, when the radio starts to process bursts. That makes
osmo-bts-trx unhappy because it expects to receive an IND CLOCK aprox at least every
400 frames. This way also we send the first IND CLOCK after the RSP POWERON 0 response.

Change-Id: I91b81a4d7627cec39c1814a39ed4be306681b874
2017-07-04 19:15:57 +02:00
Pau Espin 7c405a0c1f cosmetic: transciever: Remove trailing whitespaces
Change-Id: Ib3fbe768048b2a34a75ace9688e306720e67019a
2017-07-04 17:23:30 +02:00
Tom Tsou 4cafb0fa15 LimeSDR: set approximate tx offset value to make GSM work
may be fine-tuned in the future

Modified to match current master by Harald Welte.

Change-Id: Ied215ca9e9d9c346c2a654f96785d1b87b075129
2017-06-29 02:26:07 +02:00