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

4.104.114.84.95
Last change on this file since 3a4ae6c was 3a4ae6c, checked in by Joel Sherrill <joel.sherrill@…>, on 09/11/95 at 19:35:39

The word "RTEMS" almost completely removed from the core.

Configuration Table Template file added and all tests
modified to use this. All gvar.h and conftbl.h files
removed from test directories.

Configuration parameter maximum_devices added.

Core semaphore and mutex handlers added and RTEMS API Semaphore
Manager updated to reflect this.

Initialization sequence changed to invoke API specific initialization
routines. Initialization tasks table now owned by RTEMS Tasks Manager.

Added user extension for post-switch.

Utilized user extensions to implement API specific functionality
like signal dispatching.

Added extensions to the System Initialization Thread so that an
API can register a function to be invoked while the system
is being initialized. These are largely equivalent to the
pre-driver and post-driver hooks.

Added the Modules file oar-go32_p5, modified oar-go32, and modified
the file make/custom/go32.cfg to look at an environment varable which
determines what CPU model is being used.

All BSPs updated to reflect named devices and clock driver's IOCTL
used by the Shared Memory Driver. Also merged clock isr into
main file and removed ckisr.c where possible.

Updated spsize to reflect new and moved variables.

Makefiles for the executive source and include files updated to show
break down of files into Core, RTEMS API, and Neither.

Header and inline files installed into subdirectory based on whether
logically in the Core or a part of the RTEMS API.

  • 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#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    1024,
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    1024,
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    1024,
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 (self)",
98    end_time,
99    1,
100    0,
101    CALLING_OVERHEAD_SIGNAL_SEND
102  );
103
104  puts( "SIGNAL_ENTER (non-preemptive) na" );
105
106  Timer_initialize();
107}
108
109rtems_asr Process_asr_for_pass_2(
110  rtems_signal_set signals
111)
112{
113  rtems_status_code status;
114
115  puts( "SIGNAL_ENTER (preemptive) na" );
116
117  status = rtems_task_resume( Task_id[ 3 ] );
118  directive_failed( status, "rtems_task_resume" );
119
120  Timer_initialize();
121}
122
123rtems_task Task_1(
124  rtems_task_argument argument
125)
126{
127  rtems_status_code status;
128
129  Timer_initialize();
130    (void) rtems_signal_catch( Process_asr_for_pass_1, RTEMS_DEFAULT_MODES );
131  end_time = Read_timer();
132
133  put_time(
134    "rtems_signal_catch",
135    end_time,
136    1,
137    0,
138    CALLING_OVERHEAD_SIGNAL_CATCH
139  );
140
141  Timer_initialize();
142    rtems_signal_send( Task_id[ 2 ], 1 );
143  end_time = Read_timer();
144
145  put_time(
146    "rtems_signal_send (non-preemptive)",
147    end_time,
148    1,
149    0,
150    CALLING_OVERHEAD_SIGNAL_SEND
151  );
152
153  Timer_initialize();
154    (void) rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );
155
156  /* end time is done is RTEMS_ASR */
157
158  end_time = Read_timer();
159
160  put_time(
161    "SIGNAL_RETURN (non-preemptive)",
162    end_time,
163    1,
164    0,
165    0
166  );
167
168  status = rtems_signal_catch( Process_asr_for_pass_2, RTEMS_NO_PREEMPT );
169  directive_failed( status, "rtems_signal_catch" );
170
171  Timer_initialize();
172    (void) rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );
173}
174
175rtems_asr Process_asr_for_task_2(
176  rtems_signal_set signals
177)
178{
179  ;
180}
181
182rtems_task Task_2(
183  rtems_task_argument argument
184)
185{
186  rtems_status_code status;
187
188  status = rtems_signal_catch( Process_asr_for_task_2, RTEMS_DEFAULT_MODES );
189  directive_failed( status, "rtems_signal_catch" );
190
191  (void) rtems_task_suspend( RTEMS_SELF );
192}
193
194rtems_task Task_3(
195  rtems_task_argument argument
196)
197{
198  (void) rtems_task_suspend( RTEMS_SELF );
199
200  end_time = Read_timer();
201
202  put_time(
203    "SIGNAL_RETURN (preemptive)",
204    end_time,
205    1,
206    0,
207    0
208  );
209
210  puts( "*** END OF TEST 19 ***" );
211  exit( 0 );
212}
Note: See TracBrowser for help on using the repository browser.