Re: [Linuxptp-devel] [PATCH RFC 22/30] interface: Introduce a method to test supported time stamping modes.

2020-02-18 Thread Jacob Keller



On 2/11/2020 6:04 AM, Richard Cochran wrote:
> 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);
> + 

Good, the documentation comment indicates modes is a bitmask. In
otherwords, interface_tsmodes_supported can return true if modes is a
subset of the supported interface modes.

Ok.

>  #endif
> 


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


[Linuxptp-devel] [PATCH RFC 22/30] interface: Introduce a method to test supported time stamping modes.

2020-02-11 Thread Richard Cochran
Signed-off-by: Richard Cochran 
---
 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
-- 
2.20.1



___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel