fixeria has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-bts/+/27722 )
Change subject: osmo-bts-trx: rx_tchh_fn(): use a lookup table for FACCH/H
......................................................................
osmo-bts-trx: rx_tchh_fn(): use a lookup table for FACCH/H
Since change [1], in rts_tchh_fn() we're using a lookup table for
DL FACCH/H. Let's do the same for UL FACCH/H in rx_tchh_fn().
Change-Id: I7c4e3befdd33bef4d89a04a4c7cb1a2d4078c156
Related: [1] I3dba243e5a1b7c8008ef0178ea18ed885256c50d
Related: SYS#5916, OS#5518
---
M src/osmo-bts-trx/sched_lchan_tchh.c
1 file changed, 18 insertions(+), 13 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/22/27722/1
diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c b/src/osmo-bts-trx/sched_lchan_tchh.c
index f0d8ff6..05e8e7e 100644
--- a/src/osmo-bts-trx/sched_lchan_tchh.c
+++ b/src/osmo-bts-trx/sched_lchan_tchh.c
@@ -64,6 +64,17 @@
[3] = 1, /* TCH/H(1): a=18 / d=24 / f=3 */
};
+/* 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] = {
+ [10] = 1, /* FACCH/H(0): B0(0,2,4,6,8,10) */
+ [11] = 1, /* FACCH/H(1): B0(1,3,5,7,9,11) */
+ [19] = 1, /* FACCH/H(0): B1(8,10,13,15,17,19) */
+ [20] = 1, /* FACCH/H(1): B1(9,11,14,16,18,20) */
+ [2] = 1, /* FACCH/H(0): B2(17,19,21,23,0,2) */
+ [3] = 1, /* FACCH/H(1): B2(18,20,22,24,1,3) */
+};
+
/*! \brief a single TCH/H burst was received by the PHY, process it */
int rx_tchh_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
{
@@ -78,11 +89,6 @@
int n_errors = 0;
int n_bits_total = 0;
bool bfi_flag = false;
- /* Note on FN-10: If we are at FN 10, we decoded an even aligned
- * TCH/FACCH frame, because our burst buffer carries 6 bursts.
- * Even FN ending at: 10,11,19,20,2,3
- */
- int fn_is_odd = (((bi->fn + 26 - 10) % 26) >> 2) & 1;
enum sched_meas_avg_mode meas_avg_mode = SCHED_MEAS_AVG_M_S6N4;
struct l1sched_meas_set meas_avg;
unsigned int fn_begin;
@@ -157,12 +163,9 @@
meas_avg_mode = SCHED_MEAS_AVG_M_S6N6;
/* fall-through */
case GSM48_CMODE_SPEECH_V1: /* HR or signalling */
- /* Note on FN-10: If we are at FN 10, we decoded an even aligned
- * TCH/FACCH frame, because our burst buffer carries 6 bursts.
- * Even FN ending at: 10,11,19,20,2,3
- */
rc = gsm0503_tch_hr_decode(tch_data, *bursts_p,
- fn_is_odd, &n_errors, &n_bits_total);
+ !sched_tchh_ul_facch_map[bi->fn % 26],
+ &n_errors, &n_bits_total);
if (rc == (GSM_HR_BYTES + 1)) { /* only for valid *speech* frames */
/* gsm0503_tch_hr_decode() prepends a ToC octet (see RFC5993), skip it */
bool is_sid = osmo_hr_check_sid(&tch_data[1], GSM_HR_BYTES);
@@ -191,9 +194,11 @@
/* See comment in function rx_tchf_fn() */
amr = 2;
rc = gsm0503_tch_ahs_decode_dtx(tch_data + amr, *bursts_p,
- fn_is_odd, !fn_is_cmi, chan_state->codec,
- chan_state->codecs, &chan_state->ul_ft,
- &chan_state->ul_cmr, &n_errors, &n_bits_total,
&chan_state->amr_last_dtx);
+ !sched_tchh_ul_facch_map[bi->fn % 26],
+ !fn_is_cmi, chan_state->codec,
+ chan_state->codecs, &chan_state->ul_ft,
+ &chan_state->ul_cmr, &n_errors, &n_bits_total,
+ &chan_state->amr_last_dtx);
/* Tag all frames that are not regular AMR voice frames
as SUB-Frames */
--
To view, visit
https://gerrit.osmocom.org/c/osmo-bts/+/27722
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I7c4e3befdd33bef4d89a04a4c7cb1a2d4078c156
Gerrit-Change-Number: 27722
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange