[0d6aee4] | 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 | |
---|
[4e8589d] | 18 | #ifdef HAVE_CONFIG_H |
---|
| 19 | #include "config.h" |
---|
| 20 | #endif |
---|
| 21 | |
---|
[0d6aee4] | 22 | #include "system.h" |
---|
| 23 | |
---|
| 24 | rtems_task Tasks_Aperiodic( |
---|
| 25 | rtems_task_argument argument |
---|
| 26 | ) |
---|
| 27 | { |
---|
[74416035] | 28 | rtems_status_code status; |
---|
| 29 | int start; |
---|
| 30 | int stop; |
---|
| 31 | int now; |
---|
[0d6aee4] | 32 | |
---|
| 33 | put_name( Task_name[ argument ], FALSE ); |
---|
| 34 | |
---|
| 35 | status = rtems_task_wake_after( 2 + Phases[argument] ); |
---|
| 36 | directive_failed( status, "rtems_task_wake_after" ); |
---|
| 37 | |
---|
[74416035] | 38 | if ( argument == 6 ) { |
---|
| 39 | rtems_task_suspend( Task_id[5] ); |
---|
| 40 | rtems_task_resume( Task_id[5] ); |
---|
| 41 | } |
---|
| 42 | |
---|
[0d6aee4] | 43 | rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start); |
---|
| 44 | printf("AT%" PRIdPTR "-S ticks:%d\n", argument, start); |
---|
| 45 | /* active computing */ |
---|
| 46 | |
---|
| 47 | while(FOREVER) { |
---|
| 48 | rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now); |
---|
| 49 | if (now >= start + Execution[argument]) break; |
---|
| 50 | } |
---|
| 51 | rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &stop); |
---|
| 52 | printf("P%" PRIdPTR "-F ticks:%d\n", argument, stop); |
---|
| 53 | |
---|
| 54 | /* delete SELF */ |
---|
| 55 | fflush(stdout); |
---|
| 56 | printf( "Killing task %" PRIdPTR "\n", argument); |
---|
| 57 | status = rtems_task_delete(RTEMS_SELF); |
---|
| 58 | directive_failed(status, "rtems_task_delete of RTEMS_SELF"); |
---|
| 59 | } |
---|