XilinxProcessorIPLib/drivers/hdcp22_tx_dp/src/xhdcp22_tx.c
int XHdcp22Tx_SetCallback(XHdcp22_Tx *InstancePtr, XHdcp22_Tx_HandlerType HandlerType, void *CallbackFunc, void *CallbackRef)
{
	/* Verify arguments. */
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(HandlerType > (XHDCP22_TX_HANDLER_UNDEFINED));
	Xil_AssertNonvoid(HandlerType < (XHDCP22_TX_HANDLER_INVALID));
	Xil_AssertNonvoid(CallbackFunc != NULL);
	Xil_AssertNonvoid(CallbackRef != NULL);

	u32 Status;

	/* Check for handler type */
	switch (HandlerType)
	{
		// DDC write
		case (XHDCP22_TX_HANDLER_DDC_WRITE):
			InstancePtr->DdcWrite = (XHdcp22_Tx_DdcHandler)CallbackFunc;
			InstancePtr->DdcHandlerRef = CallbackRef;
			InstancePtr->IsDdcWriteSet = (TRUE);
			Status = (XST_SUCCESS);
			break;

		// DDC read
		case (XHDCP22_TX_HANDLER_DDC_READ):
			InstancePtr->DdcRead = (XHdcp22_Tx_DdcHandler)CallbackFunc;
			InstancePtr->DdcHandlerRef = CallbackRef;
			InstancePtr->IsDdcReadSet = (TRUE);
			Status = (XST_SUCCESS);
			break;

		// Authenticated
		case (XHDCP22_TX_HANDLER_AUTHENTICATED):
			InstancePtr->AuthenticatedCallback = (XHdcp22_Tx_Callback)CallbackFunc;
			InstancePtr->AuthenticatedCallbackRef = CallbackRef;
			InstancePtr->IsAuthenticatedCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;

		// Authentication failed
		case (XHDCP22_TX_HANDLER_UNAUTHENTICATED):
			InstancePtr->UnauthenticatedCallback = (XHdcp22_Tx_Callback)CallbackFunc;
			InstancePtr->UnauthenticatedCallbackRef = CallbackRef;
			InstancePtr->IsUnauthenticatedCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;

		// Downstream topology is available
		case (XHDCP22_TX_HANDLER_DOWNSTREAM_TOPOLOGY_AVAILABLE) :
			InstancePtr->DownstreamTopologyAvailableCallback = (XHdcp22_Tx_Callback)CallbackFunc;
			InstancePtr->DownstreamTopologyAvailableCallbackRef = CallbackRef;
			InstancePtr->IsDownstreamTopologyAvailableCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;
		case (XHDCP22_TX_HANDLER_DP_AUX_READ):
			InstancePtr->TxDpAuxReadCallback =
				(Xhdcp22_Tx_RdWrHandler)CallbackFunc;
			InstancePtr->TxDpAuxReadCallbackRef = CallbackRef;
			InstancePtr->IsTxDpAuxReadCallbackSet = (TRUE);
			break;
		case (XHDCP22_TX_HANDLER_DP_AUX_WRITE):
			InstancePtr->TxDpAuxWriteCallback =
				(Xhdcp22_Tx_RdWrHandler)CallbackFunc;
			InstancePtr->TxDpAuxWriteCallbackRef = CallbackRef;
			InstancePtr->IsTxDpAuxWriteCallbackSet = (TRUE);
			break;
		default:
			Status = (XST_INVALID_PARAM);
			break;
	}

	return Status;
}
/*****************************************************************************/
/**
*
* This function installs callback functions for the given
* HandlerType:
*
* <pre>
* HandlerType                                        Callback Function Type
* -------------------------                          ---------------------------
* (XHDCP22_TX_HANDLER_DDC_WRITE)                     DdcWrite
* (XHDCP22_TX_HANDLER_DDC_READ)                      DdcRead
* (XHDCP22_TX_HANDLER_AUTHENTICATED)                 AuthenticatedCallback
* (XHDCP22_TX_HANDLER_UNAUTHENTICATED)               UnauthenticatedCallback
* (XHDCP22_TX_HANDLER_DOWNSTREAM_TOPOLOGY_AVAILABLE) DownstreamTopologyAvailableCallback
* </pre>
*
* @param	InstancePtr is a pointer to the HDMI RX 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.


HandlerType                                        Callback Function Type


This function installs callback functions for the given HandlerType . HandlerType Callback Function Type
int XHdcp22Tx_SetCallback(XHdcp22_Tx *InstancePtr, XHdcp22_Tx_HandlerType HandlerType, void *CallbackFunc, void *CallbackRef)
{
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(HandlerType > (XHDCP22_TX_HANDLER_UNDEFINED));
	Xil_AssertNonvoid(HandlerType < (XHDCP22_TX_HANDLER_INVALID));
	Xil_AssertNonvoid(CallbackFunc != NULL);
	Xil_AssertNonvoid(CallbackRef != NULL);
	u32 Status;
	switch (HandlerType)
	{
		case (XHDCP22_TX_HANDLER_DDC_WRITE):
			InstancePtr->DdcWrite = (XHdcp22_Tx_DdcHandler)CallbackFunc;
			InstancePtr->DdcHandlerRef = CallbackRef;
			InstancePtr->IsDdcWriteSet = (TRUE);
			Status = (XST_SUCCESS);
			break;
		case (XHDCP22_TX_HANDLER_DDC_READ):
			InstancePtr->DdcRead = (XHdcp22_Tx_DdcHandler)CallbackFunc;
			InstancePtr->DdcHandlerRef = CallbackRef;
			InstancePtr->IsDdcReadSet = (TRUE);
			Status = (XST_SUCCESS);
			break;
		case (XHDCP22_TX_HANDLER_AUTHENTICATED):
			InstancePtr->AuthenticatedCallback = (XHdcp22_Tx_Callback)CallbackFunc;
			InstancePtr->AuthenticatedCallbackRef = CallbackRef;
			InstancePtr->IsAuthenticatedCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;
		case (XHDCP22_TX_HANDLER_UNAUTHENTICATED):
			InstancePtr->UnauthenticatedCallback = (XHdcp22_Tx_Callback)CallbackFunc;
			InstancePtr->UnauthenticatedCallbackRef = CallbackRef;
			InstancePtr->IsUnauthenticatedCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;
		case (XHDCP22_TX_HANDLER_DOWNSTREAM_TOPOLOGY_AVAILABLE) :
			InstancePtr->DownstreamTopologyAvailableCallback = (XHdcp22_Tx_Callback)CallbackFunc;
			InstancePtr->DownstreamTopologyAvailableCallbackRef = CallbackRef;
			InstancePtr->IsDownstreamTopologyAvailableCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;
		case (XHDCP22_TX_HANDLER_DP_AUX_READ):
			InstancePtr->TxDpAuxReadCallback =
				(Xhdcp22_Tx_RdWrHandler)CallbackFunc;
			InstancePtr->TxDpAuxReadCallbackRef = CallbackRef;
			InstancePtr->IsTxDpAuxReadCallbackSet = (TRUE);
			break;
		case (XHDCP22_TX_HANDLER_DP_AUX_WRITE):
			InstancePtr->TxDpAuxWriteCallback =
				(Xhdcp22_Tx_RdWrHandler)CallbackFunc;
			InstancePtr->TxDpAuxWriteCallbackRef = CallbackRef;
			InstancePtr->IsTxDpAuxWriteCallbackSet = (TRUE);
			break;
		default:
			Status = (XST_INVALID_PARAM);
			break;
	}
	return Status;
}
int XHdcp22Tx_SetCallback ( XHdcp22_Tx * InstancePtr , XHdcp22_Tx_HandlerType HandlerType , void * CallbackFunc , void * CallbackRef ) { Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( HandlerType > ( XHDCP22_TX_HANDLER_UNDEFINED ) ) ; Xil_AssertNonvoid ( HandlerType < ( XHDCP22_TX_HANDLER_INVALID ) ) ; Xil_AssertNonvoid ( CallbackFunc != NULL ) ; Xil_AssertNonvoid ( CallbackRef != NULL ) ; u32 Status ; switch ( HandlerType ) { case ( XHDCP22_TX_HANDLER_DDC_WRITE ) : InstancePtr -> DdcWrite = ( XHdcp22_Tx_DdcHandler ) CallbackFunc ; InstancePtr -> DdcHandlerRef = CallbackRef ; InstancePtr -> IsDdcWriteSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XHDCP22_TX_HANDLER_DDC_READ ) : InstancePtr -> DdcRead = ( XHdcp22_Tx_DdcHandler ) CallbackFunc ; InstancePtr -> DdcHandlerRef = CallbackRef ; InstancePtr -> IsDdcReadSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XHDCP22_TX_HANDLER_AUTHENTICATED ) : InstancePtr -> AuthenticatedCallback = ( XHdcp22_Tx_Callback ) CallbackFunc ; InstancePtr -> AuthenticatedCallbackRef = CallbackRef ; InstancePtr -> IsAuthenticatedCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XHDCP22_TX_HANDLER_UNAUTHENTICATED ) : InstancePtr -> UnauthenticatedCallback = ( XHdcp22_Tx_Callback ) CallbackFunc ; InstancePtr -> UnauthenticatedCallbackRef = CallbackRef ; InstancePtr -> IsUnauthenticatedCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XHDCP22_TX_HANDLER_DOWNSTREAM_TOPOLOGY_AVAILABLE ) : InstancePtr -> DownstreamTopologyAvailableCallback = ( XHdcp22_Tx_Callback ) CallbackFunc ; InstancePtr -> DownstreamTopologyAvailableCallbackRef = CallbackRef ; InstancePtr -> IsDownstreamTopologyAvailableCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XHDCP22_TX_HANDLER_DP_AUX_READ ) : InstancePtr -> TxDpAuxReadCallback = ( Xhdcp22_Tx_RdWrHandler ) CallbackFunc ; InstancePtr -> TxDpAuxReadCallbackRef = CallbackRef ; InstancePtr -> IsTxDpAuxReadCallbackSet = ( TRUE ) ; break ; case ( XHDCP22_TX_HANDLER_DP_AUX_WRITE ) : InstancePtr -> TxDpAuxWriteCallback = ( Xhdcp22_Tx_RdWrHandler ) CallbackFunc ; InstancePtr -> TxDpAuxWriteCallbackRef = CallbackRef ; InstancePtr -> IsTxDpAuxWriteCallbackSet = ( TRUE ) ; 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. */ /* Check for handler type */ // DDC write // DDC read // Authenticated // Authentication failed // Downstream topology is available