aboutsummaryrefslogtreecommitdiff
path: root/zephyr/src
diff options
context:
space:
mode:
authorDamien George2017-09-06 13:40:51 +1000
committerDamien George2017-09-06 13:40:51 +1000
commit01dd7804b87d60b2deab16712eccb3b97351a9b7 (patch)
tree1aa21f38a872b8e62a3d4e4f74f68033c6f827e4 /zephyr/src
parenta9862b30068fc9df1022f08019fb35aaa5085f64 (diff)
ports: Make new ports/ sub-directory and move all ports there.
This is to keep the top-level directory clean, to make it clear what is core and what is a port, and to allow the repository to grow with new ports in a sustainable way.
Diffstat (limited to 'zephyr/src')
-rw-r--r--zephyr/src/Makefile17
-rw-r--r--zephyr/src/zephyr_getchar.c65
-rw-r--r--zephyr/src/zephyr_getchar.h20
-rw-r--r--zephyr/src/zephyr_start.c34
4 files changed, 0 insertions, 136 deletions
diff --git a/zephyr/src/Makefile b/zephyr/src/Makefile
deleted file mode 100644
index 36dd8c64e..000000000
--- a/zephyr/src/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Copyright (c) 2016 Intel Corporation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-obj-y += zephyr_start.o zephyr_getchar.o
diff --git a/zephyr/src/zephyr_getchar.c b/zephyr/src/zephyr_getchar.c
deleted file mode 100644
index 52b3394d0..000000000
--- a/zephyr/src/zephyr_getchar.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2016 Linaro
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <zephyr.h>
-#include <uart.h>
-#include <drivers/console/uart_console.h>
-#include <misc/printk.h>
-#include "zephyr_getchar.h"
-
-extern int mp_interrupt_char;
-void mp_keyboard_interrupt(void);
-
-static struct k_sem uart_sem;
-#define UART_BUFSIZE 256
-static uint8_t uart_ringbuf[UART_BUFSIZE];
-static uint8_t i_get, i_put;
-
-static int console_irq_input_hook(uint8_t ch)
-{
- int i_next = (i_put + 1) & (UART_BUFSIZE - 1);
- if (i_next == i_get) {
- printk("UART buffer overflow - char dropped\n");
- return 1;
- }
- if (ch == mp_interrupt_char) {
- mp_keyboard_interrupt();
- return 1;
- } else {
- uart_ringbuf[i_put] = ch;
- i_put = i_next;
- }
- //printk("%x\n", ch);
- k_sem_give(&uart_sem);
- k_yield();
- return 1;
-}
-
-uint8_t zephyr_getchar(void) {
- k_sem_take(&uart_sem, K_FOREVER);
- unsigned int key = irq_lock();
- uint8_t c = uart_ringbuf[i_get++];
- i_get &= UART_BUFSIZE - 1;
- irq_unlock(key);
- return c;
-}
-
-void zephyr_getchar_init(void) {
- k_sem_init(&uart_sem, 0, UINT_MAX);
- uart_console_in_debug_hook_install(console_irq_input_hook);
- // All NULLs because we're interested only in the callback above
- uart_register_input(NULL, NULL, NULL);
-}
diff --git a/zephyr/src/zephyr_getchar.h b/zephyr/src/zephyr_getchar.h
deleted file mode 100644
index fb5f19a7b..000000000
--- a/zephyr/src/zephyr_getchar.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (c) 2016 Linaro
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdint.h>
-
-void zephyr_getchar_init(void);
-uint8_t zephyr_getchar(void);
diff --git a/zephyr/src/zephyr_start.c b/zephyr/src/zephyr_start.c
deleted file mode 100644
index 9e8a90beb..000000000
--- a/zephyr/src/zephyr_start.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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"
-
-int real_main(void);
-
-void main(void) {
- zephyr_getchar_init();
- real_main();
-}