uart2.c File Reference

#include "includes.h"

Go to the source code of this file.

Functions

void Uart2Init (void)
void Uart2Handler (void)
void Uart2Svc (void)

Variables

const U8 Uart2Name [] = "UART2"
UART2_CONTROL Uart2Ctrl


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 }

void Uart2Svc ( void   ) 

Definition at line 42 of file uart2.c.

00042                    {
00043     if(Uart2Ctrl.HasData==true){
00044         Uart2Ctrl.HasData=false;
00045         GuiStringPrint("\nCOM2 RX: ");
00046         GuiU8Print(Uart2Ctrl.RxData);
00047     }
00048 }


Variable Documentation

Definition at line 13 of file uart2.c.

const U8 Uart2Name[] = "UART2"

Definition at line 12 of file uart2.c.


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