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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [tests/] [sptests/] [sp13/] [task3.c] - Blame information for rev 587

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

Line No. Rev Author Line
1 30 unneback
/*  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-1999.
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.OARcorp.com/rtems/license.html.
17
 *
18
 *  $Id: task3.c,v 1.2 2001-09-27 12:02:32 chris Exp $
19
 */
20
 
21
#include "system.h"
22
 
23
rtems_task Task_3(
24
  rtems_task_argument argument
25
)
26
{
27
  long              buffer[ 4 ];
28
  rtems_unsigned32  size;
29
  rtems_unsigned32  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
}

powered by: WebSVN 2.1.0

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