uart_def.h

来自「嵌入式系统」· C头文件 代码 · 共 61 行

H
61
字号
/*-----------------------------------------------------------------------------
@@ (Summary): UART IP Level Definitions Header File
@@ (Comment): Define Registers of UART
@@ (Author) : Tan Wee Kah
@@ (RCS ID)     :
@@
-----------------------------------------------------------------------------*/

#ifndef APD_UART_DEF_H
#define APD_UART_DEF_H

/* UART  Register Offsets */
#define APD_UARTCH_OFST         0x400   /* UART Channel Offset */
#define APD_UARTDR_OFST         0x00    /* UART Data Register Offset */
#define APD_UARTRXSTAT_OFST     0x04    /* UART Recevie Status Register Offset */
#define APD_UARTMSEOI_OFST      0x04    /* UART MODEM Status Change Interrupt Offset */
#define APD_UARTHBRLCR_OFST     0x08    /* UART High-byte Baud Rate Register Offset */
#define APD_UARTMBRLCR_OFST     0x0C    /* UART Middle-byte Baud Rate Register Offset */
#define APD_UARTLBRLCR_OFST     0x10    /* UART Low-byte Baud Rate Offset */
#define APD_UARTCON_OFST        0x14    /* UART Control Register Offset */
#define APD_UARTFLG_OFST        0x18    /* UART Flag Register Offset */
#define APD_UARTMCR_OFST        0x1C    /* UART MODEM Control Register Offset */
#define APD_UARTINTMSK_OFST     0x20    /* UART Interrupt Mask Register Offset */
#define APD_UARTSTAT_OFST       0x24    /* UART0 Status Flag Register Offset */
#define APD_UARTINTR_OFST       0x28    /* UART Interrupt Register Offset */

/* Receive Status Register Bit Definitions */
#define APD_UARTRXSTAT_OVERRUN  0x04    /* b2 - 1 = Overrun Error Occured */
#define APD_UARTRXSTAT_PARITY   0x02    /* b1 - 1 = Received Data has Incorrect Parity */
#define APD_UARTRXSTAT_FRAMING  0x01    /* b0 - 1 = Framing Error Occured */

/* High UART Line Control Register Bit Definitions */
#define APD_UARTHUBRLCR_UFIFOEN 0x10    /* UART FIFO Enable bit */
#define APD_UARTHUBRLCR_BREAK   0x01    /* UART Break bit */

/* Medium/Low UART Line Control Register Bit Definitions */
#define APD_UARTDATAXFER_MASK   0x6E    /* Data rx/tx format mask */

/* UART Control Register Bit Definitions */
#define APD_UARTCON_UARTEN      0x01    /* UART Enable bit */

#define APD_UARTCON_SIREN       0x02    /* SIR protocol Enable bit */
#define APD_UARTCON_IRTXM       0x04    /* IrDA Tx mode bit */
#define APD_UARTCON_SIRPOL      0x08    /* SIR receive signal polality */
#define APD_UARTCON_ERINTEN     0x80    /* Error interrupt enable */


/* UART Modem Control Register Bit Definitions */
#define APD_UARTMCR_RTS         0x02    /* Ready-To-Send bit */
#define APD_UARTMCR_DTR         0x01    /* Data-Terminal-Ready bit */

/* UART Interrupt Mask Register Bit Definitions */
#define APD_UARTINTMSK_UDINT    0x01    /* UART Disable Interrupt mask */
#define APD_UARTINTMSK_MSINT    0x02    /* UART Modem Status Interrupt mask */
#define APD_UARTINTMSK_TXINT    0x04    /* UART Transmit Interrupt mask */
#define APD_UARTINTMSK_RXINT    0x08    /* UART Receive Interrupt mask */

#define APD_UARTINTMSK_ERRINT   0x10    /* UART Error Interrupt mask */

#endif  /* APD_UART_DEF */

⌨️ 快捷键说明

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