libosmogsm
0.11.0-dirty
Osmocom GSM library
|
00001 00003 #pragma once 00004 00005 #include <stdbool.h> 00006 00007 #include <osmocom/core/defs.h> 00008 #include <osmocom/core/utils.h> 00009 #include <osmocom/gsm/protocol/gsm_04_08.h> 00010 00011 #define OSMO_EARFCN_INVALID 666 00012 #define OSMO_EARFCN_MEAS_INVALID 0xff 00013 00014 enum osmo_sysinfo_type { 00015 SYSINFO_TYPE_NONE, 00016 SYSINFO_TYPE_1, 00017 SYSINFO_TYPE_2, 00018 SYSINFO_TYPE_3, 00019 SYSINFO_TYPE_4, 00020 SYSINFO_TYPE_5, 00021 SYSINFO_TYPE_6, 00022 SYSINFO_TYPE_7, 00023 SYSINFO_TYPE_8, 00024 SYSINFO_TYPE_9, 00025 SYSINFO_TYPE_10, 00026 SYSINFO_TYPE_13, 00027 SYSINFO_TYPE_16, 00028 SYSINFO_TYPE_17, 00029 SYSINFO_TYPE_18, 00030 SYSINFO_TYPE_19, 00031 SYSINFO_TYPE_20, 00032 SYSINFO_TYPE_2bis, 00033 SYSINFO_TYPE_2ter, 00034 SYSINFO_TYPE_2quater, 00035 SYSINFO_TYPE_5bis, 00036 SYSINFO_TYPE_5ter, 00037 SYSINFO_TYPE_EMO, 00038 SYSINFO_TYPE_MEAS_INFO, 00039 SYSINFO_TYPE_13alt, 00040 SYSINFO_TYPE_15, 00041 SYSINFO_TYPE_2n, 00042 SYSINFO_TYPE_21, 00043 SYSINFO_TYPE_22, 00044 SYSINFO_TYPE_23, 00045 _MAX_SYSINFO_TYPE 00046 }; 00047 00048 struct osmo_earfcn_si2q { 00049 /* EARFCN (16 bits) array */ 00050 uint16_t *arfcn; 00051 /* Measurement Bandwidth (3 bits), might be absent 00052 (OSMO_EARFCN_MEAS_INVALID is stored in this case) */ 00053 uint8_t *meas_bw; 00054 /* length of arfcn and meas_bw arrays (got to be the same) */ 00055 size_t length; 00056 /* THRESH_E-UTRAN_high (5 bits) */ 00057 uint8_t thresh_hi; 00058 /* THRESH_E-UTRAN_low (5 bits) */ 00059 uint8_t thresh_lo; 00060 /* E-UTRAN_PRIORITY (3 bits) */ 00061 uint8_t prio; 00062 /* E-UTRAN_QRXLEVMIN */ 00063 uint8_t qrxlm; 00064 /* indicates whether thresh_lo value is valid 00065 thresh_hi is mandatory and hence always considered valid */ 00066 bool thresh_lo_valid; 00067 /* indicates whether prio value is valid */ 00068 bool prio_valid; 00069 /* indicates whether qrxlm value is valid */ 00070 bool qrxlm_valid; 00071 }; 00072 00073 typedef uint8_t sysinfo_buf_t[GSM_MACBLOCK_LEN]; 00074 00075 extern const struct value_string osmo_sitype_strs[_MAX_SYSINFO_TYPE]; 00076 int osmo_earfcn_add(struct osmo_earfcn_si2q *e, uint16_t arfcn, uint8_t meas_bw); 00077 int osmo_earfcn_del(struct osmo_earfcn_si2q *e, uint16_t arfcn); 00078 size_t osmo_earfcn_bit_size(const struct osmo_earfcn_si2q *e) OSMO_DEPRECATED("Use osmo_earfcn_bit_size_ext()instead."); 00079 size_t osmo_earfcn_bit_size_ext(const struct osmo_earfcn_si2q *e, size_t offset); 00080 void osmo_earfcn_init(struct osmo_earfcn_si2q *e); 00081 uint8_t osmo_sitype2rsl(enum osmo_sysinfo_type si_type); 00082 enum osmo_sysinfo_type osmo_rsl2sitype(uint8_t rsl_si);