dptx: Changed the self test function and example to check register reset values.
This function will now pass without a DisplayPort cable connected. Signed-off-by: Andrei-Liviu Simion <andrei.simion@xilinx.com>
This commit is contained in:
parent
653c4624dd
commit
e3f77d9867
9 changed files with 239 additions and 88 deletions
|
@ -30,7 +30,7 @@ There are 5 examples included in this directory:
|
|||
5) xdptx_selftest_example.c : This self test example will perform a sanity check
|
||||
on the state of the DisplayPort TX instance. It may be called prior to usage
|
||||
of the core or after a reset to ensure that (a subset of) the registers hold
|
||||
the default values.
|
||||
their default values.
|
||||
|
||||
Each of these examples are meant to be used in conjunction with
|
||||
xdptx_example_common.[ch] which holds common functionality for all examples.
|
||||
|
|
|
@ -89,7 +89,8 @@ static void Dptx_AudioSendInfoFrame(XDptx *InstancePtr);
|
|||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return - XST_SUCCESS if the audio example finished successfully.
|
||||
* @return
|
||||
* - XST_SUCCESS if the audio example finished successfully.
|
||||
* - XST_FAILURE otherwise.
|
||||
*
|
||||
* @note None.
|
||||
|
@ -118,7 +119,8 @@ int main(void)
|
|||
* @param DeviceId is the unique device ID of the DisplayPort TX core
|
||||
* instance.
|
||||
*
|
||||
* @return - XST_SUCCESS if the system was set up correctly and link
|
||||
* @return
|
||||
* - XST_SUCCESS if the system was set up correctly and link
|
||||
* training was successful.
|
||||
* - XST_FAILURE otherwise.
|
||||
*
|
||||
|
|
|
@ -77,7 +77,8 @@ static void Dptx_StartVideoStream(XDptx *InstancePtr);
|
|||
* @param LaneCount is the number of lanes to use over the main link.
|
||||
* @param LinkRate is the link rate to use over the main link.
|
||||
*
|
||||
* @return - XST_SUCCESS if main link was successfully established.
|
||||
* @return
|
||||
* - XST_SUCCESS if main link was successfully established.
|
||||
* - XST_FAILURE otherwise.
|
||||
*
|
||||
* @note None.
|
||||
|
@ -110,7 +111,8 @@ u32 Dptx_Run(XDptx *InstancePtr)
|
|||
* @param DeviceId is the unique device ID of the DisplayPort TX core
|
||||
* instance.
|
||||
*
|
||||
* @return - XST_SUCCESS if the device configuration was found and obtained
|
||||
* @return
|
||||
* - XST_SUCCESS if the device configuration was found and obtained
|
||||
* and if the main link was successfully established.
|
||||
* - XST_FAILURE otherwise.
|
||||
*
|
||||
|
@ -146,7 +148,8 @@ u32 Dptx_SetupExample(XDptx *InstancePtr, u16 DeviceId)
|
|||
*
|
||||
* @param InstancePtr is a pointer to the XDptx instance.
|
||||
*
|
||||
* @return - XST_SUCCESS the if main link was successfully established.
|
||||
* @return
|
||||
* - XST_SUCCESS the if main link was successfully established.
|
||||
* - XST_FAILURE otherwise.
|
||||
*
|
||||
* @note None.
|
||||
|
|
|
@ -122,7 +122,8 @@ INTC IntcInstance; /* The interrupt controller instance. */
|
|||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return - XST_FAILURE if the interrupt example was unsuccessful - system
|
||||
* @return
|
||||
* - XST_FAILURE if the interrupt example was unsuccessful - system
|
||||
* setup failed.
|
||||
*
|
||||
* @note Unless setup failed, main will never return since
|
||||
|
@ -158,7 +159,8 @@ int main(void)
|
|||
* @param HpdPulseHandler is a pointer to the handler called when an HPD
|
||||
* pulse occurs.
|
||||
*
|
||||
* @return - XST_FAILURE if the system setup failed.
|
||||
* @return
|
||||
* - XST_FAILURE if the system setup failed.
|
||||
* - XST_SUCCESS should never return since this function, if setup
|
||||
* was successful, is blocking.
|
||||
*
|
||||
|
@ -218,7 +220,8 @@ u32 Dptx_IntrExample(XDptx *InstancePtr, u16 DeviceId, INTC *IntcPtr,
|
|||
* @param HpdPulseHandler is a pointer to the handler called when an HPD
|
||||
* pulse occurs.
|
||||
*
|
||||
* @return - XST_SUCCESS if the interrupt system was successfully set up.
|
||||
* @return
|
||||
* - XST_SUCCESS if the interrupt system was successfully set up.
|
||||
* - XST_FAILURE otherwise.
|
||||
*
|
||||
* @note An interrupt controller must be present in the system, connected
|
||||
|
|
|
@ -75,7 +75,8 @@ static void Dptx_HpdPoll(XDptx *InstancePtr);
|
|||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return - XST_FAILURE if the polling example was unsuccessful - system
|
||||
* @return
|
||||
* - XST_FAILURE if the polling example was unsuccessful - system
|
||||
* setup failed.
|
||||
*
|
||||
* @note Unless setup failed, main will never return since
|
||||
|
@ -103,7 +104,8 @@ int main(void)
|
|||
* @param DeviceId is the unique device ID of the DisplayPort TX core
|
||||
* instance.
|
||||
*
|
||||
* @return - XST_FAILURE if the system setup failed.
|
||||
* @return
|
||||
* - XST_FAILURE if the system setup failed.
|
||||
* - XST_SUCCESS should never return since this function, if setup
|
||||
* was successful, is blocking.
|
||||
*
|
||||
|
|
|
@ -35,8 +35,10 @@
|
|||
* @file xdptx_selftest_example.c
|
||||
*
|
||||
* Contains a design example using the XDptx driver. It performs a self test on
|
||||
* the DisplayPort TX core by training the main link at the maximum common
|
||||
* capabilities between the TX and RX and checking the lane status.
|
||||
* the DisplayPort TX core that will compare many of the DisplayPort TX core's
|
||||
* registers against their default reset values.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
|
@ -54,7 +56,7 @@
|
|||
|
||||
/**************************** Function Prototypes *****************************/
|
||||
|
||||
u32 Dptx_SelfTestExample(u16 DeviceId);
|
||||
u32 Dptx_SelfTestExample(XDptx *InstancePtr, u16 DeviceId);
|
||||
|
||||
/**************************** Function Definitions ****************************/
|
||||
|
||||
|
@ -62,28 +64,30 @@ int main(void)
|
|||
{
|
||||
u32 Status;
|
||||
|
||||
Status = Dptx_SelfTestExample(DPTX_DEVICE_ID);
|
||||
Status = Dptx_SelfTestExample(&DptxInstance, DPTX_DEVICE_ID);
|
||||
if (Status != XST_SUCCESS) {
|
||||
xil_printf("XDptx_SelfTest failed.\n");
|
||||
xil_printf("XDptx_SelfTest failed, check register values.\n");
|
||||
return XST_FAILURE;
|
||||
}
|
||||
xil_printf("XDptx_SelfTest passed.\n");
|
||||
return Status;
|
||||
}
|
||||
|
||||
u32 Dptx_SelfTestExample(u16 DeviceId)
|
||||
u32 Dptx_SelfTestExample(XDptx *InstancePtr, u16 DeviceId)
|
||||
{
|
||||
u32 Status;
|
||||
XDptx_Config *ConfigPtr;
|
||||
|
||||
Status = Dptx_SetupExample(&DptxInstance, DeviceId);
|
||||
if (Status != XST_SUCCESS) {
|
||||
/* Obtain the device configuration for the DisplayPort TX core. */
|
||||
ConfigPtr = XDptx_LookupConfig(DeviceId);
|
||||
if (!ConfigPtr) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
XDptx_EnableTrainAdaptive(&DptxInstance, TRAIN_ADAPTIVE);
|
||||
XDptx_SetHasRedriverInPath(&DptxInstance, TRAIN_HAS_REDRIVER);
|
||||
/* Copy the device configuration into the InstancePtr's Config
|
||||
* structure. */
|
||||
XDptx_CfgInitialize(InstancePtr, ConfigPtr, ConfigPtr->BaseAddr);
|
||||
|
||||
/* Run the self test. */
|
||||
Status = XDptx_SelfTest(&DptxInstance);
|
||||
Status = XDptx_SelfTest(InstancePtr);
|
||||
return Status;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,8 @@ XTmrCtr TimerCounterInst; /* The timer counter instance. */
|
|||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return - XST_SUCCESS if the timer example finished successfully.
|
||||
* @return
|
||||
* - XST_SUCCESS if the timer example finished successfully.
|
||||
* - XST_FAILURE otherwise.
|
||||
*
|
||||
* @note None.
|
||||
|
@ -117,7 +118,8 @@ int main(void)
|
|||
* @param TimerCounterPtr is a pointer to the timer instance.
|
||||
* @param UserSleepFunc is a pointer to the custom handler for sleep.
|
||||
*
|
||||
* @return - XST_SUCCESS if the system was set up correctly and link
|
||||
* @return
|
||||
* - XST_SUCCESS if the system was set up correctly and link
|
||||
* training was successful.
|
||||
* - XST_FAILURE otherwise.
|
||||
*
|
||||
|
|
|
@ -139,7 +139,8 @@ static u32 XDptx_WaitPhyReady(XDptx *InstancePtr);
|
|||
*
|
||||
* @param InstancePtr is a pointer to the XDptx instance.
|
||||
*
|
||||
* @return - XST_SUCCESS if the DisplayPort TX core was successfully
|
||||
* @return
|
||||
* - XST_SUCCESS if the DisplayPort TX core was successfully
|
||||
* initialized.
|
||||
* - XST_FAILURE otherwise.
|
||||
*
|
||||
|
@ -254,7 +255,8 @@ void XDptx_CfgInitialize(XDptx *InstancePtr, XDptx_Config *ConfigPtr,
|
|||
*
|
||||
* @param InstancePtr is a pointer to the XDptx instance.
|
||||
*
|
||||
* @return - XST_SUCCESS if the DisplayPort Configuration Data was read
|
||||
* @return
|
||||
* - XST_SUCCESS if the DisplayPort Configuration Data was read
|
||||
* successfully.
|
||||
* - XST_DEVICE_NOT_FOUND if no RX device is connected.
|
||||
* - XST_FAILURE otherwise.
|
||||
|
@ -313,7 +315,8 @@ u32 XDptx_GetRxCapabilities(XDptx *InstancePtr)
|
|||
*
|
||||
* @param InstancePtr is a pointer to the XDptx instance.
|
||||
*
|
||||
* @return - XST_SUCCESS if the I2C transactions to read the EDID were
|
||||
* @return
|
||||
* - XST_SUCCESS if the I2C transactions to read the EDID were
|
||||
* successful.
|
||||
* - XST_ERROR_COUNT_MAX if the EDID read request timed out.
|
||||
* - XST_DEVICE_NOT_FOUND if no RX device is connected.
|
||||
|
@ -347,7 +350,8 @@ u32 XDptx_GetEdid(XDptx *InstancePtr)
|
|||
*
|
||||
* @param InstancePtr is a pointer to the XDptx instance.
|
||||
*
|
||||
* @return - XST_SUCCESS if main link settings were successfully set.
|
||||
* @return
|
||||
* - XST_SUCCESS if main link settings were successfully set.
|
||||
* - XST_DEVICE_NOT_FOUND if no RX device is connected.
|
||||
* - XST_FAILURE otherwise.
|
||||
*
|
||||
|
@ -393,7 +397,8 @@ u32 XDptx_CfgMainLinkMax(XDptx *InstancePtr)
|
|||
*
|
||||
* @param InstancePtr is a pointer to the XDptx instance.
|
||||
*
|
||||
* @return - XST_SUCCESS was either already trained, or has been
|
||||
* @return
|
||||
* - XST_SUCCESS was either already trained, or has been
|
||||
* trained successfully.
|
||||
* - XST_DEVICE_NOT_FOUND if no RX device is connected.
|
||||
* - XST_FAILURE otherwise.
|
||||
|
@ -449,7 +454,8 @@ u32 XDptx_EstablishLink(XDptx *InstancePtr)
|
|||
* @param InstancePtr is a pointer to the XDptx instance.
|
||||
* @param LaneCount is the number of lanes to check.
|
||||
*
|
||||
* @return - XST_SUCCESS if the RX device has maintained clock recovery,
|
||||
* @return
|
||||
* - XST_SUCCESS if the RX device has maintained clock recovery,
|
||||
* channel equalization, symbol lock, and interlane alignment.
|
||||
* - XST_DEVICE_NOT_FOUND if no RX device is connected.
|
||||
* - XST_FAILURE otherwise.
|
||||
|
@ -554,7 +560,8 @@ void XDptx_SetHasRedriverInPath(XDptx *InstancePtr, u8 Set)
|
|||
* @param Data is a pointer to the data buffer that will be filled with
|
||||
* read data.
|
||||
*
|
||||
* @return - XST_SUCCESS if the AUX read request was successfully
|
||||
* @return
|
||||
* - XST_SUCCESS if the AUX read request was successfully
|
||||
* acknowledged.
|
||||
* - XST_DEVICE_NOT_FOUND if no RX device is connected.
|
||||
* - XST_ERROR_COUNT_MAX if the AUX request timed out.
|
||||
|
@ -596,7 +603,8 @@ u32 XDptx_AuxRead(XDptx *InstancePtr, u32 Address, u32 NumBytes, void *Data)
|
|||
* @param Data is a pointer to the data buffer that contains the data
|
||||
* to be written to the RX device.
|
||||
*
|
||||
* @return - XST_SUCCESS if AUX write request was successfully
|
||||
* @return
|
||||
* - XST_SUCCESS if AUX write request was successfully
|
||||
* acknowledged.
|
||||
* - XST_DEVICE_NOT_FOUND if no RX device is connected.
|
||||
* - XST_ERROR_COUNT_MAX if the AUX request timed out.
|
||||
|
@ -640,7 +648,8 @@ u32 XDptx_AuxWrite(XDptx *InstancePtr, u32 Address, u32 NumBytes, void *Data)
|
|||
* @param Data is a pointer to a buffer that will be filled with the I2C
|
||||
* read data.
|
||||
*
|
||||
* @return - XST_SUCCESS if the I2C read has successfully completed with no
|
||||
* @return
|
||||
* - XST_SUCCESS if the I2C read has successfully completed with no
|
||||
* errors.
|
||||
* - XST_ERROR_COUNT_MAX if the AUX request timed out.
|
||||
* - XST_DEVICE_NOT_FOUND if no RX device is connected.
|
||||
|
@ -699,7 +708,8 @@ u32 XDptx_IicRead(XDptx *InstancePtr, u8 IicAddress, u8 RegStartAddress,
|
|||
* @param Data is a pointer to a buffer which will be used as the data
|
||||
* source for the write.
|
||||
*
|
||||
* @return - XST_SUCCESS if the I2C write has successfully completed with
|
||||
* @return
|
||||
* - XST_SUCCESS if the I2C write has successfully completed with
|
||||
* no errors.
|
||||
* - XST_DEVICE_NOT_FOUND if no RX device is connected.
|
||||
* - XST_ERROR_COUNT_MAX if the AUX request timed out.
|
||||
|
@ -755,7 +765,8 @@ u32 XDptx_IicWrite(XDptx *InstancePtr, u8 IicAddress, u8 RegStartAddress,
|
|||
* @param Enable will downspread the main link signal if set to 1 and
|
||||
* disable downspreading if set to 0.
|
||||
*
|
||||
* @return - XST_SUCCESS if setting the downspread control enable was
|
||||
* @return
|
||||
* - XST_SUCCESS if setting the downspread control enable was
|
||||
* successful.
|
||||
* - XST_DEVICE_NOT_FOUND if no RX device is connected.
|
||||
* - XST_FAILURE otherwise.
|
||||
|
@ -815,7 +826,8 @@ u32 XDptx_SetDownspread(XDptx *InstancePtr, u8 Enable)
|
|||
* @param Enable will enable enhanced frame mode if set to 1 and disable
|
||||
* it if set to 0.
|
||||
*
|
||||
* @return - XST_SUCCESS if setting the enhanced frame mode enable was
|
||||
* @return
|
||||
* - XST_SUCCESS if setting the enhanced frame mode enable was
|
||||
* successful.
|
||||
* - XST_DEVICE_NOT_FOUND if no RX is connected.
|
||||
* - XST_FAILURE otherwise.
|
||||
|
@ -874,7 +886,8 @@ u32 XDptx_SetEnhancedFrameMode(XDptx *InstancePtr, u8 Enable)
|
|||
* @param InstancePtr is a pointer to the XDptx instance.
|
||||
* @param LaneCount is the number of lanes to be used over the main link.
|
||||
*
|
||||
* @return - XST_SUCCESS if setting the new lane count was successful.
|
||||
* @return
|
||||
* - XST_SUCCESS if setting the new lane count was successful.
|
||||
* - XST_DEVICE_NOT_FOUND if no RX is connected.
|
||||
* - XST_FAILURE otherwise.
|
||||
*
|
||||
|
@ -934,7 +947,8 @@ u32 XDptx_SetLaneCount(XDptx *InstancePtr, u8 LaneCount)
|
|||
* - XDPTX_LINK_BW_SET_270GBPS = 0x0A (for a 2.70 Gbps data rate)
|
||||
* - XDPTX_LINK_BW_SET_540GBPS = 0x14 (for a 5.40 Gbps data rate)
|
||||
*
|
||||
* @return - XST_SUCCESS if setting the new link rate was successful.
|
||||
* @return
|
||||
* - XST_SUCCESS if setting the new link rate was successful.
|
||||
* - XST_DEVICE_NOT_FOUND if no RX device is connected.
|
||||
* - XST_FAILURE otherwise.
|
||||
*
|
||||
|
@ -1001,7 +1015,8 @@ u32 XDptx_SetLinkRate(XDptx *InstancePtr, u8 LinkRate)
|
|||
* @param InstancePtr is a pointer to the XDptx instance.
|
||||
* @param Enable will enable or disable scrambling.
|
||||
*
|
||||
* @return - XST_SUCCESS if setting the scrambling enable was successful.
|
||||
* @return
|
||||
* - XST_SUCCESS if setting the scrambling enable was successful.
|
||||
* - XST_FAILURE otherwise.
|
||||
*
|
||||
* @note None.
|
||||
|
@ -1206,7 +1221,7 @@ void XDptx_WaitUs(XDptx *InstancePtr, u32 MicroSeconds)
|
|||
*
|
||||
* @param InstancePtr is a pointer to the XDptx instance.
|
||||
*
|
||||
* @return The next training state:
|
||||
* @return
|
||||
* - XST_SUCCESS if the training process succeeded.
|
||||
* - XST_FAILURE otherwise.
|
||||
*
|
||||
|
@ -1307,7 +1322,8 @@ static u32 XDptx_RunTraining(XDptx *InstancePtr)
|
|||
*
|
||||
* @param InstancePtr is a pointer to the XDptx instance.
|
||||
*
|
||||
* @return - XDPTX_TS_CHANNEL_EQUALIZATION if the clock recovery sequence
|
||||
* @return The next training state:
|
||||
* - XDPTX_TS_CHANNEL_EQUALIZATION if the clock recovery sequence
|
||||
* completed successfully.
|
||||
* - XDPTX_TS_FAILURE if writing the drive settings to the RX
|
||||
* device was unsuccesful.
|
||||
|
@ -1417,7 +1433,8 @@ static XDptx_TrainingState XDptx_TrainingStateClockRecovery(XDptx *InstancePtr)
|
|||
* clock recovery sequence before down-shifting to a reduced data
|
||||
* rate or a reduced number of lanes.
|
||||
*
|
||||
* @return - XDPTX_TS_SUCCESS if training succeeded.
|
||||
* @return The next training state:
|
||||
* - XDPTX_TS_SUCCESS if training succeeded.
|
||||
* - XDPTX_TS_FAILURE if writing the drive settings to the RX
|
||||
* device was unsuccesful.
|
||||
* - XDPTX_TS_ADJUST_LINK_RATE if, after MaxIterations loop
|
||||
|
@ -1648,7 +1665,8 @@ static XDptx_TrainingState XDptx_TrainingStateAdjustLaneCount(
|
|||
*
|
||||
* @param InstancePtr is a pointer to the XDptx instance.
|
||||
*
|
||||
* @return - XST_SUCCESS if the AUX read was successful.
|
||||
* @return
|
||||
* - XST_SUCCESS if the AUX read was successful.
|
||||
* - XST_FAILURE otherwise.
|
||||
*
|
||||
* @note None.
|
||||
|
@ -1679,7 +1697,8 @@ static u32 XDptx_GetLaneStatusAdjReqs(XDptx *InstancePtr)
|
|||
* @param InstancePtr is a pointer to the XDptx instance.
|
||||
* @param LaneCount is the number of lanes to check.
|
||||
*
|
||||
* @return - XST_SUCCESS if the RX device's clock recovery PLL has
|
||||
* @return
|
||||
* - XST_SUCCESS if the RX device's clock recovery PLL has
|
||||
* achieved frequency lock for all lanes in use.
|
||||
* - XST_FAILURE otherwise.
|
||||
*
|
||||
|
@ -1734,7 +1753,8 @@ static u32 XDptx_CheckClockRecovery(XDptx *InstancePtr, u8 LaneCount)
|
|||
* @param InstancePtr is a pointer to the XDptx instance.
|
||||
* @param LaneCount is the number of lanes to check.
|
||||
*
|
||||
* @return - XST_SUCCESS if the RX device has achieved channel
|
||||
* @return
|
||||
* - XST_SUCCESS if the RX device has achieved channel
|
||||
* equalization symbol lock, and interlane alignment for all
|
||||
* lanes in use.
|
||||
* - XST_FAILURE otherwise.
|
||||
|
@ -1820,7 +1840,8 @@ static u32 XDptx_CheckChannelEqualization(XDptx *InstancePtr, u8 LaneCount)
|
|||
*
|
||||
* @param InstancePtr is a pointer to the XDptx instance.
|
||||
*
|
||||
* @return - XST_SUCCESS if writing the settings was successful.
|
||||
* @return
|
||||
* - XST_SUCCESS if writing the settings was successful.
|
||||
* - XST_FAILURE otherwise.
|
||||
*
|
||||
* @note None.
|
||||
|
@ -1907,7 +1928,8 @@ static u32 XDptx_SetVswingPreemp(XDptx *InstancePtr)
|
|||
*
|
||||
* @param InstancePtr is a pointer to the XDptx instance.
|
||||
*
|
||||
* @return - XST_SUCCESS if the new levels were written successfully.
|
||||
* @return
|
||||
* - XST_SUCCESS if the new levels were written successfully.
|
||||
* - XST_FAILURE otherwise (an AUX transaction failed).
|
||||
*
|
||||
* @note None.
|
||||
|
@ -1990,7 +2012,8 @@ static u32 XDptx_AdjVswingPreemp(XDptx *InstancePtr)
|
|||
* - XDPTX_TRAINING_PATTERN_SET_TP2
|
||||
* - XDPTX_TRAINING_PATTERN_SET_TP3
|
||||
*
|
||||
* @return - XST_SUCCESS if setting the pattern was successful.
|
||||
* @return
|
||||
* - XST_SUCCESS if setting the pattern was successful.
|
||||
* - XST_FAILURE otherwise.
|
||||
*
|
||||
* @note None.
|
||||
|
@ -2093,7 +2116,8 @@ static u32 XDptx_GetTrainingDelay(XDptx *InstancePtr,
|
|||
* @param Data is a pointer to the data buffer that contains the data
|
||||
* to be read/written from/to the RX device.
|
||||
*
|
||||
* @return - XST_SUCCESS if the AUX transaction request was acknowledged.
|
||||
* @return
|
||||
* - XST_SUCCESS if the AUX transaction request was acknowledged.
|
||||
* - XST_ERROR_COUNT_MAX if the AUX request timed out.
|
||||
* - XST_FAILURE otherwise (if the DisplayPort TX core sees a NACK
|
||||
* reply code or if the AUX transaction failed).
|
||||
|
@ -2167,7 +2191,8 @@ static u32 XDptx_AuxCommon(XDptx *InstancePtr, u32 CmdType, u32 Address,
|
|||
* AUX command, as well as a write buffer used for write commands,
|
||||
* and a read buffer for read commands.
|
||||
*
|
||||
* @return - XST_SUCCESS if the request was acknowledged.
|
||||
* @return
|
||||
* - XST_SUCCESS if the request was acknowledged.
|
||||
* - XST_ERROR_COUNT_MAX if resending the request exceeded the
|
||||
* maximum for deferral and timeout.
|
||||
* - XST_FAILURE otherwise (if the DisplayPort TX core sees a NACK
|
||||
|
@ -2225,7 +2250,8 @@ static u32 XDptx_AuxRequest(XDptx *InstancePtr, XDptx_AuxTransaction *Request)
|
|||
* structure containing the required information for issuing an AUX
|
||||
* command.
|
||||
*
|
||||
* @return - XST_SUCCESS if the request was acknowledged.
|
||||
* @return
|
||||
* - XST_SUCCESS if the request was acknowledged.
|
||||
* - XST_ERROR_COUNT_MAX if waiting for a reply timed out.
|
||||
* - XST_SEND_ERROR if the request was deferred.
|
||||
* - XST_FAILURE otherwise, if the request was NACK'ed.
|
||||
|
@ -2304,7 +2330,8 @@ static u32 XDptx_AuxRequestSend(XDptx *InstancePtr,
|
|||
*
|
||||
* @param InstancePtr is a pointer to the XDptx instance.
|
||||
*
|
||||
* @return - XST_SUCCESS if a reply was sent from the RX device.
|
||||
* @return
|
||||
* - XST_SUCCESS if a reply was sent from the RX device.
|
||||
* - XST_ERROR_COUNT_MAX otherwise, if a timeout has occurred.
|
||||
*
|
||||
* @note None.
|
||||
|
@ -2342,7 +2369,8 @@ static u32 XDptx_AuxWaitReply(XDptx *InstancePtr)
|
|||
*
|
||||
* @param InstancePtr is a pointer to the XDptx instance.
|
||||
*
|
||||
* @return - XST_SUCCESS if the the RX device is no longer busy.
|
||||
* @return
|
||||
* - XST_SUCCESS if the the RX device is no longer busy.
|
||||
* - XST_ERROR_COUNT_MAX otherwise, if a timeout has occurred.
|
||||
*
|
||||
* @note None.
|
||||
|
@ -2381,7 +2409,8 @@ static u32 XDptx_AuxWaitReady(XDptx *InstancePtr)
|
|||
* - XDPTX_PHY_CLOCK_SELECT_270GBPS = 0x03
|
||||
* - XDPTX_PHY_CLOCK_SELECT_540GBPS = 0x05
|
||||
*
|
||||
* @return - XST_SUCCESS if the reset for each lane is done after the clock
|
||||
* @return
|
||||
* - XST_SUCCESS if the reset for each lane is done after the clock
|
||||
* frequency has been set.
|
||||
* - XST_FAILURE otherwise.
|
||||
*
|
||||
|
@ -2421,7 +2450,8 @@ static u32 XDptx_SetClkSpeed(XDptx *InstancePtr, u32 Speed)
|
|||
*
|
||||
* @param InstancePtr is a pointer to the XDptx instance.
|
||||
*
|
||||
* @return - XST_ERROR_COUNT_MAX if the PHY failed to be ready.
|
||||
* @return
|
||||
* - XST_ERROR_COUNT_MAX if the PHY failed to be ready.
|
||||
* - XST_SUCCESS otherwise.
|
||||
*
|
||||
* @note None.
|
||||
|
|
|
@ -34,7 +34,9 @@
|
|||
*
|
||||
* @file xdptx_selftest.c
|
||||
*
|
||||
* This file contains a diagnostic self-test function for the XDptx driver.
|
||||
* This file contains a diagnostic self-test function for the XDptx driver. It
|
||||
* will check many of the DisplayPort TX's register values against the default
|
||||
* reset values as a sanity-check that the core is ready to be used.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
|
@ -53,19 +55,109 @@
|
|||
#include "xdptx.h"
|
||||
#include "xstatus.h"
|
||||
|
||||
/**************************** Variable Definitions ****************************/
|
||||
|
||||
/**
|
||||
* This table contains the default values for the DisplayPort TX core's general
|
||||
* usage registers.
|
||||
*/
|
||||
u32 ResetValues[53][2] =
|
||||
{
|
||||
{XDPTX_LINK_BW_SET, 0},
|
||||
{XDPTX_LANE_COUNT_SET, 0},
|
||||
{XDPTX_ENHANCED_FRAME_EN, 0},
|
||||
{XDPTX_TRAINING_PATTERN_SET, 0},
|
||||
{XDPTX_LINK_QUAL_PATTERN_SET, 0},
|
||||
{XDPTX_SCRAMBLING_DISABLE, 0},
|
||||
{XDPTX_DOWNSPREAD_CTRL, 0},
|
||||
{XDPTX_SOFT_RESET, 0},
|
||||
{XDPTX_ENABLE, 0},
|
||||
{XDPTX_ENABLE_MAIN_STREAM, 0},
|
||||
{XDPTX_ENABLE_SEC_STREAM, 0},
|
||||
{XDPTX_FORCE_SCRAMBLER_RESET, 0},
|
||||
{XDPTX_TX_MST_CONFIG, 0},
|
||||
{XDPTX_AUX_CMD, 0},
|
||||
{XDPTX_AUX_WRITE_FIFO, 0},
|
||||
{XDPTX_AUX_ADDRESS, 0},
|
||||
{XDPTX_AUX_CLK_DIVIDER, 0},
|
||||
{XDPTX_TX_USER_FIFO_OVERFLOW, 0},
|
||||
{XDPTX_AUX_REPLY_DATA, 0},
|
||||
{XDPTX_AUX_REPLY_CODE, 0},
|
||||
{XDPTX_AUX_REPLY_COUNT, 0},
|
||||
{XDPTX_INTERRUPT_MASK, 0x3F},
|
||||
{XDPTX_REPLY_DATA_COUNT, 0},
|
||||
{XDPTX_REPLY_STATUS, 0x10},
|
||||
{XDPTX_STREAM0, 0},
|
||||
{XDPTX_STREAM1, 0},
|
||||
{XDPTX_STREAM2, 0},
|
||||
{XDPTX_STREAM3, 0},
|
||||
{XDPTX_PHY_CONFIG, 0x03},
|
||||
{XDPTX_PHY_VOLTAGE_DIFF_LANE_0, 0},
|
||||
{XDPTX_PHY_VOLTAGE_DIFF_LANE_1, 0},
|
||||
{XDPTX_PHY_VOLTAGE_DIFF_LANE_2, 0},
|
||||
{XDPTX_PHY_VOLTAGE_DIFF_LANE_3, 0},
|
||||
{XDPTX_PHY_TRANSMIT_PRBS7, 0},
|
||||
{XDPTX_PHY_CLOCK_SELECT, 0},
|
||||
{XDPTX_TX_PHY_POWER_DOWN, 0},
|
||||
{XDPTX_PHY_PRECURSOR_LANE_0, 0},
|
||||
{XDPTX_PHY_PRECURSOR_LANE_1, 0},
|
||||
{XDPTX_PHY_PRECURSOR_LANE_2, 0},
|
||||
{XDPTX_PHY_PRECURSOR_LANE_3, 0},
|
||||
{XDPTX_PHY_POSTCURSOR_LANE_0, 0},
|
||||
{XDPTX_PHY_POSTCURSOR_LANE_1, 0},
|
||||
{XDPTX_PHY_POSTCURSOR_LANE_2, 0},
|
||||
{XDPTX_PHY_POSTCURSOR_LANE_3, 0},
|
||||
{XDPTX_GT_DRP_COMMAND, 0},
|
||||
{XDPTX_GT_DRP_READ_DATA, 0},
|
||||
{XDPTX_GT_DRP_CHANNEL_STATUS, 0},
|
||||
{XDPTX_TX_AUDIO_CONTROL, 0},
|
||||
{XDPTX_TX_AUDIO_CHANNELS, 0},
|
||||
{XDPTX_TX_AUDIO_INFO_DATA, 0},
|
||||
{XDPTX_TX_AUDIO_MAUD, 0},
|
||||
{XDPTX_TX_AUDIO_NAUD, 0},
|
||||
{XDPTX_TX_AUDIO_EXT_DATA, 0}
|
||||
};
|
||||
|
||||
/**
|
||||
* This table contains the default values for the DisplayPort TX core's main
|
||||
* stream attribute (MSA) registers.
|
||||
*/
|
||||
u32 ResetValuesMsa[20][2] =
|
||||
{
|
||||
{XDPTX_MAIN_STREAM_HTOTAL, 0},
|
||||
{XDPTX_MAIN_STREAM_VTOTAL, 0},
|
||||
{XDPTX_MAIN_STREAM_POLARITY, 0},
|
||||
{XDPTX_MAIN_STREAM_HSWIDTH, 0},
|
||||
{XDPTX_MAIN_STREAM_VSWIDTH, 0},
|
||||
{XDPTX_MAIN_STREAM_HRES, 0},
|
||||
{XDPTX_MAIN_STREAM_VRES, 0},
|
||||
{XDPTX_MAIN_STREAM_HSTART, 0},
|
||||
{XDPTX_MAIN_STREAM_VSTART, 0},
|
||||
{XDPTX_MAIN_STREAM_MISC0, 0},
|
||||
{XDPTX_MAIN_STREAM_MISC1, 0},
|
||||
{XDPTX_M_VID, 0},
|
||||
{XDPTX_TU_SIZE, 0},
|
||||
{XDPTX_N_VID, 0},
|
||||
{XDPTX_USER_PIXEL_WIDTH, 0},
|
||||
{XDPTX_USER_DATA_COUNT_PER_LANE, 0},
|
||||
{XDPTX_MAIN_STREAM_INTERLACED, 0},
|
||||
{XDPTX_MIN_BYTES_PER_TU, 0},
|
||||
{XDPTX_FRAC_BYTES_PER_TU, 0},
|
||||
{XDPTX_INIT_WAIT, 32}
|
||||
};
|
||||
|
||||
/**************************** Function Definitions ****************************/
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* This function runs a self-test on the XDptx driver/device. The test attempts
|
||||
* to intialize the DisplayPort TX core, train the main link at the highest
|
||||
* common capabilities between the core and the RX device, and checks the status
|
||||
* of the link after training.
|
||||
* This function runs a self-test on the XDptx driver/device. The sanity test
|
||||
* checks whether or not all tested registers hold their default reset values.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XDptx instance.
|
||||
*
|
||||
* @return - XST_SUCCESS if the self-test passed. The main link has been
|
||||
* trained and established successfully.
|
||||
* @return
|
||||
* - XST_SUCCESS if the self-test passed - all tested registers
|
||||
* hold their default reset values.
|
||||
* - XST_FAILURE otherwise.
|
||||
*
|
||||
* @note None.
|
||||
|
@ -73,35 +165,48 @@
|
|||
*******************************************************************************/
|
||||
u32 XDptx_SelfTest(XDptx *InstancePtr)
|
||||
{
|
||||
XDptx_Config *ConfigPtr;
|
||||
u32 Status;
|
||||
u8 Index;
|
||||
u8 StreamIndex;
|
||||
u32 StreamOffset;
|
||||
u32 Val;
|
||||
|
||||
/* Verify arguments. */
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
/* Obtain the capabilities of the RX device by reading the DisplayPort
|
||||
* Configuration Data (DPCD). */
|
||||
Status = XDptx_GetRxCapabilities(InstancePtr);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
/* Compare general usage registers with their default values. */
|
||||
for (Index = 0; Index < 53; Index++) {
|
||||
Val = XDptx_ReadReg(InstancePtr->Config.BaseAddr,
|
||||
ResetValues[Index][0]);
|
||||
/* Fail if register does not hold default value. */
|
||||
if (Val != ResetValues[Index][1]) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Configure the main link attributes. */
|
||||
Status = XDptx_CfgMainLinkMax(InstancePtr);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
/* Compare main stream attribute (MSA) registers for all 4 streams with
|
||||
* their default values. */
|
||||
for (StreamIndex = 0; StreamIndex < 4; StreamIndex++) {
|
||||
/* Determine the MSA register offset for each stream. */
|
||||
if (StreamIndex == 0) {
|
||||
StreamOffset = 0;
|
||||
}
|
||||
else if (StreamIndex == 1) {
|
||||
StreamOffset = XDPTX_STREAM2_MSA_START_OFFSET;
|
||||
}
|
||||
else if (StreamIndex == 2) {
|
||||
StreamOffset = XDPTX_STREAM3_MSA_START_OFFSET;
|
||||
}
|
||||
else if (StreamIndex == 3) {
|
||||
StreamOffset = XDPTX_STREAM4_MSA_START_OFFSET;
|
||||
}
|
||||
|
||||
for (Index = 0; Index < 20; Index++) {
|
||||
Val = XDptx_ReadReg(InstancePtr->Config.BaseAddr,
|
||||
StreamOffset + ResetValuesMsa[Index][0]);
|
||||
/* Fail if register does not hold default value. */
|
||||
if (Val != ResetValuesMsa[Index][1]) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Attempt to establish a link at the maximum common capabilities
|
||||
* between the DisplayPort TX core and the RX device. */
|
||||
XDptx_EstablishLink(InstancePtr);
|
||||
|
||||
/* Return whether or not the link has been successfully trained. */
|
||||
Status = XDptx_CheckLinkStatus(InstancePtr,
|
||||
InstancePtr->LinkConfig.LaneCount);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
/* All tested registers hold their default reset values. */
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue