1
0

drv_uart.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. #ifndef __ARCH_ARM_SRC_ROCKCHIP_RK_SERIAL_H
  15. #define __ARCH_ARM_SRC_ROCKCHIP_RK_SERIAL_H
  16. /*******************************************************************************
  17. * Included Files
  18. ******************************************************************************/
  19. #include "hal_def.h"
  20. /*******************************************************************************
  21. * Pre-processor Definitions
  22. ******************************************************************************/
  23. #define ROCKCHIP_UART_SUPPORT_FLAG_DEFAULT \
  24. RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_INT_TX
  25. #define ROCKCHIP_UART_BAUD_RATE_DEFAULT UART_BR_115200
  26. /*******************************************************************************
  27. * Public Types
  28. ******************************************************************************/
  29. /* uart_board includes information on a board */
  30. struct uart_board
  31. {
  32. rt_uint32_t baud_rate; /* for example 115200 */
  33. rt_uint32_t dev_flag; /* for example RT_DEVICE_FLAG_INT_RX */
  34. rt_uint32_t bufer_size; /* uart buffer size */
  35. rt_bool_t en_irq_wake; /* enable uart irq wake up */
  36. char name[8]; /* device name: /dev/xxxx */
  37. };
  38. /*******************************************************************************
  39. * Public Data
  40. ******************************************************************************/
  41. #if defined(RT_USING_UART0)
  42. extern const struct uart_board g_uart0_board;
  43. #endif /* RT_USING_UART0 */
  44. #if defined(RT_USING_UART1)
  45. extern const struct uart_board g_uart1_board;
  46. #endif /* RT_USING_UART1 */
  47. #if defined(RT_USING_UART2)
  48. extern const struct uart_board g_uart2_board;
  49. #endif /* RT_USING_UART2 */
  50. #if defined(RT_USING_UART3)
  51. extern const struct uart_board g_uart3_board;
  52. #endif /* RT_USING_UART3 */
  53. #if defined(RT_USING_UART4)
  54. extern const struct uart_board g_uart4_board;
  55. #endif /* RT_USING_UART4 */
  56. #if defined(RT_USING_UART5)
  57. extern const struct uart_board g_uart5_board;
  58. #endif /* RT_USING_UART5 */
  59. #if defined(RT_USING_UART6)
  60. extern const struct uart_board g_uart6_board;
  61. #endif /* RT_USING_UART6 */
  62. #if defined(RT_USING_UART7)
  63. extern const struct uart_board g_uart7_board;
  64. #endif /* RT_USING_UART7 */
  65. #if defined(RT_USING_UART8)
  66. extern const struct uart_board g_uart8_board;
  67. #endif /* RT_USING_UART8 */
  68. #if defined(RT_USING_UART9)
  69. extern const struct uart_board g_uart9_board;
  70. #endif /* RT_USING_UART9 */
  71. /*******************************************************************************
  72. * Inline Functions
  73. ******************************************************************************/
  74. /*******************************************************************************
  75. * Public Functions
  76. ******************************************************************************/
  77. void rt_hw_usart_init(void);
  78. int rt_hw_console_channel(void);
  79. #endif /* __ARCH_ARM_SRC_ROCKCHIP_RK_SERIAL_H */