source: rtems/testsuites/mptests/mp07/task1.c @ 03f2154e

4.104.114.84.9
Last change on this file since 03f2154e was 03f2154e, checked in by Joel Sherrill <joel.sherrill@…>, on Apr 22, 1997 at 5:20:27 PM

headers updated to reflect new style copyright notice as part
of switching to the modified GNU GPL.

  • Property mode set to 100644
File size: 2.5 KB
Line 
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-1997.
13 *  On-Line Applications Research Corporation (OAR).
14 *  Copyright assigned to U.S. Government, 1994.
15 *
16 *  The license and distribution terms for this file may in
17 *  the file LICENSE in this distribution or at
18 *  http://www.OARcorp.com/rtems/license.html.
19 *
20 *  $Id$
21 */
22
23#include "system.h"
24
25#define DOT_COUNT 100
26
27rtems_timer_service_routine Stop_Test_TSR(
28  rtems_id  ignored_id,
29  void     *ignored_address
30)
31{
32  Stop_Test = TRUE;
33}
34
35rtems_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 && (Stop_Test == FALSE) ; 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
94  /*
95   * Wait a bit before shutting down so we don't screw up the other node
96   * when our MPCI shuts down
97   */
98
99  rtems_task_wake_after(10);
100
101  puts( "\n*** END OF TEST 7 ***" );
102  exit( 0 );
103}
Note: See TracBrowser for help on using the repository browser.