RTEMS 6.1-rc1
Data Structures | Macros | Functions | Variables
kern_tc.c File Reference

This source file contains the definition of _Timecounter, _Timecounter_Time_second, and _Timecounter_Time_uptime and the implementation of _Timecounter_Set_NTP_update_second(), _Timecounter_Binuptime(), _Timecounter_Nanouptime(), _Timecounter_Microuptime(), _Timecounter_Bintime(), _Timecounter_Nanotime(), _Timecounter_Microtime(), _Timecounter_Getbinuptime(), _Timecounter_Getnanouptime(), _Timecounter_Getmicrouptime(), _Timecounter_Getbintime(), _Timecounter_Getnanotime(), _Timecounter_Getmicrotime(), _Timecounter_Getboottime(), _Timecounter_Getboottimebin(), and _Timecounter_Install(). More...

#include <sys/cdefs.h>
#include "opt_ntp.h"
#include "opt_ffclock.h"
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/sbuf.h>
#include <sys/sleepqueue.h>
#include <sys/sysctl.h>
#include <sys/syslog.h>
#include <sys/systm.h>
#include <sys/timeffc.h>
#include <sys/timepps.h>
#include <sys/timetc.h>
#include <sys/timex.h>
#include <sys/vdso.h>
#include "opt_ddb.h"

Data Structures

struct  timehands
 

Macros

#define LARGE_STEP   200
 
#define GETTHBINTIME(dst, member)
 
#define GETTHMEMBER(dst, member)
 

Functions

 __FBSDID ("$FreeBSD$")
 
 SYSCTL_PROC (_kern, KERN_BOOTTIME, boottime, CTLTYPE_STRUCT|CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, 0, sysctl_kern_boottime, "S,timeval", "Estimated system boottime")
 
 SYSCTL_NODE (_kern, OID_AUTO, timecounter, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "")
 
 SYSCTL_INT (_kern_timecounter, OID_AUTO, stepwarnings, CTLFLAG_RWTUN, &timestepwarnings, 0, "Log time steps")
 
 SYSCTL_INT (_kern_timecounter, OID_AUTO, timehands_count, CTLFLAG_RDTUN|CTLFLAG_NOFETCH, &timehands_count, 0, "Count of timehands in rotation")
 
 SYSCTL_PROC (_kern_timecounter, OID_AUTO, alloweddeviation, CTLTYPE_INT|CTLFLAG_RWTUN|CTLFLAG_MPSAFE, 0, 0, sysctl_kern_timecounter_adjprecision, "I", "Allowed time interval deviation in percents")
 
void dtrace_getnanotime (struct timespec *tsp)
 
void dtrace_getnanouptime (struct timespec *tsp)
 
void binuptime (struct bintime *bt)
 
void nanouptime (struct timespec *tsp)
 
void microuptime (struct timeval *tvp)
 
void bintime (struct bintime *bt)
 
void nanotime (struct timespec *tsp)
 
void microtime (struct timeval *tvp)
 
void getbinuptime (struct bintime *bt)
 
void getnanouptime (struct timespec *tsp)
 
void getmicrouptime (struct timeval *tvp)
 
void getbintime (struct bintime *bt)
 
void getnanotime (struct timespec *tsp)
 
void getmicrotime (struct timeval *tvp)
 
void getboottime (struct timeval *boottime)
 
void getboottimebin (struct bintime *boottimebin)
 
void sysclock_getsnapshot (struct sysclock_snap *clock_snap, int fast)
 
int sysclock_snap2bintime (struct sysclock_snap *cs, struct bintime *bt, int whichclock, uint32_t flags)
 
void tc_init (struct timecounter *tc)
 
uint64_t tc_getfrequency (void)
 
 MTX_SYSINIT (tc_setclock_init, &tc_setclock_mtx, "tcsetc", MTX_SPIN)
 
void tc_setclock (struct timespec *ts)
 
 SYSCTL_PROC (_kern_timecounter, OID_AUTO, hardware, CTLTYPE_STRING|CTLFLAG_RWTUN|CTLFLAG_NOFETCH|CTLFLAG_MPSAFE, 0, 0, sysctl_kern_timecounter_hardware, "A", "Timecounter hardware selected")
 
 SYSCTL_PROC (_kern_timecounter, OID_AUTO, choice, CTLTYPE_STRING|CTLFLAG_RD|CTLFLAG_MPSAFE, 0, 0, sysctl_kern_timecounter_choice, "A", "Timecounter hardware detected")
 
int pps_ioctl (u_long cmd, caddr_t data, struct pps_state *pps)
 
void pps_init (struct pps_state *pps)
 
void pps_init_abi (struct pps_state *pps)
 
void pps_capture (struct pps_state *pps)
 
void pps_event (struct pps_state *pps, int event)
 
 SYSCTL_INT (_kern_timecounter, OID_AUTO, tick, CTLFLAG_RD, &tc_tick, 0, "Approximate number of hardclock ticks in a millisecond")
 
void tc_ticktock (int cnt)
 
 SYSINIT (timehands, SI_SUB_TUNABLES, SI_ORDER_ANY, inittimehands, NULL)
 
 SYSINIT (timecounter, SI_SUB_CLOCKS, SI_ORDER_SECOND, inittimecounter, NULL)
 
 DPCPU_DEFINE_STATIC (uint64_t, tc_cpu_ticks_base)
 
 DPCPU_DEFINE_STATIC (unsigned, tc_cpu_ticks_last)
 
void cpu_tick_calibration (void)
 
void set_cputicker (cpu_tick_f *func, uint64_t freq, bool isvariable)
 
uint64_t cpu_tickrate (void)
 
uint64_t cputick2usec (uint64_t tick)
 
 SYSCTL_PROC (_kern_timecounter, OID_AUTO, fast_gettime, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MPSAFE, NULL, 0, sysctl_fast_gettime, "I", "Enable fast time of day")
 
uint32_t tc_fill_vdso_timehands (struct vdso_timehands *vdso_th)
 

Variables

struct timecountertimecounter = &dummy_timecounter
 
int tc_min_ticktock_freq = 1
 
volatile time_t time_second = 1
 
volatile time_t time_uptime = 1
 
struct bintime bt_timethreshold
 
struct bintime bt_tickthreshold
 
sbintime_t sbt_timethreshold
 
sbintime_t sbt_tickthreshold
 
struct bintime tc_tick_bt
 
sbintime_t tc_tick_sbt
 
int tc_precexp
 
int tc_timepercentage = TC_DEFAULTPERC
 
volatile int rtc_generation = 1
 
int time_status
 
long time_esterror
 
cpu_tick_f * cpu_ticks = tc_cpu_ticks
 

Detailed Description

This source file contains the definition of _Timecounter, _Timecounter_Time_second, and _Timecounter_Time_uptime and the implementation of _Timecounter_Set_NTP_update_second(), _Timecounter_Binuptime(), _Timecounter_Nanouptime(), _Timecounter_Microuptime(), _Timecounter_Bintime(), _Timecounter_Nanotime(), _Timecounter_Microtime(), _Timecounter_Getbinuptime(), _Timecounter_Getnanouptime(), _Timecounter_Getmicrouptime(), _Timecounter_Getbintime(), _Timecounter_Getnanotime(), _Timecounter_Getmicrotime(), _Timecounter_Getboottime(), _Timecounter_Getboottimebin(), and _Timecounter_Install().

Macro Definition Documentation

◆ GETTHBINTIME

#define GETTHBINTIME (   dst,
  member 
)
Value:
do { \
_Static_assert(_Generic(((struct timehands *)NULL)->member, \
struct bintime: 1, default: 0) == 1, \
"struct timehands member is not of struct bintime type"); \
bintime_off(dst, __offsetof(struct timehands, member)); \
} while (0)
#define NULL
Requests a GPIO pin group configuration.
Definition: xil_types.h:54
Definition: kern_tc.c:197

◆ GETTHMEMBER

#define GETTHMEMBER (   dst,
  member 
)
Value:
do { \
_Static_assert(_Generic(*dst, \
__typeof(((struct timehands *)NULL)->member): 1, \
default: 0) == 1, \
"*dst and struct timehands member have different types"); \
getthmember(dst, sizeof(*dst), __offsetof(struct timehands, \
member)); \
} while (0)