Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2020fengziyang
rt-thread
提交
5774dcac
R
rt-thread
项目概览
2020fengziyang
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
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,发现更多精彩内容 >>
未验证
提交
5774dcac
编写于
6月 21, 2022
作者:
G
GUI
提交者:
GitHub
6月 21, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[bsp/qemu-virt64-aarch64] Fixup VirtIO queue align size (#6096)
上级
f41cb563
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
26 addition
and
9 deletion
+26
-9
bsp/qemu-virt64-aarch64/applications/graphic.c
bsp/qemu-virt64-aarch64/applications/graphic.c
+25
-8
bsp/qemu-virt64-aarch64/driver/virtio/virtio.c
bsp/qemu-virt64-aarch64/driver/virtio/virtio.c
+1
-1
未找到文件。
bsp/qemu-virt64-aarch64/applications/graphic.c
浏览文件 @
5774dcac
...
@@ -23,9 +23,12 @@ static rt_uint32_t cur_range[2];
...
@@ -23,9 +23,12 @@ static rt_uint32_t cur_range[2];
static
rt_uint32_t
cur_points
[
2
];
static
rt_uint32_t
cur_points
[
2
];
static
rt_uint32_t
cur_last_points
[
2
];
static
rt_uint32_t
cur_last_points
[
2
];
static
rt_bool_t
cur_event_sync
;
static
rt_bool_t
cur_event_sync
;
static
rt_uint32_t
color
[
2
]
=
{
0xff0000
,
0x0000ff
};
void
tablet_event_handler
(
struct
virtio_input_event
event
)
void
tablet_event_handler
(
struct
virtio_input_event
event
)
{
{
static
rt_bool_t
cur_btn_down
=
RT_FALSE
;
if
(
event
.
type
==
EV_ABS
)
if
(
event
.
type
==
EV_ABS
)
{
{
if
(
event
.
code
==
0
)
if
(
event
.
code
==
0
)
...
@@ -37,6 +40,24 @@ void tablet_event_handler(struct virtio_input_event event)
...
@@ -37,6 +40,24 @@ void tablet_event_handler(struct virtio_input_event event)
cur_points
[
1
]
=
(
cur_max
[
1
]
*
(
event
.
value
-
cur_min
[
1
])
+
cur_range
[
1
]
/
2
)
/
cur_range
[
1
];
cur_points
[
1
]
=
(
cur_max
[
1
]
*
(
event
.
value
-
cur_min
[
1
])
+
cur_range
[
1
]
/
2
)
/
cur_range
[
1
];
}
}
}
}
else
if
(
event
.
type
==
EV_KEY
)
{
if
(
event
.
code
==
BTN_LEFT
)
{
if
(
cur_btn_down
&&
event
.
value
==
0
)
{
color
[
0
]
^=
color
[
1
];
color
[
1
]
^=
color
[
0
];
color
[
0
]
^=
color
[
1
];
cur_btn_down
=
RT_FALSE
;
cur_event_sync
=
RT_TRUE
;
}
else
{
cur_btn_down
=
RT_TRUE
;
}
}
}
else
if
(
event
.
type
==
EV_SYN
)
else
if
(
event
.
type
==
EV_SYN
)
{
{
cur_event_sync
=
RT_TRUE
;
cur_event_sync
=
RT_TRUE
;
...
@@ -52,8 +73,6 @@ void graphic_thread(void *param)
...
@@ -52,8 +73,6 @@ void graphic_thread(void *param)
rt_device_t
tablet_dev
=
RT_NULL
;
rt_device_t
tablet_dev
=
RT_NULL
;
struct
virtio_input_config
tablet_config
;
struct
virtio_input_config
tablet_config
;
rt_uint32_t
red
=
0xff0000
;
rt_uint32_t
blue
=
0x0000ff
;
rt_uint32_t
white
=
0xffffff
;
rt_uint32_t
white
=
0xffffff
;
rt_device_t
gpu_dev
=
RT_NULL
;
rt_device_t
gpu_dev
=
RT_NULL
;
struct
rt_device_rect_info
rect_info
;
struct
rt_device_rect_info
rect_info
;
...
@@ -87,15 +106,13 @@ void graphic_thread(void *param)
...
@@ -87,15 +106,13 @@ void graphic_thread(void *param)
cur_last_points
[
0
]
=
graphic_info
.
width
/
2
;
cur_last_points
[
0
]
=
graphic_info
.
width
/
2
;
cur_last_points
[
1
]
=
graphic_info
.
height
/
2
;
cur_last_points
[
1
]
=
graphic_info
.
height
/
2
;
virtio_gpu_graphic_ops
->
draw_hline
((
char
*
)
&
red
,
0
,
graphic_info
.
width
,
cur_last_points
[
1
]);
virtio_gpu_graphic_ops
->
draw_hline
((
char
*
)
&
color
[
0
]
,
0
,
graphic_info
.
width
,
cur_last_points
[
1
]);
virtio_gpu_graphic_ops
->
draw_vline
((
char
*
)
&
blue
,
cur_last_points
[
0
],
0
,
graphic_info
.
height
);
virtio_gpu_graphic_ops
->
draw_vline
((
char
*
)
&
color
[
1
]
,
cur_last_points
[
0
],
0
,
graphic_info
.
height
);
rt_device_control
(
device
,
RTGRAPHIC_CTRL_RECT_UPDATE
,
&
rect_info
);
rt_device_control
(
device
,
RTGRAPHIC_CTRL_RECT_UPDATE
,
&
rect_info
);
gpu_dev
=
device
;
gpu_dev
=
device
;
}
}
rt_device_close
(
device
);
}
}
/* Keyboard, Mouse, Tablet */
/* Keyboard, Mouse, Tablet */
...
@@ -153,8 +170,8 @@ void graphic_thread(void *param)
...
@@ -153,8 +170,8 @@ void graphic_thread(void *param)
cur_last_points
[
0
]
=
cur_points
[
0
];
cur_last_points
[
0
]
=
cur_points
[
0
];
cur_last_points
[
1
]
=
cur_points
[
1
];
cur_last_points
[
1
]
=
cur_points
[
1
];
virtio_gpu_graphic_ops
->
draw_hline
((
char
*
)
&
red
,
0
,
graphic_info
.
width
,
cur_last_points
[
1
]);
virtio_gpu_graphic_ops
->
draw_hline
((
char
*
)
&
color
[
0
]
,
0
,
graphic_info
.
width
,
cur_last_points
[
1
]);
virtio_gpu_graphic_ops
->
draw_vline
((
char
*
)
&
blue
,
cur_last_points
[
0
],
0
,
graphic_info
.
height
);
virtio_gpu_graphic_ops
->
draw_vline
((
char
*
)
&
color
[
1
]
,
cur_last_points
[
0
],
0
,
graphic_info
.
height
);
rt_device_control
(
gpu_dev
,
RTGRAPHIC_CTRL_RECT_UPDATE
,
&
rect_info
);
rt_device_control
(
gpu_dev
,
RTGRAPHIC_CTRL_RECT_UPDATE
,
&
rect_info
);
...
...
bsp/qemu-virt64-aarch64/driver/virtio/virtio.c
浏览文件 @
5774dcac
...
@@ -72,7 +72,7 @@ rt_err_t virtio_queue_init(struct virtio_device *dev, rt_uint32_t queue_index, r
...
@@ -72,7 +72,7 @@ rt_err_t virtio_queue_init(struct virtio_device *dev, rt_uint32_t queue_index, r
queue
=
&
dev
->
queues
[
queue_index
];
queue
=
&
dev
->
queues
[
queue_index
];
pages_total_size
=
VIRTIO_PAGE_ALIGN
(
pages_total_size
=
VIRTIO_PAGE_ALIGN
(
VIRTQ_DESC_TOTAL_SIZE
(
ring_size
)
+
VIRTQ_AVAIL_TOTAL_SIZE
(
ring_size
)
+
VIRTQ_USED_TOTAL_SIZE
(
ring_size
)
);
VIRTQ_DESC_TOTAL_SIZE
(
ring_size
)
+
VIRTQ_AVAIL_TOTAL_SIZE
(
ring_size
)
)
+
VIRTQ_USED_TOTAL_SIZE
(
ring_size
);
pages
=
rt_malloc_align
(
pages_total_size
,
VIRTIO_PAGE_SIZE
);
pages
=
rt_malloc_align
(
pages_total_size
,
VIRTIO_PAGE_SIZE
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录