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.
This commit is contained in:
parent
2879e77bd3
commit
73a809e57b
|
@ -167,6 +167,7 @@ struct l1ctl_fbsb_req {
|
|||
uint8_t flags; /* L1CTL_FBSB_F_* */
|
||||
uint8_t sync_info_idx;
|
||||
uint8_t ccch_mode; /* enum ccch_mode */
|
||||
uint8_t rxlev_exp; /* expected signal level */
|
||||
} __attribute__((packed));
|
||||
|
||||
#define L1CTL_FBSB_F_FB0 (1 << 0)
|
||||
|
|
|
@ -42,7 +42,7 @@ int l1ctl_tx_dm_rel_req(struct osmocom_ms *ms);
|
|||
/* Transmit FBSB_REQ */
|
||||
int l1ctl_tx_fbsb_req(struct osmocom_ms *ms, uint16_t arfcn,
|
||||
uint8_t flags, uint16_t timeout, uint8_t sync_info_idx,
|
||||
uint8_t ccch_mode);
|
||||
uint8_t ccch_mode, uint8_t rxlev_exp);
|
||||
|
||||
/* Transmit CCCH_MODE_REQ */
|
||||
int l1ctl_tx_ccch_mode_req(struct osmocom_ms *ms, uint8_t ccch_mode);
|
||||
|
|
|
@ -328,7 +328,7 @@ int l1ctl_tx_data_req(struct osmocom_ms *ms, struct msgb *msg,
|
|||
/* Transmit FBSB_REQ */
|
||||
int l1ctl_tx_fbsb_req(struct osmocom_ms *ms, uint16_t arfcn,
|
||||
uint8_t flags, uint16_t timeout, uint8_t sync_info_idx,
|
||||
uint8_t ccch_mode)
|
||||
uint8_t ccch_mode, uint8_t rxlev_exp)
|
||||
{
|
||||
struct msgb *msg;
|
||||
struct l1ctl_fbsb_req *req;
|
||||
|
@ -351,6 +351,7 @@ int l1ctl_tx_fbsb_req(struct osmocom_ms *ms, uint16_t arfcn,
|
|||
req->flags = flags;
|
||||
req->sync_info_idx = sync_info_idx;
|
||||
req->ccch_mode = ccch_mode;
|
||||
req->rxlev_exp = rxlev_exp;
|
||||
|
||||
return osmo_send_l1(ms, msg);
|
||||
}
|
||||
|
|
|
@ -169,7 +169,8 @@ static int signal_cb(unsigned int subsys, unsigned int signal,
|
|||
case S_L1CTL_FBSB_ERR:
|
||||
ms = g_ms;
|
||||
return l1ctl_tx_fbsb_req(ms, ms->test_arfcn,
|
||||
L1CTL_FBSB_F_FB01SB, 100, 0, CCCH_MODE_COMBINED);
|
||||
L1CTL_FBSB_F_FB01SB, 100, 0, CCCH_MODE_COMBINED,
|
||||
dbm2rxlev(-85));
|
||||
case S_L1CTL_FBSB_RESP:
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -484,7 +484,7 @@ static int signal_cb(unsigned int subsys, unsigned int signal,
|
|||
layer3_app_reset();
|
||||
return l1ctl_tx_fbsb_req(ms, ms->test_arfcn,
|
||||
L1CTL_FBSB_F_FB01SB, 100, 0,
|
||||
CCCH_MODE_NONE);
|
||||
CCCH_MODE_NONE, dbm2rxlev(-85));
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -153,7 +153,8 @@ static int _cinfo_start_arfcn(unsigned int band_arfcn)
|
|||
/* ask L1 to try to tune to new ARFCN */
|
||||
/* FIXME: decode band */
|
||||
rc = l1ctl_tx_fbsb_req(fps.ms, band_arfcn,
|
||||
L1CTL_FBSB_F_FB01SB, 100, 0, CCCH_MODE_COMBINED);
|
||||
L1CTL_FBSB_F_FB01SB, 100, 0, CCCH_MODE_COMBINED,
|
||||
fps.arfcn_state[band_arfcn].rxlev);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
|
|
|
@ -343,7 +343,7 @@ static void start_sync(void)
|
|||
state = SCAN_STATE_SYNC;
|
||||
l1ctl_tx_reset_req(ms, L1CTL_RES_T_FULL);
|
||||
l1ctl_tx_fbsb_req(ms, arfcn, L1CTL_FBSB_F_FB01SB, 100, 0,
|
||||
CCCH_MODE_NONE);
|
||||
CCCH_MODE_NONE, pm[arfcn].rxlev);
|
||||
}
|
||||
|
||||
static void start_pm(void)
|
||||
|
|
|
@ -491,7 +491,8 @@ static int gsm322_sync_to_cell(struct gsm322_cellsel *cs,
|
|||
l1ctl_tx_reset_req(ms, L1CTL_RES_T_FULL);
|
||||
return l1ctl_tx_fbsb_req(ms, cs->arfcn,
|
||||
L1CTL_FBSB_F_FB01SB, 100, 0,
|
||||
cs->ccch_mode);
|
||||
cs->ccch_mode,
|
||||
cs->list[cs->arfci].rxlev);
|
||||
}
|
||||
|
||||
/* this is called whenever the serving cell is unselectied */
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue