Subversion Repositories shark

Rev

Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
422 giacomo 1
#ifndef _LINUX_JIFFIES_H
2
#define _LINUX_JIFFIES_H
3
 
4
#include <linux/kernel.h>
5
#include <linux/types.h>
6
#include <linux/spinlock.h>
7
#include <linux/seqlock.h>
8
#include <asm/system.h>
9
#include <asm/param.h>                  /* for HZ */
10
 
11
/*
12
 * The 64-bit value is not volatile - you MUST NOT read it
13
 * without holding read_lock_irq(&xtime_lock).
14
 * get_jiffies_64() will do this for you as appropriate.
15
 */
16
extern u64 jiffies_64;
17
extern unsigned long volatile jiffies;
18
 
19
#if (BITS_PER_LONG < 64)
20
u64 get_jiffies_64(void);
21
#else
22
static inline u64 get_jiffies_64(void)
23
{
24
        return (u64)jiffies;
25
}
26
#endif
27
 
28
/*
29
 *      These inlines deal with timer wrapping correctly. You are
30
 *      strongly encouraged to use them
31
 *      1. Because people otherwise forget
32
 *      2. Because if the timer wrap changes in future you won't have to
33
 *         alter your driver code.
34
 *
35
 * time_after(a,b) returns true if the time a is after time b.
36
 *
37
 * Do this with "<0" and ">=0" to only test the sign of the result. A
38
 * good compiler would generate better code (and a really good compiler
39
 * wouldn't care). Gcc is currently neither.
40
 */
41
#define time_after(a,b)         \
42
        (typecheck(unsigned long, a) && \
43
         typecheck(unsigned long, b) && \
44
         ((long)(b) - (long)(a) < 0))
45
#define time_before(a,b)        time_after(b,a)
46
 
47
#define time_after_eq(a,b)      \
48
        (typecheck(unsigned long, a) && \
49
         typecheck(unsigned long, b) && \
50
         ((long)(a) - (long)(b) >= 0))
51
#define time_before_eq(a,b)     time_after_eq(b,a)
52
 
53
#endif