// [before][step_0][delay_0][step_1][delay_1]......[step_n-2][delay_n-2][step_n-1][delay_n-1][after]
void DRV_lcd_open_callback(void *parg)
{
    __lcd_flow_t *flow;
    __u32 sel = (__u32)parg;
    __s32 i = lcd_flow_cnt[sel]++;

    flow = bsp_disp_lcd_get_open_flow(sel);

	if(i < flow->func_num)
    {
    	flow->func[i].func(sel);
        if(flow->func[i].delay == 0)
        {
        	DRV_lcd_open_callback((void*)sel);
        }
        else
        {
        	lcd_timer[sel].data = sel;
			lcd_timer[sel].expires = flow->func[i].delay;
			lcd_timer[sel].function = DRV_lcd_open_callback;
			add_timer(&lcd_timer[sel]);
    	}
    }
    else if(i == flow->func_num)
    {
    	bsp_disp_lcd_open_after(sel);
        lcd_op_finished[sel] = 1;
    }
}
// [before][step_0][delay_0][step_1][delay_1]......[step_n-2][delay_n-2][step_n-1][delay_n-1][after]
void DRV_lcd_open_callback(void *parg)
{
    __lcd_flow_t *flow;
    __u32 sel = (__u32)parg;
    __s32 i = lcd_flow_cnt[sel]++;

    flow = BSP_disp_lcd_get_open_flow(sel);
    __inf("lcd %d timeout=%d\n", i, flow->func[i].delay);
	if(i < flow->func_num)
    {
    	flow->func[i].func(sel);
        if(flow->func[i].delay == 0)
        {
            DRV_lcd_open_callback((void*)sel);
        }
        else
        {
            wBoot_timer_start(lcd_timer[sel], flow->func[i].delay, 0);
    	}
    }
    else if(i == flow->func_num)
    {
        BSP_disp_lcd_open_after(sel);
        lcd_op_finished[sel] = 1;
    }
}
__s32 DRV_lcd_open(__u32 sel)
{
	if(bsp_disp_lcd_used(sel))
    {
        lcd_flow_cnt[sel] = 0;
        lcd_op_finished[sel] = 0;
        lcd_op_start[sel] = 1;

        init_timer(&lcd_timer[sel]);

        bsp_disp_lcd_open_before(sel);
        DRV_lcd_open_callback((void*)sel);
    }
    return 0;
}
__s32 DRV_lcd_open(__u32 sel)
{
    lcd_flow_cnt[sel] = 0;
    lcd_op_finished[sel] = 0;
    lcd_timer[sel] = wBoot_timer_request((void*)DRV_lcd_open_callback,(void*)sel);
    if(!lcd_timer[sel])
    {
       __inf("%s wBoot_timer_request fail!\n",__FUNCTION__);
       
    }
    BSP_disp_lcd_open_before(sel);
    DRV_lcd_open_callback((void*)sel);


    return 0;
}