示例#1
0
BOOL boot_menu_key_trigger(void)
{
#if 1
	//wait
    ulong begin = get_timer(0);
    printf("\n%s Check  boot menu\n",MODULE_NAME);
    printf("%s Wait 50ms for special keys\n",MODULE_NAME);

    //let some case of recovery mode pass.
    if(unshield_recovery_detection())
    {
        return TRUE;
    }

    while(get_timer(begin)<50)
    {

	    //lingjinming modify for p210 you ni sen 2014 09 19
		#if defined(P201_UNISON_KEYPAD)
        if(pmic_detect_homekey())  
		#else
		
		if(mtk_detect_key(MT65XX_BOOT_MENU_KEY))
		#endif
		
		{
                           mtk_wdt_disable();
                           boot_mode_menu_select();
                           mtk_wdt_init();
                           return TRUE;
		}
    }
#endif
     return FALSE;
}
示例#2
0
BOOL mtk_detect_key(unsigned short key)	/* key: HW keycode */
{
/* Because 6572 FPGA doesn't include keypad HW,
 * add FPGA macro to avoid misjudgment 
 */
#ifdef MACH_FPGA
	return FALSE;
#else
	unsigned short idx, bit, din;

	if (key >= KPD_NUM_KEYS)
		return FALSE;

	if (key % 9 == 8)
		key = 8;

	if (key == 8)
    	{ /* Power key */
		if (1 == pmic_detect_powerkey())
		{
			//dbg_print ("power key is pressed\n");
			return TRUE;
		}
		return FALSE;
	}

#ifdef MT65XX_PMIC_RST_KEY
	if(key == MT65XX_PMIC_RST_KEY)
	{
		if (1 == pmic_detect_homekey())
		{
			printf("mtk detect key function pmic_detect_homekey pressed\n");
			return TRUE;
		}
		return FALSE;
	}
#endif

	idx = key / 16;
	bit = key % 16;

	din = DRV_Reg16(KP_MEM1 + (idx << 2)) & (1U << bit);
	if (!din) {
		printf("key %d is pressed\n", key);
		return TRUE;
	}
	return FALSE;
#endif
}
示例#3
0
BOOL mtk_detect_key(unsigned short key)	/* key: HW keycode */
{
#ifdef MACH_FPGA /* FPGA doesn't include keypad HW */
	return FALSE;
#else
	unsigned short idx, bit, din;

	if (key >= KPD_NUM_KEYS)
		return FALSE;
#if 0
	if (key % 9 == 8)
		key = 8;
#endif
	if (key == MTK_PMIC_PWR_KEY)
    	{ /* Power key */
		if (1 == pmic_detect_powerkey())
		{
			//dbg_print ("power key is pressed\n");
			return TRUE;
		}
		return FALSE;
	}

#ifdef MTK_PMIC_RST_KEY
	if (key == MTK_PMIC_RST_KEY)
	{
		if (1 == pmic_detect_homekey())
		{
			printf("mtk detect key function pmic_detect_homekey pressed\n");
			return TRUE;
		}
		return FALSE;
	}
#endif

	idx = key / 16;
	bit = key % 16;

	din = DRV_Reg16(KP_MEM1 + (idx << 2)) & (1U << bit);
	if (!din) {
		printf("key %d is pressed\n", key);
		return TRUE;
	}
	return FALSE;
#endif /* MACH_FPGA */
}
示例#4
0
BOOL mtk_detect_key(unsigned short key)	/* key: HW keycode */
{
	unsigned short idx, bit, din;

	if (key >= KPD_NUM_KEYS)
		return FALSE;

	if (key % 9 == 8)
		key = 8;

    if (key == 8)
    {                         /* Power key */
        if (1 == pmic_detect_powerkey())
        {
            //dbg_print ("power key is pressed\n");
            return TRUE;
        }
        return FALSE;
    }    

#ifdef MT65XX_PMIC_RST_KEY

	if (key == MT65XX_PMIC_RST_KEY) 
	{
		//printf("mtk detect key pmic_detect_homekey= %d\n" ,pmic_detect_homekey());	
		if (0 == pmic_detect_homekey()) //LINE<20120502><homekey pressed>wangyanhui
		{
			printf("mtk detect key function pmic_detect_homekey pressed\n");
			return TRUE;
		}
		// return FALSE; //LINE<20120502><for PR1 board>wangyanhui
	}
#endif

	idx = key / 16;
	bit = key % 16;

	din = DRV_Reg16(KP_MEM1 + (idx << 2)) & (1U << bit);
	if (!din) {
	printf("key %d is pressed\n", key);
		return TRUE;
	}
	return FALSE;
}
示例#5
0
void boot_mode_menu_select()
{
          int select = 0;  // 0=recovery mode, 1=fastboot.  2=normal boot 3=normal boot + ftrace.4=slub debug off
          const char* title_msg = "Select Boot Mode:\n[VOLUME_UP to select.  VOLUME_DOWN is OK.]\n\n";
          video_clean_screen();
          video_set_cursor(video_get_rows()/2, 0);
          video_printf(title_msg);
          video_printf("[Recovery    Mode]         <<==\n");
#ifdef MTK_FASTBOOT_SUPPORT
          video_printf("[Fastboot    Mode]             \n");
#endif
          video_printf("[Normal      Boot]             \n");
#ifndef USER_BUILD
          video_printf("[Normal      Boot +ftrace]    \n");
          video_printf("[Normal      slub debug off]     \n");
#endif
          while(1)
          {

		      //lingjinming modify for p210 you ni sen 2014 09 19
		     #if defined(P201_UNISON_KEYPAD)
               if(pmic_detect_homekey()) 
			 #else
			 
               if(mtk_detect_key(MT65XX_MENU_SELECT_KEY))//VOL_UP
             #endif
             //lingjinming 
             {
                    g_boot_menu = true;
                    switch(select) {

                        case 0:
#ifdef MTK_FASTBOOT_SUPPORT
                            select = 1;

                            video_set_cursor(video_get_rows()/2, 0);
                            video_printf(title_msg);
                            video_printf("[Recovery    Mode]             \n");
                            video_printf("[Fastboot    Mode]         <<==\n");
                            video_printf("[Normal      Boot]             \n");
#ifndef USER_BUILD
                            video_printf("[Normal      Boot +ftrace]     \n");
                            video_printf("[Normal      slub debug off]     \n");
#endif
                        break;
#endif
                        case 1:
                            select = 2;

                            video_set_cursor(video_get_rows()/2, 0);
                            video_printf(title_msg);
                            video_printf("[Recovery    Mode]             \n");
#ifdef MTK_FASTBOOT_SUPPORT
                            video_printf("[Fastboot    Mode]             \n");
#endif
                            video_printf("[Normal      Boot]         <<==\n");
#ifndef USER_BUILD
                            video_printf("[Normal      Boot +ftrace]     \n");
                            video_printf("[Normal      slub debug off]     \n");
#endif
                        break;

                        case 2:
#ifdef USER_BUILD
                            select = 0;
#else
                            select = 3;
#endif
    
                            video_set_cursor(video_get_rows()/2, 0);
                            video_printf(title_msg);
#ifdef USER_BUILD
                            video_printf("[Recovery    Mode]         <<==\n");
#ifdef MTK_FASTBOOT_SUPPORT
                            video_printf("[Fastboot    Mode]             \n");
#endif
                            video_printf("[Normal      Boot]             \n");
#else
                            video_printf("[Recovery    Mode]             \n");
#ifdef MTK_FASTBOOT_SUPPORT
                            video_printf("[Fastboot    Mode]             \n");
#endif
                            video_printf("[Normal      Boot]             \n");
                            video_printf("[Normal      Boot +ftrace] <<==\n");
                            video_printf("[Normal      slub debug off]     \n");
#endif
                        break;

#ifndef USER_BUILD
                        case 3:
                            select = 4;
                            video_set_cursor(video_get_rows()/2, 0);
                            video_printf(title_msg);
                            video_printf("[Recovery    Mode]             \n");
#ifdef MTK_FASTBOOT_SUPPORT
                            video_printf("[Fastboot    Mode]             \n");
#endif
                            video_printf("[Normal      Boot]             \n");
                            video_printf("[Normal      Boot +ftrace]     \n");
                            video_printf("[Normal      slub debug off] <<==\n");
                            
                        break;
#endif


#ifndef USER_BUILD
                        case 4:
                            select = 0;
                            video_set_cursor(video_get_rows()/2, 0);
                            video_printf(title_msg);
                            video_printf("[Recovery    Mode]         <<==\n");
#ifdef MTK_FASTBOOT_SUPPORT
                            video_printf("[Fastboot    Mode]             \n");
#endif
                            video_printf("[Normal      Boot]             \n");
                            video_printf("[Normal      Boot +ftrace]     \n");
                            video_printf("[Normal      slub debug off]     \n");                            
                        break;
#endif

                        default: 
                        break;
                    }
                    dprintf(0,  "[VOL_UP]Key Detect, current select:%d\n", select);
                    mdelay(300);
             }
			 //lingjinming modify for p210 you ni sen 2014 09 19
		      
              #if defined(P201_UNISON_KEYPAD)

			  else if(mtk_detect_key(MT65XX_BOOT_MENU_KEY))

			  #else
			  else if(pmic_detect_homekey()==1)  //lingjinming this is you li tong!!!!!
             // else if(mtk_detect_key(MT65XX_MENU_OK_KEY))//VOL_DOWN,
             #endif
             //lingjinming
             
             {
                 //use for OK
                 break;
             }
             else
             {
                //pass
             }
          }
          if(select == 0)
          {
               g_boot_mode = RECOVERY_BOOT;
          }
          else if(select == 1)
          {
                g_boot_mode = FASTBOOT;
          }
          else if(select == 2)
          {
                g_boot_mode = NORMAL_BOOT;
          }
          else if(select == 3)
          {
                sprintf(g_CMDLINE, "%s trace_buf_size=11m boot_time_ftrace", g_CMDLINE);
                g_boot_mode = NORMAL_BOOT;
          }
          else if (select == 4)
          {
                sprintf(g_CMDLINE, "%s slub_debug=-", g_CMDLINE);
                g_boot_mode = NORMAL_BOOT;
          }
          else{
                //pass
          }

          video_set_cursor(video_get_rows()/2 +8, 0);
          return;
}