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
|
* @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
|
* @name xtimer configuration
|
||||||
|
|||||||
@ -37,7 +37,7 @@ extern "C" {
|
|||||||
* baudrate to 9600 for this board
|
* 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
|
* @name Set the default baudrate to 500K for this board
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#ifndef UART_STDIO_BAUDRATE
|
#ifndef STDIO_UART_BAUDRATE
|
||||||
# define UART_STDIO_BAUDRATE (500000U)
|
# define STDIO_UART_BAUDRATE (500000U)
|
||||||
#endif
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "irq.h"
|
#include "irq.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "uart_stdio.h"
|
#include "stdio_base.h"
|
||||||
#include "periph_conf.h"
|
#include "periph_conf.h"
|
||||||
#include "msp430.h"
|
#include "msp430.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
@ -199,6 +199,6 @@ void board_init(void)
|
|||||||
|
|
||||||
msp430_set_cpu_speed(CLOCK_CORECLOCK);
|
msp430_set_cpu_speed(CLOCK_CORECLOCK);
|
||||||
|
|
||||||
/* finally initialize STDIO over UART */
|
/* finally initialize STDIO */
|
||||||
uart_stdio_init();
|
stdio_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "bc.h"
|
#include "bc.h"
|
||||||
|
|
||||||
#include "uart_stdio.h"
|
#include "stdio_uart.h"
|
||||||
|
|
||||||
#include "periph/gpio.h"
|
#include "periph/gpio.h"
|
||||||
#include "periph/uart.h"
|
#include "periph/uart.h"
|
||||||
@ -35,14 +35,14 @@
|
|||||||
/**
|
/**
|
||||||
* @brief Ensure that the correct UART is used.
|
* @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)."
|
#error "The BC requires UART_DEV(0)."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Ensure that the correct baud rate is used.
|
* @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."
|
#error "The BC requires a baud rate of 115200."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "irq.h"
|
#include "irq.h"
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "uart_stdio.h"
|
#include "stdio_uart.h"
|
||||||
#include "periph_conf.h"
|
#include "periph_conf.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -98,5 +98,5 @@ void board_init(void)
|
|||||||
irq_restore(state);
|
irq_restore(state);
|
||||||
|
|
||||||
/* initialize STDIO over UART */
|
/* initialize STDIO over UART */
|
||||||
uart_stdio_init();
|
stdio_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@ export CPU = fe310
|
|||||||
export CPU_MODEL = fe310
|
export CPU_MODEL = fe310
|
||||||
|
|
||||||
# Uses UART0 for stdio input/output (comment out to disable)
|
# Uses UART0 for stdio input/output (comment out to disable)
|
||||||
USEMODULE += uart_stdio
|
USEMODULE += stdio_uart
|
||||||
|
|
||||||
# set default port depending on operating system
|
# set default port depending on operating system
|
||||||
PORT_LINUX ?= /dev/ttyUSB1
|
PORT_LINUX ?= /dev/ttyUSB1
|
||||||
|
|||||||
@ -40,8 +40,8 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#ifndef UART_STDIO_BAUDRATE
|
#ifndef STDIO_UART_BAUDRATE
|
||||||
#define UART_STDIO_BAUDRATE (38400U) /**< Sets Baudrate for e.g. Shell */
|
#define STDIO_UART_BAUDRATE (38400U) /**< Sets Baudrate for e.g. Shell */
|
||||||
#endif
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|||||||
@ -57,7 +57,7 @@ extern "C" {
|
|||||||
/**
|
/**
|
||||||
* @brief Use the USART1 for STDIO on this board
|
* @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
|
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
||||||
|
|||||||
@ -39,15 +39,15 @@ extern "C" {
|
|||||||
* baudrate to 9600 for this board
|
* baudrate to 9600 for this board
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#ifndef UART_STDIO_BAUDRATE
|
#ifndef STDIO_UART_BAUDRATE
|
||||||
#define UART_STDIO_BAUDRATE (9600U)
|
#define STDIO_UART_BAUDRATE (9600U)
|
||||||
#endif
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Use the UART 1 for STDIO on this board
|
* @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
|
* @name xtimer configuration values
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
/**
|
/**
|
||||||
* @brief Use the UART1 for STDIO on this board
|
* @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
|
* @name xtimer configuration
|
||||||
|
|||||||
@ -66,14 +66,14 @@ extern "C" {
|
|||||||
/**
|
/**
|
||||||
* @brief Use the USART2 for STDIO on this board
|
* @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
|
* @name Override with ROBOTIS Bluetooth antenna baudrate for STDIO
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#ifndef UART_STDIO_BAUDRATE
|
#ifndef STDIO_UART_BAUDRATE
|
||||||
#define UART_STDIO_BAUDRATE (921600UL)
|
#define STDIO_UART_BAUDRATE (921600UL)
|
||||||
#endif
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
CPU_MODEL = nrf52832xxaa
|
CPU_MODEL = nrf52832xxaa
|
||||||
|
|
||||||
# for this board, we are using Segger's RTT as default terminal interface
|
# for this board, we are using Segger's RTT as default terminal interface
|
||||||
USEMODULE += rtt_stdio
|
USEMODULE += stdio_rtt
|
||||||
TERMPROG = $(RIOTTOOLS)/jlink/jlink.sh
|
TERMPROG = $(RIOTTOOLS)/jlink/jlink.sh
|
||||||
TERMFLAGS = term_rtt
|
TERMFLAGS = term_rtt
|
||||||
|
|
||||||
|
|||||||
@ -61,7 +61,7 @@ void board_init(void);
|
|||||||
/**
|
/**
|
||||||
* @brief Use the 2nd UART for STDIO on this board
|
* @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
|
* @name xtimer configuration
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "uart_stdio.h"
|
#include "stdio_uart.h"
|
||||||
|
|
||||||
void uart_init(void);
|
void uart_init(void);
|
||||||
|
|
||||||
@ -122,8 +122,8 @@ void board_init(void)
|
|||||||
telosb_ports_init();
|
telosb_ports_init();
|
||||||
msp430_init_dco();
|
msp430_init_dco();
|
||||||
|
|
||||||
/* initialize STDIO over UART */
|
/* initialize STDIO */
|
||||||
uart_stdio_init();
|
stdio_init();
|
||||||
|
|
||||||
/* enable interrupts */
|
/* enable interrupts */
|
||||||
__bis_SR_register(GIE);
|
__bis_SR_register(GIE);
|
||||||
|
|||||||
@ -43,8 +43,8 @@ extern "C" {
|
|||||||
* @name Override default baudrate for STDIO
|
* @name Override default baudrate for STDIO
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#ifndef UART_STDIO_BAUDRATE
|
#ifndef STDIO_UART_BAUDRATE
|
||||||
#define UART_STDIO_BAUDRATE (9600)
|
#define STDIO_UART_BAUDRATE (9600)
|
||||||
#endif
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
CPU_MODEL = nrf52832xxaa
|
CPU_MODEL = nrf52832xxaa
|
||||||
|
|
||||||
# for this board, we are using Segger's RTT as default terminal interface
|
# for this board, we are using Segger's RTT as default terminal interface
|
||||||
USEMODULE += rtt_stdio
|
USEMODULE += stdio_rtt
|
||||||
TERMPROG = $(RIOTTOOLS)/jlink/jlink.sh
|
TERMPROG = $(RIOTTOOLS)/jlink/jlink.sh
|
||||||
TERMFLAGS = term_rtt
|
TERMFLAGS = term_rtt
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@ extern "C" {
|
|||||||
* @brief As the CPU is too slow to handle 115200 baud, we set the default
|
* @brief As the CPU is too slow to handle 115200 baud, we set the default
|
||||||
* baudrate to 9600 for this board
|
* 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
|
* @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
|
#ifdef XBEE_UART
|
||||||
#if XBEE_UART == 0
|
#if XBEE_UART == 0
|
||||||
#define UART_STDIO_DEV (UART_DEV(1))
|
#define STDIO_UART_DEV (UART_DEV(1))
|
||||||
#else
|
#else
|
||||||
#define UART_STDIO_DEV (UART_DEV(0))
|
#define STDIO_UART_DEV (UART_DEV(0))
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "uart_stdio.h"
|
#include "stdio_uart.h"
|
||||||
|
|
||||||
static void z1_ports_init(void)
|
static void z1_ports_init(void)
|
||||||
{
|
{
|
||||||
@ -215,8 +215,8 @@ void board_init(void)
|
|||||||
/* initializes DCO */
|
/* initializes DCO */
|
||||||
msp430_init_dco();
|
msp430_init_dco();
|
||||||
|
|
||||||
/* initialize STDIO over UART */
|
/* initialize STDIO */
|
||||||
uart_stdio_init();
|
stdio_init();
|
||||||
|
|
||||||
/* enable interrupts */
|
/* enable interrupts */
|
||||||
__bis_SR_register(GIE);
|
__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 += atmega_common_periph
|
||||||
export USEMODULE += periph_common
|
export USEMODULE += periph_common
|
||||||
|
|
||||||
# the atmel port uses uart_stdio
|
# the atmel port uses stdio_uart
|
||||||
export USEMODULE += uart_stdio
|
export USEMODULE += stdio_uart
|
||||||
|
|
||||||
# include module specific includes
|
# include module specific includes
|
||||||
export INCLUDES += -I$(RIOTCPU)/atmega_common/include -isystem$(RIOTCPU)/atmega_common/include/vendor
|
export INCLUDES += -I$(RIOTCPU)/atmega_common/include -isystem$(RIOTCPU)/atmega_common/include/vendor
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
|
|
||||||
#include "uart_stdio.h"
|
#include "stdio_uart.h"
|
||||||
|
|
||||||
static int _uart_putchar(char c, FILE *stream);
|
static int _uart_putchar(char c, FILE *stream);
|
||||||
static int _uart_getchar(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)
|
static int _uart_putchar(char c, FILE *stream)
|
||||||
{
|
{
|
||||||
(void) stream;
|
(void) stream;
|
||||||
uart_stdio_write(&c, 1);
|
stdio_write(&c, 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,13 +37,13 @@ static int _uart_getchar(FILE *stream)
|
|||||||
{
|
{
|
||||||
(void) stream;
|
(void) stream;
|
||||||
char c;
|
char c;
|
||||||
uart_stdio_read(&c, 1);
|
stdio_read(&c, 1);
|
||||||
return (int)c;
|
return (int)c;
|
||||||
}
|
}
|
||||||
|
|
||||||
void atmega_stdio_init(void)
|
void atmega_stdio_init(void)
|
||||||
{
|
{
|
||||||
uart_stdio_init();
|
stdio_init();
|
||||||
|
|
||||||
stdout = &_uart_stdout;
|
stdout = &_uart_stdout;
|
||||||
stdin = &_uart_stdin;
|
stdin = &_uart_stdin;
|
||||||
|
|||||||
@ -18,8 +18,8 @@
|
|||||||
* @author Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de>
|
* @author Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de>
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Support static BAUD rate calculation using UART_STDIO_BAUDRATE.
|
* Support static BAUD rate calculation using STDIO_UART_BAUDRATE.
|
||||||
* Set UART_STDIO_BAUDRATE to the desired baud rate and pass it as a -D argument
|
* 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).
|
* 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
|
* 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.
|
* to switch to double speed transmission (U2X) to achieve a lower tolerance.
|
||||||
@ -48,9 +48,9 @@
|
|||||||
#define BAUD_TOL 2
|
#define BAUD_TOL 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(UART_STDIO_BAUDRATE)
|
#if defined(STDIO_UART_BAUDRATE)
|
||||||
/* BAUD and F_CPU are required by setbaud.h to calculated BRR */
|
/* 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
|
#define F_CPU CLOCK_CORECLOCK
|
||||||
#include <util/setbaud.h>
|
#include <util/setbaud.h>
|
||||||
#endif
|
#endif
|
||||||
@ -90,9 +90,9 @@ static void _set_brr(uart_t uart, uint32_t baudrate)
|
|||||||
{
|
{
|
||||||
uint16_t brr;
|
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> */
|
/* 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);
|
_update_brr(uart, UBRR_VALUE, USE_2X);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,8 +22,8 @@
|
|||||||
#ifdef MODULE_VFS
|
#ifdef MODULE_VFS
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "vfs.h"
|
#include "vfs.h"
|
||||||
#elif defined(MODULE_UART_STDIO)
|
#elif defined(MODULE_STDIO_UART)
|
||||||
#include "uart_stdio.h"
|
#include "stdio_uart.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int open(const char *name, int flags, ...)
|
int open(const char *name, int flags, ...)
|
||||||
@ -136,9 +136,9 @@ ssize_t read(int fd, void *dest, size_t count)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
#elif defined(MODULE_UART_STDIO)
|
#elif defined(MODULE_STDIO_UART)
|
||||||
if (fd == 0) {
|
if (fd == 0) {
|
||||||
return uart_stdio_read(dest, count);
|
return stdio_read(dest, count);
|
||||||
}
|
}
|
||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
return -1;
|
return -1;
|
||||||
@ -160,9 +160,9 @@ ssize_t write(int fd, const void *src, size_t count)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
#elif defined(MODULE_UART_STDIO)
|
#elif defined(MODULE_STDIO_UART)
|
||||||
if (fd == 0) {
|
if (fd == 0) {
|
||||||
return uart_stdio_write(src, count);
|
return stdio_write(src, count);
|
||||||
}
|
}
|
||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "irq.h"
|
#include "irq.h"
|
||||||
#include "cpu.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_start; /* Heap markers from fe310.ld file */
|
||||||
extern char _heap_end;
|
extern char _heap_end;
|
||||||
@ -38,9 +38,9 @@ char *heap_top = &_heap_start + 4;
|
|||||||
*/
|
*/
|
||||||
void nanostubs_init(void)
|
void nanostubs_init(void)
|
||||||
{
|
{
|
||||||
#if defined(MODULE_UART_STDIO)
|
#if defined(MODULE_STDIO_UART)
|
||||||
/* STDIO redirected to UART, no line buffering */
|
/* STDIO redirected to UART, no line buffering */
|
||||||
uart_stdio_init();
|
stdio_init();
|
||||||
setvbuf(stdout, NULL, _IONBF, 0);
|
setvbuf(stdout, NULL, _IONBF, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -82,9 +82,9 @@ int _open(const char *name, int flags, int mode)
|
|||||||
|
|
||||||
_ssize_t _read(int fd, void *buffer, size_t count)
|
_ssize_t _read(int fd, void *buffer, size_t count)
|
||||||
{
|
{
|
||||||
#if defined(MODULE_UART_STDIO)
|
#if defined(MODULE_STDIO_UART)
|
||||||
if (fd == STDIN_FILENO) {
|
if (fd == STDIN_FILENO) {
|
||||||
return uart_stdio_read(buffer, count);
|
return stdio_read(buffer, count);
|
||||||
}
|
}
|
||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
return -1;
|
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)
|
_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) {
|
if (fd == STDOUT_FILENO || fd == STDERR_FILENO) {
|
||||||
return uart_stdio_write(data, count);
|
return stdio_write(data, count);
|
||||||
}
|
}
|
||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
include $(RIOTCPU)/msp430_common/Makefile.include
|
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 <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "uart_stdio.h"
|
#include "stdio_uart.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get one character from STDIO - used by the libc
|
* @brief Get one character from STDIO - used by the libc
|
||||||
@ -29,7 +29,7 @@
|
|||||||
int getchar(void)
|
int getchar(void)
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
uart_stdio_read(&c, 1);
|
stdio_read(&c, 1);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ int getchar(void)
|
|||||||
int putchar(int c)
|
int putchar(int c)
|
||||||
{
|
{
|
||||||
char _c = 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)
|
ssize_t write(int fildes, const void *buf, size_t nbyte)
|
||||||
{
|
{
|
||||||
if (fildes == STDOUT_FILENO) {
|
if (fildes == STDOUT_FILENO) {
|
||||||
return uart_stdio_write(buf, nbyte);
|
return stdio_write(buf, nbyte);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@ -34,9 +34,9 @@
|
|||||||
#include "net/ethernet.h"
|
#include "net/ethernet.h"
|
||||||
|
|
||||||
#ifdef USE_ETHOS_FOR_STDIO
|
#ifdef USE_ETHOS_FOR_STDIO
|
||||||
#include "uart_stdio.h"
|
#include "stdio_uart.h"
|
||||||
#include "isrpipe.h"
|
#include "isrpipe.h"
|
||||||
extern isrpipe_t uart_stdio_isrpipe;
|
extern isrpipe_t stdio_uart_isrpipe;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ENABLE_DEBUG (0)
|
#define ENABLE_DEBUG (0)
|
||||||
@ -102,7 +102,7 @@ static void _handle_char(ethos_t *dev, char c)
|
|||||||
#ifdef USE_ETHOS_FOR_STDIO
|
#ifdef USE_ETHOS_FOR_STDIO
|
||||||
case ETHOS_FRAME_TYPE_TEXT:
|
case ETHOS_FRAME_TYPE_TEXT:
|
||||||
dev->framesize++;
|
dev->framesize++;
|
||||||
isrpipe_write_one(&uart_stdio_isrpipe, c);
|
isrpipe_write_one(&stdio_uart_isrpipe, c);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,14 +31,14 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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
|
#ifdef USE_ETHOS_FOR_STDIO
|
||||||
#include "uart_stdio.h"
|
#include "stdio_uart.h"
|
||||||
#ifndef ETHOS_UART
|
#ifndef ETHOS_UART
|
||||||
#define ETHOS_UART UART_STDIO_DEV
|
#define ETHOS_UART STDIO_UART_DEV
|
||||||
#endif
|
#endif
|
||||||
#ifndef ETHOS_BAUDRATE
|
#ifndef ETHOS_BAUDRATE
|
||||||
#define ETHOS_BAUDRATE UART_STDIO_BAUDRATE
|
#define ETHOS_BAUDRATE STDIO_UART_BAUDRATE
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -16,8 +16,8 @@
|
|||||||
// For some boards RIOT defines a macro assigning the required baudrate of the
|
// 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
|
// serial link. If this macro is not set, the default baudrate is set to
|
||||||
// 115200.
|
// 115200.
|
||||||
#ifdef UART_STDIO_BAUDRATE
|
#ifdef STDIO_UART_BAUDRATE
|
||||||
#define SERIAL_BAUDRATE UART_STDIO_BAUDRATE
|
#define SERIAL_BAUDRATE STDIO_UART_BAUDRATE
|
||||||
#else
|
#else
|
||||||
#define SERIAL_BAUDRATE 115200
|
#define SERIAL_BAUDRATE 115200
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
#include "net/gnrc/netif/ethernet.h"
|
#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;
|
ethos_t ethos;
|
||||||
|
|
||||||
|
|||||||
@ -45,7 +45,7 @@
|
|||||||
#include "vfs.h"
|
#include "vfs.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "uart_stdio.h"
|
#include "stdio_base.h"
|
||||||
|
|
||||||
#include <sys/times.h>
|
#include <sys/times.h>
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ char *heap_top = &_sheap + 4;
|
|||||||
*/
|
*/
|
||||||
void _init(void)
|
void _init(void)
|
||||||
{
|
{
|
||||||
uart_stdio_init();
|
stdio_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -389,7 +389,7 @@ int _unlink_r(struct _reent *r, const char *path)
|
|||||||
/*
|
/*
|
||||||
* Fallback read function
|
* 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.
|
* block until a byte is actually read.
|
||||||
*
|
*
|
||||||
* Note: the read function does not buffer - data will be lost if the function is not
|
* 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)r;
|
||||||
(void)fd;
|
(void)fd;
|
||||||
return uart_stdio_read(buffer, count);
|
return stdio_read(buffer, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fallback write function
|
* 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.
|
* 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)
|
_ssize_t _write_r(struct _reent *r, int fd, const void *data, size_t count)
|
||||||
{
|
{
|
||||||
(void) r;
|
(void) r;
|
||||||
(void) fd;
|
(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 */
|
/* 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) {
|
if (fd != STDIN_FILENO) {
|
||||||
return -EBADF;
|
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)
|
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) {
|
if (fd == STDIN_FILENO) {
|
||||||
return -EBADF;
|
return -EBADF;
|
||||||
}
|
}
|
||||||
return stdio_uart_write(src, nbytes);
|
return stdio_write(src, nbytes);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -871,7 +871,7 @@ static inline int _allocate_fd(int fd)
|
|||||||
if ((fd == STDIN_FILENO) || (fd == STDOUT_FILENO) || (fd == STDERR_FILENO)) {
|
if ((fd == STDIN_FILENO) || (fd == STDOUT_FILENO) || (fd == STDERR_FILENO)) {
|
||||||
/* Do not auto-allocate the stdio file descriptor numbers to
|
/* Do not auto-allocate the stdio file descriptor numbers to
|
||||||
* avoid conflicts between normal file system users and stdio
|
* 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. */
|
* to bind to these specific file descriptor numbers. */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
#include "dynamixel.h"
|
#include "dynamixel.h"
|
||||||
#include "shell.h"
|
#include "shell.h"
|
||||||
#include "shell_commands.h"
|
#include "shell_commands.h"
|
||||||
#include "uart_stdio.h"
|
#include "stdio_uart.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "periph/gpio.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);
|
printf("Error: Invalid UART_DEV device specified (%u).\n", uart);
|
||||||
return -1;
|
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);
|
printf("Error: The selected UART_DEV(%u) is used for the shell!\n", uart);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
#include "feetech.h"
|
#include "feetech.h"
|
||||||
#include "shell.h"
|
#include "shell.h"
|
||||||
#include "shell_commands.h"
|
#include "shell_commands.h"
|
||||||
#include "uart_stdio.h"
|
#include "stdio_uart.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -86,7 +86,7 @@ static int parse_uart(char *arg)
|
|||||||
printf("Error: Invalid UART_DEV device specified (%u).\n", uart);
|
printf("Error: Invalid UART_DEV device specified (%u).\n", uart);
|
||||||
return -1;
|
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);
|
printf("Error: The selected UART_DEV(%u) is used for the shell!\n", uart);
|
||||||
return -2;
|
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
|
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
|
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.
|
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.
|
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.
|
This is not the case with Arduino-zero or some Nucleo144 boards.
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ module to your board:
|
|||||||
- GND
|
- GND
|
||||||
|
|
||||||
NOTE: when you use an Arduino Xbee shield, the Xbee module is connected to the
|
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
|
another UART interface in the board.h and connect a UART-to-USB adapter to that
|
||||||
UART.
|
UART.
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
#include "ringbuffer.h"
|
#include "ringbuffer.h"
|
||||||
#include "periph/uart.h"
|
#include "periph/uart.h"
|
||||||
#include "uart_stdio.h"
|
#include "stdio_uart.h"
|
||||||
#include "xtimer.h"
|
#include "xtimer.h"
|
||||||
|
|
||||||
#define SHELL_BUFSIZE (128U)
|
#define SHELL_BUFSIZE (128U)
|
||||||
@ -39,8 +39,8 @@
|
|||||||
|
|
||||||
#define POWEROFF_DELAY (250U * US_PER_MS) /* quarter of a second */
|
#define POWEROFF_DELAY (250U * US_PER_MS) /* quarter of a second */
|
||||||
|
|
||||||
#ifndef UART_STDIO_DEV
|
#ifndef STDIO_UART_DEV
|
||||||
#define UART_STDIO_DEV (UART_UNDEF)
|
#define STDIO_UART_DEV (UART_UNDEF)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -60,7 +60,7 @@ static int parse_dev(char *arg)
|
|||||||
printf("Error: Invalid UART_DEV device specified (%u).\n", dev);
|
printf("Error: Invalid UART_DEV device specified (%u).\n", dev);
|
||||||
return -1;
|
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);
|
printf("Error: The selected UART_DEV(%u) is used for the shell!\n", dev);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
@ -196,14 +196,14 @@ int main(void)
|
|||||||
"NOTE: all strings need to be '\\n' terminated!\n");
|
"NOTE: all strings need to be '\\n' terminated!\n");
|
||||||
|
|
||||||
/* do sleep test for UART used as STDIO. There is a possibility that the
|
/* 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
|
* implementation), so we rather break the output by printing a
|
||||||
* non-numerical value instead of breaking the UART device descriptor */
|
* 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:");
|
puts("\nUART INFO:");
|
||||||
printf("Available devices: %i\n", UART_NUMOF);
|
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 */
|
/* initialize ringbuffers */
|
||||||
for (unsigned i = 0; i < UART_NUMOF; i++) {
|
for (unsigned i = 0; i < UART_NUMOF; i++) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user