blob: 49a231296c86a5175ea3e0f9267b4b8ea6fa9ed6 [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
8/* generate SI1 rest octets */
Holger Hans Peter Freytherf876c392013-03-06 12:02:33 +01009int rest_octets_si1(uint8_t *data, uint8_t *nch_pos, int is1800_net);
Maxf39d03a2017-05-12 17:00:30 +020010int rest_octets_si2quater(uint8_t *data, struct gsm_bts *bts);
Holger Hans Peter Freyther82dd9832016-05-17 23:20:03 +020011int rest_octets_si6(uint8_t *data, bool is1800_net);
Harald Weltea43f7892009-12-01 18:04:30 +053012
13struct gsm48_si_selection_params {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020014 uint16_t penalty_time:5,
Harald Weltea43f7892009-12-01 18:04:30 +053015 temp_offs:3,
16 cell_resel_off:6,
17 cbq:1,
18 present:1;
19};
20
21struct gsm48_si_power_offset {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020022 uint8_t power_offset:2,
Harald Weltea43f7892009-12-01 18:04:30 +053023 present:1;
24};
25
26struct gsm48_si3_gprs_ind {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020027 uint8_t si13_position:1,
Harald Weltea43f7892009-12-01 18:04:30 +053028 ra_colour:3,
29 present:1;
30};
31
32struct gsm48_lsa_params {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020033 uint32_t prio_thr:3,
Harald Weltea43f7892009-12-01 18:04:30 +053034 lsa_offset:3,
35 mcc:12,
36 mnc:12;
37 unsigned int present;
38};
39
40struct gsm48_si_ro_info {
41 struct gsm48_si_selection_params selection_params;
42 struct gsm48_si_power_offset power_offset;
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020043 uint8_t si2ter_indicator;
44 uint8_t early_cm_ctrl;
Harald Weltea43f7892009-12-01 18:04:30 +053045 struct {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020046 uint8_t where:3,
Harald Weltea43f7892009-12-01 18:04:30 +053047 present:1;
48 } scheduling;
49 struct gsm48_si3_gprs_ind gprs_ind;
Maxf3f35052016-04-15 16:04:44 +020050 /* SI 3 specific */
51 uint8_t si2quater_indicator;
Harald Weltea43f7892009-12-01 18:04:30 +053052 /* SI 4 specific */
53 struct gsm48_lsa_params lsa_params;
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020054 uint16_t cell_id;
55 uint8_t break_ind; /* do we have SI7 + SI8 ? */
Harald Weltea43f7892009-12-01 18:04:30 +053056};
57
58
59/* Generate SI3 Rest Octests (Chapter 10.5.2.34 / Table 10.4.72) */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020060int rest_octets_si3(uint8_t *data, const struct gsm48_si_ro_info *si3);
Harald Weltea43f7892009-12-01 18:04:30 +053061
62/* Generate SI4 Rest Octets (Chapter 10.5.2.35) */
Holger Hans Peter Freyther7ff77ec2010-12-29 23:06:22 +010063int rest_octets_si4(uint8_t *data, const struct gsm48_si_ro_info *si4, int len);
Harald Weltea43f7892009-12-01 18:04:30 +053064
65enum pbcch_carrier_type {
66 PBCCH_BCCH,
67 PBCCH_ARFCN,
68 PBCCH_MAIO
69};
70
71/* TS 03.60 Chapter 6.3.3.1: Network Mode of Operation */
72enum gprs_nmo {
73 GPRS_NMO_I = 0, /* CS pagin on GPRS paging or traffic channel */
74 GPRS_NMO_II = 1, /* all paging on CCCH */
75 GPRS_NMO_III = 2, /* no paging coordination */
76};
77
Harald Welteda0586a2010-04-18 14:49:05 +020078/* TS 04.60 12.24 */
Harald Weltea43f7892009-12-01 18:04:30 +053079struct gprs_cell_options {
80 enum gprs_nmo nmo;
81 /* T3168: wait for packet uplink assignment message */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020082 uint32_t t3168; /* in milliseconds */
Harald Weltea43f7892009-12-01 18:04:30 +053083 /* T3192: wait for release of the TBF after reception of the final block */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020084 uint32_t t3192; /* in milliseconds */
85 uint32_t drx_timer_max;/* in seconds */
86 uint32_t bs_cv_max;
bhargava350533c2016-07-21 11:14:34 +053087 uint8_t supports_egprs_11bit_rach;
Max292ec582016-07-28 11:55:37 +020088 bool ctrl_ack_type_use_block; /* use PACKET CONTROL ACKNOWLEDGMENT */
Harald Welteda0586a2010-04-18 14:49:05 +020089
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020090 uint8_t ext_info_present;
Harald Welteda0586a2010-04-18 14:49:05 +020091 struct {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020092 uint8_t egprs_supported;
93 uint8_t use_egprs_p_ch_req;
94 uint8_t bep_period;
95 uint8_t pfc_supported;
96 uint8_t dtm_supported;
97 uint8_t bss_paging_coordination;
Harald Welteda0586a2010-04-18 14:49:05 +020098 } ext_info;
Harald Weltea43f7892009-12-01 18:04:30 +053099};
100
101/* TS 04.60 Table 12.9.2 */
102struct gprs_power_ctrl_pars {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200103 uint8_t alpha;
104 uint8_t t_avg_w;
105 uint8_t t_avg_t;
106 uint8_t pc_meas_chan;
107 uint8_t n_avg_i;
Harald Weltea43f7892009-12-01 18:04:30 +0530108};
109
110struct gsm48_si13_info {
111 struct gprs_cell_options cell_opts;
112 struct gprs_power_ctrl_pars pwr_ctrl_pars;
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200113 uint8_t bcch_change_mark;
114 uint8_t si_change_field;
115 uint8_t pbcch_present;
Harald Weltea43f7892009-12-01 18:04:30 +0530116
117 union {
118 struct {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200119 uint8_t rac;
120 uint8_t spgc_ccch_sup;
121 uint8_t net_ctrl_ord;
122 uint8_t prio_acc_thr;
Harald Weltea43f7892009-12-01 18:04:30 +0530123 } no_pbcch;
124 struct {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200125 uint8_t psi1_rep_per;
126 uint8_t pb;
127 uint8_t tsc;
128 uint8_t tn;
Harald Weltea43f7892009-12-01 18:04:30 +0530129 enum pbcch_carrier_type carrier_type;
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200130 uint16_t arfcn;
131 uint8_t maio;
Harald Weltea43f7892009-12-01 18:04:30 +0530132 } pbcch;
133 };
134};
135
136/* Generate SI13 Rest Octests (Chapter 10.5.2.37b) */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200137int rest_octets_si13(uint8_t *data, const struct gsm48_si13_info *si13);
Harald Weltea43f7892009-12-01 18:04:30 +0530138
139#endif /* _REST_OCTETS_H */