Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 1 | #ifndef _REST_OCTETS_H |
| 2 | #define _REST_OCTETS_H |
| 3 | |
| 4 | #include <sys/types.h> |
| 5 | #include <openbsc/gsm_04_08.h> |
| 6 | |
| 7 | /* generate SI1 rest octets */ |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame^] | 8 | int rest_octets_si1(uint8_t *data, uint8_t *nch_pos); |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 9 | |
| 10 | struct gsm48_si_selection_params { |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame^] | 11 | uint16_t penalty_time:5, |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 12 | temp_offs:3, |
| 13 | cell_resel_off:6, |
| 14 | cbq:1, |
| 15 | present:1; |
| 16 | }; |
| 17 | |
| 18 | struct gsm48_si_power_offset { |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame^] | 19 | uint8_t power_offset:2, |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 20 | present:1; |
| 21 | }; |
| 22 | |
| 23 | struct gsm48_si3_gprs_ind { |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame^] | 24 | uint8_t si13_position:1, |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 25 | ra_colour:3, |
| 26 | present:1; |
| 27 | }; |
| 28 | |
| 29 | struct gsm48_lsa_params { |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame^] | 30 | uint32_t prio_thr:3, |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 31 | lsa_offset:3, |
| 32 | mcc:12, |
| 33 | mnc:12; |
| 34 | unsigned int present; |
| 35 | }; |
| 36 | |
| 37 | struct gsm48_si_ro_info { |
| 38 | struct gsm48_si_selection_params selection_params; |
| 39 | struct gsm48_si_power_offset power_offset; |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame^] | 40 | uint8_t si2ter_indicator; |
| 41 | uint8_t early_cm_ctrl; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 42 | struct { |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame^] | 43 | uint8_t where:3, |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 44 | present:1; |
| 45 | } scheduling; |
| 46 | struct gsm48_si3_gprs_ind gprs_ind; |
| 47 | |
| 48 | /* SI 4 specific */ |
| 49 | struct gsm48_lsa_params lsa_params; |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame^] | 50 | uint16_t cell_id; |
| 51 | uint8_t break_ind; /* do we have SI7 + SI8 ? */ |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | |
| 55 | /* Generate SI3 Rest Octests (Chapter 10.5.2.34 / Table 10.4.72) */ |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame^] | 56 | int rest_octets_si3(uint8_t *data, const struct gsm48_si_ro_info *si3); |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 57 | |
| 58 | /* Generate SI4 Rest Octets (Chapter 10.5.2.35) */ |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame^] | 59 | int rest_octets_si4(uint8_t *data, const struct gsm48_si_ro_info *si4); |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 60 | |
| 61 | enum pbcch_carrier_type { |
| 62 | PBCCH_BCCH, |
| 63 | PBCCH_ARFCN, |
| 64 | PBCCH_MAIO |
| 65 | }; |
| 66 | |
| 67 | /* TS 03.60 Chapter 6.3.3.1: Network Mode of Operation */ |
| 68 | enum gprs_nmo { |
| 69 | GPRS_NMO_I = 0, /* CS pagin on GPRS paging or traffic channel */ |
| 70 | GPRS_NMO_II = 1, /* all paging on CCCH */ |
| 71 | GPRS_NMO_III = 2, /* no paging coordination */ |
| 72 | }; |
| 73 | |
Harald Welte | 3ce9a0d | 2010-04-18 14:49:05 +0200 | [diff] [blame] | 74 | /* TS 04.60 12.24 */ |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 75 | struct gprs_cell_options { |
| 76 | enum gprs_nmo nmo; |
| 77 | /* T3168: wait for packet uplink assignment message */ |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame^] | 78 | uint32_t t3168; /* in milliseconds */ |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 79 | /* T3192: wait for release of the TBF after reception of the final block */ |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame^] | 80 | uint32_t t3192; /* in milliseconds */ |
| 81 | uint32_t drx_timer_max;/* in seconds */ |
| 82 | uint32_t bs_cv_max; |
Harald Welte | 3ce9a0d | 2010-04-18 14:49:05 +0200 | [diff] [blame] | 83 | |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame^] | 84 | uint8_t ext_info_present; |
Harald Welte | 3ce9a0d | 2010-04-18 14:49:05 +0200 | [diff] [blame] | 85 | struct { |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame^] | 86 | uint8_t egprs_supported; |
| 87 | uint8_t use_egprs_p_ch_req; |
| 88 | uint8_t bep_period; |
| 89 | uint8_t pfc_supported; |
| 90 | uint8_t dtm_supported; |
| 91 | uint8_t bss_paging_coordination; |
Harald Welte | 3ce9a0d | 2010-04-18 14:49:05 +0200 | [diff] [blame] | 92 | } ext_info; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 93 | }; |
| 94 | |
| 95 | /* TS 04.60 Table 12.9.2 */ |
| 96 | struct gprs_power_ctrl_pars { |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame^] | 97 | uint8_t alpha; |
| 98 | uint8_t t_avg_w; |
| 99 | uint8_t t_avg_t; |
| 100 | uint8_t pc_meas_chan; |
| 101 | uint8_t n_avg_i; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 102 | }; |
| 103 | |
| 104 | struct gsm48_si13_info { |
| 105 | struct gprs_cell_options cell_opts; |
| 106 | struct gprs_power_ctrl_pars pwr_ctrl_pars; |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame^] | 107 | uint8_t bcch_change_mark; |
| 108 | uint8_t si_change_field; |
| 109 | uint8_t pbcch_present; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 110 | |
| 111 | union { |
| 112 | struct { |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame^] | 113 | uint8_t rac; |
| 114 | uint8_t spgc_ccch_sup; |
| 115 | uint8_t net_ctrl_ord; |
| 116 | uint8_t prio_acc_thr; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 117 | } no_pbcch; |
| 118 | struct { |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame^] | 119 | uint8_t psi1_rep_per; |
| 120 | uint8_t pb; |
| 121 | uint8_t tsc; |
| 122 | uint8_t tn; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 123 | enum pbcch_carrier_type carrier_type; |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame^] | 124 | uint16_t arfcn; |
| 125 | uint8_t maio; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 126 | } pbcch; |
| 127 | }; |
| 128 | }; |
| 129 | |
| 130 | /* Generate SI13 Rest Octests (Chapter 10.5.2.37b) */ |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame^] | 131 | int rest_octets_si13(uint8_t *data, const struct gsm48_si13_info *si13); |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 132 | |
| 133 | #endif /* _REST_OCTETS_H */ |