summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2012-04-04 08:30:45 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2016-09-25 08:11:49 +0200
commit95dc4911e04f1ccd9397be33e78a188a1004375c (patch)
tree8c206eac6df0444ea4c3dbc641fef48fdd3ab89a
parentd1d796a4cec7077ea44ffd9db69885f4e535da3e (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 18e6b84..23e4657 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 1702621..df4787c 100644
--- a/src/target/firmware/layer1/l23_api.c
+++ b/src/target/firmware/layer1/l23_api.c
@@ -419,6 +419,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 71e0493..6876cdc 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);