source: rtems/c/src/tests/tmtests/tm22/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 Sep 11, 1995 at 7:35:39 PM

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.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_id Queue_id;
18
19long Buffer[4];
20
21rtems_task Low_task(
22  rtems_task_argument argument
23);
24
25rtems_task High_task(
26  rtems_task_argument argument
27);
28
29rtems_task Preempt_task(
30  rtems_task_argument argument
31);
32
33rtems_task Init(
34  rtems_task_argument argument
35)
36{
37  rtems_id          id;
38  rtems_status_code status;
39
40  Print_Warning();
41
42  puts( "\n\n*** TIME TEST 22 ***" );
43
44  status = rtems_message_queue_create(
45    rtems_build_name( 'M', 'Q', '1', ' '),
46    100,
47    16,
48    RTEMS_DEFAULT_ATTRIBUTES,
49    &Queue_id
50  );
51  directive_failed( status, "rtems_message_queue_create" );
52
53  status = rtems_task_create(
54    rtems_build_name( 'L', 'O', 'W', ' ' ),
55    10,
56    2048,
57    RTEMS_NO_PREEMPT,
58    RTEMS_DEFAULT_ATTRIBUTES,
59    &id
60  );
61  directive_failed( status, "rtems_task_create" );
62
63  status = rtems_task_start( id, Low_task, 0 );
64  directive_failed( status, "rtems_task_start LOW" );
65
66  status = rtems_task_create(
67    1,
68    11,
69    1024,
70    RTEMS_DEFAULT_MODES,
71    RTEMS_DEFAULT_ATTRIBUTES,
72    &id
73  );
74  directive_failed( status, "rtems_task_create RTEMS_PREEMPT" );
75
76  status = rtems_task_start( id, Preempt_task, 0 );
77  directive_failed( status, "rtems_task_start RTEMS_PREEMPT" );
78
79  status = rtems_task_delete( RTEMS_SELF );
80  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
81}
82
83rtems_task High_task(
84  rtems_task_argument argument
85)
86{
87  rtems_unsigned32  count;
88  rtems_status_code status;
89
90  Timer_initialize();
91    (void) rtems_message_queue_broadcast(
92             Queue_id,
93             (long (*)[4]) Buffer,
94             16,
95             &count
96           );
97  end_time = Read_timer();
98
99  put_time(
100    "rtems_message_queue_broadcast (readying)",
101    end_time,
102    1,
103    0,
104    CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST
105  );
106
107  status = rtems_task_suspend(RTEMS_SELF);
108  directive_failed( status, "rtems_task_suspend" );
109}
110
111rtems_task Low_task(
112  rtems_task_argument argument
113)
114{
115  rtems_id          id;
116  rtems_unsigned32  index;
117  rtems_unsigned32  count;
118  rtems_unsigned32  size;
119  rtems_status_code status;
120
121  status = rtems_task_create(
122    rtems_build_name( 'H', 'I', 'G', 'H' ),
123    5,
124    2048,
125    RTEMS_NO_PREEMPT,
126    RTEMS_DEFAULT_ATTRIBUTES,
127    &id
128  );
129  directive_failed( status, "rtems_task_create" );
130
131  status = rtems_task_start( id, High_task, 0 );
132  directive_failed( status, "rtems_task_start HIGH" );
133
134  status = rtems_message_queue_receive(
135    Queue_id,
136    (long (*)[4]) Buffer,
137    &size,
138    RTEMS_DEFAULT_OPTIONS,
139    RTEMS_NO_TIMEOUT
140  );
141  directive_failed( status, "message_queu_receive" );
142
143  Timer_initialize();
144    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
145      (void) rtems_message_queue_broadcast(
146               Queue_id,
147               (long (*)[4]) Buffer,
148               16,
149               &count
150             );
151  end_time = Read_timer();
152
153  put_time(
154    "rtems_message_queue_broadcast (no waiting tasks)",
155    end_time,
156    OPERATION_COUNT,
157    1,
158    CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST
159  );
160
161  (void) rtems_message_queue_receive(
162           Queue_id,
163           (long (*)[4]) Buffer,
164           &size,
165           RTEMS_DEFAULT_OPTIONS,
166           RTEMS_NO_TIMEOUT
167         );
168
169  /* should go to Preempt_task here */
170
171  end_time = Read_timer();
172
173  put_time(
174    "rtems_message_queue_broadcast (preempt)",
175    end_time,
176    1,
177    0,
178    CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST
179  );
180
181  puts( "*** END OF TEST 22 ***" );
182  exit( 0 );
183}
184
185rtems_task Preempt_task(
186  rtems_task_argument argument
187)
188{
189  rtems_unsigned32  count;
190
191  Timer_initialize();
192    (void) rtems_message_queue_broadcast(
193             Queue_id,
194             (long (*)[4]) Buffer,
195             16,
196             &count
197           );
198
199 /* should be preempted by low task */
200}
Note: See TracBrowser for help on using the repository browser.