source: rtems/cpukit/score/cpu/lm32/irq.c @ e0f91da

4.115
Last change on this file since e0f91da was e0f91da, checked in by Alex Ivanov <alexivanov97@…>, on 11/30/12 at 21:34:17

score misc: Score misc: Clean up Doxygen #9 (GCI 2012)

This patch is a task from GCI 2012 which improves the Doxygen
comments in the RTEMS source.

https://google-melange.appspot.com/gci/task/view/google/gci2012/7977211

  • Property mode set to 100644
File size: 1.9 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief LM32 Initialize the ISR Handler
5 */
6
7/*
8 *  COPYRIGHT (c) 1989-2009.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.com/license/LICENSE.
14 */
15
16#ifdef HAVE_CONFIG_H
17#include "config.h"
18#endif
19
20#include <rtems/system.h>
21#include <rtems/score/cpu.h>
22#include <rtems/score/thread.h>
23#include <rtems/score/isr.h>
24#include <rtems/score/percpu.h>
25
26#if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
27  unsigned long    *_old_stack_ptr;
28#endif
29
30void *_exception_stack_frame;
31
32register unsigned long  *stack_ptr __asm__ ("sp");
33
34void __ISR_Handler(uint32_t vector, CPU_Interrupt_frame *ifr)
35{
36  register uint32_t   level;
37  _exception_stack_frame = NULL;
38
39  /* Interrupts are disabled upon entry to this Handler */
40
41  _Thread_Dispatch_increment_disable_level();
42
43#if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
44  if ( _ISR_Nest_level == 0 ) {
45    /* Install irq stack */
46    _old_stack_ptr = stack_ptr;
47    stack_ptr = _CPU_Interrupt_stack_high - 4;
48  }
49#endif
50
51  _ISR_Nest_level++;
52
53  if ( _ISR_Vector_table[ vector] )
54  {
55    (*_ISR_Vector_table[ vector ])(vector, ifr);
56  };
57
58  /* Make sure that interrupts are disabled again */
59  _CPU_ISR_Disable( level );
60
61  _ISR_Nest_level--;
62
63#if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
64  if( _ISR_Nest_level == 0)
65    stack_ptr = _old_stack_ptr;
66#endif
67
68  _Thread_Dispatch_decrement_disable_level();
69
70  _CPU_ISR_Enable( level );
71
72  if ( _ISR_Nest_level )
73    return;
74
75  if ( _Thread_Dispatch_necessary && !_Thread_Dispatch_in_critical_section() ) {
76    /* save off our stack frame so the context switcher can get to it */
77    _exception_stack_frame = ifr;
78
79    _Thread_Dispatch();
80
81    /* and make sure its clear in case we didn't dispatch. if we did, its
82     * already cleared */
83    _exception_stack_frame = NULL;
84  }
85}
86
Note: See TracBrowser for help on using the repository browser.