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

core/init: call vfs_bind_stdio() in early_init()

This commit is contained in:
Benjamin Valentin 2023-01-02 18:11:24 +01:00
parent 124b849503
commit 59f067171f
11 changed files with 8 additions and 72 deletions

View File

@ -31,6 +31,10 @@
#include "thread.h" #include "thread.h"
#include "stdio_base.h" #include "stdio_base.h"
#if IS_USED(MODULE_VFS)
#include "vfs.h"
#endif
#define ENABLE_DEBUG 0 #define ENABLE_DEBUG 0
#include "debug.h" #include "debug.h"
@ -113,4 +117,8 @@ void early_init(void)
} }
stdio_init(); stdio_init();
#if MODULE_VFS
vfs_bind_stdio();
#endif
} }

View File

@ -15,15 +15,11 @@
#include "kernel_defines.h" #include "kernel_defines.h"
#include "native_internal.h" #include "native_internal.h"
#include "vfs.h"
#include "stdio_base.h" #include "stdio_base.h"
void stdio_init(void) void stdio_init(void)
{ {
if (IS_USED(MODULE_VFS)) {
vfs_bind_stdio();
}
} }
ssize_t stdio_read(void* buffer, size_t max_len) ssize_t stdio_read(void* buffer, size_t max_len)

View File

@ -24,9 +24,6 @@
#include "ethos.h" #include "ethos.h"
#include "isrpipe.h" #include "isrpipe.h"
#include "stdio_uart.h" #include "stdio_uart.h"
#if IS_USED(MODULE_VFS)
#include "vfs.h"
#endif
extern ethos_t ethos; extern ethos_t ethos;
@ -41,10 +38,6 @@ static void _isrpipe_write(void *arg, uint8_t data)
void stdio_init(void) void stdio_init(void)
{ {
uart_init(ETHOS_UART, ETHOS_BAUDRATE, _isrpipe_write, &ethos_stdio_isrpipe); uart_init(ETHOS_UART, ETHOS_BAUDRATE, _isrpipe_write, &ethos_stdio_isrpipe);
#if MODULE_VFS
vfs_bind_stdio();
#endif
} }
extern unsigned ethos_unstuff_readbyte(uint8_t *buf, uint8_t byte, extern unsigned ethos_unstuff_readbyte(uint8_t *buf, uint8_t byte,

View File

@ -28,18 +28,10 @@
#include "tusb.h" #include "tusb.h"
#include "tinyusb.h" #include "tinyusb.h"
#if MODULE_VFS
#include "vfs.h"
#endif
static mutex_t data_lock = MUTEX_INIT_LOCKED; static mutex_t data_lock = MUTEX_INIT_LOCKED;
void stdio_init(void) void stdio_init(void)
{ {
/* Initialize this side of the CDC ACM pipe */
#if MODULE_VFS
vfs_bind_stdio();
#endif
} }
#if IS_USED(MODULE_STDIO_AVAILABLE) #if IS_USED(MODULE_STDIO_AVAILABLE)

View File

@ -29,9 +29,6 @@
#include "stdio_uart.h" #include "stdio_uart.h"
#include "periph/uart.h" #include "periph/uart.h"
#endif #endif
#if IS_USED(MODULE_VFS)
#include "vfs.h"
#endif
#ifdef CPU_NATIVE #ifdef CPU_NATIVE
#include "native_internal.h" #include "native_internal.h"
#endif #endif
@ -62,10 +59,6 @@ static inline int _write_fallback(const void* buffer, size_t len)
void stdio_init(void) void stdio_init(void)
{ {
_init_fallback(); _init_fallback();
#if IS_USED(MODULE_VFS)
vfs_bind_stdio();
#endif
} }
ssize_t stdio_read(void* buffer, size_t count) ssize_t stdio_read(void* buffer, size_t count)

View File

@ -39,10 +39,6 @@
#include "periph/uart.h" #include "periph/uart.h"
#endif /* IS_USED(MODULE_STDIO_NIMBLE_DEBUG) */ #endif /* IS_USED(MODULE_STDIO_NIMBLE_DEBUG) */
#if IS_USED(MODULE_VFS)
#include "vfs.h"
#endif
#include "tsrb.h" #include "tsrb.h"
#include "isrpipe.h" #include "isrpipe.h"
#include "stdio_nimble.h" #include "stdio_nimble.h"
@ -312,10 +308,6 @@ static int gatt_svr_chr_access_stdin(
void stdio_init(void) void stdio_init(void)
{ {
#if IS_USED(MODULE_VFS)
vfs_bind_stdio();
#endif
#if IS_USED(MODULE_STDIO_NIMBLE_DEBUG) #if IS_USED(MODULE_STDIO_NIMBLE_DEBUG)
uart_init(STDIO_UART_DEV, STDIO_UART_BAUDRATE, NULL, NULL); uart_init(STDIO_UART_DEV, STDIO_UART_BAUDRATE, NULL, NULL);
#endif #endif

View File

@ -22,18 +22,11 @@
#include "stdio_base.h" #include "stdio_base.h"
#if MODULE_VFS
#include "vfs.h"
#endif
#define ENABLE_DEBUG 0 #define ENABLE_DEBUG 0
#include "debug.h" #include "debug.h"
void stdio_init(void) void stdio_init(void)
{ {
#if MODULE_VFS
vfs_bind_stdio();
#endif
} }
ssize_t stdio_read(void* buffer, size_t count) ssize_t stdio_read(void* buffer, size_t count)

View File

@ -82,10 +82,6 @@
#include "thread.h" #include "thread.h"
#include "ztimer.h" #include "ztimer.h"
#if MODULE_VFS
#include "vfs.h"
#endif
/* This parameter affects the bandwidth of both input and output. Decreasing /* This parameter affects the bandwidth of both input and output. Decreasing
it will significantly improve bandwidth at the cost of CPU time. */ it will significantly improve bandwidth at the cost of CPU time. */
#ifndef STDIO_POLL_INTERVAL_MS #ifndef STDIO_POLL_INTERVAL_MS
@ -282,10 +278,6 @@ void stdio_init(void) {
blocking_stdout = 1; blocking_stdout = 1;
#endif #endif
#if MODULE_VFS
vfs_bind_stdio();
#endif
/* the mutex should start locked */ /* the mutex should start locked */
mutex_lock(&_rx_mutex); mutex_lock(&_rx_mutex);
} }

View File

@ -27,10 +27,6 @@
#include "stdio_semihosting.h" #include "stdio_semihosting.h"
#include "ztimer.h" #include "ztimer.h"
#if MODULE_VFS
#include "vfs.h"
#endif
/** /**
* @brief Rate at which the stdin read polls (breaks) the debugger for input * @brief Rate at which the stdin read polls (breaks) the debugger for input
* data in milliseconds * data in milliseconds
@ -149,9 +145,6 @@ static ssize_t _semihosting_read(uint8_t *buffer, size_t len)
void stdio_init(void) void stdio_init(void)
{ {
#if MODULE_VFS
vfs_bind_stdio();
#endif
} }
ssize_t stdio_read(void* buffer, size_t count) ssize_t stdio_read(void* buffer, size_t count)

View File

@ -36,10 +36,6 @@
#include "periph/uart.h" #include "periph/uart.h"
#include "stdio_uart.h" #include "stdio_uart.h"
#if MODULE_VFS
#include "vfs.h"
#endif
#define ENABLE_DEBUG 0 #define ENABLE_DEBUG 0
#include "debug.h" #include "debug.h"
@ -62,10 +58,6 @@ void stdio_init(void)
} }
uart_init(STDIO_UART_DEV, STDIO_UART_BAUDRATE, cb, arg); uart_init(STDIO_UART_DEV, STDIO_UART_BAUDRATE, cb, arg);
#if MODULE_VFS
vfs_bind_stdio();
#endif
} }
#if IS_USED(MODULE_STDIO_AVAILABLE) #if IS_USED(MODULE_STDIO_AVAILABLE)

View File

@ -30,10 +30,6 @@
#include "usb/usbus.h" #include "usb/usbus.h"
#include "usb/usbus/cdc/acm.h" #include "usb/usbus/cdc/acm.h"
#if MODULE_VFS
#include "vfs.h"
#endif
static usbus_cdcacm_device_t cdcacm; static usbus_cdcacm_device_t cdcacm;
static uint8_t _cdc_tx_buf_mem[CONFIG_USBUS_CDC_ACM_STDIO_BUF_SIZE]; static uint8_t _cdc_tx_buf_mem[CONFIG_USBUS_CDC_ACM_STDIO_BUF_SIZE];
static uint8_t _cdc_rx_buf_mem[CONFIG_USBUS_CDC_ACM_STDIO_BUF_SIZE]; static uint8_t _cdc_rx_buf_mem[CONFIG_USBUS_CDC_ACM_STDIO_BUF_SIZE];
@ -41,10 +37,6 @@ static isrpipe_t _cdc_stdio_isrpipe = ISRPIPE_INIT(_cdc_rx_buf_mem);
void stdio_init(void) void stdio_init(void)
{ {
/* Initialize this side of the CDC ACM pipe */
#if MODULE_VFS
vfs_bind_stdio();
#endif
} }
#if IS_USED(MODULE_STDIO_AVAILABLE) #if IS_USED(MODULE_STDIO_AVAILABLE)