drv_usart.h 903 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright (c) 2006-2020, Bluetrum Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2020-11-20 greedyhao first version
  9. */
  10. #ifndef DRV_USART_H__
  11. #define DRV_USART_H__
  12. #include "drv_common.h"
  13. #ifdef RT_USING_SERIAL
  14. /* an32 config class */
  15. struct ab32_uart_config
  16. {
  17. const char *name;
  18. hal_sfr_t instance;
  19. // struct dma_config *dma_rx;
  20. // struct dma_config *dma_tx;
  21. };
  22. /* ab32 uart driver class */
  23. struct ab32_uart
  24. {
  25. struct uart_handle handle;
  26. struct ab32_uart_config *config;
  27. #ifdef RT_SERIAL_USING_DMA
  28. struct
  29. {
  30. DMA_HandleTypeDef handle;
  31. rt_size_t last_index;
  32. } dma_rx;
  33. struct
  34. {
  35. DMA_HandleTypeDef handle;
  36. } dma_tx;
  37. #endif
  38. rt_uint16_t uart_dma_flag;
  39. struct rt_serial_device serial;
  40. };
  41. #endif
  42. int rt_hw_usart_init(void);
  43. #endif