⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uart.c

📁 HAL硬件抽象层源码
💻 C
字号:
/***************************************************************************
 * Copyright ?Intel Corporation, March 18th 1998.  All rights reserved.
 * Copyright ?ARM Limited 1998.  All rights reserved.
 ***************************************************************************/
/*****************************************************************************

   This file contains some basic drivers etc. to interface with the serial
   port(s) on a ARM target. The aim of these routines is to provide
   a standard access mechanism without having target-specific code.
  
	$Id: uart.c,v 1.1 1999/07/06 14:03:00 drusling Exp $

******************************************************************************/


#include "platform.h"

#include "uart.h"
#include "except_h.h"
#include "uart.h"

#ifdef UARTS
/* Target specific initialisation of serial port (a 16c550 - alledgedly) */
void uHALr_ResetPort(void)
{
	/* initialize 16C550 */
	outb(NO_INTS, (void *)(OS_COMPORT + IntEnable)) ;	/* disable interrupts */
	
	/* enable divisor latch access */
	outb(0x87, (void *)(OS_COMPORT + LineCntl)) ;

	/* configure divisor latch 9600 bauds */
	outb(0x01, (void *)(OS_COMPORT + ClkCntl);
	outb(ARM_BAUD_PRESCALE, (void *)(OS_COMPORT + ClkData);
	outb(L9600BD, (void *)(OS_COMPORT + LoBaud)) ;
	outb(H9600BD, (void *)(OS_COMPORT + HiBaud)) ;

	/* configure 8 bit data (also disable divisor latch access) */
	outb(0x07, (void *)(OS_COMPORT + LineCntl)) ;
	outb(0x0f, (void *)(OS_COMPORT + ModmCntl)) ;

	/* interrupts are left disabled */
}

#endif

⌨️ 快捷键说明

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