Ejemplo n.º 1
0
int YushanII_got_INT1(void){
	
	Ilp0100_interruptReadStatus(&pInterruptId2, INTR_PIN_1);
	pr_info("[CAM]pInterruptId2 : 0x%x",pInterruptId2);
	Ilp0100_interruptClearStatus(pInterruptId2, INTR_PIN_1);
	enable_irq(yushanII_intr1);
	return 0;
}
Ejemplo n.º 2
0
int YushanII_got_INT0(void __user *argp){
	struct yushanii_stats_event_ctrl event;
	static int got_short = 0;	

	Ilp0100_interruptReadStatus(&pInterruptId, INTR_PIN_0);
	
	event.type = pInterruptId;

	Ilp0100_interruptClearStatus(pInterruptId, INTR_PIN_0);
	enable_irq(yushanII_intr0);

	
	if (pInterruptId & START_OF_SHORTFRAME) {	
		if (g_sensor->func_tbl->sensor_yushanII_ae_updated) {
			if (g_sensor->func_tbl->sensor_yushanII_ae_updated() == 0) {
				got_short++;
				if (got_short >= 2) {
					if (g_sensor->func_tbl->sensor_yushanII_active_hold)
						g_sensor->func_tbl->sensor_yushanII_active_hold();
					got_short = 0;
				}
			}
		}
	}
	

	switch(pInterruptId){
		case SPI_COMMS_READY:
			pr_info("[CAM]%s, SPI_COMMS_READY", __func__);
			break;
		case IDLE_COMPLETE:
			pr_info("[CAM]%s,  IDLE_COMPLETE", __func__);
			break;
		case ISP_STREAMING:
			pr_info("[CAM]%s, ISP_STREAMING", __func__);
			break;
		case MODE_CHANGE_COMPLETE:
			pr_info("[CAM]%s, MODE_CHANGE_COMPLETE", __func__);
			break;
	}
	if(copy_to_user((void *)argp, &event, sizeof(struct yushanii_stats_event_ctrl))){
		pr_err("[CAM]%s, copy to user error\n", __func__);
		return -EFAULT;
	}
	return 0;
}
/*!
 * \fn 			ilp0100_error Ilp0100_interruptHandler()
 * \brief		Ilp0100 function to handle Interrupts, Checks Status Register on both the Pins.
 * 				Calls the Interrupt manager to service the Interrupt.
 * \ingroup		Platform_Functions
 * \retval		ILP0100_ERROR_NONE : Success
 * \retval		"Other Error Code" : Failure
 */
ilp0100_error Ilp0100_interruptHandler()
{
	ilp0100_error Ret= ILP0100_ERROR_NONE;
	
#ifdef ST_SPECIFIC
	bool_t Pin=INTR_PIN_0;
	uint32_t InterruptReadStatusPin0, InterruptReadStatusPin1;
#else
/* Should contain customer's variables */
#endif /*ST_SPECIFIC*/

	ILP0100_LOG_FUNCTION_START(NULL);

#ifdef ST_SPECIFIC
	//! Read the Interrupt Status Register on Pin0
	Pin=INTR_PIN_0;
	Ret= Ilp0100_interruptReadStatus(&InterruptReadStatusPin0, Pin);
	if (Ret!=ILP0100_ERROR_NONE)
	{
		ILP0100_ERROR_LOG("Ilp0100_core_interruptReadStatus failed");
		ILP0100_LOG_FUNCTION_END(Ret);
		return Ret;
	}

	//! If any Interrupt is there on Pin 0. Call Interrupt manger with Pin as Pin0.
	if(InterruptReadStatusPin0)
	{
		Ret= Ilp0100_interruptManager(InterruptReadStatusPin0, Pin);
		if (Ret!=ILP0100_ERROR_NONE)
		{
			ILP0100_ERROR_LOG("Ilp0100_interruptManagerPin0 failed");
			ILP0100_LOG_FUNCTION_END(Ret);
			return Ret;
		}
	}

	Pin=INTR_PIN_1;
	//! Read the Interrupt Status Register on Pin1
	Ret= Ilp0100_interruptReadStatus(&InterruptReadStatusPin1, Pin);
	if (Ret!=ILP0100_ERROR_NONE)
	{
		ILP0100_ERROR_LOG("Ilp0100_core_interruptReadStatus failed");
		ILP0100_LOG_FUNCTION_END(Ret);
		return Ret;
	}

	//! If any Interrupt is there on Pin 1. Call Interrupt manger with Pin as Pin1.
	if(InterruptReadStatusPin1)
	{
		Ret= Ilp0100_interruptManager(InterruptReadStatusPin1, Pin);
		if (Ret!=ILP0100_ERROR_NONE)
		{
			ILP0100_ERROR_LOG("Ilp0100_interruptManagerPin1 failed");
			ILP0100_LOG_FUNCTION_END(Ret);
			return Ret;
		}
	}

#else
/*  Should contain customer's implementation */
/*  Guidelines: */
/*  Read the interrupt status and call the interrupt manager for each identified interrupt */
/*  in order of priority */
#endif /*ST_SPECIFIC*/

	ILP0100_LOG_FUNCTION_END(Ret);
	return Ret;

}
ilp0100_error Ilp0100_interruptHandler()
{
	ilp0100_error Ret= ILP0100_ERROR_NONE;
	
#ifdef ST_SPECIFIC
	bool_t Pin=INTR_PIN_0;
	uint32_t InterruptReadStatusPin0, InterruptReadStatusPin1;
#else
#endif 

	ILP0100_LOG_FUNCTION_START(NULL);

#ifdef ST_SPECIFIC
	
	Pin=INTR_PIN_0;
	Ret= Ilp0100_interruptReadStatus(&InterruptReadStatusPin0, Pin);
	if (Ret!=ILP0100_ERROR_NONE)
	{
		ILP0100_ERROR_LOG("Ilp0100_core_interruptReadStatus failed");
		ILP0100_LOG_FUNCTION_END(Ret);
		return Ret;
	}

	
	if(InterruptReadStatusPin0)
	{
		Ret= Ilp0100_interruptManager(InterruptReadStatusPin0, Pin);
		if (Ret!=ILP0100_ERROR_NONE)
		{
			ILP0100_ERROR_LOG("Ilp0100_interruptManagerPin0 failed");
			ILP0100_LOG_FUNCTION_END(Ret);
			return Ret;
		}
	}

	Pin=INTR_PIN_1;
	
	Ret= Ilp0100_interruptReadStatus(&InterruptReadStatusPin1, Pin);
	if (Ret!=ILP0100_ERROR_NONE)
	{
		ILP0100_ERROR_LOG("Ilp0100_core_interruptReadStatus failed");
		ILP0100_LOG_FUNCTION_END(Ret);
		return Ret;
	}

	
	if(InterruptReadStatusPin1)
	{
		Ret= Ilp0100_interruptManager(InterruptReadStatusPin1, Pin);
		if (Ret!=ILP0100_ERROR_NONE)
		{
			ILP0100_ERROR_LOG("Ilp0100_interruptManagerPin1 failed");
			ILP0100_LOG_FUNCTION_END(Ret);
			return Ret;
		}
	}

#else
#endif 

	ILP0100_LOG_FUNCTION_END(Ret);
	return Ret;

}