FreeCalypso > hg > fc-tourmaline
comparison src/g23m-gprs/grlc/grlc_pei.c @ 1:fa8dc04885d8
src/g23m-*: import from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Oct 2020 06:25:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:4e78acac3d88 | 1:fa8dc04885d8 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GPRS (8441) | |
4 | Modul : GRLC | |
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 GRLC | |
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 GRLC_PEI_C | |
34 | |
35 #define ENTITY_GRLC | |
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_grlc.h" /* to get cnf-definitions */ | |
53 #include "mon_grlc.h" /* to get mon-definitions */ | |
54 #include "prim.h" /* to get the definitions of used SAP and directions */ | |
55 #include "message.h" | |
56 #include "tok.h" | |
57 #include "pcm.h" | |
58 #include "grlc.h" /* to get the global entity definitions */ | |
59 #include "grlc_f.h" | |
60 #include "grlc_gffp.h" | |
61 #include "grlc_tmp.h" | |
62 #include "grlc_rup.h" | |
63 #include "grlc_rdp.h" | |
64 #include "grlc_tpcs.h" | |
65 #include "grlc_measp.h" | |
66 | |
67 #include "grlc_em.h" | |
68 | |
69 /*==== DEFINITIONS ==========================================================*/ | |
70 | |
71 #define GRLC_TSTR_ILLEGAL_KEYW 0 | |
72 #define GRLC_TSTR_OK 1 | |
73 | |
74 /*==== TYPES ================================================================*/ | |
75 | |
76 /*==== GLOBAL VARS ==========================================================*/ | |
77 | |
78 /*==== LOCAL VARS ===========================================================*/ | |
79 | |
80 | |
81 /* | |
82 * Function is needed for grlc_table[]. | |
83 */ | |
84 | |
85 LOCAL SHORT pei_signal (ULONG opc, void *data); | |
86 | |
87 static BOOL first_access = TRUE; | |
88 static T_MONITOR grlc_mon; | |
89 | |
90 | |
91 /* | |
92 * Jumptables to primitive handler functions. One table per SAP. | |
93 * | |
94 * Use MAK_FUNC_0 for primitives which contains no SDU. | |
95 * Use MAK_FUNC_S for primitives which contains a SDU. | |
96 */ | |
97 | |
98 | |
99 /* | |
100 * Function is needed for grlc_table[]. This declaration can be removed | |
101 * as soon as this function is no more called (i.e. all primitives are | |
102 * handled). | |
103 */ | |
104 LOCAL void primitive_not_supported (void *data); | |
105 | |
106 static const T_FUNC grlc_table[] = | |
107 { | |
108 MAK_FUNC_S(tm_grlc_data_req, GRLC_DATA_REQ), | |
109 MAK_FUNC_S(tm_grlc_unitdata_req, GRLC_UNITDATA_REQ), | |
110 MAK_FUNC_0(tm_grlc_activate_gmm_queue_req, GRLC_ACTIVATE_GMM_QUEUE_REQ), | |
111 MAK_FUNC_0(tm_grlc_flush_data_req, GRLC_FLUSH_DATA_REQ) | |
112 }; | |
113 | |
114 static const T_FUNC cgrlc_table[] = | |
115 { | |
116 MAK_FUNC_0(tm_cgrlc_enable_req, CGRLC_ENABLE_REQ), /* 0x00 */ | |
117 MAK_FUNC_0(tm_cgrlc_disable_req, CGRLC_DISABLE_REQ), /* 0x01 */ | |
118 MAK_FUNC_0(tm_cgrlc_ul_tbf_res, CGRLC_UL_TBF_RES), /* 0x02 */ | |
119 MAK_FUNC_0(tm_cgrlc_dl_tbf_req, CGRLC_DL_TBF_REQ), /* 0x03 */ | |
120 MAK_FUNC_0(tm_cgrlc_tbf_rel_req, CGRLC_TBF_REL_REQ), /* 0x04 */ | |
121 MAK_FUNC_0(tm_cgrlc_tbf_rel_res, CGRLC_TBF_REL_RES), /* 0x05 */ | |
122 MAK_FUNC_0(tm_cgrlc_data_req, CGRLC_DATA_REQ), /* 0x06 */ | |
123 MAK_FUNC_0(tm_cgrlc_poll_req, CGRLC_POLL_REQ), /* 0x07 */ | |
124 MAK_FUNC_0(tm_cgrlc_access_status_req, CGRLC_ACCESS_STATUS_REQ), /* 0x08 */ | |
125 MAK_FUNC_0(tm_cgrlc_test_mode_req, CGRLC_TEST_MODE_REQ), /* 0x09 */ | |
126 MAK_FUNC_0(tm_cgrlc_test_end_req, CGRLC_TEST_END_REQ), /* 0x0A */ | |
127 MAK_FUNC_0(tm_cgrlc_ta_value_req, CGRLC_TA_VALUE_REQ), /* 0x0B */ | |
128 MAK_FUNC_0(meas_int_level_req, CGRLC_INT_LEVEL_REQ), /* 0x0C */ | |
129 MAK_FUNC_0(tm_cgrlc_pwr_ctrl_req, CGRLC_PWR_CTRL_REQ), /* 0x0D */ | |
130 MAK_FUNC_0(tm_cgrlc_ready_timer_config_req, CGRLC_READY_TIMER_CONFIG_REQ), /* 0x0E */ | |
131 MAK_FUNC_0(tm_cgrlc_force_to_standby_req, CGRLC_FORCE_TO_STANDBY_REQ) /* 0x0F */ | |
132 }; | |
133 | |
134 | |
135 #ifdef _SIMULATION_ | |
136 | |
137 static const T_FUNC mac_table[] = | |
138 { | |
139 MAK_FUNC_0(gff_mac_data_ind, MAC_DATA_IND), | |
140 MAK_FUNC_0(gff_mac_ready_ind, MAC_READY_IND), | |
141 MAK_FUNC_0(gff_mac_pwr_ctrl_ind, MAC_PWR_CTRL_IND) | |
142 }; | |
143 | |
144 static const T_FUNC l1test_table[] = | |
145 { | |
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_N(primitive_not_supported, 0), | |
150 MAK_FUNC_0(gff_l1test_call_mphp_power_control, L1TEST_CALL_MPHP_POWER_CONTROL), | |
151 MAK_FUNC_N(primitive_not_supported, 0), | |
152 MAK_FUNC_N(primitive_not_supported, 0), | |
153 }; | |
154 | |
155 #endif /* #ifdef _SIMULATION_ */ | |
156 | |
157 | |
158 #ifdef FF_EM_MODE | |
159 static const T_FUNC em_ul_table[] = | |
160 { | |
161 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x00 */ | |
162 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x01 */ | |
163 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x02 */ | |
164 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x03 */ | |
165 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x04 */ | |
166 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x05 */ | |
167 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x06 */ | |
168 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x07 */ | |
169 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x08 */ | |
170 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x09 */ | |
171 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x0A */ | |
172 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x0B */ | |
173 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x0C */ | |
174 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x0D */ | |
175 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x0E */ | |
176 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x0F */ | |
177 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x10 */ | |
178 MAK_FUNC_0(grlc_em_pco_trace_req, EM_PCO_TRACE_REQ ), /* 0x11*/ /*PCO output*/ | |
179 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x12 */ | |
180 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x13 */ | |
181 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x14 */ | |
182 MAK_FUNC_0(grlc_em_fmm_rlc_trans_info_req, EM_FMM_RLC_TRANS_INFO_REQ),/* 0x15 */ | |
183 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x16 */ | |
184 MAK_FUNC_N(primitive_not_supported, 0 ), /* 0x17 */ | |
185 MAK_FUNC_0(grlc_em_grlc_info_req, EM_GRLC_INFO_REQ ) /* 0x18 */ | |
186 | |
187 }; | |
188 #endif /* FF_EM_MODE */ | |
189 | |
190 /*==== END DIAGNOSTICS ======================================================*/ | |
191 | |
192 /*==== PRIVATE FUNCTIONS ====================================================*/ | |
193 | |
194 /* | |
195 +------------------------------------------------------------------------------ | |
196 | Function : primitive_not_supported | |
197 +------------------------------------------------------------------------------ | |
198 | Description : This function handles unsupported primitives. | |
199 | | |
200 | Parameters : - | |
201 | | |
202 | Return : - | |
203 | | |
204 +------------------------------------------------------------------------------ | |
205 */ | |
206 LOCAL void primitive_not_supported (void *data) | |
207 { | |
208 TRACE_FUNCTION ("primitive_not_supported"); | |
209 | |
210 PFREE (data); | |
211 } | |
212 | |
213 | |
214 /*==== PUBLIC FUNCTIONS =====================================================*/ | |
215 | |
216 /* | |
217 +------------------------------------------------------------------------------ | |
218 | Function : pei_primitive | |
219 +------------------------------------------------------------------------------ | |
220 | Description : This function is called by the frame when a primitive is | |
221 | received and needs to be processed. | |
222 | | |
223 | | | | |
224 | GRLC CGRLC UPLINK | |
225 | | | | |
226 | +------v-----------v-------+ | |
227 | | | | |
228 | | GRLC | | |
229 | | | | |
230 | +--------------^------- ---+ | |
231 | | | |
232 | L1 DOWNLINK | |
233 | | | |
234 | | |
235 | | |
236 | Parameters : prim - Pointer to the received primitive | |
237 | | |
238 | Return : PEI_OK - function succeeded | |
239 | PEI_ERROR - function failed | |
240 | | |
241 +------------------------------------------------------------------------------ | |
242 */ | |
243 LOCAL SHORT pei_primitive (void * primptr) | |
244 { | |
245 TRACE_FUNCTION ("pei_primitive"); | |
246 | |
247 if (primptr NEQ NULL) | |
248 { | |
249 T_PRIM *prim = (T_PRIM *)primptr; | |
250 ULONG opc = prim->custom.opc; | |
251 USHORT n; | |
252 const T_FUNC *table; | |
253 | |
254 PTRACE_IN (opc); | |
255 | |
256 /* | |
257 * This must be called for Partition Pool supervision. Will be replaced | |
258 * by another macro some time. | |
259 */ | |
260 VSI_PPM_REC (&prim->custom, __FILE__, __LINE__); | |
261 | |
262 switch (SAP_NR(opc)) | |
263 { | |
264 case SAP_NR(CGRLC_UL): | |
265 table = cgrlc_table; | |
266 n = TAB_SIZE (cgrlc_table); | |
267 break; | |
268 #ifdef _SIMULATION_ | |
269 case MAC_DL: | |
270 table = mac_table; | |
271 n = TAB_SIZE (mac_table); | |
272 break; | |
273 case SAP_NR(L1TEST_DL): | |
274 table = l1test_table; | |
275 n = TAB_SIZE (l1test_table); | |
276 break; | |
277 #endif | |
278 case SAP_NR(GRLC_UL): | |
279 table = grlc_table; | |
280 n = TAB_SIZE (grlc_table); | |
281 break; | |
282 #ifdef FF_EM_MODE | |
283 case EM_Ul: | |
284 table = em_ul_table; | |
285 n = TAB_SIZE (em_ul_table); | |
286 break; | |
287 #endif /* FF_EM_MODE */ | |
288 default: | |
289 table = NULL; | |
290 n = 0; | |
291 break; | |
292 } | |
293 | |
294 if (table != NULL) | |
295 { | |
296 if ((PRIM_NR(opc)) < n) | |
297 { | |
298 table += PRIM_NR(opc); | |
299 #ifdef PALLOC_TRANSITION | |
300 P_SDU(prim) = table->soff ? (T_sdu*) (((char*)&prim->data) + table->soff) : 0; | |
301 #ifndef NO_COPY_ROUTING | |
302 P_LEN(prim) = table->size + sizeof (T_PRIM_HEADER); | |
303 #endif /* NO_COPY_ROUTING */ | |
304 #endif /* PALLOC_TRANSITION */ | |
305 JUMP (table->func) (P2D(prim)); | |
306 } | |
307 else | |
308 { | |
309 primitive_not_supported (P2D(prim)); | |
310 } | |
311 return PEI_OK; | |
312 } | |
313 } | |
314 return PEI_OK; | |
315 } | |
316 | |
317 /* | |
318 +------------------------------------------------------------------------------ | |
319 | Function : pei_init | |
320 +------------------------------------------------------------------------------ | |
321 | Description : This function is called by the frame. It is used to initialise | |
322 | the entitiy. | |
323 | | |
324 | Parameters : handle - task handle | |
325 | | |
326 | Return : PEI_OK - entity initialised | |
327 | PEI_ERROR - entity not (yet) initialised | |
328 | | |
329 +------------------------------------------------------------------------------ | |
330 */ | |
331 LOCAL SHORT pei_init (T_HANDLE handle) | |
332 { | |
333 TRACE_FUNCTION ("pei_init"); | |
334 | |
335 /* | |
336 * Initialize task handle | |
337 */ | |
338 GRLC_handle = handle; | |
339 | |
340 | |
341 /* | |
342 * Open communication channels | |
343 */ | |
344 if (hCommGRLC < VSI_OK) | |
345 { | |
346 if ((hCommGRLC = vsi_c_open (VSI_CALLER GRLC_NAME)) < VSI_OK) | |
347 return PEI_ERROR; | |
348 } | |
349 if (hCommGRR < VSI_OK) | |
350 { | |
351 if ((hCommGRR = vsi_c_open (VSI_CALLER GRR_NAME)) < VSI_OK) | |
352 return PEI_ERROR; | |
353 } | |
354 if (hCommGMM < VSI_OK) | |
355 { | |
356 if ((hCommGMM = vsi_c_open (VSI_CALLER GMM_NAME)) < VSI_OK) | |
357 return PEI_ERROR; | |
358 } | |
359 if (hCommLLC < VSI_OK) | |
360 { | |
361 if ((hCommLLC = vsi_c_open (VSI_CALLER LLC_NAME)) < VSI_OK) | |
362 return PEI_ERROR; | |
363 } | |
364 if (hCommL1 < VSI_OK) | |
365 { | |
366 if ((hCommL1 = vsi_c_open (VSI_CALLER L1_NAME)) < VSI_OK) | |
367 return PEI_ERROR; | |
368 } | |
369 | |
370 if (hCommPL < VSI_OK) | |
371 { | |
372 if ((hCommPL = vsi_c_open (VSI_CALLER PL_NAME)) < VSI_OK) | |
373 return PEI_ERROR; | |
374 } | |
375 | |
376 #ifdef FF_WAP /*FFM*/ | |
377 if (hCommWAP < VSI_OK) | |
378 { | |
379 if ((hCommWAP = vsi_c_open (VSI_CALLER WAP_NAME)) < VSI_OK) | |
380 return PEI_ERROR; | |
381 } | |
382 #endif | |
383 | |
384 /* | |
385 * call function pcm_Init to be sure that the global variable std | |
386 * is set before the initialisation of the GRLC services takes place | |
387 */ | |
388 pcm_Init(); | |
389 | |
390 /* | |
391 * Initialize entity data (call init function of every service) | |
392 */ | |
393 grlc_init(); | |
394 | |
395 /* { | |
396 PALLOC (tst_test_hw_req, TST_TEST_HW_REQ); | |
397 PSEND (hCommL1, tst_test_hw_req); | |
398 }*/ | |
399 return (PEI_OK); | |
400 } | |
401 | |
402 /* | |
403 +------------------------------------------------------------------------------ | |
404 | Function : pei_timeout | |
405 +------------------------------------------------------------------------------ | |
406 | Description : This function is called by the frame when a timer has expired. | |
407 | | |
408 | Parameters : index - timer index | |
409 | | |
410 | Return : PEI_OK - timeout processed | |
411 | PEI_ERROR - timeout not processed | |
412 | | |
413 +------------------------------------------------------------------------------ | |
414 */ | |
415 LOCAL SHORT pei_timeout (USHORT index) | |
416 { | |
417 TRACE_FUNCTION ("pei_timeout"); | |
418 | |
419 /* | |
420 * Process timeout | |
421 */ | |
422 switch (index) /* SZML-GLBL/007 */ | |
423 { | |
424 case T3164: ru_t3164(); break; | |
425 case T3166: ru_t3166(); break; | |
426 case T3168: tm_t3168(); break; | |
427 case T3180: ru_t3180(); break; | |
428 case T3182: ru_t3182(); break; | |
429 case T3184: ru_t3184(); break; | |
430 case T3188: tm_t3188(); break; | |
431 case T3190: rd_t3190(); break; | |
432 case T3192: rd_t3192(); break; | |
433 case T3314: ru_t3314(); break; | |
434 default: TRACE_EVENT_P1( "Unknown Timeout: %d", index ); break; | |
435 } | |
436 | |
437 return PEI_OK; | |
438 } | |
439 | |
440 /* | |
441 +------------------------------------------------------------------------------ | |
442 | Function : pei_signal | |
443 +------------------------------------------------------------------------------ | |
444 | Description : This function is called by the frame when a signal has been | |
445 | received. | |
446 | | |
447 | Parameters : opc - signal operation code | |
448 | *data - pointer to primitive | |
449 | | |
450 | Return : PEI_OK - signal processed | |
451 | PEI_ERROR - signal not processed | |
452 | | |
453 +------------------------------------------------------------------------------ | |
454 */ | |
455 LOCAL SHORT pei_signal (ULONG opc, void *data) | |
456 { | |
457 | |
458 TRACE_FUNCTION ("pei_signal"); | |
459 /* | |
460 * Process signal | |
461 */ | |
462 switch (opc) | |
463 { | |
464 case MAC_DATA_IND: | |
465 gff_mac_data_ind(data); | |
466 break; | |
467 | |
468 case MAC_READY_IND: | |
469 gff_mac_ready_ind(data); | |
470 break; | |
471 case MAC_PWR_CTRL_IND: | |
472 gff_mac_pwr_ctrl_ind(data); | |
473 break; | |
474 default: | |
475 TRACE_EVENT_P1( "Unknown Signal: %08X", opc ); | |
476 break; | |
477 } | |
478 | |
479 | |
480 return(PEI_OK); | |
481 } | |
482 | |
483 /* | |
484 +------------------------------------------------------------------------------ | |
485 | Function : pei_exit | |
486 +------------------------------------------------------------------------------ | |
487 | Description : This function is called by the frame when the entity is | |
488 | terminated. All open resources are freed. | |
489 | | |
490 | Parameters : - | |
491 | | |
492 | Return : PEI_OK - exit sucessful | |
493 | PEI_ERROR - exit not sueccessful | |
494 | | |
495 +------------------------------------------------------------------------------ | |
496 */ | |
497 LOCAL SHORT pei_exit (void) | |
498 { | |
499 TRACE_FUNCTION ("pei_exit"); | |
500 | |
501 /* | |
502 * Close communication channels | |
503 */ | |
504 vsi_c_close (VSI_CALLER hCommGRLC); | |
505 hCommGRLC = VSI_ERROR; | |
506 | |
507 vsi_c_close (VSI_CALLER hCommGRR); | |
508 hCommGRR = VSI_ERROR; | |
509 | |
510 vsi_c_close (VSI_CALLER hCommGMM); | |
511 hCommGMM = VSI_ERROR; | |
512 | |
513 vsi_c_close (VSI_CALLER hCommLLC); | |
514 hCommLLC = VSI_ERROR; | |
515 | |
516 vsi_c_close (VSI_CALLER hCommL1); | |
517 hCommL1 = VSI_ERROR; | |
518 | |
519 vsi_c_close (VSI_CALLER hCommPL); | |
520 hCommPL = VSI_ERROR; | |
521 | |
522 ccd_exit(); | |
523 | |
524 #ifdef FF_WAP /*FFM*/ | |
525 vsi_c_close (VSI_CALLER hCommWAP); | |
526 hCommWAP = VSI_ERROR; | |
527 #endif | |
528 | |
529 return PEI_OK; | |
530 } | |
531 | |
532 /* | |
533 +------------------------------------------------------------------------------ | |
534 | Function : pei_run | |
535 +------------------------------------------------------------------------------ | |
536 | Description : This function is called by the frame when entering the main | |
537 | loop. This fucntion is only required in the active variant. | |
538 | | |
539 | This function is not used. | |
540 | | |
541 | Parameters : handle - Communication handle | |
542 | | |
543 | Return : PEI_OK - sucessful | |
544 | PEI_ERROR - not successful | |
545 | | |
546 +------------------------------------------------------------------------------ | |
547 */ | |
548 LOCAL SHORT pei_run (T_HANDLE TaskHandle, T_HANDLE ComHandle ) | |
549 { | |
550 | |
551 return PEI_OK; | |
552 } | |
553 | |
554 /* | |
555 +------------------------------------------------------------------------------ | |
556 | Function : pei_config | |
557 +------------------------------------------------------------------------------ | |
558 | Description : This function is called by the frame when a primitive is | |
559 | received indicating dynamic configuration. | |
560 | | |
561 | This function is not used in this entity. | |
562 | | |
563 | Parameters : handle - Communication handle | |
564 | | |
565 | Return : PEI_OK - sucessful | |
566 | PEI_ERROR - not successful | |
567 | | |
568 +------------------------------------------------------------------------------ | |
569 */ | |
570 #if !defined (NCONFIG) | |
571 LOCAL const KW_DATA kwtab[] = | |
572 { | |
573 GRLC_STR_TPC_PWR_PAR, GRLC_NUM_TPC_PWR_PAR, | |
574 GRLC_STR_TPC_FIX_PCL, GRLC_NUM_TPC_FIX_PCL, | |
575 #if !defined (NTRACE) | |
576 GRLC_STR_TPC_TRACE, GRLC_NUM_TPC_TRACE, | |
577 GRLC_STR_IM_TRACE, GRLC_NUM_IM_TRACE, | |
578 #endif /* #if !defined (NTRACE) */ | |
579 GRLC_STR_CCD_USAGE, GRLC_NUM_CCD_USAGE, | |
580 "", 0 | |
581 }; | |
582 #endif /* #if !defined (NCONFIG) */ | |
583 | |
584 LOCAL SHORT pei_config (char *inString) | |
585 { | |
586 #if !defined (NCONFIG) | |
587 char * s = inString; | |
588 char * keyw; | |
589 char * val [10]; | |
590 | |
591 TRACE_FUNCTION( "pei_config" ); | |
592 | |
593 TRACE_EVENT_P1( "[PEI_CONFIG]: %s", inString ); | |
594 | |
595 tok_init(s); | |
596 | |
597 /* | |
598 * Parse next keyword and number of variables | |
599 */ | |
600 while ((tok_next(&keyw,val)) NEQ TOK_EOCS) | |
601 { | |
602 UBYTE ncomment = GRLC_TSTR_OK; | |
603 | |
604 switch ((tok_key((KW_DATA *)kwtab,keyw))) | |
605 { | |
606 case GRLC_NUM_TPC_PWR_PAR: | |
607 sig_pei_config_tpc_set_pwr_par( ( UBYTE )atoi( val[0] ), | |
608 ( UBYTE )atoi( val[1] ) ); | |
609 break; | |
610 | |
611 case GRLC_NUM_TPC_FIX_PCL: | |
612 sig_pei_config_tpc_fix_pcl( ( UBYTE )atoi( val[0] ) ); | |
613 break; | |
614 | |
615 #if !defined (NTRACE) | |
616 | |
617 case GRLC_NUM_TPC_TRACE: | |
618 grlc_data->tpc.n_tpc_trace = atoi( val[0] ); | |
619 break; | |
620 | |
621 case GRLC_NUM_IM_TRACE: | |
622 grlc_data->meas.v_im_trace = atoi( val[0] ); | |
623 break; | |
624 | |
625 #endif /* #if !defined (NTRACE) */ | |
626 | |
627 case GRLC_NUM_CCD_USAGE: | |
628 grlc_data->grlc_wo_ccd = atoi( val[0] ); | |
629 break; | |
630 | |
631 default: | |
632 ncomment = GRLC_TSTR_ILLEGAL_KEYW; | |
633 break; | |
634 } | |
635 | |
636 TRACE_EVENT_P2( "[PEI_CONFIG]: %s -> %s", | |
637 keyw, | |
638 ncomment EQ GRLC_TSTR_OK ? "OK" : "Illegal Keyword" ); | |
639 } | |
640 | |
641 #endif /* #if !defined (NCONFIG) */ | |
642 | |
643 return PEI_OK; | |
644 } | |
645 | |
646 /* | |
647 +------------------------------------------------------------------------------ | |
648 | Function : pei_config | |
649 +------------------------------------------------------------------------------ | |
650 | Description : This function is called by the frame in case sudden entity | |
651 | specific data is requested (e.g. entity Version). | |
652 | | |
653 | Parameters : out_monitor - return the address of the data to be | |
654 | monitoredCommunication handle | |
655 | | |
656 | Return : PEI_OK - sucessful (address in out_monitor is valid) | |
657 | PEI_ERROR - not successful | |
658 | | |
659 +------------------------------------------------------------------------------ | |
660 */ | |
661 LOCAL SHORT pei_monitor (void ** out_monitor) | |
662 { | |
663 TRACE_FUNCTION ("pei_monitor"); | |
664 | |
665 grlc_mon.version = "GRLC 1.0"; | |
666 *out_monitor = &grlc_mon; | |
667 | |
668 return PEI_OK; | |
669 } | |
670 | |
671 /* | |
672 +------------------------------------------------------------------------------ | |
673 | Function : pei_create | |
674 +------------------------------------------------------------------------------ | |
675 | Description : This function is called by the frame when the process is | |
676 | created. | |
677 | | |
678 | Parameters : out_name - Pointer to the buffer in which to locate | |
679 | the name of this entity | |
680 | | |
681 | Return : PEI_OK - entity created successfuly | |
682 | PEI_ERROR - entity could not be created | |
683 | | |
684 +------------------------------------------------------------------------------ | |
685 */ | |
686 GLOBAL SHORT pei_create (T_PEI_INFO **info) | |
687 { | |
688 | |
689 static T_PEI_INFO pei_info = | |
690 { | |
691 "GRLC", /* name */ | |
692 { /* pei-table */ | |
693 pei_init, | |
694 pei_exit, | |
695 pei_primitive, | |
696 pei_timeout, | |
697 pei_signal, | |
698 pei_run, | |
699 pei_config, | |
700 pei_monitor | |
701 }, | |
702 2048, /* stack size */ | |
703 PEI_PRIM_QUEUE_SIZE, /* queue entries */ | |
704 226, /* priority (1->low, 255->high): GRR 204 RR 205 ALR 225 */ | |
705 TIMER_COUNT, /* number of timers */ | |
706 #ifdef _TARGET_ | |
707 PASSIVE_BODY|COPY_BY_REF|TRC_NO_SUSPEND|PRIM_NO_SUSPEND | |
708 | INT_DATA_TASK | |
709 #else | |
710 PASSIVE_BODY|COPY_BY_REF | |
711 #endif | |
712 }; | |
713 | |
714 | |
715 TRACE_FUNCTION ("pei_create"); | |
716 | |
717 /* | |
718 * Close Resources if open | |
719 */ | |
720 if (first_access) | |
721 first_access = FALSE; | |
722 else | |
723 pei_exit(); | |
724 | |
725 /* | |
726 * Export startup configuration data | |
727 */ | |
728 *info = &pei_info; | |
729 | |
730 | |
731 | |
732 return PEI_OK; | |
733 } | |
734 | |
735 /*==== END OF FILE ==========================================================*/ |