00001 #ifndef LPTPORT1_H 00002 #define LPTPORT1_H 00003 00004 #define LPT1_BASE 0x378 //0x378~0x37f 00005 //#define LPT2_BASE 0x278 //0x278~0x27f...declaration in lptport2.h 00006 #define LPT3_BASE 0x3bc //??this port is used parrallel port which was incorporated onto video card 00007 //??this port don't support ECP address 00008 //??this port is not used any more in 80x86 pc. 00009 00010 #define LPT1_DATA_PORT LPT1_BASE 00011 #define LPT1_STATUS_PORT (LPT1_BASE+1) 00012 #define LPT1_CONTROL_PORT (LPT1_BASE+2) 00013 00014 #define LPT_CONTORL_STROBE 0x01 00015 #define LPT_CONTORL_AUTOFDXT 0x02 00016 #define LPT_CONTORL_INITB 0x04 00017 #define LPT_CONTORL_SLCTIN 0x08 00018 #define LPT_CONTORL_INTEN 0x10 //interrupt enable...we can use this as external interrupt 00019 #define LPT_CONTORL_DIR_READ 0x20 //data port direction...0 for data port output(write),1 for data port input(read) 00020 #define LPT_CONTORL_BIT6 0x40 //reserved 00021 #define LPT_CONTORL_BIT7 0x80 //reserved 00022 00023 #define LPT_STATUS_ERRORB 0x08 00024 #define LPT_STATUS_SLCT 0x10 00025 #define LPT_STATUS_PE 0x20 00026 #define LPT_STATUS_ACKNLGB 0x40 00027 #define LPT_STATUS_BUSYB 0x80 00028 00029 typedef struct{ 00030 U8 State; 00031 U8 Data; 00032 U8 Status; 00033 U8 Control; 00034 U16 Timer; 00035 }LPT1_CONTROL; 00036 00037 extern LPT1_CONTROL Lpt1Ctrl; 00038 00039 void Lpt1Init(void); 00040 void Lpt1Handler(void); 00041 void Lpt1Svc(void); 00042 U8 Lpt1DataPortRead(void); 00043 void Lpt1DataPortWrite(U8 Data); 00044 U8 Lpt1StatusPortRead(void); 00045 void Lpt1ControlPortWrite(U8 Data); 00046 void Lpt1DataPortSetOutput(void); 00047 void Lpt1DataPortSetInput(void); 00048 void Lpt1InterruptEnable(void); 00049 void Lpt1InterruptDisable(void); 00050 #endif
1.5.9