source: rtems/c/src/tests/sptests/sp13/task2.c @ 4b374f36

4.104.114.84.95
Last change on this file since 4b374f36 was 4b374f36, checked in by Joel Sherrill <joel.sherrill@…>, on 08/17/95 at 19:36:43

maximum number of messages removed and include statement cleanup

  • Property mode set to 100644
File size: 3.6 KB
Line 
1/*  Task_2
2 *
3 *  This routine serves as a test task.  Multiple tasks are required to
4 *  verify all message manager capabilities.
5 *
6 *  Input parameters:
7 *    argument - task argument
8 *
9 *  Output parameters:  NONE
10 *
11 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
12 *  On-Line Applications Research Corporation (OAR).
13 *  All rights assigned to U.S. Government, 1994.
14 *
15 *  This material may be reproduced by or for the U.S. Government pursuant
16 *  to the copyright license under the clause at DFARS 252.227-7013.  This
17 *  notice must appear in all copies of this file and its derivatives.
18 *
19 *  task2.c,v 1.2 1995/05/31 17:10:22 joel Exp
20 */
21
22#include "system.h"
23
24rtems_task Task_2(
25  rtems_task_argument argument
26)
27{
28  long                buffer[ 4 ];
29  rtems_unsigned32    size;
30  rtems_task_priority previous_priority;
31  rtems_status_code   status;
32
33  puts(
34    "TA2 - rtems_message_queue_receive - receive from queue 1 - RTEMS_NO_WAIT"
35  );
36  status = rtems_message_queue_receive(
37    Queue_id[ 1 ],
38    (long (*)[4])buffer,
39    &size,
40    RTEMS_NO_WAIT,
41    RTEMS_NO_TIMEOUT
42  );
43  directive_failed( status, "rtems_message_queue_receive" );
44  puts_nocr( "TA2 - buffer received: " );
45  Put_buffer( buffer );
46  new_line;
47
48  puts(
49    "TA2 - rtems_message_queue_receive - receive from queue 1 - "
50      "RTEMS_WAIT FOREVER"
51  );
52  status = rtems_message_queue_receive(
53    Queue_id[ 1 ],
54    (long (*)[4])buffer,
55    &size,
56    RTEMS_DEFAULT_OPTIONS,
57    RTEMS_NO_TIMEOUT
58  );
59  directive_failed( status, "rtems_message_queue_receive" );
60  puts_nocr( "TA2 - buffer received: " );
61  Put_buffer( buffer );
62  new_line;
63
64  puts(
65    "TA2 - rtems_message_queue_receive - receive from queue 1 - "
66      "RTEMS_WAIT FOREVER"
67 );
68  status = rtems_message_queue_receive(
69    Queue_id[ 1 ],
70    (long (*)[4])buffer,
71    &size,
72    RTEMS_DEFAULT_OPTIONS,
73    RTEMS_NO_TIMEOUT
74  );
75  directive_failed( status, "rtems_message_queue_receive" );
76  puts_nocr( "TA2 - buffer received: " );
77  Put_buffer( buffer );
78  new_line;
79
80  puts( "TA2 - rtems_task_set_priority - make self highest priority task" );
81  status = rtems_task_set_priority( RTEMS_SELF, 3, &previous_priority );
82  directive_failed( status, "rtems_task_set_priority" );
83
84  puts(
85    "TA2 - rtems_message_queue_receive - receive from queue 2 - "
86      "RTEMS_WAIT FOREVER"
87  );
88  status = rtems_message_queue_receive(
89    Queue_id[ 2 ],
90    (long (*)[4])buffer,
91    &size,
92    RTEMS_DEFAULT_OPTIONS,
93    RTEMS_NO_TIMEOUT
94  );
95  directive_failed( status, "rtems_message_queue_receive" );
96  puts_nocr( "TA2 - buffer received: " );
97  Put_buffer( buffer );
98  new_line;
99
100  Fill_buffer( "BUFFER 2 TO Q 2", (long *)buffer );
101  puts( "TA2 - rtems_message_queue_send - BUFFER 2 TO Q 2" );
102  directive_failed( status, "rtems_message_queue_send" );
103
104  status = rtems_message_queue_send( Queue_id[ 2 ], (long (*)[4])buffer, 16 );
105  directive_failed( status, "rtems_message_queue_send" );
106
107  puts(
108    "TA2 - rtems_message_queue_receive - receive from queue 1 - "
109      "10 second timeout"
110  );
111  status = rtems_message_queue_receive(
112    Queue_id[ 1 ],
113    (long (*)[4])buffer,
114    &size,
115    RTEMS_DEFAULT_OPTIONS,
116    10 * TICKS_PER_SECOND
117  );
118  directive_failed( status, "rtems_message_queue_receive" );
119  puts_nocr( "TA2 - buffer received: " );
120  Put_buffer( buffer );
121  new_line;
122
123  puts(
124    "TA2 - rtems_message_queue_receive - receive from queue 3 - "
125      "RTEMS_WAIT FOREVER"
126  );
127  status = rtems_message_queue_receive(
128    Queue_id[ 3 ],
129    (long (*)[4])buffer,
130    &size,
131    RTEMS_DEFAULT_OPTIONS,
132    RTEMS_NO_TIMEOUT
133  );
134  directive_failed( status, "rtems_message_queue_receive" );
135  puts_nocr( "TA2 - buffer received: " );
136  Put_buffer( buffer );
137  new_line;
138
139}
Note: See TracBrowser for help on using the repository browser.