boards/cpu/drivers/sys: use generic stdio_ if
This commit is contained in:
parent
9bd2363643
commit
c2184f3454
@ -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
|
||||
|
||||
@ -37,7 +37,7 @@ extern "C" {
|
||||
* baudrate to 9600 for this board
|
||||
* @{
|
||||
*/
|
||||
#define UART_STDIO_BAUDRATE (9600U)
|
||||
#define STDIO_UART_BAUDRATE (9600U)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
|
||||
@ -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
|
||||
/** @} */
|
||||
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
/** @} */
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
/** @} */
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
/** @} */
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
#include <stdio.h>
|
||||
#include <avr/io.h>
|
||||
|
||||
#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;
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
* @author Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de>
|
||||
*
|
||||
*
|
||||
* 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 <util/setbaud.h>
|
||||
#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 <util/setbaud.h> */
|
||||
if (baudrate == UART_STDIO_BAUDRATE) {
|
||||
if (baudrate == STDIO_UART_BAUDRATE) {
|
||||
_update_brr(uart, UBRR_VALUE, USE_2X);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -22,8 +22,8 @@
|
||||
#ifdef MODULE_VFS
|
||||
#include <fcntl.h>
|
||||
#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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
include $(RIOTCPU)/msp430_common/Makefile.include
|
||||
|
||||
export USEMODULE += periph periph_common uart_stdio
|
||||
export USEMODULE += periph periph_common stdio_uart
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#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;
|
||||
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
#include "vfs.h"
|
||||
#endif
|
||||
|
||||
#include "uart_stdio.h"
|
||||
#include "stdio_base.h"
|
||||
|
||||
#include <sys/times.h>
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
#include "feetech.h"
|
||||
#include "shell.h"
|
||||
#include "shell_commands.h"
|
||||
#include "uart_stdio.h"
|
||||
#include "stdio_uart.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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.
|
||||
|
||||
|
||||
@ -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.
|
||||
|
||||
|
||||
@ -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++) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user