drv_spi.h 759 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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_SPI_H__
  11. #define __DRV_SPI_H__
  12. #include <rthw.h>
  13. #include <rtthread.h>
  14. #include <board.h>
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. struct gd32_spi_cs
  19. {
  20. uint32_t GPIOx;
  21. uint32_t GPIO_Pin;
  22. };
  23. /* gd32 spi dirver class */
  24. struct gd32_spi
  25. {
  26. uint32_t spi_periph;
  27. char *bus_name;
  28. rcu_periph_enum spi_clk;
  29. rcu_periph_enum gpio_clk;
  30. struct rt_spi_bus *spi_bus;
  31. uint32_t spi_port;
  32. uint16_t sck_pin;
  33. uint16_t miso_pin;
  34. uint16_t mosi_pin;
  35. };
  36. #ifdef __cplusplus
  37. }
  38. #endif
  39. #endif /* __DRV_SPI_H__ */