4 #include <osmocom/gsm/gsm48_ie.h>
6 /* collection of system information of the current cell */
8 /* frequency mask flags of frequency type */
9 #define FREQ_TYPE_SERV 0x01 /* frequency of the serving cell */
10 #define FREQ_TYPE_HOPP 0x02 /* frequency used for channel hopping */
11 #define FREQ_TYPE_NCELL 0x1c /* frequency of the neighbor cell */
12 #define FREQ_TYPE_NCELL_2 0x04 /* sub channel of SI 2 */
13 #define FREQ_TYPE_NCELL_2bis 0x08 /* sub channel of SI 2bis */
14 #define FREQ_TYPE_NCELL_2ter 0x10 /* sub channel of SI 2ter */
15 #define FREQ_TYPE_REP 0xe0 /* frequency to be reported */
16 #define FREQ_TYPE_REP_5 0x20 /* sub channel of SI 5 */
17 #define FREQ_TYPE_REP_5bis 0x40 /* sub channel of SI 5bis */
18 #define FREQ_TYPE_REP_5ter 0x80 /* sub channel of SI 5ter */
20 /* structure of all received system information */
21 struct gsm48_sysinfo
{
22 /* flags of available information */
23 uint8_t si1
, si2
, si2bis
, si2ter
, si3
,
24 si4
, si5
, si5bis
, si5ter
, si6
;
26 /* memory maps to simply detect change in system info messages */
38 struct gsm_sysinfo_freq freq
[1024]; /* all frequencies */
39 uint16_t hopping
[64]; /* hopping arfcn */
45 uint16_t mcc
, mnc
, lac
; /* LAI */
46 uint8_t max_retrans
; /* decoded */
47 uint8_t tx_integer
; /* decoded */
48 uint8_t reest_denied
; /* 1 = denied */
49 uint8_t cell_barr
; /* 1 = barred */
50 uint16_t class_barr
; /* bit 10 is emergency */
55 uint8_t band_ind
; /* set for DCS */
70 uint8_t gprs_ra_colour
;
71 uint8_t gprs_si13_pos
;
74 int8_t ms_txpwr_max_cch
;
75 int8_t cell_resel_hyst_db
;
76 int8_t rxlev_acc_min_db
;
80 uint8_t bcch_radio_link_timeout
;
84 uint8_t sacch_radio_link_timeout
;
89 uint8_t bs_ag_blks_res
;
91 uint8_t pag_mf_periods
;
92 int32_t t3212
; /* real value in seconds */
93 /* channel description */
95 uint8_t h
; /* using hopping */
99 uint8_t chan_nr
; /* type, slot, sub slot */
102 uint8_t nb_ext_ind_si2
;
103 uint8_t nb_ba_ind_si2
;
104 uint8_t nb_ext_ind_si2bis
;
105 uint8_t nb_ba_ind_si2bis
;
106 uint8_t nb_multi_rep_si2ter
; /* see GSM 05.08 8.4.3 */
107 uint8_t nb_ba_ind_si2ter
;
108 uint8_t nb_ext_ind_si5
;
109 uint8_t nb_ba_ind_si5
;
110 uint8_t nb_ext_ind_si5bis
;
111 uint8_t nb_ba_ind_si5bis
;
112 uint8_t nb_multi_rep_si5ter
;
113 uint8_t nb_ba_ind_si5ter
;
114 uint8_t nb_ncc_permitted_si2
;
115 uint8_t nb_ncc_permitted_si6
;
116 uint8_t nb_max_retrans
; /* decoded */
117 uint8_t nb_tx_integer
; /* decoded */
118 uint8_t nb_reest_denied
; /* 1 = denied */
119 uint8_t nb_cell_barr
; /* 1 = barred */
120 uint16_t nb_class_barr
; /* bit 10 is emergency */
123 char *gsm_print_arfcn(uint16_t arfcn
);
124 uint8_t gsm_refer_pcs(uint16_t arfcn
, const struct gsm48_sysinfo
*s
);
125 int gsm48_sysinfo_dump(const struct gsm48_sysinfo
*s
, uint16_t arfcn
,
126 void (*print
)(void *, const char *, ...),
127 void *priv
, uint8_t *freq_map
);
128 int gsm48_decode_lai(struct gsm48_loc_area_id
*lai
, uint16_t *mcc
,
129 uint16_t *mnc
, uint16_t *lac
);
130 int gsm48_decode_chan_h0(const struct gsm48_chan_desc
*cd
,
131 uint8_t *tsc
, uint16_t *arfcn
);
132 int gsm48_decode_chan_h1(const struct gsm48_chan_desc
*cd
,
133 uint8_t *tsc
, uint8_t *maio
, uint8_t *hsn
);
134 int gsm48_decode_sysinfo1(struct gsm48_sysinfo
*s
,
135 const struct gsm48_system_information_type_1
*si
, int len
);
136 int gsm48_decode_sysinfo2(struct gsm48_sysinfo
*s
,
137 const struct gsm48_system_information_type_2
*si
, int len
);
138 int gsm48_decode_sysinfo2bis(struct gsm48_sysinfo
*s
,
139 const struct gsm48_system_information_type_2bis
*si
, int len
);
140 int gsm48_decode_sysinfo2ter(struct gsm48_sysinfo
*s
,
141 const struct gsm48_system_information_type_2ter
*si
, int len
);
142 int gsm48_decode_sysinfo3(struct gsm48_sysinfo
*s
,
143 const struct gsm48_system_information_type_3
*si
, int len
);
144 int gsm48_decode_sysinfo4(struct gsm48_sysinfo
*s
,
145 const struct gsm48_system_information_type_4
*si
, int len
);
146 int gsm48_decode_sysinfo5(struct gsm48_sysinfo
*s
,
147 const struct gsm48_system_information_type_5
*si
, int len
);
148 int gsm48_decode_sysinfo5bis(struct gsm48_sysinfo
*s
,
149 const struct gsm48_system_information_type_5bis
*si
, int len
);
150 int gsm48_decode_sysinfo5ter(struct gsm48_sysinfo
*s
,
151 const struct gsm48_system_information_type_5ter
*si
, int len
);
152 int gsm48_decode_sysinfo6(struct gsm48_sysinfo
*s
,
153 const struct gsm48_system_information_type_6
*si
, int len
);
154 int gsm48_decode_mobile_alloc(struct gsm_sysinfo_freq
*freq
,
155 const uint8_t *ma
, uint8_t len
,
156 uint16_t *hopping
, uint8_t *hopp_len
, int si4
);
157 int gsm48_encode_lai_hex(struct gsm48_loc_area_id
*lai
,
158 uint16_t mcc
, uint16_t mnc
, uint16_t lac
);
159 int gsm48_decode_lai_hex(const struct gsm48_loc_area_id
*lai
,
160 uint16_t *mcc
, uint16_t *mnc
, uint16_t *lac
);
162 #endif /* _SYSINFO_H */