blob: 11bb268206aefd1489e486e9bfd46b3eefb5ad7b [file] [log] [blame]
Neels Hofmeyr17518fe2017-06-20 04:35:06 +02001/*! \file sysinfo.h */
2
Sylvain Munaut12ba7782014-06-16 10:13:40 +02003#pragma once
Harald Welteb5503132011-05-24 15:01:53 +02004
Harald Welte5bed23c2016-03-17 16:50:27 +01005#include <stdbool.h>
Max91dd2192017-05-11 15:38:10 +02006
7#include <osmocom/core/defs.h>
Harald Welteee500812011-06-05 19:53:56 +02008#include <osmocom/core/utils.h>
Harald Welteb5503132011-05-24 15:01:53 +02009#include <osmocom/gsm/protocol/gsm_04_08.h>
10
Max03309b52016-03-17 11:51:09 +010011#define OSMO_EARFCN_INVALID 666
12#define OSMO_EARFCN_MEAS_INVALID 0xff
13
Harald Welteb5503132011-05-24 15:01:53 +020014enum osmo_sysinfo_type {
15 SYSINFO_TYPE_NONE,
16 SYSINFO_TYPE_1,
17 SYSINFO_TYPE_2,
18 SYSINFO_TYPE_3,
19 SYSINFO_TYPE_4,
20 SYSINFO_TYPE_5,
21 SYSINFO_TYPE_6,
22 SYSINFO_TYPE_7,
23 SYSINFO_TYPE_8,
24 SYSINFO_TYPE_9,
25 SYSINFO_TYPE_10,
26 SYSINFO_TYPE_13,
27 SYSINFO_TYPE_16,
28 SYSINFO_TYPE_17,
29 SYSINFO_TYPE_18,
30 SYSINFO_TYPE_19,
31 SYSINFO_TYPE_20,
32 SYSINFO_TYPE_2bis,
33 SYSINFO_TYPE_2ter,
34 SYSINFO_TYPE_2quater,
35 SYSINFO_TYPE_5bis,
36 SYSINFO_TYPE_5ter,
Harald Welte620f7ab2011-06-25 21:39:18 +020037 SYSINFO_TYPE_EMO,
38 SYSINFO_TYPE_MEAS_INFO,
Harald Welte5ade8f42017-07-15 19:20:36 +020039 SYSINFO_TYPE_13alt,
40 SYSINFO_TYPE_15,
41 SYSINFO_TYPE_2n,
42 SYSINFO_TYPE_21,
43 SYSINFO_TYPE_22,
44 SYSINFO_TYPE_23,
Harald Welteb5503132011-05-24 15:01:53 +020045 _MAX_SYSINFO_TYPE
46};
47
Maxea345cd2016-03-17 14:46:19 +010048struct osmo_earfcn_si2q {
Max03309b52016-03-17 11:51:09 +010049 /* EARFCN (16 bits) array */
50 uint16_t *arfcn;
51 /* Measurement Bandwidth (3 bits), might be absent
52 (OSMO_EARFCN_MEAS_INVALID is stored in this case) */
53 uint8_t *meas_bw;
54 /* length of arfcn and meas_bw arrays (got to be the same) */
55 size_t length;
56 /* THRESH_E-UTRAN_high (5 bits) */
57 uint8_t thresh_hi;
58 /* THRESH_E-UTRAN_low (5 bits) */
59 uint8_t thresh_lo;
60 /* E-UTRAN_PRIORITY (3 bits) */
61 uint8_t prio;
62 /* E-UTRAN_QRXLEVMIN */
63 uint8_t qrxlm;
64 /* indicates whether thresh_lo value is valid
65 thresh_hi is mandatory and hence always considered valid */
66 bool thresh_lo_valid;
67 /* indicates whether prio value is valid */
68 bool prio_valid;
69 /* indicates whether qrxlm value is valid */
70 bool qrxlm_valid;
71};
72
Harald Welteb5503132011-05-24 15:01:53 +020073typedef uint8_t sysinfo_buf_t[GSM_MACBLOCK_LEN];
74
75extern const struct value_string osmo_sitype_strs[_MAX_SYSINFO_TYPE];
Maxea345cd2016-03-17 14:46:19 +010076int osmo_earfcn_add(struct osmo_earfcn_si2q *e, uint16_t arfcn, uint8_t meas_bw);
77int osmo_earfcn_del(struct osmo_earfcn_si2q *e, uint16_t arfcn);
Max91dd2192017-05-11 15:38:10 +020078size_t osmo_earfcn_bit_size(const struct osmo_earfcn_si2q *e) OSMO_DEPRECATED("Use osmo_earfcn_bit_size_ext()instead.");
79size_t osmo_earfcn_bit_size_ext(const struct osmo_earfcn_si2q *e, size_t offset);
Maxea345cd2016-03-17 14:46:19 +010080void osmo_earfcn_init(struct osmo_earfcn_si2q *e);
Alexander Huemer4d7bcea2011-09-05 00:30:16 +020081uint8_t osmo_sitype2rsl(enum osmo_sysinfo_type si_type);
Harald Welteb5503132011-05-24 15:01:53 +020082enum osmo_sysinfo_type osmo_rsl2sitype(uint8_t rsl_si);