config: convert the 'first_step_threshold' option to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
df578135d3
commit
4f649b1ec4
7
config.c
7
config.c
|
@ -93,6 +93,7 @@ struct config_item {
|
||||||
struct config_item config_tab[] = {
|
struct config_item config_tab[] = {
|
||||||
GLOB_ITEM_INT("assume_two_step", 0, 0, 1),
|
GLOB_ITEM_INT("assume_two_step", 0, 0, 1),
|
||||||
GLOB_ITEM_INT("check_fup_sync", 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_DBL("step_threshold", 0.0, 0.0, DBL_MAX),
|
||||||
GLOB_ITEM_INT("tx_timestamp_timeout", 1, 1, INT_MAX),
|
GLOB_ITEM_INT("tx_timestamp_timeout", 1, 1, INT_MAX),
|
||||||
PORT_ITEM_INT("udp_ttl", 1, 1, 255),
|
PORT_ITEM_INT("udp_ttl", 1, 1, 255),
|
||||||
|
@ -584,12 +585,6 @@ static enum parser_result parse_global_setting(const char *option,
|
||||||
return r;
|
return r;
|
||||||
*cfg->pi_integral_norm_max = df;
|
*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")) {
|
} else if (!strcmp(option, "max_frequency")) {
|
||||||
r = get_ranged_int(value, &val, 0, INT_MAX);
|
r = get_ranged_int(value, &val, 0, INT_MAX);
|
||||||
if (r != PARSED_OK)
|
if (r != PARSED_OK)
|
||||||
|
|
1
config.h
1
config.h
|
@ -72,7 +72,6 @@ struct config {
|
||||||
struct port_defaults pod;
|
struct port_defaults pod;
|
||||||
enum servo_type clock_servo;
|
enum servo_type clock_servo;
|
||||||
|
|
||||||
double *first_step_threshold;
|
|
||||||
int *max_frequency;
|
int *max_frequency;
|
||||||
|
|
||||||
double *pi_proportional_const;
|
double *pi_proportional_const;
|
||||||
|
|
|
@ -1305,8 +1305,9 @@ int main(int argc, char *argv[])
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
case 'F':
|
case 'F':
|
||||||
if (get_arg_val_d(c, optarg, &servo_first_step_threshold,
|
if (get_arg_val_d(c, optarg, &tmp, 0.0, DBL_MAX))
|
||||||
0.0, DBL_MAX))
|
return -1;
|
||||||
|
if (config_set_double(cfg, "first_step_threshold", tmp))
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
|
|
1
ptp4l.c
1
ptp4l.c
|
@ -103,7 +103,6 @@ static struct config cfg_settings = {
|
||||||
.transport = TRANS_UDP_IPV4,
|
.transport = TRANS_UDP_IPV4,
|
||||||
.clock_servo = CLOCK_SERVO_PI,
|
.clock_servo = CLOCK_SERVO_PI,
|
||||||
|
|
||||||
.first_step_threshold = &servo_first_step_threshold,
|
|
||||||
.max_frequency = &servo_max_frequency,
|
.max_frequency = &servo_max_frequency,
|
||||||
|
|
||||||
.pi_proportional_const = &configured_pi_kp,
|
.pi_proportional_const = &configured_pi_kp,
|
||||||
|
|
5
servo.c
5
servo.c
|
@ -27,12 +27,12 @@
|
||||||
|
|
||||||
#define NSEC_PER_SEC 1000000000
|
#define NSEC_PER_SEC 1000000000
|
||||||
|
|
||||||
double servo_first_step_threshold = 0.00002; /* 20 microseconds */
|
|
||||||
int servo_max_frequency = 900000000;
|
int servo_max_frequency = 900000000;
|
||||||
|
|
||||||
struct servo *servo_create(struct config *cfg, enum servo_type type,
|
struct servo *servo_create(struct config *cfg, enum servo_type type,
|
||||||
int fadj, int max_ppb, int sw_ts)
|
int fadj, int max_ppb, int sw_ts)
|
||||||
{
|
{
|
||||||
|
double servo_first_step_threshold;
|
||||||
double servo_step_threshold;
|
double servo_step_threshold;
|
||||||
struct servo *servo;
|
struct servo *servo;
|
||||||
|
|
||||||
|
@ -60,6 +60,9 @@ struct servo *servo_create(struct config *cfg, enum servo_type type,
|
||||||
servo->step_threshold = 0.0;
|
servo->step_threshold = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
servo_first_step_threshold =
|
||||||
|
config_get_double(cfg, NULL, "first_step_threshold");
|
||||||
|
|
||||||
if (servo_first_step_threshold > 0.0) {
|
if (servo_first_step_threshold > 0.0) {
|
||||||
servo->first_step_threshold =
|
servo->first_step_threshold =
|
||||||
servo_first_step_threshold * NSEC_PER_SEC;
|
servo_first_step_threshold * NSEC_PER_SEC;
|
||||||
|
|
9
servo.h
9
servo.h
|
@ -24,15 +24,6 @@
|
||||||
|
|
||||||
struct config;
|
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
|
* When set to a non-zero value, this variable sets an additional limit for
|
||||||
* the frequency adjustment of the clock. It's in ppb.
|
* the frequency adjustment of the clock. It's in ppb.
|
||||||
|
|
Loading…
Reference in New Issue