Skip to content

I3C 32-bit Register Target

The PxI3C32BitRegisterTarget class represents a generic I3C target. It supports standard I3C features like IBI, Hot-Join, and CCC handling, along with a register-based memory model.

Features

  • IBI Generation: Initiate In-Band Interrupts.
  • Hot-Join: Request to join the bus after initialization.
  • Configurable PID/BCR/DCR: Customize the device characteristics.

PxI3C32BitRegisterTarget

PxI3C32BitRegisterTarget(
    exerciser: AqProtocolExerciser,
    *args,
    pid: int | None = None,
    bcr: int = 0,
    dcr: int = 0,
    config: I3C32BitRegisterTargetConfig | None = None,
    static_addr: int = 0,
    minimum_mrl: int | None = None,
    minimum_mwl: int | None = None,
    getcaps_std_value: bytes | None = None,
    getcaps_usr_value: list[tuple[int, bytes]] | None = None,
    sub_address_type: SubAddressType = NONE,
    getstatus_std_value: bytes | None = None,
    getstatus_usr_value: list[tuple[int, bytes]] | None = None,
    getmxds_std_value: bytes | None = None,
    getmxds_usr_value: list[tuple[int, bytes]] | None = None,
    supported_group_address_count: int = 3,
    **kwargs
)

Bases: PxAbstractTarget

I3C Base Target Class.

PARAMETER DESCRIPTION

exerciser

The exerciser instance to use.

TYPE: AqProtocolExerciser

pid

The 48-bit Provisioned ID (PID) of the target. On a given I3C bus there should be no Provisioned ID collision, otherwise the discovery mechanism may fail. If not provided, a default PID will be generated with Acute's manufacturer ID and a random 32-bit vendor value.

TYPE: int | None DEFAULT: None

bcr

The 8-bit Bus Characteristic Register (BCR) of the target. This register describes the device bus related capabilities.

TYPE: int DEFAULT: 0

dcr

The 8-bit Device Characteristic Register (DCR) of the target. This register describes the functionalities provided by the device

TYPE: int DEFAULT: 0

static_addr

The static address of the target.

TYPE: int DEFAULT: 0

minimum_mrl

The minimum read length of the target.

TYPE: int | None DEFAULT: None

minimum_mwl

The minimum write length of the target.

TYPE: int | None DEFAULT: None

sub_address_type

The sub-address type of the target.

TYPE: SubAddressType DEFAULT: NONE

getcaps_std_value

The default value for GETCAPS.

TYPE: bytes | None DEFAULT: None

getcaps_usr_value

The defining bytes and the corresponding value for GETCAPS. format: [(defining byte, getcaps value)]

TYPE: list[tuple[int, bytes]] | None DEFAULT: None

getstatus_std_value

set the default value for GETSTATUS.

TYPE: bytes | None DEFAULT: None

getstatus_usr_value

set the defining bytes and the corresponding value for GETSTATUS. format: [(first defining byte, first status value), (second defining byte, second status value)]

TYPE: list[tuple[int, bytes]] | None DEFAULT: None

getmxds_std_value

set the default value for GETMXDS.

TYPE: bytes | None DEFAULT: None

getmxds_usr_value

set the default bytes and the corresponding value for GETMXDS. format: [(defining byte, mxds value)]

TYPE: list[tuple[int, bytes]] | None DEFAULT: None

supported_group_address_count

set the count of group address that the target can support.

TYPE: int DEFAULT: 3

config

The configuration of the device using protobuf structure.

TYPE: I3C32BitRegisterTargetConfig | None DEFAULT: None

*args

Additional arguments to pass to the device constructor.

DEFAULT: ()

**kwargs

Additional keyword arguments to pass to the device constructor.

DEFAULT: {}

CLASS DESCRIPTION
HotJoinType

IBI type enumeration.

IbiType

IBI type enumeration.

SubAddressType

Sub-address type enumeration.

METHOD DESCRIPTION
add_event_handler

Add an event handler to the current device instance.

attach_to_bus

Attach the target to a bus.

config

Set the config of the target.

detach_from_bus

Detach the device from the bus.

get_event_handlers

Retreive handlers registerd on this device.

ibi_request

Initiate an IBI request from the current target.

on_event

Add an event handler to the instance by decorator.

perform_operation

Send an operation.

remove_event_handler

Remove an event handler.

send_hotjoin

Initiate an Hot-join request from the current target.

ATTRIBUTE DESCRIPTION
assigned_address

Get the assigned address of the target.

TYPE: int

available_events_map

A reverse mapping of field_name_by_number, which uses field name as key.

TYPE: dict[str, str]

event_state

Get the event state of the target.

TYPE: int

group_addresses

Get the group addresses assigned to the target.

TYPE: list[int]

is_attached

Check if the device is attached to a bus.

TYPE: bool

mrl

Get the maximum read length of the target.

TYPE: int

mwl

Get the maximum write length of the target.

TYPE: int

name

Get the name of the device.

TYPE: str

register_value

Get the current register value of the target.

TYPE: int

state

Get the state of the device.

TYPE: Message | None

sub_address_type

Get the current register type of the target.

TYPE: SubAddressType

assigned_address

assigned_address: int

Get the assigned address of the target.

available_events_map

available_events_map: dict[str, str]

A reverse mapping of field_name_by_number, which uses field name as key.

event_state

event_state: int

Get the event state of the target.

group_addresses

group_addresses: list[int]

Get the group addresses assigned to the target.

is_attached

is_attached: bool

Check if the device is attached to a bus.

mrl

mrl: int

Get the maximum read length of the target.

mwl

mwl: int

Get the maximum write length of the target.

name

name: str

Get the name of the device.

register_value

register_value: int

Get the current register value of the target.

state

state: Message | None

Get the state of the device.

sub_address_type

sub_address_type: SubAddressType

Get the current register type of the target.

HotJoinType

Bases: IntEnum

IBI type enumeration.

This is intended to avoid exporting protobuf enum to the interface.

IbiType

Bases: IntEnum

IBI type enumeration.

This is intended to avoid exporting protobuf enum to the interface.

SubAddressType

Bases: IntEnum

Sub-address type enumeration.

This is intended to avoid exporting protobuf enum to the interface.

add_event_handler

add_event_handler(event: str, handler: Callable[[Any], Any]) -> None

Add an event handler to the current device instance.

attach_to_bus

attach_to_bus(bus: PxAbstractBus) -> None

Attach the target to a bus.

This method is used to make the device aware of the bus it is connected to. It is used to set the bus attribute of the device.

Note

This method will not automatically create an actual instance on the Protocol Exerciser until user call the attach_to_bus method.

PARAMETER DESCRIPTION

bus

The bus to attach the device to

TYPE: PxAbstractBus

RAISES DESCRIPTION
ValueError

If the device is already attached to a bus

config

config(config: Message) -> None

Set the config of the target.

detach_from_bus

detach_from_bus() -> None

Detach the device from the bus.

The opposite of the attach_to_bus method.

get_event_handlers

get_event_handlers() -> dict[str, Callable]

Retreive handlers registerd on this device.

ibi_request

ibi_request(
    ibi_type: IbiType = IMMEDIATE,
    mdb_value: bytes = b"",
    additional_data: bytes = b"",
    skip_bcr_check: bool = False,
) -> None

Initiate an IBI request from the current target.

PARAMETER DESCRIPTION

ibi_type

The type of IBI to request, either Immediate or Arbitrated.

TYPE: IbiType DEFAULT: IMMEDIATE

mdb_value

The mandatory data byte (MDB) value to send with the IBI.

TYPE: bytes DEFAULT: b''

additional_data

Additional data to send along with the IBI payload.

TYPE: bytes DEFAULT: b''

skip_bcr_check

If True, the BCR check will be dismissed and still proceed to send and IBI request.

TYPE: bool DEFAULT: False

RAISES DESCRIPTION
ValueError

It the current target BCR does not allow IBI.

ValueError

It the current target BCR does not allow IBI payload, but the caller still tries to send an IBI payload.

ValueError

If the mdb_value is empty but the additional_data is not.

on_event

on_event(event_type: str) -> Callable[[Callable[..., Any]], Callable[..., Any]]

Add an event handler to the instance by decorator.

perform_operation

perform_operation(operation: PxDeviceOperation) -> PxDeviceOperation

Send an operation.

remove_event_handler

remove_event_handler(event: str) -> None

Remove an event handler.

send_hotjoin

send_hotjoin(hotjoin_type: HotJoinType = IMMEDIATE) -> None

Initiate an Hot-join request from the current target.

PARAMETER DESCRIPTION

hotjoin_type

The type of Hot-join to request, either Immediate or Arbitrated.

TYPE: HotJoinType DEFAULT: IMMEDIATE