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
This commit is contained in:
parent
9473699229
commit
4bc4655bd6
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue