drv_uart.h 809 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (c) 2006-2024 RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2022-06-29 Rbb666 first version
  9. */
  10. #ifndef __DRV_UART_H__
  11. #define __DRV_UART_H__
  12. #include <rthw.h>
  13. #include <rtdevice.h>
  14. #include "board.h"
  15. #define uart_isr_callback(name) name##_isr_callback
  16. struct ifx_uart_config
  17. {
  18. cyhal_uart_t *uart_obj;
  19. const char *name;
  20. rt_uint32_t tx_pin;
  21. rt_uint32_t rx_pin;
  22. CySCB_Type *usart_x;
  23. #if defined(SOC_SERIES_IFX_XMC)
  24. rt_uint32_t intrSrc;
  25. #else
  26. IRQn_Type intrSrc;
  27. #endif
  28. cy_israddress userIsr;
  29. cy_stc_sysint_t *UART_SCB_IRQ_cfg;
  30. };
  31. struct ifx_uart
  32. {
  33. struct ifx_uart_config *config;
  34. struct rt_serial_device serial;
  35. };
  36. void rt_hw_uart_init(void);
  37. #endif