1 | /* |
---|
2 | * Interrupt 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.rtems.com/license/LICENSE. |
---|
11 | * |
---|
12 | * $Id$ |
---|
13 | */ |
---|
14 | |
---|
15 | #if HAVE_CONFIG_H |
---|
16 | #include "config.h" |
---|
17 | #endif |
---|
18 | |
---|
19 | #include <rtems/system.h> |
---|
20 | #include <rtems/rtems/status.h> |
---|
21 | #include <rtems/score/isr.h> |
---|
22 | #include <rtems/rtems/intr.h> |
---|
23 | |
---|
24 | /* rtems_interrupt_catch |
---|
25 | * |
---|
26 | * This directive allows a thread to specify what action to take when |
---|
27 | * catching signals. |
---|
28 | * |
---|
29 | * Input parameters: |
---|
30 | * new_isr_handler - address of interrupt service routine (isr) |
---|
31 | * vector - interrupt vector number |
---|
32 | * old_isr_handler - address at which to store previous ISR address |
---|
33 | * |
---|
34 | * Output parameters: |
---|
35 | * RTEMS_SUCCESSFUL - always succeeds |
---|
36 | * *old_isr_handler - previous ISR address |
---|
37 | */ |
---|
38 | |
---|
39 | rtems_status_code rtems_interrupt_catch( |
---|
40 | rtems_isr_entry new_isr_handler, |
---|
41 | rtems_vector_number vector, |
---|
42 | rtems_isr_entry *old_isr_handler |
---|
43 | ) |
---|
44 | { |
---|
45 | if ( !_ISR_Is_vector_number_valid( vector ) ) |
---|
46 | return RTEMS_INVALID_NUMBER; |
---|
47 | |
---|
48 | if ( !_ISR_Is_valid_user_handler( (void *) new_isr_handler ) ) |
---|
49 | return RTEMS_INVALID_ADDRESS; |
---|
50 | |
---|
51 | if ( !_ISR_Is_valid_user_handler( (void *) old_isr_handler ) ) |
---|
52 | return RTEMS_INVALID_ADDRESS; |
---|
53 | |
---|
54 | _ISR_Install_vector( |
---|
55 | vector, (proc_ptr)new_isr_handler, (proc_ptr *)old_isr_handler ); |
---|
56 | |
---|
57 | return RTEMS_SUCCESSFUL; |
---|
58 | } |
---|