blob: 3faca886d72599066ef0e00acb3cbff55f51d596 [file] [log] [blame]
Vishal Bhoj82c80712015-12-15 21:13:33 +05301/*******************************************************************
2#
3#
4# Copyright (c) Huawei Technologies Co., Ltd. 2013. All rights reserved.
5# This program and the accompanying materials
6# are licensed and made available under the terms and conditions of the BSD License
7# which accompanies this distribution. The full text of the license may be found at
8# http://opensource.org/licenses/bsd-license.php
9#
10# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12#
13#**/
14
15
16
17#ifndef __BSP_UART_H
18#define __BSP_UART_H
19
20#ifdef __cplusplus
21 extern "C" {
22#endif /* __cplusplus */
23
24#include "Std.h"
25#define UART_SEND_DELAY (500000)
26
27#define SERIAL_0_BASE_ADR 0xe4007000
28#define UART_THR_REG (SERIAL_0_BASE_ADR + UART_RBR)
29#define UART_RBR_REG (SERIAL_0_BASE_ADR + UART_THR)
30#define UART_DLL_REG (SERIAL_0_BASE_ADR + UART_DLL)
31#define UART_DLH_REG (SERIAL_0_BASE_ADR + UART_DLH)
32#define UART_IEL_REG (SERIAL_0_BASE_ADR + UART_IEL)
33#define UART_IIR_REG (SERIAL_0_BASE_ADR + UART_IIR)
34#define UART_FCR_REG (SERIAL_0_BASE_ADR + UART_FCR)
35#define UART_LCR_REG (SERIAL_0_BASE_ADR + UART_LCR)
36#define UART_LSR_REG (SERIAL_0_BASE_ADR + UART_LSR)
37#define UART_USR_REG (SERIAL_0_BASE_ADR + UART_USR)
38
39#define UART_RBR 0x00
40#define UART_THR 0x00
41#define UART_DLL 0x00
42#define UART_DLH 0x04
43#define UART_IEL 0x04
44#define UART_IIR 0x08
45#define UART_FCR 0x08
46#define UART_LCR 0x0C
47#define UART_MCR 0x10
48#define UART_LSR 0x14
49#define UART_USR 0x7C
50
51/* register definitions */
52#define UART_FCR_EN 0x01
53#define UART_FCR_RXCLR 0x02
54#define UART_FCR_TXCLR 0x04
55#define UART_FCR_CLEARFIFO 0x00
56
57#define UART_LCR_DLAB 0x80
58#define UART_LCR_EPS 0x10
59#define UART_LCR_PEN 0x08
60#define UART_LCR_STOP 0x04
61#define UART_LCR_DLS8 0x03
62#define UART_LCR_DLS7 0x02
63#define UART_LCR_DLS6 0x01
64#define UART_LCR_DLS5 0x00
65
66#define UART_LSR_TEMT 0x40
67#define UART_LSR_THRE 0x20
68#define UART_LSR_BI 0x10
69#define UART_LSR_FE 0x08
70#define UART_LSR_PE 0x04
71#define UART_LSR_R 0x02
72#define UART_LSR_DR 0x01
73
74#define UART_USR_BUSY 0x01
75#define UART_USR_TFNF 0x02
76#define UART_USR_TFE 0x04
77#define UART_USR_RFNE 0x08
78#define UART_USR_RFF 0x10
79
80#define HI1210_SC_PRECTRL3 0x34
81#define HI1380_SC_PRECTRL1 0x20
82#define HI1380_SC_PRECTRL9 0x50
83
84#ifndef NULL
85#define NULL 0
86#endif
87
88extern void BspSendChar(char scShowChar);
89extern char BspGetChar(U32 ulTimeout);
90
91#ifdef __cplusplus
92 }
93#endif /* __cplusplus */
94
95#endif /* __BSP_UART_H */