]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/portable/IAR/ARM_CM4F_MPU/portmacro.h
Add xPortIsInsideInterrupt() to the IAR ARMv7-M ports.
[freertos] / FreeRTOS / Source / portable / IAR / ARM_CM4F_MPU / portmacro.h
index f26f45f9b41a8d081b846ba73b7e1fe74085a715..51de83ba043587daf194ba16f50af8eb18a3199b 100644 (file)
@@ -191,6 +191,36 @@ not necessary for to use this port.  They are defined so the common demo files
 \r
 /* portNOP() is not required by this port. */\r
 #define portNOP()\r
+\r
+#define portINLINE     __inline\r
+\r
+#ifndef portFORCE_INLINE\r
+       #define portFORCE_INLINE inline __attribute__(( always_inline))\r
+#endif\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+portFORCE_INLINE static BaseType_t xPortIsInsideInterrupt( void )\r
+{\r
+uint32_t ulCurrentInterrupt;\r
+BaseType_t xReturn;\r
+\r
+       /* Obtain the number of the currently executing interrupt. */\r
+       __asm volatile( "mrs %0, ipsr" : "=r"( ulCurrentInterrupt ) :: "memory" );\r
+\r
+       if( ulCurrentInterrupt == 0 )\r
+       {\r
+               xReturn = pdFALSE;\r
+       }\r
+       else\r
+       {\r
+               xReturn = pdTRUE;\r
+       }\r
+\r
+       return xReturn;\r
+}\r
+\r
+\r
 /*-----------------------------------------------------------*/\r
 \r
 extern BaseType_t xIsPrivileged( void );\r