Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party NuttX
提交
51b767a9
T
Third Party NuttX
项目概览
OpenHarmony
/
Third Party NuttX
大约 1 年 前同步成功
通知
5
Star
19
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party NuttX
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
51b767a9
编写于
5月 21, 2021
作者:
O
openharmony_ci
提交者:
Gitee
5月 21, 2021
浏览文件
操作
浏览文件
下载
差异文件
!43 重写代码,将嵌套的结构体成员指向与强转分层,使代码更清晰
Merge pull request !43 from JING/drv
上级
e156f0f0
4099694b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
22 addition
and
7 deletion
+22
-7
drivers/video/fb.c
drivers/video/fb.c
+22
-7
未找到文件。
drivers/video/fb.c
浏览文件 @
51b767a9
...
...
@@ -113,8 +113,10 @@ static ssize_t fb_mmap(struct file *filep, LosVmMapRegion *region)
int
ret
=
-
EINVAL
;
struct
fb_chardev_s
*
fb
;
struct
fb_vtable_s
*
vtable
;
struct
drv_data
*
drvData
;
fb
=
(
struct
fb_chardev_s
*
)((
struct
drv_data
*
)
filep
->
f_vnode
->
data
)
->
priv
;
drvData
=
(
struct
drv_data
*
)
filep
->
f_vnode
->
data
;
fb
=
(
struct
fb_chardev_s
*
)
drvData
->
priv
;
if
(
fb
==
NULL
)
{
return
-
ENODEV
;
...
...
@@ -148,8 +150,10 @@ static int fb_open(struct file *filep)
struct
fb_chardev_s
*
fb
;
struct
fb_vtable_s
*
vtable
;
int
ret
=
-
EINVAL
;
struct
drv_data
*
drvData
;
fb
=
(
struct
fb_chardev_s
*
)((
struct
drv_data
*
)
filep
->
f_vnode
->
data
)
->
priv
;
drvData
=
(
struct
drv_data
*
)
filep
->
f_vnode
->
data
;
fb
=
(
struct
fb_chardev_s
*
)
drvData
->
priv
;
if
(
fb
==
NULL
)
{
return
-
ENODEV
;
...
...
@@ -183,8 +187,10 @@ static int fb_close(struct file *filep)
struct
fb_chardev_s
*
fb
;
struct
fb_vtable_s
*
vtable
;
int
ret
=
-
EINVAL
;
struct
drv_data
*
drvData
;
fb
=
(
struct
fb_chardev_s
*
)((
struct
drv_data
*
)
filep
->
f_vnode
->
data
)
->
priv
;
drvData
=
(
struct
drv_data
*
)
filep
->
f_vnode
->
data
;
fb
=
(
struct
fb_chardev_s
*
)
drvData
->
priv
;
if
(
fb
==
NULL
)
{
return
-
ENODEV
;
...
...
@@ -215,11 +221,13 @@ static ssize_t fb_read(struct file *filep, char *buffer, size_t len)
size_t
end
;
size_t
size
;
int
ret
;
struct
drv_data
*
drvData
;
/* Get the framebuffer instance */
DEBUGASSERT
(
filep
!=
NULL
&&
filep
->
f_vnode
!=
NULL
);
fb
=
(
struct
fb_chardev_s
*
)((
struct
drv_data
*
)
filep
->
f_vnode
->
data
)
->
priv
;
drvData
=
(
struct
drv_data
*
)
filep
->
f_vnode
->
data
;
fb
=
(
struct
fb_chardev_s
*
)
drvData
->
priv
;
/* Get the start and size of the transfer */
start
=
filep
->
f_pos
;
...
...
@@ -259,11 +267,14 @@ static ssize_t fb_write(struct file *filep, const char *buffer,
size_t
end
;
size_t
size
;
int
ret
;
struct
drv_data
*
drvData
;
/* Get the framebuffer instance */
DEBUGASSERT
(
filep
!=
NULL
&&
filep
->
f_vnode
!=
NULL
);
fb
=
(
struct
fb_chardev_s
*
)((
struct
drv_data
*
)
filep
->
f_vnode
->
data
)
->
priv
;
drvData
=
(
struct
drv_data
*
)
filep
->
f_vnode
->
data
;
fb
=
(
struct
fb_chardev_s
*
)
drvData
->
priv
;
/* Get the start and size of the transfer */
start
=
filep
->
f_pos
;
...
...
@@ -306,11 +317,13 @@ static off_t fb_seek(struct file *filep, off_t offset, int whence)
struct
fb_chardev_s
*
fb
=
NULL
;
off_t
newpos
;
int
ret
;
struct
drv_data
*
drvData
;
/* Get the framebuffer instance */
DEBUGASSERT
(
filep
!=
NULL
&&
filep
->
f_vnode
!=
NULL
);
fb
=
(
struct
fb_chardev_s
*
)((
struct
drv_data
*
)
filep
->
f_vnode
->
data
)
->
priv
;
drvData
=
(
struct
drv_data
*
)
filep
->
f_vnode
->
data
;
fb
=
(
struct
fb_chardev_s
*
)
drvData
->
priv
;
/* Determine the new, requested file position */
switch
(
whence
)
...
...
@@ -371,11 +384,13 @@ static int fb_ioctl(struct file *filep, int cmd, unsigned long arg)
{
struct
fb_chardev_s
*
fb
=
NULL
;
int
ret
;
struct
drv_data
*
drvData
;
/* Get the framebuffer instance */
DEBUGASSERT
(
filep
!=
NULL
&&
filep
->
f_vnode
!=
NULL
);
fb
=
(
struct
fb_chardev_s
*
)((
struct
drv_data
*
)
filep
->
f_vnode
->
data
)
->
priv
;
drvData
=
(
struct
drv_data
*
)
filep
->
f_vnode
->
data
;
fb
=
(
struct
fb_chardev_s
*
)
drvData
->
priv
;
/* Process the IOCTL command */
switch
(
cmd
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录