示例#1
0
void platform_periph_setup()
{
    // Test PC8, if 0 then SLP_TR is bound
    gpio_set_input(GPIO_C, GPIO_PIN_8); // Red
    gpio_config_pull_up_down(GPIO_C, GPIO_PIN_8, GPIO_PULL_UP);

    if (gpio_pin_read(GPIO_C, GPIO_PIN_8) == 0)
    {
        log_info("SLP_TR to timer effective!");
        al04_has_slptr_on_timer = 1;
    }

    // Disable pull up
    gpio_set_analog(GPIO_C, GPIO_PIN_8);
    gpio_config_pull_up_down(GPIO_C, GPIO_PIN_8, GPIO_PULL_DISABLED);

    // Initialize the radio chip
    radio_setup();

    // Setup the feedback battery
    vbat_setup();

    // Initialize the amplifier
    amp_setup();
}
示例#2
0
/** Set up the USART peripherals, hook them into the settings subsystem
*
*/
void usarts_setup()
{

  radio_setup();

  int TYPE_PORTMODE = settings_type_register_enum(portmode_enum, &portmode);

  SETTING("uart_ftdi", "mode", ftdi_usart.mode, TYPE_PORTMODE);
  SETTING("uart_ftdi", "sbp_message_mask", ftdi_usart.sbp_message_mask, TYPE_INT);
  SETTING("uart_ftdi", "fwd_msg", ftdi_usart.sbp_fwd, TYPE_INT);
  SETTING_NOTIFY("uart_ftdi", "baudrate", ftdi_usart.baud_rate, TYPE_INT,
                 baudrate_change_notify);

  SETTING("uart_uarta", "mode", uarta_usart.mode, TYPE_PORTMODE);
  SETTING("uart_uarta", "sbp_message_mask", uarta_usart.sbp_message_mask, TYPE_INT);
  SETTING("uart_uarta", "configure_telemetry_radio_on_boot",
          uarta_usart.configure_telemetry_radio_on_boot, TYPE_BOOL);
  SETTING("uart_uarta", "fwd_msg", uarta_usart.sbp_fwd, TYPE_INT);
  SETTING_NOTIFY("uart_uarta", "baudrate", uarta_usart.baud_rate, TYPE_INT,
          baudrate_change_notify);

  SETTING("uart_uartb", "mode", uartb_usart.mode, TYPE_PORTMODE);
  SETTING("uart_uartb", "sbp_message_mask", uartb_usart.sbp_message_mask, TYPE_INT);
  SETTING("uart_uartb", "configure_telemetry_radio_on_boot",
          uartb_usart.configure_telemetry_radio_on_boot, TYPE_BOOL);
  SETTING("uart_uartb", "fwd_msg", uartb_usart.sbp_fwd, TYPE_INT);
  SETTING_NOTIFY("uart_uartb", "baudrate", uartb_usart.baud_rate, TYPE_INT,
          baudrate_change_notify);

  usarts_enable(ftdi_usart.baud_rate, uarta_usart.baud_rate, uartb_usart.baud_rate, true);

}
示例#3
0
int main() {
  uint8_t buf[32];

  WDTCTL = WDTPW | WDTHOLD;
  DCOCTL = 0;
  BCSCTL1 = CALBC1_16MHZ;
  DCOCTL = CALDCO_16MHZ;
  BCSCTL3 |= LFXT1S_2;

  P1DIR |= BIT0;
  P1OUT &= ~BIT0;

  _BIS_SR(GIE);
#ifdef UART_DEBUG
  uart_setup();
#endif
  radio_setup();

  // flush RX just in case
  if (!(RF24_RX_EMPTY & msprf24_queue_state())) {
    flush_rx();
  }
  msprf24_activate_rx();
  LPM4;

  while (1) {
    if (rf_irq & RF24_IRQ_FLAGGED) {
      rf_irq &= ~RF24_IRQ_FLAGGED;
      msprf24_get_irq_reason();
    }
    if (rf_irq & RF24_IRQ_RX || msprf24_rx_pending()) {
      uint8_t nextPayloadSize = r_rx_peek_payload_size();
      r_rx_payload(nextPayloadSize, buf);
      msprf24_irq_clear(RF24_IRQ_MASK);
      memcpy(dht_data.bytes, buf, nextPayloadSize);
#ifdef UART_DEBUG
      int t = (((dht_data.val.th&0x7f)<<8) + dht_data.val.tl)*((dht_data.val.th&0x80)?-1:1);
      int h = (dht_data.val.hh<<8) + (dht_data.val.hl);
      uart_send(sprintf(txbuf, "%d.%1d;%d.%1d\r\n", t/10, t%10, h/10, h%10));
#endif
    }
    LPM4;
  }

  return 0;
}
示例#4
0
void platform_periph_setup()
{
    // Configure the radio
    radio_setup();

    // Configure the power measurement
    power_setup();

    // Cut power PA11, PB2, PB12
    gpio_set_output(GPIO_A, GPIO_PIN_11);
    gpio_pin_clear(GPIO_A, GPIO_PIN_11); // Battery

    gpio_set_output(GPIO_B, GPIO_PIN_2);
    gpio_pin_clear(GPIO_B, GPIO_PIN_2); // CHARGE

    gpio_set_output(GPIO_B, GPIO_PIN_12);
    gpio_pin_clear(GPIO_B, GPIO_PIN_12); // 5V
}
示例#5
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

}
示例#6
0
文件: main.c 项目: alueger/dAISy
int main(void)
{
	// configure WDT
	WDTCTL = WDTPW | WDTHOLD;				// stop watch dog timer
	_25mhz();


#ifdef TEST
	// when compiled in test mode, use different main
	// disconnect radio when testing to avoid damage!
	test_main();
#endif

	// configure LED1 and turn it off, we'll use that for error and other stuff
	P1DIR |= LED1;
	LED1_OFF;

	P4DIR |= LED2;
	LED2_ON;

	// setup uart
	uart_init();

#ifdef DEBUG_MESSAGES
	uart_send_string("Hola mundo!\r\n");
#endif

	// setup packet handler
	ph_setup();

	// setup an configure radio
	radio_setup();
	radio_configure();

	// self-calibrate image rejection
	radio_calibrate_ir();

	// verify that radio configuration was successful
	radio_get_chip_status(0);
	if (radio_buffer.chip_status.chip_status & RADIO_CMD_ERROR) {	// check for command error
		uart_send_string("Error inicializando radio!!!\r\n");
		while (1) {
			LED1_TOGGLE;
			_delay_cycles(8000000);			// blink LED if there was an error
		}
	}


	// start packet receiving
	ph_start();

#ifdef DEBUG_MESSAGES
	uart_send_string("dAISy 0.2 started\r\n");
	LED2_OFF;
#endif

	while (1) {

		LPM0;	// deep sleep until something worthwhile happens

		__no_operation();

		ph_loop();	// packet handler house-keeping, e.g. channel hopping

#ifdef DEBUG_MESSAGES
		uint8_t channel;
		int16_t rssi;
		// debug code to monitor signal strength (RSSI)
		if (ph_get_state() == PH_STATE_PREFETCH) {											// found preamble and start flag
			// record current channel and signal strength
			channel = ph_get_radio_channel();												// read current channel
			rssi = ph_get_radio_rssi();														// read current RSSI
		}
#endif

		// retrieve last packet handler error
		uint8_t error = ph_get_last_error();
#ifdef DEBUG_MESSAGES
		// report error if packet handler failed
		if (error != PH_ERROR_NONE)	{
			dec_to_str(str_output_buffer, 3, rssi);											// convert to decimal string (reuse radio buffer)
			str_output_buffer[4] = 0;														// terminate string
			uart_send_string("sync ");														// send debug message to UART
			uart_send_byte(channel + 'A');
			uart_send_string(" RSSI=");
			uart_send_string(str_output_buffer);
			uart_send_string("dBm\r\n");
			uart_send_string("error: ");
			switch (error) {
			case PH_ERROR_NOEND:
				uart_send_string("no end flag");
				break;
			case PH_ERROR_STUFFBIT:
				uart_send_string("invalid stuff bit");
				break;
			case PH_ERROR_CRC:
				uart_send_string("CRC error");
				break;
			case PH_ERROR_RSSI_DROP:
				uart_send_string("RSSI drop");
				break;
			}
			uart_send_string("\r\n");
			ph_loop();							// house keeping, sending over UART takes time
		}
#else
		// toggle LED if packet handler failed after finding preamble and start flag
		if (error == PH_ERROR_NOEND || error == PH_ERROR_STUFFBIT || error == PH_ERROR_CRC)
			LED1_TOGGLE;
#endif

		// check if a new valid packet arrived
		uint16_t size = fifo_get_packet();
		if (size > 0) {								// if so, process packet

#ifdef DEBUG_MESSAGES
			dec_to_str(str_output_buffer, 3, rssi);											// convert to decimal string (reuse radio buffer)
			str_output_buffer[4] = 0;														// terminate string
			uart_send_string("sync ");														// send debug message to UART
			uart_send_byte(channel + 'A');
			uart_send_string(" RSSI=");
			uart_send_string(str_output_buffer);
			uart_send_string("dBm\r\n");
#endif
			LED2_ON;
			nmea_process_packet();					// process packet (NMEA message will be sent over UART)
			fifo_remove_packet();					// remove processed packet from FIFO
			LED2_OFF;
		}

		// enter low power mode LPM0 (everything off)
		// TODO: wait for UART to complete transmission

		// TODO: suspend UART
	}
}
示例#7
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

}
示例#8
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;
}
示例#9
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

}
示例#10
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

}