XilinxProcessorIPLib/drivers/tpg/src/xtpg_intr.c
int XTpg_SetCallBack(XTpg *InstancePtr, u32 HandlerType,
			void *CallBackFunc, void *CallBackRef)
{
	int Status;

	/* Verify arguments. */
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady ==
				(u32)(XIL_COMPONENT_IS_READY));
	Xil_AssertNonvoid(CallBackFunc != NULL);
	Xil_AssertNonvoid(CallBackRef != NULL);
	Xil_AssertNonvoid((HandlerType >= XTPG_HANDLER_PROCSTART) &&
				(HandlerType <= XTPG_HANDLER_ERROR));

	/* Setting the handlerType */
	switch (HandlerType) {
		case XTPG_HANDLER_PROCSTART:
			InstancePtr->ProcStartCallBack =
					(XTpg_CallBack)((void *)CallBackFunc);
			InstancePtr->ProcStartRef = CallBackRef;
			Status = (XST_SUCCESS);
			break;

		case XTPG_HANDLER_FRAMEDONE:
			InstancePtr->FrameDoneCallBack =
					(XTpg_CallBack)((void *)CallBackFunc);
			InstancePtr->FrameDoneRef = CallBackRef;
			Status = (XST_SUCCESS);
			break;

		case XTPG_HANDLER_ERROR:
			InstancePtr->ErrCallBack =
				(XTpg_ErrorCallBack)((void *)CallBackFunc);
			InstancePtr->ErrRef = CallBackRef;
			Status = (XST_SUCCESS);
			break;

		default:
			Status = (XST_INVALID_PARAM);
			break;
	}

	return Status;
}
/*****************************************************************************/
/**
*
* This function installs an asynchronous callback function for the given
* HandlerType.
*
* <pre>
* HandlerType              Callback Function Type
* -----------------------  ----------------------
* XTPG_HANDLER_FRAMEDONE   FrameDoneCallBack
* XTPG_HANDLER_PROCSTART   ProcStartCallBack
* XTPG_HANDLER_ERROR       ErrCallBack
*
* </pre>
*
* @param	InstancePtr is a pointer to the XTpg instance to be worked on.
* @param	HandlerType specifies which callback is to be attached.
* @param	CallBackFunc is the address of the callback function.
* @param	CallBackRef is a user data item that will be passed to the
* 		callback function when it is invoked.
*
* @return
*		- XST_SUCCESS when handler is installed.
*		- XST_INVALID_PARAM when HandlerType is invalid.
*
* @note		Invoking this function for a handler that already has been
* 		installed replaces it with the new handler.
*
******************************************************************************/
This function installs an asynchronous callback function for the given
HandlerType.


HandlerType              Callback Function Type




This function installs an asynchronous callback function for the given HandlerType . HandlerType Callback Function Type
int XTpg_SetCallBack(XTpg *InstancePtr, u32 HandlerType,
			void *CallBackFunc, void *CallBackRef)
{
	int Status;
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady ==
				(u32)(XIL_COMPONENT_IS_READY));
	Xil_AssertNonvoid(CallBackFunc != NULL);
	Xil_AssertNonvoid(CallBackRef != NULL);
	Xil_AssertNonvoid((HandlerType >= XTPG_HANDLER_PROCSTART) &&
				(HandlerType <= XTPG_HANDLER_ERROR));
	switch (HandlerType) {
		case XTPG_HANDLER_PROCSTART:
			InstancePtr->ProcStartCallBack =
					(XTpg_CallBack)((void *)CallBackFunc);
			InstancePtr->ProcStartRef = CallBackRef;
			Status = (XST_SUCCESS);
			break;
		case XTPG_HANDLER_FRAMEDONE:
			InstancePtr->FrameDoneCallBack =
					(XTpg_CallBack)((void *)CallBackFunc);
			InstancePtr->FrameDoneRef = CallBackRef;
			Status = (XST_SUCCESS);
			break;
		case XTPG_HANDLER_ERROR:
			InstancePtr->ErrCallBack =
				(XTpg_ErrorCallBack)((void *)CallBackFunc);
			InstancePtr->ErrRef = CallBackRef;
			Status = (XST_SUCCESS);
			break;
		default:
			Status = (XST_INVALID_PARAM);
			break;
	}
	return Status;
}
int XTpg_SetCallBack ( XTpg * InstancePtr , u32 HandlerType , void * CallBackFunc , void * CallBackRef ) { int Status ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( InstancePtr -> IsReady == ( u32 ) ( XIL_COMPONENT_IS_READY ) ) ; Xil_AssertNonvoid ( CallBackFunc != NULL ) ; Xil_AssertNonvoid ( CallBackRef != NULL ) ; Xil_AssertNonvoid ( ( HandlerType >= XTPG_HANDLER_PROCSTART ) && ( HandlerType <= XTPG_HANDLER_ERROR ) ) ; switch ( HandlerType ) { case XTPG_HANDLER_PROCSTART : InstancePtr -> ProcStartCallBack = ( XTpg_CallBack ) ( ( void * ) CallBackFunc ) ; InstancePtr -> ProcStartRef = CallBackRef ; Status = ( XST_SUCCESS ) ; break ; case XTPG_HANDLER_FRAMEDONE : InstancePtr -> FrameDoneCallBack = ( XTpg_CallBack ) ( ( void * ) CallBackFunc ) ; InstancePtr -> FrameDoneRef = CallBackRef ; Status = ( XST_SUCCESS ) ; break ; case XTPG_HANDLER_ERROR : InstancePtr -> ErrCallBack = ( XTpg_ErrorCallBack ) ( ( void * ) CallBackFunc ) ; InstancePtr -> ErrRef = CallBackRef ; Status = ( XST_SUCCESS ) ; break ; default : Status = ( XST_INVALID_PARAM ) ; break ; } return Status ; }
This function installs an asynchronous callback function for the given
HandlerType.
This function installs an asynchronous callback function for the given HandlerType .
/* Verify arguments. */ /* Setting the handlerType */