📄 main.c
字号:
#include "../inc/def.h"
#include "../inc/config.h"
#include "../inc/board.h"
#include "../inc/utils.h"
void DftEnvInit(void);
void File_System_Global_Init( void ) ;
extern int Udisk_To_PC(void);
static void SwiHandler(void)
{
puts("Swi Interrupt detected\n");
while(1);
}
static void DataAbortHandler(void)
{
puts("Data Abort detected\n");
while (1);
}
static void FetchAbortHandler(void)
{
puts("Prefetch Abort detected\n");
while (1);
}
static void UndefHandler()
{
puts("Halt on Undefined instruction\n");
while (1);
}
#ifndef INTERRUPT_SUPPORT
static void IrqHandler(void)
{
puts("Halt on IRQ!\n");
while(1);
}
#endif
static void FiqHandler(void)
{
puts("Halt on FIQ!\n");
while(1);
}
static __inline void VectorInit(void)
{
UdfInsVector = (U32)UndefHandler;
SwiSvcVector = (U32)SwiHandler;
InsAbtVector = (U32)FetchAbortHandler;
DatAbtVector = (U32)DataAbortHandler;
#ifndef INTERRUPT_SUPPORT
IrqSvcVector = (U32)IrqHandler;
#endif
FiqSvcVector = (U32)FiqHandler;
}
void LedDisp(void)
{
}
/****************************************************************************
【功能说明】系统主函数
****************************************************************************/
void Main(void)
{
DisableInt(); //Disable interrupt
BoardInitStart();
SystemClockInit();
TimerInit(TIMER_FREQ);
MemCfgInit();
PortInit();
VectorInit();
#ifdef INTERRUPT_SUPPORT
DisableIrq(-1); //Mask all IRQ
AckAndClrIrq(-1); //ACK and Clear all IRQ
EnableInt(); //Enable interrupt
#endif
#ifdef NOR_FLASH_SUPPORT
NorFlashInit();
#endif
#ifdef NAND_FLASH_SUPPORT
NandFlashInit();
#endif
#ifdef SAVE_ENV_SUPPORT
if(LoadEnv())
DftEnvInit();
#else
DftEnvInit();
#endif
TimerInit(TIMER_FREQ);
BoardInitEnd();
CacheDisable();
CacheFlush();
CacheEnable();
ShowBootInfo();
#ifdef NOR_FLASH_SUPPORT
NorFlashStatusRep();
#endif
#ifdef NAND_FLASH_SUPPORT
NandFlashStatusRep();
File_System_Global_Init() ;
#endif
Udisk_To_PC();
}
//***************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -