RTEMS 6.3
Loading...
Searching...
No Matches
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)
#define L_SUB(v, u)
#define L_ADDHI(v, a)
#define L_NEG(v)
#define L_RSHIFT(v, n)
#define L_MPY(v, a)
#define L_CLR(v)
#define L_ISNEG(v)
#define L_LINT(v, a)
#define L_GINT(v)
#define SHIFT_PLL   4
#define SHIFT_FLL   2
#define NTP_LOCK()
#define NTP_UNLOCK()
#define NTP_ASSERT_LOCKED()

Typedefs

typedef int64_t l_fp

Functions

 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_ADD

#define L_ADD ( v,
u )
Value:
((v) += (u))

◆ L_ADDHI

#define L_ADDHI ( v,
a )
Value:
((v) += (int64_t)(a) << 32)

◆ L_CLR

#define L_CLR ( v)
Value:
((v) = 0)

◆ L_GINT

#define L_GINT ( v)
Value:
((v) < 0 ? -(-(v) >> 32) : (v) >> 32)

◆ L_ISNEG

#define L_ISNEG ( v)
Value:
((v) < 0)

◆ L_LINT

#define L_LINT ( v,
a )
Value:
do { \
if ((a) < 0) \
((v) = -((int64_t)(-(a)) << 32)); \
else \
((v) = (int64_t)(a) << 32); \
} while (0)

◆ L_MPY

#define L_MPY ( v,
a )
Value:
((v) *= (a))

◆ L_NEG

#define L_NEG ( v)
Value:
((v) = -(v))

◆ L_RSHIFT

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

◆ L_SUB

#define L_SUB ( v,
u )
Value:
((v) -= (u))

◆ NTP_ASSERT_LOCKED

#define NTP_ASSERT_LOCKED ( )
Value:
mtx_assert(&ntp_lock, MA_OWNED)

◆ NTP_LOCK

#define NTP_LOCK ( )
Value:
mtx_lock_spin(&ntp_lock)

◆ NTP_UNLOCK

#define NTP_UNLOCK ( )
Value:
mtx_unlock_spin(&ntp_lock)