1 | /* |
---|
2 | * ISR Handler |
---|
3 | * |
---|
4 | * |
---|
5 | * COPYRIGHT (c) 1989-2008. |
---|
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/score/isr.h> |
---|
21 | #include <rtems/score/stack.h> |
---|
22 | #include <rtems/score/interr.h> |
---|
23 | #include <rtems/score/wkspace.h> |
---|
24 | #include <rtems/config.h> |
---|
25 | |
---|
26 | /* _ISR_Handler_initialization |
---|
27 | * |
---|
28 | * This routine initializes the ISR handler. |
---|
29 | * |
---|
30 | * Input parameters: NONE |
---|
31 | * |
---|
32 | * Output parameters: NONE |
---|
33 | */ |
---|
34 | |
---|
35 | void _ISR_Handler_initialization( void ) |
---|
36 | { |
---|
37 | _ISR_Signals_to_thread_executing = false; |
---|
38 | |
---|
39 | _ISR_Nest_level = 0; |
---|
40 | |
---|
41 | #if (CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE) |
---|
42 | _ISR_Vector_table = _Workspace_Allocate_or_fatal_error( |
---|
43 | sizeof(ISR_Handler_entry) * ISR_NUMBER_OF_VECTORS |
---|
44 | ); |
---|
45 | #endif |
---|
46 | |
---|
47 | _CPU_Initialize_vectors(); |
---|
48 | |
---|
49 | #if ( CPU_ALLOCATE_INTERRUPT_STACK == TRUE ) |
---|
50 | |
---|
51 | if ( !_Stack_Is_enough(Configuration.interrupt_stack_size) ) |
---|
52 | _Internal_error_Occurred( |
---|
53 | INTERNAL_ERROR_CORE, |
---|
54 | true, |
---|
55 | INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL |
---|
56 | ); |
---|
57 | |
---|
58 | _CPU_Interrupt_stack_low = _Workspace_Allocate_or_fatal_error( |
---|
59 | Configuration.interrupt_stack_size |
---|
60 | ); |
---|
61 | |
---|
62 | _CPU_Interrupt_stack_high = _Addresses_Add_offset( |
---|
63 | _CPU_Interrupt_stack_low, |
---|
64 | Configuration.interrupt_stack_size |
---|
65 | ); |
---|
66 | |
---|
67 | /* Interrupt stack might have to be aligned and/or setup |
---|
68 | * in a specific way. |
---|
69 | */ |
---|
70 | #if defined(_CPU_Interrupt_stack_setup) |
---|
71 | _CPU_Interrupt_stack_setup(_CPU_Interrupt_stack_low, _CPU_Interrupt_stack_high); |
---|
72 | #endif |
---|
73 | |
---|
74 | #endif |
---|
75 | |
---|
76 | #if ( CPU_HAS_HARDWARE_INTERRUPT_STACK == TRUE ) |
---|
77 | _CPU_Install_interrupt_stack(); |
---|
78 | #endif |
---|
79 | |
---|
80 | } |
---|