4.115
Line | |
---|
1 | /* Receive_messages |
---|
2 | * |
---|
3 | * This routine receives and prints three messages. |
---|
4 | * an error condition. |
---|
5 | * |
---|
6 | * Input parameters: NONE |
---|
7 | * |
---|
8 | * Output parameters: NONE |
---|
9 | * |
---|
10 | * COPYRIGHT (c) 1989-2009. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.com/license/LICENSE. |
---|
16 | * |
---|
17 | * $Id$ |
---|
18 | */ |
---|
19 | |
---|
20 | #ifdef HAVE_CONFIG_H |
---|
21 | #include "config.h" |
---|
22 | #endif |
---|
23 | |
---|
24 | #include "system.h" |
---|
25 | |
---|
26 | void Receive_messages() |
---|
27 | { |
---|
28 | rtems_status_code status; |
---|
29 | uint32_t index; |
---|
30 | size_t size; |
---|
31 | char receive_buffer[16]; |
---|
32 | |
---|
33 | for ( index=1 ; index <=3 ; index++ ) { |
---|
34 | puts( "Receiving message ..." ); |
---|
35 | status = rtems_message_queue_receive( |
---|
36 | Queue_id[ 1 ], |
---|
37 | receive_buffer, |
---|
38 | &size, |
---|
39 | RTEMS_DEFAULT_OPTIONS, |
---|
40 | RTEMS_NO_TIMEOUT |
---|
41 | ); |
---|
42 | directive_failed( status, "rtems_message_queue_receive" ); |
---|
43 | puts_nocr( "Received : "); |
---|
44 | puts( receive_buffer ); |
---|
45 | } |
---|
46 | |
---|
47 | puts( "Receiver delaying for a second" ); |
---|
48 | status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); |
---|
49 | directive_failed( status, "rtems_task_wake_after" ); |
---|
50 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.