1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers: sys: replace USE_ETHOS_FOR_STDIO macro by MODULE_STDIO_ETHOS

This commit is contained in:
Alexandre Abadie 2019-06-06 13:34:34 +02:00
parent df10aa3b59
commit f52d5ebde7
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
3 changed files with 14 additions and 12 deletions

View File

@ -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
#include "stdio_uart.h"
#include "isrpipe.h"
extern isrpipe_t stdio_uart_isrpipe;
@ -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);

View File

@ -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

View File

@ -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
@ -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
@ -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;
}