adds clock description

Adds struct containing clock description info that will be needed for
USER_DESCRIPTION and CLOCK_DESCRIPTION management messages.

Signed-off-by: Geoff Salmon <gsalmon@se-instruments.com>
master
Geoff Salmon 2013-02-03 17:01:51 -05:00 committed by Richard Cochran
parent 68b4678f7b
commit 09c2d1a652
4 changed files with 35 additions and 0 deletions

View File

@ -79,6 +79,7 @@ struct clock {
tmv_t c2;
tmv_t t1;
tmv_t t2;
struct clock_description desc;
};
struct clock the_clock;
@ -430,6 +431,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->desc = dds->clock_desc;
if (c->free_running) {
c->clkid = CLOCK_INVALID;
@ -951,3 +953,8 @@ static void handle_state_decision_event(struct clock *c)
port_dispatch(c->port[i], event, fresh_best);
}
}
struct clock_description *clock_description(struct clock *c)
{
return &c->desc;
}

View File

@ -215,4 +215,11 @@ void clock_sync_interval(struct clock *c, int n);
*/
struct timePropertiesDS *clock_time_properties(struct clock *c);
/**
* Obtain a clock's description.
* @param c The clock instance.
* @return A pointer to the clock_description of the clock.
*/
struct clock_description *clock_description(struct clock *c);
#endif

9
ds.h
View File

@ -39,10 +39,19 @@ struct defaultDS {
UInteger8 reserved2;
} PACKED;
#define OUI_LEN 3
struct clock_description {
struct static_ptp_text productDescription;
struct static_ptp_text revisionData;
struct static_ptp_text userDescription;
Octet manufacturerIdentity[OUI_LEN];
};
struct default_ds {
struct defaultDS dds;
int free_running;
int freq_est_interval; /*log seconds*/
struct clock_description clock_desc;
};
struct dataset {

12
ptp4l.c
View File

@ -52,6 +52,18 @@ static struct config cfg_settings = {
},
.free_running = 0,
.freq_est_interval = 1,
.clock_desc = {
.productDescription = {
.max_symbols = 64,
.text = ";;"
},
.revisionData = {
.max_symbols = 32,
.text = ";;"
},
.userDescription = { .max_symbols = 128 },
.manufacturerIdentity = { 0, 0, 0 },
},
},
.pod = {