XilinxProcessorIPLib/drivers/hdcp22_tx/src/xhdcp22_tx_test.c
static int XHdcp22Tx_TestDdcRead(u8 DeviceAddress, u16 ByteCount, u8* BufferPtr,
                                 u8 Stop, void *RefPtr)
{
	XHdcp22_Tx *InstancePtr = (XHdcp22_Tx *)RefPtr;
	u16  RxStatus = 0;

	if (DeviceAddress == 0x3A)
	{
		switch (InstancePtr->Test.CurrentDdcAddress)
		{
		case XHDCP22_TX_HDCPPORT_VERSION_OFFSET:
			BufferPtr[0] = 0x04;
			break;
		case XHDCP22_TX_HDCPPORT_RXSTATUS_OFFSET:
			switch(InstancePtr->Timer.ReasonId)
			{
				case XHDCP22_TX_AKE_SEND_CERT:
					RxStatus|=XHDCP22_TX_AKE_SEND_CERT_SIZE;
				break;
				case XHDCP22_TX_AKE_SEND_H_PRIME:
					RxStatus|=XHDCP22_TX_AKE_SEND_H_PRIME_SIZE;
				break;
				case XHDCP22_TX_AKE_SEND_PAIRING_INFO:
					RxStatus|=XHDCP22_TX_AKE_SEND_PAIRING_INFO_SIZE;
				break;
				case XHDCP22_TX_LC_SEND_L_PRIME:
					RxStatus|=XHDCP22_TX_LC_SEND_L_PRIME_SIZE;
				break;
				case XHDCP22_TX_REPEATAUTH_SEND_RECVID_LIST:
					RxStatus |= XHDCP22_TX_RXSTATUS_READY_MASK;
					RxStatus |= (XHDCP22_TX_RXINFO_SIZE +
					             XHDCP22_TX_SEQ_NUM_V_SIZE +
					             XHDCP22_TX_V_PRIME_SIZE +
					             sizeof(XHdcp22_Tx_Test_RcvIDList) +
					             1);
				break;
				case XHDCP22_TX_REPEATAUTH_STREAM_READY:
					RxStatus |= XHDCP22_TX_REPEATAUTH_STREAM_READY_SIZE;
				break;
			}
			*(u16 *)BufferPtr = RxStatus;
			break;
		case XHDCP22_TX_HDCPPORT_READ_MSG_OFFSET:
			XHdcp22Tx_TestReadMsg(BufferPtr, InstancePtr->Test.TestFlags);
			break;
		case XHDCP22_TX_HDCPPORT_WRITE_MSG_OFFSET:
			break;
		default:
			BufferPtr[0] = 0;
			break;
		}
	};
	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* DDCRead handler that is used in test mode, and emulates responses from a
* HDCP22 receiver.
*
* @param  DeviceAddress is the addres to use. Normally set to 0x74.
* @param  ByteCount is the amount of bytes to read.
* @param  BufferPtr contains room for dsata to read. The first byte always refers to
*         the address to read.
* @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.
*
******************************************************************************/
DDCRead handler that is used in test mode, and emulates responses from a
HDCP22 receiver.
DDCRead handler that is used in test mode and emulates responses from a HDCP22 receiver .
static int XHdcp22Tx_TestDdcRead(u8 DeviceAddress, u16 ByteCount, u8* BufferPtr,
                                 u8 Stop, void *RefPtr)
{
	XHdcp22_Tx *InstancePtr = (XHdcp22_Tx *)RefPtr;
	u16  RxStatus = 0;
	if (DeviceAddress == 0x3A)
	{
		switch (InstancePtr->Test.CurrentDdcAddress)
		{
		case XHDCP22_TX_HDCPPORT_VERSION_OFFSET:
			BufferPtr[0] = 0x04;
			break;
		case XHDCP22_TX_HDCPPORT_RXSTATUS_OFFSET:
			switch(InstancePtr->Timer.ReasonId)
			{
				case XHDCP22_TX_AKE_SEND_CERT:
					RxStatus|=XHDCP22_TX_AKE_SEND_CERT_SIZE;
				break;
				case XHDCP22_TX_AKE_SEND_H_PRIME:
					RxStatus|=XHDCP22_TX_AKE_SEND_H_PRIME_SIZE;
				break;
				case XHDCP22_TX_AKE_SEND_PAIRING_INFO:
					RxStatus|=XHDCP22_TX_AKE_SEND_PAIRING_INFO_SIZE;
				break;
				case XHDCP22_TX_LC_SEND_L_PRIME:
					RxStatus|=XHDCP22_TX_LC_SEND_L_PRIME_SIZE;
				break;
				case XHDCP22_TX_REPEATAUTH_SEND_RECVID_LIST:
					RxStatus |= XHDCP22_TX_RXSTATUS_READY_MASK;
					RxStatus |= (XHDCP22_TX_RXINFO_SIZE +
					             XHDCP22_TX_SEQ_NUM_V_SIZE +
					             XHDCP22_TX_V_PRIME_SIZE +
					             sizeof(XHdcp22_Tx_Test_RcvIDList) +
					             1);
				break;
				case XHDCP22_TX_REPEATAUTH_STREAM_READY:
					RxStatus |= XHDCP22_TX_REPEATAUTH_STREAM_READY_SIZE;
				break;
			}
			*(u16 *)BufferPtr = RxStatus;
			break;
		case XHDCP22_TX_HDCPPORT_READ_MSG_OFFSET:
			XHdcp22Tx_TestReadMsg(BufferPtr, InstancePtr->Test.TestFlags);
			break;
		case XHDCP22_TX_HDCPPORT_WRITE_MSG_OFFSET:
			break;
		default:
			BufferPtr[0] = 0;
			break;
		}
	};
	return XST_SUCCESS;
}
static int XHdcp22Tx_TestDdcRead ( u8 DeviceAddress , u16 ByteCount , u8 * BufferPtr , u8 Stop , void * RefPtr ) { XHdcp22_Tx * InstancePtr = ( XHdcp22_Tx * ) RefPtr ; u16 RxStatus = 0 ; if ( DeviceAddress == 0x3A ) { switch ( InstancePtr -> Test . CurrentDdcAddress ) { case XHDCP22_TX_HDCPPORT_VERSION_OFFSET : BufferPtr [ 0 ] = 0x04 ; break ; case XHDCP22_TX_HDCPPORT_RXSTATUS_OFFSET : switch ( InstancePtr -> Timer . ReasonId ) { case XHDCP22_TX_AKE_SEND_CERT : RxStatus |= XHDCP22_TX_AKE_SEND_CERT_SIZE ; break ; case XHDCP22_TX_AKE_SEND_H_PRIME : RxStatus |= XHDCP22_TX_AKE_SEND_H_PRIME_SIZE ; break ; case XHDCP22_TX_AKE_SEND_PAIRING_INFO : RxStatus |= XHDCP22_TX_AKE_SEND_PAIRING_INFO_SIZE ; break ; case XHDCP22_TX_LC_SEND_L_PRIME : RxStatus |= XHDCP22_TX_LC_SEND_L_PRIME_SIZE ; break ; case XHDCP22_TX_REPEATAUTH_SEND_RECVID_LIST : RxStatus |= XHDCP22_TX_RXSTATUS_READY_MASK ; RxStatus |= ( XHDCP22_TX_RXINFO_SIZE + XHDCP22_TX_SEQ_NUM_V_SIZE + XHDCP22_TX_V_PRIME_SIZE + sizeof ( XHdcp22_Tx_Test_RcvIDList ) + 1 ) ; break ; case XHDCP22_TX_REPEATAUTH_STREAM_READY : RxStatus |= XHDCP22_TX_REPEATAUTH_STREAM_READY_SIZE ; break ; } * ( u16 * ) BufferPtr = RxStatus ; break ; case XHDCP22_TX_HDCPPORT_READ_MSG_OFFSET : XHdcp22Tx_TestReadMsg ( BufferPtr , InstancePtr -> Test . TestFlags ) ; break ; case XHDCP22_TX_HDCPPORT_WRITE_MSG_OFFSET : break ; default : BufferPtr [ 0 ] = 0 ; break ; } } ; return XST_SUCCESS ; }
DDCRead handler that is used in test mode, and emulates responses from a
HDCP22 receiver.
DDCRead handler that is used in test mode and emulates responses from a HDCP22 receiver .