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

	XHdcp22_Tx_DDCMessage *MsgPtr =
		(XHdcp22_Tx_DDCMessage *)InstancePtr->MessageBuffer;

	/* Wait for the receiver to respond within 100 msecs.
	* If the receiver has timed out we go to state A9 for a retry.
	* If the receiver is busy, we stay in this state (return from polling).
	* If the receiver has finished, but the message was not handled yet,
	* we handle the message.*/
	Result = XHdcp22Tx_WaitForReceiver(InstancePtr, XHDCP22_TX_REPEATAUTH_STREAM_READY_SIZE, FALSE);
	if (Result != XST_SUCCESS) {
		/* Timeout. Go to state A9 for a retry */
		InstancePtr->Info.ContentStreamManageFailed = TRUE;
		return XHDCP22_TX_STATE_A9;
	}
	if (InstancePtr->Info.MsgAvailable == (FALSE)) {
		return XHDCP22_TX_STATE_A9_1;
	}

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

	/* Receive the expected message */
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG, XHDCP22_TX_LOG_DBG_RX_M1);
	Result = XHdcp22Tx_ReceiveMsg(InstancePtr, XHDCP22_TX_REPEATAUTH_STREAM_READY,
		                                            XHDCP22_TX_REPEATAUTH_STREAM_READY_SIZE);
	if (Result != XST_SUCCESS) {
		/* Received message is invalid. Go to state A9 for a retry */
		InstancePtr->Info.ContentStreamManageFailed = TRUE;
		return XHDCP22_TX_STATE_A9;
	}

	/* Verify the received MPrime */
	/* We've allready calculated and stored the expected value in the
	 * XHdcp22Tx_WriteRepeaterAuth_Stream_Manage function */
	/* Compare MPrime with M */
	if (memcmp(MsgPtr->Message.RepeatAuthStreamReady.MPrime, InstancePtr->Info.M,
		XHDCP22_TX_M_PRIME_SIZE) != 0) {
		/* Missmatch M and MPrime. Go to state A9 for a retry */
		InstancePtr->Info.ContentStreamManageFailed = TRUE;
		return XHDCP22_TX_STATE_A9;
	}

	/* According to the spec, the HDCP transmitter must write the
	 * RepeaterAuth_Stream_Manage message at least 100ms before the
	 * transmission of the corresponding Content Stream. Just to make
	 * sure the wait time is met, wait for 100ms. */
	XHdcp22Tx_StartTimer(InstancePtr, 100, XHDCP22_TX_TS_WAIT_FOR_CIPHER);

	InstancePtr->Info.ContentStreamManageFailed = FALSE;
	InstancePtr->Info.IsContentStreamTypeSent = TRUE;
	return XHDCP22_TX_STATE_A5;
}
/*****************************************************************************/
/**
*
* This function executes the second 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 second portion of the A9 state of the HDCP2.2 TX protocol.
This function executes the second portion of the A9 state of the HDCP2 . 2 TX protocol .
static XHdcp22_Tx_StateType XHdcp22Tx_StateA9_1(XHdcp22_Tx *InstancePtr)
{
	int Result;
	XHdcp22_Tx_DDCMessage *MsgPtr =
		(XHdcp22_Tx_DDCMessage *)InstancePtr->MessageBuffer;
	Result = XHdcp22Tx_WaitForReceiver(InstancePtr, XHDCP22_TX_REPEATAUTH_STREAM_READY_SIZE, FALSE);
	if (Result != XST_SUCCESS) {
		InstancePtr->Info.ContentStreamManageFailed = TRUE;
		return XHDCP22_TX_STATE_A9;
	}
	if (InstancePtr->Info.MsgAvailable == (FALSE)) {
		return XHDCP22_TX_STATE_A9_1;
	}
	if (InstancePtr->Info.ContentStreamManageCheckCounter == 1) {
		XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_STATE,
		                (u16)XHDCP22_TX_STATE_A9_1);
	}
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG, XHDCP22_TX_LOG_DBG_RX_M1);
	Result = XHdcp22Tx_ReceiveMsg(InstancePtr, XHDCP22_TX_REPEATAUTH_STREAM_READY,
		                                            XHDCP22_TX_REPEATAUTH_STREAM_READY_SIZE);
	if (Result != XST_SUCCESS) {
		InstancePtr->Info.ContentStreamManageFailed = TRUE;
		return XHDCP22_TX_STATE_A9;
	}
	if (memcmp(MsgPtr->Message.RepeatAuthStreamReady.MPrime, InstancePtr->Info.M,
		XHDCP22_TX_M_PRIME_SIZE) != 0) {
		InstancePtr->Info.ContentStreamManageFailed = TRUE;
		return XHDCP22_TX_STATE_A9;
	}
	XHdcp22Tx_StartTimer(InstancePtr, 100, XHDCP22_TX_TS_WAIT_FOR_CIPHER);
	InstancePtr->Info.ContentStreamManageFailed = FALSE;
	InstancePtr->Info.IsContentStreamTypeSent = TRUE;
	return XHDCP22_TX_STATE_A5;
}
static XHdcp22_Tx_StateType XHdcp22Tx_StateA9_1 ( XHdcp22_Tx * InstancePtr ) { int Result ; XHdcp22_Tx_DDCMessage * MsgPtr = ( XHdcp22_Tx_DDCMessage * ) InstancePtr -> MessageBuffer ; Result = XHdcp22Tx_WaitForReceiver ( InstancePtr , XHDCP22_TX_REPEATAUTH_STREAM_READY_SIZE , FALSE ) ; if ( Result != XST_SUCCESS ) { InstancePtr -> Info . ContentStreamManageFailed = TRUE ; return XHDCP22_TX_STATE_A9 ; } if ( InstancePtr -> Info . MsgAvailable == ( FALSE ) ) { return XHDCP22_TX_STATE_A9_1 ; } if ( InstancePtr -> Info . ContentStreamManageCheckCounter == 1 ) { XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_STATE , ( u16 ) XHDCP22_TX_STATE_A9_1 ) ; } XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_DBG , XHDCP22_TX_LOG_DBG_RX_M1 ) ; Result = XHdcp22Tx_ReceiveMsg ( InstancePtr , XHDCP22_TX_REPEATAUTH_STREAM_READY , XHDCP22_TX_REPEATAUTH_STREAM_READY_SIZE ) ; if ( Result != XST_SUCCESS ) { InstancePtr -> Info . ContentStreamManageFailed = TRUE ; return XHDCP22_TX_STATE_A9 ; } if ( memcmp ( MsgPtr -> Message . RepeatAuthStreamReady . MPrime , InstancePtr -> Info . M , XHDCP22_TX_M_PRIME_SIZE ) != 0 ) { InstancePtr -> Info . ContentStreamManageFailed = TRUE ; return XHDCP22_TX_STATE_A9 ; } XHdcp22Tx_StartTimer ( InstancePtr , 100 , XHDCP22_TX_TS_WAIT_FOR_CIPHER ) ; InstancePtr -> Info . ContentStreamManageFailed = FALSE ; InstancePtr -> Info . IsContentStreamTypeSent = TRUE ; return XHDCP22_TX_STATE_A5 ; }
This function executes the second portion of the A9 state of the HDCP2.2 TX protocol.
This function executes the second portion of the A9 state of the HDCP2 . 2 TX protocol .
/* Wait for the receiver to respond within 100 msecs.
	* If the receiver has timed out we go to state A9 for a retry.
	* If the receiver is busy, we stay in this state (return from polling).
	* If the receiver has finished, but the message was not handled yet,
	* we handle the message.*/ /* Timeout. Go to state A9 for a retry */ /* Log after waiting (don't clutter our log buffer, check on counter) */ /* Receive the expected message */ /* Received message is invalid. Go to state A9 for a retry */ /* Verify the received MPrime */ /* We've allready calculated and stored the expected value in the
	 * XHdcp22Tx_WriteRepeaterAuth_Stream_Manage function */ /* Compare MPrime with M */ /* Missmatch M and MPrime. Go to state A9 for a retry */ /* According to the spec, the HDCP transmitter must write the
	 * RepeaterAuth_Stream_Manage message at least 100ms before the
	 * transmission of the corresponding Content Stream. Just to make
	 * sure the wait time is met, wait for 100ms. */