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 CBS 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, stop, now;
0028 
0029   put_name( Task_name[ argument ], FALSE );
0030 
0031   status = rtems_task_wake_after( 2 + Phases[argument] );
0032   directive_failed( status, "rtems_task_wake_after" );
0033 
0034   start = rtems_clock_get_ticks_since_boot();
0035   printf("AT%" PRIdPTR "-S ticks:%d\n", argument, start);
0036   /* active computing */
0037 
0038   while(FOREVER) {
0039     now = rtems_clock_get_ticks_since_boot();
0040     if (now >= start + Execution[argument]) break;
0041   }
0042   stop = rtems_clock_get_ticks_since_boot();
0043   printf("P%" PRIdPTR "-F ticks:%d\n", argument, stop);
0044 
0045   /* delete SELF */
0046   fflush(stdout);
0047   printf( "Killing task %" PRIdPTR "\n", argument);
0048   rtems_task_exit();
0049 }