File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 2424#include < hardware/sync.h>
2525#include < map>
2626
27+ // FreeRTOS potential includes
28+ extern void taskEXIT_CRITICAL () __attribute__((weak));
29+ extern void taskENTER_CRITICAL () __attribute__((weak));
30+
2731// Support nested IRQ disable/re-enable
2832#ifndef maxIRQs
2933#define maxIRQs 15
@@ -32,22 +36,30 @@ static uint32_t _irqStackTop[2] = { 0, 0 };
3236static uint32_t _irqStack[2 ][maxIRQs];
3337
3438extern " C" void interrupts () {
39+ if (__freeRTOSinitted){
40+ taskEXIT_CRITICAL ();
41+ } else {
3542 auto core = get_core_num ();
3643 if (!_irqStackTop[core]) {
3744 // ERROR
3845 return ;
3946 }
4047 restore_interrupts (_irqStack[core][--_irqStackTop[core]]);
48+ }
4149}
4250
4351extern " C" void noInterrupts () {
52+ if (__freeRTOSinitted) {
53+ taskENTER_CRITICAL ();
54+ } else {
4455 auto core = get_core_num ();
4556 if (_irqStackTop[core] == maxIRQs) {
4657 // ERROR
4758 panic (" IRQ stack overflow" );
4859 }
4960
5061 _irqStack[core][_irqStackTop[core]++] = save_and_disable_interrupts ();
62+ }
5163}
5264
5365// Only 1 GPIO IRQ callback for all pins, so we need to look at the pin it's for and
You can’t perform that action at this time.
0 commit comments