aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/jiffies.h
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /include/linux/jiffies.h
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'include/linux/jiffies.h')
-rw-r--r--include/linux/jiffies.h26
1 files changed, 12 insertions, 14 deletions
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 82ed068b1eb..265e2c3cbd1 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -39,6 +39,9 @@
39# error Invalid value of HZ. 39# error Invalid value of HZ.
40#endif 40#endif
41 41
42/* LATCH is used in the interval timer and ftape setup. */
43#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */
44
42/* Suppose we want to divide two numbers NOM and DEN: NOM/DEN, then we can 45/* Suppose we want to divide two numbers NOM and DEN: NOM/DEN, then we can
43 * improve accuracy by shifting LSH bits, hence calculating: 46 * improve accuracy by shifting LSH bits, hence calculating:
44 * (NOM << LSH) / DEN 47 * (NOM << LSH) / DEN
@@ -51,17 +54,19 @@
51#define SH_DIV(NOM,DEN,LSH) ( (((NOM) / (DEN)) << (LSH)) \ 54#define SH_DIV(NOM,DEN,LSH) ( (((NOM) / (DEN)) << (LSH)) \
52 + ((((NOM) % (DEN)) << (LSH)) + (DEN) / 2) / (DEN)) 55 + ((((NOM) % (DEN)) << (LSH)) + (DEN) / 2) / (DEN))
53 56
54/* LATCH is used in the interval timer and ftape setup. */ 57/* HZ is the requested value. ACTHZ is actual HZ ("<< 8" is for accuracy) */
55#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */ 58#define ACTHZ (SH_DIV (CLOCK_TICK_RATE, LATCH, 8))
56 59
57extern int register_refined_jiffies(long clock_tick_rate); 60/* TICK_NSEC is the time between ticks in nsec assuming real ACTHZ */
58 61#define TICK_NSEC (SH_DIV (1000000UL * 1000, ACTHZ, 8))
59/* TICK_NSEC is the time between ticks in nsec assuming SHIFTED_HZ */
60#define TICK_NSEC ((NSEC_PER_SEC+HZ/2)/HZ)
61 62
62/* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */ 63/* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */
63#define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ) 64#define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ)
64 65
66/* TICK_USEC_TO_NSEC is the time between ticks in nsec assuming real ACTHZ and */
67/* a value TUSEC for TICK_USEC (can be set bij adjtimex) */
68#define TICK_USEC_TO_NSEC(TUSEC) (SH_DIV (TUSEC * USER_HZ * 1000, ACTHZ, 8))
69
65/* some arch's have a small-data section that can be accessed register-relative 70/* some arch's have a small-data section that can be accessed register-relative
66 * but that can only take up to, say, 4-byte variables. jiffies being part of 71 * but that can only take up to, say, 4-byte variables. jiffies being part of
67 * an 8-byte variable may not be correctly accessed unless we force the issue 72 * an 8-byte variable may not be correctly accessed unless we force the issue
@@ -70,12 +75,11 @@ extern int register_refined_jiffies(long clock_tick_rate);
70 75
71/* 76/*
72 * The 64-bit value is not atomic - you MUST NOT read it 77 * The 64-bit value is not atomic - you MUST NOT read it
73 * without sampling the sequence number in jiffies_lock. 78 * without sampling the sequence number in xtime_lock.
74 * get_jiffies_64() will do this for you as appropriate. 79 * get_jiffies_64() will do this for you as appropriate.
75 */ 80 */
76extern u64 __jiffy_data jiffies_64; 81extern u64 __jiffy_data jiffies_64;
77extern unsigned long volatile __jiffy_data jiffies; 82extern unsigned long volatile __jiffy_data jiffies;
78extern seqlock_t jiffies_lock;
79 83
80#if (BITS_PER_LONG < 64) 84#if (BITS_PER_LONG < 64)
81u64 get_jiffies_64(void); 85u64 get_jiffies_64(void);
@@ -299,13 +303,7 @@ extern void jiffies_to_timespec(const unsigned long jiffies,
299extern unsigned long timeval_to_jiffies(const struct timeval *value); 303extern unsigned long timeval_to_jiffies(const struct timeval *value);
300extern void jiffies_to_timeval(const unsigned long jiffies, 304extern void jiffies_to_timeval(const unsigned long jiffies,
301 struct timeval *value); 305 struct timeval *value);
302
303extern clock_t jiffies_to_clock_t(unsigned long x); 306extern clock_t jiffies_to_clock_t(unsigned long x);
304static inline clock_t jiffies_delta_to_clock_t(long delta)
305{
306 return jiffies_to_clock_t(max(0L, delta));
307}
308
309extern unsigned long clock_t_to_jiffies(unsigned long x); 307extern unsigned long clock_t_to_jiffies(unsigned long x);
310extern u64 jiffies_64_to_clock_t(u64 x); 308extern u64 jiffies_64_to_clock_t(u64 x);
311extern u64 nsec_to_clock_t(u64 x); 309extern u64 nsec_to_clock_t(u64 x);