source: rtems/c/src/tests/tmtests/tm19/task1.c @ 1c24fe7

4.104.114.84.95
Last change on this file since 1c24fe7 was 5c491aef, checked in by Joel Sherrill <joel.sherrill@…>, on 12/20/95 at 15:39:19

changes remerged after lost in disk crash -- recovered from snapshot, partially recovered working tree, etc

  • Property mode set to 100644
File size: 4.1 KB
Line 
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#define TEST_INIT
15#include "system.h"
16
17rtems_asr Process_asr_for_pass_1(
18  rtems_signal_set signals
19);
20
21rtems_asr Process_asr_for_pass_2(
22  rtems_signal_set signals
23);
24
25rtems_task Task_1(
26  rtems_task_argument argument
27);
28
29rtems_task Task_2(
30  rtems_task_argument argument
31);
32
33rtems_task Task_3(
34  rtems_task_argument argument
35);
36
37rtems_task Init(
38  rtems_task_argument argument
39)
40{
41  rtems_status_code status;
42
43  Print_Warning();
44
45  puts( "\n\n*** TIME TEST 19 ***" );
46
47  status = rtems_task_create(
48    rtems_build_name( 'T', 'I', 'M', 'E' ),
49    128,
50    RTEMS_MINIMUM_STACK_SIZE,
51    RTEMS_DEFAULT_MODES,
52    RTEMS_DEFAULT_ATTRIBUTES,
53    &Task_id[ 1 ]
54  );
55  directive_failed( status, "rtems_task_create of TASK1" );
56
57  status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
58  directive_failed( status, "rtems_task_start of TASK1" );
59
60  status = rtems_task_create(
61    rtems_build_name( 'T', 'I', 'M', 'E' ),
62    127,
63    RTEMS_MINIMUM_STACK_SIZE,
64    RTEMS_DEFAULT_MODES,
65    RTEMS_DEFAULT_ATTRIBUTES,
66    &Task_id[ 2 ]
67  );
68  directive_failed( status, "rtems_task_create of TASK2" );
69
70  status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
71  directive_failed( status, "rtems_task_start of TASK2" );
72
73  status = rtems_task_create(
74    rtems_build_name( 'T', 'I', 'M', 'E' ),
75    126,
76    RTEMS_MINIMUM_STACK_SIZE,
77    RTEMS_DEFAULT_MODES,
78    RTEMS_DEFAULT_ATTRIBUTES,
79    &Task_id[ 3 ]
80  );
81  directive_failed( status, "rtems_task_create of TASK3" );
82
83  status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
84  directive_failed( status, "rtems_task_start of TASK3" );
85
86  status = rtems_task_delete( RTEMS_SELF );
87  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
88}
89
90rtems_asr Process_asr_for_pass_1(
91  rtems_signal_set signals
92)
93{
94  end_time = Read_timer();
95
96  put_time(
97    "rtems_signal_send: signal to self",
98    end_time,
99    1,
100    0,
101    CALLING_OVERHEAD_SIGNAL_SEND
102  );
103
104  Timer_initialize();
105}
106
107rtems_asr Process_asr_for_pass_2(
108  rtems_signal_set signals
109)
110{
111  rtems_status_code status;
112
113  status = rtems_task_resume( Task_id[ 3 ] );
114  directive_failed( status, "rtems_task_resume" );
115
116  Timer_initialize();
117}
118
119rtems_task Task_1(
120  rtems_task_argument argument
121)
122{
123  rtems_status_code status;
124
125  Timer_initialize();
126    (void) rtems_signal_catch( Process_asr_for_pass_1, RTEMS_DEFAULT_MODES );
127  end_time = Read_timer();
128
129  put_time(
130    "rtems_signal_catch",
131    end_time,
132    1,
133    0,
134    CALLING_OVERHEAD_SIGNAL_CATCH
135  );
136
137  Timer_initialize();
138    rtems_signal_send( Task_id[ 2 ], 1 );
139  end_time = Read_timer();
140
141  put_time(
142    "rtems_signal_send: returns to caller",
143    end_time,
144    1,
145    0,
146    CALLING_OVERHEAD_SIGNAL_SEND
147  );
148
149  Timer_initialize();
150    (void) rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );
151
152  /* end time is done is RTEMS_ASR */
153
154  end_time = Read_timer();
155
156  put_time(
157    "exit ASR overhead: returns to calling task",
158    end_time,
159    1,
160    0,
161    0
162  );
163
164  status = rtems_signal_catch( Process_asr_for_pass_2, RTEMS_NO_PREEMPT );
165  directive_failed( status, "rtems_signal_catch" );
166
167  Timer_initialize();
168    (void) rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );
169}
170
171rtems_asr Process_asr_for_task_2(
172  rtems_signal_set signals
173)
174{
175  ;
176}
177
178rtems_task Task_2(
179  rtems_task_argument argument
180)
181{
182  rtems_status_code status;
183
184  status = rtems_signal_catch( Process_asr_for_task_2, RTEMS_DEFAULT_MODES );
185  directive_failed( status, "rtems_signal_catch" );
186
187  (void) rtems_task_suspend( RTEMS_SELF );
188}
189
190rtems_task Task_3(
191  rtems_task_argument argument
192)
193{
194  (void) rtems_task_suspend( RTEMS_SELF );
195
196  end_time = Read_timer();
197
198  put_time(
199    "exit ASR overhead: returns to preempting task",
200    end_time,
201    1,
202    0,
203    0
204  );
205
206  puts( "*** END OF TEST 19 ***" );
207  exit( 0 );
208}
Note: See TracBrowser for help on using the repository browser.