source: rtems/testsuites/sptests/spedfsched03/tasks_periodic.c @ 0d6aee4

4.115
Last change on this file since 0d6aee4 was 0d6aee4, checked in by Joel Sherrill <joel.sherrill@…>, on 09/11/11 at 20:56:45

2011-09-11 Petr Benes <benesp16@…>

PR 1897/testing

  • Makefile.am, configure.ac: Add tests for Earliest Deadline First (EDF) Scheduling Algorithm implementation.
  • spedfsched01/.cvsignore, spedfsched01/Makefile.am, spedfsched01/init.c, spedfsched01/spedfsched01.doc, spedfsched01/spedfsched01.scn, spedfsched01/system.h, spedfsched01/task1.c, spedfsched02/.cvsignore, spedfsched02/Makefile.am, spedfsched02/getall.c, spedfsched02/init.c, spedfsched02/spedfsched02.doc, spedfsched02/spedfsched02.scn, spedfsched02/system.h, spedfsched02/task1.c, spedfsched03/.cvsignore, spedfsched03/Makefile.am, spedfsched03/edfparams.h, spedfsched03/init.c, spedfsched03/spedfsched03.doc, spedfsched03/spedfsched03.scn, spedfsched03/system.h, spedfsched03/tasks_aperiodic.c, spedfsched03/tasks_periodic.c: New files.
  • Property mode set to 100644
File size: 2.4 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#include "system.h"
19
20rtems_task Tasks_Periodic(
21  rtems_task_argument argument
22)
23{
24  rtems_id          rmid;
25  rtems_id          test_rmid;
26  rtems_status_code status;
27
28  int start, stop, now;
29
30  status = rtems_rate_monotonic_create( argument, &rmid );
31  directive_failed( status, "rtems_rate_monotonic_create" );
32  put_name( Task_name[ argument ], FALSE );
33  printf( "- rtems_rate_monotonic_create id = 0x%08" PRIxrtems_id "\n",
34          rmid );
35
36  status = rtems_rate_monotonic_ident( argument, &test_rmid );
37  directive_failed( status, "rtems_rate_monotonic_ident" );
38  put_name( Task_name[ argument ], FALSE );
39  printf( "- rtems_rate_monotonic_ident id = 0x%08" PRIxrtems_id "\n",
40          test_rmid );
41
42  if ( rmid != test_rmid ) {
43     printf( "RMID's DO NOT MATCH (0x%" PRIxrtems_id " and 0x%"
44             PRIxrtems_id ")\n", rmid, test_rmid );
45     rtems_test_exit( 0 );
46  }
47
48  put_name( Task_name[ argument ], FALSE );
49  printf( "- (0x%08" PRIxrtems_id ") period %" PRIu32 "\n",
50          rmid, Periods[ argument ] );
51
52  status = rtems_task_wake_after( 2 + Phases[argument] );
53  directive_failed( status, "rtems_task_wake_after" );
54
55  while (FOREVER) {
56    if (rtems_rate_monotonic_period(rmid, Periods[argument])==RTEMS_TIMEOUT)
57      printf("P%" PRIdPTR " - Deadline miss\n", argument);
58
59    rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start);
60    printf("P%" PRIdPTR "-S ticks:%d\n", argument, start);
61    if ( start >= 2*HP_LENGTH ) break; /* stop */
62    /* active computing */
63
64    /* using periodic statistics */
65    while(FOREVER) {
66      rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now);
67      if (now >= start + Execution[argument]) break;
68    }
69    rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &stop);
70    printf("P%" PRIdPTR "-F ticks:%d\n", argument, stop);
71  }
72
73  /* delete period and SELF */
74  status = rtems_rate_monotonic_delete( rmid );
75  if ( status != RTEMS_SUCCESSFUL ) {
76    printf("rtems_rate_monotonic_delete failed with status of %d.\n",status);
77    rtems_test_exit( 0 );
78  }
79  fflush(stdout);
80  puts( "*** END OF TEST EDF SCHEDULER 3 ***" );
81  rtems_test_exit( 0 );
82}
Note: See TracBrowser for help on using the repository browser.