Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-10-27 09:38:17 +0300
committerCorinna Vinschen <corinna@vinschen.de>2016-11-07 16:03:55 +0300
commit172e2050d95b41861db858dd9bc43a3fb4a28987 (patch)
tree295a7f009246795b5dc68c86315f74c8814dcdd0
parent4b3a664a20d5f317f76f30a1ae51b6db33f79e62 (diff)
Use external header file for kernel space time
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
-rw-r--r--newlib/libc/sys/rtems/include/machine/_time.h148
1 files changed, 4 insertions, 144 deletions
diff --git a/newlib/libc/sys/rtems/include/machine/_time.h b/newlib/libc/sys/rtems/include/machine/_time.h
index 44a220d92..dd69bd665 100644
--- a/newlib/libc/sys/rtems/include/machine/_time.h
+++ b/newlib/libc/sys/rtems/include/machine/_time.h
@@ -32,7 +32,7 @@
#ifndef _SYS_TIME_H_
#error "must be included via <sys/time.h>"
-#else /* _SYS_TIME_H_ */
+#endif /* !_SYS_TIME_H_ */
__BEGIN_DECLS
extern volatile time_t _Timecounter_Time_second;
@@ -54,146 +54,6 @@ void _Timecounter_Getmicrotime(struct timeval *);
__END_DECLS
#ifdef _KERNEL
-
-/* Operations on timespecs */
-#define timespecclear(tvp) ((tvp)->tv_sec = (tvp)->tv_nsec = 0)
-#define timespecisset(tvp) ((tvp)->tv_sec || (tvp)->tv_nsec)
-#define timespeccmp(tvp, uvp, cmp) \
- (((tvp)->tv_sec == (uvp)->tv_sec) ? \
- ((tvp)->tv_nsec cmp (uvp)->tv_nsec) : \
- ((tvp)->tv_sec cmp (uvp)->tv_sec))
-#define timespecadd(vvp, uvp) \
- do { \
- (vvp)->tv_sec += (uvp)->tv_sec; \
- (vvp)->tv_nsec += (uvp)->tv_nsec; \
- if ((vvp)->tv_nsec >= 1000000000) { \
- (vvp)->tv_sec++; \
- (vvp)->tv_nsec -= 1000000000; \
- } \
- } while (0)
-#define timespecsub(vvp, uvp) \
- do { \
- (vvp)->tv_sec -= (uvp)->tv_sec; \
- (vvp)->tv_nsec -= (uvp)->tv_nsec; \
- if ((vvp)->tv_nsec < 0) { \
- (vvp)->tv_sec--; \
- (vvp)->tv_nsec += 1000000000; \
- } \
- } while (0)
-
-/* Operations on timevals. */
-
-#define timevalclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)
-#define timevalisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
-#define timevalcmp(tvp, uvp, cmp) \
- (((tvp)->tv_sec == (uvp)->tv_sec) ? \
- ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
- ((tvp)->tv_sec cmp (uvp)->tv_sec))
-
-/* timevaladd and timevalsub are not inlined */
-
-/*
- * Kernel to clock driver interface.
- */
-void inittodr(time_t base);
-void resettodr(void);
-
-#define time_second _Timecounter_Time_second
-#define time_uptime _Timecounter_Time_uptime
-#define boottimebin _Timecounter_Boottimebin
-extern struct timeval boottime;
-extern struct bintime tc_tick_bt;
-extern sbintime_t tc_tick_sbt;
-extern struct bintime tick_bt;
-extern sbintime_t tick_sbt;
-extern int tc_precexp;
-extern int tc_timepercentage;
-extern struct bintime bt_timethreshold;
-extern struct bintime bt_tickthreshold;
-extern sbintime_t sbt_timethreshold;
-extern sbintime_t sbt_tickthreshold;
-
-/*
- * Functions for looking at our clock: [get]{bin,nano,micro}[up]time()
- *
- * Functions without the "get" prefix returns the best timestamp
- * we can produce in the given format.
- *
- * "bin" == struct bintime == seconds + 64 bit fraction of seconds.
- * "nano" == struct timespec == seconds + nanoseconds.
- * "micro" == struct timeval == seconds + microseconds.
- *
- * Functions containing "up" returns time relative to boot and
- * should be used for calculating time intervals.
- *
- * Functions without "up" returns UTC time.
- *
- * Functions with the "get" prefix returns a less precise result
- * much faster than the functions without "get" prefix and should
- * be used where a precision of 1/hz seconds is acceptable or where
- * performance is priority. (NB: "precision", _not_ "resolution" !)
- */
-
-#define binuptime(_bt) _Timecounter_Binuptime(_bt)
-#define nanouptime(_tsp) _Timecounter_Nanouptime(_tsp)
-#define microuptime(_tvp) _Timecounter_Microuptime(_tvp)
-
-static __inline sbintime_t
-sbinuptime(void)
-{
- struct bintime _bt;
-
- binuptime(&_bt);
- return (bttosbt(_bt));
-}
-
-#define bintime(_bt) _Timecounter_Bintime(_bt)
-#define nanotime(_tsp) _Timecounter_Nanotime(_tsp)
-#define microtime(_tvp) _Timecounter_Microtime(_tvp)
-
-#define getbinuptime(_bt) _Timecounter_Getbinuptime(_bt)
-#define getnanouptime(_tsp) _Timecounter_Getnanouptime(_tsp)
-#define getmicrouptime(_tvp) _Timecounter_Getmicrouptime(_tvp)
-
-static __inline sbintime_t
-getsbinuptime(void)
-{
- struct bintime _bt;
-
- getbinuptime(&_bt);
- return (bttosbt(_bt));
-}
-
-#define getbintime(_bt) _Timecounter_Getbintime(_bt)
-#define getnanotime(_tsp) _Timecounter_Getnanotime(_tsp)
-#define getmicrotime(_tvp) _Timecounter_Getmicrotime(_tvp)
-
-/* Other functions */
-int itimerdecr(struct itimerval *itp, int usec);
-int itimerfix(struct timeval *tv);
-int ppsratecheck(struct timeval *, int *, int);
-int ratecheck(struct timeval *, const struct timeval *);
-void timevaladd(struct timeval *t1, const struct timeval *t2);
-void timevalsub(struct timeval *t1, const struct timeval *t2);
-int tvtohz(struct timeval *tv);
-
-#define TC_DEFAULTPERC 5
-
-#define BT2FREQ(bt) \
- (((uint64_t)0x8000000000000000 + ((bt)->frac >> 2)) / \
- ((bt)->frac >> 1))
-
-#define SBT2FREQ(sbt) ((SBT_1S + ((sbt) >> 1)) / (sbt))
-
-#define FREQ2BT(freq, bt) \
-{ \
- (bt)->sec = 0; \
- (bt)->frac = ((uint64_t)0x8000000000000000 / (freq)) << 1; \
-}
-
-#define TIMESEL(sbt, sbt2) \
- (((sbt2) >= sbt_timethreshold) ? \
- ((*(sbt) = getsbinuptime()), 1) : ((*(sbt) = sbinuptime()), 0))
-
-#endif /* _KERNEL */
-#endif /* _SYS_TIME_H_ */
+/* Header file provided outside of Newlib */
+#include <machine/_kernel_time.h>
+#endif