1 | /* set_vector |
---|
2 | * |
---|
3 | * This routine installs an interrupt vector on the SPARC simulator. |
---|
4 | * |
---|
5 | * INPUT PARAMETERS: |
---|
6 | * handler - interrupt handler entry point |
---|
7 | * vector - vector number |
---|
8 | * type - 0 indicates raw hardware connect |
---|
9 | * 1 indicates RTEMS interrupt connect |
---|
10 | * |
---|
11 | * OUTPUT PARAMETERS: NONE |
---|
12 | * |
---|
13 | * RETURNS: |
---|
14 | * address of previous interrupt handler |
---|
15 | * |
---|
16 | * COPYRIGHT (c) 1989-1998. |
---|
17 | * On-Line Applications Research Corporation (OAR). |
---|
18 | * Copyright assigned to U.S. Government, 1994. |
---|
19 | * |
---|
20 | * The license and distribution terms for this file may be |
---|
21 | * found in the file LICENSE in this distribution or at |
---|
22 | * http://www.OARcorp.com/rtems/license.html. |
---|
23 | * |
---|
24 | * Ported to ERC32 implementation of the SPARC by On-Line Applications |
---|
25 | * Research Corporation (OAR) under contract to the European Space |
---|
26 | * Agency (ESA). |
---|
27 | * |
---|
28 | * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995. |
---|
29 | * European Space Agency. |
---|
30 | * |
---|
31 | * $Id$ |
---|
32 | */ |
---|
33 | |
---|
34 | #include <bsp.h> |
---|
35 | |
---|
36 | rtems_isr_entry set_vector( /* returns old vector */ |
---|
37 | rtems_isr_entry handler, /* isr routine */ |
---|
38 | rtems_vector_number vector, /* vector number */ |
---|
39 | int type /* RTEMS or RAW intr */ |
---|
40 | ) |
---|
41 | { |
---|
42 | rtems_isr_entry previous_isr; |
---|
43 | unsigned32 real_trap; |
---|
44 | unsigned32 source; |
---|
45 | |
---|
46 | if ( type ) |
---|
47 | rtems_interrupt_catch( handler, vector, &previous_isr ); |
---|
48 | else |
---|
49 | _CPU_ISR_install_raw_handler( vector, handler, (void *)&previous_isr ); |
---|
50 | |
---|
51 | real_trap = SPARC_REAL_TRAP_NUMBER( vector ); |
---|
52 | |
---|
53 | if ( ERC32_Is_MEC_Trap( real_trap ) ) { |
---|
54 | |
---|
55 | source = ERC32_TRAP_SOURCE( real_trap ); |
---|
56 | |
---|
57 | ERC32_Clear_interrupt( source ); |
---|
58 | ERC32_Unmask_interrupt( source ); |
---|
59 | } |
---|
60 | |
---|
61 | return previous_isr; |
---|
62 | } |
---|
63 | |
---|