Stefan Sperling | bd6e7a9 | 2018-07-27 15:17:09 +0200 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <stdbool.h> |
| 4 | #include <osmocom/gsm/sysinfo.h> |
| 5 | #include <osmocom/gprs/protocol/gsm_04_60.h> |
| 6 | |
| 7 | /* 16 is the max. number of SI2quater messages according to 3GPP TS 44.018 Table 10.5.2.33b.1: |
| 8 | 4-bit index is used (2#1111 = 10#15) */ |
| 9 | #define SI2Q_MAX_NUM 16 |
| 10 | /* length in bits (for single SI2quater message) */ |
| 11 | #define SI2Q_MAX_LEN 160 |
| 12 | #define SI2Q_MIN_LEN 18 |
| 13 | |
| 14 | /* generate SI1 rest octets */ |
| 15 | int osmo_gsm48_rest_octets_si1(uint8_t *data, uint8_t *nch_pos, int is1800_net); |
| 16 | int osmo_gsm48_rest_octets_si2quater(uint8_t *data, uint8_t si2q_index, uint8_t si2q_count, const uint16_t *uarfcn_list, |
| 17 | size_t *u_offset, size_t uarfcn_length, uint16_t *scramble_list, |
| 18 | struct osmo_earfcn_si2q *si2quater_neigh_list, size_t *e_offset); |
| 19 | int osmo_gsm48_rest_octets_si2ter(uint8_t *data); |
| 20 | int osmo_gsm48_rest_octets_si2bis(uint8_t *data); |
| 21 | int osmo_gsm48_rest_octets_si6(uint8_t *data, bool is1800_net); |
| 22 | |
| 23 | struct osmo_gsm48_si_selection_params { |
| 24 | uint16_t penalty_time:5, |
| 25 | temp_offs:3, |
| 26 | cell_resel_off:6, |
| 27 | cbq:1, |
| 28 | present:1; |
| 29 | }; |
| 30 | |
| 31 | struct osmo_gsm48_si_power_offset { |
| 32 | uint8_t power_offset:2, |
| 33 | present:1; |
| 34 | }; |
| 35 | |
| 36 | struct osmo_gsm48_si3_gprs_ind { |
| 37 | uint8_t si13_position:1, |
| 38 | ra_colour:3, |
| 39 | present:1; |
| 40 | }; |
| 41 | |
| 42 | struct osmo_gsm48_lsa_params { |
| 43 | uint32_t prio_thr:3, |
| 44 | lsa_offset:3, |
| 45 | mcc:12, |
| 46 | mnc:12; |
| 47 | unsigned int present; |
| 48 | }; |
| 49 | |
| 50 | struct osmo_gsm48_si_ro_info { |
| 51 | struct osmo_gsm48_si_selection_params selection_params; |
| 52 | struct osmo_gsm48_si_power_offset power_offset; |
| 53 | bool si2ter_indicator; |
| 54 | bool early_cm_ctrl; |
| 55 | struct { |
| 56 | uint8_t where:3, |
| 57 | present:1; |
| 58 | } scheduling; |
| 59 | struct osmo_gsm48_si3_gprs_ind gprs_ind; |
| 60 | /* SI 3 specific */ |
| 61 | bool early_cm_restrict_3g; |
| 62 | bool si2quater_indicator; |
| 63 | /* SI 4 specific */ |
| 64 | struct osmo_gsm48_lsa_params lsa_params; |
| 65 | uint16_t cell_id; |
| 66 | uint8_t break_ind; /* do we have SI7 + SI8 ? */ |
| 67 | }; |
| 68 | |
| 69 | /* Generate SI3 Rest Octests (Chapter 10.5.2.34 / Table 10.4.72) */ |
| 70 | int osmo_gsm48_rest_octets_si3(uint8_t *data, const struct osmo_gsm48_si_ro_info *si3); |
| 71 | |
| 72 | /* Generate SI4 Rest Octets (Chapter 10.5.2.35) */ |
| 73 | int osmo_gsm48_rest_octets_si4(uint8_t *data, const struct osmo_gsm48_si_ro_info *si4, int len); |
| 74 | |
| 75 | struct osmo_gsm48_si13_info { |
| 76 | struct osmo_gprs_cell_options cell_opts; |
| 77 | struct osmo_gprs_power_ctrl_pars pwr_ctrl_pars; |
| 78 | uint8_t bcch_change_mark; |
| 79 | uint8_t si_change_field; |
| 80 | uint8_t rac; |
| 81 | uint8_t spgc_ccch_sup; |
| 82 | uint8_t net_ctrl_ord; |
| 83 | uint8_t prio_acc_thr; |
| 84 | }; |
| 85 | |
| 86 | /* Generate SI13 Rest Octests (Chapter 10.5.2.37b) */ |
| 87 | int osmo_gsm48_rest_octets_si13(uint8_t *data, const struct osmo_gsm48_si13_info *si13); |