Wolfgang Mauerer wrote:
> Wall time management is typically assisted by the NTP
> protocol in the Linux context, but this information is
> not propagated to Xenomai. This patch adds support
> for a CLOCK_HOST_REALTIME clock id that is coupled to the
> host operating system's realtime clock. The required
> information from the Kernel into Xenomai. The data exchange
> is designed to allow for lockless reading from userland.
> 
> Signed-off-by: Wolfgang Mauerer <wolfgang.maue...@siemens.com>
> Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>
> ---
>  include/posix/time.h     |    2 +
>  ksrc/skins/posix/clock.c |   90 
> +++++++++++++++++++++++++++++++++++++++++++++-
>  2 files changed, 91 insertions(+), 1 deletions(-)
> 
> diff --git a/include/posix/time.h b/include/posix/time.h
> index 4f2d760..938feb6 100644
> --- a/include/posix/time.h
> +++ b/include/posix/time.h
> @@ -50,6 +50,8 @@
>  #define CLOCK_MONOTONIC 1
>  #endif /* CLOCK_MONOTONIC */
>  
> +#define CLOCK_HOST_REALTIME 16
> +
>  #if defined(__KERNEL__) || defined(__XENO_SIM__)
>  
>  struct sigevent;
> diff --git a/ksrc/skins/posix/clock.c b/ksrc/skins/posix/clock.c
> index 553e123..f5a789b 100644
> --- a/ksrc/skins/posix/clock.c
> +++ b/ksrc/skins/posix/clock.c
> @@ -50,6 +50,13 @@
>   *...@{*/
>  
>  #include <posix/thread.h>
> +#include <linux/ipipe_tickdev.h>
> +#include <linux/math64.h>

Do we really need this? Because we probably do not have it in 2.4
kernels. Besides, we do not include linux/ headers in Xenomai code.

> +static int do_clock_host_realtime(struct timespec *tp)
> +{
> +#ifdef CONFIG_XENO_OPT_HOSTRT
> (...)
> +     return 0;
> +#else /* CONFIG_XENO_OPT_HOSTRT */
> +     return -1;

return -EINVAL;

> +     case CLOCK_HOST_REALTIME:
> +             if (do_clock_host_realtime(tp) != 0) {
                rc = do_clock_host_realtime(tp);
                if (rc < 0) {
                        thread_set_errno(-rc);
                        return -1;
                }


-- 
                                            Gilles.

_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to