POK
errorlog.c
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 Fri Aug 21 16:14:45 2009
15  */
16 
17 #include <core/dependencies.h>
18 
19 #ifdef POK_NEEDS_ERROR_HANDLING
20 #include <types.h>
21 #include <core/time.h>
22 #include <core/error.h>
23 
24 #ifdef POK_NEEDS_DEBUG
25 #include <libc/stdio.h>
26 #endif
27 
28 pok_error_report_t pok_error_reported[POK_ERROR_MAX_LOGGED];
29 uint16_t pok_error_nb_reported = 0;
30 
31 void pok_error_log (const uint32_t error_id, const uint32_t thread_id)
32 {
33 
34 #ifdef POK_NEEDS_DEBUG
35  printf ("Log error %d for thread %d\n", error_id, thread_id);
36 #endif
37 
41  pok_error_reported[pok_error_nb_reported].thread = thread_id;
42  pok_error_reported[pok_error_nb_reported].error = error_id;
43  pok_time_gettick (&pok_error_reported[pok_error_nb_reported].when);
44 
45  pok_error_nb_reported++;
46 }
47 #endif