CMSIS2000  0.0.7
 Указатель Структуры данных Файлы Функции Переменные Определения типов Перечисления Элементы перечислений Макросы Группы Страницы
system_LPC2xxx_ISR.c
См. документацию.
1 /*
2  * CMSIS2000
3  * CMSIS-like sources for LPC2xxx series MCUs
4  *
5  * (C) Copyright 2011-2012, Dmitriy Cherepanov, All Rights Reserved
6  *
7  * Version: 0.0.7
8  * Date of the Last Update: 2013-03-04
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining a copy
11  * of this software and associated documentation files (the "Software"), to
12  * deal in the Software without restriction, including without limitation the
13  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
14  * sell copies of the Software, and to permit persons to whom the Software is
15  * furnished to do so, subject to the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be included in
18  * all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
26  * IN THE SOFTWARE.
27  *
28  * Do not be lasy! For the latest version see http://irtos.sourceforge.net .
29  *
30  *
31 #*/
32 /*-----------Документация Doxygen -- Doxygen documentation -----------------*/
33 /** \file
34  *\~russian
35  * Функции прерывания для стандарта CMSIS для МК серии LPC2xxx
36  *
37  *\~
38  * Interrupt functions for CMSIS Device Peripheral Access Layer
39  * for the NXP LPC2xxx Device Series
40  * \author Dmitriy Cherepanov
41  * \date 2011
42  * \ingroup LPC2xxx_System
43  */
44 #if _HASBSPBRD > 0
45 #include "bsp_board_def.h"/* board /definitions if you do not have this file then create it with '#include "mcu_id.h"' line*/
46 #else
47  #include "mcu_id.h"
48 #endif
49 
50 #include "LPC2xxx.h"
51 /* ARM MODE SOURCES */
52 
53 #ifndef WEAK
54  #define WEAK __attribute__ ((weak, naked))
55 #endif
56 #ifndef ALIAS
57  //#define ALIAS(f) __attribute__ ((weakref(#f)))
58  #define ALIAS(f) __attribute__ ((weak, alias (#f)))
59 #endif
60 #ifndef NAKED
61  #define NAKED __attribute__ ((naked))
62 #endif
63 /*----------------------------------------------------------------------------*/
64 /*only B instruction must be here */
65 NAKED void IntDefault_int_Handler (void);//ISR_EXCEPTION_PROTO(IntDefault_int);
66 WEAK ISR_EXCEPTION_PROTO(IntDefault_here);
67 WEAK ISR_EXCEPTION_PROTO(IRQ_Default);
68 
71 WEAK UNDEF_HANDLER_PROTO(UNDEF_Default_Handler);
74 
75 extern void IntDefault_Handler (void) ALIAS(IntDefault_here_Handler);
76 extern void FIQ_Handler (void) ALIAS(FIQ_Default_Handler);
77 extern void UNDEF_Handler (void) ALIAS(UNDEF_Default_Handler);
78 extern void PAbort_Handler (void) ALIAS(PAbort_Default_Handler);
79 extern void DAbort_Handler (void) ALIAS(DAbort_Default_Handler);
80 extern void SWI_Handler (void) ALIAS(SWI_Default_Handler);
81 /*----------------------------------------------------------------------------*/
82 /* Stubs for various interrupts (may be replaced later) */
83 /* ---------------------------------------------------- */
84 void UNDEF_Default_Handler (void) {
85  while (1) {
86  }
87 }
88 /* ---------------------------------------------------- */
90 {
91  while (1) {
92  }
93 }
94 /* ---------------------------------------------------- */
96 {
97  while (1) {
98  }
99 }
100 /* ---------------------------------------------------- */
102 {
103  while (1) {
104  }
105 }
106 
107 /* ---------------------------------------------------- */
108 #if (port_HAS_COMMON_IRQ_HANDLER > 0)
109 ISR_EXCEPTION(IRQ_Default) {
110  while (1) ;
111 }
112 #endif
113 /* ---------------------------------------------------- */
114 void FIQ_Default_Handler (void) {
115  while (1) {
116  }
117 }
118 /* ---------------------------------------------------- */
121 
122 #if defined (system_LPC_USE_TIMER_0)
123  #define interrupt_register LPC_TIM0->IR
124 #elif defined (system_LPC_USE_TIMER_2)
125  #define interrupt_register LPC_TIM2->IR
126  #define VIC_TIMER TIMER2_IRQn
127 #elif defined (system_LPC_USE_TIMER_3)
128  #define interrupt_register LPC_TIM3->IR
129 #else
130  #define interrupt_register LPC_TIM1->IR
131 #endif
132 
133 ISR_EXCEPTION_PROTO(SysTick_internal);
134 ISR_EXCEPTION(SysTick_internal)
135 {
137  SysTick_Handler();
138  //VIC->VectAddress = 0;
139 };
141 {
142  return ;
143 }
144 /* ---------------------------------------------------- */
145 #if (i_MCU_MODEL >= 2300)
146 #else
147  #ifndef VIC_DEFAULT_ISR
148  #define VIC_DEFAULT_ISR vic_def_isr
149  #endif
151 
152  #ifndef VIC_DEFAULT_ISR
153  #define VIC_DEFAULT_ISR vic_def_isr
154  #include "arch/arm/compiler.h"
155  void vic_def_isr(void) irq_func_decl;
157  {
158  VIC->VectAddress = 0;
159  }
160  #endif
161 #endif
162 /*------------- DefaultHandler -----------------------------------------------*/
163 #define set_def_handler(handler_name) void handler_name##_IRQHandler(void) ALIAS(IntDefault_int_Handler)
164 
165 set_def_handler(WDT);
166 set_def_handler(PROGRAMM_INT);
167 set_def_handler(ARM_CORE_ICE_RX);
168 set_def_handler(ARM_CORE_ICE_TX);
169 set_def_handler(TIMER0);
170 set_def_handler(TIMER1);
171 set_def_handler(UART0);
172 set_def_handler(UART1);
173 set_def_handler(PWM);
174 set_def_handler(PWM0);
175 
176 set_def_handler(I2C);
177 set_def_handler(I2C0);
178 
179 set_def_handler(SPI);
180 set_def_handler(SPI0);
181 set_def_handler(SSP0);
182 
183 set_def_handler(SPI1);
184 set_def_handler(SSP1);
185 
186 set_def_handler(PLL0);
187 set_def_handler(RTC);
188 set_def_handler(EINT0);
189 set_def_handler(EINT1);
190 set_def_handler(EINT2);
191 set_def_handler(EINT3);
192 set_def_handler(ADC);
193 #if (i_MCU_MODEL >= 2300)
194 set_def_handler(I2C1);
195 set_def_handler(BOD);
196 set_def_handler(ENET);
198 set_def_handler(CAN);
199 set_def_handler(MCI);
200 set_def_handler(DMA);
201 
202 set_def_handler(TIMER2);
203 set_def_handler(TIMER3);
204 set_def_handler(UART2);
205 set_def_handler(UART3);
206 set_def_handler(I2C2);
207 set_def_handler(I2S);
208 #else /*(i_MCU_MODEL < 2300)*/
210 set_def_handler(CAN2_TX);
211 set_def_handler(CAN3_TX);
212 set_def_handler(CAN4_TX);
213 /*24 and 25 reserved*/
214 set_def_handler(CAN1_RX);
215 set_def_handler(CAN2_RX);
216 set_def_handler(CAN3_RX);
217 set_def_handler(CAN4_RX);
218 #endif
219 
220 
221 /*------------- DefaultHandler -----------------------------------------------*/
222 ISR_EXCEPTION(IntDefault_int)
223 {
225 }
226 ISR_EXCEPTION(IntDefault_here){
227  //
228  // Go into an infinite loop.
229  //
230  while (1) {
231  }
232 }