XilinxProcessorIPLib/drivers/hdcp22_tx/src/xhdcp22_tx_test.c
static int XHdcp22Tx_TestDdcWrite(u8 DeviceAddress, u16 ByteCount, u8* BufferPtr,
                                  u8 Stop, void *RefPtr)
{
	XHdcp22_Tx *InstancePtr = (XHdcp22_Tx *)RefPtr;
	InstancePtr->Test.CurrentDdcAddress = BufferPtr[0];

	u8 Index = XHDCP22_TX_TEST_VECTOR_R2_INDEX;
	if (TEST_FLAG_SET(XHDCP22_TX_TEST_USE_TEST_VECTOR_R1, InstancePtr->Test.TestFlags)) {
		Index = XHDCP22_TX_TEST_VECTOR_R1_INDEX;
	}

	if (DeviceAddress == XHDCP22_TX_DDC_BASE_ADDRESS)
	{
		switch (InstancePtr->Test.CurrentDdcAddress)
		{
		case XHDCP22_TX_HDCPPORT_WRITE_MSG_OFFSET:
			switch(BufferPtr[1]) {
			case XHDCP22_TX_AKE_NO_STORED_KM:
				if (memcmp(&BufferPtr[2], XHdcp22_Tx_Test_EkpubKm[Index],
					XHDCP22_TX_E_KPUB_KM_SIZE) != 0) {
						XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_TEST_ERROR,
										XHDCP22_TX_AKE_NO_STORED_KM);
				}
				break;
			case XHDCP22_TX_SKE_SEND_EKS:
				if (memcmp(&BufferPtr[2], XHdcp22_Tx_Test_EdkeyKs[Index],
					XHDCP22_TX_EDKEY_KS_SIZE) != 0) {
						XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_TEST_ERROR,
										XHDCP22_TX_SKE_SEND_EKS);
				}
				break;
			case XHDCP22_TX_REPEATAUTH_SEND_ACK:
				if (memcmp(&BufferPtr[2], XHdcp22_Tx_Test_V,
					XHDCP22_TX_V_PRIME_SIZE) != 0) {
					XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_TEST_ERROR,
						XHDCP22_TX_REPEATAUTH_SEND_ACK);
				}
			break;
			case XHDCP22_TX_AKE_INIT:
			case XHDCP22_TX_AKE_STORED_KM:
			case XHDCP22_TX_LC_INIT:
			case XHDCP22_TX_REPEATAUTH_STREAM_MANAGE:
			/* No need to check these, these messages are just assembled from
			   hardcoded values from this test */
			break;
			default:
				/* Write an error to the log if the message is undefined */
				XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_TEST_ERROR,
								XHDCP22_TX_MSG_UNDEFINED);
				break;
			};
			break;
		case XHDCP22_TX_HDCPPORT_VERSION_OFFSET:
		case XHDCP22_TX_HDCPPORT_RXSTATUS_OFFSET:
		case XHDCP22_TX_HDCPPORT_READ_MSG_OFFSET:
			/* No need to check these */
			break;
		default:
			/* Write an error to the log if the message is undefined */
			XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_TEST_ERROR,
								XHDCP22_TX_MSG_UNDEFINED);
			break;
		}
	};
	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* DDCWrite handler that is used in test mode, and emulates responses from a
* HDCP22 receiver. It also checks when possible on errors, which are logged.
*
* @param  DeviceAddress is the addres to use.
* @param  ByteCount is the amount of bytes to write.
* @param  BufferPtr contains data to write. The first byte always refers to
*         the address to write to.
* @param  RefPtr is a reference to the instance and in test mode always a #XHdcp22_Tx
*         structure.
*
* @return
*         - XST_SUCCESS if reading succeeded.
*         - XST_FAILURE if reading failed.
*
* @note   None.
*
******************************************************************************/
DDCWrite handler that is used in test mode, and emulates responses from a
HDCP22 receiver. It also checks when possible on errors, which are logged.
DDCWrite handler that is used in test mode and emulates responses from a HDCP22 receiver . It also checks when possible on errors which are logged .
static int XHdcp22Tx_TestDdcWrite(u8 DeviceAddress, u16 ByteCount, u8* BufferPtr,
                                  u8 Stop, void *RefPtr)
{
	XHdcp22_Tx *InstancePtr = (XHdcp22_Tx *)RefPtr;
	InstancePtr->Test.CurrentDdcAddress = BufferPtr[0];
	u8 Index = XHDCP22_TX_TEST_VECTOR_R2_INDEX;
	if (TEST_FLAG_SET(XHDCP22_TX_TEST_USE_TEST_VECTOR_R1, InstancePtr->Test.TestFlags)) {
		Index = XHDCP22_TX_TEST_VECTOR_R1_INDEX;
	}
	if (DeviceAddress == XHDCP22_TX_DDC_BASE_ADDRESS)
	{
		switch (InstancePtr->Test.CurrentDdcAddress)
		{
		case XHDCP22_TX_HDCPPORT_WRITE_MSG_OFFSET:
			switch(BufferPtr[1]) {
			case XHDCP22_TX_AKE_NO_STORED_KM:
				if (memcmp(&BufferPtr[2], XHdcp22_Tx_Test_EkpubKm[Index],
					XHDCP22_TX_E_KPUB_KM_SIZE) != 0) {
						XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_TEST_ERROR,
										XHDCP22_TX_AKE_NO_STORED_KM);
				}
				break;
			case XHDCP22_TX_SKE_SEND_EKS:
				if (memcmp(&BufferPtr[2], XHdcp22_Tx_Test_EdkeyKs[Index],
					XHDCP22_TX_EDKEY_KS_SIZE) != 0) {
						XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_TEST_ERROR,
										XHDCP22_TX_SKE_SEND_EKS);
				}
				break;
			case XHDCP22_TX_REPEATAUTH_SEND_ACK:
				if (memcmp(&BufferPtr[2], XHdcp22_Tx_Test_V,
					XHDCP22_TX_V_PRIME_SIZE) != 0) {
					XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_TEST_ERROR,
						XHDCP22_TX_REPEATAUTH_SEND_ACK);
				}
			break;
			case XHDCP22_TX_AKE_INIT:
			case XHDCP22_TX_AKE_STORED_KM:
			case XHDCP22_TX_LC_INIT:
			case XHDCP22_TX_REPEATAUTH_STREAM_MANAGE:
			break;
			default:
				XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_TEST_ERROR,
								XHDCP22_TX_MSG_UNDEFINED);
				break;
			};
			break;
		case XHDCP22_TX_HDCPPORT_VERSION_OFFSET:
		case XHDCP22_TX_HDCPPORT_RXSTATUS_OFFSET:
		case XHDCP22_TX_HDCPPORT_READ_MSG_OFFSET:
			break;
		default:
			XHdcp22Tx_LogWr(InstancePtr, XHDCP22_TX_LOG_EVT_TEST_ERROR,
								XHDCP22_TX_MSG_UNDEFINED);
			break;
		}
	};
	return XST_SUCCESS;
}
static int XHdcp22Tx_TestDdcWrite ( u8 DeviceAddress , u16 ByteCount , u8 * BufferPtr , u8 Stop , void * RefPtr ) { XHdcp22_Tx * InstancePtr = ( XHdcp22_Tx * ) RefPtr ; InstancePtr -> Test . CurrentDdcAddress = BufferPtr [ 0 ] ; u8 Index = XHDCP22_TX_TEST_VECTOR_R2_INDEX ; if ( TEST_FLAG_SET ( XHDCP22_TX_TEST_USE_TEST_VECTOR_R1 , InstancePtr -> Test . TestFlags ) ) { Index = XHDCP22_TX_TEST_VECTOR_R1_INDEX ; } if ( DeviceAddress == XHDCP22_TX_DDC_BASE_ADDRESS ) { switch ( InstancePtr -> Test . CurrentDdcAddress ) { case XHDCP22_TX_HDCPPORT_WRITE_MSG_OFFSET : switch ( BufferPtr [ 1 ] ) { case XHDCP22_TX_AKE_NO_STORED_KM : if ( memcmp ( & BufferPtr [ 2 ] , XHdcp22_Tx_Test_EkpubKm [ Index ] , XHDCP22_TX_E_KPUB_KM_SIZE ) != 0 ) { XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_TEST_ERROR , XHDCP22_TX_AKE_NO_STORED_KM ) ; } break ; case XHDCP22_TX_SKE_SEND_EKS : if ( memcmp ( & BufferPtr [ 2 ] , XHdcp22_Tx_Test_EdkeyKs [ Index ] , XHDCP22_TX_EDKEY_KS_SIZE ) != 0 ) { XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_TEST_ERROR , XHDCP22_TX_SKE_SEND_EKS ) ; } break ; case XHDCP22_TX_REPEATAUTH_SEND_ACK : if ( memcmp ( & BufferPtr [ 2 ] , XHdcp22_Tx_Test_V , XHDCP22_TX_V_PRIME_SIZE ) != 0 ) { XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_TEST_ERROR , XHDCP22_TX_REPEATAUTH_SEND_ACK ) ; } break ; case XHDCP22_TX_AKE_INIT : case XHDCP22_TX_AKE_STORED_KM : case XHDCP22_TX_LC_INIT : case XHDCP22_TX_REPEATAUTH_STREAM_MANAGE : break ; default : XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_TEST_ERROR , XHDCP22_TX_MSG_UNDEFINED ) ; break ; } ; break ; case XHDCP22_TX_HDCPPORT_VERSION_OFFSET : case XHDCP22_TX_HDCPPORT_RXSTATUS_OFFSET : case XHDCP22_TX_HDCPPORT_READ_MSG_OFFSET : break ; default : XHdcp22Tx_LogWr ( InstancePtr , XHDCP22_TX_LOG_EVT_TEST_ERROR , XHDCP22_TX_MSG_UNDEFINED ) ; break ; } } ; return XST_SUCCESS ; }
DDCWrite handler that is used in test mode, and emulates responses from a
HDCP22 receiver.
DDCWrite handler that is used in test mode and emulates responses from a HDCP22 receiver .
/* No need to check these, these messages are just assembled from
			   hardcoded values from this test */ /* Write an error to the log if the message is undefined */ /* No need to check these */ /* Write an error to the log if the message is undefined */