aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/msg_utils.c
AgeCommit message (Collapse)AuthorFilesLines
2017-02-01Fix AMR HR DTX FSM logic.Jean-Francois Dionne1-12/+30
Fix SID_FIRST_INH detection during speech and when SID_FIRST is interrupted by FACCH. Fix SID_UPDATE_INH detection during silence and when SID_UPDATE is interrupted by FACCH. Add a delay for SID_FIRST to appear at the right time after FACCH. Fix extra byte sent in downlink for SID_FIRST and SID_UPDATE. Change-Id: Ia811305e15541f2376005df736bd610e8b0d2f69
2017-01-04DTX AMR HR: fix inhibitionMax1-24/+73
* Unlike in AMR FR, in AMR HR incoming ONSET have to be treated differently depending on whether we've recently sent SID UPDATE or EMPTY frame. Split ST_SID_U FSM state into 2 states to accommodate for that and make sure that additional states specific to AMR HR are not used for AMR FR. * Avoid sending E_VOICE and E_SID_U in corresponding states as those do not initiate FSM state transitions anyway. This decrease extra load from FSM signalling which otherwise would be triggered on per-frame basis. * Introduce separate signal for SID First P1 -> P2 transition to avoid confusion with E_COMPL and E_SID_U initiated transitions from P1 state. * Don't init DTX FSM for SDCCH channels. Change-Id: I229ba39a38a223fada4881fc9aca35d3639371f8 Related: OS#1801
2016-12-22DTX: don't always perform AMR HR specific checkJean-Francois Dionne1-6/+8
Disable check specific to AMR HR if not DTX is enabled. Change-Id: I8af1daffbd7e59fef6e671dbd9b820497f82d354 Fixes: OS#1892
2016-12-08DTX: add explicit check if DTX enabledMax1-0/+3
Check explicitly if DTX is enabled for AMR before checking if SID frame repetition is optional. Change-Id: I660688d56505798cade1495c30338fd6806a3259 Related: OS#1801
2016-12-01DTX DL AMR: rewrite FSM recursionMax1-18/+107
Add explicit state for recursion (sending the different payload data in response to the RTS request for same FN) and corresponding transition. Remove ST_FACCH_V as with new explicit recursion handling it becomes unreacheable. This makes it easier to maintain preemption (interruption of current procedure due to FACCH or Inhibition). This also reduces the number of possible transitions out of each state thus reducing graph's cyclomatic complexity. Change-Id: If39b68083d23a4a35f468a5d75f54eb733ebfd14
2016-11-08DTX: wrap FSM signal dispatchingMax1-2/+8
Make wrapper function which checks that DTX is enabled for lchan before dispatching any events. Change-Id: Id8b519c4af6d505ec9a4b9aadd5107bf7af53d66
2016-11-08DTX DL: tighten check for enabled operationMax1-0/+9
Introduce dtx_dl_amr_enabled() function which checks that DTX is enabled and FSM is allocated and use it for all corresponding checks. Change-Id: Ifa68b641265ed14f242765c85e40da2d1021a541
2016-11-03DTX fix ONSET handlingMax1-11/+28
* re-introduce ST_ONSET_F to guard from repetitive ONSET messages in case multiple FACCH occur duriing DTX silence period. * produce ONSET event after both SID FIRST and UPDATE in case of AMR FR. * always dispatch E_SID_F (SID FIRST) signal if in talkspurt. * allow E_SID_* right after ONSET (zero-length talkspurt). * add missing E_ONSET signal description. * fix FSM transitions for AMR HR *Inhibited and First P*. * fix incorrect return from l1if_tch_encode() in ONSET FACCH with incoming SID UPDATE Change-Id: I0e9033c5f169da46aed9a0d1295faff489778dcf Related: OS#1801
2016-10-28DTX DL: split ONSET state handlingMax1-3/+18
Handle ONSET cause by Voice and FACCH separately. In case of Voice we have RTP payload which we have to cache and send later on in next response to L1 RTS. FACCH have higher priority so it preempts both voice and silence alike - hence we can send ONSET immediately but still have to track previous state in order to get back to it gracefully. This affects lc15 and sysmo hw as there's no FSM-based DTX implementation for other models yet. Note: this requires patch for OpenBSC which adds FACCH buffer to tch.dtx struct. Change-Id: Idba14dcd0cb12cd7aee86391fcc152c49fcd7052 Related: OS#1802
2016-10-24Fix DTX DL AMR SIDscheduling logicMax1-9/+14
Previously SID UPDATE was sometimes scheduled incorrectly. Fix this by: * avoid rounding error when computing scheduling time difference from FN * properly saving and updating cached SID type and FN Change-Id: I7acffae4792e7bddc2ae19a2f04ee921dc194c36 Related: OS#1801
2016-10-24DTX HR - fix array size calculationMax1-1/+2
Use ARRAY_SIZE macro for each pointer separately. Fix suggested by Neels Hofmeyr <nhofmeyr@sysmocom.de>. Change-Id: I68ec1be33fb743977121d654187d85d6b8451e2b Fixes: Coverity CID 150132
2016-10-17DTX AMR - fix buffer length checkMax1-1/+2
Consider AMR-specific prefix in computing max length to avoid triggering coverity check. Change-Id: I2fbc468caedf08f26893457db7c7fbacef5b860c Fixes: Coverity CID 150133
2016-10-13DTX: fix array size calculationMax1-4/+5
Compute array size in-place and pass it to function. Change-Id: I4cd480ceb20efc69df1b00e3c7359fcbd14c19cd Fixes: coverity CID 1357844.
2016-10-13DTX DL: use FSM for AMRMax1-52/+83
Use dedicated FSM to handle all DTX DL related events: - add explicit checks if DTX DL is enabled (fixes regression for non-DTX setup introduced in 654175f33bd412671e3ef8cdd65c0689d10f278c) - fix handling of AMR CMI for SPEECH frames - add FSM for DTX DL - sync with corresponding changes in OpenBSC's - handle FACCH-related DTX ONSET events This affects both lc15 and sysmobts and requires corresponding change in OpenBSC (Change-Id: Idac8609faf9b5ced818fde899ccfc6ed0c42e8fd). Change-Id: I74a0b42cb34d525b8a70d264135e82994ca70d31
2016-09-30DTX: move ONSET detection into separate functionMax1-2/+55
Move code from tch.c (lc15, sysmo) into generic function which: - check if talkspurt is happening - cache SID if necessary or invalidate cache - fill in CMR & CMI prefix This also fixes the problem when SID FIRST was cached without sending just like SID UPDATE instead of being sent right away. Change-Id: I6c7016a54749abadeef4fd4f5b6f750b256fb916
2016-09-30DTX: further AMR SID cache fixes (lc15, sysmo)Max1-6/+20
* consolidate AMR CMR and CMI handling in common/amr.c * use it in save_last_sid() * remove dead code * properly compute RTP payload length for AMR * use save_last_sid() for FR & HR as well * invalidate cached SID if SPEECH frame is received Fixes: OS #1800, #1801 Change-Id: I5a1c1ad0b0a295a50e67775a4db85f1d331755ed
2016-09-30DTX: move scheduling check inside repeat_last_sidMax1-22/+36
Note: this also require changes to properly link against libosmocodec - see 2bb65be159dfdabf664fec569b343320301701b0 in libosmocore. Change-Id: I96594cf3aa1013d505bd20069d5bf261d9a2aefb
2016-09-23DTX: fix SID repeat schedulingMax1-0/+44
Previously SID retransmission was scheduled incorrectly based on GSM frames instead of voice frames. Fix this by using GSM Fn only as elapsed time estimation: * move saved SID retransmission into generic function from lc15 and sysmo specific code * split retransmission time check into separate generic function * compute estimation for elapsed time since last retransmission using GSM Fn Change-Id: Ib054b458a7345d9ba40dba53754ca59ab099c8e8 Fixes: OS#1799
2016-07-25fix compiler warning: msg_utils.c: fn_chk() constify argNeels Hofmeyr1-1/+1
The only caller dtx_sched_optional() passes const arrays and a warning was issued. Change-Id: I18e0788ef96489d2116a60cae57bd516fe6eae8e
2016-07-05Mark array as static constMax1-3/+3
Change-Id: Ia70519c8f10d55084b53acb68e57debc70549246
2016-06-23DTXu: move copy-pasted code to common partMax1-0/+11
Abstract code for checking/setting lchan's UL SID flag and RTP Marker into generic function and use it for LC15 and sysmoBTS. Change-Id: Ica5392e92bab29164711163e7b01adb174272883 Related: OS#1750
2016-06-18Move copy-pasted code into common partMax1-0/+43
Related: OS#1750 Change-Id: Ic4342eaf7e32a0e9a5f2b16dd196a1f5f03152a9
2016-01-04fix large amount of compiler warnings in common and sysmobts codeHarald Welte1-3/+3
2015-01-09msg: Generalize the message structure testHolger Hans Peter Freyther1-8/+10
This was taken out of LaF0rge's OML router branch and is now used by the extended calibration feature.
2014-08-18replace oml_{osmo,ipa}_magic[] with abis_nm_{osmo,ipa}_magicHarald Welte1-8/+9
the latter is now in libosmogsm.
2014-07-31sysmobts: Verify the structure of IPA and OML messagesHolger Hans Peter Freyther1-0/+174
Extend the router to verify that the message received is properly encoded. The code can deal with the basic structure of ETSI OML and vendor specific messages for ip.access and the osmocom project.