source: rtems/testsuites/sptests/spedfsched03/tasks_periodic.c @ 99de42c

5
Last change on this file since 99de42c was 3c69c467, checked in by Joel Sherrill <joel.sherrill@…>, on 03/14/15 at 16:08:01

sptests misc: Update to not use deprecated methods

  • Property mode set to 100644
File size: 2.4 KB
RevLine 
[0d6aee4]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
[c499856]13 *  http://www.rtems.org/license/LICENSE.
[0d6aee4]14 */
15
[4e8589d]16#ifdef HAVE_CONFIG_H
17#include "config.h"
18#endif
19
[0d6aee4]20#include "system.h"
21
22rtems_task Tasks_Periodic(
23  rtems_task_argument argument
24)
25{
26  rtems_id          rmid;
27  rtems_id          test_rmid;
28  rtems_status_code status;
29
30  int start, stop, now;
31
32  status = rtems_rate_monotonic_create( argument, &rmid );
33  directive_failed( status, "rtems_rate_monotonic_create" );
34  put_name( Task_name[ argument ], FALSE );
35  printf( "- rtems_rate_monotonic_create id = 0x%08" PRIxrtems_id "\n",
36          rmid );
37
38  status = rtems_rate_monotonic_ident( argument, &test_rmid );
39  directive_failed( status, "rtems_rate_monotonic_ident" );
40  put_name( Task_name[ argument ], FALSE );
41  printf( "- rtems_rate_monotonic_ident id = 0x%08" PRIxrtems_id "\n",
42          test_rmid );
43
44  if ( rmid != test_rmid ) {
45     printf( "RMID's DO NOT MATCH (0x%" PRIxrtems_id " and 0x%"
46             PRIxrtems_id ")\n", rmid, test_rmid );
47     rtems_test_exit( 0 );
48  }
49
50  put_name( Task_name[ argument ], FALSE );
51  printf( "- (0x%08" PRIxrtems_id ") period %" PRIu32 "\n",
52          rmid, Periods[ argument ] );
53
54  status = rtems_task_wake_after( 2 + Phases[argument] );
55  directive_failed( status, "rtems_task_wake_after" );
56
57  while (FOREVER) {
58    if (rtems_rate_monotonic_period(rmid, Periods[argument])==RTEMS_TIMEOUT)
59      printf("P%" PRIdPTR " - Deadline miss\n", argument);
60
[3c69c467]61    start = rtems_clock_get_ticks_since_boot();
[0d6aee4]62    printf("P%" PRIdPTR "-S ticks:%d\n", argument, start);
63    if ( start >= 2*HP_LENGTH ) break; /* stop */
64    /* active computing */
65
66    /* using periodic statistics */
67    while(FOREVER) {
[3c69c467]68      now = rtems_clock_get_ticks_since_boot();
[0d6aee4]69      if (now >= start + Execution[argument]) break;
70    }
[3c69c467]71    stop = rtems_clock_get_ticks_since_boot();
[0d6aee4]72    printf("P%" PRIdPTR "-F ticks:%d\n", argument, stop);
73  }
74
75  /* delete period and SELF */
76  status = rtems_rate_monotonic_delete( rmid );
77  if ( status != RTEMS_SUCCESSFUL ) {
78    printf("rtems_rate_monotonic_delete failed with status of %d.\n",status);
79    rtems_test_exit( 0 );
80  }
81  fflush(stdout);
[6c0301d]82  TEST_END();
[0d6aee4]83  rtems_test_exit( 0 );
84}
Note: See TracBrowser for help on using the repository browser.