Add a clock method to receive the follow up information TLV.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2012-08-31 16:04:12 +02:00
parent f38338827b
commit 94dd186cdf
3 changed files with 25 additions and 0 deletions

10
clock.c
View File

@ -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;
@ -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;

View File

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

7
tlv.h
View File

@ -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.