ptp4l: add servo selection to the configuration file

this patch adds the servo selection to the configuration file

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
master
Jacob Keller 2012-09-28 11:45:54 -07:00 committed by Richard Cochran
parent d951ba421f
commit 3464c9cfb4
3 changed files with 15 additions and 1 deletions

View File

@ -303,6 +303,13 @@ static void scan_global_line(const char *s, struct config *cfg)
cfg->transport = TRANS_IEEE_802_3;
}
} else if (1 == sscanf(s, " clock_servo %1023s", string)) {
if (0 == strcasecmp("pi", string))
cfg->clock_servo = CLOCK_SERVO_PI;
}
}

View File

@ -23,6 +23,7 @@
#include "ds.h"
#include "dm.h"
#include "transport.h"
#include "servo.h"
#define MAX_PORTS 8
#define MAX_IFNAME_SIZE 16
@ -60,6 +61,9 @@ struct config {
int *assume_two_step;
int *tx_timestamp_retries;
int *rx_timestamp_l2only;
enum servo_type clock_servo;
double *pi_proportional_const;
double *pi_integral_const;
unsigned char *ptp_dst_mac;

View File

@ -65,6 +65,9 @@ static struct config cfg_settings = {
.assume_two_step = &assume_two_step,
.tx_timestamp_retries = &sk_tx_retries,
.rx_timestamp_l2only = &sk_prefer_layer2,
.clock_servo = CLOCK_SERVO_PI,
.pi_proportional_const = &configured_pi_kp,
.pi_integral_const = &configured_pi_ki,
.ptp_dst_mac = ptp_dst_mac,
@ -272,7 +275,7 @@ int main(int argc, char *argv[])
}
clock = clock_create(phc_index, iface, cfg_settings.nports,
*timestamping, ds, CLOCK_SERVO_PI);
*timestamping, ds, cfg_settings.clock_servo);
if (!clock) {
fprintf(stderr, "failed to create a clock\n");
return -1;