Skip to content

Commit

Permalink
Revert "Merge [...] #11310 from OTAkeys/make_uart_stdio_rx_optional"
Browse files Browse the repository at this point in the history
This change was breaking (dependencies for) ethos, shell, etc, as well as an unknown
number of external apps (API change.) See #11525 for more details.

Fixes #11525.
  • Loading branch information
jcarrano committed May 28, 2019
1 parent bb6a06a commit 768c35f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 38 deletions.
12 changes: 1 addition & 11 deletions Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -397,18 +397,8 @@ ifneq (,$(filter stdio_rtt,$(USEMODULE)))
USEMODULE += xtimer
endif

ifneq (,$(filter shell,$(USEMODULE)))
ifneq (,$(filter stdio_uart,$(USEMODULE)))
USEMODULE += stdio_uart_rx
endif
endif

ifneq (,$(filter stdio_uart_rx,$(USEMODULE)))
USEMODULE += isrpipe
USEMODULE += stdio_uart
endif

ifneq (,$(filter stdio_uart,$(USEMODULE)))
USEMODULE += isrpipe
FEATURES_REQUIRED += periph_uart
endif

Expand Down
1 change: 0 additions & 1 deletion makefiles/pseudomodules.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ PSEUDOMODULES += sock
PSEUDOMODULES += sock_ip
PSEUDOMODULES += sock_tcp
PSEUDOMODULES += sock_udp
PSEUDOMODULES += stdio_uart_rx

# print ascii representation in function od_hex_dump()
PSEUDOMODULES += od_string
Expand Down
29 changes: 3 additions & 26 deletions sys/stdio_uart/stdio_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
* @}
*/

#include <errno.h>

#include "stdio_uart.h"

#include "board.h"
Expand All @@ -47,31 +45,16 @@ extern ethos_t ethos;
#define ENABLE_DEBUG 0
#include "debug.h"

#ifdef MODULE_STDIO_UART_RX

static char _rx_buf_mem[STDIO_UART_RX_BUFSIZE];
isrpipe_t stdio_uart_isrpipe = ISRPIPE_INIT(_rx_buf_mem);
#endif

void stdio_init(void)
{
uart_rx_cb_t cb;
void *arg;

#ifdef MODULE_STDIO_UART_RX
cb = (uart_rx_cb_t) isrpipe_write_one;
arg = &stdio_uart_isrpipe;
#else
#ifdef USE_ETHOS_FOR_STDIO
#error "ethos needs stdio_uart_rx"
#endif
cb = NULL;
arg = NULL;
#endif

#ifndef USE_ETHOS_FOR_STDIO
uart_init(STDIO_UART_DEV, STDIO_UART_BAUDRATE, cb, arg);
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, cb, arg);
uart_init(ETHOS_UART, ETHOS_BAUDRATE, (uart_rx_cb_t) isrpipe_write_one, &stdio_uart_isrpipe);
#endif
#if MODULE_VFS
vfs_bind_stdio();
Expand All @@ -80,13 +63,7 @@ void stdio_init(void)

ssize_t stdio_read(void* buffer, size_t count)
{
#ifdef MODULE_STDIO_UART_RX
return (ssize_t)isrpipe_read(&stdio_uart_isrpipe, (char *)buffer, count);
#else
(void)buffer;
(void)count;
return -ENOTSUP;
#endif
}

ssize_t stdio_write(const void* buffer, size_t len)
Expand Down

0 comments on commit 768c35f

Please sign in to comment.