summaryrefslogtreecommitdiff
path: root/bsp/rockchip/common/drivers/drv_uart.h
blob: e77cbf49eff869100788338ff208b2d46d545116 (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/**
  * Copyright (c) 2018 Fuzhou Rockchip Electronics Co., Ltd
  *
  * SPDX-License-Identifier: Apache-2.0
  ******************************************************************************
  * @file    drv_uart.h
  * @author  Huibin Hong
  * @version V0.5
  * @date    10-Dec-2018
  * @brief   serial driver
  *
  ******************************************************************************
  */

#ifndef __ARCH_ARM_SRC_ROCKCHIP_RK_SERIAL_H
#define __ARCH_ARM_SRC_ROCKCHIP_RK_SERIAL_H

/*******************************************************************************
 * Included Files
 ******************************************************************************/
#include "hal_def.h"

/*******************************************************************************
 * Pre-processor Definitions
 ******************************************************************************/
#define ROCKCHIP_UART_SUPPORT_FLAG_DEFAULT  \
        RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_INT_TX
#define ROCKCHIP_UART_BAUD_RATE_DEFAULT UART_BR_115200

/*******************************************************************************
 * Public Types
 ******************************************************************************/

/* uart_board includes information on a board */
struct uart_board
{
    rt_uint32_t baud_rate;      /* for example 115200 */
    rt_uint32_t dev_flag;       /* for example RT_DEVICE_FLAG_INT_RX */
    rt_uint32_t bufer_size;     /* uart buffer size */
    rt_bool_t en_irq_wake;      /* enable uart irq wake up */
    char        name[8];        /* device name: /dev/xxxx */
};

/*******************************************************************************
 * Public Data
 ******************************************************************************/

#if defined(RT_USING_UART0)
extern const struct uart_board g_uart0_board;
#endif /* RT_USING_UART0 */

#if defined(RT_USING_UART1)
extern const struct uart_board g_uart1_board;
#endif /* RT_USING_UART1 */

#if defined(RT_USING_UART2)
extern const struct uart_board g_uart2_board;
#endif /* RT_USING_UART2 */

#if defined(RT_USING_UART3)
extern const struct uart_board g_uart3_board;
#endif /* RT_USING_UART3 */

#if defined(RT_USING_UART4)
extern const struct uart_board g_uart4_board;
#endif /* RT_USING_UART4 */

#if defined(RT_USING_UART5)
extern const struct uart_board g_uart5_board;
#endif /* RT_USING_UART5 */

#if defined(RT_USING_UART6)
extern const struct uart_board g_uart6_board;
#endif /* RT_USING_UART6 */

#if defined(RT_USING_UART7)
extern const struct uart_board g_uart7_board;
#endif /* RT_USING_UART7 */

#if defined(RT_USING_UART8)
extern const struct uart_board g_uart8_board;
#endif /* RT_USING_UART8 */

#if defined(RT_USING_UART9)
extern const struct uart_board g_uart9_board;
#endif /* RT_USING_UART9 */

/*******************************************************************************
 * Inline Functions
 ******************************************************************************/

/*******************************************************************************
 * Public Functions
 ******************************************************************************/

void rt_hw_usart_init(void);
int rt_hw_console_channel(void);

#endif /* __ARCH_ARM_SRC_ROCKCHIP_RK_SERIAL_H */