Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 1 | #ifndef _REST_OCTETS_H |
| 2 | #define _REST_OCTETS_H |
| 3 | |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 4 | #include <openbsc/gsm_04_08.h> |
| 5 | |
| 6 | /* generate SI1 rest octets */ |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 7 | int rest_octets_si1(uint8_t *data, uint8_t *nch_pos); |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 8 | |
| 9 | struct gsm48_si_selection_params { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 10 | uint16_t penalty_time:5, |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 11 | temp_offs:3, |
| 12 | cell_resel_off:6, |
| 13 | cbq:1, |
| 14 | present:1; |
| 15 | }; |
| 16 | |
| 17 | struct gsm48_si_power_offset { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 18 | uint8_t power_offset:2, |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 19 | present:1; |
| 20 | }; |
| 21 | |
| 22 | struct gsm48_si3_gprs_ind { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 23 | uint8_t si13_position:1, |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 24 | ra_colour:3, |
| 25 | present:1; |
| 26 | }; |
| 27 | |
| 28 | struct gsm48_lsa_params { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 29 | uint32_t prio_thr:3, |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 30 | lsa_offset:3, |
| 31 | mcc:12, |
| 32 | mnc:12; |
| 33 | unsigned int present; |
| 34 | }; |
| 35 | |
| 36 | struct gsm48_si_ro_info { |
| 37 | struct gsm48_si_selection_params selection_params; |
| 38 | struct gsm48_si_power_offset power_offset; |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 39 | uint8_t si2ter_indicator; |
| 40 | uint8_t early_cm_ctrl; |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 41 | struct { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 42 | uint8_t where:3, |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 43 | 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 Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 49 | uint16_t cell_id; |
| 50 | uint8_t break_ind; /* do we have SI7 + SI8 ? */ |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | |
| 54 | /* 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] | 55 | 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] | 56 | |
| 57 | /* Generate SI4 Rest Octets (Chapter 10.5.2.35) */ |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 58 | int rest_octets_si4(uint8_t *data, const struct gsm48_si_ro_info *si4); |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 59 | |
| 60 | enum 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 */ |
| 67 | enum 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 Welte | da0586a | 2010-04-18 14:49:05 +0200 | [diff] [blame] | 73 | /* TS 04.60 12.24 */ |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 74 | struct gprs_cell_options { |
| 75 | enum gprs_nmo nmo; |
| 76 | /* T3168: wait for packet uplink assignment message */ |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 77 | uint32_t t3168; /* in milliseconds */ |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 78 | /* 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] | 79 | uint32_t t3192; /* in milliseconds */ |
| 80 | uint32_t drx_timer_max;/* in seconds */ |
| 81 | uint32_t bs_cv_max; |
Harald Welte | da0586a | 2010-04-18 14:49:05 +0200 | [diff] [blame] | 82 | |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 83 | uint8_t ext_info_present; |
Harald Welte | da0586a | 2010-04-18 14:49:05 +0200 | [diff] [blame] | 84 | struct { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 85 | 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 Welte | da0586a | 2010-04-18 14:49:05 +0200 | [diff] [blame] | 91 | } ext_info; |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 92 | }; |
| 93 | |
| 94 | /* TS 04.60 Table 12.9.2 */ |
| 95 | struct gprs_power_ctrl_pars { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 96 | 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 Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 101 | }; |
| 102 | |
| 103 | struct gsm48_si13_info { |
| 104 | struct gprs_cell_options cell_opts; |
| 105 | struct gprs_power_ctrl_pars pwr_ctrl_pars; |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 106 | uint8_t bcch_change_mark; |
| 107 | uint8_t si_change_field; |
| 108 | uint8_t pbcch_present; |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 109 | |
| 110 | union { |
| 111 | struct { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +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 | } no_pbcch; |
| 117 | struct { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 118 | uint8_t psi1_rep_per; |
| 119 | uint8_t pb; |
| 120 | uint8_t tsc; |
| 121 | uint8_t tn; |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 122 | enum pbcch_carrier_type carrier_type; |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 123 | uint16_t arfcn; |
| 124 | uint8_t maio; |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 125 | } pbcch; |
| 126 | }; |
| 127 | }; |
| 128 | |
| 129 | /* Generate SI13 Rest Octests (Chapter 10.5.2.37b) */ |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 130 | 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] | 131 | |
| 132 | #endif /* _REST_OCTETS_H */ |