RTEMS
isr.c
Go to the documentation of this file.
1 
8 /*
9  * COPYRIGHT (c) 1989-2012.
10  * On-Line Applications Research Corporation (OAR).
11  *
12  * The license and distribution terms for this file may be
13  * found in the file LICENSE in this distribution or at
14  * http://www.rtems.org/license/LICENSE.
15  */
16 
17 #ifdef HAVE_CONFIG_H
18 #include "config.h"
19 #endif
20 
21 #include <rtems/score/isr.h>
22 #include <rtems/score/address.h>
23 #include <rtems/score/interr.h>
24 #include <rtems/score/percpu.h>
25 #include <rtems/score/stackimpl.h>
26 #include <rtems/config.h>
27 
28 #if (CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE)
29  ISR_Handler_entry _ISR_Vector_table[ CPU_INTERRUPT_NUMBER_OF_VECTORS ];
30 #elif defined(CPU_INTERRUPT_NUMBER_OF_VECTORS)
31  #error "CPU_INTERRUPT_NUMBER_OF_VECTORS is defined for non-simple vectored interrupts"
32 #elif defined(CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER)
33  #error "CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER is defined for non-simple vectored interrupts"
34 #endif
35 
37 {
38  uint32_t cpu_max;
39  uint32_t cpu_index;
40  size_t stack_size;
41  char *stack_low;
42 
43  _ISR_Nest_level = 0;
44 
45 #if (CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE)
47 #endif
48 
51  stack_low = _ISR_Stack_area_begin;
52 
53  for ( cpu_index = 0 ; cpu_index < cpu_max; ++cpu_index ) {
54  Per_CPU_Control *cpu;
55  char *stack_high;
56 
57  cpu = _Per_CPU_Get_by_index( cpu_index );
58  stack_high = _Addresses_Add_offset( stack_low, stack_size );
59 
60  cpu->interrupt_stack_low = stack_low;
61  cpu->interrupt_stack_high = stack_high;
62 
63  /*
64  * Interrupt stack might have to be aligned and/or setup in a specific
65  * way. Do not use the local low or high variables here since
66  * _CPU_Interrupt_stack_setup() is a nasty macro that might want to play
67  * with the real memory locations.
68  */
69 #if defined(_CPU_Interrupt_stack_setup)
70  _CPU_Interrupt_stack_setup(
73  );
74 #endif
75 
76  stack_low = stack_high;
77  }
78 }
Constants and Prototypes Related to the Internal Error Handler.
void * interrupt_stack_high
The interrupt stack high address for this processor.
Definition: percpu.h:363
char _ISR_Stack_area_begin[]
The interrupt stack area begin.
Data Related to the Management of Processor Interrupt Levels.
This header file defines parts of the application configuration information API.
Inlined Routines from the Stack Handler.
#define _CPU_Initialize_vectors()
Definition: cpu.h:774
Per CPU Core Structure.
Definition: percpu.h:347
Information Required to Manipulate Physical Addresses.
#define rtems_configuration_get_interrupt_stack_size()
Returns the interrupt stack size in bytes of this application.
Definition: config.h:166
void * interrupt_stack_low
The interrupt stack low address for this processor.
Definition: percpu.h:358
void _ISR_Handler_initialization(void)
Initializes the ISR handler.
Definition: isr.c:36
#define rtems_configuration_get_maximum_processors()
Returns the maximum number of processors which are configured for this application.
Definition: config.h:194
#define CPU_INTERRUPT_NUMBER_OF_VECTORS
Definition: cpu.h:686
RTEMS_INLINE_ROUTINE void * _Addresses_Add_offset(const void *base, uintptr_t offset)
Adds offset to an address.
Definition: address.h:55