source: rtems/testsuites/sptests/spedfsched03/tasks_aperiodic.c @ 74416035

4.115
Last change on this file since 74416035 was 74416035, checked in by Joel Sherrill <joel.sherrill@…>, on 09/20/11 at 13:06:58

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

PR 1916/testing

  • spcbssched02/init.c, spcbssched02/spcbssched02.scn, spcbssched02/system.h, spcbssched02/task_periodic.c, spedfsched03/init.c, spedfsched03/system.h, spedfsched03/tasks_aperiodic.c: Improve coverage.
  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*  Tasks_Aperiodic
2 *
3 *  This routine serves as a test task for the EDF scheduler
4 *  implementation. This is for aperiodic task execution.
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_Aperiodic(
21  rtems_task_argument argument
22)
23{
24  rtems_status_code   status;
25  int                 start;
26  int                 stop;
27  int                 now;
28
29  put_name( Task_name[ argument ], FALSE );
30
31  status = rtems_task_wake_after( 2 + Phases[argument] );
32  directive_failed( status, "rtems_task_wake_after" );
33
34  if ( argument == 6 ) {
35    rtems_task_suspend( Task_id[5] );
36    rtems_task_resume( Task_id[5] );
37  }
38
39  rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start);
40  printf("AT%" PRIdPTR "-S ticks:%d\n", argument, start);
41  /* active computing */
42
43  while(FOREVER) {
44    rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now);
45    if (now >= start + Execution[argument]) break;
46  }
47  rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &stop);
48  printf("P%" PRIdPTR "-F ticks:%d\n", argument, stop);
49
50  /* delete SELF */
51  fflush(stdout);
52  printf( "Killing task %" PRIdPTR "\n", argument);
53  status = rtems_task_delete(RTEMS_SELF);
54  directive_failed(status, "rtems_task_delete of RTEMS_SELF");
55}
Note: See TracBrowser for help on using the repository browser.