FreeCalypso > hg > tcs211-c139
comparison gpf/tst/tst_pei.c @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 /* | |
2 +------------------------------------------------------------------------------ | |
3 | File: tst_pei.c | |
4 +------------------------------------------------------------------------------ | |
5 | Copyright 2004 Texas Instruments Deutschland, AG | |
6 | All rights reserved. | |
7 | | |
8 | This file is confidential and a trade secret of Texas | |
9 | Instruments Berlin, AG | |
10 | The receipt of or possession of this file does not convey | |
11 | any rights to reproduce or disclose its contents or to | |
12 | manufacture, use, or sell anything it may describe, in | |
13 | whole, or in part, without the specific written consent of | |
14 | Texas Instruments Deutschland, AG. | |
15 +----------------------------------------------------------------------------- | |
16 | Purpose : This Modul contains the PEI interface of TST | |
17 +----------------------------------------------------------------------------- | |
18 */ | |
19 | |
20 #ifndef __TST_PEI_C__ | |
21 #define __TST_PEI_C__ | |
22 #endif | |
23 | |
24 #define ENTITY_TST | |
25 | |
26 /*==== INCLUDES ===================================================*/ | |
27 | |
28 #include <string.h> | |
29 #include <stdio.h> | |
30 #include <stdlib.h> | |
31 | |
32 #ifdef _TOOLS_ | |
33 #include "frame_const.h" | |
34 #include <stdlib.h> | |
35 #endif /* _TOOLS_ */ | |
36 | |
37 #ifndef _TARGET_ | |
38 #include "printtofile.h" | |
39 #endif | |
40 | |
41 #include "typedefs.h" | |
42 #include "vsi.h" | |
43 #include "frame.h" | |
44 #include "pei.h" | |
45 #include "os.h" | |
46 #include "tools.h" | |
47 #include "gdi.h" | |
48 #include "os.h" | |
49 #include "frm_defs.h" | |
50 #include "frm_types.h" | |
51 #include "frm_glob.h" | |
52 #include "route.h" | |
53 #include "drvconf.h" | |
54 #include "tstdriver.h" | |
55 #include "tstheader.h" | |
56 #include "tst_mux.h" | |
57 #include "pcon.h" | |
58 | |
59 #ifdef CTB | |
60 #include "tst_primitives.h" | |
61 #endif | |
62 | |
63 #ifdef _PSOS_ | |
64 #include "pna.h" | |
65 #endif | |
66 | |
67 #ifdef _FF_RV_EXIST_ | |
68 #include "ffs/ffs_api.h" | |
69 #endif | |
70 | |
71 /*==== TYPES ======================================================*/ | |
72 | |
73 #undef VSI_CALLER | |
74 #ifdef _TOOLS_ | |
75 #define VSI_CALLER TST_Handle, | |
76 #else | |
77 #define VSI_CALLER e_running[os_MyHandle()], | |
78 #endif | |
79 | |
80 /*==== CONSTANTS ==================================================*/ | |
81 | |
82 #ifdef _VXWORKS_ | |
83 #define TST_STACKSIZE 8192 | |
84 #define TST_PRIORITY 190 /* priority (1->high, 255->low) */ | |
85 #else | |
86 #ifdef _TOOLS_ | |
87 #define TST_STACKSIZE 4096 | |
88 #define TST_PRIORITY 15 | |
89 #define TST_SND_PRIORITY 15 /* priority (1->low, 255->high) */ | |
90 #define TST_RCV_PRIORITY 15 /* priority (1->low, 255->high) */ | |
91 #else | |
92 #define TST_STACKSIZE 1024 | |
93 #define TST_PRIORITY 2 | |
94 #define TST_SND_PRIORITY 6 /* priority (1->low, 255->high) */ | |
95 #define TST_RCV_PRIORITY 7 /* priority (1->low, 255->high) */ | |
96 #endif | |
97 #endif | |
98 | |
99 #ifdef _TOOLS_ | |
100 #define TST_TIMERS 2 | |
101 #define GET_STACK_TIME_TIMER_INDEX 0 | |
102 #define GET_STACK_TIME_TIMER_DURATION 60000 | |
103 #define TST_SYNC_TIMER_INDEX 1 | |
104 #define TST_SYNC_TIMER_DURATION 2000 | |
105 #else | |
106 #define TST_TIMERS 0 | |
107 #endif | |
108 | |
109 #ifdef _FF_RV_EXIST_ | |
110 #define TRACEMASKFILE "/var/dbg/tracemask" | |
111 #endif | |
112 | |
113 #define DRV_CALLBACK_OPC 0 | |
114 | |
115 #ifdef _TOOLS_ | |
116 #define TR_RCV_BUF_SIZE (MAX_PRIM_PARTITION_SIZE) | |
117 #define TR_MAX_IND (TR_RCV_BUF_SIZE-1) | |
118 USHORT MaxEntities = MAX_ENTITIES; | |
119 #endif /* _TOOLS_ */ | |
120 | |
121 /*==== EXTERNALS ==================================================*/ | |
122 | |
123 #ifndef _TOOLS_ | |
124 extern const T_PCON_PROPERTIES *pcon; | |
125 extern const USHORT TST_SndQueueEntries; | |
126 extern const USHORT TST_RcvQueueEntries; | |
127 extern const USHORT TST_SndStacksize; | |
128 extern const USHORT TST_RcvStacksize; | |
129 extern UBYTE FrameEnv; | |
130 #endif | |
131 | |
132 #ifdef _TOOLS_ | |
133 __declspec (dllimport) UBYTE SuppressOK; | |
134 #else | |
135 extern char *str2ind_version; | |
136 extern UBYTE SuppressOK; | |
137 #endif | |
138 | |
139 #ifdef CTB | |
140 static T_HANDLE hCommIDLE = VSI_ERROR; | |
141 extern short idle_pei_create (T_PEI_INFO const ** info); | |
142 #endif | |
143 | |
144 #ifdef _FF_RV_EXIST_ | |
145 extern char TaskName[]; | |
146 #endif | |
147 | |
148 /*==== VARIABLES ==================================================*/ | |
149 | |
150 #ifndef RUN_INT_RAM | |
151 | |
152 T_HANDLE TST_Handle; | |
153 T_HANDLE RCV_Handle; | |
154 T_HANDLE TIF_Handle; | |
155 | |
156 UBYTE TST_DrvState = TST_DRV_DISCONNECTED; | |
157 static char const *ok_string = "OK"; | |
158 static UBYTE frmenv; | |
159 | |
160 #ifdef _TOOLS_ | |
161 ULONG TR_RcvBufferSize = TR_RCV_BUF_SIZE; | |
162 ULONG TR_MaxInd = TR_MAX_IND; | |
163 int tst_syncronized = 0; | |
164 int tst_message_received = 0; | |
165 int tst_sync_timeout_cnt = 0; | |
166 int tst_max_sync_timeout = 0; | |
167 int tst_sync_mode = 0; | |
168 int tst_sync_sucess = 1; | |
169 int tst_sync_started = 0; | |
170 int tst_status_received = 0; | |
171 T_HANDLE tst_sync_req_handle = VSI_ERROR; | |
172 char sync_req_name[RESOURCE_NAMELEN]; | |
173 char sync_req_time[16]; | |
174 | |
175 #endif /* _TOOLS_ */ | |
176 | |
177 GLOBAL USHORT tst_task_priority = TST_PRIORITY; | |
178 GLOBAL ULONG tst_task_stack_size = TST_STACKSIZE; | |
179 | |
180 extern SHORT tst_pei_primitive (void *primitive); | |
181 | |
182 #endif /* RUN_INT_RAM */ | |
183 | |
184 #ifdef RUN_INT_RAM | |
185 | |
186 extern T_HANDLE TST_Handle; | |
187 extern T_HANDLE RCV_Handle; | |
188 extern T_HANDLE TIF_Handle; | |
189 extern UBYTE TST_DrvState; | |
190 | |
191 #endif | |
192 | |
193 #ifdef CTB | |
194 static char ctb_rcv[4]; | |
195 static U32 ctb_remaining_tick_time=0; | |
196 BOOL ctb_tick_enabled = FALSE; | |
197 BOOL ctb_sent_to_tap = FALSE; | |
198 T_HANDLE idle_handle; | |
199 #endif | |
200 | |
201 /*==== FUNCTIONS ==================================================*/ | |
202 | |
203 #ifndef RUN_FLASH | |
204 /* | |
205 +--------------------------------------------------------------------+ | |
206 | PROJECT : GSM-GPF (8415) MODULE : TST_PEI | | |
207 | STATE : code ROUTINE : pei_primitive | | |
208 +--------------------------------------------------------------------+ | |
209 */ | |
210 | |
211 SHORT tst_pei_primitive (void *primitive) | |
212 { | |
213 T_PRIM_HEADER *prim = (T_PRIM_HEADER*)primitive; | |
214 #ifndef _TOOLS_ | |
215 T_VOID_STRUCT *prim_ptr = NULL; | |
216 #endif | |
217 SHORT ret = PEI_OK; | |
218 | |
219 #ifdef _TOOLS_ | |
220 if ( ((SAP_NR(prim->opc)==TRACE_SAP) || (prim->opc==TRACE_OPC)) && (P_SHO(prim)!=0) ) | |
221 { | |
222 prim->opc = SYS_MASK; | |
223 } | |
224 #endif | |
225 | |
226 if ( (SAP_NR(prim->opc)!=TRACE_SAP) && (prim->opc!=TRACE_OPC) && !(prim->opc & SYS_MASK) ) | |
227 { | |
228 #ifndef _TOOLS_ | |
229 prim_ptr = (T_VOID_STRUCT*)(((T_PRIM_X*)prim)->prim_ptr); | |
230 #endif | |
231 VSI_PPM_RCV(prim_ptr); | |
232 PTRACE_OUT(prim->opc ); | |
233 } | |
234 | |
235 if ( TST_DrvState == TST_DRV_CONNECTED ) | |
236 { | |
237 if ( vsi_d_write ( TST_Handle, TIF_Handle, primitive, prim->len ) != VSI_OK ) | |
238 ret = PEI_ERROR; | |
239 #ifdef _TOOLS_ | |
240 vsi_t_sleep(TST_Handle,10); | |
241 #endif | |
242 } | |
243 | |
244 #ifndef _TOOLS_ | |
245 if ( prim_ptr != NULL ) | |
246 { | |
247 FREE(P2D(prim_ptr)); | |
248 } | |
249 #endif | |
250 vsi_trc_free (0, (T_VOID_STRUCT**)&prim); | |
251 | |
252 return ( ret ); | |
253 } | |
254 #endif | |
255 | |
256 #ifndef RUN_INT_RAM | |
257 /* | |
258 +--------------------------------------------------------------------+ | |
259 | PROJECT : GSM-GPF (8415) MODULE : TST_PEI | | |
260 | STATE : code ROUTINE : pei_init | | |
261 +--------------------------------------------------------------------+ | |
262 */ | |
263 | |
264 LOCAL SHORT pei_init ( T_HANDLE handle ) | |
265 { | |
266 #ifdef _TOOLS_ | |
267 T_HANDLE h_pco; | |
268 #endif | |
269 | |
270 #ifdef _FF_RV_EXIST_ | |
271 T_HANDLE entityTraceMask; | |
272 ULONG actual; | |
273 T_FFS_FD fd; | |
274 T_RV_RETURN retPath; | |
275 BOOL gotAll = TRUE; | |
276 #endif | |
277 | |
278 TST_Handle = handle; | |
279 #ifdef _TOOLS_ | |
280 while (vsi_c_open (0, FRM_RCV_NAME) < VSI_OK) | |
281 { | |
282 vsi_t_sleep(0,100); | |
283 } | |
284 frmenv = (UBYTE) pf_get_frameenv (); | |
285 if ( os_OpenQueue (0, FRM_PCO_NAME, &h_pco) == OS_OK || | |
286 os_create_extq (FRM_PCO_NAME, &h_pco) == OS_OK) | |
287 { | |
288 vsi_o_set_htrace (h_pco); | |
289 #ifdef _DEBUG | |
290 fprintf (stdout,"TST: %s commH set to %d\n", FRM_PCO_NAME,h_pco); | |
291 #endif | |
292 } | |
293 vsi_t_start ( handle, GET_STACK_TIME_TIMER_INDEX, GET_STACK_TIME_TIMER_DURATION ); | |
294 #else | |
295 if ( vsi_c_open (TST_Handle, FRM_RCV_NAME) < VSI_OK ) | |
296 return PEI_ERROR; | |
297 RCV_Handle = vsi_e_handle ( TST_Handle, FRM_RCV_NAME ); | |
298 frmenv = FrameEnv; | |
299 #endif | |
300 #ifndef _TARGET_ | |
301 initPrintToFile(); | |
302 #endif | |
303 if ( vsi_d_init ( TST_Handle ) != VSI_OK ) | |
304 { | |
305 #ifndef _TARGET_ | |
306 printf("SYSTEM ERROR: Driver initialization failed\n"); | |
307 vsi_o_assert ( TST_Handle, OS_SYST_ERR, __FILE__, __LINE__, "SYSTEM ERROR: Testinterface driver initialization failed" ); | |
308 #else | |
309 ; | |
310 #endif | |
311 } | |
312 TIF_Handle = vsi_d_open ( TST_Handle, (char*)TIF_NAME ); | |
313 vsi_d_setsignal ( TST_Handle, 0, DRV_SIGTYPE_READ|DRV_SIGTYPE_CONNECT|DRV_SIGTYPE_DISCONNECT); | |
314 vsi_d_setconfig ( TST_Handle, 0, NULL ); | |
315 vsi_trcsuspend ( TST_Handle, TST_Handle, OS_NO_SUSPEND ); | |
316 SuppressOK = FALSE; | |
317 tst_mux_init(); | |
318 | |
319 #ifdef _FF_RV_EXIST_ | |
320 fd = ffs_open(TRACEMASKFILE, FFS_O_RDWR); | |
321 if (fd < 0) | |
322 { | |
323 // could not open nor create /var/dbg/tracemask warning | |
324 vsi_o_ttrace(NO_TASK, TC_SYSTEM, "pei_init: no trace mask in FFS"); | |
325 } | |
326 else | |
327 { | |
328 InitializeTrace(); | |
329 TraceMask[0] = 0; | |
330 TraceMask[0] |= TC_SYSTEM|TC_ERROR; | |
331 for (entityTraceMask = 0; entityTraceMask < (MaxEntities + 1); entityTraceMask++) | |
332 { | |
333 actual = TraceMask[entityTraceMask]; | |
334 if (ffs_read(fd, (void*)&TraceMask[entityTraceMask], sizeof(ULONG) ) != sizeof(ULONG) ) | |
335 { | |
336 gotAll = FALSE; | |
337 } | |
338 else | |
339 { | |
340 if (entityTraceMask == 0) // first element | |
341 { | |
342 TraceMask[0] = 0; | |
343 TraceMask[0] |= TC_SYSTEM|TC_ERROR; | |
344 } | |
345 if (actual != TraceMask[entityTraceMask]) | |
346 { | |
347 // not the default trace mask, generate warning | |
348 if ( vsi_e_name ( 0, entityTraceMask, TaskName ) == VSI_OK ) | |
349 { | |
350 vsi_o_ttrace(NO_TASK, TC_SYSTEM, "pei_init: FFS trace mask gave 0x%08x for %s (default 0x%08x)", TraceMask[entityTraceMask], TaskName, actual); | |
351 } | |
352 } | |
353 } | |
354 } | |
355 } | |
356 ffs_close(fd); | |
357 if (!gotAll) | |
358 { | |
359 vsi_o_ttrace(NO_TASK, TC_SYSTEM, "pei_init: some trace masks can't be read from FFS"); | |
360 } | |
361 #endif | |
362 | |
363 return PEI_OK; | |
364 } | |
365 #endif | |
366 | |
367 | |
368 | |
369 #ifndef RUN_INT_RAM | |
370 /* | |
371 +--------------------------------------------------------------------+ | |
372 | PROJECT : GSM-GPF (8415) MODULE : TST_PEI | | |
373 | STATE : code ROUTINE : pei_exit | | |
374 +--------------------------------------------------------------------+ | |
375 */ | |
376 | |
377 static SHORT pei_exit (void) | |
378 { | |
379 #ifdef _TOOLS_ | |
380 T_HANDLE rcvh=vsi_p_handle (0, FRM_RCV_NAME); | |
381 if (rcvh > VSI_OK) | |
382 { | |
383 /* exit RCV process */ | |
384 vsi_p_exit ( TST_Handle, vsi_p_handle (0, FRM_RCV_NAME)); | |
385 } | |
386 /* exit all drivers */ | |
387 vsi_d_exit ( TST_Handle, 0); | |
388 #endif /* _TOOLS_ */ | |
389 | |
390 return PEI_OK; | |
391 } | |
392 #endif | |
393 | |
394 #ifndef RUN_INT_RAM | |
395 #ifdef _TOOLS_ | |
396 /* | |
397 +--------------------------------------------------------------------+ | |
398 | PROJECT : GSM-GPF (8415) MODULE : TST_PEI | | |
399 | STATE : code ROUTINE : pei_timeout | | |
400 +--------------------------------------------------------------------+ | |
401 */ | |
402 | |
403 LOCAL SHORT pei_timeout (USHORT index) | |
404 { | |
405 | |
406 switch ( index ) | |
407 { | |
408 case GET_STACK_TIME_TIMER_INDEX: | |
409 #if 0 | |
410 if ( tst_message_received == 1 ) | |
411 { | |
412 tst_drv_write ( NO_TASK, SYS_MASK, FRM_TST_NAME, (char*)SYSPRIM_GET_STACK_TIME ); | |
413 } | |
414 vsi_t_start ( VSI_CALLER GET_STACK_TIME_TIMER_INDEX, GET_STACK_TIME_TIMER_DURATION ); | |
415 #endif | |
416 break; | |
417 case TST_SYNC_TIMER_INDEX: | |
418 if ( tst_sync_timeout_cnt++ >= tst_max_sync_timeout-1 ) | |
419 { | |
420 T_HANDLE tif_handle; | |
421 T_VOID_STRUCT *ptr; | |
422 | |
423 tst_status_received = 0; | |
424 tst_sync_timeout_cnt = 0; | |
425 tst_sync_mode = 0; | |
426 tst_sync_sucess = 0; | |
427 tif_handle = vsi_d_open ( TST_Handle, (char*)TIF_NAME ); | |
428 vsi_d_setconfig ( TST_Handle, tif_handle, DISABLE_SYNC_MODE ); | |
429 vsi_t_stop ( TST_Handle, TST_SYNC_TIMER_INDEX ); | |
430 ptr = vsi_c_pnew ( sizeof(T_PRIM_HEADER)+strlen(SYSPRIM_TST_SYNC_REJ), 0x8000 FILE_LINE ); | |
431 strcpy ( (char*)ptr, SYSPRIM_TST_SYNC_REJ ); | |
432 vsi_c_psend ( tst_sync_req_handle, ptr ); | |
433 } | |
434 else | |
435 { | |
436 if ( tst_syncronized == 0 ) | |
437 { | |
438 T_HANDLE tif_handle; | |
439 tst_sync_sucess = 1; | |
440 tst_status_received = 0; | |
441 tif_handle = vsi_d_open ( TST_Handle, (char*)TIF_NAME ); | |
442 vsi_d_setconfig ( TST_Handle, tif_handle, ENABLE_SYNC_MODE ); | |
443 tst_drv_write ( NO_TASK, SYS_MASK, FRM_RCV_NAME, (char*)"TRACECLASS 0x10" ); | |
444 vsi_t_sleep ( TST_Handle, 100 ); | |
445 tst_drv_write ( NO_TASK, SYS_MASK, FRM_RCV_NAME, (char*)"STATUS TASK" ); | |
446 vsi_t_start ( TST_Handle, TST_SYNC_TIMER_INDEX, TST_SYNC_TIMER_DURATION ); | |
447 vsi_t_sleep ( TST_Handle, 200 ); | |
448 tst_drv_write ( NO_TASK, SYS_MASK, FRM_RCV_NAME, (char*)"ROUTING" ); | |
449 } | |
450 } | |
451 break; | |
452 default: | |
453 break; | |
454 } | |
455 return PEI_OK; | |
456 } | |
457 #endif | |
458 #endif | |
459 | |
460 #ifndef RUN_INT_RAM | |
461 /* | |
462 +--------------------------------------------------------------------+ | |
463 | PROJECT : GSM-GPF (8415) MODULE : TST_PEI | | |
464 | STATE : code ROUTINE : pei_signal | | |
465 +--------------------------------------------------------------------+ | |
466 */ | |
467 LOCAL SHORT pei_signal (ULONG SignalType, void *ptr) | |
468 { | |
469 /* | |
470 * the following line of code causes a warning on tms470 compiler, that cannot be avoided | |
471 * without changing the PEI interface. Warning will not cause a problem | |
472 */ | |
473 T_VOID_STRUCT *sig_ptr = (T_VOID_STRUCT*)ptr; | |
474 T_PRIM_HEADER *prim; | |
475 T_S_HEADER *s_hdr; | |
476 T_HANDLE DestTaskHandle, DestComHandle; | |
477 T_HANDLE min, max, i; | |
478 unsigned int Length; | |
479 ULONG Suspend, TraceMask, OldTraceMask; | |
480 unsigned int Offset = 0; | |
481 char token[81]; | |
482 UBYTE FreePrim = 1; | |
483 SHORT ret = PEI_OK; | |
484 USHORT processed = FALSE; | |
485 | |
486 switch ( SignalType ) | |
487 { | |
488 case DRV_SIGTYPE_READ: | |
489 VSI_PPM_RCV(sig_ptr); | |
490 if ( (prim = ((T_PRIM_X*)sig_ptr)->prim_ptr) != NULL ) | |
491 { | |
492 VSI_PPM_RCV (prim); | |
493 s_hdr = (T_S_HEADER*)((ULONG*)prim + prim->sh_offset); | |
494 DestTaskHandle = vsi_e_handle ( TST_Handle, s_hdr->rcv ); | |
495 if ( DestTaskHandle == VSI_ERROR ) | |
496 { | |
497 if ( !strcmp ( "IRQ", s_hdr->rcv ) ) | |
498 { | |
499 DestTaskHandle = 0; | |
500 OldTraceMask = TC_SYSTEM; | |
501 TraceMask = 0; | |
502 } | |
503 else | |
504 { | |
505 if ( !strcmp ( "SYST", s_hdr->rcv ) ) | |
506 { | |
507 DestTaskHandle = 0; | |
508 vsi_gettracemask ( DestTaskHandle, 0, &OldTraceMask); | |
509 TraceMask = TC_SYSTEM; | |
510 } | |
511 else | |
512 { | |
513 OldTraceMask = 0; | |
514 TraceMask = 0; | |
515 } | |
516 } | |
517 } | |
518 else | |
519 { | |
520 /* to satisfy LINT */ | |
521 OldTraceMask = 0; | |
522 TraceMask = 0; | |
523 } | |
524 if ( DestTaskHandle != VSI_ERROR ) | |
525 { | |
526 if ( prim->opc & SYS_MASK ) | |
527 { | |
528 Length = GetNextToken ((char*)(P2D(prim)), token, " #"); | |
529 Offset = Length+1; | |
530 if ( frmenv == ENV_STACK ) | |
531 { | |
532 /* Set Traceclass for non-frame tasks/HISRs */ | |
533 if ( DestTaskHandle == 0 && !strcmp (token, SYSPRIM_TRACECLASS_TOKEN) ) | |
534 { | |
535 Length = GetNextToken ((char *)(P2D(prim))+Offset, token, " #"); | |
536 TraceMask = ASCIIToHex(token, CHARS_FOR_32BIT); | |
537 vsi_settracemask ( DestTaskHandle, 0, TraceMask|OldTraceMask); /* it is not allowed to switch of system traces */ | |
538 sprintf ( token, "%s (%s %s)", ok_string, (char*)(P2D(prim)), s_hdr->rcv ); | |
539 tst_drv_write ( NO_TASK, 0, NULL, token ); | |
540 processed = TRUE; | |
541 } | |
542 if (!strcmp (token, SYSPRIM_TRC_SUSPEND)) | |
543 { | |
544 processed = TRUE; | |
545 /* | |
546 * set suspend for traces to SUSPEND or NO_SUSPEND | |
547 */ | |
548 Length = GetNextToken ((char *)(P2D(prim))+Offset, token, " #"); | |
549 Offset += (Length+1); | |
550 | |
551 if ( !strcmp ( token, "ALL" ) ) | |
552 { | |
553 min = 1; | |
554 max = MaxEntities; | |
555 GetNextToken ((char *)(P2D(prim))+Offset, token, " #"); | |
556 } | |
557 else | |
558 { | |
559 min = DestTaskHandle; | |
560 max = min; | |
561 } | |
562 if ( !strcmp ( token, "YES" ) ) | |
563 Suspend = 0xffffffff; | |
564 else | |
565 Suspend = 0; | |
566 | |
567 for ( i = min; i <= max; i++ ) | |
568 vsi_trcsuspend ( TST_Handle, i, Suspend ); | |
569 sprintf ( token, "%s (%s %s)", ok_string, (char*)(P2D(prim)), s_hdr->rcv ); | |
570 tst_drv_write ( NO_TASK, 0, NULL, token ); | |
571 } | |
572 else if (!strcmp (token, SYSPRIM_MEMCHECK_TOKEN)) | |
573 { | |
574 processed = TRUE; | |
575 /* | |
576 * Memory Check | |
577 */ | |
578 for ( i = 1; i <= MaxEntities; i++ ) | |
579 { | |
580 if ( vsi_object_info (TST_Handle, OS_OBJTASK, (USHORT)i, token, sizeof(token)) != VSI_ERROR ) | |
581 { | |
582 tst_drv_write ( NO_TASK, 0, NULL, token ); | |
583 } | |
584 } | |
585 } | |
586 #ifdef CTB | |
587 #ifndef _TOOLS_ | |
588 else if (!strcmp (token, SYSPRIM_TIMER_TICK_REQ)) | |
589 { | |
590 processed = TRUE; | |
591 ctb_sent_to_tap = FALSE; | |
592 if(strlen(ctb_rcv)<3) | |
593 { | |
594 strcpy(ctb_rcv, P_SND(prim)); | |
595 } | |
596 ctb_remaining_tick_time = P_TIME(prim); //The time parameter is sent in the time stap. | |
597 /*sprintf ( token, "Requesting ticking for %d from %s", ctb_remaining_tick_time, ctb_rcv); | |
598 tst_drv_write ( NO_TASK, 0, NULL, token );*/ | |
599 PSIGNAL(hCommIDLE, IDLE_REQ, NULL); | |
600 } | |
601 else if (!strcmp (token, SYSPRIM_INT_TICK_MODE_REQ)) | |
602 { | |
603 processed = TRUE; | |
604 if(ctb_tick_enabled) | |
605 { | |
606 vsi_p_delete (TST_Handle,idle_handle); | |
607 ctb_tick_enabled = FALSE; | |
608 ctb_sent_to_tap = FALSE; | |
609 sprintf ( token, "Disabling Common Timer Base"); | |
610 ctb_rcv[0]='\0'; | |
611 os_StartTicking(); | |
612 } | |
613 else | |
614 sprintf ( token, "Common Timer Base already disabled"); | |
615 tst_drv_write ( NO_TASK, 0, NULL, token ); | |
616 if(!strcmp(P_SND(prim), "TAP")) | |
617 { | |
618 tst_drv_write ( NO_TASK, SYS_MASK, "TAP", "INT_TICK_MODE_CNF"); | |
619 } | |
620 } | |
621 else if (!strcmp (token, SYSPRIM_EXT_TICK_MODE_REQ)) | |
622 { | |
623 processed = TRUE; | |
624 if(!ctb_tick_enabled) | |
625 { | |
626 if ( (idle_handle = vsi_p_create (TST_Handle, idle_pei_create, NULL, 1)) == VSI_ERROR ) | |
627 { | |
628 vsi_o_assert ( TST_Handle, OS_SYST_ERR, __FILE__, __LINE__, "CTB: Cannot create IDLE task" ); | |
629 } | |
630 vsi_p_start (TST_Handle, idle_handle); | |
631 while ( (hCommIDLE = vsi_e_handle ( TST_Handle, "IDLE" ))<VSI_OK) | |
632 { | |
633 vsi_t_sleep(0,1000); | |
634 } | |
635 os_StopTicking(); | |
636 sprintf ( token, "Enabling Common Timer Base"); | |
637 ctb_tick_enabled = TRUE; | |
638 } | |
639 else | |
640 sprintf ( token, "Common Timer Base already enabled"); | |
641 tst_drv_write ( NO_TASK, 0, NULL, token ); | |
642 if(!strcmp(P_SND(prim), "TAP")) | |
643 { | |
644 char send_str[50]; | |
645 char tmp_str[8]; | |
646 //Get process id and put in this syst primitive. | |
647 strcpy(send_str,"EXT_TICK_MODE_CNF#"); | |
648 _itoa(os_GetProcessId(), tmp_str, 10); | |
649 strcat(send_str, tmp_str); | |
650 tst_drv_write ( NO_TASK, SYS_MASK, "TAP", send_str); | |
651 } | |
652 } | |
653 #endif | |
654 #endif //CTB | |
655 | |
656 #ifndef _TARGET_ | |
657 else if (!strcmp (token, SYSPRIM_SUPPRESS_OK)) | |
658 { | |
659 processed = TRUE; | |
660 SuppressOK = TRUE; | |
661 } | |
662 #endif | |
663 else if (!strcmp (token, SYSPRIM_GET_STACK_TIME)) | |
664 { | |
665 processed = TRUE; | |
666 tst_drv_write ( NO_TASK, SYS_MASK, FRM_TST_NAME, (char*)SYSPRIM_IS_STACK_TIME ); | |
667 } | |
668 else if (!strcmp (token, SYSPRIM_READ_ROUTING)) | |
669 { | |
670 processed = TRUE; | |
671 i = 0; | |
672 while ( rt_RouteRead ( DestTaskHandle, token ) != RT_ERROR ) | |
673 { | |
674 tst_drv_write ( NO_TASK, 0, NULL, token ); | |
675 i++; | |
676 } | |
677 if ( !i ) | |
678 { | |
679 sprintf ( token, "NO %s ROUTINGS STORED", s_hdr->rcv ); | |
680 tst_drv_write ( NO_TASK, 0, NULL, token ); | |
681 } | |
682 } | |
683 #ifndef _TOOLS_ | |
684 else if (!strcmp (token, SYSPRIM_STR2IND_VERSION)) | |
685 { | |
686 processed = TRUE; | |
687 tst_drv_write ( NO_TASK, 0, NULL, str2ind_version ); | |
688 } | |
689 #endif | |
690 } | |
691 } | |
692 } | |
693 #ifdef _TOOLS_ | |
694 else | |
695 { | |
696 /* synchronization with protocol stack */ | |
697 if ( tst_sync_mode == 1 ) | |
698 { | |
699 char *pos; | |
700 char task_status; | |
701 T_VOID_STRUCT *cmd_ptr; | |
702 | |
703 pos = strstr ( (char*)(P2D(prim)), "Name:" ); | |
704 if ( pos != NULL ) | |
705 { | |
706 tst_sync_started = 1; | |
707 GetNextToken ((char *)(P2D(prim))+strlen("Name:"), token, " #"); | |
708 if ( strcmp(token,FRM_RCV_NAME) && strcmp(token,FRM_TST_NAME) && strcmp(token,"EXTR") ) | |
709 { | |
710 pos = strstr ( (char*)(P2D(prim)), "Stat:" ); | |
711 if ( pos != NULL ) | |
712 { | |
713 tst_status_received = 1; | |
714 task_status = atoi(pos+strlen("Stat:")); | |
715 if ( task_status != 6 ) | |
716 { | |
717 tst_sync_sucess = 0; | |
718 } | |
719 } | |
720 } | |
721 } | |
722 else | |
723 { | |
724 if ( tst_sync_started == 1 ) | |
725 { | |
726 pos = strstr ( (char*)(P2D(prim)), "ROUTING" ); | |
727 if ( pos != NULL ) | |
728 { | |
729 if ( tst_sync_sucess == 1 && tst_status_received == 1 ) | |
730 { | |
731 T_HANDLE tif_handle = vsi_d_open ( TST_Handle, (char*)TIF_NAME ); | |
732 vsi_d_setconfig ( TST_Handle, tif_handle, DISABLE_SYNC_MODE ); | |
733 vsi_t_stop ( TST_Handle, TST_SYNC_TIMER_INDEX ); | |
734 cmd_ptr = vsi_c_pnew ( sizeof(T_PRIM_HEADER)+strlen(SYSPRIM_TST_SYNC_CNF), 0x8000 FILE_LINE ); | |
735 strcpy ( (char*)cmd_ptr, SYSPRIM_TST_SYNC_CNF ); | |
736 vsi_o_ttrace ( TST_Handle, TC_TIMER, "SYNC DONE") ; | |
737 vsi_c_psend ( tst_sync_req_handle, cmd_ptr ); | |
738 tst_sync_mode = 0; | |
739 tst_sync_timeout_cnt = 0; | |
740 tst_syncronized = 1; | |
741 } | |
742 } | |
743 } | |
744 } | |
745 } | |
746 } | |
747 #endif /* _TOOLS_ */ | |
748 if ( processed == FALSE ) | |
749 { | |
750 if ( ( DestComHandle = vsi_c_open ( TST_Handle, s_hdr->rcv ) ) != VSI_ERROR ) | |
751 { | |
752 /* free carrier */ | |
753 PFREE(P2D(sig_ptr)); | |
754 FreePrim = 0; | |
755 vsi_c_psend (DestComHandle, (T_VOID_STRUCT*)P2D(prim) FILE_LINE_MACRO); | |
756 } | |
757 else | |
758 { | |
759 #ifndef _TOOLS_ | |
760 if ( frmenv == ENV_STACK ) | |
761 { | |
762 sprintf ( token, "SYSTEM WARNING: Receiver Process '%s' unknown", s_hdr->rcv ); | |
763 tst_drv_write ( NO_TASK, 0, NULL, token ); | |
764 ret = PEI_ERROR; | |
765 } | |
766 #endif /* _TOOLS_ */ | |
767 /* free dyn_ptr if unknown receiver */ | |
768 FREE(P2D(prim)); | |
769 } | |
770 } | |
771 else | |
772 { | |
773 /* free dyn_ptr if processed in TST */ | |
774 FREE(P2D(prim)); | |
775 } | |
776 } | |
777 | |
778 if ( FreePrim ) | |
779 { | |
780 /* free carrier */ | |
781 PFREE(P2D(sig_ptr)); | |
782 } | |
783 break; | |
784 case DRV_SIGTYPE_CONNECT: | |
785 TST_DrvState = TST_DRV_CONNECTED; | |
786 #ifndef _TOOLS_ | |
787 tst_drv_write ( NO_TASK, SYS_MASK, FRM_TST_NAME, (char*)SYSPRIM_IS_STACK_TIME ); | |
788 tst_drv_write ( NO_TASK, 0, NULL, str2ind_version ); | |
789 #endif | |
790 break; | |
791 case DRV_SIGTYPE_DISCONNECT: | |
792 TST_DrvState = TST_DRV_DISCONNECTED; | |
793 #ifdef _PSOS_ | |
794 /* for pSOS: send empty message to TST */ | |
795 if ( vsi_d_open ( TST_Handle, "SOCKET" ) != VSI_ERROR ) | |
796 { | |
797 T_QMSG Message; | |
798 static T_HANDLE tst_handle = 0; | |
799 | |
800 if( TST_Handle > 0 ) | |
801 { | |
802 Message.MsgType = MSG_PRIMITIVE; | |
803 Message.Msg.Primitive.Prim = NULL; | |
804 Message.Msg.Primitive.PrimLen = 0; | |
805 #ifdef MEMORY_SUPERVISION | |
806 vsi_c_send (TST_Handle, TST_Handle, &Message, __FILE__, __LINE__); | |
807 #else | |
808 vsi_c_send (TST_Handle, TST_Handle, &Message); | |
809 #endif | |
810 } | |
811 } | |
812 #endif | |
813 break; | |
814 #ifdef CTB | |
815 case IDLE_CNF: | |
816 if(ctb_remaining_tick_time > 0 && ctb_tick_enabled && !ctb_sent_to_tap) | |
817 { | |
818 os_Tick(); | |
819 PSIGNAL(hCommIDLE, IDLE_REQ, NULL); | |
820 ctb_remaining_tick_time = ctb_remaining_tick_time-50; | |
821 } | |
822 else | |
823 { | |
824 /*sprintf ( token, "Ticking finished - remaining time %d", ctb_remaining_tick_time); | |
825 tst_drv_write ( NO_TASK, 0, NULL, token );*/ | |
826 if(!strcmp(ctb_rcv, "TAP")) | |
827 tst_drv_write ( NO_TASK, SYS_MASK, FRM_TST_NAME, SYSPRIM_IS_STACK_TIME ); //Synchronize time with tools | |
828 tst_drv_write ( NO_TASK, SYS_MASK, ctb_rcv, "TIMER_TICK_CNF"); | |
829 } | |
830 break; | |
831 #endif | |
832 default: | |
833 sprintf ( token, "Unhandled PSIGNAL"); | |
834 tst_drv_write ( NO_TASK, 0, NULL, token ); | |
835 break; | |
836 } | |
837 return ( ret ); | |
838 } | |
839 #endif | |
840 | |
841 #ifndef RUN_INT_RAM | |
842 /* | |
843 +--------------------------------------------------------------------+ | |
844 | PROJECT : GSM-GPF (8415) MODULE : TST_PEI | | |
845 | STATE : code ROUTINE : pei_config | | |
846 +--------------------------------------------------------------------+ | |
847 */ | |
848 | |
849 LOCAL SHORT pei_config (char * inString) | |
850 { | |
851 T_HANDLE drv_handle; | |
852 char token[80]; | |
853 unsigned int length, offset; | |
854 BOOL select = 0,config = 0; | |
855 T_TST_DRV_ENTRY *tst_drv_info; | |
856 | |
857 length = GetNextToken (inString, token, " #"); | |
858 offset = length+1; | |
859 if ( !strcmp ( token, "DRIVER") ) | |
860 { | |
861 length = GetNextToken (inString+offset, token, " #"); | |
862 offset += (length+1); | |
863 if ( !strcmp ( token, "FLUSH") ) | |
864 { | |
865 vsi_d_flush ( TST_Handle, 0 ); | |
866 } | |
867 if ( !strcmp ( token, "SELECT") ) | |
868 { | |
869 select = 1; | |
870 } | |
871 if ( !strcmp ( token, "CONFIG") ) | |
872 { | |
873 config = 1; | |
874 #ifdef _TOOLS_ | |
875 tst_syncronized = 0; | |
876 #endif | |
877 } | |
878 length = GetNextToken (inString+offset, token, " #"); | |
879 offset += (length+1); | |
880 if ( select ) | |
881 { | |
882 #ifdef _TOOLS_ | |
883 if ( !strcmp(NODRV_NAME,token) ) | |
884 { | |
885 if ( tst_drv_open ( token, &tst_drv_info ) == VSI_ERROR || | |
886 vsi_d_create ( TST_Handle, tst_drv_info ) == VSI_ERROR) | |
887 { | |
888 return PEI_ERROR; | |
889 } | |
890 PrintToFile("TST: all drivers unloaded\n"); | |
891 } | |
892 else | |
893 #endif | |
894 { | |
895 /* check if driver is already loaded */ | |
896 if ( (drv_handle = vsi_d_open ( TST_Handle, token )) == VSI_ERROR ) | |
897 { | |
898 if ( tst_drv_open ( token, &tst_drv_info ) == VSI_ERROR || | |
899 vsi_d_create ( TST_Handle, tst_drv_info ) == VSI_ERROR ) | |
900 { | |
901 return PEI_ERROR; | |
902 } | |
903 } | |
904 else | |
905 { | |
906 #ifdef _TOOLS_ | |
907 #ifdef _DEBUG | |
908 PrintToFile("TST: keeping %s loaded\n",token); | |
909 #endif | |
910 #endif | |
911 vsi_d_close( TST_Handle, drv_handle ); | |
912 } | |
913 } | |
914 } | |
915 if ( config ) | |
916 { | |
917 if ( ( drv_handle = vsi_d_open ( TST_Handle, token ) ) == VSI_ERROR ) | |
918 { | |
919 return PEI_ERROR; | |
920 } | |
921 if (vsi_d_setconfig ( TST_Handle, drv_handle, inString+offset) != VSI_OK) | |
922 { | |
923 #ifdef _TOOLS_ | |
924 char text[99]; | |
925 _snprintf(text,98,"TST: Error configuring driver %s with \"%s\" :-(",token, inString+offset); | |
926 vsi_o_ttrace(NO_TASK, TC_SYSTEM, text); | |
927 #endif /* _TOOLS_ */ | |
928 } | |
929 vsi_d_close( TST_Handle, drv_handle ); | |
930 } | |
931 } | |
932 else if ( !strcmp ( token, "THIF") ) | |
933 { | |
934 T_HANDLE tif_handle; | |
935 tif_handle = vsi_d_open ( TST_Handle, (char*)TIF_NAME ); | |
936 length = GetNextToken (inString+offset, token, " #"); | |
937 offset += (length+1); | |
938 | |
939 if ( !strcmp ( token, "OPEN") ) | |
940 { | |
941 vsi_d_setconfig ( TST_Handle, tif_handle, token ); | |
942 } | |
943 else if ( !strcmp ( token, "CLOSE") ) | |
944 { | |
945 vsi_d_setconfig ( TST_Handle, tif_handle, token ); | |
946 } | |
947 } | |
948 #ifdef _TOOLS_ | |
949 else if ( !strcmp ( token, SYSPRIM_TST_SYNC_REQ) ) | |
950 { | |
951 T_HANDLE tif_handle; | |
952 unsigned int len; | |
953 | |
954 len = GetNextToken (inString+offset, sync_req_name, " #"); | |
955 offset += len; | |
956 len = GetNextToken (inString+offset, sync_req_time, " #"); | |
957 tst_max_sync_timeout = (atoi(sync_req_time) - 1000)/TST_SYNC_TIMER_DURATION; | |
958 | |
959 tst_sync_req_handle = vsi_c_open ( TST_Handle, sync_req_name ); | |
960 if ( tst_sync_req_handle != VSI_ERROR ) | |
961 { | |
962 if ( tst_syncronized == 0 ) | |
963 { | |
964 tst_sync_started = 0; | |
965 tst_status_received = 0; | |
966 tst_sync_mode = 1; | |
967 tst_sync_sucess = 1; | |
968 tif_handle = vsi_d_open ( TST_Handle, (char*)TIF_NAME ); | |
969 vsi_d_setconfig ( TST_Handle, tif_handle, ENABLE_SYNC_MODE ); | |
970 tst_drv_write ( NO_TASK, SYS_MASK, FRM_RCV_NAME, (char*)"TRACECLASS 0x10" ); | |
971 vsi_t_sleep ( TST_Handle, 100 ); | |
972 tst_drv_write ( NO_TASK, SYS_MASK, FRM_RCV_NAME, (char*)"STATUS TASK" ); | |
973 vsi_t_start ( TST_Handle, TST_SYNC_TIMER_INDEX, TST_SYNC_TIMER_DURATION ); | |
974 vsi_t_sleep ( TST_Handle, 200 ); | |
975 tst_drv_write ( NO_TASK, SYS_MASK, FRM_RCV_NAME, (char*)"ROUTING" ); | |
976 } | |
977 } | |
978 } | |
979 #endif | |
980 #ifdef _FF_RV_EXIST_ | |
981 else if ( !strcmp ( token, "TRACEMASK_IN_FFS") ) | |
982 { | |
983 int amount; | |
984 T_FFS_FD fd; | |
985 T_FFS_RET ret; | |
986 T_FFS_SIZE written; | |
987 T_FFS_DIR dir; | |
988 BOOL writeFailed = FALSE; | |
989 if (vsi_e_handle ( TST_Handle, FRM_RCV_NAME ) == e_running[os_MyHandle()]) // config prim processing only allowed in RCV, not TST! | |
990 { | |
991 fd = ffs_open(TRACEMASKFILE, FFS_O_RDWR | FFS_O_CREATE | FFS_O_TRUNC); | |
992 if (fd < 0) | |
993 { | |
994 // could not open nor create /var/dbg/tracemask warning | |
995 vsi_o_ttrace(NO_TASK, TC_SYSTEM, "pei_config: could not open/create FFS trace mask, reason is 0x%x", fd); | |
996 } | |
997 else | |
998 { | |
999 TraceMask[0] = 0; | |
1000 TraceMask[0] |= TC_SYSTEM|TC_ERROR; | |
1001 amount = sizeof(ULONG) * (MaxEntities + 1); | |
1002 written = ffs_write(fd, (void*)&TraceMask[0], amount); | |
1003 if (written != amount) | |
1004 { | |
1005 if (written >= 0) | |
1006 { | |
1007 amount -= written; | |
1008 vsi_o_ttrace(NO_TASK, TC_SYSTEM, "pei_config: writing to FFS, second try"); | |
1009 written = ffs_write(fd, (void*)&TraceMask[0], amount); | |
1010 if (written != amount) | |
1011 { | |
1012 writeFailed = TRUE; | |
1013 } | |
1014 } | |
1015 else | |
1016 { | |
1017 writeFailed = TRUE; | |
1018 } | |
1019 } | |
1020 if (writeFailed) | |
1021 { | |
1022 vsi_o_ttrace(NO_TASK, TC_SYSTEM, "pei_config: ffs_write to FFS failed with 0x%x, did open with", written, fd); | |
1023 } | |
1024 else | |
1025 { | |
1026 if (ffs_fdatasync(fd) == EFFS_OK) | |
1027 { | |
1028 vsi_o_ttrace(NO_TASK, TC_SYSTEM, "pei_config: successfully written trace mask to FFS"); | |
1029 } | |
1030 else | |
1031 { | |
1032 vsi_o_ttrace(NO_TASK, TC_SYSTEM, "pei_config: flushing FFS trace mask failed!"); | |
1033 } | |
1034 } | |
1035 ffs_close(fd); | |
1036 } | |
1037 } | |
1038 } | |
1039 else if ( !strcmp ( token, "NO_TRACEMASK_IN_FFS") ) | |
1040 { | |
1041 T_FFS_RET ret; | |
1042 | |
1043 InitializeTrace(); | |
1044 TraceMask[0] = 0; | |
1045 TraceMask[0] |= TC_SYSTEM|TC_ERROR; | |
1046 if (vsi_e_handle ( TST_Handle, FRM_RCV_NAME ) == e_running[os_MyHandle()]) // config prim processing only allowed in RCV, not TST! | |
1047 { | |
1048 ret = ffs_remove(TRACEMASKFILE); | |
1049 if (ret != EFFS_OK) | |
1050 { | |
1051 vsi_o_ttrace(NO_TASK, TC_SYSTEM, "pei_config: failed to remove FFS trace mask, reason is 0x%x", ret); | |
1052 } | |
1053 else | |
1054 { | |
1055 vsi_o_ttrace(NO_TASK, TC_SYSTEM, "pei_config: successfully removed FFS trace mask"); | |
1056 } | |
1057 } | |
1058 } | |
1059 #endif | |
1060 return PEI_OK; | |
1061 } | |
1062 #endif | |
1063 | |
1064 #ifndef RUN_INT_RAM | |
1065 GLOBAL SHORT tstsnd_pei_create ( T_PEI_INFO ** info) | |
1066 { | |
1067 static T_PEI_INFO data = | |
1068 { "TST", | |
1069 { | |
1070 pei_init, | |
1071 pei_exit, | |
1072 tst_pei_primitive, | |
1073 #ifdef _TOOLS_ | |
1074 pei_timeout, | |
1075 #else | |
1076 NULL, | |
1077 #endif | |
1078 NULL, | |
1079 NULL, | |
1080 pei_config, | |
1081 NULL | |
1082 }, | |
1083 TST_STACKSIZE, | |
1084 0, | |
1085 TST_SND_PRIORITY, | |
1086 TST_TIMERS, | |
1087 (PASSIVE_BODY|COPY_BY_REF|SYSTEM_PROCESS|TRC_NO_SUSPEND) | |
1088 }; | |
1089 | |
1090 #ifdef _TOOLS_ | |
1091 data.QueueEntries = TST_QUEUE_ENTRIES; | |
1092 #else | |
1093 data.QueueEntries = TST_SndQueueEntries; | |
1094 /* | |
1095 * This way of setting the TST and RCV stacksize is chosen to keep it backwardscompatible, | |
1096 * i.e. not change the behavior if the stacksizes are not define in the configuration | |
1097 * file xxxconst.h. | |
1098 */ | |
1099 if ( TST_SndStacksize > 0 ) | |
1100 { | |
1101 data.StackSize = TST_SndStacksize; | |
1102 } | |
1103 if ( pcon != NULL ) | |
1104 { | |
1105 data.StackSize += pcon->stack_offset; | |
1106 } | |
1107 #endif | |
1108 *info = &data; | |
1109 return PEI_OK; | |
1110 } | |
1111 #endif | |
1112 | |
1113 #ifndef RUN_INT_RAM | |
1114 GLOBAL SHORT tstrcv_pei_create ( T_PEI_INFO ** info) | |
1115 { | |
1116 static T_PEI_INFO data = | |
1117 { "RCV", | |
1118 { | |
1119 NULL, | |
1120 NULL, | |
1121 NULL, | |
1122 NULL, | |
1123 pei_signal, | |
1124 NULL, | |
1125 pei_config, | |
1126 NULL | |
1127 }, | |
1128 TST_STACKSIZE, | |
1129 0, | |
1130 TST_RCV_PRIORITY, | |
1131 TST_TIMERS, | |
1132 (PASSIVE_BODY|COPY_BY_REF|SYSTEM_PROCESS|TRC_NO_SUSPEND) | |
1133 }; | |
1134 | |
1135 #ifdef _TOOLS_ | |
1136 data.QueueEntries = TST_QUEUE_ENTRIES; | |
1137 #else | |
1138 data.QueueEntries = TST_RcvQueueEntries; | |
1139 /* | |
1140 * This way of setting the TST and RCV stacksize is chosen to keep it backwardscompatible, | |
1141 * i.e. not change the behavior if the stacksizes are not define in the configuration | |
1142 * file xxxconst.h. | |
1143 */ | |
1144 if ( TST_RcvStacksize > 0 ) | |
1145 { | |
1146 data.StackSize = TST_RcvStacksize; | |
1147 } | |
1148 if ( pcon != NULL ) | |
1149 { | |
1150 data.StackSize += pcon->stack_offset; | |
1151 } | |
1152 #endif | |
1153 *info = &data; | |
1154 return PEI_OK; | |
1155 } | |
1156 #endif | |
1157 |