pmc: Support the grandmaster settings management request.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2013-07-06 11:21:57 +02:00
parent 24ecd786c8
commit 661d7a7716
1 changed files with 28 additions and 0 deletions

28
pmc.c
View File

@ -85,6 +85,7 @@ struct management_id idtab[] = {
{ "TRANSPARENT_CLOCK_DEFAULT_DATA_SET", TRANSPARENT_CLOCK_DEFAULT_DATA_SET, not_supported }, { "TRANSPARENT_CLOCK_DEFAULT_DATA_SET", TRANSPARENT_CLOCK_DEFAULT_DATA_SET, not_supported },
{ "PRIMARY_DOMAIN", PRIMARY_DOMAIN, not_supported }, { "PRIMARY_DOMAIN", PRIMARY_DOMAIN, not_supported },
{ "TIME_STATUS_NP", TIME_STATUS_NP, do_get_action }, { "TIME_STATUS_NP", TIME_STATUS_NP, do_get_action },
{ "GRANDMASTER_SETTINGS_NP", GRANDMASTER_SETTINGS_NP, do_get_action },
/* Port management ID values */ /* Port management ID values */
{ "NULL_MANAGEMENT", NULL_MANAGEMENT, null_management }, { "NULL_MANAGEMENT", NULL_MANAGEMENT, null_management },
{ "CLOCK_DESCRIPTION", CLOCK_DESCRIPTION, do_get_action }, { "CLOCK_DESCRIPTION", CLOCK_DESCRIPTION, do_get_action },
@ -188,6 +189,7 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
struct parentDS *pds; struct parentDS *pds;
struct timePropertiesDS *tp; struct timePropertiesDS *tp;
struct time_status_np *tsn; struct time_status_np *tsn;
struct grandmaster_settings_np *gsn;
struct mgmt_clock_description *cd; struct mgmt_clock_description *cd;
struct portDS *p; struct portDS *p;
if (msg_type(msg) != MANAGEMENT) { if (msg_type(msg) != MANAGEMENT) {
@ -384,6 +386,32 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
tsn->gmPresent ? "true" : "false", tsn->gmPresent ? "true" : "false",
cid2str(&tsn->gmIdentity)); cid2str(&tsn->gmIdentity));
break; break;
case GRANDMASTER_SETTINGS_NP:
gsn = (struct grandmaster_settings_np *) mgt->data;
fprintf(fp, "GRANDMASTER_SETTINGS_NP "
IFMT "clockClass %hhu"
IFMT "clockAccuracy 0x%02hhx"
IFMT "offsetScaledLogVariance 0x%04hx"
IFMT "currentUtcOffset %hd"
IFMT "leap61 %d"
IFMT "leap59 %d"
IFMT "currentUtcOffsetValid %d"
IFMT "ptpTimescale %d"
IFMT "timeTraceable %d"
IFMT "frequencyTraceable %d"
IFMT "timeSource 0x%02hhx",
gsn->clockQuality.clockClass,
gsn->clockQuality.clockAccuracy,
gsn->clockQuality.offsetScaledLogVariance,
gsn->utc_offset,
gsn->time_flags & LEAP_61 ? 1 : 0,
gsn->time_flags & LEAP_59 ? 1 : 0,
gsn->time_flags & UTC_OFF_VALID ? 1 : 0,
gsn->time_flags & PTP_TIMESCALE ? 1 : 0,
gsn->time_flags & TIME_TRACEABLE ? 1 : 0,
gsn->time_flags & FREQ_TRACEABLE ? 1 : 0,
gsn->time_source);
break;
case PORT_DATA_SET: case PORT_DATA_SET:
p = (struct portDS *) mgt->data; p = (struct portDS *) mgt->data;
if (p->portState > PS_SLAVE) { if (p->portState > PS_SLAVE) {