XilinxProcessorIPLib/drivers/canps/src/xcanps_intr.c
s32 XCanPs_SetHandler(XCanPs *InstancePtr, u32 HandlerType,
			void *CallBackFunc, void *CallBackRef)
{
	s32 Status;
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);

	switch (HandlerType) {
		case XCANPS_HANDLER_SEND:
			InstancePtr->SendHandler =
				(XCanPs_SendRecvHandler) CallBackFunc;
			InstancePtr->SendRef = CallBackRef;
			Status = (s32)XST_SUCCESS;
			break;

		case XCANPS_HANDLER_RECV:
			InstancePtr->RecvHandler =
				(XCanPs_SendRecvHandler) CallBackFunc;
			InstancePtr->RecvRef = CallBackRef;
			Status = (s32)XST_SUCCESS;
			break;

		case XCANPS_HANDLER_ERROR:
			InstancePtr->ErrorHandler =
				(XCanPs_ErrorHandler) CallBackFunc;
			InstancePtr->ErrorRef = CallBackRef;
			Status = (s32)XST_SUCCESS;
			break;

		case XCANPS_HANDLER_EVENT:
			InstancePtr->EventHandler =
				(XCanPs_EventHandler) CallBackFunc;
			InstancePtr->EventRef = CallBackRef;
			Status = (s32)XST_SUCCESS;
			break;

		default:
			Status = (s32)XST_INVALID_PARAM;
			break;
	}
	return Status;
}
/*****************************************************************************/
/**
*
* This routine installs an asynchronous callback function for the given
* HandlerType:
*
* <pre>
* HandlerType			Callback Function Type
* -----------------------	------------------------
* XCANPS_HANDLER_SEND		XCanPs_SendRecvHandler
* XCANPS_HANDLER_RECV		XCanPs_SendRecvHandler
* XCANPS_HANDLER_ERROR		XCanPs_ErrorHandler
* XCANPS_HANDLER_EVENT		XCanPs_EventHandler
*
* HandlerType			Invoked by this driver when:
* -------------------------------------------------------------------------
* XCANPS_HANDLER_SEND		A frame transmitted by a call to
*				XCanPs_Send() has been sent successfully.
*
* XCANPS_HANDLER_RECV		A frame(s) has been received and is sitting in
*				the RX FIFO.
*
* XCANPS_HANDLER_ERROR		An error interrupt is occurring.
*
* XCANPS_HANDLER_EVENT		Any other kind of interrupt is occurring.
* </pre>
*
* @param	InstancePtr is a pointer to the XCanPs instance.
* @param	HandlerType specifies which handler 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



HandlerType                    Invoked by this driver when.

XCANPS_HANDLER_SEND            A frame transmitted by a call to
XCanPs_Send() has been sent successfully.

XCANPS_HANDLER_RECV            A frame(s) has been received and is sitting in
the RX FIFO.

XCANPS_HANDLER_ERROR           An error interrupt is occurring.

XCANPS_HANDLER_EVENT           Any other kind of interrupt is occurring.
This routine installs an asynchronous callback function for the given HandlerType . HandlerType Callback Function Type HandlerType Invoked by this driver when . XCANPS_HANDLER_SEND A frame transmitted by a call to XCanPs_Send () has been sent successfully . XCANPS_HANDLER_RECV A frame ( s ) has been received and is sitting in the RX FIFO . XCANPS_HANDLER_ERROR An error interrupt is occurring . XCANPS_HANDLER_EVENT Any other kind of interrupt is occurring .
s32 XCanPs_SetHandler(XCanPs *InstancePtr, u32 HandlerType,
			void *CallBackFunc, void *CallBackRef)
{
	s32 Status;
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	switch (HandlerType) {
		case XCANPS_HANDLER_SEND:
			InstancePtr->SendHandler =
				(XCanPs_SendRecvHandler) CallBackFunc;
			InstancePtr->SendRef = CallBackRef;
			Status = (s32)XST_SUCCESS;
			break;
		case XCANPS_HANDLER_RECV:
			InstancePtr->RecvHandler =
				(XCanPs_SendRecvHandler) CallBackFunc;
			InstancePtr->RecvRef = CallBackRef;
			Status = (s32)XST_SUCCESS;
			break;
		case XCANPS_HANDLER_ERROR:
			InstancePtr->ErrorHandler =
				(XCanPs_ErrorHandler) CallBackFunc;
			InstancePtr->ErrorRef = CallBackRef;
			Status = (s32)XST_SUCCESS;
			break;
		case XCANPS_HANDLER_EVENT:
			InstancePtr->EventHandler =
				(XCanPs_EventHandler) CallBackFunc;
			InstancePtr->EventRef = CallBackRef;
			Status = (s32)XST_SUCCESS;
			break;
		default:
			Status = (s32)XST_INVALID_PARAM;
			break;
	}
	return Status;
}
s32 XCanPs_SetHandler ( XCanPs * InstancePtr , u32 HandlerType , void * CallBackFunc , void * CallBackRef ) { s32 Status ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( InstancePtr -> IsReady == XIL_COMPONENT_IS_READY ) ; switch ( HandlerType ) { case XCANPS_HANDLER_SEND : InstancePtr -> SendHandler = ( XCanPs_SendRecvHandler ) CallBackFunc ; InstancePtr -> SendRef = CallBackRef ; Status = ( s32 ) XST_SUCCESS ; break ; case XCANPS_HANDLER_RECV : InstancePtr -> RecvHandler = ( XCanPs_SendRecvHandler ) CallBackFunc ; InstancePtr -> RecvRef = CallBackRef ; Status = ( s32 ) XST_SUCCESS ; break ; case XCANPS_HANDLER_ERROR : InstancePtr -> ErrorHandler = ( XCanPs_ErrorHandler ) CallBackFunc ; InstancePtr -> ErrorRef = CallBackRef ; Status = ( s32 ) XST_SUCCESS ; break ; case XCANPS_HANDLER_EVENT : InstancePtr -> EventHandler = ( XCanPs_EventHandler ) CallBackFunc ; InstancePtr -> EventRef = CallBackRef ; Status = ( s32 ) XST_SUCCESS ; break ; default : Status = ( s32 ) 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 :