uart.h
来自「realview22.rar」· C头文件 代码 · 共 65 行
H
65 行
/******************************************************************************
** **
** Copyright (c) 2004 ARM Limited **
** All rights reserved **
** **
******************************************************************************/
/******************************************************************************
* *
* The following are for the Versatile UART system. These are bits to enable *
* the functions in the Command Registers and the individual masks for the *
* returned Status registers *
* Register Bits - these require to be set to enable the defined functions *
* *
******************************************************************************/
#ifndef __UARTDEF
#define __UARTDEF
/*****************************************************************************/
/* UART Structure maps to register offsets */
/* Structure is instantiated in UART.c and placed by scatter file */
/*****************************************************************************/
struct uart
{ volatile unsigned dr; // @0x0
volatile unsigned ecr; // @0x4
volatile unsigned lcrh; // @0x8
volatile unsigned lcrm; // @0x0c
volatile unsigned lcrl; // @0x10
volatile unsigned cr; // @0x14
volatile unsigned fr; // @0x18
volatile unsigned iir; // @0x1C
volatile unsigned ilpr; // @0x20
volatile unsigned ibrd; // @0x24
volatile unsigned fbrd; // @0x28
volatile unsigned lcrh11; // @0x2C
volatile unsigned cr11; // @0x30
};
#define UART_SPEED 38400
/*****************************************************************************/
/* Line Control High Byte Register - LCRH */
/*****************************************************************************/
#define LCRH_Word_Length_8 0x60
#define UART_PL011_LCRH_FEN (1 << 4)
/*****************************************************************************/
/* Control Register - CR */
/*****************************************************************************/
#define CR_UART_Enable 0x01
#define UART_PL011_CR_TXE (1 << 8)
#define UART_PL011_CR_RXE (1 << 9)
/*****************************************************************************/
/* Flag Register - FR */
/*****************************************************************************/
#define FR_RX_Fifo_Empty 0x10
#define FR_TX_Fifo_Full 0x20
#define FR_RX_Fifo_Full 0x40
#define FR_TX_Fifo_Empty 0x80
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?