示例#1
0
static void reset_tempos(const char* sDefaultOS)
{
	framebuffer_setdisplaytext(FALSE);
	nvram_setvar("opib-temp-os",sDefaultOS);
	nvram_save();
	framebuffer_setdisplaytext(TRUE);
}
示例#2
0
文件: a4.c 项目: chronzz/openiBoot
void platform_init()
{
	arm_setup();
	mmu_setup();
	tasks_setup();

	// Basic prerequisites for everything else
	miu_setup();
	power_setup();

	clock_setup();

	// Need interrupts for everything afterwards
	interrupt_setup();

	gpio_setup();

	// For scheduling/sleeping niceties
	timer_setup();
	event_setup();

	// Other devices
	uart_setup();
	i2c_setup();

	dma_setup();

	LeaveCriticalSection();

	displaypipe_init();
	framebuffer_setup();
	framebuffer_setdisplaytext(TRUE);
}
示例#3
0
void cmd_text(int argc, char** argv) {
	if(argc < 2) {
		bufferPrintf("Usage: %s <on|off>\r\n", argv[0]);
		return;
	}

	if(strcmp(argv[1], "on") == 0) {
		framebuffer_setdisplaytext(ON);
		bufferPrintf("Text display ON\r\n");
	} else if(strcmp(argv[1], "off") == 0) {
		framebuffer_setdisplaytext(OFF);
		bufferPrintf("Text display OFF\r\n");
	} else {
		bufferPrintf("Unrecognized option: %s\r\n", argv[1]);
	}
}
示例#4
0
文件: a4.c 项目: boydcase31/openiBoot
void platform_init()
{
	arm_setup();
	mmu_setup();
	tasks_setup();

	// Basic prerequisites for everything else
	miu_setup();
	power_setup();

	clock_setup();

	// Need interrupts for everything afterwards
	interrupt_setup();

	gpio_setup();

	// For scheduling/sleeping niceties
	timer_setup();
	event_setup();

	// Other devices
	usb_shutdown();
	uart_setup();
	i2c_setup();

	// DMA currently f***s up. Need to check why. -- Bluerise
	// dma_setup();

	LeaveCriticalSection();

	framebuffer_hook(); // TODO: Remove once LCD implemented -- Ricky26
	framebuffer_setdisplaytext(TRUE);
}
示例#5
0
void platform_init()
{
	arm_setup();
	mmu_setup();
	tasks_setup();

	// Basic prerequisites for everything else
	miu_setup();
	power_setup();

	clock_setup();

	// Need interrupts for everything afterwards
	interrupt_setup();
	
	gpio_setup();

	// For scheduling/sleeping niceties
	timer_setup();
	event_setup();
	wdt_setup();

	// Other devices
//	uart_setup();
	i2c_setup();

//	dma_setup();

	spi_setup();

	LeaveCriticalSection();

	aes_setup();

	nor_setup();
	syscfg_setup();
	images_setup();
	nvram_setup();

//	lcd_setup();
	framebuffer_hook();	// TODO: Remove once LCD implemented
	framebuffer_setup();

//	audiohw_init();

	framebuffer_setdisplaytext(TRUE);


	gpio_register_interrupt(BUTTONS_HOLD_IRQ, BUTTONS_HOLD_IRQTYPE, BUTTONS_HOLD_IRQLEVEL, BUTTONS_HOLD_IRQAUTOFLIP, gpio_test_handler, 0);
	gpio_interrupt_enable(BUTTONS_HOLD_IRQ);
	gpio_register_interrupt(BUTTONS_HOME_IRQ, BUTTONS_HOME_IRQTYPE, BUTTONS_HOME_IRQLEVEL, BUTTONS_HOME_IRQAUTOFLIP, gpio_test_handler, 1);
	gpio_interrupt_enable(BUTTONS_HOME_IRQ);
	gpio_register_interrupt(BUTTONS_VOLUP_IRQ, BUTTONS_VOLUP_IRQTYPE, BUTTONS_VOLUP_IRQLEVEL, BUTTONS_VOLUP_IRQAUTOFLIP, gpio_test_handler, 2);
	gpio_interrupt_enable(BUTTONS_VOLUP_IRQ);
	gpio_register_interrupt(BUTTONS_VOLDOWN_IRQ, BUTTONS_VOLDOWN_IRQTYPE, BUTTONS_VOLDOWN_IRQLEVEL, BUTTONS_VOLDOWN_IRQAUTOFLIP, gpio_test_handler, 3);
	gpio_interrupt_enable(BUTTONS_VOLDOWN_IRQ);
}
示例#6
0
static void installer_init()
{
	framebuffer_setdisplaytext(FALSE);
	framebuffer_clear();

	{
		int w, h;
		uint32_t *bgImg = framebuffer_load_image(datainstallerLogoPNG, sizeof(datainstallerLogoPNG), &w, &h, TRUE);
		if(bgImg)
		{
			int x = (framebuffer_width() - w)/2;
			int y = (framebuffer_height() - h)/3;

			framebuffer_draw_image(bgImg, x, y, w, h);
		}
		else
		{
			framebuffer_setdisplaytext(TRUE);
			bufferPrintf("Failed to load image...\n");
		}
	}
}
示例#7
0
void platform_init()
{
	arm_setup();
	mmu_setup();
	tasks_setup();

	// Basic prerequisites for everything else
	miu_setup();
	power_setup();

	clock_setup();

	// Need interrupts for everything afterwards
	interrupt_setup();
	
	gpio_setup();

	// For scheduling/sleeping niceties
	timer_setup();
	event_setup();
	wdt_setup();

	// Other devices
	uart_setup();
	i2c_setup();

//	dma_setup();

	spi_setup();

	LeaveCriticalSection();

	aes_setup();

	displaypipe_init();
	framebuffer_setup();
	framebuffer_setdisplaytext(TRUE);
	lcd_set_backlight_level(186);

//	audiohw_init();
	
	//TODO: remove
	task_init(&iboot_loader_task, "iboot loader", TASK_DEFAULT_STACK_SIZE);
	task_start(&iboot_loader_task, &iboot_loader_run, NULL);
}
示例#8
0
void OpenIBootStart() {
	setup_openiboot();
	pmu_charge_settings(TRUE, FALSE, FALSE);

#ifdef OPENIBOOT_INSTALLER
	framebuffer_setdisplaytext(FALSE);
	framebuffer_clear();

	{
		int w, h;
		uint32_t *bgImg = framebuffer_load_image(datainstallerLogoPNG, sizeof(datainstallerLogoPNG), &w, &h, TRUE);
		if(bgImg)
		{
			int x = (framebuffer_width() - w)/2;
			int y = (framebuffer_height() - h)/3;

			framebuffer_draw_image(bgImg, x, y, w, h);
		}
		else
		{
			framebuffer_setdisplaytext(TRUE);
			bufferPrintf("Failed to load image...\n");
		}
	}

#else
	framebuffer_setdisplaytext(TRUE);
	framebuffer_clear();
	bufferPrintf("Loading openiBoot...");
#ifndef SMALL
#ifndef NO_STBIMAGE
	int defaultOS = 0;
	int tempOS = 0;
	const char* hideMenu = nvram_getvar("opib-hide-menu");
	const char* sDefaultOS = nvram_getvar("opib-default-os");
	const char* sTempOS = nvram_getvar("opib-temp-os");
	if(sDefaultOS)
		defaultOS = parseNumber(sDefaultOS);
	if(sTempOS)
		tempOS = parseNumber(sTempOS);
	if(tempOS!=defaultOS) {
				
		switch (tempOS) {
			case 0:
				framebuffer_clear();
				bufferPrintf("Loading iOS...");
				reset_tempos(sDefaultOS);
				Image* image = images_get(fourcc("ibox"));
				if(image == NULL)
					image = images_get(fourcc("ibot"));
				void* imageData;
				images_read(image, &imageData);
				chainload((uint32_t)imageData);
				break;
			
			case 1:
				framebuffer_clear();
				bufferPrintf("Loading iDroid...");
				reset_tempos(sDefaultOS);
#ifndef NO_HFS
#ifndef CONFIG_IPOD
				radio_setup();
#endif
				nand_setup();
				fs_setup();
				if(globalFtlHasBeenRestored) {
					if(ftl_sync()) {
						bufferPrintf("ftl synced successfully");
					} else {
						bufferPrintf("error syncing ftl");
					}
				}	
				pmu_set_iboot_stage(0);
				startScripting("linux"); //start script mode if there is a script file
				boot_linux_from_files();
#endif
				break;
				
			case 2:
				framebuffer_clear();
				bufferPrintf("Loading Console...");
				reset_tempos(sDefaultOS);
				hideMenu = "1";
				break;
		}
		
	} else if(hideMenu && (strcmp(hideMenu, "1") == 0 || strcmp(hideMenu, "true") == 0)) {
		bufferPrintf("Boot menu hidden. Use 'setenv opib-hide-menu false' and then 'saveenv' to unhide.\r\n");
	} else {
        	framebuffer_setdisplaytext(FALSE);
        	isMultitouchLoaded = load_multitouch_images();
		framebuffer_clear();
		const char* sMenuTimeout = nvram_getvar("opib-menu-timeout");
		int menuTimeout = -1;
		if(sMenuTimeout)
			menuTimeout = parseNumber(sMenuTimeout);
		menu_setup(menuTimeout, defaultOS);
	}
#endif
#endif
#endif //OPENIBOOT_INSTALLER

	startUSB();

#ifndef CONFIG_IPOD
	camera_setup();
	radio_setup();
#endif
	sdio_setup();
	wlan_setup();
	accel_setup();
#ifndef CONFIG_IPOD
	als_setup();
#endif

	nand_setup();
#ifndef NO_HFS
	fs_setup();
#endif

	pmu_set_iboot_stage(0);
	startScripting("openiboot"); //start script mode if there is a file
	bufferPrintf("version: %s\r\n", OPENIBOOT_VERSION_STR);
	bufferPrintf("-----------------------------------------------\r\n");
	bufferPrintf("              WELCOME TO OPENIBOOT\r\n");
	bufferPrintf("-----------------------------------------------\r\n");
	DebugPrintf("                    DEBUG MODE\r\n");

	audiohw_postinit();

	setReady(TRUE);

	// Process command queue
	while(TRUE) {
		char* command = NULL;
		CommandQueue* cur;
		EnterCriticalSection();
		if(commandQueue != NULL) {
			cur = commandQueue;
			command = cur->command;
			commandQueue = commandQueue->next;
			free(cur);
		}
		LeaveCriticalSection();

		if(command) {
			setReady(FALSE);
			processCommand(command);
			setReady(TRUE);
			free(command);
		}
	}
	// should not reach here

}
示例#9
0
int menu_setup() {
	FBWidth = currentWindow->framebuffer.width;
	FBHeight = currentWindow->framebuffer.height;	

	imgiPhoneOS = framebuffer_load_image(dataiPhoneOSPNG, dataiPhoneOSPNG_size, &imgiPhoneOSWidth, &imgiPhoneOSHeight, TRUE);
	imgiPhoneOSSelected = framebuffer_load_image(dataiPhoneOSSelectedPNG, dataiPhoneOSSelectedPNG_size, &imgiPhoneOSWidth, &imgiPhoneOSHeight, TRUE);
	imgConsole = framebuffer_load_image(dataConsolePNG, dataConsolePNG_size, &imgConsoleWidth, &imgConsoleHeight, TRUE);
	imgConsoleSelected = framebuffer_load_image(dataConsoleSelectedPNG, dataConsoleSelectedPNG_size, &imgConsoleWidth, &imgConsoleHeight, TRUE);
	imgHeader = framebuffer_load_image(dataHeaderPNG, dataHeaderPNG_size, &imgHeaderWidth, &imgHeaderHeight, TRUE);

	bufferPrintf("menu: images loaded\r\n");

	imgiPhoneOSX = (FBWidth - imgiPhoneOSWidth) / 2;
	imgiPhoneOSY = 106;

	imgConsoleX = (FBWidth - imgConsoleWidth) / 2;
	imgConsoleY = 246;

	imgHeaderX = (FBWidth - imgHeaderWidth) / 2;
	imgHeaderY = 30;

	framebuffer_draw_image(imgHeader, imgHeaderX, imgHeaderY, imgHeaderWidth, imgHeaderHeight);
	framebuffer_draw_rect_hgradient(0, 90, 0, 378, FBWidth, (FBHeight - 12) - 378);
	framebuffer_draw_rect_hgradient(0x22, 0x22, 0, FBHeight - 12, FBWidth, 12);

	framebuffer_setloc(0, 47);
	framebuffer_setcolors(COLOR_WHITE, 0x222222);
	framebuffer_print_force(OPENIBOOT_VERSION_STR);
	framebuffer_setcolors(COLOR_WHITE, COLOR_BLACK);
	framebuffer_setloc(0, 0);

	Selection = MenuSelectioniPhoneOS;

	drawSelectionBox();

	pmu_set_iboot_stage(0);

	while(TRUE) {
		if(buttons_is_hold_pushed()) {
			toggle();
			udelay(200000);
		}
		if(buttons_is_home_pushed()) {
			break;
		}
		udelay(10000);
	}

	if(Selection == MenuSelectioniPhoneOS) {
		Image* image = images_get(fourcc("ibox"));
		void* imageData;
		images_read(image, &imageData);
		chainload((uint32_t)imageData);
	}

	if(Selection == MenuSelectionConsole) {
		framebuffer_setdisplaytext(TRUE);
		framebuffer_clear();
	}

	return 0;
}
示例#10
0
void OpenIBootStart() {
	setup_openiboot();
	pmu_charge_settings(TRUE, FALSE, FALSE);

	framebuffer_setdisplaytext(TRUE);
	framebuffer_clear();

#ifndef SMALL
#ifndef NO_STBIMAGE
	const char* hideMenu = nvram_getvar("opib-hide-menu");
	if(hideMenu && (strcmp(hideMenu, "1") == 0 || strcmp(hideMenu, "true") == 0)) {
		bufferPrintf("Boot menu hidden. Use 'setenv opib-hide-menu false' and then 'saveenv' to unhide.\r\n");
	} else {
		framebuffer_setdisplaytext(FALSE);
		const char* sMenuTimeout = nvram_getvar("opib-menu-timeout");
		int menuTimeout = -1;
		if(sMenuTimeout)
			menuTimeout = parseNumber(sMenuTimeout);

		menu_setup(menuTimeout);
	}
#endif
#endif

	startUSB();

	radio_setup();
	sdio_setup();
	wlan_setup();
	accel_setup();
	als_setup();

	nand_setup();
#ifndef NO_HFS
	fs_setup();
#endif

	pmu_set_iboot_stage(0);
	startScripting("openiboot"); //start script mode if there is a file
	bufferPrintf("-----------------------------------------------\r\n");
	bufferPrintf("              WELCOME TO OPENIBOOT\r\n");
	bufferPrintf("-----------------------------------------------\r\n");
	DebugPrintf("                    DEBUG MODE\r\n");

	audiohw_postinit();

	// Process command queue
	while(TRUE) {
		char* command = NULL;
		CommandQueue* cur;
		EnterCriticalSection();
		if(commandQueue != NULL) {
			cur = commandQueue;
			command = cur->command;
			commandQueue = commandQueue->next;
			free(cur);
		}
		LeaveCriticalSection();

		if(command) {
			processCommand(command);
			free(command);
		}
	}
	// should not reach here

}
示例#11
0
文件: menu.c 项目: Anon0/iphonelinux
int menu_setup(int timeout) {
	FBWidth = currentWindow->framebuffer.width;
	FBHeight = currentWindow->framebuffer.height;	

	imgiPhoneOS = framebuffer_load_image(dataiPhoneOSPNG, dataiPhoneOSPNG_size, &imgiPhoneOSWidth, &imgiPhoneOSHeight, TRUE);
	imgiPhoneOSSelected = framebuffer_load_image(dataiPhoneOSSelectedPNG, dataiPhoneOSSelectedPNG_size, &imgiPhoneOSWidth, &imgiPhoneOSHeight, TRUE);
	imgConsole = framebuffer_load_image(dataConsolePNG, dataConsolePNG_size, &imgConsoleWidth, &imgConsoleHeight, TRUE);
	imgConsoleSelected = framebuffer_load_image(dataConsoleSelectedPNG, dataConsoleSelectedPNG_size, &imgConsoleWidth, &imgConsoleHeight, TRUE);
	imgAndroidOS_unblended = framebuffer_load_image(dataAndroidOSPNG, dataAndroidOSPNG_size, &imgAndroidOSWidth, &imgAndroidOSHeight, TRUE);
	imgAndroidOSSelected_unblended = framebuffer_load_image(dataAndroidOSSelectedPNG, dataAndroidOSSelectedPNG_size, &imgAndroidOSWidth, &imgAndroidOSHeight, TRUE);
	imgHeader = framebuffer_load_image(dataHeaderPNG, dataHeaderPNG_size, &imgHeaderWidth, &imgHeaderHeight, TRUE);

	bufferPrintf("menu: images loaded\r\n");

	imgiPhoneOSX = (FBWidth - imgiPhoneOSWidth) / 2;
	imgiPhoneOSY = 84;

	imgConsoleX = (FBWidth - imgConsoleWidth) / 2;
	imgConsoleY = 207;

	imgAndroidOSX = (FBWidth - imgAndroidOSWidth) / 2;
	imgAndroidOSY = 330;

	imgHeaderX = (FBWidth - imgHeaderWidth) / 2;
	imgHeaderY = 17;

	framebuffer_draw_image(imgHeader, imgHeaderX, imgHeaderY, imgHeaderWidth, imgHeaderHeight);

	framebuffer_draw_rect_hgradient(0, 42, 0, 360, FBWidth, (FBHeight - 12) - 360);
	framebuffer_draw_rect_hgradient(0x22, 0x22, 0, FBHeight - 12, FBWidth, 12);

	framebuffer_setloc(0, 47);
	framebuffer_setcolors(COLOR_WHITE, 0x222222);
	framebuffer_print_force(OPENIBOOT_VERSION_STR);
	framebuffer_setcolors(COLOR_WHITE, COLOR_BLACK);
	framebuffer_setloc(0, 0);

	imgAndroidOS = malloc(imgAndroidOSWidth * imgAndroidOSHeight * sizeof(uint32_t));
	imgAndroidOSSelected = malloc(imgAndroidOSWidth * imgAndroidOSHeight * sizeof(uint32_t));

	framebuffer_capture_image(imgAndroidOS, imgAndroidOSX, imgAndroidOSY, imgAndroidOSWidth, imgAndroidOSHeight);
	framebuffer_capture_image(imgAndroidOSSelected, imgAndroidOSX, imgAndroidOSY, imgAndroidOSWidth, imgAndroidOSHeight);

	framebuffer_blend_image(imgAndroidOS, imgAndroidOSWidth, imgAndroidOSHeight, imgAndroidOS_unblended, imgAndroidOSWidth, imgAndroidOSHeight, 0, 0);
	framebuffer_blend_image(imgAndroidOSSelected, imgAndroidOSWidth, imgAndroidOSHeight, imgAndroidOSSelected_unblended, imgAndroidOSWidth, imgAndroidOSHeight, 0, 0);

	Selection = MenuSelectioniPhoneOS;

	OtherFramebuffer = CurFramebuffer;
	CurFramebuffer = (volatile uint32_t*) NextFramebuffer;

	drawSelectionBox();

	pmu_set_iboot_stage(0);

	memcpy((void*)NextFramebuffer, (void*) CurFramebuffer, NextFramebuffer - (uint32_t)CurFramebuffer);

	uint64_t startTime = timer_get_system_microtime();
	while(TRUE) {
		if(buttons_is_pushed(BUTTONS_HOLD)) {
			toggle(TRUE);
			startTime = timer_get_system_microtime();
			udelay(200000);
		}
#ifndef CONFIG_IPOD
		if(!buttons_is_pushed(BUTTONS_VOLUP)) {
			toggle(FALSE);
			startTime = timer_get_system_microtime();
			udelay(200000);
		}
		if(!buttons_is_pushed(BUTTONS_VOLDOWN)) {
			toggle(TRUE);
			startTime = timer_get_system_microtime();
			udelay(200000);
		}
#endif
		if(buttons_is_pushed(BUTTONS_HOME)) {
			break;
		}
		if(timeout > 0 && has_elapsed(startTime, (uint64_t)timeout * 1000)) {
			bufferPrintf("menu: timed out, selecting current item\r\n");
			break;
		}
		udelay(10000);
	}

	if(Selection == MenuSelectioniPhoneOS) {
		Image* image = images_get(fourcc("ibox"));
		if(image == NULL)
			image = images_get(fourcc("ibot"));
		void* imageData;
		images_read(image, &imageData);
		chainload((uint32_t)imageData);
	}

	if(Selection == MenuSelectionConsole) {
		// Reset framebuffer back to original if necessary
		if((uint32_t) CurFramebuffer == NextFramebuffer)
		{
			CurFramebuffer = OtherFramebuffer;
			currentWindow->framebuffer.buffer = CurFramebuffer;
			lcd_window_address(2, (uint32_t) CurFramebuffer);
		}

		framebuffer_setdisplaytext(TRUE);
		framebuffer_clear();
	}

	if(Selection == MenuSelectionAndroidOS) {
		// Reset framebuffer back to original if necessary
		if((uint32_t) CurFramebuffer == NextFramebuffer)
		{
			CurFramebuffer = OtherFramebuffer;
			currentWindow->framebuffer.buffer = CurFramebuffer;
			lcd_window_address(2, (uint32_t) CurFramebuffer);
		}

		framebuffer_setdisplaytext(TRUE);
		framebuffer_clear();

#ifndef NO_HFS
		radio_setup();
		nand_setup();
		fs_setup();
		if(globalFtlHasBeenRestored) /* if ftl has been restored, sync it, so kernel doesn't have to do a ftl_restore again */
		{
			if(ftl_sync())
			{
				bufferPrintf("ftl synced successfully");
			}
			else
			{
				bufferPrintf("error syncing ftl");
			}
		}

		pmu_set_iboot_stage(0);
		startScripting("linux"); //start script mode if there is a script file
		boot_linux_from_files();
#endif
	}

	return 0;
}
示例#12
0
void OpenIBootStart() {
	setup_openiboot();

	framebuffer_hook();
	framebuffer_setdisplaytext(TRUE);

#ifndef CONFIG_IPHONE_4
	pmu_charge_settings(TRUE, FALSE, FALSE);

	framebuffer_setdisplaytext(TRUE);
	framebuffer_clear();
	bufferPrintf("Loading openiBoot...");
#ifndef SMALL
#ifndef NO_STBIMAGE
	int defaultOS = 0;
	int tempOS = 0;
	const char* hideMenu = nvram_getvar("opib-hide-menu");
	const char* sDefaultOS = nvram_getvar("opib-default-os");
	const char* sTempOS = nvram_getvar("opib-temp-os");
	if(sDefaultOS)
		defaultOS = parseNumber(sDefaultOS);
	if(sTempOS)
		tempOS = parseNumber(sTempOS);
	if(tempOS!=defaultOS) {
				
		switch (tempOS) {
			case 0:
				framebuffer_clear();
				bufferPrintf("Loading iOS...");
				reset_tempos(sDefaultOS);
				Image* image = images_get(fourcc("ibox"));
				if(image == NULL)
					image = images_get(fourcc("ibot"));
				void* imageData;
				images_read(image, &imageData);
				chainload((uint32_t)imageData);
				break;
			
			case 1:
				framebuffer_clear();
				bufferPrintf("Loading iDroid...");
				reset_tempos(sDefaultOS);
#ifndef NO_HFS
#ifndef CONFIG_IPOD
				radio_setup();
#endif
				nand_setup();
				fs_setup();
				if(globalFtlHasBeenRestored) {
					if(ftl_sync()) {
						bufferPrintf("ftl synced successfully");
					} else {
						bufferPrintf("error syncing ftl");
					}
				}	
				pmu_set_iboot_stage(0);
				startScripting("linux"); //start script mode if there is a script file
				boot_linux_from_files();
#endif
				break;
				
			case 2:
				framebuffer_clear();
				bufferPrintf("Loading Console...");
				reset_tempos(sDefaultOS);
				hideMenu = "1";
				break;
		}
		
	} else if(hideMenu && (strcmp(hideMenu, "1") == 0 || strcmp(hideMenu, "true") == 0)) {
		bufferPrintf("Boot menu hidden. Use 'setenv opib-hide-menu false' and then 'saveenv' to unhide.\r\n");
	} else {
        	framebuffer_setdisplaytext(FALSE);
        	isMultitouchLoaded = load_multitouch_images();
		framebuffer_clear();
		const char* sMenuTimeout = nvram_getvar("opib-menu-timeout");
		int menuTimeout = -1;
		if(sMenuTimeout)
			menuTimeout = parseNumber(sMenuTimeout);
		menu_setup(menuTimeout, defaultOS);
	}
#endif
#endif

#endif
#ifndef CONFIG_IPAD
	startUSB();
#endif
#ifndef CONFIG_IPHONE_4
#ifndef CONFIG_IPOD
	camera_setup();
	radio_setup();
#endif
	sdio_setup();
	wlan_setup();
	accel_setup();
#ifndef CONFIG_IPOD
	als_setup();
#endif
	nand_setup();
#ifndef NO_HFS
	fs_setup();
#endif

	pmu_set_iboot_stage(0);
	startScripting("openiboot"); //start script mode if there is a file
#endif
	bufferPrintf("  ___                   _ ____              _   \r\n");
	bufferPrintf(" / _ \\ _ __   ___ _ __ (_) __ )  ___   ___ | |_ \r\n");
	bufferPrintf("| | | | '_ \\ / _ \\ '_ \\| |  _ \\ / _ \\ / _ \\| __|\r\n");
	bufferPrintf("| |_| | |_) |  __/ | | | | |_) | (_) | (_) | |_ \r\n");
	bufferPrintf(" \\___/| .__/ \\___|_| |_|_|____/ \\___/ \\___/ \\__|\r\n");
	bufferPrintf("      |_|                                       \r\n");
	bufferPrintf("\r\n");
	bufferPrintf("version: %s\r\n", OPENIBOOT_VERSION_STR);
	DebugPrintf("                    DEBUG MODE\r\n");

#ifndef CONFIG_IPHONE_4
	audiohw_postinit();
#endif

	// Process command queue
	while(TRUE) {
		char* command = NULL;
		CommandQueue* cur;
		EnterCriticalSection();
		if(commandQueue != NULL) {
			cur = commandQueue;
			command = cur->command;
			commandQueue = commandQueue->next;
			free(cur);
		}
		LeaveCriticalSection();

		if(command) {
			processCommand(command);
			free(command);
		}
	}
	// should not reach here

}
示例#13
0
void OpenIBootStart() {
	setup_openiboot();
	pmu_charge_settings(TRUE, FALSE, FALSE);

	framebuffer_setdisplaytext(TRUE);
	framebuffer_clear();
    //enable multitouch before displaying menu, only 3g first
    framebuffer_setdisplaytext(FALSE);
    nand_setup();
    fs_setup();
    int size;
    size = fs_extract(1, "/firmware/zephyr2.bin", (void*) 0x09000000);
    if(size < 0)
    {
        bufferPrintf("Cannot find zephyr bin.\r\n");
        return;
    }
    
    multitouch_setup((uint8_t*) 0x09000000, size);
    
#ifndef SMALL
#ifndef NO_STBIMAGE
	const char* hideMenu = nvram_getvar("opib-hide-menu");
	if(hideMenu && (strcmp(hideMenu, "1") == 0 || strcmp(hideMenu, "true") == 0)) {
		bufferPrintf("Boot menu hidden. Use 'setenv opib-hide-menu false' and then 'saveenv' to unhide.\r\n");
	} else {
		framebuffer_setdisplaytext(FALSE);
		const char* sMenuTimeout = nvram_getvar("opib-menu-timeout");
		int menuTimeout = -1;
		if(sMenuTimeout)
			menuTimeout = parseNumber(sMenuTimeout);

		menu_setup(menuTimeout);
	}
#endif
#endif

	startUSB();

#ifndef CONFIG_IPOD
	camera_setup();
	radio_setup();
#endif
	sdio_setup();
	wlan_setup();
	accel_setup();
#ifndef CONFIG_IPOD
	als_setup();
#endif

	nand_setup();
#ifndef NO_HFS
	fs_setup();
#endif

	pmu_set_iboot_stage(0);
	startScripting("openiboot"); //start script mode if there is a file
	bufferPrintf("version: %s\r\n", OPENIBOOT_VERSION_STR);
	bufferPrintf("-----------------------------------------------\r\n");
	bufferPrintf("              WELCOME TO OPENIBOOT\r\n");
	bufferPrintf("-----------------------------------------------\r\n");
	DebugPrintf("                    DEBUG MODE\r\n");

	audiohw_postinit();

	// Process command queue
	while(TRUE) {
		char* command = NULL;
		CommandQueue* cur;
		EnterCriticalSection();
		if(commandQueue != NULL) {
			cur = commandQueue;
			command = cur->command;
			commandQueue = commandQueue->next;
			free(cur);
		}
		LeaveCriticalSection();

		if(command) {
			processCommand(command);
			free(command);
		}
	}
	// should not reach here

}