comparison src/g23m-gprs/grr/grr_pei.c @ 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 : This module implements the process body interface
18 | for the entity GPRS Radio Resource Management (GRR)
19 |
20 | Exported functions:
21 |
22 | pei_create - Create the Protocol Stack Entity
23 | pei_init - Initialize Protocol Stack Entity
24 | pei_primitive - Process Primitive
25 | pei_timeout - Process Timeout
26 | pei_exit - Close resources and terminate
27 | pei_run - Process Primitive
28 | pei_config - Dynamic Configuration
29 | pei_monitor - Monitoring of physical Parameters
30 |+-----------------------------------------------------------------------------
31 */
32
33 #define GRR_PEI_C
34
35 #define ENTITY_GRR
36
37 /*==== INCLUDES =============================================================*/
38
39 #include <stdio.h>
40 #include <string.h>
41 #include <stdlib.h>
42 #include <stddef.h> /* to get definition of offsetof(), for MAK_FUNC_S */
43 #include "typedefs.h" /* to get Condat data types */
44 #include "vsi.h" /* to get a lot of macros */
45 #include "macdef.h"
46 #include "gprs.h"
47
48 #include "custom.h" /*FMM*/ /*set FF_EM_MODE compile switch for SIMULATION and define WAP_NAME*/
49
50 #include "gsm.h" /* to get a lot of macros */
51 #include "ccdapi.h" /* to get CCD API */
52 #include "cnf_grr.h" /* to get cnf-definitions */
53 #include "mon_grr.h" /* to get mon-definitions */
54
55 #include "prim.h" /* to get the definitions of used SAP and directions */
56 #include "message.h"
57 #include "tok.h"
58 #include "pcm.h"
59
60 #include "grr.h" /* to get the global entity definitions */
61 #include "grr_f.h"
62 #include "grr_gfpp.h"
63 #include "grr_measp.h"
64 #include "grr_csp.h"
65 #include "grr_pgp.h"
66 #include "grr_psip.h"
67 #include "grr_tcp.h"
68
69 #ifdef _SIMULATION_
70 #include "grr_meass.h" /* to get definition of meas_init() */
71 #endif /* #ifdef _SIMULATION_ */
72
73 #include "grr_cpapp.h"
74 #include "grr_css.h"
75 #include "grr_ctrlp.h"
76 #include "grr_em.h" /*for Engineering mode*/
77
78
79
80 /*==== DEFINITIONS ==========================================================*/
81
82 #define GRR_TSTR_ILLEGAL_KEYW 0
83 #define GRR_TSTR_OK 1
84
85 /*==== TYPES ================================================================*/
86
87 /*==== GLOBAL VARS ==========================================================*/
88
89 /*==== LOCAL VARS ===========================================================*/
90
91 /*
92 * Function is needed for grr_table[].
93 */
94
95 LOCAL SHORT pei_signal (ULONG opc, void *data);
96
97 static BOOL first_access = TRUE;
98 static T_MONITOR grr_mon;
99
100
101 /*
102 * Jumptables to primitive handler functions. One table per SAP.
103 *
104 * Use MAK_FUNC_0 for primitives which contains no SDU.
105 * Use MAK_FUNC_S for primitives which contains a SDU.
106 */
107
108
109 /*
110 * Function is needed for grr_table[]. This declaration can be removed
111 * as soon as this function is no more called (i.e. all primitives are
112 * handled).
113 */
114 LOCAL void primitive_not_supported (void *data);
115
116
117
118 static const T_FUNC gmmrr_table[] =
119 {
120 MAK_FUNC_0(ctrl_gmmrr_assign_req, GMMRR_ASSIGN_REQ),
121 MAK_FUNC_0(ctrl_gmmrr_enable_req, GMMRR_ENABLE_REQ),
122 MAK_FUNC_0(ctrl_gmmrr_disable_req, GMMRR_DISABLE_REQ),
123 MAK_FUNC_0(ctrl_gmmrr_ready_req, GMMRR_READY_REQ),
124 MAK_FUNC_0(ctrl_gmmrr_standby_req, GMMRR_STANDBY_REQ),
125 MAK_FUNC_0(ctrl_gmmrr_cs_page_res, GMMRR_CS_PAGE_RES),
126 MAK_FUNC_0(ctrl_gmmrr_suspend_req, GMMRR_SUSPEND_REQ),
127 MAK_FUNC_0(ctrl_gmmrr_resume_req, GMMRR_RESUME_REQ),
128 MAK_FUNC_N(primitive_not_supported, 0),
129 MAK_FUNC_N(primitive_not_supported, 0),
130 MAK_FUNC_0(ctrl_gmmrr_attach_started_req, GMMRR_ATTACH_STARTED_REQ),
131 MAK_FUNC_0(ctrl_gmmrr_attach_finished_req, GMMRR_ATTACH_FINISHED_REQ),
132 MAK_FUNC_0(ctrl_gmmrr_cell_res, GMMRR_CELL_RES)
133 };
134
135
136 static const T_FUNC cgrlc_table[] =
137 {
138 MAK_FUNC_0(tc_cgrlc_tbf_rel_ind, CGRLC_TBF_REL_IND),
139 MAK_FUNC_0(tc_cgrlc_ul_tbf_ind, CGRLC_UL_TBF_IND),
140 MAK_FUNC_0(gfp_cgrlc_data_ind, CGRLC_DATA_IND),
141 MAK_FUNC_0(tc_cgrlc_ctrl_msg_sent_ind, CGRLC_CTRL_MSG_SENT_IND),
142 MAK_FUNC_0(tc_cgrlc_starting_time_ind, CGRLC_STARTING_TIME_IND),
143 MAK_FUNC_0(tc_cgrlc_t3192_started_ind, CGRLC_T3192_STARTED_IND),
144 MAK_FUNC_0(tc_cgrlc_cont_res_done_ind, CGRLC_CONT_RES_DONE_IND),
145 MAK_FUNC_0(tc_cgrlc_ta_value_ind, CGRLC_TA_VALUE_IND),
146 MAK_FUNC_N(primitive_not_supported, 0),
147 MAK_FUNC_N(primitive_not_supported, 0),
148 MAK_FUNC_N(primitive_not_supported, 0),
149 MAK_FUNC_0(ctrl_cgrlc_standby_state_ind, CGRLC_STANDBY_STATE_IND),
150 MAK_FUNC_0(ctrl_cgrlc_ready_state_ind, CGRLC_READY_STATE_IND),
151 MAK_FUNC_0(grr_cgrlc_pwr_ctrl_cnf, CGRLC_PWR_CTRL_CNF),
152 MAK_FUNC_0(tc_cgrlc_test_mode_ind, CGRLC_TEST_MODE_IND)
153 };
154
155
156 /* according to l1p_sign.h */
157 static const T_FUNC mphp_table[] =
158 {
159 MAK_FUNC_N(primitive_not_supported, 0), /*0*/
160 MAK_FUNC_N(primitive_not_supported, 0), /*1*/
161 MAK_FUNC_0(gfp_mphp_single_block_con, MPHP_SINGLE_BLOCK_CON), /*2*/
162 MAK_FUNC_N(primitive_not_supported, 0), /*3*/
163 MAK_FUNC_0(gfp_mphp_stop_single_block_con, MPHP_STOP_SINGLE_BLOCK_CON), /*4*/
164 MAK_FUNC_N(primitive_not_supported, 0), /*5*/
165 MAK_FUNC_N(primitive_not_supported, 0), /*6*/
166 MAK_FUNC_0(gfp_mphp_assignment_con, MPHP_ASSIGNMENT_CON), /*7*/
167 MAK_FUNC_N(primitive_not_supported, 0), /*8*/
168 MAK_FUNC_0(gfp_mphp_tbf_release_con, MPHP_TBF_RELEASE_CON), /*9*/
169 MAK_FUNC_N(primitive_not_supported, 0), /*10*/
170 MAK_FUNC_0(gfp_mphp_repeat_ul_fixed_alloc_con, MPHP_REPEAT_UL_FIXED_ALLOC_CON), /*11*/
171 MAK_FUNC_N(primitive_not_supported, 0), /*12*/
172 MAK_FUNC_0(gfp_mphp_pdch_release_con, MPHP_PDCH_RELEASE_CON), /*13*/
173 MAK_FUNC_N(primitive_not_supported, 0), /*14*/
174 MAK_FUNC_0(gfp_mphp_timing_advance_con, MPHP_TIMING_ADVANCE_CON), /*15*/
175 MAK_FUNC_N(primitive_not_supported, 0), /*16*/
176 MAK_FUNC_0(gfp_mphp_update_psi_param_con, MPHP_UPDATE_PSI_PARAM_CON), /*17*/
177 MAK_FUNC_N(primitive_not_supported, 0), /*18*/
178 MAK_FUNC_0(gfp_mphp_ra_con, MPHP_RA_CON), /*19*/
179 MAK_FUNC_N(primitive_not_supported, 0), /*20*/
180 MAK_FUNC_0(gfp_mphp_ra_stop_con, MPHP_RA_STOP_CON), /*21*/
181 MAK_FUNC_N(primitive_not_supported, 0), /*22*/
182 MAK_FUNC_0(gfp_mphp_polling_ind, MPHP_POLLING_IND), /*23*/
183 MAK_FUNC_N(primitive_not_supported, 0), /*24*/
184 MAK_FUNC_N(primitive_not_supported, 0), /*25*/
185 MAK_FUNC_N(primitive_not_supported, 0), /*26*/
186 MAK_FUNC_0(gfp_mphp_stop_pccch_con, MPHP_STOP_PCCCH_CON), /*27*/
187 MAK_FUNC_N(primitive_not_supported, 0), /*28*/
188 MAK_FUNC_N(primitive_not_supported, 0), /*29*/
189 MAK_FUNC_0(gfp_mphp_scell_pbcch_stop_con, MPHP_SCELL_PBCCH_STOP_CON), /*30*/
190 MAK_FUNC_N(primitive_not_supported, 0), /*31*/
191 MAK_FUNC_N(primitive_not_supported, 0), /*32*/
192 MAK_FUNC_0(gfp_mphp_cr_meas_stop_con, MPHP_CR_MEAS_STOP_CON), /*33*/
193 MAK_FUNC_N(primitive_not_supported, 0), /*34*/
194 MAK_FUNC_N(primitive_not_supported, 0), /*35*/
195 MAK_FUNC_0(gfp_mphp_int_meas_stop_con, MPHP_INT_MEAS_STOP_CON), /*36*/
196 MAK_FUNC_N(primitive_not_supported, 0), /*37*/
197 MAK_FUNC_N(primitive_not_supported, 0), /*38*/
198 MAK_FUNC_0(gfp_mphp_ncell_pbcch_stop_con, MPHP_NCELL_PBCCH_STOP_CON), /*39*/
199 MAK_FUNC_0(gfp_mphp_data_ind, MPHP_DATA_IND), /*40*/
200 MAK_FUNC_0(gfp_mphp_cr_meas_ind, MPHP_CR_MEAS_IND), /*41*/
201 MAK_FUNC_0(gfp_mphp_int_meas_ind, MPHP_INT_MEAS_IND), /*42*/
202 MAK_FUNC_0(gfp_mphp_tint_meas_ind, MPHP_TINT_MEAS_IND), /*43*/
203 MAK_FUNC_0(gfp_mphp_ncell_pbcch_ind, MPHP_NCELL_PBCCH_IND), /*44*/
204 MAK_FUNC_N(primitive_not_supported, 0), /*45*/
205 MAK_FUNC_0(gfp_mphp_tcr_meas_ind, MPHP_TCR_MEAS_IND) /*46*/
206 };
207
208
209
210 static const T_FUNC rrgrr_table[] =
211 {
212 MAK_FUNC_0(ctrl_rrgrr_gprs_si13_ind, RRGRR_GPRS_SI13_IND), /* 0 */
213 MAK_FUNC_N(primitive_not_supported, 0), /* 1: NOT USED */
214 MAK_FUNC_0(ctrl_rrgrr_packet_paging_ind, RRGRR_PACKET_PAGING_IND), /* 2 */
215 MAK_FUNC_0(ctrl_rrgrr_ia_ind, RRGRR_IA_IND), /* 3 */
216 MAK_FUNC_0(ctrl_rrgrr_iaext_ind, RRGRR_IAEXT_IND), /* 4 */
217 MAK_FUNC_0(ctrl_rrgrr_assignment_rej_ind, RRGRR_ASSIGNMENT_REJ_IND), /* 5 */
218 MAK_FUNC_0(ctrl_rrgrr_data_ind, RRGRR_DATA_IND), /* 6 */
219 MAK_FUNC_N(primitive_not_supported, RRGRR_RESUMED_TBF_CNF), /* 7 */
220 MAK_FUNC_0(ctrl_rrgrr_ia_downlink_ind, RRGRR_IA_DOWNLINK_IND), /* 8 */
221 MAK_FUNC_0(ctrl_rrgrr_stop_task_cnf, RRGRR_STOP_TASK_CNF), /* 9 */
222 MAK_FUNC_0(ctrl_rrgrr_ext_meas_cnf, RRGRR_EXT_MEAS_CNF), /* A */
223 MAK_FUNC_N(primitive_not_supported, 0), /* B */
224 MAK_FUNC_N(primitive_not_supported, 0), /* C */
225 MAK_FUNC_0(ctrl_rrgrr_rr_est_ind, RRGRR_RR_EST_IND), /* D */
226 MAK_FUNC_N(primitive_not_supported, 0), /* E */
227 MAK_FUNC_N(primitive_not_supported, 0), /* F: NOT USED */
228 MAK_FUNC_0(ctrl_rrgrr_suspend_dcch_cnf, RRGRR_SUSPEND_DCCH_CNF), /* 10 */
229 MAK_FUNC_0(ctrl_rrgrr_reconnect_dcch_cnf, RRGRR_RECONNECT_DCCH_CNF), /* 11 */
230 MAK_FUNC_0(ctrl_rrgrr_stop_dcch_ind, RRGRR_STOP_DCCH_IND), /* 12 */
231 MAK_FUNC_0(ctrl_rrgrr_cr_ind, RRGRR_CR_IND), /* 13 */
232 MAK_FUNC_N(primitive_not_supported, 0), /* 14: NOT USED */
233 MAK_FUNC_0(ctrl_rrgrr_check_bsic_ind, RRGRR_NCELL_SYNC_IND), /* 15 */
234 MAK_FUNC_0(ctrl_rrgrr_sync_ind, RRGRR_SYNC_IND), /* 16 */
235 MAK_FUNC_0(ctrl_rrgrr_meas_rep_cnf, RRGRR_MEAS_REP_CNF), /* 17 */
236 MAK_FUNC_N(primitive_not_supported, 0), /* 18: NOT USED */
237 MAK_FUNC_0(ctrl_rrgrr_ms_id_ind, RRGRR_MS_ID_IND), /* 19 */
238 MAK_FUNC_0(primitive_not_supported, RRGRR_START_TASK_CNF) /* 1A */
239
240 #if defined (REL99) AND defined (TI_PS_FF_EMR)
241 ,
242 MAK_FUNC_0(ctrl_rrgrr_si2quater_ind, RRGRR_SI2QUATER_IND) /* 1B */
243 #endif
244
245 };
246
247 static const T_FUNC tb_table[] =
248 {
249 MAK_FUNC_0(meas_tb_rxlev_sc_req, TB_RXLEV_SC_REQ) /*0*/
250 };
251
252 #ifdef FF_EM_MODE
253 static const T_FUNC em_ul_table[] =
254 {
255 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x00 */
256 MAK_FUNC_0(grr_em_sc_gprs_info_req, EM_SC_GPRS_INFO_REQ ), /* 0x01 */
257 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x02 */
258 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x03 */
259 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x04 */
260 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x05 */
261 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x06 */
262 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x07 */
263 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x08 */
264 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x09 */
265 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x0A */
266 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x0B */
267 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x0C */
268 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x0D */
269 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x0E */
270 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x0F */
271 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x10 */
272 MAK_FUNC_0(grr_em_pco_trace_req, EM_PCO_TRACE_REQ ), /* 0x11*/ /*PCO output*/
273 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x12 */
274 MAK_FUNC_0(grr_em_fmm_sc_gprs_info_req, EM_FMM_SC_GPRS_INFO_REQ), /* 0x13 */
275 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x14 */
276 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x15 */
277 MAK_FUNC_0(grr_em_fmm_tbf_info_req, EM_FMM_TBF_INFO_REQ ) /* 0x16 */
278 };
279 #endif /* FF_EM_MODE */
280
281
282
283
284 /*==== END DIAGNOSTICS ======================================================*/
285
286 /*==== PRIVATE FUNCTIONS ====================================================*/
287
288 /*
289 +------------------------------------------------------------------------------
290 | Function : primitive_not_supported
291 +------------------------------------------------------------------------------
292 | Description : This function handles unsupported primitives.
293 |
294 | Parameters : -
295 |
296 | Return : -
297 |
298 +------------------------------------------------------------------------------
299 */
300 LOCAL void primitive_not_supported (void *data)
301 {
302 TRACE_FUNCTION ("primitive_not_supported");
303
304 PFREE (data);
305 }
306
307
308 /*==== PUBLIC FUNCTIONS =====================================================*/
309
310 /*
311 +------------------------------------------------------------------------------
312 | Function : pei_primitive
313 +------------------------------------------------------------------------------
314 | Description : This function is called by the frame when a primitive is
315 | received and needs to be processed.
316 |
317 | | |
318 | GRR GMMRR UPLINK
319 | | |
320 | +------v-----------v-------+
321 | | |
322 | | GRR <--RRGRR--
323 | | |
324 | +--------------^------- ---+
325 | |
326 | L1 DOWNLINK
327 | |
328 |
329 |
330 | Parameters : prim - Pointer to the received primitive
331 |
332 | Return : PEI_OK - function succeeded
333 | PEI_ERROR - function failed
334 |
335 +------------------------------------------------------------------------------
336 */
337 LOCAL SHORT pei_primitive (void * primptr)
338 {
339 TRACE_FUNCTION ("pei_primitive");
340
341 if (primptr NEQ NULL)
342 {
343 T_PRIM *prim = (T_PRIM *)primptr;
344 ULONG opc = prim->custom.opc;
345 USHORT n;
346 const T_FUNC *table;
347
348 PTRACE_IN (opc);
349
350 /*
351 * This must be called for Partition Pool supervision. Will be replaced
352 * by another macro some time.
353 */
354 VSI_PPM_REC (&prim->custom, __FILE__, __LINE__);
355
356 switch (SAP_NR(opc))
357 {
358 case MPHP_DL:
359 table = mphp_table;
360 n = TAB_SIZE (mphp_table);
361 break;
362 case TB_DL:
363 table = tb_table;
364 n = TAB_SIZE (tb_table);
365 break;
366 case SAP_NR(CGRLC_DL):
367 table = cgrlc_table;
368 n = TAB_SIZE (cgrlc_table);
369 break;
370 case GMMRR_UL:
371 table = gmmrr_table;
372 n = TAB_SIZE (gmmrr_table);
373 break;
374 case RRGRR_DL:
375 table = rrgrr_table;
376 n = TAB_SIZE (rrgrr_table);
377 break;
378 #ifdef FF_EM_MODE
379 case EM_Ul:
380 table = em_ul_table;
381 n = TAB_SIZE (em_ul_table);
382 break;
383 #endif /* FF_EM_MODE */
384 default:
385 table = NULL;
386 n = 0;
387 break;
388 }
389
390 if (table != NULL)
391 {
392 if ((PRIM_NR(opc)) < n)
393 {
394 table += PRIM_NR(opc);
395 #ifdef PALLOC_TRANSITION
396 P_SDU(prim) = table->soff ? (T_sdu*) (((char*)&prim->data) + table->soff) : 0;
397 #ifndef NO_COPY_ROUTING
398 P_LEN(prim) = table->size + sizeof (T_PRIM_HEADER);
399 #endif /* NO_COPY_ROUTING */
400 #endif /* PALLOC_TRANSITION */
401 JUMP (table->func) (P2D(prim));
402 }
403 else
404 {
405 primitive_not_supported (P2D(prim));
406 }
407 return PEI_OK;
408 }
409 }
410 return PEI_OK;
411 }
412
413 /*
414 +------------------------------------------------------------------------------
415 | Function : pei_init
416 +------------------------------------------------------------------------------
417 | Description : This function is called by the frame. It is used to initialise
418 | the entitiy.
419 |
420 | Parameters : handle - task handle
421 |
422 | Return : PEI_OK - entity initialised
423 | PEI_ERROR - entity not (yet) initialised
424 |
425 +------------------------------------------------------------------------------
426 */
427 LOCAL SHORT pei_init (T_HANDLE handle)
428 {
429 TRACE_FUNCTION ("pei_init");
430
431 /*
432 * Initialize task handle
433 */
434 GRR_handle = handle;
435
436
437 /*
438 * Open communication channels
439 */
440 if (hCommGRR < VSI_OK)
441 {
442 if ((hCommGRR = vsi_c_open (VSI_CALLER GRR_NAME)) < VSI_OK)
443 return PEI_ERROR;
444 }
445 if (hCommGMM < VSI_OK)
446 {
447 if ((hCommGMM = vsi_c_open (VSI_CALLER GMM_NAME)) < VSI_OK)
448 return PEI_ERROR;
449 }
450 if (hCommGRLC < VSI_OK)
451 {
452 if ((hCommGRLC = vsi_c_open (VSI_CALLER GRLC_NAME)) < VSI_OK)
453 return PEI_ERROR;
454 }
455 if (hCommRR < VSI_OK)
456 {
457 if ((hCommRR = vsi_c_open (VSI_CALLER RR_NAME)) < VSI_OK)
458 return PEI_ERROR;
459 }
460 if (hCommL1 < VSI_OK)
461 {
462 if ((hCommL1 = vsi_c_open (VSI_CALLER L1_NAME)) < VSI_OK)
463 return PEI_ERROR;
464 }
465
466 if (hCommPL < VSI_OK)
467 {
468 if ((hCommPL = vsi_c_open (VSI_CALLER PL_NAME)) < VSI_OK)
469 return PEI_ERROR;
470 }
471 #ifdef FF_WAP /*FFM*/
472 if (hCommWAP < VSI_OK)
473 {
474 if ((hCommWAP = vsi_c_open (VSI_CALLER WAP_NAME)) < VSI_OK)
475 return PEI_ERROR;
476 }
477 #endif
478 /*
479 * call function pcm_Init to be sure that the global variable std
480 * is set before the initialisation of the GRR services takes place
481 */
482 pcm_Init();
483
484 /*
485 * Initialize entity data (call init function of every service)
486 */
487 grr_init();
488
489 /* {
490 PALLOC (tst_test_hw_req, TST_TEST_HW_REQ);
491 PSEND (hCommL1, tst_test_hw_req);
492 }*/
493 return (PEI_OK);
494 }
495
496 /*
497 +------------------------------------------------------------------------------
498 | Function : pei_timeout
499 +------------------------------------------------------------------------------
500 | Description : This function is called by the frame when a timer has expired.
501 |
502 | Parameters : index - timer index
503 |
504 | Return : PEI_OK - timeout processed
505 | PEI_ERROR - timeout not processed
506 |
507 +------------------------------------------------------------------------------
508 */
509 LOCAL SHORT pei_timeout (USHORT index)
510 {
511 TRACE_FUNCTION ("pei_timeout");
512
513 /*
514 * Process timeout
515 */
516 switch (index) /* SZML-GLBL/007 */
517 {
518 case T3134: ctrl_t3134(); break;
519 case T3158: cs_t3158(); break;
520 case T3162: tc_t3162(); break;
521 case T3168: tc_t3168(); break;
522 case T3170: tc_t3170(); break;
523 case T3172_1: tc_t3172(T3172_1); break;
524 /* case T3172_2: tc_t3172(T3172_2); break; */
525 /* case T3172_3: tc_t3172(T3172_3); break; */
526 /* case T3172_4: tc_t3172(T3172_4); break; */
527 /* case T3172_5: tc_t3172(T3172_5); break; */
528 /* case T3172_6: tc_t3172(T3172_6); break; */
529 /* case T3172_7: tc_t3172(T3172_7); break; */
530 case T3174: ctrl_t3174(); break;
531 case T3176: ctrl_t3176(); break;
532 case T3178: meas_t3178(); break;
533 case T3186: tc_t3186(); break;
534 case T_60_SEC: psi_t_60_sec(); break;
535 case T_30_SEC: psi_t_30_sec(); break;
536 case T_10_SEC: psi_t_10_sec(); break;
537 case T_IM_SYNC: meas_t_im_sync(); break;
538 case T15_SEC_CC: /* no action required when timer expires!! */ break;
539 case T_TRANS_NON_DRX: grr_handle_non_drx_period( TRANSFER_NDRX, FALSE ); break;
540 case T_NC2_NON_DRX: grr_handle_non_drx_period( NC2_NDRX, FALSE ); break;
541 case T_COMP_PSI: psi_complete_psi_read_failed(); break;
542 case T_RESELECT: cs_t_reselect(); break;
543 #ifdef REL99
544 case T_POLL_TIMER: ctrl_t_poll_timer(); break;
545 #endif
546 default: TRACE_EVENT_P1( "Unknown Timeout: %d", index ); break;
547 }
548
549 return PEI_OK;
550 }
551
552 /*
553 +------------------------------------------------------------------------------
554 | Function : pei_signal
555 +------------------------------------------------------------------------------
556 | Description : This function is called by the frame when a signal has been
557 | received.
558 |
559 | Parameters : opc - signal operation code
560 | *data - pointer to primitive
561 |
562 | Return : PEI_OK - signal processed
563 | PEI_ERROR - signal not processed
564 |
565 +------------------------------------------------------------------------------
566 */
567 LOCAL SHORT pei_signal (ULONG opc, void *data)
568 {
569
570 TRACE_FUNCTION ("pei_signal");
571 /*
572 * Process signal
573 */
574
575 TRACE_EVENT_P1( "Unknown Signal: %08X", opc );
576
577
578
579 return(PEI_OK);
580 }
581
582 /*
583 +------------------------------------------------------------------------------
584 | Function : pei_exit
585 +------------------------------------------------------------------------------
586 | Description : This function is called by the frame when the entity is
587 | terminated. All open resources are freed.
588 |
589 | Parameters : -
590 |
591 | Return : PEI_OK - exit sucessful
592 | PEI_ERROR - exit not sueccessful
593 |
594 +------------------------------------------------------------------------------
595 */
596 LOCAL SHORT pei_exit (void)
597 {
598 TRACE_FUNCTION ("pei_exit");
599
600 /*
601 * Close communication channels
602 */
603 vsi_c_close (VSI_CALLER hCommGRR);
604 hCommGRR = VSI_ERROR;
605
606 vsi_c_close (VSI_CALLER hCommGMM);
607 hCommGMM = VSI_ERROR;
608
609 vsi_c_close (VSI_CALLER hCommRR);
610 hCommRR = VSI_ERROR;
611
612 vsi_c_close (VSI_CALLER hCommGRLC);
613 hCommGRLC = VSI_ERROR;
614
615 vsi_c_close (VSI_CALLER hCommL1);
616 hCommL1 = VSI_ERROR;
617
618 vsi_c_close (VSI_CALLER hCommPL);
619 hCommPL = VSI_ERROR;
620
621 ccd_exit();
622
623 #ifdef FF_WAP /*FFM*/
624 vsi_c_close (VSI_CALLER hCommWAP);
625 hCommWAP = VSI_ERROR;
626 #endif
627
628 return PEI_OK;
629 }
630
631 /*
632 +------------------------------------------------------------------------------
633 | Function : pei_run
634 +------------------------------------------------------------------------------
635 | Description : This function is called by the frame when entering the main
636 | loop. This fucntion is only required in the active variant.
637 |
638 | This function is not used.
639 |
640 | Parameters : handle - Communication handle
641 |
642 | Return : PEI_OK - sucessful
643 | PEI_ERROR - not successful
644 |
645 +------------------------------------------------------------------------------
646 */
647 LOCAL SHORT pei_run (T_HANDLE TaskHandle, T_HANDLE ComHandle )
648 {
649
650 return PEI_OK;
651 }
652
653 /*
654 +------------------------------------------------------------------------------
655 | Function : pei_config
656 +------------------------------------------------------------------------------
657 | Description : This function is called by the frame when a primitive is
658 | received indicating dynamic configuration.
659 |
660 | This function is not used in this entity.
661 |
662 | Parameters : handle - Communication handle
663 |
664 | Return : PEI_OK - sucessful
665 | PEI_ERROR - not successful
666 |
667 +------------------------------------------------------------------------------
668 */
669 #if !defined (NCONFIG)
670 LOCAL const KW_DATA kwtab[] =
671 {
672 GRR_STR_IM_INIT, GRR_NUM_IM_INIT,
673 GRR_STR_TBF_CCCH, GRR_NUM_TBF_CCCH,
674 GRR_STR_NO_TBF_CCCH, GRR_NUM_NO_TBF_CCCH,
675 #if !defined (NTRACE)
676 GRR_STR_CRP_TRACE, GRR_NUM_CRP_TRACE,
677 GRR_STR_IM_TRACE, GRR_NUM_IM_TRACE,
678 #endif /* #if !defined (NTRACE) */
679 #ifdef _SIMULATION_
680 GRR_STR_RES_RANDOM, GRR_NUM_RES_RANDOM,
681 GRR_STR_STD, GRR_NUM_STD,
682 GRR_STR_NC2, GRR_NUM_NC2,
683
684 #endif /* #ifdef _SIMULATION_ */
685
686
687 "", 0
688 };
689 #endif /* #if !defined (NCONFIG) */
690
691
692 LOCAL SHORT pei_config (char *inString)
693 {
694 #if !defined (NCONFIG)
695 char * s = inString;
696 char * keyw;
697 char * val [10];
698
699 TRACE_FUNCTION( "pei_config" );
700
701 TRACE_EVENT_P1( "[PEI_CONFIG]: %s", inString );
702
703 tok_init(s);
704
705 /*
706 * Parse next keyword and number of variables
707 */
708 while ((tok_next(&keyw,val)) != TOK_EOCS)
709 {
710 UBYTE ncomment = GRR_TSTR_OK;
711 switch ((tok_key((KW_DATA *)kwtab,keyw)))
712 {
713 case GRR_NUM_IM_INIT:
714 meas_init( ( UBYTE )atoi( val[0] ) );
715 break;
716
717 case GRR_NUM_TBF_CCCH:
718 grr_data->ms.tbf_mon_ccch = TRUE; /* Allowed */
719 break;
720
721 case GRR_NUM_NO_TBF_CCCH:
722 grr_data->ms.tbf_mon_ccch = FALSE; /* Not allowed */
723 break;
724
725 #if !defined (NTRACE)
726
727 case GRR_NUM_CRP_TRACE:
728 grr_data->cs.v_crp_trace = atoi( val[0] );
729 break;
730
731 case GRR_NUM_IM_TRACE:
732 grr_data->meas_im.n_im_trace = atoi( val[0] );
733 break;
734
735 #endif /* #if !defined (NTRACE) */
736
737 #ifdef _SIMULATION_
738 case GRR_NUM_RES_RANDOM:
739 grr_data->tc.res_random = atoi( val[0] );
740 TRACE_EVENT_P1("grr_data->tc.res_random is %d",atoi( val[0]));
741 break;
742 case GRR_NUM_STD:
743 std = atoi( val[0] );
744 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT
745 if ( std EQ 33)
746 {
747 pcm_Init ();
748 {
749 rr_csf_check_rfcap (TRUE);
750 }
751 }
752 #endif
753 TRACE_EVENT_P1("std is %d",atoi( val[0]));
754 break;
755 case GRR_NUM_NC2:
756 grr_data->nc2_on = atoi( val[0] );
757 break;
758
759 #endif
760
761 default:
762 ncomment = GRR_TSTR_ILLEGAL_KEYW;
763 break;
764 }
765
766 TRACE_EVENT_P2( "[PEI_CONFIG]: %s -> %s",
767 keyw,
768 ncomment EQ GRR_TSTR_OK ? "OK" : "Illegal Keyword" );
769 }
770
771 #endif /* #if !defined (NCONFIG) */
772
773 return PEI_OK;
774 }
775
776 /*
777 +------------------------------------------------------------------------------
778 | Function : pei_config
779 +------------------------------------------------------------------------------
780 | Description : This function is called by the frame in case sudden entity
781 | specific data is requested (e.g. entity Version).
782 |
783 | Parameters : out_monitor - return the address of the data to be
784 | monitoredCommunication handle
785 |
786 | Return : PEI_OK - sucessful (address in out_monitor is valid)
787 | PEI_ERROR - not successful
788 |
789 +------------------------------------------------------------------------------
790 */
791 LOCAL SHORT pei_monitor (void ** out_monitor)
792 {
793 TRACE_FUNCTION ("pei_monitor");
794
795 grr_mon.version = "GRR 1.0";
796 *out_monitor = &grr_mon;
797
798 return PEI_OK;
799 }
800
801 /*
802 +------------------------------------------------------------------------------
803 | Function : pei_create
804 +------------------------------------------------------------------------------
805 | Description : This function is called by the frame when the process is
806 | created.
807 |
808 | Parameters : out_name - Pointer to the buffer in which to locate
809 | the name of this entity
810 |
811 | Return : PEI_OK - entity created successfuly
812 | PEI_ERROR - entity could not be created
813 |
814 +------------------------------------------------------------------------------
815 */
816 GLOBAL SHORT pei_create (T_PEI_INFO **info)
817 {
818
819 static T_PEI_INFO pei_info =
820 {
821 "GRR", /* name */
822 { /* pei-table */
823 pei_init,
824 pei_exit,
825 pei_primitive,
826 pei_timeout,
827 pei_signal,
828 pei_run,
829 pei_config,
830 pei_monitor
831 },
832 2560, /* stack size increased for omaps00149330 */
833 PEI_PRIM_QUEUE_SIZE,
834 /* queue entries */
835 204, /* priority (1->low, 255->high) */
836 TIMER_COUNT,
837 /* number of timers */
838 #ifdef _TARGET_
839 PASSIVE_BODY|COPY_BY_REF|TRC_NO_SUSPEND|INT_DATA_TASK|PRIM_NO_SUSPEND
840 #else
841 PASSIVE_BODY|COPY_BY_REF
842 #endif
843 };
844
845
846 TRACE_FUNCTION ("pei_create");
847
848 /*
849 * Close Resources if open
850 */
851 if (first_access)
852 first_access = FALSE;
853 else
854 pei_exit();
855
856 /*
857 * Export startup configuration data
858 */
859 *info = &pei_info;
860
861
862
863 return PEI_OK;
864 }
865
866 /*==== END OF FILE ==========================================================*/