Files
player/Project/Src/MY/bsp_init.h

51 lines
560 B
C
Raw Normal View History

2025-06-27 00:32:57 +08:00
#ifndef BSP_INIT_H__
#define BSP_INIT_H__
// 进入和退出低功耗函数返回0成功
typedef struct{
const char *name;
int (*init)(void);
}init_call_fun;
// 使用这个宏用于初始化
#define extern_init(name_,init_)\
const char __init_##name_[] __attribute__((section("name"))) = #name_;\
__attribute__((used)) const init_call_fun __bsp_init_##name_ __attribute__((section("bsp_init")))=\
{\
.name=__init_##name_,\
.init=init_,\
};
// 初始化所有外设
int bsp_init_all(void);
#endif