aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-02-19 14:21:36 +0100
committerHarald Welte <laforge@gnumonks.org>2018-02-27 19:58:20 +0100
commitd5bbd8ccf79eaf13bc23cc71accbeb3ff638b6dd (patch)
tree0f1ec34ad152ac9e7933724b35a8d342e8be2abe /include
parentb3a2a3e24f44adcc6660d33cc9684a8f24271e2e (diff)
trx/scheduler: Use integer math for TOA (Timing of Arrival)
There's no need to express TOA as a float: * We receive it as signed 16bit integer in units 1/256 symbol periods * We pass it to L1SAP as signed integer in 1/4 symbol periods So 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. Change-Id: Idce4178e0b1f7e940ebc22b3e2f340fcd544d4ec
Diffstat (limited to 'include')
-rw-r--r--include/osmo-bts/scheduler.h6
-rw-r--r--include/osmo-bts/scheduler_backend.h12
2 files changed, 9 insertions, 9 deletions
diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index 4d34315f..98f38d39 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -75,7 +75,7 @@ struct l1sched_chan_state {
uint8_t rssi_num; /* number of RSSI values */
float rssi_sum; /* sum of RSSI values */
uint8_t toa_num; /* number of TOA values */
- float toa_sum; /* sum of TOA values */
+ int32_t toa256_sum; /* sum of TOA values (1/256 symbol) */
/* loss detection */
uint8_t lost; /* (SACCH) loss detection */
@@ -113,7 +113,7 @@ struct l1sched_chan_state {
int rssi_count; /* received RSSI values */
int rssi_valid_count; /* number of stored value */
int rssi_got_burst; /* any burst received so far */
- float toa_sum; /* sum of TOA values */
+ int32_t toa256_sum; /* sum of TOA values (1/256 symbol) */
int toa_num; /* number of TOA value */
} meas;
@@ -165,7 +165,7 @@ int trx_sched_clock(struct gsm_bts *bts, uint32_t fn);
/*! \brief handle an UL burst received by PHY */
int trx_sched_ul_burst(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
- sbit_t *bits, uint16_t nbits, int8_t rssi, float toa);
+ sbit_t *bits, uint16_t nbits, int8_t rssi, int16_t toa);
/*! \brief set multiframe scheduler to given physical channel config */
int trx_sched_set_pchan(struct l1sched_trx *l1t, uint8_t tn,
diff --git a/include/osmo-bts/scheduler_backend.h b/include/osmo-bts/scheduler_backend.h
index 5e077eff..5f11f9bc 100644
--- a/include/osmo-bts/scheduler_backend.h
+++ b/include/osmo-bts/scheduler_backend.h
@@ -16,7 +16,7 @@ typedef ubit_t *trx_sched_dl_func(struct l1sched_trx *l1t, uint8_t tn,
typedef int trx_sched_ul_func(struct l1sched_trx *l1t, uint8_t tn,
uint32_t fn, enum trx_chan_type chan,
uint8_t bid, sbit_t *bits, uint16_t nbits,
- int8_t rssi, float toa);
+ int8_t rssi, int16_t toa256);
struct trx_chan_desc {
/*! \brief Is this on a PDCH (PS) ? */
@@ -74,19 +74,19 @@ ubit_t *tx_tchh_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t bid, uint16_t *nbits);
int rx_rach_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits,
- int8_t rssi, float toa);
+ int8_t rssi, int16_t toa256);
int rx_data_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits,
- int8_t rssi, float toa);
+ int8_t rssi, int16_t toa256);
int rx_pdtch_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits,
- int8_t rssi, float toa);
+ int8_t rssi, int16_t toa256);
int rx_tchf_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits,
- int8_t rssi, float toa);
+ int8_t rssi, int16_t toa256);
int rx_tchh_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits,
- int8_t rssi, float toa);
+ int8_t rssi, int16_t toa256);
const ubit_t *_sched_dl_burst(struct l1sched_trx *l1t, uint8_t tn,
uint32_t fn, uint16_t *nbits);