Beispiel #1
0
/*****************************************************************************
 函 数 名  : power_off_timeout_isr
 功能描述  : 开机定时器处理,检测C核状态
 输入参数  :
 输出参数  : 无
 返 回 值  :
 调用函数  :
 被调函数  :
*****************************************************************************/
static int power_on_timeout_isr( void )
{
    c_power_st_e status = POWER_OS_OK;
    DRV_RUN_MODE run_mode = get_run_mode();

    pr_dbg("power_on_timeout_isr, system had been powered one minute ago\n ");

#if (MBB_CHARGE == FEATURE_ON)
    if(chg_is_powdown_charging())
    {
        pr_dbg("CHG:no need to check c core status!\n ");
        return 0;
    }
#endif /*MBB_CHG_PLATFORM_V7R2*/

    if(RUN_MODE_NORMAL == run_mode)
    {
        /* 读取C核启动状态 */
        status = power_on_c_status_get();

#if defined(DRV_BUILD_SEPARATE)
        /* C核异常,设置normal模式启动失败 */
        if(status < POWER_BSP_OK)
#else
        if(status < POWER_MSP_OK)
#endif
        {
           pr_dbg("c core power on fail!\n ");
           /* 进入recovery模式 */
           bsp_drv_power_reboot();

           /* coverity[no_escape] */
           for(;;) ;
        }
    }
    else if(RUN_MODE_RECOVERY == run_mode){
        /* for test */
       #if 0
           bsp_drv_power_reboot();
           /* 等待系统重启 */
           while(1);
       #endif
    }

    pr_dbg("system power on ok!\n ");

    /* clear warm boot cnt */
    power_on_wdt_cnt_set();

    (void)bsp_softtimer_free(&power_item_info.on_timer);

    return 0;
}
/******************************************************************************
*  Function:  bsp_drv_power_reboot
*  Description: same as drv_power_off, the public API
*  Input:
*         None
*  Output:
*         None
*  Return:
*         None
*  Note  : 应用调用重启时调用,at+cfun=6
********************************************************************************/
void bsp_drv_power_reboot( void )
{
#ifndef HI_ONOFF_PHONE
    /*Set shutdown reason to reset.*/
    power_off_ctrl.reason = DRV_SHUTDOWN_RESET;

    pr_dbg( "power reboot process triggered \n");
    power_off_log_save();

    power_on_wdt_cnt_set();

    power_off_set_flag_and_reboot((power_off_reboot_flag)(power_off_ctrl.reason));
#else
    printk(KERN_ERR"bsp_drv_power_reboot_direct is called, modem reset...\n");

    bsp_modem_reset();
#endif
}
/******************************************************************************
*  Function:  bsp_drv_power_reboot
*  Description: same as drv_power_off, the public API
*  Input:
*         None
*  Output:
*         None
*  Return:
*         None
*  Note  : 应用调用重启时调用,at+cfun=6
********************************************************************************/
void bsp_drv_power_reboot( void )
{
#ifdef CONFIG_BALONG_ONOFF
    /*Set shutdown reason to reset.*/
    power_off_ctrl.reason = DRV_SHUTDOWN_RESET;

    pr_dbg( "power reboot process triggered \n");
    //power_off_log_save();

    power_on_wdt_cnt_set();

    power_off_set_flag_and_reboot((power_off_reboot_flag)(power_off_ctrl.reason));
#else
    printk(KERN_ERR"bsp_drv_power_reboot is called, modem reset...\n");

    system_error(DRV_ERROR_USER_RESET, 0, 0, NULL, 0);
#endif
}