POK(kernelpart)
time.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 Thu Jan 15 23:34:13 2009
15  */
16 
17 
18 #if defined (POK_NEEDS_TIME) || defined (POK_NEEDS_THREADS) || defined (POK_NEEDS_SCHED)
19 
20 #ifndef __POK_TIME_H__
21 #define __POK_TIME_H__
22 
23 #include <types.h>
24 #include <errno.h>
25 
29 #define POK_TIMER_FREQUENCY 1000
30 
31 extern uint64_t pok_tick_counter;
32 
33 #define CLOCK_HANDLER pok_tick_counter += 1; pok_sched ();
34 
35 #define POK_GETTICK() pok_tick_counter
36 
37 typedef int clockid_t;
38 
39 # define CLOCK_REALTIME 0
40 
41 typedef long int time_t;
42 
43 struct timespec
44 {
45  time_t tv_sec; /* Seconds. */
46  long int tv_nsec; /* Nanoseconds. */
47 };
48 
49 typedef enum
50 {
51  __POK_CLOCK_REALTIME = 0
52 } pok_clockid_t;
53 
54 void pok_time_init (void);
55 pok_ret_t pok_clock_gettime (pok_clockid_t clk_id, struct timespec *tp);
56 uint64_t pok_gettick (void);
57 pok_ret_t pok_gettick_by_pointer (uint64_t* clk_val);
58 
59 #endif /* __POK_TIME_H__ */
60 #endif /* Needs clauses */