Skip to content

Commit

Permalink
Introduce the gmCapable flag for use with 802.1AS clocks.
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Cochran <[email protected]>
  • Loading branch information
richardcochran committed Dec 1, 2013
1 parent 7f7012e commit bdbda10
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ struct clock {
int nports; /* does not include the UDS port */
int free_running;
int freq_est_interval;
int grand_master_capable; /* for 802.1AS only */
int utc_timescale;
int leap_set;
int kernel_leap;
Expand Down Expand Up @@ -587,6 +588,7 @@ struct clock *clock_create(int phc_index, struct interface *iface, int count,

c->free_running = dds->free_running;
c->freq_est_interval = dds->freq_est_interval;
c->grand_master_capable = dds->grand_master_capable;
c->kernel_leap = dds->kernel_leap;
c->utc_offset = CURRENT_UTC_OFFSET;
c->time_source = dds->time_source;
Expand Down Expand Up @@ -745,6 +747,11 @@ void clock_follow_up_info(struct clock *c, struct follow_up_info_tlv *f)
sizeof(c->status.lastGmPhaseChange));
}

int clock_gm_capable(struct clock *c)
{
return c->grand_master_capable;
}

struct ClockIdentity clock_identity(struct clock *c)
{
return c->dds.clockIdentity;
Expand Down
8 changes: 8 additions & 0 deletions clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/**
* 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.
* @param c The clock instance.
Expand Down
1 change: 1 addition & 0 deletions ds.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ struct default_ds {
struct defaultDS dds;
int free_running;
int freq_est_interval; /*log seconds*/
int grand_master_capable; /*802.1AS only*/
int stats_interval; /*log seconds*/
int kernel_leap;
int sanity_freq_limit;
Expand Down
1 change: 1 addition & 0 deletions ptp4l.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ static struct config cfg_settings = {
},
.free_running = 0,
.freq_est_interval = 1,
.grand_master_capable = 1,
.stats_interval = 0,
.kernel_leap = 1,
.sanity_freq_limit = 200000000,
Expand Down

0 comments on commit bdbda10

Please sign in to comment.