drv_gpio.h 776 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (c) 2006-2018, Synwit Technology Co.,Ltd.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2018-12-10 Zohar_Lee first version
  9. * 2020-07-10 lik rewrite
  10. */
  11. #ifndef __DRV_GPIO_H__
  12. #define __DRV_GPIO_H__
  13. #include "board.h"
  14. #define __SWM_PIN(index, gpio, pin_index) \
  15. { \
  16. index, GPIO##gpio, PIN##pin_index, GPIO##gpio##_IRQn \
  17. }
  18. #define GPIO0 ((GPIO_TypeDef *)(0))
  19. #define GPIO0_IRQn (GPIOA0_IRQn)
  20. struct swm_pin_index
  21. {
  22. uint32_t index;
  23. GPIO_TypeDef *gpio;
  24. uint32_t pin;
  25. IRQn_Type irq;
  26. };
  27. typedef struct swm_pin_index pin_t;
  28. int rt_hw_pin_init(void);
  29. #endif /* __DRV_GPIO_H__ */