Eliminate the ad-hoc use of global variables in the ts2phc program by introducing one data structure that incorporates them. This might make the code more understandable to people coming from a kernel background, since it resembles the type of data organization used there. It is also now closer to the data organization of phc2sys, a similar program in both purpose and implementation. The reason why this is needed has to do with the ts2phc polymorphism for a PPS master. In the next patches, PPS masters will expose a struct clock, which will be synchronized from the main ts2phc.c. Not all PPS masters will expose a clock, only the PHC kind will. So the current object encapsulation model needs to be loosened up little bit, because the main ts2phc.c needs to synchronize a list of clocks, list which is populated by the slaves and the masters which are capable of being synchronized. So instead of having the translation modules of ts2phc communicate through global variables, let's make struct ts2phc_private the common working space for the entire program, which is a paradigm that is more natural. Signed-off-by: Vladimir Oltean <olteanv@gmail.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
21 lines
531 B
C
21 lines
531 B
C
/**
|
|
* @file ts2phc_slave.h
|
|
* @brief Utility program to synchronize the PHC clock to external events
|
|
* @note Copyright (C) 2019 Balint Ferencz <fernya@sch.bme.hu>
|
|
* @note SPDX-License-Identifier: GPL-2.0+
|
|
*/
|
|
#ifndef HAVE_TS2PHC_SLAVE_H
|
|
#define HAVE_TS2PHC_SLAVE_H
|
|
|
|
#include "ts2phc.h"
|
|
|
|
int ts2phc_slave_add(struct ts2phc_private *priv, const char *name);
|
|
|
|
int ts2phc_slaves_init(struct ts2phc_private *priv);
|
|
|
|
void ts2phc_slave_cleanup(struct ts2phc_private *priv);
|
|
|
|
int ts2phc_slave_poll(struct ts2phc_private *priv);
|
|
|
|
#endif
|