# # Import UniTAP module. # import UniTAP def ofp_15_handler(requst_text: str) -> UniTAP.OPFDialogAnswer: print(requst_text) return UniTAP.OPFDialogAnswer.PROCEED def ofp_17_handler(requst_text: str) -> UniTAP.OPFDialogAnswer: print(requst_text) return UniTAP.OPFDialogAnswer.PROCEED # Define OPF 18 handler function. This function will be called when OPF 18 will ask for some user # actions. In this function parameters will be same as in operator feedback dialog in UCD Console. # Description for parameters can be found in TSI manual. OPF function must declare return value # via "-> UniTAP.OPFDialogAnswer" (this is verification and reminder for developer that function must # return specific value). Otherwise, dialog will be aborted by UniTAP module. def ofp_18_handler(res_x, res_y, res_frate, res_bpc, col_format, col_range, col_yc, tim_std) \ -> UniTAP.OPFDialogAnswer: print(res_x, res_y, res_frate, res_bpc, col_format, col_range, col_yc, tim_std) # # Call external executable for processing OPF dialog. # return UniTAP.OPFDialogAnswer.PROCEED # # 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. Right now UniTAP module support: # UCD323, UCD340(but without PD), UCD400, UCD422, UCD500 role = dev.select_role(UniTAP.dev.UCD424.USBCSourceUSBCSink) # role = dev.select_role(UniTAP.dev.UCD500.DPSourceDPSink) # # Assign early defined function ofp_18_handler for handling OPF 18 dialog. # # dev.opf_handler.assign_function_for_opf_id(6, ofp_6_handler) # dev.opf_handler.assign_function_for_opf_id(10, ofp_10_handler) dev.opf_handler.assign_function_for_opf_id(15, ofp_15_handler) dev.opf_handler.assign_function_for_opf_id(17, ofp_17_handler) dev.opf_handler.assign_function_for_opf_id(18, ofp_18_handler) # # Test running. # # To select required test group please use UniTAP.TestGroupId enum. In this enum presented all tests for # all possible devices. For first run good to check is required group is available on your device. # To do this use required port from "role" your need object dut_tests. # This object should be used as I/O for any interation with DUT tests. To get number of test in group # please use method number_tests_in_group and put UniTAP.TestGroupId as parameter. print(role.dut_tests.number_tests_in_group(UniTAP.TestGroupId.DP_RX_LL_CTS_DSC)) # Next step is getting default parameters for test group. Since in UCD Console default parameters # loaded automatically in python wrapper user should load this parameters via special method of # dut_tests module: get_default_parameters. params = role.dut_tests.get_default_parameters(UniTAP.Dp14SourceDUTTestParam) params.general.dut_caps.dut_caps_flags.dsc_supported = True params.general.dut_caps.dut_caps_flags.dsc_block_prediction_supported = False params.dsc.dsc_video_modes.clear_all() # params.dsc.dsc_video_modes.vm_3840x2160_60hz.cta = True # params.dsc.dsc_video_modes.vm_1920x1080_30hz.cta = True # params.dsc.dsc_video_modes.vm_5120x2160_30hz.cta = True params.dsc.dsc_video_modes.vm_7680x4320_30hz.cta = True params.dsc.dsc_version = (1, 2) params.dsc.dsc_max_slice = 4 # # For DSC Test 2 # params.dsc.colorimetry.rgb_10bpc_vesa = True params.dsc.colorimetry.rgb_12bpc_vesa = True # # For DSC Test 3 # # params.dsc.colorimetry.ycbcr444_8bpc_cta_itu709 = True # params.dsc.colorimetry.ycbcr444_10bpc_cta_itu709 = True # params.dsc.colorimetry.ycbcr444_12bpc_cta_itu709 = True # # For DSC Test 4 # # params.dsc.colorimetry.ycbcr422_simple_8bpc_cta_itu709 = True # params.dsc.colorimetry.ycbcr422_simple_10bpc_cta_itu709 = True # params.dsc.colorimetry.ycbcr422_simple_12bpc_cta_itu709 = True # # For DSC Test 5 # # params.dsc.colorimetry.ycbcr422_8bpc_cta_itu709 = True # params.dsc.colorimetry.ycbcr422_10bpc_cta_itu709 = True # params.dsc.colorimetry.ycbcr422_12bpc_cta_itu709 = True # # For DSC Test 6 # # params.dsc.colorimetry.ycbcr420_8bpc_cta_itu709 = True # params.dsc.colorimetry.ycbcr420_10bpc_cta_itu709 = True # params.dsc.colorimetry.ycbcr420_12bpc_cta_itu709 = True # # For Tests 4.4.1.1, 4.4.1.2, 4.4.2 (Mandatory RGB 6 and 8 bpc VESA) # # params.general.colorimetry.rgb_10bpc_vesa = True # params.general.colorimetry.rgb_6bpc_cta = True # params.general.colorimetry.rgb_8bpc_cta = True # params.general.colorimetry.ycbcr444_8bpc_cta_itu601 = True # params.general.colorimetry.ycbcr444_8bpc_cta_itu709 = True # params.general.colorimetry.ycbcr444_10bpc_cta_itu601 = True # params.general.colorimetry.ycbcr444_10bpc_cta_itu709 = True # params.general.colorimetry.ycbcr422_8bpc_cta_itu601 = True # params.general.colorimetry.ycbcr422_8bpc_cta_itu709 = True # params.general.colorimetry.ycbcr422_10bpc_cta_itu601 = True # params.general.colorimetry.ycbcr422_10bpc_cta_itu709 = True # # Audio params # # params.audio.min_sample_rate = 44100 # params.audio.max_sample_rate = 192000 # params.audio.sample_size = 16 # selected_channels = ["FL+FR", "RL+RR", "FLH+FRH"] # params.audio.min_ch_config_min_rate.select_channels(selected_channels, True) # params.audio.min_ch_config_max_rate.select_channels(selected_channels, True) # params.audio.max_ch_config_min_rate.select_channels(selected_channels, True) # params.audio.max_ch_config_max_rate.select_channels(selected_channels, True) # # DUT test parameters will be changed soon. (Under development right now) # # For Python Wrapper current way to configure DUT tests parameters is device whole test config to # 'tabs' with associated class(obj). For Source DUT DSC tests params.dsc_tab should be used. # # Running the test. # # To run the test just call "run" method and pass to it 3 parameters. GroupID, index of the test in # that group and as last optional parameter: test parameters. If this parameter missed, test will be # start with default parameters. role.dut_tests.run(UniTAP.TestGroupId.DP_RX_LL_CTS_DSC, 0, params) # # Collecting test results and make HTML report # # If needed test logs available as a result of method get_all_tests_results method. User will # receive TestResultObject which contain all logs and other useful information. results = role.dut_tests.get_all_tests_results() # To create a HTML report please use make_report method. It required 2 parameters: 1) path to file # where report will be saved; 2) TestAdditionalInfo obj. TestAdditionalInfo contains information about # tested DUT device and should be filled with data by user. role.dut_tests.make_report('./report', tested_by="Example", remarks="Remarks for test report.") # # 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()