drv_gpio.h 693 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (C) 2022-2024, Xiaohua Semiconductor Co., Ltd.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2022-04-28 CDT first version
  9. */
  10. #ifndef __DRV_GPIO_H__
  11. #define __DRV_GPIO_H__
  12. #include <rtdevice.h>
  13. #include "drv_irq.h"
  14. #if defined(RT_USING_PIN)
  15. #define __HC_PORT(port) GPIO_PORT_##port
  16. #define GET_PIN(PORT, PIN) (rt_base_t)(((rt_uint16_t)__HC_PORT(PORT) * 16) + PIN)
  17. struct hc32_pin_irq_map
  18. {
  19. rt_uint16_t pinbit;
  20. func_ptr_t irq_callback;
  21. struct hc32_irq_config irq_config;
  22. };
  23. int rt_hw_pin_init(void);
  24. #endif
  25. #endif /* __DRV_GPIO_H__ */