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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems/] [c/] [src/] [exec/] [rtems/] [src/] [eventmp.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 158 chris
/*
2
 *  Multiprocessing Support for the Event Manager
3
 *
4
 *  COPYRIGHT (c) 1989-1999.
5
 *  On-Line Applications Research Corporation (OAR).
6
 *
7
 *  The license and distribution terms for this file may be
8
 *  found in the file LICENSE in this distribution or at
9
 *  http://www.OARcorp.com/rtems/license.html.
10
 *
11 208 chris
 *  $Id: eventmp.c,v 1.2 2001-09-27 11:59:19 chris Exp $
12 158 chris
 */
13
 
14
#include <rtems/system.h>
15
#include <rtems/rtems/status.h>
16
#include <rtems/rtems/event.h>
17
#include <rtems/score/mpci.h>
18
#include <rtems/score/mppkt.h>
19
#include <rtems/score/object.h>
20
#include <rtems/rtems/options.h>
21
#include <rtems/score/states.h>
22
#include <rtems/score/thread.h>
23
#include <rtems/rtems/support.h>
24
 
25
/*PAGE
26
 *
27
 *  _Event_MP_Send_process_packet
28
 *
29
 *  This subprogram is not needed since there are no process
30
 *  packets to be sent by this manager.
31
 *
32
 */
33
 
34
/*PAGE
35
 *
36
 *  _Event_MP_Send_request_packet
37
 *
38
 */
39
 
40
rtems_status_code _Event_MP_Send_request_packet (
41
  Event_MP_Remote_operations operation,
42
  Objects_Id                 event_id,
43
  rtems_event_set         event_in
44
)
45
{
46
  Event_MP_Packet *the_packet;
47
 
48
  switch ( operation ) {
49
 
50
    case EVENT_MP_SEND_REQUEST:
51
 
52
      the_packet                    = _Event_MP_Get_packet();
53
      the_packet->Prefix.the_class  = MP_PACKET_EVENT;
54
      the_packet->Prefix.length     = sizeof ( Event_MP_Packet );
55
      the_packet->Prefix.to_convert = sizeof ( Event_MP_Packet );
56
      the_packet->operation         = operation;
57
      the_packet->Prefix.id         = event_id;
58
      the_packet->event_in          = event_in;
59
 
60
      return (rtems_status_code)
61
        _MPCI_Send_request_packet(
62
          rtems_get_node( event_id ),
63
          &the_packet->Prefix,
64
          STATES_READY
65
        );
66
 
67
      break;
68
 
69
    case EVENT_MP_SEND_RESPONSE:
70
      break;
71
 
72
  }
73
  /*
74
   *  The following line is included to satisfy compilers which
75
   *  produce warnings when a function does not end with a return.
76
   */
77
  return RTEMS_SUCCESSFUL;
78
}
79
 
80
/*PAGE
81
 *
82
 *  _Event_MP_Send_response_packet
83
 *
84
 */
85
 
86
void _Event_MP_Send_response_packet (
87
  Event_MP_Remote_operations  operation,
88
  Thread_Control             *the_thread
89
)
90
{
91
  Event_MP_Packet *the_packet;
92
 
93
  switch ( operation ) {
94
 
95
    case EVENT_MP_SEND_RESPONSE:
96
 
97
      the_packet = ( Event_MP_Packet *) the_thread->receive_packet;
98
 
99
/*
100
 *  The packet being returned already contains the class, length, and
101
 *  to_convert fields, therefore they are not set in this routine.
102
 */
103
      the_packet->operation = operation;
104
      the_packet->Prefix.id = the_packet->Prefix.source_tid;
105
 
106
      _MPCI_Send_response_packet(
107
        rtems_get_node( the_packet->Prefix.source_tid ),
108
        &the_packet->Prefix
109
      );
110
      break;
111
 
112
    case EVENT_MP_SEND_REQUEST:
113
      break;
114
 
115
  }
116
}
117
 
118
/*PAGE
119
 *
120
 *
121
 *  _Event_MP_Process_packet
122
 *
123
 */
124
 
125
void _Event_MP_Process_packet (
126
  rtems_packet_prefix  *the_packet_prefix
127
)
128
{
129
  Event_MP_Packet *the_packet;
130
  Thread_Control  *the_thread;
131
 
132
  the_packet = (Event_MP_Packet *) the_packet_prefix;
133
 
134
  switch ( the_packet->operation ) {
135
 
136
    case EVENT_MP_SEND_REQUEST:
137
 
138
      the_packet->Prefix.return_code = rtems_event_send(
139
        the_packet->Prefix.id,
140
        the_packet->event_in
141
      );
142
 
143
      _Event_MP_Send_response_packet(
144
        EVENT_MP_SEND_RESPONSE,
145
        _Thread_Executing
146
      );
147
      break;
148
 
149
    case EVENT_MP_SEND_RESPONSE:
150
 
151
      the_thread = _MPCI_Process_response( the_packet_prefix );
152
 
153
      _MPCI_Return_packet( the_packet_prefix );
154
 
155
      break;
156
 
157
  }
158
}
159
 
160
/*PAGE
161
 *
162
 *  _Event_MP_Send_object_was_deleted
163
 *
164
 *  This subprogram is not needed since there are no objects
165
 *  deleted by this manager.
166
 *
167
 */
168
 
169
/*PAGE
170
 *
171
 *  _Event_MP_Send_extract_proxy
172
 *
173
 *  This subprogram is not needed since there are no objects
174
 *  deleted by this manager.
175
 *
176
 */
177
 
178
/*PAGE
179
 *
180
 *  _Event_MP_Get_packet
181
 *
182
 */
183
 
184
Event_MP_Packet *_Event_MP_Get_packet ( void )
185
{
186
  return ( (Event_MP_Packet *) _MPCI_Get_packet() );
187
}
188
 
189
/* end of file */

powered by: WebSVN 2.1.0

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