文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>download mode detect_factory mode detect

download mode detect_factory mode detect

时间:2010-10-14  来源:xxha000721

手机开机时,通常把vol_up 和vol_down按键设置为进入下载模式和出厂启动模式进入键。 按键探测程序 check_flashkey();  

void check_flashkey(int *upgradesw, int *time_count_enable, powerup_reason_t *key_to_factory)
{
#if N80
    u8 val;
    if( (*(volatile unsigned int *)(GPIO0_BASE)) & BIT16 ){ //GPIO16 =1

            AddMessage((UINT8_T*) ("FlashMode key press!!\0"));
            *time_count_enable = 0;
            *upgradesw = 1;
    }
    else if ( (*(volatile unsigned int *)(GPIO0_BASE)) & BIT18 ){ //GPIO18 =1

            AddMessage((UINT8_T*) ("FactoryMode key press!!\0"));
            *key_to_factory = 1;
    }
#elif N8561 || TD920
    u8 val;
    sanremo_read( 0x28, &val );
    val |= 0x1011;
    printf(NULL, "val = %x.", val);
    sanremo_write( 0x28, val );
    Delay_us(100);
    if( (*(volatile unsigned int *)(GPIO0_BASE)) & BIT24 ){ //MMC1_DAT7 VOL_DOWN

            AddMessage((UINT8_T*) ("FlashMode key press!!\0"));
            *time_count_enable = 0;
            *upgradesw = 1;
    }
    else if ( (*(volatile unsigned int *)(GPIO3_BASE)) & BIT3 ){ //MMC1_WP VOL_UP

            AddMessage((UINT8_T*) ("FactoryMode key press!!\0"));
            *key_to_factory = 1;
    }
#elif TAHITI
/*config keypad_gpio*/
    (*(volatile unsigned int *)(GPIO_FUN_CTRL_00)) = 0x1;
    (*(volatile unsigned int *)(GPIO_FUN_CTRL_01)) = 0x1;
    (*(volatile unsigned int *)(GPIO_FUN_CTRL_02)) = 0x1;
    (*(volatile unsigned int *)(GPIO_FUN_CTRL_03)) = 0x1;
    (*(volatile unsigned int *)(GPIO_FUN_CTRL_04)) = 0x1;
    (*(volatile unsigned int *)(GPIO_FUN_CTRL_05)) = 0x1;
    (*(volatile unsigned int *)(GPIO_FUN_CTRL_06)) = 0x1;
    (*(volatile unsigned int *)(GPIO_FUN_CTRL_07)) = 0x1;
    (*(volatile unsigned int *)(GPIO_FUN_CTRL_08)) = 0x1;
    (*(volatile unsigned int *)(GPIO_FUN_CTRL_09)) = 0x1;
    (*(volatile unsigned int *)(GPIO_FUN_CTRL_10)) = 0x1;
    (*(volatile unsigned int *)(GPIO_FUN_CTRL_11)) = 0x1;
/* (*(volatile unsigned int *)(GPIO_FUN_CTRL_12)) = 0x1; */
    (*(volatile unsigned int *)(GPIO_FUN_CTRL_13)) = 0x1;
/*config keypwd_control reg*/
    unsigned int scan_value ;
    (*(volatile unsigned int *)(KEYPAD_ENABLE)) |= BIT2;
    (*(volatile unsigned int *)(KEYPAD_ENABLE)) &= ~BIT2;
    (*(volatile unsigned int *)(KEYPAD_ENABLE)) |= (BIT0 | BIT1 |BIT4);
/*config keypad control register*/
    (*(volatile unsigned int *)(KEYPAD_CTRL)) = 0x371FF800;
/* wake_up clean*/
    (*(volatile unsigned int *)(KEYPAD_WAKE)) |= BIT3;
    (*(volatile unsigned int *)(KEYPAD_WAKE)) &= ~BIT3;
/*read scan register */
    scan_value = (*(volatile unsigned int *)(KEYPAD_SCAN));
    printf_a(scan_value);
    
    if(((*(volatile unsigned int *)(KEYPAD_SCAN)) & 0xFF) == 0x13){
        *time_count_enable = 0;
        *upgradesw = 1;
        AddMessage((UINT8_T*) (" TAHITI Flash key press!!\0"));
    }
    else if(((*(volatile unsigned int *)(KEYPAD_SCAN)) & 0xFF) == 0x00){
    AddMessage((UINT8_T*) ("FactoryMode key press!!\0"));
        *key_to_factory = 1;
    }
#else
    if(0){
    ;
    }
#endif
   else{
        AddMessage((UINT8_T*) ("No key press!!\0"));
        *upgradesw = 0;
    *key_to_factory = 0;
    }
}


相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载