Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PHPmihuan
rt-thread
提交
a6343273
R
rt-thread
项目概览
PHPmihuan
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
a6343273
编写于
12月 31, 2020
作者:
B
Bernard Xiong
提交者:
GitHub
12月 31, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4212 from xiangxistu/master
[add] a new function to manage internet check.
上级
a174881e
14ac354d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
7 deletion
+21
-7
components/net/Kconfig
components/net/Kconfig
+6
-0
components/net/netdev/src/netdev.c
components/net/netdev/src/netdev.c
+4
-2
components/net/sal_socket/src/sal_socket.c
components/net/sal_socket/src/sal_socket.c
+11
-5
未找到文件。
components/net/Kconfig
浏览文件 @
a6343273
...
...
@@ -10,6 +10,12 @@ config RT_USING_SAL
if RT_USING_SAL
config SAL_INTERNET_CHECK
bool "Enable the ability that check internet status"
default y
help
The ability that check internet status is provided by RT-Thread.
if RT_USING_LWIP || AT_USING_SOCKET
menu "protocol stack implement"
...
...
components/net/netdev/src/netdev.c
浏览文件 @
a6343273
...
...
@@ -901,8 +901,8 @@ static void netdev_list_if(void)
{
rt_kprintf
(
"%d"
,
netdev
->
hwaddr
[
index
]);
}
}
}
...
...
@@ -911,8 +911,10 @@ static void netdev_list_if(void)
else
rt_kprintf
(
" DOWN"
);
if
(
netdev
->
flags
&
NETDEV_FLAG_LINK_UP
)
rt_kprintf
(
" LINK_UP"
);
else
rt_kprintf
(
" LINK_DOWN"
);
#ifdef SAL_INTERNET_CHECK
if
(
netdev
->
flags
&
NETDEV_FLAG_INTERNET_UP
)
rt_kprintf
(
" INTERNET_UP"
);
else
rt_kprintf
(
" INTERNET_DOWN"
);
#endif
if
(
netdev
->
flags
&
NETDEV_FLAG_DHCP
)
rt_kprintf
(
" DHCP_ENABLE"
);
else
rt_kprintf
(
" DHCP_DISABLE"
);
if
(
netdev
->
flags
&
NETDEV_FLAG_ETHARP
)
rt_kprintf
(
" ETHARP"
);
...
...
components/net/sal_socket/src/sal_socket.c
浏览文件 @
a6343273
...
...
@@ -21,7 +21,9 @@
#include <sal.h>
#include <netdev.h>
#ifdef SAL_INTERNET_CHECK
#include <ipc/workqueue.h>
#endif
/* check system workqueue stack size */
#if RT_SYSTEM_WORKQUEUE_STACKSIZE < 1536
...
...
@@ -45,7 +47,7 @@ struct sal_socket_table
struct
sal_netdev_res_table
{
struct
addrinfo
*
res
;
struct
netdev
*
netdev
;
struct
netdev
*
netdev
;
};
#ifdef SAL_USING_TLS
...
...
@@ -131,7 +133,7 @@ int sal_init(void)
/*init the dev_res table */
rt_memset
(
sal_dev_res_tbl
,
0
,
sizeof
(
sal_dev_res_tbl
));
/* create sal socket lock */
rt_mutex_init
(
&
sal_core_lock
,
"sal_lock"
,
RT_IPC_FLAG_FIFO
);
...
...
@@ -142,6 +144,7 @@ int sal_init(void)
}
INIT_COMPONENT_EXPORT
(
sal_init
);
#ifdef SAL_INTERNET_CHECK
/* check SAL network interface device internet status */
static
void
check_netdev_internet_up_work
(
struct
rt_work
*
work
,
void
*
work_data
)
{
...
...
@@ -271,6 +274,7 @@ __exit:
skt_ops
->
closesocket
(
sockfd
);
}
}
#endif
/* SAL_INTERNET_CHECK */
/**
* This function will check SAL network interface device internet status.
...
...
@@ -279,10 +283,12 @@ __exit:
*/
int
sal_check_netdev_internet_up
(
struct
netdev
*
netdev
)
{
RT_ASSERT
(
netdev
);
#ifdef SAL_INTERNET_CHECK
/* workqueue for network connect */
struct
rt_delayed_work
*
net_work
=
RT_NULL
;
RT_ASSERT
(
netdev
);
net_work
=
(
struct
rt_delayed_work
*
)
rt_calloc
(
1
,
sizeof
(
struct
rt_delayed_work
));
if
(
net_work
==
RT_NULL
)
...
...
@@ -293,7 +299,7 @@ int sal_check_netdev_internet_up(struct netdev *netdev)
rt_delayed_work_init
(
net_work
,
check_netdev_internet_up_work
,
(
void
*
)
netdev
);
rt_work_submit
(
&
(
net_work
->
work
),
RT_TICK_PER_SECOND
);
#endif
/* SAL_INTERNET_CHECK */
return
0
;
}
...
...
@@ -1138,7 +1144,7 @@ int sal_getaddrinfo(const char *nodename,
}
RT_ASSERT
((
i
<
SAL_SOCKETS_NUM
));
}
return
ret
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录