更新UCD-API库及文档
This commit is contained in:
@@ -3,7 +3,7 @@ import weakref
|
||||
from typing import TypeVar, Type, List
|
||||
|
||||
from .dev_5xx_roles import UCD500
|
||||
from .dev_4xx_roles import UCD400, UCD422, UCD424
|
||||
from .dev_4xx_roles import UCD400, UCD422, UCD424, UCD451, UCD452, UCD461, UCD462
|
||||
from .dev_3xx_roles import UCD240, UCD340, UCD323, UCD301
|
||||
from .modules import *
|
||||
|
||||
@@ -16,6 +16,11 @@ RoleType = TypeVar("RoleType",
|
||||
UCD500.USBCSourceUSBCSink,
|
||||
UCD500.USBCSourceDPSink,
|
||||
|
||||
UCD462.HDMISourceHDMISink,
|
||||
UCD461.DPSourceDPSink,
|
||||
UCD452.HDMISource,
|
||||
UCD451.DPSource,
|
||||
|
||||
UCD424.USBCSourceUSBCSink,
|
||||
UCD422.HDMISourceHDMISink,
|
||||
UCD400.DPSourceDPSink,
|
||||
@@ -26,6 +31,7 @@ RoleType = TypeVar("RoleType",
|
||||
UCD323.DPSink,
|
||||
UCD323.DPSource,
|
||||
UCD323.HDMISink,
|
||||
UCD323.HDMISinkEARC,
|
||||
UCD323.HDMISource,
|
||||
|
||||
UCD301.DPSink,
|
||||
@@ -36,6 +42,10 @@ RoleType = TypeVar("RoleType",
|
||||
|
||||
MODEL_TO_CLASS = {
|
||||
"UCD-500": UCD500,
|
||||
"UCD-462": UCD462,
|
||||
"UCD-461": UCD461,
|
||||
"UCD-452": UCD452,
|
||||
"UCD-451": UCD451,
|
||||
"UCD-424": UCD424,
|
||||
"UCD-422": UCD422,
|
||||
"UCD-400": UCD400,
|
||||
@@ -90,9 +100,10 @@ class TSIDevice:
|
||||
|
||||
def __define_internal_handler(self, role, role_type):
|
||||
if role_type in [UCD500.DPSourceUSBCSink, UCD500.DPSourceDPSink, UCD500.USBCSourceUSBCSink,
|
||||
UCD500.USBCSourceDPSink, UCD424.USBCSourceUSBCSink, UCD400.DPSourceDPSink]:
|
||||
UCD500.USBCSourceDPSink, UCD424.USBCSourceUSBCSink, UCD400.DPSourceDPSink,
|
||||
UCD461.DPSourceDPSink]:
|
||||
self.opf_handler._set_roles(role.dptx, role.dprx)
|
||||
elif role_type in [UCD422.HDMISourceHDMISink]:
|
||||
elif role_type in [UCD422.HDMISourceHDMISink, UCD462.HDMISourceHDMISink]:
|
||||
self.opf_handler._set_roles(role.hdtx, role.hdrx)
|
||||
|
||||
def select_role(self, role_type: Type[RoleType]) -> RoleType:
|
||||
@@ -152,3 +163,28 @@ class TSIDevice:
|
||||
@property
|
||||
def _terminal(self) -> Terminal:
|
||||
return self.__terminal
|
||||
|
||||
def reset(self):
|
||||
"""
|
||||
Reset Device NIOS FPGA.
|
||||
"""
|
||||
role = self.__io.get_role_type()
|
||||
|
||||
if role is None:
|
||||
logging.error("[UniTAP] Cannot reset device without selected role")
|
||||
return
|
||||
|
||||
if role not in (UCD500.DPSourceUSBCSink,
|
||||
UCD500.DPSourceDPSink,
|
||||
UCD500.USBCSourceUSBCSink,
|
||||
UCD500.USBCSourceDPSink):
|
||||
logging.error(f"[UniTAP] Reset functionality is not supported for selected role {role}.")
|
||||
return
|
||||
|
||||
self.__io.reset()
|
||||
|
||||
def close(self):
|
||||
"""
|
||||
Close Device (only with using TSI function `TSIX_DEV_CloseDevice`)
|
||||
"""
|
||||
self.__io.close()
|
||||
|
||||
Reference in New Issue
Block a user