Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaobo07
rt-thread
提交
4e9744c0
R
rt-thread
项目概览
Xiaobo07
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
2
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
4e9744c0
编写于
11月 29, 2021
作者:
G
guo
提交者:
GitHub
11月 29, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5302 from mysterywolf/posix
[PSE分支] 新增 RT_USING_POSIX_DEVIO
上级
3bc5ffb4
7c789d4b
变更
51
隐藏空白更改
内联
并排
Showing
51 changed file
with
112 addition
and
99 deletion
+112
-99
bsp/avr32uc3b0/startup.c
bsp/avr32uc3b0/startup.c
+2
-0
bsp/bf533/startup.c
bsp/bf533/startup.c
+2
-0
bsp/efm32/startup.c
bsp/efm32/startup.c
+2
-0
bsp/frdm-k64f/applications/startup.c
bsp/frdm-k64f/applications/startup.c
+2
-0
bsp/juicevm/rtconfig.h
bsp/juicevm/rtconfig.h
+0
-1
bsp/lm3s8962/applications/startup.c
bsp/lm3s8962/applications/startup.c
+1
-1
bsp/lm3s9b9x/applications/startup.c
bsp/lm3s9b9x/applications/startup.c
+1
-1
bsp/lm4f232/applications/startup.c
bsp/lm4f232/applications/startup.c
+1
-1
bsp/lpc43xx/M0/applications/application.c
bsp/lpc43xx/M0/applications/application.c
+2
-0
bsp/lpc43xx/M4/applications/application.c
bsp/lpc43xx/M4/applications/application.c
+2
-0
bsp/m16c62p/applications/startup.c
bsp/m16c62p/applications/startup.c
+2
-0
bsp/mb9bf568r/applications/application.c
bsp/mb9bf568r/applications/application.c
+2
-1
bsp/mb9bf618s/applications/application.c
bsp/mb9bf618s/applications/application.c
+1
-1
bsp/microblaze/startup.c
bsp/microblaze/startup.c
+2
-0
bsp/mini4020/applications/startup.c
bsp/mini4020/applications/startup.c
+1
-1
bsp/nios_ii/startup.c
bsp/nios_ii/startup.c
+2
-0
bsp/nv32f100x/app/src/main.c
bsp/nv32f100x/app/src/main.c
+3
-1
bsp/pic32ethernet/startup.c
bsp/pic32ethernet/startup.c
+1
-1
bsp/rm48x50/application/startup.c
bsp/rm48x50/application/startup.c
+2
-0
bsp/rx/applications/application.c
bsp/rx/applications/application.c
+4
-0
bsp/sam7x/applications/startup.c
bsp/sam7x/applications/startup.c
+2
-0
bsp/samd21/applications/application.c
bsp/samd21/applications/application.c
+2
-0
bsp/sep6200/application/startup.c
bsp/sep6200/application/startup.c
+1
-1
bsp/taihu/applications/startup.c
bsp/taihu/applications/startup.c
+2
-0
bsp/upd70f3454/applications/startup.c
bsp/upd70f3454/applications/startup.c
+2
-0
bsp/xplorer4330/applications/application.c
bsp/xplorer4330/applications/application.c
+2
-0
components/dfs/filesystems/devfs/devfs.c
components/dfs/filesystems/devfs/devfs.c
+2
-2
components/dfs/src/dfs.c
components/dfs/src/dfs.c
+4
-4
components/drivers/serial/serial.c
components/drivers/serial/serial.c
+6
-7
components/drivers/serial/serial_v2.c
components/drivers/serial/serial_v2.c
+3
-3
components/drivers/src/pipe.c
components/drivers/src/pipe.c
+5
-5
components/finsh/finsh.h
components/finsh/finsh.h
+1
-1
components/finsh/shell.c
components/finsh/shell.c
+6
-6
components/finsh/shell.h
components/finsh/shell.h
+1
-2
components/legacy/dfs/dfs_select.h
components/legacy/dfs/dfs_select.h
+1
-1
components/libc/Kconfig
components/libc/Kconfig
+3
-3
components/libc/compilers/armlibc/syscalls.c
components/libc/compilers/armlibc/syscalls.c
+6
-6
components/libc/compilers/common/sys/ioctl.h
components/libc/compilers/common/sys/ioctl.h
+0
-2
components/libc/compilers/dlib/syscall_read.c
components/libc/compilers/dlib/syscall_read.c
+4
-4
components/libc/compilers/dlib/syscall_write.c
components/libc/compilers/dlib/syscall_write.c
+0
-4
components/libc/compilers/gcc/newlib/syscalls.c
components/libc/compilers/gcc/newlib/syscalls.c
+5
-5
components/libc/posix/aio/SConscript
components/libc/posix/aio/SConscript
+1
-1
components/libc/posix/src/SConscript
components/libc/posix/src/SConscript
+1
-1
components/libc/posix/src/libc.c
components/libc/posix/src/libc.c
+4
-5
components/libc/posix/src/libc.h
components/libc/posix/src/libc.h
+2
-2
components/libc/posix/termios/SConscript
components/libc/posix/termios/SConscript
+1
-3
components/utilities/rt-link/src/rtlink_dev.c
components/utilities/rt-link/src/rtlink_dev.c
+3
-3
examples/libc/termios_test.c
examples/libc/termios_test.c
+0
-12
examples/rt-link/rtlink_dev_example.c
examples/rt-link/rtlink_dev_example.c
+2
-2
include/rtdef.h
include/rtdef.h
+1
-1
src/device.c
src/device.c
+4
-4
未找到文件。
bsp/avr32uc3b0/startup.c
浏览文件 @
4e9744c0
...
...
@@ -38,7 +38,9 @@ int main(void)
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init
();
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
FINSH_DEVICE_NAME
);
#endif
#endif
rt_thread_idle_init
();
...
...
bsp/bf533/startup.c
浏览文件 @
4e9744c0
...
...
@@ -62,7 +62,9 @@ void rtthread_startup(void)
/* init finsh */
extern
int
finsh_system_init
(
void
);
finsh_system_init
();
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
"uart0"
);
#endif
#endif
rt_system_timer_thread_init
();
...
...
bsp/efm32/startup.c
浏览文件 @
4e9744c0
...
...
@@ -111,7 +111,9 @@ void rtthread_startup(void)
/* init finsh */
#ifdef RT_USING_FINSH
finsh_system_init
();
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
CONSOLE_DEVICE
);
#endif
#endif
/* Initialize gui server */
...
...
bsp/frdm-k64f/applications/startup.c
浏览文件 @
4e9744c0
...
...
@@ -79,7 +79,9 @@ void rtthread_startup(void)
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init
();
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
FINSH_DEVICE_NAME
);
#endif
#endif
/* init timer thread */
...
...
bsp/juicevm/rtconfig.h
浏览文件 @
4e9744c0
...
...
@@ -106,7 +106,6 @@
/* POSIX layer and C standard library */
#define RT_USING_LIBC
// #define RT_USING_POSIX
/* Network */
...
...
bsp/lm3s8962/applications/startup.c
浏览文件 @
4e9744c0
...
...
@@ -119,7 +119,7 @@ void rtthread_startup(void)
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init
();
#if !defined(RT_USING_POSIX) && defined(RT_USING_DEVICE)
#if !defined(RT_USING_POSIX
_DEVIO
) && defined(RT_USING_DEVICE)
finsh_set_device
(
"uart1"
);
#endif
#endif
...
...
bsp/lm3s9b9x/applications/startup.c
浏览文件 @
4e9744c0
...
...
@@ -119,7 +119,7 @@ void rtthread_startup(void)
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init
();
#if
def RT_USING_DEVICE
#if
!defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
"uart1"
);
#endif
#endif
...
...
bsp/lm4f232/applications/startup.c
浏览文件 @
4e9744c0
...
...
@@ -119,7 +119,7 @@ void rtthread_startup(void)
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init
();
#if
def RT_USING_DEVICE
#if
!defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
"uart1"
);
#endif
#endif
...
...
bsp/lpc43xx/M0/applications/application.c
浏览文件 @
4e9744c0
...
...
@@ -28,8 +28,10 @@ void rt_init_thread_entry(void *parameter)
#ifdef RT_USING_FINSH
/* initialize finsh */
finsh_system_init
();
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
RT_CONSOLE_DEVICE_NAME
);
#endif
#endif
#ifdef RT_USING_VBUS
rt_vbus_do_init
();
...
...
bsp/lpc43xx/M4/applications/application.c
浏览文件 @
4e9744c0
...
...
@@ -59,8 +59,10 @@ void rt_init_thread_entry(void *parameter)
#ifdef RT_USING_FINSH
/* initialize finsh */
finsh_system_init
();
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
RT_CONSOLE_DEVICE_NAME
);
#endif
#endif
#ifdef RT_USING_VBUS
rt_vbus_do_init
();
...
...
bsp/m16c62p/applications/startup.c
浏览文件 @
4e9744c0
...
...
@@ -65,7 +65,9 @@ void rtthread_startup(void)
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init
();
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
"uart0"
);
#endif
#endif
/* init timer thread */
...
...
bsp/mb9bf568r/applications/application.c
浏览文件 @
4e9744c0
...
...
@@ -25,8 +25,9 @@ void rt_init_thread_entry(void *parameter)
//finsh_system_init();
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
RT_CONSOLE_DEVICE_NAME
);
#endif
/**< init led device */
{
...
...
bsp/mb9bf618s/applications/application.c
浏览文件 @
4e9744c0
...
...
@@ -24,7 +24,7 @@ void rt_init_thread_entry(void *parameter)
#endif
#ifdef RT_USING_FINSH
finsh_set_device
(
RT_CONSOLE_DEVICE_NAME
);
(
RT_CONSOLE_DEVICE_NAME
);
#endif
/* RT_USING_FINSH */
/**< init led device */
...
...
bsp/microblaze/startup.c
浏览文件 @
4e9744c0
...
...
@@ -84,7 +84,9 @@ void rtthread_startup(void)
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init
();
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
"uart1"
);
#endif
#endif
/* init idle thread */
...
...
bsp/mini4020/applications/startup.c
浏览文件 @
4e9744c0
...
...
@@ -77,7 +77,7 @@ void rtthread_startup()
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init
();
#if
def RT_USING_DEVICE
#if
!defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
"uart0"
);
#endif
#endif
...
...
bsp/nios_ii/startup.c
浏览文件 @
4e9744c0
...
...
@@ -60,7 +60,9 @@ void rtthread_startup(void)
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init
();
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
"uart"
);
#endif
#endif
/* init idle thread */
...
...
bsp/nv32f100x/app/src/main.c
浏览文件 @
4e9744c0
...
...
@@ -17,8 +17,10 @@ int main(void)
{
rt_thread_t
thread
;
#ifdef RT_USING_FINSH
#ifdef RT_USING_FINSH
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
RT_CONSOLE_DEVICE_NAME
);
#endif
#endif
/* Create led thread */
...
...
bsp/pic32ethernet/startup.c
浏览文件 @
4e9744c0
...
...
@@ -48,7 +48,7 @@ void rtthread_startup(void)
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init
();
#if
def RT_USING_DEVICE
#if
!defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
"uart1"
);
#endif
#endif
...
...
bsp/rm48x50/application/startup.c
浏览文件 @
4e9744c0
...
...
@@ -104,7 +104,9 @@ void rtthread_startup(void)
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init
();
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
"sci2"
);
#endif
#endif
/* init soft timer thread */
...
...
bsp/rx/applications/application.c
浏览文件 @
4e9744c0
...
...
@@ -60,8 +60,10 @@ void rt_init_thread_entry(void* parameter)
#ifdef RT_USING_FINSH
/* initialize finsh */
finsh_system_init
();
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
RT_CONSOLE_DEVICE_NAME
);
#endif
#endif
#ifdef RT_USING_LWIP
/* initialize lwip stack */
...
...
@@ -130,7 +132,9 @@ void rt_init_thread_entry(void* parameter)
#endif
#ifdef RT_USING_FINSH
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
RT_CONSOLE_DEVICE_NAME
);
#endif
#endif
/* RT_USING_FINSH */
/* Filesystem Initialization */
...
...
bsp/sam7x/applications/startup.c
浏览文件 @
4e9744c0
...
...
@@ -114,7 +114,9 @@ void rtthread_startup(void)
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init
();
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
"uart1"
);
#endif
#endif
/* init idle thread */
...
...
bsp/samd21/applications/application.c
浏览文件 @
4e9744c0
...
...
@@ -87,7 +87,9 @@ void rt_init_thread_entry(void* parameter)
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init
();
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
"uart1"
);
#endif
#endif
LED_Init
();
...
...
bsp/sep6200/application/startup.c
浏览文件 @
4e9744c0
...
...
@@ -64,7 +64,7 @@ void rtthread_startup()
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init
();
#if
def RT_USING_DEVICE
#if
!defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
"uart0"
);
#endif
#endif
...
...
bsp/taihu/applications/startup.c
浏览文件 @
4e9744c0
...
...
@@ -53,7 +53,9 @@ void rtthread_startup(void)
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init
();
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
"uart1"
);
#endif
#endif
/* init soft timer thread */
...
...
bsp/upd70f3454/applications/startup.c
浏览文件 @
4e9744c0
...
...
@@ -64,7 +64,9 @@ void rtthread_startup(void)
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init
();
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
"uart0"
);
#endif
#endif
/* init timer thread */
...
...
bsp/xplorer4330/applications/application.c
浏览文件 @
4e9744c0
...
...
@@ -23,8 +23,10 @@ void rt_init_thread_entry(void *parameter)
#ifdef RT_USING_FINSH
/* initialize finsh */
finsh_system_init
();
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
finsh_set_device
(
RT_CONSOLE_DEVICE_NAME
);
#endif
#endif
}
/*the led thread*/
ALIGN
(
RT_ALIGN_SIZE
)
...
...
components/dfs/filesystems/devfs/devfs.c
浏览文件 @
4e9744c0
...
...
@@ -173,7 +173,7 @@ int dfs_device_fs_open(struct dfs_fd *file)
if
(
device
==
RT_NULL
)
return
-
ENODEV
;
#ifdef RT_USING_POSIX
#ifdef RT_USING_POSIX
_DEVIO
if
(
device
->
fops
)
{
/* use device fops */
...
...
@@ -192,7 +192,7 @@ int dfs_device_fs_open(struct dfs_fd *file)
}
}
else
#endif
#endif
/* RT_USING_POSIX_DEVIO */
{
result
=
rt_device_open
(
device
,
RT_DEVICE_OFLAG_RDWR
);
if
(
result
==
RT_EOK
||
result
==
-
RT_ENOSYS
)
...
...
components/dfs/src/dfs.c
浏览文件 @
4e9744c0
...
...
@@ -18,9 +18,9 @@
#include <lwp.h>
#endif
#ifdef RT_USING_POSIX_
STD
IO
#ifdef RT_USING_POSIX_
DEV
IO
#include <libc.h>
#endif
/* RT_USING_POSIX_
STD
IO */
#endif
/* RT_USING_POSIX_
DEV
IO */
/* Global variables */
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_fdtable
*
fdt
;
#ifdef RT_USING_POSIX_
STD
IO
#ifdef RT_USING_POSIX_
DEV
IO
if
((
0
<=
fd
)
&&
(
fd
<=
2
))
fd
=
libc_stdio_get_console
();
#endif
/* RT_USING_POSIX_
STD
IO */
#endif
/* RT_USING_POSIX_
DEV
IO */
fdt
=
dfs_fdtable_get
();
fd
=
fd
-
DFS_FD_OFFSET
;
...
...
components/drivers/serial/serial.c
浏览文件 @
4e9744c0
...
...
@@ -36,7 +36,7 @@
#define DBG_LVL DBG_INFO
#include <rtdbg.h>
#ifdef RT_USING_POSIX
#ifdef RT_USING_POSIX
_DEVIO
#include <dfs_posix.h>
#include <poll.h>
#include <sys/ioctl.h>
...
...
@@ -203,7 +203,7 @@ const static struct dfs_file_ops _serial_fops =
RT_NULL
,
/* getdents */
serial_fops_poll
,
};
#endif
#endif
/* RT_USING_POSIX_DEVIO */
/*
* Serial poll routines
...
...
@@ -976,8 +976,7 @@ static void _tc_flush(struct rt_serial_device *serial, int queue)
}
}
#endif
#endif
/* RT_USING_POSIX_TERMIOS */
static
rt_err_t
rt_serial_control
(
struct
rt_device
*
dev
,
int
cmd
,
...
...
@@ -1020,7 +1019,7 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
}
break
;
#ifdef RT_USING_POSIX
#ifdef RT_USING_POSIX
_DEVIO
#ifdef RT_USING_POSIX_TERMIOS
case
TCGETA
:
{
...
...
@@ -1215,7 +1214,7 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
*
(
rt_size_t
*
)
args
=
recved
;
}
break
;
#endif
/*
RT_USING_POSIX
*/
#endif
/*
RT_USING_POSIX_DEVIO
*/
default
:
/* control device */
ret
=
serial
->
ops
->
control
(
serial
,
cmd
,
args
);
...
...
@@ -1270,7 +1269,7 @@ rt_err_t rt_hw_serial_register(struct rt_serial_device *serial,
/* register a character device */
ret
=
rt_device_register
(
device
,
name
,
flag
);
#if
defined(RT_USING_POSIX)
#if
def RT_USING_POSIX_DEVIO
/* set fops */
device
->
fops
=
&
_serial_fops
;
#endif
...
...
components/drivers/serial/serial_v2.c
浏览文件 @
4e9744c0
...
...
@@ -16,7 +16,7 @@
#define DBG_LVL DBG_INFO
#include <rtdbg.h>
#ifdef RT_USING_POSIX
#ifdef RT_USING_POSIX
_DEVIO
#include <dfs_posix.h>
#include <poll.h>
#include <sys/ioctl.h>
...
...
@@ -179,7 +179,7 @@ const static struct dfs_file_ops _serial_fops =
RT_NULL
,
/* getdents */
serial_fops_poll
,
};
#endif
#endif
/* RT_USING_POSIX_DEVIO */
static
rt_size_t
rt_serial_get_linear_buffer
(
struct
rt_ringbuffer
*
rb
,
rt_uint8_t
**
ptr
)
...
...
@@ -1135,7 +1135,7 @@ rt_err_t rt_hw_serial_register(struct rt_serial_device *serial,
/* register a character device */
ret
=
rt_device_register
(
device
,
name
,
flag
);
#if
defined(RT_USING_POSIX)
#if
def RT_USING_POSIX_DEVIO
/* set fops */
device
->
fops
=
&
_serial_fops
;
#endif
...
...
components/drivers/src/pipe.c
浏览文件 @
4e9744c0
...
...
@@ -13,7 +13,7 @@
#include <stdint.h>
#include <sys/errno.h>
#ifdef RT_USING_POSIX
#ifdef RT_USING_POSIX
_DEVIO
#include <dfs_file.h>
#include <dfs_posix.h>
#include <poll.h>
...
...
@@ -320,7 +320,7 @@ static const struct dfs_file_ops pipe_fops =
RT_NULL
,
pipe_fops_poll
,
};
#endif
/*
end of RT_USING_POSIX
*/
#endif
/*
RT_USING_POSIX_DEVIO
*/
rt_err_t
rt_pipe_open
(
rt_device_t
device
,
rt_uint16_t
oflag
)
{
...
...
@@ -479,7 +479,7 @@ rt_pipe_t *rt_pipe_create(const char *name, int bufsz)
rt_free
(
pipe
);
return
RT_NULL
;
}
#ifdef RT_USING_POSIX
#ifdef RT_USING_POSIX
_DEVIO
dev
->
fops
=
(
void
*
)
&
pipe_fops
;
#endif
...
...
@@ -529,7 +529,7 @@ int rt_pipe_delete(const char *name)
return
result
;
}
#ifdef RT_USING_POSIX
#ifdef RT_USING_POSIX
_DEVIO
int
pipe
(
int
fildes
[
2
])
{
rt_pipe_t
*
pipe
;
...
...
@@ -575,4 +575,4 @@ int mkfifo(const char *path, mode_t mode)
return
0
;
}
#endif
#endif
/* RT_USING_POSIX_DEVIO */
components/finsh/finsh.h
浏览文件 @
4e9744c0
...
...
@@ -168,7 +168,7 @@ extern struct finsh_syscall *_syscall_table_begin, *_syscall_table_end;
/* find out system call, which should be implemented in user program */
struct
finsh_syscall
*
finsh_syscall_lookup
(
const
char
*
name
);
#if
def RT_USING_DEVICE
#if
!defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
void
finsh_set_device
(
const
char
*
device_name
);
#endif
...
...
components/finsh/shell.c
浏览文件 @
4e9744c0
...
...
@@ -146,7 +146,7 @@ int finsh_getchar(void)
{
#ifdef RT_USING_DEVICE
char
ch
=
0
;
#ifdef RT_USING_POSIX_
STD
IO
#ifdef RT_USING_POSIX_
DEV
IO
if
(
read
(
STDIN_FILENO
,
&
ch
,
1
)
>
0
)
{
return
ch
;
...
...
@@ -170,14 +170,14 @@ int finsh_getchar(void)
rt_sem_take
(
&
shell
->
rx_sem
,
RT_WAITING_FOREVER
);
return
ch
;
#endif
/* RT_USING_POSIX_
STD
IO */
#endif
/* RT_USING_POSIX_
DEV
IO */
#else
extern
char
rt_hw_console_getchar
(
void
);
return
rt_hw_console_getchar
();
#endif
/* RT_USING_DEVICE */
}
#if !defined(RT_USING_POSIX_
STD
IO) && defined(RT_USING_DEVICE)
#if !defined(RT_USING_POSIX_
DEV
IO) && defined(RT_USING_DEVICE)
static
rt_err_t
finsh_rx_ind
(
rt_device_t
dev
,
rt_size_t
size
)
{
RT_ASSERT
(
shell
!=
RT_NULL
);
...
...
@@ -241,7 +241,7 @@ const char *finsh_get_device()
RT_ASSERT
(
shell
!=
RT_NULL
);
return
shell
->
device
->
parent
.
name
;
}
#endif
/* !defined(RT_USING_POSIX_
STD
IO) && defined(RT_USING_DEVICE) */
#endif
/* !defined(RT_USING_POSIX_
DEV
IO) && defined(RT_USING_DEVICE) */
/**
* @ingroup finsh
...
...
@@ -443,7 +443,7 @@ void finsh_thread_entry(void *parameter)
shell
->
echo_mode
=
0
;
#endif
#if !defined(RT_USING_POSIX_
STD
IO) && defined(RT_USING_DEVICE)
#if !defined(RT_USING_POSIX_
DEV
IO) && defined(RT_USING_DEVICE)
/* set console device as shell device */
if
(
shell
->
device
==
RT_NULL
)
{
...
...
@@ -453,7 +453,7 @@ void finsh_thread_entry(void *parameter)
finsh_set_device
(
console
->
parent
.
name
);
}
}
#endif
/* !defined(RT_USING_POSIX_
STD
IO) && defined(RT_USING_DEVICE) */
#endif
/* !defined(RT_USING_POSIX_
DEV
IO) && defined(RT_USING_DEVICE) */
#ifdef FINSH_USING_AUTH
/* set the default password when the password isn't setting */
...
...
components/finsh/shell.h
浏览文件 @
4e9744c0
...
...
@@ -78,7 +78,7 @@ struct finsh_shell
rt_uint16_t
line_position
;
rt_uint16_t
line_curpos
;
#if !defined(RT_USING_POSIX_
STD
IO) && defined(RT_USING_DEVICE)
#if !defined(RT_USING_POSIX_
DEV
IO) && defined(RT_USING_DEVICE)
rt_device_t
device
;
#endif
...
...
@@ -91,7 +91,6 @@ void finsh_set_echo(rt_uint32_t echo);
rt_uint32_t
finsh_get_echo
(
void
);
int
finsh_system_init
(
void
);
void
finsh_set_device
(
const
char
*
device_name
);
const
char
*
finsh_get_device
(
void
);
int
finsh_getchar
(
void
);
...
...
components/legacy/dfs/dfs_select.h
浏览文件 @
4e9744c0
...
...
@@ -13,4 +13,4 @@
#include <sys/select.h>
#endif
#endif
/* DFS_SELECT_H__ */
components/libc/Kconfig
浏览文件 @
4e9744c0
...
...
@@ -12,7 +12,7 @@ if RT_USING_LIBC
config RT_LIBC_USING_FILEIO
bool "Enable libc with file operation, eg.fopen/fwrite/fread/getchar"
select RT_USING_POSIX
select RT_USING_POSIX_
STD
IO
select RT_USING_POSIX_
DEV
IO
default n
config RT_USING_MODULE
...
...
@@ -44,8 +44,8 @@ config RT_USING_POSIX
default n
if RT_USING_POSIX
config RT_USING_POSIX_
STD
IO
bool "Enable
standard I/O, STDOUT_FILENO/STDIN_FILENO/STDERR_FILENO
"
config RT_USING_POSIX_
DEV
IO
bool "Enable
devices as file descriptors
"
select RT_USING_DFS
select RT_USING_DFS_DEVFS
default n
...
...
components/libc/compilers/armlibc/syscalls.c
浏览文件 @
4e9744c0
...
...
@@ -21,9 +21,9 @@
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#ifdef RT_USING_POSIX_
STD
IO
#ifdef RT_USING_POSIX_
DEV
IO
#include "libc.h"
#endif
#endif
/* RT_USING_POSIX_DEVIO */
#define DBG_TAG "armlibc.syscalls"
#define DBG_LVL DBG_INFO
...
...
@@ -149,7 +149,7 @@ int _sys_read(FILEHANDLE fh, unsigned char *buf, unsigned len, int mode)
if
(
fh
==
STDIN
)
{
#ifdef RT_USING_POSIX_
STD
IO
#ifdef RT_USING_POSIX_
DEV
IO
if
(
libc_stdio_get_console
()
<
0
)
{
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 */
#else
return
0
;
/* error */
#endif
#endif
/* RT_USING_POSIX_DEVIO */
}
else
if
(
fh
==
STDOUT
||
fh
==
STDERR
)
{
...
...
@@ -332,7 +332,7 @@ int fputc(int c, FILE *f)
int
fgetc
(
FILE
*
f
)
{
#ifdef RT_USING_POSIX_
STD
IO
#ifdef RT_USING_POSIX_
DEV
IO
char
ch
;
if
(
libc_stdio_get_console
()
<
0
)
...
...
@@ -343,7 +343,7 @@ int fgetc(FILE *f)
if
(
read
(
STDIN_FILENO
,
&
ch
,
1
)
==
1
)
return
ch
;
#endif
/* RT_USING_POSIX_
STD
IO */
#endif
/* RT_USING_POSIX_
DEV
IO */
return
0
;
/* error */
}
...
...
components/libc/compilers/common/sys/ioctl.h
浏览文件 @
4e9744c0
...
...
@@ -11,9 +11,7 @@
#define _SYS_IOCTL_H
#include <rtconfig.h>
#ifdef RT_USING_POSIX
#include <dfs_posix.h>
#endif
#ifdef _WIN32
#include <winsock.h>
...
...
components/libc/compilers/dlib/syscall_read.c
浏览文件 @
4e9744c0
...
...
@@ -11,9 +11,9 @@
#include <rtthread.h>
#include <LowLevelIOInterface.h>
#include <unistd.h>
#ifdef RT_USING_POSIX_
STD
IO
#ifdef RT_USING_POSIX_
DEV
IO
#include "libc.h"
#endif
#endif
/* RT_USING_POSIX_DEVIO */
#define DBG_TAG "dlib.syscall_read"
#define DBG_LVL DBG_INFO
...
...
@@ -39,7 +39,7 @@ size_t __read(int handle, unsigned char *buf, size_t len)
if
(
handle
==
_LLIO_STDIN
)
{
#ifdef RT_USING_POSIX_
STD
IO
#ifdef RT_USING_POSIX_
DEV
IO
if
(
libc_stdio_get_console
()
<
0
)
{
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 */
#else
return
_LLIO_ERROR
;
#endif
/* RT_USING_POSIX_
STD
IO */
#endif
/* RT_USING_POSIX_
DEV
IO */
}
else
if
((
handle
==
_LLIO_STDOUT
)
||
(
handle
==
_LLIO_STDERR
))
{
...
...
components/libc/compilers/dlib/syscall_write.c
浏览文件 @
4e9744c0
...
...
@@ -11,10 +11,6 @@
#include <rtthread.h>
#include <LowLevelIOInterface.h>
#include <unistd.h>
#ifdef RT_USING_POSIX_STDIO
#include "libc.h"
#endif
#define DBG_TAG "dlib.syscall_write"
#define DBG_LVL DBG_INFO
#include <rtdbg.h>
...
...
components/libc/compilers/gcc/newlib/syscalls.c
浏览文件 @
4e9744c0
...
...
@@ -20,12 +20,12 @@
#include <unistd.h>
#include <sys/errno.h>
#include <sys/stat.h>
#ifdef RT_USING_POSIX_
STD
IO
#ifdef RT_USING_POSIX_
DEV
IO
#include "libc.h"
#endif
#endif
/* RT_USING_POSIX_DEVIO */
#ifdef RT_USING_MODULE
#include <dlmodule.h>
#endif
#endif
/* RT_USING_MODULE */
#define DBG_TAG "newlib.syscalls"
#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
;
if
(
fd
==
STDIN_FILENO
)
{
#ifdef RT_USING_POSIX_
STD
IO
#ifdef RT_USING_POSIX_
DEV
IO
if
(
libc_stdio_get_console
()
<
0
)
{
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
ptr
->
_errno
=
ENOTSUP
;
return
-
1
;
#endif
/* RT_USING_POSIX_
STD
IO */
#endif
/* RT_USING_POSIX_
DEV
IO */
}
else
if
(
fd
==
STDOUT_FILENO
||
fd
==
STDERR_FILENO
)
{
...
...
components/libc/posix/aio/SConscript
浏览文件 @
4e9744c0
...
...
@@ -6,6 +6,6 @@ cwd = GetCurrentDir()
src
=
Glob
(
'*.c'
)
CPPPATH
=
[
cwd
]
group
=
DefineGroup
(
'POSIX'
,
src
,
depend
=
[
'RT_USING_POSIX
'
,
'RT_USING_POSIX
_AIO'
],
CPPPATH
=
CPPPATH
)
group
=
DefineGroup
(
'POSIX'
,
src
,
depend
=
[
'RT_USING_POSIX_AIO'
],
CPPPATH
=
CPPPATH
)
Return
(
'group'
)
components/libc/posix/src/SConscript
浏览文件 @
4e9744c0
...
...
@@ -6,7 +6,7 @@ src = ['unistd.c']
cwd
=
GetCurrentDir
()
CPPPATH
=
[
cwd
]
if
GetDepend
(
'RT_USING_POSIX_
STD
IO'
):
if
GetDepend
(
'RT_USING_POSIX_
DEV
IO'
):
src
+=
[
'libc.c'
]
if
GetDepend
(
'RT_USING_POSIX_DELAY'
):
...
...
components/libc/posix/src/libc.c
浏览文件 @
4e9744c0
...
...
@@ -23,7 +23,7 @@
int
libc_system_init
(
void
)
{
#ifdef RT_USING_POSIX
#ifdef RT_USING_POSIX
_DEVIO
rt_device_t
dev_console
;
dev_console
=
rt_console_get_device
();
...
...
@@ -31,7 +31,7 @@ int libc_system_init(void)
{
libc_stdio_set_console
(
dev_console
->
parent
.
name
,
O_RDWR
);
}
#endif
/* RT_USING_POSIX */
#endif
/* RT_USING_POSIX
_DEVIO
*/
#if defined RT_USING_PTHREADS && !defined RT_USING_COMPONENTS_INIT
pthread_system_init
();
...
...
@@ -41,8 +41,7 @@ int libc_system_init(void)
}
INIT_COMPONENT_EXPORT
(
libc_system_init
);
#ifdef RT_USING_POSIX
#ifdef RT_USING_POSIX_DEVIO
#if defined(RT_USING_LIBC) && defined(RT_USING_NEWLIB)
#define STDIO_DEVICE_NAME_MAX 32
static
FILE
*
std_console
=
NULL
;
...
...
@@ -145,4 +144,4 @@ int libc_stdio_get_console(void) {
return
std_fd
;
}
#endif
/* defined(RT_USING_LIBC) && defined(RT_USING_NEWLIB) */
#endif
/* RT_USING_POSIX */
#endif
/* RT_USING_POSIX
_DEVIO
*/
components/libc/posix/src/libc.h
浏览文件 @
4e9744c0
...
...
@@ -17,10 +17,10 @@ extern "C" {
#endif
int
libc_system_init
(
void
);
#ifdef RT_USING_POSIX
#ifdef RT_USING_POSIX
_DEVIO
int
libc_stdio_get_console
(
void
);
int
libc_stdio_set_console
(
const
char
*
device_name
,
int
mode
);
#endif
/* RT_USING_POSIX */
#endif
/* RT_USING_POSIX
_DEVIO
*/
#ifdef __cplusplus
}
...
...
components/libc/posix/termios/SConscript
浏览文件 @
4e9744c0
...
...
@@ -6,8 +6,6 @@ cwd = GetCurrentDir()
src
=
Glob
(
'*.c'
)
+
Glob
(
'*.cpp'
)
CPPPATH
=
[
cwd
]
group
=
DefineGroup
(
'POSIX'
,
src
,
depend
=
[
'RT_USING_LIBC'
,
'RT_USING_POSIX'
,
'RT_USING_POSIX_TERMIOS'
],
CPPPATH
=
CPPPATH
)
group
=
DefineGroup
(
'POSIX'
,
src
,
depend
=
[
'RT_USING_LIBC'
,
'RT_USING_POSIX_TERMIOS'
],
CPPPATH
=
CPPPATH
)
Return
(
'group'
)
components/utilities/rt-link/src/rtlink_dev.c
浏览文件 @
4e9744c0
...
...
@@ -19,7 +19,7 @@
#define RTLINK_SERV(dev) (((struct rt_link_device*)dev)->service)
#ifdef RT_USING_POSIX
#ifdef RT_USING_POSIX
_DEVIO
#include <dfs_posix.h>
#include <poll.h>
...
...
@@ -148,7 +148,7 @@ const static struct dfs_file_ops _rtlink_fops =
RT_NULL
,
/* getdents */
rtlink_fops_poll
,
};
#endif
/* RT_USING_POSIX */
#endif
/* RT_USING_POSIX
_DEVIO
*/
/* The event type for the service channel number,
* which is used to wake up the service thread in blocking receive mode */
...
...
@@ -386,7 +386,7 @@ rt_err_t rt_link_dev_register(struct rt_link_device *rtlink,
/* register a character device */
ret
=
rt_device_register
(
device
,
name
,
flag
);
#if
defined(RT_USING_POSIX)
#if
def RT_USING_POSIX_DEVIO
/* set fops */
device
->
fops
=
&
_rtlink_fops
;
#endif
...
...
examples/libc/termios_test.c
浏览文件 @
4e9744c0
...
...
@@ -14,18 +14,6 @@
#include <string.h>
#include <sys/time.h>
#if defined (RT_USING_POSIX)
#include <dfs_posix.h>
#include <sys/select.h>
#if defined (RT_USING_POSIX_TERMIOS)
#include <termios.h>
#else
#error "TERMIOS need RT_USING_POSIX_TERMIOS"
#endif
#else
#error "POSIX poll/select need RT_USING_POSIX"
#endif
#define JOINT(x,y) x##y
#define B(x) JOINT(B,x)
#define Default_baud_rate 115200
...
...
examples/rt-link/rtlink_dev_example.c
浏览文件 @
4e9744c0
...
...
@@ -45,7 +45,7 @@ static rt_err_t rtlink_dev_tx_done(rt_device_t dev, void *buffer)
return
RT_EOK
;
}
#ifdef RT_USING_POSIX
#ifdef RT_USING_POSIX
_DEVIO
#include <dfs_posix.h>
#include <poll.h>
#include <sys/select.h>
...
...
@@ -205,7 +205,7 @@ static void rtlink_fselect()
}
}
MSH_CMD_EXPORT
(
rtlink_fselect
,
rtlink
posix
interface
example
);
#endif
/* RT_USING_POSIX */
#endif
/* RT_USING_POSIX
_DEVIO
*/
static
void
rtlink_dread
(
void
)
{
...
...
include/rtdef.h
浏览文件 @
4e9744c0
...
...
@@ -1034,7 +1034,7 @@ struct rt_device
rt_err_t
(
*
control
)(
rt_device_t
dev
,
int
cmd
,
void
*
args
);
#endif
#if
defined(RT_USING_POSIX)
#if
def RT_USING_POSIX_DEVIO
const
struct
dfs_file_ops
*
fops
;
struct
rt_wqueue
wait_queue
;
#endif
...
...
src/device.c
浏览文件 @
4e9744c0
...
...
@@ -16,9 +16,9 @@
*/
#include <rtthread.h>
#ifdef RT_USING_POSIX
#ifdef RT_USING_POSIX
_DEVIO
#include <rtdevice.h>
/* for wqueue_init */
#endif
/* RT_USING_POSIX */
#endif
/* RT_USING_POSIX
_DEVIO
*/
#ifdef RT_USING_DEVICE
...
...
@@ -64,10 +64,10 @@ rt_err_t rt_device_register(rt_device_t dev,
dev
->
ref_count
=
0
;
dev
->
open_flag
=
0
;
#ifdef RT_USING_POSIX
#ifdef RT_USING_POSIX
_DEVIO
dev
->
fops
=
RT_NULL
;
rt_wqueue_init
(
&
(
dev
->
wait_queue
));
#endif
/* RT_USING_POSIX */
#endif
/* RT_USING_POSIX
_DEVIO
*/
return
RT_EOK
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录