diff options
author | phk <phk@FreeBSD.org> | 2002-04-30 19:48:45 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2002-04-30 19:48:45 +0000 |
commit | 38a094562477fb54e0d05ac941e9905cb4db6679 (patch) | |
tree | fa4f35e990b8f2443cde9eaca57fc49c9f502ece /sys | |
parent | 2131cb82704793b326e53f2d0e8d0c1b55190d23 (diff) | |
download | FreeBSD-src-38a094562477fb54e0d05ac941e9905cb4db6679.zip FreeBSD-src-38a094562477fb54e0d05ac941e9905cb4db6679.tar.gz |
Brucifixion ? Yes, out that door, row on the left, one patch each.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/sys/time.h | 37 | ||||
-rw-r--r-- | sys/sys/timepps.h | 34 | ||||
-rw-r--r-- | sys/sys/timetc.h | 34 |
3 files changed, 51 insertions, 54 deletions
diff --git a/sys/sys/time.h b/sys/sys/time.h index 8a66105..5236549 100644 --- a/sys/sys/time.h +++ b/sys/sys/time.h @@ -79,11 +79,9 @@ struct timezone { #define DST_EET 5 /* Eastern European dst */ #define DST_CAN 6 /* Canada */ -/* start of struct bintime stuff */ - struct bintime { - time_t sec; - uint64_t frac; + time_t sec; + uint64_t frac; }; static __inline void @@ -133,7 +131,6 @@ bintime_sub(struct bintime *bt, struct bintime *bt2) * Even at 15:59:59.999999999 it's not four'o'clock. * * time_second ticks after N.999999999 not after N.4999999999 - * */ static __inline void @@ -141,8 +138,7 @@ bintime2timespec(struct bintime *bt, struct timespec *ts) { ts->tv_sec = bt->sec; - ts->tv_nsec = - ((uint64_t)1000000000 * (uint32_t)(bt->frac >> 32)) >> 32; + ts->tv_nsec = ((uint64_t)1000000000 * (uint32_t)(bt->frac >> 32)) >> 32; } static __inline void @@ -159,8 +155,7 @@ bintime2timeval(struct bintime *bt, struct timeval *tv) { tv->tv_sec = bt->sec; - tv->tv_usec = - ((uint64_t)1000000 * (uint32_t)(bt->frac >> 32)) >> 32; + tv->tv_usec = ((uint64_t)1000000 * (uint32_t)(bt->frac >> 32)) >> 32; } static __inline void @@ -172,8 +167,6 @@ timeval2bintime(struct timeval *tv, struct bintime *bt) bt->frac = tv->tv_usec * (uint64_t)18446744073709LL; } -/* end of struct bintime stuff */ - #ifdef _KERNEL /* Operations on timespecs */ @@ -282,7 +275,7 @@ struct clockinfo { #ifdef _KERNEL extern time_t time_second; -/*- +/* * Functions for looking at our clock: [get]{bin,nano,micro}[up]time() * * Functions without the "get" prefix returns the best timestamp @@ -305,27 +298,27 @@ extern time_t time_second; */ void binuptime(struct bintime *bt); -void nanouptime(struct timespec *ts); -void microuptime(struct timeval *tv); +void nanouptime(struct timespec *tsp); +void microuptime(struct timeval *tvp); void bintime(struct bintime *bt); -void nanotime(struct timespec *ts); -void microtime(struct timeval *tv); +void nanotime(struct timespec *tsp); +void microtime(struct timeval *tvp); void getbinuptime(struct bintime *bt); void getnanouptime(struct timespec *tsp); -void getmicrouptime(struct timeval *tv); +void getmicrouptime(struct timeval *tvp); void getbintime(struct bintime *bt); void getnanotime(struct timespec *tsp); -void getmicrotime(struct timeval *tv); +void getmicrotime(struct timeval *tvp); -/* other prototypes */ +/* Other functions */ int itimerdecr(struct itimerval *itp, int usec); int itimerfix(struct timeval *tv); -void timevaladd(struct timeval *, struct timeval *); -void timevalsub(struct timeval *, struct timeval *); -int tvtohz(struct timeval *); +void timevaladd(struct timeval *t1, struct timeval *t2); +void timevalsub(struct timeval *t1, struct timeval *t2); +int tvtohz(struct timeval *tv); #else /* !_KERNEL */ #include <time.h> diff --git a/sys/sys/timepps.h b/sys/sys/timepps.h index a3daaca..5fe54de 100644 --- a/sys/sys/timepps.h +++ b/sys/sys/timepps.h @@ -16,6 +16,7 @@ #define _SYS_TIMEPPS_H_ #include <sys/ioccom.h> +#include <sys/time.h> #define PPS_API_VERS_1 1 @@ -103,26 +104,26 @@ struct pps_kcbind_args { #define PPS_IOC_KCBIND _IOW('1', 7, struct pps_kcbind_args) #ifdef _KERNEL -struct timehands; -struct timecounter; + struct pps_state { - /* capture information */ - struct timehands *capth; - u_int capgen; - u_int capcount; - /* state information */ - pps_params_t ppsparam; - pps_info_t ppsinfo; - int kcmode; - int ppscap; - struct timecounter *ppstc; - unsigned ppscount[3]; + /* Capture information. */ + struct timehands *capth; + unsigned capgen; + unsigned capcount; + + /* State information. */ + pps_params_t ppsparam; + pps_info_t ppsinfo; + int kcmode; + int ppscap; + struct timecounter *ppstc; + unsigned ppscount[3]; }; void pps_capture(struct pps_state *pps); void pps_event(struct pps_state *pps, int event); void pps_init(struct pps_state *pps); -int pps_ioctl(u_long cmd, caddr_t data, struct pps_state *pps); +int pps_ioctl(unsigned long cmd, caddr_t data, struct pps_state *pps); void hardpps(struct timespec *tsp, long nsec); #else /* !_KERNEL */ @@ -194,5 +195,6 @@ time_pps_kcbind(pps_handle_t handle, const int kernel_consumer, return (ioctl(handle, PPS_IOC_KCBIND, &arg)); } -#endif /* !_KERNEL */ -#endif /* _SYS_TIMEPPS_H_ */ +#endif /* KERNEL */ + +#endif /* !_SYS_TIMEPPS_H_ */ diff --git a/sys/sys/timetc.h b/sys/sys/timetc.h index eabedd4..20356b5 100644 --- a/sys/sys/timetc.h +++ b/sys/sys/timetc.h @@ -1,4 +1,4 @@ -/* +/*- * ---------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 42): * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you @@ -10,18 +10,21 @@ */ #ifndef _SYS_TIMETC_H_ -#define _SYS_TIMETC_H_ +#define _SYS_TIMETC_H_ -/* - * Struct timecounter is the interface between the hardware which implements +#ifndef _KERNEL +#error "no user-serviceable parts inside" +#endif + +/*- + * `struct timecounter' is the interface between the hardware which implements * a timecounter and the MI code which uses this to keep track of time. * * A timecounter is a binary counter which has two properties: * * it runs at a fixed, known frequency. - * * it has sufficient bits to not roll over in faster than approx - * 2 msec or 2/hz, whichever is faster. (The value of 2 here is - * really 1 + delta, for some indeterminate value of delta). - * + * * it has sufficient bits to not roll over in less than approximately + * max(2 msec, 2/HZ seconds). (The value 2 here is really 1 + delta, + * for some indeterminate value of delta.) */ struct timecounter; @@ -37,28 +40,27 @@ struct timecounter { */ timecounter_pps_t *tc_poll_pps; /* - * This function is optional, it will be called whenever the + * This function is optional. It will be called whenever the * timecounter is rewound, and is intended to check for PPS - * events. Most hardware do not need it. + * events. Normal hardware does not need it but timecounters + * which latch PPS in hardware (like sys/pci/xrpu.c) do. */ u_int tc_counter_mask; - /* This mask should mask off any unimplemnted bits. */ + /* This mask should mask off any unimplemented bits. */ u_int32_t tc_frequency; /* Frequency of the counter in Hz. */ char *tc_name; - /* Name of the counter. */ + /* Name of the timecounter. */ void *tc_priv; - /* Pointer to the counters private parts. */ + /* Pointer to the timecounter's private parts. */ struct timecounter *tc_next; - /* Initialize this to NUL */ + /* Pointer to the next timecounter. */ }; -#ifdef _KERNEL extern struct timecounter *timecounter; u_int32_t tc_getfrequency(void); void tc_init(struct timecounter *tc); void tc_setclock(struct timespec *ts); -#endif /* !_KERNEL */ #endif /* !_SYS_TIMETC_H_ */ |