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

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