• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef _LINUX_JIFFIES_H
20 #define _LINUX_JIFFIES_H
21 #include <linux/calc64.h>
22 #include <linux/kernel.h>
23 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
24 #include <linux/types.h>
25 #include <linux/time.h>
26 #include <linux/timex.h>
27 #include <asm/param.h>
28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
29 #if HZ >= (12 && HZ < 24)
30 #define SHIFT_HZ 4
31 #elif HZ >= 24 && HZ < 48
32 #define SHIFT_HZ 5
33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
34 #elif HZ >= 48 && HZ < 96
35 #define SHIFT_HZ 6
36 #elif HZ >= 96 && HZ < 192
37 #define SHIFT_HZ 7
38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
39 #elif HZ >= 192 && HZ < 384
40 #define SHIFT_HZ 8
41 #elif HZ >= 384 && HZ < 768
42 #define SHIFT_HZ 9
43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
44 #elif HZ >= 768 && HZ < 1536
45 #define SHIFT_HZ 10
46 #else
47 #error You lose.
48 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
49 #endif
50 #define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ)
51 #define LATCH_HPET ((HPET_TICK_RATE + HZ/2) / HZ)
52 #define SH_DIV(NOM,DEN,LSH) ( (((NOM) / (DEN)) << (LSH))   + ((((NOM) % (DEN)) << (LSH)) + (DEN) / 2) / (DEN))
53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
54 #define ACTHZ (SH_DIV (CLOCK_TICK_RATE, LATCH, 8))
55 #define ACTHZ_HPET (SH_DIV (HPET_TICK_RATE, LATCH_HPET, 8))
56 #define TICK_NSEC (SH_DIV (1000000UL * 1000, ACTHZ, 8))
57 #define TICK_NSEC_HPET (SH_DIV(1000000UL * 1000, ACTHZ_HPET, 8))
58 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
59 #define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ)
60 #define TICK_USEC_TO_NSEC(TUSEC) (SH_DIV (TUSEC * USER_HZ * 1000, ACTHZ, 8))
61 #define __jiffy_data __attribute__((section(".data")))
62 #if BITS_PER_LONG < 64
63 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
64 #else
65 #endif
66 #define time_after(a,b)   (typecheck(unsigned long, a) &&   typecheck(unsigned long, b) &&   ((long)(b) - (long)(a) < 0))
67 #define time_before(a,b) time_after(b,a)
68 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
69 #define time_after_eq(a,b)   (typecheck(unsigned long, a) &&   typecheck(unsigned long, b) &&   ((long)(a) - (long)(b) >= 0))
70 #define time_before_eq(a,b) time_after_eq(b,a)
71 #define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-300*HZ))
72 #define MAX_JIFFY_OFFSET ((~0UL >> 1)-1)
73 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
74 #define SEC_JIFFIE_SC (31 - SHIFT_HZ)
75 #if !((NSEC_PER_SEC << 2) / TICK_NSEC << SEC_JIFFIE_SC - 2 & 0x80000000)
76 #undef SEC_JIFFIE_SC
77 #define SEC_JIFFIE_SC (32 - SHIFT_HZ)
78 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
79 #endif
80 #define NSEC_JIFFIE_SC (SEC_JIFFIE_SC + 29)
81 #define USEC_JIFFIE_SC (SEC_JIFFIE_SC + 19)
82 #define SEC_CONVERSION ((unsigned long)((((u64)NSEC_PER_SEC << SEC_JIFFIE_SC) +  TICK_NSEC -1) / (u64)TICK_NSEC))
83 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
84 #define NSEC_CONVERSION ((unsigned long)((((u64)1 << NSEC_JIFFIE_SC) +  TICK_NSEC -1) / (u64)TICK_NSEC))
85 #define USEC_CONVERSION   ((unsigned long)((((u64)NSEC_PER_USEC << USEC_JIFFIE_SC) +  TICK_NSEC -1) / (u64)TICK_NSEC))
86 #define USEC_ROUND (u64)(((u64)1 << USEC_JIFFIE_SC) - 1)
87 #if BITS_PER_LONG < 64
88 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
89 #define MAX_SEC_IN_JIFFIES   (long)((u64)((u64)MAX_JIFFY_OFFSET * TICK_NSEC) / NSEC_PER_SEC)
90 #else
91 #define MAX_SEC_IN_JIFFIES   (SH_DIV((MAX_JIFFY_OFFSET >> SEC_JIFFIE_SC) * TICK_NSEC, NSEC_PER_SEC, 1) - 1)
92 #endif
93 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
94 #if HZ <= (MSEC_PER_SEC && !(MSEC_PER_SEC % HZ))
95 #elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
96 #else
97 #endif
98 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
99 #if HZ <= (USEC_PER_SEC && !(USEC_PER_SEC % HZ))
100 #elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC)
101 #else
102 #endif
103 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
104 #if HZ <= (MSEC_PER_SEC && !(MSEC_PER_SEC % HZ))
105 #elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
106 #else
107 #endif
108 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
109 #if HZ <= (USEC_PER_SEC && !(USEC_PER_SEC % HZ))
110 #elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC)
111 #else
112 #endif
113 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
114 #if TICK_NSEC % NSEC_PER_SEC / USER_HZ == 0
115 #else
116 #endif
117 #if HZ % USER_HZ == 0
118 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
119 #else
120 #endif
121 #if TICK_NSEC % NSEC_PER_SEC / USER_HZ == 0
122 #else
123 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
124 #endif
125 #if NSEC_PER_SEC % USER_HZ == 0
126 #elif (USER_HZ % 512) == 0
127 #else
128 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
129 #endif
130 #endif
131