More fixes on layer3.
authorAndreas.Eversberg <jolly@eversberg.eu>
Sun, 2 May 2010 17:40:52 +0000 (17:40 +0000)
committerAndreas.Eversberg <jolly@eversberg.eu>
Sun, 2 May 2010 17:40:52 +0000 (17:40 +0000)
The current code will scan frequencies, select a cell and camps on it.
No SIM is inserted. Paging requests and Immediate assginments can be seen.

When inserting a SIM card (uncomment it in app_mobile.c), location update
is triggered after selecting a cell. The RACH request is sent, an
Immediate assignment is received, the dedicated mode is requested.
Nothing happens then, because no confirm / abort of layer 2 is received.

src/host/layer23/include/osmocom/gsm322.h
src/host/layer23/src/gsm322.c
src/host/layer23/src/gsm48_mm.c
src/host/layer23/src/support.c

index bc807e5..0159972 100755 (executable)
@@ -183,7 +183,7 @@ int gsm322_is_forbidden_plmn(struct osmocom_ms *ms, uint16_t mcc, uint16_t mnc);
 int gsm322_is_forbidden_la(struct osmocom_ms *ms, uint16_t mcc, uint16_t mnc,
        uint16_t lac);
 int gsm322_dump_sorted_plmn(struct osmocom_ms *ms);
-int gsm322_dump_cs_list(struct osmocom_ms *ms);
+int gsm322_dump_cs_list(struct osmocom_ms *ms, uint8_t flag);
 int gsm322_dump_sim_plmn(struct osmocom_ms *ms);
 int gsm322_dump_forbidden_plmn(struct osmocom_ms *ms);
 int gsm322_dump_forbidden_la(struct osmocom_ms *ms);
index 0d74e6b..b96f011 100755 (executable)
@@ -45,9 +45,9 @@ static int gsm322_m_switch_on(struct osmocom_ms *ms, struct msgb *msg);
 
 
 #warning HACK to stay on one channel
+static int already = 0;
 int l1ctl_tx_ccch_req_(struct osmocom_ms *ms, uint16_t arfcn)
 {
-       static int already = 0;
 
        if (!already) {
                already = 1;
@@ -1482,7 +1482,7 @@ static int gsm322_cs_scan(struct osmocom_ms *ms)
        cs->scan_state = weight;
 
        if (!weight)
-               gsm322_dump_cs_list(ms);
+               gsm322_dump_cs_list(ms, GSM322_CS_FLAG_SYSINFO);
 
        /* special negative case for HPLMN search */
        if (cs->state == GSM322_HPLMN_SEARCH && !weight) {
@@ -1787,8 +1787,10 @@ static int gsm322_c_camp_sysinfo_bcch(struct osmocom_ms *ms, struct msgb *msg)
          || (s->si2bis && s->si2ter && s->nb_ext_ind_si2
                && s->nb_ext_ind_si2bis))) {
                if (cs->selected) {
-                       LOGP(DCS, LOGL_INFO, "Selected sysinfo is updated.\n");
+                       LOGP(DCS, LOGL_INFO, "Sysinfo of selected cell is "
+                               "updated.\n");
                        memcpy(&cs->sel_si, s, sizeof(cs->sel_si));
+                       gsm48_sysinfo_dump(ms, s);
                }
        }
 
@@ -1856,6 +1858,7 @@ static int gsm322_c_scan_sysinfo_bcch(struct osmocom_ms *ms, struct msgb *msg)
          || (s->si2bis && s->nb_ext_ind_si2 && !s->nb_ext_ind_si2bis)
          || (s->si2bis && s->si2ter && s->nb_ext_ind_si2
                && s->nb_ext_ind_si2bis))) {
+               LOGP(DCS, LOGL_INFO, "Received relevant sysinfo.\n");
                /* stop timer */
                stop_cs_timer(cs);
 
@@ -1922,10 +1925,14 @@ static int gsm322_cs_powerscan(struct osmocom_ms *ms)
        }
 
 #warning testing
-cs->list[10].rxlev_db = -50;
-cs->list[10].flags |= GSM322_CS_FLAG_POWER;
-cs->list[10].flags |= GSM322_CS_FLAG_SIGNAL;
+if (already) s = -1;
+#if 0
+cs->list[ms->test_arfcn].rxlev_db = -50;
+cs->list[ms->test_arfcn].flags |= GSM322_CS_FLAG_POWER;
+cs->list[ms->test_arfcn].flags |= GSM322_CS_FLAG_SIGNAL;
 s = -1;
+#endif
+
        /* if there is no more frequency, we can tune to that cell */
        if (s < 0) {
                int found = 0;
@@ -2720,7 +2727,7 @@ int gsm322_dump_sorted_plmn(struct osmocom_ms *ms)
        return 0;
 }
 
-int gsm322_dump_cs_list(struct osmocom_ms *ms)
+int gsm322_dump_cs_list(struct osmocom_ms *ms, uint8_t flags)
 {
        struct gsm322_cellsel *cs = &ms->cellsel;
        int i, j;
@@ -2730,7 +2737,7 @@ int gsm322_dump_cs_list(struct osmocom_ms *ms)
                "-------+-------+-------+-------+-----------------------+"
                "-------+-------\n");
        for (i = 0; i <= 1023; i++) {
-               if (!(cs->list[i].flags & GSM322_CS_FLAG_SIGNAL))
+               if (!(cs->list[i].flags & flags))
                        continue;
                printf("%4d   |", cs->list[i].rxlev_db);
                if ((cs->list[i].flags & GSM322_CS_FLAG_SYSINFO)) {
index e82b7a2..2d05622 100644 (file)
@@ -2398,7 +2398,7 @@ static int gsm48_mm_loc_upd_failed(struct osmocom_ms *ms)
 
        /* start update retry timer (RR connection is released) */
        if (mm->lupd_attempt < 4)
-               mm->start_t3211;
+               mm->start_t3211 = 1;
 
        /* CS process will trigger: return to MM IDLE */
        return 0;
index b9ff803..29317d7 100644 (file)
@@ -118,7 +118,7 @@ struct gsm_support_scan_max gsm_sup_smax[] = {
        { 955, 124, 30, 0 },
        { 512, 885, 40, 0 },
 #else
-       { 955, 125, 3, 0 }, /* testing */
+       { 955, 125, 1, 0 }, /* we support only one ARFCN */
 #endif
        { 0, 0, 0, 0 }
 };