XilinxProcessorIPLib/drivers/hdcp22_tx_dp/src/xhdcp22_tx.c
int XHdcp22Tx_CfgInitialize(XHdcp22_Tx *InstancePtr, XHdcp22_Tx_Config *CfgPtr,
                            UINTPTR EffectiveAddr)
{
	int Result = XST_SUCCESS;

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

	/* Setup the instance */
	(void)memset((void *)InstancePtr, 0, sizeof(XHdcp22_Tx));

	/* copy configuration settings */
	(void)memcpy((void *)&(InstancePtr->Config), (const void *)CfgPtr,
				 sizeof(XHdcp22_Tx_Config));

	InstancePtr->Config.BaseAddress = EffectiveAddr;

	/* Set all handlers to stub values, let user configure this data later */
	InstancePtr->DdcRead = XHdcp22Tx_StubDdc;
	InstancePtr->IsDdcReadSet = (FALSE);
	InstancePtr->DdcWrite = XHdcp22Tx_StubDdc;
	InstancePtr->IsDdcWriteSet = (FALSE);
	InstancePtr->AuthenticatedCallback = XHdcp22Tx_StubCallback;
	InstancePtr->IsAuthenticatedCallbackSet = (FALSE);
	InstancePtr->UnauthenticatedCallback = XHdcp22Tx_StubCallback;
	InstancePtr->IsUnauthenticatedCallbackSet = (FALSE);
	InstancePtr->DownstreamTopologyAvailableCallback = XHdcp22Tx_StubCallback;
	InstancePtr->IsDownstreamTopologyAvailableCallbackSet = (FALSE);

	InstancePtr->Info.Protocol = XHDCP22_TX_HDMI;

	/* Initialize global parameters */
	InstancePtr->Info.IsReceiverHDCP2Capable = (FALSE);

	/* Initialize statemachine, but do not run it */
	/* Dynamically setup the transition table */
	memset(transition_table, 0x00, sizeof(transition_table));
	transition_table[XHDCP22_TX_STATE_A1][XHDCP22_TX_STATE_A0] = XHdcp22Tx_A1A0;
	transition_table[XHDCP22_TX_STATE_A1_1][XHDCP22_TX_STATE_A0] = XHdcp22Tx_A1A0;
	transition_table[XHDCP22_TX_STATE_A1_NSK0][XHDCP22_TX_STATE_A0] = XHdcp22Tx_A1A0;
	transition_table[XHDCP22_TX_STATE_A1_NSK1][XHDCP22_TX_STATE_A0] = XHdcp22Tx_A1A0;
	transition_table[XHDCP22_TX_STATE_A1_SK0][XHDCP22_TX_STATE_A0] = XHdcp22Tx_A1A0;

	transition_table[XHDCP22_TX_STATE_A1_NSK1][XHDCP22_TX_STATE_A2] = XHdcp22Tx_A1A2;
	transition_table[XHDCP22_TX_STATE_A1_SK0][XHDCP22_TX_STATE_A2] = XHdcp22Tx_A1A2;

	transition_table[XHDCP22_TX_STATE_A2][XHDCP22_TX_STATE_A0] = XHdcp22Tx_A2A0;
	transition_table[XHDCP22_TX_STATE_A2_1][XHDCP22_TX_STATE_A0] = XHdcp22Tx_A2A0;
	transition_table[XHDCP22_TX_STATE_A3][XHDCP22_TX_STATE_A0] = XHdcp22Tx_A3A0;
	transition_table[XHDCP22_TX_STATE_A4][XHDCP22_TX_STATE_A5] = XHdcp22Tx_A4A5;
	transition_table[XHDCP22_TX_STATE_A3][XHDCP22_TX_STATE_A4] = XHdcp22Tx_A3A4;
	transition_table[XHDCP22_TX_STATE_A6_A7_A8][XHDCP22_TX_STATE_A0] = XHdcp22Tx_A6A7A0;
	transition_table[XHDCP22_TX_STATE_A9][XHDCP22_TX_STATE_A0] = XHdcp22Tx_A9A0;

	InstancePtr->Info.AuthenticationStatus = XHDCP22_TX_UNAUTHENTICATED;
	InstancePtr->Info.CurrentState = XHDCP22_TX_STATE_H0;
	InstancePtr->Info.PrvState = XHDCP22_TX_STATE_H0;
	InstancePtr->Info.IsEnabled = (FALSE);
	InstancePtr->Info.StateContext = NULL;
	InstancePtr->Info.MsgAvailable = (FALSE);
	InstancePtr->Info.PollingValue = XHDCP22_TX_DEFAULT_RX_STATUS_POLLVALUE;

	/* Topology info */
	InstancePtr->Info.IsTopologyAvailable = (FALSE);

	/* Timer configuration */
	InstancePtr->Timer.TimerExpired = (TRUE);
	InstancePtr->Timer.ReasonId = XHDCP22_TX_TS_UNDEFINED;
	InstancePtr->Timer.InitialTicks = 0;

	/* Receiver ID list */
	InstancePtr->Info.ReceivedFirstSeqNum_V = (FALSE);

	/* Revocation List */
	InstancePtr->Info.IsRevocationListValid = (FALSE);
	InstancePtr->RevocationList.NumDevices = 0;

	/* Content Stream Management */
	InstancePtr->Info.ContentStreamType = XHDCP22_STREAMTYPE_0; // Default
	InstancePtr->Info.IsContentStreamTypeSet = (TRUE);

	/* Clear pairing info */
	XHdcp22Tx_ClearPairingInfo(InstancePtr);

	/* Initialize random number generator */
	Result = XHdcp22Tx_InitializeRng(InstancePtr);
	if (Result != XST_SUCCESS) {
		return Result;
	}

	/* Initialize cipher */
	Result = XHdcp22Tx_InitializeCipher(InstancePtr);
	if (Result != XST_SUCCESS) {
		return Result;
	}

	/* Indicate the instance is now ready to use, initialized without error */
	InstancePtr->IsReady = XIL_COMPONENT_IS_READY;

	XHdcp22Tx_LogReset(InstancePtr, FALSE);

	return (XST_SUCCESS);
}
/************************** Function Definitions *****************************/
/*****************************************************************************/
/**
*
* This function initializes the HDCP22 TX core. This function must be called
* prior to using the HDCP TX core. Initialization of the HDCP TX includes
* setting up the instance data and ensuring the hardware is in a quiescent
* state.
*
* @param InstancePtr is a pointer to the XHdcp22_Tx core instance.
* @param CfgPtr points to the configuration structure associated with
*        the HDCP TX core.
* @param EffectiveAddr is the base address of the device. If address
*        translation is being used, then this parameter must reflect the
*        virtual base address. Otherwise, the physical address should be
*        used.
*
* @return
*    - XST_SUCCESS Initialization was successful.
*    - XST_FAILURE Initialization of the internal timer failed or there was a
*               HDCP TX PIO ID mismatch.
* @note   None.
*
******************************************************************************/
Function Definitions
This function initializes the HDCP22 TX core. This function must be called
prior to using the HDCP TX core. Initialization of the HDCP TX includes
setting up the instance data and ensuring the hardware is in a quiescent
state.
Function Definitions This function initializes the HDCP22 TX core . This function must be called prior to using the HDCP TX core . Initialization of the HDCP TX includes setting up the instance data and ensuring the hardware is in a quiescent state .
int XHdcp22Tx_CfgInitialize(XHdcp22_Tx *InstancePtr, XHdcp22_Tx_Config *CfgPtr,
                            UINTPTR EffectiveAddr)
{
	int Result = XST_SUCCESS;
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(CfgPtr != NULL);
	Xil_AssertNonvoid(EffectiveAddr != (UINTPTR)NULL);
	(void)memset((void *)InstancePtr, 0, sizeof(XHdcp22_Tx));
	(void)memcpy((void *)&(InstancePtr->Config), (const void *)CfgPtr,
				 sizeof(XHdcp22_Tx_Config));
	InstancePtr->Config.BaseAddress = EffectiveAddr;
	InstancePtr->DdcRead = XHdcp22Tx_StubDdc;
	InstancePtr->IsDdcReadSet = (FALSE);
	InstancePtr->DdcWrite = XHdcp22Tx_StubDdc;
	InstancePtr->IsDdcWriteSet = (FALSE);
	InstancePtr->AuthenticatedCallback = XHdcp22Tx_StubCallback;
	InstancePtr->IsAuthenticatedCallbackSet = (FALSE);
	InstancePtr->UnauthenticatedCallback = XHdcp22Tx_StubCallback;
	InstancePtr->IsUnauthenticatedCallbackSet = (FALSE);
	InstancePtr->DownstreamTopologyAvailableCallback = XHdcp22Tx_StubCallback;
	InstancePtr->IsDownstreamTopologyAvailableCallbackSet = (FALSE);
	InstancePtr->Info.Protocol = XHDCP22_TX_HDMI;
	InstancePtr->Info.IsReceiverHDCP2Capable = (FALSE);
	memset(transition_table, 0x00, sizeof(transition_table));
	transition_table[XHDCP22_TX_STATE_A1][XHDCP22_TX_STATE_A0] = XHdcp22Tx_A1A0;
	transition_table[XHDCP22_TX_STATE_A1_1][XHDCP22_TX_STATE_A0] = XHdcp22Tx_A1A0;
	transition_table[XHDCP22_TX_STATE_A1_NSK0][XHDCP22_TX_STATE_A0] = XHdcp22Tx_A1A0;
	transition_table[XHDCP22_TX_STATE_A1_NSK1][XHDCP22_TX_STATE_A0] = XHdcp22Tx_A1A0;
	transition_table[XHDCP22_TX_STATE_A1_SK0][XHDCP22_TX_STATE_A0] = XHdcp22Tx_A1A0;
	transition_table[XHDCP22_TX_STATE_A1_NSK1][XHDCP22_TX_STATE_A2] = XHdcp22Tx_A1A2;
	transition_table[XHDCP22_TX_STATE_A1_SK0][XHDCP22_TX_STATE_A2] = XHdcp22Tx_A1A2;
	transition_table[XHDCP22_TX_STATE_A2][XHDCP22_TX_STATE_A0] = XHdcp22Tx_A2A0;
	transition_table[XHDCP22_TX_STATE_A2_1][XHDCP22_TX_STATE_A0] = XHdcp22Tx_A2A0;
	transition_table[XHDCP22_TX_STATE_A3][XHDCP22_TX_STATE_A0] = XHdcp22Tx_A3A0;
	transition_table[XHDCP22_TX_STATE_A4][XHDCP22_TX_STATE_A5] = XHdcp22Tx_A4A5;
	transition_table[XHDCP22_TX_STATE_A3][XHDCP22_TX_STATE_A4] = XHdcp22Tx_A3A4;
	transition_table[XHDCP22_TX_STATE_A6_A7_A8][XHDCP22_TX_STATE_A0] = XHdcp22Tx_A6A7A0;
	transition_table[XHDCP22_TX_STATE_A9][XHDCP22_TX_STATE_A0] = XHdcp22Tx_A9A0;
	InstancePtr->Info.AuthenticationStatus = XHDCP22_TX_UNAUTHENTICATED;
	InstancePtr->Info.CurrentState = XHDCP22_TX_STATE_H0;
	InstancePtr->Info.PrvState = XHDCP22_TX_STATE_H0;
	InstancePtr->Info.IsEnabled = (FALSE);
	InstancePtr->Info.StateContext = NULL;
	InstancePtr->Info.MsgAvailable = (FALSE);
	InstancePtr->Info.PollingValue = XHDCP22_TX_DEFAULT_RX_STATUS_POLLVALUE;
	InstancePtr->Info.IsTopologyAvailable = (FALSE);
	InstancePtr->Timer.TimerExpired = (TRUE);
	InstancePtr->Timer.ReasonId = XHDCP22_TX_TS_UNDEFINED;
	InstancePtr->Timer.InitialTicks = 0;
	InstancePtr->Info.ReceivedFirstSeqNum_V = (FALSE);
	InstancePtr->Info.IsRevocationListValid = (FALSE);
	InstancePtr->RevocationList.NumDevices = 0;
	InstancePtr->Info.ContentStreamType = XHDCP22_STREAMTYPE_0; 
	InstancePtr->Info.IsContentStreamTypeSet = (TRUE);
	XHdcp22Tx_ClearPairingInfo(InstancePtr);
	Result = XHdcp22Tx_InitializeRng(InstancePtr);
	if (Result != XST_SUCCESS) {
		return Result;
	}
	Result = XHdcp22Tx_InitializeCipher(InstancePtr);
	if (Result != XST_SUCCESS) {
		return Result;
	}
	InstancePtr->IsReady = XIL_COMPONENT_IS_READY;
	XHdcp22Tx_LogReset(InstancePtr, FALSE);
	return (XST_SUCCESS);
}
int XHdcp22Tx_CfgInitialize ( XHdcp22_Tx * InstancePtr , XHdcp22_Tx_Config * CfgPtr , UINTPTR EffectiveAddr ) { int Result = XST_SUCCESS ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( CfgPtr != NULL ) ; Xil_AssertNonvoid ( EffectiveAddr != ( UINTPTR ) NULL ) ; ( void ) memset ( ( void * ) InstancePtr , 0 , sizeof ( XHdcp22_Tx ) ) ; ( void ) memcpy ( ( void * ) & ( InstancePtr -> Config ) , ( const void * ) CfgPtr , sizeof ( XHdcp22_Tx_Config ) ) ; InstancePtr -> Config . BaseAddress = EffectiveAddr ; InstancePtr -> DdcRead = XHdcp22Tx_StubDdc ; InstancePtr -> IsDdcReadSet = ( FALSE ) ; InstancePtr -> DdcWrite = XHdcp22Tx_StubDdc ; InstancePtr -> IsDdcWriteSet = ( FALSE ) ; InstancePtr -> AuthenticatedCallback = XHdcp22Tx_StubCallback ; InstancePtr -> IsAuthenticatedCallbackSet = ( FALSE ) ; InstancePtr -> UnauthenticatedCallback = XHdcp22Tx_StubCallback ; InstancePtr -> IsUnauthenticatedCallbackSet = ( FALSE ) ; InstancePtr -> DownstreamTopologyAvailableCallback = XHdcp22Tx_StubCallback ; InstancePtr -> IsDownstreamTopologyAvailableCallbackSet = ( FALSE ) ; InstancePtr -> Info . Protocol = XHDCP22_TX_HDMI ; InstancePtr -> Info . IsReceiverHDCP2Capable = ( FALSE ) ; memset ( transition_table , 0x00 , sizeof ( transition_table ) ) ; transition_table [ XHDCP22_TX_STATE_A1 ] [ XHDCP22_TX_STATE_A0 ] = XHdcp22Tx_A1A0 ; transition_table [ XHDCP22_TX_STATE_A1_1 ] [ XHDCP22_TX_STATE_A0 ] = XHdcp22Tx_A1A0 ; transition_table [ XHDCP22_TX_STATE_A1_NSK0 ] [ XHDCP22_TX_STATE_A0 ] = XHdcp22Tx_A1A0 ; transition_table [ XHDCP22_TX_STATE_A1_NSK1 ] [ XHDCP22_TX_STATE_A0 ] = XHdcp22Tx_A1A0 ; transition_table [ XHDCP22_TX_STATE_A1_SK0 ] [ XHDCP22_TX_STATE_A0 ] = XHdcp22Tx_A1A0 ; transition_table [ XHDCP22_TX_STATE_A1_NSK1 ] [ XHDCP22_TX_STATE_A2 ] = XHdcp22Tx_A1A2 ; transition_table [ XHDCP22_TX_STATE_A1_SK0 ] [ XHDCP22_TX_STATE_A2 ] = XHdcp22Tx_A1A2 ; transition_table [ XHDCP22_TX_STATE_A2 ] [ XHDCP22_TX_STATE_A0 ] = XHdcp22Tx_A2A0 ; transition_table [ XHDCP22_TX_STATE_A2_1 ] [ XHDCP22_TX_STATE_A0 ] = XHdcp22Tx_A2A0 ; transition_table [ XHDCP22_TX_STATE_A3 ] [ XHDCP22_TX_STATE_A0 ] = XHdcp22Tx_A3A0 ; transition_table [ XHDCP22_TX_STATE_A4 ] [ XHDCP22_TX_STATE_A5 ] = XHdcp22Tx_A4A5 ; transition_table [ XHDCP22_TX_STATE_A3 ] [ XHDCP22_TX_STATE_A4 ] = XHdcp22Tx_A3A4 ; transition_table [ XHDCP22_TX_STATE_A6_A7_A8 ] [ XHDCP22_TX_STATE_A0 ] = XHdcp22Tx_A6A7A0 ; transition_table [ XHDCP22_TX_STATE_A9 ] [ XHDCP22_TX_STATE_A0 ] = XHdcp22Tx_A9A0 ; InstancePtr -> Info . AuthenticationStatus = XHDCP22_TX_UNAUTHENTICATED ; InstancePtr -> Info . CurrentState = XHDCP22_TX_STATE_H0 ; InstancePtr -> Info . PrvState = XHDCP22_TX_STATE_H0 ; InstancePtr -> Info . IsEnabled = ( FALSE ) ; InstancePtr -> Info . StateContext = NULL ; InstancePtr -> Info . MsgAvailable = ( FALSE ) ; InstancePtr -> Info . PollingValue = XHDCP22_TX_DEFAULT_RX_STATUS_POLLVALUE ; InstancePtr -> Info . IsTopologyAvailable = ( FALSE ) ; InstancePtr -> Timer . TimerExpired = ( TRUE ) ; InstancePtr -> Timer . ReasonId = XHDCP22_TX_TS_UNDEFINED ; InstancePtr -> Timer . InitialTicks = 0 ; InstancePtr -> Info . ReceivedFirstSeqNum_V = ( FALSE ) ; InstancePtr -> Info . IsRevocationListValid = ( FALSE ) ; InstancePtr -> RevocationList . NumDevices = 0 ; InstancePtr -> Info . ContentStreamType = XHDCP22_STREAMTYPE_0 ; InstancePtr -> Info . IsContentStreamTypeSet = ( TRUE ) ; XHdcp22Tx_ClearPairingInfo ( InstancePtr ) ; Result = XHdcp22Tx_InitializeRng ( InstancePtr ) ; if ( Result != XST_SUCCESS ) { return Result ; } Result = XHdcp22Tx_InitializeCipher ( InstancePtr ) ; if ( Result != XST_SUCCESS ) { return Result ; } InstancePtr -> IsReady = XIL_COMPONENT_IS_READY ; XHdcp22Tx_LogReset ( InstancePtr , FALSE ) ; return ( XST_SUCCESS ) ; }
Function Definitions
This function initializes the HDCP22 TX core.
Function Definitions This function initializes the HDCP22 TX core .
/* Verify arguments. */ /* Setup the instance */ /* copy configuration settings */ /* Set all handlers to stub values, let user configure this data later */ /* Initialize global parameters */ /* Initialize statemachine, but do not run it */ /* Dynamically setup the transition table */ /* Topology info */ /* Timer configuration */ /* Receiver ID list */ /* Revocation List */ /* Content Stream Management */ // Default /* Clear pairing info */ /* Initialize random number generator */ /* Initialize cipher */ /* Indicate the instance is now ready to use, initialized without error */