XilinxProcessorIPLib/drivers/hdcp22_tx_dp/src/xhdcp22_tx.c
static XHdcp22_Tx_StateType XHdcp22Tx_StateA9(XHdcp22_Tx *InstancePtr)
{
	int Result;

#ifndef _XHDCP22_TX_DISABLE_TIMEOUT_CHECKING_
	/* Wait for the stream manage timer to expire */
	if (InstancePtr->Timer.TimerExpired == (FALSE)) {
		return XHDCP22_TX_STATE_A9;
	}
#endif

	/* Timer has expired, handle it */

	/* Check re-authentication */
	XHdcp22Tx_ReadRxStatus(InstancePtr);
	if ((InstancePtr->Info.RxStatus&XHDCP22_TX_RXSTATUS_REAUTH_REQ_MASK) ==
		XHDCP22_TX_RXSTATUS_REAUTH_REQ_MASK) {
		XHdcp22Tx_HandleReauthenticationRequest(InstancePtr);
		return XHDCP22_TX_STATE_A0;
	}

	/* Check if the Content Stream Type is available.
	 * If not set, we stay in this state (return from polling) and set a timer */
	if (InstancePtr->Info.IsContentStreamTypeSet == FALSE) {
		/* Start the wait for stream type timer */
		XHdcp22Tx_StartTimer(InstancePtr, 50, XHDCP22_TX_TS_WAIT_FOR_STREAM_TYPE);
		return XHDCP22_TX_STATE_A9;
	}

	/* Log but don't clutter our log buffer, check on counter */
	if (InstancePtr->Info.ContentStreamManageCheckCounter == 0) {
		XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_STATE,
		                (u16)XHDCP22_TX_STATE_A9);
	}

	if (InstancePtr->Info.ContentStreamManageCheckCounter >= XHDCP22_TX_MAX_ALLOWED_STREAM_MANAGE_CHECKS) {
		XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_STRMMNGCHK_COUNT,
		                (u16)InstancePtr->Info.ContentStreamManageCheckCounter);
		return XHDCP22_TX_STATE_A0;
	}

	/* Check for roll-over of seq_num_M */
	if ((InstancePtr->Info.SentFirstSeqNum_M == TRUE) &&
		(InstancePtr->Info.SeqNum_M == 0)) {
		/* Roll-over detected. According to the state-diagram
		 * we should go to state H1 and restart authentication.
		 * Instead of doing that we restart authentication by going to state A0 */
		return XHDCP22_TX_STATE_A0;
	}

	/* Send the Content Stream Manage message */
	Result = XHdcp22Tx_WriteRepeaterAuth_Stream_Manage(InstancePtr);

	if (Result != XST_SUCCESS) {
		XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG, XHDCP22_TX_LOG_DBG_MSG_WRITE_FAIL);
		return XHDCP22_TX_STATE_A0;
	}

	/* Start the timer for receiving XHDCP22_TX_REPEATAUTH_STREAM_READY */
	XHdcp22Tx_StartTimer(InstancePtr, 20, XHDCP22_TX_REPEATAUTH_STREAM_READY);

	InstancePtr->Info.SentFirstSeqNum_M = TRUE;
	InstancePtr->Info.ContentStreamManageCheckCounter++;

	return XHDCP22_TX_STATE_A9_1;
}
/*****************************************************************************/
/**
*
* This function executes the first portion of the A9 state of the HDCP2.2 TX protocol.
*
* @param  InstancePtr is a pointer to the XHdcp22Tx core instance.
*
* @return The next state to execute.
*
* @note   None.
*
******************************************************************************/
This function executes the first portion of the A9 state of the HDCP2.2 TX protocol.
This function executes the first portion of the A9 state of the HDCP2 . 2 TX protocol .
static XHdcp22_Tx_StateType XHdcp22Tx_StateA9(XHdcp22_Tx *InstancePtr)
{
	int Result;
#ifndef _XHDCP22_TX_DISABLE_TIMEOUT_CHECKING_
	if (InstancePtr->Timer.TimerExpired == (FALSE)) {
		return XHDCP22_TX_STATE_A9;
	}
#endif
	XHdcp22Tx_ReadRxStatus(InstancePtr);
	if ((InstancePtr->Info.RxStatus&XHDCP22_TX_RXSTATUS_REAUTH_REQ_MASK) ==
		XHDCP22_TX_RXSTATUS_REAUTH_REQ_MASK) {
		XHdcp22Tx_HandleReauthenticationRequest(InstancePtr);
		return XHDCP22_TX_STATE_A0;
	}
	if (InstancePtr->Info.IsContentStreamTypeSet == FALSE) {
		XHdcp22Tx_StartTimer(InstancePtr, 50, XHDCP22_TX_TS_WAIT_FOR_STREAM_TYPE);
		return XHDCP22_TX_STATE_A9;
	}
	if (InstancePtr->Info.ContentStreamManageCheckCounter == 0) {
		XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_STATE,
		                (u16)XHDCP22_TX_STATE_A9);
	}
	if (InstancePtr->Info.ContentStreamManageCheckCounter >= XHDCP22_TX_MAX_ALLOWED_STREAM_MANAGE_CHECKS) {
		XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_STRMMNGCHK_COUNT,
		                (u16)InstancePtr->Info.ContentStreamManageCheckCounter);
		return XHDCP22_TX_STATE_A0;
	}
	if ((InstancePtr->Info.SentFirstSeqNum_M == TRUE) &&
		(InstancePtr->Info.SeqNum_M == 0)) {
		return XHDCP22_TX_STATE_A0;
	}
	Result = XHdcp22Tx_WriteRepeaterAuth_Stream_Manage(InstancePtr);
	if (Result != XST_SUCCESS) {
		XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG, XHDCP22_TX_LOG_DBG_MSG_WRITE_FAIL);
		return XHDCP22_TX_STATE_A0;
	}
	XHdcp22Tx_StartTimer(InstancePtr, 20, XHDCP22_TX_REPEATAUTH_STREAM_READY);
	InstancePtr->Info.SentFirstSeqNum_M = TRUE;
	InstancePtr->Info.ContentStreamManageCheckCounter++;
	return XHDCP22_TX_STATE_A9_1;
}
static XHdcp22_Tx_StateType XHdcp22Tx_StateA9 ( XHdcp22_Tx * InstancePtr ) { int Result ; #ifndef _XHDCP22_TX_DISABLE_TIMEOUT_CHECKING_ if ( InstancePtr -> Timer . TimerExpired == ( FALSE ) ) { return XHDCP22_TX_STATE_A9 ; } #endif XHdcp22Tx_ReadRxStatus ( InstancePtr ) ; if ( ( InstancePtr -> Info . RxStatus & XHDCP22_TX_RXSTATUS_REAUTH_REQ_MASK ) == XHDCP22_TX_RXSTATUS_REAUTH_REQ_MASK ) { XHdcp22Tx_HandleReauthenticationRequest ( InstancePtr ) ; return XHDCP22_TX_STATE_A0 ; } if ( InstancePtr -> Info . IsContentStreamTypeSet == FALSE ) { XHdcp22Tx_StartTimer ( InstancePtr , 50 , XHDCP22_TX_TS_WAIT_FOR_STREAM_TYPE ) ; return XHDCP22_TX_STATE_A9 ; } if ( InstancePtr -> Info . ContentStreamManageCheckCounter == 0 ) { XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_STATE , ( u16 ) XHDCP22_TX_STATE_A9 ) ; } if ( InstancePtr -> Info . ContentStreamManageCheckCounter >= XHDCP22_TX_MAX_ALLOWED_STREAM_MANAGE_CHECKS ) { XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_STRMMNGCHK_COUNT , ( u16 ) InstancePtr -> Info . ContentStreamManageCheckCounter ) ; return XHDCP22_TX_STATE_A0 ; } if ( ( InstancePtr -> Info . SentFirstSeqNum_M == TRUE ) && ( InstancePtr -> Info . SeqNum_M == 0 ) ) { return XHDCP22_TX_STATE_A0 ; } Result = XHdcp22Tx_WriteRepeaterAuth_Stream_Manage ( InstancePtr ) ; if ( Result != XST_SUCCESS ) { XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_DBG , XHDCP22_TX_LOG_DBG_MSG_WRITE_FAIL ) ; return XHDCP22_TX_STATE_A0 ; } XHdcp22Tx_StartTimer ( InstancePtr , 20 , XHDCP22_TX_REPEATAUTH_STREAM_READY ) ; InstancePtr -> Info . SentFirstSeqNum_M = TRUE ; InstancePtr -> Info . ContentStreamManageCheckCounter ++ ; return XHDCP22_TX_STATE_A9_1 ; }
This function executes the first portion of the A9 state of the HDCP2.2 TX protocol.
This function executes the first portion of the A9 state of the HDCP2 . 2 TX protocol .
/* Wait for the stream manage timer to expire */ /* Timer has expired, handle it */ /* Check re-authentication */ /* Check if the Content Stream Type is available.
	 * If not set, we stay in this state (return from polling) and set a timer */ /* Start the wait for stream type timer */ /* Log but don't clutter our log buffer, check on counter */ /* Check for roll-over of seq_num_M */ /* Roll-over detected. According to the state-diagram
		 * we should go to state H1 and restart authentication.
		 * Instead of doing that we restart authentication by going to state A0 */ /* Send the Content Stream Manage message */ /* Start the timer for receiving XHDCP22_TX_REPEATAUTH_STREAM_READY */