summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2012-04-04 08:30:45 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2015-12-25 09:33:12 +0100
commit27d23c414c2546c7a3eceb5716e4e3044ef701a7 (patch)
treed5e95b9b389214e2d25bb0dbea290cc7f687636f
parentf639c99100614cf3132228cc47241f2db05ca11a (diff)
layer1: Retry fist power measurement, if it seems to fail
In some cases (e.g. after a call with TCH) the first power measurement after a full reset will always return 0 (-110dbm). In this case the measurment is repeated once again. This is just a workarround, and it will not fix the actual cause.
-rw-r--r--src/target/firmware/include/layer1/sync.h1
-rw-r--r--src/target/firmware/layer1/l23_api.c1
-rw-r--r--src/target/firmware/layer1/prim_pm.c9
3 files changed, 11 insertions, 0 deletions
diff --git a/src/target/firmware/include/layer1/sync.h b/src/target/firmware/include/layer1/sync.h
index 18e6b84b..23e46578 100644
--- a/src/target/firmware/include/layer1/sync.h
+++ b/src/target/firmware/include/layer1/sync.h
@@ -101,6 +101,7 @@ struct l1s_state {
struct {
/* power measurement l1 task */
unsigned int mode;
+ unsigned int first;
union {
struct {
uint16_t arfcn_start;
diff --git a/src/target/firmware/layer1/l23_api.c b/src/target/firmware/layer1/l23_api.c
index b57cf2c4..de56e9fe 100644
--- a/src/target/firmware/layer1/l23_api.c
+++ b/src/target/firmware/layer1/l23_api.c
@@ -420,6 +420,7 @@ static void l1ctl_rx_pm_req(struct msgb *msg)
switch (pm_req->type) {
case 1:
+ l1s.pm.first = 1;
l1s.pm.mode = 1;
l1s.pm.range.arfcn_start =
ntohs(pm_req->range.band_arfcn_from);
diff --git a/src/target/firmware/layer1/prim_pm.c b/src/target/firmware/layer1/prim_pm.c
index 71e04939..6876cdc9 100644
--- a/src/target/firmware/layer1/prim_pm.c
+++ b/src/target/firmware/layer1/prim_pm.c
@@ -94,6 +94,15 @@ static int l1s_pm_resp(uint8_t num_meas, __unused uint8_t p2,
printf("PM MEAS: ARFCN=%u, %-4d dBm at baseband, %-4d dBm at RF\n",
arfcn, pm_level[0]/8, agc_inp_dbm8_by_pm(pm_level[0])/8);
+ /* If the first measurement seems to fail, try once again */
+ if (l1s.pm.first) {
+ l1s.pm.first = 0;
+ if (pm_level[0] == 0) {
+ l1s_pm_test(1, l1s.pm.range.arfcn_next);
+ return 0;
+ }
+ }
+
printd("PM MEAS: %-4d dBm, %-4d dBm ARFCN=%u\n",
agc_inp_dbm8_by_pm(pm_level[0])/8,
agc_inp_dbm8_by_pm(pm_level[1])/8, arfcn);