ptp4l: modify clock_create to take servo as argument

this patch modifies the clock_create to take the servo type as an argument

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

View File

@ -398,7 +398,8 @@ UInteger8 clock_class(struct clock *c)
}
struct clock *clock_create(int phc_index, struct interface *iface, int count,
enum timestamp_type timestamping, struct defaultDS *ds)
enum timestamp_type timestamping, struct defaultDS *ds,
enum servo_type servo)
{
int i, fadj = 0, max_adj, sw_ts = timestamping == TS_SOFTWARE ? 1 : 0;
struct clock *c = &the_clock;
@ -437,7 +438,7 @@ struct clock *clock_create(int phc_index, struct interface *iface, int count,
if (c->clkid != CLOCK_INVALID) {
fadj = (int) clock_ppb_read(c->clkid);
}
c->servo = servo_create(CLOCK_SERVO_PI, -fadj, max_adj, sw_ts);
c->servo = servo_create(servo, -fadj, max_adj, sw_ts);
if (!c->servo) {
pr_err("Failed to create clock servo");
return NULL;

View File

@ -66,10 +66,12 @@ UInteger8 clock_class(struct clock *c);
* @param count The number of elements in @a interfaces.
* @param timestamping The timestamping mode for this clock.
* @param ds A pointer to a default data set for the clock.
* @param servo The servo that this clock will use.
* @return A pointer to the single global clock instance.
*/
struct clock *clock_create(int phc_index, struct interface *iface, int count,
enum timestamp_type timestamping, struct defaultDS *ds);
enum timestamp_type timestamping, struct defaultDS *ds,
enum servo_type servo);
/**
* Obtains a clock's default data set.

View File

@ -272,7 +272,7 @@ int main(int argc, char *argv[])
}
clock = clock_create(phc_index, iface, cfg_settings.nports,
*timestamping, ds);
*timestamping, ds, CLOCK_SERVO_PI);
if (!clock) {
fprintf(stderr, "failed to create a clock\n");
return -1;