summaryrefslogtreecommitdiffstats
path: root/src/host/trxcon/sched_trx.h
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_trx.h
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_trx.h')
-rw-r--r--src/host/trxcon/sched_trx.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/host/trxcon/sched_trx.h b/src/host/trxcon/sched_trx.h
index b01624c8..856566c4 100644
--- a/src/host/trxcon/sched_trx.h
+++ b/src/host/trxcon/sched_trx.h
@@ -82,7 +82,7 @@ enum trx_lchan_type {
typedef int trx_lchan_rx_func(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);
+ int8_t rssi, int16_t toa256);
typedef int trx_lchan_tx_func(struct trx_instance *trx,
struct trx_ts *ts, struct trx_lchan_state *lchan,
@@ -174,9 +174,9 @@ struct trx_lchan_state {
/*! \brief Sum of RSSI values */
float rssi_sum;
/*! \brief Number of TOA values */
- uint8_t toa_num;
+ uint8_t toa256_num;
/*! \brief Sum of TOA values */
- float toa_sum;
+ int32_t toa256_sum;
} meas;
/* AMR specific */
@@ -286,7 +286,8 @@ void sched_prim_drop(struct trx_lchan_state *lchan);
void sched_prim_flush_queue(struct llist_head *list);
int sched_trx_handle_rx_burst(struct trx_instance *trx, uint8_t tn,
- uint32_t burst_fn, sbit_t *bits, uint16_t nbits, int8_t rssi, float toa);
+ uint32_t burst_fn, sbit_t *bits, uint16_t nbits,
+ int8_t rssi, int16_t toa256);
int sched_trx_handle_tx_burst(struct trx_instance *trx,
struct trx_ts *ts, struct trx_lchan_state *lchan,
uint32_t fn, ubit_t *bits);