POK
/home/jaouen/pok_official/pok/trunk/libpok/include/core/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 Mon Jan 19 10:51:40 2009 
00015  */
00016 
00017 #include <core/dependencies.h>
00018 
00019 #ifdef POK_NEEDS_ERROR_HANDLING
00020 
00021 #include <types.h>
00022 #include <errno.h>
00023 
00024 #define POK_ERROR_MAX_LOGGED 100
00025 
00026 
00027 typedef struct
00028 {
00029    uint8_t        error_kind;
00030    uint32_t       failed_thread;
00031    uint32_t       failed_addr;
00032    char*          msg;
00033    uint32_t       msg_size;
00034 }pok_error_status_t;
00035 
00036 
00037 typedef struct
00038 {
00039    uint32_t    thread;
00040    uint32_t    error;
00041    pok_time_t  when;
00042 }pok_error_report_t;
00043 
00044 extern   pok_error_report_t pok_error_reported[POK_ERROR_MAX_LOGGED];
00045 
00046 #define POK_ERROR_KIND_DEADLINE_MISSED          10
00047 #define POK_ERROR_KIND_APPLICATION_ERROR        11
00048 #define POK_ERROR_KIND_NUMERIC_ERROR            12
00049 #define POK_ERROR_KIND_ILLEGAL_REQUEST          13
00050 #define POK_ERROR_KIND_STACK_OVERFLOW           14
00051 #define POK_ERROR_KIND_MEMORY_VIOLATION         15
00052 #define POK_ERROR_KIND_HARDWARE_FAULT           16
00053 #define POK_ERROR_KIND_POWER_FAIL               17
00054 #define POK_ERROR_KIND_PARTITION_CONFIGURATION  30
00055 #define POK_ERROR_KIND_PARTITION_INIT           31
00056 #define POK_ERROR_KIND_PARTITION_SCHEDULING     32
00057 #define POK_ERROR_KIND_PARTITION_PROCESS        33
00058 #define POK_ERROR_KIND_KERNEL_INIT              50
00059 #define POK_ERROR_KIND_KERNEL_SCHEDULING        51
00060 
00061 pok_ret_t pok_error_handler_create ();
00062 void pok_error_ignore  (const uint32_t error_id, const uint32_t thread_id);
00063 void pok_error_confirm (const uint32_t error_id, const uint32_t thread_id);
00064 pok_ret_t pok_error_handler_set_ready (const pok_error_status_t*);
00065 
00066 void pok_error_log (const uint32_t error_id, const uint32_t thread_id);
00067 
00068 void pok_error_raise_application_error (char* msg, uint32_t msg_size);
00069 
00076 pok_ret_t pok_error_get (pok_error_status_t* status);
00077 
00078 #endif
00079