5
Rev | Line | |
---|
[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 |
---|
[c499856] | 13 | * http://www.rtems.org/license/LICENSE. |
---|
[0d6aee4] | 14 | */ |
---|
| 15 | |
---|
[4e8589d] | 16 | #ifdef HAVE_CONFIG_H |
---|
| 17 | #include "config.h" |
---|
| 18 | #endif |
---|
| 19 | |
---|
[0d6aee4] | 20 | #include "system.h" |
---|
| 21 | |
---|
| 22 | rtems_task Tasks_Aperiodic( |
---|
| 23 | rtems_task_argument argument |
---|
| 24 | ) |
---|
| 25 | { |
---|
[74416035] | 26 | rtems_status_code status; |
---|
| 27 | int start; |
---|
| 28 | int stop; |
---|
| 29 | int now; |
---|
[0d6aee4] | 30 | |
---|
| 31 | put_name( Task_name[ argument ], FALSE ); |
---|
| 32 | |
---|
| 33 | status = rtems_task_wake_after( 2 + Phases[argument] ); |
---|
| 34 | directive_failed( status, "rtems_task_wake_after" ); |
---|
| 35 | |
---|
[74416035] | 36 | if ( argument == 6 ) { |
---|
| 37 | rtems_task_suspend( Task_id[5] ); |
---|
| 38 | rtems_task_resume( Task_id[5] ); |
---|
| 39 | } |
---|
| 40 | |
---|
[3c69c467] | 41 | start = rtems_clock_get_ticks_since_boot(); |
---|
[0d6aee4] | 42 | printf("AT%" PRIdPTR "-S ticks:%d\n", argument, start); |
---|
| 43 | /* active computing */ |
---|
| 44 | |
---|
| 45 | while(FOREVER) { |
---|
[3c69c467] | 46 | now = rtems_clock_get_ticks_since_boot(); |
---|
[0d6aee4] | 47 | if (now >= start + Execution[argument]) break; |
---|
| 48 | } |
---|
[3c69c467] | 49 | stop = rtems_clock_get_ticks_since_boot(); |
---|
[0d6aee4] | 50 | printf("P%" PRIdPTR "-F ticks:%d\n", argument, stop); |
---|
| 51 | |
---|
| 52 | /* delete SELF */ |
---|
| 53 | fflush(stdout); |
---|
| 54 | printf( "Killing task %" PRIdPTR "\n", argument); |
---|
[51b3cbca] | 55 | rtems_task_exit(); |
---|
[0d6aee4] | 56 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.