# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: data_generator/data_generator_channel.proto, data_generator/data_generator_counter_config.proto, i2c/i2c_32bit_register_target/i2c_32bit_register_target_config.proto, i2c/i2c_32bit_register_target/i2c_32bit_register_target_state.proto, i2c/i2c_channel.proto, i2c/i2c_controller/i2c_controller_config.proto, i2c/i2c_controller/i2c_controller_state.proto, i2c/i2c_controller_ops.proto, i3c/i3c_32bit_register_target/i3c_32bit_register_target_config.proto, i3c/i3c_32bit_register_target/i3c_32bit_register_target_state.proto, i3c/i3c_ccc_enum.proto, i3c/i3c_channel.proto, i3c/i3c_controller/i3c_controller_config.proto, i3c/i3c_controller/i3c_controller_state.proto, i3c/i3c_controller_event.proto, i3c/i3c_controller_ops.proto, i3c/i3c_stress_test_target/i3c_stress_test_target_config.proto, i3c/i3c_target_event.proto, i3c/i3c_target_ops.proto, px_controller_device.proto, px_device_operation.proto, px_device_state.proto, px_event_msg.proto, px_handle.proto, px_podctrl.proto, px_protobuf_msg.proto, px_target_device.proto, pxstatus_enum.proto, spi/spi_32bit_register_target/spi_32bit_register_target_config.proto, spi/spi_32bit_register_target/spi_32bit_register_target_state.proto, spi/spi_channel.proto, spi/spi_controller/spi_controller_config.proto, spi/spi_controller/spi_controller_state.proto, spi/spi_controller_ops.proto, system.proto, uart/uart_channel.proto, uart/uart_config.proto, uart/uart_event.proto, uart/uart_ops.proto
# plugin: python-betterproto
# This file has been @generated
import warnings
from dataclasses import dataclass
from typing import (
    List,
    Optional,
)

import betterproto


class UartConfigParityMode(betterproto.Enum):
    PARITY_MODE_NONE = 0
    PARITY_MODE_ODD = 1
    PARITY_MODE_EVEN = 2
    PARITY_MODE_MARK = 3
    PARITY_MODE_SPACE = 4


class I3CCommonCommandCode(betterproto.Enum):
    I3C_CCC_BROADCAST_ENEC = 0
    """0x00: Enable Events Command."""

    I3C_CCC_BROADCAST_DISEC = 1
    """0x01: Disable Events Command."""

    I3C_CCC_BROADCAST_ENTAS0 = 2
    """0x02: Enter Activity State 0."""

    I3C_CCC_BROADCAST_ENTAS1 = 3
    """0x03: Enter Activity State 1."""

    I3C_CCC_BROADCAST_ENTAS2 = 4
    """0x04: Enter Activity State 2."""

    I3C_CCC_BROADCAST_ENTAS3 = 5
    """0x05: Enter Activity State 3."""

    I3C_CCC_BROADCAST_RSTDAA = 6
    """0x06: Reset Dynamic Address Assignment."""

    I3C_CCC_BROADCAST_ENTDAA = 7
    """0x07: Enter Dynamic Address Assignment."""

    I3C_CCC_BROADCAST_DEFTGTS = 8
    """0x08: Define List of Targets."""

    I3C_CCC_BROADCAST_SETMWL = 9
    """0x09: Set Max Write Length."""

    I3C_CCC_BROADCAST_SETMRL = 10
    """0x0A: Set Max Read Length."""

    I3C_CCC_BROADCAST_ENTTM = 11
    """0x0B: Enter Test Mode."""

    I3C_CCC_BROADCAST_SETBUSCON = 12
    """0x0C: Set Bus Context"""

    I3C_CCC_BROADCAST_ENDXFER = 18
    """0x12: Data Transfer Ending Procedure Control."""

    I3C_CCC_BROADCAST_ENTHDR0 = 32
    """0x20: Enter HDR Mode 0 (HDR-DDR)."""

    I3C_CCC_BROADCAST_ENTHDR1 = 33
    """0x21: Enter HDR Mode 1 (HDR-TSP)."""

    I3C_CCC_BROADCAST_ENTHDR2 = 34
    """0x22: Enter HDR Mode 2 (HDR-TSL)."""

    I3C_CCC_BROADCAST_ENTHDR3 = 35
    """0x23: Enter HDR Mode 3 (HDR-BT)."""

    I3C_CCC_BROADCAST_ENTHDR4 = 36
    """0x24: Enter HDR Mode 4."""

    I3C_CCC_BROADCAST_ENTHDR5 = 37
    """0x25: Enter HDR Mode 5."""

    I3C_CCC_BROADCAST_ENTHDR6 = 38
    """0x26: Enter HDR Mode 6."""

    I3C_CCC_BROADCAST_ENTHDR7 = 39
    """0x27: Enter HDR Mode 7."""

    I3C_CCC_BROADCAST_SETXTIME = 40
    """0x28: Exchange Timing Information."""

    I3C_CCC_BROADCAST_SETAASA = 41
    """0x29: Set All Addresses to Static Addresses."""

    I3C_CCC_BROADCAST_RSTACT = 42
    """0x2A: Target Reset Action."""

    I3C_CCC_BROADCAST_DEFGRPA = 43
    """0x2B: Define List of Group Address."""

    I3C_CCC_BROADCAST_RSTGRPA = 44
    """0x2C: Reset Group Address."""

    I3C_CCC_BROADCAST_MLANE = 45
    """0x2D: Multi-Lane Data Transfer Control."""

    I3C_CCC_BROADCAST_DBGACTION = 88
    """0x58 - 0x5B Debug Reserved."""

    I3C_CCC_BROADCAST_EXTENSION = 127
    """0x61 - 0x7F Vendor Extension."""

    I3C_CCC_DIRECT_ENEC = 128
    """0x80: Enable Events Command."""

    I3C_CCC_DIRECT_DISEC = 129
    """0x81: Disable Events Command."""

    I3C_CCC_DIRECT_ENTAS0 = 130
    """0x82: Enter Activity State 0."""

    I3C_CCC_DIRECT_ENTAS1 = 131
    """0x83: Enter Activity State 1."""

    I3C_CCC_DIRECT_ENTAS2 = 132
    """0x84: Enter Activity State 2."""

    I3C_CCC_DIRECT_ENTAS3 = 133
    """0x85: Enter Activity State 3."""

    I3C_CCC_DIRECT_RSTDAA = 134
    """0x86: Reset Dynamic Address Assignment."""

    I3C_CCC_DIRECT_SETDASA = 135
    """0x87: Set Dynamic Address from Static Address."""

    I3C_CCC_DIRECT_SETNEWDA = 136
    """0x88: Set New Dynamic Address."""

    I3C_CCC_DIRECT_SETMWL = 137
    """0x89: Set Max Write Length."""

    I3C_CCC_DIRECT_SETMRL = 138
    """0x8A: Set Max Read Length."""

    I3C_CCC_DIRECT_GETMWL = 139
    """0x8B: Get Max Write Length."""

    I3C_CCC_DIRECT_GETMRL = 140
    """0x8C: Get Max Read Length."""

    I3C_CCC_DIRECT_GETPID = 141
    """0x8D: Get Provisioned ID."""

    I3C_CCC_DIRECT_GETBCR = 142
    """0x8E: Get Bus Characteristics Register."""

    I3C_CCC_DIRECT_GETDCR = 143
    """0x8F: Get Device Characteristics Register."""

    I3C_CCC_DIRECT_GETSTATUS = 144
    """0x90: Get Device Status."""

    I3C_CCC_DIRECT_GETACCCR = 145
    """0x91: Get Accept Controller Role (formerly GETACCMST)."""

    I3C_CCC_DIRECT_ENDXFER = 146
    """0x92: Data Transfer Ending Procedure Control."""

    I3C_CCC_DIRECT_SETBRGTGT = 147
    """0x93: Set Bridge Targets."""

    I3C_CCC_DIRECT_GETMXDS = 148
    """0x94: Get Max Data Speed."""

    I3C_CCC_DIRECT_GETCAPS = 149
    """0x95: Get Optional Feature Capabilities (formerly GETHDRCAPS)."""

    I3C_CCC_DIRECT_SETROUTE = 150
    """0x96: Set Route."""

    I3C_CCC_DIRECT_D2DXFER = 151
    """0x97: Device to Device(s) Tunneling Control."""

    I3C_CCC_DIRECT_SETXTIME = 152
    """0x98: Set Exchange Timing Information."""

    I3C_CCC_DIRECT_GETXTIME = 153
    """0x99: Get Exchange Timing Information."""

    I3C_CCC_DIRECT_RSTACT = 154
    """0x9A: Target Reset Action."""

    I3C_CCC_DIRECT_SETGRPA = 155
    """0x9B: Set Group Address."""

    I3C_CCC_DIRECT_RSTGRPA = 156
    """0x9C: Reset Group Address."""

    I3C_CCC_DIRECT_MLANE = 157
    """0x9D: Multi-Lane Data Transfer Control."""

    I3C_CCC_DIRECT_DBGOPCODE = 215
    """0xD7 - 0xDA Debug Reserved."""

    I3C_CCC_DIRECT_DBGACTION = 219
    """0xDB: Debug Action."""

    I3C_CCC_DIRECT_EXTENSION = 254
    """0xE0 - 0xFE Vendor Extension."""


class I3CParityMode(betterproto.Enum):
    RAW = 0
    """
    Parity mode for I3C transactions.
     RAW: raw parity calculated by user.
    """

    FLAG = 1
    """FLAG: annotate which parity is incorrect (0: correct, 1: incorrect)."""

    ALL_CORRECT = 2
    """ALL_CORRECT: provide correct calculated parity."""

    ALL_INCORRECT = 3
    """ALL_INCORRECT: provide incorrect calculated parity."""


class I3CSendTransactionStopType(betterproto.Enum):
    PUSH_PULL = 0
    OPEN_DRAIN = 1
    HDR_EXIT = 2
    TARGET_RESET = 3


class I3CTargetIbiType(betterproto.Enum):
    ImmediateIBI = 0
    ArbitratedIBI = 1


class I3CTargetHotJoinType(betterproto.Enum):
    Immediate = 0
    Arbitrated = 1


class I2C32BitRegisterTargetConfigSubAddressType(betterproto.Enum):
    SUB_ADDR_NONE = 0
    """Without sub-address."""

    SUB_ADDR_8BIT_REPEAT = 1
    """Repeatedly write to the same 8-bit register."""

    SUB_ADDR_8BIT_IGNORE = 2
    """
    Ignore repeated data write to same address, or send 0xFF after initial read.
    """

    SUB_ADDR_8BIT_INCREMENT = 3
    """
    Increment the 8-bit register address by 1 (0 - 3), and NACK afterwards.
    """

    SUB_ADDR_8BIT_INCREMENT_WITH_LOOP = 4
    """Increment the 8-bit register address by 1, with looping back to 0."""


class I3C32BitRegisterTargetConfigSubAddressType(betterproto.Enum):
    SUB_ADDR_NONE = 0
    """Without sub-address."""

    SUB_ADDR_8BIT_REPEAT = 1
    """Repeatedly write to the same 8-bit register."""

    SUB_ADDR_8BIT_IGNORE = 2
    """
    Ignore repeated data write to same address, and the target will terminate with T=0
    """

    SUB_ADDR_8BIT_INCREMENT = 3
    """
    Increment the 8-bit register address by 1 (0 - 3), and NACK afterwards.
    """

    SUB_ADDR_8BIT_INCREMENT_WITH_LOOP = 4
    """Increment the 8-bit register address by 1, with looping back to 0."""


class PxPodIoPortFlags(betterproto.Enum):
    IO_PORT_FLAG_UNUSED = 0
    IO_PORT_FLAG_PAIR_1 = 3
    IO_PORT_FLAG_PAIR_2 = 12
    IO_PORT_FLAG_PAIR_3 = 48
    IO_PORT_FLAG_PAIR_4 = 192
    IO_PORT_FLAG_GPIO_0 = 256
    IO_PORT_FLAG_GPIO_1 = 512


class PxResponseStatus(betterproto.Enum):
    SUCCESS = 0
    """* Generic status for success."""

    FAIL = 1
    """* Generic status for fail."""

    INVALID_ARGUMENT = 2
    """* Generic status for invalid arguments."""

    BAD_POINTER = 3
    """* Generic status for bad pointers."""

    TIMEOUT = 4
    """* Generic status for timeout."""

    NOT_IMPLEMENTED = 5
    """* Generic status for not implemented."""

    NO_MEMORY = 6
    """* Generic status for out of memory."""

    UNSUPPORTED = 7
    """* Generic status for unsupported."""

    ACCESS_DENIED = 8
    """* Generic status for permission denied."""

    RESOURCE_BUSY = 9
    """* Generic status for resource busy."""

    NOT_FILE = 10
    """* Generic status for not a file."""

    NOT_DIRECTORY = 11
    """* Generic status for not a directory."""

    TOO_MANY_OPEN_FILES = 12
    """* Generic status for too many open files."""

    FILE_EXISTS = 13
    """* Generic status for file exists."""

    FILE_TOO_LARGE = 14
    """* Generic status for file too large."""

    FILE_NAME_TOO_LONG = 15
    """* Generic status for file name too long."""

    PROTOCOL_NOT_SUPPORTED = 512
    """
    *
     This status code is used to indicate that the requested protocol is not supported by the
     current PXPOD.
    """

    I3C_TARGET_FAIL_TO_SEND_IBI = 1281
    """
    *
     An I3C target fails to send IBI request, due to the following conditions
    
     - Target does not have a dynamic address
     - Target interrupts is not enabled (ENINT = 0)
    """

    I3C_TARGET_FAIL_TO_SEND_HOTJOIN = 1282
    """
    *
     An I3C target fails to send Hot-Join request, due to the following conditions
    
     - Target had a dynamic address already
     - Target interrupts is not enabled (ENHJ = 0)
    """

    CHANNEL_CONFLICT = 4096
    """* Channel conflict between two different protocols"""

    PXIPStatusUnspecified = 1229979648
    """Unspecified, DO NOT USE"""

    PXIPStatusFail = 1229979649
    PXIPStatusInvalidArgument = 1229979650
    PXIPStatusBadPointer = 1229979651
    PXIPStatusTimeout = 1229979652
    PXIPStatusNotImplemented = 1229979653
    PXIPStatusNoMemory = 1229979654
    PXIPStatusUnsupported = 1229979655
    PXIPStatusInvalidId = 1229979904
    PXIPStatusInvalidInstance = 1229979905
    PXIPStatusNoFreeInstance = 1229979906
    PXIPStatusBadState = 1229979907
    PXIPStatusTransactionTooLong = 1229979908
    PXIPStatusInvalidTransaction = 1229979909


@dataclass(eq=False, repr=False)
class DataGeneratorCounterConfig(betterproto.Message):
    enabled: int = betterproto.int32_field(1)
    clk_div: int = betterproto.int32_field(2)


@dataclass(eq=False, repr=False)
class I2CTimingConfig(betterproto.Message):
    """
    Timing configurations for I2C controller to emit the its signals.

     If the optional is set, then we will try to apply the specified value
     every time we configure the I2C controller.
    """

    high: Optional[int] = betterproto.int32_field(2, optional=True)
    """
    HIGH period of the SCL clock
     Symbol: tHIGH
    """

    start_setup_time: Optional[int] = betterproto.int32_field(3, optional=True)
    """
    setup-time for a repeated START condition
     Symbol: tSU;STA
    """

    start_hold_time: Optional[int] = betterproto.int32_field(4, optional=True)
    """
    hold-time for a (repeated) START condition
     Symbol: tHD;STA
    """

    data_setup_time: Optional[int] = betterproto.int32_field(5, optional=True)
    """
    data setup-time
     Symbol: tSU;DAT
    """

    data_hold_time: Optional[int] = betterproto.int32_field(6, optional=True)
    """
    data hold-time
     Symbol: tHOLD;DAT
    """

    stop_setup_time: Optional[int] = betterproto.int32_field(7, optional=True)
    """
    setup-time for a STOP condition
     Symbol: tSU;STO
    """


@dataclass(eq=False, repr=False)
class I2CControllerConfig(betterproto.Message):
    enabled: int = betterproto.int32_field(1)
    timing: Optional["I2CTimingConfig"] = betterproto.message_field(2, optional=True)
    """
    Timing configuration for the I2C controller
     If the optional is value is not set, it will fallback to the default timing configuration.
    """


@dataclass(eq=False, repr=False)
class I3CControllerMsgAdvancedTimingConfig(betterproto.Message):
    bit_0_low: int = betterproto.int32_field(1)
    bit_0_high: int = betterproto.int32_field(2)
    bit_1_low: int = betterproto.int32_field(3)
    bit_1_high: int = betterproto.int32_field(4)
    bit_2_low: int = betterproto.int32_field(5)
    bit_2_high: int = betterproto.int32_field(6)
    bit_3_low: int = betterproto.int32_field(7)
    bit_3_high: int = betterproto.int32_field(8)
    bit_4_low: int = betterproto.int32_field(9)
    bit_4_high: int = betterproto.int32_field(10)
    bit_5_low: int = betterproto.int32_field(11)
    bit_5_high: int = betterproto.int32_field(12)
    bit_6_low: int = betterproto.int32_field(13)
    bit_6_high: int = betterproto.int32_field(14)
    bit_7_low: int = betterproto.int32_field(15)
    bit_7_high: int = betterproto.int32_field(16)
    tbit_low: int = betterproto.int32_field(17)
    tbit_high: int = betterproto.int32_field(18)


@dataclass(eq=False, repr=False)
class I3CControllerMsgSimpleTimingConfig(betterproto.Message):
    low: int = betterproto.int32_field(1)
    high: int = betterproto.int32_field(2)


@dataclass(eq=False, repr=False)
class I3CControllerMsgTimingConfig(betterproto.Message):
    """
    Timing configurations for I3C controller to emit the its signals.

     Simple mode configuration high time and low time with the same value.
     Advanced mode configuration each bit of the timing with its own value.
    """

    simple: "I3CControllerMsgSimpleTimingConfig" = betterproto.message_field(
        2, group="timing_config"
    )
    advanced: "I3CControllerMsgAdvancedTimingConfig" = betterproto.message_field(
        3, group="timing_config"
    )


@dataclass(eq=False, repr=False)
class I3CControllerTimingConfig(betterproto.Message):
    pp_header_timing: "I3CControllerMsgTimingConfig" = betterproto.message_field(1)
    op_header_timing: "I3CControllerMsgTimingConfig" = betterproto.message_field(2)
    ods_header_timing: "I3CControllerMsgTimingConfig" = betterproto.message_field(3)
    odf_header_timing: "I3CControllerMsgTimingConfig" = betterproto.message_field(4)
    i3_c_rd_timing: "I3CControllerMsgTimingConfig" = betterproto.message_field(5)
    i3_c_wr_timing: "I3CControllerMsgTimingConfig" = betterproto.message_field(6)
    i3_c_odr8_timing: "I3CControllerMsgTimingConfig" = betterproto.message_field(7)
    i3_c_t_cas: int = betterproto.int32_field(10)
    i3_c_t_ca_sr: int = betterproto.int32_field(11)
    i3_c_t_cb_sr: int = betterproto.int32_field(12)
    i3_c_t_cbp: int = betterproto.int32_field(13)
    i2_c_low: int = betterproto.int32_field(20)
    i2_c_high: int = betterproto.int32_field(21)

    def __post_init__(self) -> None:
        super().__post_init__()
        if self.is_set("i2_c_low"):
            warnings.warn(
                "I3CControllerTimingConfig.i2_c_low is deprecated", DeprecationWarning
            )
        if self.is_set("i2_c_high"):
            warnings.warn(
                "I3CControllerTimingConfig.i2_c_high is deprecated", DeprecationWarning
            )


@dataclass(eq=False, repr=False)
class I3CControllerDynamicAssignmentEntry(betterproto.Message):
    id_mask: int = betterproto.uint64_field(1)
    id_value: int = betterproto.uint64_field(2)
    requested_address: int = betterproto.uint32_field(3)


@dataclass(eq=False, repr=False)
class I3CControllerDynamicAssignmentTable(betterproto.Message):
    reserved_addr_mask_l: int = betterproto.uint64_field(2)
    """A bit mask of the 7-bit address space that is reserved."""

    entries: List["I3CControllerDynamicAssignmentEntry"] = betterproto.message_field(3)
    """
    A list of preconfigured request address that user can configure.
     For example, if we desire to allocate address with Acute's Manufacture ID
     (0x0495) to 0x12, we can add an entry with
    
     `id_mask`           = 0x0000FFFE00000000
     `id_value`          = 0x0000092A00000000
     `requested_address` = 0x12
    """

    used_addr_mask_l: int = betterproto.uint64_field(4)
    used_addr_mask_h: int = betterproto.uint64_field(5)


@dataclass(eq=False, repr=False)
class I3CControllerConfig(betterproto.Message):
    """I3C Controller Configuration"""

    enabled: int = betterproto.int32_field(2)
    timing: "I3CControllerTimingConfig" = betterproto.message_field(3)
    """Timing configurations I3C controllers to emit the its signals."""

    i2_c_timing: Optional["I2CTimingConfig"] = betterproto.message_field(
        4, optional=True
    )
    dyn_addr_table: "I3CControllerDynamicAssignmentTable" = betterproto.message_field(5)
    """
    A preconfigured dynamic address table used in DAA process. For example,
     user can configure which addresses can be allocated to targets.
    """

    receive_ibi_data_amount: Optional[int] = betterproto.int32_field(6, optional=True)
    """
    The maximum amount of IBI data to receive. If not given, the default value
     is 255.
    """


@dataclass(eq=False, repr=False)
class SpiTempTimingConfiguration(betterproto.Message):
    spi_sleep_high_pre: int = betterproto.int32_field(1)
    spi_sleep_high_post: int = betterproto.int32_field(2)
    spi_sleep_low_pre: int = betterproto.int32_field(3)
    spi_sleep_low_post: int = betterproto.int32_field(4)


@dataclass(eq=False, repr=False)
class SpiControllerConfig(betterproto.Message):
    enabled: int = betterproto.int32_field(1)
    temp_timing: "SpiTempTimingConfiguration" = betterproto.message_field(99)


@dataclass(eq=False, repr=False)
class UartConfig(betterproto.Message):
    """UART handle configuration"""

    baud_rate: int = betterproto.uint32_field(1)
    data_bits: int = betterproto.int32_field(2)
    stop_bits: int = betterproto.int32_field(3)
    enabled: int = betterproto.int32_field(4)
    parity: "UartConfigParityMode" = betterproto.enum_field(5)


@dataclass(eq=False, repr=False)
class PxControllerDevice(betterproto.Message):
    id: int = betterproto.uint32_field(1)
    """
    Device ID, will be assigned by the system when the device is created and
     attached to the bus.
    """

    name: Optional[str] = betterproto.string_field(2, optional=True)
    """Alias name for the device."""

    data_generator_counter: "DataGeneratorCounterConfig" = betterproto.message_field(
        512, group="config"
    )
    """Data Generator Devices."""

    uart_tx: "UartConfig" = betterproto.message_field(768, group="config")
    """UART Devices."""

    i2_c_controller: "I2CControllerConfig" = betterproto.message_field(
        1024, group="config"
    )
    """I2C Controller Devices."""

    i3_c_controller: "I3CControllerConfig" = betterproto.message_field(
        1280, group="config"
    )
    """I3C Controller Devices."""

    spi_controller: "SpiControllerConfig" = betterproto.message_field(
        1536, group="config"
    )
    """SPI Controller Deivces"""


@dataclass(eq=False, repr=False)
class I2CControllerState(betterproto.Message):
    pass


@dataclass(eq=False, repr=False)
class I2C32BitRegisterTargetState(betterproto.Message):
    """
    I2C 32-bit register target state.

     This provides a snapshot of the current state of the I2C 32-bit register target.

     This state is part of `PxTargetDevice` state. See also `px_target_device.proto`
     for more details.
    """

    reg_value: int = betterproto.uint32_field(1)
    """The current value of the 32-bit register."""


@dataclass(eq=False, repr=False)
class I3CControllerState(betterproto.Message):
    assigned_addresses_l: int = betterproto.uint64_field(1)
    entdaa_id_list: List[int] = betterproto.uint64_field(2)
    """addr => pid list (always 64 elements in length)"""


@dataclass(eq=False, repr=False)
class I3C32BitRegisterTargetState(betterproto.Message):
    """
    I3C 32-bit register target state.

     This provides a snapshot of the current state of the I3C 32-bit register target.

     This state is part of `PxTargetDevice` state. See also `px_target_device.proto`
     for more details.
    """

    assigned_address: int = betterproto.uint32_field(1)
    """
    The assigned dynamic address of the target when the controller does
     Dynamic Address Assignment (DAA).
    """

    reg_value: int = betterproto.uint32_field(2)
    """The current value of the 32-bit register."""

    event_state: int = betterproto.uint32_field(3)
    """
    Event status of an I3C target. This will be related to CCCs such as
     ENEC, DISEC. It can be used to determine if the target is allowed to
     perform any interupts (e.g. IBI, Hot-Join).
    """

    mwl: int = betterproto.uint32_field(5)
    """The current minimum write/read length of the target."""

    mrl: int = betterproto.uint32_field(6)
    group_address: List[int] = betterproto.uint32_field(7)
    """The current group addresses assigned to the target."""


@dataclass(eq=False, repr=False)
class SpiControllerState(betterproto.Message):
    pass


@dataclass(eq=False, repr=False)
class Spi32BitRegisterTargetState(betterproto.Message):
    reg_value: int = betterproto.uint32_field(1)
    """The current value of the 32-bit register"""


@dataclass(eq=False, repr=False)
class PxDeviceState(betterproto.Message):
    i2_c_controller_state: "I2CControllerState" = betterproto.message_field(
        1024, group="state"
    )
    """I2C"""

    i2_c_32_bit_reg_target: "I2C32BitRegisterTargetState" = betterproto.message_field(
        1056, group="state"
    )
    i3_c_controller: "I3CControllerState" = betterproto.message_field(
        1280, group="state"
    )
    """I3C"""

    i3_c_32_bit_reg_target: "I3C32BitRegisterTargetState" = betterproto.message_field(
        1312, group="state"
    )
    spi_controller_state: "SpiControllerState" = betterproto.message_field(
        1536, group="state"
    )
    """SPI"""

    spi_32_bit_reg_target: "Spi32BitRegisterTargetState" = betterproto.message_field(
        1568, group="state"
    )


@dataclass(eq=False, repr=False)
class I2CWriteTransaction(betterproto.Message):
    address: int = betterproto.uint32_field(1)
    data: bytes = betterproto.bytes_field(2)
    is_ack: int = betterproto.int32_field(3)
    bytes_written: int = betterproto.int32_field(4)


@dataclass(eq=False, repr=False)
class I2CReadTransaction(betterproto.Message):
    address: int = betterproto.uint32_field(1)
    count: int = betterproto.uint32_field(2)
    data: bytes = betterproto.bytes_field(3)
    """Send empty, will return with data"""

    is_ack: int = betterproto.int32_field(4)


@dataclass(eq=False, repr=False)
class I2CTransaction(betterproto.Message):
    i2_c_read: "I2CReadTransaction" = betterproto.message_field(1, group="transaction")
    i2_c_write: "I2CWriteTransaction" = betterproto.message_field(
        2, group="transaction"
    )


@dataclass(eq=False, repr=False)
class I2CSendTransaction(betterproto.Message):
    transactions: List["I2CTransaction"] = betterproto.message_field(1)


@dataclass(eq=False, repr=False)
class I3CPrivateWriteTransaction(betterproto.Message):
    address: int = betterproto.uint32_field(1)
    """Address of the target device"""

    is_ack: int = betterproto.int32_field(6)
    """
    (Left empty) It will be filled after the transaction is sent whether
     the controller ACK's the transaction.
    """

    data: bytes = betterproto.bytes_field(2)
    """Data to be sent."""

    parity: Optional[bytes] = betterproto.bytes_field(3, optional=True)
    """
    Parity value of the data.
     `parity` is not required if `parity_mode` is ALL_CORRECT or ALL_INCORRECT.
    """

    parity_mode: "I3CParityMode" = betterproto.enum_field(4)
    with_broadcast_hdr: bool = betterproto.bool_field(5)
    """Whether to use broadcast 7h'7E header."""


@dataclass(eq=False, repr=False)
class I3CPrivateReadTransaction(betterproto.Message):
    address: int = betterproto.uint32_field(1)
    """Address of the target device"""

    is_ack: int = betterproto.int32_field(5)
    """
    (Left empty) It will be filled after the transaction is sent whether
     the controller ACK's the transaction.
    """

    count: int = betterproto.uint32_field(2)
    """Number of bytes to read."""

    data: bytes = betterproto.bytes_field(3)
    """
    (Left empty) It will be filled after the transaction is sent with the data
     read from the target device.
    """

    with_broadcast_hdr: bool = betterproto.bool_field(4)
    """Whether to use broadcast 7h'7E header."""


@dataclass(eq=False, repr=False)
class I3CBroadcastCccTransaction(betterproto.Message):
    ccc: "I3CCommonCommandCode" = betterproto.enum_field(1)
    """Common Command Code. See also `i3c_ccc_enum.proto` for more details."""

    ccc_parity: Optional[int] = betterproto.uint32_field(2, optional=True)
    """
    Parity value of the data
     `ccc_parity` is not required if `ccc_parity_mode` is ALL_CORRECT or ALL_INCORRECT.
    """

    ccc_parity_mode: "I3CParityMode" = betterproto.enum_field(3)
    data: bytes = betterproto.bytes_field(4)
    """Data to be sent."""

    parity: Optional[bytes] = betterproto.bytes_field(5, optional=True)
    """
    Parity value of the data.
     `parity` is not required if `parity_mode` is ALL_CORRECT or ALL_INCORRECT.
    """

    parity_mode: "I3CParityMode" = betterproto.enum_field(6)


@dataclass(eq=False, repr=False)
class I3CDirectCccTransaction(betterproto.Message):
    ccc: "I3CCommonCommandCode" = betterproto.enum_field(1)
    """Common Command Code. See also `i3c_ccc_enum.proto` for more details."""

    ccc_parity: Optional[int] = betterproto.uint32_field(2, optional=True)
    """
    Parity value of the data
     `ccc_parity` is not required if `ccc_parity_mode` is ALL_CORRECT or ALL_INCORRECT.
    """

    ccc_parity_mode: "I3CParityMode" = betterproto.enum_field(3)
    defining_byte: Optional[int] = betterproto.uint32_field(4, optional=True)
    """Defining Byte"""

    defining_byte_parity: Optional[int] = betterproto.uint32_field(7, optional=True)
    """
    Parity value of the defining byte data.
     `defining_byte_parity` is not required if `defining_byte_parity_mode` is ALL_CORRECT or ALL_INCORRECT.
    """

    defining_byte_parity_mode: Optional["I3CParityMode"] = betterproto.enum_field(
        8, optional=True
    )
    write_ops: List["I3CPrivateWriteTransaction"] = betterproto.message_field(5)
    """Read and Write Operations after Repeated Start."""

    read_ops: List["I3CPrivateReadTransaction"] = betterproto.message_field(6)


@dataclass(eq=False, repr=False)
class I3CHdrDdrWriteTransaction(betterproto.Message):
    address: int = betterproto.uint32_field(1)
    """Address of the target device"""

    is_ack: int = betterproto.int32_field(6)
    """
    (Left empty) It will be filled after the transaction is sent whether
     the controller ACK's the transaction.
    """

    command: int = betterproto.uint32_field(2)
    """Write command (lower 7 bits are used, bit[7] is always set to 0)"""

    data: bytes = betterproto.bytes_field(3)
    """Data to be sent."""

    parity: Optional[bytes] = betterproto.bytes_field(4, optional=True)
    """
    Parity value of the data.
     `parity` is not required if `parity_mode` is ALL_CORRECT or ALL_INCORRECT.
    """

    parity_mode: "I3CParityMode" = betterproto.enum_field(5)
    crc5: Optional[int] = betterproto.uint32_field(7, optional=True)
    """
    If not provided, the CRC5 will be calculated internally with a correct value.
    """

    force: Optional[bool] = betterproto.bool_field(8, optional=True)
    """
    The I3C v1.0 spec did not define how a Target should NACK a DDR Write Command, hence
     HDR-DDR Write should begin with controller sending 2'b10 preamble value, instead of reading ACK/NAK from the
     Target. To accommodate this, set the `force` flag to true to force the controller to send the pattern of 2'b10.
    
     In newer specs however, there is a flow control mechanism for the addressed Target to NACK,
     resulting in 2'b11 preamble value after the Target NACKed.
     This time, the controller should send 2'b1z preamble, and treat 2'b10 as ACK, 2'b11 as NACK after the Target
     responded.
    
     In most cases, this `force` flag can be unset or set to false (to use ACK/NAK handling from newer specs).
    """


@dataclass(eq=False, repr=False)
class I3CHdrDdrReadTransaction(betterproto.Message):
    address: int = betterproto.uint32_field(1)
    """Address of the target device"""

    is_ack: int = betterproto.int32_field(6)
    """
    (Left empty) It will be filled after the transaction is sent whether
     the controller ACK's the transaction.
    """

    command: int = betterproto.uint32_field(2)
    """Read command (lower 7 bits are used, bit[7] is always set to 1)"""

    count: int = betterproto.uint32_field(3)
    """Number of bytes to read."""

    data: bytes = betterproto.bytes_field(4)
    """
    (Left empty) It will be filled after the transaction is sent with the data
     read from the target device.
    """


@dataclass(eq=False, repr=False)
class I3CTransaction(betterproto.Message):
    priv_read: "I3CPrivateReadTransaction" = betterproto.message_field(
        1, group="transaction"
    )
    """SDR Transactions"""

    priv_write: "I3CPrivateWriteTransaction" = betterproto.message_field(
        2, group="transaction"
    )
    i2_c_read: "I2CReadTransaction" = betterproto.message_field(3, group="transaction")
    i2_c_write: "I2CWriteTransaction" = betterproto.message_field(
        4, group="transaction"
    )
    ccc_broadcast: "I3CBroadcastCccTransaction" = betterproto.message_field(
        5, group="transaction"
    )
    ccc_direct: "I3CDirectCccTransaction" = betterproto.message_field(
        6, group="transaction"
    )
    hdr_ddr_write: "I3CHdrDdrWriteTransaction" = betterproto.message_field(
        7, group="transaction"
    )
    """HDR-DDR Transactions"""

    hdr_ddr_read: "I3CHdrDdrReadTransaction" = betterproto.message_field(
        8, group="transaction"
    )


@dataclass(eq=False, repr=False)
class I3CSendTransaction(betterproto.Message):
    """
    A list of transactions to be sent from the primary controller.

     This message is used to send a list of transactions from the primary controller.
     The transactions will done in continuous frame between "START" and "STOP".

     Typically, I3C message shall stop the frame in a `PUSH_PULL` manner. On the other hand,
     I2C messages shall stop the frame using `OPEN_DRAIN`.
    """

    transactions: List["I3CTransaction"] = betterproto.message_field(2)
    stop_type: "I3CSendTransactionStopType" = betterproto.enum_field(3)


@dataclass(eq=False, repr=False)
class I3CInitBus(betterproto.Message):
    """I3C Init Bus Request."""

    pass


@dataclass(eq=False, repr=False)
class I3Cdaa(betterproto.Message):
    """
    I3C Reset DAA Request.
     This is identical to send a `I3CBroadcastCCCTransaction` with `ccc` set to
     `I3C_CCC_BROADCAST_ENTDAA`. This request is to perform DAA with ease.
    """

    pass


@dataclass(eq=False, repr=False)
class I3CResetDaa(betterproto.Message):
    """
    I3C Reset DAA Request.
     This is identical to send a `I3CBroadcastCCCTransaction` with `ccc` set to
     `I3C_CCC_BROADCAST_RSTDAA`. This request is to reset DAA with ease.
    """

    pass


@dataclass(eq=False, repr=False)
class I3CTargetIbi(betterproto.Message):
    ibi_type: "I3CTargetIbiType" = betterproto.enum_field(3)
    ibi_data: bytes = betterproto.bytes_field(4)


@dataclass(eq=False, repr=False)
class I3CTargetHotJoin(betterproto.Message):
    hotjoin_type: "I3CTargetHotJoinType" = betterproto.enum_field(3)


@dataclass(eq=False, repr=False)
class UartWriteData(betterproto.Message):
    """
    UART Tx write operation

     These operations are part of `PxDeviceOperation` configuration. See also
     `px_device_operation.proto` for more details.
    """

    data: List[int] = betterproto.uint32_field(1)
    with_parity_error: bool = betterproto.bool_field(2)
    """
    If `with_parity_error` is set to `true`, the parity error will be injected
     into the whole data frame.
    """


@dataclass(eq=False, repr=False)
class SpiTransaction(betterproto.Message):
    mode: int = betterproto.int32_field(1)
    write_data: bytes = betterproto.bytes_field(2)
    read_data: bytes = betterproto.bytes_field(3)
    dummy_count: int = betterproto.int32_field(4)
    dummy_val: int = betterproto.int32_field(5)
    should_rise_cs: bool = betterproto.bool_field(6)


@dataclass(eq=False, repr=False)
class SpiSendTransaction(betterproto.Message):
    transactions: List["SpiTransaction"] = betterproto.message_field(1)


@dataclass(eq=False, repr=False)
class PxDeviceOperation(betterproto.Message):
    px_device_get_state: "PxDeviceState" = betterproto.message_field(512, group="op")
    px_device_set_state: "PxDeviceState" = betterproto.message_field(513, group="op")
    uart_tx_write_data: "UartWriteData" = betterproto.message_field(784, group="op")
    """UART"""

    i2_c_controller_send_transaction: "I2CSendTransaction" = betterproto.message_field(
        1024, group="op"
    )
    """I2C"""

    i3_c_controller_init_bus: "I3CInitBus" = betterproto.message_field(1280, group="op")
    """I3C"""

    i3_c_controller_send_transaction: "I3CSendTransaction" = betterproto.message_field(
        1281, group="op"
    )
    i3_c_controller_do_daa: "I3Cdaa" = betterproto.message_field(1282, group="op")
    i3_c_controller_rst_daa: "I3CResetDaa" = betterproto.message_field(1283, group="op")
    i3_c_target_ibi: "I3CTargetIbi" = betterproto.message_field(1312, group="op")
    i3_c_target_hotjoin: "I3CTargetHotJoin" = betterproto.message_field(
        1313, group="op"
    )
    spi_controller_send_transaction: "SpiSendTransaction" = betterproto.message_field(
        1536, group="op"
    )
    """SPI"""


@dataclass(eq=False, repr=False)
class PxDeviceOperationRequest(betterproto.Message):
    """
    All devices' operations shall be sent by using this request message.
     A device can be identified by its device ID, and the index of the handle
     it is attached to.
    """

    handle_idx: int = betterproto.uint32_field(1)
    """The index of the handle it is attached to."""

    device_id: int = betterproto.uint32_field(2)
    """The device ID."""

    op: "PxDeviceOperation" = betterproto.message_field(3)
    """The operation to perform."""


@dataclass(eq=False, repr=False)
class I3CControllerRecvIbiData(betterproto.Message):
    """
    I3C Controller Received IBI Data Event

     This event is sent when an I3C controller receives an IBI request from an
     I3C target.
    """

    address: int = betterproto.uint32_field(1)
    is_ack: bool = betterproto.bool_field(2)
    data: bytes = betterproto.bytes_field(3)


@dataclass(eq=False, repr=False)
class I3CTargetAssignedAddress(betterproto.Message):
    """
    I3C Target Assigned Address Event

     This event is sent when an I3C target is assigned with an dynamic address
     by the controller during DAA process.
    """

    assigned_address: int = betterproto.uint32_field(1)


@dataclass(eq=False, repr=False)
class I3CTargetAssignedGroupAddress(betterproto.Message):
    """
    I3C Target Assigned Group Address Event

     This event is sent when an I3C target is assigned to a group with
     up to 3 group addresses.
    """

    assigned_group_address: List[int] = betterproto.uint32_field(1)


@dataclass(eq=False, repr=False)
class I3CTargetUpdatedEventState(betterproto.Message):
    """
    I3C Target Updated Event State Event

     This event is sent when an I3C target's event state is updated. It may be
     changed when controller sends ENEC / DISEC to the target.
    """

    event_state: int = betterproto.uint32_field(1)


@dataclass(eq=False, repr=False)
class UartRecvData(betterproto.Message):
    """
    UART Received Data Event

     This event is sent when an UART RX receives data.
    """

    data: List[int] = betterproto.uint32_field(1)
    has_parity_error: bool = betterproto.bool_field(2)
    """
    This indicates whether any parity error is detected in the whole data frame.
    """


@dataclass(eq=False, repr=False)
class PxDeviceEvent(betterproto.Message):
    device_id: int = betterproto.uint32_field(1)
    """Event ID = <event_msg_type>.<device_id>.<dev_event_type>"""

    uart_rx_data: "UartRecvData" = betterproto.message_field(
        768, group="dev_event_type"
    )
    i3_c_target_assigned_address: "I3CTargetAssignedAddress" = (
        betterproto.message_field(1280, group="dev_event_type")
    )
    i3_c_target_updated_event_state: "I3CTargetUpdatedEventState" = (
        betterproto.message_field(1281, group="dev_event_type")
    )
    i3_c_target_assigned_group_address: "I3CTargetAssignedGroupAddress" = (
        betterproto.message_field(1282, group="dev_event_type")
    )
    i3_c_controller_recv_ibi_data: "I3CControllerRecvIbiData" = (
        betterproto.message_field(1312, group="dev_event_type")
    )


@dataclass(eq=False, repr=False)
class PxGlobalEvent(betterproto.Message):
    pass


@dataclass(eq=False, repr=False)
class PxEventMsg(betterproto.Message):
    global_event: "PxGlobalEvent" = betterproto.message_field(1, group="event_msg_type")
    device_event: "PxDeviceEvent" = betterproto.message_field(2, group="event_msg_type")


@dataclass(eq=False, repr=False)
class I2C32BitRegisterTargetConfig(betterproto.Message):
    """
    I2C 32-bit register target configuration

     This configuration defines the behavior of an I2C target device that emulates
     a 32-bit register interface. The target can respond to I2C transactions with
     configurable sub-address handling strategies.

     This configuration is part of `PxTargetDevice` configuration. See also
     `px_target_device.proto` for more details.
    """

    address: int = betterproto.uint32_field(1)
    """I2C static address."""

    sub_address_type: "I2C32BitRegisterTargetConfigSubAddressType" = (
        betterproto.enum_field(2)
    )
    """Sub-address handling strategy from `SubAddressType`."""


@dataclass(eq=False, repr=False)
class I3C32BitRegisterTargetConfig(betterproto.Message):
    """
    I3C 32-bit register target configuration

     This configuration defines the behavior of an I3C target device that emulates
     a 32-bit register interface. The target can respond to I3C transactions with
     configurable sub-address handling strategies.

     This configuration is part of `PxTargetDevice` configuration. See also
     `px_target_device.proto` for more details.
    """

    id_value: int = betterproto.uint64_field(1)
    """
    This stores PID / BCR / DCR of the device, with a format of
     id_value[63:16]: PID
     id_value[15:8]: BCR
     id_value[7:0]: DCR
    """

    static_address: int = betterproto.uint32_field(2)
    """
    Static address of the i3c targets. If `static_address` is 0x00, it means
     that the target does not have a static address.
    """

    sub_address_type: "I3C32BitRegisterTargetConfigSubAddressType" = (
        betterproto.enum_field(3)
    )
    """Sub-address handling strategy from `SubAddressType`."""

    minimum_mwl: Optional[int] = betterproto.uint32_field(5, optional=True)
    """
    Configurable minimum write/read length of the target.
     If not given, it will default with 0x10.
    """

    minimum_mrl: Optional[int] = betterproto.uint32_field(6, optional=True)
    getcaps_std_value: Optional[bytes] = betterproto.bytes_field(16, optional=True)
    """GETCAPS CCC user-defined values"""

    getcaps_usr0_defining_byte: int = betterproto.uint32_field(18)
    getcaps_usr0_value: Optional[bytes] = betterproto.bytes_field(19, optional=True)
    getstatus_std_value: Optional[bytes] = betterproto.bytes_field(20, optional=True)
    """GETSTATUS CCC user-defined values"""

    getstatus_usr0_defining_byte: int = betterproto.uint32_field(21)
    getstatus_usr0_value: Optional[bytes] = betterproto.bytes_field(22, optional=True)
    getstatus_usr1_defining_byte: int = betterproto.uint32_field(23)
    getstatus_usr1_value: Optional[bytes] = betterproto.bytes_field(24, optional=True)
    getmxds_std_value: Optional[bytes] = betterproto.bytes_field(25, optional=True)
    """GETMXDS CCC user-defined values"""

    getmxds_usr0_defining_byte: int = betterproto.uint32_field(26)
    getmxds_usr0_value: Optional[bytes] = betterproto.bytes_field(27, optional=True)
    supported_group_address_count: int = betterproto.uint32_field(28)
    """
    The amount of group address the target can accept.
     Currently, we support up to 3 group addresses.
    """


@dataclass(eq=False, repr=False)
class I3CStressTestMultiTargetConfig(betterproto.Message):
    """
    I3C stress test multi-target configuration.

     This provides a configuration for the I3C stress test multi-target. It simulated
     `n_targets` of I3C 32-bit register targets at the same time to test if I3C
     controller can communicate with these targets correctly.

     This configuration is part of `PxTargetDevice` configuration. See also
     `px_target_device.proto` for more details.
    """

    n_targets: int = betterproto.uint32_field(1)
    """The number of targets to be simulated."""


@dataclass(eq=False, repr=False)
class Spi32BitRegisterTargetConfig(betterproto.Message):
    pass


@dataclass(eq=False, repr=False)
class PxTargetDevice(betterproto.Message):
    id: int = betterproto.uint32_field(1)
    """
    Device ID, will be assigned by the system when the device is created and
     attached to the bus.
    """

    name: Optional[str] = betterproto.string_field(2, optional=True)
    """Alias name for the device."""

    uart_rx: "UartConfig" = betterproto.message_field(800, group="config")
    """UART Devices."""

    i2_c_32_bit_reg_target: "I2C32BitRegisterTargetConfig" = betterproto.message_field(
        1056, group="config"
    )
    """I2C Target Devices."""

    i3_c_32_bit_reg_target: "I3C32BitRegisterTargetConfig" = betterproto.message_field(
        1312, group="config"
    )
    """I3C Target Devices."""

    i3_c_stress_test_multi_target: "I3CStressTestMultiTargetConfig" = (
        betterproto.message_field(1313, group="config")
    )
    spi_32_bit_reg_target: "Spi32BitRegisterTargetConfig" = betterproto.message_field(
        1568, group="config"
    )
    """SPI Target Devices."""


@dataclass(eq=False, repr=False)
class I2CChannel(betterproto.Message):
    scl: int = betterproto.int32_field(1)
    sda: int = betterproto.int32_field(2)


@dataclass(eq=False, repr=False)
class I3CChannel(betterproto.Message):
    """I3C handle channel configuration"""

    scl: int = betterproto.int32_field(1)
    sda_0: int = betterproto.int32_field(2)


@dataclass(eq=False, repr=False)
class UartChannel(betterproto.Message):
    """UART handle channel configuration"""

    tx: int = betterproto.int32_field(1)
    rx: int = betterproto.int32_field(2)


@dataclass(eq=False, repr=False)
class SpiChannel(betterproto.Message):
    clk: int = betterproto.int32_field(1)
    miso: int = betterproto.int32_field(2)
    mosi: int = betterproto.int32_field(3)
    cs: int = betterproto.int32_field(4)


@dataclass(eq=False, repr=False)
class DataGeneratorChannel(betterproto.Message):
    """Data Generator handle channel configuration"""

    ch0: Optional[int] = betterproto.int32_field(1, optional=True)
    ch1: Optional[int] = betterproto.int32_field(2, optional=True)
    ch2: Optional[int] = betterproto.int32_field(3, optional=True)
    ch3: Optional[int] = betterproto.int32_field(4, optional=True)
    ch4: Optional[int] = betterproto.int32_field(5, optional=True)
    ch5: Optional[int] = betterproto.int32_field(6, optional=True)
    ch6: Optional[int] = betterproto.int32_field(7, optional=True)
    ch7: Optional[int] = betterproto.int32_field(8, optional=True)


@dataclass(eq=False, repr=False)
class PxHandle(betterproto.Message):
    """
    A collection of all support bus handles definitions

     Each handle shall contain their channel configurations and the devices attached
     that are on the current handle. Devices are classified into either controller or
     target devices for simplicity, and make this configuration more extensible.
    """

    data_generator: "DataGeneratorChannel" = betterproto.message_field(
        512, group="protocol"
    )
    """Data Generator Handles."""

    uart: "UartChannel" = betterproto.message_field(768, group="protocol")
    """UART Handles."""

    i2_c: "I2CChannel" = betterproto.message_field(1024, group="protocol")
    """I2C Handles."""

    i3_c: "I3CChannel" = betterproto.message_field(1280, group="protocol")
    """I3C Handles."""

    spi: "SpiChannel" = betterproto.message_field(1536, group="protocol")
    """SPI Handles."""

    controllers: List["PxControllerDevice"] = betterproto.message_field(2)
    targets: List["PxTargetDevice"] = betterproto.message_field(5)


@dataclass(eq=False, repr=False)
class TopologyPxHandlesRequest(betterproto.Message):
    px_handles: List["PxHandle"] = betterproto.message_field(2)


@dataclass(eq=False, repr=False)
class TopologyPxHandleRequest(betterproto.Message):
    handle_idx: int = betterproto.uint32_field(1)
    px_handle: "PxHandle" = betterproto.message_field(2)


@dataclass(eq=False, repr=False)
class PxElectricalConfig(betterproto.Message):
    voltage: Optional[int] = betterproto.uint32_field(1, optional=True)
    la_threshold_voltage: Optional[int] = betterproto.uint32_field(2, optional=True)
    pullup_resistance: Optional[int] = betterproto.uint32_field(3, optional=True)
    pulldown_resistance: Optional[int] = betterproto.uint32_field(4, optional=True)
    bus_hold_enable: Optional[bool] = betterproto.bool_field(7, optional=True)
    la_hysteresis: Optional[int] = betterproto.uint32_field(8, optional=True)
    """LA hysteresis, 0 for LOW, 1 for HIGH, 0xFF for High-Z"""


@dataclass(eq=False, repr=False)
class PxElectricalConfigRequest(betterproto.Message):
    handle_idx: int = betterproto.uint32_field(1)
    config: "PxElectricalConfig" = betterproto.message_field(2)


@dataclass(eq=False, repr=False)
class PxPodIoElectricalConfig(betterproto.Message):
    io_port_flags: int = betterproto.uint64_field(1)
    """Bitmask of the io port, using PxPodIOPortFlags enum"""

    config: "PxElectricalConfig" = betterproto.message_field(2)


@dataclass(eq=False, repr=False)
class PxPodIoElectricalConfigRequest(betterproto.Message):
    config: "PxPodIoElectricalConfig" = betterproto.message_field(1)


@dataclass(eq=False, repr=False)
class PxPodIoElectricalConfigsRequest(betterproto.Message):
    configs: List["PxPodIoElectricalConfig"] = betterproto.message_field(1)


@dataclass(eq=False, repr=False)
class PxSystemClockInfoRequest(betterproto.Message):
    px_system_clock_period_ns: int = betterproto.uint32_field(1)


@dataclass(eq=False, repr=False)
class PxProtobufMsg(betterproto.Message):
    set_handle_request: "TopologyPxHandleRequest" = betterproto.message_field(
        516, group="msg"
    )
    """Topology Requests"""

    get_handle_request: "TopologyPxHandleRequest" = betterproto.message_field(
        517, group="msg"
    )
    set_handles_request: "TopologyPxHandlesRequest" = betterproto.message_field(
        518, group="msg"
    )
    get_handles_request: "TopologyPxHandlesRequest" = betterproto.message_field(
        519, group="msg"
    )
    get_system_clock_info: "PxSystemClockInfoRequest" = betterproto.message_field(
        520, group="msg"
    )
    set_electrical_config_request: "PxElectricalConfigRequest" = (
        betterproto.message_field(528, group="msg")
    )
    """PX Pod Ctrl Requests"""

    get_electrical_config_request: "PxElectricalConfigRequest" = (
        betterproto.message_field(529, group="msg")
    )
    set_pod_io_electrical_config_request: "PxPodIoElectricalConfigRequest" = (
        betterproto.message_field(530, group="msg")
    )
    get_pod_io_electrical_config_request: "PxPodIoElectricalConfigRequest" = (
        betterproto.message_field(531, group="msg")
    )
    set_pod_io_electrical_configs_request: "PxPodIoElectricalConfigsRequest" = (
        betterproto.message_field(532, group="msg")
    )
    get_pod_io_electrical_configs_request: "PxPodIoElectricalConfigsRequest" = (
        betterproto.message_field(533, group="msg")
    )
    px_device_operation: "PxDeviceOperationRequest" = betterproto.message_field(
        656, group="msg"
    )
    """PX Device Operations"""
