Skip to content

Commit

Permalink
ts2phc: Provide source type.
Browse files Browse the repository at this point in the history
Save the PPS source type in the instance and add a function to retrieve
it. This will be needed for NMEA-specific rounding of timestamps.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
  • Loading branch information
mlichvar authored and richardcochran committed Jul 28, 2024
1 parent ab3eb1c commit ada36c7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ts2phc_pps_source.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ struct ts2phc_pps_source *ts2phc_pps_source_create(struct ts2phc_private *priv,
src = ts2phc_phc_pps_source_create(priv, dev);
break;
}
if (src)
src->type = type;
return src;
}

Expand All @@ -46,3 +48,8 @@ struct ts2phc_clock *ts2phc_pps_source_get_clock(struct ts2phc_pps_source *src)

return NULL;
}

enum ts2phc_pps_source_type ts2phc_pps_source_get_type(struct ts2phc_pps_source *src)
{
return src->type;
}
7 changes: 7 additions & 0 deletions ts2phc_pps_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,11 @@ int ts2phc_pps_source_getppstime(struct ts2phc_pps_source *src, struct timespec

struct ts2phc_clock *ts2phc_pps_source_get_clock(struct ts2phc_pps_source *src);

/**
* Returns the type of the PPS source
* @param src Pointer to a source obtained via @ref ts2phc_pps_source_create().
* @return The type of the clock.
*/
enum ts2phc_pps_source_type ts2phc_pps_source_get_type(struct ts2phc_pps_source *src);

#endif
1 change: 1 addition & 0 deletions ts2phc_pps_source_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "ts2phc_pps_source.h"

struct ts2phc_pps_source {
enum ts2phc_pps_source_type type;
void (*destroy)(struct ts2phc_pps_source *src);
int (*getppstime)(struct ts2phc_pps_source *src, struct timespec *ts);
struct ts2phc_clock *(*get_clock)(struct ts2phc_pps_source *src);
Expand Down

0 comments on commit ada36c7

Please sign in to comment.