uart.c
来自「HAL硬件抽象层源码」· C语言 代码 · 共 46 行
C
46 行
/***************************************************************************
* 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 + =
减小字号Ctrl + -
显示快捷键?