XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_tx.c
static void XHdcp1x_TxPollForWaitForReady(XHdcp1x *InstancePtr,
		XHdcp1x_StateType *NextStatePtr)
{
	u16 RepeaterInfo = 0;
	int Status = XST_SUCCESS;

	/* Attempt to read the repeater info */
	Status = XHdcp1x_PortGetRepeaterInfo(InstancePtr, &RepeaterInfo);
	if (Status == XST_SUCCESS) {
		/* Check that neither cascade or device numbers exceeded */
		if ((!XHdcp1x_TxGetTopologyMaxCascadeExceeded(InstancePtr)) &&
		    (!XHdcp1x_TxGetTopologyMaxDevsExceeded(InstancePtr))) {

			/* Check for at least one attached device */
			if ((RepeaterInfo & 0x007Fu) != 0) {
				/* Update InstancePtr */
				InstancePtr->Tx.StateHelper = RepeaterInfo;

				/* Update NextStatePtr */
				*NextStatePtr = XHDCP1X_STATE_READKSVLIST;

				/* No topology errors. */
				InstancePtr->RepeaterValues.hdcp14_PropagateTopoErrUpstream = FALSE;

				/* Log */
				XHdcp1x_TxDebugLog(InstancePtr,
					"devices attached: ksv list ready");
			}
			/* Otherwise */
			else {
				/*
				 * Check if Repeater. If repeater, goto
				 * unauthenticated state and wait for the
				 * Repeater RX interface to trigger
				 * authentication after timing out of
				 * WaitForDownstream state.
				 * Otherwise, restart authentication on the TX.
				 */
				if (InstancePtr->IsRepeater) {
				/* Update NextStatePtr */
				*NextStatePtr = XHDCP1X_STATE_UNAUTHENTICATED;
				} else {
				/* Update NextStatePtr */
				*NextStatePtr = XHDCP1X_STATE_DETERMINERXCAPABLE;
				}

				/* Log */
				XHdcp1x_TxDebugLog(InstancePtr,
					"no attached devices");
			}
		}
		/* Check for cascade exceeded */
		else {
#if (defined(XPAR_XV_HDMITX_NUM_INSTANCES) && \
     (XPAR_XV_HDMITX_NUM_INSTANCES > 0)) || \
    (defined(XPAR_XV_HDMITX1_NUM_INSTANCES) && \
     (XPAR_XV_HDMITX1_NUM_INSTANCES > 0))
			/* Disable the hdcp encryption for both HDMI and DP.
			 * But currently only doing it for HDMI. */
			XHdcp1x_TxDisableEncryptionState(InstancePtr);

			/* Propagate the failure upstream */
			InstancePtr->RepeaterValues.Depth =
					((RepeaterInfo & 0x0700u) >>
					 XHDCP1X_PORT_BSTATUS_DEPTH_SHIFT);
			InstancePtr->RepeaterValues.DeviceCount =
					(RepeaterInfo &
					 XHDCP1X_PORT_BSTATUS_DEV_CNT_MASK);
			/* Set the KSV List to include the downstream
			 * device's BKSV. Do not Validate or assemble the KSV
			 * List from downstream.*/
			u8 Bksv[8];

			XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_BKSV,
					Bksv, 5);

			u64 RemoteKsv = 0;

			/* Determine theRemoteKsv */
			XHDCP1X_PORT_BUF_TO_UINT(RemoteKsv, Bksv,
					XHDCP1X_PORT_SIZE_BKSV * 8);

			/* Check for invalid */
			if (!XHdcp1x_TxIsKsvValid(RemoteKsv)) {
				InstancePtr->RepeaterValues.KsvList[0] =
					RemoteKsv;
			} else {
				InstancePtr->RepeaterValues.KsvList[0] = 0x0;
			}

			/* Set V' to 0x0. */
			memset(InstancePtr->RepeaterValues.V, 0x0,
			       sizeof(u32)*5);

			InstancePtr->RepeaterValues.hdcp14_PropagateTopoErrUpstream = TRUE;

			if (InstancePtr->Tx.IsRepeaterExchangeCallbackSet) {
				InstancePtr->Tx.RepeaterExchangeCallback(
					InstancePtr->Tx.RepeaterExchangeRef);
			}
#endif

			/* Update NextStatePtr */
			*NextStatePtr = XHDCP1X_STATE_UNAUTHENTICATED;

			/* Log */
			if ((RepeaterInfo & 0x0800u) != 0) {
				XHdcp1x_TxDebugLog(InstancePtr,
					"max cascade exceeded");
			}
			else {
				XHdcp1x_TxDebugLog(InstancePtr,
					"max devices exceeded");
			}
		}
	}
}
/*****************************************************************************/
/**
* This function polls a state machine in the "wait for ready" state.
*
* @param	InstancePtr is the hdcp state machine.
* @param	NextStatePtr is the next state.
*
* @return	None.
*
* @note		None.
*
******************************************************************************/
This function polls a state machine in the "wait for ready" state.
This function polls a state machine in the " wait for ready " state .
static void XHdcp1x_TxPollForWaitForReady(XHdcp1x *InstancePtr,
		XHdcp1x_StateType *NextStatePtr)
{
	u16 RepeaterInfo = 0;
	int Status = XST_SUCCESS;
	Status = XHdcp1x_PortGetRepeaterInfo(InstancePtr, &RepeaterInfo);
	if (Status == XST_SUCCESS) {
		if ((!XHdcp1x_TxGetTopologyMaxCascadeExceeded(InstancePtr)) &&
		    (!XHdcp1x_TxGetTopologyMaxDevsExceeded(InstancePtr))) {
			if ((RepeaterInfo & 0x007Fu) != 0) {
				InstancePtr->Tx.StateHelper = RepeaterInfo;
				*NextStatePtr = XHDCP1X_STATE_READKSVLIST;
				InstancePtr->RepeaterValues.hdcp14_PropagateTopoErrUpstream = FALSE;
				XHdcp1x_TxDebugLog(InstancePtr,
					"devices attached: ksv list ready");
			}
			else {
				if (InstancePtr->IsRepeater) {
				*NextStatePtr = XHDCP1X_STATE_UNAUTHENTICATED;
				} else {
				*NextStatePtr = XHDCP1X_STATE_DETERMINERXCAPABLE;
				}
				XHdcp1x_TxDebugLog(InstancePtr,
					"no attached devices");
			}
		}
		else {
#if (defined(XPAR_XV_HDMITX_NUM_INSTANCES) && \
     (XPAR_XV_HDMITX_NUM_INSTANCES > 0)) || \
    (defined(XPAR_XV_HDMITX1_NUM_INSTANCES) && \
     (XPAR_XV_HDMITX1_NUM_INSTANCES > 0))
			XHdcp1x_TxDisableEncryptionState(InstancePtr);
			InstancePtr->RepeaterValues.Depth =
					((RepeaterInfo & 0x0700u) >>
					 XHDCP1X_PORT_BSTATUS_DEPTH_SHIFT);
			InstancePtr->RepeaterValues.DeviceCount =
					(RepeaterInfo &
					 XHDCP1X_PORT_BSTATUS_DEV_CNT_MASK);
			u8 Bksv[8];
			XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_BKSV,
					Bksv, 5);
			u64 RemoteKsv = 0;
			XHDCP1X_PORT_BUF_TO_UINT(RemoteKsv, Bksv,
					XHDCP1X_PORT_SIZE_BKSV * 8);
			if (!XHdcp1x_TxIsKsvValid(RemoteKsv)) {
				InstancePtr->RepeaterValues.KsvList[0] =
					RemoteKsv;
			} else {
				InstancePtr->RepeaterValues.KsvList[0] = 0x0;
			}
			memset(InstancePtr->RepeaterValues.V, 0x0,
			       sizeof(u32)*5);
			InstancePtr->RepeaterValues.hdcp14_PropagateTopoErrUpstream = TRUE;
			if (InstancePtr->Tx.IsRepeaterExchangeCallbackSet) {
				InstancePtr->Tx.RepeaterExchangeCallback(
					InstancePtr->Tx.RepeaterExchangeRef);
			}
#endif
			*NextStatePtr = XHDCP1X_STATE_UNAUTHENTICATED;
			if ((RepeaterInfo & 0x0800u) != 0) {
				XHdcp1x_TxDebugLog(InstancePtr,
					"max cascade exceeded");
			}
			else {
				XHdcp1x_TxDebugLog(InstancePtr,
					"max devices exceeded");
			}
		}
	}
}
static void XHdcp1x_TxPollForWaitForReady ( XHdcp1x * InstancePtr , XHdcp1x_StateType * NextStatePtr ) { u16 RepeaterInfo = 0 ; int Status = XST_SUCCESS ; Status = XHdcp1x_PortGetRepeaterInfo ( InstancePtr , & RepeaterInfo ) ; if ( Status == XST_SUCCESS ) { if ( ( ! XHdcp1x_TxGetTopologyMaxCascadeExceeded ( InstancePtr ) ) && ( ! XHdcp1x_TxGetTopologyMaxDevsExceeded ( InstancePtr ) ) ) { if ( ( RepeaterInfo & 0x007Fu ) != 0 ) { InstancePtr -> Tx . StateHelper = RepeaterInfo ; * NextStatePtr = XHDCP1X_STATE_READKSVLIST ; InstancePtr -> RepeaterValues . hdcp14_PropagateTopoErrUpstream = FALSE ; XHdcp1x_TxDebugLog ( InstancePtr , " " ) ; } else { if ( InstancePtr -> IsRepeater ) { * NextStatePtr = XHDCP1X_STATE_UNAUTHENTICATED ; } else { * NextStatePtr = XHDCP1X_STATE_DETERMINERXCAPABLE ; } XHdcp1x_TxDebugLog ( InstancePtr , " " ) ; } } else { #if ( defined ( XPAR_XV_HDMITX_NUM_INSTANCES ) && ( XPAR_XV_HDMITX_NUM_INSTANCES > 0 ) ) || ( defined ( XPAR_XV_HDMITX1_NUM_INSTANCES ) && ( XPAR_XV_HDMITX1_NUM_INSTANCES > 0 ) ) XHdcp1x_TxDisableEncryptionState ( InstancePtr ) ; InstancePtr -> RepeaterValues . Depth = ( ( RepeaterInfo & 0x0700u ) >> XHDCP1X_PORT_BSTATUS_DEPTH_SHIFT ) ; InstancePtr -> RepeaterValues . DeviceCount = ( RepeaterInfo & XHDCP1X_PORT_BSTATUS_DEV_CNT_MASK ) ; u8 Bksv [ 8 ] ; XHdcp1x_PortRead ( InstancePtr , XHDCP1X_PORT_OFFSET_BKSV , Bksv , 5 ) ; u64 RemoteKsv = 0 ; XHDCP1X_PORT_BUF_TO_UINT ( RemoteKsv , Bksv , XHDCP1X_PORT_SIZE_BKSV * 8 ) ; if ( ! XHdcp1x_TxIsKsvValid ( RemoteKsv ) ) { InstancePtr -> RepeaterValues . KsvList [ 0 ] = RemoteKsv ; } else { InstancePtr -> RepeaterValues . KsvList [ 0 ] = 0x0 ; } memset ( InstancePtr -> RepeaterValues . V , 0x0 , sizeof ( u32 ) * 5 ) ; InstancePtr -> RepeaterValues . hdcp14_PropagateTopoErrUpstream = TRUE ; if ( InstancePtr -> Tx . IsRepeaterExchangeCallbackSet ) { InstancePtr -> Tx . RepeaterExchangeCallback ( InstancePtr -> Tx . RepeaterExchangeRef ) ; } #endif * NextStatePtr = XHDCP1X_STATE_UNAUTHENTICATED ; if ( ( RepeaterInfo & 0x0800u ) != 0 ) { XHdcp1x_TxDebugLog ( InstancePtr , " " ) ; } else { XHdcp1x_TxDebugLog ( InstancePtr , " " ) ; } } } }
This function polls a state machine in the "wait for ready" state.
This function polls a state machine in the " wait for ready " state .
/* Attempt to read the repeater info */ /* Check that neither cascade or device numbers exceeded */ /* Check for at least one attached device */ /* Update InstancePtr */ /* Update NextStatePtr */ /* No topology errors. */ /* Log */ /* Otherwise */ /*
				 * Check if Repeater. If repeater, goto
				 * unauthenticated state and wait for the
				 * Repeater RX interface to trigger
				 * authentication after timing out of
				 * WaitForDownstream state.
				 * Otherwise, restart authentication on the TX.
				 */ /* Update NextStatePtr */ /* Update NextStatePtr */ /* Log */ /* Check for cascade exceeded */ /* Disable the hdcp encryption for both HDMI and DP.
			 * But currently only doing it for HDMI. */ /* Propagate the failure upstream */ /* Set the KSV List to include the downstream
			 * device's BKSV. Do not Validate or assemble the KSV
			 * List from downstream.*/ /* Determine theRemoteKsv */ /* Check for invalid */ /* Set V' to 0x0. */ /* Update NextStatePtr */ /* Log */