drv_gpio.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (c) 2020-2021, Bluetrum Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2020-11-19 greedyhao first version
  9. */
  10. #ifndef DRV_GPIO_H__
  11. #define DRV_GPIO_H__
  12. #include "drv_common.h"
  13. #include "board.h"
  14. #define __AB32_PORT(port) GPIO##port
  15. #define __AB32_GET_PIN_A(PIN) PIN
  16. #define __AB32_GET_PIN_B(PIN) 8 + PIN
  17. #define __AB32_GET_PIN_E(PIN) 13 + PIN
  18. #define __AB32_GET_PIN_F(PIN) 21 + PIN
  19. #define WAKEUP_INT_ENABLE 16
  20. #define WAKEUP_CRICUIT_0 0 // PA7
  21. #define WAKEUP_CRICUIT_1 1 // PB1
  22. #define WAKEUP_CRICUIT_2 2 // PB2
  23. #define WAKEUP_CRICUIT_3 3 // PB3
  24. #define WAKEUP_CRICUIT_4 4 // PB4
  25. #define WAKEUP_CRICUIT_5 5 // WKO (RTC)
  26. #define WAKEUP_CRICUIT_6 6 // Falling edge for other GPIOs
  27. #define WAKEUP_CRICUIT_7 7 // Rising edge for other GPIOs
  28. #define WAKEUP_EDGE_SELECT_0 16
  29. #define WAKEUP_EDGE_SELECT_1 17
  30. #define WAKEUP_EDGE_SELECT_2 18
  31. #define WAKEUP_EDGE_SELECT_3 19
  32. #define WAKEUP_EDGE_SELECT_4 20
  33. #define WAKEUP_EDGE_SELECT_5 21
  34. #define WAKEUP_EDGE_SELECT_6 22
  35. #define WAKEUP_EDGE_SELECT_7 23
  36. /* structure to store IRQ handler and arguments per pin */
  37. struct ab32_pin_irq
  38. {
  39. void (*hdr)(void *args);
  40. void *args;
  41. };
  42. int rt_hw_pin_init(void);
  43. #endif // DRV_GPIO_H__