Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
rcore-os
RCore Tutorial V3
提交
6d10d3e3
R
RCore Tutorial V3
项目概览
rcore-os
/
RCore Tutorial V3
上一次同步 1 年多
通知
15
Star
793
Fork
260
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
RCore Tutorial V3
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
6d10d3e3
编写于
6月 20, 2022
作者:
chyyuu1972
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
in gui app, can recv keyboard and mouse info
上级
39ba7253
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
7 addition
and
3 deletion
+7
-3
os/src/boards/qemu.rs
os/src/boards/qemu.rs
+5
-1
os/src/drivers/input/mod.rs
os/src/drivers/input/mod.rs
+2
-2
未找到文件。
os/src/boards/qemu.rs
浏览文件 @
6d10d3e3
...
...
@@ -16,6 +16,7 @@ pub const VIRT_UART: usize = 0x1000_0000;
use
crate
::
drivers
::
block
::
BLOCK_DEVICE
;
use
crate
::
drivers
::
chardev
::{
CharDevice
,
UART
};
use
crate
::
drivers
::
plic
::{
IntrTargetPriority
,
PLIC
};
use
crate
::
drivers
::{
KEYBOARD_DEVICE
,
MOUSE_DEVICE
};
pub
fn
device_init
()
{
use
riscv
::
register
::
sie
;
...
...
@@ -25,7 +26,8 @@ pub fn device_init() {
let
machine
=
IntrTargetPriority
::
Machine
;
plic
.set_threshold
(
hart_id
,
supervisor
,
0
);
plic
.set_threshold
(
hart_id
,
machine
,
1
);
for
intr_src_id
in
[
8u
size
,
10
]
{
//irq nums: 5 keyboard, 6 mouse, 8 block, 10 uart
for
intr_src_id
in
[
5u
size
,
6
,
8
,
10
]
{
plic
.enable
(
hart_id
,
supervisor
,
intr_src_id
);
plic
.set_priority
(
intr_src_id
,
1
);
}
...
...
@@ -38,6 +40,8 @@ pub fn irq_handler() {
let
mut
plic
=
unsafe
{
PLIC
::
new
(
VIRT_PLIC
)
};
let
intr_src_id
=
plic
.claim
(
0
,
IntrTargetPriority
::
Supervisor
);
match
intr_src_id
{
5
=>
KEYBOARD_DEVICE
.handle_irq
(),
6
=>
MOUSE_DEVICE
.handle_irq
(),
8
=>
BLOCK_DEVICE
.handle_irq
(),
10
=>
UART
.handle_irq
(),
_
=>
panic!
(
"unsupported IRQ {}"
,
intr_src_id
),
...
...
os/src/drivers/input/mod.rs
浏览文件 @
6d10d3e3
...
...
@@ -21,7 +21,7 @@ const VIRTIO6: usize = 0x10006000;
struct
VirtIOINPUT
(
UPIntrFreeCell
<
VirtIOInput
<
'static
>>
);
pub
trait
INPUTDevice
:
Send
+
Sync
+
Any
{
fn
handle
r_interrupt
(
&
self
);
fn
handle
_irq
(
&
self
);
}
lazy_static
::
lazy_static!
(
...
...
@@ -38,7 +38,7 @@ impl VirtIOINPUT {
}
impl
INPUTDevice
for
VirtIOINPUT
{
fn
handle
r_interrupt
(
&
self
)
{
fn
handle
_irq
(
&
self
)
{
let
mut
input
=
self
.0
.exclusive_access
();
input
.ack_interrupt
();
let
event
=
input
.pop_pending_event
()
.unwrap
();
...
...
Miykael_xxm
🚴
@xiongjiamu
mentioned in commit
5054212f
·
7月 14, 2022
mentioned in commit
5054212f
mentioned in commit 5054212f566c59bbd5308eefa0bf51f601c4075f
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录