• Home
  • Raw
  • Download

Lines Matching +full:class +full:- +full:utils

3 # Use of this source code is governed by a BSD-style license that can be
19 class PDDevice(object):
22 This class provides a set of APIs for expected Type C PD required actions
23 in TypeC FAFT tests. The base class is specific for Type C devices that
33 'is_src should be implemented in derived class')
41 'is_snk should be implemented in derived class')
55 'is_disconnected should be implemented in derived class')
62 'is_ufp should be implemented in derived class')
69 'is_dfp should be implemented in derived class')
76 'is_drp should be implemented in derived class')
83 'dr_swap should be implemented in derived class')
90 'pr_swap should be implemented in derived class')
98 'vbus_request should be implemented in derived class')
105 'soft_reset should be implemented in derived class')
112 'hard_reset should be implemented in derived class')
120 'drp_set should be implemented in derived class')
128 'drp_set should be implemented in derived class')
136 'drp_disconnect_connect should be implemented in derived class'
145 'cc_disconnect_connect should be implemented in derived class')
155 'in derived class')
158 class PDConsoleDevice(PDDevice):
159 """Class for PD devices that have console access
161 This class contains methods for common PD actions for any PD device which
162 has UART console access. It inherits the PD device base class. In addition,
166 def __init__(self, console, port, utils): argument
174 # Instantiate PD utilities used by methods in this class
175 self.utils = utils
183 return self.utils.get_pd_state(self.port)
190 return self.utils.get_pd_role(self.port)
202 return self.utils.is_pd_flag_set(self.port, key)
208 evaluate multiple conditions without re-getting the state.
213 return self.utils.is_src_connected(self.port, state)
219 evaluate multiple conditions without re-getting the state.
224 return self.utils.is_snk_connected(self.port, state)
230 evaluate multiple conditions without re-getting the state.
242 return self.utils.is_disconnected(self.port, state)
254 return self.utils.is_pd_dual_role_enabled(self.port)
277 swap_state = self.utils.get_snk_connect_states()
280 swap_state = self.utils.get_src_connect_states()
293 time.sleep(self.utils.CONNECT_TIME)
295 if self.utils.get_pd_state(self.port) in swap_state:
307 time.sleep(self.utils.CONNECT_TIME)
321 self.utils.set_pd_dualrole(self.port, mode)
323 current = self.utils.get_pd_dualrole(self.port)
332 return self.utils.get_pd_dualrole(self.port)
353 m = self.utils.send_pd_command_get_output(cmd, regex)
384 state_before = self.utils.get_pd_state(self.port)
385 reply = self.utils.send_pd_command_get_reply_msg(cmd)
386 if reply != self.utils.PD_CONTROL_MSG_DICT['Accept']:
389 state_after = self.utils.get_pd_state(self.port)
405 state_before = self.utils.get_pd_state(self.port)
406 self.utils.enable_pd_console_debug()
411 self.utils.send_pd_command_get_output(cmd, [pattern])
416 self.utils.disable_pd_console_debug()
419 state_after = self.utils.get_pd_state(self.port)
440 current_pr = self.utils.get_pd_state(self.port)
442 self.utils.send_pd_command(swap_cmd)
443 time.sleep(self.utils.CONNECT_TIME)
444 new_pr = self.utils.get_pd_state(self.port)
445 logging.info('Power swap: %s -> %s', current_pr, new_pr)
452 class PDTesterDevice(PDConsoleDevice):
453 """Class for PDTester devices
455 This class contains methods for PD funtions which are unique to the
460 def __init__(self, console, port, utils): argument
467 super(PDTesterDevice, self).__init__(console, port, utils)
479 m = self.utils.send_pd_command_get_output(drp_cmd, drp_re)
528 self.utils.send_pd_command(disc_cmd)
544 disconnected_tuple = self.utils.get_disconnected_states()
548 src_connected_tuple = self.utils.get_src_connect_states()
549 snk_connected_tuple = self.utils.get_snk_connect_states()
553 m = self.utils.send_pd_command_get_output(disc_cmd, [disconnected_exp,
571 time.sleep(disc_time_sec / 2 + self.utils.CONNECT_TIME)
584 drp = self.utils.get_pd_dualrole(self.port)
598 return self.utils.set_pd_dualrole(self.port, mode)
614 m = self.utils.send_pd_command_get_output(cmd, reply_exp)
688 class PDPortPartner(object):
691 This class is initalized with a list of servo consoles. It
786 logging.info("PD Devices are on same platform -> can't be a pair")
797 # Must be SRC <--> SNK or SNK <--> SRC
799 logging.debug("SRC+SNK pair: %s (%s) <--> (%s) %s",
803 logging.debug("Not a SRC+SNK pair: %s (%s) <--> (%s) %s",
825 logging.info("Check: %s <--> %s", tester_port, dut_port)
838 logging.debug("Recheck: %s (%s) <--> (%s) %s",
845 # Delay to allow non-pair devices to reconnect
846 time.sleep(DISC_WAIT_TIME - DISC_CHECK_TIME + CONNECT_TIME)
852 time.sleep(DISC_WAIT_TIME - DISC_CHECK_TIME + CONNECT_TIME)
855 logging.info('PDTester <--> DUT pair found')
865 @return: list of 2 PD devices if a DUT <-> PDTester found.
908 # PD Devices are on same servo console -> can't be a pair