Software Drivers

xdp.c File Reference


Detailed Description

Contains a minimal set of functions for the XDp driver that allow access to all of the DisplayPort core's functionality. See xdp.h for a detailed description of the driver.

Note:
None.
 MODIFICATION HISTORY:

 Ver   Who  Date     Changes
 ----- ---- -------- -----------------------------------------------
 1.0   als  01/20/15 Initial release.
 

#include "xdp.h"
#include "xenv.h"

Classes

struct  XDp_AuxTransaction

Defines

#define XDP_TX_MAXIMUM_VS_LEVEL   3
#define XDP_TX_MAXIMUM_PE_LEVEL   3
#define XDP_AUX_MAX_DEFER_COUNT   50
#define XDP_AUX_MAX_TIMEOUT_COUNT   50
#define XDP_IS_CONNECTED_MAX_TIMEOUT_COUNT   50

Enumerations

enum  XDp_TxTrainingState {
  XDP_TX_TS_CLOCK_RECOVERY, XDP_TX_TS_CHANNEL_EQUALIZATION, XDP_TX_TS_ADJUST_LINK_RATE, XDP_TX_TS_ADJUST_LANE_COUNT,
  XDP_TX_TS_FAILURE, XDP_TX_TS_SUCCESS
}

Functions

void XDp_CfgInitialize (XDp *InstancePtr, XDp_Config *ConfigPtr, u32 EffectiveAddr)
u32 XDp_Initialize (XDp *InstancePtr)
u32 XDp_TxGetRxCapabilities (XDp *InstancePtr)
u32 XDp_TxCfgMainLinkMax (XDp *InstancePtr)
u32 XDp_TxEstablishLink (XDp *InstancePtr)
u32 XDp_TxCheckLinkStatus (XDp *InstancePtr, u8 LaneCount)
void XDp_TxEnableTrainAdaptive (XDp *InstancePtr, u8 Enable)
void XDp_TxSetHasRedriverInPath (XDp *InstancePtr, u8 Set)
void XDp_TxCfgTxVsOffset (XDp *InstancePtr, u8 Offset)
void XDp_TxCfgTxVsLevel (XDp *InstancePtr, u8 Level, u8 TxLevel)
void XDp_TxCfgTxPeLevel (XDp *InstancePtr, u8 Level, u8 TxLevel)
u32 XDp_TxIsConnected (XDp *InstancePtr)
u32 XDp_TxAuxRead (XDp *InstancePtr, u32 DpcdAddress, u32 BytesToRead, void *ReadData)
u32 XDp_TxAuxWrite (XDp *InstancePtr, u32 DpcdAddress, u32 BytesToWrite, void *WriteData)
u32 XDp_TxIicRead (XDp *InstancePtr, u8 IicAddress, u16 Offset, u16 BytesToRead, void *ReadData)
u32 XDp_TxIicWrite (XDp *InstancePtr, u8 IicAddress, u8 BytesToWrite, void *WriteData)
u32 XDp_TxSetDownspread (XDp *InstancePtr, u8 Enable)
u32 XDp_TxSetEnhancedFrameMode (XDp *InstancePtr, u8 Enable)
u32 XDp_TxSetLaneCount (XDp *InstancePtr, u8 LaneCount)
u32 XDp_TxSetLinkRate (XDp *InstancePtr, u8 LinkRate)
u32 XDp_TxSetScrambler (XDp *InstancePtr, u8 Enable)
void XDp_TxEnableMainLink (XDp *InstancePtr)
void XDp_TxDisableMainLink (XDp *InstancePtr)
void XDp_TxResetPhy (XDp *InstancePtr, u32 Reset)
u32 XDp_RxCheckLinkStatus (XDp *InstancePtr)
void XDp_RxDtgEn (XDp *InstancePtr)
void XDp_RxDtgDis (XDp *InstancePtr)
void XDp_RxSetLinkRate (XDp *InstancePtr, u8 LinkRate)
void XDp_RxSetLaneCount (XDp *InstancePtr, u8 LaneCount)
void XDp_SetUserTimerHandler (XDp *InstancePtr, XDp_TimerHandler CallbackFunc, void *CallbackRef)
void XDp_WaitUs (XDp *InstancePtr, u32 MicroSeconds)


Define Documentation

#define XDP_AUX_MAX_DEFER_COUNT   50

#define XDP_AUX_MAX_TIMEOUT_COUNT   50

#define XDP_IS_CONNECTED_MAX_TIMEOUT_COUNT   50

#define XDP_TX_MAXIMUM_PE_LEVEL   3

#define XDP_TX_MAXIMUM_VS_LEVEL   3


Enumeration Type Documentation

enum XDp_TxTrainingState

This typedef enumerates the list of training states used in the state machine during the link training process.

Enumerator:
XDP_TX_TS_CLOCK_RECOVERY 
XDP_TX_TS_CHANNEL_EQUALIZATION 
XDP_TX_TS_ADJUST_LINK_RATE 
XDP_TX_TS_ADJUST_LANE_COUNT 
XDP_TX_TS_FAILURE 
XDP_TX_TS_SUCCESS 


Function Documentation

void XDp_CfgInitialize ( XDp InstancePtr,
XDp_Config ConfigPtr,
u32  EffectiveAddr 
)

This function retrieves the configuration for this DisplayPort instance and fills in the InstancePtr->Config structure.

Parameters:
InstancePtr is a pointer to the XDp instance.
ConfigPtr is a pointer to the configuration structure that will be used to copy the settings from.
EffectiveAddr is the device base address in the virtual memory space. If the address translation is not used, then the physical address is passed.
Returns:
None.
Note:
Unexpected errors may occur if the address mapping is changed after this function is invoked.

u32 XDp_Initialize ( XDp InstancePtr  ) 

This function prepares the DisplayPort core for use depending on whether the core is operating in TX or RX mode.

Parameters:
InstancePtr is a pointer to the XDp instance.
Returns:
  • XST_SUCCESS if the DisplayPort core was successfully initialized.
  • XST_FAILURE otherwise.
Note:
None.

u32 XDp_RxCheckLinkStatus ( XDp InstancePtr  ) 

This function checks if the reciever's internal registers indicate that link training has complete. That is, training has achieved channel equalization, symbol lock, and interlane alignment for all lanes currently in use.

Parameters:
InstancePtr is a pointer to the XDp instance.
Returns:
  • XST_SUCCESS if the RX device has achieved clock recovery, channel equalization, symbol lock, and interlane alignment.
  • XST_FAILURE otherwise.
Note:
None.

void XDp_RxDtgDis ( XDp InstancePtr  ) 

This function disables the display timing generator (DTG).

Parameters:
InstancePtr is a pointer to the XDp instance.
Returns:
None.
Note:
None.

void XDp_RxDtgEn ( XDp InstancePtr  ) 

This function enables the display timing generator (DTG).

Parameters:
InstancePtr is a pointer to the XDp instance.
Returns:
None.
Note:
None.

void XDp_RxSetLaneCount ( XDp InstancePtr,
u8  LaneCount 
)

This function sets the maximum lane count to be exposed in the RX device's DisplayPort Configuration Data (DPCD) registers.

Parameters:
InstancePtr is a pointer to the XDp instance.
LaneCount is the number of lanes to be used over the main link.
Returns:
None.
Note:
None.

void XDp_RxSetLinkRate ( XDp InstancePtr,
u8  LinkRate 
)

This function sets the maximum data rate to be exposed in the RX device's DisplayPort Configuration Data (DPCD) registers.

Parameters:
InstancePtr is a pointer to the XDp instance.
LinkRate is the link rate to be used over the main link based on one of the following selects:
  • XDP_RX_LINK_BW_SET_162GBPS = 0x06 (for a 1.62 Gbps data rate)
  • XDP_RX_LINK_BW_SET_270GBPS = 0x0A (for a 2.70 Gbps data rate)
  • XDP_RX_LINK_BW_SET_540GBPS = 0x14 (for a 5.40 Gbps data rate)
Returns:
None.
Note:
None.

void XDp_SetUserTimerHandler ( XDp InstancePtr,
XDp_TimerHandler  CallbackFunc,
void *  CallbackRef 
)

This function installs a custom delay/sleep function to be used by the XDp driver.

Parameters:
InstancePtr is a pointer to the XDp instance.
CallbackFunc is the address to the callback function.
CallbackRef is the user data item (microseconds to delay) that will be passed to the custom sleep/delay function when it is invoked.
Returns:
None.
Note:
None.

u32 XDp_TxAuxRead ( XDp InstancePtr,
u32  DpcdAddress,
u32  BytesToRead,
void *  ReadData 
)

This function issues a read request over the AUX channel that will read from the RX device's DisplayPort Configuration Data (DPCD) address space. The read message will be divided into multiple transactions which read a maximum of 16 bytes each.

Parameters:
InstancePtr is a pointer to the XDp instance.
DpcdAddress is the starting address to read from the RX device.
BytesToRead is the number of bytes to read from the RX device.
ReadData is a pointer to the data buffer that will be filled with read data.
Returns:
  • 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.
  • XST_FAILURE otherwise.
Note:
None.

u32 XDp_TxAuxWrite ( XDp InstancePtr,
u32  DpcdAddress,
u32  BytesToWrite,
void *  WriteData 
)

This function issues a write request over the AUX channel that will write to the RX device's DisplayPort Configuration Data (DPCD) address space. The write message will be divided into multiple transactions which write a maximum of 16 bytes each.

Parameters:
InstancePtr is a pointer to the XDp instance.
DpcdAddress is the starting address to write to the RX device.
BytesToWrite is the number of bytes to write to the RX device.
WriteData is a pointer to the data buffer that contains the data to be written to the RX device.
Returns:
  • XST_SUCCESS if the 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.
  • XST_FAILURE otherwise.
Note:
None.

u32 XDp_TxCfgMainLinkMax ( XDp InstancePtr  ) 

This function determines the common capabilities between the DisplayPort TX core and the RX device.

Parameters:
InstancePtr is a pointer to the XDp instance.
Returns:
  • XST_SUCCESS if main link settings were successfully set.
  • XST_DEVICE_NOT_FOUND if no RX device is connected.
  • XST_FAILURE otherwise.
Note:
None.

void XDp_TxCfgTxPeLevel ( XDp InstancePtr,
u8  Level,
u8  TxLevel 
)

This function sets the pre-emphasis level value in the DisplayPort TX that will be used during link training for a given pre-emphasis training level.

Parameters:
InstancePtr is a pointer to the XDp instance.
Level is the pre-emphasis training level to set the DisplayPort TX level for.
TxLevel is the DisplayPort TX pre-emphasis level value to be used during link training.
Returns:
None.
Note:
There are 32 possible pre-emphasis levels in the DisplayPort TX core that map to 4 possible pre-emphasis training levels in the RX device.

void XDp_TxCfgTxVsLevel ( XDp InstancePtr,
u8  Level,
u8  TxLevel 
)

This function sets the voltage swing level value in the DisplayPort TX that will be used during link training for a given voltage swing training level.

Parameters:
InstancePtr is a pointer to the XDp instance.
Level is the voltage swing training level to set the DisplayPort TX level for.
TxLevel is the DisplayPort TX voltage swing level value to be used during link training.
Returns:
None.
Note:
There are 16 possible voltage swing levels in the DisplayPort TX core that map to 4 possible voltage swing training levels in the RX device.

void XDp_TxCfgTxVsOffset ( XDp InstancePtr,
u8  Offset 
)

This function sets the voltage swing offset to use during training when no redriver exists. The offset will be added to the DisplayPort TX's voltage swing level value when pre-emphasis is used (when the pre-emphasis level not equal to 0).

Parameters:
InstancePtr is a pointer to the XDp instance.
Offset is the value to set for the voltage swing offset.
Returns:
None.
Note:
None.

u32 XDp_TxCheckLinkStatus ( XDp InstancePtr,
u8  LaneCount 
)

This function checks if the reciever's DisplayPort Configuration Data (DPCD) indicates the reciever has achieved and maintained clock recovery, channel equalization, symbol lock, and interlane alignment for all lanes currently in use.

Parameters:
InstancePtr is a pointer to the XDp instance.
LaneCount is the number of lanes to check.
Returns:
  • 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.
Note:
None.

void XDp_TxDisableMainLink ( XDp InstancePtr  ) 

This function disables the main link.

Parameters:
InstancePtr is a pointer to the XDp instance.
Returns:
None.
Note:
None.

void XDp_TxEnableMainLink ( XDp InstancePtr  ) 

This function enables the main link.

Parameters:
InstancePtr is a pointer to the XDp instance.
Returns:
None.
Note:
None.

void XDp_TxEnableTrainAdaptive ( XDp InstancePtr,
u8  Enable 
)

This function enables or disables downshifting during the training process.

Parameters:
InstancePtr is a pointer to the XDp instance.
Enable controls the downshift feature in the training process.
Returns:
None.
Note:
None.

u32 XDp_TxEstablishLink ( XDp InstancePtr  ) 

This function checks if the link needs training and runs the training sequence if training is required.

Parameters:
InstancePtr is a pointer to the XDp instance.
Returns:
  • XST_SUCCESS was either already trained, or has been trained successfully.
  • XST_DEVICE_NOT_FOUND if no RX device is connected.
  • XST_FAILURE otherwise.
Note:
None.

u32 XDp_TxGetRxCapabilities ( XDp InstancePtr  ) 

This function retrieves the RX device's capabilities from the RX device's DisplayPort Configuration Data (DPCD).

Parameters:
InstancePtr is a pointer to the XDp instance.
Returns:
  • XST_SUCCESS if the DisplayPort Configuration Data was read successfully.
  • XST_DEVICE_NOT_FOUND if no RX device is connected.
  • XST_FAILURE otherwise.
Note:
None.

u32 XDp_TxIicRead ( XDp InstancePtr,
u8  IicAddress,
u16  Offset,
u16  BytesToRead,
void *  ReadData 
)

This function performs an I2C read over the AUX channel. The read message will be divided into multiple transactions if the requested data spans multiple segments. The segment pointer is automatically incremented and the offset is calibrated as needed. E.g. For an overall offset of:

Parameters:
InstancePtr is a pointer to the XDp instance.
IicAddress is the address on the I2C bus of the target device.
Offset is the offset at the specified address of the targeted I2C device that the read will start from.
BytesToRead is the number of bytes to read.
ReadData is a pointer to a buffer that will be filled with the I2C read data.
Returns:
  • 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.
  • XST_FAILURE otherwise.
Note:
None.

u32 XDp_TxIicWrite ( XDp InstancePtr,
u8  IicAddress,
u8  BytesToWrite,
void *  WriteData 
)

This function performs an I2C write over the AUX channel.

Parameters:
InstancePtr is a pointer to the XDp instance.
IicAddress is the address on the I2C bus of the target device.
BytesToWrite is the number of bytes to write.
WriteData is a pointer to a buffer which will be used as the data source for the write.
Returns:
  • 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.
  • XST_FAILURE otherwise.
Note:
None.

u32 XDp_TxIsConnected ( XDp InstancePtr  ) 

This function checks if there is a connected RX device.

Parameters:
InstancePtr is a pointer to the XDp instance.
Returns:
  • TRUE if there is a connection.
  • FALSE if there is no connection.

void XDp_TxResetPhy ( XDp InstancePtr,
u32  Reset 
)

This function does a PHY reset.

Parameters:
InstancePtr is a pointer to the XDp instance.
Reset is the type of reset to assert.
Returns:
None.
Note:
None.

u32 XDp_TxSetDownspread ( XDp InstancePtr,
u8  Enable 
)

This function enables or disables 0.5% spreading of the clock for both the DisplayPort and the RX device.

Parameters:
InstancePtr is a pointer to the XDp instance.
Enable will downspread the main link signal if set to 1 and disable downspreading if set to 0.
Returns:
  • XST_SUCCESS if setting the downspread control enable was successful.
  • XST_DEVICE_NOT_FOUND if no RX device is connected.
  • XST_FAILURE otherwise.
Note:
None.

u32 XDp_TxSetEnhancedFrameMode ( XDp InstancePtr,
u8  Enable 
)

This function enables or disables the enhanced framing symbol sequence for both the DisplayPort TX core and the RX device.

Parameters:
InstancePtr is a pointer to the XDp instance.
Enable will enable enhanced frame mode if set to 1 and disable it if set to 0.
Returns:
  • XST_SUCCESS if setting the enhanced frame mode enable was successful.
  • XST_DEVICE_NOT_FOUND if no RX is connected.
  • XST_FAILURE otherwise.
Note:
None.

void XDp_TxSetHasRedriverInPath ( XDp InstancePtr,
u8  Set 
)

This function sets a software switch that signifies whether or not a redriver exists on the DisplayPort output path. XDp_TxSetVswingPreemp uses this switch to determine which set of voltage swing and pre-emphasis values to use in the TX core.

Parameters:
InstancePtr is a pointer to the XDp instance.
Set establishes that a redriver exists in the DisplayPort output path.
Returns:
None.
Note:
None.

u32 XDp_TxSetLaneCount ( XDp InstancePtr,
u8  LaneCount 
)

This function sets the number of lanes to be used by the main link for both the DisplayPort TX core and the RX device.

Parameters:
InstancePtr is a pointer to the XDp instance.
LaneCount is the number of lanes to be used over the main link.
Returns:
  • XST_SUCCESS if setting the new lane count was successful.
  • XST_DEVICE_NOT_FOUND if no RX is connected.
  • XST_FAILURE otherwise.
Note:
None.

u32 XDp_TxSetLinkRate ( XDp InstancePtr,
u8  LinkRate 
)

This function sets the data rate to be used by the main link for both the DisplayPort TX core and the RX device.

Parameters:
InstancePtr is a pointer to the XDp instance.
LinkRate is the link rate to be used over the main link based on one of the following selects:
  • XDP_TX_LINK_BW_SET_162GBPS = 0x06 (for a 1.62 Gbps data rate)
  • XDP_TX_LINK_BW_SET_270GBPS = 0x0A (for a 2.70 Gbps data rate)
  • XDP_TX_LINK_BW_SET_540GBPS = 0x14 (for a 5.40 Gbps data rate)
Returns:
  • XST_SUCCESS if setting the new link rate was successful.
  • XST_DEVICE_NOT_FOUND if no RX device is connected.
  • XST_FAILURE otherwise.
Note:
None.

u32 XDp_TxSetScrambler ( XDp InstancePtr,
u8  Enable 
)

This function enables or disables scrambling of symbols for both the DisplayPort and the RX device.

Parameters:
InstancePtr is a pointer to the XDp instance.
Enable will enable or disable scrambling.
Returns:
  • XST_SUCCESS if setting the scrambling enable was successful.
  • XST_FAILURE otherwise.
Note:
None.

void XDp_WaitUs ( XDp InstancePtr,
u32  MicroSeconds 
)

This function is the delay/sleep function for the XDp driver. For the Zynq family, there exists native sleep functionality. For MicroBlaze however, there does not exist such functionality. In the MicroBlaze case, the default method for delaying is to use a predetermined amount of loop iterations. This method is prone to inaccuracy and dependent on system configuration; for greater accuracy, the user may supply their own delay/sleep handler, pointed to by InstancePtr->UserTimerWaitUs, which may have better accuracy if a hardware timer is used.

Parameters:
InstancePtr is a pointer to the XDp instance.
MicroSeconds is the number of microseconds to delay/sleep for.
Returns:
None.
Note:
None.

Copyright @ 1995-2014 Xilinx, Inc. All rights reserved.