OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

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

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

Line No. Rev Author Line
1 30 unneback
/*  Task_2
2
 *
3
 *  This routine serves as a test task.  Multiple tasks are required to
4
 *  verify all message manager capabilities.
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: task2.c,v 1.2 2001-09-27 12:02:32 chris Exp $
19
 */
20
 
21
#include "system.h"
22
 
23
#define MESSAGE_SIZE (sizeof(long) * 4)
24
 
25
rtems_task Task_2(
26
  rtems_task_argument argument
27
)
28
{
29
  long                buffer[ 4 ];
30
  rtems_unsigned32    size;
31
  rtems_task_priority previous_priority;
32
  rtems_status_code   status;
33
 
34
  puts(
35
    "TA2 - rtems_message_queue_receive - receive from queue 1 - RTEMS_NO_WAIT"
36
  );
37
  status = rtems_message_queue_receive(
38
    Queue_id[ 1 ],
39
    buffer,
40
    &size,
41
    RTEMS_NO_WAIT,
42
    RTEMS_NO_TIMEOUT
43
  );
44
  directive_failed( status, "rtems_message_queue_receive" );
45
  puts_nocr( "TA2 - buffer received: " );
46
  Put_buffer( buffer );
47
  new_line;
48
 
49
  puts(
50
    "TA2 - rtems_message_queue_receive - receive from queue 1 - "
51
      "RTEMS_WAIT FOREVER"
52
  );
53
  status = rtems_message_queue_receive(
54
    Queue_id[ 1 ],
55
    buffer,
56
    &size,
57
    RTEMS_DEFAULT_OPTIONS,
58
    RTEMS_NO_TIMEOUT
59
  );
60
  directive_failed( status, "rtems_message_queue_receive" );
61
  puts_nocr( "TA2 - buffer received: " );
62
  Put_buffer( buffer );
63
  new_line;
64
 
65
  puts(
66
    "TA2 - rtems_message_queue_receive - receive from queue 1 - "
67
      "RTEMS_WAIT FOREVER"
68
 );
69
  status = rtems_message_queue_receive(
70
    Queue_id[ 1 ],
71
    buffer,
72
    &size,
73
    RTEMS_DEFAULT_OPTIONS,
74
    RTEMS_NO_TIMEOUT
75
  );
76
  directive_failed( status, "rtems_message_queue_receive" );
77
  puts_nocr( "TA2 - buffer received: " );
78
  Put_buffer( buffer );
79
  new_line;
80
 
81
  puts( "TA2 - rtems_task_set_priority - make self highest priority task" );
82
  status = rtems_task_set_priority( RTEMS_SELF, 3, &previous_priority );
83
  directive_failed( status, "rtems_task_set_priority" );
84
 
85
  puts(
86
    "TA2 - rtems_message_queue_receive - receive from queue 2 - "
87
      "RTEMS_WAIT FOREVER"
88
  );
89
  status = rtems_message_queue_receive(
90
    Queue_id[ 2 ],
91
    buffer,
92
    &size,
93
    RTEMS_DEFAULT_OPTIONS,
94
    RTEMS_NO_TIMEOUT
95
  );
96
  directive_failed( status, "rtems_message_queue_receive" );
97
  puts_nocr( "TA2 - buffer received: " );
98
  Put_buffer( buffer );
99
  new_line;
100
 
101
  Fill_buffer( "BUFFER 2 TO Q 2", (long *)buffer );
102
  puts( "TA2 - rtems_message_queue_send - BUFFER 2 TO Q 2" );
103
  directive_failed( status, "rtems_message_queue_send" );
104
 
105
  status = rtems_message_queue_send( Queue_id[ 2 ], buffer, MESSAGE_SIZE );
106
  directive_failed( status, "rtems_message_queue_send" );
107
 
108
  puts(
109
    "TA2 - rtems_message_queue_receive - receive from queue 1 - "
110
      "10 second timeout"
111
  );
112
  status = rtems_message_queue_receive(
113
    Queue_id[ 1 ],
114
    buffer,
115
    &size,
116
    RTEMS_DEFAULT_OPTIONS,
117
    10 * TICKS_PER_SECOND
118
  );
119
  directive_failed( status, "rtems_message_queue_receive" );
120
  puts_nocr( "TA2 - buffer received: " );
121
  Put_buffer( buffer );
122
  new_line;
123
 
124
  puts(
125
    "TA2 - rtems_message_queue_receive - receive from queue 3 - "
126
      "RTEMS_WAIT FOREVER"
127
  );
128
  status = rtems_message_queue_receive(
129
    Queue_id[ 3 ],
130
    buffer,
131
    &size,
132
    RTEMS_DEFAULT_OPTIONS,
133
    RTEMS_NO_TIMEOUT
134
  );
135
  directive_failed( status, "rtems_message_queue_receive" );
136
  puts_nocr( "TA2 - buffer received: " );
137
  Put_buffer( buffer );
138
  new_line;
139
 
140
}

powered by: WebSVN 2.1.0

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