Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Mozi
rt-thread
提交
59a4e4b2
R
rt-thread
项目概览
Mozi
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
0
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,发现更多精彩内容 >>
提交
59a4e4b2
编写于
1月 18, 2019
作者:
armink_ztl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[DeviceDriver][wlan] Add device ops to wlan.
上级
8859b7b6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
36 addition
and
1 deletion
+36
-1
components/drivers/wlan/wlan_dev.c
components/drivers/wlan/wlan_dev.c
+18
-1
components/drivers/wlan/wlan_lwip.c
components/drivers/wlan/wlan_lwip.c
+18
-0
未找到文件。
components/drivers/wlan/wlan_dev.c
浏览文件 @
59a4e4b2
...
@@ -754,6 +754,18 @@ static rt_err_t _rt_wlan_dev_control(rt_device_t dev, int cmd, void *args)
...
@@ -754,6 +754,18 @@ static rt_err_t _rt_wlan_dev_control(rt_device_t dev, int cmd, void *args)
return
err
;
return
err
;
}
}
#ifdef RT_USING_DEVICE_OPS
const
static
struct
rt_device_ops
wlan_ops
=
{
_rt_wlan_dev_init
,
RT_NULL
,
RT_NULL
,
RT_NULL
,
RT_NULL
,
_rt_wlan_dev_control
};
#endif
rt_err_t
rt_wlan_dev_register
(
struct
rt_wlan_device
*
wlan
,
const
char
*
name
,
const
struct
rt_wlan_dev_ops
*
ops
,
rt_uint32_t
flag
,
void
*
user_data
)
rt_err_t
rt_wlan_dev_register
(
struct
rt_wlan_device
*
wlan
,
const
char
*
name
,
const
struct
rt_wlan_dev_ops
*
ops
,
rt_uint32_t
flag
,
void
*
user_data
)
{
{
rt_err_t
err
=
RT_EOK
;
rt_err_t
err
=
RT_EOK
;
...
@@ -765,13 +777,18 @@ rt_err_t rt_wlan_dev_register(struct rt_wlan_device *wlan, const char *name, con
...
@@ -765,13 +777,18 @@ rt_err_t rt_wlan_dev_register(struct rt_wlan_device *wlan, const char *name, con
}
}
rt_memset
(
wlan
,
0
,
sizeof
(
struct
rt_wlan_device
));
rt_memset
(
wlan
,
0
,
sizeof
(
struct
rt_wlan_device
));
#ifdef RT_USING_DEVICE_OPS
wlan
->
device
.
ops
=
&
wlan_ops
;
#else
wlan
->
device
.
init
=
_rt_wlan_dev_init
;
wlan
->
device
.
init
=
_rt_wlan_dev_init
;
wlan
->
device
.
open
=
RT_NULL
;
wlan
->
device
.
open
=
RT_NULL
;
wlan
->
device
.
close
=
RT_NULL
;
wlan
->
device
.
close
=
RT_NULL
;
wlan
->
device
.
read
=
RT_NULL
;
wlan
->
device
.
read
=
RT_NULL
;
wlan
->
device
.
write
=
RT_NULL
;
wlan
->
device
.
write
=
RT_NULL
;
wlan
->
device
.
control
=
_rt_wlan_dev_control
;
wlan
->
device
.
control
=
_rt_wlan_dev_control
;
#endif
wlan
->
device
.
user_data
=
RT_NULL
;
wlan
->
device
.
user_data
=
RT_NULL
;
wlan
->
device
.
type
=
RT_Device_Class_NetIf
;
wlan
->
device
.
type
=
RT_Device_Class_NetIf
;
...
...
components/drivers/wlan/wlan_lwip.c
浏览文件 @
59a4e4b2
...
@@ -372,6 +372,18 @@ static rt_err_t rt_wlan_lwip_protocol_send(rt_device_t device, struct pbuf *p)
...
@@ -372,6 +372,18 @@ static rt_err_t rt_wlan_lwip_protocol_send(rt_device_t device, struct pbuf *p)
#endif
#endif
}
}
#ifdef RT_USING_DEVICE_OPS
const
static
struct
rt_device_ops
wlan_lwip_ops
=
{
RT_NULL
,
RT_NULL
,
RT_NULL
,
RT_NULL
,
RT_NULL
,
rt_wlan_lwip_protocol_control
};
#endif
static
struct
rt_wlan_prot
*
rt_wlan_lwip_protocol_register
(
struct
rt_wlan_prot
*
prot
,
struct
rt_wlan_device
*
wlan
)
static
struct
rt_wlan_prot
*
rt_wlan_lwip_protocol_register
(
struct
rt_wlan_prot
*
prot
,
struct
rt_wlan_device
*
wlan
)
{
{
struct
eth_device
*
eth
=
RT_NULL
;
struct
eth_device
*
eth
=
RT_NULL
;
...
@@ -417,12 +429,18 @@ static struct rt_wlan_prot *rt_wlan_lwip_protocol_register(struct rt_wlan_prot *
...
@@ -417,12 +429,18 @@ static struct rt_wlan_prot *rt_wlan_lwip_protocol_register(struct rt_wlan_prot *
rt_memset
(
lwip_prot
,
0
,
sizeof
(
struct
lwip_prot_des
));
rt_memset
(
lwip_prot
,
0
,
sizeof
(
struct
lwip_prot_des
));
eth
=
&
lwip_prot
->
eth
;
eth
=
&
lwip_prot
->
eth
;
#ifdef RT_USING_DEVICE_OPS
eth
->
parent
.
ops
=
&
wlan_lwip_ops
;
#else
eth
->
parent
.
init
=
RT_NULL
;
eth
->
parent
.
init
=
RT_NULL
;
eth
->
parent
.
open
=
RT_NULL
;
eth
->
parent
.
open
=
RT_NULL
;
eth
->
parent
.
close
=
RT_NULL
;
eth
->
parent
.
close
=
RT_NULL
;
eth
->
parent
.
read
=
RT_NULL
;
eth
->
parent
.
read
=
RT_NULL
;
eth
->
parent
.
write
=
RT_NULL
;
eth
->
parent
.
write
=
RT_NULL
;
eth
->
parent
.
control
=
rt_wlan_lwip_protocol_control
;
eth
->
parent
.
control
=
rt_wlan_lwip_protocol_control
;
#endif
eth
->
parent
.
user_data
=
wlan
;
eth
->
parent
.
user_data
=
wlan
;
eth
->
eth_rx
=
RT_NULL
;
eth
->
eth_rx
=
RT_NULL
;
eth
->
eth_tx
=
rt_wlan_lwip_protocol_send
;
eth
->
eth_tx
=
rt_wlan_lwip_protocol_send
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录