From 717e84f7b24a49ad4242cbc3d4c73e2cea8e3997 Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Thu, 5 Jul 2018 14:03:27 +0200 Subject: [PATCH 1/4] sys/stdio: factor out STDIO abstraction --- sys/include/stdio_base.h | 63 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 sys/include/stdio_base.h diff --git a/sys/include/stdio_base.h b/sys/include/stdio_base.h new file mode 100644 index 0000000000..e76bd2ff19 --- /dev/null +++ b/sys/include/stdio_base.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2015 Kaspar Schleiser + * 2018 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_stdio STDIO abstraction + * @ingroup sys + * + * @brief Simple standard input/output (STDIO) abstraction for RIOT + * + * @{ + * @file + * + * @author Kaspar Schleiser + * @author Hauke Petersen + */ + +#ifndef STDIO_BASE_H +#define STDIO_BASE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief initialize the module + */ +void stdio_init(void); + +/** + * @brief read @p len bytes from stdio uart into @p buffer + * + * @param[out] buffer buffer to read into + * @param[in] max_len nr of bytes to read + * + * @return nr of bytes read + * @return <0 on error + */ +ssize_t stdio_read(void* buffer, size_t max_len); + +/** + * @brief write @p len bytes from @p buffer into uart + * + * @param[in] buffer buffer to read from + * @param[in] len nr of bytes to write + * + * @return nr of bytes written + * @return <0 on error + */ +ssize_t stdio_write(const void* buffer, size_t len); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif /* STDIO_BASE_H */ From d55616a7f56ca17440ed5acd3b11771bcbcb3dbd Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Thu, 5 Jul 2018 14:04:17 +0200 Subject: [PATCH 2/4] sys/stdio: s/uart_stdio/stdio_uart/ --- Makefile.dep | 4 +- sys/include/stdio_uart.h | 59 +++++++++++++ sys/include/uart_stdio.h | 83 ------------------- sys/{uart_stdio => stdio_uart}/Makefile | 0 .../uart_stdio.c => stdio_uart/stdio_uart.c} | 52 ++++++------ 5 files changed, 88 insertions(+), 110 deletions(-) create mode 100644 sys/include/stdio_uart.h delete mode 100644 sys/include/uart_stdio.h rename sys/{uart_stdio => stdio_uart}/Makefile (100%) rename sys/{uart_stdio/uart_stdio.c => stdio_uart/stdio_uart.c} (56%) diff --git a/Makefile.dep b/Makefile.dep index cfeb10de38..7a4f918147 100644 --- a/Makefile.dep +++ b/Makefile.dep @@ -374,7 +374,7 @@ ifneq (,$(filter newlib,$(USEMODULE))) USEMODULE += newlib_syscalls_default endif ifeq (,$(filter rtt_stdio,$(USEMODULE))) - USEMODULE += uart_stdio + USEMODULE += stdio_uart endif endif @@ -390,7 +390,7 @@ ifneq (,$(filter rtt_stdio,$(USEMODULE))) USEMODULE += xtimer endif -ifneq (,$(filter uart_stdio,$(USEMODULE))) +ifneq (,$(filter stdio_uart,$(USEMODULE))) USEMODULE += isrpipe FEATURES_REQUIRED += periph_uart endif diff --git a/sys/include/stdio_uart.h b/sys/include/stdio_uart.h new file mode 100644 index 0000000000..bfe975c67e --- /dev/null +++ b/sys/include/stdio_uart.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2015 Kaspar Schleiser + * 2018 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_stdio_uart STDIO over UART + * @ingroup sys + * + * @brief Standard input/output backend using UART + * + * @{ + * @file + * + * @author Kaspar Schleiser + * @author Hauke Petersen + */ + +#ifndef STDIO_UART_H +#define STDIO_UART_H + +/* Boards may override the default STDIO UART device */ +#include "board.h" +#include "stdio_base.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef STDIO_UART_DEV +/** + * @brief UART device to use for STDIO + */ +#define STDIO_UART_DEV UART_DEV(0) +#endif + +#ifndef STDIO_UART_BAUDRATE +/** + * @brief Baudrate for STDIO + */ +#define STDIO_UART_BAUDRATE (115200) +#endif + +#ifndef STDIO_UART_RX_BUFSIZE +/** + * @brief Buffer size for STDIO + */ +#define STDIO_UART_RX_BUFSIZE (64) +#endif + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif /* STDIO_UART_H */ diff --git a/sys/include/uart_stdio.h b/sys/include/uart_stdio.h deleted file mode 100644 index 7363ea3850..0000000000 --- a/sys/include/uart_stdio.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2015 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. - */ - -/** - * @defgroup sys_uart_stdio UART stdio - * @ingroup sys - * - * @brief stdio init/read/write functions for UARTs - * - * @{ - * @file - * - * @author Kaspar Schleiser - */ -#ifndef UART_STDIO_H -#define UART_STDIO_H - -/* Boards may override the default STDIO UART device */ -#include -#include "board.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef UART_STDIO_DEV -/** - * @brief UART device to use for STDIO - */ -#define UART_STDIO_DEV UART_DEV(0) -#endif - -#ifndef UART_STDIO_BAUDRATE -/** - * @brief Baudrate for STDIO - */ -#define UART_STDIO_BAUDRATE (115200) -#endif - -#ifndef UART_STDIO_RX_BUFSIZE -/** - * @brief Buffer size for STDIO - */ -#define UART_STDIO_RX_BUFSIZE (64) -#endif - -/** - * @brief initialize the module - */ -void uart_stdio_init(void); - -/** - * @brief read @p len bytes from stdio uart into @p buffer - * - * @param[out] buffer buffer to read into - * @param[in] len nr of bytes to read - * - * @return nr of bytes read - * @return <0 on error - */ -int uart_stdio_read(char* buffer, int len); - -/** - * @brief write @p len bytes from @p buffer into uart - * - * @param[in] buffer buffer to read from - * @param[in] len nr of bytes to write - * - * @return nr of bytes written - * @return <0 on error - */ -int uart_stdio_write(const char* buffer, int len); - -#ifdef __cplusplus -} -#endif -/** @} */ -#endif /* UART_STDIO_H */ diff --git a/sys/uart_stdio/Makefile b/sys/stdio_uart/Makefile similarity index 100% rename from sys/uart_stdio/Makefile rename to sys/stdio_uart/Makefile diff --git a/sys/uart_stdio/uart_stdio.c b/sys/stdio_uart/stdio_uart.c similarity index 56% rename from sys/uart_stdio/uart_stdio.c rename to sys/stdio_uart/stdio_uart.c index 0fc039790a..40993196ee 100644 --- a/sys/uart_stdio/uart_stdio.c +++ b/sys/stdio_uart/stdio_uart.c @@ -2,6 +2,7 @@ * Copyright (C) 2013 INRIA * 2015 Kaspar Schleiser * 2016 Eistec AB + * 2018 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 @@ -9,18 +10,19 @@ */ /** - * @ingroup sys + * @ingroup sys * @{ * * @file - * @brief UART stdio implementation + * @brief STDIO over UART implementation * - * This file implements a UART callback and read/write functions. + * This file implements a UART callback and the STDIO read/write functions * * @author Oliver Hahm * @author Ludwig Knüpfer * @author Kaspar Schleiser * @author Joakim Nohlgård + * @author Hauke Petersen * * @} */ @@ -31,7 +33,7 @@ #include #include #endif -#include "uart_stdio.h" +#include "stdio_uart.h" #include "board.h" #include "periph/uart.h" @@ -49,73 +51,73 @@ extern ethos_t ethos; #define ENABLE_DEBUG 0 #include "debug.h" -static char _rx_buf_mem[UART_STDIO_RX_BUFSIZE]; -isrpipe_t uart_stdio_isrpipe = ISRPIPE_INIT(_rx_buf_mem); +static char _rx_buf_mem[STDIO_UART_RX_BUFSIZE]; +isrpipe_t stdio_uart_isrpipe = ISRPIPE_INIT(_rx_buf_mem); #if MODULE_VFS -static ssize_t uart_stdio_vfs_read(vfs_file_t *filp, void *dest, size_t nbytes); -static ssize_t uart_stdio_vfs_write(vfs_file_t *filp, const void *src, size_t nbytes); +static ssize_t stdio_uart_vfs_read(vfs_file_t *filp, void *dest, size_t nbytes); +static ssize_t stdio_uart_vfs_write(vfs_file_t *filp, const void *src, size_t nbytes); /** * @brief VFS file operation table for stdin/stdout/stderr */ -static vfs_file_ops_t uart_stdio_vfs_ops = { - .read = uart_stdio_vfs_read, - .write = uart_stdio_vfs_write, +static vfs_file_ops_t stdio_uart_vfs_ops = { + .read = stdio_uart_vfs_read, + .write = stdio_uart_vfs_write, }; -static ssize_t uart_stdio_vfs_read(vfs_file_t *filp, void *dest, size_t nbytes) +static ssize_t stdio_uart_vfs_read(vfs_file_t *filp, void *dest, size_t nbytes) { int fd = filp->private_data.value; if (fd != STDIN_FILENO) { return -EBADF; } - return uart_stdio_read(dest, nbytes); + return stdio_uart_read(dest, nbytes); } -static ssize_t uart_stdio_vfs_write(vfs_file_t *filp, const void *src, size_t nbytes) +static ssize_t stdio_uart_vfs_write(vfs_file_t *filp, const void *src, size_t nbytes) { int fd = filp->private_data.value; if (fd == STDIN_FILENO) { return -EBADF; } - return uart_stdio_write(src, nbytes); + return stdio_uart_write(src, nbytes); } #endif -void uart_stdio_init(void) +void stdio_init(void) { #ifndef USE_ETHOS_FOR_STDIO - uart_init(UART_STDIO_DEV, UART_STDIO_BAUDRATE, (uart_rx_cb_t) isrpipe_write_one, &uart_stdio_isrpipe); + uart_init(STDIO_UART_DEV, STDIO_UART_BAUDRATE, (uart_rx_cb_t) isrpipe_write_one, &stdio_uart_isrpipe); #else - uart_init(ETHOS_UART, ETHOS_BAUDRATE, (uart_rx_cb_t) isrpipe_write_one, &uart_stdio_isrpipe); + uart_init(ETHOS_UART, ETHOS_BAUDRATE, (uart_rx_cb_t) isrpipe_write_one, &stdio_uart_isrpipe); #endif #if MODULE_VFS int fd; - fd = vfs_bind(STDIN_FILENO, O_RDONLY, &uart_stdio_vfs_ops, (void *)STDIN_FILENO); + fd = vfs_bind(STDIN_FILENO, O_RDONLY, &stdio_uart_vfs_ops, (void *)STDIN_FILENO); if (fd < 0) { /* How to handle errors on init? */ } - fd = vfs_bind(STDOUT_FILENO, O_WRONLY, &uart_stdio_vfs_ops, (void *)STDOUT_FILENO); + fd = vfs_bind(STDOUT_FILENO, O_WRONLY, &stdio_uart_vfs_ops, (void *)STDOUT_FILENO); if (fd < 0) { /* How to handle errors on init? */ } - fd = vfs_bind(STDERR_FILENO, O_WRONLY, &uart_stdio_vfs_ops, (void *)STDERR_FILENO); + fd = vfs_bind(STDERR_FILENO, O_WRONLY, &stdio_uart_vfs_ops, (void *)STDERR_FILENO); if (fd < 0) { /* How to handle errors on init? */ } #endif } -int uart_stdio_read(char* buffer, int count) +ssize_t stdio_read(void* buffer, size_t count) { - return isrpipe_read(&uart_stdio_isrpipe, buffer, count); + return (ssize_t)isrpipe_read(&stdio_uart_isrpipe, (char *)buffer, count); } -int uart_stdio_write(const char* buffer, int len) +ssize_t stdio_write(const void* buffer, size_t len) { #ifndef USE_ETHOS_FOR_STDIO - uart_write(UART_STDIO_DEV, (const uint8_t *)buffer, (size_t)len); + uart_write(STDIO_UART_DEV, (const uint8_t *)buffer, len); #else ethos_send_frame(ðos, (const uint8_t *)buffer, len, ETHOS_FRAME_TYPE_TEXT); #endif From 9bd23636432da7ba5c2ebb97586941debcf91fcd Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Thu, 5 Jul 2018 14:07:17 +0200 Subject: [PATCH 3/4] sys/stdio: s/rtt_stdio/stdio_rtt/ --- Makefile.dep | 4 +- sys/include/rtt_stdio.h | 73 ------------------- sys/include/stdio_rtt.h | 51 +++++++++++++ sys/{rtt_stdio => stdio_rtt}/Makefile | 0 sys/{rtt_stdio => stdio_rtt}/README.md | 6 +- .../rtt_stdio.c => stdio_rtt/stdio_rtt.c} | 29 ++++---- 6 files changed, 70 insertions(+), 93 deletions(-) delete mode 100644 sys/include/rtt_stdio.h create mode 100644 sys/include/stdio_rtt.h rename sys/{rtt_stdio => stdio_rtt}/Makefile (100%) rename sys/{rtt_stdio => stdio_rtt}/README.md (93%) rename sys/{rtt_stdio/rtt_stdio.c => stdio_rtt/stdio_rtt.c} (95%) diff --git a/Makefile.dep b/Makefile.dep index 7a4f918147..b511ca08e6 100644 --- a/Makefile.dep +++ b/Makefile.dep @@ -373,7 +373,7 @@ ifneq (,$(filter newlib,$(USEMODULE))) ifeq (,$(filter newlib_syscalls_%,$(USEMODULE))) USEMODULE += newlib_syscalls_default endif - ifeq (,$(filter rtt_stdio,$(USEMODULE))) + ifeq (,$(filter stdio_rtt,$(USEMODULE))) USEMODULE += stdio_uart endif endif @@ -386,7 +386,7 @@ ifneq (,$(filter posix_sockets,$(USEMODULE))) USEMODULE += xtimer endif -ifneq (,$(filter rtt_stdio,$(USEMODULE))) +ifneq (,$(filter stdio_rtt,$(USEMODULE))) USEMODULE += xtimer endif diff --git a/sys/include/rtt_stdio.h b/sys/include/rtt_stdio.h deleted file mode 100644 index 2ce337420e..0000000000 --- a/sys/include/rtt_stdio.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2016 Michael Andersen - * - * 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_rtt_stdio SEGGER RTT stdio - * @ingroup sys - * - * @brief stdio init/read/write functions for SEGGER RTT. This is - * designed to shadow the functions in uart_stdio - * - * @{ - * @file - * - * @author Michael Andersen - */ -#ifndef RTT_STDIO_H -#define RTT_STDIO_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief initialize the module. This is a noop. - */ -void uart_stdio_init(void); - -/** - * @brief read @p len bytes from stdio uart into @p buffer - * - * @param[out] buffer buffer to read into - * @param[in] len nr of bytes to read - * - * @return nr of bytes read - * @return <0 on error - */ -int uart_stdio_read(char* buffer, int len); - -/** - * @brief write @p len bytes from @p buffer into uart - * - * @param[in] buffer buffer to read from - * @param[in] len nr of bytes to write - * - * @return nr of bytes written - * @return <0 on error - */ -int uart_stdio_write(const char* buffer, int len); - -/** - * @brief enable stdin polling, at a power consumption cost. This is enabled - * by default unless RTT_STDIO_DISABLE_STDIN is defined. - */ -void rtt_stdio_enable_stdin(void); - -/** - * @brief enable stdout blocking and free space polling. This must be done - * with caution because if there is no RTT client attached, all - * writes to stdout will block indefinitely. This can be enabled - * automatically by defining RTT_STDIO_ENABLE_BLOCKING_STDOUT - */ -void rtt_stdio_enable_blocking_stdout(void); - -#ifdef __cplusplus -} -#endif -/** @} */ -#endif /* RTT_STDIO_H */ diff --git a/sys/include/stdio_rtt.h b/sys/include/stdio_rtt.h new file mode 100644 index 0000000000..8d3b03de5e --- /dev/null +++ b/sys/include/stdio_rtt.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2016 Michael Andersen + * 2018 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_stdio_rtt STDIO over SEGGER RTT + * @ingroup sys + * + * @brief STDIO mapping for running the STDIO over SEGGER's RTT interface + * + * @{ + * @file + * + * @author Michael Andersen + * @author Hauke Petersen + */ + +#ifndef STDIO_RTT_H +#define STDIO_RTT_H + +#include "stdio_base.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief enable stdin polling, at a power consumption cost. This is enabled + * by default unless STDIO_RTT_DISABLE_STDIN is defined. + */ +void rtt_stdio_enable_stdin(void); + +/** + * @brief enable stdout blocking and free space polling. This must be done + * with caution because if there is no RTT client attached, all + * writes to stdout will block indefinitely. This can be enabled + * automatically by defining STDIO_RTT_ENABLE_BLOCKING_STDOUT + */ +void rtt_stdio_enable_blocking_stdout(void); + +#ifdef __cplusplus +} +#endif + +/** @} */ +#endif /* STDIO_RTT_H */ diff --git a/sys/rtt_stdio/Makefile b/sys/stdio_rtt/Makefile similarity index 100% rename from sys/rtt_stdio/Makefile rename to sys/stdio_rtt/Makefile diff --git a/sys/rtt_stdio/README.md b/sys/stdio_rtt/README.md similarity index 93% rename from sys/rtt_stdio/README.md rename to sys/stdio_rtt/README.md index abd868f2a6..e42bc28be8 100644 --- a/sys/rtt_stdio/README.md +++ b/sys/stdio_rtt/README.md @@ -11,7 +11,7 @@ and enables stdio on platforms that do not have a UART. To use this module, add ``` -USEMODULE += rtt_stdio +USEMODULE += stdio_rtt ``` to your makefile. By default the module will drop bytes written to stdout if the @@ -19,7 +19,7 @@ buffer is full. If you know for certain that the debugger is attached, you can obtain lossless stdout by adding ``` -CFLAGS += -DRTT_STDIO_ENABLE_BLOCKING_STDOUT +CFLAGS += -DSTDIO_RTT_ENABLE_BLOCKING_STDOUT ``` to your makefile. Note well that if you do NOT plug in the debugger and run @@ -41,5 +41,5 @@ can increase the number of unnecessary wakeups from sleep. To disable stdin, add this to your makefile: ``` -CFLAGS += -DRTT_STDIO_DISABLE_STDIN +CFLAGS += -DSTDIO_RTT_DISABLE_STDIN ``` diff --git a/sys/rtt_stdio/rtt_stdio.c b/sys/stdio_rtt/stdio_rtt.c similarity index 95% rename from sys/rtt_stdio/rtt_stdio.c rename to sys/stdio_rtt/stdio_rtt.c index d829f77580..692d3aea14 100644 --- a/sys/rtt_stdio/rtt_stdio.c +++ b/sys/stdio_rtt/stdio_rtt.c @@ -67,10 +67,8 @@ * @file * @brief SEGGER RTT stdio implementation * - * This file implements UART read/write functions, but it - * is actually a virtual UART backed by a ringbuffer that - * complies with SEGGER RTT. It is designed to shadow - * uart_stdio that is used by newlib. + * This file implements RIOTs STDIO interface and works with a ringbuffer that + * complies with SEGGER RTT. * * @author Michael Andersen * @@ -84,8 +82,8 @@ #include #endif #include -#include +#include "stdio_rtt.h" #include "thread.h" #include "mutex.h" #include "xtimer.h" @@ -319,12 +317,12 @@ static ssize_t rtt_stdio_vfs_write(vfs_file_t *filp, const void *src, size_t nby #endif -void uart_stdio_init(void) { - #ifndef RTT_STDIO_DISABLE_STDIN +void stdio_init(void) { + #ifndef STDIO_RTT_DISABLE_STDIN stdin_enabled = 1; #endif - #ifdef RTT_STDIO_ENABLE_BLOCKING_STDOUT + #ifdef STDIO_RTT_ENABLE_BLOCKING_STDOUT blocking_stdout = 1; #endif @@ -363,8 +361,8 @@ void rtt_stdio_enable_blocking_stdout(void) { actually have an RTT console (because we are deployed on a battery somewhere) then we REALLY don't want to poll especially since we are not expecting to EVER get input. */ -int uart_stdio_read(char* buffer, int count) { - int res = rtt_read(buffer, count); +ssize_t stdio_read(void* buffer, size_t count) { + int res = rtt_read((void *)buffer, (uint16_t)count); if (res == 0) { if (!stdin_enabled) { mutex_lock(&_rx_mutex); @@ -379,15 +377,16 @@ int uart_stdio_read(char* buffer, int count) { return res; } } - return res; + return (ssize_t)res; } -int uart_stdio_write(const char* buffer, int len) { - int written = rtt_write(buffer, len); +ssize_t stdio_write(const void* in, size_t len) { + const char *buffer = (const char *)in; + int written = rtt_write(buffer, (unsigned)len); xtimer_ticks32_t last_wakeup = xtimer_now(); - while (blocking_stdout && written < len) { + while (blocking_stdout && ((size_t)written < len)) { xtimer_periodic_wakeup(&last_wakeup, STDIO_POLL_INTERVAL); written += rtt_write(&buffer[written], len-written); } - return written; + return (ssize_t)written; } From c2184f34547fb454b9d55ed4a1977bbacfdb0415 Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Thu, 5 Jul 2018 14:09:08 +0200 Subject: [PATCH 4/4] boards/cpu/drivers/sys: use generic stdio_ if --- boards/bluepill/include/board.h | 2 +- .../common/arduino-atmega/include/board_common.h | 2 +- boards/common/iotlab/include/board_common.h | 4 ++-- boards/common/msb-430/board_init.c | 6 +++--- boards/common/silabs/drivers/bc/bc.c | 6 +++--- boards/common/wsn430/board_init.c | 4 ++-- boards/hifive1/Makefile.include | 2 +- boards/jiminy-mega256rfr2/include/board.h | 4 ++-- boards/maple-mini/include/board.h | 2 +- boards/mega-xplained/include/board.h | 6 +++--- boards/mulle/include/board.h | 2 +- boards/opencm904/include/board.h | 6 +++--- boards/ruuvitag/Makefile.include | 2 +- boards/stm32mindev/include/board.h | 2 +- boards/telosb/board.c | 6 +++--- boards/telosb/include/board.h | 4 ++-- boards/thingy52/Makefile.include | 2 +- boards/waspmote-pro/include/board.h | 6 +++--- boards/z1/board.c | 6 +++--- cpu/atmega_common/Makefile.include | 4 ++-- cpu/atmega_common/atmega_stdio.c | 8 ++++---- cpu/atmega_common/periph/uart.c | 12 ++++++------ cpu/atmega_common/posix_unistd.c | 12 ++++++------ cpu/fe310/nano/nanostubs.c | 14 +++++++------- cpu/msp430fxyz/Makefile.include | 2 +- cpu/msp430fxyz/msp430_stdio.c | 8 ++++---- drivers/ethos/ethos.c | 6 +++--- drivers/include/ethos.h | 8 ++++---- examples/arduino_hello-world/hello-world.sketch | 4 ++-- sys/auto_init/netif/auto_init_ethos.c | 2 +- sys/newlib_syscalls_default/syscalls.c | 12 ++++++------ sys/stdio_uart/stdio_uart.c | 4 ++-- sys/vfs/vfs.c | 2 +- tests/driver_dynamixel/main.c | 4 ++-- tests/driver_feetech/main.c | 4 ++-- tests/driver_rn2xx3/README.md | 2 +- tests/driver_xbee/README.md | 2 +- tests/periph_uart/main.c | 14 +++++++------- 38 files changed, 99 insertions(+), 99 deletions(-) diff --git a/boards/bluepill/include/board.h b/boards/bluepill/include/board.h index ca178a6f73..48c4b4c283 100644 --- a/boards/bluepill/include/board.h +++ b/boards/bluepill/include/board.h @@ -54,7 +54,7 @@ void board_init(void); /** * @brief Use the 2nd UART for STDIO on this board */ -#define UART_STDIO_DEV UART_DEV(1) +#define STDIO_UART_DEV UART_DEV(1) /** * @name xtimer configuration diff --git a/boards/common/arduino-atmega/include/board_common.h b/boards/common/arduino-atmega/include/board_common.h index 0b884520b4..6694f2a93a 100644 --- a/boards/common/arduino-atmega/include/board_common.h +++ b/boards/common/arduino-atmega/include/board_common.h @@ -37,7 +37,7 @@ extern "C" { * baudrate to 9600 for this board * @{ */ -#define UART_STDIO_BAUDRATE (9600U) +#define STDIO_UART_BAUDRATE (9600U) /** @} */ /** diff --git a/boards/common/iotlab/include/board_common.h b/boards/common/iotlab/include/board_common.h index 129b9c66f3..ed0dc64c09 100644 --- a/boards/common/iotlab/include/board_common.h +++ b/boards/common/iotlab/include/board_common.h @@ -38,8 +38,8 @@ extern "C" { * @name Set the default baudrate to 500K for this board * @{ */ -#ifndef UART_STDIO_BAUDRATE -# define UART_STDIO_BAUDRATE (500000U) +#ifndef STDIO_UART_BAUDRATE +# define STDIO_UART_BAUDRATE (500000U) #endif /** @} */ diff --git a/boards/common/msb-430/board_init.c b/boards/common/msb-430/board_init.c index 6be78cf94a..8d2dc04b71 100644 --- a/boards/common/msb-430/board_init.c +++ b/boards/common/msb-430/board_init.c @@ -21,7 +21,7 @@ #include "cpu.h" #include "irq.h" #include "board.h" -#include "uart_stdio.h" +#include "stdio_base.h" #include "periph_conf.h" #include "msp430.h" #include "debug.h" @@ -199,6 +199,6 @@ void board_init(void) msp430_set_cpu_speed(CLOCK_CORECLOCK); - /* finally initialize STDIO over UART */ - uart_stdio_init(); + /* finally initialize STDIO */ + stdio_init(); } diff --git a/boards/common/silabs/drivers/bc/bc.c b/boards/common/silabs/drivers/bc/bc.c index 9deddb211f..c0b495f114 100644 --- a/boards/common/silabs/drivers/bc/bc.c +++ b/boards/common/silabs/drivers/bc/bc.c @@ -20,7 +20,7 @@ #include "bc.h" -#include "uart_stdio.h" +#include "stdio_uart.h" #include "periph/gpio.h" #include "periph/uart.h" @@ -35,14 +35,14 @@ /** * @brief Ensure that the correct UART is used. */ -#if ((UART_STDIO_DEV) != (UART_DEV(0))) +#if ((STDIO_UART_DEV) != (UART_DEV(0))) #error "The BC requires UART_DEV(0)." #endif /** * @brief Ensure that the correct baud rate is used. */ -#if ((UART_STDIO_BAUDRATE) != 115200) +#if ((STDIO_UART_BAUDRATE) != 115200) #error "The BC requires a baud rate of 115200." #endif diff --git a/boards/common/wsn430/board_init.c b/boards/common/wsn430/board_init.c index 521e248f2f..317ce365bb 100644 --- a/boards/common/wsn430/board_init.c +++ b/boards/common/wsn430/board_init.c @@ -23,7 +23,7 @@ #include "cpu.h" #include "irq.h" #include "assert.h" -#include "uart_stdio.h" +#include "stdio_uart.h" #include "periph_conf.h" enum { @@ -98,5 +98,5 @@ void board_init(void) irq_restore(state); /* initialize STDIO over UART */ - uart_stdio_init(); + stdio_init(); } diff --git a/boards/hifive1/Makefile.include b/boards/hifive1/Makefile.include index 554566d32c..098e456c64 100644 --- a/boards/hifive1/Makefile.include +++ b/boards/hifive1/Makefile.include @@ -3,7 +3,7 @@ export CPU = fe310 export CPU_MODEL = fe310 # Uses UART0 for stdio input/output (comment out to disable) -USEMODULE += uart_stdio +USEMODULE += stdio_uart # set default port depending on operating system PORT_LINUX ?= /dev/ttyUSB1 diff --git a/boards/jiminy-mega256rfr2/include/board.h b/boards/jiminy-mega256rfr2/include/board.h index f47de1232a..410addb56b 100644 --- a/boards/jiminy-mega256rfr2/include/board.h +++ b/boards/jiminy-mega256rfr2/include/board.h @@ -40,8 +40,8 @@ extern "C" { * * @{ */ -#ifndef UART_STDIO_BAUDRATE -#define UART_STDIO_BAUDRATE (38400U) /**< Sets Baudrate for e.g. Shell */ +#ifndef STDIO_UART_BAUDRATE +#define STDIO_UART_BAUDRATE (38400U) /**< Sets Baudrate for e.g. Shell */ #endif /** @} */ diff --git a/boards/maple-mini/include/board.h b/boards/maple-mini/include/board.h index 3684ef5f41..cfd187e19c 100644 --- a/boards/maple-mini/include/board.h +++ b/boards/maple-mini/include/board.h @@ -57,7 +57,7 @@ extern "C" { /** * @brief Use the USART1 for STDIO on this board */ -#define UART_STDIO_DEV UART_DEV(1) +#define STDIO_UART_DEV UART_DEV(1) /** * @brief Initialize board specific hardware, including clock, LEDs and std-IO diff --git a/boards/mega-xplained/include/board.h b/boards/mega-xplained/include/board.h index 52baca6759..f7021dd829 100644 --- a/boards/mega-xplained/include/board.h +++ b/boards/mega-xplained/include/board.h @@ -39,15 +39,15 @@ extern "C" { * baudrate to 9600 for this board * @{ */ -#ifndef UART_STDIO_BAUDRATE -#define UART_STDIO_BAUDRATE (9600U) +#ifndef STDIO_UART_BAUDRATE +#define STDIO_UART_BAUDRATE (9600U) #endif /** @} */ /** * @brief Use the UART 1 for STDIO on this board */ -#define UART_STDIO_DEV (UART_DEV(1)) +#define STDIO_UART_DEV (UART_DEV(1)) /** * @name xtimer configuration values diff --git a/boards/mulle/include/board.h b/boards/mulle/include/board.h index b5044c9e22..ba396f9e5b 100644 --- a/boards/mulle/include/board.h +++ b/boards/mulle/include/board.h @@ -35,7 +35,7 @@ /** * @brief Use the UART1 for STDIO on this board */ -#define UART_STDIO_DEV UART_DEV(1) +#define STDIO_UART_DEV UART_DEV(1) /** * @name xtimer configuration diff --git a/boards/opencm904/include/board.h b/boards/opencm904/include/board.h index 57f07a958a..a03a5b4616 100644 --- a/boards/opencm904/include/board.h +++ b/boards/opencm904/include/board.h @@ -66,14 +66,14 @@ extern "C" { /** * @brief Use the USART2 for STDIO on this board */ -#define UART_STDIO_DEV UART_DEV(0) +#define STDIO_UART_DEV UART_DEV(0) /** * @name Override with ROBOTIS Bluetooth antenna baudrate for STDIO * @{ */ -#ifndef UART_STDIO_BAUDRATE -#define UART_STDIO_BAUDRATE (921600UL) +#ifndef STDIO_UART_BAUDRATE +#define STDIO_UART_BAUDRATE (921600UL) #endif /** @} */ diff --git a/boards/ruuvitag/Makefile.include b/boards/ruuvitag/Makefile.include index e2df4570f6..eb284c27fc 100644 --- a/boards/ruuvitag/Makefile.include +++ b/boards/ruuvitag/Makefile.include @@ -2,7 +2,7 @@ CPU_MODEL = nrf52832xxaa # for this board, we are using Segger's RTT as default terminal interface -USEMODULE += rtt_stdio +USEMODULE += stdio_rtt TERMPROG = $(RIOTTOOLS)/jlink/jlink.sh TERMFLAGS = term_rtt diff --git a/boards/stm32mindev/include/board.h b/boards/stm32mindev/include/board.h index 902087c1aa..b9a1680076 100644 --- a/boards/stm32mindev/include/board.h +++ b/boards/stm32mindev/include/board.h @@ -61,7 +61,7 @@ void board_init(void); /** * @brief Use the 2nd UART for STDIO on this board */ -#define UART_STDIO_DEV UART_DEV(1) +#define STDIO_UART_DEV UART_DEV(1) /** * @name xtimer configuration diff --git a/boards/telosb/board.c b/boards/telosb/board.c index cb699cbde4..894fd50dd2 100644 --- a/boards/telosb/board.c +++ b/boards/telosb/board.c @@ -9,7 +9,7 @@ #include "cpu.h" #include "board.h" -#include "uart_stdio.h" +#include "stdio_uart.h" void uart_init(void); @@ -122,8 +122,8 @@ void board_init(void) telosb_ports_init(); msp430_init_dco(); - /* initialize STDIO over UART */ - uart_stdio_init(); + /* initialize STDIO */ + stdio_init(); /* enable interrupts */ __bis_SR_register(GIE); diff --git a/boards/telosb/include/board.h b/boards/telosb/include/board.h index 652f6794ef..81e849e468 100644 --- a/boards/telosb/include/board.h +++ b/boards/telosb/include/board.h @@ -43,8 +43,8 @@ extern "C" { * @name Override default baudrate for STDIO * @{ */ -#ifndef UART_STDIO_BAUDRATE -#define UART_STDIO_BAUDRATE (9600) +#ifndef STDIO_UART_BAUDRATE +#define STDIO_UART_BAUDRATE (9600) #endif /** @} */ diff --git a/boards/thingy52/Makefile.include b/boards/thingy52/Makefile.include index 96fda10616..e680c05598 100644 --- a/boards/thingy52/Makefile.include +++ b/boards/thingy52/Makefile.include @@ -2,7 +2,7 @@ CPU_MODEL = nrf52832xxaa # for this board, we are using Segger's RTT as default terminal interface -USEMODULE += rtt_stdio +USEMODULE += stdio_rtt TERMPROG = $(RIOTTOOLS)/jlink/jlink.sh TERMFLAGS = term_rtt diff --git a/boards/waspmote-pro/include/board.h b/boards/waspmote-pro/include/board.h index 25023e9b71..8fa8a538ab 100644 --- a/boards/waspmote-pro/include/board.h +++ b/boards/waspmote-pro/include/board.h @@ -31,7 +31,7 @@ extern "C" { * @brief As the CPU is too slow to handle 115200 baud, we set the default * baudrate to 9600 for this board */ -#define UART_STDIO_BAUDRATE (9600U) +#define STDIO_UART_BAUDRATE (9600U) /** * @brief Use the UART 0 for STDIO on this board, if the XBee socket is not @@ -39,9 +39,9 @@ extern "C" { */ #ifdef XBEE_UART #if XBEE_UART == 0 -#define UART_STDIO_DEV (UART_DEV(1)) +#define STDIO_UART_DEV (UART_DEV(1)) #else -#define UART_STDIO_DEV (UART_DEV(0)) +#define STDIO_UART_DEV (UART_DEV(0)) #endif #endif diff --git a/boards/z1/board.c b/boards/z1/board.c index 0f2984ad9c..1f4838046f 100644 --- a/boards/z1/board.c +++ b/boards/z1/board.c @@ -24,7 +24,7 @@ #include "cpu.h" #include "board.h" -#include "uart_stdio.h" +#include "stdio_uart.h" static void z1_ports_init(void) { @@ -215,8 +215,8 @@ void board_init(void) /* initializes DCO */ msp430_init_dco(); - /* initialize STDIO over UART */ - uart_stdio_init(); + /* initialize STDIO */ + stdio_init(); /* enable interrupts */ __bis_SR_register(GIE); diff --git a/cpu/atmega_common/Makefile.include b/cpu/atmega_common/Makefile.include index 06e06f876b..717ec08ab6 100644 --- a/cpu/atmega_common/Makefile.include +++ b/cpu/atmega_common/Makefile.include @@ -14,8 +14,8 @@ export LINKFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG) $(CFLAGS_OPT) -static -lgcc -e r export USEMODULE += atmega_common_periph export USEMODULE += periph_common -# the atmel port uses uart_stdio -export USEMODULE += uart_stdio +# the atmel port uses stdio_uart +export USEMODULE += stdio_uart # include module specific includes export INCLUDES += -I$(RIOTCPU)/atmega_common/include -isystem$(RIOTCPU)/atmega_common/include/vendor diff --git a/cpu/atmega_common/atmega_stdio.c b/cpu/atmega_common/atmega_stdio.c index f069a56b42..d37158b0ad 100644 --- a/cpu/atmega_common/atmega_stdio.c +++ b/cpu/atmega_common/atmega_stdio.c @@ -19,7 +19,7 @@ #include #include -#include "uart_stdio.h" +#include "stdio_uart.h" static int _uart_putchar(char c, FILE *stream); static int _uart_getchar(FILE *stream); @@ -29,7 +29,7 @@ static FILE _uart_stdin = FDEV_SETUP_STREAM(NULL, _uart_getchar, _FDEV_SETUP_REA static int _uart_putchar(char c, FILE *stream) { (void) stream; - uart_stdio_write(&c, 1); + stdio_write(&c, 1); return 0; } @@ -37,13 +37,13 @@ static int _uart_getchar(FILE *stream) { (void) stream; char c; - uart_stdio_read(&c, 1); + stdio_read(&c, 1); return (int)c; } void atmega_stdio_init(void) { - uart_stdio_init(); + stdio_init(); stdout = &_uart_stdout; stdin = &_uart_stdin; diff --git a/cpu/atmega_common/periph/uart.c b/cpu/atmega_common/periph/uart.c index 8925f7a2bc..260191ce58 100644 --- a/cpu/atmega_common/periph/uart.c +++ b/cpu/atmega_common/periph/uart.c @@ -18,8 +18,8 @@ * @author Hinnerk van Bruinehsen * * - * Support static BAUD rate calculation using UART_STDIO_BAUDRATE. - * Set UART_STDIO_BAUDRATE to the desired baud rate and pass it as a -D argument + * Support static BAUD rate calculation using STDIO_UART_BAUDRATE. + * Set STDIO_UART_BAUDRATE to the desired baud rate and pass it as a -D argument * at compliation time (e.g. in the boards Makefile.include file). * UART_BAUD_TOL can be set to guarantee a BAUD rate tolerance at compile time or * to switch to double speed transmission (U2X) to achieve a lower tolerance. @@ -48,9 +48,9 @@ #define BAUD_TOL 2 #endif -#if defined(UART_STDIO_BAUDRATE) +#if defined(STDIO_UART_BAUDRATE) /* BAUD and F_CPU are required by setbaud.h to calculated BRR */ -#define BAUD UART_STDIO_BAUDRATE +#define BAUD STDIO_UART_BAUDRATE #define F_CPU CLOCK_CORECLOCK #include #endif @@ -90,9 +90,9 @@ static void _set_brr(uart_t uart, uint32_t baudrate) { uint16_t brr; -#if defined(UART_STDIO_BAUDRATE) +#if defined(STDIO_UART_BAUDRATE) /* UBRR_VALUE and USE_2X are statically computed from */ - if (baudrate == UART_STDIO_BAUDRATE) { + if (baudrate == STDIO_UART_BAUDRATE) { _update_brr(uart, UBRR_VALUE, USE_2X); return; } diff --git a/cpu/atmega_common/posix_unistd.c b/cpu/atmega_common/posix_unistd.c index 4e0e736da7..8f00bb455c 100644 --- a/cpu/atmega_common/posix_unistd.c +++ b/cpu/atmega_common/posix_unistd.c @@ -22,8 +22,8 @@ #ifdef MODULE_VFS #include #include "vfs.h" -#elif defined(MODULE_UART_STDIO) -#include "uart_stdio.h" +#elif defined(MODULE_STDIO_UART) +#include "stdio_uart.h" #endif int open(const char *name, int flags, ...) @@ -136,9 +136,9 @@ ssize_t read(int fd, void *dest, size_t count) return -1; } return res; -#elif defined(MODULE_UART_STDIO) +#elif defined(MODULE_STDIO_UART) if (fd == 0) { - return uart_stdio_read(dest, count); + return stdio_read(dest, count); } errno = EBADF; return -1; @@ -160,9 +160,9 @@ ssize_t write(int fd, const void *src, size_t count) return -1; } return res; -#elif defined(MODULE_UART_STDIO) +#elif defined(MODULE_STDIO_UART) if (fd == 0) { - return uart_stdio_write(src, count); + return stdio_write(src, count); } errno = EBADF; return -1; diff --git a/cpu/fe310/nano/nanostubs.c b/cpu/fe310/nano/nanostubs.c index 0a230622ca..b5550689f2 100644 --- a/cpu/fe310/nano/nanostubs.c +++ b/cpu/fe310/nano/nanostubs.c @@ -27,7 +27,7 @@ #include "thread.h" #include "irq.h" #include "cpu.h" -#include "uart_stdio.h" +#include "stdio_uart.h" extern char _heap_start; /* Heap markers from fe310.ld file */ extern char _heap_end; @@ -38,9 +38,9 @@ char *heap_top = &_heap_start + 4; */ void nanostubs_init(void) { -#if defined(MODULE_UART_STDIO) +#if defined(MODULE_STDIO_UART) /* STDIO redirected to UART, no line buffering */ - uart_stdio_init(); + stdio_init(); setvbuf(stdout, NULL, _IONBF, 0); #endif } @@ -82,9 +82,9 @@ int _open(const char *name, int flags, int mode) _ssize_t _read(int fd, void *buffer, size_t count) { -#if defined(MODULE_UART_STDIO) +#if defined(MODULE_STDIO_UART) if (fd == STDIN_FILENO) { - return uart_stdio_read(buffer, count); + return stdio_read(buffer, count); } errno = EBADF; return -1; @@ -99,9 +99,9 @@ _ssize_t _read(int fd, void *buffer, size_t count) _ssize_t _write(int fd, const void *data, size_t count) { -#if defined(MODULE_UART_STDIO) +#if defined(MODULE_STDIO_UART) if (fd == STDOUT_FILENO || fd == STDERR_FILENO) { - return uart_stdio_write(data, count); + return stdio_write(data, count); } errno = EBADF; return -1; diff --git a/cpu/msp430fxyz/Makefile.include b/cpu/msp430fxyz/Makefile.include index ab2d20164a..044bd13233 100644 --- a/cpu/msp430fxyz/Makefile.include +++ b/cpu/msp430fxyz/Makefile.include @@ -1,3 +1,3 @@ include $(RIOTCPU)/msp430_common/Makefile.include -export USEMODULE += periph periph_common uart_stdio +export USEMODULE += periph periph_common stdio_uart diff --git a/cpu/msp430fxyz/msp430_stdio.c b/cpu/msp430fxyz/msp430_stdio.c index 31f783a669..898e0c8ee9 100644 --- a/cpu/msp430fxyz/msp430_stdio.c +++ b/cpu/msp430fxyz/msp430_stdio.c @@ -21,7 +21,7 @@ #include #include -#include "uart_stdio.h" +#include "stdio_uart.h" /** * @brief Get one character from STDIO - used by the libc @@ -29,7 +29,7 @@ int getchar(void) { char c; - uart_stdio_read(&c, 1); + stdio_read(&c, 1); return c; } @@ -40,7 +40,7 @@ int getchar(void) int putchar(int c) { char _c = c; - return uart_stdio_write(&_c, 1); + return stdio_write(&_c, 1); } /** @@ -49,7 +49,7 @@ int putchar(int c) ssize_t write(int fildes, const void *buf, size_t nbyte) { if (fildes == STDOUT_FILENO) { - return uart_stdio_write(buf, nbyte); + return stdio_write(buf, nbyte); } else { return -1; diff --git a/drivers/ethos/ethos.c b/drivers/ethos/ethos.c index 511eec2865..cecec42545 100644 --- a/drivers/ethos/ethos.c +++ b/drivers/ethos/ethos.c @@ -34,9 +34,9 @@ #include "net/ethernet.h" #ifdef USE_ETHOS_FOR_STDIO -#include "uart_stdio.h" +#include "stdio_uart.h" #include "isrpipe.h" -extern isrpipe_t uart_stdio_isrpipe; +extern isrpipe_t stdio_uart_isrpipe; #endif #define ENABLE_DEBUG (0) @@ -102,7 +102,7 @@ static void _handle_char(ethos_t *dev, char c) #ifdef USE_ETHOS_FOR_STDIO case ETHOS_FRAME_TYPE_TEXT: dev->framesize++; - isrpipe_write_one(&uart_stdio_isrpipe, c); + isrpipe_write_one(&stdio_uart_isrpipe, c); #endif } } diff --git a/drivers/include/ethos.h b/drivers/include/ethos.h index b5d39e2377..18f1abf259 100644 --- a/drivers/include/ethos.h +++ b/drivers/include/ethos.h @@ -31,14 +31,14 @@ extern "C" { #endif -/* if using ethos + stdio, use UART_STDIO values unless overridden */ +/* if using ethos + stdio, use STDIO_UART values unless overridden */ #ifdef USE_ETHOS_FOR_STDIO -#include "uart_stdio.h" +#include "stdio_uart.h" #ifndef ETHOS_UART -#define ETHOS_UART UART_STDIO_DEV +#define ETHOS_UART STDIO_UART_DEV #endif #ifndef ETHOS_BAUDRATE -#define ETHOS_BAUDRATE UART_STDIO_BAUDRATE +#define ETHOS_BAUDRATE STDIO_UART_BAUDRATE #endif #endif diff --git a/examples/arduino_hello-world/hello-world.sketch b/examples/arduino_hello-world/hello-world.sketch index a6fd74d97b..bdf414c0fd 100644 --- a/examples/arduino_hello-world/hello-world.sketch +++ b/examples/arduino_hello-world/hello-world.sketch @@ -16,8 +16,8 @@ // For some boards RIOT defines a macro assigning the required baudrate of the // serial link. If this macro is not set, the default baudrate is set to // 115200. -#ifdef UART_STDIO_BAUDRATE -#define SERIAL_BAUDRATE UART_STDIO_BAUDRATE +#ifdef STDIO_UART_BAUDRATE +#define SERIAL_BAUDRATE STDIO_UART_BAUDRATE #else #define SERIAL_BAUDRATE 115200 #endif diff --git a/sys/auto_init/netif/auto_init_ethos.c b/sys/auto_init/netif/auto_init_ethos.c index 65bcd92a41..7cdeaac8a3 100644 --- a/sys/auto_init/netif/auto_init_ethos.c +++ b/sys/auto_init/netif/auto_init_ethos.c @@ -26,7 +26,7 @@ #include "net/gnrc/netif/ethernet.h" /** - * @brief global ethos object, used by uart_stdio + * @brief global ethos object, used by stdio_uart */ ethos_t ethos; diff --git a/sys/newlib_syscalls_default/syscalls.c b/sys/newlib_syscalls_default/syscalls.c index 42ad730902..7eebf50109 100644 --- a/sys/newlib_syscalls_default/syscalls.c +++ b/sys/newlib_syscalls_default/syscalls.c @@ -45,7 +45,7 @@ #include "vfs.h" #endif -#include "uart_stdio.h" +#include "stdio_base.h" #include @@ -69,7 +69,7 @@ char *heap_top = &_sheap + 4; */ void _init(void) { - uart_stdio_init(); + stdio_init(); } /** @@ -389,7 +389,7 @@ int _unlink_r(struct _reent *r, const char *path) /* * Fallback read function * - * All input is read from uart_stdio regardless of fd number. The function will + * All input is read from stdio_uart regardless of fd number. The function will * block until a byte is actually read. * * Note: the read function does not buffer - data will be lost if the function is not @@ -399,20 +399,20 @@ _ssize_t _read_r(struct _reent *r, int fd, void *buffer, size_t count) { (void)r; (void)fd; - return uart_stdio_read(buffer, count); + return stdio_read(buffer, count); } /* * Fallback write function * - * All output is directed to uart_stdio, independent of the given file descriptor. + * All output is directed to stdio_uart, independent of the given file descriptor. * The write call will further block until the byte is actually written to the UART. */ _ssize_t _write_r(struct _reent *r, int fd, const void *data, size_t count) { (void) r; (void) fd; - return uart_stdio_write(data, count); + return stdio_write(data, count); } /* Stubs to avoid linking errors, these functions do not have any effect */ diff --git a/sys/stdio_uart/stdio_uart.c b/sys/stdio_uart/stdio_uart.c index 40993196ee..e89ca2047e 100644 --- a/sys/stdio_uart/stdio_uart.c +++ b/sys/stdio_uart/stdio_uart.c @@ -72,7 +72,7 @@ static ssize_t stdio_uart_vfs_read(vfs_file_t *filp, void *dest, size_t nbytes) if (fd != STDIN_FILENO) { return -EBADF; } - return stdio_uart_read(dest, nbytes); + return stdio_read(dest, nbytes); } static ssize_t stdio_uart_vfs_write(vfs_file_t *filp, const void *src, size_t nbytes) @@ -81,7 +81,7 @@ static ssize_t stdio_uart_vfs_write(vfs_file_t *filp, const void *src, size_t nb if (fd == STDIN_FILENO) { return -EBADF; } - return stdio_uart_write(src, nbytes); + return stdio_write(src, nbytes); } #endif diff --git a/sys/vfs/vfs.c b/sys/vfs/vfs.c index 807a95d0d8..0938e67f86 100644 --- a/sys/vfs/vfs.c +++ b/sys/vfs/vfs.c @@ -871,7 +871,7 @@ static inline int _allocate_fd(int fd) if ((fd == STDIN_FILENO) || (fd == STDOUT_FILENO) || (fd == STDERR_FILENO)) { /* Do not auto-allocate the stdio file descriptor numbers to * avoid conflicts between normal file system users and stdio - * drivers such as uart_stdio, rtt_stdio which need to be able + * drivers such as stdio_uart, stdio_rtt which need to be able * to bind to these specific file descriptor numbers. */ continue; } diff --git a/tests/driver_dynamixel/main.c b/tests/driver_dynamixel/main.c index 04521232cb..ce0775e1db 100644 --- a/tests/driver_dynamixel/main.c +++ b/tests/driver_dynamixel/main.c @@ -9,7 +9,7 @@ #include "dynamixel.h" #include "shell.h" #include "shell_commands.h" -#include "uart_stdio.h" +#include "stdio_uart.h" #include "board.h" #include "periph/gpio.h" @@ -101,7 +101,7 @@ static int parse_uart(char *arg) printf("Error: Invalid UART_DEV device specified (%u).\n", uart); return -1; } - else if (UART_DEV(uart) == UART_STDIO_DEV) { + else if (UART_DEV(uart) == STDIO_UART_DEV) { printf("Error: The selected UART_DEV(%u) is used for the shell!\n", uart); return -2; } diff --git a/tests/driver_feetech/main.c b/tests/driver_feetech/main.c index c461d740f6..018f5fd412 100644 --- a/tests/driver_feetech/main.c +++ b/tests/driver_feetech/main.c @@ -9,7 +9,7 @@ #include "feetech.h" #include "shell.h" #include "shell_commands.h" -#include "uart_stdio.h" +#include "stdio_uart.h" #include #include @@ -86,7 +86,7 @@ static int parse_uart(char *arg) printf("Error: Invalid UART_DEV device specified (%u).\n", uart); return -1; } - else if (UART_DEV(uart) == UART_STDIO_DEV) { + else if (UART_DEV(uart) == STDIO_UART_DEV) { printf("Error: The selected UART_DEV(%u) is used for the shell!\n", uart); return -2; } diff --git a/tests/driver_rn2xx3/README.md b/tests/driver_rn2xx3/README.md index 3211e9ca13..63262c254c 100644 --- a/tests/driver_rn2xx3/README.md +++ b/tests/driver_rn2xx3/README.md @@ -18,7 +18,7 @@ of the Bee-like module to your board: NOTE: when you use an Arduino Wireless Proto shield, the RN2483/RN2903 module can potentially be connected to the same UART as RIOTs standard out. This is the case for Arduino UNO, and most of the Nucleo 64 boards. -In this case you must redefine `UART_STDIO_DEV` to another UART interface in +In this case you must redefine `STDIO_UART_DEV` to another UART interface in the `board.h` and connect a UART-to-USB adapter to that UART. This is not the case with Arduino-zero or some Nucleo144 boards. diff --git a/tests/driver_xbee/README.md b/tests/driver_xbee/README.md index e9e8aa7a58..9931112a14 100644 --- a/tests/driver_xbee/README.md +++ b/tests/driver_xbee/README.md @@ -9,7 +9,7 @@ module to your board: - GND NOTE: when you use an Arduino Xbee shield, the Xbee module is connected to the -same UART as RIOTs standard out. In this case you must redefine UART_STDIO_DEV to +same UART as RIOTs standard out. In this case you must redefine STDIO_UART_DEV to another UART interface in the board.h and connect a UART-to-USB adapter to that UART. diff --git a/tests/periph_uart/main.c b/tests/periph_uart/main.c index 689c798fe4..fbab5ef4bc 100644 --- a/tests/periph_uart/main.c +++ b/tests/periph_uart/main.c @@ -28,7 +28,7 @@ #include "msg.h" #include "ringbuffer.h" #include "periph/uart.h" -#include "uart_stdio.h" +#include "stdio_uart.h" #include "xtimer.h" #define SHELL_BUFSIZE (128U) @@ -39,8 +39,8 @@ #define POWEROFF_DELAY (250U * US_PER_MS) /* quarter of a second */ -#ifndef UART_STDIO_DEV -#define UART_STDIO_DEV (UART_UNDEF) +#ifndef STDIO_UART_DEV +#define STDIO_UART_DEV (UART_UNDEF) #endif typedef struct { @@ -60,7 +60,7 @@ static int parse_dev(char *arg) printf("Error: Invalid UART_DEV device specified (%u).\n", dev); return -1; } - else if (UART_DEV(dev) == UART_STDIO_DEV) { + else if (UART_DEV(dev) == STDIO_UART_DEV) { printf("Error: The selected UART_DEV(%u) is used for the shell!\n", dev); return -2; } @@ -196,14 +196,14 @@ int main(void) "NOTE: all strings need to be '\\n' terminated!\n"); /* do sleep test for UART used as STDIO. There is a possibility that the - * value given in UART_STDIO_DEV is not a numeral (depends on the CPU + * value given in STDIO_UART_DEV is not a numeral (depends on the CPU * implementation), so we rather break the output by printing a * non-numerical value instead of breaking the UART device descriptor */ - sleep_test(UART_STDIO_DEV, UART_STDIO_DEV); + sleep_test(STDIO_UART_DEV, STDIO_UART_DEV); puts("\nUART INFO:"); printf("Available devices: %i\n", UART_NUMOF); - printf("UART used for STDIO (the shell): UART_DEV(%i)\n\n", UART_STDIO_DEV); + printf("UART used for STDIO (the shell): UART_DEV(%i)\n\n", STDIO_UART_DEV); /* initialize ringbuffers */ for (unsigned i = 0; i < UART_NUMOF; i++) {