The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/timetc.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * ----------------------------------------------------------------------------
    3  * "THE BEER-WARE LICENSE" (Revision 42):
    4  * <phk@FreeBSD.ORG> wrote this file.  As long as you retain this notice you
    5  * can do whatever you want with this stuff. If we meet some day, and you think
    6  * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
    7  * ----------------------------------------------------------------------------
    8  *
    9  * $FreeBSD: releng/8.1/sys/sys/timetc.h 199583 2009-11-20 15:27:52Z jhb $
   10  */
   11 
   12 #ifndef _SYS_TIMETC_H_
   13 #define _SYS_TIMETC_H_
   14 
   15 #ifndef _KERNEL
   16 #error "no user-serviceable parts inside"
   17 #endif
   18 
   19 /*-
   20  * `struct timecounter' is the interface between the hardware which implements
   21  * a timecounter and the MI code which uses this to keep track of time.
   22  *
   23  * A timecounter is a binary counter which has two properties:
   24  *    * it runs at a fixed, known frequency.
   25  *    * it has sufficient bits to not roll over in less than approximately
   26  *      max(2 msec, 2/HZ seconds).  (The value 2 here is really 1 + delta,
   27  *      for some indeterminate value of delta.)
   28  */
   29 
   30 struct timecounter;
   31 typedef u_int timecounter_get_t(struct timecounter *);
   32 typedef void timecounter_pps_t(struct timecounter *);
   33 
   34 struct timecounter {
   35         timecounter_get_t       *tc_get_timecount;
   36                 /*
   37                  * This function reads the counter.  It is not required to
   38                  * mask any unimplemented bits out, as long as they are
   39                  * constant.
   40                  */
   41         timecounter_pps_t       *tc_poll_pps;
   42                 /*
   43                  * This function is optional.  It will be called whenever the
   44                  * timecounter is rewound, and is intended to check for PPS
   45                  * events.  Normal hardware does not need it but timecounters
   46                  * which latch PPS in hardware (like sys/pci/xrpu.c) do.
   47                  */
   48         u_int                   tc_counter_mask;
   49                 /* This mask should mask off any unimplemented bits. */
   50         u_int64_t               tc_frequency;
   51                 /* Frequency of the counter in Hz. */
   52         char                    *tc_name;
   53                 /* Name of the timecounter. */
   54         int                     tc_quality;
   55                 /*
   56                  * Used to determine if this timecounter is better than
   57                  * another timecounter higher means better.  Negative
   58                  * means "only use at explicit request".
   59                  */
   60 
   61         void                    *tc_priv;
   62                 /* Pointer to the timecounter's private parts. */
   63         struct timecounter      *tc_next;
   64                 /* Pointer to the next timecounter. */
   65 };
   66 
   67 extern struct timecounter *timecounter;
   68 
   69 u_int64_t tc_getfrequency(void);
   70 void    tc_init(struct timecounter *tc);
   71 void    tc_setclock(struct timespec *ts);
   72 void    tc_ticktock(void);
   73 
   74 #ifdef SYSCTL_DECL
   75 SYSCTL_DECL(_kern_timecounter);
   76 #endif
   77 
   78 #endif /* !_SYS_TIMETC_H_ */

Cache object: 0c10f1096ee5b8ebf551a95fb5bce713


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.