Commit 94170821 authored by julien.delange's avatar julien.delange
Browse files

* po-hi-c/src/po_hi_protected.c

   - Support protected objects for XENO_POSIX and XENO_NATIVE

 * po-hi-c/src/po_hi_task.c
   - Add more output when a task does not enforce its deadline

 * po-hi-c/examples/aadlv2/d3.1.3-1/toy_example_xenomai_native.aadl
   - Fix the example with the correct definition of system priorities
     xenomai accepts priority range from 0 to 99 only.



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@2349 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent b9e37a21
......@@ -124,7 +124,7 @@ properties
Period => 1000 ms;
Compute_Execution_time => 0 ms .. 600 ms;
Deadline => 1000 ms;
Cheddar_Properties::Fixed_Priority => 250;
Cheddar_Properties::Fixed_Priority => 50;
end GNC_thread.Impl;
thread TMTC_Thread
......@@ -144,7 +144,7 @@ properties
Period => 100 ms;
Compute_Execution_time => 0 ms .. 50 ms;
Deadline => 100 ms;
Cheddar_Properties::Fixed_Priority => 190;
Cheddar_Properties::Fixed_Priority => 40;
end TMTC_Thread.Impl;
---------------
......@@ -171,7 +171,7 @@ end Toy_Example_Proc.Impl;
processor the_processor
properties
Deployment::Execution_Platform => LINUX32_XENOMAI_NATIVE;
Priority_Range => 0 .. 255;
Priority_Range => 0 .. 99;
end the_processor;
------------
......
......@@ -22,9 +22,10 @@
#if __PO_HI_NB_PROTECTED > 0
#if defined (RTEMS_POSIX) || defined (POSIX)
#if defined (RTEMS_POSIX) || defined (POSIX) || defined (XENO_POSIX)
#define __USE_UNIX98 1
#include <pthread.h>
#include <po_hi_task.h>
/* Declare only needed mutexes according to the generated
* declarations. The __PO_HI_NB_PROTECTED is a generated macro that
......@@ -39,9 +40,7 @@ extern __po_hi_uint8_t __po_hi_protected_priorities[__PO_HI_NB_P
int __po_hi_protected_init ()
{
__po_hi_uint8_t i;
#ifndef __PO_HI_PLATFORM_LINUXTASTE
__po_hi_uint8_t prio;
#endif
for (i = 0 ; i < __PO_HI_NB_PROTECTED ; i++ )
{
......@@ -50,7 +49,6 @@ int __po_hi_protected_init ()
__PO_HI_DEBUG_DEBUG ("[PROTECTED] Error while initializing mutex attr\n");
}
#ifndef __PO_HI_PLATFORM_LINUXTASTE
if (__po_hi_protected_configuration[i] == __PO_HI_PROTECTED_IPCP)
{
if (pthread_mutexattr_setprotocol (&__po_hi_protected_mutexes_attr[i], PTHREAD_PRIO_PROTECT) != 0)
......@@ -62,7 +60,6 @@ int __po_hi_protected_init ()
if (prio == 0)
{
#include <po_hi_task.h>
prio = __PO_HI_MAX_PRIORITY - 1;
}
......@@ -80,7 +77,6 @@ int __po_hi_protected_init ()
__PO_HI_DEBUG_DEBUG ("[PROTECTED] Error while changing mutex protocol\n");
}
}
#endif
if (pthread_mutex_init (&__po_hi_protected_mutexes[i], &__po_hi_protected_mutexes_attr[i]) != 0)
{
......@@ -97,8 +93,11 @@ int __po_hi_protected_lock (__po_hi_protected_t protected_id)
{
if (pthread_mutex_lock (&__po_hi_protected_mutexes[protected_id]) != 0 )
{
__PO_HI_DEBUG_DEBUG ("[PROTECTED] Error when lock protected resource %d\n", protected_id);
return __PO_HI_ERROR_PROTECTED_LOCK;
}
__PO_HI_DEBUG_DEBUG ("[PROTECTED] Successfully lock protected resource %d\n", protected_id);
return __PO_HI_SUCCESS;
}
......@@ -106,11 +105,14 @@ int __po_hi_protected_unlock (__po_hi_protected_t protected_id)
{
if (pthread_mutex_unlock (&__po_hi_protected_mutexes[protected_id]) != 0 )
{
__PO_HI_DEBUG_DEBUG ("[PROTECTED] Error when unlock protected resource %d\n", protected_id);
return __PO_HI_ERROR_PROTECTED_UNLOCK;
}
__PO_HI_DEBUG_DEBUG ("[PROTECTED] Successfully unlock protected resource %d\n", protected_id);
return __PO_HI_SUCCESS;
}
#endif /* POSIX or RTEMS_POSIX */
#endif /* POSIX or RTEMS_POSIX or XENO_POSIX*/
#if defined (RTEMS_PURE)
......@@ -169,7 +171,61 @@ int __po_hi_protected_unlock (__po_hi_protected_t protected_id)
return __PO_HI_SUCCESS;
}
#endif /* POSIX or RTEMS_POSIX */
#endif /* RTEMS_PURE */
#if defined (XENO_NATIVE)
#include <native/mutex.h>
#include <po_hi_task.h>
/* Declare only needed mutexes according to the generated
* declarations. The __PO_HI_NB_PROTECTED is a generated macro that
* represents the needed number of mutexes in the system.
*/
RT_MUTEX __po_hi_protected_mutexes[__PO_HI_NB_PROTECTED];
int __po_hi_protected_init ()
{
__po_hi_uint8_t i;
for (i = 0 ; i < __PO_HI_NB_PROTECTED ; i++ )
{
if (rt_mutex_create (&__po_hi_protected_mutexes[i], NULL) != 0)
{
__PO_HI_DEBUG_DEBUG ("[PROTECTED] Error while creating mutex %d\n", i);
return __PO_HI_ERROR_PROTECTED_CREATE;
}
__PO_HI_DEBUG_DEBUG ("[PROTECTED] Successfully create mutex %d\n", i);
}
return (__PO_HI_SUCCESS);
}
int __po_hi_protected_lock (__po_hi_protected_t protected_id)
{
if (rt_mutex_acquire (&__po_hi_protected_mutexes[protected_id], TM_INFINITE) != 0 )
{
__PO_HI_DEBUG_DEBUG ("[PROTECTED] Error when lock protected resource %d\n", protected_id);
return __PO_HI_ERROR_PROTECTED_LOCK;
}
__PO_HI_DEBUG_DEBUG ("[PROTECTED] Successfully lock protected resource %d\n", protected_id);
return __PO_HI_SUCCESS;
}
int __po_hi_protected_unlock (__po_hi_protected_t protected_id)
{
if (rt_mutex_release (&__po_hi_protected_mutexes[protected_id]) != 0 )
{
__PO_HI_DEBUG_DEBUG ("[PROTECTED] Error when unlock protected resource %d\n", protected_id);
return __PO_HI_ERROR_PROTECTED_UNLOCK;
}
__PO_HI_DEBUG_DEBUG ("[PROTECTED] Successfully unlock protected resource %d\n", protected_id);
return __PO_HI_SUCCESS;
}
#endif /* XENO_NATIVE */
#endif /* __PO_HI_NB_PROTECTED > 0 */
......@@ -164,7 +164,7 @@ int __po_hi_wait_for_next_period (__po_hi_task_id task)
ret = rt_task_wait_period (&overrun);
if ( ret != 0)
{
__DEBUGMSG ("Error in rt_task_period (task=%d;ret=%d)\n", task, ret);
__DEBUGMSG ("Error in rt_task_period (task=%d;ret=%d,overrun=%lu)\n", task, ret, overrun);
return (__PO_HI_ERROR_TASK_PERIOD);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment