summaryrefslogtreecommitdiffstats
path: root/src/host/trxcon/sched_lchan_tchf.c
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2018-03-02 21:24:57 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2018-03-02 21:24:57 +0700
commitc066787fd5e9696e4af0a43f7bd3fd9392de4931 (patch)
tree551ded65f04e9e57b990a9865a7d073942dc3554 /src/host/trxcon/sched_lchan_tchf.c
parentff233256e12b370db78af29d4b283ba5e19becfa (diff)
host/trxcon: use integer math for ToA (Timing of Arrival)
There's no need to express ToA value as a float. Let's turn it into an int16_t with 1/256 symbol period accuracy throughout the code to avoid both float arithmetic as well as loosing any precision. Inspired by Idce4178e0b1f7e940ebc22b3e2f340fcd544d4ec. Change-Id: I99c0f38db08a530d5846c474aba352aa0b68fe86
Diffstat (limited to 'src/host/trxcon/sched_lchan_tchf.c')
-rw-r--r--src/host/trxcon/sched_lchan_tchf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/host/trxcon/sched_lchan_tchf.c b/src/host/trxcon/sched_lchan_tchf.c
index 45fa1c20..b023126a 100644
--- a/src/host/trxcon/sched_lchan_tchf.c
+++ b/src/host/trxcon/sched_lchan_tchf.c
@@ -46,7 +46,7 @@
int rx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts,
struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid,
- sbit_t *bits, int8_t rssi, float toa)
+ sbit_t *bits, int8_t rssi, int16_t toa256)
{
const struct trx_lchan_desc *lchan_desc;
uint8_t rsl_cmode, tch_mode, mode;
@@ -79,9 +79,9 @@ int rx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts,
/* Update mask and RSSI */
lchan->meas.rssi_sum += rssi;
- lchan->meas.toa_sum += toa;
+ lchan->meas.toa256_sum += toa256;
lchan->meas.rssi_num++;
- lchan->meas.toa_num++;
+ lchan->meas.toa256_num++;
/* Copy burst to end of buffer of 8 bursts */
offset = buffer + bid * 116 + 464;