OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [tests/] [mptests/] [mp13/] [task1.c] - Blame information for rev 373

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*  Test_task1
2
 *
3
 *  This task attempts to receive a message from a global message queue.
4
 *  If running on the node on which the queue resides, the wait is
5
 *  forever, otherwise it times out on a remote message queue.
6
 *
7
 *  Input parameters:
8
 *    argument - task argument
9
 *
10
 *  Output parameters:  NONE
11
 *
12
 *  COPYRIGHT (c) 1989-1999.
13
 *  On-Line Applications Research Corporation (OAR).
14
 *
15
 *  The license and distribution terms for this file may be
16
 *  found in the file LICENSE in this distribution or at
17
 *  http://www.OARcorp.com/rtems/license.html.
18
 *
19
 *  $Id: task1.c,v 1.2 2001-09-27 12:02:22 chris Exp $
20
 */
21
 
22
#include "system.h"
23
 
24
rtems_task Test_task1(
25
  rtems_task_argument argument
26
)
27
{
28
  char              receive_buffer[16];
29
  rtems_unsigned32  size;
30
  rtems_status_code status;
31
 
32
  puts( "Getting QID of message queue" );
33
 
34
  do {
35
    status = rtems_message_queue_ident(
36
      Queue_name[ 1 ],
37
      RTEMS_SEARCH_ALL_NODES,
38
      &Queue_id[ 1 ]
39
    );
40
  } while ( !rtems_is_status_successful( status ) );
41
 
42
  if ( Multiprocessing_configuration.node == 1 ) {
43
    puts( "Receiving message ..." );
44
    status = rtems_message_queue_receive(
45
      Queue_id[ 1 ],
46
      (long (*)[4])receive_buffer,
47
      &size,
48
      RTEMS_DEFAULT_OPTIONS,
49
      RTEMS_NO_TIMEOUT
50
    );
51
    puts( "How did I get back from here????" );
52
    directive_failed( status, "rtems_message_queue_receive" );
53
  }
54
 
55
  status = rtems_task_wake_after( TICKS_PER_SECOND );
56
  directive_failed( status, "rtems_task_wake_after" );
57
 
58
  puts( "Receiving message ..." );
59
  status = rtems_message_queue_receive(
60
    Queue_id[ 1 ],
61
    (long (*)[4])receive_buffer,
62
    &size,
63
    RTEMS_DEFAULT_OPTIONS,
64
    2 * TICKS_PER_SECOND
65
  );
66
  fatal_directive_status(status, RTEMS_TIMEOUT, "rtems_message_queue_receive");
67
  puts( "rtems_message_queue_receive correctly returned RTEMS_TIMEOUT" );
68
 
69
  puts( "Deleting self" );
70
  status = rtems_task_delete( RTEMS_SELF );
71
  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
72
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.