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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [tests/] [libtests/] [rtems++/] [Task2.cc] - Blame information for rev 173

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.  Its only purpose is to generate the
4
 *  error where a semaphore is deleted while a task is waiting for it.
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.cc,v 1.2 2001-09-27 12:02:13 chris Exp $
19
 */
20
 
21
#include "System.h"
22
 
23
Task2::Task2(const char* name,
24
             const rtems_task_priority initial_priority,
25
             const rtems_unsigned32 stack_size)
26
  : rtemsTask(name, initial_priority, stack_size, RTEMS_NO_PREEMPT)
27
{
28
}
29
 
30
void Task2::body(rtems_task_argument )
31
{
32
  screen4();
33
 
34
  printf("%s - destroy itself\n", name_string());
35
  destroy();
36
}
37
 
38
void Task2::screen4()
39
{
40
  rtemsEvent event;
41
 
42
  // block waiting for any event
43
  rtems_event_set out;
44
 
45
  printf("%s - event no wait - ", name_string());
46
  event.receive(RTEMS_SIGNAL_0, out, 0, rtemsEvent::no_wait);
47
  printf("%s\n", event.last_status_string());
48
 
49
  printf("%s - event 5 secs timeout - ", name_string()); fflush(stdout);
50
  event.receive(RTEMS_SIGNAL_0, out, 5000000);
51
  printf("%s\n", event.last_status_string());
52
 
53
  // send using task id
54
  printf("%s - event wait forever for signal 0 from TA1 ....\n", name_string());
55
  event.receive(RTEMS_SIGNAL_0, out);
56
  printf("%s - %s, signals out are 0x%08X\n", name_string(), event.last_status_string(), out);
57
 
58
  // send using task object reference
59
  printf("%s - event wait forever for signal 0 from TA1 ....\n", name_string());
60
  event.receive(RTEMS_SIGNAL_0, out);
61
  printf("%s - %s, signals out are 0x%08X\n", name_string(), event.last_status_string(), out);
62
 
63
  printf("%s - event wait forever for signal 31 from TA1 ....\n", name_string());
64
  event.receive(RTEMS_SIGNAL_31, out);
65
  printf("%s - %s, signals out are 0x%08X\n", name_string(), event.last_status_string(), out);
66
 
67
  printf("%s - event wait forever for signal 0 and 31 from TA1 ....\n", name_string());
68
  event.receive(RTEMS_SIGNAL_0 | RTEMS_SIGNAL_31, out, 0, rtemsEvent::wait, rtemsEvent::all);
69
  printf("%s - %s, signals out are 0x%08X\n", name_string(), event.last_status_string(), out);
70
 
71
  printf("%s - send event signal 1 - ", name_string());
72
  event.send(RTEMS_SIGNAL_1);
73
  printf("%s\n", event.last_status_string());
74
 
75
  printf("%s - event wait forever for signal 1 from TA2 - ", name_string());
76
  event.receive(RTEMS_SIGNAL_1, out, 0, rtemsEvent::wait, rtemsEvent::all);
77
  printf("%s, signals out are 0x%08X\n", event.last_status_string(), out);
78
}
79
 
80
 

powered by: WebSVN 2.1.0

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