XilinxProcessorIPLib/drivers/hdcp22_rx_dp/src/xhdcp22_rx.c
static void *XHdcp22Rx_StateC7(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.
	   When SkipRead flag is set, this indicates that a message has
	   already been read by another state and should get processed
	   by this state; therefore, skip the first read. */
	if(InstancePtr->Info.SkipRead != TRUE)
	{
		InstancePtr->MessageSize = XHdcp22Rx_PollMessage(InstancePtr);
	}
	InstancePtr->Info.SkipRead = FALSE;

	/* Message handling */
	if(InstancePtr->MessageSize > 0)
	{
		switch(MsgPtr->MsgId)
		{
		case XHDCP22_RX_MSG_ID_AKEINIT: /* Transition C7->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_REPEATERAUTHSENDACK:
			InstancePtr->Info.NextState = InstancePtr->Info.ReturnState;
			InstancePtr->Info.ReturnState = InstancePtr->Info.CurrentState;
			InstancePtr->Info.SkipRead = TRUE;
			return (void *)XHdcp22Rx_StateC6; /* Transition C7->C6 */
		case XHDCP22_RX_MSG_ID_REPEATERAUTHSTREAMMANAGE:
			Status = XHdcp22Rx_ProcessMessageRepeaterAuthStreamManage(InstancePtr);
			if(Status == XST_SUCCESS)
			{
				InstancePtr->Info.NextState = XHDCP22_RX_STATE_C7_SEND_STREAM_READY;
				break;
			}
			XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_ERROR,
				XHDCP22_RX_ERROR_FLAG_PROCESSING_REPEATERAUTHSTREAMMANAGE);
			XHdcp22Rx_ResetAfterError(InstancePtr);
			XHdcp22Rx_SetDdcReauthReq(InstancePtr);
			return (void *)XHdcp22Rx_StateB0; /* Transition C7->B0 */
		default:
			XHdcp22Rx_ResetAfterError(InstancePtr);
			return (void *)XHdcp22Rx_StateB0;
		}
	}

	/* Message send */
	switch(InstancePtr->Info.NextState)
	{
	case XHDCP22_RX_STATE_C7_SEND_STREAM_READY:
		if(XHdcp22Rx_IsReadMessageComplete(InstancePtr) == TRUE)
		{
			Status = XHdcp22Rx_SendMessageRepeaterAuthStreamReady(InstancePtr);
			InstancePtr->Info.HasStreamManagementInfo = TRUE;
			InstancePtr->Info.NextState = XHDCP22_RX_STATE_C7_SEND_STREAM_READY_DONE;
		}
		break;
	case XHDCP22_RX_STATE_C7_SEND_STREAM_READY_DONE:
		if(XHdcp22Rx_IsReadMessageComplete(InstancePtr) == TRUE)
		{
			if(InstancePtr->Info.ReturnState == XHDCP22_RX_STATE_UNDEFINED)
			{
				InstancePtr->Info.NextState = XHDCP22_RX_STATE_C8_AUTHENTICATED;
				return (void *)XHdcp22Rx_StateC8; /* Transition C7->C8 */
			}
			else
			{
				InstancePtr->Info.NextState = InstancePtr->Info.ReturnState;
				switch(InstancePtr->Info.ReturnState)
				{
				case XHDCP22_RX_STATE_C4_WAIT_FOR_DOWNSTREAM:
					InstancePtr->Info.ReturnState = XHDCP22_RX_STATE_UNDEFINED;
					return (void *)XHdcp22Rx_StateC4; /* Transition C7->C4 */
				case XHDCP22_RX_STATE_C5_SEND_RECEIVERIDLIST:
					InstancePtr->Info.ReturnState = XHDCP22_RX_STATE_UNDEFINED;
					return (void *)XHdcp22Rx_StateC5; /* Transition C7->C5 */
				case XHDCP22_RX_STATE_C5_SEND_RECEIVERIDLIST_DONE:
					InstancePtr->Info.ReturnState = XHDCP22_RX_STATE_UNDEFINED;
					return (void *)XHdcp22Rx_StateC5; /* Transition C7->C5 */
				case XHDCP22_RX_STATE_C6_VERIFY_RECEIVERIDLISTACK:
					InstancePtr->Info.ReturnState = XHDCP22_RX_STATE_UNDEFINED;
					return (void *)XHdcp22Rx_StateC6; /* Transition C7->C6 */
				case XHDCP22_RX_STATE_C8_AUTHENTICATED:
					InstancePtr->Info.ReturnState = XHDCP22_RX_STATE_UNDEFINED;
					return (void *)XHdcp22Rx_StateC8; /* Transition C7->C8 */
				default:
					break;
				}
			}
		}
		break;
	default:
		break;
	}

	return (void *)XHdcp22Rx_StateC7; /* Transition C7->C7 */
}
/*****************************************************************************/
/**
* This function implements the Repeater State C7 (ContentStreamManagement).
* This state waits to receive the RepeaterAuth_Stream_Manage message from
* the upstream transmitter. Once the message is received the MPrime value is
* computed and made available to the upstream transmitter to read as part of
* the RepeaterAuth_Stream_Ready message. Note that state executes in parallel
* with the upstream propagation of topology information (State C4, State C5,
* and State C6). A transition in to this state may occur from State C4,
* State C5, or State C6 if content stream management information is received
* from the upstream transmitter. Also, the transition from State C7 may
* return to the appropriate state to allow undisrupted operation.
*
* @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 C7 (ContentStreamManagement).
This state waits to receive the RepeaterAuth_Stream_Manage message from
the upstream transmitter. Once the message is received the MPrime value is
computed and made available to the upstream transmitter to read as part of
the RepeaterAuth_Stream_Ready message. Note that state executes in parallel
with the upstream propagation of topology information (State C4, State C5,
and State C6). A transition in to this state may occur from State C4,
State C5, or State C6 if content stream management information is received
from the upstream transmitter. Also, the transition from State C7 may
return to the appropriate state to allow undisrupted operation.
This function implements the Repeater State C7 ( ContentStreamManagement ) . This state waits to receive the RepeaterAuth_Stream_Manage message from the upstream transmitter . Once the message is received the MPrime value is computed and made available to the upstream transmitter to read as part of the RepeaterAuth_Stream_Ready message . Note that state executes in parallel with the upstream propagation of topology information ( State C4 State C5 and State C6 ) . A transition in to this state may occur from State C4 State C5 or State C6 if content stream management information is received from the upstream transmitter . Also the transition from State C7 may return to the appropriate state to allow undisrupted operation .
static void *XHdcp22Rx_StateC7(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;
	}
	if(InstancePtr->Info.SkipRead != TRUE)
	{
		InstancePtr->MessageSize = XHdcp22Rx_PollMessage(InstancePtr);
	}
	InstancePtr->Info.SkipRead = FALSE;
	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_REPEATERAUTHSENDACK:
			InstancePtr->Info.NextState = InstancePtr->Info.ReturnState;
			InstancePtr->Info.ReturnState = InstancePtr->Info.CurrentState;
			InstancePtr->Info.SkipRead = TRUE;
			return (void *)XHdcp22Rx_StateC6; 
		case XHDCP22_RX_MSG_ID_REPEATERAUTHSTREAMMANAGE:
			Status = XHdcp22Rx_ProcessMessageRepeaterAuthStreamManage(InstancePtr);
			if(Status == XST_SUCCESS)
			{
				InstancePtr->Info.NextState = XHDCP22_RX_STATE_C7_SEND_STREAM_READY;
				break;
			}
			XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_ERROR,
				XHDCP22_RX_ERROR_FLAG_PROCESSING_REPEATERAUTHSTREAMMANAGE);
			XHdcp22Rx_ResetAfterError(InstancePtr);
			XHdcp22Rx_SetDdcReauthReq(InstancePtr);
			return (void *)XHdcp22Rx_StateB0; 
		default:
			XHdcp22Rx_ResetAfterError(InstancePtr);
			return (void *)XHdcp22Rx_StateB0;
		}
	}
	switch(InstancePtr->Info.NextState)
	{
	case XHDCP22_RX_STATE_C7_SEND_STREAM_READY:
		if(XHdcp22Rx_IsReadMessageComplete(InstancePtr) == TRUE)
		{
			Status = XHdcp22Rx_SendMessageRepeaterAuthStreamReady(InstancePtr);
			InstancePtr->Info.HasStreamManagementInfo = TRUE;
			InstancePtr->Info.NextState = XHDCP22_RX_STATE_C7_SEND_STREAM_READY_DONE;
		}
		break;
	case XHDCP22_RX_STATE_C7_SEND_STREAM_READY_DONE:
		if(XHdcp22Rx_IsReadMessageComplete(InstancePtr) == TRUE)
		{
			if(InstancePtr->Info.ReturnState == XHDCP22_RX_STATE_UNDEFINED)
			{
				InstancePtr->Info.NextState = XHDCP22_RX_STATE_C8_AUTHENTICATED;
				return (void *)XHdcp22Rx_StateC8; 
			}
			else
			{
				InstancePtr->Info.NextState = InstancePtr->Info.ReturnState;
				switch(InstancePtr->Info.ReturnState)
				{
				case XHDCP22_RX_STATE_C4_WAIT_FOR_DOWNSTREAM:
					InstancePtr->Info.ReturnState = XHDCP22_RX_STATE_UNDEFINED;
					return (void *)XHdcp22Rx_StateC4; 
				case XHDCP22_RX_STATE_C5_SEND_RECEIVERIDLIST:
					InstancePtr->Info.ReturnState = XHDCP22_RX_STATE_UNDEFINED;
					return (void *)XHdcp22Rx_StateC5; 
				case XHDCP22_RX_STATE_C5_SEND_RECEIVERIDLIST_DONE:
					InstancePtr->Info.ReturnState = XHDCP22_RX_STATE_UNDEFINED;
					return (void *)XHdcp22Rx_StateC5; 
				case XHDCP22_RX_STATE_C6_VERIFY_RECEIVERIDLISTACK:
					InstancePtr->Info.ReturnState = XHDCP22_RX_STATE_UNDEFINED;
					return (void *)XHdcp22Rx_StateC6; 
				case XHDCP22_RX_STATE_C8_AUTHENTICATED:
					InstancePtr->Info.ReturnState = XHDCP22_RX_STATE_UNDEFINED;
					return (void *)XHdcp22Rx_StateC8; 
				default:
					break;
				}
			}
		}
		break;
	default:
		break;
	}
	return (void *)XHdcp22Rx_StateC7; 
}
static void * XHdcp22Rx_StateC7 ( 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 ; } if ( InstancePtr -> Info . SkipRead != TRUE ) { InstancePtr -> MessageSize = XHdcp22Rx_PollMessage ( InstancePtr ) ; } InstancePtr -> Info . SkipRead = FALSE ; 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_REPEATERAUTHSENDACK : InstancePtr -> Info . NextState = InstancePtr -> Info . ReturnState ; InstancePtr -> Info . ReturnState = InstancePtr -> Info . CurrentState ; InstancePtr -> Info . SkipRead = TRUE ; return ( void * ) XHdcp22Rx_StateC6 ; case XHDCP22_RX_MSG_ID_REPEATERAUTHSTREAMMANAGE : Status = XHdcp22Rx_ProcessMessageRepeaterAuthStreamManage ( InstancePtr ) ; if ( Status == XST_SUCCESS ) { InstancePtr -> Info . NextState = XHDCP22_RX_STATE_C7_SEND_STREAM_READY ; break ; } XHdcp22Rx_LogWr ( InstancePtr , XHDCP22_RX_LOG_EVT_ERROR , XHDCP22_RX_ERROR_FLAG_PROCESSING_REPEATERAUTHSTREAMMANAGE ) ; XHdcp22Rx_ResetAfterError ( InstancePtr ) ; XHdcp22Rx_SetDdcReauthReq ( InstancePtr ) ; return ( void * ) XHdcp22Rx_StateB0 ; default : XHdcp22Rx_ResetAfterError ( InstancePtr ) ; return ( void * ) XHdcp22Rx_StateB0 ; } } switch ( InstancePtr -> Info . NextState ) { case XHDCP22_RX_STATE_C7_SEND_STREAM_READY : if ( XHdcp22Rx_IsReadMessageComplete ( InstancePtr ) == TRUE ) { Status = XHdcp22Rx_SendMessageRepeaterAuthStreamReady ( InstancePtr ) ; InstancePtr -> Info . HasStreamManagementInfo = TRUE ; InstancePtr -> Info . NextState = XHDCP22_RX_STATE_C7_SEND_STREAM_READY_DONE ; } break ; case XHDCP22_RX_STATE_C7_SEND_STREAM_READY_DONE : if ( XHdcp22Rx_IsReadMessageComplete ( InstancePtr ) == TRUE ) { if ( InstancePtr -> Info . ReturnState == XHDCP22_RX_STATE_UNDEFINED ) { InstancePtr -> Info . NextState = XHDCP22_RX_STATE_C8_AUTHENTICATED ; return ( void * ) XHdcp22Rx_StateC8 ; } else { InstancePtr -> Info . NextState = InstancePtr -> Info . ReturnState ; switch ( InstancePtr -> Info . ReturnState ) { case XHDCP22_RX_STATE_C4_WAIT_FOR_DOWNSTREAM : InstancePtr -> Info . ReturnState = XHDCP22_RX_STATE_UNDEFINED ; return ( void * ) XHdcp22Rx_StateC4 ; case XHDCP22_RX_STATE_C5_SEND_RECEIVERIDLIST : InstancePtr -> Info . ReturnState = XHDCP22_RX_STATE_UNDEFINED ; return ( void * ) XHdcp22Rx_StateC5 ; case XHDCP22_RX_STATE_C5_SEND_RECEIVERIDLIST_DONE : InstancePtr -> Info . ReturnState = XHDCP22_RX_STATE_UNDEFINED ; return ( void * ) XHdcp22Rx_StateC5 ; case XHDCP22_RX_STATE_C6_VERIFY_RECEIVERIDLISTACK : InstancePtr -> Info . ReturnState = XHDCP22_RX_STATE_UNDEFINED ; return ( void * ) XHdcp22Rx_StateC6 ; case XHDCP22_RX_STATE_C8_AUTHENTICATED : InstancePtr -> Info . ReturnState = XHDCP22_RX_STATE_UNDEFINED ; return ( void * ) XHdcp22Rx_StateC8 ; default : break ; } } } break ; default : break ; } return ( void * ) XHdcp22Rx_StateC7 ; }
This function implements the Repeater State C7 (ContentStreamManagement).
This function implements the Repeater State C7 ( ContentStreamManagement ) .
/* Verify arguments */ /* Update state */ /* Check error condition */ /* Check if message is available.
	   When SkipRead flag is set, this indicates that a message has
	   already been read by another state and should get processed
	   by this state; therefore, skip the first read. */ /* Message handling */ /* Transition C7->B1 */ /* Transition C7->C6 */ /* Transition C7->B0 */ /* Message send */ /* Transition C7->C8 */ /* Transition C7->C4 */ /* Transition C7->C5 */ /* Transition C7->C5 */ /* Transition C7->C6 */ /* Transition C7->C8 */ /* Transition C7->C7 */