📄 main.c
字号:
#include "../inc/def.h"
#include "../inc/config.h"
#include "../inc/board.h"
#include "../inc/utils.h"
void DftEnvInit(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)
{
LedSet(0x08); //LED点亮/熄灭状态设置
Delay(100);
LedSet(0x04); //LED点亮/熄灭状态设置
Delay(100);
LedSet(0x02); //LED点亮/熄灭状态设置
Delay(100);
LedSet(0x01); //LED点亮/熄灭状态设置
Delay(100);
LedSet(0x02); //LED点亮/熄灭状态设置
Delay(100);
LedSet(0x04); //LED点亮/熄灭状态设置
Delay(100);
LedSet(0x08); //LED点亮/熄灭状态设置
Delay(100);
LedSet(0x00); //LED点亮/熄灭状态设置
}
/****************************************************************************
【功能说明】系统主函数
****************************************************************************/
int main(void)
{
DisableInt(); //Disable interrupt
BoardInitStart();
SystemClockInit();
TimerInit(TIMER_FREQ);
MemCfgInit();
PortInit();
#ifdef TFTP_DOWNLOAD_SUPPORT
eth_init();
arp_init();
#endif
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();
Beep(2000, 100);
LedDisp(); //LED来回闪烁显示
ShowBootInfo();
#ifdef NOR_FLASH_SUPPORT
NorFlashStatusRep();
#endif
#ifdef NAND_FLASH_SUPPORT
NandFlashStatusRep();
#endif
printf("Build date : %s--%s\n", __DATE__, __TIME__);
#ifdef IDE_DISK_SUPPORT
IdeHardReset();
#endif
#ifdef CMD_SHELL_SUPPORT
ShellIn();
#else
while(1) {
LedDisp();
ERROR("No Command Shell, Enter This Loop Forever...\n");
}
#endif
}
//***************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -