aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-litecell15/tch.c
AgeCommit message (Collapse)AuthorFilesLines
2017-07-10Allow passing low link quality buffers to upper layersPau Espin Pedrol1-5/+9
We want to always call l1if_tch_rx and l1sap_up in order to avoid losing triggering events on the upper layer. With this change, the upper layer will increase correctly seq + ts for RTP. It will then send an RTP packet with only the header and no payload, which is not correct but at least we avoid drifting the RTP clock. Upcoming patch in the series solves this issue. This patch assumes that we are not lossing data events from the physical layer and that we receive an event every 20ms, even if the MS is not transmitting due to DTX. Depends on libosmocore If4ae20c22b881e94585dad710f17b9e37f77bf82 Change-Id: If5df8940fab833eb4e3ed851880b66987d356031
2017-07-04Fix annoying trailing whitespacePau Espin Pedrol1-1/+1
This whitespace keeps being automatically fixed by editor, polluting my patches. Change-Id: If0ba1321ed326c1498e3f60b611bd962f2a9484a
2017-07-04Use L1P instead of L1C for TCH logging and allocationPau Espin Pedrol1-12/+12
L1C is for L1-Control primitives, while TCH channels are L1 Data channels. Change-Id: I07ea3a7326bfcb62271d58deb0743311f6d97c8b
2017-06-30litecell15/tch.c: Clean up use of empty bufferPau Espin Pedrol1-3/+4
Make code easier to read and avoid reading first byte of the buffer if size is 0. Change-Id: Ib9ee967c0f42098b3a0569e9d84f23832eb4f2d5
2017-02-01Fix AMR HR DTX FSM logic.Jean-Francois Dionne1-2/+2
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-10DTX: fix SID-FIRST detectionJean-Francois Dionne1-1/+1
Max's note: made similar modification to osmo-bts-sysmo/tch.c Change-Id: I76e62783b73803dfc0d32693a68020a9d89878b8 Related: OS#1801
2017-01-04DTX AMR HR: fix inhibitionMax1-0/+1
* 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-01DTX DL AMR: rewrite FSM recursionMax1-19/+12
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 DL: tighten check for enabled operationMax1-3/+3
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-2/+1
* 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-2/+4
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-13DTX DL: use FSM for AMRMax1-28/+94
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: send AMR voice alongside with ONSETMax1-5/+7
When ONSET event happens (either via Marker bit or due to unmarked talkspurt) we should first send Onset event to L1 and than send voice data in response to the same PH-RTS.ind. Change-Id: I2a7b89430ca49eee4a350c5f980bd6bcbc386347
2016-09-30DTX: move ONSET detection into separate functionMax1-36/+19
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-81/+33
* 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-25/+9
Note: this also require changes to properly link against libosmocodec - see 2bb65be159dfdabf664fec569b343320301701b0 in libosmocore. Change-Id: I96594cf3aa1013d505bd20069d5bf261d9a2aefb
2016-09-26DTX: remove misleading commentMax1-1/+1
There's no SID stored in UL direction so there's nothing to remove. Change-Id: I3f587a66406bc6a02b859e826f4903641fcc5a15
2016-09-24DTX: check Marker bit to send ONSET to L1Max1-8/+25
If Marker bit is set than it's a talkspurt which we have to explicitly indicate to L1 by first sending ONSET message and than actual voice data in a separate message. This change affect sysmobts and LC15 hw. Change-Id: I88c41568bcb0d82699f617adc4ad192603dd1bb6 Related: OS#1750
2016-09-23lc15, sysmo: Use SID_FIRST_P1 to initiate DTXMax1-2/+1
Some phone seems to not send SID_FIRST_P2 message which seems like a different understanding of the DTX spec. L1 accommodates for that by using P1 to supply data for SID. Hence we should use it to initiate DTX and ignore P2 message in case of AMR HR. Change-Id: Iaf993b89caa0ad49b97d1c745dcaf039f867f018
2016-09-23DTX: fix SID logicMax1-4/+9
Previously receiving SID via RTP always caused it's transmission to L1 regardless of the time which might have resulted in excess traffic. Fix this by only saving SID data and transmitting it later on as necessary according to 3GPP TS 26.093 A.5.1.1. Change-Id: Ifcdc5c60d0238b704a94f6778d4e00f2b087b090 Fixes: OS#1801
2016-09-23DTX: fix SID repeat schedulingMax1-58/+10
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-09-23DTX: fix last SID savingMax1-11/+5
Previously SID was saved explicitly by each BTS model (lc15, sysmo) instead of relying on generic function. Fix it by using generic function and propagating necessary parameters for it. Change-Id: Ie545212cce5ed2b3ea3228597f18a473f5e1deb4 Fixes: OS#1800
2016-06-24Remove duplicated nibble shift codeMax1-39/+0
Those functions are now part of libosmocore. Change-Id: Iab3206e3b41caff23f656a727605032df9798953
2016-06-23DTXu: move copy-pasted code to common partMax1-18/+4
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-73/+4
Related: OS#1750 Change-Id: Ic4342eaf7e32a0e9a5f2b16dd196a1f5f03152a9
2016-06-18DTX: add support for AMR/HRMax1-1/+35
Change-Id: Id744b67904011eb328b24c46a645b3eb53525c04 Fixes: OS#1562
2016-06-14DTXu: mark beginning of speech burst in RTPMax1-6/+44
Set Marker bit in RTP header to mark the beginning of talkspurt. Change-Id: I3dd70ad8ff94356e3c3cc5458255f6c23534783e Related: OS#1562
2016-06-14DTXd: store/repeat last SIDMax1-15/+116
Store last SID received over RTP and repeat is if necessary (no new SID or SPEECH frames) according to codec-specific scheduling rules. Related: OS#1563 Copy-paster from I4d23846a27d3dbd2a6e75e481c1efcdb2a85f305 for LC15. Change-Id: I29acea6e8bbf426330ce52554a48afb5d2ef1679
2016-06-14Fix debug outputMax1-0/+1
Previously frame number was not saved in case of PRIM_TCH rendering many debug statements with g_time useless. Copy-paste from ef30f50d5d6d5f863fc147d05ccdceb89284934e. Change-Id: I952b39458d921622d5964cbdcc2f4e45ff9ea951
2016-06-12Use libosmocodec for AMR RTPMax1-15/+10
Use libosmocodec function to parse RTP with AMR payload in sysmoBTS and LC15. This replaces "manual" parsing of AMR frame with function covered by test suite and makes adding DTXd support easier. Related: OS#1563 Change-Id: I1464f9a12e3f92926d03d5dd5d18e8f0f7206dd9 Reviewed-on: https://gerrit.osmocom.org/204 Tested-by: Jenkins Builder Reviewed-by: Harald Welte <laforge@gnumonks.org>
2016-02-15LC15: Add initial support for the NuRAN Wireless Litecell 1.5Yves Godin1-0/+534
This commit adds basic support for the Litecell 1.5. Multi-TRX is not supported yet. Instead, multiple instances of the BTS can be launched using command line parameter -n <HW_TRX_NR> to specify if TRX 1 or 2 must be used by the bts. Note that only TRX 1 opens a connection to the PCU. Full support for GPRS on both TRX will come at the same time than the multi-TRX support. The BTS manager has been adapted to match the new hardware but otherwise it has not been improved or changed compared to the one used on the SuperFemto/Litecell (sysmobts).