Commit Graph

196 Commits

Author SHA1 Message Date
Piotr Krysik df417739b0 cmake: make formatting of install statements follow one pattern
Change-Id: Ib7d571af629b0af78397a411b0cca409a6d218d8
2021-05-03 07:14:00 +02:00
Piotr Krysik d8211032fa trx: Removing old and unused grc based radio_if
Change-Id: I7d43e6f2962b21ff03601cf1b1aafc222f2c4661
2021-05-03 07:14:00 +02:00
Vasil Velichkov 284f1dbb40 Log import errors as currently GRC 3.8 suppress them
See gnuradio/grc/core/FlowGraph.py:194

Change-Id: Ie6213428c218720692a544c98dc32c16bd50cbe1
2021-05-03 07:14:00 +02:00
Vasil Velichkov 601c786d51 tests: Close the temp file handle in qa_burst_file_source
This fixes the following warning

./usr/lib64/python3.7/unittest/case.py:645: ResourceWarning: unclosed file <_io.BufferedWriter name='/tmp/tmpkkz_akd6'>
  testMethod()
ResourceWarning: Enable tracemalloc to get the object allocation traceback

Change-Id: I66c2be2e5bf6915e3df253b3a69f5516534e3750
2021-05-03 07:14:00 +02:00
Vasil Velichkov f6314031e7 Python 3 compatibility changes in fn_time.py
- Use range instead of xrange as it has been removed
- Use integer division operator (//)
- Import uniform and fn_time_delta_cpp only when started as a script
- Remove the unused imports

Change-Id: I268e0aec8fb8e6d490bfb8b0e9e6d169a9f6c352
2021-05-03 07:14:00 +02:00
Vasil Velichkov 0c2845650a tests: Do not specify filename when runing gr_unittest
This fixes the following warning

DEPRECATED: Using filename with gr_unittest does no longer have any effect.

Change-Id: I7d6dbc32ff794ebf2bc116fa7437062e6780b85f
2021-05-03 07:14:00 +02:00
Vasil Velichkov 0af1435815 Remove build_utils.py and build_utils_codes.py
These two files are no longer used

Change-Id: I80a364c729e75681a0afd926ea3ecd0eb2d65381
2021-05-03 07:14:00 +02:00
Vasil Velichkov c7134fff20 Do not add python/misc_utils to PYTHONPATH when executing tests
Change-Id: Ib19a181a3fd9bb78c1d3989bad0e55433f060950
2021-05-03 07:14:00 +02:00
Vasil Velichkov 6eea94f7de Fix grcc compilation with python3 by adding local subdirs to __path__
As the directory structure in the repository is different then the one
after the package gets installed we need to add those subdirectories to
the __path__ otherwise python3 is not able to load the modules using the
relative import syntax and grcc compilation and some unit tests fail.

Mofiy __path__ only when the CMAKE_BINARY_DIR environment variable is
present.

Revert "grgsm_livemon: Set cell_allocation to [0]"

This reverts commit 013d4c258c6ad31c2581f0caa4eee3aa609fd9de.

Change-Id: I223fd6181e8e36027039301186b671712a597ff8
2021-05-03 07:14:00 +02:00
Vasil Velichkov 783a1f7b56 Remove the RTLD_GLOBAL hack
It was removed from gnuradio back in 2014
39f14138ac

Change-Id: I1604ad5b9eefe3d4a2228b2a09e2069962844c97
2021-05-03 07:14:00 +02:00
Vasil Velichkov 46c90bec99 Various python3 related changes
- Use relative import for grgsm's modules
- Convert map to list
- Remove the hier_block.py workaround as as gnuradio 3.7 is no longer
  supported in this branch

Change-Id: I5ca8fd340823996e8c444aaf18ddacd85c92ab1c
2021-05-03 07:14:00 +02:00
Vasil Velichkov 1789ae28ee GNU Radio 3.8 support
https://wiki.gnuradio.org/index.php/GNU_Radio_3.8_OOT_Module_Porting_Guide

Change-Id: I23dd638c8c48ed0a4b50559ce33fbd5e60b7dcbc
2021-05-03 07:14:00 +02:00
Vasil Velichkov fa184a9447 Fix uplink sub_slot and sub_types assignment in the sdcch4 and bcch_ccch demappers blocks
Add support for RACH bursts although they are not yet supported in the
receiver and control channel decoder blocks.

3GPP TS 45.002 version 15.1.0 Release 15
Table 3 : Mapping of logical channels onto physical channels (see subclauses 6.3, 6.4, 6.5)
Figure 8a: TDMA frame mapping for FCCH + SCH + BCCH + CCCH

Fixes the following tests:
qa_gsm_bcch_ccch_demapper.test_uplink
qa_gsm_bcch_ccch_sdcch4_demapper.test_uplink

Change-Id: Ia6b3070c1085bcdda6d98fd94a89c6e0982e2aec
2019-07-29 21:12:24 +03:00
Vasil Velichkov c895bf2f22 Fix uplink sub_slot assignment in the sdcch8 demapper block
3GPP TS 45.002 version 15.1.0 Release 15
Table 4 : Mapping of logical channels onto physical channels (see subclauses 6.3, 6.4, 6.5)

Fixes qa_gsm_sdcch8_demapper.test_uplink test

Change-Id: I29e9055805c8478010c51ceb40f86ba3aed5ecab
2019-07-29 21:12:24 +03:00
Vasil Velichkov 4954ae6fbf Fix sub_slot assignment in the universal_ctrl_chans_demapper block
3GPP TS 45.002 version 15.1.0 Release 15
Table 3 : Mapping of logical channels onto physical channels (see subclauses 6.3, 6.4, 6.5)
Table 4 : Mapping of logical channels onto physical channels (see subclauses 6.3, 6.4, 6.5)

Fixes the following tests:
qa_gsm_bcch_ccch_sdcch4_demapper.test_downlink
qa_gsm_sdcch8_demapper.test_downlink

Change-Id: Idc63407694fd1f7be962ab630d4e8c13b4a5d348
2019-07-29 21:12:24 +03:00
Vasil Velichkov ff88ba41ec Add control channels demappers tests
3GPP TS 45.002 version 15.1.0 Release 15
Table 3 : Mapping of logical channels onto physical channels (see subclauses 6.3, 6.4, 6.5)
Table 4 : Mapping of logical channels onto physical channels (see subclauses 6.3, 6.4, 6.5)
Figure 8a: TDMA frame mapping for FCCH + SCH + BCCH + CCCH
Figure 8b: TDMA frame mapping for FCCH + SCH + BCCH + CCCH + SDCCH/4(0...3) + SACCH/4(0...3)

Five of the six tests currently fail and are marked with
@unittest.expectedFailure. Fixes in subsequent commits.

Change-Id: I33b0948832a0c2506bffd389cc134c3236c74d27
2019-07-29 21:09:07 +03:00
Vasil Velichkov 54580d148d Filter out SoapyAudio devices
When gr-osmosdr is compiled with SoapySDR support and SoapyAudio is
installed the audio device is picked as a first choice when detecting
devices but grgsm tools are not able to work with audio devices. So in
such cases the user has to always specify the correct SDR device in the
args parameter which is a bit inconvenient.

When args is not specified call osmosdr.device_find to get all devices
and filter out unspported ones like SoapyAudio devices. When args is
specifed just try to create osmosdr.source with whatever value has been
specified.

Add -l and --list-devices command line option that prints information
about all detected devices.

Example commands:
  grgsm_capture --list-devices
  grgsm_capture --list-devices --args=nofake
  grgsm_capture --args=uhd,type=b210 -a 111 capture.cfile
  grgsm_livemon --args=rtl
  grgsm_livemon --args=uhd,type=b210

Change-Id: Ib84081041ca6c2bc18b9da0c32bac9d3ecef65ca
2019-05-03 00:20:34 +03:00
Vasil Velichkov c5bb436cda Fix the TCH/H decoder and demapper XML definitions
- The second argument of tch_h_decoder constructor is a string that
  accepts the value of MultiRate configuration element and not an enum
  like the tch_f_decoder decoder.
- Make the demapper's burst sink required.
- Make all parameters visible.
- Rename the TCH/H Channel parameter to Sub-channel number.
- Add the qa_tch_h_decoder test in the CMakeLists.txt
- Fix several typos

Change-Id: I92d4f49955c634df7d76f17cfb58d7106846c1bd
2019-03-19 17:36:28 +02:00
Vadim Yanitskiy ca25d141f5 apps/grgsm_trx: introduce initial LMS driver support
Change-Id: Ie983b10d1814906b6e659213f865e58d0f5c08e4
2019-01-26 10:58:25 +07:00
Vadim Yanitskiy a53dd193dc apps/grgsm_trx: add RadioInterface driver selection argument
Change-Id: Ic11f878c176bad16b057f25725ab0cfecc01782f
2019-01-22 16:44:30 +07:00
Vadim Yanitskiy b6f6f471d9 trx/radio_if.py: print type of RadioInterface
Change-Id: I6c1ba8546caec122cd1ea0ed87656f691abec068
2019-01-22 16:44:24 +07:00
Vadim Yanitskiy 3120ba7017 python/trx: fork RadioInterfaceUHD from RadioInterface
Change-Id: I1644a3f6b8da0d5f2a1a133058269e5383948fda
2019-01-22 16:43:48 +07:00
Vadim Yanitskiy 404842da11 trx/ctrl_if.py: use relative import for UDPLink
Change-Id: If4b00f6332461d3c37cde5a1f724906ca3d3a30f
2019-01-22 14:41:30 +07:00
Vadim Yanitskiy 5823a419e9 trx/radio_if.py: update clock_offset_control in set_rx_freq()
Change-Id: I065bf664f775099c90c123c9ff75f262a73bf1be
2019-01-19 11:29:35 +07:00
Vadim Yanitskiy 8bd9e15c66 trx/radio_if.py: do not print anything if freq. shift is 0
Change-Id: I100ce2ab8effc00e164e13253894445bdc816f06
2019-01-19 11:29:35 +07:00
Vadim Yanitskiy 180a037a41 python/trx: introduce and use Transceiver class
Change-Id: I6dc88edbb69a68746cc8e01206dc86f7ea2fa80f
2019-01-19 11:29:35 +07:00
Vadim Yanitskiy baebe451cd trx/ctrl_if_bb.py: reset transceiver on POWEROFF
Change-Id: I1e7f74c56388a431794a0b32b8a9537c360f5d33
2019-01-19 11:29:28 +07:00
Vadim Yanitskiy b7a272e3f0 trx/radio_if.py: introduce a new @property 'ready'
Change-Id: I513da0f45c6a608d15fbd0e8eafe14d6af8833d7
2019-01-19 10:24:31 +07:00
Vadim Yanitskiy 1fe28253b9 trx/radio_if.py: do not init both rx_freq and tx_freq
Change-Id: I9f251958ec90141d144fdb027aff20182131a1d1
2019-01-19 10:24:05 +07:00
Vadim Yanitskiy 7da82f458f python/trx: get rid of FakePM class
Change-Id: Ie96eb9735ecaa3329135c7be976ffd277a2f64f4
2019-01-19 09:32:36 +07:00
Vadim Yanitskiy f237f1a978 python/trx: use CamelCase naming for basic classes
Change-Id: Ica9c56d01191dda38e63b51caba2ec8c63b671c9
2019-01-16 17:11:55 +07:00
Vadim Yanitskiy bd4daec11c trx/radio_if.py: use existing 'dict_toggle_sign' block
Change-Id: Ifa616644a858f493b9f8706663f9e7fed717f3d0
2019-01-16 17:11:55 +07:00
Vadim Yanitskiy a1a871ee37 python/trx: rename 'change_sign_of_dict_elements' to 'dict_toggle_sign'
The old name was quite long, resulting into cumbersome imports:

  from change_sign_of_dict_elements import change_sign_of_dict_elements

let's use a shorter variant:

  from dict_toggle_sign import dict_toggle_sign

Change-Id: Ie75e1d6e5e74c7c1cf34154633c1472e4b85dbb6
2019-01-16 17:11:55 +07:00
Vadim Yanitskiy ace92ae2c5 python/trx/__init__.py: cosmetic: add missing new line
Change-Id: I379b321866bd892a52b0c272ed50c670da380a17
2019-01-16 17:11:55 +07:00
Vasil Velichkov 6ade8b8f19 Add TCH/H decoder tests 2018-12-29 00:52:05 +01:00
Vasil Velichkov 0ccec373b3 Add tests for the TCH/F and TCH/H Demappers 2018-12-29 00:52:05 +01:00
Piotr Krysik b8632ffdac apps/grgsm_trx: remove redundant unit from freq_offset variable name
Frequency is always in Hz so there is no need to add that
information in the variable name.

Change-Id: I509771c3fe072069a680f66b0763ae6825f6d529
2018-09-13 16:34:35 +00:00
Piotr Krysik 0f3bceb13d apps/grgsm_trx: remove unnecessary checks of freq_offset
Checking if freq_offset is None doesn't make sense currently
as it's always set to a float value by argparse (to 0 by default).

Change-Id: Ie8bae1ccde60d07fc25e0b874afa5aaaac04d8a7
2018-09-13 14:53:26 +02:00
Piotr Krysik 0631767b24 trx/radio_if: add freq_offset parameter to constructor
Change-Id: Ie1db02b719a0fec478b8a8b8a95643fb10fdfce5
2018-09-13 14:41:06 +02:00
Vasil Velichkov 89585b374b burst_file_source: Fix reading longer bursts
- Read bursts with pmt::deserialize directly from the std::filebuf
- Remove the unused unserialized variable
- Add tests

Since df978693 when the rx_time tags are present in the incomming stream
the gsm receiver adds fm_time to the burst's PMT and the bursts that
burst file sink writes becomes longer because of the additional field.

The burst file source block was expecting all burst to be 147 bytes long
and reading files with longer bursts was failing with an unhandled exception.

terminate called after throwing an instance of 'pmt::exception'
thread[thread-per-block[5]: <block dummy_burst_filter (2)>]: pmt_cdr: wrong_type : #f
  what():  pmt::deserialize: malformed input stream, tag value = : 115

Change-Id: I989b0d6a6b214088b7880e5cbf7bb6725492dbfc
2018-09-13 09:35:28 +00:00
Piotr Krysik b3d5c5743b trx/radio_if.py: clarify magic numbers in sample rate calculation
Change-Id: I55f283113d0324a0236b7bbf13bce5718003b857
2018-09-12 00:37:29 +07:00
Vadim Yanitskiy 38baac9678 apps/grgsm_trx: fix inaccurate sample rate calculation
Change-Id: I0c309588fa0f7822abfb3919327639735db07679
2018-09-12 00:36:13 +07:00
Piotr Krysik 1cc264fb0c Revert "grgsm_trx: Migrated argument parsing to argparse" that shouldn't be pushed
This reverts commit c62a3d9f55.
2018-09-06 19:57:57 +02:00
Piotr Krysik c62a3d9f55 grgsm_trx: Migrated argument parsing to argparse
Argparse makes adding new parameters easier and
adds consistent way of handling default values of
parameters and printing of their help info.

Change-Id: Idf99fd7a581464aa2f77fe01e721dbd162686811
2018-09-05 21:36:34 +02:00
Vadim Yanitskiy 97dc84e9f3 apps/grgsm_trx: add baseband frequency shift feature
An ability to shift the baseband frequency would allow one to
run both base stations and (OsmocomBB-based) mobile stations on
any frequency (e.g. in 2.4 GHz WiFi band)!

This is achieved by adding a given frequency offset to the
result of "ARFCN -> RX/TX frequency" calculation.

Usage example:

  grgsm_trx --freq-offset -500M

Both RX (Downlink) and TX (Uplink) frequencies will be shifted
by 500 MHz back, e.g. tuning request to ARFCN 105 would result
in tuning the radio to 456.0 MHz (instead of 956.0 MHz).

Related: OS#3520 (https://osmocom.org/versions/136)
Change-Id: I42e397e47402a87f4141ef31b25eff4c8c1267e2
2018-09-05 02:36:08 +07:00
Vadim Yanitskiy 2adbee48bf apps/grgsm_trx: print bind / remote address and port
Change-Id: If750d476f3972f1ab5c5b637438d14d40b1e3d87
2018-08-10 16:38:59 +07:00
Vadim Yanitskiy 473b35be86 apps/grgsm_trx: introduce bind address option
The new option (-b --bind-addr) allows one to specify the bind
address for both DATA and CTRL interfaces. By default, '0.0.0.0'
is used, so there are no restrictions for the L1 source address.

Change-Id: I3339f686b53db07cfd1bff9a516f4bdc28058cd9
2018-08-10 16:38:59 +07:00
Vadim Yanitskiy 5394c6012d gsm_trx_burst_if: allow to customize the bind address
Pleviously remote address for DATA interface was also used as the
bind address, what is definitely wrong. Let's change the API a bit
in order to allow one to specify a custom bind address.

Change-Id: I6e5f7b7119ac454217b8dd04f9ee0dd3b23972b6
2018-08-10 16:38:59 +07:00
Vadim Yanitskiy 0e246372bc trx/ctrl_if.py: send control responses to where commands are from
When we receive a control command, we should not simply send the
response to the default destination, but send it back to the exact
IP/prt from which the command originated.

This ensures correct routing of responses even in case multiple
programs are interfacing concurrently with a control socket.

Cherry-picked from: I24a0bba6eed059b101af95dac7d059f34dd715fc
Change-Id: I1f304ea887dc957d3ad53adb1e3c56ab27d8f196
2018-08-10 16:38:59 +07:00
Vadim Yanitskiy b085a2c854 trx/udp_link.py: set SO_REUSEADDR socket option
Setting this option allows one to reuse existing connections,
for example, by injecting CTRL commands or DATA bursts
into existing connections.

Cherry-picked from: I0882c76affa9a668a12d10967081054d2b666ed1
Change-Id: I6d256683a7aa0419cd5bd0a3eaa97aefdf3254f9
2018-08-10 16:38:59 +07:00