📄 main.c
字号:
/******************************************************************************
* Filename : main.c *
* Program : loader. *
* Copyright : Copyright (C) 2001, Young-Su, Ahn. *
* Author : Young-Su, Ahn <nurie@dreamwiz.com> *
* Description : main function of c code. *
* Get Command table and run it. *
* Created at : Wed Mar 13 2001. *
* Based on : blob-1.0.8-pre2 (http://www.lart.tudelft.nl) *
* Modified by : *
* Modified at : *
******************************************************************************/
/* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "main.h"
//#include "scc.h"
#include "includes.h"
#include "stdio.h"
// 傈开函荐.
LOADER_STATUS status;
// function prototype.
void BeforeMain();
void CMain(void);
void BeforeMain()
{
register ulong *dest = (ulong *)LOADER_DRAM_BASE;
register ulong *src = (ulong *)LOADER_SRAM_BASE;
register ulong len = LOADER_DRAM_MAX_SIZE/4;
void (*JumpTo)(void);
while(len--) *dest++ = *src++;
JumpTo = CMain;
JumpTo();
return;
}
// 开且 : command mode狼 main function.
// 概俺 :
// 馆券 :
// 林狼 :
void CMain(){
int i;
bool autoboot=true;
char cmd[128];
long timeout;
int argc=0;
char *argv[3];
///// when configuration of blob exist at end of flash block, /////////////
///// if no key input read it. ////////////////////////////////////////////
///// Set environment of blob. ////////////////////////////////////////////
// initiate status.
status.terminalSpeed = SERIAL_SPEED;
status.downloadSpeed = SERIAL_DOWNLOAD_SPEED;
///// initiate serial and timer. //////////////////////////////////////////
// serial and timer init.
SerialInit(status.terminalSpeed);
TimerInit2(); //time.h
//#ifdef USE_LCD_LOGO
// ViewLogo();
//#endif
/////////////////////////////////// printf the required GPL string. //////////////////////////////////////
printf("\n\n\nWelcome.\n");
printf(PACKAGE "-" VERSION "\nCopyright (C) 2001 T&B Tronics.\n");
printf(PACKAGE " comes with ABSOLUTELY NO WARRANTY; Read the GNU GPL for details.\n");
printf("This is free software, and you are welcome to redistribute it\n");
printf("under certain conditions; read the GNU GPL for details.\n");
// 俊矾啊 乐阑 锭 皋矫瘤 免仿阑 困秦 捞镑俊 困摹.
printf("\n");
///// wait 10 seconds before starting autoboot. ///////////////////////////
printf("Autoboot in progress, press any key to stop ");
/*for (i=0; i<DELAY_BEFORE_BOOT; i++){
timeout = GetTime() + HZ; // 1檬埃 Delay //time.h
printf(".");
while (GetTime()<timeout){
if (UTSR1 & UTSR1_RNE){ // Serial肺 Input捞 乐阑 锭.
UTDR; // 甸绢柯 涝仿 蔼 公矫...
autoboot = false;
break;
}
}
if (autoboot==false) break;
}*/
///// No key was pressed, so proceed booting the kernel. //////////////////
if (autoboot){
printf("Autoboot started.\n");
//MemCpy((char *)KERNEL_DRAM_BASE, (char *)KERNEL_SRAM_BASE, KERNEL_MAX_SIZE);
//MemCpy((char *)RAMDISK_DRAM_BASE, (char *)RAMDISK_SRAM_BASE, RAMDISK_MAX_SIZE);
//for (cptr=cmdTbl; cptr->cmd; cptr++){
// if (!StrCmp(cptr->cmd, "boot")) break;
//}
//DoBootKernel(cptr, 1, 0);
C_Entry();
}else{
// C_Entry();
}
} // CMain.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -