POK(kernelpart)
/home/jaouen/pok_official/pok/trunk/kernel/include/core/time.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 Thu Jan 15 23:34:13 2009 
00015  */
00016 
00017 
00018 #if defined (POK_NEEDS_TIME) || defined (POK_NEEDS_THREADS) || defined (POK_NEEDS_SCHED)
00019 
00020 #ifndef __POK_TIME_H__
00021 #define __POK_TIME_H__
00022 
00023 #include <types.h>
00024 #include <errno.h>
00025 
00029 #define POK_TIMER_FREQUENCY 1000
00030 
00031 extern uint64_t pok_tick_counter;
00032 
00033 #define CLOCK_HANDLER pok_tick_counter += 1; pok_sched ();
00034 
00035 #define POK_GETTICK() pok_tick_counter
00036 
00037 typedef int clockid_t;
00038 
00039 # define CLOCK_REALTIME 0
00040 
00041 typedef long int time_t;
00042 
00043 struct timespec
00044 {
00045     time_t tv_sec;              /* Seconds.  */
00046     long int tv_nsec;           /* Nanoseconds.  */
00047 };
00048 
00049 typedef enum
00050 {
00051    __POK_CLOCK_REALTIME = 0 
00052 } pok_clockid_t;
00053 
00054 void        pok_time_init (void);
00055 pok_ret_t   pok_clock_gettime (pok_clockid_t clk_id, struct timespec *tp);
00056 uint64_t    pok_gettick (void);
00057 pok_ret_t   pok_gettick_by_pointer (uint64_t* clk_val);
00058 
00059 #endif  /* __POK_TIME_H__ */
00060 #endif /* Needs clauses */