⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c.svn-base

📁 vivi源代码
💻 SVN-BASE
字号:
/* * vivi/main.c: main routine * * Copyright (C) 2001,2002 MIZI Research, Inc. * * 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * * * Author: Janghoon Lyu <nandy@mizi.com> * Date  : $Date: 2002/08/28 06:00:11 $ * * $Revision: 1.7 $ * $Id: main.c,v 1.7 2002/08/28 06:00:11 nandy Exp $ * * * History * * 2001-10-xx: Janghoon Lyu <nandy@mizi.com> *    - Initial code * * 2001-01-26: Janghoon Lyu <nandy@mizi.com> *    - Release VIVI Bootloader * * 2002-07-02: Janghoon Lyu <nandy@mizi.com> *    - bootldr狼 儡犁甫 没家窍搁辑 货酚霸 累己 */#include "config.h"#include "machine.h"#include "mmu.h"#include "heap.h"#include "serial.h"#include "printk.h"#include "command.h"#include "priv_data.h"#include "getcmd.h"#include "vivi_string.h"#include "mtd/mtd.h"#include "processor.h"#include <reset_handle.h>#include <types.h>	extern char *vivi_banner;void vivi_shell(void){#ifdef CONFIG_SERIAL_TERM	serial_term();#else#error there is no terminal.#endif}void run_autoboot(void){	while (1) {		exec_string("boot");		printk("Failed 'boot' command. reentering vivi shell\n");		/* if default boot fails, drop into the shell */		vivi_shell();	}}static void error(void){	putstr("Sorry. We can not run vivi\n");	for (;;) /* nothing */;		/* infinite loop */}#define DEFAULT_BOOT_DELAY	0x300000void boot_or_vivi(void){	char c;	int ret;	ulong boot_delay;	//boot_delay = get_param_value("boot_delay", &ret);	boot_delay = DEFAULT_BOOT_DELAY;	/* If a value of boot_delay is zero, 	 * unconditionally call vivi shell */	if (boot_delay == 0) vivi_shell();	/*	 * wait for a keystroke (or a button press if you want.)	 */	printk("Press Return to start the LINUX now, any other key for vivi\n");	c = awaitkey(boot_delay, NULL);	if (((c != '\r') && (c != '\n') && (c != '\0'))) {		printk("type \"help\" for help.\n");		vivi_shell();	}	run_autoboot();	return;}int main(int argc, char *argv[]){	int ret;	/* NB: 酒流鳖瘤绰 MMU啊 波廉 乐澜. */	/*	 * Step 1:	 *  老窜 埃窜茄 硅呈窍唱 谎府绊..	 */	putstr("\r\n");	putstr(vivi_banner);	reset_handler();	/*	 * Step 2:	 *   Board甫 檬扁拳 钦聪促.	 */	ret = board_init();	if (ret) {		putstr("Failed a board_init() procedure\r\n");		error();	}	/*	 * Step 3:	 *   4G甫 府聪绢(linear)窍霸 概俏窍绊, 敲贰浆 皋葛府甫	 *   盔窍绰 措肺 概俏窍绊,	 *   MMU甫 难技夸.	 */	mem_map_init();	mmu_init();	putstr("Succeed memory mapping.\r\n");	/* NB: 瘤陛何磐绰 MMU啊 悼累且 荐档 乐澜 */	/*	 * Now, vivi is running on the ram. MMU is enabled.	 */	/* 	 * Step 4:	 *   何飘肺歹俊辑 悼利 皋葛府 且寸阑 荤侩且 荐 乐档废	 */	/* initialize the heap area*/	ret = heap_init();	if (ret) {		putstr("Failed initailizing heap region\r\n");		error();	}	/* Step 5:	 *    磊, 困俊辑 皋葛府 概俏捞 力措肺 灯促搁,	 *    MTD率阑 棱酒 壕矫促.	 *    悼矫俊, MTD狼 颇萍记partition 沥焊啊 乐促搁	 *    棱酒郴摆烈.	 */	ret = mtd_dev_init();	/* Step 6:	 *   何飘肺歹甫 困茄 颇扼固磐 蔼甸阑 棱酒郴具摆烈.	 */	init_priv_data();	/* Step 7:	 *   啊阐 荤捞(荤厩窍绊 捞惑茄)茄 焊靛甸阑 困秦辑	 */	misc();	init_builtin_cmds();	/* Step 8:	 *   绢叼肺 哎鳖唱?	 */	boot_or_vivi();	/* 咯扁鳖瘤 坷搁 捞惑窍瘤夸. 弊犯瘤 臼唱夸? */	return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -