source:
rtems/testsuites/mptests/mp05/task1.c
@
3c48599
Last change on this file since 3c48599 was d7a0857, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:53:31 | |
---|---|
|
|
File size: 2.6 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-1999. |
15 | * On-Line Applications Research Corporation (OAR). |
16 | * |
17 | * The license and distribution terms for this file may be |
18 | * found in the file LICENSE in this distribution or at |
19 | * http://www.rtems.com/license/LICENSE. |
20 | * |
21 | * $Id$ |
22 | */ |
23 | |
24 | #include "system.h" |
25 | |
26 | #define SIGNALS_PER_DOT 15 |
27 | |
28 | rtems_timer_service_routine Stop_Test_TSR( |
29 | rtems_id ignored_id, |
30 | void *ignored_address |
31 | ) |
32 | { |
33 | Stop_Test = TRUE; |
34 | } |
35 | |
36 | rtems_task Test_task( |
37 | rtems_task_argument argument |
38 | ) |
39 | { |
40 | rtems_status_code status; |
41 | |
42 | Stop_Test = FALSE; |
43 | |
44 | signal_caught = 0; |
45 | signal_count = 0; |
46 | |
47 | puts( "rtems_signal_catch: initializing signal catcher" ); |
48 | status = rtems_signal_catch( Process_asr, RTEMS_NO_ASR|RTEMS_NO_PREEMPT ); |
49 | directive_failed( status, "rtems_signal_catch" ); |
50 | |
51 | if (Multiprocessing_configuration.node == 1) { |
52 | remote_node = 2; |
53 | remote_signal = RTEMS_SIGNAL_18; |
54 | expected_signal = RTEMS_SIGNAL_17; |
55 | } |
56 | else { |
57 | remote_node = 1; |
58 | remote_signal = RTEMS_SIGNAL_17; |
59 | expected_signal = RTEMS_SIGNAL_18; |
60 | } |
61 | puts_nocr( "Remote task's name is : " ); |
62 | put_name( Task_name[ remote_node ], TRUE ); |
63 | |
64 | puts( "Getting TID of remote task" ); |
65 | do { |
66 | status = rtems_task_ident( |
67 | Task_name[ remote_node ], |
68 | RTEMS_SEARCH_ALL_NODES, |
69 | &remote_tid |
70 | ); |
71 | } while ( status != RTEMS_SUCCESSFUL ); |
72 | directive_failed( status, "rtems_task_ident" ); |
73 | |
74 | status = rtems_timer_fire_after( |
75 | Timer_id[ 1 ], |
76 | 3 * TICKS_PER_SECOND, |
77 | Stop_Test_TSR, |
78 | NULL |
79 | ); |
80 | directive_failed( status, "rtems_timer_fire_after" ); |
81 | |
82 | if ( Multiprocessing_configuration.node == 1 ) { |
83 | puts( "Sending signal to remote task" ); |
84 | do { |
85 | status = rtems_signal_send( remote_tid, remote_signal ); |
86 | if ( status == RTEMS_NOT_DEFINED ) |
87 | continue; |
88 | } while ( status != RTEMS_SUCCESSFUL ); |
89 | directive_failed( status, "rtems_signal_send" ); |
90 | } |
91 | |
92 | while ( Stop_Test == FALSE ) { |
93 | if ( signal_caught ) { |
94 | signal_caught = 0; |
95 | if ( ++signal_count >= SIGNALS_PER_DOT ) { |
96 | signal_count = 0; |
97 | put_dot( '.' ); |
98 | } |
99 | status = rtems_signal_send( remote_tid, remote_signal ); |
100 | directive_failed( status, "rtems_signal_send" ); |
101 | } |
102 | } |
103 | puts( "\n*** END OF TEST 5 ***" ); |
104 | rtems_test_exit( 0 ); |
105 | } |
Note: See TracBrowser
for help on using the repository browser.