summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-02-26 11:48:00 +0100
committerHarald Welte <laforge@gnumonks.org>2018-02-26 12:26:38 +0100
commit6950b191e84c73687f9dc77462ff66cbeaec5686 (patch)
treea86f13e43837229d5231064897b3c983631b1e5a /src
parent175a4ae93aaf1068b61041dca12962059d65ed55 (diff)
coding: Add BER-reporting RACH decode functions
For all other decode operations we report the BER, but not for the RACH. This results in osmo-bts-trx not being able to report BER to the higher layers, which is possible on other BTS backends. Let's close this gap by introducing gsm0503_rach_ext_decode_ber() and gsm0503_rach_decode_ber() with the usual n_errors / n_bits_total arguments. Change-Id: I2b1926a37bde860dcfeb0d613eb55a71271928c5
Diffstat (limited to 'src')
-rw-r--r--src/coding/gsm0503_coding.c46
-rw-r--r--src/coding/libosmocoding.map2
2 files changed, 44 insertions, 4 deletions
diff --git a/src/coding/gsm0503_coding.c b/src/coding/gsm0503_coding.c
index c94bca7e..215cc6dd 100644
--- a/src/coding/gsm0503_coding.c
+++ b/src/coding/gsm0503_coding.c
@@ -2826,13 +2826,15 @@ static inline void rach_apply_bsic(ubit_t *d, uint8_t bsic, uint8_t start)
d[start + i] ^= ((bsic >> (5 - i)) & 1);
}
-static inline int16_t rach_decode(const sbit_t *burst, uint8_t bsic, bool is_11bit)
+static inline int16_t rach_decode_ber(const sbit_t *burst, uint8_t bsic, bool is_11bit,
+ int *n_errors, int *n_bits_total)
{
ubit_t conv[17];
uint8_t ra[2] = { 0 }, nbits = is_11bit ? 11 : 8;
int rv;
- osmo_conv_decode(is_11bit ? &gsm0503_rach_ext : &gsm0503_rach, burst, conv);
+ osmo_conv_decode_ber(is_11bit ? &gsm0503_rach_ext : &gsm0503_rach, burst, conv,
+ n_errors, n_bits_total);
rach_apply_bsic(conv, bsic, nbits);
@@ -2852,7 +2854,7 @@ static inline int16_t rach_decode(const sbit_t *burst, uint8_t bsic, bool is_11b
* \returns 0 on success; negative on error (e.g. CRC error) */
int gsm0503_rach_ext_decode(uint16_t *ra, const sbit_t *burst, uint8_t bsic)
{
- int16_t r = rach_decode(burst, bsic, true);
+ int16_t r = rach_decode_ber(burst, bsic, true, NULL, NULL);
if (r < 0)
return r;
@@ -2869,7 +2871,43 @@ int gsm0503_rach_ext_decode(uint16_t *ra, const sbit_t *burst, uint8_t bsic)
* \returns 0 on success; negative on error (e.g. CRC error) */
int gsm0503_rach_decode(uint8_t *ra, const sbit_t *burst, uint8_t bsic)
{
- int16_t r = rach_decode(burst, bsic, false);
+ int16_t r = rach_decode_ber(burst, bsic, false, NULL, NULL);
+ if (r < 0)
+ return r;
+
+ *ra = r;
+ return 0;
+}
+
+/*! Decode the Extended (11-bit) RACH according to 3GPP TS 45.003
+ * \param[out] ra output buffer for RACH data
+ * \param[in] burst Input burst data
+ * \param[in] bsic BSIC used in this cell
+ * \param[out] n_errors Number of detected bit errors
+ * \param[out] n_bits_total Total number of bits
+ * \returns 0 on success; negative on error (e.g. CRC error) */
+int gsm0503_rach_ext_decode_ber(uint16_t *ra, const sbit_t *burst, uint8_t bsic,
+ int *n_errors, int *n_bits_total)
+{
+ int16_t r = rach_decode_ber(burst, bsic, true, n_errors, n_bits_total);
+ if (r < 0)
+ return r;
+
+ *ra = r;
+ return 0;
+}
+
+/*! Decode the (8-bit) RACH according to TS 05.03
+ * \param[out] ra output buffer for RACH data
+ * \param[in] burst Input burst data
+ * \param[in] bsic BSIC used in this cell
+ * \param[out] n_errors Number of detected bit errors
+ * \param[out] n_bits_total Total number of bits
+ * \returns 0 on success; negative on error (e.g. CRC error) */
+int gsm0503_rach_decode_ber(uint8_t *ra, const sbit_t *burst, uint8_t bsic,
+ int *n_errors, int *n_bits_total)
+{
+ int16_t r = rach_decode_ber(burst, bsic, false, n_errors, n_bits_total);
if (r < 0)
return r;
diff --git a/src/coding/libosmocoding.map b/src/coding/libosmocoding.map
index 95953cf2..87b38864 100644
--- a/src/coding/libosmocoding.map
+++ b/src/coding/libosmocoding.map
@@ -110,8 +110,10 @@ gsm0503_tch_ahs_encode;
gsm0503_tch_ahs_decode;
gsm0503_rach_ext_encode;
gsm0503_rach_ext_decode;
+gsm0503_rach_ext_decode_ber;
gsm0503_rach_encode;
gsm0503_rach_decode;
+gsm0503_rach_decode_ber;
gsm0503_sch_encode;
gsm0503_sch_decode;