blob: f7ad682b71303e664c5e4b6af008e66855cfa9f9 [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>
Max59a1bf32016-04-15 16:04:46 +02005#include <osmocom/gsm/sysinfo.h>
Harald Weltea43f7892009-12-01 18:04:30 +05306
Neels Hofmeyr7b656882017-07-09 22:09:18 +02007struct gsm_bts;
8
Harald Weltea43f7892009-12-01 18:04:30 +05309/* generate SI1 rest octets */
Holger Hans Peter Freytherf876c392013-03-06 12:02:33 +010010int rest_octets_si1(uint8_t *data, uint8_t *nch_pos, int is1800_net);
Maxf39d03a2017-05-12 17:00:30 +020011int rest_octets_si2quater(uint8_t *data, struct gsm_bts *bts);
Max4bd710d2017-12-11 12:09:34 +010012int rest_octets_si2ter(uint8_t *data);
Max61b0c302017-12-11 12:24:18 +010013int rest_octets_si2bis(uint8_t *data);
Holger Hans Peter Freyther82dd9832016-05-17 23:20:03 +020014int rest_octets_si6(uint8_t *data, bool is1800_net);
Harald Weltea43f7892009-12-01 18:04:30 +053015
16struct gsm48_si_selection_params {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020017 uint16_t penalty_time:5,
Harald Weltea43f7892009-12-01 18:04:30 +053018 temp_offs:3,
19 cell_resel_off:6,
20 cbq:1,
21 present:1;
22};
23
24struct gsm48_si_power_offset {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020025 uint8_t power_offset:2,
Harald Weltea43f7892009-12-01 18:04:30 +053026 present:1;
27};
28
29struct gsm48_si3_gprs_ind {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020030 uint8_t si13_position:1,
Harald Weltea43f7892009-12-01 18:04:30 +053031 ra_colour:3,
32 present:1;
33};
34
35struct gsm48_lsa_params {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020036 uint32_t prio_thr:3,
Harald Weltea43f7892009-12-01 18:04:30 +053037 lsa_offset:3,
38 mcc:12,
39 mnc:12;
40 unsigned int present;
41};
42
43struct gsm48_si_ro_info {
44 struct gsm48_si_selection_params selection_params;
45 struct gsm48_si_power_offset power_offset;
Pau Espin Pedrol91c76fd2017-11-24 12:44:07 +010046 bool si2ter_indicator;
47 bool early_cm_ctrl;
Harald Weltea43f7892009-12-01 18:04:30 +053048 struct {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020049 uint8_t where:3,
Harald Weltea43f7892009-12-01 18:04:30 +053050 present:1;
51 } scheduling;
52 struct gsm48_si3_gprs_ind gprs_ind;
Maxf3f35052016-04-15 16:04:44 +020053 /* SI 3 specific */
Pau Espin Pedrole8dda5f2017-11-23 19:06:09 +010054 bool early_cm_restrict_3g;
Pau Espin Pedrol91c76fd2017-11-24 12:44:07 +010055 bool si2quater_indicator;
Harald Weltea43f7892009-12-01 18:04:30 +053056 /* SI 4 specific */
57 struct gsm48_lsa_params lsa_params;
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020058 uint16_t cell_id;
59 uint8_t break_ind; /* do we have SI7 + SI8 ? */
Harald Weltea43f7892009-12-01 18:04:30 +053060};
61
62
63/* Generate SI3 Rest Octests (Chapter 10.5.2.34 / Table 10.4.72) */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020064int rest_octets_si3(uint8_t *data, const struct gsm48_si_ro_info *si3);
Harald Weltea43f7892009-12-01 18:04:30 +053065
66/* Generate SI4 Rest Octets (Chapter 10.5.2.35) */
Holger Hans Peter Freyther7ff77ec2010-12-29 23:06:22 +010067int rest_octets_si4(uint8_t *data, const struct gsm48_si_ro_info *si4, int len);
Harald Weltea43f7892009-12-01 18:04:30 +053068
Harald Weltea43f7892009-12-01 18:04:30 +053069/* TS 03.60 Chapter 6.3.3.1: Network Mode of Operation */
70enum gprs_nmo {
71 GPRS_NMO_I = 0, /* CS pagin on GPRS paging or traffic channel */
72 GPRS_NMO_II = 1, /* all paging on CCCH */
73 GPRS_NMO_III = 2, /* no paging coordination */
74};
75
Harald Welteda0586a2010-04-18 14:49:05 +020076/* TS 04.60 12.24 */
Harald Weltea43f7892009-12-01 18:04:30 +053077struct gprs_cell_options {
78 enum gprs_nmo nmo;
79 /* T3168: wait for packet uplink assignment message */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020080 uint32_t t3168; /* in milliseconds */
Harald Weltea43f7892009-12-01 18:04:30 +053081 /* T3192: wait for release of the TBF after reception of the final block */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020082 uint32_t t3192; /* in milliseconds */
83 uint32_t drx_timer_max;/* in seconds */
84 uint32_t bs_cv_max;
bhargava350533c2016-07-21 11:14:34 +053085 uint8_t supports_egprs_11bit_rach;
Max292ec582016-07-28 11:55:37 +020086 bool ctrl_ack_type_use_block; /* use PACKET CONTROL ACKNOWLEDGMENT */
Harald Welteda0586a2010-04-18 14:49:05 +020087
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020088 uint8_t ext_info_present;
Harald Welteda0586a2010-04-18 14:49:05 +020089 struct {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020090 uint8_t egprs_supported;
91 uint8_t use_egprs_p_ch_req;
92 uint8_t bep_period;
93 uint8_t pfc_supported;
94 uint8_t dtm_supported;
95 uint8_t bss_paging_coordination;
Harald Welteda0586a2010-04-18 14:49:05 +020096 } ext_info;
Harald Weltea43f7892009-12-01 18:04:30 +053097};
98
99/* TS 04.60 Table 12.9.2 */
100struct gprs_power_ctrl_pars {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200101 uint8_t alpha;
102 uint8_t t_avg_w;
103 uint8_t t_avg_t;
104 uint8_t pc_meas_chan;
105 uint8_t n_avg_i;
Harald Weltea43f7892009-12-01 18:04:30 +0530106};
107
108struct gsm48_si13_info {
109 struct gprs_cell_options cell_opts;
110 struct gprs_power_ctrl_pars pwr_ctrl_pars;
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200111 uint8_t bcch_change_mark;
112 uint8_t si_change_field;
Max72fbc952017-08-29 13:14:24 +0200113 uint8_t rac;
114 uint8_t spgc_ccch_sup;
115 uint8_t net_ctrl_ord;
116 uint8_t prio_acc_thr;
Harald Weltea43f7892009-12-01 18:04:30 +0530117};
118
119/* Generate SI13 Rest Octests (Chapter 10.5.2.37b) */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200120int rest_octets_si13(uint8_t *data, const struct gsm48_si13_info *si13);
Harald Weltea43f7892009-12-01 18:04:30 +0530121
122#endif /* _REST_OCTETS_H */