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

	/* Update NextStatePtr */
	*NextStatePtr = XHDCP1X_STATE_UNAUTHENTICATED;

	/* Attempt to read Ro */
	do {
		/* Read the remote Ro' */
		if (XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_RO,
				Buf, 2) > 0) {
			char LogBuf[32];
			u16 RemoteRo = 0;
			u16 LocalRo = 0;

			/* Determine RemoteRo */
			XHDCP1X_PORT_BUF_TO_UINT(RemoteRo, Buf, (2 * 8));

			/* Determine theLLocalRoocalRo */
			LocalRo = XHdcp1x_CipherGetRo(InstancePtr);

			/* Compare the Ro values */
			if (LocalRo == RemoteRo) {

				/* Determine theLogBuf */
				snprintf(LogBuf, 32, "rx valid Ro/Ro' (%04X)",
						LocalRo);

				/* Update NextStatePtr */
				*NextStatePtr = XHDCP1X_STATE_TESTFORREPEATER;
			}
			/* Otherwise */
			else {
				/* Determine theLogBuf */
				snprintf(LogBuf, 32, "Ro/Ro' mismatch (%04X/"
						"%04X)", LocalRo, RemoteRo);

				/* Update statistics if the last attempt */
				if (NumTries == 1)
					InstancePtr->Tx.Stats.AuthFailed++;
			}

			/* Log */
			XHdcp1x_TxDebugLog(InstancePtr, LogBuf);
		}
		/* Otherwise */
		else {
			/* Log */
			XHdcp1x_TxDebugLog(InstancePtr, "Ro' read failure");

			/* Update the statistics */
			InstancePtr->Tx.Stats.ReadFailures++;
		}

		/* Update for loop */
		NumTries--;
	}
	while ((*NextStatePtr == XHDCP1X_STATE_UNAUTHENTICATED) &&
		(NumTries > 0));
}
/*****************************************************************************/
/**
* This function validates the attached receiver.
*
* @param	InstancePtr is the HDCP state machine.
* @param	NextStatePtr is the next state.
*
* @return	None.
*
* @note		None.
*
******************************************************************************/
This function validates the attached receiver.
This function validates the attached receiver .
static void XHdcp1x_TxValidateRx(XHdcp1x *InstancePtr,
		XHdcp1x_StateType *NextStatePtr)
{
	u8 Buf[2];
	int NumTries = 3;
	*NextStatePtr = XHDCP1X_STATE_UNAUTHENTICATED;
	do {
		if (XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_RO,
				Buf, 2) > 0) {
			char LogBuf[32];
			u16 RemoteRo = 0;
			u16 LocalRo = 0;
			XHDCP1X_PORT_BUF_TO_UINT(RemoteRo, Buf, (2 * 8));
			LocalRo = XHdcp1x_CipherGetRo(InstancePtr);
			if (LocalRo == RemoteRo) {
				snprintf(LogBuf, 32, "rx valid Ro/Ro' (%04X)",
						LocalRo);
				*NextStatePtr = XHDCP1X_STATE_TESTFORREPEATER;
			}
			else {
				snprintf(LogBuf, 32, "Ro/Ro' mismatch (%04X/"
						"%04X)", LocalRo, RemoteRo);
				if (NumTries == 1)
					InstancePtr->Tx.Stats.AuthFailed++;
			}
			XHdcp1x_TxDebugLog(InstancePtr, LogBuf);
		}
		else {
			XHdcp1x_TxDebugLog(InstancePtr, "Ro' read failure");
			InstancePtr->Tx.Stats.ReadFailures++;
		}
		NumTries--;
	}
	while ((*NextStatePtr == XHDCP1X_STATE_UNAUTHENTICATED) &&
		(NumTries > 0));
}
static void XHdcp1x_TxValidateRx ( XHdcp1x * InstancePtr , XHdcp1x_StateType * NextStatePtr ) { u8 Buf [ 2 ] ; int NumTries = 3 ; * NextStatePtr = XHDCP1X_STATE_UNAUTHENTICATED ; do { if ( XHdcp1x_PortRead ( InstancePtr , XHDCP1X_PORT_OFFSET_RO , Buf , 2 ) > 0 ) { char LogBuf [ 32 ] ; u16 RemoteRo = 0 ; u16 LocalRo = 0 ; XHDCP1X_PORT_BUF_TO_UINT ( RemoteRo , Buf , ( 2 * 8 ) ) ; LocalRo = XHdcp1x_CipherGetRo ( InstancePtr ) ; if ( LocalRo == RemoteRo ) { snprintf ( LogBuf , 32 , " " , LocalRo ) ; * NextStatePtr = XHDCP1X_STATE_TESTFORREPEATER ; } else { snprintf ( LogBuf , 32 , " " " " , LocalRo , RemoteRo ) ; if ( NumTries == 1 ) InstancePtr -> Tx . Stats . AuthFailed ++ ; } XHdcp1x_TxDebugLog ( InstancePtr , LogBuf ) ; } else { XHdcp1x_TxDebugLog ( InstancePtr , " " ) ; InstancePtr -> Tx . Stats . ReadFailures ++ ; } NumTries -- ; } while ( ( * NextStatePtr == XHDCP1X_STATE_UNAUTHENTICATED ) && ( NumTries > 0 ) ) ; }
This function validates the attached receiver.
This function validates the attached receiver .
/* Update NextStatePtr */ /* Attempt to read Ro */ /* Read the remote Ro' */ /* Determine RemoteRo */ /* Determine theLLocalRoocalRo */ /* Compare the Ro values */ /* Determine theLogBuf */ /* Update NextStatePtr */ /* Otherwise */ /* Determine theLogBuf */ /* Update statistics if the last attempt */ /* Log */ /* Otherwise */ /* Log */ /* Update the statistics */ /* Update for loop */