blob: 876e0ab47174858e0debc5fac302de7c439f6e0a [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);
Holger Hans Peter Freyther82dd9832016-05-17 23:20:03 +020012int rest_octets_si6(uint8_t *data, bool is1800_net);
Harald Weltea43f7892009-12-01 18:04:30 +053013
14struct gsm48_si_selection_params {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020015 uint16_t penalty_time:5,
Harald Weltea43f7892009-12-01 18:04:30 +053016 temp_offs:3,
17 cell_resel_off:6,
18 cbq:1,
19 present:1;
20};
21
22struct gsm48_si_power_offset {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020023 uint8_t power_offset:2,
Harald Weltea43f7892009-12-01 18:04:30 +053024 present:1;
25};
26
27struct gsm48_si3_gprs_ind {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020028 uint8_t si13_position:1,
Harald Weltea43f7892009-12-01 18:04:30 +053029 ra_colour:3,
30 present:1;
31};
32
33struct gsm48_lsa_params {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020034 uint32_t prio_thr:3,
Harald Weltea43f7892009-12-01 18:04:30 +053035 lsa_offset:3,
36 mcc:12,
37 mnc:12;
38 unsigned int present;
39};
40
41struct gsm48_si_ro_info {
42 struct gsm48_si_selection_params selection_params;
43 struct gsm48_si_power_offset power_offset;
Pau Espin Pedrol91c76fd2017-11-24 12:44:07 +010044 bool si2ter_indicator;
45 bool early_cm_ctrl;
Harald Weltea43f7892009-12-01 18:04:30 +053046 struct {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020047 uint8_t where:3,
Harald Weltea43f7892009-12-01 18:04:30 +053048 present:1;
49 } scheduling;
50 struct gsm48_si3_gprs_ind gprs_ind;
Maxf3f35052016-04-15 16:04:44 +020051 /* SI 3 specific */
Pau Espin Pedrole8dda5f2017-11-23 19:06:09 +010052 bool early_cm_restrict_3g;
Pau Espin Pedrol91c76fd2017-11-24 12:44:07 +010053 bool si2quater_indicator;
Harald Weltea43f7892009-12-01 18:04:30 +053054 /* SI 4 specific */
55 struct gsm48_lsa_params lsa_params;
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020056 uint16_t cell_id;
57 uint8_t break_ind; /* do we have SI7 + SI8 ? */
Harald Weltea43f7892009-12-01 18:04:30 +053058};
59
60
61/* Generate SI3 Rest Octests (Chapter 10.5.2.34 / Table 10.4.72) */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020062int rest_octets_si3(uint8_t *data, const struct gsm48_si_ro_info *si3);
Harald Weltea43f7892009-12-01 18:04:30 +053063
64/* Generate SI4 Rest Octets (Chapter 10.5.2.35) */
Holger Hans Peter Freyther7ff77ec2010-12-29 23:06:22 +010065int rest_octets_si4(uint8_t *data, const struct gsm48_si_ro_info *si4, int len);
Harald Weltea43f7892009-12-01 18:04:30 +053066
Harald Weltea43f7892009-12-01 18:04:30 +053067/* TS 03.60 Chapter 6.3.3.1: Network Mode of Operation */
68enum gprs_nmo {
69 GPRS_NMO_I = 0, /* CS pagin on GPRS paging or traffic channel */
70 GPRS_NMO_II = 1, /* all paging on CCCH */
71 GPRS_NMO_III = 2, /* no paging coordination */
72};
73
Harald Welteda0586a2010-04-18 14:49:05 +020074/* TS 04.60 12.24 */
Harald Weltea43f7892009-12-01 18:04:30 +053075struct gprs_cell_options {
76 enum gprs_nmo nmo;
77 /* T3168: wait for packet uplink assignment message */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020078 uint32_t t3168; /* in milliseconds */
Harald Weltea43f7892009-12-01 18:04:30 +053079 /* T3192: wait for release of the TBF after reception of the final block */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020080 uint32_t t3192; /* in milliseconds */
81 uint32_t drx_timer_max;/* in seconds */
82 uint32_t bs_cv_max;
bhargava350533c2016-07-21 11:14:34 +053083 uint8_t supports_egprs_11bit_rach;
Max292ec582016-07-28 11:55:37 +020084 bool ctrl_ack_type_use_block; /* use PACKET CONTROL ACKNOWLEDGMENT */
Harald Welteda0586a2010-04-18 14:49:05 +020085
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020086 uint8_t ext_info_present;
Harald Welteda0586a2010-04-18 14:49:05 +020087 struct {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020088 uint8_t egprs_supported;
89 uint8_t use_egprs_p_ch_req;
90 uint8_t bep_period;
91 uint8_t pfc_supported;
92 uint8_t dtm_supported;
93 uint8_t bss_paging_coordination;
Harald Welteda0586a2010-04-18 14:49:05 +020094 } ext_info;
Harald Weltea43f7892009-12-01 18:04:30 +053095};
96
97/* TS 04.60 Table 12.9.2 */
98struct gprs_power_ctrl_pars {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020099 uint8_t alpha;
100 uint8_t t_avg_w;
101 uint8_t t_avg_t;
102 uint8_t pc_meas_chan;
103 uint8_t n_avg_i;
Harald Weltea43f7892009-12-01 18:04:30 +0530104};
105
106struct gsm48_si13_info {
107 struct gprs_cell_options cell_opts;
108 struct gprs_power_ctrl_pars pwr_ctrl_pars;
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200109 uint8_t bcch_change_mark;
110 uint8_t si_change_field;
Max72fbc952017-08-29 13:14:24 +0200111 uint8_t rac;
112 uint8_t spgc_ccch_sup;
113 uint8_t net_ctrl_ord;
114 uint8_t prio_acc_thr;
Harald Weltea43f7892009-12-01 18:04:30 +0530115};
116
117/* Generate SI13 Rest Octests (Chapter 10.5.2.37b) */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200118int rest_octets_si13(uint8_t *data, const struct gsm48_si13_info *si13);
Harald Weltea43f7892009-12-01 18:04:30 +0530119
120#endif /* _REST_OCTETS_H */