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
parent
d67892abd7
commit
d951ba421f
5
clock.c
5
clock.c
|
@ -398,7 +398,8 @@ UInteger8 clock_class(struct clock *c)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct clock *clock_create(int phc_index, struct interface *iface, int count,
|
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;
|
int i, fadj = 0, max_adj, sw_ts = timestamping == TS_SOFTWARE ? 1 : 0;
|
||||||
struct clock *c = &the_clock;
|
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) {
|
if (c->clkid != CLOCK_INVALID) {
|
||||||
fadj = (int) clock_ppb_read(c->clkid);
|
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) {
|
if (!c->servo) {
|
||||||
pr_err("Failed to create clock servo");
|
pr_err("Failed to create clock servo");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
4
clock.h
4
clock.h
|
@ -66,10 +66,12 @@ UInteger8 clock_class(struct clock *c);
|
||||||
* @param count The number of elements in @a interfaces.
|
* @param count The number of elements in @a interfaces.
|
||||||
* @param timestamping The timestamping mode for this clock.
|
* @param timestamping The timestamping mode for this clock.
|
||||||
* @param ds A pointer to a default data set for the 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.
|
* @return A pointer to the single global clock instance.
|
||||||
*/
|
*/
|
||||||
struct clock *clock_create(int phc_index, struct interface *iface, int count,
|
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.
|
* Obtains a clock's default data set.
|
||||||
|
|
2
ptp4l.c
2
ptp4l.c
|
@ -272,7 +272,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
clock = clock_create(phc_index, iface, cfg_settings.nports,
|
clock = clock_create(phc_index, iface, cfg_settings.nports,
|
||||||
*timestamping, ds);
|
*timestamping, ds, CLOCK_SERVO_PI);
|
||||||
if (!clock) {
|
if (!clock) {
|
||||||
fprintf(stderr, "failed to create a clock\n");
|
fprintf(stderr, "failed to create a clock\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue