drv_usart.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2022-06-04 BruceOu first implementation
  9. */
  10. #ifndef __DRV_USART_H__
  11. #define __DRV_USART_H__
  12. #include <rthw.h>
  13. #include <rtthread.h>
  14. #include <board.h>
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. /* GD32 uart driver */
  19. // Todo: compress uart info
  20. struct gd32_uart
  21. {
  22. uint32_t uart_periph; //Todo: 3bits
  23. IRQn_Type irqn; //Todo: 7bits
  24. rcu_periph_enum per_clk; //Todo: 5bits
  25. rcu_periph_enum tx_gpio_clk; //Todo: 5bits
  26. rcu_periph_enum rx_gpio_clk; //Todo: 5bits
  27. uint32_t tx_port; //Todo: 4bits
  28. uint16_t tx_pin; //Todo: 4bits
  29. uint32_t rx_port; //Todo: 4bits
  30. uint16_t rx_pin; //Todo: 4bits
  31. struct rt_serial_device * serial;
  32. char *device_name;
  33. };
  34. int rt_hw_usart_init(void);
  35. #ifdef __cplusplus
  36. }
  37. #endif
  38. #endif /* __DRV_USART_H__ */