2009-03-04 04:28:35 +01:00
|
|
|
/****************************************************************************
|
|
|
|
****************************************************************************
|
|
|
|
***
|
|
|
|
*** This header was automatically generated from a Linux kernel header
|
|
|
|
*** of the same name, to make information necessary for userspace to
|
|
|
|
*** call into the kernel available to libc. It contains only constants,
|
|
|
|
*** structures, and macros generated from the original header, and thus,
|
|
|
|
*** contains no copyrightable information.
|
|
|
|
***
|
2012-03-07 00:45:52 +01:00
|
|
|
*** To edit the content of this header, modify the corresponding
|
|
|
|
*** source file (e.g. under external/kernel-headers/original/) then
|
|
|
|
*** run bionic/libc/kernel/tools/update_all.py
|
|
|
|
***
|
|
|
|
*** Any manual change here will be lost the next time this script will
|
|
|
|
*** be run. You've been warned!
|
|
|
|
***
|
2009-03-04 04:28:35 +01:00
|
|
|
****************************************************************************
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef _LINUX_JIFFIES_H
|
|
|
|
#define _LINUX_JIFFIES_H
|
|
|
|
#include <linux/calc64.h>
|
|
|
|
#include <linux/kernel.h>
|
2012-03-07 00:45:52 +01:00
|
|
|
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
2009-03-04 04:28:35 +01:00
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/time.h>
|
|
|
|
#include <linux/timex.h>
|
|
|
|
#include <asm/param.h>
|
2012-03-07 00:45:52 +01:00
|
|
|
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
2009-03-04 04:28:35 +01:00
|
|
|
#if HZ >= (12 && HZ < 24)
|
|
|
|
#define SHIFT_HZ 4
|
|
|
|
#elif HZ >= 24 && HZ < 48
|
|
|
|
#define SHIFT_HZ 5
|
2012-03-07 00:45:52 +01:00
|
|
|
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
2009-03-04 04:28:35 +01:00
|
|
|
#elif HZ >= 48 && HZ < 96
|
|
|
|
#define SHIFT_HZ 6
|
|
|
|
#elif HZ >= 96 && HZ < 192
|
|
|
|
#define SHIFT_HZ 7
|
2012-03-07 00:45:52 +01:00
|
|
|
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
2009-03-04 04:28:35 +01:00
|
|
|
#elif HZ >= 192 && HZ < 384
|
|
|
|
#define SHIFT_HZ 8
|
|
|
|
#elif HZ >= 384 && HZ < 768
|
|
|
|
#define SHIFT_HZ 9
|
2012-03-07 00:45:52 +01:00
|
|
|
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
2009-03-04 04:28:35 +01:00
|
|
|
#elif HZ >= 768 && HZ < 1536
|
|
|
|
#define SHIFT_HZ 10
|
|
|
|
#else
|
|
|
|
#error You lose.
|
2012-03-07 00:45:52 +01:00
|
|
|
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
2009-03-04 04:28:35 +01:00
|
|
|
#endif
|
|
|
|
#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ)
|
|
|
|
#define LATCH_HPET ((HPET_TICK_RATE + HZ/2) / HZ)
|
|
|
|
#define SH_DIV(NOM,DEN,LSH) ( (((NOM) / (DEN)) << (LSH)) + ((((NOM) % (DEN)) << (LSH)) + (DEN) / 2) / (DEN))
|
2012-03-07 00:45:52 +01:00
|
|
|
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
2009-03-04 04:28:35 +01:00
|
|
|
#define ACTHZ (SH_DIV (CLOCK_TICK_RATE, LATCH, 8))
|
|
|
|
#define ACTHZ_HPET (SH_DIV (HPET_TICK_RATE, LATCH_HPET, 8))
|
|
|
|
#define TICK_NSEC (SH_DIV (1000000UL * 1000, ACTHZ, 8))
|
|
|
|
#define TICK_NSEC_HPET (SH_DIV(1000000UL * 1000, ACTHZ_HPET, 8))
|
2012-03-07 00:45:52 +01:00
|
|
|
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
2009-03-04 04:28:35 +01:00
|
|
|
#define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ)
|
|
|
|
#define TICK_USEC_TO_NSEC(TUSEC) (SH_DIV (TUSEC * USER_HZ * 1000, ACTHZ, 8))
|
|
|
|
#define __jiffy_data __attribute__((section(".data")))
|
|
|
|
#if BITS_PER_LONG < 64
|
2012-03-07 00:45:52 +01:00
|
|
|
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
2009-03-04 04:28:35 +01:00
|
|
|
#else
|
|
|
|
#endif
|
|
|
|
#define time_after(a,b) (typecheck(unsigned long, a) && typecheck(unsigned long, b) && ((long)(b) - (long)(a) < 0))
|
|
|
|
#define time_before(a,b) time_after(b,a)
|
2012-03-07 00:45:52 +01:00
|
|
|
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
2009-03-04 04:28:35 +01:00
|
|
|
#define time_after_eq(a,b) (typecheck(unsigned long, a) && typecheck(unsigned long, b) && ((long)(a) - (long)(b) >= 0))
|
|
|
|
#define time_before_eq(a,b) time_after_eq(b,a)
|
|
|
|
#define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-300*HZ))
|
|
|
|
#define MAX_JIFFY_OFFSET ((~0UL >> 1)-1)
|
2012-03-07 00:45:52 +01:00
|
|
|
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
2009-03-04 04:28:35 +01:00
|
|
|
#define SEC_JIFFIE_SC (31 - SHIFT_HZ)
|
|
|
|
#if !((NSEC_PER_SEC << 2) / TICK_NSEC << SEC_JIFFIE_SC - 2 & 0x80000000)
|
|
|
|
#undef SEC_JIFFIE_SC
|
|
|
|
#define SEC_JIFFIE_SC (32 - SHIFT_HZ)
|
2012-03-07 00:45:52 +01:00
|
|
|
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
2009-03-04 04:28:35 +01:00
|
|
|
#endif
|
|
|
|
#define NSEC_JIFFIE_SC (SEC_JIFFIE_SC + 29)
|
|
|
|
#define USEC_JIFFIE_SC (SEC_JIFFIE_SC + 19)
|
|
|
|
#define SEC_CONVERSION ((unsigned long)((((u64)NSEC_PER_SEC << SEC_JIFFIE_SC) + TICK_NSEC -1) / (u64)TICK_NSEC))
|
2012-03-07 00:45:52 +01:00
|
|
|
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
2009-03-04 04:28:35 +01:00
|
|
|
#define NSEC_CONVERSION ((unsigned long)((((u64)1 << NSEC_JIFFIE_SC) + TICK_NSEC -1) / (u64)TICK_NSEC))
|
|
|
|
#define USEC_CONVERSION ((unsigned long)((((u64)NSEC_PER_USEC << USEC_JIFFIE_SC) + TICK_NSEC -1) / (u64)TICK_NSEC))
|
|
|
|
#define USEC_ROUND (u64)(((u64)1 << USEC_JIFFIE_SC) - 1)
|
|
|
|
#if BITS_PER_LONG < 64
|
2012-03-07 00:45:52 +01:00
|
|
|
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
2009-03-04 04:28:35 +01:00
|
|
|
#define MAX_SEC_IN_JIFFIES (long)((u64)((u64)MAX_JIFFY_OFFSET * TICK_NSEC) / NSEC_PER_SEC)
|
|
|
|
#else
|
|
|
|
#define MAX_SEC_IN_JIFFIES (SH_DIV((MAX_JIFFY_OFFSET >> SEC_JIFFIE_SC) * TICK_NSEC, NSEC_PER_SEC, 1) - 1)
|
|
|
|
#endif
|
2012-03-07 00:45:52 +01:00
|
|
|
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
2009-03-04 04:28:35 +01:00
|
|
|
#if HZ <= (MSEC_PER_SEC && !(MSEC_PER_SEC % HZ))
|
|
|
|
#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
|
|
|
|
#else
|
|
|
|
#endif
|
2012-03-07 00:45:52 +01:00
|
|
|
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
2009-03-04 04:28:35 +01:00
|
|
|
#if HZ <= (USEC_PER_SEC && !(USEC_PER_SEC % HZ))
|
|
|
|
#elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC)
|
|
|
|
#else
|
|
|
|
#endif
|
2012-03-07 00:45:52 +01:00
|
|
|
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
2009-03-04 04:28:35 +01:00
|
|
|
#if HZ <= (MSEC_PER_SEC && !(MSEC_PER_SEC % HZ))
|
|
|
|
#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
|
|
|
|
#else
|
|
|
|
#endif
|
2012-03-07 00:45:52 +01:00
|
|
|
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
2009-03-04 04:28:35 +01:00
|
|
|
#if HZ <= (USEC_PER_SEC && !(USEC_PER_SEC % HZ))
|
|
|
|
#elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC)
|
|
|
|
#else
|
|
|
|
#endif
|
2012-03-07 00:45:52 +01:00
|
|
|
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
2009-03-04 04:28:35 +01:00
|
|
|
#if TICK_NSEC % NSEC_PER_SEC / USER_HZ == 0
|
|
|
|
#else
|
|
|
|
#endif
|
|
|
|
#if HZ % USER_HZ == 0
|
2012-03-07 00:45:52 +01:00
|
|
|
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
2009-03-04 04:28:35 +01:00
|
|
|
#else
|
|
|
|
#endif
|
|
|
|
#if TICK_NSEC % NSEC_PER_SEC / USER_HZ == 0
|
|
|
|
#else
|
2012-03-07 00:45:52 +01:00
|
|
|
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
2009-03-04 04:28:35 +01:00
|
|
|
#endif
|
|
|
|
#if NSEC_PER_SEC % USER_HZ == 0
|
|
|
|
#elif (USER_HZ % 512) == 0
|
|
|
|
#else
|
2012-03-07 00:45:52 +01:00
|
|
|
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
2009-03-04 04:28:35 +01:00
|
|
|
#endif
|
|
|
|
#endif
|