uart_config.h 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2018-10-30 SummerGift change to new framework
  9. */
  10. #ifndef __UART_CONFIG_H__
  11. #define __UART_CONFIG_H__
  12. #include <rtthread.h>
  13. #if defined(BSP_USING_UART1)
  14. #define UART1_CONFIG \
  15. { \
  16. .name = "uart1", \
  17. .Instance = USART1, \
  18. .irq_type = USART1_IRQn, \
  19. .dma.stream_channel.Instance = DMA2_Stream5, \
  20. .dma.stream_channel.channel = DMA_CHANNEL_4, \
  21. .dma_rcc = RCC_AHB1ENR_DMA2EN, \
  22. .dma_irq = DMA2_Stream5_IRQn, \
  23. }
  24. #define USART1_RX_DMA_ISR DMA2_Stream5_IRQHandler
  25. #endif
  26. #if defined(BSP_USING_UART2)
  27. #define UART2_CONFIG \
  28. { \
  29. .name = "uart2", \
  30. .Instance = USART2, \
  31. .irq_type = USART2_IRQn, \
  32. .dma.stream_channel.Instance = DMA1_Stream5, \
  33. .dma.stream_channel.channel = DMA_CHANNEL_4, \
  34. .dma_rcc = RCC_AHB1ENR_DMA1EN, \
  35. .dma_irq = DMA1_Stream5_IRQn, \
  36. }
  37. #define USART2_RX_DMA_ISR DMA1_Stream5_IRQHandler
  38. #endif
  39. #if defined(BSP_USING_UART3)
  40. #define UART3_CONFIG \
  41. { \
  42. .name = "uart3", \
  43. .Instance = USART3, \
  44. .irq_type = USART3_IRQn, \
  45. .dma.stream_channel.Instance = DMA1_Stream1, \
  46. .dma.stream_channel.channel = DMA_CHANNEL_4, \
  47. .dma_rcc = RCC_AHB1ENR_DMA1EN, \
  48. .dma_irq = DMA1_Stream1_IRQn, \
  49. }
  50. #define USART3_RX_DMA_ISR DMA1_Stream1_IRQHandler
  51. #endif
  52. #if defined(BSP_USING_UART4)
  53. #define UART4_CONFIG \
  54. { \
  55. .name = "uart4", \
  56. .Instance = UART4, \
  57. .irq_type = UART4_IRQn, \
  58. .dma.stream_channel.Instance = DMA1_Stream2, \
  59. .dma.stream_channel.channel = DMA_CHANNEL_4, \
  60. .dma_rcc = RCC_AHB1ENR_DMA1EN, \
  61. .dma_irq = DMA1_Stream2_IRQn, \
  62. }
  63. #define USART4_RX_DMA_ISR DMA1_Stream2_IRQHandler
  64. #endif
  65. #if defined(BSP_USING_UART5)
  66. #define UART5_CONFIG \
  67. { \
  68. .name = "uart5", \
  69. .Instance = UART5, \
  70. .irq_type = UART5_IRQn, \
  71. .dma.stream_channel.Instance = DMA1_Stream0, \
  72. .dma.stream_channel.channel = DMA_CHANNEL_4, \
  73. .dma_rcc = RCC_AHB1ENR_DMA1EN, \
  74. .dma_irq = DMA1_Stream0_IRQn, \
  75. }
  76. #define USART5_RX_DMA_ISR DMA1_Stream0_IRQHandler
  77. #endif
  78. #endif