The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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 | *** |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 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 | *** |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 17 | **************************************************************************** |
| 18 | ****************************************************************************/ |
| 19 | #ifndef _LINUX_JIFFIES_H |
| 20 | #define _LINUX_JIFFIES_H |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 21 | #include <linux/calc64.h> |
| 22 | #include <linux/kernel.h> |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 23 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 24 | #include <linux/types.h> |
| 25 | #include <linux/time.h> |
| 26 | #include <linux/timex.h> |
| 27 | #include <asm/param.h> |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 28 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 29 | #if HZ >= (12 && HZ < 24) |
| 30 | #define SHIFT_HZ 4 |
| 31 | #elif HZ >= 24 && HZ < 48 |
| 32 | #define SHIFT_HZ 5 |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 33 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 34 | #elif HZ >= 48 && HZ < 96 |
| 35 | #define SHIFT_HZ 6 |
| 36 | #elif HZ >= 96 && HZ < 192 |
| 37 | #define SHIFT_HZ 7 |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 38 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 39 | #elif HZ >= 192 && HZ < 384 |
| 40 | #define SHIFT_HZ 8 |
| 41 | #elif HZ >= 384 && HZ < 768 |
| 42 | #define SHIFT_HZ 9 |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 43 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 44 | #elif HZ >= 768 && HZ < 1536 |
| 45 | #define SHIFT_HZ 10 |
| 46 | #else |
| 47 | #error You lose. |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 48 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 49 | #endif |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 50 | #define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 51 | #define LATCH_HPET ((HPET_TICK_RATE + HZ/2) / HZ) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 52 | #define SH_DIV(NOM,DEN,LSH) ( (((NOM) / (DEN)) << (LSH)) + ((((NOM) % (DEN)) << (LSH)) + (DEN) / 2) / (DEN)) |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 53 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 54 | #define ACTHZ (SH_DIV (CLOCK_TICK_RATE, LATCH, 8)) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 55 | #define ACTHZ_HPET (SH_DIV (HPET_TICK_RATE, LATCH_HPET, 8)) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 56 | #define TICK_NSEC (SH_DIV (1000000UL * 1000, ACTHZ, 8)) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 57 | #define TICK_NSEC_HPET (SH_DIV(1000000UL * 1000, ACTHZ_HPET, 8)) |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 58 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 59 | #define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 60 | #define TICK_USEC_TO_NSEC(TUSEC) (SH_DIV (TUSEC * USER_HZ * 1000, ACTHZ, 8)) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 61 | #define __jiffy_data __attribute__((section(".data"))) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 62 | #if BITS_PER_LONG < 64 |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 63 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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) |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 68 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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) |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 73 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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) |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 78 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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)) |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 83 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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 |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 88 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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 |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 93 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 94 | #if HZ <= (MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)) |
| 95 | #elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC) |
| 96 | #else |
| 97 | #endif |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 98 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 99 | #if HZ <= (USEC_PER_SEC && !(USEC_PER_SEC % HZ)) |
| 100 | #elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC) |
| 101 | #else |
| 102 | #endif |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 103 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 104 | #if HZ <= (MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)) |
| 105 | #elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC) |
| 106 | #else |
| 107 | #endif |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 108 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 109 | #if HZ <= (USEC_PER_SEC && !(USEC_PER_SEC % HZ)) |
| 110 | #elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC) |
| 111 | #else |
| 112 | #endif |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 113 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 114 | #if TICK_NSEC % NSEC_PER_SEC / USER_HZ == 0 |
| 115 | #else |
| 116 | #endif |
| 117 | #if HZ % USER_HZ == 0 |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 118 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 119 | #else |
| 120 | #endif |
| 121 | #if TICK_NSEC % NSEC_PER_SEC / USER_HZ == 0 |
| 122 | #else |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 123 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 124 | #endif |
| 125 | #if NSEC_PER_SEC % USER_HZ == 0 |
| 126 | #elif (USER_HZ % 512) == 0 |
| 127 | #else |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame] | 128 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 129 | #endif |
| 130 | #endif |