esp32/uart: Use core-provided mp_keyboard_interrupt, placed in IRAM.

This commit is contained in:
Damien George 2020-02-07 12:11:22 +11:00
parent 8d0421c3cf
commit f4641b2378
2 changed files with 5 additions and 8 deletions

View File

@ -260,6 +260,9 @@ void *esp_native_code_commit(void*, size_t, void*);
} while (0);
#endif
// Functions that should go in IRAM
#define MICROPY_WRAP_MP_KEYBOARD_INTERRUPT(f) IRAM_ATTR f
#define UINT_FMT "%u"
#define INT_FMT "%d"

View File

@ -30,7 +30,7 @@
#include "driver/uart.h"
#include "py/mpstate.h"
#include "py/runtime.h"
#include "py/mphal.h"
STATIC void uart_irq_handler(void *arg);
@ -50,13 +50,7 @@ STATIC void IRAM_ATTR uart_irq_handler(void *arg) {
while (uart->status.rxfifo_cnt) {
uint8_t c = uart->fifo.rw_byte;
if (c == mp_interrupt_char) {
// inline version of mp_keyboard_interrupt();
MP_STATE_VM(mp_pending_exception) = MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception));
#if MICROPY_ENABLE_SCHEDULER
if (MP_STATE_VM(sched_state) == MP_SCHED_IDLE) {
MP_STATE_VM(sched_state) = MP_SCHED_PENDING;
}
#endif
mp_keyboard_interrupt();
} else {
// this is an inline function so will be in IRAM
ringbuf_put(&stdin_ringbuf, c);