[ac7d5ef0] | 1 | /* |
---|
| 2 | * |
---|
| 3 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
| 4 | * On-Line Applications Research Corporation (OAR). |
---|
| 5 | * All rights assigned to U.S. Government, 1994. |
---|
| 6 | * |
---|
| 7 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
| 8 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
| 9 | * notice must appear in all copies of this file and its derivatives. |
---|
| 10 | * |
---|
| 11 | * $Id$ |
---|
| 12 | */ |
---|
| 13 | |
---|
[3a4ae6c] | 14 | #define TEST_INIT |
---|
[ac7d5ef0] | 15 | #include "system.h" |
---|
| 16 | |
---|
[5c491aef] | 17 | rtems_id Task_id[ OPERATION_COUNT+1 ], task_index; |
---|
[ac7d5ef0] | 18 | |
---|
| 19 | rtems_task High_task( |
---|
| 20 | rtems_task_argument argument |
---|
| 21 | ); |
---|
| 22 | |
---|
| 23 | rtems_task Middle_tasks( |
---|
| 24 | rtems_task_argument argument |
---|
| 25 | ); |
---|
| 26 | |
---|
| 27 | rtems_task Low_task( |
---|
| 28 | rtems_task_argument argument |
---|
| 29 | ); |
---|
| 30 | |
---|
| 31 | void test_init(); |
---|
| 32 | |
---|
| 33 | rtems_task Init( |
---|
| 34 | rtems_task_argument argument |
---|
| 35 | ) |
---|
| 36 | { |
---|
| 37 | rtems_status_code status; |
---|
| 38 | |
---|
[3a4ae6c] | 39 | Print_Warning(); |
---|
| 40 | |
---|
[ac7d5ef0] | 41 | puts( "\n\n*** TIME TEST 7 ***" ); |
---|
| 42 | |
---|
| 43 | test_init(); |
---|
| 44 | |
---|
| 45 | status = rtems_task_delete( RTEMS_SELF ); |
---|
| 46 | directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | void test_init() |
---|
| 50 | { |
---|
| 51 | rtems_status_code status; |
---|
| 52 | rtems_task_priority priority; |
---|
| 53 | rtems_task_entry task_entry; |
---|
| 54 | rtems_unsigned32 index; |
---|
| 55 | |
---|
| 56 | priority = 250; |
---|
| 57 | |
---|
| 58 | for( index=0 ; index <= OPERATION_COUNT ; index++ ) { |
---|
| 59 | status = rtems_task_create( |
---|
| 60 | rtems_build_name( 'T', 'I', 'M', 'E' ), |
---|
| 61 | priority, |
---|
[3652ad35] | 62 | RTEMS_MINIMUM_STACK_SIZE, |
---|
[ac7d5ef0] | 63 | RTEMS_DEFAULT_MODES, |
---|
| 64 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 65 | &Task_id[index] |
---|
| 66 | ); |
---|
| 67 | directive_failed( status, "rtems_task_create" ); |
---|
| 68 | priority--; |
---|
| 69 | |
---|
| 70 | if ( index == 0 ) task_entry = Low_task; |
---|
| 71 | else if ( index == OPERATION_COUNT ) task_entry = High_task; |
---|
| 72 | else task_entry = Middle_tasks; |
---|
| 73 | |
---|
| 74 | status = rtems_task_start( Task_id[index], task_entry, 0 ); |
---|
| 75 | directive_failed( status, "rtems_task_start" ); |
---|
| 76 | } |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | rtems_task High_task( |
---|
| 80 | rtems_task_argument argument |
---|
| 81 | ) |
---|
| 82 | { |
---|
| 83 | if ( argument != 0 ) { |
---|
| 84 | end_time = Read_timer(); |
---|
| 85 | |
---|
| 86 | put_time( |
---|
[5c491aef] | 87 | "rtems_task_restart: suspended task -- preempts caller", |
---|
[ac7d5ef0] | 88 | end_time, |
---|
| 89 | OPERATION_COUNT, |
---|
| 90 | 0, |
---|
| 91 | CALLING_OVERHEAD_TASK_RESTART |
---|
| 92 | ); |
---|
| 93 | } else |
---|
| 94 | (void) rtems_task_suspend( RTEMS_SELF ); |
---|
| 95 | |
---|
[3a4ae6c] | 96 | puts( "*** END OF TEST 7 ***" ); |
---|
[ac7d5ef0] | 97 | exit( 0 ); |
---|
| 98 | } |
---|
| 99 | |
---|
| 100 | rtems_task Middle_tasks( |
---|
| 101 | rtems_task_argument argument |
---|
| 102 | ) |
---|
| 103 | { |
---|
| 104 | task_index++; |
---|
| 105 | |
---|
| 106 | if ( argument != 0 ) |
---|
| 107 | (void) rtems_task_restart( Task_id[ task_index ], 0xffffffff ); |
---|
| 108 | else |
---|
| 109 | (void) rtems_task_suspend( RTEMS_SELF ); |
---|
| 110 | } |
---|
| 111 | |
---|
| 112 | rtems_task Low_task( |
---|
| 113 | rtems_task_argument argument |
---|
| 114 | ) |
---|
| 115 | { |
---|
| 116 | task_index = 1; |
---|
| 117 | |
---|
| 118 | Timer_initialize(); |
---|
| 119 | (void) rtems_task_restart( Task_id[ task_index ], 0xffffffff ); |
---|
| 120 | } |
---|