[ac7d5ef0] | 1 | /* |
---|
[9410d011] | 2 | * COPYRIGHT (c) 1989-2013. |
---|
[ac7d5ef0] | 3 | * On-Line Applications Research Corporation (OAR). |
---|
| 4 | * |
---|
[98e4ebf5] | 5 | * The license and distribution terms for this file may be |
---|
| 6 | * found in the file LICENSE in this distribution or at |
---|
[c499856] | 7 | * http://www.rtems.org/license/LICENSE. |
---|
[ac7d5ef0] | 8 | */ |
---|
| 9 | |
---|
[a4bc4d6e] | 10 | #ifdef HAVE_CONFIG_H |
---|
| 11 | #include "config.h" |
---|
| 12 | #endif |
---|
| 13 | |
---|
[d1128e2] | 14 | #define CONFIGURE_INIT |
---|
[ac7d5ef0] | 15 | #include "system.h" |
---|
| 16 | |
---|
| 17 | rtems_asr Process_asr_for_pass_1( |
---|
| 18 | rtems_signal_set signals |
---|
| 19 | ); |
---|
| 20 | |
---|
| 21 | rtems_asr Process_asr_for_pass_2( |
---|
| 22 | rtems_signal_set signals |
---|
| 23 | ); |
---|
| 24 | |
---|
| 25 | rtems_task Task_1( |
---|
| 26 | rtems_task_argument argument |
---|
| 27 | ); |
---|
| 28 | |
---|
| 29 | rtems_task Task_2( |
---|
| 30 | rtems_task_argument argument |
---|
| 31 | ); |
---|
| 32 | |
---|
| 33 | rtems_task Task_3( |
---|
| 34 | rtems_task_argument argument |
---|
| 35 | ); |
---|
| 36 | |
---|
| 37 | rtems_task Init( |
---|
| 38 | rtems_task_argument argument |
---|
| 39 | ) |
---|
| 40 | { |
---|
| 41 | rtems_status_code status; |
---|
| 42 | |
---|
[3a4ae6c] | 43 | Print_Warning(); |
---|
| 44 | |
---|
[ac7d5ef0] | 45 | puts( "\n\n*** TIME TEST 19 ***" ); |
---|
| 46 | |
---|
| 47 | status = rtems_task_create( |
---|
| 48 | rtems_build_name( 'T', 'I', 'M', 'E' ), |
---|
[1055ce20] | 49 | (RTEMS_MAXIMUM_PRIORITY / 2u) + 1u, |
---|
[3652ad35] | 50 | RTEMS_MINIMUM_STACK_SIZE, |
---|
[ac7d5ef0] | 51 | RTEMS_DEFAULT_MODES, |
---|
| 52 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 53 | &Task_id[ 1 ] |
---|
| 54 | ); |
---|
| 55 | directive_failed( status, "rtems_task_create of TASK1" ); |
---|
| 56 | |
---|
| 57 | status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); |
---|
| 58 | directive_failed( status, "rtems_task_start of TASK1" ); |
---|
| 59 | |
---|
| 60 | status = rtems_task_create( |
---|
| 61 | rtems_build_name( 'T', 'I', 'M', 'E' ), |
---|
[4389287a] | 62 | (RTEMS_MAXIMUM_PRIORITY / 2), |
---|
[3652ad35] | 63 | RTEMS_MINIMUM_STACK_SIZE, |
---|
[ac7d5ef0] | 64 | RTEMS_DEFAULT_MODES, |
---|
| 65 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 66 | &Task_id[ 2 ] |
---|
| 67 | ); |
---|
| 68 | directive_failed( status, "rtems_task_create of TASK2" ); |
---|
| 69 | |
---|
| 70 | status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); |
---|
| 71 | directive_failed( status, "rtems_task_start of TASK2" ); |
---|
| 72 | |
---|
| 73 | status = rtems_task_create( |
---|
| 74 | rtems_build_name( 'T', 'I', 'M', 'E' ), |
---|
[1055ce20] | 75 | (RTEMS_MAXIMUM_PRIORITY / 2u) - 1u, |
---|
[3652ad35] | 76 | RTEMS_MINIMUM_STACK_SIZE, |
---|
[ac7d5ef0] | 77 | RTEMS_DEFAULT_MODES, |
---|
| 78 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 79 | &Task_id[ 3 ] |
---|
| 80 | ); |
---|
| 81 | directive_failed( status, "rtems_task_create of TASK3" ); |
---|
| 82 | |
---|
| 83 | status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); |
---|
| 84 | directive_failed( status, "rtems_task_start of TASK3" ); |
---|
| 85 | |
---|
| 86 | status = rtems_task_delete( RTEMS_SELF ); |
---|
| 87 | directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); |
---|
| 88 | } |
---|
| 89 | |
---|
| 90 | rtems_asr Process_asr_for_pass_1( |
---|
| 91 | rtems_signal_set signals |
---|
| 92 | ) |
---|
| 93 | { |
---|
[dbf4f17] | 94 | end_time = benchmark_timer_read(); |
---|
[ac7d5ef0] | 95 | |
---|
| 96 | put_time( |
---|
[5c491aef] | 97 | "rtems_signal_send: signal to self", |
---|
[ac7d5ef0] | 98 | end_time, |
---|
| 99 | 1, |
---|
| 100 | 0, |
---|
| 101 | CALLING_OVERHEAD_SIGNAL_SEND |
---|
| 102 | ); |
---|
| 103 | |
---|
[dbf4f17] | 104 | benchmark_timer_initialize(); |
---|
[ac7d5ef0] | 105 | } |
---|
| 106 | |
---|
| 107 | rtems_asr Process_asr_for_pass_2( |
---|
| 108 | rtems_signal_set signals |
---|
| 109 | ) |
---|
| 110 | { |
---|
| 111 | rtems_status_code status; |
---|
| 112 | |
---|
| 113 | status = rtems_task_resume( Task_id[ 3 ] ); |
---|
| 114 | directive_failed( status, "rtems_task_resume" ); |
---|
| 115 | |
---|
[dbf4f17] | 116 | benchmark_timer_initialize(); |
---|
[ac7d5ef0] | 117 | } |
---|
| 118 | |
---|
| 119 | rtems_task Task_1( |
---|
| 120 | rtems_task_argument argument |
---|
| 121 | ) |
---|
| 122 | { |
---|
| 123 | rtems_status_code status; |
---|
| 124 | |
---|
[dbf4f17] | 125 | benchmark_timer_initialize(); |
---|
[ac7d5ef0] | 126 | (void) rtems_signal_catch( Process_asr_for_pass_1, RTEMS_DEFAULT_MODES ); |
---|
[dbf4f17] | 127 | end_time = benchmark_timer_read(); |
---|
[ac7d5ef0] | 128 | |
---|
| 129 | put_time( |
---|
[9410d011] | 130 | "rtems_signal_catch: only case", |
---|
[ac7d5ef0] | 131 | end_time, |
---|
| 132 | 1, |
---|
| 133 | 0, |
---|
| 134 | CALLING_OVERHEAD_SIGNAL_CATCH |
---|
| 135 | ); |
---|
| 136 | |
---|
[dbf4f17] | 137 | benchmark_timer_initialize(); |
---|
[ac7d5ef0] | 138 | rtems_signal_send( Task_id[ 2 ], 1 ); |
---|
[dbf4f17] | 139 | end_time = benchmark_timer_read(); |
---|
[ac7d5ef0] | 140 | |
---|
| 141 | put_time( |
---|
[5c491aef] | 142 | "rtems_signal_send: returns to caller", |
---|
[ac7d5ef0] | 143 | end_time, |
---|
| 144 | 1, |
---|
| 145 | 0, |
---|
| 146 | CALLING_OVERHEAD_SIGNAL_SEND |
---|
| 147 | ); |
---|
| 148 | |
---|
[dbf4f17] | 149 | benchmark_timer_initialize(); |
---|
[ac7d5ef0] | 150 | (void) rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 ); |
---|
| 151 | |
---|
| 152 | /* end time is done is RTEMS_ASR */ |
---|
| 153 | |
---|
[dbf4f17] | 154 | end_time = benchmark_timer_read(); |
---|
[ac7d5ef0] | 155 | |
---|
| 156 | put_time( |
---|
[bcc45a8] | 157 | "rtems_signal: exit ASR overhead returns to calling task", |
---|
[ac7d5ef0] | 158 | end_time, |
---|
| 159 | 1, |
---|
| 160 | 0, |
---|
| 161 | 0 |
---|
| 162 | ); |
---|
| 163 | |
---|
| 164 | status = rtems_signal_catch( Process_asr_for_pass_2, RTEMS_NO_PREEMPT ); |
---|
| 165 | directive_failed( status, "rtems_signal_catch" ); |
---|
| 166 | |
---|
[dbf4f17] | 167 | benchmark_timer_initialize(); |
---|
[ac7d5ef0] | 168 | (void) rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 ); |
---|
| 169 | } |
---|
| 170 | |
---|
[1055ce20] | 171 | /* avoid warnings for no prototype */ |
---|
| 172 | rtems_asr Process_asr_for_task_2( |
---|
| 173 | rtems_signal_set signals |
---|
| 174 | ); |
---|
| 175 | |
---|
[ac7d5ef0] | 176 | rtems_asr Process_asr_for_task_2( |
---|
| 177 | rtems_signal_set signals |
---|
| 178 | ) |
---|
| 179 | { |
---|
| 180 | ; |
---|
| 181 | } |
---|
| 182 | |
---|
| 183 | rtems_task Task_2( |
---|
| 184 | rtems_task_argument argument |
---|
| 185 | ) |
---|
| 186 | { |
---|
| 187 | rtems_status_code status; |
---|
| 188 | |
---|
| 189 | status = rtems_signal_catch( Process_asr_for_task_2, RTEMS_DEFAULT_MODES ); |
---|
| 190 | directive_failed( status, "rtems_signal_catch" ); |
---|
| 191 | |
---|
| 192 | (void) rtems_task_suspend( RTEMS_SELF ); |
---|
| 193 | } |
---|
| 194 | |
---|
| 195 | rtems_task Task_3( |
---|
| 196 | rtems_task_argument argument |
---|
| 197 | ) |
---|
| 198 | { |
---|
| 199 | (void) rtems_task_suspend( RTEMS_SELF ); |
---|
| 200 | |
---|
[dbf4f17] | 201 | end_time = benchmark_timer_read(); |
---|
[ac7d5ef0] | 202 | |
---|
| 203 | put_time( |
---|
[bcc45a8] | 204 | "rtems_signal: exit ASR overhead returns to preempting task", |
---|
[ac7d5ef0] | 205 | end_time, |
---|
| 206 | 1, |
---|
| 207 | 0, |
---|
| 208 | 0 |
---|
| 209 | ); |
---|
| 210 | |
---|
[3a4ae6c] | 211 | puts( "*** END OF TEST 19 ***" ); |
---|
[b454bc9] | 212 | rtems_test_exit( 0 ); |
---|
[ac7d5ef0] | 213 | } |
---|