Commit 6063b8da authored by Alessandro Rubini's avatar Alessandro Rubini

PP_ADJ_FREQ_MAX partial cleanup

This unifies PP_ADJ_FREQ_MAX, that was defined in several places with the
same value.

Unfortunately, it isn't clear at all to me what is this value (looks
like arch-spec uses it as nanoseconds and not as an adjustment).
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 831965d1
......@@ -5,8 +5,6 @@
#include <ppsi/diag.h>
#include "bare-i386.h"
const Integer32 PP_ADJ_FREQ_MAX = 512000;
void pp_puts(const char *s)
{
sys_write(0, s, strnlen(s, 300));
......@@ -52,13 +50,13 @@ int bare_adj_freq(Integer32 adj)
if (adj > PP_ADJ_FREQ_MAX)
adj = PP_ADJ_FREQ_MAX;
else if (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);
return sys_adjtimex(&t);
}
int32_t pp_set_tstamp(TimeInternal *t)
......
......@@ -5,8 +5,6 @@
#include <ppsi/diag.h>
#include "bare-x86-64.h"
const Integer32 PP_ADJ_FREQ_MAX = 512000;
void pp_puts(const char *s)
{
sys_write(0, s, strnlen(s, 300));
......@@ -52,13 +50,13 @@ int bare_adj_freq(Integer32 adj)
if (adj > PP_ADJ_FREQ_MAX)
adj = PP_ADJ_FREQ_MAX;
else if (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);
return sys_adjtimex(&t);
}
int32_t pp_set_tstamp(TimeInternal *t)
......
......@@ -11,8 +11,6 @@
#include <ppsi/ppsi.h>
#include <ppsi/diag.h>
const Integer32 PP_ADJ_FREQ_MAX = 512000;
static void clock_fatal_error(char *context)
{
PP_PRINTF("failure in \"%s\": %s\n.Exiting.\n", context,
......@@ -57,13 +55,13 @@ int posix_adj_freq(Integer32 adj)
if (adj > PP_ADJ_FREQ_MAX)
adj = PP_ADJ_FREQ_MAX;
else if (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);
return adjtimex(&t);
}
void pp_puts(const char *s)
......
......@@ -6,8 +6,6 @@
#include <pps_gen.h>
#include "spec.h"
const Integer32 PP_ADJ_FREQ_MAX = 512000; //GGDD value ?
void pp_puts(const char *s)
{
uart_write_string(s);
......@@ -31,8 +29,9 @@ int32_t spec_set_tstamp(TimeInternal *t)
int spec_adj_freq(Integer32 adj)
{
/* FIXME: this adjusts nanoseconds, not frequency */
shw_pps_gen_adjust(PPSG_ADJUST_NSEC, adj);
return 0;
return -1; /* failure? */
}
int pp_adj_freq(Integer32 adj)
......
......@@ -431,10 +431,14 @@ 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. Boolean: returns 1 in case of success and 0 if failure */
/*
* 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);
extern const Integer32 PP_ADJ_FREQ_MAX;
/* 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.
......
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