uart2.h File Reference

Go to the source code of this file.

Data Structures

struct  UART2_CONTROL

Defines

#define COM2_BASE   0x2f8

Functions

void Uart2Init (void)
void Uart2Handler (void)

Variables

UART2_CONTROL Uart2Ctrl


Define Documentation

#define COM2_BASE   0x2f8

Definition at line 4 of file uart2.h.


Function Documentation

void Uart2Handler ( void   ) 

Definition at line 32 of file uart2.c.

00032                        {
00033     U8 i;
00034     
00035     i=InByte(COM2_BASE+LSR);
00036     if(i&COM1_LSR_DR){
00037         Uart2Ctrl.RxData=InByte(COM2_BASE+RXREG);
00038         Uart2Ctrl.HasData=true;
00039     }
00040 }

void Uart2Init ( void   ) 

Definition at line 15 of file uart2.c.

00015                     {
00016     PicIrqDisable(IRQ3_COM2);
00017     Uart2Ctrl.HasData=false;
00018     Uart2Ctrl.RxData=0;
00019     OutByte((U32)(COM2_BASE+IER),0x00);  //disable all interrupt
00020     OutByte((U32)(COM2_BASE+LCR),0x80);  //set DLAB=1
00021     OutByte((U32)(COM2_BASE+DLLR),BAUDRATE_38400); // set baudrate - divisor latch low byte
00022     OutByte((U32)(COM2_BASE+DLHR),0x00); //default 0x03 -> 9600 bps
00023     OutByte((U32)(COM2_BASE+LCR),0x03);  //DLAB=0,n.8.1
00024     OutByte((U32)(COM2_BASE+FCR),0x00);  //no use fifo
00025     OutByte((U32)(COM2_BASE+MCR),0x0b);  //turn on /OUT2,/RTS,/DTR.../OUT2 is for interrupt use
00026     OutByte((U32)(COM2_BASE+IER),0x01);  //eanble 
00027     OsEventAdd(&Uart2Ctrl.Uart2Event,&Uart2Name,OS_EVENT_UART2);
00028     InterruptIrqHandlerSet(IRQ3_COM2,Uart2Handler);
00029     PicIrqEnable(IRQ3_COM2);
00030 }


Variable Documentation

Definition at line 13 of file uart2.c.


Generated on Sat Apr 10 23:28:08 2010 for 80X86 MULTI-TASKING OPERATION SYSTEM by  doxygen 1.5.9