source: rtems/cpukit/rtems/src/eventmp.c @ e38a92b

5
Last change on this file since e38a92b was e38a92b, checked in by Sebastian Huber <sebastian.huber@…>, on 05/02/16 at 04:30:49

mpci: Make _*_MP_Get_packet() static

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