POK(kernelpart)
/home/jaouen/pok_official/pok/trunk/kernel/include/core/error.h
Go to the documentation of this file.
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 #ifdef POK_NEEDS_ERROR_HANDLING
00018 
00019 #ifndef __POK_CORE_ERROR_H__
00020 #define __POK_CORE_ERROR_H__
00021 
00022 #include <types.h>
00023 #include <core/sched.h>
00024 
00025 #define POK_ERROR_KIND_INVALID                   9
00026 #define POK_ERROR_KIND_DEADLINE_MISSED          10
00027 #define POK_ERROR_KIND_APPLICATION_ERROR        11
00028 #define POK_ERROR_KIND_NUMERIC_ERROR            12
00029 #define POK_ERROR_KIND_ILLEGAL_REQUEST          13
00030 #define POK_ERROR_KIND_STACK_OVERFLOW           14
00031 #define POK_ERROR_KIND_MEMORY_VIOLATION         15
00032 #define POK_ERROR_KIND_HARDWARE_FAULT           16
00033 #define POK_ERROR_KIND_POWER_FAIL               17
00034 #define POK_ERROR_KIND_PARTITION_CONFIGURATION  30 
00035 #define POK_ERROR_KIND_PARTITION_INIT           31
00036 #define POK_ERROR_KIND_PARTITION_SCHEDULING     32
00037 #define POK_ERROR_KIND_PARTITION_HANDLER        33
00038 #define POK_ERROR_KIND_PARTITION_PROCESS        34
00039 #define POK_ERROR_KIND_KERNEL_INIT              50
00040 #define POK_ERROR_KIND_KERNEL_SCHEDULING        51
00041 #define POK_ERROR_KIND_KERNEL_CONFIG            52
00042 
00043 #define POK_ERROR_MAX_MSG_SIZE                  250
00044 
00045 typedef struct
00046 {
00047    uint8_t        error_kind;
00048    uint32_t       failed_thread;
00049    uint32_t       failed_addr;
00050    char           msg[POK_ERROR_MAX_MSG_SIZE];
00051    uint32_t       msg_size;
00052 } pok_error_status_t;
00053 
00054 
00055 pok_ret_t   pok_partition_error_set_ready (pok_error_status_t*);
00056 void        pok_error_ignore ();
00057 void        pok_error_declare (const uint8_t error);
00058 pok_ret_t   pok_error_thread_create (uint32_t stack_size, void* entry);
00059 void        pok_partition_error (uint8_t partition, uint32_t error);
00060 void        pok_kernel_error (uint32_t error);
00061 void        pok_error_partition_callback (uint32_t partition);
00062 void        pok_error_kernel_callback ();
00063 
00064 pok_ret_t   pok_error_handler_create (void* entry, uint32_t stack_size);
00065 
00066 
00067 void        pok_error_raise_application_error (char* msg, uint32_t msg_size);
00068 pok_ret_t   pok_error_get (pok_error_status_t* status);
00069 #define POK_ERROR_CURRENT_PARTITION(error) pok_partition_error(pok_current_partition, error);
00070 
00071 #endif
00072 
00073 #endif