1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-24 22:13:52 +01:00

posix: configure stdio only to uart0 if enabled

This commit is contained in:
Oleg Hahm 2014-10-02 10:12:28 +02:00
parent 9cf21545fa
commit a50d44c195

View File

@ -21,7 +21,9 @@
#include <string.h>
#include "posix_io.h"
#ifdef MODULE_UART0
#include "board_uart0.h"
#endif
#include "unistd.h"
#include "fd.h"
@ -38,6 +40,7 @@ int fd_init(void)
{
memset(fd_table, 0, sizeof(fd_t) * FD_MAX);
#ifdef MODULE_UART0
posix_open(uart0_handler_pid, 0);
fd_t fd = {
.__active = 1,
@ -49,6 +52,7 @@ int fd_init(void)
memcpy(&fd_table[STDIN_FILENO], &fd, sizeof(fd_t));
memcpy(&fd_table[STDOUT_FILENO], &fd, sizeof(fd_t));
memcpy(&fd_table[STDERR_FILENO], &fd, sizeof(fd_t));
#endif
return FD_MAX;
}