source: rtems/cpukit/rtems/src/eventmp.c @ 7d5566e

4.104.114.84.95
Last change on this file since 7d5566e was 03f2154e, checked in by Joel Sherrill <joel.sherrill@…>, on 04/22/97 at 17:20:27

headers updated to reflect new style copyright notice as part
of switching to the modified GNU GPL.

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