summaryrefslogtreecommitdiffstats
path: root/src/target
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-11-20 10:13:44 +0100
committerHarald Welte <laforge@gnumonks.org>2012-11-20 10:13:44 +0100
commit73a809e57b8a531b9b8a33b6841ed3df2ea22620 (patch)
tree76effaeb610b2394769991614fd54e5802e292ab /src/target
parent2879e77bd3720f261330dad2ef7f14d6a0988421 (diff)
Tell L1CTL_FBSB_REQ the expected received signal level
As Dieter points out, this drastically improves the resiliance to high receive levels on the C155. We cannot blindly assume a received signal level of -85 dBm if the BTS is 2m away and we actually receive -40 dBm. This patch extends the L1CTL_FBSB_REQ data structure in layer 1 with the respective field, as well as the l1ctl_tx_fbsb_req() API function called from the various layer23 apps. "mobile" and "bcch_scan" already did a PM request and thus know the expected signal power. "ccch_scan" and "cbch_sniff" apparently don't do, so the -85 dBm constant is now hardcoded into the host-side source code there, and should probably be fixed in a follow-up patch.
Diffstat (limited to 'src/target')
-rw-r--r--src/target/firmware/layer1/prim_fbsb.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/target/firmware/layer1/prim_fbsb.c b/src/target/firmware/layer1/prim_fbsb.c
index e849240b..19b0e0dc 100644
--- a/src/target/firmware/layer1/prim_fbsb.c
+++ b/src/target/firmware/layer1/prim_fbsb.c
@@ -375,7 +375,7 @@ static int l1s_fbdet_cmd(__unused uint8_t p1, __unused uint8_t p2,
l1s.fb.mode = fb_mode;
/* Tell the RF frontend to set the gain appropriately */
- rffe_compute_gain(-85, CAL_DSP_TGT_BB_LVL);
+ rffe_compute_gain(rxlev2dbm(fbs.req.rxlev_exp), CAL_DSP_TGT_BB_LVL);
/* Program DSP */
dsp_api.db_w->d_task_md = FB_DSP_TASK; /* maybe with I/Q swap? */
@@ -548,6 +548,7 @@ void l1s_fbsb_req(uint8_t base_fn, struct l1ctl_fbsb_req *req)
fbs.req.num_freqerr_avg = req->num_freqerr_avg;
fbs.req.flags = req->flags;
fbs.req.sync_info_idx = req->sync_info_idx;
+ fbs.req.rxlev_exp = req->rxlev_exp;
/* clear initial frequency error */
fbs.initial_freq_err = 0;