Commit bb38580a authored by Alessandro Rubini's avatar Alessandro Rubini

overall: use time operations

The time operations are get, set and adjust. They are methods of a
single structure in order to simplify use of custom timers (and make
them separate works according to the LGPL).

This patch set introduces specific <arch>-time.c files where all the
timing stuff lives (not much, actually). Sometimes this turns
<arch>-io.c into an almost-empty file, but that how history changes
stuff.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 58ca782f
...@@ -13,6 +13,7 @@ OBJ-libarch := $A/bare-startup.o \ ...@@ -13,6 +13,7 @@ OBJ-libarch := $A/bare-startup.o \
$A/bare-socket.o \ $A/bare-socket.o \
$A/bare-timer.o \ $A/bare-timer.o \
$A/bare-io.o \ $A/bare-io.o \
$A/bare-time.o \
$A/syscalls.o \ $A/syscalls.o \
lib/libc-functions.o \ lib/libc-functions.o \
lib/div64.o lib/div64.o
......
/* /*
* Alessandro Rubini for CERN, 2011 -- GPL 2 or later (it includes u-boot code) * Alessandro Rubini for CERN, 2011 -- public domain
*/ */
#include <ppsi/ppsi.h> #include <ppsi/ppsi.h>
#include <ppsi/diag.h>
#include "bare-i386.h" #include "bare-i386.h"
void pp_puts(const char *s) void pp_puts(const char *s)
...@@ -10,59 +9,3 @@ void pp_puts(const char *s) ...@@ -10,59 +9,3 @@ void pp_puts(const char *s)
sys_write(0, s, strnlen(s, 300)); sys_write(0, s, strnlen(s, 300));
} }
void bare_get_tstamp(TimeInternal *t)
{
struct bare_timeval tv;
if (sys_gettimeofday(&tv, NULL) < 0) {
PP_PRINTF("gettimeofday error");
sys_exit(0);
}
t->seconds = tv.tv_sec;
t->nanoseconds = tv.tv_usec * 1000;
}
int32_t bare_set_tstamp(TimeInternal *t)
{
struct bare_timeval tv_orig;
struct bare_timeval tv;
if (sys_gettimeofday(&tv_orig, NULL) < 0) {
PP_PRINTF("gettimeofday error");
sys_exit(0);
}
tv.tv_sec = t->seconds;
tv.tv_usec = t->nanoseconds / 1000;
if (sys_settimeofday(&tv, NULL) < 0) {
PP_PRINTF("settimeofday error");
sys_exit(0);
}
return tv.tv_sec - tv_orig.tv_sec;
}
int bare_adj_freq(Integer32 adj)
{
struct bare_timex t;
if (adj > PP_ADJ_FREQ_MAX)
adj = PP_ADJ_FREQ_MAX;
if (adj < -PP_ADJ_FREQ_MAX)
adj = -PP_ADJ_FREQ_MAX;
t.modes = MOD_FREQUENCY;
t.freq = adj * ((1 << 16) / 1000);
return sys_adjtimex(&t);
}
int32_t pp_set_tstamp(TimeInternal *t)
__attribute__((alias("bare_set_tstamp")));
void pp_get_tstamp(TimeInternal *t)
__attribute__((alias("bare_get_tstamp")));
int pp_adj_freq(Integer32 adj)
__attribute__((alias("bare_adj_freq")));
...@@ -15,7 +15,7 @@ static int bare_net_recv(struct pp_instance *ppi, void *pkt, int len, ...@@ -15,7 +15,7 @@ static int bare_net_recv(struct pp_instance *ppi, void *pkt, int len,
TimeInternal *t) TimeInternal *t)
{ {
if (t) if (t)
pp_get_tstamp(t); pp_t_ops.get(t);
return sys_recv(NP(ppi)->ch[PP_NP_GEN].fd, return sys_recv(NP(ppi)->ch[PP_NP_GEN].fd,
pkt - NP(ppi)->proto_ofst, len, 0); pkt - NP(ppi)->proto_ofst, len, 0);
...@@ -37,7 +37,7 @@ static int bare_net_send(struct pp_instance *ppi, void *pkt, int len, ...@@ -37,7 +37,7 @@ static int bare_net_send(struct pp_instance *ppi, void *pkt, int len,
memcpy(hdr->h_source, NP(ppi)->ch[PP_NP_GEN].addr, 6); memcpy(hdr->h_source, NP(ppi)->ch[PP_NP_GEN].addr, 6);
if (t) if (t)
pp_get_tstamp(t); pp_t_ops.get(t);
return sys_send(NP(ppi)->ch[chtype].fd, hdr, return sys_send(NP(ppi)->ch[chtype].fd, hdr,
len + NP(ppi)->proto_ofst, 0); len + NP(ppi)->proto_ofst, 0);
......
/*
* Alessandro Rubini for CERN, 2013 -- LGPL 2.1 or later
*/
#include <ppsi/ppsi.h>
#include "bare-i386.h"
static int bare_time_get(TimeInternal *t)
{
struct bare_timeval tv;
if (sys_gettimeofday(&tv, NULL) < 0) {
PP_PRINTF("gettimeofday error");
sys_exit(0);
}
t->seconds = tv.tv_sec;
t->nanoseconds = tv.tv_usec * 1000;
return 0;
}
static int bare_time_set(TimeInternal *t)
{
struct bare_timeval tv;
tv.tv_sec = t->seconds;
tv.tv_usec = t->nanoseconds / 1000;
if (sys_settimeofday(&tv, NULL) < 0) {
PP_PRINTF("settimeofday error");
sys_exit(0);
}
return 0;
}
static int bare_time_adjust(long offset_ns, long freq_ppm)
{
struct bare_timex t;
if (freq_ppm > PP_ADJ_FREQ_MAX)
freq_ppm = PP_ADJ_FREQ_MAX;
if (freq_ppm < -PP_ADJ_FREQ_MAX)
freq_ppm = -PP_ADJ_FREQ_MAX;
t.offset = offset_ns / 1000;
t.freq = freq_ppm; /* was: "adj * ((1 << 16) / 1000)" */
t.modes = MOD_FREQUENCY | MOD_OFFSET;
return sys_adjtimex(&t);
}
struct pp_time_operations pp_t_ops = {
.get = bare_time_get,
.set = bare_time_set,
.adjust = bare_time_adjust,
};
...@@ -13,6 +13,7 @@ OBJ-libarch := $A/bare-startup.o \ ...@@ -13,6 +13,7 @@ OBJ-libarch := $A/bare-startup.o \
$A/bare-socket.o \ $A/bare-socket.o \
$A/bare-timer.o \ $A/bare-timer.o \
$A/bare-io.o \ $A/bare-io.o \
$A/bare-time.o \
$A/syscall.o \ $A/syscall.o \
$A/syscalls.o \ $A/syscalls.o \
lib/libc-functions.o \ lib/libc-functions.o \
......
/* /*
* Alessandro Rubini for CERN, 2011 -- GPL 2 or later (it includes u-boot code) * Alessandro Rubini for CERN, 2011 -- public domain
*/ */
#include <ppsi/ppsi.h> #include <ppsi/ppsi.h>
#include <ppsi/diag.h>
#include "bare-x86-64.h" #include "bare-x86-64.h"
void pp_puts(const char *s) void pp_puts(const char *s)
{ {
sys_write(0, s, strnlen(s, 300)); sys_write(0, s, strnlen(s, 300));
} }
void bare_get_tstamp(TimeInternal *t)
{
struct bare_timeval tv;
if (sys_gettimeofday(&tv, NULL) < 0) {
PP_PRINTF("gettimeofday error");
sys_exit(0);
}
t->seconds = tv.tv_sec;
t->nanoseconds = tv.tv_usec * 1000;
}
int32_t bare_set_tstamp(TimeInternal *t)
{
struct bare_timeval tv_orig;
struct bare_timeval tv;
if (sys_gettimeofday(&tv_orig, NULL) < 0) {
PP_PRINTF("gettimeofday error");
sys_exit(0);
}
tv.tv_sec = t->seconds;
tv.tv_usec = t->nanoseconds / 1000;
if (sys_settimeofday(&tv, NULL) < 0) {
PP_PRINTF("settimeofday error");
sys_exit(0);
}
return tv.tv_sec - tv_orig.tv_sec;
}
int bare_adj_freq(Integer32 adj)
{
struct bare_timex t;
if (adj > PP_ADJ_FREQ_MAX)
adj = PP_ADJ_FREQ_MAX;
if (adj < -PP_ADJ_FREQ_MAX)
adj = -PP_ADJ_FREQ_MAX;
t.modes = MOD_FREQUENCY;
t.freq = adj * ((1 << 16) / 1000);
return sys_adjtimex(&t);
}
int32_t pp_set_tstamp(TimeInternal *t)
__attribute__((alias("bare_set_tstamp")));
void pp_get_tstamp(TimeInternal *t)
__attribute__((alias("bare_get_tstamp")));
int pp_adj_freq(Integer32 adj)
__attribute__((alias("bare_adj_freq")));
...@@ -15,7 +15,7 @@ static int bare_net_recv(struct pp_instance *ppi, void *pkt, int len, ...@@ -15,7 +15,7 @@ static int bare_net_recv(struct pp_instance *ppi, void *pkt, int len,
TimeInternal *t) TimeInternal *t)
{ {
if (t) if (t)
pp_get_tstamp(t); pp_t_ops.get(t);
return sys_recv(NP(ppi)->ch[PP_NP_GEN].fd, return sys_recv(NP(ppi)->ch[PP_NP_GEN].fd,
pkt - NP(ppi)->proto_ofst, len, 0); pkt - NP(ppi)->proto_ofst, len, 0);
...@@ -37,7 +37,7 @@ static int bare_net_send(struct pp_instance *ppi, void *pkt, int len, ...@@ -37,7 +37,7 @@ static int bare_net_send(struct pp_instance *ppi, void *pkt, int len,
memcpy(hdr->h_source, NP(ppi)->ch[PP_NP_GEN].addr, 6); memcpy(hdr->h_source, NP(ppi)->ch[PP_NP_GEN].addr, 6);
if (t) if (t)
pp_get_tstamp(t); pp_t_ops.get(t);
return sys_send(NP(ppi)->ch[chtype].fd, hdr, return sys_send(NP(ppi)->ch[chtype].fd, hdr,
len + NP(ppi)->proto_ofst, 0); len + NP(ppi)->proto_ofst, 0);
......
/*
* Alessandro Rubini for CERN, 2013 -- LGPL 2.1 or later
*/
#include <ppsi/ppsi.h>
#include "bare-x86-64.h"
static int bare_time_get(TimeInternal *t)
{
struct bare_timeval tv;
if (sys_gettimeofday(&tv, NULL) < 0) {
PP_PRINTF("gettimeofday error");
sys_exit(0);
}
t->seconds = tv.tv_sec;
t->nanoseconds = tv.tv_usec * 1000;
return 0;
}
static int bare_time_set(TimeInternal *t)
{
struct bare_timeval tv;
tv.tv_sec = t->seconds;
tv.tv_usec = t->nanoseconds / 1000;
if (sys_settimeofday(&tv, NULL) < 0) {
PP_PRINTF("settimeofday error");
sys_exit(0);
}
return 0;
}
static int bare_time_adjust(long offset_ns, long freq_ppm)
{
struct bare_timex t;
if (freq_ppm > PP_ADJ_FREQ_MAX)
freq_ppm = PP_ADJ_FREQ_MAX;
if (freq_ppm < -PP_ADJ_FREQ_MAX)
freq_ppm = -PP_ADJ_FREQ_MAX;
t.offset = offset_ns / 1000;
t.freq = freq_ppm; /* was: "adj * ((1 << 16) / 1000)" */
t.modes = MOD_FREQUENCY | MOD_OFFSET;
return sys_adjtimex(&t);
}
struct pp_time_operations pp_t_ops = {
.get = bare_time_get,
.set = bare_time_set,
.adjust = bare_time_adjust,
};
...@@ -9,6 +9,7 @@ OBJ-libarch := $A/posix-startup.o \ ...@@ -9,6 +9,7 @@ OBJ-libarch := $A/posix-startup.o \
$A/main-loop.o \ $A/main-loop.o \
$A/posix-socket.o \ $A/posix-socket.o \
$A/posix-io.o \ $A/posix-io.o \
$A/posix-time.o \
$A/posix-timer.o \ $A/posix-timer.o \
lib/cmdline.o \ lib/cmdline.o \
lib/div64.o lib/div64.o
......
/* /*
* Alessandro Rubini for CERN, 2011 -- public domain * Alessandro Rubini for CERN, 2011 -- public domain
*/ */
#define _GNU_SOURCE /* for strnlen */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#include <sys/timex.h>
#include <ppsi/ppsi.h> #include <ppsi/ppsi.h>
#include <ppsi/diag.h>
static void clock_fatal_error(char *context) void pp_puts(const char *s)
{
PP_PRINTF("failure in \"%s\": %s\n.Exiting.\n", context,
strerror(errno));
exit(1);
}
void posix_puts(const char *s)
{ {
fputs(s, stdout); fputs(s, stdout);
} }
void posix_get_tstamp(TimeInternal *t)
{
struct timespec tp;
if (clock_gettime(CLOCK_REALTIME, &tp) < 0)
clock_fatal_error("clock_gettime");
t->seconds = tp.tv_sec;
t->nanoseconds = tp.tv_nsec;
}
int32_t posix_set_tstamp(TimeInternal *t)
{
struct timespec tp_orig;
struct timespec tp;
if (clock_gettime(CLOCK_REALTIME, &tp_orig) < 0)
clock_fatal_error("clock_gettime");
tp.tv_sec = t->seconds;
tp.tv_nsec = t->nanoseconds;
if (clock_settime(CLOCK_REALTIME, &tp) < 0)
clock_fatal_error("clock_settime");
return tp.tv_sec - tp_orig.tv_sec; /* handle only sec field, since
* timer granularity is 1s */
}
int posix_adj_freq(Integer32 adj)
{
struct timex t;
if (adj > PP_ADJ_FREQ_MAX)
adj = PP_ADJ_FREQ_MAX;
if (adj < -PP_ADJ_FREQ_MAX)
adj = -PP_ADJ_FREQ_MAX;
t.modes = MOD_FREQUENCY;
t.freq = adj * ((1 << 16) / 1000);
return adjtimex(&t);
}
void pp_puts(const char *s)
__attribute__((alias("posix_puts")));
void pp_get_tstamp(TimeInternal *t)
__attribute__((alias("posix_get_tstamp")));
int32_t pp_set_tstamp(TimeInternal *t)
__attribute__((alias("posix_set_tstamp")));
int pp_adj_freq(Integer32 adj)
__attribute__((alias("posix_adj_freq")));
...@@ -83,7 +83,7 @@ static int posix_recv_msg(int fd, void *pkt, int len, TimeInternal *t) ...@@ -83,7 +83,7 @@ static int posix_recv_msg(int fd, void *pkt, int len, TimeInternal *t)
* spike in the offset signal sent to the clock servo * spike in the offset signal sent to the clock servo
*/ */
PP_VPRINTF("no receive time stamp, getting it in user space\n"); PP_VPRINTF("no receive time stamp, getting it in user space\n");
pp_get_tstamp(t); pp_t_ops.get(t);
} }
return ret; return ret;
} }
...@@ -155,7 +155,7 @@ static int posix_net_send(struct pp_instance *ppi, void *pkt, int len, ...@@ -155,7 +155,7 @@ static int posix_net_send(struct pp_instance *ppi, void *pkt, int len,
addr.sin_addr.s_addr = NP(ppi)->peer_mcast_addr; addr.sin_addr.s_addr = NP(ppi)->peer_mcast_addr;
if (t) if (t)
pp_get_tstamp(t); pp_t_ops.get(t);
return sendto(NP(ppi)->ch[chtype].fd, pkt, len, 0, return sendto(NP(ppi)->ch[chtype].fd, pkt, len, 0,
(struct sockaddr *)&addr, sizeof(struct sockaddr_in)); (struct sockaddr *)&addr, sizeof(struct sockaddr_in));
......
/*
* Alessandro Rubini for CERN, 2011 -- public domain
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#include <sys/timex.h>
#include <ppsi/ppsi.h>
#include <ppsi/diag.h>
static void clock_fatal_error(char *context)
{
PP_PRINTF("failure in \"%s\": %s\n.Exiting.\n", context,
strerror(errno));
exit(1);
}
static int posix_time_get(TimeInternal *t)
{
struct timespec tp;
if (clock_gettime(CLOCK_REALTIME, &tp) < 0)
clock_fatal_error("clock_gettime");
t->seconds = tp.tv_sec;
t->nanoseconds = tp.tv_nsec;
return 0;
}
int32_t posix_time_set(TimeInternal *t)
{
struct timespec tp;
tp.tv_sec = t->seconds;
tp.tv_nsec = t->nanoseconds;
if (clock_settime(CLOCK_REALTIME, &tp) < 0)
clock_fatal_error("clock_settime");
return 0;
}
int posix_time_adjust(long offset_ns, long freq_ppm)
{
struct timex t;
if (freq_ppm > PP_ADJ_FREQ_MAX)
freq_ppm = PP_ADJ_FREQ_MAX;
if (freq_ppm < -PP_ADJ_FREQ_MAX)
freq_ppm = -PP_ADJ_FREQ_MAX;
t.offset = offset_ns / 1000;
t.freq = freq_ppm; /* was: "adj * ((1 << 16) / 1000)" */
t.modes = MOD_FREQUENCY | MOD_OFFSET;
return adjtimex(&t);
}
struct pp_time_operations pp_t_ops = {
.get = posix_time_get,
.set = posix_time_set,
.adjust = posix_time_adjust,
};
...@@ -58,7 +58,7 @@ void pp_timed_printf(char *fmt, ...) ...@@ -58,7 +58,7 @@ void pp_timed_printf(char *fmt, ...)
va_list args; va_list args;
TimeInternal t; TimeInternal t;
pp_get_tstamp(&t); pp_t_ops.get(&t);
pp_printf("%09d.%03d ", (int)t.seconds, pp_printf("%09d.%03d ", (int)t.seconds,
(int)t.nanoseconds / 1000000); (int)t.nanoseconds / 1000000);
va_start(args, fmt); va_start(args, fmt);
......
...@@ -344,6 +344,25 @@ struct pp_network_operations { ...@@ -344,6 +344,25 @@ struct pp_network_operations {
extern struct pp_network_operations pp_net_ops; extern struct pp_network_operations pp_net_ops;
/*
* Time operations, like network operations above, are encapsulated.
* They may live in their own time-<name> subdirectory.
*
* Maybe this structure will need updating, to pass ppi as well
*/
struct pp_time_operations {
int (*get)(TimeInternal *t); /* returns error code */
int (*set)(TimeInternal *t); /* returns error code */
/* freq_ppm is "scaled-ppm" like the argument of adjtimex(2) */
int (*adjust)(long offset_ns, long freq_ppm);
};
/* Where is this maximum imposed from? And which unit? */
#define PP_ADJ_FREQ_MAX 512000
extern struct pp_time_operations pp_t_ops;
/* The channel for an instance must be created and possibly destroyed. */ /* The channel for an instance must be created and possibly destroyed. */
extern int pp_open_instance(struct pp_instance *ppi, extern int pp_open_instance(struct pp_instance *ppi,
struct pp_runtime_opts *rt_opts); struct pp_runtime_opts *rt_opts);
...@@ -431,20 +450,6 @@ extern void set_TimeInternal(TimeInternal *t, Integer32 s, Integer32 ns); ...@@ -431,20 +450,6 @@ extern void set_TimeInternal(TimeInternal *t, Integer32 s, Integer32 ns);
extern void display_TimeInternal(const char *label, TimeInternal *t); extern void display_TimeInternal(const char *label, TimeInternal *t);
extern void div2_TimeInternal(TimeInternal *r); extern void div2_TimeInternal(TimeInternal *r);
/* Get and Set system timestamp */
extern void pp_get_tstamp(TimeInternal *t);
extern int32_t pp_set_tstamp(TimeInternal *t);
/*
* Virtualization of Linux adjtimex (or BSD adjtime) system clock time
* adjustment. Returns 0 for success, -1 for failure
*/
extern int pp_adj_freq(Integer32 adj);
/* Where is this maximum imposed from? And which unit? */
#define PP_ADJ_FREQ_MAX 512000
/* /*
* The state machine itself is an array of these structures. * The state machine itself is an array of these structures.
*/ */
......
...@@ -611,7 +611,7 @@ int msg_issue_sync(struct pp_instance *ppi) ...@@ -611,7 +611,7 @@ int msg_issue_sync(struct pp_instance *ppi)
{ {
Timestamp orig_tstamp; Timestamp orig_tstamp;
TimeInternal now; TimeInternal now;
pp_get_tstamp(&now); pp_t_ops.get(&now);
from_TimeInternal(&now, &orig_tstamp); from_TimeInternal(&now, &orig_tstamp);
msg_pack_sync(ppi, &orig_tstamp); msg_pack_sync(ppi, &orig_tstamp);
...@@ -635,7 +635,7 @@ int msg_issue_delay_req(struct pp_instance *ppi) ...@@ -635,7 +635,7 @@ int msg_issue_delay_req(struct pp_instance *ppi)
{ {
Timestamp orig_tstamp; Timestamp orig_tstamp;
TimeInternal now; TimeInternal now;
pp_get_tstamp(&now); pp_t_ops.get(&now);
from_TimeInternal(&now, &orig_tstamp); from_TimeInternal(&now, &orig_tstamp);
msg_pack_delay_req(ppi, &orig_tstamp); msg_pack_delay_req(ppi, &orig_tstamp);
...@@ -648,7 +648,7 @@ int msg_issue_pdelay_req(struct pp_instance *ppi) ...@@ -648,7 +648,7 @@ int msg_issue_pdelay_req(struct pp_instance *ppi)
{ {
Timestamp orig_tstamp; Timestamp orig_tstamp;
TimeInternal now; TimeInternal now;
pp_get_tstamp(&now); pp_t_ops.get(&now);
from_TimeInternal(&now, &orig_tstamp); from_TimeInternal(&now, &orig_tstamp);
msg_pack_pdelay_req(ppi, &orig_tstamp); msg_pack_pdelay_req(ppi, &orig_tstamp);
......
...@@ -19,7 +19,7 @@ void pp_init_clock(struct pp_instance *ppi) ...@@ -19,7 +19,7 @@ void pp_init_clock(struct pp_instance *ppi)
/* level clock */ /* level clock */
if (!OPTS(ppi)->no_adjust) if (!OPTS(ppi)->no_adjust)
pp_adj_freq(0); pp_t_ops.adjust(0, 0);
} }
void pp_update_delay(struct pp_instance *ppi, TimeInternal *correction_field) void pp_update_delay(struct pp_instance *ppi, TimeInternal *correction_field)
...@@ -248,7 +248,6 @@ void pp_update_clock(struct pp_instance *ppi) ...@@ -248,7 +248,6 @@ void pp_update_clock(struct pp_instance *ppi)
{ {
Integer32 adj; Integer32 adj;
TimeInternal time_tmp; TimeInternal time_tmp;
uint32_t tstamp_diff;
if (OPTS(ppi)->max_rst) { /* If max_rst is 0 then it's OFF */ if (OPTS(ppi)->max_rst) { /* If max_rst is 0 then it's OFF */
if (DSCUR(ppi)->offsetFromMaster.seconds) { if (DSCUR(ppi)->offsetFromMaster.seconds) {
...@@ -275,15 +274,16 @@ void pp_update_clock(struct pp_instance *ppi) ...@@ -275,15 +274,16 @@ void pp_update_clock(struct pp_instance *ppi)
/* if secs, reset clock or set freq adjustment to max */ /* if secs, reset clock or set freq adjustment to max */
if (!OPTS(ppi)->no_adjust) { if (!OPTS(ppi)->no_adjust) {
if (!OPTS(ppi)->no_rst_clk) { if (!OPTS(ppi)->no_rst_clk) {
pp_get_tstamp(&time_tmp); /* FIXME: use adjust instead of set? */
pp_t_ops.get(&time_tmp);
sub_TimeInternal(&time_tmp, &time_tmp, sub_TimeInternal(&time_tmp, &time_tmp,
&DSCUR(ppi)->offsetFromMaster); &DSCUR(ppi)->offsetFromMaster);
tstamp_diff = pp_set_tstamp(&time_tmp); pp_t_ops.set(&time_tmp);
pp_init_clock(ppi); pp_init_clock(ppi);
} else { } else {
adj = DSCUR(ppi)->offsetFromMaster.nanoseconds adj = DSCUR(ppi)->offsetFromMaster.nanoseconds
> 0 ? PP_ADJ_FREQ_MAX:-PP_ADJ_FREQ_MAX; > 0 ? PP_ADJ_FREQ_MAX:-PP_ADJ_FREQ_MAX;
pp_adj_freq(-adj); pp_t_ops.adjust(-adj, 0);
} }
} }
} else { } else {
...@@ -312,7 +312,7 @@ void pp_update_clock(struct pp_instance *ppi) ...@@ -312,7 +312,7 @@ void pp_update_clock(struct pp_instance *ppi)
/* apply controller output as a clock tick rate adjustment */ /* apply controller output as a clock tick rate adjustment */
if (!OPTS(ppi)->no_adjust) if (!OPTS(ppi)->no_adjust)
pp_adj_freq(-adj); pp_t_ops.adjust(0, -adj);
dc++; dc++;
if (dc % 2 == 0) { /* Prints statistics every 8s */ if (dc % 2 == 0) { /* Prints statistics every 8s */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment