94 lines
2.3 KiB
Python
94 lines
2.3 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
|
|
#
|
|
print(role.dprx.link.status.cable_state)
|
|
# Read status of lane 0
|
|
lane_status = role.dprx.link.status.lane(0)
|
|
print(lane_status)
|
|
|
|
# Read status of VCP (stream 0)
|
|
vcp_table_status = role.dprx.link.status.vcp(0)
|
|
print(vcp_table_status)
|
|
|
|
# Get current stream status (VM, CRC, DSC CRC)
|
|
stream = role.dprx.link.status.stream(0)
|
|
print(stream)
|
|
|
|
# Also, you can print all status
|
|
print(role.dprx.link.status)
|
|
|
|
# role.dprx.link.hpd_pulse()
|
|
|
|
# # Assert/Deassert
|
|
# print(role.dprx.link.status.hpd_asserted)
|
|
# role.dprx.link.set_assert_state(False)
|
|
# print(role.dprx.link.status.hpd_asserted)
|
|
# role.dprx.link.set_assert_state(True)
|
|
# print(role.dprx.link.status.hpd_asserted)
|
|
|
|
# Scrambler Seed
|
|
print(role.dprx.link.scrambler_seed)
|
|
role.dprx.link.scrambler_seed = 0xfffe
|
|
print(role.dprx.link.scrambler_seed)
|
|
|
|
|
|
caps = UniTAP.LinkCapabilities()
|
|
caps.max_lane = 4
|
|
caps.bit_rate = 8.1
|
|
caps.dp_128_132_bitrates = None
|
|
caps.override_10g = None
|
|
caps.force_cable_status_to_plugged = False
|
|
caps.old_dp_2_0_lt = False
|
|
caps.dsc = False
|
|
caps.ss_sbm = False
|
|
caps.fec = False
|
|
caps.tps3 = False
|
|
caps.tps4 = False
|
|
caps.mst = True
|
|
|
|
print(role.dprx.link.capabilities.link_caps_status())
|
|
role.dprx.link.capabilities.set(caps)
|
|
print(role.dprx.link.capabilities.link_caps_status())
|
|
|
|
print(role.dprx.link.status.stream(0).sdp_crc16)
|
|
role.dprx.link.status.reset_sdp_crc16_errors()
|
|
|
|
#
|
|
# Get eDP caps
|
|
#
|
|
edp_caps = role.dprx.link.capabilities.link_caps_status(UniTAP.LinkEDPCapabilities)
|
|
print(edp_caps)
|
|
edp_caps.max_lane = 2
|
|
edp_caps.eDp_cur_rate = [1.62, 2.16, 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() |