source: rtems/testsuites/tmtests/tm14/task1.c @ 5250ff39

4.104.114.84.95
Last change on this file since 5250ff39 was 3235ad9, checked in by Joel Sherrill <joel.sherrill@…>, on 08/23/95 at 19:30:23

Support for variable length names added to Object Handler. This supports
both fixed length "raw" names and strings from the API's point of view.

Both inline and macro implementations were tested.

  • Property mode set to 100644
File size: 3.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_id Queue_id;
21
22long Buffer[4];
23
24rtems_task test_init(
25  rtems_task_argument argument
26);
27
28rtems_task High_task(
29  rtems_task_argument argument
30);
31
32rtems_task Low_tasks(
33  rtems_task_argument argument
34);
35
36
37rtems_task Init(
38  rtems_task_argument argument
39)
40{
41  rtems_id          task_id;
42  rtems_status_code status;
43
44  puts( "\n\n*** TIME TEST 14 ***" );
45
46  status = rtems_task_create(
47    1,
48    251,
49    1024,
50    RTEMS_DEFAULT_MODES,
51    RTEMS_DEFAULT_ATTRIBUTES,
52    &task_id
53  );
54  directive_failed( status, "rtems_task_create" );
55
56  status = rtems_task_start( task_id, test_init, 0 );
57  directive_failed( status, "rtems_task_start" );
58
59  status = rtems_task_delete( RTEMS_SELF );
60  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
61}
62
63rtems_task test_init(
64  rtems_task_argument argument
65)
66{
67  rtems_unsigned32     index;
68  rtems_task_entry     task_entry;
69  rtems_task_priority  priority;
70  rtems_id             task_id;
71  rtems_status_code    status;
72
73
74  status = rtems_message_queue_create(
75    rtems_build_name( 'M', 'Q', '1', ' ' ),
76    OPERATION_COUNT,
77    16,
78    RTEMS_DEFAULT_ATTRIBUTES,
79    &Queue_id
80  );
81  directive_failed( status, "rtems_message_queue_create" );
82
83  priority = 250;
84
85  for( index = 0; index <= OPERATION_COUNT ; index++ ) {
86    status = rtems_task_create(
87      rtems_build_name( 'T', 'I', 'M', 'E' ),
88      priority,
89      1024,
90      RTEMS_DEFAULT_MODES,
91      RTEMS_DEFAULT_ATTRIBUTES,
92      &task_id
93    );
94    directive_failed( status, "rtems_task_create LOOP" );
95
96    priority--;
97
98    if ( index==OPERATION_COUNT ) task_entry = High_task;
99    else                          task_entry = Low_tasks;
100
101    status = rtems_task_start( task_id, task_entry, 0 );
102    directive_failed( status, "rtems_task_start LOOP" );
103  }
104}
105
106rtems_task High_task(
107  rtems_task_argument argument
108)
109{
110  rtems_unsigned32  index;
111
112  Timer_initialize();
113    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
114      (void) Empty_function();
115  overhead = Read_timer();
116
117  Timer_initialize();
118    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
119      (void) rtems_message_queue_urgent( Queue_id, (long (*)[4]) Buffer, 16 );
120  end_time = Read_timer();
121
122  put_time(
123    "rtems_message_queue_urgent (readying)",
124    end_time,
125    OPERATION_COUNT,
126    overhead,
127    CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT
128  );
129
130  exit( 0 );
131}
132
133rtems_task Low_tasks(
134  rtems_task_argument argument
135)
136{
137  rtems_unsigned32 size;
138
139  (void) rtems_message_queue_receive(
140           Queue_id,
141           (long (*)[4]) Buffer,
142           &size,
143           RTEMS_DEFAULT_OPTIONS,
144           RTEMS_NO_TIMEOUT
145         );
146}
Note: See TracBrowser for help on using the repository browser.