XilinxProcessorIPLib/drivers/hdcp22_rx/src/xhdcp22_rx.c
static int XHdcp22Rx_ProcessMessageAKEInit(XHdcp22_Rx *InstancePtr)
{
	/* Verify arguments */
	Xil_AssertNonvoid(InstancePtr != NULL);

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

	/* Log message read completion */
	XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_INFO_MESSAGE, XHDCP22_RX_MSG_ID_AKEINIT);

	/* Increment authentication request count */
	InstancePtr->Info.AuthRequestCnt++;

	/* Reset cipher */
	XHdcp22Cipher_Disable(&InstancePtr->CipherInst);
	XHdcp22Cipher_Enable(&InstancePtr->CipherInst);

	/* Reset timer counter */
	XTmrCtr_Reset(&InstancePtr->TimerInst, XHDCP22_RX_TMR_CTR_0);
	XHdcp22Rx_StopTimer(InstancePtr);

	/* Reset repeater values */
	memset(&InstancePtr->Topology, 0, sizeof(XHdcp22_Rx_Topology));
	InstancePtr->Info.ReauthReq = FALSE;
	InstancePtr->Info.TopologyReady = FALSE;
	InstancePtr->Info.IsTopologyValid = FALSE;
	InstancePtr->Info.ReturnState = XHDCP22_RX_STATE_UNDEFINED;
	InstancePtr->Info.SeqNumV = 0;
	InstancePtr->Info.HasStreamManagementInfo = FALSE;
	InstancePtr->Info.SkipRead = FALSE;

	/* Check message size */
	if(InstancePtr->MessageSize != sizeof(XHdcp22_Rx_AKEInit))
	{
		XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_ERROR, XHDCP22_RX_ERROR_FLAG_MESSAGE_SIZE);
		return XST_FAILURE;
	}

	/* Reset state variables and DDC registers */
	XHdcp22Rx_ResetParams(InstancePtr);
	XHdcp22Rx_ResetDdc(InstancePtr, FALSE, TRUE, TRUE, TRUE);

	/* Record Rtx and TxCaps parameters */
	memcpy(InstancePtr->Params.Rtx, MsgPtr->AKEInit.Rtx, XHDCP22_RX_RTX_SIZE);
	memcpy(InstancePtr->Params.TxCaps, MsgPtr->AKEInit.TxCaps, XHDCP22_RX_TXCAPS_SIZE);

	/* Run callback function type: XHDCP22_RX_HANDLER_UNAUTHENTICATED */
	if((InstancePtr->Handles.IsUnauthenticatedCallbackSet) &&
		 (InstancePtr->Info.AuthenticationStatus == XHDCP22_RX_AUTHENTICATED))
	{
		InstancePtr->Handles.UnauthenticatedCallback(InstancePtr->Handles.UnauthenticatedCallbackRef);
	}

	/* Run callback function type: XHDCP22_RX_HANDLER_AUTHENTICATION_REQUEST */
	if(InstancePtr->Handles.IsAuthenticationRequestCallbackSet)
	{
		InstancePtr->Handles.AuthenticationRequestCallback(
			InstancePtr->Handles.AuthenticationRequestCallbackRef);
	}

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
* This function processes the AKE_Init message received from the transmitter.
* The stored authentication parameters are reset so that no state
* information is stored between authentication attempts. The DDC
* registers are reset to their default value including the REAUTH_REQ
* flag. The cipher is disabled.
*
* @param    InstancePtr is a pointer to the XHdcp22_Rx core instance.
*
* @return   - XST_SUCCESS if message processed successfully.
*           - XST_FAILURE if message size is incorrect.
*
* @note     None.
******************************************************************************/
This function processes the AKE_Init message received from the transmitter.
The stored authentication parameters are reset so that no state
information is stored between authentication attempts. The DDC
registers are reset to their default value including the REAUTH_REQ
flag. The cipher is disabled.
This function processes the AKE_Init message received from the transmitter . The stored authentication parameters are reset so that no state information is stored between authentication attempts . The DDC registers are reset to their default value including the REAUTH_REQ flag . The cipher is disabled .
static int XHdcp22Rx_ProcessMessageAKEInit(XHdcp22_Rx *InstancePtr)
{
	Xil_AssertNonvoid(InstancePtr != NULL);
	XHdcp22_Rx_Message *MsgPtr = (XHdcp22_Rx_Message*)InstancePtr->MessageBuffer;
	XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_INFO_MESSAGE, XHDCP22_RX_MSG_ID_AKEINIT);
	InstancePtr->Info.AuthRequestCnt++;
	XHdcp22Cipher_Disable(&InstancePtr->CipherInst);
	XHdcp22Cipher_Enable(&InstancePtr->CipherInst);
	XTmrCtr_Reset(&InstancePtr->TimerInst, XHDCP22_RX_TMR_CTR_0);
	XHdcp22Rx_StopTimer(InstancePtr);
	memset(&InstancePtr->Topology, 0, sizeof(XHdcp22_Rx_Topology));
	InstancePtr->Info.ReauthReq = FALSE;
	InstancePtr->Info.TopologyReady = FALSE;
	InstancePtr->Info.IsTopologyValid = FALSE;
	InstancePtr->Info.ReturnState = XHDCP22_RX_STATE_UNDEFINED;
	InstancePtr->Info.SeqNumV = 0;
	InstancePtr->Info.HasStreamManagementInfo = FALSE;
	InstancePtr->Info.SkipRead = FALSE;
	if(InstancePtr->MessageSize != sizeof(XHdcp22_Rx_AKEInit))
	{
		XHdcp22Rx_LogWr(InstancePtr, XHDCP22_RX_LOG_EVT_ERROR, XHDCP22_RX_ERROR_FLAG_MESSAGE_SIZE);
		return XST_FAILURE;
	}
	XHdcp22Rx_ResetParams(InstancePtr);
	XHdcp22Rx_ResetDdc(InstancePtr, FALSE, TRUE, TRUE, TRUE);
	memcpy(InstancePtr->Params.Rtx, MsgPtr->AKEInit.Rtx, XHDCP22_RX_RTX_SIZE);
	memcpy(InstancePtr->Params.TxCaps, MsgPtr->AKEInit.TxCaps, XHDCP22_RX_TXCAPS_SIZE);
	if((InstancePtr->Handles.IsUnauthenticatedCallbackSet) &&
		 (InstancePtr->Info.AuthenticationStatus == XHDCP22_RX_AUTHENTICATED))
	{
		InstancePtr->Handles.UnauthenticatedCallback(InstancePtr->Handles.UnauthenticatedCallbackRef);
	}
	if(InstancePtr->Handles.IsAuthenticationRequestCallbackSet)
	{
		InstancePtr->Handles.AuthenticationRequestCallback(
			InstancePtr->Handles.AuthenticationRequestCallbackRef);
	}
	return XST_SUCCESS;
}
static int XHdcp22Rx_ProcessMessageAKEInit ( XHdcp22_Rx * InstancePtr ) { Xil_AssertNonvoid ( InstancePtr != NULL ) ; XHdcp22_Rx_Message * MsgPtr = ( XHdcp22_Rx_Message * ) InstancePtr -> MessageBuffer ; XHdcp22Rx_LogWr ( InstancePtr , XHDCP22_RX_LOG_EVT_INFO_MESSAGE , XHDCP22_RX_MSG_ID_AKEINIT ) ; InstancePtr -> Info . AuthRequestCnt ++ ; XHdcp22Cipher_Disable ( & InstancePtr -> CipherInst ) ; XHdcp22Cipher_Enable ( & InstancePtr -> CipherInst ) ; XTmrCtr_Reset ( & InstancePtr -> TimerInst , XHDCP22_RX_TMR_CTR_0 ) ; XHdcp22Rx_StopTimer ( InstancePtr ) ; memset ( & InstancePtr -> Topology , 0 , sizeof ( XHdcp22_Rx_Topology ) ) ; InstancePtr -> Info . ReauthReq = FALSE ; InstancePtr -> Info . TopologyReady = FALSE ; InstancePtr -> Info . IsTopologyValid = FALSE ; InstancePtr -> Info . ReturnState = XHDCP22_RX_STATE_UNDEFINED ; InstancePtr -> Info . SeqNumV = 0 ; InstancePtr -> Info . HasStreamManagementInfo = FALSE ; InstancePtr -> Info . SkipRead = FALSE ; if ( InstancePtr -> MessageSize != sizeof ( XHdcp22_Rx_AKEInit ) ) { XHdcp22Rx_LogWr ( InstancePtr , XHDCP22_RX_LOG_EVT_ERROR , XHDCP22_RX_ERROR_FLAG_MESSAGE_SIZE ) ; return XST_FAILURE ; } XHdcp22Rx_ResetParams ( InstancePtr ) ; XHdcp22Rx_ResetDdc ( InstancePtr , FALSE , TRUE , TRUE , TRUE ) ; memcpy ( InstancePtr -> Params . Rtx , MsgPtr -> AKEInit . Rtx , XHDCP22_RX_RTX_SIZE ) ; memcpy ( InstancePtr -> Params . TxCaps , MsgPtr -> AKEInit . TxCaps , XHDCP22_RX_TXCAPS_SIZE ) ; if ( ( InstancePtr -> Handles . IsUnauthenticatedCallbackSet ) && ( InstancePtr -> Info . AuthenticationStatus == XHDCP22_RX_AUTHENTICATED ) ) { InstancePtr -> Handles . UnauthenticatedCallback ( InstancePtr -> Handles . UnauthenticatedCallbackRef ) ; } if ( InstancePtr -> Handles . IsAuthenticationRequestCallbackSet ) { InstancePtr -> Handles . AuthenticationRequestCallback ( InstancePtr -> Handles . AuthenticationRequestCallbackRef ) ; } return XST_SUCCESS ; }
This function processes the AKE_Init message received from the transmitter.
This function processes the AKE_Init message received from the transmitter .
/* Verify arguments */ /* Log message read completion */ /* Increment authentication request count */ /* Reset cipher */ /* Reset timer counter */ /* Reset repeater values */ /* Check message size */ /* Reset state variables and DDC registers */ /* Record Rtx and TxCaps parameters */ /* Run callback function type: XHDCP22_RX_HANDLER_UNAUTHENTICATED */ /* Run callback function type: XHDCP22_RX_HANDLER_AUTHENTICATION_REQUEST */