From e8a2956ce05190da4b61af518edf38784c7b871b Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Wed, 12 Aug 2015 15:32:55 +0200 Subject: [PATCH] config: convert the 'max_frequency' option to the new scheme. Signed-off-by: Richard Cochran --- config.c | 7 +------ config.h | 2 -- ptp4l.c | 2 -- servo.c | 4 ++-- servo.h | 6 ------ 5 files changed, 3 insertions(+), 18 deletions(-) diff --git a/config.c b/config.c index d539a5b..08508be 100644 --- a/config.c +++ b/config.c @@ -94,6 +94,7 @@ struct config_item config_tab[] = { GLOB_ITEM_INT("assume_two_step", 0, 0, 1), GLOB_ITEM_INT("check_fup_sync", 0, 0, 1), GLOB_ITEM_DBL("first_step_threshold", 0.00002, 0.0, DBL_MAX), + GLOB_ITEM_INT("max_frequency", 900000000, 0, INT_MAX), GLOB_ITEM_DBL("step_threshold", 0.0, 0.0, DBL_MAX), GLOB_ITEM_INT("tx_timestamp_timeout", 1, 1, INT_MAX), PORT_ITEM_INT("udp_ttl", 1, 1, 255), @@ -585,12 +586,6 @@ static enum parser_result parse_global_setting(const char *option, return r; *cfg->pi_integral_norm_max = df; - } else if (!strcmp(option, "max_frequency")) { - r = get_ranged_int(value, &val, 0, INT_MAX); - if (r != PARSED_OK) - return r; - *cfg->max_frequency = val; - } else if (!strcmp(option, "sanity_freq_limit")) { r = get_ranged_int(value, &val, 0, INT_MAX); if (r != PARSED_OK) diff --git a/config.h b/config.h index b8781fa..a297e85 100644 --- a/config.h +++ b/config.h @@ -72,8 +72,6 @@ struct config { struct port_defaults pod; enum servo_type clock_servo; - int *max_frequency; - double *pi_proportional_const; double *pi_integral_const; double *pi_proportional_scale; diff --git a/ptp4l.c b/ptp4l.c index 575ee0c..ca62370 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -103,8 +103,6 @@ static struct config cfg_settings = { .transport = TRANS_UDP_IPV4, .clock_servo = CLOCK_SERVO_PI, - .max_frequency = &servo_max_frequency, - .pi_proportional_const = &configured_pi_kp, .pi_integral_const = &configured_pi_ki, .pi_proportional_scale = &configured_pi_kp_scale, diff --git a/servo.c b/servo.c index 4f26ea6..2e82ebe 100644 --- a/servo.c +++ b/servo.c @@ -27,13 +27,12 @@ #define NSEC_PER_SEC 1000000000 -int servo_max_frequency = 900000000; - struct servo *servo_create(struct config *cfg, enum servo_type type, int fadj, int max_ppb, int sw_ts) { double servo_first_step_threshold; double servo_step_threshold; + int servo_max_frequency; struct servo *servo; switch (type) { @@ -70,6 +69,7 @@ struct servo *servo_create(struct config *cfg, enum servo_type type, servo->first_step_threshold = 0.0; } + servo_max_frequency = config_get_int(cfg, NULL, "max_frequency"); servo->max_frequency = max_ppb; if (servo_max_frequency && servo->max_frequency > servo_max_frequency) { servo->max_frequency = servo_max_frequency; diff --git a/servo.h b/servo.h index b5252df..f90befd 100644 --- a/servo.h +++ b/servo.h @@ -24,12 +24,6 @@ struct config; -/** - * When set to a non-zero value, this variable sets an additional limit for - * the frequency adjustment of the clock. It's in ppb. - */ -extern int servo_max_frequency; - /** Opaque type */ struct servo;