Add a clock variable to hold the value of the time source.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2013-07-05 20:43:45 +02:00
parent d9bdf4f876
commit 4782d669c2
3 changed files with 5 additions and 1 deletions

View File

@ -79,6 +79,7 @@ struct clock {
int utc_timescale; int utc_timescale;
int leap_set; int leap_set;
int kernel_leap; int kernel_leap;
int time_source; /* grand master role */
enum servo_state servo_state; enum servo_state servo_state;
tmv_t master_offset; tmv_t master_offset;
tmv_t path_delay; tmv_t path_delay;
@ -436,7 +437,7 @@ static void clock_update_grandmaster(struct clock *c)
} else { } else {
c->tds.flags = PTP_TIMESCALE; c->tds.flags = PTP_TIMESCALE;
} }
c->tds.timeSource = INTERNAL_OSCILLATOR; c->tds.timeSource = c->time_source;
} }
static void clock_update_slave(struct clock *c) static void clock_update_slave(struct clock *c)
@ -570,6 +571,7 @@ struct clock *clock_create(int phc_index, struct interface *iface, int count,
c->free_running = dds->free_running; c->free_running = dds->free_running;
c->freq_est_interval = dds->freq_est_interval; c->freq_est_interval = dds->freq_est_interval;
c->kernel_leap = dds->kernel_leap; c->kernel_leap = dds->kernel_leap;
c->time_source = dds->time_source;
c->desc = dds->clock_desc; c->desc = dds->clock_desc;
if (c->free_running) { if (c->free_running) {

1
ds.h
View File

@ -54,6 +54,7 @@ struct default_ds {
int freq_est_interval; /*log seconds*/ int freq_est_interval; /*log seconds*/
int stats_interval; /*log seconds*/ int stats_interval; /*log seconds*/
int kernel_leap; int kernel_leap;
int time_source;
struct clock_description clock_desc; struct clock_description clock_desc;
}; };

View File

@ -54,6 +54,7 @@ static struct config cfg_settings = {
.freq_est_interval = 1, .freq_est_interval = 1,
.stats_interval = 0, .stats_interval = 0,
.kernel_leap = 1, .kernel_leap = 1,
.time_source = INTERNAL_OSCILLATOR,
.clock_desc = { .clock_desc = {
.productDescription = { .productDescription = {
.max_symbols = 64, .max_symbols = 64,