main.c
来自「arm7 s3c44b0x开发板fs44b的bios启动源代码及使用说明 下载方」· C语言 代码 · 共 152 行
C
152 行
#include "../inc/def.h"
#include "../inc/config.h"
#include "../inc/board.h"
#include "../inc/utils.h"
extern 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)
{
U32 i, value;
value = 8;
for(i = 0; i < 8; i++)
{
LedSet(value);
Delay(100);
if(i >= 3)
value = value << 1;
else
value = value >> 1;
}
LedSet(0);
}
/****************************************************************************
【功能说明】系统主函数
****************************************************************************/
void 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 + =
减小字号Ctrl + -
显示快捷键?