forked from richardcochran/linuxptp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 "master" and replace it with "PPS source", 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
1 parent
ddabf9b
commit 58c7f9d
Showing
12 changed files
with
190 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/** | ||
* @file ts2phc_generic_master.c | ||
* @file ts2phc_generic_pps_source.c | ||
* @note Copyright (C) 2019 Richard Cochran <[email protected]> | ||
* @note SPDX-License-Identifier: GPL-2.0+ | ||
*/ | ||
|
@@ -12,14 +12,14 @@ | |
#include "ts2phc_pps_source_private.h" | ||
#include "util.h" | ||
|
||
struct ts2phc_generic_master { | ||
struct ts2phc_master master; | ||
struct ts2phc_generic_pps_source { | ||
struct ts2phc_pps_source pps_source; | ||
}; | ||
|
||
static void ts2phc_generic_master_destroy(struct ts2phc_master *master) | ||
static void ts2phc_generic_pps_source_destroy(struct ts2phc_pps_source *src) | ||
{ | ||
struct ts2phc_generic_master *s = | ||
container_of(master, struct ts2phc_generic_master, master); | ||
struct ts2phc_generic_pps_source *s = | ||
container_of(src, struct ts2phc_generic_pps_source, pps_source); | ||
free(s); | ||
} | ||
|
||
|
@@ -28,8 +28,8 @@ static void ts2phc_generic_master_destroy(struct ts2phc_master *master) | |
* PPS event was generated. This implementation assumes that the | ||
* system time is approximately correct. | ||
*/ | ||
static int ts2phc_generic_master_getppstime(struct ts2phc_master *m, | ||
struct timespec *ts) | ||
static int ts2phc_generic_pps_source_getppstime(struct ts2phc_pps_source *src, | ||
struct timespec *ts) | ||
{ | ||
struct timex ntx; | ||
int code; | ||
|
@@ -47,17 +47,17 @@ static int ts2phc_generic_master_getppstime(struct ts2phc_master *m, | |
return 0; | ||
} | ||
|
||
struct ts2phc_master *ts2phc_generic_master_create(struct config *cfg, | ||
const char *dev) | ||
struct ts2phc_pps_source *ts2phc_generic_pps_source_create(struct config *cfg, | ||
const char *dev) | ||
{ | ||
struct ts2phc_generic_master *master; | ||
struct ts2phc_generic_pps_source *src; | ||
|
||
master = calloc(1, sizeof(*master)); | ||
if (!master) { | ||
src = calloc(1, sizeof(*src)); | ||
if (!src) { | ||
return NULL; | ||
} | ||
master->master.destroy = ts2phc_generic_master_destroy; | ||
master->master.getppstime = ts2phc_generic_master_getppstime; | ||
src->pps_source.destroy = ts2phc_generic_pps_source_destroy; | ||
src->pps_source.getppstime = ts2phc_generic_pps_source_getppstime; | ||
|
||
return &master->master; | ||
return &src->pps_source; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,12 @@ | |
* @note Copyright (C) 2019 Richard Cochran <[email protected]> | ||
* @note SPDX-License-Identifier: GPL-2.0+ | ||
*/ | ||
#ifndef HAVE_TS2PHC_GENERIC_MASTER_H | ||
#define HAVE_TS2PHC_GENERIC_MASTER_H | ||
#ifndef HAVE_TS2PHC_GENERIC_PPS_SOURCE_H | ||
#define HAVE_TS2PHC_GENERIC_PPS_SOURCE_H | ||
|
||
#include "ts2phc_pps_source.h" | ||
|
||
struct ts2phc_master *ts2phc_generic_master_create(struct config *cfg, | ||
const char *dev); | ||
struct ts2phc_pps_source *ts2phc_generic_pps_source_create(struct config *cfg, | ||
const char *dev); | ||
|
||
#endif |
Oops, something went wrong.