CMSIS2000  0.0.7
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
interrupt.h
Go to the documentation of this file.
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 /** \file
33  *\if russian_lng
34  * Файл определяющий макросы прерываний и исключений
35  *\else
36  * This file is used to define exeptions and interrupt subroutines macroses for selected arch
37 
38  * \note need to insert iConfig.h or FreeRTOSConfig.h
39  *\endif
40  */
41 #ifndef _iARCH_AVR_INTERRUPT_H_
42 #define _iARCH_AVR_INTERRUPT_H_ 1
43 /*------------------------- ICC Compiler -------------------------------------*/
44 #if defined (defined (__ICCARM__))
45 /* IAR iccarm specific functions */
46 /*---------------------------- GNU Compiler ----------------------------------*/
47 #elif (defined (__GNUC__))
48 /* GNU gcc specific functions */
49 #include <avr/interrupt.h>
50 
51 #ifdef __cplusplus
52  # PORT_ISR_IRQ_PROTO(name) \
53  extern "C" void name##_vect (void) __attribute__ ((signal,__INTR_ATTRS)) __VA_ARGS__
54 #else
55  #define PORT_ISR_IRQ_PROTO(name) \
56  void name##_vect (void) __attribute__ ((signal,__INTR_ATTRS)) __VA_ARGS__
57 #endif
58  /* by default the name of ISR is name_##vect*/
59  #define PORT_ISR_IRQ(name) ISR(name##_vect)
60 
61 #ifdef iSCHEDULER_TYPE /* --------------using iRTOS----------------*/
62  #if (iSCHEDULER_TYPE == iPREEMPETIVE_SCHEDULER)
63  #if (configUSE_PREEMPTION == 1)
64  /* - Save the context of the interrupted task.
65  - Call the handler.
66  - Restore the context of whichever task is going to run next. */
67  #define PORT_ISR_IRQ_OS(name) \
68  static inline void name##_inline_interrupt_wrapper(void); \
69  ISR(name##_vect,ISR_NAKED) \
70  { \
71  portSAVE_CONTEXT(); \
72  name##_inline_interrupt_wrapper(); \
73  portRESTORE_CONTEXT(); \
74  }; \
75  void name##_inline_interrupt_wrapper(void)
76 
77  #endif
78 #endif
79 
80 #endif /* defined ( __ICCARM__ ) */
81 
82 /*- THE DEFAULT PROTOTYPING OF THIS HANDLERS WITHOUT ANY RTOS-----------------*/
83 #ifndef PORT_ISR_EXCEPTION_PROTO
84  #define PORT_ISR_EXCEPTION_PROTO(name) ISR_HANDLER_PROTO(name##_Handler)
85 #endif
86 #ifndef PORT_ISR_EXCEPTION
87  #define PORT_ISR_EXCEPTION(name) ISR_HANDLER(name##_Handler)
88 #endif
89 
90 #ifndef PORT_ISR_IRQ_PROTO
91  #define PORT_ISR_IRQ_PROTO(name) ISR_HANDLER_PROTO(name##_IRQHandler)
92 #endif
93 #ifndef PORT_ISR_IRQ
94  #define PORT_ISR_IRQ(name) ISR_HANDLER(name##_IRQHandler)
95 #endif
96 /*----- IRQ HANDLERS IF OS IS IN COOPERATIVE MODE ----------------------------*/
97 #ifndef PORT_ISR_IRQ_OS_PROTO
98  #define PORT_ISR_IRQ_OS_PROTO(name) ISR_HANDLER_PROTO(name##_IRQHandler)
99 #endif
100 #ifndef PORT_ISR_IRQ_OS
101  #define PORT_ISR_IRQ_OS(name) ISR_HANDLER(name##_IRQHandler)
102 #endif
103 
104 
105 
106 #endif /* _iARCH_ARM_INTERRUPT_H_ */