When I want to disable interrupt on Cortex M core I have more choice.
can you describe (even roughly) the difference between
They are defined as follow:
* task. h
* Macro to disable all maskable interrupts.
* \defgroup taskDISABLE_INTERRUPTS taskDISABLE_INTERRUPTS
* \ingroup SchedulerControl
#define taskDISABLE_INTERRUPTS() portDISABLE_INTERRUPTS()
#define portDISABLE_INTERRUPTS() vPortRaiseBASEPRI()
portFORCE_INLINE static void vPortRaiseBASEPRI( void )
" mov %0, %1 \n" \
" msr basepri, %0 \n" \
" isb \n" \
" dsb \n" \
:"=r" (ulNewBASEPRI) : "i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY ) : "memory"
\brief Disable IRQ Interrupts
\details Disables IRQ interrupts by setting the I-bit in the CPSR.
Can only be executed in Privileged modes.
__STATIC_FORCEINLINE void __disable_irq(void)
__ASM volatile ("cpsid i" : : : "memory");
portDISABLE_INTERRUPTS(). So if I need to disable interruptions can I feel free to use
taskDISABLE_INTERRUPTS() or should I use
There are at least two fundamental ways on the Cortex-M series to ‘Disable Interrupts’, The method used by taskENTER_CRITICAL / portENTER_CRITICAL / portDISABLE_INTERRUPTS / vPortRaiseBASEPRI() doesn’t actually disable ALL interrupts, but only those interrupts that can interact with FreeRTOS, but leaves any higher priority interrupts enabled. This allows the FreeRTS kernel to work with its core variables and not get sidetracked with another operation that needs them. It also allows for any very urgent operations the program may have to continue. The difference between the ENTER_CRITICAL and DISABLE_INTERRUPTS is that the critical section routines handle possible nesting, while the disable interrupts is a bit faster but assumes no nesting.
The second method, used by __disable_irq() actually turns off the whole IRQ system, so blocking even those possibly ultra urgent ISRs that don’t interact with FreeRTOS. I don’t think FreeRTOS ever calls this, but the application can if it needs a short critical section protected even from those interrupts for its own needs.
I’m going to disable interrupts in the
That probably wants __disable_irq(), but portDISABLE_INTERRUPTS() may also be good enough, it really depends on what you need done with the ultra high priority interrupts (if you have any),