source: rtems/testsuites/sptests/sp13/task3.c @ 99de42c

5
Last change on this file since 99de42c was 51b3cbca, checked in by Sebastian Huber <sebastian.huber@…>, on 10/04/18 at 13:23:25

tests: Use rtems_task_exit()

Update #3533.

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*  Task_3
2 *
3 *  This routine serves as a test task.  Its major function is to
4 *  broadcast a messge to all the other tasks.
5 *
6 *  Input parameters:
7 *    argument - task argument
8 *
9 *  Output parameters:  NONE
10 *
11 *  COPYRIGHT (c) 1989-2007.
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.org/license/LICENSE.
17 */
18
19#ifdef HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include "system.h"
24
25rtems_task Task_3(
26  rtems_task_argument argument
27)
28{
29  long              buffer[ 4 ];
30  size_t            size;
31  uint32_t          count;
32  rtems_status_code status;
33
34  puts(
35    "TA3 - rtems_message_queue_receive - receive from queue 2 - "
36      "RTEMS_WAIT FOREVER"
37  );
38  status = rtems_message_queue_receive(
39    Queue_id[ 2 ],
40    (long (*)[4])buffer,
41    &size,
42    RTEMS_DEFAULT_OPTIONS,
43    RTEMS_NO_TIMEOUT
44  );
45  directive_failed( status, "rtems_message_queue_receive" );
46  puts_nocr( "TA3 - buffer received: " );
47  Put_buffer( buffer );
48  new_line;
49
50  Fill_buffer( "BUFFER 3 TO Q 1", (long *)buffer );
51  puts( "TA3 - rtems_message_queue_broadcast - BUFFER 3 TO Q 1" );
52  status = rtems_message_queue_broadcast(
53    Queue_id[ 1 ],
54    (long (*)[4])buffer,
55    16,
56    &count
57  );
58  printf( "TA3 - number of tasks awakened = %02" PRIu32 "\n", count );
59  puts(
60    "TA3 - rtems_message_queue_receive - receive from queue 3 - "
61      "RTEMS_WAIT FOREVER"
62  );
63
64  status = rtems_message_queue_receive(
65    Queue_id[ 3 ],
66    (long (*)[4])buffer,
67    &size,
68    RTEMS_DEFAULT_OPTIONS,
69    RTEMS_NO_TIMEOUT
70  );
71  directive_failed( status, "rtems_message_queue_receive" );
72  puts_nocr( "TA3 - buffer received: " );
73  Put_buffer( buffer );
74  new_line;
75
76  puts( "TA3 - rtems_task_exit" );
77  rtems_task_exit();
78}
Note: See TracBrowser for help on using the repository browser.