config: convert the 'max_frequency' option to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
4f649b1ec4
commit
e8a2956ce0
7
config.c
7
config.c
|
@ -94,6 +94,7 @@ 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("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_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),
|
||||||
|
@ -585,12 +586,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, "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")) {
|
} else if (!strcmp(option, "sanity_freq_limit")) {
|
||||||
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)
|
||||||
|
|
2
config.h
2
config.h
|
@ -72,8 +72,6 @@ struct config {
|
||||||
struct port_defaults pod;
|
struct port_defaults pod;
|
||||||
enum servo_type clock_servo;
|
enum servo_type clock_servo;
|
||||||
|
|
||||||
int *max_frequency;
|
|
||||||
|
|
||||||
double *pi_proportional_const;
|
double *pi_proportional_const;
|
||||||
double *pi_integral_const;
|
double *pi_integral_const;
|
||||||
double *pi_proportional_scale;
|
double *pi_proportional_scale;
|
||||||
|
|
2
ptp4l.c
2
ptp4l.c
|
@ -103,8 +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,
|
||||||
|
|
||||||
.max_frequency = &servo_max_frequency,
|
|
||||||
|
|
||||||
.pi_proportional_const = &configured_pi_kp,
|
.pi_proportional_const = &configured_pi_kp,
|
||||||
.pi_integral_const = &configured_pi_ki,
|
.pi_integral_const = &configured_pi_ki,
|
||||||
.pi_proportional_scale = &configured_pi_kp_scale,
|
.pi_proportional_scale = &configured_pi_kp_scale,
|
||||||
|
|
4
servo.c
4
servo.c
|
@ -27,13 +27,12 @@
|
||||||
|
|
||||||
#define NSEC_PER_SEC 1000000000
|
#define NSEC_PER_SEC 1000000000
|
||||||
|
|
||||||
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_first_step_threshold;
|
||||||
double servo_step_threshold;
|
double servo_step_threshold;
|
||||||
|
int servo_max_frequency;
|
||||||
struct servo *servo;
|
struct servo *servo;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -70,6 +69,7 @@ struct servo *servo_create(struct config *cfg, enum servo_type type,
|
||||||
servo->first_step_threshold = 0.0;
|
servo->first_step_threshold = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
servo_max_frequency = config_get_int(cfg, NULL, "max_frequency");
|
||||||
servo->max_frequency = max_ppb;
|
servo->max_frequency = max_ppb;
|
||||||
if (servo_max_frequency && servo->max_frequency > servo_max_frequency) {
|
if (servo_max_frequency && servo->max_frequency > servo_max_frequency) {
|
||||||
servo->max_frequency = servo_max_frequency;
|
servo->max_frequency = servo_max_frequency;
|
||||||
|
|
6
servo.h
6
servo.h
|
@ -24,12 +24,6 @@
|
||||||
|
|
||||||
struct config;
|
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 */
|
/** Opaque type */
|
||||||
struct servo;
|
struct servo;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue