| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- /*
- * Copyright (c) 2006-2021, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- * 2018-11-7 SummerGift first version
- */
- #ifndef __DRV_COMMON_H__
- #define __DRV_COMMON_H__
- #include <rtthread.h>
- #include <rthw.h>
- #ifdef RT_USING_DEVICE
- #include <rtdevice.h>
- #endif
- #ifdef __cplusplus
- extern "C"
- {
- #endif
- void _Error_Handler(char *s, int num);
- #ifndef Error_Handler
- #define Error_Handler() _Error_Handler(__FILE__, __LINE__)
- #endif
- #define DMA_NOT_AVAILABLE ((DMA_INSTANCE_TYPE *)0xFFFFFFFFU)
- #define __STM32_PORT(port) GPIO##port##_BASE
- #if defined(SOC_SERIES_STM32MP1)
- #define GET_PIN(PORTx,PIN) (GPIO##PORTx == GPIOZ) ? (176 + PIN) : ((rt_base_t)((16 * ( ((rt_base_t)__STM32_PORT(PORTx) - (rt_base_t)GPIOA_BASE)/(0x1000UL) )) + PIN))
- #else
- #define GET_PIN(PORTx,PIN) (rt_base_t)((16 * ( ((rt_base_t)__STM32_PORT(PORTx) - (rt_base_t)GPIOA_BASE)/(0x0400UL) )) + PIN)
- #endif
- #define STM32_FLASH_START_ADRESS ROM_START
- #define STM32_FLASH_SIZE ROM_SIZE
- #define STM32_FLASH_END_ADDRESS ROM_END
- #define STM32_SRAM1_SIZE RAM1_SIZE
- #define STM32_SRAM1_START RAM1_START
- #define STM32_SRAM1_END RAM1_END
- #define STM32_SRAM2_SIZE RAM2_SIZE
- #define STM32_SRAM2_START RAM2_START
- #define STM32_SRAM2_END RAM2_END
- #if defined(__CC_ARM) || defined(__CLANG_ARM)
- extern int Image$$RW_IRAM1$$ZI$$Limit;
- extern int Image$$RW_IRAM2$$ZI$$Limit;
- #define HEAP_BEGIN1 ((void *)&Image$$RW_IRAM1$$ZI$$Limit)
- #define HEAP_BEGIN2 ((void *)&Image$$RW_IRAM2$$ZI$$Limit)
- #elif __ICCARM__
- #pragma section="CSTACK"
- #define HEAP_BEGIN (__segment_end("CSTACK"))
- #else
- extern int __bss_end;
- #define HEAP_BEGIN ((void *)&__bss_end)
- #endif
- #define HEAP_END1 STM32_SRAM1_END
- #define HEAP_END2 STM32_SRAM2_END
- #ifdef __cplusplus
- }
- #endif
- #endif
|