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.com/license/LICENSE. |
---|
17 | * |
---|
18 | * $Id$ |
---|
19 | */ |
---|
20 | |
---|
21 | #include "system.h" |
---|
22 | |
---|
23 | rtems_task Task_3( |
---|
24 | rtems_task_argument argument |
---|
25 | ) |
---|
26 | { |
---|
27 | long buffer[ 4 ]; |
---|
28 | size_t size; |
---|
29 | uint32_t count; |
---|
30 | rtems_status_code status; |
---|
31 | |
---|
32 | puts( |
---|
33 | "TA3 - rtems_message_queue_receive - receive from queue 2 - " |
---|
34 | "RTEMS_WAIT FOREVER" |
---|
35 | ); |
---|
36 | status = rtems_message_queue_receive( |
---|
37 | Queue_id[ 2 ], |
---|
38 | (long (*)[4])buffer, |
---|
39 | &size, |
---|
40 | RTEMS_DEFAULT_OPTIONS, |
---|
41 | RTEMS_NO_TIMEOUT |
---|
42 | ); |
---|
43 | directive_failed( status, "rtems_message_queue_receive" ); |
---|
44 | puts_nocr( "TA3 - buffer received: " ); |
---|
45 | Put_buffer( buffer ); |
---|
46 | new_line; |
---|
47 | |
---|
48 | Fill_buffer( "BUFFER 3 TO Q 1", (long *)buffer ); |
---|
49 | puts( "TA3 - rtems_message_queue_broadcast - BUFFER 3 TO Q 1" ); |
---|
50 | status = rtems_message_queue_broadcast( |
---|
51 | Queue_id[ 1 ], |
---|
52 | (long (*)[4])buffer, |
---|
53 | 16, |
---|
54 | &count |
---|
55 | ); |
---|
56 | printf( "TA3 - number of tasks awakened = %02d\n", count ); |
---|
57 | puts( |
---|
58 | "TA3 - rtems_message_queue_receive - receive from queue 3 - " |
---|
59 | "RTEMS_WAIT FOREVER" |
---|
60 | ); |
---|
61 | |
---|
62 | status = rtems_message_queue_receive( |
---|
63 | Queue_id[ 3 ], |
---|
64 | (long (*)[4])buffer, |
---|
65 | &size, |
---|
66 | RTEMS_DEFAULT_OPTIONS, |
---|
67 | RTEMS_NO_TIMEOUT |
---|
68 | ); |
---|
69 | directive_failed( status, "rtems_message_queue_receive" ); |
---|
70 | puts_nocr( "TA3 - buffer received: " ); |
---|
71 | Put_buffer( buffer ); |
---|
72 | new_line; |
---|
73 | |
---|
74 | puts( "TA3 - rtems_task_delete - delete self" ); |
---|
75 | status = rtems_task_delete( RTEMS_SELF ); |
---|
76 | directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); |
---|
77 | } |
---|