comparison src/g23m-gprs/grr/grr_f.h @ 183:219afcfc6250

src/g23m-gprs: initial import from TCS3.2/LoCosto
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 13 Oct 2016 04:24:13 +0000
parents
children
comparison
equal deleted inserted replaced
182:f02d0a0e1849 183:219afcfc6250
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GPRS (8441)
4 | Modul : GRR
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose: Definitions for grr_f.c .
18 +-----------------------------------------------------------------------------
19 */
20
21 #ifndef GRR_F_H
22 #define GRR_F_H
23
24
25 #define END_OF_LIST 0xff
26
27 #define DELETE_MESSAGE 0xff
28
29
30 #define COMPUTE_DATA 0x00
31 #define INITIALIZE 0x01
32
33 #define DB_MODE_INIT 0 /* initialisation */
34 #define DB_MODE_CC_REQ 1 /* cell change request */
35 #define DB_MODE_CC_ACC 2 /* confirmation of cell change request */
36 /* (acceptance of new cell) */
37 #define DB_MODE_CC_REJ 3 /* rejection of cell change request */
38 /* (back to old cell) */
39 #define DB_MODE_SWAP 4 /* swap between the two databases */
40
41 #define PLEV_RND_INDEX 0
42 #define S_T_RND_INDEX 1
43 #define PCR_RND_INDEX 2
44
45 typedef UBYTE T_DB_MODE;
46
47 EXTERN void grr_set_pg_nmo(void);
48 EXTERN BOOL grr_check_tmsi( BUF_tmsi_field * tmsi_i);
49 EXTERN BOOL grr_check_ptmsi( BUF_ptmsi * ptmsi_i);
50 EXTERN ULONG grr_buffer2ulong ( BUF_ptmsi * ptmsi);
51 EXTERN BOOL grr_check_all_tlli ( BUF_tlli_value * tlli_i );
52 EXTERN void grr_init ( void );
53 EXTERN UBYTE grr_decode_grr ( T_MSGBUF * msg_ptr_i );
54 EXTERN UBYTE grr_decode_rr ( T_MSGBUF * msg_ptr_i );
55
56 EXTERN void grr_encode_ctrl ( UBYTE * ptr_in_i,
57 T_MSGBUF * ptr_out_i,
58 UBYTE r_bit_i);
59 EXTERN BOOL grr_check_address ( UBYTE msg_type_i,UBYTE tn_i );
60 EXTERN void grr_save_persistence_level ( T_pers_lev * ptr2persistence_level_i );
61 EXTERN ULONG grr_calc_new_poll_pos ( ULONG fn_i, UBYTE rrbp_i );
62 EXTERN ULONG grr_random_value (UBYTE index, ULONG max_i);
63 EXTERN BOOL grr_is_pbcch_present (void);
64 EXTERN ULONG grr_decode_tbf_start_abs(T_abs *ptr2tbf_abs);
65 EXTERN ULONG grr_decode_tbf_start_rel(ULONG start_fn, USHORT rel_pos);
66
67 EXTERN UBYTE grr_calc_nr_of_set_bits ( UBYTE value );
68
69 EXTERN T_DB_MODE grr_get_db_mode( void );
70 EXTERN void grr_set_db_ptr( T_DB_MODE mode );
71 EXTERN void grr_init_db( T_SC_DATABASE *db );
72
73 EXTERN BOOL grr_check_dist ( ULONG high_i, ULONG low_i, ULONG dist_i);
74 EXTERN BOOL handle_ms_cap (UBYTE msg_type );
75
76 /* the following functions are used by service MEAS, CS and PSI */
77 EXTERN void grr_prcs_xmeas_struct ( T_XMEAS *db_xmeas,
78 T_xmeas_par *air_xmeas,
79 BOOL cpy_prm_set,
80 UBYTE new_inst_idx,
81 UBYTE *start_ext_lst_idx,
82 UBYTE *stop_ext_lst_idx );
83 EXTERN void grr_init_xmeas_struct ( T_XMEAS *xmeas );
84 EXTERN BOOL grr_prcs_nc_freq_list ( T_NC_LIST *db_list,
85 T_NC_RFREQ_LIST *rfreq_list,
86 BOOL v_air_list,
87 T_nc_freq_list *air_list,
88 T_INFO_TYPE type,
89 UBYTE instance );
90 EXTERN void grr_prcs_nc_freq_final ( T_NC_LIST *dest_list,
91 T_NC_RFREQ_LIST *dest_rfreq,
92 BOOL *v_src_list_rfreq,
93 T_NC_LIST *src_list,
94 T_NC_RFREQ_LIST *src_rfreq );
95 EXTERN void grr_prcs_nc_param_struct ( T_NC_PARAM *db_nc,
96 T_nc_meas_par *ext_nc,
97 UBYTE new_idx );
98 EXTERN void grr_prcs_nc_param_final ( T_NC_PARAM *dest_nc,
99 BOOL *v_src_nc,
100 T_NC_PARAM *src_nc );
101 EXTERN void grr_init_ncmeas_extd_struct
102 ( T_NCMEAS_EXTENDED *extd,
103 BOOL is_cw );
104 EXTERN void grr_init_nc_list ( T_NC_LIST *list );
105
106 EXTERN void grr_init_nc_param ( T_NC_PARAM *param,
107 BOOL is_cw );
108 EXTERN void grr_sort_ext_lst_freq ( T_EXT_FREQ_LIST *list,
109 UBYTE max_number,
110 T_EXT_START_STOP *start_stop );
111
112 /* the above functions are used by service MEAS, CS and PSI */
113
114 /*
115 * Refrence frequency list, hopping frequencies etc.
116 */
117 EXTERN void grr_create_channel_list(T_rfl* rfl, UBYTE* list);
118 EXTERN BOOL grr_create_freq_list(UBYTE ma_num, UBYTE maio, T_p_chan_sel *chan_sel, T_p_freq_list *freq_list);
119 EXTERN void grr_ma_filter_list(
120 USHORT* list1, /* input*/
121 USHORT* list2, /* output*/
122 const T_gprs_ms_alloc_ie* gp_ma
123 );
124
125
126
127 /*
128 * Cell Reselection functions
129 */
130 EXTERN void grr_prepare_db_for_new_cell (void );
131
132 /*
133 * NON DRX Functions
134 */
135 EXTERN BOOL grr_is_non_drx_mode( void );
136 EXTERN BOOL grr_is_non_drx_period(void);
137 EXTERN void grr_handle_non_drx_period ( T_NON_DRX_TYPE non_drx_type,
138 BOOL non_drx_timer_running );
139
140 EXTERN void grr_store_g_pwr_par ( T_g_pwr_par *g_pwr_par );
141 EXTERN void grr_store_type_pwr_par
142 ( T_pwr_par *pwr_par,
143 BOOL use_prev );
144 EXTERN void grr_store_type_tn_alloc_pwr
145 ( T_tn_alloc_pwr *pwr_par );
146 EXTERN void grr_store_type_dyn_alloc
147 ( T_dyn_alloc *pwr_par );
148 EXTERN void grr_store_type_alf_gam
149 ( T_alf_gam *pwr_par,
150 UBYTE tn );
151 EXTERN void grr_store_type_pck_upl_ass_ia
152 ( T_tfi_ass_alloc *pwr_par,
153 UBYTE tn );
154 EXTERN void grr_store_type_pck_snbl_ass_ia
155 ( T_sngl_block_alloc *pwr_par,
156 UBYTE tn );
157
158 EXTERN void grr_store_type_tfi_ass_rlc
159 ( T_tfi_ass_rlc *pwr_par,
160 UBYTE tn );
161
162 EXTERN void grr_store_type_alpha_gamma
163 ( T_alpha_gamma *pwr_par,
164 UBYTE tn );
165
166 EXTERN void grr_store_type_pwr_ctrl
167 ( T_pwr_ctrl *pwr_par );
168
169
170 EXTERN void grr_set_tbf_cfg_req_param
171 ( T_MPHP_ASSIGNMENT_REQ *tbf_cfg_req );
172
173 EXTERN void grr_update_pacch( void );
174
175 EXTERN USHORT grr_imsi_mod ( void );
176
177 EXTERN ULONG grr_get_tlli ( void );
178
179 EXTERN void grr_set_buf_tlli ( BUF_tlli_value *buf_tlli_o, ULONG tlli_i );
180
181
182 EXTERN void grr_set_tlli ( USHORT * l_tlli,
183 USHORT * o_tlli,
184 UBYTE * b_tlli,
185 ULONG tlli );
186
187 EXTERN UBYTE grr_calculate_Ttb (UBYTE ul_usage,UBYTE dl_usage);
188
189 EXTERN UBYTE grr_calculate_Tra (UBYTE ul_usage,UBYTE dl_usage);
190
191 EXTERN UBYTE grr_reconstruct_dl_usage(UBYTE dl_usage);
192
193 EXTERN void grr_encode_ul_ctrl_block ( UBYTE *ul_ctrl_block,
194 UBYTE *ul_ctrl_data );
195
196 EXTERN UBYTE grr_get_ul_ctrl_block_header ( UBYTE r_bit );
197
198 EXTERN BOOL grr_check_if_tbf_start_is_elapsed ( ULONG start_fn, ULONG current_fn);
199
200 EXTERN UBYTE grr_get_gprs_ms_class( void );
201
202 EXTERN BOOL grr_store_cs_param ( T_NC_LIST *nc_list,
203 BOOL v_cs_par,
204 T_cs_par *cs_par,
205 T_INFO_TYPE type,
206 UBYTE instance,
207 UBYTE *number,
208 USHORT *last_arfcn,
209 USHORT arfcn,
210 UBYTE bsic );
211 EXTERN void grr_store_si13_pbcch_location
212 ( T_CR_PAR *cr_par,
213 BOOL v_si13_pbcch,
214 T_si13_pbcch *si13_pbcch );
215 EXTERN void grr_restore_cs_param ( T_ncell_info *curr_info,
216 T_ncell_info *prev_info,
217 UBYTE curr_idx );
218 EXTERN T_ncell_info* grr_get_next_ncell_param
219 ( UBYTE max_number,
220 T_NC_LIST *list,
221 T_INFO_SRC info_src );
222 EXTERN T_ncell_info* grr_get_next_bigger_ncell_param
223 ( T_NC_LIST *list,
224 T_INFO_SRC info_src );
225
226 EXTERN void grr_handle_ta ( UBYTE v_tav,
227 UBYTE tav,
228 UBYTE v_ul_tai,
229 UBYTE ul_tai,
230 UBYTE ul_tatn,
231 UBYTE v_dl_tai,
232 UBYTE dl_tai,
233 UBYTE dl_tatn,
234 T_p_timing_advance *ptr2ta);
235 /*NEWFILES*/
236 EXTERN void grr_decode_rlcmac ( UBYTE * ptr_msg_i, T_D_HEADER * ptr_d_header_i );
237 EXTERN T_MSGBUF * grr_handle_rlcmac_header ( T_PACKET_MODE mode_i,
238 T_D_HEADER * ptr_header_i,
239 ULONG fn_i );
240 EXTERN void grr_increase_dsc ( void );
241 EXTERN BOOL grr_decrease_dsc ( void );
242
243 #define grr_g23_arfcn_to_l1(arfcn) convert_arfcn_to_l1(arfcn,0)
244 #define grr_l1_arfcn_to_g23(arfcn) convert_arfcn_to_g23(arfcn,0)
245
246 EXTERN USHORT convert_arfcn_to_l1 (USHORT arfcn, UBYTE std);
247 EXTERN USHORT convert_arfcn_to_g23 (USHORT arfcn, UBYTE std);
248
249 EXTERN T_TIME grr_t_status( USHORT t_index );
250
251 #define SET_GPRS_RXLEV_ACCESS_MIN(a,v_b,b) (a=(v_b?b:GPRS_RXLEV_ACCESS_MIN_INVALID))
252 #define SET_GPRS_MS_TXPWR_MAX_CCH(a,v_b,b) (a=(v_b?b:GPRS_MS_TXPWR_MAX_CCH_INVALID))
253 #define SET_GPRS_TEMP_OFFSET(a,v_b,b) (a=(v_b?b:GPRS_TEMPORARY_OFFSET_INVALID))
254 #define SET_GPRS_PENALTY_TIME(a,v_b,b) (a=(v_b?b:GPRS_PENALTY_TIME_INVALID ))
255 #define SET_GPRS_RESEL_OFF(a,v_b,b) \
256 (a=(v_b?b:(grr_is_pbcch_present()?GPRS_RESEL_OFF_DEFAULT:GPRS_RESEL_OFF_INVALID)))
257 #define SET_GPRS_HCS_THR(a,v_b,b) (a=(v_b?b:GPRS_HCS_THR_INVALID ))
258 #define SET_GPRS_PRIO_CLASS(a,v_b,b) (a=(v_b?b:GPRS_PRIORITY_CLASS_INVALID ))
259
260 EXTERN T_NC_MVAL* grr_get_nc_mval ( USHORT arfcn, UBYTE bsic, UBYTE *idx );
261 EXTERN T_ncell_info* grr_get_ncell_info ( USHORT arfcn, UBYTE bsic );
262
263 EXTERN void grr_set_pbcch ( BOOL pbcch_presence );
264 EXTERN void grr_set_freq_par ( T_p_frequency_par *freq_par );
265 EXTERN BOOL grr_get_pccch_freq_par( UBYTE pccch_group,
266 T_p_chan_sel *chan_sel,
267 T_p_freq_list *freq_list );
268
269 EXTERN void grr_cgrlc_pwr_ctrl_cnf ( T_CGRLC_PWR_CTRL_CNF *cgrlc_pwr_ctrl_cnf );
270 EXTERN void grr_cgrlc_pwr_ctrl_req ( BOOL v_c_value );
271 EXTERN void grr_prcs_pwr_ctrl ( T_CGRLC_pwr_ctrl *pwr_ctrl,
272 BOOL v_c_value );
273 EXTERN UBYTE grr_get_ms_txpwr_max_cch( USHORT arfcn,
274 UBYTE pwr_offset,
275 UBYTE gprs_ms_txpwr_max_cch );
276 EXTERN UBYTE grr_get_pms_max ( USHORT arfcn,
277 UBYTE pwr_offset,
278 UBYTE gprs_ms_txpwr_max_cch,
279 T_MS_PWR_CAP *mspc );
280 EXTERN void grr_get_ms_pwr_cap ( USHORT arfcn,
281 UBYTE pow_offset,
282 T_MS_PWR_CAP *mspc );
283 EXTERN UBYTE grr_get_pcl ( UBYTE const *p_ctrl,
284 SHORT nop );
285
286 EXTERN void grr_get_ms_pwr_cap_gsm900 ( UBYTE rf_pow_cap,
287 T_MS_PWR_CAP *mspc );
288 EXTERN void grr_get_ms_pwr_cap_dcs1800( UBYTE rf_pow_cap,
289 UBYTE pow_offset,
290 T_MS_PWR_CAP *mspc );
291 EXTERN void grr_get_ms_pwr_cap_pcs1900( UBYTE rf_pow_cap,
292 UBYTE pow_offset,
293 T_MS_PWR_CAP *mspc );
294 EXTERN UBYTE grr_get_power_class ( UBYTE index );
295
296 EXTERN void grr_set_cell_info_service( void );
297
298 EXTERN BOOL grr_is_packet_idle_mode( void );
299
300 EXTERN void grr_clip_rxlev ( UBYTE *clipp,
301 UBYTE *rxlev,
302 UBYTE number );
303
304 EXTERN T_gprs_ms_alloc_ie* grr_get_gprs_ma (UBYTE ma_num);
305
306 EXTERN BOOL grr_validate_ma_num_in_freq_par (const T_freq_par *freq_par,UBYTE msg_type);
307
308 EXTERN BOOL grr_get_ref_list_or_cell_allocation (T_LIST *list1,
309 const T_gprs_ms_alloc_ie *gp_ma,
310 UBYTE ma_num);
311 EXTERN BOOL grr_validate_and_count_frequencies ( USHORT radio_freq_list[MPHP_NUMC_MA],
312 USHORT* ptr_cnt);
313
314 #ifdef REL99
315
316 EXTERN T_TIME grr_get_time_to_send_poll(UBYTE rrbp);
317
318 /*
319 * Though this funciton is called only by TC, it is placed in
320 * grr_f.c so that the temporary static arrays ussed by this
321 * fuction can be shared by other function[grr_cnv_freq_para_in_psi8_direct_enc_2]
322 * used by CTRL.
323 */
324 EXTERN BOOL grr_cnv_freq_para_in_assignment_direct_enc_2 (T_p_frequency_par *frequency_par,
325 T_freq_par *freq_par);
326
327 EXTERN BOOL grr_cnv_freq_para_in_psi8_direct_enc_2 (T_cbch *cbch_req,
328 const T_freq_par *freq_par);
329
330 #ifdef TI_PS_FF_EMR
331 EXTERN void grr_init_ba_bcch_nc_list ( T_SC_DATABASE *db );
332
333 EXTERN void grr_init_enh_param ( T_GRR_ENH_PARA *param,
334 BOOL rep_prio_pres );
335
336 GLOBAL void grr_init_enh_cell_list ( void );
337
338 EXTERN void grr_prcs_enh_param_cw_temp ( T_GRR_ENH_PARA *db_enh,
339 T_enh_rep_param_struct *air_enh,
340 UBYTE new_idx );
341
342 EXTERN void grr_prcs_enh_param_pmo ( T_GRR_ENH_PARA *db_enh,
343 T_enh_meas_param_pmo *air_enh,
344 UBYTE new_idx, UBYTE *pmo_ind );
345 EXTERN void grr_prcs_enh_param_pcco ( T_SC_DATABASE *db,
346 T_enh_meas_param_pcco *air_enh );
347
348 EXTERN void grr_copy_enh_and_nc_params_from_si2qtr
349 (T_RRGRR_SI2QUATER_IND
350 *rrgrr_si2quater_ind );
351
352 EXTERN UBYTE grr_get_psi3_cm(void);
353 #endif
354
355 #endif
356
357 #endif /* !GRR_F_H */
358