blob: e2fc09d903de8dd74370c56cfb0bc3e2906f35ab [file] [log] [blame]
Sylvain Munaut12ba7782014-06-16 10:13:40 +02001#pragma once
Harald Welteb5503132011-05-24 15:01:53 +02002
Harald Welteee500812011-06-05 19:53:56 +02003#include <osmocom/core/utils.h>
Harald Welteb5503132011-05-24 15:01:53 +02004#include <osmocom/gsm/protocol/gsm_04_08.h>
5
Max03309b52016-03-17 11:51:09 +01006#define OSMO_EARFCN_INVALID 666
7#define OSMO_EARFCN_MEAS_INVALID 0xff
8
Harald Welteb5503132011-05-24 15:01:53 +02009enum osmo_sysinfo_type {
10 SYSINFO_TYPE_NONE,
11 SYSINFO_TYPE_1,
12 SYSINFO_TYPE_2,
13 SYSINFO_TYPE_3,
14 SYSINFO_TYPE_4,
15 SYSINFO_TYPE_5,
16 SYSINFO_TYPE_6,
17 SYSINFO_TYPE_7,
18 SYSINFO_TYPE_8,
19 SYSINFO_TYPE_9,
20 SYSINFO_TYPE_10,
21 SYSINFO_TYPE_13,
22 SYSINFO_TYPE_16,
23 SYSINFO_TYPE_17,
24 SYSINFO_TYPE_18,
25 SYSINFO_TYPE_19,
26 SYSINFO_TYPE_20,
27 SYSINFO_TYPE_2bis,
28 SYSINFO_TYPE_2ter,
29 SYSINFO_TYPE_2quater,
30 SYSINFO_TYPE_5bis,
31 SYSINFO_TYPE_5ter,
Harald Welte620f7ab2011-06-25 21:39:18 +020032 SYSINFO_TYPE_EMO,
33 SYSINFO_TYPE_MEAS_INFO,
Harald Welteb5503132011-05-24 15:01:53 +020034 /* FIXME all the various bis and ter */
35 _MAX_SYSINFO_TYPE
36};
37
Maxea345cd2016-03-17 14:46:19 +010038struct osmo_earfcn_si2q {
Max03309b52016-03-17 11:51:09 +010039 /* EARFCN (16 bits) array */
40 uint16_t *arfcn;
41 /* Measurement Bandwidth (3 bits), might be absent
42 (OSMO_EARFCN_MEAS_INVALID is stored in this case) */
43 uint8_t *meas_bw;
44 /* length of arfcn and meas_bw arrays (got to be the same) */
45 size_t length;
46 /* THRESH_E-UTRAN_high (5 bits) */
47 uint8_t thresh_hi;
48 /* THRESH_E-UTRAN_low (5 bits) */
49 uint8_t thresh_lo;
50 /* E-UTRAN_PRIORITY (3 bits) */
51 uint8_t prio;
52 /* E-UTRAN_QRXLEVMIN */
53 uint8_t qrxlm;
54 /* indicates whether thresh_lo value is valid
55 thresh_hi is mandatory and hence always considered valid */
56 bool thresh_lo_valid;
57 /* indicates whether prio value is valid */
58 bool prio_valid;
59 /* indicates whether qrxlm value is valid */
60 bool qrxlm_valid;
61};
62
Harald Welteb5503132011-05-24 15:01:53 +020063typedef uint8_t sysinfo_buf_t[GSM_MACBLOCK_LEN];
64
65extern const struct value_string osmo_sitype_strs[_MAX_SYSINFO_TYPE];
Maxea345cd2016-03-17 14:46:19 +010066int osmo_earfcn_add(struct osmo_earfcn_si2q *e, uint16_t arfcn, uint8_t meas_bw);
67int osmo_earfcn_del(struct osmo_earfcn_si2q *e, uint16_t arfcn);
68void osmo_earfcn_init(struct osmo_earfcn_si2q *e);
Alexander Huemer4d7bcea2011-09-05 00:30:16 +020069uint8_t osmo_sitype2rsl(enum osmo_sysinfo_type si_type);
Harald Welteb5503132011-05-24 15:01:53 +020070enum osmo_sysinfo_type osmo_rsl2sitype(uint8_t rsl_si);