summaryrefslogtreecommitdiff
path: root/zephyr/src
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/src')
-rw-r--r--zephyr/src/zephyr_getchar.c12
-rw-r--r--zephyr/src/zephyr_start.c25
2 files changed, 35 insertions, 2 deletions
diff --git a/zephyr/src/zephyr_getchar.c b/zephyr/src/zephyr_getchar.c
index 3a1898a60..89e3e0efb 100644
--- a/zephyr/src/zephyr_getchar.c
+++ b/zephyr/src/zephyr_getchar.c
@@ -20,6 +20,9 @@
#include <misc/printk.h>
#include "zephyr_getchar.h"
+extern int mp_interrupt_char;
+void mp_keyboard_interrupt(void);
+
static struct nano_sem uart_sem;
#define UART_BUFSIZE 256
static uint8_t uart_ringbuf[UART_BUFSIZE];
@@ -32,8 +35,13 @@ static int console_irq_input_hook(struct device *dev, uint8_t ch)
printk("UART buffer overflow - char dropped\n");
return 1;
}
- uart_ringbuf[i_put] = ch;
- i_put = i_next;
+ if (ch == mp_interrupt_char) {
+ mp_keyboard_interrupt();
+ return 1;
+ } else {
+ uart_ringbuf[i_put] = ch;
+ i_put = i_next;
+ }
//printk("%x\n", ch);
nano_isr_sem_give(&uart_sem);
return 1;
diff --git a/zephyr/src/zephyr_start.c b/zephyr/src/zephyr_start.c
index b490cc770..9e8a90beb 100644
--- a/zephyr/src/zephyr_start.c
+++ b/zephyr/src/zephyr_start.c
@@ -1,3 +1,28 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Linaro Limited
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
#include <zephyr.h>
#include "zephyr_getchar.h"