drivers: sys: replace USE_ETHOS_FOR_STDIO macro by MODULE_STDIO_ETHOS
This commit is contained in:
parent
df10aa3b59
commit
f52d5ebde7
@ -34,6 +34,10 @@
|
|||||||
#include "net/ethernet.h"
|
#include "net/ethernet.h"
|
||||||
|
|
||||||
#ifdef USE_ETHOS_FOR_STDIO
|
#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 "stdio_uart.h"
|
||||||
#include "isrpipe.h"
|
#include "isrpipe.h"
|
||||||
extern isrpipe_t stdio_uart_isrpipe;
|
extern isrpipe_t stdio_uart_isrpipe;
|
||||||
@ -104,7 +108,7 @@ static void _handle_char(ethos_t *dev, char c)
|
|||||||
_reset_state(dev);
|
_reset_state(dev);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef USE_ETHOS_FOR_STDIO
|
#ifdef MODULE_STDIO_ETHOS
|
||||||
case ETHOS_FRAME_TYPE_TEXT:
|
case ETHOS_FRAME_TYPE_TEXT:
|
||||||
dev->framesize++;
|
dev->framesize++;
|
||||||
isrpipe_write_one(&stdio_uart_isrpipe, c);
|
isrpipe_write_one(&stdio_uart_isrpipe, c);
|
||||||
|
|||||||
@ -34,7 +34,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* if using ethos + stdio, use STDIO_UART values unless overridden */
|
/* if using ethos + stdio, use STDIO_UART values unless overridden */
|
||||||
#ifdef USE_ETHOS_FOR_STDIO
|
#ifdef MODULE_STDIO_ETHOS
|
||||||
#include "stdio_uart.h"
|
#include "stdio_uart.h"
|
||||||
#ifndef ETHOS_UART
|
#ifndef ETHOS_UART
|
||||||
#define ETHOS_UART STDIO_UART_DEV
|
#define ETHOS_UART STDIO_UART_DEV
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
#include "periph/uart.h"
|
#include "periph/uart.h"
|
||||||
#include "isrpipe.h"
|
#include "isrpipe.h"
|
||||||
|
|
||||||
#ifdef USE_ETHOS_FOR_STDIO
|
#ifdef MODULE_STDIO_ETHOS
|
||||||
#include "ethos.h"
|
#include "ethos.h"
|
||||||
extern ethos_t ethos;
|
extern ethos_t ethos;
|
||||||
#endif
|
#endif
|
||||||
@ -61,18 +61,16 @@ void stdio_init(void)
|
|||||||
cb = (uart_rx_cb_t) isrpipe_write_one;
|
cb = (uart_rx_cb_t) isrpipe_write_one;
|
||||||
arg = &stdio_uart_isrpipe;
|
arg = &stdio_uart_isrpipe;
|
||||||
#else
|
#else
|
||||||
#ifdef USE_ETHOS_FOR_STDIO
|
|
||||||
#error "ethos needs stdio_uart_rx"
|
|
||||||
#endif
|
|
||||||
cb = NULL;
|
cb = NULL;
|
||||||
arg = NULL;
|
arg = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef USE_ETHOS_FOR_STDIO
|
#ifdef MODULE_STDIO_ETHOS
|
||||||
uart_init(STDIO_UART_DEV, STDIO_UART_BAUDRATE, cb, arg);
|
|
||||||
#else
|
|
||||||
uart_init(ETHOS_UART, ETHOS_BAUDRATE, cb, arg);
|
uart_init(ETHOS_UART, ETHOS_BAUDRATE, cb, arg);
|
||||||
|
#else
|
||||||
|
uart_init(STDIO_UART_DEV, STDIO_UART_BAUDRATE, cb, arg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MODULE_VFS
|
#if MODULE_VFS
|
||||||
vfs_bind_stdio();
|
vfs_bind_stdio();
|
||||||
#endif
|
#endif
|
||||||
@ -91,10 +89,10 @@ ssize_t stdio_read(void* buffer, size_t count)
|
|||||||
|
|
||||||
ssize_t stdio_write(const void* buffer, size_t len)
|
ssize_t stdio_write(const void* buffer, size_t len)
|
||||||
{
|
{
|
||||||
#ifndef USE_ETHOS_FOR_STDIO
|
#ifdef MODULE_STDIO_ETHOS
|
||||||
uart_write(STDIO_UART_DEV, (const uint8_t *)buffer, len);
|
|
||||||
#else
|
|
||||||
ethos_send_frame(ðos, (const uint8_t *)buffer, len, ETHOS_FRAME_TYPE_TEXT);
|
ethos_send_frame(ðos, (const uint8_t *)buffer, len, ETHOS_FRAME_TYPE_TEXT);
|
||||||
|
#else
|
||||||
|
uart_write(STDIO_UART_DEV, (const uint8_t *)buffer, len);
|
||||||
#endif
|
#endif
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user