📄 x86.h
字号:
/***************************************************************************
** File name : x86.h
** Author :
** Create date :
**
** Comments:
** 定义了x86机器的中断号以及和硬件中断有关的...
**
** Revisions:
** $Log: x86.h,v $
** Revision 1.1.1.1 2005/07/27 06:53:15 x.cheng
** add into repositories
**
**
***************************************************************************/
#ifndef __JCINX_INC_X86_H
#define __JCINX_INC_X86_H
#include "io.h"
/************************************************
* EFLAGS
************************************************/
#define EFLAGS_IF 0x200 //Interrupt enable flag in EFLAGS register.
#define EFLAGS_IOPL3 0x3000 //I/O privilege level 3 (minimum privilege).
//Everyone can perform I/O operation.
#define EFLAGS_IOPL2 0x2000 //I/O privilege level 2.
#define EFLAGS_IOPL1 0x1000 //I/O privilege level 1.
#define EFLAGS_IOPL0 0x0000 //I/O privilege level 0 (maximum privilege).
//Only the kernel can perform I/O operation.
/************************************************
* PC 硬件端口号定义
************************************************/
/*********中断屏蔽寄存器的起始端口号*************/
#define PORT_8259A_MAJOR 0x20 /*主片*/
#define PORT_8259A_MINOR 0xA0 /*从片*/
#define EOI 0x20 // PIC 8259 EOI (End Of Interrupt).
/*********键盘I/O端口号**************************/
#define PORT_8255_BASE_ADDRESS 0x60 //Keyboard base address port.
#define PORT_8255_KEYB_ACK PORT_8255_BASE_ADDRESS+1 //Keyboard acknowledge register.
#define PORT_8255_KEYB_STATUS PORT_8255_BASE_ADDRESS+4 //Keyboard status register.
#define PORT_8255_KEYB_LED_CODE 0xED //Keyboard LED register.
/************************************************
*在setup.asm中,我们把硬件可屏蔽中断的起始号
*定在0x20,8259A(PIC)
************************************************/
#define HW_IRQ_NR 16
#define HW_PIC_INTR_START 0x20
/************so, the following*******************/
#define HWM_TIMER_IRQ0 HW_PIC_INTR_START+0
#define HWM_KEYB_IRQ1 HW_PIC_INTR_START+1
#define HWM_SLAVE_IRQ2 HW_PIC_INTR_START+2
#define HWM_COM2_IRQ3 HW_PIC_INTR_START+3
#define HWM_COM1_IRQ4 HW_PIC_INTR_START+4
#define HWM_LPT2_IRQ5 HW_PIC_INTR_START+5
#define HWM_FLOPPY_IRQ6 HW_PIC_INTR_START+6
#define HWM_LPT1_IRQ7 HW_PIC_INTR_START+7
/*******从片********************/
#define HWM_RTC_IRQ8 HW_PIC_INTR_START+8
#define HWM_PICMASTER_IRQ9 HW_PIC_INTR_START+9
#define HWM_RESERVED_IRQa HW_PIC_INTR_START+0x0a
#define HWM_RESERVED_IRQb HW_PIC_INTR_START+0x0b
#define HWM_PS2_IRQc HW_PIC_INTR_START+0x0c
#define HWM_80x87_IRQd HW_PIC_INTR_START+0x0d
#define HWM_IDE_CHN0_IRQe HW_PIC_INTR_START+0x0e
#define HWM_IDE_CHN1_IRQf HW_PIC_INTR_START+0x0f
/********允许8259A的主片的inr2(即允许从片中断)********/
//#define ENABLE_IRQ2 ucInPortDelay(PORT_8259A_MAJOR+1)&0xfd
#define ENABLE_IRQ2 ucInPortDelay(PORT_8259A_MAJOR+1)&~0x04
/***********允许IRQ0 ---timer0*******************/
#define ENABLE_IRQ0 ucInPortDelay(PORT_8259A_MAJOR+1)&~0x01
/***********允许IRQ1 ---keyb*********************/
#define ENABLE_IRQ1 ucInPortDelay(PORT_8259A_MAJOR+1)&~0x02
/**************允许IRQe ---ide*******************/
#define ENABLE_IRQe ucInPortDelay(PORT_8259A_MINOR+1)&~0x40
#endif /* end of __JCINX_INC_X86_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -