fixeria has submitted this change. (
https://gerrit.osmocom.org/c/osmo-bts/+/29935 )
Change subject: osmo-bts-trx: use lookup tables for checking AMR CMI/CMR on Downlink
......................................................................
osmo-bts-trx: use lookup tables for checking AMR CMI/CMR on Downlink
Change-Id: I75ecf5369f31c8b8e9519d2b580355fa80c24196
---
M src/osmo-bts-trx/sched_lchan_tchf.c
M src/osmo-bts-trx/sched_lchan_tchh.c
2 files changed, 30 insertions(+), 3 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/src/osmo-bts-trx/sched_lchan_tchf.c b/src/osmo-bts-trx/sched_lchan_tchf.c
index bf6703a..6a6331f 100644
--- a/src/osmo-bts-trx/sched_lchan_tchf.c
+++ b/src/osmo-bts-trx/sched_lchan_tchf.c
@@ -61,6 +61,15 @@
[24] = 1, /* TCH/F: a=17 / h=24 */
};
+/* TDMA frame number of burst 'a' should be used as the table index. */
+static const uint8_t sched_tchf_dl_amr_cmi_map[26] = {
+ [4] = 1, /* TCH/F: a=4 */
+ [13] = 1, /* TCH/F: a=13 */
+ [21] = 1, /* TCH/F: a=21 */
+};
+
+extern const uint8_t sched_tchh_dl_amr_cmi_map[26];
+
/*! \brief a single TCH/F burst was received by the PHY, process it */
int rx_tchf_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
{
@@ -392,7 +401,7 @@
enum osmo_amr_type ft_codec;
enum osmo_amr_quality bfi;
int8_t sti, cmi;
- bool amr_is_cmr = !dl_amr_fn_is_cmi(br->fn);
+ bool amr_is_cmr;
if (rsl_cmode != RSL_CMOD_SPD_SPEECH) {
LOGL1SB(DL1P, LOGL_NOTICE, l1ts, br, "Dropping speech frame, "
@@ -430,6 +439,10 @@
"Codec (FT = %d) of RTP frame not in list\n", ft_codec);
goto free_bad_msg;
}
+ if (br->chan == TRXC_TCHF)
+ amr_is_cmr = !sched_tchf_dl_amr_cmi_map[br->fn % 26];
+ else /* TRXC_TCHH_0 or TRXC_TCHH_1 */
+ amr_is_cmr = !sched_tchh_dl_amr_cmi_map[br->fn % 26];
if (amr_is_cmr && chan_state->dl_ft != ft) {
LOGL1SB(DL1P, LOGL_NOTICE, l1ts, br, "Codec (FT = %d) "
" of RTP cannot be changed now, but in next frame\n", ft_codec);
@@ -514,7 +527,8 @@
* the first FN 0,8,17 defines that CMR is included in frame.
*/
gsm0503_tch_afs_encode(*bursts_p, msg->l2h + sizeof(struct amr_hdr),
- msgb_l2len(msg) - sizeof(struct amr_hdr), !dl_amr_fn_is_cmi(br->fn),
+ msgb_l2len(msg) - sizeof(struct amr_hdr),
+ !sched_tchf_dl_amr_cmi_map[br->fn % 26],
chan_state->codec, chan_state->codecs,
chan_state->dl_ft,
chan_state->dl_cmr);
diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c b/src/osmo-bts-trx/sched_lchan_tchh.c
index 17073e0..37fd59d 100644
--- a/src/osmo-bts-trx/sched_lchan_tchh.c
+++ b/src/osmo-bts-trx/sched_lchan_tchh.c
@@ -66,6 +66,18 @@
[3] = 1, /* TCH/H(1): a=18 / d=24 / f=3 */
};
+/* TDMA frame number of burst 'a' should be used as the table index.
+ * This mapping is valid for both FACCH/H(0) and FACCH/H(1). */
+const uint8_t sched_tchh_dl_amr_cmi_map[26] = {
+ [4] = 1, /* TCH/H(0): a=4 */
+ [13] = 1, /* TCH/H(0): a=13 */
+ [21] = 1, /* TCH/H(0): a=21 */
+
+ [5] = 1, /* TCH/H(1): a=5 */
+ [14] = 1, /* TCH/H(1): a=14 */
+ [22] = 1, /* TCH/H(1): a=22 */
+};
+
/* 3GPP TS 45.002, table 1 in clause 7: Mapping tables.
* TDMA frame number of burst 'f' is always used as the table index. */
static const uint8_t sched_tchh_ul_facch_map[26] = {
@@ -439,7 +451,8 @@
* in frame, the first FN 0,8,17 or 1,9,18 defines that CMR is
* included in frame. */
gsm0503_tch_ahs_encode(*bursts_p, msg->l2h + sizeof(struct amr_hdr),
- msgb_l2len(msg) - sizeof(struct amr_hdr), !dl_amr_fn_is_cmi(br->fn),
+ msgb_l2len(msg) - sizeof(struct amr_hdr),
+ !sched_tchh_dl_amr_cmi_map[br->fn % 26],
chan_state->codec, chan_state->codecs,
chan_state->dl_ft,
chan_state->dl_cmr);
--
To view, visit
https://gerrit.osmocom.org/c/osmo-bts/+/29935
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I75ecf5369f31c8b8e9519d2b580355fa80c24196
Gerrit-Change-Number: 29935
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged