#define portNO_SECURE_CONTEXT 0\r
/*-----------------------------------------------------------*/\r
\r
-/**\r
- * @brief Setup the timer to generate the tick interrupts.\r
- */\r
-static void prvSetupTimerInterrupt( void ) PRIVILEGED_FUNCTION;\r
-\r
/**\r
* @brief Used to catch tasks that attempt to return from their implementing\r
* function.\r
static void prvSetupFPU( void ) PRIVILEGED_FUNCTION;\r
#endif /* configENABLE_FPU */\r
\r
+/**\r
+ * @brief Setup the timer to generate the tick interrupts.\r
+ *\r
+ * The implementation in this file is weak to allow application writers to\r
+ * change the timer used to generate the tick interrupt.\r
+ */\r
+void vPortSetupTimerInterrupt( void ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * @brief Checks whether the current execution context is interrupt.\r
+ *\r
+ * @return pdTRUE if the current execution context is interrupt, pdFALSE\r
+ * otherwise.\r
+ */\r
+BaseType_t xPortIsInsideInterrupt( void );\r
+\r
/**\r
* @brief Yield the processor.\r
*/\r
#endif /* configENABLE_TRUSTZONE */\r
/*-----------------------------------------------------------*/\r
\r
-static void prvSetupTimerInterrupt( void ) /* PRIVILEGED_FUNCTION */\r
+__attribute__(( weak )) void vPortSetupTimerInterrupt( void ) /* PRIVILEGED_FUNCTION */\r
{\r
/* Stop and reset the SysTick. */\r
*( portNVIC_SYSTICK_CTRL ) = 0UL;\r
\r
/* Start the timer that generates the tick ISR. Interrupts are disabled\r
* here already. */\r
- prvSetupTimerInterrupt();\r
+ vPortSetupTimerInterrupt();\r
\r
/* Initialize the critical nesting count ready for the first task. */\r
ulCriticalNesting = 0;\r
}\r
#endif /* configENABLE_MPU */\r
/*-----------------------------------------------------------*/\r
+\r
+BaseType_t xPortIsInsideInterrupt( void )\r
+{\r
+uint32_t ulCurrentInterrupt;\r
+BaseType_t xReturn;\r
+\r
+ /* Obtain the number of the currently executing interrupt. Interrupt Program\r
+ * Status Register (IPSR) holds the exception number of the currently-executing\r
+ * exception or zero for Thread mode.*/\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
+/*-----------------------------------------------------------*/
\ No newline at end of file