source: rtems/cpukit/rtems/src/intr.c @ ea9d7db

4.104.114.84.95
Last change on this file since ea9d7db was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/95 at 17:39:37

Initial revision

  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
2 *  Interrupt 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/isr.h>
18#include <rtems/stack.h>
19#include <rtems/intr.h>
20#include <rtems/wkspace.h>
21
22/*  _Interrupt_Manager_initialization
23 *
24 *  This routine initializes the interrupt manager.
25 *
26 *  Input parameters: NONE
27 *
28 *  Output parameters: NONE
29 */
30
31void _Interrupt_Manager_initialization( void )
32{
33#if ( CPU_ALLOCATE_INTERRUPT_STACK == TRUE )
34
35  if ( _CPU_Table.interrupt_stack_size < RTEMS_MINIMUM_STACK_SIZE )
36    rtems_fatal_error_occurred( RTEMS_INVALID_SIZE );
37
38  _CPU_Interrupt_stack_low =
39    _Workspace_Allocate_or_fatal_error( _CPU_Table.interrupt_stack_size );
40
41  _CPU_Interrupt_stack_high = _Addresses_Add_offset(
42    _CPU_Interrupt_stack_low,
43    _CPU_Table.interrupt_stack_size
44  );
45
46#endif
47
48#if ( CPU_HAS_HARDWARE_INTERRUPT_STACK == TRUE )
49  _CPU_Install_interrupt_stack();
50#endif
51
52}
53
54/*  rtems_interrupt_catch
55 *
56 *  This directive allows a thread to specify what action to take when
57 *  catching signals.
58 *
59 *  Input parameters:
60 *    new_isr_handler - address of interrupt service routine (isr)
61 *    vector          - interrupt vector number
62 *    old_isr_handler - address at which to store previous ISR address
63 *
64 *  Output parameters:
65 *    RTEMS_SUCCESSFUL - always succeeds
66 *    *old_isr_handler  - previous ISR address
67 */
68
69rtems_status_code rtems_interrupt_catch(
70  rtems_isr_entry      new_isr_handler,
71  rtems_vector_number  vector,
72  rtems_isr_entry     *old_isr_handler
73)
74{
75  if ( !_ISR_Is_vector_number_valid( vector ) )
76    return( RTEMS_INVALID_NUMBER );
77
78  if ( !_ISR_Is_valid_user_handler( new_isr_handler ) )
79    return( RTEMS_INVALID_ADDRESS );
80
81  _ISR_Install_vector(
82    vector, (proc_ptr)new_isr_handler, (proc_ptr *)old_isr_handler );
83
84  return( RTEMS_SUCCESSFUL );
85}
Note: See TracBrowser for help on using the repository browser.