Esempio n. 1
0
    def write_register_by_address(self, register_address, field_name, value):
        '''
        VDM001002 board write TPS6598x chip register information by address.

        Args:
            register_address:   int,    address range as follow:\r\n
                                            0x16, 0x17, 0x20, 0x28, 0x29, 0x32, 0x33, 0x37, 0x38, 0x47,
                                            0x4a, 0x50, 0x51, 0x52, 0x5c, 0x5d, 0x6e, 0x70, 0x72, 0x7c.

            field_name:         str,    register file name.
            value:              int,    field value

        Returns:
            None

        Raise:
            VDM001002Exception: if register not support filed name will throw exception and raise what support

        Examples:
            vdm.write_register_by_address(0x28, "PortInfo", 0)

        '''
        assert isinstance(register_address, int)
        assert isinstance(field_name, basestring)
        assert isinstance(value, int)

        register = register_definitions.registerByAddr(register_address)
        field_list = [field.name for field in register.fields]
        if field_name not in field_list:
            raise VDM001002Exception('field name \'{}\' not in {}'.format(
                field_name, field_list))

        register.read(self.tps6598x)
        register.fieldByName(field_name).value = value
        register.write(self.tps6598x)
Esempio n. 2
0
    def read_register_by_address(self, chip_id, register_address):
        '''
        USBC001001 read TPS6598x chip register information by address.

        Args:
            chip_id:             string, ["XA", "XB"].
            register_address:    int,    address range as follow:\r\n
                                            0x00, 0x01, 0x03, 0x05, 0x06, 0x0F, 0x14, 0x15, 0x16, 0x17,
                                            0x1A, 0x20, 0x28, 0x29, 0x2D, 0x2F, 0x30, 0x31, 0x32, 0x33,
                                            0x34, 0x35, 0x36, 0x37, 0x38, 0x3F, 0x40, 0x47, 0x48, 0x49,
                                            0x4A, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x57, 0x58, 0x59, 0x5B,
                                            0x5C, 0x5D, 0x5F, 0x60, 0x61, 0x68, 0x69, 0x6E, 0x70, 0x72,
                                            0x7C, 0x7D, 0x7E, 0x7F

        Returns:
            string, str, information of all register.

        Examples:
            register_info = usbc001001.read_register_by_address('XA', 0x03)\r\n
            print(register_info)\r\n

        '''
        assert chip_id in USBC001001Def.USBC_ID

        register = register_definitions.registerByAddr(register_address)
        register.read(self.tps6598x[chip_id])
        return show(register)
Esempio n. 3
0
    def read_register_by_address(self, register_address):
        '''
        VDM001002 board read TPS6598x chip register information by address.

        Args:
            register_address:    int,    address range as follow:\r\n
                                            0x00, 0x01, 0x03, 0x05, 0x06, 0x0F, 0x14, 0x15, 0x16, 0x17,
                                            0x1A, 0x20, 0x28, 0x29, 0x2D, 0x2F, 0x30, 0x31, 0x32, 0x33,
                                            0x34, 0x35, 0x36, 0x37, 0x38, 0x3F, 0x40, 0x47, 0x48, 0x49,
                                            0x4A, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x57, 0x58, 0x59, 0x5B,
                                            0x5C, 0x5D, 0x5F, 0x60, 0x61, 0x68, 0x69, 0x6E, 0x70, 0x72,
                                            0x7C, 0x7D, 0x7E, 0x7F

        Returns:
            string, str, information of all register.

        Examples:
            register_info = vdm.read_register_by_address(0x03)\r\n
            print(register_info)\r\n

        '''
        register = register_definitions.registerByAddr(register_address)
        register.read(self.tps6598x)
        return show(register)