OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [rtems/] [src/] [signalsend.c] - Blame information for rev 593

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  Signal Manager
3
 *
4
 *
5
 *  COPYRIGHT (c) 1989-1999.
6
 *  On-Line Applications Research Corporation (OAR).
7
 *
8
 *  The license and distribution terms for this file may be
9
 *  found in the file LICENSE in this distribution or at
10
 *  http://www.OARcorp.com/rtems/license.html.
11
 *
12
 *  $Id: signalsend.c,v 1.2 2001-09-27 11:59:19 chris Exp $
13
 */
14
 
15
#include <rtems/system.h>
16
#include <rtems/rtems/status.h>
17
#include <rtems/rtems/asr.h>
18
#include <rtems/score/isr.h>
19
#include <rtems/rtems/modes.h>
20
#include <rtems/rtems/signal.h>
21
#include <rtems/score/thread.h>
22
#include <rtems/rtems/tasks.h>
23
 
24
/*PAGE
25
 *
26
 *  rtems_signal_send
27
 *
28
 *  This directive allows a thread to send signals to a thread.
29
 *
30
 *  Input parameters:
31
 *    id         - thread id
32
 *    signal_set - signal set
33
 *
34
 *  Output parameters:
35
 *    RTEMS_SUCCESSFUL - if successful
36
 *    error code - if unsuccessful
37
 */
38
 
39
rtems_status_code rtems_signal_send(
40
  Objects_Id             id,
41
  rtems_signal_set signal_set
42
)
43
{
44
  register Thread_Control *the_thread;
45
  Objects_Locations        location;
46
  RTEMS_API_Control       *api;
47
  ASR_Information         *asr;
48
 
49
  the_thread = _Thread_Get( id, &location );
50
  switch ( location ) {
51
 
52
    case OBJECTS_REMOTE:
53
#if defined(RTEMS_MULTIPROCESSING)
54
      return _Signal_MP_Send_request_packet(
55
        SIGNAL_MP_SEND_REQUEST,
56
        id,
57
        signal_set
58
      );
59
#endif
60
 
61
    case OBJECTS_ERROR:
62
      return RTEMS_INVALID_ID;
63
 
64
    case OBJECTS_LOCAL:
65
      api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
66
      asr = &api->Signal;
67
 
68
      if ( ! _ASR_Is_null_handler( asr->handler ) ) {
69
        if ( asr->is_enabled ) {
70
          _ASR_Post_signals( signal_set, &asr->signals_posted );
71
 
72
          the_thread->do_post_task_switch_extension = TRUE;
73
 
74
          if ( _ISR_Is_in_progress() && _Thread_Is_executing( the_thread ) )
75
            _ISR_Signals_to_thread_executing = TRUE;
76
        } else {
77
          _ASR_Post_signals( signal_set, &asr->signals_pending );
78
        }
79
        _Thread_Enable_dispatch();
80
        return RTEMS_SUCCESSFUL;
81
      }
82
      _Thread_Enable_dispatch();
83
      return RTEMS_NOT_DEFINED;
84
  }
85
 
86
  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
87
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.