source: rtems/cpukit/rtems/src/signalmp.c @ a112364

4.115
Last change on this file since a112364 was a112364, checked in by Sebastian Huber <sebastian.huber@…>, on 07/24/13 at 15:30:26

score: Create threadq implementation header

Move implementation specific parts of tqdata.h, threadq.h and
threadq.inl into new header file threadqimpl.h. The threadq.h contains
now only the application visible API.

Delete tqdata.h.

  • Property mode set to 100644
File size: 3.9 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Signal MP Support
5 *  @ingroup ClassicSignalMP
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.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/system.h>
22#include <rtems/rtems/status.h>
23#include <rtems/score/mpci.h>
24#include <rtems/score/mppkt.h>
25#include <rtems/score/object.h>
26#include <rtems/rtems/options.h>
27#include <rtems/rtems/signal.h>
28#include <rtems/score/thread.h>
29#include <rtems/score/watchdog.h>
30#include <rtems/rtems/support.h>
31#include <rtems/score/statesimpl.h>
32#include <rtems/score/threadimpl.h>
33#include <rtems/score/threadqimpl.h>
34
35RTEMS_STATIC_ASSERT(
36  sizeof(Signal_MP_Packet) <= MP_PACKET_MINIMUM_PACKET_SIZE,
37  Signal_MP_Packet
38);
39
40/*
41 *  _Signal_MP_Send_process_packet
42 *
43 *  This subprogram is not needed since there are no process
44 *  packets to be sent by this manager.
45 *
46 */
47
48rtems_status_code _Signal_MP_Send_request_packet (
49  Signal_MP_Remote_operations operation,
50  Objects_Id                  task_id,
51  rtems_signal_set            signal_in
52)
53{
54  Signal_MP_Packet *the_packet;
55
56  switch ( operation ) {
57
58    case SIGNAL_MP_SEND_REQUEST:
59
60      the_packet                    = _Signal_MP_Get_packet();
61      the_packet->Prefix.the_class  = MP_PACKET_SIGNAL;
62      the_packet->Prefix.length     = sizeof ( Signal_MP_Packet );
63      the_packet->Prefix.to_convert = sizeof ( Signal_MP_Packet );
64      the_packet->operation         = operation;
65      the_packet->Prefix.id         = task_id;
66      the_packet->signal_in         = signal_in;
67
68      return _MPCI_Send_request_packet(
69        _Objects_Get_node( task_id ),
70        &the_packet->Prefix,
71        STATES_READY   /* Not used */
72      );
73      break;
74
75    case SIGNAL_MP_SEND_RESPONSE:
76      break;
77
78  }
79  /*
80   *  The following line is included to satisfy compilers which
81   *  produce warnings when a function does not end with a return.
82   */
83  return RTEMS_INTERNAL_ERROR;
84}
85
86void _Signal_MP_Send_response_packet (
87  Signal_MP_Remote_operations  operation,
88  Thread_Control              *the_thread
89)
90{
91  Signal_MP_Packet *the_packet;
92
93  switch ( operation ) {
94
95    case SIGNAL_MP_SEND_RESPONSE:
96
97      the_packet = ( Signal_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        _Objects_Get_node( the_packet->Prefix.source_tid ),
108        &the_packet->Prefix
109      );
110      break;
111
112    case SIGNAL_MP_SEND_REQUEST:
113      break;
114
115  }
116}
117
118void _Signal_MP_Process_packet (
119  rtems_packet_prefix  *the_packet_prefix
120)
121{
122  Signal_MP_Packet *the_packet;
123  Thread_Control   *the_thread;
124
125  the_packet = (Signal_MP_Packet *) the_packet_prefix;
126
127  switch ( the_packet->operation ) {
128
129    case SIGNAL_MP_SEND_REQUEST:
130
131      the_packet->Prefix.return_code = rtems_signal_send(
132        the_packet->Prefix.id,
133        the_packet->signal_in
134      );
135
136      _Signal_MP_Send_response_packet(
137        SIGNAL_MP_SEND_RESPONSE,
138        _Thread_Executing
139      );
140      break;
141
142    case SIGNAL_MP_SEND_RESPONSE:
143
144      the_thread = _MPCI_Process_response( the_packet_prefix );
145
146      _MPCI_Return_packet( the_packet_prefix );
147      break;
148
149  }
150}
151
152/*
153 *  _Signal_MP_Send_object_was_deleted
154 *
155 *  This subprogram is not needed since there are no objects
156 *  deleted by this manager.
157 *
158 */
159
160/*
161 *  _Signal_MP_Send_extract_proxy
162 *
163 *  This subprogram is not needed since there are no objects
164 *  deleted by this manager.
165 *
166 */
167
168Signal_MP_Packet *_Signal_MP_Get_packet ( void )
169{
170  return ( (Signal_MP_Packet *) _MPCI_Get_packet() );
171}
172
173/* end of file */
Note: See TracBrowser for help on using the repository browser.