POK(kernelpart)
error.h
Go to the documentation of this file.
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 #ifdef POK_NEEDS_ERROR_HANDLING
18 
19 #ifndef __POK_CORE_ERROR_H__
20 #define __POK_CORE_ERROR_H__
21 
22 #include <types.h>
23 #include <core/sched.h>
24 
25 #define POK_ERROR_KIND_INVALID 9
26 #define POK_ERROR_KIND_DEADLINE_MISSED 10
27 #define POK_ERROR_KIND_APPLICATION_ERROR 11
28 #define POK_ERROR_KIND_NUMERIC_ERROR 12
29 #define POK_ERROR_KIND_ILLEGAL_REQUEST 13
30 #define POK_ERROR_KIND_STACK_OVERFLOW 14
31 #define POK_ERROR_KIND_MEMORY_VIOLATION 15
32 #define POK_ERROR_KIND_HARDWARE_FAULT 16
33 #define POK_ERROR_KIND_POWER_FAIL 17
34 #define POK_ERROR_KIND_PARTITION_CONFIGURATION 30
35 #define POK_ERROR_KIND_PARTITION_INIT 31
36 #define POK_ERROR_KIND_PARTITION_SCHEDULING 32
37 #define POK_ERROR_KIND_PARTITION_HANDLER 33
38 #define POK_ERROR_KIND_PARTITION_PROCESS 34
39 #define POK_ERROR_KIND_KERNEL_INIT 50
40 #define POK_ERROR_KIND_KERNEL_SCHEDULING 51
41 #define POK_ERROR_KIND_KERNEL_CONFIG 52
42 
43 #define POK_ERROR_MAX_MSG_SIZE 250
44 
45 typedef struct
46 {
47  uint8_t error_kind;
48  uint32_t failed_thread;
49  uint32_t failed_addr;
50  char msg[POK_ERROR_MAX_MSG_SIZE];
51  uint32_t msg_size;
52 } pok_error_status_t;
53 
54 
55 pok_ret_t pok_partition_error_set_ready (pok_error_status_t*);
56 void pok_error_ignore ();
57 void pok_error_declare (const uint8_t error);
58 pok_ret_t pok_error_thread_create (uint32_t stack_size, void* entry);
59 void pok_partition_error (uint8_t partition, uint32_t error);
60 void pok_kernel_error (uint32_t error);
61 void pok_error_partition_callback (uint32_t partition);
62 void pok_error_kernel_callback ();
63 
64 pok_ret_t pok_error_handler_create (void* entry, uint32_t stack_size);
65 
66 
67 void pok_error_raise_application_error (char* msg, uint32_t msg_size);
68 pok_ret_t pok_error_get (pok_error_status_t* status);
69 #define POK_ERROR_CURRENT_PARTITION(error) pok_partition_error(pok_current_partition, error);
70 
71 #endif
72 
73 #endif