Introduce the gmCapable flag for use with 802.1AS clocks.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2013-12-01 20:32:05 +01:00
parent 7f7012eab5
commit bdbda10c73
4 changed files with 17 additions and 0 deletions

View File

@ -76,6 +76,7 @@ struct clock {
int nports; /* does not include the UDS port */ int nports; /* does not include the UDS port */
int free_running; int free_running;
int freq_est_interval; int freq_est_interval;
int grand_master_capable; /* for 802.1AS only */
int utc_timescale; int utc_timescale;
int leap_set; int leap_set;
int kernel_leap; int kernel_leap;
@ -587,6 +588,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->grand_master_capable = dds->grand_master_capable;
c->kernel_leap = dds->kernel_leap; c->kernel_leap = dds->kernel_leap;
c->utc_offset = CURRENT_UTC_OFFSET; c->utc_offset = CURRENT_UTC_OFFSET;
c->time_source = dds->time_source; c->time_source = dds->time_source;
@ -745,6 +747,11 @@ void clock_follow_up_info(struct clock *c, struct follow_up_info_tlv *f)
sizeof(c->status.lastGmPhaseChange)); sizeof(c->status.lastGmPhaseChange));
} }
int clock_gm_capable(struct clock *c)
{
return c->grand_master_capable;
}
struct ClockIdentity clock_identity(struct clock *c) struct ClockIdentity clock_identity(struct clock *c)
{ {
return c->dds.clockIdentity; return c->dds.clockIdentity;

View File

@ -100,6 +100,14 @@ UInteger8 clock_domain_number(struct clock *c);
*/ */
void clock_follow_up_info(struct clock *c, struct follow_up_info_tlv *f); void clock_follow_up_info(struct clock *c, struct follow_up_info_tlv *f);
/**
* Obtain the gmCapable flag from a clock's default data set.
* This function is specific to the 802.1AS standard.
* @param c The clock instance.
* @return One if the clock is capable of becoming grand master, zero otherwise.
*/
int clock_gm_capable(struct clock *c);
/** /**
* Obtain a clock's identity from its default data set. * Obtain a clock's identity from its default data set.
* @param c The clock instance. * @param c The clock instance.

1
ds.h
View File

@ -53,6 +53,7 @@ struct default_ds {
struct defaultDS dds; struct defaultDS dds;
int free_running; int free_running;
int freq_est_interval; /*log seconds*/ int freq_est_interval; /*log seconds*/
int grand_master_capable; /*802.1AS only*/
int stats_interval; /*log seconds*/ int stats_interval; /*log seconds*/
int kernel_leap; int kernel_leap;
int sanity_freq_limit; int sanity_freq_limit;

View File

@ -53,6 +53,7 @@ static struct config cfg_settings = {
}, },
.free_running = 0, .free_running = 0,
.freq_est_interval = 1, .freq_est_interval = 1,
.grand_master_capable = 1,
.stats_interval = 0, .stats_interval = 0,
.kernel_leap = 1, .kernel_leap = 1,
.sanity_freq_limit = 200000000, .sanity_freq_limit = 200000000,