FreeCalypso > hg > fc-selenite
comparison src/g23m-gprs/llc/llc_pei.c @ 1:d393cd9bb723
src/g23m-*: initial import from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 15 Jul 2018 04:40:46 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:b6a5e36de839 | 1:d393cd9bb723 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : | |
4 | Modul : | |
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 Logical Link Control (LLC) | |
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 LLC_PEI_C | |
34 | |
35 #define ENTITY_LLC | |
36 | |
37 /*==== INCLUDES =============================================================*/ | |
38 | |
39 #include <stddef.h> /* to get definition of offsetof(), for MAK_FUNC_S */ | |
40 #include <stdlib.h> /* to get atoi() */ | |
41 #include "typedefs.h" /* to get Condat data types */ | |
42 #include "vsi.h" /* to get a lot of macros */ | |
43 #include "macdef.h" | |
44 #include "gprs.h" | |
45 #include "gsm.h" /* to get a lot of macros */ | |
46 #include "cnf_llc.h" /* to get cnf-definitions */ | |
47 #include "mon_llc.h" /* to get mon-definitions */ | |
48 #include "prim.h" /* to get the definitions of used SAP and directions */ | |
49 #include "pei.h" /* to get PEI interface */ | |
50 #include "llc.h" /* to get the global entity definitions */ | |
51 #include "llc_f.h" /* to get the global entity definitions */ | |
52 | |
53 #include "llc_llmep.h" /* to get primitive interface to LLME */ | |
54 #include "llc_up.h" /* to get primitive interface to U */ | |
55 #include "llc_itxp.h" /* to get primitive interface to ITX */ | |
56 #include "llc_irxp.h" /* to get primitive interface to IRX */ | |
57 #include "llc_itxt.h" /* to get timer interface to IRX */ | |
58 #include "llc_uitxp.h" /* to get primitive interface to UITX */ | |
59 #include "llc_uirxp.h" /* to get primitive interface to UIRX */ | |
60 #include "llc_t200p.h" /* to get primitive interface to T200 */ | |
61 #include "llc_txp.h" /* to get primitive interface to TX */ | |
62 #include "llc_rxp.h" /* to get primitive interface to RX */ | |
63 #include "llc_llmef.h" /* to get init function of LLME */ | |
64 #include "llc_uf.h" /* to get init function of U */ | |
65 #include "llc_itxf.h" /* to get init function of ITX */ | |
66 #include "llc_irxf.h" /* to get init function of IRX */ | |
67 #include "llc_uitxf.h" /* to get init function of UITX */ | |
68 #include "llc_uirxf.h" /* to get init function of UIRX */ | |
69 #include "llc_t200f.h" /* to get init function of T200 */ | |
70 #include "llc_txf.h" /* to get init function of TX */ | |
71 #include "llc_rxf.h" /* to get init function of RX */ | |
72 | |
73 | |
74 | |
75 /*==== DEFINITIONS ==========================================================*/ | |
76 | |
77 /*==== TYPES ================================================================*/ | |
78 | |
79 /*==== GLOBAL VARS ==========================================================*/ | |
80 | |
81 /*==== LOCAL VARS ===========================================================*/ | |
82 | |
83 static BOOL first_access = TRUE; | |
84 static T_MONITOR llc_mon; | |
85 | |
86 /* | |
87 * Jumptables to primitive handler functions. One table per SAP. | |
88 * | |
89 * Use MAK_FUNC_0 for primitives which contains no SDU. | |
90 * Use MAK_FUNC_S for primitives which contains a SDU. | |
91 */ | |
92 | |
93 /* | |
94 * This Function is needed for primitives, that are not (yet?) supported. | |
95 * It frees the primitive for which it is specified in the jump table. | |
96 */ | |
97 LOCAL void primitive_not_supported (T_PRIM_HEADER *data); | |
98 | |
99 | |
100 static const T_FUNC ll_table[] = | |
101 { | |
102 MAK_FUNC_S(u_ll_establish_req, LL_ESTABLISH_REQ), | |
103 MAK_FUNC_S(u_ll_establish_res, LL_ESTABLISH_RES), | |
104 MAK_FUNC_0(u_ll_release_req, LL_RELEASE_REQ), | |
105 MAK_FUNC_S(u_ll_xid_req, LL_XID_REQ), | |
106 MAK_FUNC_S(u_ll_xid_res, LL_XID_RES), | |
107 MAK_FUNC_0(irx_ll_getdata_req, LL_GETDATA_REQ), | |
108 MAK_FUNC_0(uirx_ll_getunitdata_req, LL_GETUNITDATA_REQ), | |
109 #ifdef LL_DESC | |
110 MAK_FUNC_S(itx_ll_data_req, LL_DATA_REQ), | |
111 MAK_FUNC_S(uitx_ll_unitdata_req, LL_UNITDATA_REQ), | |
112 MAK_FUNC_0(itx_ll_desc_req, LL_DESC_REQ), | |
113 MAK_FUNC_0(uitx_ll_unitdesc_req, LL_UNITDESC_REQ), | |
114 #else | |
115 MAK_FUNC_S(itx_ll_desc_req, LL_DATA_REQ), | |
116 MAK_FUNC_S(uitx_ll_unitdesc_req, LL_UNITDATA_REQ) | |
117 #endif | |
118 }; | |
119 | |
120 static const T_FUNC llgmm_table[] = | |
121 { | |
122 MAK_FUNC_0(llme_llgmm_assign_req, LLGMM_ASSIGN_REQ), | |
123 MAK_FUNC_0(llme_llgmm_trigger_req, LLGMM_TRIGGER_REQ), | |
124 MAK_FUNC_0(llme_llgmm_suspend_req, LLGMM_SUSPEND_REQ), | |
125 MAK_FUNC_0(llme_llgmm_resume_req, LLGMM_RESUME_REQ) | |
126 }; | |
127 | |
128 static const T_FUNC grlc_table[] = | |
129 { | |
130 MAK_FUNC_0(rx_grlc_data_ind, GRLC_DATA_IND), | |
131 #ifdef _SIMULATION_ | |
132 MAK_FUNC_S(rx_grlc_data_ind_test, GRLC_DATA_IND_TEST), | |
133 #else | |
134 MAK_FUNC_N(primitive_not_supported, GRLC_DATA_IND_TEST), | |
135 #endif | |
136 MAK_FUNC_0(rx_grlc_unitdata_ind, GRLC_UNITDATA_IND), | |
137 #ifdef _SIMULATION_ | |
138 MAK_FUNC_S(rx_grlc_unitdata_ind_test, GRLC_UNITDATA_IND_TEST), | |
139 #else | |
140 MAK_FUNC_N(primitive_not_supported, GRLC_UNITDATA_IND_TEST), | |
141 #endif | |
142 MAK_FUNC_N(tx_grlc_ready_ind, GRLC_READY_IND), | |
143 MAK_FUNC_N(tx_grlc_suspend_ready_ind, GRLC_SUSPEND_READY_IND) | |
144 }; | |
145 | |
146 | |
147 /*==== PRIVATE FUNCTIONS ====================================================*/ | |
148 | |
149 /* | |
150 +------------------------------------------------------------------------------ | |
151 | Function : primitive_not_supported | |
152 +------------------------------------------------------------------------------ | |
153 | Description : This function handles unsupported primitives. | |
154 | | |
155 | Parameters : - | |
156 | | |
157 | Return : - | |
158 | | |
159 +------------------------------------------------------------------------------ | |
160 */ | |
161 LOCAL void primitive_not_supported (T_PRIM_HEADER *data) | |
162 { | |
163 TRACE_FUNCTION ("primitive_not_supported"); | |
164 | |
165 PFREE (data); | |
166 } | |
167 | |
168 | |
169 /*==== PUBLIC FUNCTIONS =====================================================*/ | |
170 | |
171 /* | |
172 +------------------------------------------------------------------------------ | |
173 | Function : pei_primitive | |
174 +------------------------------------------------------------------------------ | |
175 | Description : This function is called by the frame when a primitive is | |
176 | received and needs to be processed. | |
177 | | |
178 | | | | |
179 | LLGMM LL UPLINK | |
180 | | | | |
181 | +------v-----------v-------+ | |
182 | | | | |
183 | | LLC | | |
184 | | | | |
185 | +-------------^------------+ | |
186 | | | |
187 | GRLC DOWNLINK | |
188 | | | |
189 | | |
190 | | |
191 | Parameters : prim - Pointer to the received primitive | |
192 | | |
193 | Return : PEI_OK - function succeeded | |
194 | PEI_ERROR - function failed | |
195 | | |
196 +------------------------------------------------------------------------------ | |
197 */ | |
198 LOCAL SHORT pei_primitive (void * primptr) | |
199 { | |
200 TRACE_FUNCTION ("pei_primitive"); | |
201 | |
202 if (primptr != NULL) | |
203 { | |
204 T_PRIM *prim = (T_PRIM *)primptr; | |
205 ULONG opc = prim->custom.opc; | |
206 USHORT n; | |
207 const T_FUNC *table; | |
208 | |
209 /* | |
210 * This must be called to enable Partition Pool (memory) supervision. | |
211 */ | |
212 VSI_PPM_REC (&prim->custom, __FILE__, __LINE__); | |
213 | |
214 switch (SAP_NR(opc)) | |
215 { | |
216 case SAP_NR(LLGMM_UL): | |
217 table = llgmm_table; | |
218 n = TAB_SIZE (llgmm_table); | |
219 break; | |
220 case SAP_NR(LL_UL): | |
221 #ifdef TRACE_EVE | |
222 { | |
223 /* | |
224 * following line requires sapi is always the first struct member | |
225 * in all LL primitive headers and always using the same size. | |
226 */ | |
227 T_LL_GETUNITDATA_REQ* pData = (T_LL_GETUNITDATA_REQ*)(P2D(prim)); | |
228 | |
229 switch (pData->sapi) | |
230 { | |
231 case LL_SAPI_1: TRACE_PRIM_FROM("GMM"); break; | |
232 #ifdef LL_2to1 | |
233 case LL_SAPI_7: TRACE_PRIM_FROM("MM"); break; | |
234 #else | |
235 case LL_SAPI_7: TRACE_PRIM_FROM("GSMS"); break; | |
236 #endif | |
237 default: break; | |
238 } | |
239 } | |
240 #endif | |
241 table = ll_table; | |
242 n = TAB_SIZE (ll_table); | |
243 break; | |
244 case SAP_NR(GRLC_DL): | |
245 table = grlc_table; | |
246 n = TAB_SIZE (grlc_table); | |
247 break; | |
248 default: | |
249 table = NULL; | |
250 n = 0; | |
251 break; | |
252 } | |
253 | |
254 PTRACE_IN (opc); | |
255 | |
256 if (table != NULL) | |
257 { | |
258 if ((PRIM_NR(opc)) < n) | |
259 { | |
260 table += PRIM_NR(opc); | |
261 #ifdef PALLOC_TRANSITION | |
262 P_SDU(prim) = table->soff ? (T_sdu*) (((char*)&prim->data) + table->soff) : 0; | |
263 #ifndef NO_COPY_ROUTING | |
264 P_LEN(prim) = table->size + sizeof (T_PRIM_HEADER); | |
265 #endif /* NO_COPY_ROUTING */ | |
266 #endif /* PALLOC_TRANSITION */ | |
267 JUMP (table->func) (P2D(prim)); | |
268 } | |
269 else | |
270 { | |
271 primitive_not_supported (P2D(prim)); | |
272 } | |
273 return PEI_OK; | |
274 } | |
275 | |
276 /* | |
277 * primitive is not a GSM primitive - forward it to the environment | |
278 */ | |
279 if (opc & SYS_MASK) | |
280 vsi_c_primitive (VSI_CALLER prim); | |
281 else | |
282 { | |
283 PFREE (P2D(prim)); | |
284 return PEI_ERROR; | |
285 } | |
286 } | |
287 return PEI_OK; | |
288 } | |
289 | |
290 | |
291 /* | |
292 +------------------------------------------------------------------------------ | |
293 | Function : pei_init | |
294 +------------------------------------------------------------------------------ | |
295 | Description : This function is called by the frame. It is used to initialise | |
296 | the entitiy. | |
297 | | |
298 | Parameters : handle - task handle | |
299 | | |
300 | Return : PEI_OK - entity initialised | |
301 | PEI_ERROR - entity not (yet) initialised | |
302 | | |
303 +------------------------------------------------------------------------------ | |
304 */ | |
305 LOCAL SHORT pei_init (T_HANDLE handle) | |
306 { | |
307 TRACE_FUNCTION ("pei_init"); | |
308 | |
309 /* | |
310 * Initialize task handle | |
311 */ | |
312 LLC_handle = handle; | |
313 | |
314 /* | |
315 * Open communication channels | |
316 */ | |
317 if (hCommGMM < VSI_OK) | |
318 { | |
319 #ifdef LL_2to1 | |
320 if ((hCommGMM = vsi_c_open (VSI_CALLER MM_NAME)) < VSI_OK) | |
321 #else | |
322 if ((hCommGMM = vsi_c_open (VSI_CALLER GMM_NAME)) < VSI_OK) | |
323 #endif | |
324 return PEI_ERROR; | |
325 } | |
326 if (hCommSNDCP < VSI_OK) | |
327 { | |
328 if ((hCommSNDCP = vsi_c_open (VSI_CALLER SNDCP_NAME)) < VSI_OK) | |
329 return PEI_ERROR; | |
330 } | |
331 #ifdef LL_2to1 | |
332 if (hCommMM < VSI_OK) | |
333 { | |
334 if ((hCommMM = vsi_c_open (VSI_CALLER MM_NAME)) < VSI_OK) | |
335 return PEI_ERROR; | |
336 } | |
337 #else | |
338 if (hCommGSMS < VSI_OK) | |
339 { | |
340 if ((hCommGSMS = vsi_c_open (VSI_CALLER GSMS_NAME)) < VSI_OK) | |
341 return PEI_ERROR; | |
342 } | |
343 #endif | |
344 if (hCommGRLC < VSI_OK) | |
345 { | |
346 if ((hCommGRLC = vsi_c_open (VSI_CALLER GRLC_NAME)) < VSI_OK) | |
347 return PEI_ERROR; | |
348 } | |
349 | |
350 | |
351 /* | |
352 * Initialize global pointer llc_data. This is required to access all | |
353 * entity data. | |
354 */ | |
355 llc_data = &llc_data_base; | |
356 | |
357 | |
358 /* | |
359 * Initialize entity data (call init function of every service) | |
360 */ | |
361 llme_init(); | |
362 u_init(); | |
363 itx_init(); | |
364 irx_init(); | |
365 uitx_init(); | |
366 uirx_init(); | |
367 t200_init(); | |
368 llc_tx_init(); | |
369 rx_init(); | |
370 #ifndef TI_PS_OP_CIPH_DRIVER | |
371 llc_fbs_init(); | |
372 #endif | |
373 return (PEI_OK); | |
374 } | |
375 | |
376 /* | |
377 +------------------------------------------------------------------------------ | |
378 | Function : pei_timeout | |
379 +------------------------------------------------------------------------------ | |
380 | Description : This function is called by the frame when a timer has expired. | |
381 | | |
382 | Parameters : index - timer index | |
383 | | |
384 | Return : PEI_OK - timeout processed | |
385 | PEI_ERROR - timeout not processed | |
386 | | |
387 +------------------------------------------------------------------------------ | |
388 */ | |
389 LOCAL SHORT pei_timeout (USHORT index) | |
390 { | |
391 TRACE_FUNCTION ("pei_timeout"); | |
392 | |
393 /* | |
394 * Process timeout | |
395 */ | |
396 switch (index) | |
397 { | |
398 case TIMER_T200_1: | |
399 /* | |
400 * T200 for SAPI 1 expired. | |
401 */ | |
402 t200_timer_t200 (LL_SAPI_1); | |
403 break; | |
404 case TIMER_T200_3: | |
405 /* | |
406 * T200 for SAPI 3 expired. | |
407 */ | |
408 t200_timer_t200 (LL_SAPI_3); | |
409 break; | |
410 case TIMER_T200_5: | |
411 /* | |
412 * T200 for SAPI 5 expired. | |
413 */ | |
414 t200_timer_t200 (LL_SAPI_5); | |
415 break; | |
416 case TIMER_T200_7: | |
417 /* | |
418 * T200 for SAPI 7 expired. | |
419 */ | |
420 t200_timer_t200 (LL_SAPI_7); | |
421 break; | |
422 case TIMER_T200_9: | |
423 /* | |
424 * T200 for SAPI 9 expired. | |
425 */ | |
426 t200_timer_t200 (LL_SAPI_9); | |
427 break; | |
428 case TIMER_T200_11: | |
429 /* | |
430 * T200 for SAPI 11 expired. | |
431 */ | |
432 t200_timer_t200 (LL_SAPI_11); | |
433 break; | |
434 case TIMER_T201_3: | |
435 /* | |
436 * T201 for SAPI 3 expired. | |
437 */ | |
438 itx_timer_t201 (LL_SAPI_3); | |
439 break; | |
440 case TIMER_T201_5: | |
441 /* | |
442 * T201 for SAPI 5 expired. | |
443 */ | |
444 itx_timer_t201 (LL_SAPI_5); | |
445 break; | |
446 case TIMER_T201_9: | |
447 /* | |
448 * T201 for SAPI 9 expired. | |
449 */ | |
450 itx_timer_t201 (LL_SAPI_9); | |
451 break; | |
452 case TIMER_T201_11: | |
453 /* | |
454 * T201 for SAPI 11 expired. | |
455 */ | |
456 itx_timer_t201 (LL_SAPI_11); | |
457 break; | |
458 default: | |
459 TRACE_ERROR("Unknown Timeout"); | |
460 break; | |
461 } | |
462 | |
463 return PEI_OK; | |
464 } | |
465 | |
466 /* | |
467 +------------------------------------------------------------------------------ | |
468 | Function : pei_signal | |
469 +------------------------------------------------------------------------------ | |
470 | Description : This function is called by the frame when a signal has been | |
471 | received. | |
472 | | |
473 | Parameters : opc - signal operation code | |
474 | *data - pointer to primitive | |
475 | | |
476 | Return : PEI_OK - signal processed | |
477 | PEI_ERROR - signal not processed | |
478 | | |
479 +------------------------------------------------------------------------------ | |
480 */ | |
481 LOCAL SHORT pei_signal (ULONG opc, void *data) | |
482 { | |
483 TRACE_FUNCTION ("pei_signal"); | |
484 | |
485 /* | |
486 * Process signal | |
487 */ | |
488 TRACE_ERROR("Unknown Signal OPC"); | |
489 | |
490 return PEI_OK; | |
491 } | |
492 | |
493 /* | |
494 +------------------------------------------------------------------------------ | |
495 | Function : pei_exit | |
496 +------------------------------------------------------------------------------ | |
497 | Description : This function is called by the frame when the entity is | |
498 | terminated. All open resources are freed. | |
499 | | |
500 | Parameters : - | |
501 | | |
502 | Return : PEI_OK - exit sucessful | |
503 | PEI_ERROR - exit not sueccessful | |
504 | | |
505 +------------------------------------------------------------------------------ | |
506 */ | |
507 LOCAL SHORT pei_exit (void) | |
508 { | |
509 TRACE_FUNCTION ("pei_exit"); | |
510 | |
511 /* | |
512 * Close communication channels | |
513 */ | |
514 vsi_c_close (VSI_CALLER hCommGMM); | |
515 hCommGMM = VSI_ERROR; | |
516 | |
517 vsi_c_close (VSI_CALLER hCommSNDCP); | |
518 hCommSNDCP = VSI_ERROR; | |
519 | |
520 #ifdef LL_2to1 | |
521 vsi_c_close (VSI_CALLER hCommMM); | |
522 hCommMM = VSI_ERROR; | |
523 #else | |
524 vsi_c_close (VSI_CALLER hCommGSMS); | |
525 hCommGSMS = VSI_ERROR; | |
526 #endif | |
527 | |
528 vsi_c_close (VSI_CALLER hCommGRLC); | |
529 hCommGRLC = VSI_ERROR; | |
530 | |
531 return PEI_OK; | |
532 } | |
533 | |
534 /* | |
535 +------------------------------------------------------------------------------ | |
536 | Function : pei_run | |
537 +------------------------------------------------------------------------------ | |
538 | Description : This function is called by the frame when entering the main | |
539 | loop. This fucntion is only required in the active variant. | |
540 | | |
541 | This function is not used. | |
542 | | |
543 | Parameters : handle - Communication handle | |
544 | | |
545 | Return : PEI_OK - sucessful | |
546 | PEI_ERROR - not successful | |
547 | | |
548 +------------------------------------------------------------------------------ | |
549 */ | |
550 LOCAL SHORT pei_run (T_HANDLE TaskHandle, T_HANDLE ComHandle ) | |
551 { | |
552 /* | |
553 * Does not compile! | |
554 * | |
555 T_QMSG Message; | |
556 | |
557 TRACE_FUNCTION ("pei_run"); | |
558 | |
559 if (pei_init (TaskHandle) != PEI_OK) | |
560 return PEI_ERROR; | |
561 | |
562 while (!exit_flag) | |
563 { | |
564 vsi_c_await (VSI_CALLER ComHandle, &Message); | |
565 switch (Message.MsgType) | |
566 { | |
567 case MSG_PRIMITIVE: | |
568 pei_primitive (Message.Msg.Primitive.Prim ); | |
569 break; | |
570 case MSG_SIGNAL: | |
571 pei_signal ( (USHORT)Message.Msg.Signal.SigOPC, | |
572 Message.Msg.Signal.SigBuffer ); | |
573 break; | |
574 case MSG_TIMEOUT: | |
575 pei_timeout ( (USHORT)Message.Msg.Timer.Index ); | |
576 break; | |
577 default: | |
578 TRACE_ERROR("Unknown Message Type"); | |
579 break; | |
580 } | |
581 } | |
582 | |
583 * | |
584 * | |
585 */ | |
586 | |
587 return PEI_OK; | |
588 } | |
589 | |
590 /* | |
591 +------------------------------------------------------------------------------ | |
592 | Function : pei_config | |
593 +------------------------------------------------------------------------------ | |
594 | Description : This function is called by the frame when a primitive is | |
595 | received indicating dynamic configuration. | |
596 | | |
597 | This function is not used in this entity. | |
598 | | |
599 | Parameters : handle - Communication handle | |
600 | | |
601 | Return : PEI_OK - sucessful | |
602 | PEI_ERROR - not successful | |
603 | | |
604 +------------------------------------------------------------------------------ | |
605 */ | |
606 LOCAL SHORT pei_config (char *inString) | |
607 { | |
608 TRACE_FUNCTION ("pei_config"); | |
609 TRACE_FUNCTION (inString); | |
610 | |
611 #ifdef _SIMULATION_ | |
612 #ifndef NCONFIG | |
613 /* | |
614 * Parse for config keywords: | |
615 * SAPI XX KU YYYY | |
616 * SAPI XX KD YYYY | |
617 * SAPI XX MU YYYY | |
618 * SAPI XX MD YYYY | |
619 * SAPI XX N200 YYYY | |
620 * SAPI XX T200 YYYY | |
621 * SAPI XX N201_U YYYY | |
622 * SAPI XX N201_I YYYY | |
623 * The configured values are currently stored in the requested_xid struct, which is | |
624 * refilled completely after change into LLC assigned state and after LLC XID reset. | |
625 */ | |
626 if (inString[0] == 'S' AND inString[1] == 'A' AND inString[2] == 'P' AND | |
627 inString[3] == 'I' AND inString[4] == ' ') | |
628 { | |
629 UBYTE sapi = 0; | |
630 UBYTE i = 5; | |
631 | |
632 /* get first sapi number */ | |
633 if (inString[i] >= '0' AND inString[i] <= '9') | |
634 { | |
635 sapi = (inString[i] - '0'); | |
636 i++; | |
637 } | |
638 | |
639 /* get second sapi number, if available */ | |
640 if (inString[i] >= '0' AND inString[i] <= '9') | |
641 { | |
642 sapi = (sapi * 10) + (inString[i] - '0'); | |
643 i++; | |
644 } | |
645 | |
646 /* skip next whitespace */ | |
647 i++; | |
648 | |
649 /* get XID value to change */ | |
650 if (inString[i] == 'K' AND inString[i+2] == ' ') | |
651 { | |
652 if (inString[i+1] == 'U') /* KU */ | |
653 { | |
654 llc_data->ffs_xid.ku[IMAP(sapi)].valid = TRUE; | |
655 llc_data->ffs_xid.ku[IMAP(sapi)].value = (UBYTE)atoi(&inString[i+3]); | |
656 } | |
657 else /* KD */ | |
658 { | |
659 llc_data->ffs_xid.kd[IMAP(sapi)].valid = TRUE; | |
660 llc_data->ffs_xid.kd[IMAP(sapi)].value = (UBYTE)atoi(&inString[i+3]); | |
661 } | |
662 } | |
663 else if (inString[i] == 'M' AND inString[i+2] == ' ') | |
664 { | |
665 if (inString[i+1] == 'U') /* MU */ | |
666 { | |
667 llc_data->ffs_xid.mu[IMAP(sapi)].valid = TRUE; | |
668 llc_data->ffs_xid.mu[IMAP(sapi)].value = (UBYTE)atoi(&inString[i+3]); | |
669 } | |
670 else /* MD */ | |
671 { | |
672 llc_data->ffs_xid.md[IMAP(sapi)].valid = TRUE; | |
673 llc_data->ffs_xid.md[IMAP(sapi)].value = (UBYTE)atoi(&inString[i+3]); | |
674 } | |
675 } | |
676 else if (inString[i+0] == 'N' AND inString[i+1] == '2' AND inString[i+2] == '0' AND | |
677 inString[i+3] == '1' AND inString[i+4] == '_' AND inString[i+6] == ' ' ) | |
678 { | |
679 if (inString[i+5] == 'I') /* N201_I */ | |
680 { | |
681 llc_data->ffs_xid.n201_i[IMAP(sapi)].valid = TRUE; | |
682 llc_data->ffs_xid.n201_i[IMAP(sapi)].value = (USHORT)atoi(&inString[i+7]); | |
683 } | |
684 else if (inString[i+5] == 'U') /* N201_U */ | |
685 { | |
686 llc_data->ffs_xid.n201_u[UIMAP(sapi)].valid = TRUE; | |
687 llc_data->ffs_xid.n201_u[UIMAP(sapi)].value = (USHORT)atoi(&inString[i+7]); | |
688 } | |
689 } | |
690 else if (inString[i+1] == '2' AND inString[i+2] == '0' AND inString[i+3] == '0' AND | |
691 inString[i+4] == ' ') | |
692 { | |
693 if (inString[i+0] == 'N') /* N200 */ | |
694 { | |
695 llc_data->ffs_xid.n200[UIMAP(sapi)].valid = TRUE; | |
696 llc_data->ffs_xid.n200[UIMAP(sapi)].value = (UBYTE)atoi(&inString[i+5]); | |
697 } | |
698 else if (inString[i+0] == 'T') /* T200 */ | |
699 { | |
700 llc_data->ffs_xid.t200[UIMAP(sapi)].valid = TRUE; | |
701 llc_data->ffs_xid.t200[UIMAP(sapi)].value = (USHORT)atoi(&inString[i+5]); | |
702 } | |
703 } | |
704 } | |
705 | |
706 #endif | |
707 | |
708 #else /*_SIMULATION_*/ | |
709 /* CCI_INFO */ | |
710 if(inString[0] == 'C' AND | |
711 inString[1] == 'C' AND | |
712 inString[2] == 'I' AND | |
713 inString[3] == '_' AND | |
714 inString[4] == 'I' AND | |
715 inString[5] == 'N' AND | |
716 inString[6] == 'F' AND | |
717 inString[7] == 'O') { | |
718 TRACE_EVENT("CCI Info Trace Enabled"); | |
719 llc_fbs_enable_cci_info_trace(); | |
720 } else if (inString[0] == 'D' && | |
721 inString[1] == 'E' && | |
722 inString[2] == 'L' && | |
723 inString[3] == 'A' && | |
724 inString[4] == 'Y') { | |
725 | |
726 USHORT millis = (USHORT)atoi(&inString[5]); | |
727 llc_data->millis = millis; | |
728 TRACE_1_OUT_PARA("Delay timer :%d milliseconds", llc_data->millis); | |
729 } else { | |
730 TRACE_EVENT("PEI ERROR: invalid config primitive"); | |
731 } | |
732 #endif/*_SIMULATION_*/ | |
733 | |
734 return PEI_OK; | |
735 } | |
736 | |
737 /* | |
738 +------------------------------------------------------------------------------ | |
739 | Function : pei_config | |
740 +------------------------------------------------------------------------------ | |
741 | Description : This function is called by the frame in case sudden entity | |
742 | specific data is requested (e.g. entity Version). | |
743 | | |
744 | Parameters : out_monitor - return the address of the data to be | |
745 | monitoredCommunication handle | |
746 | | |
747 | Return : PEI_OK - sucessful (address in out_monitor is valid) | |
748 | PEI_ERROR - not successful | |
749 | | |
750 +------------------------------------------------------------------------------ | |
751 */ | |
752 LOCAL SHORT pei_monitor (void ** out_monitor) | |
753 { | |
754 TRACE_FUNCTION ("pei_monitor"); | |
755 | |
756 /* | |
757 * Version = "0.S" (S = Step). | |
758 */ | |
759 llc_mon.version = "LLC 1.0"; | |
760 *out_monitor = &llc_mon; | |
761 | |
762 return PEI_OK; | |
763 } | |
764 | |
765 /* | |
766 +------------------------------------------------------------------------------ | |
767 | Function : pei_create | |
768 +------------------------------------------------------------------------------ | |
769 | Description : This function is called by the frame when the process is | |
770 | created. | |
771 | | |
772 | Parameters : out_name - Pointer to the buffer in which to locate | |
773 | the name of this entity | |
774 | | |
775 | Return : PEI_OK - entity created successfuly | |
776 | PEI_ERROR - entity could not be created | |
777 | | |
778 +------------------------------------------------------------------------------ | |
779 */ | |
780 GLOBAL SHORT pei_create (T_PEI_INFO **info) | |
781 { | |
782 static T_PEI_INFO pei_info = | |
783 { | |
784 "LLC", /* name */ | |
785 { /* pei-table */ | |
786 pei_init, | |
787 pei_exit, | |
788 pei_primitive, | |
789 pei_timeout, | |
790 pei_signal, | |
791 pei_run, | |
792 pei_config, | |
793 pei_monitor | |
794 }, | |
795 2560, /* stack size */ | |
796 32, /* queue entries */ | |
797 200, /* priority (1->low, 255->high) */ | |
798 TIMER_NUM, /* number of timers */ | |
799 #ifdef _TARGET_ | |
800 PASSIVE_BODY|COPY_BY_REF|TRC_NO_SUSPEND|PRIM_NO_SUSPEND | |
801 #else | |
802 PASSIVE_BODY|COPY_BY_REF | |
803 #endif | |
804 }; | |
805 | |
806 | |
807 TRACE_FUNCTION ("pei_create"); | |
808 | |
809 /* | |
810 * Close Resources if open | |
811 */ | |
812 if (first_access) | |
813 first_access = FALSE; | |
814 else | |
815 pei_exit(); | |
816 | |
817 /* | |
818 * Export startup configuration data | |
819 */ | |
820 *info = &pei_info; | |
821 | |
822 return PEI_OK; | |
823 } | |
824 | |
825 /*==== END OF FILE ==========================================================*/ |