Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ihbai
rt-thread
提交
a7956e5e
R
rt-thread
项目概览
ihbai
/
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,发现更多精彩内容 >>
提交
a7956e5e
编写于
10月 18, 2018
作者:
还_没_想_好
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[components][wlan] 兼容lwip1.4
上级
9c255e7d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
8 deletion
+13
-8
components/drivers/wlan/wlan_lwip.c
components/drivers/wlan/wlan_lwip.c
+13
-8
未找到文件。
components/drivers/wlan/wlan_lwip.c
浏览文件 @
a7956e5e
...
@@ -31,6 +31,10 @@
...
@@ -31,6 +31,10 @@
#define DBG_COLOR
#define DBG_COLOR
#include <rtdbg.h>
#include <rtdbg.h>
#ifndef IPADDR_STRLEN_MAX
#define IPADDR_STRLEN_MAX (32)
#endif
struct
lwip_prot_des
struct
lwip_prot_des
{
{
struct
rt_wlan_prot
prot
;
struct
rt_wlan_prot
prot
;
...
@@ -46,10 +50,10 @@ static void netif_is_ready(struct rt_work *work, void *parameter)
...
@@ -46,10 +50,10 @@ static void netif_is_ready(struct rt_work *work, void *parameter)
struct
rt_wlan_device
*
wlan
=
parameter
;
struct
rt_wlan_device
*
wlan
=
parameter
;
struct
lwip_prot_des
*
lwip_prot
=
(
struct
lwip_prot_des
*
)
wlan
->
prot
;
struct
lwip_prot_des
*
lwip_prot
=
(
struct
lwip_prot_des
*
)
wlan
->
prot
;
struct
eth_device
*
eth_dev
=
&
lwip_prot
->
eth
;
struct
eth_device
*
eth_dev
=
&
lwip_prot
->
eth
;
char
str
[
IP4ADDR_STRLEN_MAX
];
rt_base_t
level
;
rt_base_t
level
;
struct
rt_wlan_buff
buff
;
struct
rt_wlan_buff
buff
;
rt_uint32_t
ip_addr
[
4
];
rt_uint32_t
ip_addr
[
4
];
char
str
[
IPADDR_STRLEN_MAX
];
rt_timer_stop
(
&
lwip_prot
->
timer
);
rt_timer_stop
(
&
lwip_prot
->
timer
);
if
(
ip_addr_cmp
(
&
(
eth_dev
->
netif
->
ip_addr
),
&
ip_addr_zero
)
!=
0
)
if
(
ip_addr_cmp
(
&
(
eth_dev
->
netif
->
ip_addr
),
&
ip_addr_zero
)
!=
0
)
...
@@ -91,9 +95,9 @@ static void netif_is_ready(struct rt_work *work, void *parameter)
...
@@ -91,9 +95,9 @@ static void netif_is_ready(struct rt_work *work, void *parameter)
rt_timer_start
(
&
lwip_prot
->
timer
);
rt_timer_start
(
&
lwip_prot
->
timer
);
goto
exit
;
goto
exit
;
}
}
rt_memset
(
str
,
0
,
IP
4
ADDR_STRLEN_MAX
);
rt_memset
(
str
,
0
,
IPADDR_STRLEN_MAX
);
rt_enter_critical
();
rt_enter_critical
();
rt_memcpy
(
str
,
ipaddr_ntoa
(
&
(
eth_dev
->
netif
->
ip_addr
)),
IP
4
ADDR_STRLEN_MAX
);
rt_memcpy
(
str
,
ipaddr_ntoa
(
&
(
eth_dev
->
netif
->
ip_addr
)),
IPADDR_STRLEN_MAX
);
rt_exit_critical
();
rt_exit_critical
();
LOG_I
(
"Got IP address : %s"
,
str
);
LOG_I
(
"Got IP address : %s"
,
str
);
exit:
exit:
...
@@ -136,7 +140,7 @@ static void netif_set_connected(void *parameter)
...
@@ -136,7 +140,7 @@ static void netif_set_connected(void *parameter)
if
(
wlan
->
mode
==
RT_WLAN_STATION
)
if
(
wlan
->
mode
==
RT_WLAN_STATION
)
{
{
LOG_D
(
"F:%s L:%d dhcp start run"
,
__FUNCTION__
,
__LINE__
);
LOG_D
(
"F:%s L:%d dhcp start run"
,
__FUNCTION__
,
__LINE__
);
netifapi_netif_
set_link_up
(
eth_dev
->
netif
);
netifapi_netif_
common
(
eth_dev
->
netif
,
netif_set_link_up
,
NULL
);
#ifdef RT_LWIP_DHCP
#ifdef RT_LWIP_DHCP
dhcp_start
(
eth_dev
->
netif
);
dhcp_start
(
eth_dev
->
netif
);
#endif
#endif
...
@@ -146,7 +150,7 @@ static void netif_set_connected(void *parameter)
...
@@ -146,7 +150,7 @@ static void netif_set_connected(void *parameter)
{
{
LOG_D
(
"F:%s L:%d dhcpd start run"
,
__FUNCTION__
,
__LINE__
);
LOG_D
(
"F:%s L:%d dhcpd start run"
,
__FUNCTION__
,
__LINE__
);
netifapi_netif_
set_link_up
(
eth_dev
->
netif
);
netifapi_netif_
common
(
eth_dev
->
netif
,
netif_set_link_up
,
NULL
);
#ifdef LWIP_USING_DHCPD
#ifdef LWIP_USING_DHCPD
{
{
char
netif_name
[
8
];
char
netif_name
[
8
];
...
@@ -167,10 +171,10 @@ static void netif_set_connected(void *parameter)
...
@@ -167,10 +171,10 @@ static void netif_set_connected(void *parameter)
if
(
wlan
->
mode
==
RT_WLAN_STATION
)
if
(
wlan
->
mode
==
RT_WLAN_STATION
)
{
{
LOG_D
(
"F:%s L:%d dhcp stop run"
,
__FUNCTION__
,
__LINE__
);
LOG_D
(
"F:%s L:%d dhcp stop run"
,
__FUNCTION__
,
__LINE__
);
netifapi_netif_
set_link_down
(
eth_dev
->
netif
);
netifapi_netif_
common
(
eth_dev
->
netif
,
netif_set_link_down
,
NULL
);
#ifdef RT_LWIP_DHCP
#ifdef RT_LWIP_DHCP
{
{
ip
4
_addr_t
ip_addr
=
{
0
};
ip_addr_t
ip_addr
=
{
0
};
dhcp_stop
(
eth_dev
->
netif
);
dhcp_stop
(
eth_dev
->
netif
);
netif_set_addr
(
eth_dev
->
netif
,
&
ip_addr
,
&
ip_addr
,
&
ip_addr
);
netif_set_addr
(
eth_dev
->
netif
,
&
ip_addr
,
&
ip_addr
,
&
ip_addr
);
}
}
...
@@ -180,7 +184,7 @@ static void netif_set_connected(void *parameter)
...
@@ -180,7 +184,7 @@ static void netif_set_connected(void *parameter)
else
if
(
wlan
->
mode
==
RT_WLAN_AP
)
else
if
(
wlan
->
mode
==
RT_WLAN_AP
)
{
{
LOG_D
(
"F:%s L:%d dhcpd stop run"
,
__FUNCTION__
,
__LINE__
);
LOG_D
(
"F:%s L:%d dhcpd stop run"
,
__FUNCTION__
,
__LINE__
);
netifapi_netif_
set_link_down
(
eth_dev
->
netif
);
netifapi_netif_
common
(
eth_dev
->
netif
,
netif_set_link_down
,
NULL
);
}
}
}
}
}
}
...
@@ -438,6 +442,7 @@ static struct rt_wlan_prot *rt_wlan_lwip_protocol_register(struct rt_wlan_prot *
...
@@ -438,6 +442,7 @@ static struct rt_wlan_prot *rt_wlan_lwip_protocol_register(struct rt_wlan_prot *
rt_timer_init
(
&
lwip_prot
->
timer
,
timer_name
,
timer_callback
,
wlan
,
rt_tick_from_millisecond
(
1000
),
rt_timer_init
(
&
lwip_prot
->
timer
,
timer_name
,
timer_callback
,
wlan
,
rt_tick_from_millisecond
(
1000
),
RT_TIMER_FLAG_SOFT_TIMER
|
RT_TIMER_FLAG_ONE_SHOT
);
RT_TIMER_FLAG_SOFT_TIMER
|
RT_TIMER_FLAG_ONE_SHOT
);
}
}
netif_set_up
(
eth
->
netif
);
LOG_I
(
"eth device init ok name:%s"
,
eth_name
);
LOG_I
(
"eth device init ok name:%s"
,
eth_name
);
return
&
lwip_prot
->
prot
;
return
&
lwip_prot
->
prot
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录