git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
feat: (iso9660) finishing up unmount
[lunaix-os.git]
/
lunaix-os
/
kernel
/
peripheral
/
ps2kbd.c
diff --git
a/lunaix-os/kernel/peripheral/ps2kbd.c
b/lunaix-os/kernel/peripheral/ps2kbd.c
index df6ffc1ade4ed728e19a87fa9906d21ca6284e97..83ad3573190b7485060436a601ff4ae2fc52bd51 100644
(file)
--- a/
lunaix-os/kernel/peripheral/ps2kbd.c
+++ b/
lunaix-os/kernel/peripheral/ps2kbd.c
@@
-3,6
+3,7
@@
#include <lunaix/clock.h>
#include <lunaix/common.h>
#include <lunaix/input.h>
#include <lunaix/clock.h>
#include <lunaix/common.h>
#include <lunaix/input.h>
+#include <lunaix/isrm.h>
#include <lunaix/peripheral/ps2kbd.h>
#include <lunaix/syslog.h>
#include <lunaix/timer.h>
#include <lunaix/peripheral/ps2kbd.h>
#include <lunaix/syslog.h>
#include <lunaix/timer.h>
@@
-15,7
+16,7
@@
#define PS2_DEV_CMD_MAX_ATTEMPTS 5
#define PS2_DEV_CMD_MAX_ATTEMPTS 5
-LOG_MODULE("
PS2KBD
");
+LOG_MODULE("
i8042
");
static struct ps2_cmd_queue cmd_q;
static struct ps2_kbd_state kbd_state;
static struct ps2_cmd_queue cmd_q;
static struct ps2_kbd_state kbd_state;
@@
-138,13
+139,13
@@
ps2_kbd_init()
* https://bochs.sourceforge.io/cgi-bin/lxr/source/bios/rombios32.c#L1314
*/
if (!(acpi_ctx->fadt.boot_arch & IAPC_ARCH_8042)) {
* https://bochs.sourceforge.io/cgi-bin/lxr/source/bios/rombios32.c#L1314
*/
if (!(acpi_ctx->fadt.boot_arch & IAPC_ARCH_8042)) {
- kprintf(KERROR "
i8042:
not found\n");
+ kprintf(KERROR "not found\n");
// FUTURE: Some alternative fallback on this? Check PCI bus for USB
// controller instead?
return;
}
} else {
// FUTURE: Some alternative fallback on this? Check PCI bus for USB
// controller instead?
return;
}
} else {
- kprintf(KWARN "
i8042:
outdated FADT used, assuming exists.\n");
+ kprintf(KWARN "outdated FADT used, assuming exists.\n");
}
char result;
}
char result;
@@
-166,14
+167,14
@@
ps2_kbd_init()
// 4、控制器自检
result = ps2_issue_cmd_wretry(PS2_CMD_SELFTEST, PS2_NO_ARG);
if (result != PS2_RESULT_TEST_OK) {
// 4、控制器自检
result = ps2_issue_cmd_wretry(PS2_CMD_SELFTEST, PS2_NO_ARG);
if (result != PS2_RESULT_TEST_OK) {
- kprintf(KWARN "
C
ontroller self-test failed. (%x)\n", result);
+ kprintf(KWARN "
c
ontroller self-test failed. (%x)\n", result);
// goto done;
}
// 5、设备自检(端口1自检,通常是我们的键盘)
result = ps2_issue_cmd_wretry(PS2_CMD_SELFTEST_PORT1, PS2_NO_ARG);
if (result != 0) {
// goto done;
}
// 5、设备自检(端口1自检,通常是我们的键盘)
result = ps2_issue_cmd_wretry(PS2_CMD_SELFTEST_PORT1, PS2_NO_ARG);
if (result != 0) {
- kprintf(KERROR "
I
nterface test on port 1 failed. (%x)\n", result);
+ kprintf(KERROR "
i
nterface test on port 1 failed. (%x)\n", result);
// goto done;
}
// goto done;
}
@@
-188,9
+189,6
@@
ps2_kbd_init()
// 至此,PS/2控制器和设备已完成初始化,可以正常使用。
// 至此,PS/2控制器和设备已完成初始化,可以正常使用。
- // 将我们的键盘驱动挂载到第204号中断上(已由IOAPIC映射至IRQ#1),
- intr_subscribe(PC_KBD_IV, intr_ps2_kbd_handler);
-
// 搞一个计时器,将我们的 ps2_process_cmd
// 挂上去。每隔5毫秒执行排在队头的命令。
// 为什么只执行队头的命令,而不是全部的命令?
// 搞一个计时器,将我们的 ps2_process_cmd
// 挂上去。每隔5毫秒执行排在队头的命令。
// 为什么只执行队头的命令,而不是全部的命令?
@@
-207,8
+205,7
@@
ps2_kbd_init()
*
* 所以,保险的方法是:在初始化后才去设置ioapic,这样一来我们就能有一个稳定的IRQ#1以放心使用。
*/
*
* 所以,保险的方法是:在初始化后才去设置ioapic,这样一来我们就能有一个稳定的IRQ#1以放心使用。
*/
- uint8_t irq_kbd = ioapic_get_irq(acpi_ctx, PC_AT_IRQ_KBD);
- ioapic_redirect(irq_kbd, PC_KBD_IV, 0, IOAPIC_DELMOD_FIXED);
+ isrm_bindirq(PC_AT_IRQ_KBD, intr_ps2_kbd_handler);
done:
cpu_enable_interrupt();
done:
cpu_enable_interrupt();
@@
-427,7
+424,7
@@
ps2_issue_cmd_wretry(char cmd, uint16_t arg)
c++;
}
if (c >= 5) {
c++;
}
if (c >= 5) {
- kprintf(KWARN "
M
ax attempt reached.\n");
+ kprintf(KWARN "
m
ax attempt reached.\n");
}
return r;
}
}
return r;
}