[EXTERNAL] rtems_semaphore routines on SMP systems

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Sep 28 16:42:41 UTC 2021


On 28/09/2021 17:11, Johnson, Andrew N. wrote:
>> sc = rtems_semaphore_create (rtems_build_name ('B', c3, c2, c1),
>>     initialState,
>>     RTEMS_FIFO | RTEMS_SIMPLE_BINARY_SEMAPHORE |
>>         RTEMS_NO_INHERIT_PRIORITY | RTEMS_NO_PRIORITY_CEILING | 
>> RTEMS_LOCAL,
>> 0,
>>     &sid);
> 
> We will want to use the same code on both SMP and UP systems and from 
> earlier posts it sounds like they would need different flags. Does RTEMS 
> define a macro that tells us which we’re compiling for, or will we have 
> to add our own?

You don't need different flags. The earlier post mentioned a new locking 
protocol (MrsP) which is specifically added for SMP systems. This is not 
relevant for this event stuff here.

You can use the RTEMS_SMP define to figure out if RTEMS was built with 
SMP support enabled:

https://docs.rtems.org/branches/master/c-user/symmetric_multiprocessing_services.html#application-configuration

> 
>> Which RTEMS semaphore classes do you use in EPICS and in particular 
>> which classes do you use in interrupt context?
> 
> An epicsEvent must be able to be triggered from interrupt context, and 
> in the above implementation epicsEventTrigger() calls 
> rtems_semaphore_release(). That’s the only routine we need AFAIK.

The RTEMS_SIMPLE_BINARY_SEMAPHORE semaphores can be used from within 
interrupt context. An alternative are:

https://docs.rtems.org/branches/master/c-user/self_contained_objects.html#binary-semaphores

-- 
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 users mailing list