/********************************************************** * Routine: recovery_detection * * Description: check recovery mode * * Notice: the recovery bits of RTC PDN1 are set as 0x10 only if * (1) user trigger factory reset * **********************************************************/ BOOL recovery_detection(void) { //if ((DRV_Reg16(RTC_PDN1) & 0x0030) == 0x0010) { /* factory data reset */ if(Check_RTC_Recovery_Mode()) { g_boot_mode = RECOVERY_BOOT; return TRUE; } if(recovery_check_key_trigger()) { return TRUE; } return recovery_check_command_trigger(); /* recovery_check_command_trigger(); if (g_boot_mode == RECOVERY_BOOT) { return TRUE; } else { return FALSE; } */ }
BOOL recovery_detection(void) { if(Check_RTC_Recovery_Mode()) { g_boot_mode = RECOVERY_BOOT; return TRUE; } #if 0 if(recovery_check_key_trigger()) { return TRUE; } #endif return recovery_check_command_trigger(); }
int unshield_recovery_detection(void) { //because recovery_check_command_trigger's BOOL is different from the BOOL in this file. //so use code like this type. return recovery_check_command_trigger()? TRUE:FALSE; }
// check the boot mode : (1) meta mode or (2) recovery mode ... void boot_mode_select(void) { //Ivan ulong begin; if (meta_detection()) { return; } #if defined (HAVE_LK_TEXT_MENU) if(Check_RTC_PDN1_bit13()) { printf("[FASTBOOT] reboot to boot loader\n"); g_boot_mode = FASTBOOT; Set_Clr_RTC_PDN1_bit13(false); return; } //Ivan #ifdef MENU_BOOT_ENABLE boot_mode_dkey_check(); if (g_boot_mode == MENU_BOOT) { /* clean console screen */ video_clean_screen(); // mt65xx_disp_fill_rect(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT, 0x0); video_set_cursor(2,0); video_printf("Recovery Mode: Volume Up\r\n"); video_set_cursor(4,0); video_printf("Factory Mode: Volume Down\r\n"); // mt65xx_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT); mt65xx_backlight_on(); video_set_cursor(49,0); while (mt65XX_get_key() != 0xFFFF); printf(" > Key release!!!\n"); mdelay(500); //Ivan added mtk_wdt_restart(); begin = get_timer(0); while (g_boot_mode == MENU_BOOT) { if (factory_detection()) { video_clean_screen(); return; } if(boot_menu_detection())//recovery, fastboot, normal boot. { video_clean_screen(); return; } //Ivan add 20s time limit if (get_timer(begin) < 20000) mtk_wdt_restart(); } // video_clean_screen(); // mt65xx_disp_fill_rect(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT, 0x0); // mt65xx_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT); // video_set_cursor(49,0); // mt65xx_disp_wait_idle(); } if(Check_RTC_Recovery_Mode()) { g_boot_mode = RECOVERY_BOOT; } recovery_check_command_trigger(); #else //MENU_BOOT_ENABLE if (factory_detection()) { return; } if(boot_menu_detection())//recovery, fastboot, normal boot. { return; } recovery_detection(); #endif //MENU_BOOT_ENABLE #else //HAVE_LK_TEXT_MENU #ifdef MTK_FASTBOOT_SUPPORT if(fastboot_trigger()) { return; } #endif //MTK_FASTBOOT_SUPPORT if (factory_detection()) { return; } if(recovery_detection()) { //************************************** //* CHECK IMAGE //************************************** if(DRV_Reg32(0x40002300)==0xE92D4800) { printf(" > do recovery_check\n"); //jump(0x40002300); } else { printf(" > bypass recovery_check\n"); } return; } #endif #ifdef MTK_KERNEL_POWER_OFF_CHARGING if(kernel_power_off_charging_detection()) { printf(" < Kernel Power Off Charging Detection Ok> \n"); return; } else { printf("< Kernel Enter Normal Boot > \n"); } #endif }