summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2019-01-21 14:58:25 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2019-02-21 17:20:36 +0700
commit4bc4655bd64f191d402d5c176d92cd053d939deb (patch)
tree2cea9434d5ca9cb02140f86c0d667ce6d0326548
parent947369922990195bccb59cae88cccbd7eefac9c8 (diff)
trxcon/scheduler: count number of measurements
Instead of counting both RSSI and ToA measurements separately, let's have a single counter in trx_lchan_state.meas struct. Change-Id: I45454a3ac92b8cc85dd74092e4ab6eb350f20c9a
-rw-r--r--src/host/trxcon/sched_lchan_common.c4
-rw-r--r--src/host/trxcon/sched_lchan_pdtch.c3
-rw-r--r--src/host/trxcon/sched_lchan_tchf.c3
-rw-r--r--src/host/trxcon/sched_lchan_tchh.c3
-rw-r--r--src/host/trxcon/sched_lchan_xcch.c3
-rw-r--r--src/host/trxcon/sched_trx.h6
6 files changed, 8 insertions, 14 deletions
diff --git a/src/host/trxcon/sched_lchan_common.c b/src/host/trxcon/sched_lchan_common.c
index 921c466..615d81c 100644
--- a/src/host/trxcon/sched_lchan_common.c
+++ b/src/host/trxcon/sched_lchan_common.c
@@ -99,9 +99,9 @@ int sched_send_dt_ind(struct trx_instance *trx, struct trx_ts *ts,
dl_hdr.num_biterr = bit_error_count;
/* Convert average RSSI to RX level */
- if (lchan->meas.rssi_num) {
+ if (lchan->meas.num) {
/* RX level: 0 .. 63 in typical GSM notation (dBm + 110) */
- dbm_avg = lchan->meas.rssi_sum / lchan->meas.rssi_num;
+ dbm_avg = lchan->meas.rssi_sum / lchan->meas.num;
dl_hdr.rx_level = dbm2rxlev(dbm_avg);
} else {
/* No measurements, assuming the worst */
diff --git a/src/host/trxcon/sched_lchan_pdtch.c b/src/host/trxcon/sched_lchan_pdtch.c
index aa9cb6a..845ef64 100644
--- a/src/host/trxcon/sched_lchan_pdtch.c
+++ b/src/host/trxcon/sched_lchan_pdtch.c
@@ -75,8 +75,7 @@ int rx_pdtch_fn(struct trx_instance *trx, struct trx_ts *ts,
/* Update measurements */
lchan->meas.toa256_sum += toa256;
lchan->meas.rssi_sum += rssi;
- lchan->meas.toa256_num++;
- lchan->meas.rssi_num++;
+ lchan->meas.num++;
/* Copy burst to buffer of 4 bursts */
offset = buffer + bid * 116;
diff --git a/src/host/trxcon/sched_lchan_tchf.c b/src/host/trxcon/sched_lchan_tchf.c
index 5bebe49..cec7daf 100644
--- a/src/host/trxcon/sched_lchan_tchf.c
+++ b/src/host/trxcon/sched_lchan_tchf.c
@@ -77,8 +77,7 @@ int rx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts,
/* Update mask and RSSI */
lchan->meas.rssi_sum += rssi;
lchan->meas.toa256_sum += toa256;
- lchan->meas.rssi_num++;
- lchan->meas.toa256_num++;
+ lchan->meas.num++;
/* Copy burst to end of buffer of 8 bursts */
offset = buffer + bid * 116 + 464;
diff --git a/src/host/trxcon/sched_lchan_tchh.c b/src/host/trxcon/sched_lchan_tchh.c
index 5b7daa3..172f54b 100644
--- a/src/host/trxcon/sched_lchan_tchh.c
+++ b/src/host/trxcon/sched_lchan_tchh.c
@@ -243,8 +243,7 @@ int rx_tchh_fn(struct trx_instance *trx, struct trx_ts *ts,
*/
lchan->meas.rssi_sum += rssi;
lchan->meas.toa256_sum += toa256;
- lchan->meas.rssi_num++;
- lchan->meas.toa256_num++;
+ lchan->meas.num++;
/* Copy burst to the end of buffer of 6 bursts */
offset = buffer + bid * 116 + 464;
diff --git a/src/host/trxcon/sched_lchan_xcch.c b/src/host/trxcon/sched_lchan_xcch.c
index 825fc58..71eb38d 100644
--- a/src/host/trxcon/sched_lchan_xcch.c
+++ b/src/host/trxcon/sched_lchan_xcch.c
@@ -74,8 +74,7 @@ int rx_data_fn(struct trx_instance *trx, struct trx_ts *ts,
/* Update measurements */
lchan->meas.rssi_sum += rssi;
lchan->meas.toa256_sum += toa256;
- lchan->meas.rssi_num++;
- lchan->meas.toa256_num++;
+ lchan->meas.num++;
/* Copy burst to buffer of 4 bursts */
offset = buffer + bid * 116;
diff --git a/src/host/trxcon/sched_trx.h b/src/host/trxcon/sched_trx.h
index f914eee..72d9549 100644
--- a/src/host/trxcon/sched_trx.h
+++ b/src/host/trxcon/sched_trx.h
@@ -181,12 +181,10 @@ struct trx_lchan_state {
uint8_t ul_facch_blocks;
struct {
- /*! \brief Number of RSSI values */
- uint8_t rssi_num;
+ /*! \brief Number of measurements */
+ unsigned int num;
/*! \brief Sum of RSSI values */
float rssi_sum;
- /*! \brief Number of TOA values */
- uint8_t toa256_num;
/*! \brief Sum of TOA values */
int32_t toa256_sum;
} meas;