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

	XHdcp22_Tx_PairingInfo *PairingInfoPtr =
	                       (XHdcp22_Tx_PairingInfo *)InstancePtr->Info.StateContext;
	XHdcp22_Tx_DDCMessage *MsgPtr =
	                       (XHdcp22_Tx_DDCMessage *)InstancePtr->MessageBuffer;

	/* Wait for the receiver to send AKE_Send_Pairing_Info */
	Result = XHdcp22Tx_WaitForReceiver(InstancePtr, sizeof(XHdcp22_Tx_AKESendPairingInfo), FALSE);
	if (Result != XST_SUCCESS) {
		XHdcp22Tx_InvalidatePairingInfo(InstancePtr, PairingInfoPtr->ReceiverId);
		return XHDCP22_TX_STATE_A0;
	}
	if (InstancePtr->Info.MsgAvailable == (FALSE)) {
		return XHDCP22_TX_STATE_A1_NSK1;
	}

	/* Log after waiting */
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_STATE,
	                (u16)XHDCP22_TX_STATE_A1_NSK1);

	/* Receive the expected message */
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG, XHDCP22_TX_LOG_DBG_RX_EKHKM);
	Result = XHdcp22Tx_ReceiveMsg(InstancePtr, XHDCP22_TX_AKE_SEND_PAIRING_INFO,
	                              sizeof(XHdcp22_Tx_AKESendPairingInfo));
	if (Result != XST_SUCCESS) {
		XHdcp22Tx_InvalidatePairingInfo(InstancePtr, PairingInfoPtr->ReceiverId);
		return XHDCP22_TX_STATE_A0;
	}

	xdbg_printf(XDBG_DEBUG_GENERAL,
			"HDCP22TX: Reading Done for AKE_SEND_PAIRING_INFO\n\r");

	/* Store the pairing info with the received Ekh(Km) */
	memcpy(PairingInfoPtr->Ekh_Km, MsgPtr->Message.AKESendPairingInfo.EKhKm,
	       sizeof(PairingInfoPtr->Ekh_Km));

	XHdcp22Tx_UpdatePairingInfo(InstancePtr, PairingInfoPtr, TRUE);

	/* Authentication done, goto the next state (exchange Ks) */
	return XHDCP22_TX_STATE_A2;
}
/******************************************************************************/
/**
*
* This function executes a part of the A1 state functionality of the HDCP2.2
* TX protocol.
* It handles a part of the  'No Stored Km' scenario and receives and
* stores pairing info.
*
* @param  InstancePtr is a pointer to the XHdcp22Tx core instance.
*
* @return
*         - XHDCP22_TX_STATE_A0 on errors.
*         - XHDCP22_TX_STATE_A1_NSK1 if busy waiting for
*           the XHDCP22_TX_AKE_SEND_PAIRING_INFO message.
*         - XHDCP22_TX_STATE_A2 if authentication is done.
*
* @note   None.
*
******************************************************************************/
This function executes a part of the A1 state functionality of the HDCP2.2
TX protocol.
It handles a part of the  'No Stored Km' scenario and receives and
stores pairing info.
This function executes a part of the A1 state functionality of the HDCP2 . 2 TX protocol . It handles a part of the ' No Stored Km ' scenario and receives and stores pairing info .
static XHdcp22_Tx_StateType Xhdcp22Tx_StateA1_Nsk1(XHdcp22_Tx *InstancePtr)
{
	int Result = XST_SUCCESS;
	XHdcp22_Tx_PairingInfo *PairingInfoPtr =
	                       (XHdcp22_Tx_PairingInfo *)InstancePtr->Info.StateContext;
	XHdcp22_Tx_DDCMessage *MsgPtr =
	                       (XHdcp22_Tx_DDCMessage *)InstancePtr->MessageBuffer;
	Result = XHdcp22Tx_WaitForReceiver(InstancePtr, sizeof(XHdcp22_Tx_AKESendPairingInfo), FALSE);
	if (Result != XST_SUCCESS) {
		XHdcp22Tx_InvalidatePairingInfo(InstancePtr, PairingInfoPtr->ReceiverId);
		return XHDCP22_TX_STATE_A0;
	}
	if (InstancePtr->Info.MsgAvailable == (FALSE)) {
		return XHDCP22_TX_STATE_A1_NSK1;
	}
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_STATE,
	                (u16)XHDCP22_TX_STATE_A1_NSK1);
	XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_DBG, XHDCP22_TX_LOG_DBG_RX_EKHKM);
	Result = XHdcp22Tx_ReceiveMsg(InstancePtr, XHDCP22_TX_AKE_SEND_PAIRING_INFO,
	                              sizeof(XHdcp22_Tx_AKESendPairingInfo));
	if (Result != XST_SUCCESS) {
		XHdcp22Tx_InvalidatePairingInfo(InstancePtr, PairingInfoPtr->ReceiverId);
		return XHDCP22_TX_STATE_A0;
	}
	xdbg_printf(XDBG_DEBUG_GENERAL,
			"HDCP22TX: Reading Done for AKE_SEND_PAIRING_INFO\n\r");
	memcpy(PairingInfoPtr->Ekh_Km, MsgPtr->Message.AKESendPairingInfo.EKhKm,
	       sizeof(PairingInfoPtr->Ekh_Km));
	XHdcp22Tx_UpdatePairingInfo(InstancePtr, PairingInfoPtr, TRUE);
	return XHDCP22_TX_STATE_A2;
}
static XHdcp22_Tx_StateType Xhdcp22Tx_StateA1_Nsk1 ( XHdcp22_Tx * InstancePtr ) { int Result = XST_SUCCESS ; XHdcp22_Tx_PairingInfo * PairingInfoPtr = ( XHdcp22_Tx_PairingInfo * ) InstancePtr -> Info . StateContext ; XHdcp22_Tx_DDCMessage * MsgPtr = ( XHdcp22_Tx_DDCMessage * ) InstancePtr -> MessageBuffer ; Result = XHdcp22Tx_WaitForReceiver ( InstancePtr , sizeof ( XHdcp22_Tx_AKESendPairingInfo ) , FALSE ) ; if ( Result != XST_SUCCESS ) { XHdcp22Tx_InvalidatePairingInfo ( InstancePtr , PairingInfoPtr -> ReceiverId ) ; return XHDCP22_TX_STATE_A0 ; } if ( InstancePtr -> Info . MsgAvailable == ( FALSE ) ) { return XHDCP22_TX_STATE_A1_NSK1 ; } XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_STATE , ( u16 ) XHDCP22_TX_STATE_A1_NSK1 ) ; XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_DBG , XHDCP22_TX_LOG_DBG_RX_EKHKM ) ; Result = XHdcp22Tx_ReceiveMsg ( InstancePtr , XHDCP22_TX_AKE_SEND_PAIRING_INFO , sizeof ( XHdcp22_Tx_AKESendPairingInfo ) ) ; if ( Result != XST_SUCCESS ) { XHdcp22Tx_InvalidatePairingInfo ( InstancePtr , PairingInfoPtr -> ReceiverId ) ; return XHDCP22_TX_STATE_A0 ; } xdbg_printf ( XDBG_DEBUG_GENERAL , " \n \r " ) ; memcpy ( PairingInfoPtr -> Ekh_Km , MsgPtr -> Message . AKESendPairingInfo . EKhKm , sizeof ( PairingInfoPtr -> Ekh_Km ) ) ; XHdcp22Tx_UpdatePairingInfo ( InstancePtr , PairingInfoPtr , TRUE ) ; return XHDCP22_TX_STATE_A2 ; }
This function executes a part of the A1 state functionality of the HDCP2.2
TX protocol.
This function executes a part of the A1 state functionality of the HDCP2 . 2 TX protocol .
/* Wait for the receiver to send AKE_Send_Pairing_Info */ /* Log after waiting */ /* Receive the expected message */ /* Store the pairing info with the received Ekh(Km) */ /* Authentication done, goto the next state (exchange Ks) */