XilinxProcessorIPLib/drivers/hdcp22_rx/src/xhdcp22_rx.c
int XHdcp22Rx_SetCallback(XHdcp22_Rx *InstancePtr, XHdcp22_Rx_HandlerType HandlerType, void *CallbackFunc, void *CallbackRef)
{
	/* Verify arguments. */
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(HandlerType > (XHDCP22_RX_HANDLER_UNDEFINED));
	Xil_AssertNonvoid(HandlerType < (XHDCP22_RX_HANDLER_INVALID));
	Xil_AssertNonvoid(CallbackFunc != NULL);
	Xil_AssertNonvoid(CallbackRef != NULL);

	u32 Status;

	/* Check for handler type */
	switch(HandlerType)
	{
		// DDC Set Register Address
		case (XHDCP22_RX_HANDLER_DDC_SETREGADDR):
			InstancePtr->Handles.DdcSetAddressCallback = (XHdcp22_Rx_SetHandler)CallbackFunc;
			InstancePtr->Handles.DdcSetAddressCallbackRef = CallbackRef;
			InstancePtr->Handles.IsDdcSetAddressCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;

		// DDC Set Register Data
		case (XHDCP22_RX_HANDLER_DDC_SETREGDATA):
			InstancePtr->Handles.DdcSetDataCallback = (XHdcp22_Rx_SetHandler)CallbackFunc;
			InstancePtr->Handles.DdcSetDataCallbackRef = CallbackRef;
			InstancePtr->Handles.IsDdcSetDataCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;

		// DDC Get Register Data
		case (XHDCP22_RX_HANDLER_DDC_GETREGDATA):
			InstancePtr->Handles.DdcGetDataCallback = (XHdcp22_Rx_GetHandler)CallbackFunc;
			InstancePtr->Handles.DdcGetDataCallbackRef = CallbackRef;
			InstancePtr->Handles.IsDdcGetDataCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;

		// DDC Get Write Buffer Size
		case (XHDCP22_RX_HANDLER_DDC_GETWBUFSIZE):
			InstancePtr->Handles.DdcGetWriteBufferSizeCallback = (XHdcp22_Rx_GetHandler)CallbackFunc;
			InstancePtr->Handles.DdcGetWriteBufferSizeCallbackRef = CallbackRef;
			InstancePtr->Handles.IsDdcGetWriteBufferSizeCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;

		// DDC Get Read Buffer Size
		case (XHDCP22_RX_HANDLER_DDC_GETRBUFSIZE):
			InstancePtr->Handles.DdcGetReadBufferSizeCallback = (XHdcp22_Rx_GetHandler)CallbackFunc;
			InstancePtr->Handles.DdcGetReadBufferSizeCallbackRef = CallbackRef;
			InstancePtr->Handles.IsDdcGetReadBufferSizeCallbackRefSet = (TRUE);
			Status = (XST_SUCCESS);
			break;

		// DDC Is Write Buffer Empty
		case (XHDCP22_RX_HANDLER_DDC_ISWBUFEMPTY):
			InstancePtr->Handles.DdcIsWriteBufferEmptyCallback = (XHdcp22_Rx_GetHandler)CallbackFunc;
			InstancePtr->Handles.DdcIsWriteBufferEmptyCallbackRef = CallbackRef;
			InstancePtr->Handles.IsDdcIsWriteBufferEmptyCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;

		// DDC Is Read Buffer Empty
		case (XHDCP22_RX_HANDLER_DDC_ISRBUFEMPTY):
			InstancePtr->Handles.DdcIsReadBufferEmptyCallback = (XHdcp22_Rx_GetHandler)CallbackFunc;
			InstancePtr->Handles.DdcIsReadBufferEmptyCallbackRef = CallbackRef;
			InstancePtr->Handles.IsDdcIsReadBufferEmptyCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;

		// DDC Clear Read Buffer
		case (XHDCP22_RX_HANDLER_DDC_CLEARRBUF):
			InstancePtr->Handles.DdcClearReadBufferCallback = (XHdcp22_Rx_RunHandler)CallbackFunc;
			InstancePtr->Handles.DdcClearReadBufferCallbackRef = CallbackRef;
			InstancePtr->Handles.IsDdcClearReadBufferCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;

		// DDC Clear Write Buffer
		case (XHDCP22_RX_HANDLER_DDC_CLEARWBUF):
			InstancePtr->Handles.DdcClearWriteBufferCallback = (XHdcp22_Rx_RunHandler)CallbackFunc;
			InstancePtr->Handles.DdcClearWriteBufferCallbackRef = CallbackRef;
			InstancePtr->Handles.IsDdcClearWriteBufferCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;

		// Authenticated
		case (XHDCP22_RX_HANDLER_AUTHENTICATED):
			InstancePtr->Handles.AuthenticatedCallback = (XHdcp22_Rx_RunHandler)CallbackFunc;
			InstancePtr->Handles.AuthenticatedCallbackRef = CallbackRef;
			InstancePtr->Handles.IsAuthenticatedCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;

		// Unauthenticated
		case (XHDCP22_RX_HANDLER_UNAUTHENTICATED):
			InstancePtr->Handles.UnauthenticatedCallback = (XHdcp22_Rx_RunHandler)CallbackFunc;
			InstancePtr->Handles.UnauthenticatedCallbackRef = CallbackRef;
			InstancePtr->Handles.IsUnauthenticatedCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;

		// Authentication Request
		case (XHDCP22_RX_HANDLER_AUTHENTICATION_REQUEST):
			InstancePtr->Handles.AuthenticationRequestCallback = (XHdcp22_Rx_RunHandler)CallbackFunc;
			InstancePtr->Handles.AuthenticationRequestCallbackRef = CallbackRef;
			InstancePtr->Handles.IsAuthenticationRequestCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;

		// Management Request
		case (XHDCP22_RX_HANDLER_STREAM_MANAGE_REQUEST):
			InstancePtr->Handles.StreamManageRequestCallback = (XHdcp22_Rx_RunHandler)CallbackFunc;
			InstancePtr->Handles.StreamManageRequestCallbackRef = CallbackRef;
			InstancePtr->Handles.IsStreamManageRequestCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;

		// Topology Update
		case (XHDCP22_RX_HANDLER_TOPOLOGY_UPDATE):
			InstancePtr->Handles.TopologyUpdateCallback = (XHdcp22_Rx_RunHandler)CallbackFunc;
			InstancePtr->Handles.TopologyUpdateCallbackRef = CallbackRef;
			InstancePtr->Handles.IsTopologyUpdateCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;

		// Encryption Status Update
		case (XHDCP22_RX_HANDLER_ENCRYPTION_UPDATE):
			InstancePtr->Handles.EncryptionStatusCallback = (XHdcp22_Rx_RunHandler)CallbackFunc;
			InstancePtr->Handles.EncryptionStatusCallbackRef = CallbackRef;
			InstancePtr->Handles.IsEncryptionStatusCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;

		default:
			Status = (XST_INVALID_PARAM);
			break;
	}

	/* Reset DDC registers only when all handlers have been registered */
    if(InstancePtr->Handles.IsDdcSetAddressCallbackSet &&
		InstancePtr->Handles.IsDdcSetDataCallbackSet &&
		InstancePtr->Handles.IsDdcGetDataCallbackSet &&
		InstancePtr->Handles.IsDdcGetWriteBufferSizeCallbackSet &&
		InstancePtr->Handles.IsDdcGetReadBufferSizeCallbackRefSet &&
		InstancePtr->Handles.IsDdcIsWriteBufferEmptyCallbackSet &&
		InstancePtr->Handles.IsDdcIsReadBufferEmptyCallbackSet &&
		InstancePtr->Handles.IsDdcClearReadBufferCallbackSet &&
		InstancePtr->Handles.IsDdcClearWriteBufferCallbackSet &&
        InstancePtr->Handles.IsDdcAllCallbacksSet == (FALSE))
	{
		InstancePtr->Handles.IsDdcAllCallbacksSet = (TRUE);
		XHdcp22Rx_ResetDdc(InstancePtr, TRUE, TRUE, TRUE, TRUE);
	}

	return Status;
}
/*****************************************************************************/
/**
*
* This function installs callback functions for the given
* HandlerType:
*
* <pre>
* HandlerType                                           Callback Function Type
* -------------------------                             ---------------------------
* (XHDCP22_RX_HANDLER_DDC_SETREGADDR)                   DdcSetAddressCallback
* (XHDCP22_RX_HANDLER_DDC_SETREGDATA)                   DdcSetDataCallback
* (XHDCP22_RX_HANDLER_DDC_GETREGDATA)                   DdcGetDataCallback
* (XHDCP22_RX_HANDLER_DDC_GETWBUFSIZE)                  DdcGetWriteBufferSizeCallback
* (XHDCP22_RX_HANDLER_DDC_GETRBUFSIZE)                  DdcGetReadBufferSizeCallback
* (XHDCP22_RX_HANDLER_DDC_ISWBUFEMPTY)                  DdcIsWriteBufferEmptyCallback
* (XHDCP22_RX_HANDLER_DDC_ISRBUFEMPTY)                  DdcIsReadBufferEmptyCallback
* (XHDCP22_RX_HANDLER_DDC_CLEARRBUF)                    DdcClearReadBufferCallback
* (XHDCP22_RX_HANDLER_DDC_CLEARWBUF)                    DdcClearWriteBufferCallback
* (XHDCP22_RX_HANDLER_AUTHENTICATED)                    AuthenticatedCallback
* (XHDCP22_RX_HANDLER_UNAUTHENTICATED)                  UnauthenticatedCallback
* (XHDCP22_RX_HANDLER_AUTHENTICATION_REQUEST)           AuthenticationRequestCallback
* (XHDCP22_RX_HANDLER_STREAM_MANAGE_REQUEST)            StreamManageRequestCallback
* (XHDCP22_RX_HANDLER_TOPOLOGY_UPDATE)                  TopologyUpdateCallback
* </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 XHdcp22Rx_SetCallback(XHdcp22_Rx *InstancePtr, XHdcp22_Rx_HandlerType HandlerType, void *CallbackFunc, void *CallbackRef)
{
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(HandlerType > (XHDCP22_RX_HANDLER_UNDEFINED));
	Xil_AssertNonvoid(HandlerType < (XHDCP22_RX_HANDLER_INVALID));
	Xil_AssertNonvoid(CallbackFunc != NULL);
	Xil_AssertNonvoid(CallbackRef != NULL);
	u32 Status;
	switch(HandlerType)
	{
		case (XHDCP22_RX_HANDLER_DDC_SETREGADDR):
			InstancePtr->Handles.DdcSetAddressCallback = (XHdcp22_Rx_SetHandler)CallbackFunc;
			InstancePtr->Handles.DdcSetAddressCallbackRef = CallbackRef;
			InstancePtr->Handles.IsDdcSetAddressCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;
		case (XHDCP22_RX_HANDLER_DDC_SETREGDATA):
			InstancePtr->Handles.DdcSetDataCallback = (XHdcp22_Rx_SetHandler)CallbackFunc;
			InstancePtr->Handles.DdcSetDataCallbackRef = CallbackRef;
			InstancePtr->Handles.IsDdcSetDataCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;
		case (XHDCP22_RX_HANDLER_DDC_GETREGDATA):
			InstancePtr->Handles.DdcGetDataCallback = (XHdcp22_Rx_GetHandler)CallbackFunc;
			InstancePtr->Handles.DdcGetDataCallbackRef = CallbackRef;
			InstancePtr->Handles.IsDdcGetDataCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;
		case (XHDCP22_RX_HANDLER_DDC_GETWBUFSIZE):
			InstancePtr->Handles.DdcGetWriteBufferSizeCallback = (XHdcp22_Rx_GetHandler)CallbackFunc;
			InstancePtr->Handles.DdcGetWriteBufferSizeCallbackRef = CallbackRef;
			InstancePtr->Handles.IsDdcGetWriteBufferSizeCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;
		case (XHDCP22_RX_HANDLER_DDC_GETRBUFSIZE):
			InstancePtr->Handles.DdcGetReadBufferSizeCallback = (XHdcp22_Rx_GetHandler)CallbackFunc;
			InstancePtr->Handles.DdcGetReadBufferSizeCallbackRef = CallbackRef;
			InstancePtr->Handles.IsDdcGetReadBufferSizeCallbackRefSet = (TRUE);
			Status = (XST_SUCCESS);
			break;
		case (XHDCP22_RX_HANDLER_DDC_ISWBUFEMPTY):
			InstancePtr->Handles.DdcIsWriteBufferEmptyCallback = (XHdcp22_Rx_GetHandler)CallbackFunc;
			InstancePtr->Handles.DdcIsWriteBufferEmptyCallbackRef = CallbackRef;
			InstancePtr->Handles.IsDdcIsWriteBufferEmptyCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;
		case (XHDCP22_RX_HANDLER_DDC_ISRBUFEMPTY):
			InstancePtr->Handles.DdcIsReadBufferEmptyCallback = (XHdcp22_Rx_GetHandler)CallbackFunc;
			InstancePtr->Handles.DdcIsReadBufferEmptyCallbackRef = CallbackRef;
			InstancePtr->Handles.IsDdcIsReadBufferEmptyCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;
		case (XHDCP22_RX_HANDLER_DDC_CLEARRBUF):
			InstancePtr->Handles.DdcClearReadBufferCallback = (XHdcp22_Rx_RunHandler)CallbackFunc;
			InstancePtr->Handles.DdcClearReadBufferCallbackRef = CallbackRef;
			InstancePtr->Handles.IsDdcClearReadBufferCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;
		case (XHDCP22_RX_HANDLER_DDC_CLEARWBUF):
			InstancePtr->Handles.DdcClearWriteBufferCallback = (XHdcp22_Rx_RunHandler)CallbackFunc;
			InstancePtr->Handles.DdcClearWriteBufferCallbackRef = CallbackRef;
			InstancePtr->Handles.IsDdcClearWriteBufferCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;
		case (XHDCP22_RX_HANDLER_AUTHENTICATED):
			InstancePtr->Handles.AuthenticatedCallback = (XHdcp22_Rx_RunHandler)CallbackFunc;
			InstancePtr->Handles.AuthenticatedCallbackRef = CallbackRef;
			InstancePtr->Handles.IsAuthenticatedCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;
		case (XHDCP22_RX_HANDLER_UNAUTHENTICATED):
			InstancePtr->Handles.UnauthenticatedCallback = (XHdcp22_Rx_RunHandler)CallbackFunc;
			InstancePtr->Handles.UnauthenticatedCallbackRef = CallbackRef;
			InstancePtr->Handles.IsUnauthenticatedCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;
		case (XHDCP22_RX_HANDLER_AUTHENTICATION_REQUEST):
			InstancePtr->Handles.AuthenticationRequestCallback = (XHdcp22_Rx_RunHandler)CallbackFunc;
			InstancePtr->Handles.AuthenticationRequestCallbackRef = CallbackRef;
			InstancePtr->Handles.IsAuthenticationRequestCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;
		case (XHDCP22_RX_HANDLER_STREAM_MANAGE_REQUEST):
			InstancePtr->Handles.StreamManageRequestCallback = (XHdcp22_Rx_RunHandler)CallbackFunc;
			InstancePtr->Handles.StreamManageRequestCallbackRef = CallbackRef;
			InstancePtr->Handles.IsStreamManageRequestCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;
		case (XHDCP22_RX_HANDLER_TOPOLOGY_UPDATE):
			InstancePtr->Handles.TopologyUpdateCallback = (XHdcp22_Rx_RunHandler)CallbackFunc;
			InstancePtr->Handles.TopologyUpdateCallbackRef = CallbackRef;
			InstancePtr->Handles.IsTopologyUpdateCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;
		case (XHDCP22_RX_HANDLER_ENCRYPTION_UPDATE):
			InstancePtr->Handles.EncryptionStatusCallback = (XHdcp22_Rx_RunHandler)CallbackFunc;
			InstancePtr->Handles.EncryptionStatusCallbackRef = CallbackRef;
			InstancePtr->Handles.IsEncryptionStatusCallbackSet = (TRUE);
			Status = (XST_SUCCESS);
			break;
		default:
			Status = (XST_INVALID_PARAM);
			break;
	}
    if(InstancePtr->Handles.IsDdcSetAddressCallbackSet &&
		InstancePtr->Handles.IsDdcSetDataCallbackSet &&
		InstancePtr->Handles.IsDdcGetDataCallbackSet &&
		InstancePtr->Handles.IsDdcGetWriteBufferSizeCallbackSet &&
		InstancePtr->Handles.IsDdcGetReadBufferSizeCallbackRefSet &&
		InstancePtr->Handles.IsDdcIsWriteBufferEmptyCallbackSet &&
		InstancePtr->Handles.IsDdcIsReadBufferEmptyCallbackSet &&
		InstancePtr->Handles.IsDdcClearReadBufferCallbackSet &&
		InstancePtr->Handles.IsDdcClearWriteBufferCallbackSet &&
        InstancePtr->Handles.IsDdcAllCallbacksSet == (FALSE))
	{
		InstancePtr->Handles.IsDdcAllCallbacksSet = (TRUE);
		XHdcp22Rx_ResetDdc(InstancePtr, TRUE, TRUE, TRUE, TRUE);
	}
	return Status;
}
int XHdcp22Rx_SetCallback ( XHdcp22_Rx * InstancePtr , XHdcp22_Rx_HandlerType HandlerType , void * CallbackFunc , void * CallbackRef ) { Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( HandlerType > ( XHDCP22_RX_HANDLER_UNDEFINED ) ) ; Xil_AssertNonvoid ( HandlerType < ( XHDCP22_RX_HANDLER_INVALID ) ) ; Xil_AssertNonvoid ( CallbackFunc != NULL ) ; Xil_AssertNonvoid ( CallbackRef != NULL ) ; u32 Status ; switch ( HandlerType ) { case ( XHDCP22_RX_HANDLER_DDC_SETREGADDR ) : InstancePtr -> Handles . DdcSetAddressCallback = ( XHdcp22_Rx_SetHandler ) CallbackFunc ; InstancePtr -> Handles . DdcSetAddressCallbackRef = CallbackRef ; InstancePtr -> Handles . IsDdcSetAddressCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XHDCP22_RX_HANDLER_DDC_SETREGDATA ) : InstancePtr -> Handles . DdcSetDataCallback = ( XHdcp22_Rx_SetHandler ) CallbackFunc ; InstancePtr -> Handles . DdcSetDataCallbackRef = CallbackRef ; InstancePtr -> Handles . IsDdcSetDataCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XHDCP22_RX_HANDLER_DDC_GETREGDATA ) : InstancePtr -> Handles . DdcGetDataCallback = ( XHdcp22_Rx_GetHandler ) CallbackFunc ; InstancePtr -> Handles . DdcGetDataCallbackRef = CallbackRef ; InstancePtr -> Handles . IsDdcGetDataCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XHDCP22_RX_HANDLER_DDC_GETWBUFSIZE ) : InstancePtr -> Handles . DdcGetWriteBufferSizeCallback = ( XHdcp22_Rx_GetHandler ) CallbackFunc ; InstancePtr -> Handles . DdcGetWriteBufferSizeCallbackRef = CallbackRef ; InstancePtr -> Handles . IsDdcGetWriteBufferSizeCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XHDCP22_RX_HANDLER_DDC_GETRBUFSIZE ) : InstancePtr -> Handles . DdcGetReadBufferSizeCallback = ( XHdcp22_Rx_GetHandler ) CallbackFunc ; InstancePtr -> Handles . DdcGetReadBufferSizeCallbackRef = CallbackRef ; InstancePtr -> Handles . IsDdcGetReadBufferSizeCallbackRefSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XHDCP22_RX_HANDLER_DDC_ISWBUFEMPTY ) : InstancePtr -> Handles . DdcIsWriteBufferEmptyCallback = ( XHdcp22_Rx_GetHandler ) CallbackFunc ; InstancePtr -> Handles . DdcIsWriteBufferEmptyCallbackRef = CallbackRef ; InstancePtr -> Handles . IsDdcIsWriteBufferEmptyCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XHDCP22_RX_HANDLER_DDC_ISRBUFEMPTY ) : InstancePtr -> Handles . DdcIsReadBufferEmptyCallback = ( XHdcp22_Rx_GetHandler ) CallbackFunc ; InstancePtr -> Handles . DdcIsReadBufferEmptyCallbackRef = CallbackRef ; InstancePtr -> Handles . IsDdcIsReadBufferEmptyCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XHDCP22_RX_HANDLER_DDC_CLEARRBUF ) : InstancePtr -> Handles . DdcClearReadBufferCallback = ( XHdcp22_Rx_RunHandler ) CallbackFunc ; InstancePtr -> Handles . DdcClearReadBufferCallbackRef = CallbackRef ; InstancePtr -> Handles . IsDdcClearReadBufferCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XHDCP22_RX_HANDLER_DDC_CLEARWBUF ) : InstancePtr -> Handles . DdcClearWriteBufferCallback = ( XHdcp22_Rx_RunHandler ) CallbackFunc ; InstancePtr -> Handles . DdcClearWriteBufferCallbackRef = CallbackRef ; InstancePtr -> Handles . IsDdcClearWriteBufferCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XHDCP22_RX_HANDLER_AUTHENTICATED ) : InstancePtr -> Handles . AuthenticatedCallback = ( XHdcp22_Rx_RunHandler ) CallbackFunc ; InstancePtr -> Handles . AuthenticatedCallbackRef = CallbackRef ; InstancePtr -> Handles . IsAuthenticatedCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XHDCP22_RX_HANDLER_UNAUTHENTICATED ) : InstancePtr -> Handles . UnauthenticatedCallback = ( XHdcp22_Rx_RunHandler ) CallbackFunc ; InstancePtr -> Handles . UnauthenticatedCallbackRef = CallbackRef ; InstancePtr -> Handles . IsUnauthenticatedCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XHDCP22_RX_HANDLER_AUTHENTICATION_REQUEST ) : InstancePtr -> Handles . AuthenticationRequestCallback = ( XHdcp22_Rx_RunHandler ) CallbackFunc ; InstancePtr -> Handles . AuthenticationRequestCallbackRef = CallbackRef ; InstancePtr -> Handles . IsAuthenticationRequestCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XHDCP22_RX_HANDLER_STREAM_MANAGE_REQUEST ) : InstancePtr -> Handles . StreamManageRequestCallback = ( XHdcp22_Rx_RunHandler ) CallbackFunc ; InstancePtr -> Handles . StreamManageRequestCallbackRef = CallbackRef ; InstancePtr -> Handles . IsStreamManageRequestCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XHDCP22_RX_HANDLER_TOPOLOGY_UPDATE ) : InstancePtr -> Handles . TopologyUpdateCallback = ( XHdcp22_Rx_RunHandler ) CallbackFunc ; InstancePtr -> Handles . TopologyUpdateCallbackRef = CallbackRef ; InstancePtr -> Handles . IsTopologyUpdateCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XHDCP22_RX_HANDLER_ENCRYPTION_UPDATE ) : InstancePtr -> Handles . EncryptionStatusCallback = ( XHdcp22_Rx_RunHandler ) CallbackFunc ; InstancePtr -> Handles . EncryptionStatusCallbackRef = CallbackRef ; InstancePtr -> Handles . IsEncryptionStatusCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; default : Status = ( XST_INVALID_PARAM ) ; break ; } if ( InstancePtr -> Handles . IsDdcSetAddressCallbackSet && InstancePtr -> Handles . IsDdcSetDataCallbackSet && InstancePtr -> Handles . IsDdcGetDataCallbackSet && InstancePtr -> Handles . IsDdcGetWriteBufferSizeCallbackSet && InstancePtr -> Handles . IsDdcGetReadBufferSizeCallbackRefSet && InstancePtr -> Handles . IsDdcIsWriteBufferEmptyCallbackSet && InstancePtr -> Handles . IsDdcIsReadBufferEmptyCallbackSet && InstancePtr -> Handles . IsDdcClearReadBufferCallbackSet && InstancePtr -> Handles . IsDdcClearWriteBufferCallbackSet && InstancePtr -> Handles . IsDdcAllCallbacksSet == ( FALSE ) ) { InstancePtr -> Handles . IsDdcAllCallbacksSet = ( TRUE ) ; XHdcp22Rx_ResetDdc ( InstancePtr , TRUE , TRUE , TRUE , TRUE ) ; } 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 Set Register Address // DDC Set Register Data // DDC Get Register Data // DDC Get Write Buffer Size // DDC Get Read Buffer Size // DDC Is Write Buffer Empty // DDC Is Read Buffer Empty // DDC Clear Read Buffer // DDC Clear Write Buffer // Authenticated // Unauthenticated // Authentication Request // Management Request // Topology Update // Encryption Status Update /* Reset DDC registers only when all handlers have been registered */