diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/osmo-bts-trx/scheduler_trx.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c index 294e73cb..7bdbc4f9 100644 --- a/src/osmo-bts-trx/scheduler_trx.c +++ b/src/osmo-bts-trx/scheduler_trx.c @@ -982,8 +982,11 @@ int rx_pdtch_fn(struct l1sched_trx *l1t, enum trx_chan_type chan, 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 @@ int rx_pdtch_fn(struct l1sched_trx *l1t, enum trx_chan_type chan, *rssi_num = 0; *toa256_sum = 0; *toa_num = 0; + *ci_cb_sum = 0; + *ci_cb_num = 0; } /* update mask + rssi */ @@ -1016,6 +1021,12 @@ int rx_pdtch_fn(struct l1sched_trx *l1t, enum trx_chan_type chan, *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 @@ int rx_pdtch_fn(struct l1sched_trx *l1t, enum trx_chan_type chan, 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 */ |