blob: 2d16a1f4f2987b4c79184c933ec40faf4e84ff5a [file] [log] [blame]
Harald Weltea43f7892009-12-01 18:04:30 +05301#ifndef _REST_OCTETS_H
2#define _REST_OCTETS_H
3
Harald Weltea43f7892009-12-01 18:04:30 +05304#include <openbsc/gsm_04_08.h>
5
6/* generate SI1 rest octets */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +02007int rest_octets_si1(uint8_t *data, uint8_t *nch_pos);
Harald Weltea43f7892009-12-01 18:04:30 +05308
9struct gsm48_si_selection_params {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020010 uint16_t penalty_time:5,
Harald Weltea43f7892009-12-01 18:04:30 +053011 temp_offs:3,
12 cell_resel_off:6,
13 cbq:1,
14 present:1;
15};
16
17struct gsm48_si_power_offset {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020018 uint8_t power_offset:2,
Harald Weltea43f7892009-12-01 18:04:30 +053019 present:1;
20};
21
22struct gsm48_si3_gprs_ind {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020023 uint8_t si13_position:1,
Harald Weltea43f7892009-12-01 18:04:30 +053024 ra_colour:3,
25 present:1;
26};
27
28struct gsm48_lsa_params {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020029 uint32_t prio_thr:3,
Harald Weltea43f7892009-12-01 18:04:30 +053030 lsa_offset:3,
31 mcc:12,
32 mnc:12;
33 unsigned int present;
34};
35
36struct gsm48_si_ro_info {
37 struct gsm48_si_selection_params selection_params;
38 struct gsm48_si_power_offset power_offset;
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020039 uint8_t si2ter_indicator;
40 uint8_t early_cm_ctrl;
Harald Weltea43f7892009-12-01 18:04:30 +053041 struct {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020042 uint8_t where:3,
Harald Weltea43f7892009-12-01 18:04:30 +053043 present:1;
44 } scheduling;
45 struct gsm48_si3_gprs_ind gprs_ind;
46
47 /* SI 4 specific */
48 struct gsm48_lsa_params lsa_params;
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020049 uint16_t cell_id;
50 uint8_t break_ind; /* do we have SI7 + SI8 ? */
Harald Weltea43f7892009-12-01 18:04:30 +053051};
52
53
54/* Generate SI3 Rest Octests (Chapter 10.5.2.34 / Table 10.4.72) */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020055int rest_octets_si3(uint8_t *data, const struct gsm48_si_ro_info *si3);
Harald Weltea43f7892009-12-01 18:04:30 +053056
57/* Generate SI4 Rest Octets (Chapter 10.5.2.35) */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020058int rest_octets_si4(uint8_t *data, const struct gsm48_si_ro_info *si4);
Harald Weltea43f7892009-12-01 18:04:30 +053059
60enum pbcch_carrier_type {
61 PBCCH_BCCH,
62 PBCCH_ARFCN,
63 PBCCH_MAIO
64};
65
66/* TS 03.60 Chapter 6.3.3.1: Network Mode of Operation */
67enum gprs_nmo {
68 GPRS_NMO_I = 0, /* CS pagin on GPRS paging or traffic channel */
69 GPRS_NMO_II = 1, /* all paging on CCCH */
70 GPRS_NMO_III = 2, /* no paging coordination */
71};
72
Harald Welteda0586a2010-04-18 14:49:05 +020073/* TS 04.60 12.24 */
Harald Weltea43f7892009-12-01 18:04:30 +053074struct gprs_cell_options {
75 enum gprs_nmo nmo;
76 /* T3168: wait for packet uplink assignment message */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020077 uint32_t t3168; /* in milliseconds */
Harald Weltea43f7892009-12-01 18:04:30 +053078 /* T3192: wait for release of the TBF after reception of the final block */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020079 uint32_t t3192; /* in milliseconds */
80 uint32_t drx_timer_max;/* in seconds */
81 uint32_t bs_cv_max;
Harald Welteda0586a2010-04-18 14:49:05 +020082
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020083 uint8_t ext_info_present;
Harald Welteda0586a2010-04-18 14:49:05 +020084 struct {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020085 uint8_t egprs_supported;
86 uint8_t use_egprs_p_ch_req;
87 uint8_t bep_period;
88 uint8_t pfc_supported;
89 uint8_t dtm_supported;
90 uint8_t bss_paging_coordination;
Harald Welteda0586a2010-04-18 14:49:05 +020091 } ext_info;
Harald Weltea43f7892009-12-01 18:04:30 +053092};
93
94/* TS 04.60 Table 12.9.2 */
95struct gprs_power_ctrl_pars {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020096 uint8_t alpha;
97 uint8_t t_avg_w;
98 uint8_t t_avg_t;
99 uint8_t pc_meas_chan;
100 uint8_t n_avg_i;
Harald Weltea43f7892009-12-01 18:04:30 +0530101};
102
103struct gsm48_si13_info {
104 struct gprs_cell_options cell_opts;
105 struct gprs_power_ctrl_pars pwr_ctrl_pars;
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200106 uint8_t bcch_change_mark;
107 uint8_t si_change_field;
108 uint8_t pbcch_present;
Harald Weltea43f7892009-12-01 18:04:30 +0530109
110 union {
111 struct {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200112 uint8_t rac;
113 uint8_t spgc_ccch_sup;
114 uint8_t net_ctrl_ord;
115 uint8_t prio_acc_thr;
Harald Weltea43f7892009-12-01 18:04:30 +0530116 } no_pbcch;
117 struct {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200118 uint8_t psi1_rep_per;
119 uint8_t pb;
120 uint8_t tsc;
121 uint8_t tn;
Harald Weltea43f7892009-12-01 18:04:30 +0530122 enum pbcch_carrier_type carrier_type;
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200123 uint16_t arfcn;
124 uint8_t maio;
Harald Weltea43f7892009-12-01 18:04:30 +0530125 } pbcch;
126 };
127};
128
129/* Generate SI13 Rest Octests (Chapter 10.5.2.37b) */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200130int rest_octets_si13(uint8_t *data, const struct gsm48_si13_info *si13);
Harald Weltea43f7892009-12-01 18:04:30 +0530131
132#endif /* _REST_OCTETS_H */