XilinxProcessorIPLib/drivers/dp14/src/xdp_intr.c
int XDp_TxSetCallback(XDp *InstancePtr,	XDp_Tx_HandlerType HandlerType,
			XDp_IntrHandler CallbackFunc, void *CallbackRef)
{
	/* Verify arguments. */
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(XDp_GetCoreType(InstancePtr) == XDP_TX);
	Xil_AssertNonvoid(HandlerType < XDP_TX_NUM_HANDLERS);
	Xil_AssertNonvoid(CallbackFunc != NULL);
	Xil_AssertNonvoid(CallbackRef != NULL);

	u32 Status;

	switch (HandlerType)
	{
	case XDP_TX_HANDLER_SETMSA:
        InstancePtr->TxInstance.TxSetMsaCallback = CallbackFunc;
        InstancePtr->TxInstance.TxMsaCallbackRef = CallbackRef;
		Status = XST_SUCCESS;
		break;

	case XDP_TX_HANDLER_HPDEVENT:
		InstancePtr->TxInstance.HpdEventHandler = CallbackFunc;
		InstancePtr->TxInstance.HpdEventCallbackRef = CallbackRef;
		Status = XST_SUCCESS;
		break;

	case XDP_TX_HANDLER_DRV_HPDEVENT:
		InstancePtr->TxInstance.DrvHpdEventHandler = CallbackFunc;
		InstancePtr->TxInstance.DrvHpdEventCallbackRef = CallbackRef;
		Status = XST_SUCCESS;
		break;

	case XDP_TX_HANDLER_HPDPULSE:
		InstancePtr->TxInstance.HpdPulseHandler = CallbackFunc;
		InstancePtr->TxInstance.HpdPulseCallbackRef = CallbackRef;
		Status = XST_SUCCESS;
		break;

	case XDP_TX_HANDLER_DRV_HPDPULSE:
		InstancePtr->TxInstance.DrvHpdPulseHandler = CallbackFunc;
		InstancePtr->TxInstance.DrvHpdPulseCallbackRef = CallbackRef;
		Status = XST_SUCCESS;
		break;

	case XDP_TX_HANDLER_LANECNTCHANGE:
		InstancePtr->TxInstance.LaneCountChangeCallback = CallbackFunc;
		InstancePtr->TxInstance.LaneCountChangeCallbackRef = CallbackRef;
		Status = XST_SUCCESS;
		break;

	case XDP_TX_HANDLER_LINKRATECHANGE:
		InstancePtr->TxInstance.LinkRateChangeCallback = CallbackFunc;
		InstancePtr->TxInstance.LinkRateChangeCallbackRef = CallbackRef;
		Status = XST_SUCCESS;
		break;

	case XDP_TX_HANDLER_PEVSADJUST:
		InstancePtr->TxInstance.PeVsAdjustCallback = CallbackFunc;
		InstancePtr->TxInstance.PeVsAdjustCallbackRef = CallbackRef;
		Status = XST_SUCCESS;
		break;

	case XDP_TX_HANDLER_EXTPKT_TXD:
		InstancePtr->TxInstance.ExtPktCallbackHandler = CallbackFunc;
		InstancePtr->TxInstance.ExtPktCallbackHandlerRef = CallbackRef;
		Status = XST_SUCCESS;
		break;

	case XDP_TX_HANDLER_DRV_EXTPKT_TXD:
		InstancePtr->TxInstance.DrvExtPktCallbackHandler = CallbackFunc;
		InstancePtr->TxInstance.DrvExtPktCallbackHandlerRef = CallbackRef;
		Status = XST_SUCCESS;
		break;

	case XDP_TX_HANDLER_VSYNC:
		InstancePtr->TxInstance.VsyncCallbackHandler = CallbackFunc;
		InstancePtr->TxInstance.VsyncCallbackHandlerRef = CallbackRef;
		Status = XST_SUCCESS;
		break;

	default:
		Status = XST_INVALID_PARAM;
		break;

	}

	return Status;
}
/*****************************************************************************/
/**
* This function installs callback functions for the given
* HandlerType:
*
* @param	InstancePtr is a pointer to the DP core instance.
* @param	HandlerType specifies the type of handler.
* @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 if callback function installed successfully.
*		- 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 callback functions for the given
HandlerType.
This function installs callback functions for the given HandlerType .
int XDp_TxSetCallback(XDp *InstancePtr,	XDp_Tx_HandlerType HandlerType,
			XDp_IntrHandler CallbackFunc, void *CallbackRef)
{
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(XDp_GetCoreType(InstancePtr) == XDP_TX);
	Xil_AssertNonvoid(HandlerType < XDP_TX_NUM_HANDLERS);
	Xil_AssertNonvoid(CallbackFunc != NULL);
	Xil_AssertNonvoid(CallbackRef != NULL);
	u32 Status;
	switch (HandlerType)
	{
	case XDP_TX_HANDLER_SETMSA:
        InstancePtr->TxInstance.TxSetMsaCallback = CallbackFunc;
        InstancePtr->TxInstance.TxMsaCallbackRef = CallbackRef;
		Status = XST_SUCCESS;
		break;
	case XDP_TX_HANDLER_HPDEVENT:
		InstancePtr->TxInstance.HpdEventHandler = CallbackFunc;
		InstancePtr->TxInstance.HpdEventCallbackRef = CallbackRef;
		Status = XST_SUCCESS;
		break;
	case XDP_TX_HANDLER_DRV_HPDEVENT:
		InstancePtr->TxInstance.DrvHpdEventHandler = CallbackFunc;
		InstancePtr->TxInstance.DrvHpdEventCallbackRef = CallbackRef;
		Status = XST_SUCCESS;
		break;
	case XDP_TX_HANDLER_HPDPULSE:
		InstancePtr->TxInstance.HpdPulseHandler = CallbackFunc;
		InstancePtr->TxInstance.HpdPulseCallbackRef = CallbackRef;
		Status = XST_SUCCESS;
		break;
	case XDP_TX_HANDLER_DRV_HPDPULSE:
		InstancePtr->TxInstance.DrvHpdPulseHandler = CallbackFunc;
		InstancePtr->TxInstance.DrvHpdPulseCallbackRef = CallbackRef;
		Status = XST_SUCCESS;
		break;
	case XDP_TX_HANDLER_LANECNTCHANGE:
		InstancePtr->TxInstance.LaneCountChangeCallback = CallbackFunc;
		InstancePtr->TxInstance.LaneCountChangeCallbackRef = CallbackRef;
		Status = XST_SUCCESS;
		break;
	case XDP_TX_HANDLER_LINKRATECHANGE:
		InstancePtr->TxInstance.LinkRateChangeCallback = CallbackFunc;
		InstancePtr->TxInstance.LinkRateChangeCallbackRef = CallbackRef;
		Status = XST_SUCCESS;
		break;
	case XDP_TX_HANDLER_PEVSADJUST:
		InstancePtr->TxInstance.PeVsAdjustCallback = CallbackFunc;
		InstancePtr->TxInstance.PeVsAdjustCallbackRef = CallbackRef;
		Status = XST_SUCCESS;
		break;
	case XDP_TX_HANDLER_EXTPKT_TXD:
		InstancePtr->TxInstance.ExtPktCallbackHandler = CallbackFunc;
		InstancePtr->TxInstance.ExtPktCallbackHandlerRef = CallbackRef;
		Status = XST_SUCCESS;
		break;
	case XDP_TX_HANDLER_DRV_EXTPKT_TXD:
		InstancePtr->TxInstance.DrvExtPktCallbackHandler = CallbackFunc;
		InstancePtr->TxInstance.DrvExtPktCallbackHandlerRef = CallbackRef;
		Status = XST_SUCCESS;
		break;
	case XDP_TX_HANDLER_VSYNC:
		InstancePtr->TxInstance.VsyncCallbackHandler = CallbackFunc;
		InstancePtr->TxInstance.VsyncCallbackHandlerRef = CallbackRef;
		Status = XST_SUCCESS;
		break;
	default:
		Status = XST_INVALID_PARAM;
		break;
	}
	return Status;
}
int XDp_TxSetCallback ( XDp * InstancePtr , XDp_Tx_HandlerType HandlerType , XDp_IntrHandler CallbackFunc , void * CallbackRef ) { Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( XDp_GetCoreType ( InstancePtr ) == XDP_TX ) ; Xil_AssertNonvoid ( HandlerType < XDP_TX_NUM_HANDLERS ) ; Xil_AssertNonvoid ( CallbackFunc != NULL ) ; Xil_AssertNonvoid ( CallbackRef != NULL ) ; u32 Status ; switch ( HandlerType ) { case XDP_TX_HANDLER_SETMSA : InstancePtr -> TxInstance . TxSetMsaCallback = CallbackFunc ; InstancePtr -> TxInstance . TxMsaCallbackRef = CallbackRef ; Status = XST_SUCCESS ; break ; case XDP_TX_HANDLER_HPDEVENT : InstancePtr -> TxInstance . HpdEventHandler = CallbackFunc ; InstancePtr -> TxInstance . HpdEventCallbackRef = CallbackRef ; Status = XST_SUCCESS ; break ; case XDP_TX_HANDLER_DRV_HPDEVENT : InstancePtr -> TxInstance . DrvHpdEventHandler = CallbackFunc ; InstancePtr -> TxInstance . DrvHpdEventCallbackRef = CallbackRef ; Status = XST_SUCCESS ; break ; case XDP_TX_HANDLER_HPDPULSE : InstancePtr -> TxInstance . HpdPulseHandler = CallbackFunc ; InstancePtr -> TxInstance . HpdPulseCallbackRef = CallbackRef ; Status = XST_SUCCESS ; break ; case XDP_TX_HANDLER_DRV_HPDPULSE : InstancePtr -> TxInstance . DrvHpdPulseHandler = CallbackFunc ; InstancePtr -> TxInstance . DrvHpdPulseCallbackRef = CallbackRef ; Status = XST_SUCCESS ; break ; case XDP_TX_HANDLER_LANECNTCHANGE : InstancePtr -> TxInstance . LaneCountChangeCallback = CallbackFunc ; InstancePtr -> TxInstance . LaneCountChangeCallbackRef = CallbackRef ; Status = XST_SUCCESS ; break ; case XDP_TX_HANDLER_LINKRATECHANGE : InstancePtr -> TxInstance . LinkRateChangeCallback = CallbackFunc ; InstancePtr -> TxInstance . LinkRateChangeCallbackRef = CallbackRef ; Status = XST_SUCCESS ; break ; case XDP_TX_HANDLER_PEVSADJUST : InstancePtr -> TxInstance . PeVsAdjustCallback = CallbackFunc ; InstancePtr -> TxInstance . PeVsAdjustCallbackRef = CallbackRef ; Status = XST_SUCCESS ; break ; case XDP_TX_HANDLER_EXTPKT_TXD : InstancePtr -> TxInstance . ExtPktCallbackHandler = CallbackFunc ; InstancePtr -> TxInstance . ExtPktCallbackHandlerRef = CallbackRef ; Status = XST_SUCCESS ; break ; case XDP_TX_HANDLER_DRV_EXTPKT_TXD : InstancePtr -> TxInstance . DrvExtPktCallbackHandler = CallbackFunc ; InstancePtr -> TxInstance . DrvExtPktCallbackHandlerRef = CallbackRef ; Status = XST_SUCCESS ; break ; case XDP_TX_HANDLER_VSYNC : InstancePtr -> TxInstance . VsyncCallbackHandler = CallbackFunc ; InstancePtr -> TxInstance . VsyncCallbackHandlerRef = CallbackRef ; Status = XST_SUCCESS ; break ; default : Status = XST_INVALID_PARAM ; break ; } return Status ; }
This function installs callback functions for the given
HandlerType:
This function installs callback functions for the given HandlerType :
/* Verify arguments. */