drv_common.h 737 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2018-11-7 SummerGift first version
  9. */
  10. #ifndef __DRV_COMMON_H__
  11. #define __DRV_COMMON_H__
  12. #include <rtthread.h>
  13. #include <rthw.h>
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. void _Error_Handler(char *s, int num);
  18. #ifndef Error_Handler
  19. #define Error_Handler() _Error_Handler(__FILE__, __LINE__)
  20. #endif
  21. #define DMA_NOT_AVAILABLE ((DMA_INSTANCE_TYPE *)0xFFFFFFFFU)
  22. #define __STM32_PORT(port) GPIO##port##_BASE
  23. #define GET_PIN(PORTx,PIN) (rt_base_t)((16 * ( ((rt_base_t)__STM32_PORT(PORTx) - (rt_base_t)GPIOA_BASE)/(0x0400UL) )) + PIN)
  24. #ifdef __cplusplus
  25. }
  26. #endif
  27. #endif