source: rtems/c/src/exec/rtems/src/signal.c @ b3ac6a8d

4.104.114.84.95
Last change on this file since b3ac6a8d was 3a4ae6c, checked in by Joel Sherrill <joel.sherrill@…>, on 09/11/95 at 19:35:39

The word "RTEMS" almost completely removed from the core.

Configuration Table Template file added and all tests
modified to use this. All gvar.h and conftbl.h files
removed from test directories.

Configuration parameter maximum_devices added.

Core semaphore and mutex handlers added and RTEMS API Semaphore
Manager updated to reflect this.

Initialization sequence changed to invoke API specific initialization
routines. Initialization tasks table now owned by RTEMS Tasks Manager.

Added user extension for post-switch.

Utilized user extensions to implement API specific functionality
like signal dispatching.

Added extensions to the System Initialization Thread so that an
API can register a function to be invoked while the system
is being initialized. These are largely equivalent to the
pre-driver and post-driver hooks.

Added the Modules file oar-go32_p5, modified oar-go32, and modified
the file make/custom/go32.cfg to look at an environment varable which
determines what CPU model is being used.

All BSPs updated to reflect named devices and clock driver's IOCTL
used by the Shared Memory Driver. Also merged clock isr into
main file and removed ckisr.c where possible.

Updated spsize to reflect new and moved variables.

Makefiles for the executive source and include files updated to show
break down of files into Core, RTEMS API, and Neither.

Header and inline files installed into subdirectory based on whether
logically in the Core or a part of the RTEMS API.

  • Property mode set to 100644
File size: 3.5 KB
Line 
1/*
2 *  Signal Manager
3 *
4 *
5 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
6 *  On-Line Applications Research Corporation (OAR).
7 *  All rights assigned to U.S. Government, 1994.
8 *
9 *  This material may be reproduced by or for the U.S. Government pursuant
10 *  to the copyright license under the clause at DFARS 252.227-7013.  This
11 *  notice must appear in all copies of this file and its derivatives.
12 *
13 *  $Id$
14 */
15
16#include <rtems/system.h>
17#include <rtems/rtems/status.h>
18#include <rtems/rtems/asr.h>
19#include <rtems/core/isr.h>
20#include <rtems/rtems/modes.h>
21#include <rtems/rtems/signal.h>
22#include <rtems/core/thread.h>
23#include <rtems/rtems/tasks.h>
24
25/*PAGE
26 *
27 *  _Signal_Manager_initialization
28 *
29 *  This routine initializes all signal manager related data structures.
30 *
31 *  Input parameters:   NONE
32 *
33 *  Output parameters:  NONE
34 */
35 
36void _Signal_Manager_initialization( void )
37{
38  /*
39   *  Register the MP Process Packet routine.
40   */
41 
42  _MPCI_Register_packet_processor(
43    MP_PACKET_SIGNAL,
44    _Signal_MP_Process_packet
45  );
46}
47 
48/*PAGE
49 *
50 *  rtems_signal_catch
51 *
52 *  This directive allows a thread to specify what action to take when
53 *  catching signals.
54 *
55 *  Input parameters:
56 *    handler  - address of asynchronous signal routine (asr)
57 *              ( NULL indicates asr is invalid )
58 *    mode_set - mode value for asr
59 *
60 *  Output parameters:
61 *    RTEMS_SUCCESSFUL - always succeeds
62 */
63
64rtems_status_code rtems_signal_catch(
65  rtems_asr_entry   asr_handler,
66  rtems_mode        mode_set
67)
68{
69  Thread_Control     *executing;
70  RTEMS_API_Control  *api;
71  ASR_Information    *asr;
72
73/* XXX normalize mode */
74  executing = _Thread_Executing;
75  api = executing->API_Extensions[ THREAD_API_RTEMS ];
76  asr = &api->Signal;
77
78  _Thread_Disable_dispatch(); /* cannot reschedule while */
79                              /*   the thread is inconsistent */
80
81  if ( !_ASR_Is_null_handler( asr_handler ) ) {
82    asr->mode_set = mode_set;
83    asr->handler = asr_handler;
84  }
85  else
86    _ASR_Initialize( asr );
87  _Thread_Enable_dispatch();
88  return RTEMS_SUCCESSFUL;
89}
90
91/*PAGE
92 *
93 *  rtems_signal_send
94 *
95 *  This directive allows a thread to send signals to a thread.
96 *
97 *  Input parameters:
98 *    id         - thread id
99 *    signal_set - signal set
100 *
101 *  Output parameters:
102 *    RTEMS_SUCCESSFUL - if successful
103 *    error code - if unsuccessful
104 */
105
106rtems_status_code rtems_signal_send(
107  Objects_Id             id,
108  rtems_signal_set signal_set
109)
110{
111  register Thread_Control *the_thread;
112  Objects_Locations        location;
113  RTEMS_API_Control       *api;
114  ASR_Information         *asr;
115
116  the_thread = _Thread_Get( id, &location );
117  switch ( location ) {
118    case OBJECTS_ERROR:
119      return RTEMS_INVALID_ID;
120    case OBJECTS_REMOTE:
121      return _Signal_MP_Send_request_packet(
122        SIGNAL_MP_SEND_REQUEST,
123        id,
124        signal_set
125      );
126    case OBJECTS_LOCAL:
127      api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
128      asr = &api->Signal;
129
130      if ( ! _ASR_Is_null_handler( asr->handler ) ) {
131        if ( asr->is_enabled ) {
132          _ASR_Post_signals( signal_set, &asr->signals_posted );
133          if ( _ISR_Is_in_progress() && _Thread_Is_executing( the_thread ) )
134            _ISR_Signals_to_thread_executing = TRUE;
135        } else {
136          _ASR_Post_signals( signal_set, &asr->signals_pending );
137        }
138        _Thread_Enable_dispatch();
139        return RTEMS_SUCCESSFUL;
140      }
141      _Thread_Enable_dispatch();
142      return RTEMS_NOT_DEFINED;
143  }
144
145  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
146}
Note: See TracBrowser for help on using the repository browser.