summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2013-02-27 10:38:01 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2013-02-27 10:38:01 +0100
commit048153214be27965aed121092906db7559db7bba (patch)
treec39c9718ae1f814be014ab940749cdd45b89610f
parent15f2dfa3b328fea56e55c823a5ce5060619741fb (diff)
Calypso BTS sends RSSI with each received bust
-rw-r--r--include/l1ctl_proto.h1
-rw-r--r--src/target/firmware/layer1/prim_bts.c7
2 files changed, 8 insertions, 0 deletions
diff --git a/include/l1ctl_proto.h b/include/l1ctl_proto.h
index 97b24db5..b92ccf11 100644
--- a/include/l1ctl_proto.h
+++ b/include/l1ctl_proto.h
@@ -329,6 +329,7 @@ struct l1ctl_bts_burst_nb_ind {
uint32_t fn;
uint8_t tn;
uint8_t toa;
+ int8_t rssi;
uint8_t data[15];
} __attribute__((packed));
diff --git a/src/target/firmware/layer1/prim_bts.c b/src/target/firmware/layer1/prim_bts.c
index d02fa068..2f121bf9 100644
--- a/src/target/firmware/layer1/prim_bts.c
+++ b/src/target/firmware/layer1/prim_bts.c
@@ -171,6 +171,7 @@ l1s_bts_resp(uint8_t p1, uint8_t p2, uint16_t p3)
else if (db->rx[0].cmd == DSP_EXT_RX_CMD_NB)
{
uint16_t *d = &db->data[32];
+ int rssi = agc_inp_dbm8_by_pm(d[1] >> 3) / 8;
if (d[3] > 0x1000) {
struct msgb *msg;
@@ -195,6 +196,12 @@ l1s_bts_resp(uint8_t p1, uint8_t p2, uint16_t p3)
/* TOA */
bi->toa = d[0];
+ /* RSSI */
+ if (rssi < -110)
+ bi->rssi = -110;
+ else if (rssi < 0)
+ bi->rssi = rssi;
+
/* Pack bits */
memset(bi->data, 0x00, sizeof(bi->data));