Files
player/Project/Src/MY/bsp_init.h
2025-07-06 02:53:08 +08:00

51 lines
513 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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,section(".bsp_init"))) const init_call_fun __bsp_init_##name_ =\
{\
.name=__init_##name_,\
.init=init_,\
};
// 初始化所有外设
int bsp_init_all(void);
#endif