source: rtems/cpukit/rtems/src/eventmp.c @ 4f90134

4.104.114.84.95
Last change on this file since 4f90134 was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/95 at 17:39:37

Initial revision

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