XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_tx.c
static void XHdcp1x_TxCheckLinkIntegrity(XHdcp1x *InstancePtr,
		XHdcp1x_StateType *NextStatePtr)
{
	u8 Buf[2];
	int NumTries = 3;

	/* Update theNextState */
	*NextStatePtr = XHDCP1X_STATE_DETERMINERXCAPABLE;

	/* Iterate through the tries */
	do {
		/* Read the remote Ri' */
		if (XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_RO,
				Buf, 2) > 0) {

			char LogBuf[48];
			u16 RemoteRi = 0;
			u16 LocalRi = 0;

			/* Determine theRemoteRo */
			XHDCP1X_PORT_BUF_TO_UINT(RemoteRi, Buf, 16);

			/* Determine theLocalRi */
			LocalRi = XHdcp1x_CipherGetRi(InstancePtr);

			/* Compare the local and remote values */
			if (LocalRi == RemoteRi) {
				*NextStatePtr = XHDCP1X_STATE_AUTHENTICATED;
				snprintf(LogBuf, 48, "link check passed Ri/Ri'"
						"(%04X)", LocalRi);
			}
			/* Check for last attempt */
			else if (NumTries == 1) {
				snprintf(LogBuf, 48, "link check failed Ri/Ri'"
						"(%04X/%04X)", LocalRi,
						RemoteRi);
			}

			/* Log */
			XHdcp1x_TxDebugLog(InstancePtr, LogBuf);
		}
		else {
			XHdcp1x_TxDebugLog(InstancePtr, "Ri' read failure");
			InstancePtr->Tx.Stats.ReadFailures++;
		}

		/* Update for loop */
		NumTries--;
	} while ((*NextStatePtr != XHDCP1X_STATE_AUTHENTICATED) &&
		(NumTries > 0));

	/* Check for success */
	if (*NextStatePtr == XHDCP1X_STATE_AUTHENTICATED) {
		InstancePtr->Tx.Stats.LinkCheckPassed++;
	}
	else {
		InstancePtr->Tx.Stats.LinkCheckFailed++;
	}
}
/*****************************************************************************/
/**
* This function checks the integrity of a HDCP link.
*
* @param	InstancePtr is the hdcp state machine.
* @param	NextStatePtr is the next state.
*
* @return	None.
*
* @note		None.
*
******************************************************************************/
This function checks the integrity of a HDCP link.
This function checks the integrity of a HDCP link .
static void XHdcp1x_TxCheckLinkIntegrity(XHdcp1x *InstancePtr,
		XHdcp1x_StateType *NextStatePtr)
{
	u8 Buf[2];
	int NumTries = 3;
	*NextStatePtr = XHDCP1X_STATE_DETERMINERXCAPABLE;
	do {
		if (XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_RO,
				Buf, 2) > 0) {
			char LogBuf[48];
			u16 RemoteRi = 0;
			u16 LocalRi = 0;
			XHDCP1X_PORT_BUF_TO_UINT(RemoteRi, Buf, 16);
			LocalRi = XHdcp1x_CipherGetRi(InstancePtr);
			if (LocalRi == RemoteRi) {
				*NextStatePtr = XHDCP1X_STATE_AUTHENTICATED;
				snprintf(LogBuf, 48, "link check passed Ri/Ri'"
						"(%04X)", LocalRi);
			}
			else if (NumTries == 1) {
				snprintf(LogBuf, 48, "link check failed Ri/Ri'"
						"(%04X/%04X)", LocalRi,
						RemoteRi);
			}
			XHdcp1x_TxDebugLog(InstancePtr, LogBuf);
		}
		else {
			XHdcp1x_TxDebugLog(InstancePtr, "Ri' read failure");
			InstancePtr->Tx.Stats.ReadFailures++;
		}
		NumTries--;
	} while ((*NextStatePtr != XHDCP1X_STATE_AUTHENTICATED) &&
		(NumTries > 0));
	if (*NextStatePtr == XHDCP1X_STATE_AUTHENTICATED) {
		InstancePtr->Tx.Stats.LinkCheckPassed++;
	}
	else {
		InstancePtr->Tx.Stats.LinkCheckFailed++;
	}
}
static void XHdcp1x_TxCheckLinkIntegrity ( XHdcp1x * InstancePtr , XHdcp1x_StateType * NextStatePtr ) { u8 Buf [ 2 ] ; int NumTries = 3 ; * NextStatePtr = XHDCP1X_STATE_DETERMINERXCAPABLE ; do { if ( XHdcp1x_PortRead ( InstancePtr , XHDCP1X_PORT_OFFSET_RO , Buf , 2 ) > 0 ) { char LogBuf [ 48 ] ; u16 RemoteRi = 0 ; u16 LocalRi = 0 ; XHDCP1X_PORT_BUF_TO_UINT ( RemoteRi , Buf , 16 ) ; LocalRi = XHdcp1x_CipherGetRi ( InstancePtr ) ; if ( LocalRi == RemoteRi ) { * NextStatePtr = XHDCP1X_STATE_AUTHENTICATED ; snprintf ( LogBuf , 48 , " " " " , LocalRi ) ; } else if ( NumTries == 1 ) { snprintf ( LogBuf , 48 , " " " " , LocalRi , RemoteRi ) ; } XHdcp1x_TxDebugLog ( InstancePtr , LogBuf ) ; } else { XHdcp1x_TxDebugLog ( InstancePtr , " " ) ; InstancePtr -> Tx . Stats . ReadFailures ++ ; } NumTries -- ; } while ( ( * NextStatePtr != XHDCP1X_STATE_AUTHENTICATED ) && ( NumTries > 0 ) ) ; if ( * NextStatePtr == XHDCP1X_STATE_AUTHENTICATED ) { InstancePtr -> Tx . Stats . LinkCheckPassed ++ ; } else { InstancePtr -> Tx . Stats . LinkCheckFailed ++ ; } }
This function checks the integrity of a HDCP link.
This function checks the integrity of a HDCP link .
/* Update theNextState */ /* Iterate through the tries */ /* Read the remote Ri' */ /* Determine theRemoteRo */ /* Determine theLocalRi */ /* Compare the local and remote values */ /* Check for last attempt */ /* Log */ /* Update for loop */ /* Check for success */