uart0.c

来自「s3c2410/s3c2440的bootloader演示程序」· C语言 代码 · 共 43 行

C
43
字号
#include "option.h"
#include "2410addr.h"
#include "uart0.h"


//***************************[ UART ]******************************
void Uart0_Init(void)
{
    int i;

	rUFCON0 = 0x0;      // FIFO disable
	rUMCON0 = 0x0;      // AFC disable

	rULCON0 = 0x3;      // Normal,No parity,1 stop,8 bits
	rUCON0  = 0x245;   

	rUBRDIV0=( (int)(PCLK/16./BAUD_RATE) -1 );

	for(i=0;i<100;i++);    
}

//=================================================================
void Uart0_SendByte(int data)
{
	int i;
	if(data=='\n')
	{
		while(!(UART_STATUS & 0x2));
			for(i=0;i<1000;i++);
		WRITE_UART('\r');
	}

	while(!(UART_STATUS & 0x2));   //Wait until THR is empty.
		for(i=0;i<1000;i++);
	WRITE_UART(data);
}

//=================================================================
void Uart0_SendString(char *pt)
{
	while(*pt)
		Uart0_SendByte(*pt++);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?