fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/14613


Change subject: osmo-bts/scheduler: provide actual C/I values to OsmoPCU
......................................................................

osmo-bts/scheduler: provide actual C/I values to OsmoPCU

Change-Id: Ia58043bd2381a4d34d604522e02899ae64ee0d26
Fixes: OS#1855
---
M include/osmo-bts/scheduler.h
M src/osmo-bts-trx/scheduler_trx.c
2 files changed, 18 insertions(+), 3 deletions(-)



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

diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index 4f40636..e693e3e 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -79,11 +79,13 @@
        uint32_t                ul_first_fn;    /* fn of first burst */
        uint8_t                 ul_mask;        /* mask of received bursts */

-       /* RSSI / TOA */
+       /* measurements */
        uint8_t                 rssi_num;       /* number of RSSI values */
        float                   rssi_sum;       /* sum of RSSI values */
        uint8_t                 toa_num;        /* number of TOA values */
        int32_t                 toa256_sum;     /* sum of TOA values (1/256 
symbol) */
+       uint8_t                 ci_cb_num;      /* number of C/I values */
+       int32_t                 ci_cb_sum;      /* sum of C/I values (in 
centiBels) */

        /* loss detection */
        uint8_t                 lost_frames;    /* how many L2 frames were lost 
*/
diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index 294e73c..7bdbc4f 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -982,8 +982,11 @@
        uint8_t *rssi_num = &chan_state->rssi_num;
        int32_t *toa256_sum = &chan_state->toa256_sum;
        uint8_t *toa_num = &chan_state->toa_num;
+       int32_t *ci_cb_sum = &chan_state->ci_cb_sum;
+       uint8_t *ci_cb_num = &chan_state->ci_cb_num;
        uint8_t l2[EGPRS_0503_MAX_BYTES];
        int n_errors, n_bursts_bits, n_bits_total;
+       int16_t lqual_cb;
        uint16_t ber10k;
        int rc;

@@ -1007,6 +1010,8 @@
                *rssi_num = 0;
                *toa256_sum = 0;
                *toa_num = 0;
+               *ci_cb_sum = 0;
+               *ci_cb_num = 0;
        }

        /* update mask + rssi */
@@ -1016,6 +1021,12 @@
        *toa256_sum += bi->toa256;
        (*toa_num)++;

+       /* C/I: Carrier-to-Interference ratio (in centiBels) */
+       if (bi->flags & TRX_BI_F_CI_CB) {
+               *ci_cb_sum += bi->ci_cb;
+               (*ci_cb_num)++;
+       }
+
        /* copy burst to buffer of 4 bursts */
        if (bi->burst_len == EGPRS_BURST_LEN) {
                burst = *bursts_p + bid * 348;
@@ -1069,13 +1080,15 @@
                        bi->fn % l1ts->mf_period, l1ts->mf_period);
                return 0;
        }
+
+       lqual_cb = *ci_cb_num ? (*ci_cb_sum / *ci_cb_num) : 0;
        ber10k = compute_ber10k(n_bits_total, n_errors);
        return _sched_compose_ph_data_ind(l1t, bi->tn,
                                          *first_fn, chan, l2, rc,
                                          *rssi_sum / *rssi_num,
                                          *toa256_sum / *toa_num,
-                                         0 /* FIXME: AVG C/I */,
-                                         ber10k, PRES_INFO_BOTH);
+                                         lqual_cb, ber10k,
+                                         PRES_INFO_BOTH);
 }

 /*! \brief a single TCH/F burst was received by the PHY, process it */

--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/14613
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ia58043bd2381a4d34d604522e02899ae64ee0d26
Gerrit-Change-Number: 14613
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>
Gerrit-MessageType: newchange

Reply via email to