Skip to content

Commit

Permalink
Add a clock method to receive the follow up information TLV.
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Cochran <[email protected]>
  • Loading branch information
richardcochran committed Sep 2, 2012
1 parent f383388 commit 94dd186
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
10 changes: 10 additions & 0 deletions clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ struct clock {
tmv_t path_delay;
struct mave *avg_delay;
struct freq_estimator fest;
struct time_status_np status;
double nrr;
tmv_t c1;
tmv_t c2;
Expand Down Expand Up @@ -473,6 +474,15 @@ UInteger8 clock_domain_number(struct clock *c)
return c->dds.domainNumber;
}

void clock_follow_up_info(struct clock *c, struct follow_up_info_tlv *f)
{
c->status.cumulativeScaledRateOffset = f->cumulativeScaledRateOffset;
c->status.scaledLastGmPhaseChange = f->scaledLastGmPhaseChange;
c->status.gmTimeBaseIndicator = f->gmTimeBaseIndicator;
memcpy(&c->status.lastGmPhaseChange, &f->lastGmPhaseChange,
sizeof(c->status.lastGmPhaseChange));
}

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 @@ -24,6 +24,7 @@
#include "ds.h"
#include "config.h"
#include "servo.h"
#include "tlv.h"
#include "tmv.h"
#include "transport.h"

Expand Down Expand Up @@ -90,6 +91,13 @@ void clock_destroy(struct clock *c);
*/
UInteger8 clock_domain_number(struct clock *c);

/**
* Provide the follow_up info TLV from a slave port.
* @param c The clock instance.
* @param f Pointer to the TLV.
*/
void clock_follow_up_info(struct clock *c, struct follow_up_info_tlv *f);

/**
* Obtain a clock's identity from its default data set.
* @param c The clock instance.
Expand Down
7 changes: 7 additions & 0 deletions tlv.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ struct follow_up_info_tlv {
Integer32 scaledLastGmPhaseChange;
} PACKED;

struct time_status_np {
UInteger32 cumulativeScaledRateOffset;
Integer32 scaledLastGmPhaseChange;
UInteger16 gmTimeBaseIndicator;
ScaledNs lastGmPhaseChange;
} PACKED;

/**
* Converts recognized value sub-fields into host byte order.
* @param tlv Pointer to a Type Length Value field.
Expand Down

0 comments on commit 94dd186

Please sign in to comment.