diff --git a/Makefile.dep b/Makefile.dep index cc20a614d3..d2ccffeaec 100644 --- a/Makefile.dep +++ b/Makefile.dep @@ -205,10 +205,6 @@ ifneq (,$(filter newlib,$(USEMODULE))) USEMODULE += uart_stdio endif -ifneq (,$(filter uart0,$(USEMODULE))) - USEMODULE += posix -endif - ifneq (,$(filter posix,$(USEMODULE))) USEMODULE += timex USEMODULE += vtimer diff --git a/boards/msba2-common/drivers/include/uart0.h b/boards/msba2-common/drivers/include/uart0.h deleted file mode 100644 index 24a22b99c7..0000000000 --- a/boards/msba2-common/drivers/include/uart0.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2014 Kaspar Schleiser - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -#ifndef UART0_H_ -#define UART0_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -extern kernel_pid_t uart0_handler_pid; - -#ifdef __cplusplus -} -#endif - -#endif /* UART0_H */ diff --git a/cpu/arm7_common/include/arm_cpu.h b/cpu/arm7_common/include/arm_cpu.h index f5347fba3c..d883753fae 100644 --- a/cpu/arm7_common/include/arm_cpu.h +++ b/cpu/arm7_common/include/arm_cpu.h @@ -27,18 +27,6 @@ uint32_t get_system_speed(void); void cpu_clock_scale(uint32_t source, uint32_t target, uint32_t *prescale); void arm_reset(void); -void stdio_flush(void); - -/** - * @brief Writes an array of characters to the UART0 device - * - * @param[in] astring The string to write - * @param[in] length Length of the string - * - * @returns Always @p length - */ -int uart0_puts(char *astring, int length); - #ifdef __cplusplus } diff --git a/dist/Makefile b/dist/Makefile index 71d06736f2..c330667b81 100644 --- a/dist/Makefile +++ b/dist/Makefile @@ -33,7 +33,6 @@ QUIET ?= 1 # Modules to include: #USEMODULE += shell -#USEMODULE += uart0 #USEMODULE += posix #USEMODULE += vtimer diff --git a/examples/default/README.md b/examples/default/README.md index f52eac934f..a5fb53e112 100644 --- a/examples/default/README.md +++ b/examples/default/README.md @@ -14,10 +14,6 @@ shell commands. These are included via the `shell_commands` module. Additionally, the `ps` module which provides the `ps` shell command is included. -Finally, in order for the shell to receive input, the `uart0` module -is used. - - Usage ===== @@ -71,7 +67,6 @@ Running the `ps` command on an msba2: 2014-05-09 17:38:33,394 - INFO # pid | name | state Q | pri | stack ( used) location 2014-05-09 17:38:33,401 - INFO # 0 | idle | pending Q | 31 | 160 ( 148) 0x40000014 2014-05-09 17:38:33,407 - INFO # 1 | main | running Q | 15 | 2560 ( 848) 0x400000b4 -2014-05-09 17:38:33,414 - INFO # 2 | uart0 | bl rx _ | 14 | 512 ( 296) 0x40000ce0 2014-05-09 17:38:33,431 - INFO # | SUM | | | 4256 ``` diff --git a/sys/auto_init/auto_init.c b/sys/auto_init/auto_init.c index a4b0641ef7..e150c54944 100644 --- a/sys/auto_init/auto_init.c +++ b/sys/auto_init/auto_init.c @@ -36,10 +36,6 @@ #include "ltc4150.h" #endif -#ifdef MODULE_UART0 -#include "board_uart0.h" -#endif - #ifdef MODULE_MCI #include "diskio.h" #endif @@ -103,12 +99,6 @@ void auto_init(void) DEBUG("Auto init vtimer module.\n"); vtimer_init(); #endif -#ifndef MODULE_UART_STDIO -#ifdef MODULE_UART0 - DEBUG("Auto init uart0 module.\n"); - board_uart0_init(); -#endif -#endif #ifdef MODULE_XTIMER DEBUG("Auto init xtimer module.\n"); xtimer_init(); diff --git a/sys/include/board_uart0.h b/sys/include/board_uart0.h deleted file mode 100644 index 59a83ffa73..0000000000 --- a/sys/include/board_uart0.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2010 Freie Universität Berlin - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - - -/** - * @defgroup sys_uart0 UART0 - * @ingroup sys - * @brief UART0 interface abstraction - * @{ - * - * @file - * @brief Interface definitions for the UART0 abstraction - */ - -#ifndef __BOARD_UART0_H -#define __BOARD_UART0_H - -#include "kernel_types.h" -#include "cpu.h" /* To give user access to UART0_BUFSIZE */ -#include "cpu_conf.h" /* Some CPUs define this in cpu_conf.h... */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Process identifier for the UART0 module. - */ -extern kernel_pid_t uart0_handler_pid; - -/** - * @brief Initialize and starts the UART0 handler. - */ -void board_uart0_init(void); - -/** - * @brief To be called from the uart interrupt handler for every incoming - * character. - * - * @param[in] c The received character. - */ -void uart0_handle_incoming(int c); - -/** - * @brief Notify the chardev thread that new characters are available in the - * ringbuffer. - */ -void uart0_notify_thread(void); - -/** - * @brief Reads one character from the ringbuffer. - * - * @returns The first available character from the ringbuffer. - */ -int uart0_readc(void); - -/** - * @brief Wrapper to putchar. - * - * @param[in] c The character to put on the UART. - */ -int uart0_putc(int c); - -#ifdef __cplusplus -} -#endif - -/** @} */ -#endif /* __BOARD_UART0_H */ diff --git a/sys/posix/fd.c b/sys/posix/fd.c index 520efb10c7..9a1580e73e 100644 --- a/sys/posix/fd.c +++ b/sys/posix/fd.c @@ -21,9 +21,6 @@ #include #include "posix_io.h" -#ifdef MODULE_UART0 -#include "board_uart0.h" -#endif #include "unistd.h" #include "fd.h" @@ -40,19 +37,6 @@ int fd_init(void) { memset(fd_table, 0, sizeof(fd_t) * FD_MAX); -#ifdef MODULE_UART0 - posix_open(uart0_handler_pid, 0); - fd_t fd = { - .internal_active = 1, - .internal_fd = (int)uart0_handler_pid, - .read = (ssize_t ( *)(int, void *, size_t))posix_read, - .write = (ssize_t ( *)(int, const void *, size_t))posix_write, - .close = posix_close - }; - memcpy(&fd_table[STDIN_FILENO], &fd, sizeof(fd_t)); - memcpy(&fd_table[STDOUT_FILENO], &fd, sizeof(fd_t)); - memcpy(&fd_table[STDERR_FILENO], &fd, sizeof(fd_t)); -#endif return FD_MAX; } diff --git a/sys/uart0/Makefile b/sys/uart0/Makefile deleted file mode 100644 index 48422e909a..0000000000 --- a/sys/uart0/Makefile +++ /dev/null @@ -1 +0,0 @@ -include $(RIOTBASE)/Makefile.base diff --git a/sys/uart0/uart0.c b/sys/uart0/uart0.c deleted file mode 100644 index 5c115a6f7e..0000000000 --- a/sys/uart0/uart0.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (C) 2013 INRIA - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup sys - * @{ - * - * @file - * @brief UART implementation - * - * @author Oliver Hahm - * @author Ludwig Ortmann - * - * @} - */ - -#include - -#include "kernel_types.h" -#include "board_uart0.h" - -kernel_pid_t uart0_handler_pid = KERNEL_PID_UNDEF; - -#ifdef MODULE_UART_STDIO - -#include "uart_stdio.h" - -void board_uart0_init(void){} -int uart0_readc(void) -{ - char c = 0; - uart_stdio_read(&c, 1); - return c; -} -#else - -#include "cpu_conf.h" -#include "chardev_thread.h" -#include "ringbuffer.h" -#include "thread.h" -#include "msg.h" -#include "posix_io.h" -#include "irq.h" - -#ifndef UART0_BUFSIZE -#define UART0_BUFSIZE (128) -#endif - -/* increase when ENABLE_DEBUG in chardev_thread is set to 1! */ -#define UART0_STACKSIZE (THREAD_STACKSIZE_DEFAULT) - -ringbuffer_t uart0_ringbuffer; - -static char buffer[UART0_BUFSIZE]; - -static char uart0_thread_stack[UART0_STACKSIZE]; - -void board_uart0_init(void) -{ - ringbuffer_init(&uart0_ringbuffer, buffer, UART0_BUFSIZE); - kernel_pid_t pid = thread_create( - uart0_thread_stack, - sizeof(uart0_thread_stack), - THREAD_PRIORITY_MAIN - 1, - CREATE_STACKTEST | CREATE_SLEEPING, - chardev_thread_entry, - &uart0_ringbuffer, - "uart0" - ); - uart0_handler_pid = pid; - thread_wakeup(pid); - puts("uart0_init() [OK]"); -} - -void uart0_handle_incoming(int c) -{ - ringbuffer_add_one(&uart0_ringbuffer, c); -} - -void uart0_notify_thread(void) -{ - msg_t m; - m.type = 0; - msg_send_int(&m, uart0_handler_pid); -} - -int uart0_readc(void) -{ - char c = 0; - posix_read(uart0_handler_pid, &c, 1); - return c; -} -#endif - -int uart0_putc(int c) -{ - return putchar(c); -} diff --git a/sys/uart_stdio/uart_stdio.c b/sys/uart_stdio/uart_stdio.c index 9cb4c1712d..08e1cda2a3 100644 --- a/sys/uart_stdio/uart_stdio.c +++ b/sys/uart_stdio/uart_stdio.c @@ -34,12 +34,21 @@ #include "periph/uart.h" #include "board.h" +#include "periph/uart.h" #define ENABLE_DEBUG 0 #include "debug.h" +#ifndef STDIO +#define STDIO (0) +#endif + +#ifndef STDIO_BAUDRATE +#define STDIO_BAUDRATE (115200) +#endif + #ifndef STDIO_RX_BUFSIZE -#define STDIO_RX_BUFSIZE (64) +#define STDIO_RX_BUFSIZE (64) #endif /**