File tree 2 files changed +10
-1
lines changed
hardware/esp8266com/esp8266
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,8 @@ extern "C" void __yield() {
88
88
extern " C" void yield (void ) __attribute__ ((weak, alias(" __yield" )));
89
89
90
90
extern " C" void optimistic_yield () {
91
- if (system_get_time () - g_micros_at_last_task_yield > OPTIMISTIC_YIELD_TIME_US)
91
+ if (!ETS_INTR_WITHINISR () &&
92
+ (system_get_time () - g_micros_at_last_task_yield) > OPTIMISTIC_YIELD_TIME_US)
92
93
{
93
94
__yield ();
94
95
}
Original file line number Diff line number Diff line change @@ -61,6 +61,14 @@ typedef void (*int_handler_t)(void*);
61
61
#define ETS_INTR_DISABLE (inum ) \
62
62
ets_isr_mask((1<<inum))
63
63
64
+ inline bool ETS_INTR_WITHINISR ()
65
+ {
66
+ uint32_t ps ;
67
+ __asm__ __volatile__("rsr %0,ps" :"=a" (ps ));
68
+ // PS.EXCM and PS.UM bit checks
69
+ return ((ps & ((1 << 4 ) | (1 << 5 ))) > 0 );
70
+ }
71
+
64
72
inline uint32_t ETS_INTR_ENABLED (void )
65
73
{
66
74
uint32_t enabled ;
You can’t perform that action at this time.
0 commit comments