23 lines
722 B
C
23 lines
722 B
C
#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
|