File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 4545// Interfaces for the main core to use FreeRTOS mutexes
4646extern " C" {
4747 extern volatile bool __otherCoreIdled;
48+ static UBaseType_t __savedIrqs[configNUMBER_OF_CORES];
4849
4950 SemaphoreHandle_t __freertos_mutex_create () {
5051 return xSemaphoreCreateMutex ();
@@ -93,11 +94,19 @@ extern "C" {
9394 }
9495
9596 void __freertos_task_exit_critical () {
96- taskEXIT_CRITICAL ();
97+ if (portGET_CRITICAL_NESTING_COUNT () == 1U && portCHECK_IF_IN_ISR ()) {
98+ taskEXIT_CRITICAL_FROM_ISR (__savedIrqs[portGET_CORE_ID ()]);
99+ } else {
100+ taskEXIT_CRITICAL ();
101+ }
97102 }
98103
99104 void __freertos_task_enter_critical () {
100- taskENTER_CRITICAL ();
105+ if (portGET_CRITICAL_NESTING_COUNT () == 0U && portCHECK_IF_IN_ISR ()) {
106+ __savedIrqs[portGET_CORE_ID ()] = taskENTER_CRITICAL_FROM_ISR ();
107+ } else {
108+ taskENTER_CRITICAL ();
109+ }
101110 }
102111}
103112
You can’t perform that action at this time.
0 commit comments