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> |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 5 | #include <openbsc/gsm_04_08.h> |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 6 | #include <osmocom/gsm/sysinfo.h> |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 7 | |
| 8 | /* generate SI1 rest octets */ |
Holger Hans Peter Freyther | f876c39 | 2013-03-06 12:02:33 +0100 | [diff] [blame] | 9 | 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] | 10 | int rest_octets_si2quater(uint8_t *data, struct gsm_bts *bts); |
Holger Hans Peter Freyther | 82dd983 | 2016-05-17 23:20:03 +0200 | [diff] [blame] | 11 | int rest_octets_si6(uint8_t *data, bool is1800_net); |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 12 | |
| 13 | struct gsm48_si_selection_params { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 14 | uint16_t penalty_time:5, |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 15 | temp_offs:3, |
| 16 | cell_resel_off:6, |
| 17 | cbq:1, |
| 18 | present:1; |
| 19 | }; |
| 20 | |
| 21 | struct gsm48_si_power_offset { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 22 | uint8_t power_offset:2, |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 23 | present:1; |
| 24 | }; |
| 25 | |
| 26 | struct gsm48_si3_gprs_ind { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 27 | uint8_t si13_position:1, |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 28 | ra_colour:3, |
| 29 | present:1; |
| 30 | }; |
| 31 | |
| 32 | struct gsm48_lsa_params { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 33 | uint32_t prio_thr:3, |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 34 | lsa_offset:3, |
| 35 | mcc:12, |
| 36 | mnc:12; |
| 37 | unsigned int present; |
| 38 | }; |
| 39 | |
| 40 | struct gsm48_si_ro_info { |
| 41 | struct gsm48_si_selection_params selection_params; |
| 42 | struct gsm48_si_power_offset power_offset; |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 43 | uint8_t si2ter_indicator; |
| 44 | uint8_t early_cm_ctrl; |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 45 | struct { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 46 | uint8_t where:3, |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 47 | present:1; |
| 48 | } scheduling; |
| 49 | struct gsm48_si3_gprs_ind gprs_ind; |
Max | f3f3505 | 2016-04-15 16:04:44 +0200 | [diff] [blame] | 50 | /* SI 3 specific */ |
| 51 | uint8_t si2quater_indicator; |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 52 | /* SI 4 specific */ |
| 53 | struct gsm48_lsa_params lsa_params; |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 54 | uint16_t cell_id; |
| 55 | uint8_t break_ind; /* do we have SI7 + SI8 ? */ |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | |
| 59 | /* 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] | 60 | 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] | 61 | |
| 62 | /* Generate SI4 Rest Octets (Chapter 10.5.2.35) */ |
Holger Hans Peter Freyther | 7ff77ec | 2010-12-29 23:06:22 +0100 | [diff] [blame] | 63 | 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] | 64 | |
| 65 | enum 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 */ |
| 72 | enum 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 Welte | da0586a | 2010-04-18 14:49:05 +0200 | [diff] [blame] | 78 | /* TS 04.60 12.24 */ |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 79 | struct gprs_cell_options { |
| 80 | enum gprs_nmo nmo; |
| 81 | /* T3168: wait for packet uplink assignment message */ |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 82 | uint32_t t3168; /* in milliseconds */ |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 83 | /* 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] | 84 | uint32_t t3192; /* in milliseconds */ |
| 85 | uint32_t drx_timer_max;/* in seconds */ |
| 86 | uint32_t bs_cv_max; |
bhargava | 350533c | 2016-07-21 11:14:34 +0530 | [diff] [blame] | 87 | uint8_t supports_egprs_11bit_rach; |
Max | 292ec58 | 2016-07-28 11:55:37 +0200 | [diff] [blame] | 88 | bool ctrl_ack_type_use_block; /* use PACKET CONTROL ACKNOWLEDGMENT */ |
Harald Welte | da0586a | 2010-04-18 14:49:05 +0200 | [diff] [blame] | 89 | |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 90 | uint8_t ext_info_present; |
Harald Welte | da0586a | 2010-04-18 14:49:05 +0200 | [diff] [blame] | 91 | struct { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 92 | 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 Welte | da0586a | 2010-04-18 14:49:05 +0200 | [diff] [blame] | 98 | } ext_info; |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 99 | }; |
| 100 | |
| 101 | /* TS 04.60 Table 12.9.2 */ |
| 102 | struct gprs_power_ctrl_pars { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 103 | 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 Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 108 | }; |
| 109 | |
| 110 | struct gsm48_si13_info { |
| 111 | struct gprs_cell_options cell_opts; |
| 112 | struct gprs_power_ctrl_pars pwr_ctrl_pars; |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 113 | uint8_t bcch_change_mark; |
| 114 | uint8_t si_change_field; |
| 115 | uint8_t pbcch_present; |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 116 | |
| 117 | union { |
| 118 | struct { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 119 | uint8_t rac; |
| 120 | uint8_t spgc_ccch_sup; |
| 121 | uint8_t net_ctrl_ord; |
| 122 | uint8_t prio_acc_thr; |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 123 | } no_pbcch; |
| 124 | struct { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 125 | uint8_t psi1_rep_per; |
| 126 | uint8_t pb; |
| 127 | uint8_t tsc; |
| 128 | uint8_t tn; |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 129 | enum pbcch_carrier_type carrier_type; |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 130 | uint16_t arfcn; |
| 131 | uint8_t maio; |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 132 | } pbcch; |
| 133 | }; |
| 134 | }; |
| 135 | |
| 136 | /* Generate SI13 Rest Octests (Chapter 10.5.2.37b) */ |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 137 | 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] | 138 | |
| 139 | #endif /* _REST_OCTETS_H */ |