1 | /* Broadcast to a message queue with pending messages |
---|
2 | * |
---|
3 | * COPYRIGHT (c) 1989-2009. |
---|
4 | * On-Line Applications Research Corporation (OAR). |
---|
5 | * |
---|
6 | * The license and distribution terms for this file may be |
---|
7 | * found in the file LICENSE in this distribution or at |
---|
8 | * http://www.rtems.com/license/LICENSE. |
---|
9 | * |
---|
10 | * $Id$ |
---|
11 | */ |
---|
12 | |
---|
13 | #include <tmacros.h> |
---|
14 | |
---|
15 | rtems_task Init( |
---|
16 | rtems_task_argument ignored |
---|
17 | ) |
---|
18 | { |
---|
19 | rtems_status_code status; |
---|
20 | rtems_id id; |
---|
21 | int msg = 1; |
---|
22 | uint32_t count = 20; |
---|
23 | |
---|
24 | puts( "\n\n*** TEST 55 ***" ); |
---|
25 | |
---|
26 | puts( "Init - rtems_message_queue_create - OK" ); |
---|
27 | status = rtems_message_queue_create( |
---|
28 | rtems_build_name( 'Q', '1', ' ', ' ' ), |
---|
29 | 2, |
---|
30 | sizeof(int), |
---|
31 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
32 | &id |
---|
33 | ); |
---|
34 | directive_failed( status, "rtems_message_queue_create" ); |
---|
35 | |
---|
36 | puts( "Init - rtems_message_queue_send - make message pending - OK" ); |
---|
37 | status = rtems_message_queue_send( id, &msg, sizeof(msg) ); |
---|
38 | directive_failed( status, "rtems_message_queue_send" ); |
---|
39 | |
---|
40 | puts( "Init - rtems_message_queue_broadcast - with message pending - OK" ); |
---|
41 | status = rtems_message_queue_broadcast( id, &msg, sizeof(msg), &count ); |
---|
42 | directive_failed( status, "rtems_message_queue_broadcast" ); |
---|
43 | if ( count != 0 ) { |
---|
44 | puts( "broadcast with message pending FAILED" ); |
---|
45 | rtems_test_exit(0); |
---|
46 | } |
---|
47 | |
---|
48 | puts( "Init - rtems_message_queue_delete - OK" ); |
---|
49 | status = rtems_message_queue_delete( id ); |
---|
50 | directive_failed( status, "rtems_message_queue_delete" ); |
---|
51 | |
---|
52 | puts( "*** END OF TEST 55 ***" ); |
---|
53 | rtems_test_exit(0); |
---|
54 | } |
---|
55 | |
---|
56 | /* configuration information */ |
---|
57 | |
---|
58 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
59 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER |
---|
60 | |
---|
61 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
62 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 |
---|
63 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
64 | |
---|
65 | #define CONFIGURE_MESSAGE_BUFFER_MEMORY \ |
---|
66 | CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( 2, sizeof(int) ) |
---|
67 | |
---|
68 | #define CONFIGURE_INIT |
---|
69 | #include <rtems/confdefs.h> |
---|
70 | |
---|
71 | /* global variables */ |
---|