dppsu: xdppsu.c File Reference

| dppsu Xilinx SDK Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List

Enumerations | Functions
xdppsu.c File Reference

## Overview

Contains a minimal set of functions for the XDpPsu driver that allow access to all of the DisplayPort TX core's functionality.

See xdppsu.h for a detailed description of the driver.

Note
  None.

    MODIFICATION HISTORY:

    Ver   Who  Date     Changes

    1.0   aad  01/27/17 Initial release.

## Enumerations
enum | XDpPsu_TrainingState
| This typedef enumerates the list of training states used in the state machine during the link training process. More...

## Functions
u32 | XDpPsu_InitializeTx (XDpPsu *InstancePtr)
| This function prepares the DisplayPort TX core for use. More...
void | XDpPsu_CfgInitialize (XDpPsu *InstancePtr, XDpPsu_Config *ConfigPtr, u32 EffectiveAddr)
| This function retrieves the configuration for this DisplayPort TX instance and fills in the InstancePtr->Config structure. More...
u32 | XDpPsu_GetRxCapabilities (XDpPsu *InstancePtr)
| This function retrieves the RX device's capabilities from the RX device's DisplayPort Configuration Data (DPCD). More...
u32 | XDpPsu_CfgMainLinkMax (XDpPsu *InstancePtr)
| This function determines the common capabilities between the DisplayPort TX core and the RX device. More...
u32 | XDpPsu_EstablishLink (XDpPsu *InstancePtr)
| This function checks if the link needs training and runs the training sequence if training is required. More...
u32 | XDpPsu_CheckLinkStatus (XDpPsu *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. More...
u32 | XDpPsu_IsConnected (XDpPsu *InstancePtr)
| This function checks if there is a connected RX device. More...
u32 | XDpPsu_AuxRead (XDpPsu *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. More...
u32 | XDpPsu_AuxWrite (XDpPsu *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. More...
u32 | XDpPsu_IicRead (XDpPsu *InstancePtr, u8 IicAddress, u16 Offset, u16 BytesToRead, void *ReadData)
| This function performs an I2C read over the AUX channel. More...
u32 | XDpPsu_IicWrite (XDpPsu *InstancePtr, u8 IicAddress, u8 BytesToWrite, void *WriteData)
| This function performs an I2C write over the AUX channel. More...
u32 | XDpPsu_SetDownspread (XDpPsu *InstancePtr, u8 Enable)
| This function enables or disables 0.5% spreading of the clock for both the DisplayPort and the RX device. More...
u32 | XDpPsu_SetEnhancedFrameMode (XDpPsu *InstancePtr, u8 Enable)
| This function enables or disables the enhanced framing symbol sequence for both the DisplayPort TX core and the RX device. More...
u32 | XDpPsu_SetLaneCount (XDpPsu *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. More...
u32 | XDpPsu_SetLinkRate (XDpPsu *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. More...
u32 | XDpPsu_SetScrambler (XDpPsu *InstancePtr, u8 Enable)
| This function enables or disables scrambling of symbols for both the DisplayPort and the RX device. More...
void | XDpPsu_EnableMainLink (XDpPsu *InstancePtr, u8 Enable)
| This function enables the main link. More...
void | XDpPsu_ResetPhy (XDpPsu *InstancePtr, u32 Reset)
| This function does a PHY reset. More...

## Enumeration Type Documentation

enum XDpPsu_TrainingState

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

## Function Documentation

u32 XDpPsu_AuxRead | ( | XDpPsu * | 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 XDpPsu 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.

References XDpPsu::IsReady, and XDPPSU_AUX_CMD_READ.

Referenced by XDpPsu_GetRxCapabilities(), XDpPsu_SetDownspread(), XDpPsu_SetEnhancedFrameMode(), XDpPsu_SetLaneCount(), and XDpPsu_SetScrambler().

u32 XDpPsu_AuxWrite | ( | XDpPsu * | 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 XDpPsu 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.

References XDpPsu::IsReady, and XDPPSU_AUX_CMD_WRITE.

Referenced by XDpPsu_SetDownspread(), XDpPsu_SetEnhancedFrameMode(), XDpPsu_SetLaneCount(), XDpPsu_SetLinkRate(), and XDpPsu_SetScrambler().

void XDpPsu_CfgInitialize | ( | XDpPsu * | InstancePtr,
|  | XDpPsu_Config * | ConfigPtr,
|  | u32 | EffectiveAddr
| ) |  |

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

Parameters

  InstancePtr | is a pointer to the XDpPsu 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.

References XDpPsu_Config::BaseAddr, XDpPsu::Config, XDpPsu_Config::DeviceId, XDpPsu::IsReady, and XDpPsu::SAxiClkHz.

Referenced by DpPsu_SelfTestExample().

u32 XDpPsu_CfgMainLinkMax | ( | XDpPsu * | InstancePtr | ) |

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

Parameters

  InstancePtr | is a pointer to the XDpPsu 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.

References XDpPsu::IsReady, XDpPsu::LinkConfig, XDpPsu_LinkConfig::MaxLaneCount, XDpPsu_LinkConfig::MaxLinkRate, XDpPsu_SetLaneCount(), and XDpPsu_SetLinkRate().

u32 XDpPsu_CheckLinkStatus | ( | XDpPsu * | 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 XDpPsu 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.

References XDpPsu::IsReady, XDPPSU_LANE_COUNT_SET_1, and XDPPSU_LANE_COUNT_SET_2.

Referenced by XDpPsu_EstablishLink().

void XDpPsu_EnableMainLink | ( | XDpPsu * | InstancePtr,
|  | u8 | Enable
| ) |  |

This function enables the main link.

Parameters

  InstancePtr | is a pointer to the XDpPsu instance.
  Enable | is a control flag to enable or disable main link

Returns
  None.

Note
  Enable = 1, Enable main link Enable =0, Disable main link.

References XDpPsu_Config::BaseAddr, XDpPsu::Config, XDpPsu::IsReady, XDPPSU_ENABLE_MAIN_STREAM, XDPPSU_FORCE_SCRAMBLER_RESET, and XDpPsu_WriteReg.

Referenced by XDpPsu_EstablishLink().

u32 XDpPsu_EstablishLink | ( | XDpPsu * | 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 XDpPsu 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.

References XDpPsu_Config::BaseAddr, XDpPsu::Config, XDpPsu::IsReady, XDpPsu_LinkConfig::LaneCount, XDpPsu::LinkConfig, XDpPsu_LinkConfig::LinkRate, XDpPsu_CheckLinkStatus(), XDPPSU_ENABLE_MAIN_STREAM, XDpPsu_EnableMainLink(), XDPPSU_LANE_COUNT_SET_1, XDPPSU_LANE_COUNT_SET_2, XDPPSU_LINK_BW_SET_162GBPS, XDPPSU_LINK_BW_SET_270GBPS, XDPPSU_LINK_BW_SET_540GBPS, XDPPSU_PHY_CONFIG_PHY_RESET_MASK, XDPPSU_PHY_CONFIG_TX_PHY_8B10BEN_MASK, XDpPsu_ReadReg, XDpPsu_ResetPhy(), and XDPPSU_TRAINING_PATTERN_SET_OFF.

u32 XDpPsu_GetRxCapabilities | ( | XDpPsu * | 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 XDpPsu 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.

References XDpPsu::Config, XDpPsu_SinkConfig::DpcdRxCapsField, XDpPsu::IsReady, XDpPsu::LinkConfig, XDpPsu_LinkConfig::MaxLaneCount, XDpPsu_LinkConfig::MaxLinkRate, XDpPsu::RxConfig, XDpPsu_LinkConfig::SupportDownspreadControl, XDpPsu_LinkConfig::SupportEnhancedFramingMode, and XDpPsu_AuxRead().

u32 XDpPsu_IicRead | ( | XDpPsu * | 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:

- 128, an I2C read is done on segptr=0; offset=128.
- 256, an I2C read is done on segptr=1; offset=0.
- 384, an I2C read is done on segptr=1; offset=128.
- 512, an I2C read is done on segptr=2; offset=0.
- etc.

Parameters

  InstancePtr | is a pointer to the XDpPsu 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.

References XDpPsu_Config::BaseAddr, XDpPsu::Config, XDpPsu::IsReady, XDPPSU_AUX_CMD_I2C_READ, XDPPSU_AUX_CMD_I2C_WRITE_MOT, XDpPsu_IicWrite(), XDPPSU_INTR_HPD_EVENT_MASK, XDPPSU_INTR_STATUS, and XDpPsu_ReadReg.

Referenced by XDpPsu_GetEdidBlock().

u32 XDpPsu_IicWrite | ( | XDpPsu * | InstancePtr,
|  | u8 | IicAddress,
|  | u8 | BytesToWrite,
|  | void * | WriteData
| ) |  |

This function performs an I2C write over the AUX channel.

Parameters

  InstancePtr | is a pointer to the XDpPsu 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.

References XDpPsu::IsReady, and XDPPSU_AUX_CMD_I2C_WRITE.

Referenced by XDpPsu_IicRead().

u32 XDpPsu_InitializeTx | ( | XDpPsu * | InstancePtr | ) |

This function prepares the DisplayPort TX core for use.

Parameters

  InstancePtr | is a pointer to the XDpPsu instance.

Returns
  - XST_SUCCESS if the DisplayPort TX core was successfully initialized.
  - XST_FAILURE otherwise.

Note
  None.

References XDpPsu_Config::BaseAddr, XDpPsu::Config, XDpPsu::IsReady, XDpPsu::SAxiClkHz, XDPPSU_AUX_CLK_DIVIDER, XDPPSU_AUX_CLK_DIVIDER_VAL_MASK, XDPPSU_DP_DISABLE, XDPPSU_DP_ENABLE, XDPPSU_ENABLE, XDPPSU_INTR_HPD_EVENT_MASK, XDPPSU_INTR_HPD_IRQ_MASK, XDPPSU_INTR_HPD_PULSE_DETECTED_MASK, XDPPSU_INTR_MASK, XDPPSU_PHY_CLOCK_SELECT, XDPPSU_PHY_CLOCK_SELECT_540GBPS, XDPPSU_PHY_CONFIG, XDPPSU_PHY_CONFIG_GT_ALL_RESET_MASK, XDpPsu_ReadReg, XDPPSU_SOFT_RESET, XDPPSU_SOFT_RESET_EN, and XDpPsu_WriteReg.

u32 XDpPsu_IsConnected | ( | XDpPsu * | InstancePtr | ) |

This function checks if there is a connected RX device.

Parameters

  InstancePtr | is a pointer to the XDpPsu instance.

Returns
  - TRUE if there is a connection.
  - FALSE if there is no connection.

References XDpPsu_Config::BaseAddr, XDpPsu::Config, XDPPSU_INTERRUPT_SIG_STATE, XDPPSU_INTERRUPT_SIG_STATE_HPD_STATE_MASK, and XDpPsu_ReadReg.

Referenced by XDpPsu_HpdInterruptHandler().

void XDpPsu_ResetPhy | ( | XDpPsu * | InstancePtr,
|  | u32 | Reset
| ) |  |

This function does a PHY reset.

Parameters

  InstancePtr | is a pointer to the XDpPsu instance.
  Reset | is the type of reset to assert.

Returns
  None.

Note
  None.

References XDpPsu_Config::BaseAddr, XDpPsu::Config, XDpPsu::IsReady, XDPPSU_ENABLE, XDPPSU_PHY_CONFIG, XDpPsu_ReadReg, and XDpPsu_WriteReg.

Referenced by XDpPsu_EstablishLink().

u32 XDpPsu_SetDownspread | ( | XDpPsu * | 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 XDpPsu 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.

References XDpPsu_Config::BaseAddr, XDpPsu::Config, XDpPsu_LinkConfig::DownspreadControl, XDpPsu::IsReady, XDpPsu::LinkConfig, XDpPsu_AuxRead(), XDpPsu_AuxWrite(), XDPPSU_DOWNSPREAD_CTRL, and XDpPsu_WriteReg.

u32 XDpPsu_SetEnhancedFrameMode | ( | XDpPsu * | 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 XDpPsu 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.

References XDpPsu_Config::BaseAddr, XDpPsu::Config, XDpPsu_LinkConfig::EnhancedFramingMode, XDpPsu::IsReady, XDpPsu::LinkConfig, XDpPsu_AuxRead(), XDpPsu_AuxWrite(), XDPPSU_ENHANCED_FRAME_EN, and XDpPsu_WriteReg.

u32 XDpPsu_SetLaneCount | ( | XDpPsu * | 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 XDpPsu 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.

References XDpPsu_Config::BaseAddr, XDpPsu::Config, XDpPsu::IsReady, XDpPsu_LinkConfig::LaneCount, XDpPsu::LinkConfig, XDpPsu_AuxRead(), XDpPsu_AuxWrite(), XDPPSU_LANE_COUNT_SET, XDPPSU_LANE_COUNT_SET_1, XDPPSU_LANE_COUNT_SET_2, and XDpPsu_WriteReg.

Referenced by XDpPsu_CfgMainLinkMax().

u32 XDpPsu_SetLinkRate | ( | XDpPsu * | 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 XDpPsu instance.
  LinkRate | is the link rate to be used over the main link based on one of the following selects: XDPPSU_LINK_BW_SET_162GBPS = 0x06 (for a 1.62 Gbps data rate) XDPPSU_LINK_BW_SET_270GBPS = 0x0A (for a 2.70 Gbps data rate) XDPPSU_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.

References XDpPsu_Config::BaseAddr, XDpPsu::Config, XDpPsu::IsReady, XDpPsu::LinkConfig, XDpPsu_LinkConfig::LinkRate, XDpPsu_AuxWrite(), XDPPSU_LINK_BW_SET, XDPPSU_LINK_BW_SET_162GBPS, XDPPSU_LINK_BW_SET_270GBPS, XDPPSU_LINK_BW_SET_540GBPS, XDPPSU_PHY_CLOCK_SELECT_162GBPS, XDPPSU_PHY_CLOCK_SELECT_270GBPS, XDPPSU_PHY_CLOCK_SELECT_540GBPS, and XDpPsu_WriteReg.

Referenced by XDpPsu_CfgMainLinkMax().

u32 XDpPsu_SetScrambler | ( | XDpPsu * | 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 XDpPsu instance.
  Enable | will enable or disable scrambling.

Returns
  - XST_SUCCESS if setting the scrambling enable was successful.
  - XST_FAILURE otherwise.

Note
  None.

References XDpPsu_Config::BaseAddr, XDpPsu::Config, XDpPsu::IsReady, XDpPsu::LinkConfig, XDpPsu_LinkConfig::ScramblerEn, XDpPsu_AuxRead(), XDpPsu_AuxWrite(), XDPPSU_SCRAMBLING_DISABLE, and XDpPsu_WriteReg.