source: rtems/testsuites/sptests/spedfsched03/tasks_periodic.c @ 4e8589d

4.115
Last change on this file since 4e8589d was 4e8589d, checked in by Ralf Corsepius <ralf.corsepius@…>, on 09/29/11 at 16:20:49

2011-09-29 Ralf Corsépius <ralf.corsepius@…>

  • sp75/init.c, spcbssched01/init.c, spcbssched01/task1.c spcbssched02/init.c, spcbssched02/task_periodic.c, spcbssched03/init.c, spcbssched03/tasks_aperiodic.c, spcbssched03/tasks_periodic.c, spedfsched01/init.c, spedfsched01/task1.c, spedfsched02/getall.c, spedfsched02/init.c, spedfsched02/task1.c, spedfsched03/init.c, spedfsched03/tasks_aperiodic.c, spedfsched03/tasks_periodic.c, sprbtree01/init.c: Add HAVE_CONFIG_H.
  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*  Tasks_Periodic
2 *
3 *  This routine serves as a test task for the EDF scheduler
4 *  implementation.
5 *
6 *  Input parameters:
7 *    argument - task argument
8 *
9 *  Output parameters:  NONE
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.com/license/LICENSE.
14 *
15 *  $Id$
16 */
17
18#ifdef HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include "system.h"
23
24rtems_task Tasks_Periodic(
25  rtems_task_argument argument
26)
27{
28  rtems_id          rmid;
29  rtems_id          test_rmid;
30  rtems_status_code status;
31
32  int start, stop, now;
33
34  status = rtems_rate_monotonic_create( argument, &rmid );
35  directive_failed( status, "rtems_rate_monotonic_create" );
36  put_name( Task_name[ argument ], FALSE );
37  printf( "- rtems_rate_monotonic_create id = 0x%08" PRIxrtems_id "\n",
38          rmid );
39
40  status = rtems_rate_monotonic_ident( argument, &test_rmid );
41  directive_failed( status, "rtems_rate_monotonic_ident" );
42  put_name( Task_name[ argument ], FALSE );
43  printf( "- rtems_rate_monotonic_ident id = 0x%08" PRIxrtems_id "\n",
44          test_rmid );
45
46  if ( rmid != test_rmid ) {
47     printf( "RMID's DO NOT MATCH (0x%" PRIxrtems_id " and 0x%"
48             PRIxrtems_id ")\n", rmid, test_rmid );
49     rtems_test_exit( 0 );
50  }
51
52  put_name( Task_name[ argument ], FALSE );
53  printf( "- (0x%08" PRIxrtems_id ") period %" PRIu32 "\n",
54          rmid, Periods[ argument ] );
55
56  status = rtems_task_wake_after( 2 + Phases[argument] );
57  directive_failed( status, "rtems_task_wake_after" );
58
59  while (FOREVER) {
60    if (rtems_rate_monotonic_period(rmid, Periods[argument])==RTEMS_TIMEOUT)
61      printf("P%" PRIdPTR " - Deadline miss\n", argument);
62
63    rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start);
64    printf("P%" PRIdPTR "-S ticks:%d\n", argument, start);
65    if ( start >= 2*HP_LENGTH ) break; /* stop */
66    /* active computing */
67
68    /* using periodic statistics */
69    while(FOREVER) {
70      rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now);
71      if (now >= start + Execution[argument]) break;
72    }
73    rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &stop);
74    printf("P%" PRIdPTR "-F ticks:%d\n", argument, stop);
75  }
76
77  /* delete period and SELF */
78  status = rtems_rate_monotonic_delete( rmid );
79  if ( status != RTEMS_SUCCESSFUL ) {
80    printf("rtems_rate_monotonic_delete failed with status of %d.\n",status);
81    rtems_test_exit( 0 );
82  }
83  fflush(stdout);
84  puts( "*** END OF TEST EDF SCHEDULER 3 ***" );
85  rtems_test_exit( 0 );
86}
Note: See TracBrowser for help on using the repository browser.