revise RT_USING_POSIX_STDIO to RT_USING_POSIX_DEVIO
This commit is contained in:
parent
3bc5ffb495
commit
a3284876ff
|
@ -18,9 +18,9 @@
|
||||||
#include <lwp.h>
|
#include <lwp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RT_USING_POSIX_STDIO
|
#ifdef RT_USING_POSIX_DEVIO
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#endif /* RT_USING_POSIX_STDIO */
|
#endif /* RT_USING_POSIX_DEVIO */
|
||||||
|
|
||||||
/* Global variables */
|
/* Global variables */
|
||||||
const struct dfs_filesystem_ops *filesystem_operation_table[DFS_FILESYSTEM_TYPES_MAX];
|
const struct dfs_filesystem_ops *filesystem_operation_table[DFS_FILESYSTEM_TYPES_MAX];
|
||||||
|
@ -216,10 +216,10 @@ struct dfs_fd *fd_get(int fd)
|
||||||
struct dfs_fd *d;
|
struct dfs_fd *d;
|
||||||
struct dfs_fdtable *fdt;
|
struct dfs_fdtable *fdt;
|
||||||
|
|
||||||
#ifdef RT_USING_POSIX_STDIO
|
#ifdef RT_USING_POSIX_DEVIO
|
||||||
if ((0 <= fd) && (fd <= 2))
|
if ((0 <= fd) && (fd <= 2))
|
||||||
fd = libc_stdio_get_console();
|
fd = libc_stdio_get_console();
|
||||||
#endif /* RT_USING_POSIX_STDIO */
|
#endif /* RT_USING_POSIX_DEVIO */
|
||||||
|
|
||||||
fdt = dfs_fdtable_get();
|
fdt = dfs_fdtable_get();
|
||||||
fd = fd - DFS_FD_OFFSET;
|
fd = fd - DFS_FD_OFFSET;
|
||||||
|
|
|
@ -146,7 +146,7 @@ int finsh_getchar(void)
|
||||||
{
|
{
|
||||||
#ifdef RT_USING_DEVICE
|
#ifdef RT_USING_DEVICE
|
||||||
char ch = 0;
|
char ch = 0;
|
||||||
#ifdef RT_USING_POSIX_STDIO
|
#ifdef RT_USING_POSIX_DEVIO
|
||||||
if(read(STDIN_FILENO, &ch, 1) > 0)
|
if(read(STDIN_FILENO, &ch, 1) > 0)
|
||||||
{
|
{
|
||||||
return ch;
|
return ch;
|
||||||
|
@ -170,14 +170,14 @@ int finsh_getchar(void)
|
||||||
rt_sem_take(&shell->rx_sem, RT_WAITING_FOREVER);
|
rt_sem_take(&shell->rx_sem, RT_WAITING_FOREVER);
|
||||||
|
|
||||||
return ch;
|
return ch;
|
||||||
#endif /* RT_USING_POSIX_STDIO */
|
#endif /* RT_USING_POSIX_DEVIO */
|
||||||
#else
|
#else
|
||||||
extern char rt_hw_console_getchar(void);
|
extern char rt_hw_console_getchar(void);
|
||||||
return rt_hw_console_getchar();
|
return rt_hw_console_getchar();
|
||||||
#endif /* RT_USING_DEVICE */
|
#endif /* RT_USING_DEVICE */
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE)
|
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
|
||||||
static rt_err_t finsh_rx_ind(rt_device_t dev, rt_size_t size)
|
static rt_err_t finsh_rx_ind(rt_device_t dev, rt_size_t size)
|
||||||
{
|
{
|
||||||
RT_ASSERT(shell != RT_NULL);
|
RT_ASSERT(shell != RT_NULL);
|
||||||
|
@ -241,7 +241,7 @@ const char *finsh_get_device()
|
||||||
RT_ASSERT(shell != RT_NULL);
|
RT_ASSERT(shell != RT_NULL);
|
||||||
return shell->device->parent.name;
|
return shell->device->parent.name;
|
||||||
}
|
}
|
||||||
#endif /* !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE) */
|
#endif /* !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE) */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ingroup finsh
|
* @ingroup finsh
|
||||||
|
@ -443,7 +443,7 @@ void finsh_thread_entry(void *parameter)
|
||||||
shell->echo_mode = 0;
|
shell->echo_mode = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE)
|
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
|
||||||
/* set console device as shell device */
|
/* set console device as shell device */
|
||||||
if (shell->device == RT_NULL)
|
if (shell->device == RT_NULL)
|
||||||
{
|
{
|
||||||
|
@ -453,7 +453,7 @@ void finsh_thread_entry(void *parameter)
|
||||||
finsh_set_device(console->parent.name);
|
finsh_set_device(console->parent.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE) */
|
#endif /* !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE) */
|
||||||
|
|
||||||
#ifdef FINSH_USING_AUTH
|
#ifdef FINSH_USING_AUTH
|
||||||
/* set the default password when the password isn't setting */
|
/* set the default password when the password isn't setting */
|
||||||
|
|
|
@ -78,7 +78,7 @@ struct finsh_shell
|
||||||
rt_uint16_t line_position;
|
rt_uint16_t line_position;
|
||||||
rt_uint16_t line_curpos;
|
rt_uint16_t line_curpos;
|
||||||
|
|
||||||
#if !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE)
|
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
|
||||||
rt_device_t device;
|
rt_device_t device;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -13,4 +13,4 @@
|
||||||
|
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
|
|
||||||
#endif
|
#endif /* DFS_SELECT_H__ */
|
||||||
|
|
|
@ -12,7 +12,7 @@ if RT_USING_LIBC
|
||||||
config RT_LIBC_USING_FILEIO
|
config RT_LIBC_USING_FILEIO
|
||||||
bool "Enable libc with file operation, eg.fopen/fwrite/fread/getchar"
|
bool "Enable libc with file operation, eg.fopen/fwrite/fread/getchar"
|
||||||
select RT_USING_POSIX
|
select RT_USING_POSIX
|
||||||
select RT_USING_POSIX_STDIO
|
select RT_USING_POSIX_DEVIO
|
||||||
default n
|
default n
|
||||||
|
|
||||||
config RT_USING_MODULE
|
config RT_USING_MODULE
|
||||||
|
@ -44,8 +44,8 @@ config RT_USING_POSIX
|
||||||
default n
|
default n
|
||||||
|
|
||||||
if RT_USING_POSIX
|
if RT_USING_POSIX
|
||||||
config RT_USING_POSIX_STDIO
|
config RT_USING_POSIX_DEVIO
|
||||||
bool "Enable standard I/O, STDOUT_FILENO/STDIN_FILENO/STDERR_FILENO"
|
bool "Enable devices as file descriptors"
|
||||||
select RT_USING_DFS
|
select RT_USING_DFS
|
||||||
select RT_USING_DFS_DEVFS
|
select RT_USING_DFS_DEVFS
|
||||||
default n
|
default n
|
||||||
|
|
|
@ -21,9 +21,9 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#ifdef RT_USING_POSIX_STDIO
|
#ifdef RT_USING_POSIX_DEVIO
|
||||||
#include "libc.h"
|
#include "libc.h"
|
||||||
#endif
|
#endif /* RT_USING_POSIX_DEVIO */
|
||||||
|
|
||||||
#define DBG_TAG "armlibc.syscalls"
|
#define DBG_TAG "armlibc.syscalls"
|
||||||
#define DBG_LVL DBG_INFO
|
#define DBG_LVL DBG_INFO
|
||||||
|
@ -149,7 +149,7 @@ int _sys_read(FILEHANDLE fh, unsigned char *buf, unsigned len, int mode)
|
||||||
|
|
||||||
if (fh == STDIN)
|
if (fh == STDIN)
|
||||||
{
|
{
|
||||||
#ifdef RT_USING_POSIX_STDIO
|
#ifdef RT_USING_POSIX_DEVIO
|
||||||
if (libc_stdio_get_console() < 0)
|
if (libc_stdio_get_console() < 0)
|
||||||
{
|
{
|
||||||
LOG_W("Do not invoke standard output before initializing libc");
|
LOG_W("Do not invoke standard output before initializing libc");
|
||||||
|
@ -159,7 +159,7 @@ int _sys_read(FILEHANDLE fh, unsigned char *buf, unsigned len, int mode)
|
||||||
return 0; /* success */
|
return 0; /* success */
|
||||||
#else
|
#else
|
||||||
return 0; /* error */
|
return 0; /* error */
|
||||||
#endif
|
#endif /* RT_USING_POSIX_DEVIO */
|
||||||
}
|
}
|
||||||
else if (fh == STDOUT || fh == STDERR)
|
else if (fh == STDOUT || fh == STDERR)
|
||||||
{
|
{
|
||||||
|
@ -332,7 +332,7 @@ int fputc(int c, FILE *f)
|
||||||
|
|
||||||
int fgetc(FILE *f)
|
int fgetc(FILE *f)
|
||||||
{
|
{
|
||||||
#ifdef RT_USING_POSIX_STDIO
|
#ifdef RT_USING_POSIX_DEVIO
|
||||||
char ch;
|
char ch;
|
||||||
|
|
||||||
if (libc_stdio_get_console() < 0)
|
if (libc_stdio_get_console() < 0)
|
||||||
|
@ -343,7 +343,7 @@ int fgetc(FILE *f)
|
||||||
|
|
||||||
if(read(STDIN_FILENO, &ch, 1) == 1)
|
if(read(STDIN_FILENO, &ch, 1) == 1)
|
||||||
return ch;
|
return ch;
|
||||||
#endif /* RT_USING_POSIX_STDIO */
|
#endif /* RT_USING_POSIX_DEVIO */
|
||||||
return 0; /* error */
|
return 0; /* error */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
#include <LowLevelIOInterface.h>
|
#include <LowLevelIOInterface.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#ifdef RT_USING_POSIX_STDIO
|
#ifdef RT_USING_POSIX_DEVIO
|
||||||
#include "libc.h"
|
#include "libc.h"
|
||||||
#endif
|
#endif /* RT_USING_POSIX_DEVIO */
|
||||||
|
|
||||||
#define DBG_TAG "dlib.syscall_read"
|
#define DBG_TAG "dlib.syscall_read"
|
||||||
#define DBG_LVL DBG_INFO
|
#define DBG_LVL DBG_INFO
|
||||||
|
@ -39,7 +39,7 @@ size_t __read(int handle, unsigned char *buf, size_t len)
|
||||||
|
|
||||||
if (handle == _LLIO_STDIN)
|
if (handle == _LLIO_STDIN)
|
||||||
{
|
{
|
||||||
#ifdef RT_USING_POSIX_STDIO
|
#ifdef RT_USING_POSIX_DEVIO
|
||||||
if (libc_stdio_get_console() < 0)
|
if (libc_stdio_get_console() < 0)
|
||||||
{
|
{
|
||||||
LOG_W("Do not invoke standard input before initializing libc");
|
LOG_W("Do not invoke standard input before initializing libc");
|
||||||
|
@ -48,7 +48,7 @@ size_t __read(int handle, unsigned char *buf, size_t len)
|
||||||
return read(STDIN_FILENO, buf, len); /* return the length of the data read */
|
return read(STDIN_FILENO, buf, len); /* return the length of the data read */
|
||||||
#else
|
#else
|
||||||
return _LLIO_ERROR;
|
return _LLIO_ERROR;
|
||||||
#endif /* RT_USING_POSIX_STDIO */
|
#endif /* RT_USING_POSIX_DEVIO */
|
||||||
}
|
}
|
||||||
else if ((handle == _LLIO_STDOUT) || (handle == _LLIO_STDERR))
|
else if ((handle == _LLIO_STDOUT) || (handle == _LLIO_STDERR))
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,10 +11,6 @@
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
#include <LowLevelIOInterface.h>
|
#include <LowLevelIOInterface.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#ifdef RT_USING_POSIX_STDIO
|
|
||||||
#include "libc.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DBG_TAG "dlib.syscall_write"
|
#define DBG_TAG "dlib.syscall_write"
|
||||||
#define DBG_LVL DBG_INFO
|
#define DBG_LVL DBG_INFO
|
||||||
#include <rtdbg.h>
|
#include <rtdbg.h>
|
||||||
|
|
|
@ -20,12 +20,12 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/errno.h>
|
#include <sys/errno.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#ifdef RT_USING_POSIX_STDIO
|
#ifdef RT_USING_POSIX_DEVIO
|
||||||
#include "libc.h"
|
#include "libc.h"
|
||||||
#endif
|
#endif /* RT_USING_POSIX_DEVIO */
|
||||||
#ifdef RT_USING_MODULE
|
#ifdef RT_USING_MODULE
|
||||||
#include <dlmodule.h>
|
#include <dlmodule.h>
|
||||||
#endif
|
#endif /* RT_USING_MODULE */
|
||||||
|
|
||||||
#define DBG_TAG "newlib.syscalls"
|
#define DBG_TAG "newlib.syscalls"
|
||||||
#define DBG_LVL DBG_INFO
|
#define DBG_LVL DBG_INFO
|
||||||
|
@ -225,7 +225,7 @@ _ssize_t _read_r(struct _reent *ptr, int fd, void *buf, size_t nbytes)
|
||||||
_ssize_t rc;
|
_ssize_t rc;
|
||||||
if (fd == STDIN_FILENO)
|
if (fd == STDIN_FILENO)
|
||||||
{
|
{
|
||||||
#ifdef RT_USING_POSIX_STDIO
|
#ifdef RT_USING_POSIX_DEVIO
|
||||||
if (libc_stdio_get_console() < 0)
|
if (libc_stdio_get_console() < 0)
|
||||||
{
|
{
|
||||||
LOG_W("Do not invoke standard input before initializing libc");
|
LOG_W("Do not invoke standard input before initializing libc");
|
||||||
|
@ -234,7 +234,7 @@ _ssize_t _read_r(struct _reent *ptr, int fd, void *buf, size_t nbytes)
|
||||||
#else
|
#else
|
||||||
ptr->_errno = ENOTSUP;
|
ptr->_errno = ENOTSUP;
|
||||||
return -1;
|
return -1;
|
||||||
#endif /* RT_USING_POSIX_STDIO */
|
#endif /* RT_USING_POSIX_DEVIO */
|
||||||
}
|
}
|
||||||
else if (fd == STDOUT_FILENO || fd == STDERR_FILENO)
|
else if (fd == STDOUT_FILENO || fd == STDERR_FILENO)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@ src = ['unistd.c']
|
||||||
cwd = GetCurrentDir()
|
cwd = GetCurrentDir()
|
||||||
CPPPATH = [cwd]
|
CPPPATH = [cwd]
|
||||||
|
|
||||||
if GetDepend('RT_USING_POSIX_STDIO'):
|
if GetDepend('RT_USING_POSIX_DEVIO'):
|
||||||
src += ['libc.c']
|
src += ['libc.c']
|
||||||
|
|
||||||
if GetDepend('RT_USING_POSIX_DELAY'):
|
if GetDepend('RT_USING_POSIX_DELAY'):
|
||||||
|
|
Loading…
Reference in New Issue