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 45
45
// Interfaces for the main core to use FreeRTOS mutexes
46
46
extern " C" {
47
47
extern volatile bool __otherCoreIdled;
48
+ static UBaseType_t __savedIrqs[configNUMBER_OF_CORES];
48
49
49
50
SemaphoreHandle_t __freertos_mutex_create () {
50
51
return xSemaphoreCreateMutex ();
@@ -93,11 +94,19 @@ extern "C" {
93
94
}
94
95
95
96
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
+ }
97
102
}
98
103
99
104
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
+ }
101
110
}
102
111
}
103
112
You can’t perform that action at this time.
0 commit comments