/*
************************************************************************************************************
*
*                                             function
*
*    函数名称:
*
*    参数列表:
*
*    返回值  :
*
*    说明    :
*
*
************************************************************************************************************
*/
static void usb_detect_irq_handler(void *p_arg)
{
	pusb_struct pusb = &awxx_usb[0];
	__u32 temp;

	temp = usb_get_bus_interrupt_status(pusb);
	usb_clear_bus_interrupt_status(pusb, temp);
    __debug("%s,temp=%x\n",__FUNCTION__,temp);
	if(temp & 0x04) //reset babble detected,set to usb pc
	{   
		usb_clock_exit();
		wBoot_DisableInt(awxx_usb[0].irq_no);

		power_ops_int_status |= 0x08;
		wBoot_timer_stop(tmr_hd);
		wBoot_timer_release(tmr_hd);
		tmr_hd = NULL;
        __inf("usb set pc\n");
		//power_set_usbpc();

		usb_working = 0;
	}

	return;
}
Exemplo n.º 2
0
/*
************************************************************************************************************
*
*                                             function
*
*    函数名称:
*
*    参数列表:
*
*    返回值  :
*
*    说明    :
*
*
************************************************************************************************************
*/
static void usb_detect_irq_handler(void *p_arg)
{
	pusb_struct pusb = &awxx_usb[0];
	__u32 temp;

	temp = usb_get_bus_interrupt_status(pusb);
	usb_clear_bus_interrupt_status(pusb, temp);

	__inf("usb irq %x\n", temp);

	if(temp & 0x04)
	{
		usb_clock_exit();
		wBoot_DisableInt(awxx_usb[0].irq_no);
		wBoot_timer_stop(tmr_hd);
		wBoot_timer_release(tmr_hd);
		tmr_hd = NULL;
		usb_working = 0;

		//打开usb限流
		__inf("usb irq ,set pc\n");
		wBoot_power_limit_topc();
	}

	return;
}
/*
************************************************************************************************************
*
*                                             function
*
*    函数名称:
*
*    参数列表:
*
*    返回值  :
*
*    说明    :
*
*
************************************************************************************************************
*/
int sprite_led_init(void)
{
    user_gpio_set_t     gpio_init;
	int					ret;
	int					delay;

	sprite_timer_hd = wBoot_timer_request((void *)sprite_timer_func, 0);
	if(!sprite_timer_hd)
	{
		__inf("reuqest timer for led failed\n");

		return -1;
	}
	else
	{
		sprite_led_status = 1;
		ret = wBoot_script_parser_fetch("card_boot", "sprite_work_delay", (void *)&delay, 1);
		if((ret) || (!delay))
		{
			delay = 500;
		}
	}
	__inf("try gpio config\n");
	sprite_led_hd = NULL;
	memset(&gpio_init, 0, sizeof(user_gpio_set_t));
	ret = wBoot_script_parser_fetch("card_boot", "sprite_gpio0", (void *)&gpio_init, sizeof(user_gpio_set_t)>>2);
	if(!ret)
	{
		if(gpio_init.port)
		{
			sprite_led_hd = wBoot_GPIO_Request(&gpio_init, 1);
			if(!sprite_led_hd)
			{
				__inf("reuqest gpio for led failed\n");

				goto _led_err;
			}
			__inf("gpio start\n");
			wBoot_timer_start(sprite_timer_hd, delay, 1);	//初始1000ms翻转一次,重复显示

			return 0;
		}
	}
	__inf("try codec config\n");
	codec_init();
	codec_led_hd = codec_play();
	wBoot_timer_start(sprite_timer_hd, delay, 1);	//初始1000ms翻转一次,重复显示

	return 0;


_led_err:
	if(sprite_timer_hd)
	{
		wBoot_timer_release(sprite_timer_hd);
	}

	return -1;
}
/*
****************************************************************************************************
*
*             DRV_DE_EXIT
*
*  Description: 卸载驱动,通常把只会执行一次的操作放在这里
*               当驱动退出的时候会调用这个这个函数
*               卸载函数没有参数
*  Parameters:
*
*  Return value:
*       0
*       -1
****************************************************************************************************
*/
__s32 DRV_DE_EXIT(void)
{
    if(lcd_op_finished[0] && lcd_timer[0] != NULL)
    {
        wBoot_timer_release(lcd_timer[0]);
        lcd_timer[0] = NULL;
    }
    if(lcd_op_finished[1] && lcd_timer[1] != NULL)
    {
        wBoot_timer_release(lcd_timer[1]);
        lcd_timer[1] = NULL;
    }

    BSP_disp_exit(exit_mode);

    return 0;
}
__bool DRV_lcd_check_open_finished(__u32 sel)
{
    if(lcd_op_finished[sel] && lcd_timer[sel] != NULL)
    {
        wBoot_timer_release(lcd_timer[sel]);
        lcd_timer[sel] = NULL;
    }
    return lcd_op_finished[sel];
}
/*
************************************************************************************************************
*
*                                             function
*
*    函数名称:
*
*    参数列表:
*
*    返回值  :
*
*    说明    :
*
*
************************************************************************************************************
*/
__u32 usb_detect_exit(void)
{
	__inf("usb exit detect\n");
	usb_working = 0;
	usb_clock_exit();
	wBoot_DisableInt(awxx_usb[0].irq_no);
	if(tmr_hd)
	{
		wBoot_timer_stop(tmr_hd);
		wBoot_timer_release(tmr_hd);
		tmr_hd = NULL;
	}

	return 0;
}