1 /*
2  * Copyright (c) 2006-2022, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author         Notes
8  * 2020-08-20     Abbcc          first version
9  * 2022-03-04     stevetong459   Add head file of new driver
10  */
11 
12 #ifndef __BOARD_H__
13 #define __BOARD_H__
14 
15 #include <rtthread.h>
16 #include <apm32f10x.h>
17 
18 #include "apm32f10x_gpio.h"
19 #include "apm32f10x_rcm.h"
20 #include "apm32f10x_misc.h"
21 #include "apm32f10x_rcm.h"
22 #include "apm32f10x_eint.h"
23 #include "apm32f10x_usart.h"
24 #include "apm32f10x_dma.h"
25 
26 #if defined(RT_USING_ADC)
27     #include "apm32f10x_adc.h"
28 #endif
29 #if defined(RT_USING_DAC)
30     #include "apm32f10x_dac.h"
31 #endif
32 #if defined(RT_USING_RTC)
33     #include "apm32f10x_rtc.h"
34     #include "apm32f10x_pmu.h"
35 #endif
36 #if defined(RT_USING_SPI)
37     #include "apm32f10x_spi.h"
38 #endif
39 #if defined(RT_USING_HWTIMER) || defined(RT_USING_PWM)
40     #include "apm32f10x_tmr.h"
41 #endif
42 #if defined(RT_USING_WDT)
43     #include "apm32f10x_iwdt.h"
44     #include "apm32f10x_wwdt.h"
45 #endif
46 #if defined(BSP_USING_SDCARD)
47     #include "apm32f10x_sdio.h"
48 #endif
49 #if defined(BSP_USING_ON_CHIP_FLASH)
50     #include "apm32f10x_fmc.h"
51 #endif
52 #if defined(RT_USING_CAN)
53     #include "apm32f10x_can.h"
54 #endif
55 #if defined(BSP_USING_SDRAM)
56     #include "apm32f10x_dmc.h"
57 #endif
58 
59 #include "drv_common.h"
60 #include "drv_gpio.h"
61 
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65 
66 #define APM32_FLASH_START_ADRESS     ((uint32_t)0x08000000)
67 #define APM32_FLASH_SIZE             (512 * 1024)
68 #define APM32_FLASH_END_ADDRESS      ((uint32_t)(APM32_FLASH_START_ADRESS + APM32_FLASH_SIZE))
69 
70 /* Internal SRAM memory size[Kbytes] <6-128>, Default: 128 */
71 #define APM32_SRAM_SIZE      128
72 #define APM32_SRAM_END       (0x20000000 + APM32_SRAM_SIZE * 1024)
73 
74 #if defined(__ARMCC_VERSION)
75 extern int Image$$RW_IRAM1$$ZI$$Limit;
76 #define HEAP_BEGIN      ((void *)&Image$$RW_IRAM1$$ZI$$Limit)
77 #elif __ICCARM__
78 #pragma section="CSTACK"
79 #define HEAP_BEGIN      (__segment_end("CSTACK"))
80 #else
81 extern int __bss_end;
82 #define HEAP_BEGIN      ((void *)&__bss_end)
83 #endif
84 
85 #define HEAP_END        APM32_SRAM_END
86 
87 void SystemClock_Config(void);
88 
89 void apm32_usart_init(void);
90 
91 #ifdef __cplusplus
92 }
93 #endif
94 
95 #endif /* __BOARD_H__ */
96