From 720c9fa08dce20bd9ea59e9d32f42e6443d8755a Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sun, 9 Feb 2020 16:06:21 -0800 Subject: [PATCH] interface: Introduce a method to test supported time stamping modes. Signed-off-by: Richard Cochran Reviewed-by: Jacob Keller --- interface.c | 8 ++++++++ interface.h | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/interface.c b/interface.c index 7a3eddc..74a2512 100644 --- a/interface.c +++ b/interface.c @@ -47,3 +47,11 @@ bool interface_tsinfo_valid(struct interface *iface) { return iface->ts_info.valid ? true : false; } + +bool interface_tsmodes_supported(struct interface *iface, int modes) +{ + if ((iface->ts_info.so_timestamping & modes) == modes) { + return true; + } + return false; +} diff --git a/interface.h b/interface.h index 3526a48..32eec7b 100644 --- a/interface.h +++ b/interface.h @@ -82,4 +82,12 @@ void interface_set_name(struct interface *iface, const char *name); */ bool interface_tsinfo_valid(struct interface *iface); +/** + * Tests whether an interface supports a set of given time stamping modes. + * @param iface The interface of interest. + * @param modes Bit mask of SOF_TIMESTAMPING_ flags. + * @return True if the time stamping modes are supported, false otherwise. + */ +bool interface_tsmodes_supported(struct interface *iface, int modes); + #endif