Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:46

0001 /*  Tasks_Aperiodic
0002  *
0003  *  This routine serves as a test task for the EDF scheduler
0004  *  implementation. This is for aperiodic task execution.
0005  *
0006  *  Input parameters:
0007  *    argument - task argument
0008  *
0009  *  Output parameters:  NONE
0010  *
0011  *  The license and distribution terms for this file may be
0012  *  found in the file LICENSE in this distribution or at
0013  *  http://www.rtems.org/license/LICENSE.
0014  */
0015 
0016 #ifdef HAVE_CONFIG_H
0017 #include "config.h"
0018 #endif
0019 
0020 #include "system.h"
0021 
0022 rtems_task Tasks_Aperiodic(
0023   rtems_task_argument argument
0024 )
0025 {
0026   rtems_status_code   status;
0027   int                 start;
0028   int                 stop;
0029   int                 now;
0030 
0031   put_name( Task_name[ argument ], FALSE );
0032 
0033   status = rtems_task_wake_after( 2 + Phases[argument] );
0034   directive_failed( status, "rtems_task_wake_after" );
0035 
0036   if ( argument == 6 ) {
0037     rtems_task_suspend( Task_id[5] );
0038     rtems_task_resume( Task_id[5] );
0039   }
0040 
0041   start = rtems_clock_get_ticks_since_boot();
0042   printf("AT%" PRIdPTR "-S ticks:%d\n", argument, start);
0043   /* active computing */
0044 
0045   while(FOREVER) {
0046     now = rtems_clock_get_ticks_since_boot();
0047     if (now >= start + Execution[argument]) break;
0048   }
0049   stop = rtems_clock_get_ticks_since_boot();
0050   printf("P%" PRIdPTR "-F ticks:%d\n", argument, stop);
0051 
0052   /* delete SELF */
0053   fflush(stdout);
0054   printf( "Killing task %" PRIdPTR "\n", argument);
0055   rtems_task_exit();
0056 }