summaryrefslogtreecommitdiff
path: root/bsp/phytium/libraries/standalone/board/e2000/fearly_uart.h
blob: cbb47a898fc71f13cfe12ba1b0fc01a32000b393 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
 * Copyright : (C) 2022 Phytium Information Technology, Inc.
 * All Rights Reserved.
 *
 * This program is OPEN SOURCE software: you can redistribute it and/or modify it
 * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd,
 * either version 1.0 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the Phytium Public License for more details.
 *
 *
 * FilePath: fearly_uart.h
 * Date: 2022-02-11 13:33:28
 * LastEditTime: 2022-02-17 18:00:16
 * Description:  This files is for
 *
 * Modify History:
 *  Ver   Who        Date         Changes
 * ----- ------     --------    --------------------------------------
 * 1.0   rtos       2022/6/25    init commit
 */
#ifndef  BOARD_E2000_EARLY_UART_H
#define  BOARD_E2000_EARLY_UART_H

#ifdef __cplusplus
extern "C"
{
#endif

/***************************** Include Files *********************************/
#include "ftypes.h"
#include "fio.h"
#include "fparameters.h"
#include "sdkconfig.h"

/**************************** Type Definitions *******************************/

/************************** Constant Definitions *****************************/
#if defined(CONFIG_DEFAULT_DEBUG_PRINT_UART2)
#define EARLY_UART_BASE FUART2_BASE_ADDR
#define EARLY_UART_IRQ_NUM FUART2_IRQ_NUM
#elif defined(CONFIG_DEFAULT_DEBUG_PRINT_UART0)
#define EARLY_UART_BASE FUART0_BASE_ADDR
#define EARLY_UART_IRQ_NUM FUART0_IRQ_NUM
#else
#define EARLY_UART_BASE FUART1_BASE_ADDR
#define EARLY_UART_IRQ_NUM FUART1_IRQ_NUM
#endif

#define EARLY_UART_UARTDR (EARLY_UART_BASE + 0x0)  /* UART 数据寄存器地址 */
#define EARLY_UART_UARTFR (EARLY_UART_BASE + 0x18) /* UART 状态寄存器地址 */
#define EARLY_UART_UARTCR (EARLY_UART_BASE + 0x30)
#define EARLY_UART_UARTCR_UARTEN BIT(0)
#define EARLY_UART_UARTCR_TXE BIT(8)
#define EARLY_UART_UARTCR_RXE BIT(9)
#define EARLY_UART_UARTCR_INIT (EARLY_UART_UARTCR_UARTEN | EARLY_UART_UARTCR_TXE | \
                                EARLY_UART_UARTCR_RXE)
#define EARLY_UART_UARTIMSC (EARLY_UART_BASE + 0x38)
#define EARLY_UART_UARTIMSC_RXIM BIT(4)
#define EARLY_UART_UARTIMSC_RTIM BIT(6)
#define EARLY_UART_UARTMIS (EARLY_UART_BASE + 0x40)
#define EARLY_UART_UARTICR (EARLY_UART_BASE + 0x44)
#define EARLY_UART_TXFF BIT(5) /* 发送 FIFO 已满标志位 */
#define EARLY_UART_RXFE BIT(4) /* 接收 FIFO 为空标志位 */
#define EARLY_UART_DATA_MASK GENMASK(7, 0)
#define EARLY_UART_RXI_MASK BIT(4)

#define STDOUT_BASEADDRESS
/************************** Variable Definitions *****************************/

/***************** Macros (Inline Functions) Definitions *********************/

/*****************************************************************************/
void OutByte(s8 byte);
char GetByte(void);

#ifdef __cplusplus
}
#endif

#endif