Ejemplo n.º 1
0
/*
*********************************************************************************************************
*                           aw_pm_enter
*
*Description: Enter the system sleep state;
*
*Arguments  : state     system sleep state;
*
*Return     : return 0 is process successed;
*
*Notes      : this function is the core function for platform sleep.
*********************************************************************************************************
*/
static int aw_pm_enter(suspend_state_t state)
{
//  asm volatile ("stmfd sp!, {r1-r12, lr}" );
    normal_standby_func standby;
    
    PM_DBG("enter state %d\n", state);

    if(unlikely(debug_mask&PM_STANDBY_PRINT_REG)){
        printk("after cpu suspend , line:%d\n", __LINE__);
        show_reg(SW_VA_CCM_IO_BASE, (CCU_REG_LENGTH)*4, "ccu");
        show_reg(SW_VA_PORTC_IO_BASE, GPIO_REG_LENGTH*4, "gpio");
        show_reg(SW_VA_TIMERC_IO_BASE, TMR_REG_LENGTH*4, "timer");
        show_reg(SW_VA_TWI0_IO_BASE, TWI0_REG_LENGTH*4, "twi0");
        show_reg(SW_VA_SRAM_IO_BASE, SRAM_REG_LENGTH*4, "sram");
        if (userdef_reg_addr != 0 && userdef_reg_size != 0)
        {
            show_reg(userdef_reg_addr, userdef_reg_size*4, "user defined");
        }
    }

    standby_info.standby_para.axp_enable = standby_axp_enable;
    
    if(NORMAL_STANDBY== standby_type){
        standby = (int (*)(struct aw_pm_info *arg))SRAM_FUNC_START;
        //move standby code to sram
        memcpy((void *)SRAM_FUNC_START, (void *)&standby_bin_start, (int)&standby_bin_end - (int)&standby_bin_start);
        /* config system wakeup evetn type */
        if(PM_SUSPEND_MEM == state || PM_SUSPEND_STANDBY == state){
            standby_info.standby_para.axp_src = AXP_MEM_WAKEUP;
        }else if(PM_SUSPEND_BOOTFAST == state){
            standby_info.standby_para.axp_src = AXP_BOOTFAST_WAKEUP;
        }
        standby_info.standby_para.event_enable = (SUSPEND_WAKEUP_SRC_EXINT | SUSPEND_WAKEUP_SRC_ALARM);

        if (standby_timeout != 0)
        {
            standby_info.standby_para.event_enable |= (SUSPEND_WAKEUP_SRC_TIMEOFF);
            standby_info.standby_para.time_off = standby_timeout;
        }
        /* goto sram and run */
        printk("standby_mode:%d, standby_type:%d, line:%d\n",standby_mode, standby_type, __LINE__);
        standby(&standby_info);
        printk("standby_mode:%d, standby_type:%d, line:%d\n",standby_mode, standby_type, __LINE__);
    }else if(SUPER_STANDBY == standby_type){
        printk("standby_mode:%d, standby_type:%d, line:%d\n",standby_mode, standby_type, __LINE__);
            print_call_info();
            aw_super_standby(state);    
    }
    pm_enable_watchdog();
    print_call_info();

    if(unlikely(debug_mask&PM_STANDBY_PRINT_REG)){
        printk("after cpu suspend , line:%d\n", __LINE__);
        show_reg(SW_VA_CCM_IO_BASE, (CCU_REG_LENGTH)*4, "ccu");
        show_reg(SW_VA_PORTC_IO_BASE, GPIO_REG_LENGTH*4, "gpio");
        show_reg(SW_VA_TIMERC_IO_BASE, TMR_REG_LENGTH*4, "timer");
        show_reg(SW_VA_TWI0_IO_BASE, TWI0_REG_LENGTH*4, "twi0");
        show_reg(SW_VA_SRAM_IO_BASE, SRAM_REG_LENGTH*4, "sram");
        if (userdef_reg_addr != 0 && userdef_reg_size != 0)
        {
            show_reg(userdef_reg_addr, userdef_reg_size*4, "user defined");
        }
    }
//  asm volatile ("ldmfd sp!, {r1-r12, lr}" );
    return 0;
}
Ejemplo n.º 2
0
void pm_wd_enable(void)
{
	pm_enable_watchdog();
}