Signed-off-by: Richard Cochran <[email protected]>
---
config.c | 7 +------
config.h | 1 -
phc2sys.c | 5 +++--
ptp4l.c | 1 -
servo.c | 5 ++++-
servo.h | 9 ---------
6 files changed, 8 insertions(+), 20 deletions(-)
diff --git a/config.c b/config.c
index 6732b23..d539a5b 100644
--- a/config.c
+++ b/config.c
@@ -93,6 +93,7 @@ struct config_item {
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_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),
@@ -584,12 +585,6 @@ static enum parser_result parse_global_setting(const char
*option,
return r;
*cfg->pi_integral_norm_max = df;
- } else if (!strcmp(option, "first_step_threshold")) {
- r = get_ranged_double(value, &df, 0.0, DBL_MAX);
- if (r != PARSED_OK)
- return r;
- *cfg->first_step_threshold = df;
-
} else if (!strcmp(option, "max_frequency")) {
r = get_ranged_int(value, &val, 0, INT_MAX);
if (r != PARSED_OK)
diff --git a/config.h b/config.h
index 45805de..b8781fa 100644
--- a/config.h
+++ b/config.h
@@ -72,7 +72,6 @@ struct config {
struct port_defaults pod;
enum servo_type clock_servo;
- double *first_step_threshold;
int *max_frequency;
double *pi_proportional_const;
diff --git a/phc2sys.c b/phc2sys.c
index fa75607..44ba1fc 100644
--- a/phc2sys.c
+++ b/phc2sys.c
@@ -1305,8 +1305,9 @@ int main(int argc, char *argv[])
return -1;
break;
case 'F':
- if (get_arg_val_d(c, optarg,
&servo_first_step_threshold,
- 0.0, DBL_MAX))
+ if (get_arg_val_d(c, optarg, &tmp, 0.0, DBL_MAX))
+ return -1;
+ if (config_set_double(cfg, "first_step_threshold", tmp))
return -1;
break;
case 'R':
diff --git a/ptp4l.c b/ptp4l.c
index 3b913c0..575ee0c 100644
--- a/ptp4l.c
+++ b/ptp4l.c
@@ -103,7 +103,6 @@ static struct config cfg_settings = {
.transport = TRANS_UDP_IPV4,
.clock_servo = CLOCK_SERVO_PI,
- .first_step_threshold = &servo_first_step_threshold,
.max_frequency = &servo_max_frequency,
.pi_proportional_const = &configured_pi_kp,
diff --git a/servo.c b/servo.c
index f1eddc8..4f26ea6 100644
--- a/servo.c
+++ b/servo.c
@@ -27,12 +27,12 @@
#define NSEC_PER_SEC 1000000000
-double servo_first_step_threshold = 0.00002; /* 20 microseconds */
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;
struct servo *servo;
@@ -60,6 +60,9 @@ struct servo *servo_create(struct config *cfg, enum
servo_type type,
servo->step_threshold = 0.0;
}
+ servo_first_step_threshold =
+ config_get_double(cfg, NULL, "first_step_threshold");
+
if (servo_first_step_threshold > 0.0) {
servo->first_step_threshold =
servo_first_step_threshold * NSEC_PER_SEC;
diff --git a/servo.h b/servo.h
index 88d926b..b5252df 100644
--- a/servo.h
+++ b/servo.h
@@ -25,15 +25,6 @@
struct config;
/**
- * When set to zero, the clock is not stepped on start. When set to a non-zero
- * value, the value bahaves as a threshold and the clock is stepped on start if
- * the offset is bigger than the threshold.
- *
- * Note that this variable is measured in seconds, and allows fractional
values.
- */
-extern double servo_first_step_threshold;
-
-/**
* When set to a non-zero value, this variable sets an additional limit for
* the frequency adjustment of the clock. It's in ppb.
*/
--
2.1.4
------------------------------------------------------------------------------
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel