config: convert 'priority1' and 'priority2' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
ea574c7e4f
commit
0c9d54d3ff
16
config.c
16
config.c
|
@ -125,6 +125,8 @@ struct config_item config_tab[] = {
|
||||||
GLOB_ITEM_DBL("pi_proportional_exponent", -0.3, -DBL_MAX, DBL_MAX),
|
GLOB_ITEM_DBL("pi_proportional_exponent", -0.3, -DBL_MAX, DBL_MAX),
|
||||||
GLOB_ITEM_DBL("pi_proportional_norm_max", 0.7, DBL_MIN, 1.0),
|
GLOB_ITEM_DBL("pi_proportional_norm_max", 0.7, DBL_MIN, 1.0),
|
||||||
GLOB_ITEM_DBL("pi_proportional_scale", 0.0, 0.0, DBL_MAX),
|
GLOB_ITEM_DBL("pi_proportional_scale", 0.0, 0.0, DBL_MAX),
|
||||||
|
GLOB_ITEM_INT("priority1", 128, 0, UINT8_MAX),
|
||||||
|
GLOB_ITEM_INT("priority2", 128, 0, UINT8_MAX),
|
||||||
GLOB_ITEM_INT("sanity_freq_limit", 200000000, 0, INT_MAX),
|
GLOB_ITEM_INT("sanity_freq_limit", 200000000, 0, INT_MAX),
|
||||||
GLOB_ITEM_INT("slaveOnly", 0, 0, 1),
|
GLOB_ITEM_INT("slaveOnly", 0, 0, 1),
|
||||||
GLOB_ITEM_DBL("step_threshold", 0.0, 0.0, DBL_MAX),
|
GLOB_ITEM_DBL("step_threshold", 0.0, 0.0, DBL_MAX),
|
||||||
|
@ -396,19 +398,7 @@ static enum parser_result parse_global_setting(const char *option,
|
||||||
if (r != NOT_PARSED)
|
if (r != NOT_PARSED)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if (!strcmp(option, "priority1")) {
|
if (!strcmp(option, "domainNumber")) {
|
||||||
r = get_ranged_uint(value, &uval, 0, UINT8_MAX);
|
|
||||||
if (r != PARSED_OK)
|
|
||||||
return r;
|
|
||||||
dds->priority1 = uval;
|
|
||||||
|
|
||||||
} else if (!strcmp(option, "priority2")) {
|
|
||||||
r = get_ranged_uint(value, &uval, 0, UINT8_MAX);
|
|
||||||
if (r != PARSED_OK)
|
|
||||||
return r;
|
|
||||||
dds->priority2 = uval;
|
|
||||||
|
|
||||||
} else if (!strcmp(option, "domainNumber")) {
|
|
||||||
r = get_ranged_uint(value, &uval, 0, 127);
|
r = get_ranged_uint(value, &uval, 0, 127);
|
||||||
if (r != PARSED_OK)
|
if (r != PARSED_OK)
|
||||||
return r;
|
return r;
|
||||||
|
|
4
ptp4l.c
4
ptp4l.c
|
@ -44,11 +44,9 @@ static struct config cfg_settings = {
|
||||||
|
|
||||||
.dds = {
|
.dds = {
|
||||||
.dds = {
|
.dds = {
|
||||||
.priority1 = 128,
|
|
||||||
.clockQuality.clockClass = 248,
|
.clockQuality.clockClass = 248,
|
||||||
.clockQuality.clockAccuracy = 0xfe,
|
.clockQuality.clockAccuracy = 0xfe,
|
||||||
.clockQuality.offsetScaledLogVariance = 0xffff,
|
.clockQuality.offsetScaledLogVariance = 0xffff,
|
||||||
.priority2 = 128,
|
|
||||||
.domainNumber = 0,
|
.domainNumber = 0,
|
||||||
},
|
},
|
||||||
.clock_desc = {
|
.clock_desc = {
|
||||||
|
@ -232,6 +230,8 @@ int main(int argc, char *argv[])
|
||||||
if (config_get_int(cfg, NULL, "twoStepFlag")) {
|
if (config_get_int(cfg, NULL, "twoStepFlag")) {
|
||||||
ds->flags |= DDS_TWO_STEP_FLAG;
|
ds->flags |= DDS_TWO_STEP_FLAG;
|
||||||
}
|
}
|
||||||
|
ds->priority1 = config_get_int(cfg, NULL, "priority1");
|
||||||
|
ds->priority2 = config_get_int(cfg, NULL, "priority2");
|
||||||
|
|
||||||
if (!config_get_int(cfg, NULL, "gmCapable") &&
|
if (!config_get_int(cfg, NULL, "gmCapable") &&
|
||||||
ds->flags & DDS_SLAVE_ONLY) {
|
ds->flags & DDS_SLAVE_ONLY) {
|
||||||
|
|
Loading…
Reference in New Issue