#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )\r
#define portNOP() __asm volatile( "NOP" )\r
\r
+#ifdef configASSERT\r
+ #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() configASSERT( ( ulPortGetIPL() <= configMAX_SYSCALL_INTERRUPT_PRIORITY ) )\r
+#endif\r
+\r
/* Save clobbered register, set ITU SWINR (at address 0x872E0), read the value\r
back to ensure it is set before continuing, then restore the clobbered\r
register. */\r
\r
/*\r
* These macros should be called directly, but through the taskENTER_CRITICAL()\r
- * and taskEXIT_CRITICAL() macros.\r
+ * and taskEXIT_CRITICAL() macros. If the RTOS is being used correctly then\r
+ * the check to ensure the IPL is not being lowered will not be needed. It is\r
+ * included to ensure assert()s triggered by using an incorrect interrupt\r
+ * priority do not result in the assert() handler inadvertently lowering the\r
+ * priority mask, and in so doing allowing the offending interrupt to continue\r
+ * triggering until stack space is exhausted.\r
*/\r
#define portENABLE_INTERRUPTS() __asm volatile ( "MVTIPL #0" );\r
-#define portDISABLE_INTERRUPTS() __asm volatile ( "MVTIPL %0" ::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY) )\r
+#define portDISABLE_INTERRUPTS() if( ulPortGetIPL() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) __asm volatile ( "MVTIPL %0" ::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY) )\r
\r
/* Critical nesting counts are stored in the TCB. */\r
#define portCRITICAL_NESTING_IN_TCB ( 1 )\r
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) \r
#define portNOP() __asm volatile( "NOP" )\r
\r
+#ifdef configASSERT\r
+ #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() configASSERT( ( ulPortGetIPL() <= configMAX_SYSCALL_INTERRUPT_PRIORITY ) )\r
+#endif\r
+\r
+\r
/* Yield equivalent to "*portITU_SWINTR = 0x01; ( void ) *portITU_SWINTR;"\r
where portITU_SWINTR is the location of the software interrupt register\r
(0x000872E0). Don't rely on the assembler to select a register, so instead \r
\r
/*\r
* These macros should be called directly, but through the taskENTER_CRITICAL()\r
- * and taskEXIT_CRITICAL() macros.\r
+ * and taskEXIT_CRITICAL() macros. If the RTOS is being used correctly then\r
+ * the check to ensure the IPL is not being lowered will not be needed. It is\r
+ * included to ensure assert()s triggered by using an incorrect interrupt\r
+ * priority do not result in the assert() handler inadvertently lowering the\r
+ * priority mask, and in so doing allowing the offending interrupt to continue\r
+ * triggering until stack space is exhausted.\r
*/\r
#define portENABLE_INTERRUPTS() __asm volatile ( "MVTIPL #0" );\r
-#define portDISABLE_INTERRUPTS() __asm volatile ( "MVTIPL %0" ::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY) )\r
+#define portDISABLE_INTERRUPTS() if( ulPortGetIPL() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) __asm volatile ( "MVTIPL %0" ::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY) )\r
\r
/* Critical nesting counts are stored in the TCB. */\r
#define portCRITICAL_NESTING_IN_TCB ( 1 )\r
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )\r
#define portNOP() __no_operation()\r
\r
+#ifdef configASSERT\r
+ #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() configASSERT( ( __get_interrupt_level() <= configMAX_SYSCALL_INTERRUPT_PRIORITY ) )\r
+#endif\r
+\r
#define portYIELD() \\r
__asm volatile \\r
( \\r
\r
/*\r
* These macros should be called directly, but through the taskENTER_CRITICAL()\r
- * and taskEXIT_CRITICAL() macros.\r
+ * and taskEXIT_CRITICAL() macros. If the RTOS is being used correctly then\r
+ * the check to ensure the IPL is not being lowered will not be needed. It is\r
+ * included to ensure assert()s triggered by using an incorrect interrupt\r
+ * priority do not result in the assert() handler inadvertently lowering the\r
+ * priority mask, and in so doing allowing the offending interrupt to continue\r
+ * triggering until stack space is exhausted.\r
*/\r
#define portENABLE_INTERRUPTS() __set_interrupt_level( ( unsigned char ) 0 )\r
-#define portDISABLE_INTERRUPTS() __set_interrupt_level( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY )\r
+#define portDISABLE_INTERRUPTS() if( __get_interrupt_level() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) __set_interrupt_level( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY )\r
\r
/* Critical nesting counts are stored in the TCB. */\r
#define portCRITICAL_NESTING_IN_TCB ( 1 )\r
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )\r
#define portNOP() __no_operation()\r
\r
+#ifdef configASSERT\r
+ #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() configASSERT( ( __get_interrupt_level() <= configMAX_SYSCALL_INTERRUPT_PRIORITY ) )\r
+#endif\r
+\r
/* Yield equivalent to "*portITU_SWINTR = 0x01; ( void ) *portITU_SWINTR;"\r
where portITU_SWINTR is the location of the software interrupt register\r
(0x000872E0). Don't rely on the assembler to select a register, so instead\r
\r
/*\r
* These macros should be called directly, but through the taskENTER_CRITICAL()\r
- * and taskEXIT_CRITICAL() macros.\r
+ * and taskEXIT_CRITICAL() macros. If the RTOS is being used correctly then\r
+ * the check to ensure the IPL is not being lowered will not be needed. It is\r
+ * included to ensure assert()s triggered by using an incorrect interrupt\r
+ * priority do not result in the assert() handler inadvertently lowering the\r
+ * priority mask, and in so doing allowing the offending interrupt to continue\r
+ * triggering until stack space is exhausted.\r
*/\r
#define portENABLE_INTERRUPTS() __set_interrupt_level( ( unsigned char ) 0 )\r
-#define portDISABLE_INTERRUPTS() __set_interrupt_level( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY )\r
+#define portDISABLE_INTERRUPTS() if( __get_interrupt_level() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) __set_interrupt_level( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY )\r
\r
/* Critical nesting counts are stored in the TCB. */\r
#define portCRITICAL_NESTING_IN_TCB ( 1 )\r
\r
/*\r
* These macros should be called directly, but through the taskENTER_CRITICAL()\r
- * and taskEXIT_CRITICAL() macros.\r
+ * and taskEXIT_CRITICAL() macros. If the RTOS is being used correctly then\r
+ * the check to ensure the IPL is not being lowered will not be needed. It is\r
+ * included to ensure assert()s triggered by using an incorrect interrupt\r
+ * priority do not result in the assert() handler inadvertently lowering the\r
+ * priority mask, and in so doing allowing the offending interrupt to continue\r
+ * triggering until stack space is exhausted.\r
*/\r
#define portENABLE_INTERRUPTS() set_ipl( 0 )\r
-#define portDISABLE_INTERRUPTS() set_ipl( configMAX_SYSCALL_INTERRUPT_PRIORITY )\r
+#define portDISABLE_INTERRUPTS() if( get_ipl() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) set_ipl( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY )\r
\r
/* Critical nesting counts are stored in the TCB. */\r
#define portCRITICAL_NESTING_IN_TCB ( 1 )\r
\r
/*\r
* These macros should be called directly, but through the taskENTER_CRITICAL()\r
- * and taskEXIT_CRITICAL() macros.\r
+ * and taskEXIT_CRITICAL() macros. If the RTOS is being used correctly then\r
+ * the check to ensure the IPL is not being lowered will not be needed. It is\r
+ * included to ensure assert()s triggered by using an incorrect interrupt\r
+ * priority do not result in the assert() handler inadvertently lowering the\r
+ * priority mask, and in so doing allowing the offending interrupt to continue\r
+ * triggering until stack space is exhausted.\r
*/\r
#define portENABLE_INTERRUPTS() set_ipl( 0 )\r
-#define portDISABLE_INTERRUPTS() set_ipl( configMAX_SYSCALL_INTERRUPT_PRIORITY )\r
+#define portDISABLE_INTERRUPTS() if( get_ipl() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) set_ipl( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY )\r
\r
/* Critical nesting counts are stored in the TCB. */\r
#define portCRITICAL_NESTING_IN_TCB ( 1 )\r
***************************************************************************\r
\r
\r
- http://www.FreeRTOS.org - Documentation, books, training, latest versions, \r
+ http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
license and Real Time Engineers Ltd. contact details.\r
\r
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
including FreeRTOS+Trace - an indispensable productivity tool, and our new\r
fully thread aware and reentrant UDP/IP stack.\r
\r
- http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High \r
- Integrity Systems, who sell the code with commercial support, \r
+ http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+ Integrity Systems, who sell the code with commercial support,\r
indemnification and middleware, under the OpenRTOS brand.\r
- \r
- http://www.SafeRTOS.com - High Integrity Systems also provide a safety \r
- engineered and independently SIL3 certified version for use in safety and \r
+\r
+ http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+ engineered and independently SIL3 certified version for use in safety and\r
mission critical applications that require provable dependability.\r
*/\r
\r
#include "machine.h"\r
\r
/*-----------------------------------------------------------\r
- * Port specific definitions. \r
+ * Port specific definitions.\r
*\r
* The settings in this file configure FreeRTOS correctly for the\r
* given hardware and compiler.\r
/* Hardware specifics. */\r
#define portBYTE_ALIGNMENT 8 /* Could make four, according to manual. */\r
#define portSTACK_GROWTH -1\r
-#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) \r
+#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )\r
#define portNOP() nop()\r
\r
#ifdef configASSERT\r
\r
/*\r
* These macros should be called directly, but through the taskENTER_CRITICAL()\r
- * and taskEXIT_CRITICAL() macros.\r
+ * and taskEXIT_CRITICAL() macros. If the RTOS is being used correctly then\r
+ * the check to ensure the IPL is not being lowered will not be needed. It is\r
+ * included to ensure assert()s triggered by using an incorrect interrupt\r
+ * priority do not result in the assert() handler inadvertently lowering the\r
+ * priority mask, and in so doing allowing the offending interrupt to continue\r
+ * triggering until stack space is exhausted.\r
*/\r
#define portENABLE_INTERRUPTS() set_ipl( 0 )\r
-#define portDISABLE_INTERRUPTS() set_ipl( configMAX_SYSCALL_INTERRUPT_PRIORITY )\r
+#define portDISABLE_INTERRUPTS() if( get_ipl() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) set_ipl( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY )\r
\r
/* Critical nesting counts are stored in the TCB. */\r
#define portCRITICAL_NESTING_IN_TCB ( 1 )\r