• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2012 - 2014 Cisco Systems
4  * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
5  */
6 
7 #ifndef __TIMER_INTERNAL_H__
8 #define __TIMER_INTERNAL_H__
9 
10 #define TIMER_MULTIPLIER 256
11 #define TIMER_MIN_DELTA  500
12 
13 enum time_travel_mode {
14 	TT_MODE_OFF,
15 	TT_MODE_BASIC,
16 	TT_MODE_INFCPU,
17 };
18 
19 enum time_travel_timer_mode {
20 	TT_TMR_DISABLED,
21 	TT_TMR_ONESHOT,
22 	TT_TMR_PERIODIC,
23 };
24 
25 #ifdef CONFIG_UML_TIME_TRAVEL_SUPPORT
26 extern enum time_travel_mode time_travel_mode;
27 extern unsigned long long time_travel_time;
28 extern enum time_travel_timer_mode time_travel_timer_mode;
29 extern unsigned long long time_travel_timer_expiry;
30 extern unsigned long long time_travel_timer_interval;
31 
time_travel_set_time(unsigned long long ns)32 static inline void time_travel_set_time(unsigned long long ns)
33 {
34 	time_travel_time = ns;
35 }
36 
time_travel_set_timer_mode(enum time_travel_timer_mode mode)37 static inline void time_travel_set_timer_mode(enum time_travel_timer_mode mode)
38 {
39 	time_travel_timer_mode = mode;
40 }
41 
time_travel_set_timer_expiry(unsigned long long expiry)42 static inline void time_travel_set_timer_expiry(unsigned long long expiry)
43 {
44 	time_travel_timer_expiry = expiry;
45 }
46 
time_travel_set_timer_interval(unsigned long long interval)47 static inline void time_travel_set_timer_interval(unsigned long long interval)
48 {
49 	time_travel_timer_interval = interval;
50 }
51 #else
52 #define time_travel_mode TT_MODE_OFF
53 #define time_travel_time 0
54 #define time_travel_timer_expiry 0
55 #define time_travel_timer_interval 0
56 
time_travel_set_time(unsigned long long ns)57 static inline void time_travel_set_time(unsigned long long ns)
58 {
59 }
60 
time_travel_set_timer_mode(enum time_travel_timer_mode mode)61 static inline void time_travel_set_timer_mode(enum time_travel_timer_mode mode)
62 {
63 }
64 
time_travel_set_timer_expiry(unsigned long long expiry)65 static inline void time_travel_set_timer_expiry(unsigned long long expiry)
66 {
67 }
68 
time_travel_set_timer_interval(unsigned long long interval)69 static inline void time_travel_set_timer_interval(unsigned long long interval)
70 {
71 }
72 
73 #define time_travel_timer_mode TT_TMR_DISABLED
74 #endif
75 
76 #endif
77