Public API functions for I3C driver. More...
Public API functions for I3C driver.
| INIT_CODE i3c_status_en i3c_init | ( | i3c_instance_en | id, |
| i3c_peripheral_mode_t | mode ) |
Initialize the I³C peripheral for the given instance (e.g., I3C0 for controller, I3C1 for target). This function must be called before any other I³C operations. It resets the peripheral to its default state and enables the interface clock.
| id | I³C Instance ID. |
| mode | Peripheral mode configuration (I³C or I²C). |
| INIT_CODE i3c_status_en i3c_deinit | ( | i3c_instance_en | id | ) |
Reset context structure and hardware registers to default state, disable interrupts, disable the I³C peripheral, and disable clock to I³C peripheral registers interface.
| id | I³C Instance ID. |
| i3c_status_en i3c_enable | ( | i3c_instance_en | id | ) |
Enable the I³C peripheral. After enabling, configuration cannot be changed, nor can the target address be changed until the block is disabled again.
| id | I³C Instance ID. |
| i3c_status_en i3c_disable | ( | i3c_instance_en | id | ) |
Disable the I³C peripheral. Masks and clears all interrupts.
| id | I³C Instance ID. |
| i3c_status_en i3c_controller_set_config | ( | i3c_instance_en | id, |
| i3c_controller_config_t * | cfg ) |
Configures the I³C peripheral for controller mode (formerly "master" mode). This includes:
| id | I³C instance identifier. |
| cfg | Pointer to the controller configuration structure. |
| i3c_status_en i3c_controller_set_policy_config | ( | i3c_instance_en | id, |
| const i3c_controller_policy_config_t * | cfg ) |
Configure controller behavior policy independent from hardware timing setup.
| id | I³C instance identifier. |
| cfg | Pointer to controller policy configuration. |
| i3c_status_en i3c_controller_set_interrupt_config | ( | i3c_instance_en | id, |
| const i3c_interrupt_config_t * | cfg ) |
Configure notification and interrupt policy for controller mode.
| id | I³C instance identifier. |
| cfg | Pointer to interrupt configuration. |
| i3c_status_en i3c_controller_config_hdr_mode | ( | i3c_instance_en | id, |
| const i3c_hdr_config_t * | cfg ) |
Explicitly enable/disable and configure HDR mode behavior.
| id | I³C instance identifier. |
| cfg | Pointer to HDR mode configuration. |
| i3c_status_en i3c_controller_perform_daa | ( | i3c_instance_en | id, |
| const i3c_device_config_t * | device_configs, | ||
| uint8_t | device_count, | ||
| i3c_device_t * | discovered_devices, | ||
| uint8_t * | discovered_count ) |
Performs Dynamic Address Assignment (DAA) for I³C devices on the bus. Resets existing dynamic addresses and assigns new ones using CCC commands. Discovered devices are always persisted in an internal controller device list.
| id | I³C instance identifier. |
| device_configs | Pointer to array of device configuration structures. |
| device_count | Number of devices in the device_configs array. |
| discovered_devices | Optional output array to copy discovered device descriptors. |
| discovered_count | Input: capacity of discovered_devices array. Output: number of descriptors filled (or internal discovered count if discovered_devices is NULL). |
| i3c_status_en i3c_controller_get_device_count | ( | i3c_instance_en | id, |
| uint8_t * | device_count ) |
Get number of devices currently cached in the internal controller device list.
| id | I³C instance identifier. |
| device_count | Pointer to receive device count. |
| i3c_status_en i3c_controller_get_device | ( | i3c_instance_en | id, |
| uint8_t | device_index, | ||
| i3c_device_t * | device ) |
Read one device descriptor from the internal controller device list.
| id | I³C instance identifier. |
| device_index | Internal device list index. |
| device | Pointer to receive device descriptor. |
| i3c_status_en i3c_controller_find_device_by_dynamic_addr | ( | i3c_instance_en | id, |
| uint8_t | dynamic_addr, | ||
| i3c_device_t * | device ) |
Find a device descriptor from internal controller list by dynamic address.
| id | I³C instance identifier. |
| dynamic_addr | Dynamic address to look up. |
| device | Pointer to receive matching device descriptor. |
| i3c_status_en i3c_controller_find_device_by_pid | ( | i3c_instance_en | id, |
| uint64_t | pid, | ||
| i3c_device_t * | device ) |
Find a device descriptor from internal controller list by PID value.
| id | I³C instance identifier. |
| pid | 48-bit provisional ID value to look up. |
| device | Pointer to receive matching device descriptor. |
| i3c_status_en i3c_controller_config_targets | ( | i3c_instance_en | id, |
| const i3c_device_config_t * | device_configs, | ||
| uint8_t | device_count ) |
Configures controller DAT entries (cache + hardware) without issuing any address-assignment CCC on the bus.
| id | I³C instance identifier. |
| device_configs | Pointer to array of device configuration structures. |
| device_count | Number of devices in the device_configs array. |
| i3c_status_en i3c_controller_send_ccc | ( | i3c_instance_en | id, |
| uint8_t | ccc_id, | ||
| i3c_ccc_type_en | ccc_type, | ||
| int8_t | dat_index, | ||
| uint8_t * | req_buffer, | ||
| uint16_t | req_length, | ||
| uint8_t * | resp_buffer, | ||
| uint16_t | resp_max_length, | ||
| uint16_t * | resp_length ) |
Sends a Common Command Code (CCC) to I³C devices on the bus.
| id | I³C instance identifier. |
| ccc_id | CCC command identifier (0x00-0x7F for broadcast, 0x80+ for direct). |
| ccc_type | CCC routing type (broadcast/direct). API validates ccc_id and route matching. |
| dat_index | Device Address Table index for direct CCCs. Ignored for broadcast CCC. |
HAL validation rules:
| req_buffer | Pointer to request payload buffer (NULL if no request payload). |
| req_length | Number of request payload bytes. |
| resp_buffer | Pointer to response payload destination buffer (NULL if response not required). |
| resp_max_length | Maximum response bytes allowed in resp_buffer. |
| resp_length | Pointer to receive actual response payload length. |
| i3c_status_en i3c_controller_ccc_response_get_count | ( | i3c_instance_en | id, |
| uint8_t * | count ) |
Get the number of pending entries in the CCC response queue.
| id | I3C instance identifier. |
| count | Pointer to a variable that will receive the number of pending CCC response entries currently available in the response queue. |
| i3c_status_en i3c_controller_ccc_response_read | ( | i3c_instance_en | id, |
| i3c_ccc_response_entry_t * | entry, | ||
| uint8_t * | payload_buffer, | ||
| uint16_t | payload_capacity ) |
Pop one entry from the CCC response queue and optionally copy the associated payload data.
If the response entry contains payload data and payload_buffer is not NULL, up to payload_capacity bytes will be copied into the buffer.
The actual payload length returned by the controller is stored in entry->payload_length.
| id | I3C instance identifier. |
| entry | Pointer to a structure that will receive metadata describing the CCC response entry (e.g. CCC ID, DAT index, status, payload length). |
| payload_buffer | Optional pointer to a buffer where the payload data will be copied. Can be NULL if the payload is not required. |
| payload_capacity | Size of the destination payload buffer in bytes. Ignored if payload_buffer is NULL. |
| i3c_status_en i3c_controller_ccc_response_peek | ( | i3c_instance_en | id, |
| i3c_ccc_response_entry_t * | entry ) |
Inspect the next CCC response queue entry without popping it.
| id | I3C instance identifier. |
| entry | Pointer to a structure that will receive metadata for the next response entry. |
| i3c_status_en i3c_controller_get_dat_entry | ( | i3c_instance_en | id, |
| uint8_t | dat_index, | ||
| i3c_dat_entry_t * | dat_entry ) |
Read a cached Device Address Table (DAT) entry by index.
| id | I³C instance identifier. |
| dat_index | DAT index to read. |
| dat_entry | Pointer to receive DAT entry contents. |
| i3c_status_en i3c_controller_set_target_device_by_addr | ( | i3c_instance_en | id, |
| uint8_t | static_addr, | ||
| i3c_xfer_speed_en | speed ) |
Sets the target I²C device for communication by using its static address.
| id | I³C instance identifier. |
| static_addr | Static address of the target device. |
| speed | Desired transfer speed (e.g., FM, FMP). |
static_addr. | i3c_status_en i3c_controller_set_target_device_by_dynamic_addr | ( | i3c_instance_en | id, |
| uint8_t | dynamic_addr, | ||
| i3c_xfer_speed_en | speed ) |
Sets the target I²C device for communication by using its dynamic address.
| id | I³C instance identifier. |
| dynamic_addr | Dynamic address of the target device. |
| speed | Desired transfer speed (e.g., FM, FMP). |
dynamic_addr. | i3c_status_en i3c_controller_set_target_device_by_id | ( | i3c_instance_en | id, |
| i3c_target_id_t | device_id, | ||
| i3c_xfer_speed_en | speed ) |
Sets the target I³C device for communication using its device ID.
| id | I³C instance identifier. |
| device_id | Device ID from the Device Address Table (DAT). |
| speed | Desired transfer speed (e.g., SDR, HDR). |
device_id. | i3c_status_en i3c_controller_abort | ( | i3c_instance_en | id | ) |
Abort an ongoing controller transfer. Issues STOP and clears FIFOs.
| id | I³C Instance ID. |
| i3c_transfer_status_en i3c_controller_get_transfer_status | ( | i3c_instance_en | id | ) |
Returns the status of the ongoing non-blocking read or write transfer.
| id | I³C Instance ID. |
| i3c_status_en i3c_clear_all_interrupts | ( | i3c_instance_en | id | ) |
Clears all interrupts.
| id | I³C Instance ID. |
| i3c_status_en i3c_controller_get_queue_status | ( | i3c_instance_en | id, |
| uint8_t * | cmd_queue_level, | ||
| uint8_t * | resp_queue_level, | ||
| uint8_t * | tx_fifo_level, | ||
| uint8_t * | rx_fifo_level ) |
Low-level queue/FIFO occupancy snapshot for debugging and advanced tuning.
| id | I³C Instance ID. |
| cmd_queue_level | Pointer to receive command queue occupancy. |
| resp_queue_level | Pointer to receive response queue occupancy. |
| tx_fifo_level | Pointer to receive TX FIFO occupancy. |
| rx_fifo_level | Pointer to receive RX FIFO occupancy. |
| i3c_status_en i3c_controller_peek_response_word | ( | i3c_instance_en | id, |
| uint32_t * | response_word ) |
Read one raw response queue word for low-level debugging.
| id | I³C Instance ID. |
| response_word | Pointer to receive raw response queue word. |
| i3c_status_en i3c_register_callback | ( | i3c_instance_en | id, |
| i3c_event_cb_t | cb, | ||
| void * | user_data ) |
Register a callback. A majority of I³C block logic is handled in the driver ISR. Notification filtering is configured by i3c_controller_set_interrupt_config.
| id | I³C Instance ID. |
| cb | User callback function. |
| user_data | User context passed back in callback. |
| i3c_status_en i3c_controller_write_blocking | ( | i3c_instance_en | id, |
| i3c_transfer_t * | xfer ) |
Performs a blocking write transfer as controller using descriptor-supplied target addressing and flags.
| id | I³C Instance ID. |
| xfer | Unified transfer descriptor. i3c_transfer_t::direction shall be I3C_TRANSFER_WRITE. i3c_transfer_t::size shall be <= I3C_MAX_TRANSFER_SIZE_BYTES. |
| i3c_status_en i3c_controller_read_blocking | ( | i3c_instance_en | id, |
| i3c_transfer_t * | xfer ) |
Performs a blocking read transfer as controller using descriptor-supplied target addressing and flags.
| id | I³C Instance ID. |
| xfer | Unified transfer descriptor. i3c_transfer_t::direction shall be I3C_TRANSFER_READ. i3c_transfer_t::size shall be <= I3C_MAX_TRANSFER_SIZE_BYTES. |
| i3c_status_en i3c_controller_write_non_blocking | ( | i3c_instance_en | id, |
| i3c_transfer_t * | xfer ) |
Start a non-blocking write as controller using descriptor-supplied target addressing and flags. This function loads the TX FIFO with data and configures the I³C interrupts to handle the rest of the transfer in the driver ISR.
The callback set in i3c_register_callback will be called when:
| id | I³C Instance ID. |
| xfer | Unified transfer descriptor. i3c_transfer_t::direction shall be I3C_TRANSFER_WRITE. |
| i3c_status_en i3c_controller_read_non_blocking | ( | i3c_instance_en | id, |
| i3c_transfer_t * | xfer ) |
Start a non-blocking read as controller using descriptor-supplied target addressing and flags. This function configures the I³C interrupts to handle the transfer in the driver ISR.
The callback set in i3c_register_callback will be called when:
| id | I³C Instance ID. |
| xfer | Unified transfer descriptor. i3c_transfer_t::direction shall be I3C_TRANSFER_READ. |
| i3c_status_en i3c_controller_enable_ibi | ( | i3c_instance_en | id, |
| i3c_ibi_config_t * | ibi_cfg ) |
Configures IBI handling for the target device selected using i3c_controller_set_target_device_by_addr or i3c_controller_set_target_device_by_id. Enables IBI and sets mandatory byte requirement. IBI payload (if present) is processed via the registered IBI handler.
| id | I³C Instance ID. |
| ibi_cfg | Pointer to IBI configuration structure. |
| i3c_status_en i3c_controller_read_ibi_data | ( | i3c_instance_en | id, |
| uint8_t * | buffer, | ||
| uint16_t * | data_length ) |
Read IBI data from controller buffer.
| id | I³C Instance ID. |
| buffer | Buffer to store IBI data. |
| data_length | Pointer to store data length. |
| i3c_status_en i3c_controller_config_hot_join | ( | i3c_instance_en | id, |
| bool | enable_hot_join ) |
Configure hot join functionality for controller.
| id | I³C Instance ID. |
| enable_hot_join | Enable or disable hot join. |
| i3c_status_en i3c_controller_process_hot_join_req | ( | i3c_instance_en | id | ) |
Process hot join request from target device.
| id | I³C Instance ID. |
| i3c_status_en i3c_controller_process_hot_join_and_enumerate | ( | i3c_instance_en | id, |
| i3c_device_t * | discovered_devices, | ||
| uint8_t * | discovered_count ) |
Process Hot-Join request and perform automatic enumeration helper flow.
| id | I³C Instance ID. |
| discovered_devices | Optional output array for newly discovered devices. |
| discovered_count | Input: output array capacity. Output: number of devices discovered. |
| i3c_status_en i3c_target_set_config | ( | i3c_instance_en | id, |
| i3c_target_config_t * | cfg ) |
Initializes the I³C target configuration such as static address, vendor ID, part ID, and max read/write length. Must be called before target enable. This information is used during DAA or SETDASA operations by the controller.
| id | I³C Instance ID. |
| cfg | Pointer to target device configuration structure. |
| i3c_status_en i3c_target_prep_controller_write | ( | i3c_instance_en | id, |
| uint8_t * | buf, | ||
| uint32_t | size ) |
Prepares the target to receive data from the controller by assigning the buffer where incoming data will be stored.
| id | I³C Instance ID. |
| buf | Pointer to buffer where the received data should be stored. |
| size | Size of the buffer in bytes. Must be <= I3C_MAX_TRANSFER_SIZE_BYTES. |
buf to 32-bit boundary when platform/FIFO access path requires word-aligned accesses.| i3c_status_en i3c_target_prep_controller_read | ( | i3c_instance_en | id, |
| uint8_t * | buf, | ||
| uint32_t | size ) |
Prepares the target with data to be sent when the controller initiates a read operation. The data in the buffer will be transmitted to the controller upon request.
| id | I³C Instance ID. |
| buf | Pointer to buffer containing data to send to the controller. |
| size | Number of bytes to send from the buffer. Must be <= I3C_MAX_TRANSFER_SIZE_BYTES. |
buf to 32-bit boundary when platform/FIFO access path requires word-aligned accesses.| i3c_status_en i3c_target_raise_ibi_sir | ( | i3c_instance_en | id, |
| i3c_sir_config_t * | xfer ) |
Used by an I³C target to raise an In-Band Interrupt (IBI) with SIR payload. The controller must have previously enabled IBI for this request to succeed. Data in the provided config will be transmitted as part of the IBI request.
| id | I³C Instance ID (in target mode). |
| xfer | Pointer to SIR transfer configuration structure. |
| i3c_status_en i3c_target_get_ibi_sir_response | ( | i3c_instance_en | id | ) |
Retrieves the response status of the previously sent IBI SIR by the target. This can indicate if the controller accepted or rejected the IBI request. Should be called after initiating an IBI using i3c_target_raise_ibi_sir. Useful for error recovery or retry logic in the target firmware.
| id | I³C Instance ID (in target mode). |
| i3c_status_en i3c_target_raise_master_request | ( | i3c_instance_en | id | ) |
Used by an I3C secondary controller (target mode) to generate a Master Request (MR) and request bus ownership from the active controller. Callback subscribers can observe I3C_EVENT_MR_RESPONSE to track result.
| id | I3C Instance ID (in target mode). |
| i3c_status_en i3c_target_get_master_request_response | ( | i3c_instance_en | id | ) |
Retrieves the response status of a previously raised Master Request (MR). Should be called after i3c_target_raise_master_request.
| id | I3C Instance ID (in target mode). |
| i3c_status_en i3c_target_config_hot_join | ( | i3c_instance_en | id, |
| bool | enable ) |
Configure hot join functionality for target device.
| id | I³C Instance ID. |
| enable | Enable or disable hot join. |