1- What's the difference between taskEnterCritical, portEnterCritical and portDISABLE_INTERRUPTS API functions?
2- Suppose i have the following Task and IRQ handler in my running program:
IRQHandler /* Priority supposed to be above MAXSYSCALLINTERRUPTPRIORITY */
flag = TRUE;
bool mysecflag = FALSE;
portDISABLEINTERRUPTS(); /* Whitch API should i use? portDISABLE, taskENTERCRITICAL? */
mysecflag = flag;
if (mysecflag == TRUE)
mysecflag = FALSE
3- Does freertos mask some interrupts priority level in a Cortex M0+? or it enables and disables global interrupts?
Thanks in advance
1- What's the difference between taskEnterCritical, portEnterCritical
taskENTERCRITICAL() is a macro that calls portENTERCRITICAL() - the idea being that things that start 'task' are part of the API and things that call 'port' are not meant to be public functions. There is nothing to stop you calling the 'port' version - it will do exactly the same thing. Also the naming convention falls down a bit when it comes to macros like portYIELDFROMISR(), for which there is no 'task' equivalent.
and portDISABLE_INTERRUPTS API functions?
That is not part of the public API and should not really be called. It does not handle nesting so can break the nesting if any exists.
The M0+ does not have a basepri register like the Cortex-M3/4/7 so global interrupt enable/disable is used.