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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [rtems/] [src/] [signalcatch.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: signalcatch.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_catch
27
 *
28
 *  This directive allows a thread to specify what action to take when
29
 *  catching signals.
30
 *
31
 *  Input parameters:
32
 *    handler  - address of asynchronous signal routine (asr)
33
 *              ( NULL indicates asr is invalid )
34
 *    mode_set - mode value for asr
35
 *
36
 *  Output parameters:
37
 *    RTEMS_SUCCESSFUL - always succeeds
38
 */
39
 
40
rtems_status_code rtems_signal_catch(
41
  rtems_asr_entry   asr_handler,
42
  rtems_mode        mode_set
43
)
44
{
45
  Thread_Control     *executing;
46
  RTEMS_API_Control  *api;
47
  ASR_Information    *asr;
48
 
49
/* XXX normalize mode */
50
  executing = _Thread_Executing;
51
  api = executing->API_Extensions[ THREAD_API_RTEMS ];
52
  asr = &api->Signal;
53
 
54
  _Thread_Disable_dispatch(); /* cannot reschedule while */
55
                              /*   the thread is inconsistent */
56
 
57
  if ( !_ASR_Is_null_handler( asr_handler ) ) {
58
    asr->mode_set = mode_set;
59
    asr->handler = asr_handler;
60
  }
61
  else
62
    _ASR_Initialize( asr );
63
  _Thread_Enable_dispatch();
64
  return RTEMS_SUCCESSFUL;
65
}

powered by: WebSVN 2.1.0

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