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

Subversion Repositories openrisc

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

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 capabilities of the event manager.
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
rtems_task Task_2(
24
  rtems_task_argument argument
25
)
26
{
27
  rtems_event_set   eventout;
28
  rtems_time_of_day time;
29
  rtems_status_code status;
30
 
31
  status = rtems_task_wake_after( 1*TICKS_PER_SECOND );
32
  directive_failed( status, "rtems_task_wake_after" );
33
 
34
  puts( "TA2 - rtems_event_receive - waiting forever on RTEMS_EVENT_16" );
35
  status = rtems_event_receive(
36
    RTEMS_EVENT_16,
37
    RTEMS_DEFAULT_OPTIONS,
38
    RTEMS_NO_TIMEOUT,
39
    &eventout
40
  );
41
  directive_failed( status, "rtems_event_receive" );
42
  printf( "TA2 - RTEMS_EVENT_16 received - eventout => %08x\n", eventout );
43
 
44
  puts(
45
    "TA2 - rtems_event_send - send RTEMS_EVENT_14 and RTEMS_EVENT_15 to TA1"
46
  );
47
  status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_14 | RTEMS_EVENT_15 );
48
  directive_failed( status, "rtems_event_send" );
49
 
50
  puts(
51
    "TA2 - rtems_event_receive - RTEMS_EVENT_17 or "
52
      "RTEMS_EVENT_18 - forever and ANY"
53
  );
54
  status = rtems_event_receive(
55
    RTEMS_EVENT_17 | RTEMS_EVENT_18,
56
    RTEMS_EVENT_ANY,
57
    RTEMS_NO_TIMEOUT,
58
    &eventout
59
  );
60
  directive_failed( status, "rtems_event_receive" );
61
  printf(
62
    "TA2 - RTEMS_EVENT_17 or RTEMS_EVENT_18 received - eventout => %08x\n",
63
    eventout
64
  );
65
 
66
  puts( "TA2 - rtems_event_send - send RTEMS_EVENT_14 to TA1" );
67
  status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_14 );
68
  directive_failed( status, "rtems_event_send" );
69
 
70
  build_time( &time, 2, 12, 1988, 8, 15, 0, 0 );
71
  print_time( "TA2 - rtems_clock_set - ", &time, "\n" );
72
  status = rtems_clock_set( &time );
73
  directive_failed( status, "TA2 rtems_clock_set" );
74
 
75
  time.second += 4;
76
  puts(
77
    "TA2 - rtems_event_send - sending RTEMS_EVENT_10 to self after 4 seconds"
78
  );
79
  status = rtems_timer_fire_when(
80
    Timer_id[ 5 ],
81
    &time,
82
    TA2_send_10_to_self,
83
    NULL
84
  );
85
  directive_failed( status, "rtems_timer_fire_when after 4 seconds" );
86
 
87
  puts( "TA2 - rtems_event_receive - waiting forever on RTEMS_EVENT_10" );
88
  status = rtems_event_receive(
89
    RTEMS_EVENT_10,
90
    RTEMS_DEFAULT_OPTIONS,
91
    RTEMS_NO_TIMEOUT,
92
    &eventout
93
  );
94
  directive_failed( status, "rtems_event_receive" );
95
 
96
  status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
97
  directive_failed( status, "rtems_clock_get" );
98
 
99
  printf( "TA2 - RTEMS_EVENT_10 received - eventout => %08x\n", eventout );
100
  print_time( "TA2 - rtems_clock_get - ", &time, "\n" );
101
 
102
  puts( "TA2 - rtems_event_receive - RTEMS_PENDING_EVENTS" );
103
  status = rtems_event_receive(
104
    RTEMS_PENDING_EVENTS,
105
    RTEMS_DEFAULT_OPTIONS,
106
    RTEMS_NO_TIMEOUT,
107
    &eventout
108
  );
109
  directive_failed( status, "rtems_event_receive" );
110
  printf( "TA2 - eventout => %08x\n", eventout );
111
 
112
  puts( "TA2 - rtems_event_receive - RTEMS_EVENT_19 - RTEMS_NO_WAIT" );
113
  status = rtems_event_receive(
114
    RTEMS_EVENT_19,
115
    RTEMS_NO_WAIT,
116
    RTEMS_NO_TIMEOUT,
117
    &eventout
118
  );
119
  directive_failed( status, "rtems_event_receive" );
120
  printf( "TA2 - RTEMS_EVENT_19 received - eventout => %08x\n", eventout );
121
 
122
  puts( "TA2 - rtems_task_delete - deletes self" );
123
  status = rtems_task_delete( Task_id[ 2 ] );
124
  directive_failed( status, "rtems_task_delete of TA2" );
125
}

powered by: WebSVN 2.1.0

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