Initial commit
[kernel/linux-3.0.git] / drivers / gpu / vithar / osk / src / linux / include / osk / mali_osk_arch_time.h
1 /*
2  *
3  * (C) COPYRIGHT 2010-2011 ARM Limited. All rights reserved.
4  *
5  * This program is free software and is provided to you under the terms of the GNU General Public License version 2
6  * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
7  * 
8  * A copy of the licence is included with the program, and can also be obtained from Free Software
9  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
10  * 
11  */
12
13
14
15 /**
16  * @file
17  * Implementation of the OS abstraction layer for the kernel device driver
18  */
19
20 #ifndef _OSK_ARCH_TIME_H
21 #define _OSK_ARCH_TIME_H
22
23 #ifndef _OSK_H_
24 #error "Include mali_osk.h directly"
25 #endif
26
27 OSK_STATIC_INLINE osk_ticks osk_time_now(void)
28 {
29         return jiffies;
30 }
31
32 OSK_STATIC_INLINE u32 osk_time_mstoticks(u32 ms)
33 {
34         return msecs_to_jiffies(ms);
35 }
36
37 OSK_STATIC_INLINE u32 osk_time_elapsed(osk_ticks ticka, osk_ticks tickb)
38 {
39         return jiffies_to_msecs((long)tickb - (long)ticka);
40 }
41
42 OSK_STATIC_INLINE mali_bool osk_time_after(osk_ticks ticka, osk_ticks tickb)
43 {
44         return time_after(ticka, tickb);
45 }
46
47 OSK_STATIC_INLINE void osk_gettimeofday(osk_timeval *tv)
48 {
49         struct timespec ts;
50         getnstimeofday(&ts);
51
52         tv->tv_sec = ts.tv_sec;
53         tv->tv_usec = ts.tv_nsec/1000;
54 }
55
56 #endif /* _OSK_ARCH_TIME_H_ */