Hi folks:
the “taskENTER_CRITICAL” and “taskEXIT_CRITICAL” implementation on FreeRTOS are with void return and void parameter, so it cant backup each critical level cpu status in stack and then restore from stack.
may be in order to deal with the nest use scenario, these two functions imle with a nest counter in each TCB so that each task can remeber the nesting level of critical regison and then restore the cpu interrupt status.
but, did this identical with the return status version like others ? for example, another impl. with retun status is:
u32 enter_critical_section(void)
{
status = get_cpsr();
............
return status;
}
u32 leave_critical_section(u32 sr)
{
set_cpsr(sr);
}
the advantange of this is, if there are not only a interrupt flag(interrupt enable control bit in this situation) ,each critical level could have his own version of flag, which should identical with the value befre enter criticaon after this leve critical section exited.
so, maybe the global nesting counter cant do this.
so, can i have your opinion on this point, can the two impl. be identical in some degree?
or they have essential difference?
thank you!