How to program fine-grained real-time concurrent applications in C or Ada

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Dec 31 12:03:49 UTC 2020


Hello Mattia,

On 24/12/2020 11:24, Mattia Bottaro wrote:
> I need to develop a multitasking real-time application with RTEMS 
> (preferably in Ada, but also C solutions are welcomed). I see that I 
> can use the Classic API 
> <https://docs.rtems.org/branches/master/c-user/index.html>, but they 
> are unsuitable to my purposes. As you can read here 
> <https://docs.rtems.org/branches/master/c-user/task/directives.html#task-wake-when-wake-up-when-specified>, 
> the rtems_task_wake_when directive is too coarse: "The timing 
> granularity of this directive is a second.".
> I need to work with microseconds-granularity and I cannot find how to 
> do it.

this limitation is do some implementation constraints which no longer 
apply. From an API point of view

/**
  * @ingroup RTEMSAPIClassicTypes
  *
  * @brief This type represents Classic API calendar times.
  */
typedef struct {
[...]

   /**
    * @brief This member contains the clock tick of the second with 
values from 0
    *   to rtems_clock_get_ticks_per_second() minus one.
    */
   uint32_t ticks;
} rtems_time_of_day;

it would be possible to also specify the clock driver ticks of a time 
point. The rtems_task_wake_when() uses _Thread_Timer_insert_realtime() 
which uses a time with a nanoseconds resolution. It would be easy to 
change the implementation of rtems_task_wake_when() to use the clock 
driver ticks.

As already mentioned, the clock_nanosleep() provides this functionality 
already.

-- 
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