Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 1 | #ifndef _REST_OCTETS_H |
| 2 | #define _REST_OCTETS_H |
| 3 | |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 4 | #include <stdbool.h> |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 5 | #include <osmocom/gsm/sysinfo.h> |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 6 | |
Neels Hofmeyr | 7b65688 | 2017-07-09 22:09:18 +0200 | [diff] [blame] | 7 | struct gsm_bts; |
| 8 | |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 9 | /* generate SI1 rest octets */ |
Holger Hans Peter Freyther | f876c39 | 2013-03-06 12:02:33 +0100 | [diff] [blame] | 10 | int rest_octets_si1(uint8_t *data, uint8_t *nch_pos, int is1800_net); |
Max | f39d03a | 2017-05-12 17:00:30 +0200 | [diff] [blame] | 11 | int rest_octets_si2quater(uint8_t *data, struct gsm_bts *bts); |
Max | 4bd710d | 2017-12-11 12:09:34 +0100 | [diff] [blame] | 12 | int rest_octets_si2ter(uint8_t *data); |
Max | 61b0c30 | 2017-12-11 12:24:18 +0100 | [diff] [blame] | 13 | int rest_octets_si2bis(uint8_t *data); |
Holger Hans Peter Freyther | 82dd983 | 2016-05-17 23:20:03 +0200 | [diff] [blame] | 14 | int rest_octets_si6(uint8_t *data, bool is1800_net); |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 15 | |
| 16 | struct gsm48_si_selection_params { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 17 | uint16_t penalty_time:5, |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 18 | temp_offs:3, |
| 19 | cell_resel_off:6, |
| 20 | cbq:1, |
| 21 | present:1; |
| 22 | }; |
| 23 | |
| 24 | struct gsm48_si_power_offset { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 25 | uint8_t power_offset:2, |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 26 | present:1; |
| 27 | }; |
| 28 | |
| 29 | struct gsm48_si3_gprs_ind { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 30 | uint8_t si13_position:1, |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 31 | ra_colour:3, |
| 32 | present:1; |
| 33 | }; |
| 34 | |
| 35 | struct gsm48_lsa_params { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 36 | uint32_t prio_thr:3, |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 37 | lsa_offset:3, |
| 38 | mcc:12, |
| 39 | mnc:12; |
| 40 | unsigned int present; |
| 41 | }; |
| 42 | |
| 43 | struct gsm48_si_ro_info { |
| 44 | struct gsm48_si_selection_params selection_params; |
| 45 | struct gsm48_si_power_offset power_offset; |
Pau Espin Pedrol | 91c76fd | 2017-11-24 12:44:07 +0100 | [diff] [blame] | 46 | bool si2ter_indicator; |
| 47 | bool early_cm_ctrl; |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 48 | struct { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 49 | uint8_t where:3, |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 50 | present:1; |
| 51 | } scheduling; |
| 52 | struct gsm48_si3_gprs_ind gprs_ind; |
Max | f3f3505 | 2016-04-15 16:04:44 +0200 | [diff] [blame] | 53 | /* SI 3 specific */ |
Pau Espin Pedrol | e8dda5f | 2017-11-23 19:06:09 +0100 | [diff] [blame] | 54 | bool early_cm_restrict_3g; |
Pau Espin Pedrol | 91c76fd | 2017-11-24 12:44:07 +0100 | [diff] [blame] | 55 | bool si2quater_indicator; |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 56 | /* SI 4 specific */ |
| 57 | struct gsm48_lsa_params lsa_params; |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 58 | uint16_t cell_id; |
| 59 | uint8_t break_ind; /* do we have SI7 + SI8 ? */ |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | |
| 63 | /* Generate SI3 Rest Octests (Chapter 10.5.2.34 / Table 10.4.72) */ |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 64 | int rest_octets_si3(uint8_t *data, const struct gsm48_si_ro_info *si3); |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 65 | |
| 66 | /* Generate SI4 Rest Octets (Chapter 10.5.2.35) */ |
Holger Hans Peter Freyther | 7ff77ec | 2010-12-29 23:06:22 +0100 | [diff] [blame] | 67 | int rest_octets_si4(uint8_t *data, const struct gsm48_si_ro_info *si4, int len); |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 68 | |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 69 | /* TS 03.60 Chapter 6.3.3.1: Network Mode of Operation */ |
| 70 | enum 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 Welte | da0586a | 2010-04-18 14:49:05 +0200 | [diff] [blame] | 76 | /* TS 04.60 12.24 */ |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 77 | struct gprs_cell_options { |
| 78 | enum gprs_nmo nmo; |
| 79 | /* T3168: wait for packet uplink assignment message */ |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 80 | uint32_t t3168; /* in milliseconds */ |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 81 | /* T3192: wait for release of the TBF after reception of the final block */ |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 82 | uint32_t t3192; /* in milliseconds */ |
| 83 | uint32_t drx_timer_max;/* in seconds */ |
| 84 | uint32_t bs_cv_max; |
Max | 292ec58 | 2016-07-28 11:55:37 +0200 | [diff] [blame] | 85 | bool ctrl_ack_type_use_block; /* use PACKET CONTROL ACKNOWLEDGMENT */ |
Harald Welte | da0586a | 2010-04-18 14:49:05 +0200 | [diff] [blame] | 86 | |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 87 | uint8_t ext_info_present; |
Harald Welte | da0586a | 2010-04-18 14:49:05 +0200 | [diff] [blame] | 88 | struct { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 89 | uint8_t egprs_supported; |
Vadim Yanitskiy | 0c94d72 | 2020-04-06 16:56:56 +0700 | [diff] [blame] | 90 | uint8_t use_egprs_p_ch_req; |
| 91 | uint8_t bep_period; |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 92 | uint8_t pfc_supported; |
| 93 | uint8_t dtm_supported; |
| 94 | uint8_t bss_paging_coordination; |
Harald Welte | da0586a | 2010-04-18 14:49:05 +0200 | [diff] [blame] | 95 | } ext_info; |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 96 | }; |
| 97 | |
| 98 | /* TS 04.60 Table 12.9.2 */ |
| 99 | struct gprs_power_ctrl_pars { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 100 | uint8_t alpha; |
| 101 | uint8_t t_avg_w; |
| 102 | uint8_t t_avg_t; |
| 103 | uint8_t pc_meas_chan; |
| 104 | uint8_t n_avg_i; |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 105 | }; |
| 106 | |
| 107 | struct gsm48_si13_info { |
| 108 | struct gprs_cell_options cell_opts; |
| 109 | struct gprs_power_ctrl_pars pwr_ctrl_pars; |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 110 | uint8_t bcch_change_mark; |
| 111 | uint8_t si_change_field; |
Max | 72fbc95 | 2017-08-29 13:14:24 +0200 | [diff] [blame] | 112 | uint8_t rac; |
| 113 | uint8_t spgc_ccch_sup; |
| 114 | uint8_t net_ctrl_ord; |
| 115 | uint8_t prio_acc_thr; |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 116 | }; |
| 117 | |
| 118 | /* Generate SI13 Rest Octests (Chapter 10.5.2.37b) */ |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 119 | int rest_octets_si13(uint8_t *data, const struct gsm48_si13_info *si13); |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 120 | |
| 121 | #endif /* _REST_OCTETS_H */ |