config: convert the 'max_frequency' option to the new scheme.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2015-08-12 15:32:55 +02:00
parent 4f649b1ec4
commit e8a2956ce0
5 changed files with 3 additions and 18 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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,

View File

@ -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;

View File

@ -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;