XilinxProcessorIPLib/drivers/hdcp22_rx_dp/src/xhdcp22_rx.c
static void *XHdcp22Rx_StateC4(XHdcp22_Rx *InstancePtr)
{
	/* Verify arguments */
	Xil_AssertNonvoid(InstancePtr != NULL);

	int Status;
	XHdcp22_Rx_Message *MsgPtr = (XHdcp22_Rx_Message*)InstancePtr->MessageBuffer;

	/* Run topology update callback */
	if((InstancePtr->Info.CurrentState != InstancePtr->Info.NextState) &&
	(InstancePtr->Handles.IsTopologyUpdateCallbackSet))
	{
		InstancePtr->Handles.TopologyUpdateCallback(
			InstancePtr->Handles.TopologyUpdateCallbackRef);
	}

	/* Update state */
	InstancePtr->Info.AuthenticationStatus = XHDCP22_RX_AUTHENTICATION_BUSY;
	InstancePtr->Info.CurrentState = InstancePtr->Info.NextState;

	/* Check error condition */
	if(InstancePtr->Info.ErrorFlag & XHDCP22_RX_ERROR_FLAG_DDC_BURST)
	{
		XHdcp22Rx_ResetDdc(InstancePtr, FALSE, TRUE, TRUE, TRUE);
		XHdcp22Rx_ResetAfterError(InstancePtr);
		return (void *)XHdcp22Rx_StateB0;
	}
	else if(InstancePtr->Info.ErrorFlag & XHDCP22_RX_ERROR_FLAG_LINK_INTEGRITY)
	{
		XHdcp22Rx_SetDdcReauthReq(InstancePtr);
		InstancePtr->Info.AuthenticationStatus = XHDCP22_RX_REAUTHENTICATE_REQUESTED;
	}

	/* Check if message is available */
	InstancePtr->MessageSize = XHdcp22Rx_PollMessage(InstancePtr);

	/* Message handling */
	if(InstancePtr->MessageSize > 0)
	{
		switch(MsgPtr->MsgId)
		{
		case XHDCP22_RX_MSG_ID_AKEINIT: /* Transition C4->B1 */
			Status = XHdcp22Rx_ProcessMessageAKEInit(InstancePtr);
			if(Status == XST_SUCCESS)
			{
			    InstancePtr->Info.NextState = XHDCP22_RX_STATE_B1_SEND_AKESENDCERT;
			    return (void *)XHdcp22Rx_StateB1;
			}
			XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_ERROR,
				XHDCP22_RX_ERROR_FLAG_PROCESSING_AKEINIT);
			XHdcp22Rx_ResetAfterError(InstancePtr);
			return (void *)XHdcp22Rx_StateB0;
		case XHDCP22_RX_MSG_ID_REPEATERAUTHSTREAMMANAGE: /* Transition C4->C7 */
			InstancePtr->Info.NextState = XHDCP22_RX_STATE_C7_WAIT_STREAM_MANAGEMENT;
			InstancePtr->Info.ReturnState = InstancePtr->Info.CurrentState;
			InstancePtr->Info.SkipRead = TRUE;
			return (void *)XHdcp22Rx_StateC7;
		default:
			XHdcp22Rx_ResetAfterError(InstancePtr);
			return (void *)XHdcp22Rx_StateB0;
		}
	}

	/* Check the topology update flag */
	if(InstancePtr->Info.IsTopologyValid == TRUE)
	{
		InstancePtr->Info.IsTopologyValid = FALSE;
		InstancePtr->Info.NextState = XHDCP22_RX_STATE_C5_SEND_RECEIVERIDLIST;
		return (void *)XHdcp22Rx_StateC5; /* Transition C4->C5 */
	}

	return (void *)XHdcp22Rx_StateC4; /* Transition C4->C4 */
}
/*****************************************************************************/
/**
* This function implements the Repeater State C4 (WaitForDownstream). In this
* state the receiver upstream is waiting for all downstream HDCP-protected
* interface ports of the HDCP Repeater to enter one of the following states:
* Unconnected (State P0), Unauthenticated (State P1), Authenticated (State F5),
* or ReceiverIdListAck (State F8). This state checks if the topology table
* is available for upstream propogation based on the flag set in the function
* XHdcp22Rx_SetTopologyUpdate by the higher level repeater function.
*
* @param    InstancePtr is a pointer to the XHdcp22_Rx core instance.
*
* @return   Pointer to the function that implements the next state.
*
* @note     If a link integrity problem is detected during this state
*           then the REAUTH_REQ bit is set in the RxStatus register.
*           If the RepeaterAuth_Stream_Manage message is received then
*           transition to State C7 then return back to this state.
******************************************************************************/
This function implements the Repeater State C4 (WaitForDownstream). In this
state the receiver upstream is waiting for all downstream HDCP-protected
interface ports of the HDCP Repeater to enter one of the following states:
Unconnected (State P0), Unauthenticated (State P1), Authenticated (State F5),
or ReceiverIdListAck (State F8). This state checks if the topology table
is available for upstream propogation based on the flag set in the function
XHdcp22Rx_SetTopologyUpdate by the higher level repeater function.
This function implements the Repeater State C4 ( WaitForDownstream ) . In this state the receiver upstream is waiting for all downstream HDCP - protected interface ports of the HDCP Repeater to enter one of the following states : Unconnected ( State P0 ) Unauthenticated ( State P1 ) Authenticated ( State F5 ) or ReceiverIdListAck ( State F8 ) . This state checks if the topology table is available for upstream propogation based on the flag set in the function XHdcp22Rx_SetTopologyUpdate by the higher level repeater function .
static void *XHdcp22Rx_StateC4(XHdcp22_Rx *InstancePtr)
{
	Xil_AssertNonvoid(InstancePtr != NULL);
	int Status;
	XHdcp22_Rx_Message *MsgPtr = (XHdcp22_Rx_Message*)InstancePtr->MessageBuffer;
	if((InstancePtr->Info.CurrentState != InstancePtr->Info.NextState) &&
	(InstancePtr->Handles.IsTopologyUpdateCallbackSet))
	{
		InstancePtr->Handles.TopologyUpdateCallback(
			InstancePtr->Handles.TopologyUpdateCallbackRef);
	}
	InstancePtr->Info.AuthenticationStatus = XHDCP22_RX_AUTHENTICATION_BUSY;
	InstancePtr->Info.CurrentState = InstancePtr->Info.NextState;
	if(InstancePtr->Info.ErrorFlag & XHDCP22_RX_ERROR_FLAG_DDC_BURST)
	{
		XHdcp22Rx_ResetDdc(InstancePtr, FALSE, TRUE, TRUE, TRUE);
		XHdcp22Rx_ResetAfterError(InstancePtr);
		return (void *)XHdcp22Rx_StateB0;
	}
	else if(InstancePtr->Info.ErrorFlag & XHDCP22_RX_ERROR_FLAG_LINK_INTEGRITY)
	{
		XHdcp22Rx_SetDdcReauthReq(InstancePtr);
		InstancePtr->Info.AuthenticationStatus = XHDCP22_RX_REAUTHENTICATE_REQUESTED;
	}
	InstancePtr->MessageSize = XHdcp22Rx_PollMessage(InstancePtr);
	if(InstancePtr->MessageSize > 0)
	{
		switch(MsgPtr->MsgId)
		{
		case XHDCP22_RX_MSG_ID_AKEINIT: 
			Status = XHdcp22Rx_ProcessMessageAKEInit(InstancePtr);
			if(Status == XST_SUCCESS)
			{
			    InstancePtr->Info.NextState = XHDCP22_RX_STATE_B1_SEND_AKESENDCERT;
			    return (void *)XHdcp22Rx_StateB1;
			}
			XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_ERROR,
				XHDCP22_RX_ERROR_FLAG_PROCESSING_AKEINIT);
			XHdcp22Rx_ResetAfterError(InstancePtr);
			return (void *)XHdcp22Rx_StateB0;
		case XHDCP22_RX_MSG_ID_REPEATERAUTHSTREAMMANAGE: 
			InstancePtr->Info.NextState = XHDCP22_RX_STATE_C7_WAIT_STREAM_MANAGEMENT;
			InstancePtr->Info.ReturnState = InstancePtr->Info.CurrentState;
			InstancePtr->Info.SkipRead = TRUE;
			return (void *)XHdcp22Rx_StateC7;
		default:
			XHdcp22Rx_ResetAfterError(InstancePtr);
			return (void *)XHdcp22Rx_StateB0;
		}
	}
	if(InstancePtr->Info.IsTopologyValid == TRUE)
	{
		InstancePtr->Info.IsTopologyValid = FALSE;
		InstancePtr->Info.NextState = XHDCP22_RX_STATE_C5_SEND_RECEIVERIDLIST;
		return (void *)XHdcp22Rx_StateC5; 
	}
	return (void *)XHdcp22Rx_StateC4; 
}
static void * XHdcp22Rx_StateC4 ( XHdcp22_Rx * InstancePtr ) { Xil_AssertNonvoid ( InstancePtr != NULL ) ; int Status ; XHdcp22_Rx_Message * MsgPtr = ( XHdcp22_Rx_Message * ) InstancePtr -> MessageBuffer ; if ( ( InstancePtr -> Info . CurrentState != InstancePtr -> Info . NextState ) && ( InstancePtr -> Handles . IsTopologyUpdateCallbackSet ) ) { InstancePtr -> Handles . TopologyUpdateCallback ( InstancePtr -> Handles . TopologyUpdateCallbackRef ) ; } InstancePtr -> Info . AuthenticationStatus = XHDCP22_RX_AUTHENTICATION_BUSY ; InstancePtr -> Info . CurrentState = InstancePtr -> Info . NextState ; if ( InstancePtr -> Info . ErrorFlag & XHDCP22_RX_ERROR_FLAG_DDC_BURST ) { XHdcp22Rx_ResetDdc ( InstancePtr , FALSE , TRUE , TRUE , TRUE ) ; XHdcp22Rx_ResetAfterError ( InstancePtr ) ; return ( void * ) XHdcp22Rx_StateB0 ; } else if ( InstancePtr -> Info . ErrorFlag & XHDCP22_RX_ERROR_FLAG_LINK_INTEGRITY ) { XHdcp22Rx_SetDdcReauthReq ( InstancePtr ) ; InstancePtr -> Info . AuthenticationStatus = XHDCP22_RX_REAUTHENTICATE_REQUESTED ; } InstancePtr -> MessageSize = XHdcp22Rx_PollMessage ( InstancePtr ) ; if ( InstancePtr -> MessageSize > 0 ) { switch ( MsgPtr -> MsgId ) { case XHDCP22_RX_MSG_ID_AKEINIT : Status = XHdcp22Rx_ProcessMessageAKEInit ( InstancePtr ) ; if ( Status == XST_SUCCESS ) { InstancePtr -> Info . NextState = XHDCP22_RX_STATE_B1_SEND_AKESENDCERT ; return ( void * ) XHdcp22Rx_StateB1 ; } XHdcp22Rx_LogWr ( InstancePtr , XHDCP22_RX_LOG_EVT_ERROR , XHDCP22_RX_ERROR_FLAG_PROCESSING_AKEINIT ) ; XHdcp22Rx_ResetAfterError ( InstancePtr ) ; return ( void * ) XHdcp22Rx_StateB0 ; case XHDCP22_RX_MSG_ID_REPEATERAUTHSTREAMMANAGE : InstancePtr -> Info . NextState = XHDCP22_RX_STATE_C7_WAIT_STREAM_MANAGEMENT ; InstancePtr -> Info . ReturnState = InstancePtr -> Info . CurrentState ; InstancePtr -> Info . SkipRead = TRUE ; return ( void * ) XHdcp22Rx_StateC7 ; default : XHdcp22Rx_ResetAfterError ( InstancePtr ) ; return ( void * ) XHdcp22Rx_StateB0 ; } } if ( InstancePtr -> Info . IsTopologyValid == TRUE ) { InstancePtr -> Info . IsTopologyValid = FALSE ; InstancePtr -> Info . NextState = XHDCP22_RX_STATE_C5_SEND_RECEIVERIDLIST ; return ( void * ) XHdcp22Rx_StateC5 ; } return ( void * ) XHdcp22Rx_StateC4 ; }
This function implements the Repeater State C4 (WaitForDownstream).
This function implements the Repeater State C4 ( WaitForDownstream ) .
/* Verify arguments */ /* Run topology update callback */ /* Update state */ /* Check error condition */ /* Check if message is available */ /* Message handling */ /* Transition C4->B1 */ /* Transition C4->C7 */ /* Check the topology update flag */ /* Transition C4->C5 */ /* Transition C4->C4 */