source: rtems/testsuites/tmtests/tm19/task1.c @ 98e92f6f

4.104.114.84.9
Last change on this file since 98e92f6f was 95a81ab, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 4, 2003 at 6:53:55 PM

2003-09-04 Joel Sherrill <joel@…>

  • include/timesys.h, tm01/system.h, tm01/task1.c, tm01/tm01.doc, tm02/system.h, tm02/task1.c, tm02/tm02.doc, tm03/system.h, tm03/task1.c, tm03/tm03.doc, tm04/system.h, tm04/task1.c, tm04/tm04.doc, tm05/system.h, tm05/task1.c, tm05/tm05.doc, tm06/system.h, tm06/task1.c, tm06/tm06.doc, tm07/system.h, tm07/task1.c, tm07/tm07.doc, tm08/system.h, tm08/task1.c, tm08/tm08.doc, tm09/system.h, tm09/task1.c, tm09/tm09.doc, tm10/system.h, tm10/task1.c, tm10/tm10.doc, tm11/system.h, tm11/task1.c, tm11/tm11.doc, tm12/system.h, tm12/task1.c, tm12/tm12.doc, tm13/system.h, tm13/task1.c, tm13/tm13.doc, tm14/system.h, tm14/task1.c, tm14/tm14.doc, tm15/system.h, tm15/task1.c, tm15/tm15.doc, tm16/system.h, tm16/task1.c, tm16/tm16.doc, tm17/system.h, tm17/task1.c, tm17/tm17.doc, tm18/system.h, tm18/task1.c, tm18/tm18.doc, tm19/system.h, tm19/task1.c, tm19/tm19.doc, tm20/system.h, tm20/task1.c, tm20/tm20.doc, tm21/system.h, tm21/task1.c, tm21/tm21.doc, tm22/system.h, tm22/task1.c, tm22/tm22.doc, tm23/system.h, tm23/task1.c, tm23/tm23.doc, tm24/system.h, tm24/task1.c, tm24/tm24.doc, tm25/system.h, tm25/task1.c, tm25/tm25.doc, tm26/fptest.h, tm26/system.h, tm26/task1.c, tm26/tm26.doc, tm27/system.h, tm27/task1.c, tm27/tm27.doc, tm28/system.h, tm28/task1.c, tm28/tm28.doc, tm29/system.h, tm29/task1.c, tm29/tm29.doc, tmck/system.h, tmck/task1.c, tmck/tmck.doc, tmoverhd/dumrtems.h, tmoverhd/empty.c, tmoverhd/system.h, tmoverhd/testtask.c, tmoverhd/tmoverhd.doc: URL for license changed.
  • Property mode set to 100644
File size: 3.9 KB
Line 
1/*
2 *
3 *  COPYRIGHT (c) 1989-1999.
4 *  On-Line Applications Research Corporation (OAR).
5 *
6 *  The license and distribution terms for this file may be
7 *  found in the file LICENSE in this distribution or at
8 *  http://www.rtems.com/license/LICENSE.
9 *
10 *  $Id$
11 */
12
13#define TEST_INIT
14#include "system.h"
15
16rtems_asr Process_asr_for_pass_1(
17  rtems_signal_set signals
18);
19
20rtems_asr Process_asr_for_pass_2(
21  rtems_signal_set signals
22);
23
24rtems_task Task_1(
25  rtems_task_argument argument
26);
27
28rtems_task Task_2(
29  rtems_task_argument argument
30);
31
32rtems_task Task_3(
33  rtems_task_argument argument
34);
35
36rtems_task Init(
37  rtems_task_argument argument
38)
39{
40  rtems_status_code status;
41
42  Print_Warning();
43
44  puts( "\n\n*** TIME TEST 19 ***" );
45
46  status = rtems_task_create(
47    rtems_build_name( 'T', 'I', 'M', 'E' ),
48    128,
49    RTEMS_MINIMUM_STACK_SIZE,
50    RTEMS_DEFAULT_MODES,
51    RTEMS_DEFAULT_ATTRIBUTES,
52    &Task_id[ 1 ]
53  );
54  directive_failed( status, "rtems_task_create of TASK1" );
55
56  status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
57  directive_failed( status, "rtems_task_start of TASK1" );
58
59  status = rtems_task_create(
60    rtems_build_name( 'T', 'I', 'M', 'E' ),
61    127,
62    RTEMS_MINIMUM_STACK_SIZE,
63    RTEMS_DEFAULT_MODES,
64    RTEMS_DEFAULT_ATTRIBUTES,
65    &Task_id[ 2 ]
66  );
67  directive_failed( status, "rtems_task_create of TASK2" );
68
69  status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
70  directive_failed( status, "rtems_task_start of TASK2" );
71
72  status = rtems_task_create(
73    rtems_build_name( 'T', 'I', 'M', 'E' ),
74    126,
75    RTEMS_MINIMUM_STACK_SIZE,
76    RTEMS_DEFAULT_MODES,
77    RTEMS_DEFAULT_ATTRIBUTES,
78    &Task_id[ 3 ]
79  );
80  directive_failed( status, "rtems_task_create of TASK3" );
81
82  status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
83  directive_failed( status, "rtems_task_start of TASK3" );
84
85  status = rtems_task_delete( RTEMS_SELF );
86  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
87}
88
89rtems_asr Process_asr_for_pass_1(
90  rtems_signal_set signals
91)
92{
93  end_time = Read_timer();
94
95  put_time(
96    "rtems_signal_send: signal to self",
97    end_time,
98    1,
99    0,
100    CALLING_OVERHEAD_SIGNAL_SEND
101  );
102
103  Timer_initialize();
104}
105
106rtems_asr Process_asr_for_pass_2(
107  rtems_signal_set signals
108)
109{
110  rtems_status_code status;
111
112  status = rtems_task_resume( Task_id[ 3 ] );
113  directive_failed( status, "rtems_task_resume" );
114
115  Timer_initialize();
116}
117
118rtems_task Task_1(
119  rtems_task_argument argument
120)
121{
122  rtems_status_code status;
123
124  Timer_initialize();
125    (void) rtems_signal_catch( Process_asr_for_pass_1, RTEMS_DEFAULT_MODES );
126  end_time = Read_timer();
127
128  put_time(
129    "rtems_signal_catch",
130    end_time,
131    1,
132    0,
133    CALLING_OVERHEAD_SIGNAL_CATCH
134  );
135
136  Timer_initialize();
137    rtems_signal_send( Task_id[ 2 ], 1 );
138  end_time = Read_timer();
139
140  put_time(
141    "rtems_signal_send: returns to caller",
142    end_time,
143    1,
144    0,
145    CALLING_OVERHEAD_SIGNAL_SEND
146  );
147
148  Timer_initialize();
149    (void) rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );
150
151  /* end time is done is RTEMS_ASR */
152
153  end_time = Read_timer();
154
155  put_time(
156    "exit ASR overhead: returns to calling task",
157    end_time,
158    1,
159    0,
160    0
161  );
162
163  status = rtems_signal_catch( Process_asr_for_pass_2, RTEMS_NO_PREEMPT );
164  directive_failed( status, "rtems_signal_catch" );
165
166  Timer_initialize();
167    (void) rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );
168}
169
170rtems_asr Process_asr_for_task_2(
171  rtems_signal_set signals
172)
173{
174  ;
175}
176
177rtems_task Task_2(
178  rtems_task_argument argument
179)
180{
181  rtems_status_code status;
182
183  status = rtems_signal_catch( Process_asr_for_task_2, RTEMS_DEFAULT_MODES );
184  directive_failed( status, "rtems_signal_catch" );
185
186  (void) rtems_task_suspend( RTEMS_SELF );
187}
188
189rtems_task Task_3(
190  rtems_task_argument argument
191)
192{
193  (void) rtems_task_suspend( RTEMS_SELF );
194
195  end_time = Read_timer();
196
197  put_time(
198    "exit ASR overhead: returns to preempting task",
199    end_time,
200    1,
201    0,
202    0
203  );
204
205  puts( "*** END OF TEST 19 ***" );
206  rtems_test_exit( 0 );
207}
Note: See TracBrowser for help on using the repository browser.