POK
/home/jaouen/pok_official/pok/trunk/libpok/include/arinc653/error.h
00001 /*
00002  *                               POK header
00003  * 
00004  * The following file is a part of the POK project. Any modification should
00005  * made according to the POK licence. You CANNOT use this file or a part of
00006  * this file is this part of a file for your own project
00007  *
00008  * For more information on the POK licence, please see our LICENCE FILE
00009  *
00010  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
00011  *
00012  *                                      Copyright (c) 2007-2009 POK team 
00013  *
00014  * Created by julien on Thu Jan 15 23:34:13 2009 
00015  */
00016 
00017 
00018 #ifdef POK_NEEDS_ARINC653_ERROR
00019 #ifndef APEX_ERROR
00020 #define APEX_ERROR
00021 
00022 #ifndef POK_NEEDS_ARINC653_PROCESS
00023 #define POK_NEEDS_ARINC653_PROCESS 1
00024 #endif
00025 
00026 #include <arinc653/process.h>
00027 
00028 #include <arinc653/types.h>
00029 
00030 #define  MAX_ERROR_MESSAGE_SIZE         64 
00031  
00032 typedef  APEX_INTEGER   ERROR_MESSAGE_SIZE_TYPE; 
00033  
00034 typedef  APEX_BYTE      ERROR_MESSAGE_TYPE[MAX_ERROR_MESSAGE_SIZE]; 
00035  
00036 enum ERROR_CODE_VALUE_TYPE {
00037    DEADLINE_MISSED      = 0,
00038    APPLICATION_ERROR    = 1,
00039    NUMERIC_ERROR        = 2,
00040    ILLEGAL_REQUEST      = 3,
00041    STACK_OVERFLOW       = 4,
00042    MEMORY_VIOLATION     = 5,
00043    HARDWARE_FAULT       = 6,
00044    POWER_FAIL           = 7
00045 };
00046 
00047 typedef enum ERROR_CODE_VALUE_TYPE ERROR_CODE_TYPE;
00048 /*------------------------------*/
00049 /* error status type */
00050 /*------------------------------*/
00051 typedef struct{
00052    ERROR_CODE_TYPE         ERROR_CODE;
00053    MESSAGE_SIZE_TYPE       LENGTH;
00054    PROCESS_ID_TYPE         FAILED_PROCESS_ID;
00055    SYSTEM_ADDRESS_TYPE     FAILED_ADDRESS;
00056    ERROR_MESSAGE_TYPE      MESSAGE;
00057 } ERROR_STATUS_TYPE;
00058 
00059 /*----------------------------------------------------------------------*/
00060 /* */
00061 /* ERROR MANAGEMENT SERVICES */
00062 /* */
00063 /*----------------------------------------------------------------------*/
00064 /*----------------------------------------------------------------------*/
00065 
00066 extern void REPORT_APPLICATION_MESSAGE (MESSAGE_ADDR_TYPE    MESSAGE,
00067                                         MESSAGE_SIZE_TYPE    LENGTH,
00068                                         RETURN_CODE_TYPE     *RETURN_CODE);
00069 
00070 extern void CREATE_ERROR_HANDLER (SYSTEM_ADDRESS_TYPE  ENTRY_POINT,
00071                                   STACK_SIZE_TYPE      STACK_SIZE,
00072                                   RETURN_CODE_TYPE     *RETURN_CODE);
00073 
00074 extern void GET_ERROR_STATUS (ERROR_STATUS_TYPE  *ERROR_STATUS,
00075                               RETURN_CODE_TYPE   *RETURN_CODE );
00076 
00077 extern void RAISE_APPLICATION_ERROR (ERROR_CODE_TYPE            ERROR_CODE,
00078                                      MESSAGE_ADDR_TYPE          MESSAGE,
00079                                      ERROR_MESSAGE_SIZE_TYPE    LENGTH,
00080                                      RETURN_CODE_TYPE           *RETURN_CODE);
00081 #endif
00082 #endif