🆕 键盘驱动上半部

This commit is contained in:
fslongjin
2022-03-16 13:54:26 +08:00
parent fcb3930ab7
commit 832442af6a
8 changed files with 176 additions and 13 deletions

View File

@ -291,13 +291,14 @@ void do_IRQ(struct pt_regs *rsp, ul number)
{
unsigned char x = io_in8(0x60);
printk_color(BLUE, WHITE, "(IRQ:%#04x)\tkey code:%#04x\n", number, x);
irq_desc_t *irq = &interrupt_desc[number - 32];
// 执行中断上半部处理程序
if (irq->handler != NULL)
irq->handler(number, irq->parameter, rsp);
else
kwarn("Intr vector [%d] does not have a handler!");
// 向中断控制器发送应答消息
if (irq->controller != NULL && irq->controller->ack != NULL)
@ -316,7 +317,7 @@ void do_IRQ(struct pt_regs *rsp, ul number)
* @param index 索引值
* @return ul
*/
ul apic_read_ioapic_rte(unsigned char index)
ul apic_ioapic_read_rte(unsigned char index)
{
// 由于处理器的乱序执行的问题,需要加入内存屏障以保证结果的正确性。
ul ret;

View File

@ -212,7 +212,7 @@ struct apic_IO_APIC_RTE_entry
#define ICR_ALL_INCLUDE_Self 2
#define ICR_ALL_EXCLUDE_Self 3
// 目标模式
// 投递目标模式
#define DEST_PHYSICAL 0 // 物理模式
#define DEST_LOGIC 1 // 逻辑模式
@ -220,7 +220,7 @@ struct apic_IO_APIC_RTE_entry
#define ICR_LEVEL_DE_ASSERT 0
#define ICR_LEVEL_ASSERT 1
// 远程IRR
// 远程IRR标志位, 在处理Local APIC标志位时置位在收到处理器发来的EOI命令时复位
#define IRR_RESET 0
#define IRR_ACCEPT 1