RTEMS 6.1-rc2
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions | Variables
kern_ntptime.c File Reference

This source file contains the implementation of ntp_gettime(), ntp_adjtime(), adjtime(), and _Timecounter_NTP_update_second(). More...

#include <sys/cdefs.h>
#include "opt_ntp.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/sysproto.h>
#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/time.h>
#include <sys/timex.h>
#include <sys/timetc.h>
#include <sys/timepps.h>
#include <sys/syscallsubr.h>
#include <sys/sysctl.h>

Data Structures

struct  ntp_gettime_args
 
struct  ntp_adjtime_args
 
struct  adjtime_args
 

Macros

#define L_ADD(v, u)   ((v) += (u))
 
#define L_SUB(v, u)   ((v) -= (u))
 
#define L_ADDHI(v, a)   ((v) += (int64_t)(a) << 32)
 
#define L_NEG(v)   ((v) = -(v))
 
#define L_RSHIFT(v, n)
 
#define L_MPY(v, a)   ((v) *= (a))
 
#define L_CLR(v)   ((v) = 0)
 
#define L_ISNEG(v)   ((v) < 0)
 
#define L_LINT(v, a)   ((v) = (int64_t)(a) << 32)
 
#define L_GINT(v)   ((v) < 0 ? -(-(v) >> 32) : (v) >> 32)
 
#define SHIFT_PLL   4 /* PLL loop gain (shift) */
 
#define SHIFT_FLL   2 /* FLL loop gain (shift) */
 
#define NTP_LOCK()   mtx_lock_spin(&ntp_lock)
 
#define NTP_UNLOCK()   mtx_unlock_spin(&ntp_lock)
 
#define NTP_ASSERT_LOCKED()   mtx_assert(&ntp_lock, MA_OWNED)
 

Typedefs

typedef int64_t l_fp
 

Functions

 __FBSDID ("$FreeBSD$")
 
 MTX_SYSINIT (ntp, &ntp_lock, "ntp", MTX_SPIN)
 
int sys_ntp_gettime (struct thread *td, struct ntp_gettime_args *uap)
 
 SYSCTL_NODE (_kern, OID_AUTO, ntp_pll, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "")
 
 SYSCTL_PROC (_kern_ntp_pll, OID_AUTO, gettime, CTLTYPE_OPAQUE|CTLFLAG_RD|CTLFLAG_MPSAFE, 0, sizeof(struct ntptimeval), ntp_sysctl, "S,ntptimeval", "")
 
int kern_ntp_adjtime (struct thread *td, struct timex *ntv, int *retvalp)
 
int sys_ntp_adjtime (struct thread *td, struct ntp_adjtime_args *uap)
 
void ntp_update_second (int64_t *adjustment, time_t *newsec)
 
int sys_adjtime (struct thread *td, struct adjtime_args *uap)
 
int kern_adjtime (struct thread *td, struct timeval *delta, struct timeval *olddelta)
 
 SYSCTL_PROC (_machdep, OID_AUTO, rtc_save_period, CTLTYPE_INT|CTLFLAG_RWTUN|CTLFLAG_MPSAFE, &resettodr_period, 1800, sysctl_resettodr_period, "I", "Save system time to RTC with this period (in seconds)")
 
 SYSINIT (periodic_resettodr, SI_SUB_LAST, SI_ORDER_MIDDLE, start_periodic_resettodr, NULL)
 

Variables

int time_status = STA_UNSYNC
 
long time_esterror = MAXPHASE / 1000
 

Detailed Description

This source file contains the implementation of ntp_gettime(), ntp_adjtime(), adjtime(), and _Timecounter_NTP_update_second().

Macro Definition Documentation

◆ L_RSHIFT

#define L_RSHIFT (   v,
 
)
Value:
do { \
if ((v) < 0) \
(v) = -(-(v) >> (n)); \
else \
(v) = (v) >> (n); \
} while (0)