📄 main.c
字号:
#include <string.h>
#include "..\inc\option.h"
#include "..\inc\def.h"
#include "..\inc\44b.h"
#include "..\inc\44blib.h"
#include "..\inc\drv\flash.h"
#include "..\inc\download.h"
#include "..\inc\lcd320.h"
#include "..\inc\biosfunc.h"
#include "drv/zlg7289.h"
#include "drv/ADC-S3C44B0.h"
#include "drv/KeyBoard.h"
#include "fat16/file.h"
volatile unsigned int err=0;
extern unsigned char *downPt;
extern unsigned int fileSize;
static void (*run)(void)=(void (*)(void))DOWNLOAD_ADDRESS;
/*------------------------Bios function-------------------------------------*/
void LCD_Test()
{ int i;
Uart_Printf("\nPlease look at the LCD.");
for (i=0;i<32;i++)
{Delay(500);
LCD_printf("#");}
LCD_printf("\n");
LCD_printf("This is LCD text Mode\n");
LCD_printf("Please wait.....\n");
Delay(5000);
LCD_printf("Then entering graph mode...\n");
Delay(5000);
LCD_ChangeMode(DspGraMode);
LCD_TestShow();
Delay(5000);
Uart_Printf("\nPress any key return.");
Uart_Getch(0);
LCD_ChangeMode(DspTxtMode);
}
void BootSystem()
{
Boot(NULL);
}
Bios_function LCD_Test_func={
LCD_Test,
"Test LCD",
'l',
"Lcdtest",
NULL
};
Bios_function LED_Test_func={
Zlg7289_Test,
"Test LED",
'e',
"LEDtest",
NULL
};
Bios_function ADTest_func={
ADTest,
"Enter Test ADC Mode",
'a',
"testad",
NULL
};
Bios_function KeyTest_func={
Key_Test,
"Enter Test Key Mode",
'k',
"testkey",
NULL
};
Bios_function boot_func={
BootSystem,
"Boot default system",
'b',
"boot",
NULL
};
Bios_function* sysfunc[]={&LCD_Test_func,&LED_Test_func, &KeyTest_func,&ADTest_func,&boot_func};
#define SYSFUNCNUM (sizeof(sysfunc)/sizeof(Bios_function*))
/*------------------------Bios function end-------------------------------------*/
void ShowShellMenu()
{
int i,j;
Uart_Printf("\n*--------------------------Shell Menu-----------------------------------*");
for(i=0;i<SYSFUNCNUM;i++){
Uart_Printf("\n* %c >>%s",sysfunc[i]->MenuAcc,sysfunc[i]->pShellMenu);
for(j=51-strlen(sysfunc[i]->pShellMenu);j>0;j--) //补齐空格
Uart_SendByte(0, ' ');
Uart_SendByte(0, '*');
}
Uart_Printf("\n*-----------------------------------------------------------------------*");
}
void Main()
{
int i;//memError=0;
char aa;
U32 mode;
int x,y;
rSYSCFG=CACHECFG; // Using 8KB Cache//
Port_Init();
Set_D12CLK();//set clk 12M
Uart_Init(0,115200);
init_SIO();
Delay(100);
downPt=(unsigned char *)DOWNLOAD_ADDRESS;
Uart_Printf("\nBIOS start:OK!");
Delay(100);
LCD_Init();
Flash_Reset(); //自检举例
if(Check_Flash_Id()==KM29U128_ID)
{
Uart_Printf("\nK9F2808U is found.");
LCD_printf("K9F2808U is found.\n");
}
else
{
Uart_Printf("\nK9F2808U is not found.");
LCD_printf("K9F2808U is not found.\n");
}
Uart_Printf("\n*************************************************************************");
Uart_Printf("\n* UP-NetARM3000 Bootloader EXP *");
Uart_Printf("\n* COM:115.2kbps,8Bit,NP,UART0 *");
Uart_Printf("\n*-----------------------------------------------------------------------*");
LCD_printf("******************************\n");
LCD_printf("* Bootloader EXP *\n");
LCD_printf("* Build Time: 2004-07-15 *\n");
LCD_printf("******************************\n");
LCD_printf("Enter BIOS test mode\n");
LCD_printf("press any key\n");
Delay(10000);
Delay(10000);
Delay(10000);
if(!IsKeyDown()){ //无按键按下,正常引导系统
Uart_Printf("\nAuto Boot\n");
Boot(NULL);
for(;;);
}
//有按键按下,进入BIOS 测试状态
LCD_printf("Enter the Embedded System BIOS\n");
for(;;)
{
ShowShellMenu();
Uart_Printf("\n");
aa=Uart_Getch(0);
for(i=0;i<SYSFUNCNUM;i++){
if(sysfunc[i]->MenuAcc == aa)
sysfunc[i]->func();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -