[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 | |
---|
| 14 | #include "system.h" |
---|
| 15 | #undef EXTERN |
---|
| 16 | #define EXTERN |
---|
| 17 | #include "conftbl.h" |
---|
| 18 | #include "gvar.h" |
---|
| 19 | |
---|
| 20 | rtems_device_major_number _STUB_major = 0; |
---|
| 21 | |
---|
| 22 | rtems_id Region_id; |
---|
| 23 | rtems_name Region_name; |
---|
| 24 | rtems_unsigned8 Region_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT; |
---|
| 25 | |
---|
| 26 | rtems_id Partition_id; |
---|
| 27 | rtems_name Partition_name; |
---|
| 28 | rtems_unsigned8 Partition_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT; |
---|
| 29 | |
---|
| 30 | void *Buffer_address_1; |
---|
| 31 | void *Buffer_address_2; |
---|
| 32 | void *Buffer_address_3; |
---|
| 33 | void *Buffer_address_4; |
---|
| 34 | |
---|
| 35 | rtems_unsigned32 buffer_count; |
---|
| 36 | |
---|
| 37 | void *Buffer_addresses[ OPERATION_COUNT+1 ]; |
---|
| 38 | |
---|
| 39 | rtems_task Task_1( |
---|
| 40 | rtems_task_argument argument |
---|
| 41 | ); |
---|
| 42 | |
---|
| 43 | rtems_task Task_2( |
---|
| 44 | rtems_task_argument argument |
---|
| 45 | ); |
---|
| 46 | |
---|
| 47 | rtems_task Init( |
---|
| 48 | rtems_task_argument argument |
---|
| 49 | ) |
---|
| 50 | { |
---|
| 51 | rtems_status_code status; |
---|
| 52 | |
---|
| 53 | puts( "\n\n*** TIME TEST 20 ***" ); |
---|
| 54 | |
---|
| 55 | status = rtems_task_create( |
---|
| 56 | rtems_build_name( 'T', 'I', 'M', '1' ), |
---|
| 57 | 128, |
---|
| 58 | 2048, |
---|
| 59 | RTEMS_DEFAULT_MODES, |
---|
| 60 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 61 | &Task_id[ 1 ] |
---|
| 62 | ); |
---|
| 63 | directive_failed( status, "rtems_task_create of TASK1" ); |
---|
| 64 | |
---|
| 65 | status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); |
---|
| 66 | directive_failed( status, "rtems_task_start of TASK1" ); |
---|
| 67 | |
---|
| 68 | status = rtems_task_create( |
---|
| 69 | rtems_build_name( 'T', 'I', 'M', '2' ), |
---|
| 70 | 129, |
---|
| 71 | 2048, |
---|
| 72 | RTEMS_DEFAULT_MODES, |
---|
| 73 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 74 | &Task_id[ 2 ] |
---|
| 75 | ); |
---|
| 76 | directive_failed( status, "rtems_task_create of TASK2" ); |
---|
| 77 | |
---|
| 78 | status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); |
---|
| 79 | directive_failed( status, "rtems_task_start of TASK2" ); |
---|
| 80 | |
---|
| 81 | status = rtems_task_delete( RTEMS_SELF ); |
---|
| 82 | directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | rtems_task Task_1( |
---|
| 86 | rtems_task_argument argument |
---|
| 87 | ) |
---|
| 88 | { |
---|
| 89 | rtems_unsigned32 index; |
---|
| 90 | rtems_mode previous_mode; |
---|
| 91 | rtems_task_priority previous_priority; |
---|
| 92 | rtems_unsigned32 return_value; |
---|
| 93 | rtems_status_code status; |
---|
| 94 | |
---|
| 95 | Partition_name = rtems_build_name( 'P', 'A', 'R', 'T' ); |
---|
| 96 | |
---|
| 97 | Timer_initialize(); |
---|
| 98 | rtems_partition_create( |
---|
| 99 | Partition_name, |
---|
| 100 | Partition_area, |
---|
| 101 | 2048, |
---|
| 102 | 128, |
---|
| 103 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 104 | &Partition_id |
---|
| 105 | ); |
---|
| 106 | end_time = Read_timer(); |
---|
| 107 | |
---|
| 108 | put_time( |
---|
| 109 | "rtems_partition_create", |
---|
| 110 | end_time, |
---|
| 111 | 1, |
---|
| 112 | 0, |
---|
| 113 | CALLING_OVERHEAD_PARTITION_CREATE |
---|
| 114 | ); |
---|
| 115 | |
---|
| 116 | Region_name = rtems_build_name( 'R', 'E', 'G', 'N' ); |
---|
| 117 | |
---|
| 118 | Timer_initialize(); |
---|
| 119 | rtems_region_create( |
---|
| 120 | Region_name, |
---|
| 121 | Region_area, |
---|
| 122 | 2048, |
---|
| 123 | 16, |
---|
| 124 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 125 | &Region_id |
---|
| 126 | ); |
---|
| 127 | end_time = Read_timer(); |
---|
| 128 | |
---|
| 129 | put_time( |
---|
| 130 | "rtems_region_create", |
---|
| 131 | end_time, |
---|
| 132 | 1, |
---|
| 133 | 0, |
---|
| 134 | CALLING_OVERHEAD_REGION_CREATE |
---|
| 135 | ); |
---|
| 136 | |
---|
| 137 | Timer_initialize(); |
---|
| 138 | (void) rtems_partition_get_buffer( Partition_id, &Buffer_address_1 ); |
---|
| 139 | end_time = Read_timer(); |
---|
| 140 | |
---|
| 141 | put_time( |
---|
| 142 | "rtems_partition_get_buffer (available)", |
---|
| 143 | end_time, |
---|
| 144 | 1, |
---|
| 145 | 0, |
---|
| 146 | CALLING_OVERHEAD_PARTITION_GET_BUFFER |
---|
| 147 | ); |
---|
| 148 | |
---|
| 149 | buffer_count = 0; |
---|
| 150 | while ( FOREVER ) { |
---|
| 151 | |
---|
| 152 | status = rtems_partition_get_buffer( |
---|
| 153 | Partition_id, |
---|
| 154 | &Buffer_addresses[ buffer_count ] |
---|
| 155 | ); |
---|
| 156 | |
---|
| 157 | if ( status == RTEMS_UNSATISFIED ) break; |
---|
| 158 | |
---|
| 159 | buffer_count++; |
---|
| 160 | } |
---|
| 161 | |
---|
| 162 | Timer_initialize(); |
---|
| 163 | (void) rtems_partition_get_buffer( Partition_id, &Buffer_address_2 ); |
---|
| 164 | end_time = Read_timer(); |
---|
| 165 | |
---|
| 166 | put_time( |
---|
| 167 | "rtems_partition_get_buffer (not available)", |
---|
| 168 | end_time, |
---|
| 169 | 1, |
---|
| 170 | 0, |
---|
| 171 | CALLING_OVERHEAD_PARTITION_GET_BUFFER |
---|
| 172 | ); |
---|
| 173 | |
---|
| 174 | Timer_initialize(); |
---|
| 175 | (void) rtems_partition_return_buffer( Partition_id, Buffer_address_1 ); |
---|
| 176 | end_time = Read_timer(); |
---|
| 177 | |
---|
| 178 | put_time( |
---|
| 179 | "rtems_partition_return_buffer", |
---|
| 180 | end_time, |
---|
| 181 | 1, |
---|
| 182 | 0, |
---|
| 183 | CALLING_OVERHEAD_PARTITION_RETURN_BUFFER |
---|
| 184 | ); |
---|
| 185 | |
---|
| 186 | for ( index = 0 ; index < buffer_count ; index++ ) { |
---|
| 187 | |
---|
| 188 | status = rtems_partition_return_buffer( |
---|
| 189 | Partition_id, |
---|
| 190 | Buffer_addresses[ index ] |
---|
| 191 | ); |
---|
| 192 | directive_failed( status, "rtems_partition_return_buffer" ); |
---|
| 193 | |
---|
| 194 | } |
---|
| 195 | |
---|
| 196 | Timer_initialize(); |
---|
| 197 | (void) rtems_partition_delete( Partition_id ); |
---|
| 198 | end_time = Read_timer(); |
---|
| 199 | |
---|
| 200 | put_time( |
---|
| 201 | "rtems_partition_delete", |
---|
| 202 | end_time, |
---|
| 203 | 1, |
---|
| 204 | 0, |
---|
| 205 | CALLING_OVERHEAD_PARTITION_DELETE |
---|
| 206 | ); |
---|
| 207 | |
---|
| 208 | status = rtems_region_get_segment( |
---|
| 209 | Region_id, |
---|
| 210 | 400, |
---|
| 211 | RTEMS_DEFAULT_OPTIONS, |
---|
| 212 | RTEMS_NO_TIMEOUT, |
---|
| 213 | &Buffer_address_2 |
---|
| 214 | ); |
---|
| 215 | directive_failed( status, "region_get_semgent" ); |
---|
| 216 | |
---|
| 217 | Timer_initialize(); |
---|
| 218 | (void) rtems_region_get_segment( |
---|
| 219 | Region_id, |
---|
| 220 | 400, |
---|
| 221 | RTEMS_DEFAULT_OPTIONS, |
---|
| 222 | RTEMS_NO_TIMEOUT, |
---|
| 223 | &Buffer_address_3 |
---|
| 224 | ); |
---|
| 225 | end_time = Read_timer(); |
---|
| 226 | |
---|
| 227 | put_time( |
---|
| 228 | "rtems_region_get_segment (available)", |
---|
| 229 | end_time, |
---|
| 230 | 1, |
---|
| 231 | 0, |
---|
| 232 | CALLING_OVERHEAD_REGION_GET_SEGMENT |
---|
| 233 | ); |
---|
| 234 | |
---|
| 235 | Timer_initialize(); |
---|
| 236 | (void) rtems_region_get_segment( |
---|
| 237 | Region_id, |
---|
| 238 | 1998, |
---|
| 239 | RTEMS_NO_WAIT, |
---|
| 240 | RTEMS_NO_TIMEOUT, |
---|
| 241 | &Buffer_address_4 |
---|
| 242 | ); |
---|
| 243 | end_time = Read_timer(); |
---|
| 244 | |
---|
| 245 | put_time( |
---|
| 246 | "rtems_region_get_segment (RTEMS_NO_WAIT)", |
---|
| 247 | end_time, |
---|
| 248 | 1, |
---|
| 249 | 0, |
---|
| 250 | CALLING_OVERHEAD_REGION_GET_SEGMENT |
---|
| 251 | ); |
---|
| 252 | |
---|
| 253 | status = rtems_region_return_segment( Region_id, Buffer_address_3 ); |
---|
| 254 | directive_failed( status, "rtems_region_return_segment" ); |
---|
| 255 | |
---|
| 256 | Timer_initialize(); |
---|
| 257 | (void) rtems_region_return_segment( Region_id, Buffer_address_2 ); |
---|
| 258 | end_time = Read_timer(); |
---|
| 259 | |
---|
| 260 | put_time( |
---|
| 261 | "rtems_region_return_segment (no tasks waiting)", |
---|
| 262 | end_time, |
---|
| 263 | 1, |
---|
| 264 | 0, |
---|
| 265 | CALLING_OVERHEAD_REGION_RETURN_SEGMENT |
---|
| 266 | ); |
---|
| 267 | |
---|
| 268 | status = rtems_region_get_segment( |
---|
| 269 | Region_id, |
---|
| 270 | 400, |
---|
| 271 | RTEMS_DEFAULT_OPTIONS, |
---|
| 272 | RTEMS_NO_TIMEOUT, |
---|
| 273 | &Buffer_address_1 |
---|
| 274 | ); |
---|
| 275 | directive_failed( status, "rtems_region_get_segment" ); |
---|
| 276 | |
---|
| 277 | Timer_initialize(); |
---|
| 278 | (void) rtems_region_get_segment( |
---|
| 279 | Region_id, |
---|
| 280 | 1998, |
---|
| 281 | RTEMS_DEFAULT_OPTIONS, |
---|
| 282 | RTEMS_NO_TIMEOUT, |
---|
| 283 | &Buffer_address_2 |
---|
| 284 | ); |
---|
| 285 | |
---|
| 286 | /* execute Task_2 */ |
---|
| 287 | |
---|
| 288 | end_time = Read_timer(); |
---|
| 289 | |
---|
| 290 | put_time( |
---|
| 291 | "rtems_region_return_segment (preempt)", |
---|
| 292 | end_time, |
---|
| 293 | 1, |
---|
| 294 | 0, |
---|
| 295 | CALLING_OVERHEAD_REGION_RETURN_SEGMENT |
---|
| 296 | ); |
---|
| 297 | |
---|
| 298 | status = rtems_region_return_segment( Region_id, Buffer_address_2 ); |
---|
| 299 | directive_failed( status, "rtems_region_return_segment" ); |
---|
| 300 | |
---|
| 301 | status = rtems_task_mode( |
---|
| 302 | RTEMS_NO_PREEMPT, |
---|
| 303 | RTEMS_PREEMPT_MASK, |
---|
| 304 | &previous_mode |
---|
| 305 | ); |
---|
| 306 | directive_failed( status, "rtems_task_mode" ); |
---|
| 307 | |
---|
| 308 | status = rtems_task_set_priority( RTEMS_SELF, 254, &previous_priority ); |
---|
| 309 | directive_failed( status, "rtems_task_set_priority" ); |
---|
| 310 | |
---|
| 311 | status = rtems_region_get_segment( |
---|
| 312 | Region_id, |
---|
| 313 | 400, |
---|
| 314 | RTEMS_DEFAULT_OPTIONS, |
---|
| 315 | RTEMS_NO_TIMEOUT, |
---|
| 316 | &Buffer_address_1 |
---|
| 317 | ); |
---|
| 318 | directive_failed( status, "rtems_region_return_segment" ); |
---|
| 319 | |
---|
| 320 | status = rtems_region_get_segment( |
---|
| 321 | Region_id, |
---|
| 322 | 1998, |
---|
| 323 | RTEMS_DEFAULT_OPTIONS, |
---|
| 324 | RTEMS_NO_TIMEOUT, |
---|
| 325 | &Buffer_address_2 |
---|
| 326 | ); |
---|
| 327 | directive_failed( status, "rtems_region_get_segment" ); |
---|
| 328 | |
---|
| 329 | /* execute Task_2 */ |
---|
| 330 | |
---|
| 331 | status = rtems_region_return_segment( Region_id, Buffer_address_2 ); |
---|
| 332 | directive_failed( status, "rtems_region_return_segment" ); |
---|
| 333 | |
---|
| 334 | Timer_initialize(); |
---|
| 335 | (void) rtems_region_delete( Region_id ); |
---|
| 336 | end_time = Read_timer(); |
---|
| 337 | |
---|
| 338 | put_time( |
---|
| 339 | "rtems_region_delete", |
---|
| 340 | end_time, |
---|
| 341 | 1, |
---|
| 342 | 0, |
---|
| 343 | CALLING_OVERHEAD_REGION_DELETE |
---|
| 344 | ); |
---|
| 345 | |
---|
| 346 | Timer_initialize(); |
---|
| 347 | for ( index=1 ; index <= OPERATION_COUNT ; index++ ) |
---|
| 348 | (void) Empty_function(); |
---|
| 349 | overhead = Read_timer(); |
---|
| 350 | |
---|
| 351 | Timer_initialize(); |
---|
| 352 | for ( index=1 ; index <= OPERATION_COUNT ; index++ ) |
---|
| 353 | (void) rtems_io_initialize( 0, 0, NULL, &return_value ); |
---|
| 354 | end_time = Read_timer(); |
---|
| 355 | |
---|
| 356 | put_time( |
---|
| 357 | "rtems_io_initialize", |
---|
| 358 | end_time, |
---|
| 359 | OPERATION_COUNT, |
---|
| 360 | overhead, |
---|
| 361 | CALLING_OVERHEAD_IO_INITIALIZE |
---|
| 362 | ); |
---|
| 363 | |
---|
| 364 | Timer_initialize(); |
---|
| 365 | for ( index=1 ; index <= OPERATION_COUNT ; index++ ) |
---|
| 366 | (void) rtems_io_open( 0, 0, NULL, &return_value ); |
---|
| 367 | end_time = Read_timer(); |
---|
| 368 | |
---|
| 369 | put_time( |
---|
| 370 | "rtems_io_open", |
---|
| 371 | end_time, |
---|
| 372 | OPERATION_COUNT, |
---|
| 373 | overhead, |
---|
| 374 | CALLING_OVERHEAD_IO_OPEN |
---|
| 375 | ); |
---|
| 376 | |
---|
| 377 | Timer_initialize(); |
---|
| 378 | for ( index=1 ; index <= OPERATION_COUNT ; index++ ) |
---|
| 379 | (void) rtems_io_close( 0, 0, NULL, &return_value ); |
---|
| 380 | end_time = Read_timer(); |
---|
| 381 | |
---|
| 382 | put_time( |
---|
| 383 | "rtems_io_close", |
---|
| 384 | end_time, |
---|
| 385 | OPERATION_COUNT, |
---|
| 386 | overhead, |
---|
| 387 | CALLING_OVERHEAD_IO_CLOSE |
---|
| 388 | ); |
---|
| 389 | |
---|
| 390 | Timer_initialize(); |
---|
| 391 | for ( index=1 ; index <= OPERATION_COUNT ; index++ ) |
---|
| 392 | (void) rtems_io_read( 0, 0, NULL, &return_value ); |
---|
| 393 | end_time = Read_timer(); |
---|
| 394 | |
---|
| 395 | put_time( |
---|
| 396 | "rtems_io_read", |
---|
| 397 | end_time, |
---|
| 398 | OPERATION_COUNT, |
---|
| 399 | overhead, |
---|
| 400 | CALLING_OVERHEAD_IO_READ |
---|
| 401 | ); |
---|
| 402 | |
---|
| 403 | Timer_initialize(); |
---|
| 404 | for ( index=1 ; index <= OPERATION_COUNT ; index++ ) |
---|
| 405 | (void) rtems_io_write( 0, 0, NULL, &return_value ); |
---|
| 406 | end_time = Read_timer(); |
---|
| 407 | |
---|
| 408 | put_time( |
---|
| 409 | "rtems_io_write", |
---|
| 410 | end_time, |
---|
| 411 | OPERATION_COUNT, |
---|
| 412 | overhead, |
---|
| 413 | CALLING_OVERHEAD_IO_WRITE |
---|
| 414 | ); |
---|
| 415 | |
---|
| 416 | Timer_initialize(); |
---|
| 417 | for ( index=1 ; index <= OPERATION_COUNT ; index++ ) |
---|
| 418 | (void) rtems_io_control( 0, 0, NULL, &return_value ); |
---|
| 419 | end_time = Read_timer(); |
---|
| 420 | |
---|
| 421 | put_time( |
---|
| 422 | "rtems_io_control", |
---|
| 423 | end_time, |
---|
| 424 | OPERATION_COUNT, |
---|
| 425 | overhead, |
---|
| 426 | CALLING_OVERHEAD_IO_CONTROL |
---|
| 427 | ); |
---|
| 428 | |
---|
| 429 | exit( 0 ); |
---|
| 430 | } |
---|
| 431 | |
---|
| 432 | rtems_task Task_2( |
---|
| 433 | rtems_task_argument argument |
---|
| 434 | ) |
---|
| 435 | { |
---|
| 436 | rtems_status_code status; |
---|
| 437 | |
---|
| 438 | end_time = Read_timer(); |
---|
| 439 | |
---|
| 440 | put_time( |
---|
| 441 | "rtems_region_get_segment (blocking)", |
---|
| 442 | end_time, |
---|
| 443 | 1, |
---|
| 444 | 0, |
---|
| 445 | CALLING_OVERHEAD_REGION_GET_SEGMENT |
---|
| 446 | ); |
---|
| 447 | |
---|
| 448 | Timer_initialize(); |
---|
| 449 | (void) rtems_region_return_segment( Region_id, Buffer_address_1 ); |
---|
| 450 | |
---|
| 451 | /* preempt back to Task_1 */ |
---|
| 452 | |
---|
| 453 | Timer_initialize(); |
---|
| 454 | (void) rtems_region_return_segment( Region_id, Buffer_address_1 ); |
---|
| 455 | end_time = Read_timer(); |
---|
| 456 | |
---|
| 457 | put_time( |
---|
| 458 | "rtems_region_return_segment (ready -- return)", |
---|
| 459 | end_time, |
---|
| 460 | 1, |
---|
| 461 | 0, |
---|
| 462 | CALLING_OVERHEAD_REGION_RETURN_SEGMENT |
---|
| 463 | ); |
---|
| 464 | |
---|
| 465 | status = rtems_task_delete( RTEMS_SELF ); |
---|
| 466 | directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); |
---|
| 467 | } |
---|