44 lines
698 B
C
44 lines
698 B
C
#include "bsp_init.h"
|
|
#include "stm32f4xx.h"
|
|
#include "stdio.h"
|
|
|
|
|
|
|
|
|
|
|
|
extern const unsigned int Load$$bsp_init$$Base;
|
|
extern const unsigned int Load$$bsp_init$$Limit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化所有外设
|
|
int bsp_init_all(void)
|
|
{
|
|
init_call_fun *start=(init_call_fun *)&Load$$bsp_init$$Base;
|
|
init_call_fun *end=(init_call_fun *)&Load$$bsp_init$$Limit;
|
|
|
|
int ret=0;
|
|
init_call_fun *ptr=0;
|
|
for(ptr=start;ptr<end;ptr++)
|
|
{
|
|
if(ptr->init)
|
|
{
|
|
int err=0;
|
|
if(err=ptr->init(),err)
|
|
{
|
|
printf("%s:%s init failed,err=%d\r\n",__func__,ptr->name,err);
|
|
ret=err;
|
|
}
|
|
}
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
|
|
|
|
|
|
|