3.14 I3C Target Driver
Overview
The Improved Inter-Integrated Circuit (I3C) Target driver provides a complete implementation for operating the
dsPIC33AK I3C peripheral in Target (Slave) mode. The I3C interface, developed by the MIPI® Alliance, is a high-speed,
low-power, managed two-wire digital interface designed for sensor and device integration. It is backward compatible
with legacy I2C devices and adheres to the MIPI I3C® Basic Specification v1.1.1.
In Target mode, the device responds to transfers initiated by the Active Controller on the bus. The Target supports
dynamic address assignment, can request bus access via In-Band Interrupts (IBI), and can join an active bus via the
Hot-Join mechanism. Data transfers are DMA-assisted for efficient high-throughput operation without CPU intervention
during the data phase.
Features
- Two-wire serial interface supporting SDR speeds up to 12.5 MHz and HDR-DDR mode.
- I2C backward compatible (Target responds to I2C transfers when configured with a static address).
- Static address support for I2C/mixed-bus operation and dynamic address assignment via ENTDAA, SETDASA, or SETAASA.
- In-Band Interrupt (IBI/SIR) support with configurable Mandatory Data Byte and up to 4-byte payload.
- Hot-Join support with adaptive mode for safe operation on unknown bus types.
- DMA-based transmit and receive for transfers up to 756 bytes without CPU-managed byte loops.
- HDR-DDR (High Data Rate – Double Data Rate) private transfer support for increased throughput.
- Packet Error Check (PEC) with CRC-8 generation and validation on SDR transfers.
- Hardware-autonomous Common Command Code (CCC) handling with application notification on updates.
- Bus-Available and Bus-Idle condition detection with configurable idle count multiplier.
- SDA stuck bus recovery with hardware 100 µs timeout and automatic High-Z release.
- ECC protection on internal SRAM (FIFOs/queues) with single-bit correction and double-bit detection interrupts.
- Grouped addressing support for multicast CCC targeting.
-
Callback-driven architecture with 12 event callbacks (transaction complete, errors, IBI done, dynamic address, CCC
update, ECC errors, start detection, read request, underrun, overrun).
3.14.1 Module Documentation
3.14.1.1 I3C Target Driver
I3C Target Driver Interface for dsPIC MCUs.
3.14.1.1.1 Module description
I3C Target Driver Interface for dsPIC MCUs.
Data structures
struct I3C_TARGET_TRANSMIT_COMMAND
Transfer command register layout as a 64-bit (two-word) structure.
union I3C_TARGET_RESPONSE_DATA
Extended Response Data Structure Format 2 (Table 24-31).
struct I3C_TARGET_INTERFACE
Structure containing the function pointers of the I3C Target driver.
struct I3C_TARGET_TRANSACTION_COMPLETE_STATUS
Contains the status of the transaction complete operation.
struct I3C_TARGET_CCC_UPDATE_STATUS
Contains the status of which CCC fields were updated by the Active Controller. Read via CCCUpdateStatusGet() inside the CCCTableUpdatedCallback.
Enumerations
enum I3C_TARGET_HJ_STATUS { I3C_TARGET_HJ_COMPLETED_OR_NOT_STARTED = 0, I3C_TARGET_HJ_COMPLETED, I3C_TARGET_HJ_FAILED, I3C_TARGET_HJ_PENDING }
Defines the status of the Hot-Join operation.
enum I3C_TARGET_IBI_STATUS { I3C_TARGET_IBI_STATUS_NONE = 0, I3C_TARGET_IBI_STATUS_ACCEPTED = 1, I3C_TARGET_IBI_STATUS_EARLY_TERMINATE = 2, I3C_TARGET_IBI_STATUS_NOT_ATTEMPTED = 3 }
Defines the status codes for In-Band Interrupt operations.
enum I3C_TARGET_IBI_REQUEST_ERROR { I3C_TARGET_IBI_REQUEST_NO_ERROR, I3C_TARGET_IBI_REQUEST_SEND_BUFFER_SIZE_EXCEEDED, I3C_TARGET_IBI_REQUEST_NOT_IN_I3C_MODE, I3C_TARGET_IBI_REQUEST_IBI_DISABLED_ON_BUS }
Defines the error states of the In-Band Interrupt request operation.
enum I3C_TARGET_TRANSACTION_ERROR_STATUS { I3C_TARGET_TRANSACTION_NO_ERR = 0x0, I3C_TARGET_TRANSACTION_ERR_CRC = 0x1, I3C_TARGET_TRANSACTION_ERR_PARITY = 0x2, I3C_TARGET_TRANSACTION_ERR_FRAME = 0x3, I3C_TARGET_TRANSACTION_ERR_OVERFLOW = 0x6, I3C_TARGET_TRANSACTION_ERR_SDA_STUCK_RELEASE = 0x8, I3C_TARGET_TRANSACTION_ERR_CONTROLLER_EARLY_TERM = 0xA, I3C_TARGET_TRANSACTION_ERR_PEC = 0xC }
Defines the transaction error status codes.
enum I3C_TARGET_RX_CMD_SIZE { I3C_TARGET_RX_NO_COMMAND_WORD = 0x0, I3C_TARGET_RX_HDR_COMMAND_CODE_OR_CCC_CODE = 0x1, I3C_TARGET_RX_HDR_COMMAND_CODE_WITH_DEFINING_BYTE = 0x2, I3C_TARGET_RX_HDR_BULK_TRANSFER_COMMAND = 0x4 }
Defines the command word size in the RX FIFO prefix for received transfers. Indicates whether the first word in the RX buffer is data or an encoded command.
enum I3C_TARGET_BUFFER_RECEIVE_ERROR { I3C_TARGET_BUFFER_RECEIVE_NO_ERROR, I3C_TARGET_BUFFER_RECEIVE_BUFFER_SIZE_EXCEEDED, I3C_TARGET_BUFFER_RECEIVE_NULL_BUFFER, I3C_TARGET_BUFFER_RECEIVE_TRANSFER_IN_PROGRESS }
Defines the error status of the buffer receive operation.
enum I3C_TARGET_BUFFER_TRANSMIT_ERROR { I3C_TARGET_BUFFER_TRANSMIT_NO_ERROR, I3C_TARGET_BUFFER_TRANSMIT_BUFFER_SIZE_EXCEEDED, I3C_TARGET_BUFFER_TRANSMIT_NULL_BUFFER, I3C_TARGET_BUFFER_TRANSMIT_COMMAND_QUEUE_FULL }
Defines the error status of the buffer transmit operation.
enum I3C_TARGET_DATA_FLOW_DIRECTION { I3C_TARGET_DATA_TRANSMITTED, I3C_TARGET_DATA_RECEIVED }
Defines the data flow direction of an I3C transaction.
enum I3C_TARGET_ACTIVITY_STATE { I3C_TARGET_ACTIVITY_STATE_0 = 0, I3C_TARGET_ACTIVITY_STATE_1 = 1, I3C_TARGET_ACTIVITY_STATE_2 = 2, I3C_TARGET_ACTIVITY_STATE_3 = 3 }
Defines the activity state of the Target as set by the Controller via ENTAS0/ENTAS1/ENTAS2/ENTAS3 CCC commands.
Functions
void I3C1_Target_Initialize (void)
Initializes the I3C1 Target peripheral with default configuration.
void I3C1_Target_Deinitialize (void)
De-initializes the I3C1 Target peripheral. Disables DMA channels, interrupts, resets all queues/buffers/state machine, and powers off the module.
void I3C1_Target_Enable (void)
Enables the I3C1 Target peripheral.
uint8_t I3C1_Target_IsEnabled (void)
Checks whether the I3C1 Target peripheral is enabled.
bool I3C1_Target_IsDynamicAddressValid (void)
Checks whether the Dynamic Address has been assigned by the Controller.
void I3C1_Target_Disable (void)
Disables the I3C1 Target peripheral.
uint16_t I3C1_Target_MaxWriteLengthGet (void)
Returns the configured maximum write length.
void I3C1_Target_MaxWriteLengthSet (uint16_t maxWriteLen)
Sets the maximum write length.
uint16_t I3C1_Target_MaxReadLengthGet (void)
Returns the configured maximum read length.
void I3C1_Target_MaxReadLengthSet (uint16_t maxReadLen)
Sets the maximum read length.
void I3C1_Target_TxBufferFIFOClear (void)
Clears the I3C1 Target TX buffer FIFO.
void I3C1_Target_RxBufferFIFOClear (void)
Clears the I3C1 Target RX buffer FIFO.
void I3C1_Target_ResponseQueueClear (void)
Clears the I3C1 Target response queue.
void I3C1_Target_CommandQueueClear (void)
Clears the I3C1 Target command queue.
void I3C1_Target_PeripheralReset (void)
Resets the I3C1 Target peripheral using the SOFTRST core software reset bit.
void I3C1_Target_Resume (void)
Resumes the I3C1 Target peripheral after a halt condition.
void I3C1_Target_PECEnable (void)
Enables Packet Error Check (PEC) for SDR transfers. When enabled, the Target appends a CRC-8 byte to read/IBI transfers and validates the CRC-8 byte on write transfers.
void I3C1_Target_PECDisable (void)
Disables Packet Error Check (PEC) for SDR transfers. After calling this function, the Target will no longer append or validate CRC-8 bytes on SDR transfers.
enum I3C_TARGET_BUFFER_RECEIVE_ERROR I3C1_Target_BufferReceive (uint8_t *rxBuf, uint16_t len)
Configures the buffer for the next Private Write transaction to receive data. The status of the transaction can be checked using the transaction complete callback.
enum I3C_TARGET_BUFFER_TRANSMIT_ERROR I3C1_Target_BufferTransmit (uint8_t *txBuf, uint16_t len)
Configures the buffer for the next Private Read transaction to transmit data. The status of the transaction can be checked using the transaction complete callback.
void I3C1_Target_HDRCommandCodeSet (uint8_t hdrCmdCode)
Sets the HDR-DDR command code for the next BufferTransmit call. Default is 0x00 (SDR Private Read). For HDR-DDR transfers, set the appropriate HDR command code before calling BufferTransmit.
enum I3C_TARGET_HJ_STATUS I3C1_Target_HotJoinStatusGet (void)
Returns the current status of the Hot-Join operation.
void I3C1_Target_IBIMandatoryDataByteSet (uint8_t mdb)
Sets the Mandatory Data Byte (MDB) for IBI requests.
void I3C1_Target_IBIPayloadSizeSet (uint8_t size)
Sets the IBI payload size.
uint8_t I3C1_Target_IBIPayloadSizeGet (void)
Gets the current IBI payload size.
enum I3C_TARGET_IBI_REQUEST_ERROR I3C1_Target_IBIRequest (uint8_t *payloadBuf, uint16_t payloadLen)
Initiates an In-Band Interrupt (IBI/SIR) request on the I3C bus.
bool I3C1_Target_IsIBIEnabledOnBus (void)
Checks if the IBI capability is enabled on the bus.
void I3C1_Target_TransactionCompleteCallbackRegister (void(*callback)(struct I3C_TARGET_TRANSACTION_COMPLETE_STATUS *transactionCompleteStatus))
Registers a callback for the Transaction Complete event. The callback provides the data flow direction and total number of bytes transferred.
void I3C1_Target_TransactionErrorCallbackRegister (void(*handler)(enum I3C_TARGET_TRANSACTION_ERROR_STATUS transactionError))
Registers a callback for the Transaction Error event.
void I3C1_Target_IBIDoneCallbackRegister (void(*handler)(enum I3C_TARGET_IBI_STATUS ibiStatus))
Registers a callback for the IBI Done event.
void I3C1_Target_StartConditionDetectedCallbackRegister (void(*callback)(void))
Registers a callback for the Start Condition detection event.
void I3C1_Target_DynamicAddressAssignedCallbackRegister (void(*callback)(void))
Registers a callback for the Dynamic Address Assigned event.
void I3C1_Target_SingleBitECCErrorCallbackRegister (void(*callback)(void))
Registers a callback for the Single-Bit ECC Error (SERR) interrupt event.
void I3C1_Target_DoubleBitECCErrorCallbackRegister (void(*callback)(void))
Registers a callback for the Double-Bit ECC Error (DERR) interrupt event.
void I3C1_Target_CCCTableUpdatedCallbackRegister (void(*callback)(void))
Registers a callback for the CCC Table Updated event. Triggered when the Active Controller updates CCC-mapped registers (e.g. MWL, MRL) via a supported CCC command.
void I3C1_Target_CCCUpdateStatusGet (struct I3C_TARGET_CCC_UPDATE_STATUS *status)
Reads the current CCC update status from the I3CxTGTESTA register. Clears the sticky status bits (MWLSTA, MRLSTA) after reading. Call this inside the CCCTableUpdatedCallback to determine which CCC was received from the Active Controller.
void I3C1_Target_TransmitUnderrunCallbackRegister (void(*callback)(void))
Registers a callback for the Transmit Underrun event. Triggered when the Extended TX FIFO underflows during a Controller Read transfer.
void I3C1_Target_ReceiveOverrunCallbackRegister (void(*callback)(void))
Registers a callback for the Receive Overrun event. Triggered when the RX FIFO overflows during a Controller Write transfer.
void I3C1_Target_ReadRequestReceivedCallbackRegister (void(*callback)(void))
Registers a callback for the Read Request Received event. Triggered when the Controller issues a read request and the command queue is empty.
void I3C1_Target_TransactionCompleteCallback (struct I3C_TARGET_TRANSACTION_COMPLETE_STATUS *status)
Default weak callback for the Transaction Complete event. Override this function or register a custom callback using I3C1_Target_TransactionCompleteCallbackRegister.
void I3C1_Target_TransactionErrorCallback (enum I3C_TARGET_TRANSACTION_ERROR_STATUS error)
Default weak callback for the Transaction Error event. Override this function or register a custom callback using I3C1_Target_TransactionErrorCallbackRegister.
void I3C1_Target_IBIDoneCallback (enum I3C_TARGET_IBI_STATUS ibiStatus)
Default weak callback for the IBI Done event. Override this function or register a custom callback using I3C1_Target_IBIDoneCallbackRegister.
void I3C1_Target_StartConditionDetectedCallback (void)
Default weak callback for the Start Condition Detected event. Override this function or register a custom callback using I3C1_Target_StartConditionDetectedCallbackRegister.
void I3C1_Target_DynamicAddressAssignedCallback (void)
Default weak callback for the Dynamic Address Assigned event. Override this function or register a custom callback using I3C1_Target_DynamicAddressAssignedCallbackRegister.
void I3C1_Target_SingleBitECCErrorCallback (void)
Default weak callback for the Single-Bit ECC Error event. Override this function or register a custom callback using I3C1_Target_SingleBitECCErrorCallbackRegister.
void I3C1_Target_DoubleBitECCErrorCallback (void)
Default weak callback for the Double-Bit ECC Error event. Override this function or register a custom callback using I3C1_Target_DoubleBitECCErrorCallbackRegister.
void I3C1_Target_CCCTableUpdatedCallback (void)
Default weak callback for the CCC Table Updated event. Override this function or register a custom callback using I3C1_Target_CCCTableUpdatedCallbackRegister.
void I3C1_Target_TransmitUnderrunCallback (void)
Default weak callback for the Transmit Underrun event. Override this function or register a custom callback using I3C1_Target_TransmitUnderrunCallbackRegister.
void I3C1_Target_ReceiveOverrunCallback (void)
Default weak callback for the Receive Overrun event. Override this function or register a custom callback using I3C1_Target_ReceiveOverrunCallbackRegister.
void I3C1_Target_ReadRequestReceivedCallback (void)
Default weak callback for the Read Request Received event. Override this function or register a custom callback using I3C1_Target_ReadRequestReceivedCallbackRegister.
Variables
const struct I3C_TARGET_INTERFACE I3C1_Target
Structure object of type I3C_TARGET_INTERFACE with the custom name given by the user in the Melody Driver User interface. The default name e.g. I3C_TARGET can be changed via the 'Custom Name' field. Application-specific naming allows API portability across peripheral instances.
3.14.1.1.2 Function Documentation
I3C1_Target_BufferReceive()
enum I3C_TARGET_BUFFER_RECEIVE_ERROR I3C1_Target_BufferReceive (uint8_t * rxBuf, uint16_t len)
Configures the buffer for the next Private Write transaction to receive data. The status of the transaction can be checked using the transaction complete callback.
The rxBuf pointer must be 4-byte aligned for DMA word transfers. |
| in | rxBuf |
- Pointer to the buffer in which data needs to be received. |
Lifetime of the buffer must be maintained until data is received.
| in | len |
- Size of the buffer. |
Buffer size must be greater than the expected size of data received in the next Private Write transaction.
Status of the buffer receive operation as described in I3C_TARGET_BUFFER_RECEIVE_ERROR. |
I3C1_Target_BufferTransmit()
enum I3C_TARGET_BUFFER_TRANSMIT_ERROR I3C1_Target_BufferTransmit (uint8_t * txBuf, uint16_t len)
Configures the buffer for the next Private Read transaction to transmit data. The status of the transaction can be checked using the transaction complete callback.
Once the TX Command is programmed, it is valid for only one read transfer. The application must call this API again for the next read transfer after receiving the transaction complete callback for the previously programmed command.
The txBuf pointer must be 4-byte aligned for DMA word transfers. |
| in | txBuf |
- Pointer to the buffer from which data needs to be transmitted. |
Lifetime of the buffer must be maintained until data is transmitted.
| in | len |
- Number of data bytes to be transmitted. |
Status of the buffer transmit operation as described in I3C_TARGET_BUFFER_TRANSMIT_ERROR. |
I3C1_Target_CCCTableUpdatedCallback()
void I3C1_Target_CCCTableUpdatedCallback (void )
Default weak callback for the CCC Table Updated event. Override this function or register a custom callback using I3C1_Target_CCCTableUpdatedCallbackRegister.
| None. |
None. |
I3C1_Target_CCCTableUpdatedCallbackRegister()
void I3C1_Target_CCCTableUpdatedCallbackRegister (void(*)(void) callback)
Registers a callback for the CCC Table Updated event. Triggered when the Active Controller updates CCC-mapped registers (e.g. MWL, MRL) via a supported CCC command.
None. |
| in | callback |
- Function pointer to the callback, or NULL to deregister. |
None. |
I3C1_Target_CCCUpdateStatusGet()
void I3C1_Target_CCCUpdateStatusGet (struct I3C_TARGET_CCC_UPDATE_STATUS * status)
Reads the current CCC update status from the I3CxTGTESTA register. Clears the sticky status bits (MWLSTA, MRLSTA) after reading. Call this inside the CCCTableUpdatedCallback to determine which CCC was received from the Active Controller.
Called within or after the CCCTableUpdatedCallback. |
| out | status |
- Pointer to structure to fill with current CCC update info. |
None. |
I3C1_Target_CommandQueueClear()
void I3C1_Target_CommandQueueClear (void )
Clears the I3C1 Target command queue.
None. |
| None. |
None. |
I3C1_Target_Deinitialize()
void I3C1_Target_Deinitialize (void )
De-initializes the I3C1 Target peripheral. Disables DMA channels, interrupts, resets all queues/buffers/state machine, and powers off the module.
None. |
| None. |
None. |
I3C1_Target_Disable()
void I3C1_Target_Disable (void )
Disables the I3C1 Target peripheral.
After disabling, the Target will not respond to any bus activity. Re-enabling requires a new placeholder transfer from the Controller to provide SCL clocks before the Target becomes operational again.
None. |
| None. |
None. |
I3C1_Target_DoubleBitECCErrorCallback()
void I3C1_Target_DoubleBitECCErrorCallback (void )
Default weak callback for the Double-Bit ECC Error event. Override this function or register a custom callback using I3C1_Target_DoubleBitECCErrorCallbackRegister.
| None. |
None. |
I3C1_Target_DoubleBitECCErrorCallbackRegister()
void I3C1_Target_DoubleBitECCErrorCallbackRegister (void(*)(void) callback)
Registers a callback for the Double-Bit ECC Error (DERR) interrupt event.
None. |
| in | callback |
- Function pointer to the callback, or NULL to deregister. |
None. |
I3C1_Target_DynamicAddressAssignedCallback()
void I3C1_Target_DynamicAddressAssignedCallback (void )
Default weak callback for the Dynamic Address Assigned event. Override this function or register a custom callback using I3C1_Target_DynamicAddressAssignedCallbackRegister.
| None. |
None. |
I3C1_Target_DynamicAddressAssignedCallbackRegister()
void I3C1_Target_DynamicAddressAssignedCallbackRegister (void(*)(void) callback)
Registers a callback for the Dynamic Address Assigned event.
None. |
| in | callback |
- Function pointer to the callback, or NULL to deregister. |
None. |
I3C1_Target_Enable()
void I3C1_Target_Enable (void )
Enables the I3C1 Target peripheral.
In Target mode, I3C operation becomes active only after the Controller provides SCL clocks via a placeholder transfer (any transfer ending in STOP). The placeholder transfer is ignored by the Target. Once enabled, the module responds to bus transfers only after observing the Bus Available condition.
I3C1_Target_Initialize() must have been called. |
| None. |
None. |
I3C1_Target_HDRCommandCodeSet()
void I3C1_Target_HDRCommandCodeSet (uint8_t hdrCmdCode)
Sets the HDR-DDR command code for the next BufferTransmit call. Default is 0x00 (SDR Private Read). For HDR-DDR transfers, set the appropriate HDR command code before calling BufferTransmit.
To revert back to SDR mode after an HDR-DDR transfer, call this function with hdrCmdCode = 0x00 before the next BufferTransmit.
None. |
| in | hdrCmdCode |
- HDR-DDR command code. Use 0x00 for SDR Private Read. |
None. |
I3C1_Target_HotJoinStatusGet()
enum I3C_TARGET_HJ_STATUS I3C1_Target_HotJoinStatusGet (void )
Returns the current status of the Hot-Join operation.
None. |
| None. |
Hot-Join status as described in I3C_TARGET_HJ_STATUS. |
I3C1_Target_IBIDoneCallback()
void I3C1_Target_IBIDoneCallback (enum I3C_TARGET_IBI_STATUS ibiStatus)
Default weak callback for the IBI Done event. Override this function or register a custom callback using I3C1_Target_IBIDoneCallbackRegister.
| in | ibiStatus |
- The IBI completion status. |
None. |
I3C1_Target_IBIDoneCallbackRegister()
void I3C1_Target_IBIDoneCallbackRegister (void(*)(enum I3C_TARGET_IBI_STATUS ibiStatus) handler)
Registers a callback for the IBI Done event.
None. |
| in | handler |
- Function pointer to the handler, or NULL to deregister. |
None. |
I3C1_Target_IBIMandatoryDataByteSet()
void I3C1_Target_IBIMandatoryDataByteSet (uint8_t mdb)
Sets the Mandatory Data Byte (MDB) for IBI requests.
None. |
| in | mdb |
- Mandatory Data Byte value. |
None. |
I3C1_Target_IBIPayloadSizeGet()
uint8_t I3C1_Target_IBIPayloadSizeGet (void )
Gets the current IBI payload size.
None. |
| None. |
Current payload size in bytes. |
I3C1_Target_IBIPayloadSizeSet()
void I3C1_Target_IBIPayloadSizeSet (uint8_t size)
Sets the IBI payload size.
None. |
| in | size |
- Payload size in bytes (0-4). |
None. |
I3C1_Target_IBIRequest()
enum I3C_TARGET_IBI_REQUEST_ERROR I3C1_Target_IBIRequest (uint8_t * payloadBuf, uint16_t payloadLen)
Initiates an In-Band Interrupt (IBI/SIR) request on the I3C bus.
Dynamic Address must be assigned and IBI must be enabled. |
| in | payloadBuf |
- Pointer to payload data, or NULL for no payload. |
| in | payloadLen |
- Payload length in bytes (0 for no payload, max 4). |
Status of the IBI request as described in I3C_TARGET_IBI_REQUEST_ERROR. |
I3C1_Target_Initialize()
void I3C1_Target_Initialize (void )
Initializes the I3C1 Target peripheral with default configuration.
None. |
| None. |
None. |
I3C1_Target_IsDynamicAddressValid()
bool I3C1_Target_IsDynamicAddressValid (void )
Checks whether the Dynamic Address has been assigned by the Controller.
None. |
| None. |
| True |
- Dynamic Address is valid. |
| False |
- Dynamic Address is not yet assigned. |
I3C1_Target_IsEnabled()
uint8_t I3C1_Target_IsEnabled (void )
Checks whether the I3C1 Target peripheral is enabled.
None. |
| None. |
1 if enabled, 0 if disabled. |
I3C1_Target_IsIBIEnabledOnBus()
bool I3C1_Target_IsIBIEnabledOnBus (void )
Checks if the IBI capability is enabled on the bus.
None. |
| None. |
| True |
- IBI is enabled on the bus. |
| False |
- IBI is not enabled on the bus. |
I3C1_Target_MaxReadLengthGet()
uint16_t I3C1_Target_MaxReadLengthGet (void )
Returns the configured maximum read length.
None. |
| None. |
Maximum read length in bytes. |
I3C1_Target_MaxReadLengthSet()
void I3C1_Target_MaxReadLengthSet (uint16_t maxReadLen)
Sets the maximum read length.
None. |
| in | maxReadLen |
- Maximum read length in bytes. |
None. |
I3C1_Target_MaxWriteLengthGet()
uint16_t I3C1_Target_MaxWriteLengthGet (void )
Returns the configured maximum write length.
None. |
| None. |
Maximum write length in bytes. |
I3C1_Target_MaxWriteLengthSet()
void I3C1_Target_MaxWriteLengthSet (uint16_t maxWriteLen)
Sets the maximum write length.
None. |
| in | maxWriteLen |
- Maximum write length in bytes. |
None. |
I3C1_Target_PECDisable()
void I3C1_Target_PECDisable (void )
Disables Packet Error Check (PEC) for SDR transfers. After calling this function, the Target will no longer append or validate CRC-8 bytes on SDR transfers.
This is the counterpart to PECEnable().
None. |
| None. |
None. |
I3C1_Target_PECEnable()
void I3C1_Target_PECEnable (void )
Enables Packet Error Check (PEC) for SDR transfers. When enabled, the Target appends a CRC-8 byte to read/IBI transfers and validates the CRC-8 byte on write transfers.
PEC is applicable only for SDR CCC, IBI, and SDR private transfers. It has no effect on HDR-DDR mode transfers.
Should be enabled after receiving DEVCTRL CCC from the Controller. |
| None. |
None. |
I3C1_Target_PeripheralReset()
void I3C1_Target_PeripheralReset (void )
Resets the I3C1 Target peripheral using the SOFTRST core software reset bit.
None. |
| None. |
None. |
I3C1_Target_ReadRequestReceivedCallback()
void I3C1_Target_ReadRequestReceivedCallback (void )
Default weak callback for the Read Request Received event. Override this function or register a custom callback using I3C1_Target_ReadRequestReceivedCallbackRegister.
| None. |
None. |
I3C1_Target_ReadRequestReceivedCallbackRegister()
void I3C1_Target_ReadRequestReceivedCallbackRegister (void(*)(void) callback)
Registers a callback for the Read Request Received event. Triggered when the Controller issues a read request and the command queue is empty.
None. |
| in | callback |
- Function pointer to the callback, or NULL to deregister. |
None. |
I3C1_Target_ReceiveOverrunCallback()
void I3C1_Target_ReceiveOverrunCallback (void )
Default weak callback for the Receive Overrun event. Override this function or register a custom callback using I3C1_Target_ReceiveOverrunCallbackRegister.
| None. |
None. |
I3C1_Target_ReceiveOverrunCallbackRegister()
void I3C1_Target_ReceiveOverrunCallbackRegister (void(*)(void) callback)
Registers a callback for the Receive Overrun event. Triggered when the RX FIFO overflows during a Controller Write transfer.
None. |
| in | callback |
- Function pointer to the callback, or NULL to deregister. |
None. |
I3C1_Target_ResponseQueueClear()
void I3C1_Target_ResponseQueueClear (void )
Clears the I3C1 Target response queue.
None. |
| None. |
None. |
I3C1_Target_Resume()
void I3C1_Target_Resume (void )
Resumes the I3C1 Target peripheral after a halt condition.
None. |
| None. |
None. |
I3C1_Target_RxBufferFIFOClear()
void I3C1_Target_RxBufferFIFOClear (void )
Clears the I3C1 Target RX buffer FIFO.
None. |
| None. |
None. |
I3C1_Target_SingleBitECCErrorCallback()
void I3C1_Target_SingleBitECCErrorCallback (void )
Default weak callback for the Single-Bit ECC Error event. Override this function or register a custom callback using I3C1_Target_SingleBitECCErrorCallbackRegister.
| None. |
None. |
I3C1_Target_SingleBitECCErrorCallbackRegister()
void I3C1_Target_SingleBitECCErrorCallbackRegister (void(*)(void) callback)
Registers a callback for the Single-Bit ECC Error (SERR) interrupt event.
None. |
| in | callback |
- Function pointer to the callback, or NULL to deregister. |
None. |
I3C1_Target_StartConditionDetectedCallback()
void I3C1_Target_StartConditionDetectedCallback (void )
Default weak callback for the Start Condition Detected event. Override this function or register a custom callback using I3C1_Target_StartConditionDetectedCallbackRegister.
| None. |
None. |
I3C1_Target_StartConditionDetectedCallbackRegister()
void I3C1_Target_StartConditionDetectedCallbackRegister (void(*)(void) callback)
Registers a callback for the Start Condition detection event.
None. |
| in | callback |
- Function pointer to the callback, or NULL to deregister. |
None. |
I3C1_Target_TransactionCompleteCallback()
void I3C1_Target_TransactionCompleteCallback (struct I3C_TARGET_TRANSACTION_COMPLETE_STATUS * status)
Default weak callback for the Transaction Complete event. Override this function or register a custom callback using I3C1_Target_TransactionCompleteCallbackRegister.
| in | status |
- Pointer to the transaction complete status structure. |
None. |
I3C1_Target_TransactionCompleteCallbackRegister()
void I3C1_Target_TransactionCompleteCallbackRegister (void(*)(struct I3C_TARGET_TRANSACTION_COMPLETE_STATUS *transactionCompleteStatus) callback)
Registers a callback for the Transaction Complete event. The callback provides the data flow direction and total number of bytes transferred.
None. |
| in | callback |
- Function pointer to the handler, or NULL to deregister. |
None. |
I3C1_Target_TransactionErrorCallback()
void I3C1_Target_TransactionErrorCallback (enum I3C_TARGET_TRANSACTION_ERROR_STATUS error)
Default weak callback for the Transaction Error event. Override this function or register a custom callback using I3C1_Target_TransactionErrorCallbackRegister.
| in | error |
- The transaction error status. |
None. |
I3C1_Target_TransactionErrorCallbackRegister()
void I3C1_Target_TransactionErrorCallbackRegister (void(*)(enum I3C_TARGET_TRANSACTION_ERROR_STATUS transactionError) handler)
Registers a callback for the Transaction Error event.
None. |
| in | handler |
- Function pointer to the handler, or NULL to deregister. |
None. |
I3C1_Target_TransmitUnderrunCallback()
void I3C1_Target_TransmitUnderrunCallback (void )
Default weak callback for the Transmit Underrun event. Override this function or register a custom callback using I3C1_Target_TransmitUnderrunCallbackRegister.
| None. |
None. |
I3C1_Target_TransmitUnderrunCallbackRegister()
void I3C1_Target_TransmitUnderrunCallbackRegister (void(*)(void) callback)
Registers a callback for the Transmit Underrun event. Triggered when the Extended TX FIFO underflows during a Controller Read transfer.
None. |
| in | callback |
- Function pointer to the callback, or NULL to deregister. |
None. |
I3C1_Target_TxBufferFIFOClear()
void I3C1_Target_TxBufferFIFOClear (void )
Clears the I3C1 Target TX buffer FIFO.
None. |
| None. |
None. |
3.14.1.1.3 Enumeration Type Documentation
I3C_TARGET_ACTIVITY_STATE
enum I3C_TARGET_ACTIVITY_STATE
Defines the activity state of the Target as set by the Controller via ENTAS0/ENTAS1/ENTAS2/ENTAS3 CCC commands.
| I3C_TARGET_ACTIVITY_STATE_0 |
Normal activity (ENTAS0) |
| I3C_TARGET_ACTIVITY_STATE_1 |
Activity state 1 (ENTAS1) |
| I3C_TARGET_ACTIVITY_STATE_2 |
Activity state 2 (ENTAS2) |
| I3C_TARGET_ACTIVITY_STATE_3 |
Activity state 3 - lowest power (ENTAS3) |
I3C_TARGET_BUFFER_RECEIVE_ERROR
enum I3C_TARGET_BUFFER_RECEIVE_ERROR
Defines the error status of the buffer receive operation.
| I3C_TARGET_BUFFER_RECEIVE_NO_ERROR | |
| I3C_TARGET_BUFFER_RECEIVE_BUFFER_SIZE_EXCEEDED | |
| I3C_TARGET_BUFFER_RECEIVE_NULL_BUFFER | |
| I3C_TARGET_BUFFER_RECEIVE_TRANSFER_IN_PROGRESS |
I3C_TARGET_BUFFER_TRANSMIT_ERROR
enum I3C_TARGET_BUFFER_TRANSMIT_ERROR
Defines the error status of the buffer transmit operation.
| I3C_TARGET_BUFFER_TRANSMIT_NO_ERROR | |
| I3C_TARGET_BUFFER_TRANSMIT_BUFFER_SIZE_EXCEEDED | |
| I3C_TARGET_BUFFER_TRANSMIT_NULL_BUFFER | |
| I3C_TARGET_BUFFER_TRANSMIT_COMMAND_QUEUE_FULL |
I3C_TARGET_DATA_FLOW_DIRECTION
enum I3C_TARGET_DATA_FLOW_DIRECTION
Defines the data flow direction of an I3C transaction.
| I3C_TARGET_DATA_TRANSMITTED |
Data transmitted via Private Read or IBI |
| I3C_TARGET_DATA_RECEIVED |
Data received via Private Write |
I3C_TARGET_HJ_STATUS
enum I3C_TARGET_HJ_STATUS
Defines the status of the Hot-Join operation.
| I3C_TARGET_HJ_COMPLETED_OR_NOT_STARTED | |
| I3C_TARGET_HJ_COMPLETED | |
| I3C_TARGET_HJ_FAILED | |
| I3C_TARGET_HJ_PENDING |
I3C_TARGET_IBI_REQUEST_ERROR
enum I3C_TARGET_IBI_REQUEST_ERROR
Defines the error states of the In-Band Interrupt request operation.
| I3C_TARGET_IBI_REQUEST_NO_ERROR | |
| I3C_TARGET_IBI_REQUEST_SEND_BUFFER_SIZE_EXCEEDED | |
| I3C_TARGET_IBI_REQUEST_NOT_IN_I3C_MODE | |
| I3C_TARGET_IBI_REQUEST_IBI_DISABLED_ON_BUS |
I3C_TARGET_IBI_STATUS
enum I3C_TARGET_IBI_STATUS
Defines the status codes for In-Band Interrupt operations.
| I3C_TARGET_IBI_STATUS_NONE |
No IBI status / Reserved |
| I3C_TARGET_IBI_STATUS_ACCEPTED |
IBI accepted (ACK received) |
| I3C_TARGET_IBI_STATUS_EARLY_TERMINATE |
Controller early terminated |
| I3C_TARGET_IBI_STATUS_NOT_ATTEMPTED |
IBI not attempted |
I3C_TARGET_RX_CMD_SIZE
enum I3C_TARGET_RX_CMD_SIZE
Defines the command word size in the RX FIFO prefix for received transfers. Indicates whether the first word in the RX buffer is data or an encoded command.
| I3C_TARGET_RX_NO_COMMAND_WORD |
No command word. First RX FIFO word is the first data word of the transfer (SDR Private Write). |
| I3C_TARGET_RX_HDR_COMMAND_CODE_OR_CCC_CODE |
1 command word in RX FIFO. Only byte 0 is valid. Contains the HDR command code or the CCC code based on the CCC bit in the response. |
| I3C_TARGET_RX_HDR_COMMAND_CODE_WITH_DEFINING_BYTE |
1 command word in RX FIFO. Byte 0 and byte 1 are valid. Byte 0 = HDR command code or CCC code, byte 1 = defining byte for the CCC. |
| I3C_TARGET_RX_HDR_BULK_TRANSFER_COMMAND |
1 command word in RX FIFO. All 4 bytes are valid. Contains HDR Bulk Transfer command words 0, 1, 2, and 3. |
I3C_TARGET_TRANSACTION_ERROR_STATUS
enum I3C_TARGET_TRANSACTION_ERROR_STATUS
Defines the transaction error status codes.
| I3C_TARGET_TRANSACTION_NO_ERR |
No error |
| I3C_TARGET_TRANSACTION_ERR_CRC |
CRC error (Controller writes in DDR mode) |
| I3C_TARGET_TRANSACTION_ERR_PARITY |
Parity error (Controller writes in DDR and SDR modes) |
| I3C_TARGET_TRANSACTION_ERR_FRAME |
Frame error (HDR mode Controller writes) |
| I3C_TARGET_TRANSACTION_ERR_OVERFLOW |
Underflow/Overflow error |
| I3C_TARGET_TRANSACTION_ERR_SDA_STUCK_RELEASE |
SDA released from stuck state after RELEASE_SDA_TIMING timeout |
| I3C_TARGET_TRANSACTION_ERR_CONTROLLER_EARLY_TERM |
Controller early termination |
| I3C_TARGET_TRANSACTION_ERR_PEC |
PEC Error |
3.14.1.1.4 Variable Documentation
I3C1_Target
const struct I3C_TARGET_INTERFACE I3C1_Target
Structure object of type I3C_TARGET_INTERFACE with the custom name given by the user in the Melody Driver User interface. The default name e.g. I3C_TARGET can be changed via the 'Custom Name' field. Application-specific naming allows API portability across peripheral instances.
3.14.2 Data Structure Documentation
3.14.2.1 I3C_TARGET_CCC_UPDATE_STATUS Struct Reference
Contains the status of which CCC fields were updated by the Active Controller. Read via CCCUpdateStatusGet() inside the CCCTableUpdatedCallback.
3.14.2.1.1 Detailed Description
Contains the status of which CCC fields were updated by the Active Controller. Read via CCCUpdateStatusGet() inside the CCCTableUpdatedCallback.
#include <i3c_target_types.h>
Data Fields
bool mwlChanged
bool mrlChanged
bool ibiEnabled
bool hotJoinEnabled
3.14.2.1.2 Field Documentation
activityState
enum I3C_TARGET_ACTIVITY_STATE activityState
Current activity state from ENTAS CCC
controllerRequestEnabled
bool controllerRequestEnabled
Controller Request enabled on bus after ENEC/DISEC
hotJoinEnabled
bool hotJoinEnabled
Hot-Join enabled on bus after ENEC/DISEC
ibiEnabled
bool ibiEnabled
IBI (SIR) enabled on bus after ENEC/DISEC
mrlChanged
bool mrlChanged
SETMRL CCC received â?? MRL updated by Controller
mwlChanged
bool mwlChanged
SETMWL CCC received â?? MWL updated by Controller
3.14.2.2 I3C_TARGET_INTERFACE Struct Reference
Structure containing the function pointers of the I3C Target driver.
3.14.2.2.1 Detailed Description
Structure containing the function pointers of the I3C Target driver.
#include <i3c_target_interface.h>
Data Fields
void(* Initialize )(void)
Pointer to I3C1_Target_Initialize e.g. I3C1_Target_Initialize.
void(* Deinitialize )(void)
Pointer to I3C1_Target_Deinitialize e.g. I3C1_Target_Deinitialize.
void(* Enable )(void)
Pointer to I3C1_Target_Enable e.g. I3C1_Target_Enable.
void(* Disable )(void)
Pointer to I3C1_Target_Disable e.g. I3C1_Target_Disable.
uint8_t(* IsEnabled )(void)
Pointer to I3C1_Target_IsEnabled e.g. I3C1_Target_IsEnabled.
bool(* IsDynamicAddressValid )(void)
Pointer to I3C1_Target_IsDynamicAddressValid e.g. I3C1_Target_IsDynamicAddressValid.
void(* Resume )(void)
Pointer to I3C1_Target_Resume e.g. I3C1_Target_Resume.
void(* PECEnable )(void)
Pointer to I3C1_Target_PECEnable e.g. I3C1_Target_PECEnable.
void(* PECDisable )(void)
Pointer to I3C1_Target_PECDisable e.g. I3C1_Target_PECDisable.
uint16_t(* MaxWriteLengthGet )(void)
Pointer to I3C1_Target_MaxWriteLengthGet e.g. I3C1_Target_MaxWriteLengthGet.
void(* MaxWriteLengthSet )(uint16_t maxWriteLen)
Pointer to I3C1_Target_MaxWriteLengthSet e.g. I3C1_Target_MaxWriteLengthSet.
uint16_t(* MaxReadLengthGet )(void)
Pointer to I3C1_Target_MaxReadLengthGet e.g. I3C1_Target_MaxReadLengthGet.
void(* MaxReadLengthSet )(uint16_t maxReadLen)
Pointer to I3C1_Target_MaxReadLengthSet e.g. I3C1_Target_MaxReadLengthSet.
void(* TxBufferFIFOClear )(void)
Pointer to I3C1_Target_TxBufferFIFOClear e.g. I3C1_Target_TxBufferFIFOClear.
void(* RxBufferFIFOClear )(void)
Pointer to I3C1_Target_RxBufferFIFOClear e.g. I3C1_Target_RxBufferFIFOClear.
void(* ResponseQueueClear )(void)
Pointer to I3C1_Target_ResponseQueueClear e.g. I3C1_Target_ResponseQueueClear.
void(* CommandQueueClear )(void)
Pointer to I3C1_Target_CommandQueueClear e.g. I3C1_Target_CommandQueueClear.
void(* PeripheralReset )(void)
Pointer to I3C1_Target_PeripheralReset e.g. I3C1_Target_PeripheralReset.
enum I3C_TARGET_BUFFER_RECEIVE_ERROR(* BufferReceive )(uint8_t *rxBuf, uint16_t len)
Pointer to I3C1_Target_BufferReceive e.g. I3C1_Target_BufferReceive.
enum I3C_TARGET_BUFFER_TRANSMIT_ERROR(* BufferTransmit )(uint8_t *txBuf, uint16_t len)
Pointer to I3C1_Target_BufferTransmit e.g. I3C1_Target_BufferTransmit.
void(* HDRCommandCodeSet )(uint8_t hdrCmdCode)
Pointer to I3C1_Target_HDRCommandCodeSet e.g. I3C1_Target_HDRCommandCodeSet.
enum I3C_TARGET_HJ_STATUS(* HotJoinStatusGet )(void)
Pointer to I3C1_Target_HotJoinStatusGet e.g. I3C1_Target_HotJoinStatusGet.
enum I3C_TARGET_IBI_REQUEST_ERROR(* IBIRequest )(uint8_t *payloadBuf, uint16_t payloadLen)
Pointer to I3C1_Target_IBIRequest e.g. I3C1_Target_IBIRequest.
void(* IBIMandatoryDataByteSet )(uint8_t mdb)
Pointer to I3C1_Target_IBIMandatoryDataByteSet e.g. I3C1_Target_IBIMandatoryDataByteSet.
void(* IBIPayloadSizeSet )(uint8_t size)
Pointer to I3C1_Target_IBIPayloadSizeSet e.g. I3C1_Target_IBIPayloadSizeSet.
uint8_t(* IBIPayloadSizeGet )(void)
Pointer to I3C1_Target_IBIPayloadSizeGet e.g. I3C1_Target_IBIPayloadSizeGet.
bool(* IsIBIEnabledOnBus )(void)
Pointer to I3C1_Target_IsIBIEnabledOnBus e.g. I3C1_Target_IsIBIEnabledOnBus.
void(* TransactionCompleteCallbackRegister )(void(*handler)(struct I3C_TARGET_TRANSACTION_COMPLETE_STATUS *transactionCompleteStatus))
void(* TransactionErrorCallbackRegister )(void(*handler)(enum I3C_TARGET_TRANSACTION_ERROR_STATUS transactionError))
void(* IBIDoneCallbackRegister )(void(*handler)(enum I3C_TARGET_IBI_STATUS ibiStatus))
void(* StartConditionDetectedCallbackRegister )(void(*callback)(void))
void(* DynamicAddressAssignedCallbackRegister )(void(*callback)(void))
void(* SingleBitECCErrorCallbackRegister )(void(*callback)(void))
void(* DoubleBitECCErrorCallbackRegister )(void(*callback)(void))
void(* CCCTableUpdatedCallbackRegister )(void(*callback)(void))
void(* CCCUpdateStatusGet )(struct I3C_TARGET_CCC_UPDATE_STATUS *status)
void(* TransmitUnderrunCallbackRegister )(void(*callback)(void))
void(* ReceiveOverrunCallbackRegister )(void(*callback)(void))
void(* ReadRequestReceivedCallbackRegister )(void(*callback)(void))
3.14.2.2.2 Field Documentation
The documentation for this struct was generated from the following file:
source/
BufferReceive
enum I3C_TARGET_BUFFER_RECEIVE_ERROR(* BufferReceive) (uint8_t *rxBuf, uint16_t len)
Pointer to I3C1_Target_BufferReceive e.g. I3C1_Target_BufferReceive.
BufferTransmit
enum I3C_TARGET_BUFFER_TRANSMIT_ERROR(* BufferTransmit) (uint8_t *txBuf, uint16_t len)
Pointer to I3C1_Target_BufferTransmit e.g. I3C1_Target_BufferTransmit.
CCCTableUpdatedCallbackRegister
void(* CCCTableUpdatedCallbackRegister) (void(*callback)(void))
Pointer to I3C1_Target_CCCTableUpdatedCallbackRegister e.g. I3C1_Target_CCCTableUpdatedCallbackRegister
CCCUpdateStatusGet
void(* CCCUpdateStatusGet) (struct I3C_TARGET_CCC_UPDATE_STATUS *status)
Pointer to I3C1_Target_CCCUpdateStatusGet e.g. I3C1_Target_CCCUpdateStatusGet
CommandQueueClear
void(* CommandQueueClear) (void)
Pointer to I3C1_Target_CommandQueueClear e.g. I3C1_Target_CommandQueueClear.
Deinitialize
void(* Deinitialize) (void)
Pointer to I3C1_Target_Deinitialize e.g. I3C1_Target_Deinitialize.
Disable
void(* Disable) (void)
Pointer to I3C1_Target_Disable e.g. I3C1_Target_Disable.
DoubleBitECCErrorCallbackRegister
void(* DoubleBitECCErrorCallbackRegister) (void(*callback)(void))
Pointer to I3C1_Target_DoubleBitECCErrorCallbackRegister e.g. I3C1_Target_DoubleBitECCErrorCallbackRegister
DynamicAddressAssignedCallbackRegister
void(* DynamicAddressAssignedCallbackRegister) (void(*callback)(void))
Pointer to I3C1_Target_DynamicAddressAssignedCallbackRegister e.g. I3C1_Target_DynamicAddressAssignedCallbackRegister
Enable
void(* Enable) (void)
Pointer to I3C1_Target_Enable e.g. I3C1_Target_Enable.
HDRCommandCodeSet
void(* HDRCommandCodeSet) (uint8_t hdrCmdCode)
Pointer to I3C1_Target_HDRCommandCodeSet e.g. I3C1_Target_HDRCommandCodeSet.
HotJoinStatusGet
enum I3C_TARGET_HJ_STATUS(* HotJoinStatusGet) (void)
Pointer to I3C1_Target_HotJoinStatusGet e.g. I3C1_Target_HotJoinStatusGet.
IBIDoneCallbackRegister
void(* IBIDoneCallbackRegister) (void(*handler)(enum I3C_TARGET_IBI_STATUS ibiStatus))
Pointer to I3C1_Target_IBIDoneCallbackRegister e.g. I3C1_Target_IBIDoneCallbackRegister
IBIMandatoryDataByteSet
void(* IBIMandatoryDataByteSet) (uint8_t mdb)
Pointer to I3C1_Target_IBIMandatoryDataByteSet e.g. I3C1_Target_IBIMandatoryDataByteSet.
IBIPayloadSizeGet
uint8_t(* IBIPayloadSizeGet) (void)
Pointer to I3C1_Target_IBIPayloadSizeGet e.g. I3C1_Target_IBIPayloadSizeGet.
IBIPayloadSizeSet
void(* IBIPayloadSizeSet) (uint8_t size)
Pointer to I3C1_Target_IBIPayloadSizeSet e.g. I3C1_Target_IBIPayloadSizeSet.
IBIRequest
enum I3C_TARGET_IBI_REQUEST_ERROR(* IBIRequest) (uint8_t *payloadBuf, uint16_t payloadLen)
Pointer to I3C1_Target_IBIRequest e.g. I3C1_Target_IBIRequest.
Initialize
void(* Initialize) (void)
Pointer to I3C1_Target_Initialize e.g. I3C1_Target_Initialize.
IsDynamicAddressValid
bool(* IsDynamicAddressValid) (void)
Pointer to I3C1_Target_IsDynamicAddressValid e.g. I3C1_Target_IsDynamicAddressValid.
IsEnabled
uint8_t(* IsEnabled) (void)
Pointer to I3C1_Target_IsEnabled e.g. I3C1_Target_IsEnabled.
IsIBIEnabledOnBus
bool(* IsIBIEnabledOnBus) (void)
Pointer to I3C1_Target_IsIBIEnabledOnBus e.g. I3C1_Target_IsIBIEnabledOnBus.
MaxReadLengthGet
uint16_t(* MaxReadLengthGet) (void)
Pointer to I3C1_Target_MaxReadLengthGet e.g. I3C1_Target_MaxReadLengthGet.
MaxReadLengthSet
void(* MaxReadLengthSet) (uint16_t maxReadLen)
Pointer to I3C1_Target_MaxReadLengthSet e.g. I3C1_Target_MaxReadLengthSet.
MaxWriteLengthGet
uint16_t(* MaxWriteLengthGet) (void)
Pointer to I3C1_Target_MaxWriteLengthGet e.g. I3C1_Target_MaxWriteLengthGet.
MaxWriteLengthSet
void(* MaxWriteLengthSet) (uint16_t maxWriteLen)
Pointer to I3C1_Target_MaxWriteLengthSet e.g. I3C1_Target_MaxWriteLengthSet.
PECDisable
void(* PECDisable) (void)
Pointer to I3C1_Target_PECDisable e.g. I3C1_Target_PECDisable.
PECEnable
void(* PECEnable) (void)
Pointer to I3C1_Target_PECEnable e.g. I3C1_Target_PECEnable.
PeripheralReset
void(* PeripheralReset) (void)
Pointer to I3C1_Target_PeripheralReset e.g. I3C1_Target_PeripheralReset.
ReadRequestReceivedCallbackRegister
void(* ReadRequestReceivedCallbackRegister) (void(*callback)(void))
Pointer to I3C1_Target_ReadRequestReceivedCallbackRegister e.g. I3C1_Target_ReadRequestReceivedCallbackRegister
ReceiveOverrunCallbackRegister
void(* ReceiveOverrunCallbackRegister) (void(*callback)(void))
Pointer to I3C1_Target_ReceiveOverrunCallbackRegister e.g. I3C1_Target_ReceiveOverrunCallbackRegister
ResponseQueueClear
void(* ResponseQueueClear) (void)
Pointer to I3C1_Target_ResponseQueueClear e.g. I3C1_Target_ResponseQueueClear.
Resume
void(* Resume) (void)
Pointer to I3C1_Target_Resume e.g. I3C1_Target_Resume.
RxBufferFIFOClear
void(* RxBufferFIFOClear) (void)
Pointer to I3C1_Target_RxBufferFIFOClear e.g. I3C1_Target_RxBufferFIFOClear.
SingleBitECCErrorCallbackRegister
void(* SingleBitECCErrorCallbackRegister) (void(*callback)(void))
Pointer to I3C1_Target_SingleBitECCErrorCallbackRegister e.g. I3C1_Target_SingleBitECCErrorCallbackRegister
StartConditionDetectedCallbackRegister
void(* StartConditionDetectedCallbackRegister) (void(*callback)(void))
Pointer to I3C1_Target_StartConditionDetectedCallbackRegister e.g. I3C1_Target_StartConditionDetectedCallbackRegister
TransactionCompleteCallbackRegister
void(* TransactionCompleteCallbackRegister) (void(*handler)(struct I3C_TARGET_TRANSACTION_COMPLETE_STATUS *transactionCompleteStatus))
Pointer to I3C1_Target_TransactionCompleteCallbackRegister e.g. I3C1_Target_TransactionCompleteCallbackRegister
TransactionErrorCallbackRegister
void(* TransactionErrorCallbackRegister) (void(*handler)(enum I3C_TARGET_TRANSACTION_ERROR_STATUS transactionError))
Pointer to I3C1_Target_TransactionErrorCallbackRegister e.g. I3C1_Target_TransactionErrorCallbackRegister
TransmitUnderrunCallbackRegister
void(* TransmitUnderrunCallbackRegister) (void(*callback)(void))
Pointer to I3C1_Target_TransmitUnderrunCallbackRegister e.g. I3C1_Target_TransmitUnderrunCallbackRegister
TxBufferFIFOClear
void(* TxBufferFIFOClear) (void)
Pointer to I3C1_Target_TxBufferFIFOClear e.g. I3C1_Target_TxBufferFIFOClear.
3.14.2.3 I3C_TARGET_RESPONSE_DATA Union Reference
Extended Response Data Structure Format 2 (Table 24-31).
3.14.2.3.1 Detailed Description
Extended Response Data Structure Format 2 (Table 24-31).
Bit layout (LSB first): [2:0] ATTR - Response Attribute [3] LAST - This is the last response of the transfer [4] FIRST - This is the first response of the transfer [5] DEFTGTS - Response is for DEFTGTS CCC [6] RESERVED [7] CCC - Response is for Private Write (0) or CCC Write (1) [11:8] ERR_STATUS - Error Status (0=No Error, 1=CRC, 2=Parity, 3=Frame, 6=Underflow/Overflow) [15:12] CMD_SIZE - Reports if first data entry in RX FIFO is an encoded command [20:16] TARGET_ID - Target/Targets that this transfer is intended for [23:21] RESERVED [31:24] DATA_LENGTH - Data length of the transfer
#include <i3c_target_types.h>
Data Fields
struct {
} frame
uint32_t RespondData
3.14.2.3.2 Field Documentation
ATTR
uint32_t ATTR
Response Attribute
CCC
uint32_t CCC
0 = Private Write, 1 = CCC Write
CMD_SIZE
uint32_t CMD_SIZE
Command size indicator
DATA_LENGTH
uint32_t DATA_LENGTH
Data length of the transfer
DEFTGTS
uint32_t DEFTGTS
Response is for DEFTGTS CCC
ERR_STATUS
uint32_t ERR_STATUS
Error Status
FIRST
uint32_t FIRST
First response of the transfer
frame
struct { ... } frame
LAST
uint32_t LAST
Last response of the transfer
RESERVED1
uint32_t RESERVED1
Reserved
RESERVED2
uint32_t RESERVED2
Reserved
RespondData
uint32_t RespondData
TARGET_ID
uint32_t TARGET_ID
Target ID
3.14.2.4 I3C_TARGET_TRANSACTION_COMPLETE_STATUS Struct Reference
Contains the status of the transaction complete operation.
3.14.2.4.1 Detailed Description
Contains the status of the transaction complete operation.
#include <i3c_target_types.h>
Data Fields
uint16_t numOfBytesReceived
uint16_t numOfBytesTransmitted
3.14.2.4.2 Field Documentation
cmdSize
enum I3C_TARGET_RX_CMD_SIZE cmdSize
Command word prefix in RX buffer. CMD_NONE = SDR (all bytes are data). Non-zero = HDR (first word is command, rest is data).
dataFlowDirection
enum I3C_TARGET_DATA_FLOW_DIRECTION dataFlowDirection
numOfBytesReceived
uint16_t numOfBytesReceived
numOfBytesTransmitted
uint16_t numOfBytesTransmitted
3.14.2.5 I3C_TARGET_TRANSMIT_COMMAND Struct Reference
Transfer command register layout as a 64-bit (two-word) structure.
3.14.2.5.1 Detailed Description
Transfer command register layout as a 64-bit (two-word) structure.
CMD_BYTE1 layout (first 32 bits): [2:0] CMD_ATTR - Command attribute (1 = Transmit Command) [5:3] RESERVED1 [6] FINITE_DL - Finite data length flag [7] RESERVED2 [15:8] ERR_STATUS - Error status [16] CMD_VLD - Command valid flag [23:17] RESERVED3 [24] CCC - CCC flag [26:25] ADDR_MSK - Address mask [27] RESERVED4 [31:28] ADDR_OFFSET - Address offset
CMD_BYTE2 layout (second 32 bits): [7:0] CCC_HDR_HEADER - CCC/HDR header [15:8] DB - Defining Byte [31:16] DATA_LENGTH - Data length in bytes
#include <i3c_target_types.h>
Data Fields
union {
union {
struct {
uint32_t CCC_HDR_HEADER: 8
uint32_t DB: 8
uint32_t DATA_LENGTH: 16
} F[2/2]
uint32_t BYTE2
3.14.2.5.2 Field Documentation
ADDR_MSK
uint32_t ADDR_MSK
ADDR_OFFSET
uint32_t ADDR_OFFSET
BYTE1
uint32_t BYTE1
BYTE2
uint32_t BYTE2
CCC
uint32_t CCC
CCC_HDR_HEADER
uint32_t CCC_HDR_HEADER
CMD_ATTR
uint32_t CMD_ATTR
CMD_BYTE1
union { ... } CMD_BYTE1
CMD_BYTE2
union { ... } CMD_BYTE2
CMD_VLD
uint32_t CMD_VLD
DATA_LENGTH
uint32_t DATA_LENGTH
DB
uint32_t DB
ERR_STATUS
uint32_t ERR_STATUS
F[1/2]
struct { ... } F
F[2/2]
struct { ... } F
FINITE_DL
uint32_t FINITE_DL
RESERVED1
uint32_t RESERVED1
RESERVED2
uint32_t RESERVED2
RESERVED3
uint32_t RESERVED3
RESERVED4
uint32_t RESERVED4
3.14.3 File Documentation
3.14.3.1 source/i3c1.h File Reference
This is the generated driver header file for the I3C1 Target driver.
3.14.3.1.1 Functions
void I3C1_Target_Initialize (void)
Initializes the I3C1 Target peripheral with default configuration.
void I3C1_Target_Deinitialize (void)
De-initializes the I3C1 Target peripheral. Disables DMA channels, interrupts, resets all queues/buffers/state machine, and powers off the module.
void I3C1_Target_Enable (void)
Enables the I3C1 Target peripheral.
uint8_t I3C1_Target_IsEnabled (void)
Checks whether the I3C1 Target peripheral is enabled.
bool I3C1_Target_IsDynamicAddressValid (void)
Checks whether the Dynamic Address has been assigned by the Controller.
void I3C1_Target_Disable (void)
Disables the I3C1 Target peripheral.
uint16_t I3C1_Target_MaxWriteLengthGet (void)
Returns the configured maximum write length.
void I3C1_Target_MaxWriteLengthSet (uint16_t maxWriteLen)
Sets the maximum write length.
uint16_t I3C1_Target_MaxReadLengthGet (void)
Returns the configured maximum read length.
void I3C1_Target_MaxReadLengthSet (uint16_t maxReadLen)
Sets the maximum read length.
void I3C1_Target_TxBufferFIFOClear (void)
Clears the I3C1 Target TX buffer FIFO.
void I3C1_Target_RxBufferFIFOClear (void)
Clears the I3C1 Target RX buffer FIFO.
void I3C1_Target_ResponseQueueClear (void)
Clears the I3C1 Target response queue.
void I3C1_Target_CommandQueueClear (void)
Clears the I3C1 Target command queue.
void I3C1_Target_PeripheralReset (void)
Resets the I3C1 Target peripheral using the SOFTRST core software reset bit.
void I3C1_Target_Resume (void)
Resumes the I3C1 Target peripheral after a halt condition.
void I3C1_Target_PECEnable (void)
Enables Packet Error Check (PEC) for SDR transfers. When enabled, the Target appends a CRC-8 byte to read/IBI transfers and validates the CRC-8 byte on write transfers.
void I3C1_Target_PECDisable (void)
Disables Packet Error Check (PEC) for SDR transfers. After calling this function, the Target will no longer append or validate CRC-8 bytes on SDR transfers.
enum I3C_TARGET_BUFFER_RECEIVE_ERROR I3C1_Target_BufferReceive (uint8_t *rxBuf, uint16_t len)
Configures the buffer for the next Private Write transaction to receive data. The status of the transaction can be checked using the transaction complete callback.
enum I3C_TARGET_BUFFER_TRANSMIT_ERROR I3C1_Target_BufferTransmit (uint8_t *txBuf, uint16_t len)
Configures the buffer for the next Private Read transaction to transmit data. The status of the transaction can be checked using the transaction complete callback.
void I3C1_Target_HDRCommandCodeSet (uint8_t hdrCmdCode)
Sets the HDR-DDR command code for the next BufferTransmit call. Default is 0x00 (SDR Private Read). For HDR-DDR transfers, set the appropriate HDR command code before calling BufferTransmit.
enum I3C_TARGET_HJ_STATUS I3C1_Target_HotJoinStatusGet (void)
Returns the current status of the Hot-Join operation.
void I3C1_Target_IBIMandatoryDataByteSet (uint8_t mdb)
Sets the Mandatory Data Byte (MDB) for IBI requests.
void I3C1_Target_IBIPayloadSizeSet (uint8_t size)
Sets the IBI payload size.
uint8_t I3C1_Target_IBIPayloadSizeGet (void)
Gets the current IBI payload size.
enum I3C_TARGET_IBI_REQUEST_ERROR I3C1_Target_IBIRequest (uint8_t *payloadBuf, uint16_t payloadLen)
Initiates an In-Band Interrupt (IBI/SIR) request on the I3C bus.
bool I3C1_Target_IsIBIEnabledOnBus (void)
Checks if the IBI capability is enabled on the bus.
void I3C1_Target_TransactionCompleteCallbackRegister (void(*callback)(struct I3C_TARGET_TRANSACTION_COMPLETE_STATUS *transactionCompleteStatus))
Registers a callback for the Transaction Complete event. The callback provides the data flow direction and total number of bytes transferred.
void I3C1_Target_TransactionErrorCallbackRegister (void(*handler)(enum I3C_TARGET_TRANSACTION_ERROR_STATUS transactionError))
Registers a callback for the Transaction Error event.
void I3C1_Target_IBIDoneCallbackRegister (void(*handler)(enum I3C_TARGET_IBI_STATUS ibiStatus))
Registers a callback for the IBI Done event.
void I3C1_Target_StartConditionDetectedCallbackRegister (void(*callback)(void))
Registers a callback for the Start Condition detection event.
void I3C1_Target_DynamicAddressAssignedCallbackRegister (void(*callback)(void))
Registers a callback for the Dynamic Address Assigned event.
void I3C1_Target_SingleBitECCErrorCallbackRegister (void(*callback)(void))
Registers a callback for the Single-Bit ECC Error (SERR) interrupt event.
void I3C1_Target_DoubleBitECCErrorCallbackRegister (void(*callback)(void))
Registers a callback for the Double-Bit ECC Error (DERR) interrupt event.
void I3C1_Target_CCCTableUpdatedCallbackRegister (void(*callback)(void))
Registers a callback for the CCC Table Updated event. Triggered when the Active Controller updates CCC-mapped registers (e.g. MWL, MRL) via a supported CCC command.
void I3C1_Target_CCCUpdateStatusGet (struct I3C_TARGET_CCC_UPDATE_STATUS *status)
Reads the current CCC update status from the I3CxTGTESTA register. Clears the sticky status bits (MWLSTA, MRLSTA) after reading. Call this inside the CCCTableUpdatedCallback to determine which CCC was received from the Active Controller.
void I3C1_Target_TransmitUnderrunCallbackRegister (void(*callback)(void))
Registers a callback for the Transmit Underrun event. Triggered when the Extended TX FIFO underflows during a Controller Read transfer.
void I3C1_Target_ReceiveOverrunCallbackRegister (void(*callback)(void))
Registers a callback for the Receive Overrun event. Triggered when the RX FIFO overflows during a Controller Write transfer.
void I3C1_Target_ReadRequestReceivedCallbackRegister (void(*callback)(void))
Registers a callback for the Read Request Received event. Triggered when the Controller issues a read request and the command queue is empty.
void I3C1_Target_TransactionCompleteCallback (struct I3C_TARGET_TRANSACTION_COMPLETE_STATUS *status)
Default weak callback for the Transaction Complete event. Override this function or register a custom callback using I3C1_Target_TransactionCompleteCallbackRegister.
void I3C1_Target_TransactionErrorCallback (enum I3C_TARGET_TRANSACTION_ERROR_STATUS error)
Default weak callback for the Transaction Error event. Override this function or register a custom callback using I3C1_Target_TransactionErrorCallbackRegister.
void I3C1_Target_IBIDoneCallback (enum I3C_TARGET_IBI_STATUS ibiStatus)
Default weak callback for the IBI Done event. Override this function or register a custom callback using I3C1_Target_IBIDoneCallbackRegister.
void I3C1_Target_StartConditionDetectedCallback (void)
Default weak callback for the Start Condition Detected event. Override this function or register a custom callback using I3C1_Target_StartConditionDetectedCallbackRegister.
void I3C1_Target_DynamicAddressAssignedCallback (void)
Default weak callback for the Dynamic Address Assigned event. Override this function or register a custom callback using I3C1_Target_DynamicAddressAssignedCallbackRegister.
void I3C1_Target_SingleBitECCErrorCallback (void)
Default weak callback for the Single-Bit ECC Error event. Override this function or register a custom callback using I3C1_Target_SingleBitECCErrorCallbackRegister.
void I3C1_Target_DoubleBitECCErrorCallback (void)
Default weak callback for the Double-Bit ECC Error event. Override this function or register a custom callback using I3C1_Target_DoubleBitECCErrorCallbackRegister.
void I3C1_Target_CCCTableUpdatedCallback (void)
Default weak callback for the CCC Table Updated event. Override this function or register a custom callback using I3C1_Target_CCCTableUpdatedCallbackRegister.
void I3C1_Target_TransmitUnderrunCallback (void)
Default weak callback for the Transmit Underrun event. Override this function or register a custom callback using I3C1_Target_TransmitUnderrunCallbackRegister.
void I3C1_Target_ReceiveOverrunCallback (void)
Default weak callback for the Receive Overrun event. Override this function or register a custom callback using I3C1_Target_ReceiveOverrunCallbackRegister.
void I3C1_Target_ReadRequestReceivedCallback (void)
Default weak callback for the Read Request Received event. Override this function or register a custom callback using I3C1_Target_ReadRequestReceivedCallbackRegister.
3.14.3.1.2 Variables
const struct I3C_TARGET_INTERFACE I3C1_Target
Structure object of type I3C_TARGET_INTERFACE with the custom name given by the user in the Melody Driver User interface. The default name e.g. I3C_TARGET can be changed via the 'Custom Name' field. Application-specific naming allows API portability across peripheral instances.
3.14.3.1.3 Detailed Description
This is the generated driver header file for the I3C1 Target driver.
I3C1 Generated Driver Header File
3.14.3.2 source/i3c_target_interface.h File Reference
3.14.3.2.1 Data structures
struct I3C_TARGET_INTERFACE
Structure containing the function pointers of the I3C Target driver.
3.14.3.2.2 Detailed Description
I3C Target Generated Driver Interface Header File
3.14.3.3 source/i3c_target_types.h File Reference
This is the generated driver types header file for the I3C1 Target driver.
3.14.3.3.1 Data structures
struct I3C_TARGET_TRANSMIT_COMMAND
Transfer command register layout as a 64-bit (two-word) structure.
union I3C_TARGET_RESPONSE_DATA
Extended Response Data Structure Format 2 (Table 24-31).
struct I3C_TARGET_TRANSACTION_COMPLETE_STATUS
Contains the status of the transaction complete operation.
struct I3C_TARGET_CCC_UPDATE_STATUS
Contains the status of which CCC fields were updated by the Active Controller. Read via CCCUpdateStatusGet() inside the CCCTableUpdatedCallback.
3.14.3.3.2 Enumerations
enum I3C_TARGET_HJ_STATUS { I3C_TARGET_HJ_COMPLETED_OR_NOT_STARTED = 0, I3C_TARGET_HJ_COMPLETED, I3C_TARGET_HJ_FAILED, I3C_TARGET_HJ_PENDING }
Defines the status of the Hot-Join operation.
enum I3C_TARGET_IBI_STATUS { I3C_TARGET_IBI_STATUS_NONE = 0, I3C_TARGET_IBI_STATUS_ACCEPTED = 1, I3C_TARGET_IBI_STATUS_EARLY_TERMINATE = 2, I3C_TARGET_IBI_STATUS_NOT_ATTEMPTED = 3 }
Defines the status codes for In-Band Interrupt operations.
enum I3C_TARGET_IBI_REQUEST_ERROR { I3C_TARGET_IBI_REQUEST_NO_ERROR, I3C_TARGET_IBI_REQUEST_SEND_BUFFER_SIZE_EXCEEDED, I3C_TARGET_IBI_REQUEST_NOT_IN_I3C_MODE, I3C_TARGET_IBI_REQUEST_IBI_DISABLED_ON_BUS }
Defines the error states of the In-Band Interrupt request operation.
enum I3C_TARGET_TRANSACTION_ERROR_STATUS { I3C_TARGET_TRANSACTION_NO_ERR = 0x0, I3C_TARGET_TRANSACTION_ERR_CRC = 0x1, I3C_TARGET_TRANSACTION_ERR_PARITY = 0x2, I3C_TARGET_TRANSACTION_ERR_FRAME = 0x3, I3C_TARGET_TRANSACTION_ERR_OVERFLOW = 0x6, I3C_TARGET_TRANSACTION_ERR_SDA_STUCK_RELEASE = 0x8, I3C_TARGET_TRANSACTION_ERR_CONTROLLER_EARLY_TERM = 0xA, I3C_TARGET_TRANSACTION_ERR_PEC = 0xC }
Defines the transaction error status codes.
enum I3C_TARGET_RX_CMD_SIZE { I3C_TARGET_RX_NO_COMMAND_WORD = 0x0, I3C_TARGET_RX_HDR_COMMAND_CODE_OR_CCC_CODE = 0x1, I3C_TARGET_RX_HDR_COMMAND_CODE_WITH_DEFINING_BYTE = 0x2, I3C_TARGET_RX_HDR_BULK_TRANSFER_COMMAND = 0x4 }
Defines the command word size in the RX FIFO prefix for received transfers. Indicates whether the first word in the RX buffer is data or an encoded command.
enum I3C_TARGET_BUFFER_RECEIVE_ERROR { I3C_TARGET_BUFFER_RECEIVE_NO_ERROR, I3C_TARGET_BUFFER_RECEIVE_BUFFER_SIZE_EXCEEDED, I3C_TARGET_BUFFER_RECEIVE_NULL_BUFFER, I3C_TARGET_BUFFER_RECEIVE_TRANSFER_IN_PROGRESS }
Defines the error status of the buffer receive operation.
enum I3C_TARGET_BUFFER_TRANSMIT_ERROR { I3C_TARGET_BUFFER_TRANSMIT_NO_ERROR, I3C_TARGET_BUFFER_TRANSMIT_BUFFER_SIZE_EXCEEDED, I3C_TARGET_BUFFER_TRANSMIT_NULL_BUFFER, I3C_TARGET_BUFFER_TRANSMIT_COMMAND_QUEUE_FULL }
Defines the error status of the buffer transmit operation.
enum I3C_TARGET_DATA_FLOW_DIRECTION { I3C_TARGET_DATA_TRANSMITTED, I3C_TARGET_DATA_RECEIVED }
Defines the data flow direction of an I3C transaction.
enum I3C_TARGET_ACTIVITY_STATE { I3C_TARGET_ACTIVITY_STATE_0 = 0, I3C_TARGET_ACTIVITY_STATE_1 = 1, I3C_TARGET_ACTIVITY_STATE_2 = 2, I3C_TARGET_ACTIVITY_STATE_3 = 3 }
Defines the activity state of the Target as set by the Controller via ENTAS0/ENTAS1/ENTAS2/ENTAS3 CCC commands.
3.14.3.3.3 Detailed Description
This is the generated driver types header file for the I3C1 Target driver.
I3C1 Generated Driver Types Header File
