XilinxProcessorIPLib/drivers/v_sdirx/src/xv_sdirx.c
int XV_SdiRx_CfgInitialize(XV_SdiRx *InstancePtr, XV_SdiRx_Config *CfgPtr,
				UINTPTR EffectiveAddr)
{
	XV_SdiRx_SupportedModes SupportModes = XV_SDIRX_SUPPORT_ALL;

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

	/* Setup the instance */
	(void)memset((void *)InstancePtr, 0, sizeof(XV_SdiRx));
	(void)memcpy((void *)&(InstancePtr->Config),
	(const void *)CfgPtr,
	sizeof(XV_SdiRx_Config));
	InstancePtr->Config.BaseAddress = EffectiveAddr;

	/*
	 * Callbacks
	 * These are placeholders pointing to the StubCallback. The actual
	 * callback pointers will be assigned by the SetCallback function.
	 */
	InstancePtr->StreamDownCallback = (XV_SdiRx_Callback)((void *)StubCallback);

	InstancePtr->StreamUpCallback = (XV_SdiRx_Callback)((void *)StubCallback);

	InstancePtr->OverFlowCallback = (XV_SdiRx_Callback)((void *)StubCallback);

	InstancePtr->UnderFlowCallback = (XV_SdiRx_Callback)((void *)StubCallback);
	InstancePtr->VsyncCallback = (XV_SdiRx_Callback)((void *)StubCallback);

	/* Clear SDI variables */
	XV_SdiRx_ResetStream(InstancePtr);

	/* Stop SDI RX Core */
	XV_SdiRx_Stop(InstancePtr);

	/* Configure SDI RX Core */
	XV_SdiRx_FramerEnable(InstancePtr);

	if (InstancePtr->Config.MaxRateSupported < XSDIRX_LINE_RATE_12G8DS)
		SupportModes &= ~(XV_SDIRX_SUPPORT_12GI | XV_SDIRX_SUPPORT_12GF);

	if (InstancePtr->Config.MaxRateSupported < XSDIRX_LINE_RATE_6G)
		SupportModes &= ~XV_SDIRX_SUPPORT_6G;

	XV_SdiRx_EnableMode(InstancePtr, SupportModes);

	/* Enables FF EDH and AP EDH errors counter */
	XV_SdiRx_SetEdhErrCntTrigger(InstancePtr, 0x420);

	/* Initializes the video lock window */
	XV_SdiRx_SetVidLckWindow(InstancePtr, XV_SDIRX_VID_LCK_WINDOW);

	/* Reset all peripherals */
	XV_SdiRx_IntrDisable(InstancePtr, XV_SDIRX_IER_ALLINTR_MASK);

	/* Start SDI core */
	XV_SdiRx_Start(InstancePtr, XV_SDIRX_MULTISEARCHMODE);

	/* Set global interrupt enable bit */
	XV_SdiRx_SetGlobalInterrupt(InstancePtr);

	/* Clear the interrupt status */
	XV_SdiRx_WriteReg(InstancePtr->Config.BaseAddress,
				(XV_SDIRX_ISR_OFFSET),
				(XV_SDIRX_ISR_VIDEO_LOCK_MASK
				| XV_SDIRX_ISR_VIDEO_UNLOCK_MASK
				| XV_SDIRX_ISR_OVERFLOW_MASK
				| XV_SDIRX_ISR_UNDERFLOW_MASK));

	/* Reset the hardware and set the flag to indicate the driver is ready */
	InstancePtr->IsReady = (u32)(XIL_COMPONENT_IS_READY);

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function initializes the SDI RX core. This function must be called
* prior to using the SDI RX core. Initialization of the SDI RX includes
* setting up the instance data, and ensuring the hardware is in a quiescent
* state.
*
* @param	InstancePtr is a pointer to the XV_SdiRx core instance.
* @param	CfgPtr points to the configuration structure associated with
*		the SDI RX 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 if XV_SdiRx_CfgInitialize was successful.
*		- XST_FAILURE if XV_SdiRx_CfgInitialize was unsuccessful.
*
* @note		None.
*
******************************************************************************/
This function initializes the SDI RX core. This function must be called
prior to using the SDI RX core. Initialization of the SDI RX includes
setting up the instance data, and ensuring the hardware is in a quiescent
state.
This function initializes the SDI RX core . This function must be called prior to using the SDI RX core . Initialization of the SDI RX includes setting up the instance data and ensuring the hardware is in a quiescent state .
int XV_SdiRx_CfgInitialize(XV_SdiRx *InstancePtr, XV_SdiRx_Config *CfgPtr,
				UINTPTR EffectiveAddr)
{
	XV_SdiRx_SupportedModes SupportModes = XV_SDIRX_SUPPORT_ALL;
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(CfgPtr != NULL);
	Xil_AssertNonvoid(EffectiveAddr != (UINTPTR)0x0);
	(void)memset((void *)InstancePtr, 0, sizeof(XV_SdiRx));
	(void)memcpy((void *)&(InstancePtr->Config),
	(const void *)CfgPtr,
	sizeof(XV_SdiRx_Config));
	InstancePtr->Config.BaseAddress = EffectiveAddr;
	InstancePtr->StreamDownCallback = (XV_SdiRx_Callback)((void *)StubCallback);
	InstancePtr->StreamUpCallback = (XV_SdiRx_Callback)((void *)StubCallback);
	InstancePtr->OverFlowCallback = (XV_SdiRx_Callback)((void *)StubCallback);
	InstancePtr->UnderFlowCallback = (XV_SdiRx_Callback)((void *)StubCallback);
	InstancePtr->VsyncCallback = (XV_SdiRx_Callback)((void *)StubCallback);
	XV_SdiRx_ResetStream(InstancePtr);
	XV_SdiRx_Stop(InstancePtr);
	XV_SdiRx_FramerEnable(InstancePtr);
	if (InstancePtr->Config.MaxRateSupported < XSDIRX_LINE_RATE_12G8DS)
		SupportModes &= ~(XV_SDIRX_SUPPORT_12GI | XV_SDIRX_SUPPORT_12GF);
	if (InstancePtr->Config.MaxRateSupported < XSDIRX_LINE_RATE_6G)
		SupportModes &= ~XV_SDIRX_SUPPORT_6G;
	XV_SdiRx_EnableMode(InstancePtr, SupportModes);
	XV_SdiRx_SetEdhErrCntTrigger(InstancePtr, 0x420);
	XV_SdiRx_SetVidLckWindow(InstancePtr, XV_SDIRX_VID_LCK_WINDOW);
	XV_SdiRx_IntrDisable(InstancePtr, XV_SDIRX_IER_ALLINTR_MASK);
	XV_SdiRx_Start(InstancePtr, XV_SDIRX_MULTISEARCHMODE);
	XV_SdiRx_SetGlobalInterrupt(InstancePtr);
	XV_SdiRx_WriteReg(InstancePtr->Config.BaseAddress,
				(XV_SDIRX_ISR_OFFSET),
				(XV_SDIRX_ISR_VIDEO_LOCK_MASK
				| XV_SDIRX_ISR_VIDEO_UNLOCK_MASK
				| XV_SDIRX_ISR_OVERFLOW_MASK
				| XV_SDIRX_ISR_UNDERFLOW_MASK));
	InstancePtr->IsReady = (u32)(XIL_COMPONENT_IS_READY);
	return XST_SUCCESS;
}
int XV_SdiRx_CfgInitialize ( XV_SdiRx * InstancePtr , XV_SdiRx_Config * CfgPtr , UINTPTR EffectiveAddr ) { XV_SdiRx_SupportedModes SupportModes = XV_SDIRX_SUPPORT_ALL ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( CfgPtr != NULL ) ; Xil_AssertNonvoid ( EffectiveAddr != ( UINTPTR ) 0x0 ) ; ( void ) memset ( ( void * ) InstancePtr , 0 , sizeof ( XV_SdiRx ) ) ; ( void ) memcpy ( ( void * ) & ( InstancePtr -> Config ) , ( const void * ) CfgPtr , sizeof ( XV_SdiRx_Config ) ) ; InstancePtr -> Config . BaseAddress = EffectiveAddr ; InstancePtr -> StreamDownCallback = ( XV_SdiRx_Callback ) ( ( void * ) StubCallback ) ; InstancePtr -> StreamUpCallback = ( XV_SdiRx_Callback ) ( ( void * ) StubCallback ) ; InstancePtr -> OverFlowCallback = ( XV_SdiRx_Callback ) ( ( void * ) StubCallback ) ; InstancePtr -> UnderFlowCallback = ( XV_SdiRx_Callback ) ( ( void * ) StubCallback ) ; InstancePtr -> VsyncCallback = ( XV_SdiRx_Callback ) ( ( void * ) StubCallback ) ; XV_SdiRx_ResetStream ( InstancePtr ) ; XV_SdiRx_Stop ( InstancePtr ) ; XV_SdiRx_FramerEnable ( InstancePtr ) ; if ( InstancePtr -> Config . MaxRateSupported < XSDIRX_LINE_RATE_12G8DS ) SupportModes &= ~ ( XV_SDIRX_SUPPORT_12GI | XV_SDIRX_SUPPORT_12GF ) ; if ( InstancePtr -> Config . MaxRateSupported < XSDIRX_LINE_RATE_6G ) SupportModes &= ~ XV_SDIRX_SUPPORT_6G ; XV_SdiRx_EnableMode ( InstancePtr , SupportModes ) ; XV_SdiRx_SetEdhErrCntTrigger ( InstancePtr , 0x420 ) ; XV_SdiRx_SetVidLckWindow ( InstancePtr , XV_SDIRX_VID_LCK_WINDOW ) ; XV_SdiRx_IntrDisable ( InstancePtr , XV_SDIRX_IER_ALLINTR_MASK ) ; XV_SdiRx_Start ( InstancePtr , XV_SDIRX_MULTISEARCHMODE ) ; XV_SdiRx_SetGlobalInterrupt ( InstancePtr ) ; XV_SdiRx_WriteReg ( InstancePtr -> Config . BaseAddress , ( XV_SDIRX_ISR_OFFSET ) , ( XV_SDIRX_ISR_VIDEO_LOCK_MASK | XV_SDIRX_ISR_VIDEO_UNLOCK_MASK | XV_SDIRX_ISR_OVERFLOW_MASK | XV_SDIRX_ISR_UNDERFLOW_MASK ) ) ; InstancePtr -> IsReady = ( u32 ) ( XIL_COMPONENT_IS_READY ) ; return XST_SUCCESS ; }
This function initializes the SDI RX core.
This function initializes the SDI RX core .
/* Verify arguments. */ /* Setup the instance */ /*
	 * Callbacks
	 * These are placeholders pointing to the StubCallback. The actual
	 * callback pointers will be assigned by the SetCallback function.
	 */ /* Clear SDI variables */ /* Stop SDI RX Core */ /* Configure SDI RX Core */ /* Enables FF EDH and AP EDH errors counter */ /* Initializes the video lock window */ /* Reset all peripherals */ /* Start SDI core */ /* Set global interrupt enable bit */ /* Clear the interrupt status */ /* Reset the hardware and set the flag to indicate the driver is ready */