FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/ccd/ccd_err.c @ 648:970d6199f2c5
gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Thu, 04 Sep 2014 05:48:57 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
647:a60b375014e3 | 648:970d6199f2c5 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : | |
4 | Modul : ccd_err.c | |
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 : CCD - Definition of error handling routines | |
18 +----------------------------------------------------------------------------- | |
19 */ | |
20 | |
21 #define CCD_ERR_C | |
22 | |
23 #include <stdio.h> | |
24 #include <stdlib.h> | |
25 #include <stdarg.h> | |
26 #include <string.h> | |
27 #include <setjmp.h> | |
28 | |
29 /* | |
30 * Standard definitions like UCHAR, ERROR etc. | |
31 */ | |
32 #include "typedefs.h" | |
33 #include "header.h" | |
34 | |
35 /* | |
36 * Types and constants used by CCD | |
37 */ | |
38 #include "ccd_globs.h" | |
39 | |
40 /* | |
41 * Type definitions for CCD data tables | |
42 */ | |
43 #include "ccdtable.h" | |
44 | |
45 /* | |
46 * Function prototypes of CCD-CCDDATA interface | |
47 */ | |
48 #include "ccddata.h" | |
49 | |
50 /* | |
51 * Prototypes of ccd internal functions | |
52 */ | |
53 #include "ccd.h" | |
54 | |
55 /* | |
56 * Definition of CCD Error table | |
57 */ | |
58 #include "ccd_err.h" | |
59 | |
60 extern T_CCD_TASK_TABLE* ccd_task_list[]; | |
61 | |
62 #ifdef CCD_TEST | |
63 #define CCD_ERR_TRC_P1(A,B,C) {printf("\n"); printf(B, C);} | |
64 #define CCD_ERR_TRC_P2(A,B,C,D) {printf("\n"); printf(B, C, D);} | |
65 #else | |
66 #define CCD_ERR_TRC_P1(A,B,C) vsi_o_ttrace(A, TC_ERROR, B, C); | |
67 #define CCD_ERR_TRC_P2(A,B,C,D) vsi_o_ttrace(A, TC_ERROR, B, C, D); | |
68 #endif | |
69 | |
70 /* | |
71 * backwards compatibility with the new style for error information container | |
72 */ | |
73 #define errPar para.para_list.err_list | |
74 #define numErrPar para.para_list.num_para | |
75 | |
76 #ifndef RUN_INT_RAM | |
77 /* | |
78 +------------------------------------------------------------------------------ | |
79 | Function : ccd_err_reset | |
80 +------------------------------------------------------------------------------ | |
81 | Description : This function resets the task related error entry in | |
82 | ccd_task_list with each coding/decoding action. | |
83 | | |
84 | Parameters : eentry - the task related error entry in ccd_task_list | |
85 | | |
86 | Return : - | |
87 +------------------------------------------------------------------------------ | |
88 */ | |
89 void ccd_err_reset (T_CCD_ERR_LIST_HEAD* eentry) | |
90 { | |
91 eentry->act_error = &(eentry->first_error); | |
92 eentry->num_errors = 0; | |
93 } | |
94 #endif /* !RUN_INT_RAM */ | |
95 | |
96 #ifndef RUN_INT_RAM | |
97 /* | |
98 +------------------------------------------------------------------------------ | |
99 | Function : ccd_err_alloc | |
100 +------------------------------------------------------------------------------ | |
101 | Description : This function allocates a new T_CCD_ERR_LIST and | |
102 | set its next pointer to 0. | |
103 | | |
104 | Parameters : - | |
105 | | |
106 | Return : - | |
107 +------------------------------------------------------------------------------ | |
108 */ | |
109 static T_CCD_ERR_LIST* ccd_err_alloc () | |
110 { | |
111 T_CCD_ERR_LIST* entry; | |
112 #if defined (CCD_TEST) | |
113 entry = malloc (sizeof(T_CCD_ERR_LIST)); | |
114 #else | |
115 entry = D_ALLOC (sizeof(T_CCD_ERR_LIST)); | |
116 #endif | |
117 if (entry) | |
118 { | |
119 entry->next = 0; | |
120 return entry; | |
121 } | |
122 return 0; | |
123 } | |
124 #endif /* !RUN_INT_RAM */ | |
125 | |
126 #ifndef RUN_INT_RAM | |
127 /* | |
128 +------------------------------------------------------------------------------ | |
129 | Function : ccd_err_free | |
130 +------------------------------------------------------------------------------ | |
131 | Description : This function frees the task related error list. | |
132 | The freeing starts with the act_error entry, i.e. | |
133 | either it is called at the end of a code/decode action | |
134 | and concerns only those list entries that were allocated | |
135 | by a former actions and are now not used anymore, or it | |
136 | can be called by ccd_free_errors and than the whole list | |
137 | is freed. | |
138 | | |
139 | Parameters : eentry - the task related error entry in ccd_task_list | |
140 | | |
141 | Return : - | |
142 +------------------------------------------------------------------------------ | |
143 */ | |
144 void ccd_err_free (T_CCD_ERR_LIST_HEAD* entry) | |
145 { | |
146 T_CCD_ERR_LIST* it = *entry->act_error; | |
147 T_CCD_ERR_LIST* next; | |
148 | |
149 while (it) | |
150 { | |
151 next = it->next; | |
152 #if defined (CCD_TEST) | |
153 free (it); | |
154 #else | |
155 D_FREE (it); | |
156 #endif | |
157 it = next; | |
158 } | |
159 *entry->act_error = 0; | |
160 } | |
161 #endif /* !RUN_INT_RAM */ | |
162 | |
163 #ifndef RUN_INT_RAM | |
164 /* | |
165 +------------------------------------------------------------------------------ | |
166 | Function : ccd_err_init | |
167 +------------------------------------------------------------------------------ | |
168 | Description : This function initializes the entity's error entry | |
169 | The members of the entry not set here, | |
170 | are reset with each coding/decoding action. | |
171 | | |
172 | Parameters : eentry - pointing to the entity's error entry | |
173 | | |
174 | Return : 1 in case of error, 0 otherwise | |
175 +------------------------------------------------------------------------------ | |
176 */ | |
177 int ccd_err_init (T_CCD_ERR_LIST_HEAD** eentry) | |
178 { | |
179 if (!*eentry) | |
180 { | |
181 #if defined (CCD_TEST) | |
182 *eentry = malloc (sizeof(T_CCD_ERR_LIST_HEAD)); | |
183 #else | |
184 *eentry = D_ALLOC (sizeof(T_CCD_ERR_LIST_HEAD)); | |
185 #endif | |
186 } | |
187 else | |
188 { | |
189 ccd_err_reset(*eentry); | |
190 ccd_err_free(*eentry); | |
191 } | |
192 | |
193 if (*eentry) | |
194 { | |
195 (*eentry)->first_error = 0; | |
196 return 0; | |
197 } | |
198 return 1; | |
199 } | |
200 #endif /* !RUN_INT_RAM */ | |
201 | |
202 #ifndef RUN_INT_RAM | |
203 /* | |
204 +------------------------------------------------------------------------------ | |
205 | Function : ccd_err_exit | |
206 +------------------------------------------------------------------------------ | |
207 | Description : This function frees the task related error entry in | |
208 | ccd_task_list. | |
209 | | |
210 | Parameters : - | |
211 | | |
212 | Return : - | |
213 +------------------------------------------------------------------------------ | |
214 */ | |
215 void ccd_err_exit (void) | |
216 { | |
217 T_CCD_ERR_LIST_HEAD** entry; | |
218 #if defined (CCD_TEST) | |
219 entry = &ccd_task_list[0]->ccd_err_list; | |
220 if (*entry) | |
221 { | |
222 ccd_err_reset(*entry); | |
223 ccd_err_free(*entry); | |
224 free (*entry); | |
225 } | |
226 #else | |
227 T_HANDLE me = vsi_e_handle (0, NULL); | |
228 if (me == VSI_ERROR) | |
229 me = 0; | |
230 entry = &ccd_task_list[me]->ccd_err_list; | |
231 if (*entry) | |
232 { | |
233 ccd_err_reset(*entry); | |
234 ccd_err_free(*entry); | |
235 D_FREE (*entry); | |
236 } | |
237 #endif | |
238 *entry = 0; | |
239 } | |
240 #endif /* !RUN_INT_RAM */ | |
241 | |
242 #ifndef RUN_INT_RAM | |
243 /* | |
244 +------------------------------------------------------------------------------ | |
245 | Function : ccd_trace_err_stk | |
246 +------------------------------------------------------------------------------ | |
247 | Description : This function traces the error stack. | |
248 | | |
249 | Parameters : globs - the current variable set | |
250 | | |
251 | Return : - | |
252 +------------------------------------------------------------------------------ | |
253 */ | |
254 #ifdef ERR_TRC_STK_CCD | |
255 static void ccd_trace_err_stk (T_CCD_Globs *globs) | |
256 { | |
257 int i=1; | |
258 | |
259 if (globs->ccd_recurs_level NEQ 255) | |
260 { | |
261 #ifdef CCD_SYMBOLS | |
262 CCD_ERR_TRC_P1(globs->me, "CCD Error: in message %s", | |
263 mcomp[globs->error_stack[0]].name) | |
264 if (globs->ccd_recurs_level > 5) | |
265 { | |
266 CCD_ERR_TRC_P1(globs->me, "CCD Error: %s", "... ->"); | |
267 i = (int) (globs->ccd_recurs_level - 5); | |
268 } | |
269 while (i <= globs->ccd_recurs_level) | |
270 { | |
271 CCD_ERR_TRC_P1(globs->me, "CCD Error: -> %s", | |
272 ccddata_get_alias (globs->error_stack[i], 1)) | |
273 i++; | |
274 } | |
275 #else /* CCD_SYMBOLS */ | |
276 | |
277 CCD_ERR_TRC_P1(globs->me, "CCD Error: in message with mcompRef=%d!", | |
278 globs->error_stack[0]) | |
279 for (i=1; i <= globs->ccd_recurs_level; i++) | |
280 CCD_ERR_TRC_P1(globs->me, "CCD Error: -> %d", globs->error_stack[i]) | |
281 #endif /* CCD_SYMBOLS */ | |
282 } | |
283 } | |
284 #endif /* ERR_TRC_STK_CCD */ | |
285 #endif /* !RUN_INT_RAM */ | |
286 | |
287 #ifndef RUN_INT_RAM | |
288 /* | |
289 +--------------------------------------------------------------------+ | |
290 | PROJECT : CCD (6144) MODULE : CCD | | |
291 | STATE : code ROUTINE : ccd_setError | | |
292 +--------------------------------------------------------------------+ | |
293 | |
294 PURPOSE : Error processing of the CCD. | |
295 | |
296 */ | |
297 | |
298 void ccd_setError (T_CCD_Globs *globs, | |
299 UBYTE ErrCode, | |
300 UBYTE Action, | |
301 USHORT first_par, | |
302 ...) | |
303 { | |
304 USHORT par; | |
305 UBYTE parnum; | |
306 va_list varpars; | |
307 T_CCD_ERR_LIST_HEAD* entry = ccd_task_list[globs->me]->ccd_err_list; | |
308 T_CCD_ERR_LIST** it = entry->act_error; | |
309 char *err_msg = NULL; | |
310 | |
311 if (globs->errLabel) | |
312 { | |
313 Action = BREAK; | |
314 ErrCode = globs->errLabel; | |
315 } | |
316 | |
317 #if defined (ERR_TRACE_CCD) || defined (DEBUG_CCD) | |
318 | |
319 #if defined (DEBUG_CCD) | |
320 if (Action EQ BREAK) | |
321 CCD_ERR_TRC_P2(globs->me, "CCD Error: %s (errCode %d); stopped processing", | |
322 ccdErrCodeTable[ErrCode], ErrCode) | |
323 else | |
324 CCD_ERR_TRC_P2(globs->me, "CCD Error: %s (errCode %d); yet continued processing", | |
325 ccdErrCodeTable[ErrCode], ErrCode) | |
326 #else | |
327 if (Action EQ BREAK) | |
328 CCD_ERR_TRC_P1(globs->me, "CCD Error: errCode %d; stopped processing", | |
329 ErrCode) | |
330 else | |
331 CCD_ERR_TRC_P1(globs->me, "CCD Error: errCode %d; yet continued processing", | |
332 ErrCode) | |
333 #endif /* DEBUG_CCD */ | |
334 | |
335 #endif /* (ERR_TRACE_CCD) || defined (DEBUG_CCD) */ | |
336 | |
337 if (!*it) | |
338 { | |
339 *it = ccd_err_alloc (); | |
340 } | |
341 | |
342 if (*it) | |
343 { | |
344 /* | |
345 * Memory allocation from dynamic partitions should not fail. | |
346 * Nevertheless, if it fails, this is not particularly handled here | |
347 */ | |
348 (*it)->entry.error = ErrCode; | |
349 (*it)->entry.kind = CCD_ERR_KIND_PARA_LIST; | |
350 | |
351 va_start (varpars, first_par); /* Initialize variable arguments. */ | |
352 par = first_par; | |
353 parnum = 0; | |
354 while ((par != 0xffff) AND (parnum < MAX_ERR_PAR)) | |
355 { | |
356 (*it)->entry.errPar[parnum++] = par; | |
357 #if defined (ERR_TRACE_CCD) || defined (DEBUG_CCD) | |
358 CCD_ERR_TRC_P1(globs->me, "CCD Error: saved parameter %d to errList", par) | |
359 #endif | |
360 par = (USHORT) va_arg (varpars, int); | |
361 } | |
362 (*it)->entry.numErrPar = parnum; | |
363 va_end (varpars); /* Reset variable arguments. */ | |
364 | |
365 entry->act_error = &(*it)->next; | |
366 } | |
367 | |
368 entry->num_errors++; | |
369 | |
370 #ifdef ERR_TRC_STK_CCD | |
371 ccd_trace_err_stk (globs); | |
372 #endif /* ERR_TRC_STK_CCD */ | |
373 | |
374 /* | |
375 * if the action say break, perform a longjump to terminate ccd. | |
376 */ | |
377 if (Action EQ BREAK) | |
378 { | |
379 globs->CCD_Error = ccdError; | |
380 if (globs->jmp_mark_set) | |
381 longjmp (globs->jmp_mark, -1); | |
382 } | |
383 else | |
384 globs->CCD_Error = ccdWarning; | |
385 } | |
386 #endif /* !RUN_INT_RAM */ | |
387 | |
388 #ifndef RUN_INT_RAM | |
389 /* | |
390 +------------------------------------------------------------------------------ | |
391 | Function : ccd_get_error | |
392 +------------------------------------------------------------------------------ | |
393 | Description : This function copies the next error information of the | |
394 | classical parameter list kind to the user. | |
395 | | |
396 | Parameters : item - the task's current error entry | |
397 | entry - the returned pointer | |
398 | | |
399 | Return : the error code if there was still an error, ccdOK otherwise | |
400 +------------------------------------------------------------------------------ | |
401 */ | |
402 static ULONG ccd_get_error (T_CCD_ERR_LIST_HEAD* head, USHORT *parlist) | |
403 { | |
404 T_CCD_ERR_LIST** item; | |
405 int i; | |
406 if (head) | |
407 { | |
408 item = head->act_error; | |
409 if (*item) | |
410 { | |
411 if ((*item)->entry.kind == CCD_ERR_KIND_PARA_LIST) | |
412 { | |
413 for (i=0; i < (*item)->entry.numErrPar; i++) | |
414 *parlist++ = (*item)->entry.errPar[i]; | |
415 } | |
416 head->act_error = &(*item)->next; | |
417 return (ULONG) (*item)->entry.error; | |
418 } | |
419 return ccdOK; | |
420 } | |
421 return ccdOK; | |
422 } | |
423 #endif /* !RUN_INT_RAM */ | |
424 | |
425 #ifndef RUN_INT_RAM | |
426 /* | |
427 +--------------------------------------------------------------------+ | |
428 | PROJECT : CCD (6144) MODULE : CCD | | |
429 | STATE : code ROUTINE : ccd_getNextError | | |
430 +--------------------------------------------------------------------+ | |
431 | |
432 PURPOSE : if an error is stored in the errorlist, this function | |
433 stores the additional stored error parameter | |
434 into the given parlist and returns the errorcode. | |
435 If no error occured this function returns 0. | |
436 | |
437 */ | |
438 | |
439 UBYTE CCDDATA_PREF(ccd_getNextError) (UBYTE entity, USHORT *parlist) | |
440 /* | |
441 * The parameter entity is not used anymore, but the function interface | |
442 * should remain the same. | |
443 */ | |
444 { | |
445 T_CCD_ERR_LIST_HEAD* head; | |
446 #if defined (CCD_TEST) | |
447 head = ccd_task_list[0]->ccd_err_list; | |
448 #else | |
449 T_HANDLE me = vsi_e_handle (0, NULL); | |
450 if (me == VSI_ERROR) | |
451 me = 0; | |
452 head = ccd_task_list[me]->ccd_err_list; | |
453 #endif | |
454 | |
455 return (UBYTE) ccd_get_error (head, parlist); | |
456 } | |
457 #endif /* !RUN_INT_RAM */ | |
458 | |
459 #ifndef RUN_INT_RAM | |
460 /* | |
461 +--------------------------------------------------------------------+ | |
462 | PROJECT : CCD (6144) MODULE : CCD | | |
463 | STATE : code ROUTINE : ccd_getFirstError | | |
464 +--------------------------------------------------------------------+ | |
465 | |
466 PURPOSE : if an error is stored in the errorlist, this function | |
467 stores the additional stored error parameter | |
468 into the given parlist and returns the errorcode. | |
469 If no error occured this function returns 0. | |
470 | |
471 */ | |
472 | |
473 UBYTE CCDDATA_PREF(ccd_getFirstError) (UBYTE entity, USHORT *parlist) | |
474 { | |
475 /* | |
476 * The parameter entity is not used anymore, but the function interface | |
477 * should remain the same. | |
478 */ | |
479 T_CCD_ERR_LIST_HEAD* head; | |
480 #if defined (CCD_TEST) | |
481 head = ccd_task_list[0]->ccd_err_list; | |
482 #else | |
483 T_HANDLE me = vsi_e_handle (0, NULL); | |
484 if (me == VSI_ERROR) | |
485 me = 0; | |
486 head = ccd_task_list[me]->ccd_err_list; | |
487 #endif | |
488 | |
489 head->act_error = &(head->first_error); | |
490 | |
491 return (UBYTE) ccd_get_error (head, parlist); | |
492 | |
493 } | |
494 #endif /* !RUN_INT_RAM */ | |
495 | |
496 #ifndef RUN_INT_RAM | |
497 /* | |
498 +------------------------------------------------------------------------------ | |
499 | Function : ccd_get_numFaults | |
500 +------------------------------------------------------------------------------ | |
501 | Description : This function delivers the task related number of | |
502 | errors/faults of the last coding/decoding action. | |
503 | | |
504 | Parameters : - | |
505 | | |
506 | Return : the number of occurred errors | |
507 +------------------------------------------------------------------------------ | |
508 */ | |
509 | |
510 int CCDDATA_PREF(ccd_get_numFaults) () | |
511 { | |
512 T_CCD_ERR_LIST_HEAD* head; | |
513 #if defined (CCD_TEST) | |
514 head = ccd_task_list[0]->ccd_err_list; | |
515 #else | |
516 T_HANDLE me = vsi_e_handle (0, NULL); | |
517 if (me == VSI_ERROR) | |
518 me = 0; | |
519 head = ccd_task_list[me]->ccd_err_list; | |
520 #endif | |
521 | |
522 if (head) | |
523 return head->num_errors; | |
524 else | |
525 return 0; | |
526 } | |
527 #endif /* !RUN_INT_RAM */ | |
528 | |
529 #ifndef RUN_INT_RAM | |
530 /* | |
531 +------------------------------------------------------------------------------ | |
532 | Function : ccd_free_faultlist | |
533 +------------------------------------------------------------------------------ | |
534 | Description : This function frees any allocated error/fault inforamtion | |
535 | of the current task. | |
536 | | |
537 | Parameters : - | |
538 | | |
539 | Return : - | |
540 +------------------------------------------------------------------------------ | |
541 */ | |
542 | |
543 void CCDDATA_PREF(ccd_free_faultlist) () | |
544 { | |
545 #if defined (CCD_TEST) | |
546 int me = 0; | |
547 #else | |
548 T_HANDLE me; | |
549 me = vsi_e_handle (0, NULL); | |
550 if (me == VSI_ERROR) | |
551 me = 0; | |
552 #endif | |
553 ccd_err_reset (ccd_task_list[me]->ccd_err_list); | |
554 ccd_err_free (ccd_task_list[me]->ccd_err_list); | |
555 } | |
556 #endif /* !RUN_INT_RAM */ | |
557 | |
558 #ifndef RUN_INT_RAM | |
559 /* | |
560 +--------------------------------------------------------------------+ | |
561 | PROJECT : CCD (6144) MODULE : CCD | | |
562 | STATE : code ROUTINE : ccd_recordFault | | |
563 +--------------------------------------------------------------------+ | |
564 | |
565 PURPOSE : Record of information on an detected error to support | |
566 entity fault diagnosis activities. | |
567 | |
568 */ | |
569 | |
570 void ccd_recordFault (T_CCD_Globs *globs, | |
571 UBYTE ErrCode, | |
572 UBYTE Action, | |
573 T_ERR_INFO err_info, | |
574 U8 *err_IEaddr) | |
575 { | |
576 char *err_msg = NULL; | |
577 T_CCD_ERR_LIST_HEAD* entry = ccd_task_list[globs->me]->ccd_err_list; | |
578 T_CCD_ERR_LIST** it = entry->act_error; | |
579 | |
580 if (globs->errLabel) | |
581 { | |
582 Action = BREAK; | |
583 ErrCode = globs->errLabel; | |
584 } | |
585 | |
586 if (!*it) | |
587 { | |
588 *it = ccd_err_alloc (); | |
589 } | |
590 | |
591 if (*it) | |
592 { | |
593 /* | |
594 * Memory allocation from dynamic partitions should not fail. | |
595 * Nevertheless, if it fails, this is not particularly handled here | |
596 */ | |
597 (*it)->entry.error = ErrCode; | |
598 (*it)->entry.kind = CCD_ERR_KIND_IE_TYPE; | |
599 (*it)->entry.para.err_type.err_info = err_info; | |
600 (*it)->entry.para.err_type.err_IEaddr = (U32)err_IEaddr; | |
601 entry->act_error = &(*it)->next; | |
602 } | |
603 | |
604 entry->num_errors++; | |
605 | |
606 #if defined (ERR_TRACE_CCD) || defined (DEBUG_CCD) | |
607 | |
608 #if defined (DEBUG_CCD) | |
609 if (Action EQ BREAK) | |
610 CCD_ERR_TRC_P2(globs->me, "CCD Error: %s (errCode %d); stopped processing", | |
611 ccdErrCodeTable[ErrCode], ErrCode) | |
612 else | |
613 CCD_ERR_TRC_P2(globs->me, "CCD Error: %s (errCode %d); yet continued processing", | |
614 ccdErrCodeTable[ErrCode], ErrCode) | |
615 #else | |
616 if (Action EQ BREAK) | |
617 CCD_ERR_TRC_P1(globs->me, "CCD Error: errCode %d; stopped processing", | |
618 ErrCode) | |
619 else | |
620 CCD_ERR_TRC_P1(globs->me, "CCD Error: errCode %d; yet continued processing", | |
621 ErrCode) | |
622 #endif /* DEBUG_CCD */ | |
623 | |
624 #endif /* (ERR_TRACE_CCD) || defined (DEBUG_CCD) */ | |
625 | |
626 #ifdef ERR_TRC_STK_CCD | |
627 ccd_trace_err_stk (globs); | |
628 #endif /* ERR_TRC_STK_CCD */ | |
629 | |
630 /* | |
631 * if the action say break, perform a longjump to terminate ccd. | |
632 */ | |
633 if (Action EQ BREAK) | |
634 { | |
635 globs->CCD_Error = ccdError; | |
636 if (globs->jmp_mark_set) | |
637 longjmp (globs->jmp_mark, -1); | |
638 } | |
639 else | |
640 globs->CCD_Error = ccdWarning; | |
641 } | |
642 #endif /* !RUN_INT_RAM */ | |
643 | |
644 #ifndef RUN_INT_RAM | |
645 /* | |
646 +------------------------------------------------------------------------------ | |
647 | Function : ccd_get_fault | |
648 +------------------------------------------------------------------------------ | |
649 | Description : This function copies the next error information to | |
650 | the user (no matter which kind). | |
651 | | |
652 | Parameters : item - the task's current error entry | |
653 | entry - the returned pointer | |
654 | | |
655 | Return : the error code if there was still an error, ccdOK otherwise | |
656 +------------------------------------------------------------------------------ | |
657 */ | |
658 static ULONG ccd_get_fault (T_CCD_ERR_LIST_HEAD* head, T_CCD_ERR_ENTRY **entry) | |
659 { | |
660 T_CCD_ERR_LIST** item; | |
661 if (head) | |
662 { | |
663 item = head->act_error; | |
664 if (*item) | |
665 { | |
666 *entry = &(*item)->entry; | |
667 head->act_error = &(*item)->next; | |
668 return (ULONG) (*entry)->error; | |
669 } | |
670 return ccdOK; | |
671 } | |
672 return ccdOK; | |
673 } | |
674 #endif /* !RUN_INT_RAM */ | |
675 | |
676 #ifndef RUN_INT_RAM | |
677 /* | |
678 +--------------------------------------------------------------------+ | |
679 | PROJECT : CCD (6144) MODULE : CCD | | |
680 | STATE : code ROUTINE : ccd_getNextFault | | |
681 +--------------------------------------------------------------------+ | |
682 | |
683 PURPOSE : If an error is stored in the errorlist, this function | |
684 copies information on the error into the function parameter. | |
685 This information is made of error number, error-union type, | |
686 ccd_id for the faulty element and the address of this | |
687 element in the C-structure of the decoded message. | |
688 If no error occured this function returns 0. | |
689 | |
690 */ | |
691 | |
692 ULONG CCDDATA_PREF(ccd_getNextFault) (T_CCD_ERR_ENTRY **ccd_err_entry) | |
693 { | |
694 T_CCD_ERR_LIST_HEAD* head; | |
695 #if defined (CCD_TEST) | |
696 head = ccd_task_list[0]->ccd_err_list; | |
697 #else | |
698 T_HANDLE me = vsi_e_handle (0, NULL); | |
699 if (me == VSI_ERROR) | |
700 me = 0; | |
701 head = ccd_task_list[me]->ccd_err_list; | |
702 #endif | |
703 | |
704 return ccd_get_fault (head, ccd_err_entry); | |
705 } | |
706 #endif /* !RUN_INT_RAM */ | |
707 | |
708 #ifndef RUN_INT_RAM | |
709 /* | |
710 +--------------------------------------------------------------------+ | |
711 | PROJECT : CCD (6144) MODULE : CCD | | |
712 | STATE : code ROUTINE : ccd_getFirstFault | | |
713 +--------------------------------------------------------------------+ | |
714 | |
715 PURPOSE : If an error is stored in the errorlist, this function | |
716 copies information on the error into the function parameter. | |
717 This information is made of error number, error-union type, | |
718 ccd_id for the faulty element and the address of this | |
719 element in the C-structure of the decoded message. | |
720 If no error occured this function returns 0. | |
721 */ | |
722 | |
723 ULONG CCDDATA_PREF(ccd_getFirstFault) (T_CCD_ERR_ENTRY **ccd_err_entry) | |
724 { | |
725 T_CCD_ERR_LIST_HEAD* head; | |
726 #if defined (CCD_TEST) | |
727 head = ccd_task_list[0]->ccd_err_list; | |
728 #else | |
729 T_HANDLE me = vsi_e_handle (0, NULL); | |
730 if (me == VSI_ERROR) | |
731 me = 0; | |
732 head = ccd_task_list[me]->ccd_err_list; | |
733 #endif | |
734 | |
735 head->act_error = &(head->first_error); | |
736 | |
737 return ccd_get_fault (head, ccd_err_entry); | |
738 } | |
739 #endif /* !RUN_INT_RAM */ |