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

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

	/* 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 C5->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 C5->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;
		}
	}

	/* Message send */
	switch(InstancePtr->Info.NextState)
	{
	case XHDCP22_RX_STATE_C5_SEND_RECEIVERIDLIST:
		if(XHdcp22Rx_IsReadMessageComplete(InstancePtr) == TRUE)
		{
			Status = XHdcp22Rx_SendMessageRepeaterAuthSendRxIdList(InstancePtr);
			if(Status == XST_SUCCESS)
			{
				InstancePtr->Info.NextState = XHDCP22_RX_STATE_C5_SEND_RECEIVERIDLIST_DONE;
			}
			else
			{
				XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_ERROR,
					XHDCP22_RX_ERROR_FLAG_EMPTY_REPEATER_TOPOLOGY);
				XHdcp22Rx_ResetAfterError(InstancePtr);
				XHdcp22Rx_SetDdcReauthReq(InstancePtr);
				return (void *)XHdcp22Rx_StateB0; /* Transition C5->B0 */
			}
		}
		break;
	case XHDCP22_RX_STATE_C5_SEND_RECEIVERIDLIST_DONE:
		if(XHdcp22Rx_IsReadMessageComplete(InstancePtr) == TRUE)
		{
			XHdcp22Rx_ResetDdc(InstancePtr, FALSE, FALSE, TRUE, FALSE);

			if(InstancePtr->Topology.MaxDevsExceeded == TRUE ||
				InstancePtr->Topology.MaxCascadeExceeded == TRUE)
			{
				XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_ERROR,
					XHDCP22_RX_ERROR_FLAG_MAX_REPEATER_TOPOLOGY);
				XHdcp22Rx_ResetAfterError(InstancePtr);
				XHdcp22Rx_SetDdcReauthReq(InstancePtr);
				return (void *)XHdcp22Rx_StateB0; /* Transition C5->B0 */
			}
			else
			{
				InstancePtr->Info.NextState = XHDCP22_RX_STATE_C6_VERIFY_RECEIVERIDLISTACK;
				return (void *)XHdcp22Rx_StateC6; /* Transition C5->C6 */
			}
		}
		break;
	default:
		break;
	}

	return (void *)XHdcp22Rx_StateC5; /* Transition C5->C5 */
}
/*****************************************************************************/
/**
* This function implements the Repeater State C5 (AssembleReceiverIdList).
* If MAX_DEVS_EXCEEDED or MAX_CASCADE_EXCEEDED is not set then this state
* calculates VPrime based on the Receiver ID List in the topology table.
* After VPrime is calculated the Repeaterauth_Send_ReceiverID_List message
* is populated based on the topology table, VPrime computation, and
* current seq_num_V counter value. seq_num_V is initialized to a value
* of zero after AKE_Init and is incremented by one after the transmission
* of every RepeaterAuth_Send_ReceiverID_List message. The upstream
* transmitter is responsible for detecting roll over of seq_num_V.
* The READY bit is asserted once the Repeaterauth_Send_ReceiverID_List
* message is made available to the upstream and a watchdog timer is set
* to detect if the acknowledgement arrives within a 2 second period.
* If the topology maximum flags are asserted in the topology table then
* the state machine transitions to StateC0 immediately after the
* Repeaterauth_Send_ReceiverID_List message is read, and the
* REAUTH_REQ bit is set the in the RxStatus register.
*
* @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 C5 (AssembleReceiverIdList).
If MAX_DEVS_EXCEEDED or MAX_CASCADE_EXCEEDED is not set then this state
calculates VPrime based on the Receiver ID List in the topology table.
After VPrime is calculated the Repeaterauth_Send_ReceiverID_List message
is populated based on the topology table, VPrime computation, and
current seq_num_V counter value. seq_num_V is initialized to a value
of zero after AKE_Init and is incremented by one after the transmission
of every RepeaterAuth_Send_ReceiverID_List message. The upstream
transmitter is responsible for detecting roll over of seq_num_V.
The READY bit is asserted once the Repeaterauth_Send_ReceiverID_List
message is made available to the upstream and a watchdog timer is set
to detect if the acknowledgement arrives within a 2 second period.
If the topology maximum flags are asserted in the topology table then
the state machine transitions to StateC0 immediately after the
Repeaterauth_Send_ReceiverID_List message is read, and the
REAUTH_REQ bit is set the in the RxStatus register.
This function implements the Repeater State C5 ( AssembleReceiverIdList ) . If MAX_DEVS_EXCEEDED or MAX_CASCADE_EXCEEDED is not set then this state calculates VPrime based on the Receiver ID List in the topology table . After VPrime is calculated the Repeaterauth_Send_ReceiverID_List message is populated based on the topology table VPrime computation and current seq_num_V counter value . seq_num_V is initialized to a value of zero after AKE_Init and is incremented by one after the transmission of every RepeaterAuth_Send_ReceiverID_List message . The upstream transmitter is responsible for detecting roll over of seq_num_V . The READY bit is asserted once the Repeaterauth_Send_ReceiverID_List message is made available to the upstream and a watchdog timer is set to detect if the acknowledgement arrives within a 2 second period . If the topology maximum flags are asserted in the topology table then the state machine transitions to StateC0 immediately after the Repeaterauth_Send_ReceiverID_List message is read and the REAUTH_REQ bit is set the in the RxStatus register .
static void *XHdcp22Rx_StateC5(XHdcp22_Rx *InstancePtr)
{
	Xil_AssertNonvoid(InstancePtr != NULL);
	int Status;
	XHdcp22_Rx_Message *MsgPtr = (XHdcp22_Rx_Message*)InstancePtr->MessageBuffer;
	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;
		}
	}
	switch(InstancePtr->Info.NextState)
	{
	case XHDCP22_RX_STATE_C5_SEND_RECEIVERIDLIST:
		if(XHdcp22Rx_IsReadMessageComplete(InstancePtr) == TRUE)
		{
			Status = XHdcp22Rx_SendMessageRepeaterAuthSendRxIdList(InstancePtr);
			if(Status == XST_SUCCESS)
			{
				InstancePtr->Info.NextState = XHDCP22_RX_STATE_C5_SEND_RECEIVERIDLIST_DONE;
			}
			else
			{
				XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_ERROR,
					XHDCP22_RX_ERROR_FLAG_EMPTY_REPEATER_TOPOLOGY);
				XHdcp22Rx_ResetAfterError(InstancePtr);
				XHdcp22Rx_SetDdcReauthReq(InstancePtr);
				return (void *)XHdcp22Rx_StateB0; 
			}
		}
		break;
	case XHDCP22_RX_STATE_C5_SEND_RECEIVERIDLIST_DONE:
		if(XHdcp22Rx_IsReadMessageComplete(InstancePtr) == TRUE)
		{
			XHdcp22Rx_ResetDdc(InstancePtr, FALSE, FALSE, TRUE, FALSE);
			if(InstancePtr->Topology.MaxDevsExceeded == TRUE ||
				InstancePtr->Topology.MaxCascadeExceeded == TRUE)
			{
				XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_ERROR,
					XHDCP22_RX_ERROR_FLAG_MAX_REPEATER_TOPOLOGY);
				XHdcp22Rx_ResetAfterError(InstancePtr);
				XHdcp22Rx_SetDdcReauthReq(InstancePtr);
				return (void *)XHdcp22Rx_StateB0; 
			}
			else
			{
				InstancePtr->Info.NextState = XHDCP22_RX_STATE_C6_VERIFY_RECEIVERIDLISTACK;
				return (void *)XHdcp22Rx_StateC6; 
			}
		}
		break;
	default:
		break;
	}
	return (void *)XHdcp22Rx_StateC5; 
}
static void * XHdcp22Rx_StateC5 ( XHdcp22_Rx * InstancePtr ) { Xil_AssertNonvoid ( InstancePtr != NULL ) ; int Status ; XHdcp22_Rx_Message * MsgPtr = ( XHdcp22_Rx_Message * ) InstancePtr -> MessageBuffer ; 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 ; } } switch ( InstancePtr -> Info . NextState ) { case XHDCP22_RX_STATE_C5_SEND_RECEIVERIDLIST : if ( XHdcp22Rx_IsReadMessageComplete ( InstancePtr ) == TRUE ) { Status = XHdcp22Rx_SendMessageRepeaterAuthSendRxIdList ( InstancePtr ) ; if ( Status == XST_SUCCESS ) { InstancePtr -> Info . NextState = XHDCP22_RX_STATE_C5_SEND_RECEIVERIDLIST_DONE ; } else { XHdcp22Rx_LogWr ( InstancePtr , XHDCP22_RX_LOG_EVT_ERROR , XHDCP22_RX_ERROR_FLAG_EMPTY_REPEATER_TOPOLOGY ) ; XHdcp22Rx_ResetAfterError ( InstancePtr ) ; XHdcp22Rx_SetDdcReauthReq ( InstancePtr ) ; return ( void * ) XHdcp22Rx_StateB0 ; } } break ; case XHDCP22_RX_STATE_C5_SEND_RECEIVERIDLIST_DONE : if ( XHdcp22Rx_IsReadMessageComplete ( InstancePtr ) == TRUE ) { XHdcp22Rx_ResetDdc ( InstancePtr , FALSE , FALSE , TRUE , FALSE ) ; if ( InstancePtr -> Topology . MaxDevsExceeded == TRUE || InstancePtr -> Topology . MaxCascadeExceeded == TRUE ) { XHdcp22Rx_LogWr ( InstancePtr , XHDCP22_RX_LOG_EVT_ERROR , XHDCP22_RX_ERROR_FLAG_MAX_REPEATER_TOPOLOGY ) ; XHdcp22Rx_ResetAfterError ( InstancePtr ) ; XHdcp22Rx_SetDdcReauthReq ( InstancePtr ) ; return ( void * ) XHdcp22Rx_StateB0 ; } else { InstancePtr -> Info . NextState = XHDCP22_RX_STATE_C6_VERIFY_RECEIVERIDLISTACK ; return ( void * ) XHdcp22Rx_StateC6 ; } } break ; default : break ; } return ( void * ) XHdcp22Rx_StateC5 ; }
This function implements the Repeater State C5 (AssembleReceiverIdList).
This function implements the Repeater State C5 ( AssembleReceiverIdList ) .
/* Verify arguments */ /* Update state */ /* Check error condition */ /* Check if message is available */ /* Message handling */ /* Transition C5->B1 */ /* Transition C5->C7 */ /* Message send */ /* Transition C5->B0 */ /* Transition C5->B0 */ /* Transition C5->C6 */ /* Transition C5->C5 */