source: rtems/testsuites/sptests/sp13/task2.c @ a841314

4.104.114.84.95
Last change on this file since a841314 was a841314, checked in by Joel Sherrill <joel.sherrill@…>, on Mar 30, 2004 at 7:46:38 PM

2004-03-30 David Querbach <querbach@…>

PR 595/tests

  • sp13/fillbuff.c, sp13/init.c, sp13/putbuff.c, sp13/system.h, sp13/task1.c, sp13/task2.c: Fill_buffer() in fillbuff.c overruns the supplied buffer due to confusion in the definition of MESSAGE_SIZE. Some files in the sp13 test treat MESSAGE_SIZE as a count of bytes, others treat it as a count of longs.
  • Property mode set to 100644
File size: 3.3 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-1999.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 *
18 *  $Id$
19 */
20
21#include "system.h"
22
23rtems_task Task_2(
24  rtems_task_argument argument
25)
26{
27  long                buffer[ 4 ];
28  uint32_t      size;
29  rtems_task_priority previous_priority;
30  rtems_status_code   status;
31
32  puts(
33    "TA2 - rtems_message_queue_receive - receive from queue 1 - RTEMS_NO_WAIT"
34  );
35  status = rtems_message_queue_receive(
36    Queue_id[ 1 ],
37    buffer,
38    &size,
39    RTEMS_NO_WAIT,
40    RTEMS_NO_TIMEOUT
41  );
42  directive_failed( status, "rtems_message_queue_receive" );
43  puts_nocr( "TA2 - buffer received: " );
44  Put_buffer( buffer );
45  new_line;
46
47  puts(
48    "TA2 - rtems_message_queue_receive - receive from queue 1 - "
49      "RTEMS_WAIT FOREVER"
50  );
51  status = rtems_message_queue_receive(
52    Queue_id[ 1 ],
53    buffer,
54    &size,
55    RTEMS_DEFAULT_OPTIONS,
56    RTEMS_NO_TIMEOUT
57  );
58  directive_failed( status, "rtems_message_queue_receive" );
59  puts_nocr( "TA2 - buffer received: " );
60  Put_buffer( buffer );
61  new_line;
62
63  puts(
64    "TA2 - rtems_message_queue_receive - receive from queue 1 - "
65      "RTEMS_WAIT FOREVER"
66 );
67  status = rtems_message_queue_receive(
68    Queue_id[ 1 ],
69    buffer,
70    &size,
71    RTEMS_DEFAULT_OPTIONS,
72    RTEMS_NO_TIMEOUT
73  );
74  directive_failed( status, "rtems_message_queue_receive" );
75  puts_nocr( "TA2 - buffer received: " );
76  Put_buffer( buffer );
77  new_line;
78
79  puts( "TA2 - rtems_task_set_priority - make self highest priority task" );
80  status = rtems_task_set_priority( RTEMS_SELF, 3, &previous_priority );
81  directive_failed( status, "rtems_task_set_priority" );
82
83  puts(
84    "TA2 - rtems_message_queue_receive - receive from queue 2 - "
85      "RTEMS_WAIT FOREVER"
86  );
87  status = rtems_message_queue_receive(
88    Queue_id[ 2 ],
89    buffer,
90    &size,
91    RTEMS_DEFAULT_OPTIONS,
92    RTEMS_NO_TIMEOUT
93  );
94  directive_failed( status, "rtems_message_queue_receive" );
95  puts_nocr( "TA2 - buffer received: " );
96  Put_buffer( buffer );
97  new_line;
98
99  Fill_buffer( "BUFFER 2 TO Q 2", (long *)buffer );
100  puts( "TA2 - rtems_message_queue_send - BUFFER 2 TO Q 2" );
101  status = rtems_message_queue_send( Queue_id[ 2 ], buffer, MESSAGE_SIZE );
102  directive_failed( status, "rtems_message_queue_send" );
103
104  puts(
105    "TA2 - rtems_message_queue_receive - receive from queue 1 - "
106      "10 second timeout"
107  );
108  status = rtems_message_queue_receive(
109    Queue_id[ 1 ],
110    buffer,
111    &size,
112    RTEMS_DEFAULT_OPTIONS,
113    10 * TICKS_PER_SECOND
114  );
115  directive_failed( status, "rtems_message_queue_receive" );
116  puts_nocr( "TA2 - buffer received: " );
117  Put_buffer( buffer );
118  new_line;
119
120  puts(
121    "TA2 - rtems_message_queue_receive - receive from queue 3 - "
122      "RTEMS_WAIT FOREVER"
123  );
124  status = rtems_message_queue_receive(
125    Queue_id[ 3 ],
126    buffer,
127    &size,
128    RTEMS_DEFAULT_OPTIONS,
129    RTEMS_NO_TIMEOUT
130  );
131  directive_failed( status, "rtems_message_queue_receive" );
132  puts_nocr( "TA2 - buffer received: " );
133  Put_buffer( buffer );
134  new_line;
135
136}
Note: See TracBrowser for help on using the repository browser.