2021-08-31 14:41:35 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2021-08-10 charlown first version
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __BOARD_H__
|
|
|
|
#define __BOARD_H__
|
|
|
|
|
|
|
|
#include "ch32f10x.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#define CH32_FLASH_START_ADRESS ((uint32_t)0x08000000)
|
|
|
|
#define FLASH_PAGE_SIZE (64)
|
|
|
|
#define CH32_FLASH_SIZE (1024 * 1024)
|
|
|
|
#define CH32_FLASH_END_ADDRESS ((uint32_t)(CH32_FLASH_START_ADRESS + CH32_FLASH_SIZE))
|
|
|
|
|
|
|
|
#define CH32_SRAM_SIZE 20
|
|
|
|
#define CH32_SRAM_END (0x20000000 + CH32_SRAM_SIZE * 1024)
|
|
|
|
|
2021-12-30 03:14:07 +08:00
|
|
|
#if defined(__ARMCC_VERSION)
|
2021-08-31 14:41:35 +08:00
|
|
|
extern int Image$$RW_IRAM1$$ZI$$Limit;
|
|
|
|
#define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$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_END CH32_SRAM_END
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
rt_uint32_t ch32_get_sysclock_frequency(void);
|
2021-10-12 21:27:39 +08:00
|
|
|
|
|
|
|
#ifdef BSP_USING_UART
|
2021-08-31 14:41:35 +08:00
|
|
|
void ch32f1_usart_clock_and_io_init(USART_TypeDef* usartx);
|
2021-10-12 21:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef BSP_USING_SPI
|
2021-08-31 14:41:35 +08:00
|
|
|
void ch32f1_spi_clock_and_io_init(SPI_TypeDef* spix);
|
|
|
|
rt_uint32_t ch32f1_spi_clock_get(SPI_TypeDef* spix);
|
2021-10-12 21:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef BSP_USING_HWI2C
|
2021-08-31 14:41:35 +08:00
|
|
|
void ch32f1_i2c_clock_and_io_init(I2C_TypeDef* i2cx);
|
|
|
|
void ch32f1_i2c_config(I2C_TypeDef* i2cx);
|
2021-10-12 21:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef BSP_USING_TIM
|
2021-09-10 17:12:31 +08:00
|
|
|
void ch32f1_tim_clock_init(TIM_TypeDef *timx);
|
|
|
|
rt_uint32_t ch32f1_tim_clock_get(TIM_TypeDef *timx);
|
2021-10-12 21:27:39 +08:00
|
|
|
|
|
|
|
#ifdef BSP_USING_HWTIMER
|
2021-09-08 16:45:55 +08:00
|
|
|
struct rt_hwtimer_info* ch32f1_hwtimer_info_config_get(TIM_TypeDef *timx);
|
2021-10-12 21:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef BSP_USING_PWM
|
2021-09-23 23:20:16 +08:00
|
|
|
void ch32f1_pwm_io_init(TIM_TypeDef *timx, rt_uint8_t channel);
|
2021-10-12 21:27:39 +08:00
|
|
|
#endif
|
|
|
|
#endif
|
2021-08-31 14:41:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* __BOARD_H__ */
|