diff options
author | Namhoon Kim <namhoonk@cs.unc.edu> | 2014-11-03 21:52:24 -0500 |
---|---|---|
committer | Namhoon Kim <namhoonk@cs.unc.edu> | 2014-11-03 21:52:24 -0500 |
commit | 5c2112a210e8654d96e3f4c0395f1a326f28666f (patch) | |
tree | 409b6a5955b8f17014f6c2629fc4e4a83debd9ac /include | |
parent | 5b564e918add09d778ae347e9fdd005a36f8e879 (diff) |
ARM timer support
Diffstat (limited to 'include')
-rw-r--r-- | include/litmus/clock.h | 48 | ||||
-rw-r--r-- | include/litmus/feather_trace.h | 12 |
2 files changed, 60 insertions, 0 deletions
diff --git a/include/litmus/clock.h b/include/litmus/clock.h new file mode 100644 index 000000000000..f8de7a3dfb5a --- /dev/null +++ b/include/litmus/clock.h | |||
@@ -0,0 +1,48 @@ | |||
1 | #ifndef _LITMUS_CLOCK_H_ | ||
2 | #define _LITMUS_CLOCK_H_ | ||
3 | |||
4 | #if defined(CONFIG_EXYNOS_MCT) | ||
5 | |||
6 | /* | ||
7 | * Only used if we are using the EXYNOS MCT clock. | ||
8 | */ | ||
9 | |||
10 | #include <linux/clocksource.h> | ||
11 | extern struct clocksource mct_frc; | ||
12 | |||
13 | static inline cycles_t mct_frc_read(void) | ||
14 | { | ||
15 | cycle_t cycles = mct_frc.read(&mct_frc); | ||
16 | return cycles; | ||
17 | } | ||
18 | |||
19 | static inline s64 litmus_cycles_to_ns(cycles_t cycles) | ||
20 | { | ||
21 | return clocksource_cyc2ns(cycles, mct_frc.mult, mct_frc.shift); | ||
22 | } | ||
23 | |||
24 | #define litmus_get_cycles mct_frc_read | ||
25 | |||
26 | #elif defined(CONFIG_CPU_V7) && !defined(CONFIG_HW_PERF_EVENTS) | ||
27 | |||
28 | #include <asm/timex.h> | ||
29 | |||
30 | static inline cycles_t v7_get_cycles (void) | ||
31 | { | ||
32 | u32 value; | ||
33 | /* read CCNT register */ | ||
34 | asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(value)); | ||
35 | return value; | ||
36 | } | ||
37 | |||
38 | #define litmus_get_cycles v7_get_cycles | ||
39 | |||
40 | #else | ||
41 | #include <asm/timex.h> | ||
42 | |||
43 | #define litmus_get_cycles get_cycles | ||
44 | |||
45 | #endif | ||
46 | |||
47 | #endif | ||
48 | |||
diff --git a/include/litmus/feather_trace.h b/include/litmus/feather_trace.h index dbeca46c01f5..cc4396e7fbe4 100644 --- a/include/litmus/feather_trace.h +++ b/include/litmus/feather_trace.h | |||
@@ -38,11 +38,23 @@ static inline void ft_atomic_dec(int *val) | |||
38 | /* provide default implementation */ | 38 | /* provide default implementation */ |
39 | #include <linux/timex.h> /* for get_cycles() */ | 39 | #include <linux/timex.h> /* for get_cycles() */ |
40 | 40 | ||
41 | #if defined(CONFIG_CPU_V7) && !defined(CONFIG_HW_PERF_EVENTS) | ||
42 | |||
43 | #include <litmus/clock.h> /* for litmus_get_cycles() */ | ||
44 | static inline unsigned long long ft_timestamp(void) | ||
45 | { | ||
46 | return (unsigned long long)litmus_get_cycles(); | ||
47 | } | ||
48 | |||
49 | #else | ||
50 | |||
41 | static inline unsigned long long ft_timestamp(void) | 51 | static inline unsigned long long ft_timestamp(void) |
42 | { | 52 | { |
43 | return get_cycles(); | 53 | return get_cycles(); |
44 | } | 54 | } |
45 | 55 | ||
56 | #endif | ||
57 | |||
46 | #define feather_callback | 58 | #define feather_callback |
47 | 59 | ||
48 | #define MAX_EVENTS 1024 | 60 | #define MAX_EVENTS 1024 |