Rtems id question

Manuel Pedro Coutinho manuelpedrocoutinho at hotmail.com
Mon Apr 18 10:05:32 UTC 2005


Hi

I'm trying to use the partition and rate monotonic managers on different 
tasks and I can't make them work properly

If I do (for the rate monotonic example)

Init(...)
{
  /* Task Start */
  status = rtems_task_create( rtems_build_name( 'T', 'A', '1', ' ' ),   10,
                	RTEMS_MINIMUM_STACK_SIZE , RTEMS_DEFAULT_MODES,
                	RTEMS_FLOATING_POINT | RTEMS_GLOBAL, &id1);

  status = rtems_task_create( rtems_build_name( 'T', 'A', '2', ' ' ),   20,
		 	RTEMS_MINIMUM_STACK_SIZE , RTEMS_DEFAULT_MODES,
		      	RTEMS_FLOATING_POINT | RTEMS_GLOBAL, &id2);

  status = rtems_task_create( rtems_build_name( 'T', 'A', '3', ' ' ),   30,
		 	RTEMS_MINIMUM_STACK_SIZE , RTEMS_DEFAULT_MODES,
		      	RTEMS_FLOATING_POINT | RTEMS_GLOBAL, &id3);

  /* Rate monotonic Create*/
  rtems_rate_monotonic_create(rtems_build_name( 'R' , 'T' , 'A' , 
'1'),&period1);
  rtems_rate_monotonic_create(rtems_build_name( 'R' , 'T' , 'A' , 
'2'),&period2);
  rtems_rate_monotonic_create(rtems_build_name( 'R' , 'T' , 'A' , 
'3'),&period3);

  /* Rate monotonic start */
  rtems_rate_monotonic_period(periodo1,100);
  rtems_rate_monotonic_period(periodo2,200);
  rtems_rate_monotonic_period(periodo3,300);

   /* Task Start */
   status = rtems_task_start( id3, Task3 , 0 );
   status = rtems_task_start( id2, Task2 , 0 );
   status = rtems_task_start( id1, Task1 , 0 );
   ...
}



and then on each task do something like:



rtems_task Task1(rtems_task_argument arg)
{
  rtems_rate_monotonic_period_status status;
  rtems_id period1;
  rtems_status_code stat;

  stat = rtems_rate_monotonic_ident( rtems_build_name('R' , 'T' , 'A' , '1' 
) , &period1);
  if( stat != RTEMS_SUCCESSFUL )
     fatal_error("error\n");

  while(1)
  {
           /* PERFORM TASK1 */
           .....


           /* Wait for end of period */
           if(rtems_rate_monotonic_period(period1,100) == RTEMS_TIMEOUT)
	fatal_error("error!");
  }
}


This task can't increment the tick count and stays blocked in the 
rate_monotonic_period, but
the RTEMS functions don't return error. The system.h is defined as follows



#define CONFIGURE_MAXIMUM_TASKS                        10
#define CONFIGURE_MICROSECONDS_PER_TICK           100000/2
#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_MAXIMUM_PERIODS                     30
#define CONFIGURE_INIT
#define CONFIGURE_INIT_TASK_PRIORITY                  1
#include <confdefs.h>


if the rate monotonic is built on each task seperatly, the system works so I 
guess this isn't a problem of bad configuration.
Also, if instead of each searching for the rate monotonic name, it uses its 
global id variable, the result is the same: the tick variable doesn't 
change.

A similar error comes when I use the partition: It's created during driver 
initialization and when used on a task (using its global id), the 
partition_get function doesn't return an error but something "stupid" 
happens: I do the following

  rtems_partition_get( partition_id, &pointer );
  pointer->some_field = 10;

and when I print the pointer->some_field, it always returns 255, no matter 
of what I try to put there! (by the way, the pointer->some_field is an 
unsigned char)


Can anyone tell me what I'm doing wrong? I'm sure this must be something 
very simple to workout, but I can't manage to figure this one out!

Many Thanks
Manuel Coutinho

_________________________________________________________________
MSN Hotmail, o maior webmail do Brasil. http://www.hotmail.com




More information about the users mailing list