[ac7d5ef0] | 1 | /* Test_task |
---|
| 2 | * |
---|
| 3 | * This task continuously sends an event to its counterpart on the |
---|
| 4 | * other node, and then waits for it to send an event. The copy |
---|
| 5 | * running on node one send the first event. |
---|
| 6 | * |
---|
| 7 | * Input parameters: |
---|
| 8 | * argument - task argument |
---|
| 9 | * |
---|
| 10 | * Output parameters: NONE |
---|
| 11 | * |
---|
| 12 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
| 13 | * On-Line Applications Research Corporation (OAR). |
---|
| 14 | * All rights assigned to U.S. Government, 1994. |
---|
| 15 | * |
---|
| 16 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
| 17 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
| 18 | * notice must appear in all copies of this file and its derivatives. |
---|
| 19 | * |
---|
| 20 | * $Id$ |
---|
| 21 | */ |
---|
| 22 | |
---|
| 23 | #include "system.h" |
---|
| 24 | |
---|
| 25 | #define DOT_COUNT 100 |
---|
| 26 | |
---|
| 27 | rtems_timer_service_routine Stop_Test_TSR( |
---|
| 28 | rtems_id ignored_id, |
---|
| 29 | void *ignored_address |
---|
| 30 | ) |
---|
| 31 | { |
---|
| 32 | Stop_Test = TRUE; |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | rtems_task Test_task( |
---|
| 36 | rtems_task_argument argument |
---|
| 37 | ) |
---|
| 38 | { |
---|
| 39 | rtems_status_code status; |
---|
| 40 | rtems_unsigned32 count; |
---|
| 41 | rtems_unsigned32 remote_node; |
---|
| 42 | rtems_id remote_tid; |
---|
| 43 | rtems_event_set event_out; |
---|
| 44 | |
---|
| 45 | Stop_Test = FALSE; |
---|
| 46 | |
---|
| 47 | remote_node = (Multiprocessing_configuration.node == 1) ? 2 : 1; |
---|
| 48 | puts_nocr( "Remote task's name is : " ); |
---|
| 49 | put_name( Task_name[ remote_node ], TRUE ); |
---|
| 50 | |
---|
| 51 | puts( "Getting TID of remote task" ); |
---|
| 52 | do { |
---|
| 53 | status = rtems_task_ident( |
---|
| 54 | Task_name[ remote_node ], |
---|
| 55 | RTEMS_SEARCH_ALL_NODES, |
---|
| 56 | &remote_tid |
---|
| 57 | ); |
---|
| 58 | } while ( !rtems_is_status_successful( status ) ); |
---|
| 59 | |
---|
| 60 | if ( Multiprocessing_configuration.node == 1 ) { |
---|
| 61 | puts( "Sending first event to remote task" ); |
---|
| 62 | status = rtems_event_send( remote_tid, RTEMS_EVENT_16 ); |
---|
| 63 | directive_failed( status, "rtems_event_send" ); |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | status = rtems_timer_fire_after( |
---|
| 67 | Timer_id[ 1 ], |
---|
| 68 | 5 * TICKS_PER_SECOND, |
---|
| 69 | Stop_Test_TSR, |
---|
| 70 | NULL |
---|
| 71 | ); |
---|
| 72 | directive_failed( status, "rtems_timer_fire_after" ); |
---|
| 73 | |
---|
| 74 | while ( Stop_Test == FALSE ) { |
---|
| 75 | for ( count=DOT_COUNT ; count ; count-- ) { |
---|
| 76 | status = rtems_event_receive( |
---|
| 77 | RTEMS_EVENT_16, |
---|
| 78 | RTEMS_DEFAULT_OPTIONS, |
---|
| 79 | RTEMS_NO_TIMEOUT, |
---|
| 80 | &event_out |
---|
| 81 | ); |
---|
| 82 | if ( status == RTEMS_TIMEOUT ) { |
---|
| 83 | puts( "\nTA1 - RTEMS_TIMEOUT .. probably OK if the other node exits" ); |
---|
| 84 | break; |
---|
| 85 | } else |
---|
| 86 | directive_failed( status, "rtems_event_receive" ); |
---|
| 87 | |
---|
| 88 | status = rtems_event_send( remote_tid, RTEMS_EVENT_16 ); |
---|
| 89 | directive_failed( status, "rtems_event_send" ); |
---|
| 90 | } |
---|
| 91 | put_dot('.'); |
---|
| 92 | } |
---|
| 93 | puts( "\n*** END OF TEST 7 ***" ); |
---|
| 94 | exit( 0 ); |
---|
| 95 | } |
---|