[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 | |
---|
| 18 | #include "system.h" |
---|
| 19 | |
---|
| 20 | rtems_task Tasks_Aperiodic( |
---|
| 21 | rtems_task_argument argument |
---|
| 22 | ) |
---|
| 23 | { |
---|
[74416035] | 24 | rtems_status_code status; |
---|
| 25 | int start; |
---|
| 26 | int stop; |
---|
| 27 | int now; |
---|
[0d6aee4] | 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 | |
---|
[74416035] | 34 | if ( argument == 6 ) { |
---|
| 35 | rtems_task_suspend( Task_id[5] ); |
---|
| 36 | rtems_task_resume( Task_id[5] ); |
---|
| 37 | } |
---|
| 38 | |
---|
[0d6aee4] | 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 | } |
---|