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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [tests/] [mptests/] [mp07/] [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_task
2
 *
3
 *  This task continuously sends an event to its counterpart on the
4
 *  other node, and then waits for it to send an event.  The copy
5
 *  running on node one send the first event.
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:19 chris Exp $
20
 */
21
 
22
#include "system.h"
23
 
24
#define DOT_COUNT 100
25
 
26
rtems_timer_service_routine Stop_Test_TSR(
27
  rtems_id  ignored_id,
28
  void     *ignored_address
29
)
30
{
31
  Stop_Test = TRUE;
32
}
33
 
34
rtems_task Test_task(
35
  rtems_task_argument argument
36
)
37
{
38
  rtems_status_code status;
39
  rtems_unsigned32  count;
40
  rtems_unsigned32  remote_node;
41
  rtems_id          remote_tid;
42
  rtems_event_set   event_out;
43
 
44
  Stop_Test = FALSE;
45
 
46
  remote_node = (Multiprocessing_configuration.node == 1) ? 2 : 1;
47
  puts_nocr( "Remote task's name is : " );
48
  put_name( Task_name[ remote_node ], TRUE );
49
 
50
  puts( "Getting TID of remote task" );
51
  do {
52
    status = rtems_task_ident(
53
      Task_name[ remote_node ],
54
      RTEMS_SEARCH_ALL_NODES,
55
      &remote_tid
56
    );
57
  } while ( !rtems_is_status_successful( status ) );
58
 
59
  if ( Multiprocessing_configuration.node == 1 ) {
60
    puts( "Sending first event to remote task" );
61
    status = rtems_event_send( remote_tid, RTEMS_EVENT_16 );
62
    directive_failed( status, "rtems_event_send" );
63
  }
64
 
65
  status = rtems_timer_fire_after(
66
    Timer_id[ 1 ],
67
    5 * TICKS_PER_SECOND,
68
    Stop_Test_TSR,
69
    NULL
70
  );
71
  directive_failed( status, "rtems_timer_fire_after" );
72
 
73
  while ( Stop_Test == FALSE ) {
74
    for ( count=DOT_COUNT ; count && (Stop_Test == FALSE) ; count-- ) {
75
      status = rtems_event_receive(
76
        RTEMS_EVENT_16,
77
        RTEMS_DEFAULT_OPTIONS,
78
        RTEMS_NO_TIMEOUT,
79
        &event_out
80
      );
81
      if ( status == RTEMS_TIMEOUT ) {
82
        puts( "\nTA1 - RTEMS_TIMEOUT .. probably OK if the other node exits" );
83
        break;
84
      } else
85
        directive_failed( status, "rtems_event_receive" );
86
 
87
      status = rtems_event_send( remote_tid, RTEMS_EVENT_16 );
88
      directive_failed( status, "rtems_event_send" );
89
    }
90
    put_dot('.');
91
  }
92
 
93
  /*
94
   * Wait a bit before shutting down so we don't screw up the other node
95
   * when our MPCI shuts down
96
   */
97
 
98
  rtems_task_wake_after(10);
99
 
100
  puts( "\n*** END OF TEST 7 ***" );
101
  exit( 0 );
102
}

powered by: WebSVN 2.1.0

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