示例#1
0
 def battery_connector(self, plug, battery_type="DEFAULT"):
     """
     Handles battery insertion / removal
     :type plug: boolean
     :param plug: action to be done:
         - True  => insert battery
         - False => remove battery
     :type battery_type: str
     :param battery_type: battery to plug
     """
     if plug:
         self.get_logger().info("Battery insertion")
         # Insert battery
         W.Disable(self, self.LINES.power_supply1_ac_charger)  # ctrl27
         time.sleep(0.3)
         W.Enable(self, self.LINES.battery)  # ctrl00
         W.Enable(self, self.LINES.supply1_switch)  # ctrl15
         time.sleep(0.3)
         W.Enable(self, self.LINES.power_supply1_ac_charger)  # ctrl27
         W.Disable(self, self.LINES.button_ctrl12)  # ctrl12
         time.sleep(0.3)
         W.Disable(self, self.LINES.button_ctrl12)  # ctrl12
         # work around for bench batt id bug
         self.set_battery_type(battery_type)
     else:
         self.get_logger().info("Battery removal")
         # remove battery
         W.Disable(self, self.LINES.power_supply1_ac_charger)  # ctrl27
         time.sleep(0.3)
         W.Disable(self, self.LINES.battery)  # ctrl00
         W.Enable(self, self.LINES.supply1_switch)  # ctrl15
         # work around for bench batt id bug
         self.set_battery_type(self.BAT_INVALID)
示例#2
0
    def set_usb_otg_type(self, otg_type):
        """
        Sets the OTG type
        :type otg_type: str
        :param otg_type: OTG type to select:
            - "NORMAL"
            - "DUT_DEVICE"
            - "DUT_HOST"
        """
        self.get_logger().info("Set OTG type to : %s", otg_type)

        if otg_type == "NORMAL":
            W.Disable(self, self.LINES.OTG_ctrl28)  # ctrl28
            W.Enable(self, self.LINES.OTG_ctrl29)  # ctrl29
            W.Enable(self, self.LINES.OTG_ctrl30)  # ctrl30

        elif otg_type == "DUT_DEVICE":
            W.Enable(self, self.LINES.OTG_ctrl28)  # ctrl28
            W.Disable(self, self.LINES.OTG_ctrl29)  # ctrl29
            W.Enable(self, self.LINES.OTG_ctrl30)  # ctrl30

        elif otg_type == "DUT_HOST":
            W.Enable(self, self.LINES.OTG_ctrl28)  # ctrl28
            W.Disable(self, self.LINES.OTG_ctrl29)  # ctrl29
            W.Disable(self, self.LINES.OTG_ctrl30)  # ctrl30

        else:
            raise TestEquipmentException(
                TestEquipmentException.INVALID_PARAMETER,
                "Unknown OTG type : %s!" % otg_type)
示例#3
0
    def battery_connector(self, plug, battery_type="DEFAULT"):
        """
        Handles battery insertion / removal
        :type plug: boolean
        :param plug: action to be done:
            - True  => insert battery
            - False => remove battery
        :type battery_type: str
        :param battery_type: battery to plug
        """
        if plug:
            self.get_logger().info("Battery insertion")
            # Insert battery
            W.Enable(self, self.LINES.vbatt_force_sens)  # ctrl28
            time.sleep(0.5)
            W.Enable(self, self.LINES.battery)  # ctrl00
            time.sleep(0.5)
            W.Disable(self, self.LINES.vbatt_force_sens)  # ctrl28
            # insert batt id action
            self.set_battery_type(battery_type)

        else:
            self.get_logger().info("Battery removal")
            # remove batt id action
            self.set_battery_type(self.BAT_REMOVED)
            W.Enable(self, self.LINES.vbatt_force_sens)  # ctrl28
            time.sleep(0.5)
            W.Disable(self, self.LINES.battery)  # ctrl00
示例#4
0
 def reset(self):
     """
     Reset the IO card to default states
     """
     ACBN.reset(self)
     self.ac_charger_connector(False)
     self.glitch(False, "short")
     W.Disable(self, self.LINES.prog_res_rdy)  # ctrl08
     W.Enable(self, self.LINES.prog_res_cs)  # ctrl23
     W.Disable(self, self.LINES.prog_res_clk)  # ctrl24
     W.Disable(self, self.LINES.prog_res_sdi)  # ctrl25
示例#5
0
    def press_key_combo(self, button_list, press_duration):
        """
        push on the following button

        :type button_list: list of str
        :param button_list: list of button to press on. defined by  PHONE_BUTTON key

        :type press_duration: int
        :param press_duration: time to keep button on.
        """
        missing_btn = set(button_list) - set(self.PHONE_BUTTON)

        if len(missing_btn) > 0:
            self.get_logger().error(
                "missing unlinked to relay button found :" + str(missing_btn))
            raise TestEquipmentException(
                TestEquipmentException.INVALID_PARAMETER,
                "Unknown or not configured button : %s" % str(missing_btn))

        self.get_logger().info("pressing button %s during %ss" %
                               (str(button_list), press_duration))
        # push button
        for button_name in button_list:
            W.Enable(self, self.PHONE_BUTTON[button_name])  # press button
            time.sleep(0.2)
        # wait a while
        time.sleep(press_duration)
        # release button
        for button_name in button_list:
            W.Disable(self, self.PHONE_BUTTON[button_name])  # release button
            time.sleep(0.2)
示例#6
0
def spi_stop(feature, usb_dio):
    """
    This function generate a invalid sequence in order to
    disable the spi communication
    :type feature: str
    :param feature: can be "bptherm" or "battid"
    :type usb_dio: An Ariane board equipment
    :param usb_dio: the equipment that uses the ProgResistance
    :return: none
    """
    # check the selected feature (bptherm or battid)
    if feature == "bptherm":
        W.Enable(usb_dio, usb_dio.LINES.prog_res_rdy, log=False)  # ctrl08
        W.Disable(usb_dio, usb_dio.LINES.prog_res_cs, log=False)  # ctrl23

        W.Enable(usb_dio, usb_dio.LINES.prog_res_rdy, log=False)  # ctrl08
        W.Enable(usb_dio, usb_dio.LINES.prog_res_cs, log=False)  # ctrl23

        W.Disable(usb_dio, usb_dio.LINES.prog_res_rdy, log=False)  # ctrl08
        W.Enable(usb_dio, usb_dio.LINES.prog_res_cs, log=False)  # ctrl23
示例#7
0
def spi_data(data, usb_dio):
    """
    This function generate a valid clock during 5 half period
    and a data pulse of 3 half period
    :type data: integer
    :param data: this interger is the bit data (1 or 0)
    :type usb_dio: An Ariane board equipment
    :param usb_dio: the equipment that uses the ProgResistance
    :return: none
    """

    # 1 half period
    time.sleep(0.001)
    W.Disable(usb_dio, usb_dio.LINES.prog_res_sdi, log=False)  # ctrl25
    W.Disable(usb_dio, usb_dio.LINES.prog_res_clk, log=False)  # ctrl24

    # 2 half period
    time.sleep(0.001)
    if data == 1:
        W.Enable(usb_dio, usb_dio.LINES.prog_res_sdi, log=False)  # ctrl25
    elif data == 0:
        W.Disable(usb_dio, usb_dio.LINES.prog_res_sdi, log=False)  # ctrl25
    W.Disable(usb_dio, usb_dio.LINES.prog_res_clk, log=False)  # ctrl24

    # 3 half period
    time.sleep(0.001)
    if data == 1:
        W.Enable(usb_dio, usb_dio.LINES.prog_res_sdi, log=False)  # ctrl25
    elif data == 0:
        W.Disable(usb_dio, usb_dio.LINES.prog_res_sdi, log=False)  # ctrl25
    W.Enable(usb_dio, usb_dio.LINES.prog_res_clk, log=False)  # ctrl24

    # 4 half period
    time.sleep(0.001)
    if data == 1:
        W.Enable(usb_dio, usb_dio.LINES.prog_res_sdi, log=False)  # ctrl25
    elif data == 0:
        W.Disable(usb_dio, usb_dio.LINES.prog_res_sdi, log=False)  # ctrl25
    W.Disable(usb_dio, usb_dio.LINES.prog_res_clk, log=False)  # ctrl24

    # 5 half period
    time.sleep(0.001)
    W.Disable(usb_dio, usb_dio.LINES.prog_res_sdi, log=False)  # ctrl25
    W.Disable(usb_dio, usb_dio.LINES.prog_res_clk, log=False)  # ctrl24
示例#8
0
 def press_power_button(self, duration):
     """
     Presses power button.
     Allow to simulate special behavior on the board like S3 mode.
     :type duration: float
     :param duration: time while the power button is pressed
         The value should be superior than 0 seconds
     """
     self.get_logger().info("Press power button during %s second(s)",
                            str(duration))
     W.Enable(self, self.LINES.button_ctrl12)
     time.sleep(duration)
     W.Disable(self, self.LINES.button_ctrl12)
示例#9
0
    def usb_connector(self, plug):
        """
        Handles USB connector connection and disconnection
        :type plug: boolean
        :param plug: action to be done:
            - True  => plug currently selected USB device
            - False => unplug currently selected USB device
        """
        if plug:
            self.get_logger().info("Plug USB")
            W.Enable(self, self.LINES.usb_5v_gnd)
        else:
            self.get_logger().info("Unplug USB")
            W.Disable(self, self.LINES.usb_dp_dm_id)

        time.sleep(0.2)

        if plug:
            W.Enable(self, self.LINES.usb_dp_dm_id)
            # Waiting for enumeration
            time.sleep(3)
        else:
            W.Disable(self, self.LINES.usb_5v_gnd)
示例#10
0
    def usb_device_selector(self, usb_device):
        """
        Handles USB device selection
        :param usb_device: USB device to select:
            - "USB_HOST_PC" -> USB Host PC (ACS, FW/SW Updates)
        """
        self.get_logger().info("Select USB device: %s", usb_device)

        if usb_device == ACBP.USB_HOST_PC:
            W.Enable(self, self.LINES.usb_switch_select)
            W.Disable(self, self.LINES.usb_switch_select2)
        else:
            raise TestEquipmentException(
                TestEquipmentException.INVALID_PARAMETER,
                "Unknown USB device: %s!" % usb_device)
示例#11
0
 def sim_card_connector(self, plug):
     """
     Handles SIM card insertion / removal
     :type plug: boolean
     :param plug: action to be done:
         - True  => insert SIM card
         - False => remove SIM card
     """
     if plug:
         self.get_logger().info("SIM card insertion")
         # Insert battery
         W.Enable(self, self.LINES.sim_card)  # ctrl11
     else:
         self.get_logger().info("SIM card removal")
         # remove battery
         W.Disable(self, self.LINES.sim_card)  # ctrl11
示例#12
0
 def usb_connector_data(self, plug):
     """
     Handles USB connector connection and disconnection
     :type plug: boolean
     :param plug: action to be done:
         - True  => plug data cable
         - False => unplug data cable
     """
     if plug:
         self.get_logger().info("Plug Datas USB")
         W.Enable(self, self.LINES.usb_dp_dm_id)
         # Waiting for enumeration
         time.sleep(3)
     else:
         self.get_logger().info("Unplug datas USB")
         W.Disable(self, self.LINES.usb_dp_dm_id)
         time.sleep(1)
示例#13
0
 def glitch(self, start, behavior):
     """
     Start or stop a short or a long Glitch
     :type start: boolean
     :param start: 'True' for starting or 'False' for stopping a glitch
     :type behavior: str
     :param behavior: can be "short" or "long
     """
     if start:
         self.get_logger().info("Start a %s Glitch", behavior)
         if behavior == "short":
             # long glitch
             W.Disable(self, self.LINES.batt_id_glitch)  # ctrl09
             W.Enable(self, self.LINES.batt_id_glitch_duration)  # ctrl10
             W.Disable(self, self.LINES.digital_battery_protocol)  # ctrl14
         elif behavior == "long":
             # short glitch
             W.Disable(self, self.LINES.batt_id_glitch)  # ctrl09
             W.Disable(self, self.LINES.batt_id_glitch_duration)  # ctrl10
             W.Disable(self, self.LINES.digital_battery_protocol)  # ctrl14
         else:
             raise TestEquipmentException(
                 TestEquipmentException.INVALID_PARAMETER,
                 "Unsupported behavior: %d!" % behavior)
     else:
         self.get_logger().info("Stop a %s Glitch", behavior)
         if behavior == "short":
             # long glitch
             W.Enable(self, self.LINES.batt_id_glitch)  # ctrl09
             W.Enable(self, self.LINES.batt_id_glitch_duration)  # ctrl10
             W.Disable(self, self.LINES.digital_battery_protocol)  # ctrl14
         elif behavior == "long":
             # short glitch
             W.Enable(self, self.LINES.batt_id_glitch)  # ctrl09
             W.Disable(self, self.LINES.batt_id_glitch_duration)  # ctrl10
             W.Disable(self, self.LINES.digital_battery_protocol)  # ctrl14
         else:
             raise TestEquipmentException(
                 TestEquipmentException.INVALID_PARAMETER,
                 "Unsupported behavior: %d!" % behavior)
示例#14
0
    def set_battery_temperature(self, temperature):
        """
        Sets battery temperature
        :type temperature: integer
        :param temperature: temperature in C to set, possible values:
        {95; 70; 50; 25; 10; 5; 0; -15}
        """
        temperature = int(temperature)
        self.get_logger().info("Set battery temperature: %d C", temperature)

        codes = {
            95: [False, False, True],
            70: [True, False, True],
            50: [False, True, True],
            25: [True, True, True],
            10: [False, False, False],
            5: [True, False, False],
            0: [False, True, False],
            -15: [True, True, False]
        }

        lines = [
            self.LINES.temp_value_ctrl6, self.LINES.temp_value_ctrl7,
            self.LINES.temp_value_ctrl16
        ]

        if temperature in codes.keys():
            code = codes[temperature]
            for num in range(len(code)):
                if code[num]:
                    W.Enable(self, lines[num])
                else:
                    W.Disable(self, lines[num])
        else:
            raise TestEquipmentException(
                TestEquipmentException.INVALID_PARAMETER,
                "Unsupported battery temperature: %d!" % temperature)