clock: store the configuration in the clock data structure.
This will help us to simplify the passing of parameters between the main program. clock, and ports. Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
ae09c1c4c0
commit
1579b7893b
9
clock.c
9
clock.c
|
@ -73,6 +73,7 @@ struct clock_subscriber {
|
|||
};
|
||||
|
||||
struct clock {
|
||||
struct config *config;
|
||||
clockid_t clkid;
|
||||
struct servo *servo;
|
||||
enum servo_type servo_type;
|
||||
|
@ -792,9 +793,10 @@ static void clock_remove_port(struct clock *c, struct port *p)
|
|||
port_close(p);
|
||||
}
|
||||
|
||||
struct clock *clock_create(int phc_index, struct interfaces_head *ifaces,
|
||||
enum timestamp_type timestamping, struct default_ds *dds,
|
||||
enum servo_type servo)
|
||||
struct clock *clock_create(struct config *config, int phc_index,
|
||||
struct interfaces_head *ifaces,
|
||||
enum timestamp_type timestamping,
|
||||
struct default_ds *dds, enum servo_type servo)
|
||||
{
|
||||
int fadj = 0, max_adj = 0, sw_ts = timestamping == TS_SOFTWARE ? 1 : 0;
|
||||
struct clock *c = &the_clock;
|
||||
|
@ -814,6 +816,7 @@ struct clock *clock_create(int phc_index, struct interfaces_head *ifaces,
|
|||
udsif->transport = TRANS_UDS;
|
||||
udsif->delay_filter_length = 1;
|
||||
|
||||
c->config = config;
|
||||
c->free_running = dds->free_running;
|
||||
c->freq_est_interval = dds->freq_est_interval;
|
||||
c->grand_master_capable = dds->grand_master_capable;
|
||||
|
|
8
clock.h
8
clock.h
|
@ -61,6 +61,7 @@ UInteger8 clock_class(struct clock *c);
|
|||
* Create a clock instance. There can only be one clock in any system,
|
||||
* so subsequent calls will destroy the previous clock instance.
|
||||
*
|
||||
* @param config Pointer to the configuration database.
|
||||
* @param phc_index PTP hardware clock device to use.
|
||||
* Pass -1 to select CLOCK_REALTIME.
|
||||
* @param ifaces A queue of network interfaces.
|
||||
|
@ -69,9 +70,10 @@ UInteger8 clock_class(struct clock *c);
|
|||
* @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 interfaces_head *ifaces,
|
||||
enum timestamp_type timestamping, struct default_ds *dds,
|
||||
enum servo_type servo);
|
||||
struct clock *clock_create(struct config *config, int phc_index,
|
||||
struct interfaces_head *ifaces,
|
||||
enum timestamp_type timestamping,
|
||||
struct default_ds *dds, enum servo_type servo);
|
||||
|
||||
/**
|
||||
* Obtains a clock's default data set.
|
||||
|
|
Loading…
Reference in New Issue