From: richardbarry Date: Sat, 13 Jul 2013 11:31:35 +0000 (+0000) Subject: Update RX ports to only include additional check on the existing IPL (so it is not... X-Git-Tag: V7.5.0~15 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7fbcd1cface8498647303bdedded0b3aaf6a9381;p=freertos Update RX ports to only include additional check on the existing IPL (so it is not lowered) if configASSERT() is defined. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1975 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/FreeRTOS/Source/portable/GCC/RX100/portmacro.h b/FreeRTOS/Source/portable/GCC/RX100/portmacro.h index b3cff6084..3313b65ad 100644 --- a/FreeRTOS/Source/portable/GCC/RX100/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/RX100/portmacro.h @@ -115,10 +115,6 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) #define portNOP() __asm volatile( "NOP" ) -#ifdef configASSERT - #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() configASSERT( ( ulPortGetIPL() <= configMAX_SYSCALL_INTERRUPT_PRIORITY ) ) -#endif - /* Save clobbered register, set ITU SWINR (at address 0x872E0), read the value back to ensure it is set before continuing, then restore the clobbered register. */ @@ -133,17 +129,22 @@ register. */ #define portYIELD_FROM_ISR( x ) if( x != pdFALSE ) { portYIELD(); } -/* - * These macros should be called directly, but through the taskENTER_CRITICAL() - * and taskEXIT_CRITICAL() macros. If the RTOS is being used correctly then - * the check to ensure the IPL is not being lowered will not be needed. It is - * included to ensure assert()s triggered by using an incorrect interrupt - * priority do not result in the assert() handler inadvertently lowering the - * priority mask, and in so doing allowing the offending interrupt to continue - * triggering until stack space is exhausted. - */ -#define portENABLE_INTERRUPTS() __asm volatile ( "MVTIPL #0" ); -#define portDISABLE_INTERRUPTS() if( ulPortGetIPL() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) __asm volatile ( "MVTIPL %0" ::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY) ) +/* These macros should not be called directly, but through the +taskENTER_CRITICAL() and taskEXIT_CRITICAL() macros. An extra check is +performed if configASSERT() is defined to ensure an assertion handler does not +inadvertently attempt to lower the IPL when the call to assert was triggered +because the IPL value was found to be above configMAX_SYSCALL_INTERRUPT_PRIORITY +when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API +functions are those that end in FromISR. FreeRTOS maintains a separate +interrupt API to ensure API function and interrupt entry is as fast and as +simple as possible. */ +#define portENABLE_INTERRUPTS() __asm volatile ( "MVTIPL #0" ) +#ifdef configASSERT + #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() configASSERT( ( ulPortGetIPL() <= configMAX_SYSCALL_INTERRUPT_PRIORITY ) ) + #define portDISABLE_INTERRUPTS() if( ulPortGetIPL() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) __asm volatile ( "MVTIPL %0" ::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY) ) +#else + #define portDISABLE_INTERRUPTS() __asm volatile ( "MVTIPL %0" ::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY) ) +#endif /* Critical nesting counts are stored in the TCB. */ #define portCRITICAL_NESTING_IN_TCB ( 1 ) diff --git a/FreeRTOS/Source/portable/GCC/RX600/portmacro.h b/FreeRTOS/Source/portable/GCC/RX600/portmacro.h index 0e6c6d3e3..e2d7480f9 100644 --- a/FreeRTOS/Source/portable/GCC/RX600/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/RX600/portmacro.h @@ -115,11 +115,6 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) #define portNOP() __asm volatile( "NOP" ) -#ifdef configASSERT - #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() configASSERT( ( ulPortGetIPL() <= configMAX_SYSCALL_INTERRUPT_PRIORITY ) ) -#endif - - /* Yield equivalent to "*portITU_SWINTR = 0x01; ( void ) *portITU_SWINTR;" where portITU_SWINTR is the location of the software interrupt register (0x000872E0). Don't rely on the assembler to select a register, so instead @@ -136,17 +131,22 @@ save and restore clobbered registers manually. */ #define portYIELD_FROM_ISR( x ) if( x != pdFALSE ) portYIELD() -/* - * These macros should be called directly, but through the taskENTER_CRITICAL() - * and taskEXIT_CRITICAL() macros. If the RTOS is being used correctly then - * the check to ensure the IPL is not being lowered will not be needed. It is - * included to ensure assert()s triggered by using an incorrect interrupt - * priority do not result in the assert() handler inadvertently lowering the - * priority mask, and in so doing allowing the offending interrupt to continue - * triggering until stack space is exhausted. - */ -#define portENABLE_INTERRUPTS() __asm volatile ( "MVTIPL #0" ); -#define portDISABLE_INTERRUPTS() if( ulPortGetIPL() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) __asm volatile ( "MVTIPL %0" ::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY) ) +/* These macros should not be called directly, but through the +taskENTER_CRITICAL() and taskEXIT_CRITICAL() macros. An extra check is +performed if configASSERT() is defined to ensure an assertion handler does not +inadvertently attempt to lower the IPL when the call to assert was triggered +because the IPL value was found to be above configMAX_SYSCALL_INTERRUPT_PRIORITY +when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API +functions are those that end in FromISR. FreeRTOS maintains a separate +interrupt API to ensure API function and interrupt entry is as fast and as +simple as possible. */ +#define portENABLE_INTERRUPTS() __asm volatile ( "MVTIPL #0" ) +#ifdef configASSERT + #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() configASSERT( ( ulPortGetIPL() <= configMAX_SYSCALL_INTERRUPT_PRIORITY ) ) + #define portDISABLE_INTERRUPTS() if( ulPortGetIPL() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) __asm volatile ( "MVTIPL %0" ::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY) ) +#else + #define portDISABLE_INTERRUPTS() __asm volatile ( "MVTIPL %0" ::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY) ) +#endif /* Critical nesting counts are stored in the TCB. */ #define portCRITICAL_NESTING_IN_TCB ( 1 ) diff --git a/FreeRTOS/Source/portable/IAR/RX100/portmacro.h b/FreeRTOS/Source/portable/IAR/RX100/portmacro.h index 0c50981af..37a51a97a 100644 --- a/FreeRTOS/Source/portable/IAR/RX100/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/RX100/portmacro.h @@ -120,10 +120,6 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) #define portNOP() __no_operation() -#ifdef configASSERT - #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() configASSERT( ( __get_interrupt_level() <= configMAX_SYSCALL_INTERRUPT_PRIORITY ) ) -#endif - #define portYIELD() \ __asm volatile \ ( \ @@ -135,17 +131,22 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portYIELD_FROM_ISR( x ) if( ( x ) != pdFALSE ) { portYIELD(); } -/* - * These macros should be called directly, but through the taskENTER_CRITICAL() - * and taskEXIT_CRITICAL() macros. If the RTOS is being used correctly then - * the check to ensure the IPL is not being lowered will not be needed. It is - * included to ensure assert()s triggered by using an incorrect interrupt - * priority do not result in the assert() handler inadvertently lowering the - * priority mask, and in so doing allowing the offending interrupt to continue - * triggering until stack space is exhausted. - */ +/* These macros should not be called directly, but through the +taskENTER_CRITICAL() and taskEXIT_CRITICAL() macros. An extra check is +performed if configASSERT() is defined to ensure an assertion handler does not +inadvertently attempt to lower the IPL when the call to assert was triggered +because the IPL value was found to be above configMAX_SYSCALL_INTERRUPT_PRIORITY +when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API +functions are those that end in FromISR. FreeRTOS maintains a separate +interrupt API to ensure API function and interrupt entry is as fast and as +simple as possible. */ #define portENABLE_INTERRUPTS() __set_interrupt_level( ( unsigned char ) 0 ) -#define portDISABLE_INTERRUPTS() if( __get_interrupt_level() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) __set_interrupt_level( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) +#ifdef configASSERT + #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() configASSERT( ( __get_interrupt_level() <= configMAX_SYSCALL_INTERRUPT_PRIORITY ) ) + #define portDISABLE_INTERRUPTS() if( __get_interrupt_level() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) __set_interrupt_level( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) +#else + #define portDISABLE_INTERRUPTS() __set_interrupt_level( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) +#endif /* Critical nesting counts are stored in the TCB. */ #define portCRITICAL_NESTING_IN_TCB ( 1 ) @@ -157,8 +158,6 @@ extern void vTaskExitCritical( void ); #define portEXIT_CRITICAL() vTaskExitCritical() /* As this port allows interrupt nesting... */ -unsigned long ulPortGetIPL( void ); -void vPortSetIPL( unsigned long ulNewIPL ); #define portSET_INTERRUPT_MASK_FROM_ISR() __get_interrupt_level(); portDISABLE_INTERRUPTS() #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ) __set_interrupt_level( ( unsigned char ) ( uxSavedInterruptStatus ) ) diff --git a/FreeRTOS/Source/portable/IAR/RX600/portmacro.h b/FreeRTOS/Source/portable/IAR/RX600/portmacro.h index 45b373af5..9e8f9556e 100644 --- a/FreeRTOS/Source/portable/IAR/RX600/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/RX600/portmacro.h @@ -117,10 +117,6 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) #define portNOP() __no_operation() -#ifdef configASSERT - #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() configASSERT( ( __get_interrupt_level() <= configMAX_SYSCALL_INTERRUPT_PRIORITY ) ) -#endif - /* Yield equivalent to "*portITU_SWINTR = 0x01; ( void ) *portITU_SWINTR;" where portITU_SWINTR is the location of the software interrupt register (0x000872E0). Don't rely on the assembler to select a register, so instead @@ -137,17 +133,22 @@ save and restore clobbered registers manually. */ #define portYIELD_FROM_ISR( x ) if( ( x ) != pdFALSE ) portYIELD() -/* - * These macros should be called directly, but through the taskENTER_CRITICAL() - * and taskEXIT_CRITICAL() macros. If the RTOS is being used correctly then - * the check to ensure the IPL is not being lowered will not be needed. It is - * included to ensure assert()s triggered by using an incorrect interrupt - * priority do not result in the assert() handler inadvertently lowering the - * priority mask, and in so doing allowing the offending interrupt to continue - * triggering until stack space is exhausted. - */ +/* These macros should not be called directly, but through the +taskENTER_CRITICAL() and taskEXIT_CRITICAL() macros. An extra check is +performed if configASSERT() is defined to ensure an assertion handler does not +inadvertently attempt to lower the IPL when the call to assert was triggered +because the IPL value was found to be above configMAX_SYSCALL_INTERRUPT_PRIORITY +when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API +functions are those that end in FromISR. FreeRTOS maintains a separate +interrupt API to ensure API function and interrupt entry is as fast and as +simple as possible. */ #define portENABLE_INTERRUPTS() __set_interrupt_level( ( unsigned char ) 0 ) -#define portDISABLE_INTERRUPTS() if( __get_interrupt_level() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) __set_interrupt_level( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) +#ifdef configASSERT + #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() configASSERT( ( __get_interrupt_level() <= configMAX_SYSCALL_INTERRUPT_PRIORITY ) ) + #define portDISABLE_INTERRUPTS() if( __get_interrupt_level() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) __set_interrupt_level( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) +#else + #define portDISABLE_INTERRUPTS() __set_interrupt_level( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) +#endif /* Critical nesting counts are stored in the TCB. */ #define portCRITICAL_NESTING_IN_TCB ( 1 ) @@ -159,8 +160,6 @@ extern void vTaskExitCritical( void ); #define portEXIT_CRITICAL() vTaskExitCritical() /* As this port allows interrupt nesting... */ -unsigned long ulPortGetIPL( void ); -void vPortSetIPL( unsigned long ulNewIPL ); #define portSET_INTERRUPT_MASK_FROM_ISR() __get_interrupt_level(); portDISABLE_INTERRUPTS() #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ) __set_interrupt_level( ( unsigned char ) ( uxSavedInterruptStatus ) ) diff --git a/FreeRTOS/Source/portable/MPLAB/PIC32MX/portmacro.h b/FreeRTOS/Source/portable/MPLAB/PIC32MX/portmacro.h index c8a07856d..74dc76410 100644 --- a/FreeRTOS/Source/portable/MPLAB/PIC32MX/portmacro.h +++ b/FreeRTOS/Source/portable/MPLAB/PIC32MX/portmacro.h @@ -129,7 +129,6 @@ value was found to be above configMAX_SYSCALL_INTERRUPT_PRIORITY when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API functions are those that end in FromISR. FreeRTOS maintains a separate interrupt API to ensure API function and interrupt entry is as fast and as simple as possible. */ - #ifdef configASSERT #define portDISABLE_INTERRUPTS() \ { \ @@ -145,7 +144,7 @@ ensure API function and interrupt entry is as fast and as simple as possible. */ _CP0_SET_STATUS( ( ulStatus | ( configMAX_SYSCALL_INTERRUPT_PRIORITY << portIPL_SHIFT ) ) ); \ } \ } -#else +#else /* configASSERT */ #define portDISABLE_INTERRUPTS() \ { \ unsigned long ulStatus; \ diff --git a/FreeRTOS/Source/portable/Renesas/RX100/portmacro.h b/FreeRTOS/Source/portable/Renesas/RX100/portmacro.h index 736375eb1..ae9d9418d 100644 --- a/FreeRTOS/Source/portable/Renesas/RX100/portmacro.h +++ b/FreeRTOS/Source/portable/Renesas/RX100/portmacro.h @@ -118,10 +118,6 @@ than portSTACK_TYPE and portBASE_TYPE. */ #define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) #define portNOP() nop() -#ifdef configASSERT - #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() configASSERT( ( get_ipl() <= configMAX_SYSCALL_INTERRUPT_PRIORITY ) ) -#endif - #pragma inline_asm vPortYield static void vPortYield( void ) { @@ -140,17 +136,22 @@ static void vPortYield( void ) #define portYIELD() vPortYield() #define portYIELD_FROM_ISR( x ) if( x != pdFALSE ) { portYIELD(); } -/* - * These macros should be called directly, but through the taskENTER_CRITICAL() - * and taskEXIT_CRITICAL() macros. If the RTOS is being used correctly then - * the check to ensure the IPL is not being lowered will not be needed. It is - * included to ensure assert()s triggered by using an incorrect interrupt - * priority do not result in the assert() handler inadvertently lowering the - * priority mask, and in so doing allowing the offending interrupt to continue - * triggering until stack space is exhausted. - */ -#define portENABLE_INTERRUPTS() set_ipl( 0 ) -#define portDISABLE_INTERRUPTS() if( get_ipl() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) set_ipl( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) +/* These macros should not be called directly, but through the +taskENTER_CRITICAL() and taskEXIT_CRITICAL() macros. An extra check is +performed if configASSERT() is defined to ensure an assertion handler does not +inadvertently attempt to lower the IPL when the call to assert was triggered +because the IPL value was found to be above configMAX_SYSCALL_INTERRUPT_PRIORITY +when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API +functions are those that end in FromISR. FreeRTOS maintains a separate +interrupt API to ensure API function and interrupt entry is as fast and as +simple as possible. */ +#define portENABLE_INTERRUPTS() set_ipl( ( long ) 0 ) +#ifdef configASSERT + #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() configASSERT( ( get_ipl() <= configMAX_SYSCALL_INTERRUPT_PRIORITY ) ) + #define portDISABLE_INTERRUPTS() if( get_ipl() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) set_ipl( ( long ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) +#else + #define portDISABLE_INTERRUPTS() set_ipl( ( long ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) +#endif /* Critical nesting counts are stored in the TCB. */ #define portCRITICAL_NESTING_IN_TCB ( 1 ) diff --git a/FreeRTOS/Source/portable/Renesas/RX200/portmacro.h b/FreeRTOS/Source/portable/Renesas/RX200/portmacro.h index 721334a48..b6030cca7 100644 --- a/FreeRTOS/Source/portable/Renesas/RX200/portmacro.h +++ b/FreeRTOS/Source/portable/Renesas/RX200/portmacro.h @@ -118,10 +118,6 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) #define portNOP() nop() -#ifdef configASSERT - #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() configASSERT( ( get_ipl() <= configMAX_SYSCALL_INTERRUPT_PRIORITY ) ) -#endif - #pragma inline_asm vPortYield static void vPortYield( void ) { @@ -140,17 +136,22 @@ static void vPortYield( void ) #define portYIELD() vPortYield() #define portYIELD_FROM_ISR( x ) if( x != pdFALSE ) portYIELD() -/* - * These macros should be called directly, but through the taskENTER_CRITICAL() - * and taskEXIT_CRITICAL() macros. If the RTOS is being used correctly then - * the check to ensure the IPL is not being lowered will not be needed. It is - * included to ensure assert()s triggered by using an incorrect interrupt - * priority do not result in the assert() handler inadvertently lowering the - * priority mask, and in so doing allowing the offending interrupt to continue - * triggering until stack space is exhausted. - */ -#define portENABLE_INTERRUPTS() set_ipl( 0 ) -#define portDISABLE_INTERRUPTS() if( get_ipl() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) set_ipl( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) +/* These macros should not be called directly, but through the +taskENTER_CRITICAL() and taskEXIT_CRITICAL() macros. An extra check is +performed if configASSERT() is defined to ensure an assertion handler does not +inadvertently attempt to lower the IPL when the call to assert was triggered +because the IPL value was found to be above configMAX_SYSCALL_INTERRUPT_PRIORITY +when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API +functions are those that end in FromISR. FreeRTOS maintains a separate +interrupt API to ensure API function and interrupt entry is as fast and as +simple as possible. */ +#define portENABLE_INTERRUPTS() set_ipl( ( long ) 0 ) +#ifdef configASSERT + #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() configASSERT( ( get_ipl() <= configMAX_SYSCALL_INTERRUPT_PRIORITY ) ) + #define portDISABLE_INTERRUPTS() if( get_ipl() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) set_ipl( ( long ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) +#else + #define portDISABLE_INTERRUPTS() set_ipl( ( long ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) +#endif /* Critical nesting counts are stored in the TCB. */ #define portCRITICAL_NESTING_IN_TCB ( 1 ) diff --git a/FreeRTOS/Source/portable/Renesas/RX600/portmacro.h b/FreeRTOS/Source/portable/Renesas/RX600/portmacro.h index 5a249d371..b6fe7bc7e 100644 --- a/FreeRTOS/Source/portable/Renesas/RX600/portmacro.h +++ b/FreeRTOS/Source/portable/Renesas/RX600/portmacro.h @@ -118,9 +118,6 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) #define portNOP() nop() -#ifdef configASSERT - #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() configASSERT( ( get_ipl() <= configMAX_SYSCALL_INTERRUPT_PRIORITY ) ) -#endif #pragma inline_asm vPortYield static void vPortYield( void ) @@ -140,17 +137,22 @@ static void vPortYield( void ) #define portYIELD() vPortYield() #define portYIELD_FROM_ISR( x ) if( x != pdFALSE ) portYIELD() -/* - * These macros should be called directly, but through the taskENTER_CRITICAL() - * and taskEXIT_CRITICAL() macros. If the RTOS is being used correctly then - * the check to ensure the IPL is not being lowered will not be needed. It is - * included to ensure assert()s triggered by using an incorrect interrupt - * priority do not result in the assert() handler inadvertently lowering the - * priority mask, and in so doing allowing the offending interrupt to continue - * triggering until stack space is exhausted. - */ -#define portENABLE_INTERRUPTS() set_ipl( 0 ) -#define portDISABLE_INTERRUPTS() if( get_ipl() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) set_ipl( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) +/* These macros should not be called directly, but through the +taskENTER_CRITICAL() and taskEXIT_CRITICAL() macros. An extra check is +performed if configASSERT() is defined to ensure an assertion handler does not +inadvertently attempt to lower the IPL when the call to assert was triggered +because the IPL value was found to be above configMAX_SYSCALL_INTERRUPT_PRIORITY +when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API +functions are those that end in FromISR. FreeRTOS maintains a separate +interrupt API to ensure API function and interrupt entry is as fast and as +simple as possible. */ +#define portENABLE_INTERRUPTS() set_ipl( ( long ) 0 ) +#ifdef configASSERT + #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() configASSERT( ( get_ipl() <= configMAX_SYSCALL_INTERRUPT_PRIORITY ) ) + #define portDISABLE_INTERRUPTS() if( get_ipl() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) set_ipl( ( long ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) +#else + #define portDISABLE_INTERRUPTS() set_ipl( ( long ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) +#endif /* Critical nesting counts are stored in the TCB. */ #define portCRITICAL_NESTING_IN_TCB ( 1 )