rtems_rate_monotonic_create return 5
Asma Mehiaoui
asma.mehiaoui at yahoo.com
Thu Sep 15 07:19:35 UTC 2011
Hi,
i'm trying to create a periodic task but the statut of "rtems_rate_monotonic_create" return 5.
The code is:
#include <rtems.h>
#include <stdio.h>
#include <stdlib.h>
#include <bsp.h>
#include "../../testmacros.h"
rtems_id Task_id[ 3]; /* array of task ids */
rtems_name Task_name[ 3 ]; /* array of task names */
rtems_task_priority Priorites[ 3 ] = {1 ,15 ,5};
int j;
char Char_Name;
rtems_task Test_task(
rtems_task_argument task_index
)
{
rtems_id period;
rtems_status_code status;
rtems_id tid;
status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
status = rtems_rate_monotonic_create (Task_name[ task_index ], & period);
if (status != 0)
{
printf("creation fail with %d \n", status);
exit(1);
}
while (1){
if ( rtems_rate_monotonic_period (period, 5) == RTEMS_TIMEOUT)
break;
printf (" je suis la tache %s \n", Task_name [task_index]);
}
status = rtems_rate_monotonic_delete (period);
if (status != 0)
{
printf("destruction fail with %d \n", status);
exit(1);
}
status = rtems_task_delete (tid);
printf("destruction fail with %d \n", status);
exit(1);
}
/**************************************************************************/
rtems_task Init(
rtems_task_argument argument
)
{
rtems_status_code status;
rtems_time_of_day time;
rtems_task_priority the_priority;
time.year = 1988;
time.month = 12;
time.day = 31;
time.hour = 9;
time.minute = 0;
time.second = 0;
time.ticks = 0;
status = rtems_clock_set( &time );
status = rtems_task_set_priority (RTEMS_SELF, 1, &the_priority);
status = rtems_task_set_priority (RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &the_priority);
for (j = 0; j < 2; j++) {
Char_Name = '1'+j;
Task_name [j+1] = rtems_build_name( 'T', 'A', Char_Name, ' ');
put_name (Task_name [j+1] , FALSE);
status = rtems_task_create(
Task_name[ j+1 ], Priorites [j+1], RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ j+1]);
}
for (j = 0; j < 2; j++) {
status = rtems_task_start( Task_id[ j+1 ], Test_task , j+1 );
}
status = rtems_task_delete( RTEMS_SELF );
}
/**************** START OF CONFIGURATION INFORMATION ****************/
#define CONFIGURE_INIT
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 3
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT_TASK_STACK_SIZE (2 * RTEMS_MINIMUM_STACK_SIZE)
#define CONFIGURE_EXTRA_TASK_STACKS (4 * RTEMS_MINIMUM_STACK_SIZE)
#include <rtems/confdefs.h>
/**************** END OF CONFIGURATION INFORMATION ****************/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20110915/df4ce8ae/attachment.html>
More information about the users
mailing list