41 #ifndef _iARCH_ARM_INTERRUPT_H_
42 #define _iARCH_ARM_INTERRUPT_H_ 1
44 #if defined ( __CC_ARM )
49 #elif (defined (__ICCARM__))
54 #define ISR_HANDLER_PROTO(name) \
55 void name (void) __irq
57 #elif (defined (__GNUC__))
64 __attribute__( ( always_inline ) ) static inline
void __enable_irq(
void)
67 __asm
volatile (
"mrs r0, cpsr; bic r0, r0, #0x80; msr cpsr, r0" : : :
"r0");
75 __attribute__( ( always_inline ) ) static inline
void __disable_irq(
void)
77 __asm
volatile (
"mrs r0, cpsr; orr r0, r0, #0x80; msr cpsr, r0" : : :
"r0");
84 __attribute__( ( always_inline ) ) static inline
void __enable_fault_irq(
void)
87 __asm
volatile (
"mrs r0, cpsr; bic r0, r0, #0x40; msr cpsr, r0" : : :
"r0");
96 __attribute__( ( always_inline ) ) static inline
void __disable_fault_irq(
void)
98 __asm
volatile (
"mrs r0, cpsr; orr r0, r0, #0x40; msr cpsr, r0" : : :
"r0");
102 #define ISR_HANDLER_PROTO(name) \
103 void name (void) __attribute__ ((interrupt("IRQ"),section (".text.keep.vector")))
105 #define FIQ_HANDLER_PROTO(name) \
106 void name (void) __attribute__ ((interrupt("FIQ"),section (".text.keep.vector")))
108 #define FIQ_HANDLER(name) void name (void)
110 #define UNDEF_HANDLER_PROTO(name) \
111 void name (void) __attribute__ ((interrupt("UNDEF"),section (".text.keep.vector")))
113 #define UNDEF_HANDLER(name) void name (void)
116 #define SWI_HANDLER_PROTO(name) \
117 void name (void) __attribute__ ((interrupt("SWI"),section (".text.keep.vector")))
119 #define SWI_HANDLER(name) void name (void)
121 #ifdef iSCHEDULER_TYPE
123 #if (iSCHEDULER_TYPE == iPREEMPETIVE_SCHEDULER)
128 #ifdef configUSE_PREEMPTION
129 #if (configUSE_PREEMPTION == 1)
131 #define dri_make_asm_call_here(STRING) \
132 __asm volatile ("bl " #STRING)
135 #define ISR_IRQ_OS_PROTO(function_name) \
136 void function_name##_IRQHandler ( void ) \
137 __attribute__ ((naked,section (".text.keep.vector")));\
138 void function_name##_IRQHandler_internal( void ) \
139 __attribute__ ((noinline)) \
144 #define ISR_IRQ_OS(function_name) \
145 void function_name##_IRQHandler ( void ) \
147 portSAVE_CONTEXT(); \
148 dri_make_asm_call_here (function_name##_IRQHandler_internal) ; \
149 portRESTORE_CONTEXT(); \
152 void function_name##_IRQHandler_internal( void )
158 #elif (defined (__TASKING__))
167 #if ((i_MCU_MODEL >= 2000) && (i_MCU_MODEL < 2300))
168 #define VICVectAddr_ISR_HOOK() (*(unsigned int*)(0xFFFFF030)) = 0;
170 #define VICVectAddr_ISR_HOOK() (*(unsigned int*)(0xFFFFFF00)) = 0
174 #ifndef ISR_EXCEPTION_PROTO
175 #define ISR_EXCEPTION_PROTO(name) ISR_HANDLER_PROTO(name##_Handler)
177 #ifndef ISR_EXCEPTION
178 #define ISR_EXCEPTION(name) ISR_IRQhook(name##_Handler)
181 #ifndef ISR_IRQ_PROTOint
182 #define ISR_IRQ_PROTOint(name) ISR_HANDLER_PROTO(name##_IRQHandler)
185 #ifndef ISR_IRQ_PROTO
186 #define ISR_IRQ_PROTO(name) ISR_IRQ_PROTOint(name)
189 #define ISR_IRQhook(function_name) \
190 inline static void function_name##_internal( void ); \
191 ISR_HANDLER(function_name) \
193 function_name##_internal() ; \
194 VIC->VectAddress = 0; \
196 inline static void function_name##_internal( void )
200 #define ISR_IRQint(name) ISR_IRQhook(name##_IRQHandler)
203 #define ISR_IRQ(name) ISR_IRQint(name)