xa_error_handler.h
4.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
* Copyright (c) 2006-2017 by Cadence Design Systems, Inc. ALL RIGHTS RESERVED.
* These coded instructions, statements, and computer programs are the
* copyrighted works and confidential proprietary information of
* Cadence Design Systems Inc. They may be adapted and modified by bona fide
* purchasers for internal use, but neither the original nor any adapted
* or modified version may be disclosed or distributed to third parties
* in any manner, medium, or form, in whole or in part, without the prior
* written consent of Cadence Design Systems Inc. This software and its
* derivatives are to be executed solely on products incorporating a Cadence
* Design Systems processor.
*/
#ifndef __XA_ERROR_HANDLER_H__
#define __XA_ERROR_HANDLER_H__
#define XA_ERROR_HHANDLER_DEBUG
/*****************************************************************************/
/* File includes */
/* xa_type_def.h */
/* xa_error_standards.h */
/*****************************************************************************/
/* these definitions are used by error handling function */
/* the error handler will work on a structure which identifies a */
/* particular error with a module, context and error_code */
/*****************************************************************************/
/* Constant hash defines */
/*****************************************************************************/
#define XA_ERROR_NON_FATAL_IDX 0x0
#define XA_ERROR_FATAL_IDX 0x1
#define XA_ERROR_CLASS_0 0x0
#define XA_ERROR_CLASS_1 0x1
#define XA_ERROR_CLASS_2 0x2
#define XA_ERROR_CLASS_3 0x3
#define XA_ERROR_CLASS_4 0x4
#define XA_ERROR_CLASS_5 0x5
#define XA_ERROR_CLASS_6 0x6
#define XA_ERROR_CLASS_7 0x7
#define XA_ERROR_CLASS_8 0x8
#define XA_ERROR_CLASS_9 0x9
#define XA_ERROR_CLASS_A 0xA
#define XA_ERROR_CLASS_B 0xB
#define XA_ERROR_CLASS_C 0xC
#define XA_ERROR_CLASS_D 0xD
#define XA_ERROR_CLASS_E 0xE
#define XA_ERROR_CLASS_F 0xF
/* each module, hence, needs to copy the following structure */
/* the first index is for FATAL/NONFATAL */
/* the second index is for the classes */
/* then in a module specific initialization, fill in the following */
/* structure with the pointers to the particular error message arrays */
/*****************************************************************************/
/* Type definitions */
/*****************************************************************************/
typedef struct {
const char *pb_module_name;
const char *ppb_class_names[16];
const char **ppppb_error_msg_pointers[2][16];
} xa_error_info_struct;
/*****************************************************************************/
/* Function prototypes */
/*****************************************************************************/
/* this error handler maps the code generated by a module to a error string */
/* pb_context is a string to specify where the module broke */
/* Note that this function declaration logically belongs to the calling */
/* program; it is not used in the codec library. */
XA_ERRORCODE xa_error_handler(xa_error_info_struct *p_mod_err_info,
const char *pb_context,
XA_ERRORCODE code);
/*****************************************************************************/
/* Macro functions */
/*****************************************************************************/
/* the following macro does a one-line job of returning back to the parent */
/* in case a fatal error occurs after calling the error handler function */
/* Note that this macro logically belongs to the calling program; it */
/* is not used in the codec library. */
#define _XA_HANDLE_ERROR(p_mod_err_info, context, e) \
if((e) != XA_NO_ERROR) \
{ \
xa_error_handler((p_mod_err_info), (context), (e)); \
if((e) & XA_FATAL_ERROR) \
return (e); \
}
#ifdef XA_ERROR_HHANDLER_DEBUG
extern xa_error_info_struct xa_testbench_error_info;
#else
extern const xa_error_info_struct xa_testbench_error_info;
#endif
#endif /* __XA_ERROR_HANDLER_H__ */