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


Change subject: osmo-bts-trx/scheduler: rx_data_fn(): provide actual C/I ratio 
to L1SAP
......................................................................

osmo-bts-trx/scheduler: rx_data_fn(): provide actual C/I ratio to L1SAP

Change-Id: Iea0dad65e9bc511f99375fd3ee2eb44e47a6168f
---
M src/osmo-bts-trx/scheduler_trx.c
1 file changed, 13 insertions(+), 2 deletions(-)



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

diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index 5a24dda..327ee6e 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -889,6 +889,8 @@
        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[GSM_MACBLOCK_LEN], l2_len;
        int n_errors, n_bits_total;
        uint16_t ber10k;
@@ -917,6 +919,8 @@
                *rssi_num = 0;
                *toa256_sum = 0;
                *toa_num = 0;
+               *ci_cb_sum = 0;
+               *ci_cb_num = 0;
        }

        /* update mask + RSSI */
@@ -926,6 +930,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 */
        burst = *bursts_p + bid * 116;
        memcpy(burst, bi->burst + 3, 58);
@@ -971,13 +981,14 @@
                              n_errors, n_bits_total,
                              *rssi_sum / *rssi_num,
                              *toa256_sum / *toa_num);
+       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, l2_len,
                                          *rssi_sum / *rssi_num,
                                          *toa256_sum / *toa_num,
-                                         0 /* FIXME: AVG C/I */,
-                                         ber10k, PRES_INFO_UNKNOWN);
+                                         lqual_cb, ber10k,
+                                         PRES_INFO_UNKNOWN);
 }

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

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

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

Reply via email to