source: rtems/testsuites/tmtests/tm21/task1.c @ 7f6a24ab

4.104.114.84.95
Last change on this file since 7f6a24ab was 7f6a24ab, checked in by Joel Sherrill <joel.sherrill@…>, on Aug 28, 1995 at 3:30:29 PM

Added unused priority ceiling parameter to rtems_semaphore_create.

Rearranged code to created thread handler routines to initialize,
start, restart, and "close/delete" a thread.

Made internal threads their own object class. This now uses the
thread support routines for starting and initializing a thread.

Insured deleted tasks are freed to the Inactive pool associated with the
correct Information block.

Added an RTEMS API specific data area to the thread control block.

Beginnings of removing the word "rtems" from the core.

  • Property mode set to 100644
File size: 5.3 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_unsigned8 Region_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
21rtems_unsigned8 Partition_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
22
23rtems_task Task_1(
24  rtems_task_argument argument
25);
26
27rtems_task Init(
28  rtems_task_argument argument
29)
30{
31  rtems_id          id;
32  rtems_status_code status;
33
34  puts( "\n\n*** TIME TEST 21 ***" );
35
36  status = rtems_task_create(
37    rtems_build_name( 'T', 'I', 'M', 'E' ),
38    250,
39    1024,
40    RTEMS_DEFAULT_MODES,
41    RTEMS_DEFAULT_ATTRIBUTES,
42    &id
43  );
44  directive_failed( status, "rtems_task_create of TASK1" );
45
46  status = rtems_task_start( id, Task_1, 0 );
47  directive_failed( status, "rtems_task_start of TASK1" );
48
49  status = rtems_task_delete( RTEMS_SELF );
50  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
51}
52
53rtems_task Task_1(
54  rtems_task_argument argument
55)
56{
57  rtems_unsigned32  index;
58  rtems_id          id;
59  rtems_status_code status;
60
61  for( index = 1 ; index <= OPERATION_COUNT ; index++ ) {
62    status = rtems_task_create (
63      index,
64      254,
65      1024,
66      RTEMS_DEFAULT_MODES,
67      RTEMS_DEFAULT_ATTRIBUTES,
68      &id
69    );
70    directive_failed( status, "rtems_task_create" );
71
72    status = rtems_message_queue_create(
73      index,
74      OPERATION_COUNT,
75      16,
76      RTEMS_DEFAULT_ATTRIBUTES,
77      &id
78    );
79    directive_failed( status, "rtems_message_queue_create" );
80
81    status = rtems_semaphore_create(
82      index,
83      OPERATION_COUNT,
84      RTEMS_DEFAULT_ATTRIBUTES,
85      RTEMS_NO_PRIORITY,
86      &id
87    );
88    directive_failed( status, "rtems_semaphore_create" );
89
90    status = rtems_region_create(
91      index,
92      Region_area,
93      2048,
94      16,
95      RTEMS_DEFAULT_ATTRIBUTES,
96      &id
97    );
98    directive_failed( status, "rtems_region_create" );
99
100    status = rtems_partition_create(
101      index,
102      Partition_area,
103      2048,
104      128,
105      RTEMS_DEFAULT_ATTRIBUTES,
106      &id
107    );
108    directive_failed( status, "rtems_partition_create" );
109
110    status = rtems_port_create(
111      index,
112      Partition_area,
113      Region_area,
114      0xff,
115      &id
116    );
117    directive_failed( status, "rtems_port_create" );
118
119    status = rtems_timer_create( index, &id );
120    directive_failed( status, "rtems_timer_create" );
121
122    status = rtems_rate_monotonic_create( index, &id );
123    directive_failed( status, "rtems_rate_monotonic_create" );
124  }
125
126  Timer_initialize();
127    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
128      (void) Empty_function();
129  overhead = Read_timer();
130
131  Timer_initialize();
132    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
133      (void) rtems_task_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
134  end_time = Read_timer();
135
136  put_time(
137    "rtems_task_ident",
138    end_time,
139    OPERATION_COUNT,
140    overhead,
141    CALLING_OVERHEAD_TASK_IDENT
142  );
143
144  Timer_initialize();
145    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
146      (void) rtems_message_queue_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
147  end_time = Read_timer();
148
149  put_time(
150    "rtems_message_queue_ident",
151    end_time,
152    OPERATION_COUNT,
153    overhead,
154    CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT
155  );
156
157  Timer_initialize();
158    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
159      (void) rtems_semaphore_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
160  end_time = Read_timer();
161
162  put_time(
163    "rtems_semaphore_ident",
164    end_time,
165    OPERATION_COUNT,
166    overhead,
167    CALLING_OVERHEAD_SEMAPHORE_IDENT
168  );
169
170  Timer_initialize();
171    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
172      (void) rtems_partition_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
173  end_time = Read_timer();
174
175  put_time(
176    "rtems_partition_ident",
177    end_time,
178    OPERATION_COUNT,
179    overhead,
180    CALLING_OVERHEAD_PARTITION_IDENT
181  );
182
183  Timer_initialize();
184    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
185      (void) rtems_region_ident( index, &id );
186  end_time = Read_timer();
187
188  put_time(
189    "rtems_region_ident",
190    end_time,
191    OPERATION_COUNT,
192    overhead,
193    CALLING_OVERHEAD_REGION_IDENT
194  );
195
196  Timer_initialize();
197    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
198      (void) rtems_port_ident( index, &id );
199  end_time = Read_timer();
200
201  put_time(
202    "rtems_port_ident",
203    end_time,
204    OPERATION_COUNT,
205    overhead,
206    CALLING_OVERHEAD_PORT_IDENT
207  );
208
209  Timer_initialize();
210    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
211      (void) rtems_timer_ident( index, &id );
212  end_time = Read_timer();
213
214  put_time(
215    "rtems_timer_ident",
216    end_time,
217    OPERATION_COUNT,
218    overhead,
219    CALLING_OVERHEAD_TIMER_IDENT
220  );
221
222  Timer_initialize();
223    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
224      (void) rtems_rate_monotonic_ident( index, &id );
225  end_time = Read_timer();
226
227  put_time(
228    "rtems_rate_monotonic_ident",
229    end_time,
230    OPERATION_COUNT,
231    overhead,
232    CALLING_OVERHEAD_RATE_MONOTONIC_IDENT
233  );
234
235  exit( 0 );
236}
Note: See TracBrowser for help on using the repository browser.