/** * This function will setup and initialize the DisplayPort RX core. The core's * configuration parameters will be retrieved based on the configuration * to the DisplayPort RX core instance with the specified device ID. * * @param InstancePtr is a pointer to the XDp instance. * @param DeviceId is the unique device ID of the DisplayPort RX core * instance. * * @return * - XST_SUCCESS if the device configuration was found and obtained * and if the main link was successfully established. * - XST_FAILURE otherwise. * * @note None. * *******************************************************************************/ static u32 Dprx_SetupExample(XDp *InstancePtr, u16 DeviceId) { XDp_Config *ConfigPtr; u32 Status; /* Obtain the device configuration for the DisplayPort RX core. */ ConfigPtr = XDp_LookupConfig(DeviceId); if (!ConfigPtr) { return XST_FAILURE; } /* Copy the device configuration into the InstancePtr's Config * structure. */ XDp_CfgInitialize(InstancePtr, ConfigPtr, ConfigPtr->BaseAddr); XDp_RxSetLaneCount(InstancePtr, InstancePtr->Config.MaxLaneCount); XDp_RxSetLinkRate(InstancePtr, InstancePtr->Config.MaxLinkRate); /* Initialize the DisplayPort RX core. */ Status = XDp_Initialize(InstancePtr); if (Status != XST_SUCCESS) { return XST_FAILURE; } return XST_SUCCESS; }
/** * The main entry point for the selftest example using the XDp driver. This * function will check whether or not the DisplayPort TX's registers are at * their default reset values to ensure that the core is in a known and working * state. * * @param InstancePtr is a pointer to the XDp instance. * @param DeviceId is the unique device ID of the DisplayPort TX core * instance. * * @return * - XST_SUCCESS if the DisplayPort TX's registers are at their * default reset values. * - XST_FAILURE if the DisplayPort TX's registers do not match * their default values or no DisplayPort TX instance was found. * * @note None. * *******************************************************************************/ u32 Dp_SelfTestExample(XDp *InstancePtr, u16 DeviceId) { u32 Status; XDp_Config *ConfigPtr; /* Obtain the device configuration for the DisplayPort TX core. */ ConfigPtr = XDp_LookupConfig(DeviceId); if (!ConfigPtr) { return XST_FAILURE; } /* Copy the device configuration into the InstancePtr's Config * structure. */ XDp_CfgInitialize(InstancePtr, ConfigPtr, ConfigPtr->BaseAddr); /* Run the self test. */ Status = XDp_SelfTest(InstancePtr); return Status; }
/** * * This function initializes the DisplayPort Transmitter Subsystem core. This * function must be called prior to using the core. Initialization of the core * includes setting up the instance data and ensuring the hardware is in a * quiescent state. * * @param InstancePtr is a pointer to the XDpTxSs core instance. * @param CfgPtr points to the configuration structure associated with * the DisplayPort TX Subsystem 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_DEVICE_NOT_FOUND if sub-core not found. * - XST_FAILURE if sub-core initialization failed. * - XST_SUCCESS if XDpTxSs_CfgInitialize successful. * * @note None. * ******************************************************************************/ u32 XDpTxSs_CfgInitialize(XDpTxSs *InstancePtr, XDpTxSs_Config *CfgPtr, u32 EffectiveAddr) { #if (XPAR_XDUALSPLITTER_NUM_INSTANCES > 0) XDualSplitter_Config DualConfig; #endif XDp_Config DpConfig; XVtc_Config VtcConfig; u32 Status; u32 Index; /* Verify arguments. */ Xil_AssertNonvoid(InstancePtr != NULL); Xil_AssertNonvoid(CfgPtr != NULL); Xil_AssertNonvoid(EffectiveAddr != (u32)0x0); /* Setup the instance */ (void)memset((void *)InstancePtr, 0, sizeof(XDpTxSs)); (void)memcpy((void *)&(InstancePtr->Config), (const void *)CfgPtr, sizeof(XDpTxSs_Config)); InstancePtr->Config.BaseAddress = EffectiveAddr; /* Get included sub cores in the DisplayPort TX Subsystem */ DpTxSs_GetIncludedSubCores(InstancePtr); /* Check for DisplayPort availability */ if (InstancePtr->DpPtr) { xdbg_printf(XDBG_DEBUG_GENERAL,"SS INFO: Initializing " "DisplayPort Transmitter IP\n\r"); /* Assign number of streams to one when MST is not enabled */ if (InstancePtr->Config.MstSupport) { InstancePtr->UsrOpt.NumOfStreams = InstancePtr->Config.NumMstStreams; } else { InstancePtr->Config.DpSubCore.DpConfig.NumMstStreams = 1; InstancePtr->UsrOpt.NumOfStreams = 1; InstancePtr->Config.NumMstStreams = 1; } /* Calculate absolute base address of DP sub-core */ InstancePtr->Config.DpSubCore.DpConfig.BaseAddr += InstancePtr->Config.BaseAddress; (void)memcpy((void *)&(DpConfig), (const void *)&CfgPtr->DpSubCore.DpConfig, sizeof(XDp_Config)); /* DisplayPort config initialize */ DpConfig.BaseAddr += InstancePtr->Config.BaseAddress; XDp_CfgInitialize(InstancePtr->DpPtr, &DpConfig, DpConfig.BaseAddr); Status = XDp_Initialize(InstancePtr->DpPtr); if (Status != XST_SUCCESS) { xdbg_printf(XDBG_DEBUG_GENERAL,"SS ERR:: DP TX " "initialization failed!\n\r"); return XST_FAILURE; } /* Initialize user configurable parameters */ InstancePtr->UsrOpt.VmId = XVIDC_VM_USE_EDID_PREFERRED; InstancePtr->UsrOpt.Bpc = InstancePtr->Config.MaxBpc; InstancePtr->UsrOpt.MstSupport = InstancePtr->Config.MstSupport; } #if (XPAR_XDUALSPLITTER_NUM_INSTANCES > 0) /* Check for Dual Splitter availability */ if ((InstancePtr->DsPtr != NULL) && (InstancePtr->Config.MstSupport)) { xdbg_printf(XDBG_DEBUG_GENERAL,"SS INFO: Initializing Dual " "Splitter IP\n\r"); /* Calculate absolute base address of Dual Splitter sub-core */ InstancePtr->Config.DsSubCore.DsConfig.BaseAddress += InstancePtr->Config.BaseAddress; (void)memcpy((void *)&(DualConfig), (const void *)&CfgPtr->DsSubCore.DsConfig, sizeof(XDualSplitter_Config)); /* Dual Splitter config initialize */ DualConfig.BaseAddress += InstancePtr->Config.BaseAddress; Status = XDualSplitter_CfgInitialize(InstancePtr->DsPtr, &DualConfig, DualConfig.BaseAddress); if (Status != XST_SUCCESS) { xdbg_printf(XDBG_DEBUG_GENERAL,"SS ERR:: Dual " "Splitter initialization failed \n\r"); return XST_FAILURE; } } #endif /* Initialize VTC equal to number of streams */ for (Index = 0; Index < InstancePtr->Config.NumMstStreams; Index++) { if (InstancePtr->VtcPtr[Index]) { xdbg_printf(XDBG_DEBUG_GENERAL,"SS INFO: " "Initializing VTC%d IP \n\r", Index); /* Calculate absolute base address of VTC sub-core */ InstancePtr->Config.VtcSubCore[ Index].VtcConfig.BaseAddress += InstancePtr->Config.BaseAddress; (void)memcpy((void *)&(VtcConfig), (const void *)&CfgPtr->VtcSubCore[Index].VtcConfig, sizeof(XVtc_Config)); /* VTC config initialize */ VtcConfig.BaseAddress += InstancePtr->Config.BaseAddress; Status = XVtc_CfgInitialize(InstancePtr->VtcPtr[Index], &VtcConfig, VtcConfig.BaseAddress); if (Status != XST_SUCCESS) { xdbg_printf(XDBG_DEBUG_GENERAL,"SS ERR: " "VTC%d initialization failed!\n\r", Index); return XST_FAILURE; } } } /* Reset the hardware and set the flag to indicate the * subsystem is ready */ XDpTxSs_Reset(InstancePtr); InstancePtr->IsReady = (u32)XIL_COMPONENT_IS_READY; return XST_SUCCESS; }