Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
天中雨水
rt-thread
提交
7ff976da
R
rt-thread
项目概览
天中雨水
/
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,发现更多精彩内容 >>
提交
7ff976da
编写于
12月 07, 2021
作者:
mysterywolf
提交者:
Bernard Xiong
12月 14, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[posix] [pipe] add IPC for POSIX and add pipe for it
上级
3b007a7b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
33 addition
and
24 deletion
+33
-24
components/drivers/Kconfig
components/drivers/Kconfig
+1
-5
components/drivers/include/ipc/pipe.h
components/drivers/include/ipc/pipe.h
+0
-6
components/drivers/src/pipe.c
components/drivers/src/pipe.c
+13
-13
components/libc/posix/Kconfig
components/libc/posix/Kconfig
+2
-0
components/libc/posix/ipc/Kconfig
components/libc/posix/ipc/Kconfig
+17
-0
未找到文件。
components/drivers/Kconfig
浏览文件 @
7ff976da
...
...
@@ -5,10 +5,6 @@ config RT_USING_DEVICE_IPC
default y
if RT_USING_DEVICE_IPC
config RT_PIPE_BUFSZ
int "Set pipe buffer size"
default 512
config RT_USING_SYSTEM_WORKQUEUE
bool "Using system default workqueue"
default n
...
...
@@ -18,7 +14,7 @@ if RT_USING_DEVICE_IPC
int "The stack size for system workqueue thread"
default 2048
config RT_SYSTEM_WORKQUEUE_PRIORITY
config RT_SYSTEM_WORKQUEUE_PRIORITY
int "The priority level of system workqueue thread"
default 23
endif
...
...
components/drivers/include/ipc/pipe.h
浏览文件 @
7ff976da
...
...
@@ -15,12 +15,6 @@
#include <rtthread.h>
#include <rtdevice.h>
#ifndef RT_PIPE_BUFSZ
#define PIPE_BUFSZ 512
#else
#define PIPE_BUFSZ RT_PIPE_BUFSZ
#endif
struct
rt_pipe_device
{
struct
rt_device
parent
;
...
...
components/drivers/src/pipe.c
浏览文件 @
7ff976da
...
...
@@ -13,7 +13,7 @@
#include <stdint.h>
#include <sys/errno.h>
#if
def RT_USING_POSIX_DEVIO
#if
defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_POSIX_PIPE)
#include <dfs_file.h>
#include <dfs_posix.h>
#include <poll.h>
...
...
@@ -320,9 +320,9 @@ static const struct dfs_file_ops pipe_fops =
RT_NULL
,
pipe_fops_poll
,
};
#endif
/*
RT_USING_POSIX_DEVIO
*/
#endif
/*
defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_POSIX_PIPE)
*/
rt_err_t
rt_pipe_open
(
rt_device_t
device
,
rt_uint16_t
oflag
)
static
rt_err_t
rt_pipe_open
(
rt_device_t
device
,
rt_uint16_t
oflag
)
{
rt_pipe_t
*
pipe
=
(
rt_pipe_t
*
)
device
;
rt_err_t
ret
=
RT_EOK
;
...
...
@@ -350,7 +350,7 @@ __exit:
return
ret
;
}
rt_err_t
rt_pipe_close
(
rt_device_t
device
)
static
rt_err_t
rt_pipe_close
(
rt_device_t
device
)
{
rt_pipe_t
*
pipe
=
(
rt_pipe_t
*
)
device
;
...
...
@@ -368,7 +368,7 @@ rt_err_t rt_pipe_close(rt_device_t device)
return
RT_EOK
;
}
rt_size_t
rt_pipe_read
(
rt_device_t
device
,
rt_off_t
pos
,
void
*
buffer
,
rt_size_t
count
)
static
rt_size_t
rt_pipe_read
(
rt_device_t
device
,
rt_off_t
pos
,
void
*
buffer
,
rt_size_t
count
)
{
uint8_t
*
pbuf
;
rt_size_t
read_bytes
=
0
;
...
...
@@ -396,7 +396,7 @@ rt_size_t rt_pipe_read(rt_device_t device, rt_off_t pos, void *buffer, rt_size_t
return
read_bytes
;
}
rt_size_t
rt_pipe_write
(
rt_device_t
device
,
rt_off_t
pos
,
const
void
*
buffer
,
rt_size_t
count
)
static
rt_size_t
rt_pipe_write
(
rt_device_t
device
,
rt_off_t
pos
,
const
void
*
buffer
,
rt_size_t
count
)
{
uint8_t
*
pbuf
;
rt_size_t
write_bytes
=
0
;
...
...
@@ -424,7 +424,7 @@ rt_size_t rt_pipe_write(rt_device_t device, rt_off_t pos, const void *buffer, rt
return
write_bytes
;
}
rt_err_t
rt_pipe_control
(
rt_device_t
dev
,
int
cmd
,
void
*
args
)
static
rt_err_t
rt_pipe_control
(
rt_device_t
dev
,
int
cmd
,
void
*
args
)
{
return
RT_EOK
;
}
...
...
@@ -479,9 +479,9 @@ rt_pipe_t *rt_pipe_create(const char *name, int bufsz)
rt_free
(
pipe
);
return
RT_NULL
;
}
#if
def RT_USING_POSIX_DEVIO
#if
defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_POSIX_PIPE)
dev
->
fops
=
(
void
*
)
&
pipe_fops
;
#endif
/* RT_USING_POSIX_DEVIO */
#endif
return
pipe
;
}
...
...
@@ -529,7 +529,7 @@ int rt_pipe_delete(const char *name)
return
result
;
}
#if
def RT_USING_POSIX_DEVIO
#if
defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_POSIX_PIPE)
int
pipe
(
int
fildes
[
2
])
{
rt_pipe_t
*
pipe
;
...
...
@@ -539,7 +539,7 @@ int pipe(int fildes[2])
rt_snprintf
(
dname
,
sizeof
(
dname
),
"pipe%d"
,
pipeno
++
);
pipe
=
rt_pipe_create
(
dname
,
PIPE_BUFSZ
);
pipe
=
rt_pipe_create
(
dname
,
RT_USING_POSIX_PIPE_SIZE
);
if
(
pipe
==
RT_NULL
)
{
return
-
1
;
...
...
@@ -567,7 +567,7 @@ int mkfifo(const char *path, mode_t mode)
{
rt_pipe_t
*
pipe
;
pipe
=
rt_pipe_create
(
path
,
PIPE_BUFSZ
);
pipe
=
rt_pipe_create
(
path
,
RT_USING_POSIX_PIPE_SIZE
);
if
(
pipe
==
RT_NULL
)
{
return
-
1
;
...
...
@@ -575,4 +575,4 @@ int mkfifo(const char *path, mode_t mode)
return
0
;
}
#endif
/*
RT_USING_POSIX_DEVIO
*/
#endif
/*
defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_POSIX_PIPE)
*/
components/libc/posix/Kconfig
浏览文件 @
7ff976da
...
...
@@ -55,4 +55,6 @@ if RT_USING_PTHREADS
default 8
endif
source "$RTT_DIR/components/libc/posix/ipc/Kconfig"
endmenu
components/libc/posix/ipc/Kconfig
0 → 100644
浏览文件 @
7ff976da
menu "Interprocess Communication (IPC)"
config RT_USING_POSIX_PIPE
bool "Enable pipe and FIFO"
select RT_USING_POSIX_FS
select RT_USING_POSIX_DEVIO
select RT_USING_POSIX_POLL
default n
config RT_USING_POSIX_PIPE_SIZE
int "Set pipe buffer size"
depends on RT_USING_POSIX_PIPE
default 512
comment "Socket is in the 'Network' category"
endmenu
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录