source: rtems/cpukit/score/cpu/c4x/irq.c @ f26145b

4.104.114.84.95
Last change on this file since f26145b was 16ce0e70, checked in by Ralf Corsepius <ralf.corsepius@…>, on 03/30/04 at 11:45:56

2004-03-30 Ralf Corsepius <ralf_corsepius@…>

  • c4xio.h, cpu.c, irq.c, rtems/score/cpu.h: Convert to using c99 fixed size types.
  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*
2 *  C4x CPU Dependent Source
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#include <rtems/system.h>
16#include <rtems/score/cpu.h>
17#include <rtems/score/isr.h>
18#include <rtems/score/thread.h>
19
20/*
21 *  This routine provides the RTEMS interrupt management.
22 */
23
24#if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
25  unsigned long    *_old_stack_ptr;
26#endif
27
28register unsigned long  *stack_ptr asm("sp");
29
30void __ISR_Handler(uint32_t   vector, void *isr_sp)
31{
32  register uint32_t   level;
33
34  /* already disabled when we get here */
35  /* _CPU_ISR_Disable( level ); */
36
37  _Thread_Dispatch_disable_level++;
38
39#if 0
40  if ( stack_ptr > (_Thread_Executing->Start.stack +
41            _Thread_Executing->Start.Initial_stack.size) ) {
42    printk( "Blown interrupt stack at 0x%x\n", stack_ptr );
43  }
44#endif
45
46#if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
47  if ( _ISR_Nest_level == 0 ) {
48    /* Install irq stack */
49    _old_stack_ptr = stack_ptr;
50    stack_ptr = _CPU_Interrupt_stack_low;
51  }
52#endif
53
54  _ISR_Nest_level++;
55
56  /* leave it to the ISR to decide if they get reenabled */
57  /* _CPU_ISR_Enable( level ); */
58
59  /* call isp */
60  if ( _ISR_Vector_table[ vector] )
61    (*_ISR_Vector_table[ vector ])(
62       vector, isr_sp - sizeof(CPU_Interrupt_frame) + 1 );
63
64  _CPU_ISR_Disable( level );
65
66  _ISR_Nest_level--;
67
68#if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
69  if ( _ISR_Nest_level == 0 )       /* restore old stack pointer */
70    stack_ptr = _old_stack_ptr;
71#endif
72
73  _Thread_Dispatch_disable_level--;
74
75  _CPU_ISR_Enable( level );
76
77  if ( _ISR_Nest_level )
78    return;
79
80  if ( _Thread_Dispatch_disable_level ) {
81    _ISR_Signals_to_thread_executing = FALSE;
82    return;
83  }
84
85  if ( _Context_Switch_necessary || _ISR_Signals_to_thread_executing ) {
86    _ISR_Signals_to_thread_executing = FALSE;
87    _Thread_Dispatch();
88  }
89}
Note: See TracBrowser for help on using the repository browser.