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 Mon Jan 19 10:51:40 2009
15  */
16 
17 #include <core/dependencies.h>
18 
19 #ifdef POK_NEEDS_ERROR_HANDLING
20 
21 #include <types.h>
22 #include <errno.h>
23 
24 #define POK_ERROR_MAX_LOGGED 100
25 
26 
27 typedef struct
28 {
29  uint8_t error_kind;
30  uint32_t failed_thread;
31  uint32_t failed_addr;
32  char* msg;
33  uint32_t msg_size;
35 
36 
37 typedef struct
38 {
39  uint32_t thread;
40  uint32_t error;
41  pok_time_t when;
43 
44 extern pok_error_report_t pok_error_reported[POK_ERROR_MAX_LOGGED];
45 
46 #define POK_ERROR_KIND_DEADLINE_MISSED 10
47 #define POK_ERROR_KIND_APPLICATION_ERROR 11
48 #define POK_ERROR_KIND_NUMERIC_ERROR 12
49 #define POK_ERROR_KIND_ILLEGAL_REQUEST 13
50 #define POK_ERROR_KIND_STACK_OVERFLOW 14
51 #define POK_ERROR_KIND_MEMORY_VIOLATION 15
52 #define POK_ERROR_KIND_HARDWARE_FAULT 16
53 #define POK_ERROR_KIND_POWER_FAIL 17
54 #define POK_ERROR_KIND_PARTITION_CONFIGURATION 30
55 #define POK_ERROR_KIND_PARTITION_INIT 31
56 #define POK_ERROR_KIND_PARTITION_SCHEDULING 32
57 #define POK_ERROR_KIND_PARTITION_PROCESS 33
58 #define POK_ERROR_KIND_KERNEL_INIT 50
59 #define POK_ERROR_KIND_KERNEL_SCHEDULING 51
60 
61 pok_ret_t pok_error_handler_create ();
62 void pok_error_ignore (const uint32_t error_id, const uint32_t thread_id);
63 void pok_error_confirm (const uint32_t error_id, const uint32_t thread_id);
64 pok_ret_t pok_error_handler_set_ready (const pok_error_status_t*);
65 
66 void pok_error_log (const uint32_t error_id, const uint32_t thread_id);
67 
68 void pok_error_raise_application_error (char* msg, uint32_t msg_size);
69 
76 pok_ret_t pok_error_get (pok_error_status_t* status);
77 
78 #endif
79