XilinxProcessorIPLib/drivers/mcdma/src/xmcdma_intr.c
s32 XMcdma_SetCallBack(XMcdma *InstancePtr, XMcdma_Handler HandlerType,
		       void *CallBackFunc, void *CallBackRef)
{
	s32 Status;

	/* Verify arguments. */
	Xil_AssertNonvoid(CallBackFunc != NULL);
	Xil_AssertNonvoid(CallBackRef != NULL);
	Xil_AssertNonvoid((HandlerType == XMCDMA_TX_HANDLER_DONE) ||
			  (HandlerType == XMCDMA_TX_HANDLER_ERROR) ||
			  (HandlerType == XMCDMA_HANDLER_DONE) ||
			  (HandlerType == XMCDMA_HANDLER_ERROR) ||
			  (HandlerType == XMCDMA_HANDLER_PKTDROP));

	/*
	 * Calls the respective callback function corresponding to
	 * the handler type
	 */
	switch (HandlerType) {
	case XMCDMA_TX_HANDLER_DONE:
		InstancePtr->TxDoneHandler = (XMcdma_TxDoneHandler)((void *)CallBackFunc);
		InstancePtr->TxDoneRef = CallBackRef;
		Status = (XST_SUCCESS);
		break;

	case XMCDMA_TX_HANDLER_ERROR:
		InstancePtr->TxErrorHandler = (XMcdma_TxErrorHandler)((void *)CallBackFunc);
		InstancePtr->TxErrorRef = CallBackRef;
		Status = (XST_SUCCESS);
		break;

	case XMCDMA_HANDLER_DONE:
		InstancePtr->DoneHandler = (XMcdma_DoneHandler)((void *)CallBackFunc);
		InstancePtr->DoneRef = CallBackRef;
		Status = (XST_SUCCESS);
		break;

	case XMCDMA_HANDLER_ERROR:
		InstancePtr->ErrorHandler = (XMcdma_ErrorHandler)((void *)CallBackFunc);
		InstancePtr->ErrorRef = CallBackRef;
		Status = (XST_SUCCESS);
		break;

	case XMCDMA_HANDLER_PKTDROP:
		InstancePtr->PktDropHandler = (XMcdma_PktDropHandler)((void *)CallBackFunc);
		InstancePtr->PktDropRef = CallBackRef;
		Status = (XST_SUCCESS);
		break;

	default:
		Status = (XST_INVALID_PARAM);
		break;
	}

	return Status;
}
/*****************************************************************************/
/**
*
* This routine installs an asynchronous callback function for the given
* HandlerType.
*
* <pre>
* HandlerType              Callback Function Type
* -----------------------  --------------------------------------------------
* XMCDMA_TX_HANDLER_DONE   MM2S(TX) Done handler
* XMCDMA_TX_HANDLER_ERROR  MM2S(TX) Error handler
* XMCDMA_HANDLER_DONE      S2MM(RX) Done handler
* XMCDMA_HANDLER_ERROR     S2MM(RX) Error handler
* XMCDMA_HANDLER_PKTDROP   S2MM(RX) Packet drop handler
*
* </pre>
*
* @param	InstancePtr is a pointer to the XMcdma 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 routine installs an asynchronous callback function for the given
HandlerType.


HandlerType              Callback Function Type




This routine installs an asynchronous callback function for the given HandlerType . HandlerType Callback Function Type
s32 XMcdma_SetCallBack(XMcdma *InstancePtr, XMcdma_Handler HandlerType,
		       void *CallBackFunc, void *CallBackRef)
{
	s32 Status;
	Xil_AssertNonvoid(CallBackFunc != NULL);
	Xil_AssertNonvoid(CallBackRef != NULL);
	Xil_AssertNonvoid((HandlerType == XMCDMA_TX_HANDLER_DONE) ||
			  (HandlerType == XMCDMA_TX_HANDLER_ERROR) ||
			  (HandlerType == XMCDMA_HANDLER_DONE) ||
			  (HandlerType == XMCDMA_HANDLER_ERROR) ||
			  (HandlerType == XMCDMA_HANDLER_PKTDROP));
	switch (HandlerType) {
	case XMCDMA_TX_HANDLER_DONE:
		InstancePtr->TxDoneHandler = (XMcdma_TxDoneHandler)((void *)CallBackFunc);
		InstancePtr->TxDoneRef = CallBackRef;
		Status = (XST_SUCCESS);
		break;
	case XMCDMA_TX_HANDLER_ERROR:
		InstancePtr->TxErrorHandler = (XMcdma_TxErrorHandler)((void *)CallBackFunc);
		InstancePtr->TxErrorRef = CallBackRef;
		Status = (XST_SUCCESS);
		break;
	case XMCDMA_HANDLER_DONE:
		InstancePtr->DoneHandler = (XMcdma_DoneHandler)((void *)CallBackFunc);
		InstancePtr->DoneRef = CallBackRef;
		Status = (XST_SUCCESS);
		break;
	case XMCDMA_HANDLER_ERROR:
		InstancePtr->ErrorHandler = (XMcdma_ErrorHandler)((void *)CallBackFunc);
		InstancePtr->ErrorRef = CallBackRef;
		Status = (XST_SUCCESS);
		break;
	case XMCDMA_HANDLER_PKTDROP:
		InstancePtr->PktDropHandler = (XMcdma_PktDropHandler)((void *)CallBackFunc);
		InstancePtr->PktDropRef = CallBackRef;
		Status = (XST_SUCCESS);
		break;
	default:
		Status = (XST_INVALID_PARAM);
		break;
	}
	return Status;
}
s32 XMcdma_SetCallBack ( XMcdma * InstancePtr , XMcdma_Handler HandlerType , void * CallBackFunc , void * CallBackRef ) { s32 Status ; Xil_AssertNonvoid ( CallBackFunc != NULL ) ; Xil_AssertNonvoid ( CallBackRef != NULL ) ; Xil_AssertNonvoid ( ( HandlerType == XMCDMA_TX_HANDLER_DONE ) || ( HandlerType == XMCDMA_TX_HANDLER_ERROR ) || ( HandlerType == XMCDMA_HANDLER_DONE ) || ( HandlerType == XMCDMA_HANDLER_ERROR ) || ( HandlerType == XMCDMA_HANDLER_PKTDROP ) ) ; switch ( HandlerType ) { case XMCDMA_TX_HANDLER_DONE : InstancePtr -> TxDoneHandler = ( XMcdma_TxDoneHandler ) ( ( void * ) CallBackFunc ) ; InstancePtr -> TxDoneRef = CallBackRef ; Status = ( XST_SUCCESS ) ; break ; case XMCDMA_TX_HANDLER_ERROR : InstancePtr -> TxErrorHandler = ( XMcdma_TxErrorHandler ) ( ( void * ) CallBackFunc ) ; InstancePtr -> TxErrorRef = CallBackRef ; Status = ( XST_SUCCESS ) ; break ; case XMCDMA_HANDLER_DONE : InstancePtr -> DoneHandler = ( XMcdma_DoneHandler ) ( ( void * ) CallBackFunc ) ; InstancePtr -> DoneRef = CallBackRef ; Status = ( XST_SUCCESS ) ; break ; case XMCDMA_HANDLER_ERROR : InstancePtr -> ErrorHandler = ( XMcdma_ErrorHandler ) ( ( void * ) CallBackFunc ) ; InstancePtr -> ErrorRef = CallBackRef ; Status = ( XST_SUCCESS ) ; break ; case XMCDMA_HANDLER_PKTDROP : InstancePtr -> PktDropHandler = ( XMcdma_PktDropHandler ) ( ( void * ) CallBackFunc ) ; InstancePtr -> PktDropRef = CallBackRef ; Status = ( XST_SUCCESS ) ; break ; default : Status = ( XST_INVALID_PARAM ) ; break ; } return Status ; }
This routine installs an asynchronous callback function for the given
HandlerType.
This routine installs an asynchronous callback function for the given HandlerType .
/* Verify arguments. */ /*
	 * Calls the respective callback function corresponding to
	 * the handler type
	 */