Skip to content

Commit

Permalink
ts2phc: rename "slave clocks" to "PPS sinks"
Browse files Browse the repository at this point in the history
The ts2phc program will introduce clock synchronization which is
orthogonal to the direction in which PPS is emitted (from the master
to the slave).

To have a more consistent terminology, we can avoid using the
ultra-generic term "slave" and replace it with "PPS sink", which
describes the role of the data structure in the new interpretation of
the program in a much clearer way.

Signed-off-by: Vladimir Oltean <[email protected]>
  • Loading branch information
vladimiroltean authored and richardcochran committed May 15, 2022
1 parent 528ec64 commit ddabf9b
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 145 deletions.
24 changes: 12 additions & 12 deletions ts2phc.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct interface {

static void ts2phc_cleanup(struct config *cfg, struct ts2phc_master *master)
{
ts2phc_slave_cleanup();
ts2phc_pps_sink_cleanup();
if (master) {
ts2phc_master_destroy(master);
}
Expand Down Expand Up @@ -55,7 +55,7 @@ static void usage(char *progname)

int main(int argc, char *argv[])
{
int c, err = 0, have_slave = 0, index, print_level;
int c, err = 0, have_sink = 0, index, print_level;
struct ts2phc_master *master = NULL;
enum ts2phc_master_type pps_type;
char *config = NULL, *progname;
Expand Down Expand Up @@ -87,11 +87,11 @@ int main(int argc, char *argv[])
break;
case 'c':
if (!config_create_interface(optarg, cfg)) {
fprintf(stderr, "failed to add slave\n");
fprintf(stderr, "failed to add PPS sink\n");
ts2phc_cleanup(cfg, master);
return -1;
}
have_slave = 1;
have_sink = 1;
break;
case 'f':
config = optarg;
Expand Down Expand Up @@ -156,16 +156,16 @@ int main(int argc, char *argv[])
}
pps_source = interface_name(iface);
} else {
if (ts2phc_slave_add(cfg, interface_name(iface))) {
fprintf(stderr, "failed to add slave\n");
if (ts2phc_pps_sink_add(cfg, interface_name(iface))) {
fprintf(stderr, "failed to add PPS sink\n");
ts2phc_cleanup(cfg, master);
return -1;
}
have_slave = 1;
have_sink = 1;
}
}
if (!have_slave) {
fprintf(stderr, "no slave clocks specified\n");
if (!have_sink) {
fprintf(stderr, "no PPS sinks specified\n");
ts2phc_cleanup(cfg, master);
usage(progname);
return -1;
Expand All @@ -176,8 +176,8 @@ int main(int argc, char *argv[])
usage(progname);
return -1;
}
if (ts2phc_slave_arm()) {
fprintf(stderr, "failed to arm slaves\n");
if (ts2phc_pps_sink_arm()) {
fprintf(stderr, "failed to arm PPS sinks\n");
ts2phc_cleanup(cfg, master);
return -1;
}
Expand All @@ -197,7 +197,7 @@ int main(int argc, char *argv[])
}

while (is_running()) {
err = ts2phc_slave_poll(master);
err = ts2phc_pps_sink_poll(master);
if (err) {
pr_err("poll failed");
break;
Expand Down
Loading

0 comments on commit ddabf9b

Please sign in to comment.