POK
error.h
1 /*
2  * POK header
3  *
4  * The following file is a part of the POK project. Any modification should
5  * made according to the POK licence. You CANNOT use this file or a part of
6  * this file is this part of a file for your own project
7  *
8  * For more information on the POK licence, please see our LICENCE FILE
9  *
10  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
11  *
12  * Copyright (c) 2007-2009 POK team
13  *
14  * Created by julien on Thu Jan 15 23:34:13 2009
15  */
16 
17 
18 #ifdef POK_NEEDS_ARINC653_ERROR
19 #ifndef APEX_ERROR
20 #define APEX_ERROR
21 
22 #ifndef POK_NEEDS_ARINC653_PROCESS
23 #define POK_NEEDS_ARINC653_PROCESS 1
24 #endif
25 
26 #include <arinc653/process.h>
27 
28 #include <arinc653/types.h>
29 
30 #define MAX_ERROR_MESSAGE_SIZE 64
31 
32 typedef APEX_INTEGER ERROR_MESSAGE_SIZE_TYPE;
33 
34 typedef APEX_BYTE ERROR_MESSAGE_TYPE[MAX_ERROR_MESSAGE_SIZE];
35 
36 enum ERROR_CODE_VALUE_TYPE {
37  DEADLINE_MISSED = 0,
38  APPLICATION_ERROR = 1,
39  NUMERIC_ERROR = 2,
40  ILLEGAL_REQUEST = 3,
41  STACK_OVERFLOW = 4,
42  MEMORY_VIOLATION = 5,
43  HARDWARE_FAULT = 6,
44  POWER_FAIL = 7
45 };
46 
47 typedef enum ERROR_CODE_VALUE_TYPE ERROR_CODE_TYPE;
48 /*------------------------------*/
49 /* error status type */
50 /*------------------------------*/
51 typedef struct{
52  ERROR_CODE_TYPE ERROR_CODE;
53  MESSAGE_SIZE_TYPE LENGTH;
54  PROCESS_ID_TYPE FAILED_PROCESS_ID;
55  SYSTEM_ADDRESS_TYPE FAILED_ADDRESS;
56  ERROR_MESSAGE_TYPE MESSAGE;
58 
59 /*----------------------------------------------------------------------*/
60 /* */
61 /* ERROR MANAGEMENT SERVICES */
62 /* */
63 /*----------------------------------------------------------------------*/
64 /*----------------------------------------------------------------------*/
65 
66 extern void REPORT_APPLICATION_MESSAGE (MESSAGE_ADDR_TYPE MESSAGE,
67  MESSAGE_SIZE_TYPE LENGTH,
68  RETURN_CODE_TYPE *RETURN_CODE);
69 
70 extern void CREATE_ERROR_HANDLER (SYSTEM_ADDRESS_TYPE ENTRY_POINT,
71  STACK_SIZE_TYPE STACK_SIZE,
72  RETURN_CODE_TYPE *RETURN_CODE);
73 
74 extern void GET_ERROR_STATUS (ERROR_STATUS_TYPE *ERROR_STATUS,
75  RETURN_CODE_TYPE *RETURN_CODE );
76 
77 extern void RAISE_APPLICATION_ERROR (ERROR_CODE_TYPE ERROR_CODE,
78  MESSAGE_ADDR_TYPE MESSAGE,
79  ERROR_MESSAGE_SIZE_TYPE LENGTH,
80  RETURN_CODE_TYPE *RETURN_CODE);
81 #endif
82 #endif