Fixing cell selection, so it works with the current layer 1 API.

This commit is contained in:
Andreas.Eversberg 2010-05-22 09:27:33 +00:00
parent 0d53134db5
commit 6ca03ff7e6
2 changed files with 27 additions and 12 deletions

View File

@ -1421,9 +1421,8 @@ static int gsm322_cs_select(struct osmocom_ms *ms, int any)
LOGP(DCS, LOGL_INFO, "Select using access class with Emergency "
"class.\n");
} else {
acc_class = subscr->acc_class & 0xfbff; /* remove emergency */
LOGP(DCS, LOGL_INFO, "Select using access class without "
"Emergency class\n");
acc_class = subscr->acc_class;
LOGP(DCS, LOGL_INFO, "Select using access class \n");
}
/* flags to match */
@ -1595,7 +1594,7 @@ static int gsm322_cs_scan(struct osmocom_ms *ms)
"%d).\n", cs->arfcn, cs->list[cs->arfcn].rxlev_db);
cs->ccch_state = GSM322_CCCH_ST_INIT;
l1ctl_tx_fbsb_req(ms, cs->arfcn, L1CTL_FBSB_F_FB01SB, 100, 0);
start_cs_timer(cs, ms->support.sync_to, 0);
// start_cs_timer(cs, ms->support.sync_to, 0);
return 0;
}
@ -1695,7 +1694,7 @@ static int gsm322_cs_scan(struct osmocom_ms *ms)
cs->list[cs->arfcn].rxlev_db);
cs->ccch_state = GSM322_CCCH_ST_INIT;
l1ctl_tx_fbsb_req(ms, cs->arfcn, L1CTL_FBSB_F_FB01SB, 100, 0);
start_cs_timer(cs, ms->support.sync_to, 0);
// start_cs_timer(cs, ms->support.sync_to, 0);
/* Allocate/clean system information. */
cs->list[cs->arfcn].flags &= ~GSM322_CS_FLAG_SYSINFO;
@ -1710,8 +1709,12 @@ static int gsm322_cs_scan(struct osmocom_ms *ms)
cs->si = cs->list[cs->arfcn].sysinfo;
/* increase scan counter for each maximum scan range */
if (gsm_sup_smax[j].max)
if (gsm_sup_smax[j].max) {
LOGP(DCS, LOGL_INFO, "%d frequencies left in band %d..%d\n",
gsm_sup_smax[j].max - gsm_sup_smax[j].temp,
gsm_sup_smax[j].start, gsm_sup_smax[j].end);
gsm_sup_smax[j].temp++;
}
return 0;
}
@ -2212,7 +2215,7 @@ static int gsm322_cs_powerscan(struct osmocom_ms *ms)
cs->list[cs->arfcn].rxlev_db);
cs->ccch_state = GSM322_CCCH_ST_INIT;
l1ctl_tx_fbsb_req(ms, cs->arfcn, L1CTL_FBSB_F_FB01SB, 100, 0);
start_cs_timer(cs, ms->support.sync_to, 0);
// start_cs_timer(cs, ms->support.sync_to, 0);
} else
new_c_state(cs, GSM322_C0_NULL);
@ -2292,6 +2295,7 @@ static int gsm322_l1_signal(unsigned int subsys, unsigned int signal,
/* in dedicated mode */
if (ms->rrlayer.state == GSM48_RR_ST_CONN_PEND)
return gsm48_rr_tx_rand_acc(ms, NULL);
#endif
/* set timer for reading BCCH */
if (cs->state == GSM322_C2_STORED_CELL_SEL
@ -2305,10 +2309,19 @@ static int gsm322_l1_signal(unsigned int subsys, unsigned int signal,
|| cs->state == GSM322_HPLMN_SEARCH)
start_cs_timer(cs, ms->support.scan_to, 0);
// TODO: timer depends on BCCH config
#endif
}
break;
case S_L1CTL_FBSB_ERR:
ms = signal_data;
cs = &ms->cellsel;
LOGP(DCS, LOGL_INFO, "Sync error.\n");
/* tune to next cell */
gsm322_cs_scan(ms);
break;
}
return 0;
}

View File

@ -896,7 +896,7 @@ int gsm48_rr_tx_rand_acc(struct osmocom_ms *ms, struct msgb *msg)
{
struct gsm48_rrlayer *rr = &ms->rrlayer;
struct gsm322_cellsel *cs = &ms->cellsel;
struct gsm48_sysinfo *s = ms->cellsel.si;
struct gsm48_sysinfo *s = &ms->cellsel.sel_si;
struct msgb *nmsg;
struct l1ctl_info_ul *nul;
struct l1ctl_rach_req *nra;
@ -907,7 +907,8 @@ int gsm48_rr_tx_rand_acc(struct osmocom_ms *ms, struct msgb *msg)
LOGP(DRR, LOGL_INFO, "CCCH channel activation failed.\n");
if (rr->rr_est_req) {
struct msgb *msg = gsm48_rr_msgb_alloc(GSM48_RR_REL_IND);
struct msgb *msg =
gsm48_rr_msgb_alloc(GSM48_RR_REL_IND);
struct gsm48_rr_hdr *rrh;
if (!msg)
@ -3094,7 +3095,6 @@ static int gsm48_rr_unit_data_ind(struct osmocom_ms *ms, struct msgb *msg)
{
struct gsm322_cellsel *cs = &ms->cellsel;
struct abis_rsl_rll_hdr *rllh = msgb_l2(msg);
struct gsm48_sysinfo *s = ms->cellsel.si;
struct tlv_parsed tv;
DEBUGP(DRSL, "RSLms UNIT DATA IND chan_nr=0x%02x link_id=0x%02x\n",
@ -3113,13 +3113,15 @@ static int gsm48_rr_unit_data_ind(struct osmocom_ms *ms, struct msgb *msg)
/* when camping, start/reset loss timer */
if (cs->state == GSM322_C3_CAMPED_NORMALLY
|| cs->state == GSM322_C7_CAMPED_ANY_CELL)
|| cs->state == GSM322_C7_CAMPED_ANY_CELL) {
struct gsm48_sysinfo *s = &ms->cellsel.sel_si;
#ifdef TODO
set radio link timeout on layer 1
it is the number of subsequent BCCH blocks. (about 1/4 seconds)
#else
start_loss_timer(cs, s->bcch_radio_link_timeout / 4, 0);
#endif
}
/* temporary moved here until confirm is fixed */
if (cs->ccch_state != GSM322_CCCH_ST_DATA) {