diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2022-04-10 19:02:40 +0300 |
---|---|---|
committer | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2022-04-10 19:04:29 +0300 |
commit | 3ac0cf8c398f19d51f819bf829d4a1b0d68d0ee9 (patch) | |
tree | 15a8e555baf375916c2a1f14bf805f3f61837be4 | |
parent | 93e3a220b1a9c83a982f90647b7a620a8f91369c (diff) |
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
-rw-r--r-- | src/osmo-bts-trx/sched_lchan_tchh.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c b/src/osmo-bts-trx/sched_lchan_tchh.c index f0d8ff68..05e8e7ec 100644 --- a/src/osmo-bts-trx/sched_lchan_tchh.c +++ b/src/osmo-bts-trx/sched_lchan_tchh.c @@ -64,6 +64,17 @@ static const uint8_t sched_tchh_ul_amr_cmi_map[26] = { [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 rx_tchh_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi) 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 @@ int rx_tchh_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi) 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 @@ int rx_tchh_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi) /* 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 */ |