/*!
 * \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;

}