Commit Graph

26 Commits

Author SHA1 Message Date
wbokslag 86796c6c4a Fixups and clarifying comments for msgb tail modifications
Added fixups for msgb len field whenever the tail is modified
Also, added some clarifying comments

Change-Id: Ia725edbeafe26bd2ea9b5a1810d0b26bc79d84db
2023-07-29 11:48:22 +02:00
wbokslag e3f1aa97e1 Added calls to stub decryption functions for MAC resources
The tcs (Tetra Crypto State) struct now maintains information relevant for decryption, such as the current network, colour code, hyperframe, etcetera.
Also, the upper mac now calls a stub decryption function when receiving an encrypted resource.

Change-Id: I92d718789d6b7e84c1901d09165fce59cdf8c1ca
2023-07-27 20:51:10 +02:00
wbokslag affab933cf Added support for slot stealing
Slot stealing is how a traffic slot can be partially or fully "stolen" by a control channel. This patch adds support for that and maintains the stealing status in the tetra_mac_state. This can be used to prevent passing a signalling half slot to the voice decoder.

Change-Id: I01a112e6e74f75401649d358b8f98c6248d2522b
2023-07-26 17:37:52 +02:00
wbokslag 79560cbf86 Support parsing of multiple mac resources in the same timeslot
Change-Id: Ic2956a5f10cffe296b76a290a0d16f45461eb2e7
2022-09-22 11:46:35 +02:00
wbokslag 1b7ebde55d Keep timeslot number in range 1-4 instead of 0-3 in parsing of SYNC frame
According to the tetra_tdma_time struct definition, the tn should be in range 1-4. Also, tetra_burst_sync_in increments the timeslot number when in a synchronized state. The timeslot is then normalized with normalize_tn which also expects the tn to be within the 1-4 range.

Change-Id: Ib0967fdeef3bf37c612124626a74d240aa571a66
2022-09-18 15:16:51 +02:00
wbokslag 16713cab01 when traffic dump directory is specified, now prints error message and exits instead of crashing when traffic file cannot be written
Change-Id: I273e07aefd9faea13662f6699a6f3b074c8efe88
2022-08-09 17:28:31 +02:00
wbokslag d5bfc8e74a keep track of which block of a downlink burst is being processed
tp_sap_udata_ind now accepts a parameter designating from which block
(first or second) of the downlink burst the bits originate (not
applicable for all downlink burst types). In some cases, the upper mac
needs this information, see ETSI EN 300 392-7 clause 6.4.1

Change-Id: I5ff316a773906328e19c3530b09d7412f9c731ec
2022-08-02 13:22:30 +02:00
Jan Hrach 73e9e0e871 add traffic dumping patch, use getopt to parse arguments
Enable the user to specify a directory, where contents of traffic channel will
be saved. Together with this dump, a text file with SSIs of the engaged
stations is saved too.

Based on 0004-HACK-Quick-hack-to-save-the-speech-data-from-TCH.patch available at
https://build.opensuse.org/package/view_file/home:mnhauke:sdr/osmo-tetra/0004-HACK-Quick-hack-to-save-the-speech-data-from-TCH.patch

Change-Id: I94135753a76cadfa373167ffca18e89bee5bcff8
2018-09-28 23:27:20 +00:00
Jan Hrach 013ef6e8a1 update scrambling only if we have good CRC
When a bad frame is received, the scrambling should not be updated,
because setting scrambling to wrong values will completely break further
decoding (until another SYNC frame is received).

Change-Id: I5e88b52fcbb98532d7ab6ca85e4f956589a595ab
2018-07-31 06:58:51 +00:00
Jan Hrach 2c19f9856a Make viterbi decoder deterministic in case of bit errors / too few symbols
Running tetra-rx on a capture with lots of bit errors is not
deterministic. Investigation with Valgrind shows various errors about
uninitialised values in libosmocore's viterbi decoder.

The cause appears to lie in @lower_mac/viterbi.c@. The only function
there allocates space for 864 symbols and then fills it with the symbols
received. However, sym_count is sometimes less than 864, leaving the
rest of the array uninitialized.

Initializing it with @int8_t vit_inp[864*4] = {0};@ fixes the problem.

Change-Id: Ib745c387e21fb81afef69efcf7e46d5d49331c8f
Fixes: OS#3410
2018-07-21 10:29:20 +02:00
Sylvain Munaut 1bc5434a99 lower_mac/viterbi: Use the high level API of conv.h from libosmocore
It's more stable ... here we just need a flexible length, which we
can 'fake' by creating a local copy of the 'code' definition on the
stack.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-25 20:13:51 +01:00
Harald Welte f72acb950a add bit-reordering functions for TETRA ACELP speech codec 2011-05-29 13:02:37 +02:00
Harald Welte 06b01f79b3 Speech Class 1 bits are 112 / 168, not 114 / 171 2011-05-27 12:32:15 +02:00
Harald Welte c959894fbe add rate 8/17 RCPC for speech with STCH 2011-05-27 11:05:51 +02:00
Harald Welte e3032cd897 add matrix interleave for voice frames (untested) 2011-05-27 10:59:09 +02:00
Harald Welte a9885473d2 conv_enc: fix test cases for voice RCPC 2011-05-27 10:48:23 +02:00
Harald Welte cb25e99b21 lower_mac: Add puncturing schemes for voice channels 2011-05-27 10:38:24 +02:00
Harald Welte 0ad20fd762 create 'struct tetra_mac_state' in main and pass through all layers/SAPs 2011-05-27 08:44:12 +02:00
Harald Welte a22f5923d1 libosmocore namespace changes ("osmo_") 2011-05-08 09:46:46 +02:00
Sylvain Munaut 2d9b3e2560 lower_mac/viterbi: Use the viterbi code provided in libosmocore
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-04-26 14:46:04 +02:00
Harald Welte 4911ba91ef TETRA: start to use msgb as part of osmo_prim / tmvsap_prim
This will allow us to pass the same msgb (with different l1h/l2h)
up the stack.
2011-04-24 16:55:42 +02:00
Harald Welte 44cd972b05 lower mac: don't print all the different type-n bits per default 2011-04-24 09:14:12 +02:00
Sylvain Munaut 6d08da3bd3 Adapt to the new "osmocom/core/" include path
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-04-17 20:21:41 +02:00
Harald Welte 140c2f80c1 use ubit_dump() which is part of libosmocore instead of local bitdump() 2011-02-08 16:57:48 +01:00
Dimitri Stolnikov b19383473d [lower_mac] fix wrong header inclusion (typo) 2011-01-19 19:33:37 +01:00
Harald Welte 7ee08faee0 initial import of Osmocom TETRA phy and lower MAC code 2011-01-19 10:39:59 +01:00