XilinxProcessorIPLib/drivers/hdcp22_tx/src/xhdcp22_tx_test.c
void XHdcp22Tx_TestSetMode(XHdcp22_Tx *InstancePtr, XHdcp22_Tx_TestMode Mode,
                           u32 TestFlags)
{
	/* Verify argument. */
	Xil_AssertVoid(InstancePtr != NULL);
	Xil_AssertVoid(Mode < XHDCP22_TX_TESTMODE_INVALID);

	u8 Index = XHDCP22_TX_TEST_VECTOR_R2_INDEX;
	if (TEST_FLAG_SET(XHDCP22_TX_TEST_USE_TEST_VECTOR_R1, TestFlags)) {
		Index = XHDCP22_TX_TEST_VECTOR_R1_INDEX;
	}

	if ((TestFlags & XHDCP22_TX_TEST_CLR_PAIRINGINFO) == XHDCP22_TX_TEST_CLR_PAIRINGINFO) {
			memset(InstancePtr->Info.PairingInfo, 0, sizeof(InstancePtr->Info.PairingInfo));
	}

	/* Handle test scenarios */
	if (Mode == XHDCP22_TX_TESTMODE_NO_RX || Mode == XHDCP22_TX_TESTMODE_UNIT) {
		/* Set test handlers for DDC */
		XHdcp22Tx_SetCallback(InstancePtr, XHDCP22_TX_HANDLER_DDC_WRITE, XHdcp22Tx_TestDdcWrite, InstancePtr);
		XHdcp22Tx_SetCallback(InstancePtr, XHDCP22_TX_HANDLER_DDC_READ, XHdcp22Tx_TestDdcRead, InstancePtr);

		if ((TestFlags & XHDCP22_TX_TEST_STORED_KM) == XHDCP22_TX_TEST_STORED_KM) {
			memcpy(InstancePtr->Info.PairingInfo[0].ReceiverId, XHdcp22_Tx_Test_CertRx[Index], XHDCP22_TX_CERT_RCVID_SIZE);
			memcpy(InstancePtr->Info.PairingInfo[0].Km, XHdcp22_Tx_Test_Km[Index], XHDCP22_TX_KM_SIZE);
			memcpy(InstancePtr->Info.PairingInfo[0].Rrx, XHdcp22_Tx_Test_Rrx[Index], XHDCP22_TX_RRX_SIZE);
			memcpy(InstancePtr->Info.PairingInfo[0].Rtx, XHdcp22_Tx_Test_Rtx[Index], XHDCP22_TX_RTX_SIZE);
			memcpy(InstancePtr->Info.PairingInfo[0].RxCaps, XHdcp22_Tx_Test_RxCaps[Index], XHDCP22_TX_RXCAPS_SIZE);
			memcpy(InstancePtr->Info.PairingInfo[0].Ekh_Km, XHdcp22_Tx_Test_Ekh_Km[Index], XHDCP22_TX_EKH_KM_SIZE);
		}
	}

	InstancePtr->Test.TestMode = Mode;
	InstancePtr->Test.TestFlags = TestFlags;
}
/*****************************************************************************/
/**
*
* Set core into test mode for validation.
*
* @param  InstancePtr is a pointer to the HDCP22 TX core instance.
* @param  Mode is the mode to use refer to #XHdcp22_Tx_TestMode.
* @param  TestFlags are the flags that allow to trigger test conditions.
*
* @return None.
*
* @note   Test flags should be combined for a certain test.
*         Some testflags force the use of a test item as described in:
*         "Errata to HDCP on HDMI Specification revision 2.2."
*         Examples:
*         - Receiving an invalid receiver certificate requires:
*           XHDCP22_TX_TEST_CERT_RX | XHDCP22_TX_TEST_INVALID_VALUE
*         - Receiving of the certificate times out
*           XHDCP22_TX_TEST_CERT_RX | XHDCP22_TX_TEST_RECV_TIMEOUT
*         - Receiving of HPrime in a stored Km scenario with timeout error
*           XHDCP22_TX_TEST_CERT_RX | XHDCP22_TX_TEST_STORED_KM |
*           XHDCP22_TX_TEST_RECV_TIMEOUT
*
******************************************************************************/
Set core into test mode for validation.
Set core into test mode for validation .
void XHdcp22Tx_TestSetMode(XHdcp22_Tx *InstancePtr, XHdcp22_Tx_TestMode Mode,
                           u32 TestFlags)
{
	Xil_AssertVoid(InstancePtr != NULL);
	Xil_AssertVoid(Mode < XHDCP22_TX_TESTMODE_INVALID);
	u8 Index = XHDCP22_TX_TEST_VECTOR_R2_INDEX;
	if (TEST_FLAG_SET(XHDCP22_TX_TEST_USE_TEST_VECTOR_R1, TestFlags)) {
		Index = XHDCP22_TX_TEST_VECTOR_R1_INDEX;
	}
	if ((TestFlags & XHDCP22_TX_TEST_CLR_PAIRINGINFO) == XHDCP22_TX_TEST_CLR_PAIRINGINFO) {
			memset(InstancePtr->Info.PairingInfo, 0, sizeof(InstancePtr->Info.PairingInfo));
	}
	if (Mode == XHDCP22_TX_TESTMODE_NO_RX || Mode == XHDCP22_TX_TESTMODE_UNIT) {
		XHdcp22Tx_SetCallback(InstancePtr, XHDCP22_TX_HANDLER_DDC_WRITE, XHdcp22Tx_TestDdcWrite, InstancePtr);
		XHdcp22Tx_SetCallback(InstancePtr, XHDCP22_TX_HANDLER_DDC_READ, XHdcp22Tx_TestDdcRead, InstancePtr);
		if ((TestFlags & XHDCP22_TX_TEST_STORED_KM) == XHDCP22_TX_TEST_STORED_KM) {
			memcpy(InstancePtr->Info.PairingInfo[0].ReceiverId, XHdcp22_Tx_Test_CertRx[Index], XHDCP22_TX_CERT_RCVID_SIZE);
			memcpy(InstancePtr->Info.PairingInfo[0].Km, XHdcp22_Tx_Test_Km[Index], XHDCP22_TX_KM_SIZE);
			memcpy(InstancePtr->Info.PairingInfo[0].Rrx, XHdcp22_Tx_Test_Rrx[Index], XHDCP22_TX_RRX_SIZE);
			memcpy(InstancePtr->Info.PairingInfo[0].Rtx, XHdcp22_Tx_Test_Rtx[Index], XHDCP22_TX_RTX_SIZE);
			memcpy(InstancePtr->Info.PairingInfo[0].RxCaps, XHdcp22_Tx_Test_RxCaps[Index], XHDCP22_TX_RXCAPS_SIZE);
			memcpy(InstancePtr->Info.PairingInfo[0].Ekh_Km, XHdcp22_Tx_Test_Ekh_Km[Index], XHDCP22_TX_EKH_KM_SIZE);
		}
	}
	InstancePtr->Test.TestMode = Mode;
	InstancePtr->Test.TestFlags = TestFlags;
}
void XHdcp22Tx_TestSetMode ( XHdcp22_Tx * InstancePtr , XHdcp22_Tx_TestMode Mode , u32 TestFlags ) { Xil_AssertVoid ( InstancePtr != NULL ) ; Xil_AssertVoid ( Mode < XHDCP22_TX_TESTMODE_INVALID ) ; u8 Index = XHDCP22_TX_TEST_VECTOR_R2_INDEX ; if ( TEST_FLAG_SET ( XHDCP22_TX_TEST_USE_TEST_VECTOR_R1 , TestFlags ) ) { Index = XHDCP22_TX_TEST_VECTOR_R1_INDEX ; } if ( ( TestFlags & XHDCP22_TX_TEST_CLR_PAIRINGINFO ) == XHDCP22_TX_TEST_CLR_PAIRINGINFO ) { memset ( InstancePtr -> Info . PairingInfo , 0 , sizeof ( InstancePtr -> Info . PairingInfo ) ) ; } if ( Mode == XHDCP22_TX_TESTMODE_NO_RX || Mode == XHDCP22_TX_TESTMODE_UNIT ) { XHdcp22Tx_SetCallback ( InstancePtr , XHDCP22_TX_HANDLER_DDC_WRITE , XHdcp22Tx_TestDdcWrite , InstancePtr ) ; XHdcp22Tx_SetCallback ( InstancePtr , XHDCP22_TX_HANDLER_DDC_READ , XHdcp22Tx_TestDdcRead , InstancePtr ) ; if ( ( TestFlags & XHDCP22_TX_TEST_STORED_KM ) == XHDCP22_TX_TEST_STORED_KM ) { memcpy ( InstancePtr -> Info . PairingInfo [ 0 ] . ReceiverId , XHdcp22_Tx_Test_CertRx [ Index ] , XHDCP22_TX_CERT_RCVID_SIZE ) ; memcpy ( InstancePtr -> Info . PairingInfo [ 0 ] . Km , XHdcp22_Tx_Test_Km [ Index ] , XHDCP22_TX_KM_SIZE ) ; memcpy ( InstancePtr -> Info . PairingInfo [ 0 ] . Rrx , XHdcp22_Tx_Test_Rrx [ Index ] , XHDCP22_TX_RRX_SIZE ) ; memcpy ( InstancePtr -> Info . PairingInfo [ 0 ] . Rtx , XHdcp22_Tx_Test_Rtx [ Index ] , XHDCP22_TX_RTX_SIZE ) ; memcpy ( InstancePtr -> Info . PairingInfo [ 0 ] . RxCaps , XHdcp22_Tx_Test_RxCaps [ Index ] , XHDCP22_TX_RXCAPS_SIZE ) ; memcpy ( InstancePtr -> Info . PairingInfo [ 0 ] . Ekh_Km , XHdcp22_Tx_Test_Ekh_Km [ Index ] , XHDCP22_TX_EKH_KM_SIZE ) ; } } InstancePtr -> Test . TestMode = Mode ; InstancePtr -> Test . TestFlags = TestFlags ; }
Set core into test mode for validation.
Set core into test mode for validation .
/* Verify argument. */ /* Handle test scenarios */ /* Set test handlers for DDC */