layer23/sysinfo: update coding style, make pointers const
[osmocom-bb.git] / src / host / layer23 / include / osmocom / bb / common / sysinfo.h
blob6a915d032fe888b63eba83597ae07d4c5c5e7d09
1 #ifndef _SYSINFO_H
2 #define _SYSINFO_H
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 */
27 uint8_t si1_msg[23];
28 uint8_t si2_msg[23];
29 uint8_t si2b_msg[23];
30 uint8_t si2t_msg[23];
31 uint8_t si3_msg[23];
32 uint8_t si4_msg[23];
33 uint8_t si5_msg[18];
34 uint8_t si5b_msg[18];
35 uint8_t si5t_msg[18];
36 uint8_t si6_msg[18];
38 struct gsm_sysinfo_freq freq[1024]; /* all frequencies */
39 uint16_t hopping[64]; /* hopping arfcn */
40 uint8_t hopp_len;
42 /* serving cell */
43 uint8_t bsic;
44 uint16_t cell_id;
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 */
52 /* si1 rest */
53 uint8_t nch;
54 uint8_t nch_position;
55 uint8_t band_ind; /* set for DCS */
57 /* si3 rest */
58 uint8_t sp;
59 uint8_t sp_cbq;
60 uint8_t sp_cro;
61 uint8_t sp_to;
62 uint8_t sp_pt;
63 uint8_t po;
64 uint8_t po_value;
65 uint8_t si2ter_ind;
66 uint8_t ecsm;
67 uint8_t sched;
68 uint8_t sched_where;
69 uint8_t gprs;
70 uint8_t gprs_ra_colour;
71 uint8_t gprs_si13_pos;
73 /* cell selection */
74 int8_t ms_txpwr_max_cch;
75 int8_t cell_resel_hyst_db;
76 int8_t rxlev_acc_min_db;
77 uint8_t neci;
78 uint8_t acs;
79 /* bcch options */
80 uint8_t bcch_radio_link_timeout;
81 uint8_t bcch_dtx;
82 uint8_t bcch_pwrc;
83 /* sacch options */
84 uint8_t sacch_radio_link_timeout;
85 uint8_t sacch_dtx;
86 uint8_t sacch_pwrc;
87 /* control channel */
88 uint8_t ccch_conf;
89 uint8_t bs_ag_blks_res;
90 uint8_t att_allowed;
91 uint8_t pag_mf_periods;
92 int32_t t3212; /* real value in seconds */
93 /* channel description */
94 uint8_t tsc;
95 uint8_t h; /* using hopping */
96 uint16_t arfcn;
97 uint8_t maio;
98 uint8_t hsn;
99 uint8_t chan_nr; /* type, slot, sub slot */
101 /* neighbor cell */
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 */