all: Rename mp_keyboard_interrupt to mp_sched_keyboard_interrupt.
To match mp_sched_exception() and mp_sched_schedule(). Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
bd54eb566f
commit
e9e9c76ddf
|
@ -133,7 +133,7 @@ int mp_uos_dupterm_rx_chr(void) {
|
|||
nlr_pop();
|
||||
if (buf[0] == mp_interrupt_char) {
|
||||
// Signal keyboard interrupt to be raised as soon as the VM resumes
|
||||
mp_keyboard_interrupt();
|
||||
mp_sched_keyboard_interrupt();
|
||||
return -2;
|
||||
}
|
||||
return buf[0];
|
||||
|
|
|
@ -250,7 +250,7 @@ STATIC void UARTGenericIntHandler(uint32_t uart_id) {
|
|||
int data = MAP_UARTCharGetNonBlocking(self->reg);
|
||||
if (MP_STATE_PORT(os_term_dup_obj) && MP_STATE_PORT(os_term_dup_obj)->stream_o == self && data == mp_interrupt_char) {
|
||||
// raise an exception when interrupts are finished
|
||||
mp_keyboard_interrupt();
|
||||
mp_sched_keyboard_interrupt();
|
||||
} else { // there's always a read buffer available
|
||||
uint16_t next_head = (self->read_buf_head + 1) % PYBUART_RX_BUFFER_LEN;
|
||||
if (next_head != self->read_buf_tail) {
|
||||
|
|
|
@ -446,7 +446,7 @@ static void telnet_parse_input (uint8_t *str, int16_t *len) {
|
|||
if (*_str <= 127) {
|
||||
if (telnet_data.state == E_TELNET_STE_LOGGED_IN && *_str == mp_interrupt_char) {
|
||||
// raise a keyboard exception
|
||||
mp_keyboard_interrupt();
|
||||
mp_sched_keyboard_interrupt();
|
||||
(*len)--;
|
||||
_str++;
|
||||
}
|
||||
|
|
|
@ -265,7 +265,7 @@ void *esp_native_code_commit(void *, size_t, void *);
|
|||
|
||||
// Functions that should go in IRAM
|
||||
#define MICROPY_WRAP_MP_SCHED_EXCEPTION(f) IRAM_ATTR f
|
||||
#define MICROPY_WRAP_MP_KEYBOARD_INTERRUPT(f) IRAM_ATTR f
|
||||
#define MICROPY_WRAP_MP_SCHED_KEYBOARD_INTERRUPT(f) IRAM_ATTR f
|
||||
|
||||
#define UINT_FMT "%u"
|
||||
#define INT_FMT "%d"
|
||||
|
|
|
@ -55,7 +55,7 @@ STATIC void IRAM_ATTR uart_irq_handler(void *arg) {
|
|||
uint8_t c = READ_PERI_REG(UART_FIFO_AHB_REG(0)); // UART0
|
||||
#endif
|
||||
if (c == mp_interrupt_char) {
|
||||
mp_keyboard_interrupt();
|
||||
mp_sched_keyboard_interrupt();
|
||||
} else {
|
||||
// this is an inline function so will be in IRAM
|
||||
ringbuf_put(&stdin_ringbuf, c);
|
||||
|
|
|
@ -50,7 +50,7 @@ static void usb_callback_rx(int itf, cdcacm_event_t *event) {
|
|||
}
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
if (usb_rx_buf[i] == mp_interrupt_char) {
|
||||
mp_keyboard_interrupt();
|
||||
mp_sched_keyboard_interrupt();
|
||||
} else {
|
||||
ringbuf_put(&stdin_ringbuf, usb_rx_buf[i]);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "lib/utils/interrupt_char.h"
|
||||
#include "xtirq.h"
|
||||
|
||||
void mp_keyboard_interrupt(void);
|
||||
void mp_sched_keyboard_interrupt(void);
|
||||
|
||||
struct _mp_print_t;
|
||||
// Structure for UART-only output via mp_printf()
|
||||
|
|
|
@ -196,7 +196,7 @@ extern const struct _mp_obj_module_t mp_module_onewire;
|
|||
|
||||
#define MP_FASTCODE(n) __attribute__((section(".iram0.text." #n))) n
|
||||
#define MICROPY_WRAP_MP_SCHED_EXCEPTION(f) MP_FASTCODE(f)
|
||||
#define MICROPY_WRAP_MP_KEYBOARD_INTERRUPT(f) MP_FASTCODE(f)
|
||||
#define MICROPY_WRAP_MP_SCHED_KEYBOARD_INTERRUPT(f) MP_FASTCODE(f)
|
||||
#define MICROPY_WRAP_MP_SCHED_SCHEDULE(f) MP_FASTCODE(f)
|
||||
|
||||
#define WDEV_HWRNG ((volatile uint32_t *)0x3ff20e44)
|
||||
|
|
|
@ -42,7 +42,7 @@ static ringbuf_t uart_ringbuf = {uart_ringbuf_array, sizeof(uart_ringbuf_array),
|
|||
static void uart0_rx_intr_handler(void *para);
|
||||
|
||||
void soft_reset(void);
|
||||
void mp_keyboard_interrupt(void);
|
||||
void mp_sched_keyboard_interrupt(void);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : uart_config
|
||||
|
@ -179,7 +179,7 @@ static void uart0_rx_intr_handler(void *para) {
|
|||
// directly on stdin_ringbuf, rather than going via uart_ringbuf
|
||||
if (uart_attached_to_dupterm) {
|
||||
if (RcvChar == mp_interrupt_char) {
|
||||
mp_keyboard_interrupt();
|
||||
mp_sched_keyboard_interrupt();
|
||||
} else {
|
||||
ringbuf_put(&stdin_ringbuf, RcvChar);
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ void ICACHE_FLASH_ATTR uart_task_handler(os_event_t *evt) {
|
|||
int c, ret = 0;
|
||||
while ((c = ringbuf_get(&stdin_ringbuf)) >= 0) {
|
||||
if (c == mp_interrupt_char) {
|
||||
mp_keyboard_interrupt();
|
||||
mp_sched_keyboard_interrupt();
|
||||
}
|
||||
ret = pyexec_event_repl_process_char(c);
|
||||
if (ret & PYEXEC_FORCED_EXIT) {
|
||||
|
|
|
@ -51,7 +51,7 @@ OBJ = $(PY_O)
|
|||
OBJ += $(addprefix $(BUILD)/, $(SRC_LIB:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
||||
|
||||
JSFLAGS = -O0 -s EXPORTED_FUNCTIONS="['_mp_js_init', '_mp_js_init_repl', '_mp_js_do_str', '_mp_js_process_char', '_mp_hal_get_interrupt_char', '_mp_keyboard_interrupt']" -s EXTRA_EXPORTED_RUNTIME_METHODS="['ccall', 'cwrap']" -s "BINARYEN_TRAP_MODE='clamp'" --memory-init-file 0 --js-library library.js
|
||||
JSFLAGS = -O0 -s EXPORTED_FUNCTIONS="['_mp_js_init', '_mp_js_init_repl', '_mp_js_do_str', '_mp_js_process_char', '_mp_hal_get_interrupt_char', '_mp_sched_keyboard_interrupt']" -s EXTRA_EXPORTED_RUNTIME_METHODS="['ccall', 'cwrap']" -s "BINARYEN_TRAP_MODE='clamp'" --memory-init-file 0 --js-library library.js
|
||||
|
||||
all: $(BUILD)/micropython.js
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ mergeInto(LibraryManager.library, {
|
|||
var n = fs.readSync(process.stdin.fd, buf, 0, 1);
|
||||
if (n > 0) {
|
||||
if (buf[0] == mp_interrupt_char) {
|
||||
Module.ccall('mp_keyboard_interrupt', 'null', ['null'], ['null']);
|
||||
Module.ccall('mp_sched_keyboard_interrupt', 'null', ['null'], ['null']);
|
||||
} else {
|
||||
process.stdout.write(String.fromCharCode(buf[0]));
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ void tud_cdc_rx_wanted_cb(uint8_t itf, char wanted_char) {
|
|||
(void)itf;
|
||||
(void)wanted_char;
|
||||
tud_cdc_read_char(); // discard interrupt char
|
||||
mp_keyboard_interrupt();
|
||||
mp_sched_keyboard_interrupt();
|
||||
}
|
||||
|
||||
void mp_hal_set_interrupt_char(int c) {
|
||||
|
|
|
@ -193,7 +193,7 @@ STATIC void gatts_event_handler(mp_obj_t self_in, uint16_t event_id, uint16_t at
|
|||
for (uint16_t i = 0; i < length; i++) {
|
||||
#if MICROPY_KBD_EXCEPTION
|
||||
if (data[i] == mp_interrupt_char) {
|
||||
mp_keyboard_interrupt();
|
||||
mp_sched_keyboard_interrupt();
|
||||
m_rx_ring_buffer.start = 0;
|
||||
m_rx_ring_buffer.end = 0;
|
||||
} else
|
||||
|
|
|
@ -128,7 +128,7 @@ STATIC void uart_event_handler(nrfx_uart_event_t const *p_event, void *p_context
|
|||
nrfx_uart_rx(self->p_uart, &self->buf->rx_buf[0], 1);
|
||||
#if !MICROPY_PY_BLE_NUS && MICROPY_KBD_EXCEPTION
|
||||
if (chr == mp_interrupt_char) {
|
||||
mp_keyboard_interrupt();
|
||||
mp_sched_keyboard_interrupt();
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
|
|
|
@ -52,7 +52,7 @@ void tud_cdc_rx_wanted_cb(uint8_t itf, char wanted_char) {
|
|||
(void)itf;
|
||||
(void)wanted_char;
|
||||
tud_cdc_read_char(); // discard interrupt char
|
||||
mp_keyboard_interrupt();
|
||||
mp_sched_keyboard_interrupt();
|
||||
}
|
||||
|
||||
void mp_hal_set_interrupt_char(int c) {
|
||||
|
|
|
@ -41,7 +41,7 @@ void uart_irq(void) {
|
|||
int c = uart_getc(uart_default);
|
||||
#if MICROPY_KBD_EXCEPTION
|
||||
if (c == mp_interrupt_char) {
|
||||
mp_keyboard_interrupt();
|
||||
mp_sched_keyboard_interrupt();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -35,7 +35,7 @@ void tud_cdc_rx_wanted_cb(uint8_t itf, char wanted_char) {
|
|||
(void)itf;
|
||||
(void)wanted_char;
|
||||
tud_cdc_read_char(); // discard interrupt char
|
||||
mp_keyboard_interrupt();
|
||||
mp_sched_keyboard_interrupt();
|
||||
}
|
||||
|
||||
void mp_hal_set_interrupt_char(int c) {
|
||||
|
|
|
@ -61,7 +61,7 @@ void pendsv_init(void) {
|
|||
// thread.
|
||||
void pendsv_kbd_intr(void) {
|
||||
if (MP_STATE_VM(mp_pending_exception) == MP_OBJ_NULL) {
|
||||
mp_keyboard_interrupt();
|
||||
mp_sched_keyboard_interrupt();
|
||||
} else {
|
||||
MP_STATE_VM(mp_pending_exception) = MP_OBJ_NULL;
|
||||
pendsv_object = &MP_STATE_VM(mp_kbd_exception);
|
||||
|
|
|
@ -483,7 +483,7 @@ STATIC mp_obj_t extra_coverage(void) {
|
|||
}
|
||||
|
||||
// setting the keyboard interrupt and raising it during mp_handle_pending
|
||||
mp_keyboard_interrupt();
|
||||
mp_sched_keyboard_interrupt();
|
||||
nlr_buf_t nlr;
|
||||
if (nlr_push(&nlr) == 0) {
|
||||
mp_handle_pending(true);
|
||||
|
@ -493,13 +493,13 @@ STATIC mp_obj_t extra_coverage(void) {
|
|||
}
|
||||
|
||||
// setting the keyboard interrupt (twice) and cancelling it during mp_handle_pending
|
||||
mp_keyboard_interrupt();
|
||||
mp_keyboard_interrupt();
|
||||
mp_sched_keyboard_interrupt();
|
||||
mp_sched_keyboard_interrupt();
|
||||
mp_handle_pending(false);
|
||||
|
||||
// setting keyboard interrupt and a pending event (intr should be handled first)
|
||||
mp_sched_schedule(MP_OBJ_FROM_PTR(&mp_builtin_print_obj), MP_OBJ_NEW_SMALL_INT(10));
|
||||
mp_keyboard_interrupt();
|
||||
mp_sched_keyboard_interrupt();
|
||||
if (nlr_push(&nlr) == 0) {
|
||||
mp_handle_pending(true);
|
||||
nlr_pop();
|
||||
|
|
|
@ -58,7 +58,7 @@ STATIC void sighandler(int signum) {
|
|||
// this is the second time we are called, so die straight away
|
||||
exit(1);
|
||||
}
|
||||
mp_keyboard_interrupt();
|
||||
mp_sched_keyboard_interrupt();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ BOOL WINAPI console_sighandler(DWORD evt) {
|
|||
// this is the second time we are called, so die straight away
|
||||
exit(1);
|
||||
}
|
||||
mp_keyboard_interrupt();
|
||||
mp_sched_keyboard_interrupt();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "zephyr_getchar.h"
|
||||
|
||||
extern int mp_interrupt_char;
|
||||
void mp_keyboard_interrupt(void);
|
||||
void mp_sched_keyboard_interrupt(void);
|
||||
|
||||
static struct k_sem uart_sem;
|
||||
#define UART_BUFSIZE 256
|
||||
|
@ -36,7 +36,7 @@ static int console_irq_input_hook(uint8_t ch)
|
|||
return 1;
|
||||
}
|
||||
if (ch == mp_interrupt_char) {
|
||||
mp_keyboard_interrupt();
|
||||
mp_sched_keyboard_interrupt();
|
||||
return 1;
|
||||
} else {
|
||||
uart_ringbuf[i_put] = ch;
|
||||
|
|
|
@ -1508,8 +1508,8 @@ typedef double mp_float_t;
|
|||
#define MICROPY_WRAP_MP_SCHED_EXCEPTION(f) f
|
||||
#endif
|
||||
|
||||
#ifndef MICROPY_WRAP_MP_KEYBOARD_INTERRUPT
|
||||
#define MICROPY_WRAP_MP_KEYBOARD_INTERRUPT(f) f
|
||||
#ifndef MICROPY_WRAP_MP_SCHED_KEYBOARD_INTERRUPT
|
||||
#define MICROPY_WRAP_MP_SCHED_KEYBOARD_INTERRUPT(f) f
|
||||
#endif
|
||||
|
||||
#ifndef MICROPY_WRAP_MP_SCHED_SCHEDULE
|
||||
|
|
|
@ -65,7 +65,7 @@ void mp_init(void);
|
|||
void mp_deinit(void);
|
||||
|
||||
void mp_sched_exception(mp_obj_t exc);
|
||||
void mp_keyboard_interrupt(void);
|
||||
void mp_sched_keyboard_interrupt(void);
|
||||
void mp_handle_pending(bool raise_exc);
|
||||
void mp_handle_pending_tail(mp_uint_t atomic_state);
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ void mp_sched_exception(mp_obj_t exc) {
|
|||
|
||||
#if MICROPY_KBD_EXCEPTION
|
||||
// This function may be called asynchronously at any time so only do the bare minimum.
|
||||
void MICROPY_WRAP_MP_KEYBOARD_INTERRUPT(mp_keyboard_interrupt)(void) {
|
||||
void MICROPY_WRAP_MP_SCHED_KEYBOARD_INTERRUPT(mp_sched_keyboard_interrupt)(void) {
|
||||
MP_STATE_VM(mp_kbd_exception).traceback_data = NULL;
|
||||
mp_sched_exception(MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception)));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue