Work on Radio Ressource
authorAndreas Eversberg <jolly@eversberg.eu>
Mon, 15 Mar 2010 19:15:40 +0000 (20:15 +0100)
committerAndreas Eversberg <jolly@eversberg.eu>
Mon, 15 Mar 2010 19:15:40 +0000 (20:15 +0100)
- SI 5, 5bis, 5ter

src/host/gsm48-andreas/extra.h
src/host/gsm48-andreas/gsm48_rr.c
src/host/gsm48-andreas/sysinfo.h

index 1146753..248c376 100644 (file)
@@ -405,6 +405,21 @@ struct gsm48_system_information_type_2ter {
        uint8_t rest_octets[0];
 } __attribute__ ((packed));
 
+/* Section 9.1.38 System information Type 5bis */
+struct gsm48_system_information_type_5bis {
+        uint8_t rr_protocol_discriminator :4,
+                skip_indicator:4;
+       uint8_t system_information;
+       uint8_t bcch_frequency_list[16];
+} __attribute__ ((packed));
+
+/* Section 9.1.39 System information Type 5ter */
+struct gsm48_system_information_type_5ter {
+        uint8_t rr_protocol_discriminator :4,
+                skip_indicator:4;
+       uint8_t system_information;
+       uint8_t bcch_frequency_list[16];
+} __attribute__ ((packed));
 
 
 rsl.h:
index 5a924b8..fb3beb1 100644 (file)
@@ -1821,6 +1821,10 @@ static int gsm48_decode_mobile_alloc(struct gsm48_sysinfo *s, uint8_t *ma, uint8
        int i, j = 0;
        uint16_t f[len << 3];
 
+       /* not more than 64 hopping indexes allowed in IE */
+       if (len > 8)
+               return -EINVAL;
+
        /* tabula rasa */
        s->hopp_len = 0;
 
@@ -1903,6 +1907,11 @@ static int gsm48_decode_si3_rest(struct gsm48_sysinfo *s, uint8_t *si, uint8_t l
 {
 }
 
+/* decode "SI 4 Rest Octets" (10.5.2.35) */
+static int gsm48_decode_si4_rest(struct gsm48_sysinfo *s, uint8_t *si, uint8_t len)
+{
+}
+
 
 todo: add to unit data ind switch-case state
 /* receive "SYSTEM INFORMATION 1" message (9.1.31) */
@@ -1943,9 +1952,9 @@ static int gsm_rr_rx_sysinfo2(struct osmocom_ms *ms, struct msgb *msg)
        }
        /* Neighbor Cell Description */
        gsm48_decode_freq_list(s->freq, si->bcch_frequency_list,
-               sizeof(si->bcch_frequency_list), 0xce, FREQ_TYPE_NCELL);
+               sizeof(si->bcch_frequency_list), 0xce, FREQ_TYPE_NCELL_2);
        /* NCC Permitted */
-       s->ncc_permitted = si->ncc_permitted;
+       s->nb_ncc_permitted = si->ncc_permitted;
        /* RACH Control Parameter */
        gsm48_decode_rach_ctl_neigh(s, si->rach_control);
 
@@ -1965,10 +1974,10 @@ static int gsm_rr_rx_sysinfo2bis(struct osmocom_ms *ms, struct msgb *msg)
                return -EINVAL;
        }
        /* Neighbor Cell Description */
-       s->ext_ind = (si->bcch_frequency_list[0] >> 6) & 1;
-       s->ba_ind = (si->bcch_frequency_list[0] >> 5) & 1;
+       s->nb_ext_ind = (si->bcch_frequency_list[0] >> 6) & 1;
+       s->nb_ba_ind = (si->bcch_frequency_list[0] >> 5) & 1;
        gsm48_decode_freq_list(s->freq, si->ext_bcch_frequency_list,
-               sizeof(si->ext_bcch_frequency_list), 0x8e, FREQ_TYPE_NCELL);
+               sizeof(si->ext_bcch_frequency_list), 0x8e, FREQ_TYPE_NCELL_2bis);
        /* RACH Control Parameter */
        gsm48_decode_rach_ctl_neigh(s, si->rach_control);
 
@@ -1989,9 +1998,9 @@ static int gsm_rr_rx_sysinfo2ter(struct osmocom_ms *ms, struct msgb *msg)
                return -EINVAL;
        }
        /* Neighbor Cell Description 2 */
-       s->multi_rep = (si->bcch_frequency_list[0] >> 6) & 3;
+       s->nb_multi_rep = (si->bcch_frequency_list[0] >> 6) & 3;
        gsm48_decode_freq_list(s->freq, si->ext_bcch_frequency_list,
-               sizeof(si->ext_bcch_frequency_list), 0x8e, FREQ_TYPE_NCELL);
+               sizeof(si->ext_bcch_frequency_list), 0x8e, FREQ_TYPE_NCELL_2ter);
 
        return 0;
 }
@@ -2020,7 +2029,7 @@ static int gsm_rr_rx_sysinfo3(struct osmocom_ms *ms, struct msgb *msg)
        gsm48_decode_cell_sel_param(s, si->cell_sel_par);
        /* RACH Control Parameter */
        gsm48_decode_rach_ctl_param(s, si->rach_control);
-       /* SI 1 Rest Octets */
+       /* SI 3 Rest Octets */
        if (payload_len >= 4)
                gsm48_decode_si3_rest(si->rest_octets, payload_len);
 
@@ -2056,14 +2065,73 @@ static int gsm_rr_rx_sysinfo4(struct osmocom_ms *ms, struct msgb *msg)
        }
        /* Cell Options (BCCH) */
        gsm48_decode_cellopt(s, si->control_channel_desc);
-       /* SI 1 Rest Octets */
-       if (payload_len >= 4)
-               gsm48_decode_si3_rest(si->rest_octets, payload_len);
+       /* SI 4 Rest Octets */
+       if (payload_len >= 4 + 1 + si->data[5])
+               gsm48_decode_si3_rest(si->rest_octets,
+                       payload_len - 4 - 1 - si->data[5]);
+
+       return 0;
+}
+
+todo: frequency list and extension processing: may we delete all frequencies in this category, or just the ones from this special system information?:
+
+todo: add to unit data ind switch-case state
+/* receive "SYSTEM INFORMATION 5" message (9.1.37) */
+static int gsm_rr_rx_sysinfo5(struct osmocom_ms *ms, struct msgb *msg)
+{
+       struct gsm48_system_information_type_5 *si = msgb_l3(msg);
+       struct gsm48_sysinfo *s = ms->sysinfo;
+       int payload_len = msgb_l3len(msg) - sizeof(*si);
+
+       if (payload_len < 0) {
+               DEBUGP(DRR, "Short read of SYSTEM INFORMATION 5 message.\n");
+               return -EINVAL;
+       }
+       /* Neighbor Cell Description */
+       gsm48_decode_freq_list(s->freq, si->bcch_frequency_list,
+               sizeof(si->bcch_frequency_list), 0xce, FREQ_TYPE_REP_5);
+
+       return 0;
+}
+
+todo: add to unit data ind switch-case state
+/* receive "SYSTEM INFORMATION 5bis" message (9.1.38) */
+static int gsm_rr_rx_sysinfo5bis(struct osmocom_ms *ms, struct msgb *msg)
+{
+       struct gsm48_system_information_type_5bis *si = msgb_l3(msg);
+       struct gsm48_sysinfo *s = ms->sysinfo;
+       int payload_len = msgb_l3len(msg) - sizeof(*si);
+
+       if (payload_len < 0) {
+               DEBUGP(DRR, "Short read of SYSTEM INFORMATION 5bis message.\n");
+               return -EINVAL;
+       }
+       /* Neighbor Cell Description */
+       gsm48_decode_freq_list(s->freq, si->bcch_frequency_list,
+               sizeof(si->bcch_frequency_list), 0xce, FREQ_TYPE_REP_5bis);
+
+       return 0;
+}
+
+todo: add to unit data ind switch-case state
+/* receive "SYSTEM INFORMATION 5ter" message (9.1.39) */
+static int gsm_rr_rx_sysinfo5ter(struct osmocom_ms *ms, struct msgb *msg)
+{
+       struct gsm48_system_information_type_5ter *si = msgb_l3(msg);
+       struct gsm48_sysinfo *s = ms->sysinfo;
+       int payload_len = msgb_l3len(msg) - sizeof(*si);
+
+       if (payload_len < 0) {
+               DEBUGP(DRR, "Short read of SYSTEM INFORMATION 5ter message.\n");
+               return -EINVAL;
+       }
+       /* Neighbor Cell Description */
+       gsm48_decode_freq_list(s->freq, si->bcch_frequency_list,
+               sizeof(si->bcch_frequency_list), 0xce, FREQ_TYPE_REP_5ter);
 
        return 0;
 }
 
-today: decode mobile alloc 1-8 binary masks
 
 
 
index 8ff84c4..110433a 100644 (file)
 /* collection of system information of the current cell */
 
 /* frequency mask flags of frequency type */
-#define        FREQ_TYPE_SERV  (1 << 0)
-#define        FREQ_TYPE_NCELL (1 << 1)
+#define        FREQ_TYPE_SERV          0x01 /* frequency of the serving cell */
+#define        FREQ_TYPE_RESERVED      0x02 /* reserved for channel hopping */
+#define        FREQ_TYPE_NCELL         0x1c /* frequency of the neighbor cell */
+#define        FREQ_TYPE_NCELL_2       0x04 /* sub channel of SI 2 */
+#define        FREQ_TYPE_NCELL_2bis    0x08 /* sub channel of SI 2bis */
+#define        FREQ_TYPE_NCELL_2ter    0x10 /* sub channel of SI 2ter */
+#define        FREQ_TYPE_REP           0xe0 /* frequency to be reported */
+#define        FREQ_TYPE_REP_5         0x20 /* sub channel of SI 5 */
+#define        FREQ_TYPE_REP_5bis      0x40 /* sub channel of SI 5bis */
+#define        FREQ_TYPE_REP_5ter      0x80 /* sub channel of SI 5ter */
 
 /* structure of one frequency */
 struct gsm_sysinfo_freq {