drv_gpio.h 893 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2021-06-20 RiceChen the first version
  9. */
  10. #ifndef __DRV_GPIO_H__
  11. #define __DRV_GPIO_H__
  12. #include "gd32f3x0.h"
  13. #include "gd32f3x0_exti.h"
  14. #define GD32_PIN(index, port, pin) {index, RCU_GPIO##port, \
  15. GPIO##port, GPIO_PIN_##pin, \
  16. EXTI_SOURCE_GPIO##port, \
  17. EXTI_SOURCE_PIN##pin}
  18. #define GD32_PIN_DEFAULT {-1, (rcu_periph_enum)0, 0, 0, 0, 0}
  19. struct pin_index
  20. {
  21. rt_int16_t index;
  22. rcu_periph_enum clk;
  23. rt_uint32_t gpio_periph;
  24. rt_uint32_t pin;
  25. rt_uint8_t port_src;
  26. rt_uint8_t pin_src;
  27. };
  28. struct pin_irq_map
  29. {
  30. rt_uint16_t pinbit;
  31. IRQn_Type irqno;
  32. };
  33. #endif