61 lines
1.7 KiB
C
61 lines
1.7 KiB
C
|
/*
|
|||
|
* File : board.h
|
|||
|
* This file is part of RT-Thread RTOS
|
|||
|
* COPYRIGHT (C) 2009, RT-Thread Development Team
|
|||
|
*
|
|||
|
* The license and distribution terms for this file may be
|
|||
|
* found in the file LICENSE in this distribution or at
|
|||
|
* http://www.rt-thread.org/license/LICENSE
|
|||
|
*
|
|||
|
* Change Logs:
|
|||
|
* Date Author Notes
|
|||
|
* 2009-09-22 Bernard add board.h to this bsp
|
|||
|
* 2017-10-20 ZYH emmm...setup for HAL Libraries
|
|||
|
*/
|
|||
|
#ifndef __BOARD_H__
|
|||
|
#define __BOARD_H__
|
|||
|
|
|||
|
#include "ch32v30x.h"
|
|||
|
|
|||
|
#define CH32V30X_PIN_NUMBERS (64U)
|
|||
|
|
|||
|
// 最大堆大小开关
|
|||
|
// 参考:https://club.rt-thread.org/ask/article/001065082e9ae611.html
|
|||
|
#define USING_MAX_HEAP_SIZE 1
|
|||
|
|
|||
|
#if (USING_MAX_HEAP_SIZE == 0)
|
|||
|
/* board configuration */
|
|||
|
#define SRAM_SIZE 64
|
|||
|
#define SRAM_END (0x20000000 + SRAM_SIZE * 1024)
|
|||
|
|
|||
|
extern int _ebss;
|
|||
|
#define HEAP_BEGIN ((void *)&_ebss)
|
|||
|
#define HEAP_END (SRAM_END-_stack_size)
|
|||
|
#else
|
|||
|
extern int _ebss, _heap_end;
|
|||
|
#define HEAP_BEGIN ((void *)&_ebss)
|
|||
|
#define HEAP_END ((void *)&_heap_end)
|
|||
|
#endif // !USING_MAX_HEAP_SIZE
|
|||
|
|
|||
|
|
|||
|
|
|||
|
void rt_hw_board_init(void);
|
|||
|
long reboot(void);
|
|||
|
|
|||
|
//仿二进制赋值
|
|||
|
#define HEX__(n) 0x##n##UL
|
|||
|
#define B8__(x) ( (x & 0x0000000FUL) ? 1:0 )\
|
|||
|
+( (x & 0x000000F0UL) ? 2:0 )\
|
|||
|
+( (x & 0x00000F00UL) ? 4:0 )\
|
|||
|
+( (x & 0x0000F000UL) ? 8:0 )\
|
|||
|
+( (x & 0x000F0000UL) ? 16:0 )\
|
|||
|
+( (x & 0x00F00000UL) ? 32:0 )\
|
|||
|
+( (x & 0x0F000000UL) ? 64:0 )\
|
|||
|
+( (x & 0xF0000000UL) ? 128:0 )
|
|||
|
#define B8(x) ((unsigned char)B8__(HEX__(x)))
|
|||
|
#define B16(x_msb,x_lsb) (((unsigned int)B8(x_msb)<<8) + B8(x_lsb))
|
|||
|
#define B32(x_msb,x_2,x_3,x_lsb) (((unsigned long)B8(x_msb)<<24) + ((unsigned long)B8(x_2)<<16) + ((unsigned long)B8(x_3)<<8) + B8(x_lsb))
|
|||
|
|
|||
|
|
|||
|
#endif /* __BOARD_H__ */
|