aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2023-11-24 17:32:31 +0100
committerfixeria <vyanitskiy@sysmocom.de>2023-12-06 16:33:00 +0000
commitbc6cc67115821fd86ec4c6cd06d8b1e0ce356a85 (patch)
tree97dd1f2e74bc6986f2d79790b97b63586a152079 /src
parentbc4ca18a31fce0e41b0257cfb6fcd749d56b0b38 (diff)
Transmit invalid AMR speech blocks instead of dummy FACCH
Every BTS needs to have some graceful handling for the scenario where it is time to send out a speech frame on TCH DL, but there is no frame to be sent. One possible solution is to transmit dummy FACCH, but this option is unattractive for TCH/AHS where FACCH displaces two speech frames rather than one. A more elegant solution is to emit a speech frame that is bad, causing the MS receiver to declare a BFI condition to trigger substitution and muting procedure. A bad frame is generated by gsm0503_tch_{afs,ahs}_encode() by setting the payload length to 0. Depends: libosmocore.git I82ce2adf995a4b42d1f378c5819f88d773b9104a Related: OS#6049 Change-Id: I056f379715c91ad968f198e112d363a9009dc1c3
Diffstat (limited to 'src')
-rw-r--r--src/osmo-bts-trx/sched_lchan_tchf.c22
-rw-r--r--src/osmo-bts-trx/sched_lchan_tchh.c22
2 files changed, 36 insertions, 8 deletions
diff --git a/src/osmo-bts-trx/sched_lchan_tchf.c b/src/osmo-bts-trx/sched_lchan_tchf.c
index 0138a2a2..b621b234 100644
--- a/src/osmo-bts-trx/sched_lchan_tchf.c
+++ b/src/osmo-bts-trx/sched_lchan_tchf.c
@@ -538,15 +538,14 @@ int tx_tchf_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br)
/* - If the channel mode is TCH/FS or TCH/EFS, transmit a dummy
* speech block with inverted CRC3, designed to induce a BFI
* condition in the MS receiver.
+ * - If the channel mode is TCH/AFS, transmit a dummy speech
+ * block with inverted CRC6, designed to induce a BFI
+ * condition in the MS receiver.
* - If the channel mode is one of the CSD modes, transmit an
* idle frame as described in 3GPP TS 44.021, sections 8.1.6
* and 10.2.3 (all data, status and E-bits set to binary '1').
* - In all other channel modes, transmit dummy FACCH
* like we always did before.
- *
- * FIXME: someone who knows AMR needs to look at this problem
- * and decide what is the correct BTS Tx behavior for frame
- * gaps in TCH/AFS. See OS#6049.
*/
switch (tch_mode) {
case GSM48_CMODE_DATA_12k0:
@@ -562,6 +561,21 @@ int tx_tchf_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br)
/* fall-through */
case GSM48_CMODE_SIGN:
default:
+ if (tch_mode == GSM48_CMODE_SPEECH_AMR) {
+ /* the first FN 4,13,21 defines that CMI is included in frame,
+ * the first FN 0,8,17 defines that CMR is included in frame.
+ */
+ rc = gsm0503_tch_afs_encode(BUFPOS(bursts_p, 0),
+ NULL, 0,
+ !sched_tchf_dl_amr_cmi_map[br->fn % 26],
+ chan_state->codec,
+ chan_state->codecs,
+ chan_state->dl_ft,
+ chan_state->dl_cmr);
+ if (rc == 0)
+ goto send_burst;
+ }
+
/* TODO: use randomized padding */
msg_facch = tch_dummy_msgb(GSM_MACBLOCK_LEN, GSM_MACBLOCK_PADDING);
/* dummy LAPDm func=UI frame */
diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c b/src/osmo-bts-trx/sched_lchan_tchh.c
index e0d7aca6..05e1af4b 100644
--- a/src/osmo-bts-trx/sched_lchan_tchh.c
+++ b/src/osmo-bts-trx/sched_lchan_tchh.c
@@ -453,15 +453,14 @@ int tx_tchh_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br)
/* - If the channel mode is TCH/HS, transmit a dummy speech block
* with inverted CRC3, designed to induce a BFI condition in
* the MS receiver.
+ * - If the channel mode is TCH/AHS, transmit a dummy speech
+ * block with inverted CRC6, designed to induce a BFI
+ * condition in the MS receiver.
* - If the channel mode is one of the CSD modes, transmit an
* idle frame as described in 3GPP TS 44.021, sections 8.1.6
* and 10.2.3 (all data, status and E-bits set to binary '1').
* - In all other channel modes, transmit dummy FACCH
* like we always did before.
- *
- * FIXME: someone who knows AMR needs to look at this problem
- * and decide what is the correct BTS Tx behavior for frame
- * gaps in TCH/AHS. See OS#6049.
*/
switch (tch_mode) {
case GSM48_CMODE_DATA_6k0:
@@ -474,6 +473,21 @@ int tx_tchh_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br)
/* fall-through */
case GSM48_CMODE_SIGN:
default:
+ if (tch_mode == GSM48_CMODE_SPEECH_AMR) {
+ /* the first FN 4,13,21 or 5,14,22 defines that CMI is included
+ * in frame, the first FN 0,8,17 or 1,9,18 defines that CMR is
+ * included in frame. */
+ rc = gsm0503_tch_ahs_encode(BUFPOS(bursts_p, 0),
+ NULL, 0,
+ !sched_tchh_dl_amr_cmi_map[br->fn % 26],
+ chan_state->codec,
+ chan_state->codecs,
+ chan_state->dl_ft,
+ chan_state->dl_cmr);
+ if (rc == 0)
+ goto send_burst;
+ }
+
/* FACCH/H can only be scheduled at specific TDMA offset */
if (!sched_tchh_dl_facch_map[br->fn % 26]) {
/* FACCH/H is not allowed, send half-filled bursts with even numbered