AW: Dependencies of PPS API in rtems-libbsd

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Mar 17 12:45:52 UTC 2022



On 16/03/2022 08:04, Gabriel.Moyano at dlr.de wrote:
> Hello Sebastian,
> 
>> On 15/03/2022 16:31, Gabriel.Moyano at dlr.de wrote:
>>> I'm working on enabling PPS support in RTEMS
>>
>> does this mean you want to define PPS_SYNC for kern_tc.c and kern_ntptime.c in RTEMS?
> 
> yes
> 
>> I guess you want to enable tc_poll_pps in struct timecounter as well?
> 
> I didn't plan to do that but it can be done just removing some #ifndef, right?

Is this handler not use for the PPS support? If it is currently unused, 
then please let it disabled.

> 
>> For what do you need the sleep() and wakeup() support? Is this only used by the RFC 2783 PPS-API implementation?
> 
> Yes, they are required by pps_fetch() and pps_event()
>   
>> If you want to keep implement this in RTEMS, then you can convert this to use a condition variable from <sys/lock.h> or
>> <rtems/thread.h>.
> 
> Do you mean to add a condition variable, for example in struct pps_state, and to replace sleep() and wakeup() by wait and signal? It is good idea if we don't want to use the first functions.

Ok, it seems the pps_event() could be called by interrupt service 
routines. In this case, you cannot use a mutex and condition variables. 
You have to use a thread queue directly. Use the thread queue ISR lock 
for mutual exclusion. Use _Thread_queue_Enqueue() to emulate sleep() and 
_Thread_queue_Flush_critical() to emulate wakeup(). Check all critical 
sections that they can be protected by an ISR lock (no blocking calls 
and short).

> 
>> All the uses of sleep() and wakeup() need to be clearly identified and if possible avoided.
> 
> May I ask, what is the reason for avoiding them?

The sleep() and wakeup() synchronization is nice, but not suitable for 
real-time systems (use of hash tables).

> 
> What do you think about coping the functions lmax()/qmin() and the define for ENOIOCTL? For lmax()/qmin() I saw that the file where are defined (libkern.h) is in libnetworking. Not sure what it is the best option here, I don't like when the things are duplicated.

Since you refer to libnetworking I guess you work with RTEMS 5. Please 
first get it working on RTEMS 6 and then we think about a back port.

> 
> What about tvtohz(), which is defined in rtemsbsd/rtems/rtems-kernel-timesupport.c?

Maybe just copy the dependencies to kern_tc.c. Later we can try to move 
them to shared locations if necessary.

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/


More information about the devel mailing list