when does rtems_rate_monotonic_period return TIMEOUT ?

Asma Mehiaoui asma.mehiaoui at yahoo.com
Sun Sep 18 17:29:26 UTC 2011


Hello,
 
I'm runing this code of periodic task with rate monotonic period.  I would like to test the case where task missed it's period, could someone help me to do it ? 
I tried to put a loop within but that does not work (the loop does not end). 
What does RTEMS do when rtems_rate_monotonic_period return TIMEOUT ? 
 
rtems_task Task_Rate_Monotonic_Period(
  rtems_task_argument unused
)
{
  rtems_time_of_day time;
  rtems_status_code status;
  uint32_t          ticks_since_boot;
  rtems_name        my_period_name; 
  rtems_id          RM_period;
  bool              is_RM_created = 0;
  uint32_t          count;
 
  while( 1 ) {
    status = rtems_clock_get_tod( &time );
    printf( "\n\nTask 2 - activating every %d second using rate monotonic manager to schedule (rtems_rate_monotonic_period)\n", PERIOD_TASK_RATE_MONOTONIC);
    print_time( " - rtems_clock_get_tod - ", &time, "\n" );
    ticks_since_boot = rtems_clock_get_ticks_since_boot();
    printf(" - Ticks since boot: %" PRIu32 "\n", ticks_since_boot);
    if( TRUE != is_RM_created ) {
      count = 0;
      my_period_name = rtems_build_name( 'P', 'E', 'R', '1' );
      status = rtems_rate_monotonic_create( my_period_name, &RM_period );
      if( RTEMS_SUCCESSFUL != status ) {
 printf("RM failed with status: %d\n", status);
 exit(1);
      }
      // Initiate RM period -- every N2 seconds
      status = rtems_rate_monotonic_period(
        RM_period,
        rtems_clock_get_ticks_per_second() * PERIOD_TASK_RATE_MONOTONIC
      );
      if( RTEMS_SUCCESSFUL != status ) {
 printf("RM failed with status: %d\n", status);
 exit(1);
      }
      is_RM_created = TRUE;
    }
    // Block until RM period has expired -- every N2 seconds
    status = rtems_rate_monotonic_period(
      RM_period,
      rtems_clock_get_ticks_per_second() * PERIOD_TASK_RATE_MONOTONIC
    );
 
//###########################################
int x = 0;
while (x < 10000)
{
x++;
}
//###########################################
    if( RTEMS_SUCCESSFUL != status ) {
      if( RTEMS_TIMEOUT != status ) {
 printf("RM missed period!\n");
      }
      printf("RM failed with status: %d\n", status);
      exit(1);
    }
    }
  }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20110918/cac50164/attachment.html>


More information about the users mailing list