mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-19 04:56:30 +00:00
🎨 将初始化8259A的代码移动到driver文件夹
This commit is contained in:
@ -1,35 +0,0 @@
|
||||
#include "8259A.h"
|
||||
#include "irq.c"
|
||||
#include "../common/printk.h"
|
||||
#include "../common/kprint.h"
|
||||
|
||||
void init_8259A()
|
||||
{
|
||||
// 初始化中断门, 中断使用第二个ist
|
||||
for(int i=32;i<=55;++i)
|
||||
set_intr_gate(i, 2, interrupt[i-32]);
|
||||
kinfo("Initializing 8259A...");
|
||||
|
||||
// 初始化主芯片
|
||||
io_out8(0x20, 0x11); // 初始化主芯片的icw1
|
||||
io_out8(0x21, 0x20); // 设置主芯片的中断向量号为0x20(0x20-0x27)
|
||||
io_out8(0x21, 0x04); // 设置int2端口级联从芯片
|
||||
io_out8(0x21, 0x01); // 设置为AEOI模式、FNM、无缓冲
|
||||
|
||||
// 初始化从芯片
|
||||
io_out8(0xa0, 0x11);
|
||||
io_out8(0xa1, 0x28); // 设置从芯片的中断向量号为0x28(0x28-0x2f)
|
||||
io_out8(0xa1, 0x02); // 设置从芯片连接到主芯片的int2
|
||||
io_out8(0xa1, 0x01);
|
||||
|
||||
|
||||
// 设置ocw1, 允许所有中断请求
|
||||
io_out8(0x21, 0x00);
|
||||
io_out8(0xa1, 0x00);
|
||||
|
||||
sti();
|
||||
|
||||
kinfo("IRQ circuit 8259A initialized.");
|
||||
|
||||
}
|
||||
|
@ -1,25 +0,0 @@
|
||||
/**
|
||||
* @file 8259A.h
|
||||
* @author longjin
|
||||
* @brief 8259A中断芯片
|
||||
* @version 0.1
|
||||
* @date 2022-01-29
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../common/glib.h"
|
||||
|
||||
#define PIC_EOI 0x20
|
||||
#define PIC_master 0x20 /* IO base address for master PIC */
|
||||
#define PIC2_slave 0xA0 /* IO base address for slave PIC */
|
||||
|
||||
// 初始化8259A芯片的中断服务
|
||||
void init_8259A();
|
||||
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "irq.h"
|
||||
#include "8259A.h"
|
||||
#include "../driver/interrupt/8259A/8259A.h"
|
||||
#include "../common/asm.h"
|
||||
#include"../common/printk.h"
|
||||
#include "gate.h"
|
||||
@ -80,7 +80,7 @@ Build_IRQ(0x36)
|
||||
Build_IRQ(0x37)
|
||||
|
||||
// 初始化中断数组
|
||||
void (*interrupt[24])(void)=
|
||||
void (*interrupt_table[24])(void)=
|
||||
{
|
||||
IRQ0x20interrupt,
|
||||
IRQ0x21interrupt,
|
||||
|
Reference in New Issue
Block a user