Go to the source code of this file.
Data Structures | |
| struct | LPT1_CONTROL |
Defines | |
| #define | LPT1_BASE 0x378 |
| #define | LPT3_BASE 0x3bc |
| #define | LPT1_DATA_PORT LPT1_BASE |
| #define | LPT1_STATUS_PORT (LPT1_BASE+1) |
| #define | LPT1_CONTROL_PORT (LPT1_BASE+2) |
| #define | LPT_CONTORL_STROBE 0x01 |
| #define | LPT_CONTORL_AUTOFDXT 0x02 |
| #define | LPT_CONTORL_INITB 0x04 |
| #define | LPT_CONTORL_SLCTIN 0x08 |
| #define | LPT_CONTORL_INTEN 0x10 |
| #define | LPT_CONTORL_DIR_READ 0x20 |
| #define | LPT_CONTORL_BIT6 0x40 |
| #define | LPT_CONTORL_BIT7 0x80 |
| #define | LPT_STATUS_ERRORB 0x08 |
| #define | LPT_STATUS_SLCT 0x10 |
| #define | LPT_STATUS_PE 0x20 |
| #define | LPT_STATUS_ACKNLGB 0x40 |
| #define | LPT_STATUS_BUSYB 0x80 |
Functions | |
| void | Lpt1Init (void) |
| void | Lpt1Handler (void) |
| void | Lpt1Svc (void) |
| U8 | Lpt1DataPortRead (void) |
| void | Lpt1DataPortWrite (U8 Data) |
| U8 | Lpt1StatusPortRead (void) |
| void | Lpt1ControlPortWrite (U8 Data) |
| void | Lpt1DataPortSetOutput (void) |
| void | Lpt1DataPortSetInput (void) |
| void | Lpt1InterruptEnable (void) |
| void | Lpt1InterruptDisable (void) |
Variables | |
| LPT1_CONTROL | Lpt1Ctrl |
| #define LPT1_BASE 0x378 |
Definition at line 4 of file lptport1.h.
| #define LPT1_CONTROL_PORT (LPT1_BASE+2) |
Definition at line 12 of file lptport1.h.
| #define LPT1_DATA_PORT LPT1_BASE |
Definition at line 10 of file lptport1.h.
| #define LPT1_STATUS_PORT (LPT1_BASE+1) |
Definition at line 11 of file lptport1.h.
| #define LPT3_BASE 0x3bc |
Definition at line 6 of file lptport1.h.
| #define LPT_CONTORL_AUTOFDXT 0x02 |
Definition at line 15 of file lptport1.h.
| #define LPT_CONTORL_BIT6 0x40 |
Definition at line 20 of file lptport1.h.
| #define LPT_CONTORL_BIT7 0x80 |
Definition at line 21 of file lptport1.h.
| #define LPT_CONTORL_DIR_READ 0x20 |
Definition at line 19 of file lptport1.h.
| #define LPT_CONTORL_INITB 0x04 |
Definition at line 16 of file lptport1.h.
| #define LPT_CONTORL_INTEN 0x10 |
Definition at line 18 of file lptport1.h.
| #define LPT_CONTORL_SLCTIN 0x08 |
Definition at line 17 of file lptport1.h.
| #define LPT_CONTORL_STROBE 0x01 |
Definition at line 14 of file lptport1.h.
| #define LPT_STATUS_ACKNLGB 0x40 |
Definition at line 26 of file lptport1.h.
| #define LPT_STATUS_BUSYB 0x80 |
Definition at line 27 of file lptport1.h.
| #define LPT_STATUS_ERRORB 0x08 |
Definition at line 23 of file lptport1.h.
| #define LPT_STATUS_PE 0x20 |
Definition at line 25 of file lptport1.h.
| #define LPT_STATUS_SLCT 0x10 |
Definition at line 24 of file lptport1.h.
| void Lpt1ControlPortWrite | ( | U8 | Data | ) |
| U8 Lpt1DataPortRead | ( | void | ) |
Definition at line 55 of file lptport1.c.
00055 { 00056 if((Lpt1Ctrl.Control&LPT_CONTORL_DIR_READ)==0){ 00057 Lpt1DataPortSetInput(); 00058 } 00059 Lpt1Ctrl.Data=InByte(LPT1_DATA_PORT); 00060 return Lpt1Ctrl.Data; 00061 }
| void Lpt1DataPortSetInput | ( | void | ) |
Definition at line 76 of file lptport1.c.
00076 { 00077 Lpt1Ctrl.Control=Lpt1Ctrl.Control|LPT_CONTORL_DIR_READ; //dir bit=0 for output 00078 OutByte(LPT1_CONTROL_PORT,Lpt1Ctrl.Control); 00079 }
| void Lpt1DataPortSetOutput | ( | void | ) |
Definition at line 71 of file lptport1.c.
00071 { 00072 Lpt1Ctrl.Control=Lpt1Ctrl.Control&(~LPT_CONTORL_DIR_READ); //dir bit=0 for output 00073 OutByte(LPT1_CONTROL_PORT,Lpt1Ctrl.Control); 00074 }
| void Lpt1DataPortWrite | ( | U8 | Data | ) |
Definition at line 63 of file lptport1.c.
00063 { 00064 if((Lpt1Ctrl.Control&LPT_CONTORL_DIR_READ)==LPT_CONTORL_DIR_READ){ 00065 Lpt1DataPortSetOutput(); 00066 } 00067 Lpt1Ctrl.Data=Data; 00068 return OutByte(LPT1_DATA_PORT,Data); 00069 }
| void Lpt1Handler | ( | void | ) |
| void Lpt1Init | ( | void | ) |
Definition at line 19 of file lptport1.c.
00019 { 00020 PicIrqDisable(IRQ7_LPT1); //no use interrupt at begining 00021 Lpt1Ctrl.State=Lpt1LedOnState; 00022 Lpt1Ctrl.Data=0; 00023 Lpt1Ctrl.Status=0; 00024 Lpt1Ctrl.Control=LPT_CONTORL_DIR_READ|0xc0; //set data port read, 00025 //disable interrupt, 00026 //nSelectIn=1,nInit=1,nStrob=0,nAutoLF=0, 00027 Lpt1Ctrl.Timer=0; 00028 Lpt1ControlPortWrite(Lpt1Ctrl.Control); //set data port read,disable interrupt,nStrob=0,nAutoLF=0 00029 //InterruptIrqHandlerSet(IRQ7_LPT1,Lpt1Handler); //no use interrupt at begining 00030 //PicIrqEnable(IRQ7_LPT1); //no use interrupt at begining 00031 }
| void Lpt1InterruptDisable | ( | void | ) |
| void Lpt1InterruptEnable | ( | void | ) |
| U8 Lpt1StatusPortRead | ( | void | ) |
Definition at line 81 of file lptport1.c.
00081 { 00082 Lpt1Ctrl.Status=InByte(LPT1_STATUS_PORT); 00083 }
| void Lpt1Svc | ( | void | ) |
Definition at line 37 of file lptport1.c.
00037 { 00038 switch(Lpt1Ctrl.State){ 00039 case Lpt1IdleState: 00040 break; 00041 case Lpt1LedOnState: 00042 Lpt1DataPortWrite(0x00); 00043 Lpt1Ctrl.State=Lpt1LedOffState; 00044 break; 00045 case Lpt1LedOffState: 00046 Lpt1DataPortWrite(0xff); 00047 Lpt1Ctrl.State=Lpt1LedOnState; 00048 break; 00049 default: 00050 break; 00051 } 00052 }
Definition at line 17 of file lptport1.c.
1.5.9