2021-05-18 09:57:25 +08:00
|
|
|
/*
|
2021-05-21 17:03:30 +08:00
|
|
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
2021-05-18 09:57:25 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
2021-05-21 17:03:30 +08:00
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2021-05-20 bigmagic first version
|
2021-05-18 09:57:25 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __DRV_UART_H__
|
|
|
|
#define __DRV_UART_H__
|
|
|
|
|
2021-05-21 17:03:30 +08:00
|
|
|
#define UART0_IRQ (10)
|
|
|
|
|
|
|
|
#define UART_DEFAULT_BAUDRATE 115200
|
|
|
|
|
|
|
|
#define UART_BASE (0x10000000L)
|
|
|
|
|
|
|
|
#define RHR 0 // Receive Holding Register (read mode)
|
|
|
|
#define THR 0 // Transmit Holding Register (write mode)
|
|
|
|
#define DLL 0 // LSB of Divisor Latch (write mode)
|
|
|
|
#define IER 1 // Interrupt Enable Register (write mode)
|
|
|
|
#define DLM 1 // MSB of Divisor Latch (write mode)
|
|
|
|
#define FCR 2 // FIFO Control Register (write mode)
|
|
|
|
#define ISR 2 // Interrupt Status Register (read mode)
|
|
|
|
#define LCR 3 // Line Control Register
|
|
|
|
#define MCR 4 // Modem Control Register
|
|
|
|
#define LSR 5 // Line Status Register
|
|
|
|
#define MSR 6 // Modem Status Register
|
|
|
|
#define SPR 7 // ScratchPad Register
|
|
|
|
|
|
|
|
#define UART_REG(reg) ((volatile uint8_t *)(UART_BASE + reg))
|
|
|
|
|
|
|
|
#define LSR_RX_READY (1 << 0)
|
|
|
|
#define LSR_TX_IDLE (1 << 5)
|
|
|
|
|
|
|
|
#define uart_read_reg(reg) (*(UART_REG(reg)))
|
|
|
|
#define uart_write_reg(reg, v) (*(UART_REG(reg)) = (v))
|
|
|
|
|
2021-05-18 09:57:25 +08:00
|
|
|
int rt_hw_uart_init(void);
|
|
|
|
|
|
|
|
#endif /* __DRV_UART_H__ */
|