101 lines
2.4 KiB
Python
101 lines
2.4 KiB
Python
#
|
|
# Import UniTAP module.
|
|
#
|
|
|
|
import UniTAP
|
|
|
|
#
|
|
# To initialize UniTAP library wrapper user should create UniTAP.TsiLib() object.
|
|
#
|
|
lUniTAP = UniTAP.TsiLib()
|
|
|
|
#
|
|
# For opening device, please, put serial number of the device as 8 symbol str or put index of device.
|
|
#
|
|
# dev = lUniTAP.open("NNNNNNNN")
|
|
dev = lUniTAP.open(0)
|
|
|
|
# After opening device as in UCD Console device role should be selected.
|
|
|
|
role = dev.select_role(UniTAP.dev.UCD400.DPSourceDPSink)
|
|
# role = dev.select_role(UniTAP.dev.UCD500.DPSourceDPSink)
|
|
|
|
#
|
|
# Read current Link Status
|
|
#
|
|
|
|
# Read status of lane 0
|
|
lane_status = role.dptx.link.status.lane(0)
|
|
print(lane_status)
|
|
|
|
# Read status of VCP (stream 0)
|
|
vcp_table_status = role.dptx.link.status.vcp(0)
|
|
print(vcp_table_status)
|
|
|
|
# Read current status of link configuration
|
|
link_config = role.dptx.link.config.get()
|
|
print(link_config)
|
|
|
|
# Get current stream status (VM, CRC, DSC CRC)
|
|
stream = role.dptx.link.status.stream(0)
|
|
print(stream)
|
|
|
|
# Also, you can print all status
|
|
print(role.dptx.link.status)
|
|
|
|
# Configure Link 8b/10b
|
|
config = UniTAP.LinkConfig.DP8b10b()
|
|
|
|
# Set new lane count and bit rate
|
|
config.lane_count = 2
|
|
config.bit_rate = 6.75
|
|
|
|
# Configure Link 128b/132b
|
|
# config = UniTAP.LinkConfig.DP128b132b()
|
|
|
|
# Set new lane count and bit rate
|
|
# config.lane_count = 2
|
|
# config.bit_rate = 5
|
|
|
|
# config.force_dp_128_132 = True
|
|
# config.try_dp_128_132 = True
|
|
# config.enhanced_framing_mode = True
|
|
|
|
# Enable MST mode and configure mst stream count
|
|
config.mst = True
|
|
config.mst_stream_count = 2
|
|
|
|
# Enable/Disable Enhanced framing mode
|
|
config.enhanced_framing_mode = True
|
|
|
|
# Configure SSC
|
|
ssc_config = UniTAP.SSCConfig()
|
|
ssc_config.enabled = True
|
|
ssc_config.amplitude = 34
|
|
ssc_config.frequency = 59000
|
|
config.ssc = ssc_config
|
|
|
|
# Configure Scrambler Seed
|
|
# If you do not want to setting scrambler seed value, you can activate 'auto seed'
|
|
# config.auto_seed = True
|
|
# role.dptx.link.scrambler_seed = 0xFFFF
|
|
|
|
role.dptx.link.config.set(config)
|
|
role.dptx.link.start_link_training()
|
|
|
|
edp_conf = role.dptx.link.config.get(UniTAP.LinkConfig.eDP)
|
|
print(edp_conf)
|
|
edp_conf.force_edp = True
|
|
edp_conf.lane_count = 2
|
|
edp_conf.eDp_cur_rate = 2.43
|
|
|
|
#
|
|
# Since the 3.5 version, TsiLib and TSIDevice objects have the option to be closed earlier.
|
|
# TSIDevice can be closed with the TsiLib method close(). TsiLib can be closed with cleanup().
|
|
# Clean up will close all opened devices and block ability to open any devices
|
|
# with same TsiLib object.
|
|
#
|
|
lUniTAP.close(dev)
|
|
|
|
lUniTAP.cleanup()
|