Review at  https://gerrit.osmocom.org/6315

Add 11-bit RACH support to osmo-bts-trx

Attempt to decode incoming RACH burst as 11-bit first and fallback to
8-bit if unsuccessful.

Change-Id: Ia28741603636406744e5e22ffff1fb7a9689955a
---
M src/osmo-bts-trx/scheduler_trx.c
1 file changed, 14 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/15/6315/1

diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index 0f3272e..b95f594 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -719,6 +719,7 @@
        uint8_t chan_nr;
        struct osmo_phsap_prim l1sap;
        uint8_t ra;
+       uint16_t ra11;
        int rc;
 
        chan_nr = trx_chan_desc[chan].chan_nr | tn;
@@ -726,10 +727,18 @@
        LOGL1S(DL1P, LOGL_DEBUG, l1t, tn, chan, fn, "Received RACH toa=%.2f\n", 
toa);
 
        /* decode */
-       rc = gsm0503_rach_decode(&ra, bits + 8 + 41, l1t->trx->bts->bsic);
-       if (rc) {
-               LOGL1S(DL1P, LOGL_DEBUG, l1t, tn, chan, fn, "Received bad AB 
frame\n");
-               return 0;
+       rc = gsm0503_rach_ext_decode(&ra11, bits + 8 + 41, l1t->trx->bts->bsic);
+       if (rc < 0) {
+               rc = gsm0503_rach_decode(&ra, bits + 8 + 41, 
l1t->trx->bts->bsic);
+               if (rc < 0) {
+                       LOGL1S(DL1P, LOGL_DEBUG, l1t, tn, chan, fn, "Received 
bad AB frame\n");
+                       return 0;
+               }
+               l1sap.u.rach_ind.is_11bit = 0;
+               l1sap.u.rach_ind.burst_type = GSM_L1_BURST_TYPE_ACCESS_0;
+       } else {
+               l1sap.u.rach_ind.is_11bit = 1;
+               l1sap.u.rach_ind.burst_type = GSM_L1_BURST_TYPE_ACCESS_0; /* 
FIXME: determine burst_type */
        }
 
        /* compose primitive */
@@ -738,17 +747,13 @@
        osmo_prim_init(&l1sap.oph, SAP_GSM_PH, PRIM_PH_RACH, PRIM_OP_INDICATION,
                NULL);
        l1sap.u.rach_ind.chan_nr = chan_nr;
-       l1sap.u.rach_ind.ra = ra;
+       l1sap.u.rach_ind.ra = l1sap.u.rach_ind.is_11bit ? ra11 : ra;
 #ifdef TA_TEST
 #warning TIMING ADVANCE TEST-HACK IS ENABLED!!!
        toa *= 10;
 #endif
        l1sap.u.rach_ind.acc_delay = (toa >= 0) ? toa : 0;
        l1sap.u.rach_ind.fn = fn;
-
-       /* 11bit RACH is not supported for osmo-trx */
-       l1sap.u.rach_ind.is_11bit = 0;
-       l1sap.u.rach_ind.burst_type = GSM_L1_BURST_TYPE_ACCESS_0;
 
        /* forward primitive */
        l1sap_up(l1t->trx, &l1sap);

-- 
To view, visit https://gerrit.osmocom.org/6315
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia28741603636406744e5e22ffff1fb7a9689955a
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max <msur...@sysmocom.de>

Reply via email to