XilinxProcessorIPLib/drivers/hdcp22_tx_dp/src/xhdcp22_tx.c
static int XHdcp22Tx_Dp_ReadDpRxMsg(XHdcp22_Tx *InstancePtr, u8 MessageId)
{
	int NumRead = 0;
	int Status = XST_FAILURE;
	XHdcp22_Tx_DDCMessage* MsgPtr =
		(XHdcp22_Tx_DDCMessage*)InstancePtr->MessageBuffer;

	/* Verify arguments. */
	Xil_AssertNonvoid(InstancePtr != NULL);

	switch (MessageId) {
		case XHDCP22_TX_AKE_SEND_CERT:
			/*Read Cert_rx*/
			NumRead = InstancePtr->TxDpAuxReadCallback(
					InstancePtr->TxDpAuxReadCallbackRef,
					XHDCP22_TX_DP_HDCPPORT_CERT_RX_OFFSET,
					MsgPtr->Message.AKESendCert.CertRx.ReceiverId,
					XHDCP22_TX_DP_HDCPPORT_CERT_RX_SIZE);
			/*Read R_rx*/
			NumRead += InstancePtr->TxDpAuxReadCallback(
					InstancePtr->TxDpAuxReadCallbackRef,
					XHDCP22_TX_DP_HDCPPORT_R_RX_OFFSET,
					MsgPtr->Message.AKESendCert.Rrx,
					XHDCP22_TX_DP_HDCPPORT_R_RX_SIZE);
			/*Read Rx_Caps*/
			NumRead += InstancePtr->TxDpAuxReadCallback(
					InstancePtr->TxDpAuxReadCallbackRef,
					XHDCP22_TX_DP_HDCPPORT_RX_CAPS_OFFSET,
					MsgPtr->Message.AKESendCert.RxCaps,
					XHDCP22_TX_DP_HDCPPORT_RX_CAPS_SIZE);
			if (NumRead == (XHDCP22_TX_DP_HDCPPORT_CERT_RX_SIZE +
						XHDCP22_TX_DP_HDCPPORT_R_RX_SIZE +
						XHDCP22_TX_DP_HDCPPORT_RX_CAPS_SIZE))
				Status = XST_SUCCESS;
			break;
		case XHDCP22_TX_AKE_SEND_H_PRIME:
			/*Read H'*/
			NumRead = InstancePtr->TxDpAuxReadCallback(
					InstancePtr->TxDpAuxReadCallbackRef,
					XHDCP22_TX_DP_HDCPPORT_H_PRIME_OFFSET,
					MsgPtr->Message.AKESendHPrime.HPrime,
					XHDCP22_TX_DP_HDCPPORT_H_PRIME_SIZE);
			if (NumRead == XHDCP22_TX_DP_HDCPPORT_H_PRIME_SIZE)
				Status = XST_SUCCESS;
			break;
		case XHDCP22_TX_AKE_SEND_PAIRING_INFO:
			/*Read E_Kh_Km*/
			NumRead = InstancePtr->TxDpAuxReadCallback(
					InstancePtr->TxDpAuxReadCallbackRef,
					XHDCP22_TX_DP_HDCPPORT_E_KH_KM_PAIRING_OFFSET,
					MsgPtr->Message.AKESendPairingInfo.EKhKm,
					XHDCP22_TX_DP_HDCPPORT_E_KH_KM_PAIRING_SIZE);
			if (NumRead == XHDCP22_TX_DP_HDCPPORT_E_KH_KM_PAIRING_SIZE)
				Status = XST_SUCCESS;
			break;
		case XHDCP22_TX_LC_SEND_L_PRIME:
			/*Read L'*/
			NumRead = InstancePtr->TxDpAuxReadCallback(
					InstancePtr->TxDpAuxReadCallbackRef,
					XHDCP22_TX_DP_HDCPPORT_L_PRIME_OFFSET,
					MsgPtr->Message.LCSendLPrime.LPrime,
					XHDCP22_TX_DP_HDCPPORT_L_PRIME_SIZE);
			if (NumRead == XHDCP22_TX_DP_HDCPPORT_L_PRIME_SIZE)
				Status = XST_SUCCESS;
			break;
		case XHDCP22_TX_REPEATAUTH_SEND_RECVID_LIST:
			/* Read RX_Info */
			NumRead = InstancePtr->TxDpAuxReadCallback(
					InstancePtr->TxDpAuxReadCallbackRef,
					XHDCP22_TX_DP_HDCPPORT_RX_INFO_OFFSET,
					MsgPtr->Message.RepeatAuthSendRecvIDList.RxInfo,
					XHDCP22_TX_DP_HDCPPORT_RX_INFO_SIZE);
			/* Read SeqNum_V */
			NumRead += InstancePtr->TxDpAuxReadCallback(
					InstancePtr->TxDpAuxReadCallbackRef,
					XHDCP22_TX_DP_HDCPPORT_SEQ_NUM_V_OFFSET,
					MsgPtr->Message.RepeatAuthSendRecvIDList.SeqNum_V,
					XHDCP22_TX_DP_HDCPPORT_SEQ_NUM_V_SIZE);
			/* Read VPrime */
			NumRead += InstancePtr->TxDpAuxReadCallback(
					InstancePtr->TxDpAuxReadCallbackRef,
					XHDCP22_TX_DP_HDCPPORT_V_PRIME_OFFSET,
					MsgPtr->Message.RepeatAuthSendRecvIDList.VPrime,
					XHDCP22_TX_DP_HDCPPORT_V_PRIME_SIZE);
			/* Read ReceverID_List */
			NumRead += InstancePtr->TxDpAuxReadCallback(
					InstancePtr->TxDpAuxReadCallbackRef,
					XHDCP22_TX_DP_HDCPPORT_RCVR_ID_LST_OFFSET,
					MsgPtr->Message.RepeatAuthSendRecvIDList.ReceiverIDs,
					XHDCP22_TX_DP_HDCPPORT_RCVR_ID_LST_MAX_SIZE);
			if (NumRead == XHDCP22_TX_DP_HDCPPORT_RX_INFO_SIZE +
					XHDCP22_TX_DP_HDCPPORT_SEQ_NUM_V_SIZE +
					XHDCP22_TX_DP_HDCPPORT_V_PRIME_SIZE +
					XHDCP22_TX_DP_HDCPPORT_RCVR_ID_LST_MAX_SIZE)
				Status = XST_SUCCESS;
			break;
		case XHDCP22_TX_REPEATAUTH_STREAM_READY:
			/* Read M' */
			NumRead = InstancePtr->TxDpAuxReadCallback(
					InstancePtr->TxDpAuxReadCallbackRef,
					XHDCP22_TX_DP_HDCPPORT_M_PRIME_OFFSET,
					MsgPtr->Message.RepeatAuthStreamReady.MPrime,
					XHDCP22_TX_DP_HDCPPORT_M_PRIME_SIZE);
			if (NumRead == XHDCP22_TX_DP_HDCPPORT_M_PRIME_SIZE)
				Status = XST_SUCCESS;
			break;
		default:
			xdbg_printf(XDBG_DEBUG_GENERAL,
					"Wrong msg reading requested (id = %d)"
					"\n\r",	MessageId);
			Status = XST_FAILURE;
			break;
	}

	return Status;
}
/*****************************************************************************/
/**
*
* This function reads requested MSG from DP RX.
*
* @param  InstancePtr is a pointer to the XHdcp22Tx core instance.
* @param  MessageId the message Id of the expected message.
*
* @return
*         - XST_SUCCESS if the message size and id are as expected.
*         - XST_FAILURE if if the message size and id are incorrect.
*
* @note   None.
*
******************************************************************************/
This function reads requested MSG from DP RX.
This function reads requested MSG from DP RX .
static int XHdcp22Tx_Dp_ReadDpRxMsg(XHdcp22_Tx *InstancePtr, u8 MessageId)
{
	int NumRead = 0;
	int Status = XST_FAILURE;
	XHdcp22_Tx_DDCMessage* MsgPtr =
		(XHdcp22_Tx_DDCMessage*)InstancePtr->MessageBuffer;
	Xil_AssertNonvoid(InstancePtr != NULL);
	switch (MessageId) {
		case XHDCP22_TX_AKE_SEND_CERT:
			NumRead = InstancePtr->TxDpAuxReadCallback(
					InstancePtr->TxDpAuxReadCallbackRef,
					XHDCP22_TX_DP_HDCPPORT_CERT_RX_OFFSET,
					MsgPtr->Message.AKESendCert.CertRx.ReceiverId,
					XHDCP22_TX_DP_HDCPPORT_CERT_RX_SIZE);
			NumRead += InstancePtr->TxDpAuxReadCallback(
					InstancePtr->TxDpAuxReadCallbackRef,
					XHDCP22_TX_DP_HDCPPORT_R_RX_OFFSET,
					MsgPtr->Message.AKESendCert.Rrx,
					XHDCP22_TX_DP_HDCPPORT_R_RX_SIZE);
			NumRead += InstancePtr->TxDpAuxReadCallback(
					InstancePtr->TxDpAuxReadCallbackRef,
					XHDCP22_TX_DP_HDCPPORT_RX_CAPS_OFFSET,
					MsgPtr->Message.AKESendCert.RxCaps,
					XHDCP22_TX_DP_HDCPPORT_RX_CAPS_SIZE);
			if (NumRead == (XHDCP22_TX_DP_HDCPPORT_CERT_RX_SIZE +
						XHDCP22_TX_DP_HDCPPORT_R_RX_SIZE +
						XHDCP22_TX_DP_HDCPPORT_RX_CAPS_SIZE))
				Status = XST_SUCCESS;
			break;
		case XHDCP22_TX_AKE_SEND_H_PRIME:
			NumRead = InstancePtr->TxDpAuxReadCallback(
					InstancePtr->TxDpAuxReadCallbackRef,
					XHDCP22_TX_DP_HDCPPORT_H_PRIME_OFFSET,
					MsgPtr->Message.AKESendHPrime.HPrime,
					XHDCP22_TX_DP_HDCPPORT_H_PRIME_SIZE);
			if (NumRead == XHDCP22_TX_DP_HDCPPORT_H_PRIME_SIZE)
				Status = XST_SUCCESS;
			break;
		case XHDCP22_TX_AKE_SEND_PAIRING_INFO:
			NumRead = InstancePtr->TxDpAuxReadCallback(
					InstancePtr->TxDpAuxReadCallbackRef,
					XHDCP22_TX_DP_HDCPPORT_E_KH_KM_PAIRING_OFFSET,
					MsgPtr->Message.AKESendPairingInfo.EKhKm,
					XHDCP22_TX_DP_HDCPPORT_E_KH_KM_PAIRING_SIZE);
			if (NumRead == XHDCP22_TX_DP_HDCPPORT_E_KH_KM_PAIRING_SIZE)
				Status = XST_SUCCESS;
			break;
		case XHDCP22_TX_LC_SEND_L_PRIME:
			NumRead = InstancePtr->TxDpAuxReadCallback(
					InstancePtr->TxDpAuxReadCallbackRef,
					XHDCP22_TX_DP_HDCPPORT_L_PRIME_OFFSET,
					MsgPtr->Message.LCSendLPrime.LPrime,
					XHDCP22_TX_DP_HDCPPORT_L_PRIME_SIZE);
			if (NumRead == XHDCP22_TX_DP_HDCPPORT_L_PRIME_SIZE)
				Status = XST_SUCCESS;
			break;
		case XHDCP22_TX_REPEATAUTH_SEND_RECVID_LIST:
			NumRead = InstancePtr->TxDpAuxReadCallback(
					InstancePtr->TxDpAuxReadCallbackRef,
					XHDCP22_TX_DP_HDCPPORT_RX_INFO_OFFSET,
					MsgPtr->Message.RepeatAuthSendRecvIDList.RxInfo,
					XHDCP22_TX_DP_HDCPPORT_RX_INFO_SIZE);
			NumRead += InstancePtr->TxDpAuxReadCallback(
					InstancePtr->TxDpAuxReadCallbackRef,
					XHDCP22_TX_DP_HDCPPORT_SEQ_NUM_V_OFFSET,
					MsgPtr->Message.RepeatAuthSendRecvIDList.SeqNum_V,
					XHDCP22_TX_DP_HDCPPORT_SEQ_NUM_V_SIZE);
			NumRead += InstancePtr->TxDpAuxReadCallback(
					InstancePtr->TxDpAuxReadCallbackRef,
					XHDCP22_TX_DP_HDCPPORT_V_PRIME_OFFSET,
					MsgPtr->Message.RepeatAuthSendRecvIDList.VPrime,
					XHDCP22_TX_DP_HDCPPORT_V_PRIME_SIZE);
			NumRead += InstancePtr->TxDpAuxReadCallback(
					InstancePtr->TxDpAuxReadCallbackRef,
					XHDCP22_TX_DP_HDCPPORT_RCVR_ID_LST_OFFSET,
					MsgPtr->Message.RepeatAuthSendRecvIDList.ReceiverIDs,
					XHDCP22_TX_DP_HDCPPORT_RCVR_ID_LST_MAX_SIZE);
			if (NumRead == XHDCP22_TX_DP_HDCPPORT_RX_INFO_SIZE +
					XHDCP22_TX_DP_HDCPPORT_SEQ_NUM_V_SIZE +
					XHDCP22_TX_DP_HDCPPORT_V_PRIME_SIZE +
					XHDCP22_TX_DP_HDCPPORT_RCVR_ID_LST_MAX_SIZE)
				Status = XST_SUCCESS;
			break;
		case XHDCP22_TX_REPEATAUTH_STREAM_READY:
			NumRead = InstancePtr->TxDpAuxReadCallback(
					InstancePtr->TxDpAuxReadCallbackRef,
					XHDCP22_TX_DP_HDCPPORT_M_PRIME_OFFSET,
					MsgPtr->Message.RepeatAuthStreamReady.MPrime,
					XHDCP22_TX_DP_HDCPPORT_M_PRIME_SIZE);
			if (NumRead == XHDCP22_TX_DP_HDCPPORT_M_PRIME_SIZE)
				Status = XST_SUCCESS;
			break;
		default:
			xdbg_printf(XDBG_DEBUG_GENERAL,
					"Wrong msg reading requested (id = %d)"
					"\n\r",	MessageId);
			Status = XST_FAILURE;
			break;
	}
	return Status;
}
static int XHdcp22Tx_Dp_ReadDpRxMsg ( XHdcp22_Tx * InstancePtr , u8 MessageId ) { int NumRead = 0 ; int Status = XST_FAILURE ; XHdcp22_Tx_DDCMessage * MsgPtr = ( XHdcp22_Tx_DDCMessage * ) InstancePtr -> MessageBuffer ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; switch ( MessageId ) { case XHDCP22_TX_AKE_SEND_CERT : NumRead = InstancePtr -> TxDpAuxReadCallback ( InstancePtr -> TxDpAuxReadCallbackRef , XHDCP22_TX_DP_HDCPPORT_CERT_RX_OFFSET , MsgPtr -> Message . AKESendCert . CertRx . ReceiverId , XHDCP22_TX_DP_HDCPPORT_CERT_RX_SIZE ) ; NumRead += InstancePtr -> TxDpAuxReadCallback ( InstancePtr -> TxDpAuxReadCallbackRef , XHDCP22_TX_DP_HDCPPORT_R_RX_OFFSET , MsgPtr -> Message . AKESendCert . Rrx , XHDCP22_TX_DP_HDCPPORT_R_RX_SIZE ) ; NumRead += InstancePtr -> TxDpAuxReadCallback ( InstancePtr -> TxDpAuxReadCallbackRef , XHDCP22_TX_DP_HDCPPORT_RX_CAPS_OFFSET , MsgPtr -> Message . AKESendCert . RxCaps , XHDCP22_TX_DP_HDCPPORT_RX_CAPS_SIZE ) ; if ( NumRead == ( XHDCP22_TX_DP_HDCPPORT_CERT_RX_SIZE + XHDCP22_TX_DP_HDCPPORT_R_RX_SIZE + XHDCP22_TX_DP_HDCPPORT_RX_CAPS_SIZE ) ) Status = XST_SUCCESS ; break ; case XHDCP22_TX_AKE_SEND_H_PRIME : NumRead = InstancePtr -> TxDpAuxReadCallback ( InstancePtr -> TxDpAuxReadCallbackRef , XHDCP22_TX_DP_HDCPPORT_H_PRIME_OFFSET , MsgPtr -> Message . AKESendHPrime . HPrime , XHDCP22_TX_DP_HDCPPORT_H_PRIME_SIZE ) ; if ( NumRead == XHDCP22_TX_DP_HDCPPORT_H_PRIME_SIZE ) Status = XST_SUCCESS ; break ; case XHDCP22_TX_AKE_SEND_PAIRING_INFO : NumRead = InstancePtr -> TxDpAuxReadCallback ( InstancePtr -> TxDpAuxReadCallbackRef , XHDCP22_TX_DP_HDCPPORT_E_KH_KM_PAIRING_OFFSET , MsgPtr -> Message . AKESendPairingInfo . EKhKm , XHDCP22_TX_DP_HDCPPORT_E_KH_KM_PAIRING_SIZE ) ; if ( NumRead == XHDCP22_TX_DP_HDCPPORT_E_KH_KM_PAIRING_SIZE ) Status = XST_SUCCESS ; break ; case XHDCP22_TX_LC_SEND_L_PRIME : NumRead = InstancePtr -> TxDpAuxReadCallback ( InstancePtr -> TxDpAuxReadCallbackRef , XHDCP22_TX_DP_HDCPPORT_L_PRIME_OFFSET , MsgPtr -> Message . LCSendLPrime . LPrime , XHDCP22_TX_DP_HDCPPORT_L_PRIME_SIZE ) ; if ( NumRead == XHDCP22_TX_DP_HDCPPORT_L_PRIME_SIZE ) Status = XST_SUCCESS ; break ; case XHDCP22_TX_REPEATAUTH_SEND_RECVID_LIST : NumRead = InstancePtr -> TxDpAuxReadCallback ( InstancePtr -> TxDpAuxReadCallbackRef , XHDCP22_TX_DP_HDCPPORT_RX_INFO_OFFSET , MsgPtr -> Message . RepeatAuthSendRecvIDList . RxInfo , XHDCP22_TX_DP_HDCPPORT_RX_INFO_SIZE ) ; NumRead += InstancePtr -> TxDpAuxReadCallback ( InstancePtr -> TxDpAuxReadCallbackRef , XHDCP22_TX_DP_HDCPPORT_SEQ_NUM_V_OFFSET , MsgPtr -> Message . RepeatAuthSendRecvIDList . SeqNum_V , XHDCP22_TX_DP_HDCPPORT_SEQ_NUM_V_SIZE ) ; NumRead += InstancePtr -> TxDpAuxReadCallback ( InstancePtr -> TxDpAuxReadCallbackRef , XHDCP22_TX_DP_HDCPPORT_V_PRIME_OFFSET , MsgPtr -> Message . RepeatAuthSendRecvIDList . VPrime , XHDCP22_TX_DP_HDCPPORT_V_PRIME_SIZE ) ; NumRead += InstancePtr -> TxDpAuxReadCallback ( InstancePtr -> TxDpAuxReadCallbackRef , XHDCP22_TX_DP_HDCPPORT_RCVR_ID_LST_OFFSET , MsgPtr -> Message . RepeatAuthSendRecvIDList . ReceiverIDs , XHDCP22_TX_DP_HDCPPORT_RCVR_ID_LST_MAX_SIZE ) ; if ( NumRead == XHDCP22_TX_DP_HDCPPORT_RX_INFO_SIZE + XHDCP22_TX_DP_HDCPPORT_SEQ_NUM_V_SIZE + XHDCP22_TX_DP_HDCPPORT_V_PRIME_SIZE + XHDCP22_TX_DP_HDCPPORT_RCVR_ID_LST_MAX_SIZE ) Status = XST_SUCCESS ; break ; case XHDCP22_TX_REPEATAUTH_STREAM_READY : NumRead = InstancePtr -> TxDpAuxReadCallback ( InstancePtr -> TxDpAuxReadCallbackRef , XHDCP22_TX_DP_HDCPPORT_M_PRIME_OFFSET , MsgPtr -> Message . RepeatAuthStreamReady . MPrime , XHDCP22_TX_DP_HDCPPORT_M_PRIME_SIZE ) ; if ( NumRead == XHDCP22_TX_DP_HDCPPORT_M_PRIME_SIZE ) Status = XST_SUCCESS ; break ; default : xdbg_printf ( XDBG_DEBUG_GENERAL , " " " \n \r " , MessageId ) ; Status = XST_FAILURE ; break ; } return Status ; }
This function reads requested MSG from DP RX.
This function reads requested MSG from DP RX .
/* Verify arguments. */ /*Read Cert_rx*/ /*Read R_rx*/ /*Read Rx_Caps*/ /*Read H'*/ /*Read E_Kh_Km*/ /*Read L'*/ /* Read RX_Info */ /* Read SeqNum_V */ /* Read VPrime */ /* Read ReceverID_List */ /* Read M' */