blob: 7b324d3ff89fee307457dac9ed043f18a0983bb0 [file] [log] [blame]
Harald Weltea43f7892009-12-01 18:04:30 +05301#ifndef _REST_OCTETS_H
2#define _REST_OCTETS_H
3
Max59a1bf32016-04-15 16:04:46 +02004#include <stdbool.h>
Harald Weltea43f7892009-12-01 18:04:30 +05305#include <openbsc/gsm_04_08.h>
Max59a1bf32016-04-15 16:04:46 +02006#include <osmocom/gsm/sysinfo.h>
Harald Weltea43f7892009-12-01 18:04:30 +05307
Max6f0e50c2017-04-12 15:30:54 +02008/* 16 is the max. number of SI2quater messages according to 3GPP TS 44.018: 4-bit index is used */
9#define SI2Q_MAX_NUM 16
10/* length in bits (for single SI2quater message) */
Max26679e02016-04-20 15:57:13 +020011#define SI2Q_MAX_LEN 160
12#define SI2Q_MIN_LEN 18
13
Harald Weltea43f7892009-12-01 18:04:30 +053014/* generate SI1 rest octets */
Holger Hans Peter Freytherf876c392013-03-06 12:02:33 +010015int rest_octets_si1(uint8_t *data, uint8_t *nch_pos, int is1800_net);
Maxf39d03a2017-05-12 17:00:30 +020016int rest_octets_si2quater(uint8_t *data, struct gsm_bts *bts);
Holger Hans Peter Freyther82dd9832016-05-17 23:20:03 +020017int rest_octets_si6(uint8_t *data, bool is1800_net);
Harald Weltea43f7892009-12-01 18:04:30 +053018
19struct gsm48_si_selection_params {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020020 uint16_t penalty_time:5,
Harald Weltea43f7892009-12-01 18:04:30 +053021 temp_offs:3,
22 cell_resel_off:6,
23 cbq:1,
24 present:1;
25};
26
27struct gsm48_si_power_offset {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020028 uint8_t power_offset:2,
Harald Weltea43f7892009-12-01 18:04:30 +053029 present:1;
30};
31
32struct gsm48_si3_gprs_ind {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020033 uint8_t si13_position:1,
Harald Weltea43f7892009-12-01 18:04:30 +053034 ra_colour:3,
35 present:1;
36};
37
38struct gsm48_lsa_params {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020039 uint32_t prio_thr:3,
Harald Weltea43f7892009-12-01 18:04:30 +053040 lsa_offset:3,
41 mcc:12,
42 mnc:12;
43 unsigned int present;
44};
45
46struct gsm48_si_ro_info {
47 struct gsm48_si_selection_params selection_params;
48 struct gsm48_si_power_offset power_offset;
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020049 uint8_t si2ter_indicator;
50 uint8_t early_cm_ctrl;
Harald Weltea43f7892009-12-01 18:04:30 +053051 struct {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020052 uint8_t where:3,
Harald Weltea43f7892009-12-01 18:04:30 +053053 present:1;
54 } scheduling;
55 struct gsm48_si3_gprs_ind gprs_ind;
Maxf3f35052016-04-15 16:04:44 +020056 /* SI 3 specific */
57 uint8_t si2quater_indicator;
Harald Weltea43f7892009-12-01 18:04:30 +053058 /* SI 4 specific */
59 struct gsm48_lsa_params lsa_params;
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020060 uint16_t cell_id;
61 uint8_t break_ind; /* do we have SI7 + SI8 ? */
Harald Weltea43f7892009-12-01 18:04:30 +053062};
63
64
65/* Generate SI3 Rest Octests (Chapter 10.5.2.34 / Table 10.4.72) */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020066int rest_octets_si3(uint8_t *data, const struct gsm48_si_ro_info *si3);
Harald Weltea43f7892009-12-01 18:04:30 +053067
68/* Generate SI4 Rest Octets (Chapter 10.5.2.35) */
Holger Hans Peter Freyther7ff77ec2010-12-29 23:06:22 +010069int rest_octets_si4(uint8_t *data, const struct gsm48_si_ro_info *si4, int len);
Harald Weltea43f7892009-12-01 18:04:30 +053070
71enum pbcch_carrier_type {
72 PBCCH_BCCH,
73 PBCCH_ARFCN,
74 PBCCH_MAIO
75};
76
77/* TS 03.60 Chapter 6.3.3.1: Network Mode of Operation */
78enum gprs_nmo {
79 GPRS_NMO_I = 0, /* CS pagin on GPRS paging or traffic channel */
80 GPRS_NMO_II = 1, /* all paging on CCCH */
81 GPRS_NMO_III = 2, /* no paging coordination */
82};
83
Harald Welteda0586a2010-04-18 14:49:05 +020084/* TS 04.60 12.24 */
Harald Weltea43f7892009-12-01 18:04:30 +053085struct gprs_cell_options {
86 enum gprs_nmo nmo;
87 /* T3168: wait for packet uplink assignment message */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020088 uint32_t t3168; /* in milliseconds */
Harald Weltea43f7892009-12-01 18:04:30 +053089 /* T3192: wait for release of the TBF after reception of the final block */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020090 uint32_t t3192; /* in milliseconds */
91 uint32_t drx_timer_max;/* in seconds */
92 uint32_t bs_cv_max;
bhargava350533c2016-07-21 11:14:34 +053093 uint8_t supports_egprs_11bit_rach;
Max292ec582016-07-28 11:55:37 +020094 bool ctrl_ack_type_use_block; /* use PACKET CONTROL ACKNOWLEDGMENT */
Harald Welteda0586a2010-04-18 14:49:05 +020095
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020096 uint8_t ext_info_present;
Harald Welteda0586a2010-04-18 14:49:05 +020097 struct {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020098 uint8_t egprs_supported;
99 uint8_t use_egprs_p_ch_req;
100 uint8_t bep_period;
101 uint8_t pfc_supported;
102 uint8_t dtm_supported;
103 uint8_t bss_paging_coordination;
Harald Welteda0586a2010-04-18 14:49:05 +0200104 } ext_info;
Harald Weltea43f7892009-12-01 18:04:30 +0530105};
106
107/* TS 04.60 Table 12.9.2 */
108struct gprs_power_ctrl_pars {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200109 uint8_t alpha;
110 uint8_t t_avg_w;
111 uint8_t t_avg_t;
112 uint8_t pc_meas_chan;
113 uint8_t n_avg_i;
Harald Weltea43f7892009-12-01 18:04:30 +0530114};
115
116struct gsm48_si13_info {
117 struct gprs_cell_options cell_opts;
118 struct gprs_power_ctrl_pars pwr_ctrl_pars;
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200119 uint8_t bcch_change_mark;
120 uint8_t si_change_field;
121 uint8_t pbcch_present;
Harald Weltea43f7892009-12-01 18:04:30 +0530122
123 union {
124 struct {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200125 uint8_t rac;
126 uint8_t spgc_ccch_sup;
127 uint8_t net_ctrl_ord;
128 uint8_t prio_acc_thr;
Harald Weltea43f7892009-12-01 18:04:30 +0530129 } no_pbcch;
130 struct {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200131 uint8_t psi1_rep_per;
132 uint8_t pb;
133 uint8_t tsc;
134 uint8_t tn;
Harald Weltea43f7892009-12-01 18:04:30 +0530135 enum pbcch_carrier_type carrier_type;
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200136 uint16_t arfcn;
137 uint8_t maio;
Harald Weltea43f7892009-12-01 18:04:30 +0530138 } pbcch;
139 };
140};
141
142/* Generate SI13 Rest Octests (Chapter 10.5.2.37b) */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200143int rest_octets_si13(uint8_t *data, const struct gsm48_si13_info *si13);
Harald Weltea43f7892009-12-01 18:04:30 +0530144
145#endif /* _REST_OCTETS_H */