summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas.Eversberg2010-05-09 11:40:41 +0200
committerAndreas.Eversberg2010-05-09 11:40:41 +0200
commitacd570fff8ba3b7e378e690eb41acb68f107677f (patch)
tree4c4311ea0be5af387f0cfd643aa6b86417d85686 /src
parentAdded some "get"-functions to bitvec of libosmocore. (diff)
downloadosmocom-acd570fff8ba3b7e378e690eb41acb68f107677f.tar.gz
osmocom-acd570fff8ba3b7e378e690eb41acb68f107677f.tar.xz
osmocom-acd570fff8ba3b7e378e690eb41acb68f107677f.zip
Added SI3 rest octets to RR layer. Now a cell can be qualified:
- Low prio - High prio - Barred
Diffstat (limited to 'src')
-rw-r--r--src/host/layer23/include/osmocom/sysinfo.h16
-rwxr-xr-xsrc/host/layer23/src/gsm322.c47
-rw-r--r--src/host/layer23/src/gsm48_rr.c40
-rw-r--r--src/host/layer23/src/sysinfo.c8
4 files changed, 95 insertions, 16 deletions
diff --git a/src/host/layer23/include/osmocom/sysinfo.h b/src/host/layer23/include/osmocom/sysinfo.h
index 24ca983..cc73283 100644
--- a/src/host/layer23/include/osmocom/sysinfo.h
+++ b/src/host/layer23/include/osmocom/sysinfo.h
@@ -51,6 +51,22 @@ struct gsm48_sysinfo {
uint8_t reest_denied; /* 1 = denied */
uint8_t cell_barr; /* 1 = barred */
uint16_t class_barr; /* bit 10 is emergency */
+
+ /* si3 rest */
+ uint8_t sp;
+ uint8_t sp_cbq;
+ uint8_t sp_cro;
+ uint8_t sp_to;
+ uint8_t sp_pt;
+ uint8_t po;
+ uint8_t po_value;
+ uint8_t si2ter_ind;
+ uint8_t ecsm;
+ uint8_t sched;
+ uint8_t sched_where;
+ uint8_t gi_ra_colour;
+ uint8_t gi_si13_pos;
+
/* cell selection */
int8_t ms_txpwr_max_ccch;
int8_t cell_resel_hyst_db;
diff --git a/src/host/layer23/src/gsm322.c b/src/host/layer23/src/gsm322.c
index 43ff5ef..efac401 100755
--- a/src/host/layer23/src/gsm322.c
+++ b/src/host/layer23/src/gsm322.c
@@ -603,9 +603,10 @@ static int gsm322_sort_list(struct osmocom_ms *ms)
found = NULL;
llist_for_each_entry(temp, &temp_list, entry) {
if (temp->mcc == cs->list[i].sysinfo->mcc
- && temp->mnc == cs->list[i].sysinfo->mnc)
+ && temp->mnc == cs->list[i].sysinfo->mnc) {
found = temp;
break;
+ }
}
/* update or create */
if (found) {
@@ -716,7 +717,7 @@ static int gsm322_sort_list(struct osmocom_ms *ms)
break;
}
}
- LOGP(DPLMN, LOGL_INFO, "Crating Sorted PLMN list. "
+ LOGP(DPLMN, LOGL_INFO, "Creating Sorted PLMN list. "
"(%02d: mcc=%03d mnc=%02d allowed=%s rx-lev=%d)\n",
i, temp->mcc, temp->mnc, (temp->cause) ? "no ":"yes",
temp->rxlev_db);
@@ -1197,11 +1198,22 @@ static int gsm322_m_go_not_on_plmn(struct osmocom_ms *ms, struct msgb *msg)
/* display PLMNs and to Not on PLMN */
static int gsm322_m_display_plmns(struct osmocom_ms *ms, struct msgb *msg)
{
+ struct gsm322_plmn *plmn = &ms->plmn;
+ struct gsm_sub_plmn_list *temp;
+
/* generate list */
gsm322_sort_list(ms);
#ifdef TODO
display PLMNs to user
+#else
+ printf("\nSelect from Network:\n");
+
+ llist_for_each_entry(temp, &plmn->sorted_plmn, entry)
+ printf("Network %03d, %02d (%s, %s)\n", temp->mcc, temp->mnc,
+ gsm_get_mcc(temp->mcc),
+ gsm_get_mnc(temp->mcc, temp->mnc));
+ printf("\n");
#endif
/* go Not on PLMN state */
@@ -1597,6 +1609,10 @@ static int gsm322_cs_scan(struct osmocom_ms *ms)
if (cs->state == GSM322_PLMN_SEARCH && !weight) {
struct msgb *nmsg;
+ /* create AA flag */
+ cs->mcc = cs->mnc = 0;
+ gsm322_cs_select(ms, 0);
+
nmsg = gsm322_msgb_alloc(GSM322_EVENT_PLMN_SEARCH_END);
LOGP(DCS, LOGL_INFO, "PLMN search finished.\n");
if (!nmsg)
@@ -1766,7 +1782,9 @@ static int gsm322_cs_store(struct osmocom_ms *ms)
/* store sysinfo */
cs->list[cs->arfcn].flags |= GSM322_CS_FLAG_SYSINFO;
- if (s->cell_barr)
+ if (s->cell_barr
+ && !(cs->list[cs->arfcn].sysinfo && cs->list[cs->arfcn].sysinfo->sp &&
+ cs->list[cs->arfcn].sysinfo->sp_cbq))
cs->list[cs->arfcn].flags |= GSM322_CS_FLAG_BARRED;
else
cs->list[cs->arfcn].flags &= ~GSM322_CS_FLAG_BARRED;
@@ -1845,8 +1863,7 @@ static int gsm322_cs_store(struct osmocom_ms *ms)
case PLMN_MODE_AUTO:
if (plmn->state == GSM322_A4_WAIT_FOR_PLMN) {
/* PLMN becomes available */
- nmsg = gsm322_msgb_alloc(
- GSM322_EVENT_PLMN_AVAIL);
+ nmsg = gsm322_msgb_alloc( GSM322_EVENT_PLMN_AVAIL);
if (!nmsg)
return -ENOMEM;
gsm322_plmn_sendmsg(ms, nmsg);
@@ -1857,8 +1874,7 @@ static int gsm322_cs_store(struct osmocom_ms *ms)
&& gsm322_is_plmn_avail(cs, plmn->mcc,
plmn->mnc)) {
/* PLMN becomes available */
- nmsg = gsm322_msgb_alloc(
- GSM322_EVENT_PLMN_AVAIL);
+ nmsg = gsm322_msgb_alloc( GSM322_EVENT_PLMN_AVAIL);
if (!nmsg)
return -ENOMEM;
gsm322_plmn_sendmsg(ms, nmsg);
@@ -2473,8 +2489,9 @@ static int gsm322_c_any_cell_sel(struct osmocom_ms *ms, struct msgb *msg)
struct gsm322_cellsel *cs = &ms->cellsel;
int i;
- /* in case we already tried any cell selection, power scan again */
- if (cs->state == GSM322_C6_ANY_CELL_SEL) {
+ /* in case we already tried any cell (re-)selection, power scan again */
+ if (cs->state == GSM322_C6_ANY_CELL_SEL
+ || cs->state == GSM322_C8_ANY_CELL_RESEL) {
struct msgb *nmsg;
/* tell that we have no cell found */
@@ -3061,7 +3078,7 @@ int gsm322_dump_cs_list(struct osmocom_ms *ms, uint8_t flags)
int i, j;
struct gsm48_sysinfo *s;
- printf("rx-lev |MCC |MNC |forb.LA|barred,0123456789abcdef|"
+ printf("rx-lev |MCC |MNC |forb.LA|prio ,0123456789abcdef|"
"min-db |max-pwr\n"
"-------+-------+-------+-------+-----------------------+"
"-------+-------\n");
@@ -3077,9 +3094,13 @@ int gsm322_dump_cs_list(struct osmocom_ms *ms, uint8_t flags)
else
printf("no |");
if ((cs->list[i].flags & GSM322_CS_FLAG_BARRED))
- printf("yes ");
- else
- printf("no ");
+ printf("barred ");
+ else {
+ if (cs->list[i].sysinfo->cell_barr)
+ printf("low ");
+ else
+ printf("high ");
+ }
for (j = 0; j < 16; j++) {
if ((s->class_barr & (1 << j)))
printf("*");
diff --git a/src/host/layer23/src/gsm48_rr.c b/src/host/layer23/src/gsm48_rr.c
index 7357bd9..383bb4a 100644
--- a/src/host/layer23/src/gsm48_rr.c
+++ b/src/host/layer23/src/gsm48_rr.c
@@ -1608,6 +1608,39 @@ static int gsm48_decode_si1_rest(struct gsm48_sysinfo *s, uint8_t *si,
static int gsm48_decode_si3_rest(struct gsm48_sysinfo *s, uint8_t *si,
uint8_t len)
{
+ struct bitvec bv;
+
+ memset(&bv, 0, sizeof(bv));
+ bv.data_len = len;
+ bv.data = si;
+
+ /* Optional Selection Parameters */
+ if (bitvec_get_bit_high(&bv) == H) {
+ s->sp = 1;
+ s->sp_cbq = bitvec_get_uint(&bv, 1);
+ s->sp_cro = bitvec_get_uint(&bv, 6);
+ s->sp_to = bitvec_get_uint(&bv, 3);
+ s->sp_pt = bitvec_get_uint(&bv, 5);
+ }
+ /* Optional Power Offset */
+ if (bitvec_get_bit_high(&bv) == H) {
+ s->po = 1;
+ s->po_value = bitvec_get_uint(&bv, 3);
+ }
+ /* System Onformation 2ter Indicator */
+ if (bitvec_get_bit_high(&bv) == H)
+ s->si2ter_ind = 1;
+ /* Early Classark Sending Control */
+ if (bitvec_get_bit_high(&bv) == H)
+ s->ecsm = 1;
+ /* Scheduling if and where */
+ if (bitvec_get_bit_high(&bv) == H) {
+ s->sched = 1;
+ s->sched_where = bitvec_get_uint(&bv, 3);
+ }
+ /* GPRS Indicator */
+ s->gi_ra_colour = bitvec_get_uint(&bv, 3);
+ s->gi_si13_pos = bitvec_get_uint(&bv, 1);
return 0;
}
@@ -3081,7 +3114,12 @@ 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)
- start_loss_timer(cs, s->bcch_radio_link_timeout, 0);
+#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) {
diff --git a/src/host/layer23/src/sysinfo.c b/src/host/layer23/src/sysinfo.c
index 8769a8e..1a656be 100644
--- a/src/host/layer23/src/sysinfo.c
+++ b/src/host/layer23/src/sysinfo.c
@@ -103,7 +103,11 @@ int gsm48_sysinfo_dump(struct osmocom_ms *ms, struct gsm48_sysinfo *s)
if ((s->class_barr & (1 << i)))
printf(" C%d", i);
}
- printf("\n\n");
+ printf("\n");
+ if (s->sp)
+ printf(" CBQ = %d CRO = %d TEMP_OFFSET = %d PENALTY_TIME "
+ "= %d\n", s->sp_cbq, s->sp_cro, s->sp_to, s->sp_pt);
+ printf("\n");
/* neighbor cell */
printf("Neighbor Cell:\n");
@@ -151,7 +155,7 @@ int gsm48_sysinfo_dump(struct osmocom_ms *ms, struct gsm48_sysinfo *s)
default:
printf("CCCH Config = reserved");
}
- printf("BS-PA-MFMS = %d Attachment = %s\n",
+ printf(" BS-PA-MFMS = %d Attachment = %s\n",
s->pag_mf_periods, (s->att_allowed) ? "allowed" : "denied");
printf("BS-AG_BLKS_RES = %d\n", s->bs_ag_blks_res);