Dependencies of PPS API in rtems-libbsd

Gabriel.Moyano at Gabriel.Moyano at
Tue Mar 15 15:31:56 UTC 2022

Hi everybody,

I'm working on enabling PPS support in RTEMS (actually it is already running and I'm preparing the commits to send them) but have couple of questions about functions/macros that are defined in rtems-libbsd repository. Since the repository where the changes need to be applied is just the rtems repo, I'm wondering what is the best way to add those dependencies.

Let me mention which functions/macros I'm talking, where they can be found and then I'll comment what I did.

The functions are:
                int tvtohz(struct timeval *tv); found in rtemsbsd/rtems/rtems-kernel-timesupport.c
                void wakeup(void *chan); found in freebsd/sys/sys/systm.h
                long lmax(long a, long b); found in freebsd/sys/sys/libkern.h
                quad_t qmin(quad_t a, quad_t b); found in freebsd/sys/sys/libkern.h

Some macros that define new functions based on _sleep():
These macros can be found in freebsd/sys/sys/systm.h

And another macro:
ENOIOCTL; found in rtemsbsd/include/machine/rtems-bsd-kernel-space.h

Some easy solution is to copy the definition in the file where is needed. This was done for lmax(), qmin() and ENOIOCTL.
In case of tvtohz() and wakeup() can be used a pointer to function. For doing the same with msleep(), msleep_spin() and tsleep(), they need to be defined as a function first; or a maybe a pointer to _sleep() can be used and then the definition of the macros copied (I did the first).

The next question is when/where to set these pointers. I thought that a good place where this can happen is while rtems_bsd_initialize() is called. For doing this a kernel module and some macros in rtems-bsd-config.h need to be added.

Please let me know if there is a better way to do these things.
Thanks in advance.


Deutsches Zentrum für Luft- und Raumfahrt e.V. (DLR)
Institute for Software Technology | SC-SRV-OSS | Lilienthalplatz 7 | 38108 Braunschweig  | Germany

Gabriel Moyano | Research Scientist in Onboard Software Systems group

More information about the devel mailing list