source: rtems/testsuites/mptests/mp05/task1.c @ 8bdcfc4

4.104.114.84.95
Last change on this file since 8bdcfc4 was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on May 11, 1995 at 5:39:37 PM

Initial revision

  • Property mode set to 100644
File size: 2.7 KB
Line 
1/*  Test_task
2 *
3 *  This task initializes the signal catcher, sends the first signal
4 *  if running on the first node, and loops while waiting for signals.
5 *
6 *  NOTE: The signal catcher is not reentrant and hence RTEMS_NO_ASR must
7 *        be a part of its execution mode.
8 *
9 *  Input parameters:
10 *    argument - task argument
11 *
12 *  Output parameters:  NONE
13 *
14 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
15 *  On-Line Applications Research Corporation (OAR).
16 *  All rights assigned to U.S. Government, 1994.
17 *
18 *  This material may be reproduced by or for the U.S. Government pursuant
19 *  to the copyright license under the clause at DFARS 252.227-7013.  This
20 *  notice must appear in all copies of this file and its derivatives.
21 *
22 *  $Id$
23 */
24
25#include "system.h"
26
27#define SIGNALS_PER_DOT 15
28
29rtems_timer_service_routine Stop_Test_TSR(
30  rtems_id  ignored_id,
31  void     *ignored_address
32)
33{
34  Stop_Test = TRUE;
35}
36
37rtems_task Test_task(
38  rtems_task_argument argument
39)
40{
41  rtems_status_code status;
42
43  Stop_Test = FALSE;
44
45  signal_caught = 0;
46  signal_count  = 0;
47
48  puts( "rtems_signal_catch: initializing signal catcher" );
49  status = rtems_signal_catch( Process_asr, RTEMS_NO_ASR|RTEMS_NO_PREEMPT );
50  directive_failed( status, "rtems_signal_catch" );
51
52  if (Multiprocessing_configuration.node == 1) {
53     remote_node = 2;
54     remote_signal  = RTEMS_SIGNAL_18;
55     expected_signal = RTEMS_SIGNAL_17;
56  }
57  else {
58     remote_node = 1;
59     remote_signal  = RTEMS_SIGNAL_17;
60     expected_signal = RTEMS_SIGNAL_18;
61  }
62  puts_nocr( "Remote task's name is : " );
63  put_name( Task_name[ remote_node ], TRUE );
64
65  puts( "Getting TID of remote task" );
66  do {
67      status = rtems_task_ident(
68          Task_name[ remote_node ],
69          RTEMS_SEARCH_ALL_NODES,
70          &remote_tid
71          );
72  } while ( status != RTEMS_SUCCESSFUL );
73  directive_failed( status, "rtems_task_ident" );
74
75  status = rtems_timer_fire_after(
76    Timer_id[ 1 ],
77    3 * TICKS_PER_SECOND,
78    Stop_Test_TSR,
79    NULL
80  );
81  directive_failed( status, "rtems_timer_fire_after" );
82
83  if ( Multiprocessing_configuration.node == 1 ) {
84    puts( "Sending signal to remote task" );
85    do {
86      status = rtems_signal_send( remote_tid, remote_signal );
87      if ( status == RTEMS_NOT_DEFINED )
88        continue;
89    } while ( status != RTEMS_SUCCESSFUL );
90    directive_failed( status, "rtems_signal_send" );
91  }
92
93  while ( Stop_Test == FALSE ) {
94    if ( signal_caught ) {
95      signal_caught = 0;
96      if ( ++signal_count >= SIGNALS_PER_DOT ) {
97        signal_count = 0;
98        put_dot( '.' );
99      }
100      status = rtems_signal_send( remote_tid, remote_signal );
101      directive_failed( status, "rtems_signal_send" );
102    }
103  }
104  puts( "\n*** END OF TEST 5 ***" );
105  exit( 0 );
106}
Note: See TracBrowser for help on using the repository browser.