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); }
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); }
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 }