1 /** 2 * Copyright (c) 2018 Fuzhou Rockchip Electronics Co., Ltd 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 ****************************************************************************** 6 * @file drv_uart.h 7 * @author Huibin Hong 8 * @version V0.5 9 * @date 10-Dec-2018 10 * @brief serial driver 11 * 12 ****************************************************************************** 13 */ 14 15 #ifndef __ARCH_ARM_SRC_ROCKCHIP_RK_SERIAL_H 16 #define __ARCH_ARM_SRC_ROCKCHIP_RK_SERIAL_H 17 18 /******************************************************************************* 19 * Included Files 20 ******************************************************************************/ 21 #include "hal_def.h" 22 23 /******************************************************************************* 24 * Pre-processor Definitions 25 ******************************************************************************/ 26 #define ROCKCHIP_UART_SUPPORT_FLAG_DEFAULT \ 27 RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_INT_TX 28 #define ROCKCHIP_UART_BAUD_RATE_DEFAULT UART_BR_115200 29 30 /******************************************************************************* 31 * Public Types 32 ******************************************************************************/ 33 34 /* uart_board includes information on a board */ 35 struct uart_board 36 { 37 rt_uint32_t baud_rate; /* for example 115200 */ 38 rt_uint32_t dev_flag; /* for example RT_DEVICE_FLAG_INT_RX */ 39 rt_uint32_t bufer_size; /* uart buffer size */ 40 rt_bool_t en_irq_wake; /* enable uart irq wake up */ 41 char name[8]; /* device name: /dev/xxxx */ 42 }; 43 44 /******************************************************************************* 45 * Public Data 46 ******************************************************************************/ 47 48 #if defined(RT_USING_UART0) 49 extern const struct uart_board g_uart0_board; 50 #endif /* RT_USING_UART0 */ 51 52 #if defined(RT_USING_UART1) 53 extern const struct uart_board g_uart1_board; 54 #endif /* RT_USING_UART1 */ 55 56 #if defined(RT_USING_UART2) 57 extern const struct uart_board g_uart2_board; 58 #endif /* RT_USING_UART2 */ 59 60 #if defined(RT_USING_UART3) 61 extern const struct uart_board g_uart3_board; 62 #endif /* RT_USING_UART3 */ 63 64 #if defined(RT_USING_UART4) 65 extern const struct uart_board g_uart4_board; 66 #endif /* RT_USING_UART4 */ 67 68 #if defined(RT_USING_UART5) 69 extern const struct uart_board g_uart5_board; 70 #endif /* RT_USING_UART5 */ 71 72 #if defined(RT_USING_UART6) 73 extern const struct uart_board g_uart6_board; 74 #endif /* RT_USING_UART6 */ 75 76 #if defined(RT_USING_UART7) 77 extern const struct uart_board g_uart7_board; 78 #endif /* RT_USING_UART7 */ 79 80 #if defined(RT_USING_UART8) 81 extern const struct uart_board g_uart8_board; 82 #endif /* RT_USING_UART8 */ 83 84 #if defined(RT_USING_UART9) 85 extern const struct uart_board g_uart9_board; 86 #endif /* RT_USING_UART9 */ 87 88 /******************************************************************************* 89 * Inline Functions 90 ******************************************************************************/ 91 92 /******************************************************************************* 93 * Public Functions 94 ******************************************************************************/ 95 96 void rt_hw_usart_init(void); 97 int rt_hw_console_channel(void); 98 99 #endif /* __ARCH_ARM_SRC_ROCKCHIP_RK_SERIAL_H */ 100