[c9973bb] | 1 | /* |
---|
| 2 | * Interrupt Manager |
---|
| 3 | * |
---|
| 4 | * |
---|
| 5 | * COPYRIGHT (c) 1989-1998. |
---|
| 6 | * On-Line Applications Research Corporation (OAR). |
---|
| 7 | * Copyright assigned to U.S. Government, 1994. |
---|
| 8 | * |
---|
| 9 | * The license and distribution terms for this file may be |
---|
| 10 | * found in the file LICENSE in this distribution or at |
---|
| 11 | * http://www.OARcorp.com/rtems/license.html. |
---|
| 12 | * |
---|
| 13 | * $Id$ |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | #include <rtems/system.h> |
---|
| 17 | #include <rtems/rtems/status.h> |
---|
| 18 | #include <rtems/score/isr.h> |
---|
| 19 | #include <rtems/rtems/intr.h> |
---|
| 20 | |
---|
| 21 | /* rtems_interrupt_catch |
---|
| 22 | * |
---|
| 23 | * This directive allows a thread to specify what action to take when |
---|
| 24 | * catching signals. |
---|
| 25 | * |
---|
| 26 | * Input parameters: |
---|
| 27 | * new_isr_handler - address of interrupt service routine (isr) |
---|
| 28 | * vector - interrupt vector number |
---|
| 29 | * old_isr_handler - address at which to store previous ISR address |
---|
| 30 | * |
---|
| 31 | * Output parameters: |
---|
| 32 | * RTEMS_SUCCESSFUL - always succeeds |
---|
| 33 | * *old_isr_handler - previous ISR address |
---|
| 34 | */ |
---|
| 35 | |
---|
| 36 | rtems_status_code rtems_interrupt_catch( |
---|
| 37 | rtems_isr_entry new_isr_handler, |
---|
| 38 | rtems_vector_number vector, |
---|
| 39 | rtems_isr_entry *old_isr_handler |
---|
| 40 | ) |
---|
| 41 | { |
---|
| 42 | if ( !_ISR_Is_vector_number_valid( vector ) ) |
---|
| 43 | return RTEMS_INVALID_NUMBER; |
---|
| 44 | |
---|
| 45 | if ( !_ISR_Is_valid_user_handler( (void *) new_isr_handler ) ) |
---|
| 46 | return RTEMS_INVALID_ADDRESS; |
---|
| 47 | |
---|
| 48 | if ( !_ISR_Is_valid_user_handler( (void *) old_isr_handler ) ) |
---|
| 49 | return RTEMS_INVALID_ADDRESS; |
---|
| 50 | |
---|
| 51 | _ISR_Install_vector( |
---|
| 52 | vector, (proc_ptr)new_isr_handler, (proc_ptr *)old_isr_handler ); |
---|
| 53 | |
---|
| 54 | return RTEMS_SUCCESSFUL; |
---|
| 55 | } |
---|