# UniTAP.dev.ports.modules.dpcd.dpcd

class DPCDRegion:

Class `DPCDRegion` describe a byte range of DPCD registers. Allows saving DPCD data to dpd file format `save_to_dpd`, hex files format `save_to_hex`, dsc file format `save_to_csv`.

###### Arguments:

- base - start DPCD address of byte range.
- data - DPCD data of byte range.

DPCDRegion(base: int, data: Union[bytearray, int])
base
size: int

Returns length fo data.

###### Returns:

> result of int object

def save_to_dpd(self, path: str):

Save DPCD data to 'dpd' file format.

###### Arguments:

- path (str) - full path to file

def save_to_hex(self, path: str):

Save DPCD data to 'hex' file format.

###### Arguments:

- path (str) - full path to file

def save_to_csv(self, path: str):

Save DPCD data to 'csv' file format.

###### Arguments:

- path (str) - full path to file

class DPCDRegisters:

Class `DPCDRegisters` allows working with DPCD registers: writing `write` DPCD data to device, reading `read` DPCD data from device, loading `load_from_file` DPCD data from file.

DPCDRegisters( port_io: UniTAP.libs.lib_tsi.tsi_io.PortIO, base_ci: int, data_ci: int)
def write(self, base: int, data: Union[bytearray, int, list]) -> int:

Write transferred DPCD data to device from base address.

###### Arguments:

- base (int) - start (base) address.
- data (Union[bytearray, int]) - DPCD data.

###### Returns:

> result of operation

def read( self, base: int, count: int) -> DPCDRegion:

Read DPCD data from base address in a certain quantity.

###### Arguments:

- base (int) - start (base) address.
- count (int) - quantity of DPCD bytes.

###### Returns:

> object of `DPCDRegion`

@staticmethod
def load_from_file( path: str) -> Tuple[ DPCDRegion , DPCDRegion ]:

Read DPCD data from file. Supported formats:

- DPD.

###### Arguments:

- path (str) - full path to file.

###### Returns:

> object of tuple with two `DPCDRegion` objects