Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys/stdio_ethos: replace USE_ETHOS_FOR_STDIO by stdio_ethos pseudomodule #11668

Merged
merged 5 commits into from
Jun 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,12 @@ ifneq (,$(filter shell,$(USEMODULE)))
USEMODULE += stdin
endif

ifneq (,$(filter stdio_ethos,$(USEMODULE)))
kaspar030 marked this conversation as resolved.
Show resolved Hide resolved
USEMODULE += ethos
USEMODULE += stdin
USEMODULE += stdio_uart
endif

ifneq (,$(filter stdin,$(USEMODULE)))
ifneq (,$(filter stdio_uart,$(USEMODULE)))
USEMODULE += stdio_uart_rx
Expand Down
6 changes: 3 additions & 3 deletions dist/tools/ethos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ To use, add

#
GNRC_NETIF_NUMOF := 2
USEMODULE += ethos gnrc_netdev
CFLAGS += '-DETHOS_UART=UART_DEV(0)' -DETHOS_BAUDRATE=115200 -DUSE_ETHOS_FOR_STDIO
USEMODULE += stdio_ethos gnrc_netdev
CFLAGS += '-DETHOS_UART=UART_DEV(0)' -DETHOS_BAUDRATE=115200

to app Makefile, "make clean all flash", then run this tool so follows:
to app Makefile, "make clean all flash", then run this tool as follows:
# sudo ./ethos <tap-device> <serial>
6 changes: 5 additions & 1 deletion drivers/ethos/ethos.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
#include "net/ethernet.h"

#ifdef USE_ETHOS_FOR_STDIO
#error USE_ETHOS_FOR_STDIO is deprecated, use USEMODULE+=stdio_ethos instead
#endif

#ifdef MODULE_STDIO_ETHOS
kaspar030 marked this conversation as resolved.
Show resolved Hide resolved
#include "stdio_uart.h"
#include "isrpipe.h"
extern isrpipe_t stdio_uart_isrpipe;
Expand Down Expand Up @@ -104,7 +108,7 @@ static void _handle_char(ethos_t *dev, char c)
_reset_state(dev);
}
break;
#ifdef USE_ETHOS_FOR_STDIO
#ifdef MODULE_STDIO_ETHOS
case ETHOS_FRAME_TYPE_TEXT:
dev->framesize++;
isrpipe_write_one(&stdio_uart_isrpipe, c);
Expand Down
2 changes: 1 addition & 1 deletion drivers/include/ethos.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extern "C" {
#endif

/* if using ethos + stdio, use STDIO_UART values unless overridden */
#ifdef USE_ETHOS_FOR_STDIO
#ifdef MODULE_STDIO_ETHOS
#include "stdio_uart.h"
#ifndef ETHOS_UART
#define ETHOS_UART STDIO_UART_DEV
Expand Down
4 changes: 2 additions & 2 deletions examples/gnrc_border_router/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ BOARD_BLACKLIST += mips-malta pic32-wifire pic32-clicker ruuvitag thingy52
# UART, but not on native, as native has a tap interface towards the host.
ifeq (,$(filter native,$(BOARD)))
GNRC_NETIF_NUMOF := 2
USEMODULE += ethos
USEMODULE += stdio_ethos

# ethos baudrate can be configured from make command
ETHOS_BAUDRATE ?= 115200
CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE) -DUSE_ETHOS_FOR_STDIO
CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE)
else
GNRC_NETIF_NUMOF := 2
TERMFLAGS += -z [::1]:17754
Expand Down
4 changes: 2 additions & 2 deletions examples/gnrc_border_router/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ has the following:
```make
ifeq (,$(filter native,$(BOARD)))
GNRC_NETIF_NUMOF := 2
USEMODULE += ethos
CFLAGS += '-DETHOS_UART=UART_DEV(0)' -DETHOS_BAUDRATE=115200 -DUSE_ETHOS_FOR_STDIO
USEMODULE += stdio_ethos
CFLAGS += '-DETHOS_UART=UART_DEV(0)' -DETHOS_BAUDRATE=115200
FEATURES_REQUIRED += periph_uart
endif
# include UHCP client
Expand Down
1 change: 1 addition & 0 deletions makefiles/pseudomodules.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ PSEUDOMODULES += sock_ip
PSEUDOMODULES += sock_tcp
PSEUDOMODULES += sock_udp
PSEUDOMODULES += stdin
PSEUDOMODULES += stdio_ethos
PSEUDOMODULES += stdio_uart_rx

# print ascii representation in function od_hex_dump()
Expand Down
18 changes: 8 additions & 10 deletions sys/stdio_uart/stdio_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "periph/uart.h"
#include "isrpipe.h"

#ifdef USE_ETHOS_FOR_STDIO
#ifdef MODULE_STDIO_ETHOS
#include "ethos.h"
extern ethos_t ethos;
#endif
Expand All @@ -61,18 +61,16 @@ void stdio_init(void)
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);
#else
#ifdef MODULE_STDIO_ETHOS
uart_init(ETHOS_UART, ETHOS_BAUDRATE, cb, arg);
#else
uart_init(STDIO_UART_DEV, STDIO_UART_BAUDRATE, cb, arg);
#endif

#if MODULE_VFS
vfs_bind_stdio();
#endif
Expand All @@ -91,10 +89,10 @@ ssize_t stdio_read(void* buffer, size_t count)

ssize_t stdio_write(const void* buffer, size_t len)
{
#ifndef USE_ETHOS_FOR_STDIO
uart_write(STDIO_UART_DEV, (const uint8_t *)buffer, len);
#else
#ifdef MODULE_STDIO_ETHOS
ethos_send_frame(&ethos, (const uint8_t *)buffer, len, ETHOS_FRAME_TYPE_TEXT);
#else
uart_write(STDIO_UART_DEV, (const uint8_t *)buffer, len);
#endif
return len;
}
4 changes: 2 additions & 2 deletions tests/gnrc_ipv6_ext/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ ifeq (native,$(BOARD))

TERMFLAGS ?= $(TAP)
else
USEMODULE += ethos
USEMODULE += stdio_ethos

ETHOS_BAUDRATE ?= 115200
CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE) -DUSE_ETHOS_FOR_STDIO
CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE)
TERMDEPS += ethos
TERMPROG ?= sudo $(RIOTTOOLS)/ethos/ethos
TERMFLAGS ?= $(TAP) $(PORT) $(ETHOS_BAUDRATE)
Expand Down
4 changes: 2 additions & 2 deletions tests/gnrc_rpl_srh/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ ifeq (native,$(BOARD))

TERMFLAGS ?= $(TAP)
else
USEMODULE += ethos
USEMODULE += stdio_ethos

ETHOS_BAUDRATE ?= 115200
CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE) -DUSE_ETHOS_FOR_STDIO
CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE)
TERMDEPS += ethos
TERMPROG ?= sudo $(RIOTTOOLS)/ethos/ethos
TERMFLAGS ?= $(TAP) $(PORT) $(ETHOS_BAUDRATE)
Expand Down
4 changes: 2 additions & 2 deletions tests/gnrc_sock_dns/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ ifeq (native,$(BOARD))

TERMFLAGS ?= $(TAP)
else
USEMODULE += ethos
USEMODULE += stdio_ethos

ETHOS_BAUDRATE ?= 115200
CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE) -DUSE_ETHOS_FOR_STDIO
CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE)
TERMDEPS += ethos
TERMPROG ?= sudo $(RIOTTOOLS)/ethos/ethos
TERMFLAGS ?= $(TAP) $(PORT) $(ETHOS_BAUDRATE)
Expand Down
4 changes: 2 additions & 2 deletions tests/riotboot_flashwrite/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ LOW_MEMORY_BOARDS := nucleo-f334r8
GNRC_NETIF_NUMOF := 2

# uncomment these to use ethos
#USEMODULE += ethos gnrc_uhcpc
#USEMODULE += stdio_ethos gnrc_uhcpc
#
## ethos baudrate can be configured from make command
#ETHOS_BAUDRATE ?= 115200
#CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE) -DUSE_ETHOS_FOR_STDIO
#CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE)

ifneq (,$(filter $(BOARD),$(LOW_MEMORY_BOARDS)))
$(info Using low-memory configuration for microcoap_server.)
Expand Down