Sylvain Munaut | 12ba778 | 2014-06-16 10:13:40 +0200 | [diff] [blame] | 1 | #pragma once |
Harald Welte | b550313 | 2011-05-24 15:01:53 +0200 | [diff] [blame] | 2 | |
Harald Welte | 5bed23c | 2016-03-17 16:50:27 +0100 | [diff] [blame] | 3 | #include <stdbool.h> |
Harald Welte | ee50081 | 2011-06-05 19:53:56 +0200 | [diff] [blame] | 4 | #include <osmocom/core/utils.h> |
Harald Welte | b550313 | 2011-05-24 15:01:53 +0200 | [diff] [blame] | 5 | #include <osmocom/gsm/protocol/gsm_04_08.h> |
| 6 | |
Max | 03309b5 | 2016-03-17 11:51:09 +0100 | [diff] [blame] | 7 | #define OSMO_EARFCN_INVALID 666 |
| 8 | #define OSMO_EARFCN_MEAS_INVALID 0xff |
| 9 | |
Harald Welte | b550313 | 2011-05-24 15:01:53 +0200 | [diff] [blame] | 10 | enum osmo_sysinfo_type { |
| 11 | SYSINFO_TYPE_NONE, |
| 12 | SYSINFO_TYPE_1, |
| 13 | SYSINFO_TYPE_2, |
| 14 | SYSINFO_TYPE_3, |
| 15 | SYSINFO_TYPE_4, |
| 16 | SYSINFO_TYPE_5, |
| 17 | SYSINFO_TYPE_6, |
| 18 | SYSINFO_TYPE_7, |
| 19 | SYSINFO_TYPE_8, |
| 20 | SYSINFO_TYPE_9, |
| 21 | SYSINFO_TYPE_10, |
| 22 | SYSINFO_TYPE_13, |
| 23 | SYSINFO_TYPE_16, |
| 24 | SYSINFO_TYPE_17, |
| 25 | SYSINFO_TYPE_18, |
| 26 | SYSINFO_TYPE_19, |
| 27 | SYSINFO_TYPE_20, |
| 28 | SYSINFO_TYPE_2bis, |
| 29 | SYSINFO_TYPE_2ter, |
| 30 | SYSINFO_TYPE_2quater, |
| 31 | SYSINFO_TYPE_5bis, |
| 32 | SYSINFO_TYPE_5ter, |
Harald Welte | 620f7ab | 2011-06-25 21:39:18 +0200 | [diff] [blame] | 33 | SYSINFO_TYPE_EMO, |
| 34 | SYSINFO_TYPE_MEAS_INFO, |
Harald Welte | b550313 | 2011-05-24 15:01:53 +0200 | [diff] [blame] | 35 | /* FIXME all the various bis and ter */ |
| 36 | _MAX_SYSINFO_TYPE |
| 37 | }; |
| 38 | |
Max | ea345cd | 2016-03-17 14:46:19 +0100 | [diff] [blame] | 39 | struct osmo_earfcn_si2q { |
Max | 03309b5 | 2016-03-17 11:51:09 +0100 | [diff] [blame] | 40 | /* EARFCN (16 bits) array */ |
| 41 | uint16_t *arfcn; |
| 42 | /* Measurement Bandwidth (3 bits), might be absent |
| 43 | (OSMO_EARFCN_MEAS_INVALID is stored in this case) */ |
| 44 | uint8_t *meas_bw; |
| 45 | /* length of arfcn and meas_bw arrays (got to be the same) */ |
| 46 | size_t length; |
| 47 | /* THRESH_E-UTRAN_high (5 bits) */ |
| 48 | uint8_t thresh_hi; |
| 49 | /* THRESH_E-UTRAN_low (5 bits) */ |
| 50 | uint8_t thresh_lo; |
| 51 | /* E-UTRAN_PRIORITY (3 bits) */ |
| 52 | uint8_t prio; |
| 53 | /* E-UTRAN_QRXLEVMIN */ |
| 54 | uint8_t qrxlm; |
| 55 | /* indicates whether thresh_lo value is valid |
| 56 | thresh_hi is mandatory and hence always considered valid */ |
| 57 | bool thresh_lo_valid; |
| 58 | /* indicates whether prio value is valid */ |
| 59 | bool prio_valid; |
| 60 | /* indicates whether qrxlm value is valid */ |
| 61 | bool qrxlm_valid; |
| 62 | }; |
| 63 | |
Harald Welte | b550313 | 2011-05-24 15:01:53 +0200 | [diff] [blame] | 64 | typedef uint8_t sysinfo_buf_t[GSM_MACBLOCK_LEN]; |
| 65 | |
| 66 | extern const struct value_string osmo_sitype_strs[_MAX_SYSINFO_TYPE]; |
Max | ea345cd | 2016-03-17 14:46:19 +0100 | [diff] [blame] | 67 | int osmo_earfcn_add(struct osmo_earfcn_si2q *e, uint16_t arfcn, uint8_t meas_bw); |
| 68 | int osmo_earfcn_del(struct osmo_earfcn_si2q *e, uint16_t arfcn); |
Max | fbb8bfa | 2016-04-15 16:04:04 +0200 | [diff] [blame] | 69 | size_t osmo_earfcn_bit_size(const struct osmo_earfcn_si2q *e); |
Max | ea345cd | 2016-03-17 14:46:19 +0100 | [diff] [blame] | 70 | void osmo_earfcn_init(struct osmo_earfcn_si2q *e); |
Alexander Huemer | 4d7bcea | 2011-09-05 00:30:16 +0200 | [diff] [blame] | 71 | uint8_t osmo_sitype2rsl(enum osmo_sysinfo_type si_type); |
Harald Welte | b550313 | 2011-05-24 15:01:53 +0200 | [diff] [blame] | 72 | enum osmo_sysinfo_type osmo_rsl2sitype(uint8_t rsl_si); |