Commit | Line | Data |
---|---|---|
6fa3eb70 S |
1 | /* |
2 | * This confidential and proprietary software may be used only as | |
3 | * authorised by a licensing agreement from ARM Limited | |
bdc132d7 | 4 | * (C) COPYRIGHT 2008-2010, 2013-2015 ARM Limited |
6fa3eb70 S |
5 | * ALL RIGHTS RESERVED |
6 | * The entire notice above must be reproduced on all authorised | |
7 | * copies and copies may only be made to the extent permitted | |
8 | * by a licensing agreement from ARM Limited. | |
9 | */ | |
10 | ||
11 | /** | |
12 | * @file mali_osk_time.c | |
13 | * Implementation of the OS abstraction layer for the kernel device driver | |
14 | */ | |
15 | ||
16 | #include "mali_osk.h" | |
17 | #include <linux/jiffies.h> | |
18 | #include <linux/time.h> | |
19 | #include <asm/delay.h> | |
20 | ||
bdc132d7 | 21 | mali_bool _mali_osk_time_after_eq(unsigned long ticka, unsigned long tickb) |
6fa3eb70 | 22 | { |
bdc132d7 S |
23 | return time_after_eq(ticka, tickb) ? |
24 | MALI_TRUE : MALI_FALSE; | |
6fa3eb70 S |
25 | } |
26 | ||
bdc132d7 | 27 | unsigned long _mali_osk_time_mstoticks(u32 ms) |
6fa3eb70 S |
28 | { |
29 | return msecs_to_jiffies(ms); | |
30 | } | |
31 | ||
bdc132d7 | 32 | u32 _mali_osk_time_tickstoms(unsigned long ticks) |
6fa3eb70 S |
33 | { |
34 | return jiffies_to_msecs(ticks); | |
35 | } | |
36 | ||
bdc132d7 | 37 | unsigned long _mali_osk_time_tickcount(void) |
6fa3eb70 S |
38 | { |
39 | return jiffies; | |
40 | } | |
41 | ||
bdc132d7 | 42 | void _mali_osk_time_ubusydelay(u32 usecs) |
6fa3eb70 S |
43 | { |
44 | udelay(usecs); | |
45 | } | |
46 | ||
bdc132d7 | 47 | u64 _mali_osk_time_get_ns(void) |
6fa3eb70 S |
48 | { |
49 | struct timespec tsval; | |
50 | getnstimeofday(&tsval); | |
51 | return (u64)timespec_to_ns(&tsval); | |
52 | } | |
bdc132d7 S |
53 | |
54 | u64 _mali_osk_boot_time_get_ns(void) | |
55 | { | |
56 | struct timespec tsval; | |
57 | get_monotonic_boottime(&tsval); | |
58 | return (u64)timespec_to_ns(&tsval); | |
59 | } |