I3C FIFO 目標¶
PxI3CFifoTarget 模擬具有主機可存取 RX 與 TX FIFO 的 I3C 目標裝置。控制器在匯流排上寫入的資料進入 RX FIFO(以事件交給 Python);Python 將資料入列到 TX FIFO,供控制器在匯流排上讀取。
此目標也支援標準 I3C CCC 處理、Dynamic Address Assignment、IBI 與 Hot-Join。
TX FIFO 深度固定為 2 KB(扣除 8 位元組簿記開銷後為 2040 位元組),無法從 Python 設定。單次 enqueue 最多可傳送目前可用的 TX FIFO 容量。當匯流排讀取抽空 TX FIFO 時,sent 事件會回報從 TX FIFO 抽走的位元組數。
收到的資料以 receive 事件交給 Python,每個 receive 事件最多交付 1 KB。若傳輸大於 1 KB,會拆成多個事件。
功能¶
- 2 KB TX FIFO,支援主機端入列與封包化匯流排事件。
- CCC 處理,包含位址指派、MRL/MWL、GETCAPS、GETSTATUS、GETMXDS 與群組位址。
- 透過 CCC 啟用時支援 IBI 與 Hot-Join。
資料流¶
Controller WRITE → RX FIFO → fifo_target_recv events → Python
Python enqueue → TX FIFO → Controller READ
Controller READ → (drains TX FIFO) → fifo_target_sent events → Python
PxI3CFifoTarget
¶
PxI3CFifoTarget(
exerciser: AqProtocolExerciser,
*args,
pid: int | None = None,
bcr: int = 0,
dcr: int = 0,
config: I3CFifoTargetConfig | 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,
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 FIFO target.
Emulates an I3C target with host-accessible RX and TX FIFOs. Bytes written by
a controller on the bus are delivered to Python as packeted
fifo_target_recv events. Bytes enqueued from Python are presented on
subsequent bus reads; completed bus reads are reported as fifo_target_sent
events with the byte count drained in each transaction.
The target also supports standard I3C CCC handling, IBI, and Hot-Join like other I3C targets.
| CLASS | DESCRIPTION |
|---|---|
IbiType |
IBI type enumeration. |
HotJoinType |
Hot-Join type enumeration. |
| METHOD | DESCRIPTION |
|---|---|
add_event_handler |
Add an event handler to the current device instance. |
remove_event_handler |
Remove an event handler. |
get_event_handlers |
Retreive handlers registerd on this device. |
on_event |
Add an event handler to the instance by decorator. |
set_config |
Set the config of the target. |
detach_from_bus |
Detach the device from the bus. |
perform_operation |
Send an operation. |
attach_to_bus |
Attach the target to a bus. |
enqueue |
Enqueue bytes into the host-side TX FIFO. |
ibi_request |
Initiate an IBI request from the current target. |
send_hotjoin |
Initiate a Hot-Join request from the current target. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
available_events_map |
A reverse mapping of |
is_attached |
Check if the device is attached to a bus.
TYPE:
|
state |
Get the state of the device.
TYPE:
|
name |
Get the name of the device.
TYPE:
|
additional_data |
Get the opaque additional data blob associated with this device.
TYPE:
|
config |
Get the config of the device.
TYPE:
|
cts_op_name |
Get the name of CTS operation. Currently not available now.
TYPE:
|
static_address |
Static address of the I3C FIFO target.
TYPE:
|
assigned_address |
Get the assigned address of the target.
TYPE:
|
event_state |
Get the event state of the target.
TYPE:
|
group_addresses |
Get the group addresses assigned to the target. |
mrl |
Get the maximum read length of the target.
TYPE:
|
mwl |
Get the maximum write length of the target.
TYPE:
|
tx_capacity |
Get the capacity of the FIFO.
TYPE:
|
tx_fill |
Number of bytes currently in the TX FIFO.
TYPE:
|
total_read |
Total bytes read by the controller from the target since configuration.
TYPE:
|
total_written |
Total bytes written by the controller to the target since configuration.
TYPE:
|
available_events_map
¶
A reverse mapping of field_name_by_number, which uses field name as key.
additional_data
¶
additional_data: bytes
Get the opaque additional data blob associated with this device.
total_read
¶
total_read: int
Total bytes read by the controller from the target since configuration.
total_written
¶
total_written: int
Total bytes written by the controller to the target since configuration.
add_event_handler
¶
Add an event handler to the current device instance.
get_event_handlers
¶
Retreive handlers registerd on this device.
on_event
¶
Add an event handler to the instance by decorator.
detach_from_bus
¶
Detach the device from the bus.
The opposite of the attach_to_bus method.
perform_operation
¶
Send an operation.
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 |
|---|---|
|
The bus to attach the device to
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the device is already attached to a bus |
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.
send_hotjoin
¶
send_hotjoin(hotjoin_type: HotJoinType = IMMEDIATE) -> None
Initiate a Hot-Join request from the current target.