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

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

	/* Run callback function type: XHDCP22_RX_HANDLER_AUTHENTICATED
	   Only run once and clear params */
	if(InstancePtr->Info.CurrentState != InstancePtr->Info.NextState)
	{
	    if(InstancePtr->Handles.IsAuthenticatedCallbackSet)
		{
			InstancePtr->Handles.AuthenticatedCallback(InstancePtr->Handles.AuthenticatedCallbackRef);
		}

	  /* Start 1 second timer */
	  XHdcp22Rx_StartTimer(InstancePtr, XHDCP22_RX_ENCRYPTION_STATUS_INTERVAL, 0);
	}

	/* Run callback function type: XHDCP22_RX_HANDLER_ENCRYPTION_UPDATE */
	if(InstancePtr->Info.TimerExpired == TRUE)
	{
	  Status = XHdcp22Cipher_IsEncrypted(&InstancePtr->CipherInst);

	/* Encryption Enabled */
	  if((InstancePtr->Info.IsEncrypted != Status)) {
		  if(InstancePtr->Handles.IsEncryptionStatusCallbackSet)
		  {
			InstancePtr->Handles.EncryptionStatusCallback(InstancePtr->Handles.EncryptionStatusCallbackRef);
		  }
	}

	  InstancePtr->Info.IsEncrypted = Status;

	  /* Start 1 second timer */
	  XHdcp22Rx_StartTimer(InstancePtr, XHDCP22_RX_ENCRYPTION_STATUS_INTERVAL, 0);
	}

	/* Update state */
	InstancePtr->Info.AuthenticationStatus = XHDCP22_RX_AUTHENTICATED;
	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 C8->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:
			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 C8->C5 */
	}

	return (void *)XHdcp22Rx_StateC8; /* Transition C8->C8 */
}
/*****************************************************************************/
/**
* This function implements the Receiver State C8 (Authenticated). The
* repeater has completed the authentication protocol. Upon detection
* of any changes to the topology a transition back to State C5
* (AssembleReceiverIdList) occurs. Change to the topology occur when
* a repeater downstream port has transitioned to the following:
* authenticated, unauthenticated, or unconnected. This function
* executes the XHDCP22_RX_HANDLER_AUTHENTICATED user callback function
* on transition to this state. An ongoing link integrity check is performed
* external to the HDCP22-RX system to detect synchronization mismatches
* between transmitter and receiver. RxStatus REAUTH_REQ bit is set if
* 50 consecutive data island CRC errors are detected. Setting the REAUTH_REQ
* bit signals the transmitter to re-initiate authentication.
*
* @param    InstancePtr is a pointer to the XHdcp22_Rx core instance.
*
* @return   Pointer to the function that implements the next state.
*
* @note     When an unexpected or malformed message is received the
*           system is reset to the default state B0 to allow graceful
*           recovery from error.
******************************************************************************/
This function implements the Receiver State C8 (Authenticated). The
repeater has completed the authentication protocol. Upon detection
of any changes to the topology a transition back to State C5
(AssembleReceiverIdList) occurs. Change to the topology occur when
a repeater downstream port has transitioned to the following:
authenticated, unauthenticated, or unconnected. This function
executes the XHDCP22_RX_HANDLER_AUTHENTICATED user callback function
on transition to this state. An ongoing link integrity check is performed
external to the HDCP22-RX system to detect synchronization mismatches
between transmitter and receiver. RxStatus REAUTH_REQ bit is set if
50 consecutive data island CRC errors are detected. Setting the REAUTH_REQ
bit signals the transmitter to re-initiate authentication.
This function implements the Receiver State C8 ( Authenticated ) . The repeater has completed the authentication protocol . Upon detection of any changes to the topology a transition back to State C5 ( AssembleReceiverIdList ) occurs . Change to the topology occur when a repeater downstream port has transitioned to the following : authenticated unauthenticated or unconnected . This function executes the XHDCP22_RX_HANDLER_AUTHENTICATED user callback function on transition to this state . An ongoing link integrity check is performed external to the HDCP22 - RX system to detect synchronization mismatches between transmitter and receiver . RxStatus REAUTH_REQ bit is set if 50 consecutive data island CRC errors are detected . Setting the REAUTH_REQ bit signals the transmitter to re - initiate authentication .
static void *XHdcp22Rx_StateC8(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)
	{
	    if(InstancePtr->Handles.IsAuthenticatedCallbackSet)
		{
			InstancePtr->Handles.AuthenticatedCallback(InstancePtr->Handles.AuthenticatedCallbackRef);
		}
	  XHdcp22Rx_StartTimer(InstancePtr, XHDCP22_RX_ENCRYPTION_STATUS_INTERVAL, 0);
	}
	if(InstancePtr->Info.TimerExpired == TRUE)
	{
	  Status = XHdcp22Cipher_IsEncrypted(&InstancePtr->CipherInst);
	  if((InstancePtr->Info.IsEncrypted != Status)) {
		  if(InstancePtr->Handles.IsEncryptionStatusCallbackSet)
		  {
			InstancePtr->Handles.EncryptionStatusCallback(InstancePtr->Handles.EncryptionStatusCallbackRef);
		  }
	}
	  InstancePtr->Info.IsEncrypted = Status;
	  XHdcp22Rx_StartTimer(InstancePtr, XHDCP22_RX_ENCRYPTION_STATUS_INTERVAL, 0);
	}
	InstancePtr->Info.AuthenticationStatus = XHDCP22_RX_AUTHENTICATED;
	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_StateC8; 
}
static void * XHdcp22Rx_StateC8 ( 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 ) { if ( InstancePtr -> Handles . IsAuthenticatedCallbackSet ) { InstancePtr -> Handles . AuthenticatedCallback ( InstancePtr -> Handles . AuthenticatedCallbackRef ) ; } XHdcp22Rx_StartTimer ( InstancePtr , XHDCP22_RX_ENCRYPTION_STATUS_INTERVAL , 0 ) ; } if ( InstancePtr -> Info . TimerExpired == TRUE ) { Status = XHdcp22Cipher_IsEncrypted ( & InstancePtr -> CipherInst ) ; if ( ( InstancePtr -> Info . IsEncrypted != Status ) ) { if ( InstancePtr -> Handles . IsEncryptionStatusCallbackSet ) { InstancePtr -> Handles . EncryptionStatusCallback ( InstancePtr -> Handles . EncryptionStatusCallbackRef ) ; } } InstancePtr -> Info . IsEncrypted = Status ; XHdcp22Rx_StartTimer ( InstancePtr , XHDCP22_RX_ENCRYPTION_STATUS_INTERVAL , 0 ) ; } InstancePtr -> Info . AuthenticationStatus = XHDCP22_RX_AUTHENTICATED ; 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_StateC8 ; }
This function implements the Receiver State C8 (Authenticated).
This function implements the Receiver State C8 ( Authenticated ) .
/* Verify arguments */ /* Run callback function type: XHDCP22_RX_HANDLER_AUTHENTICATED
	   Only run once and clear params */ /* Start 1 second timer */ /* Run callback function type: XHDCP22_RX_HANDLER_ENCRYPTION_UPDATE */ /* Encryption Enabled */ /* Start 1 second timer */ /* Update state */ /* Check error condition */ /* Check if message is available */ /* Message handling */ /* Transition C8->B1 */ /* Check the topology update flag */ /* Transition C8->C5 */ /* Transition C8->C8 */