MCUXpresso SDK API Reference Manual
Rev 2.12.1
NXP Semiconductors
|
Data Structures | |
struct | i3c_slave_config_t |
Structure with settings to initialize the I3C slave module. More... | |
struct | i3c_slave_transfer_t |
I3C slave transfer structure. More... | |
struct | i3c_slave_handle_t |
I3C slave handle structure. More... | |
Typedefs | |
typedef void(* | i3c_slave_transfer_callback_t )(I3C_Type *base, i3c_slave_transfer_t *transfer, void *userData) |
Slave event callback function pointer type. More... | |
Initialization and deinitialization | |
void | I3C_SlaveGetDefaultConfig (i3c_slave_config_t *slaveConfig) |
Provides a default configuration for the I3C slave peripheral. More... | |
void | I3C_SlaveInit (I3C_Type *base, const i3c_slave_config_t *slaveConfig, uint32_t slowClock_Hz) |
Initializes the I3C slave peripheral. More... | |
void | I3C_SlaveDeinit (I3C_Type *base) |
Deinitializes the I3C slave peripheral. More... | |
static void | I3C_SlaveEnable (I3C_Type *base, bool isEnable) |
Enable/Disable Slave. More... | |
Status | |
static uint32_t | I3C_SlaveGetStatusFlags (I3C_Type *base) |
Gets the I3C slave status flags. More... | |
static void | I3C_SlaveClearStatusFlags (I3C_Type *base, uint32_t statusMask) |
Clears the I3C slave status flag state. More... | |
static uint32_t | I3C_SlaveGetErrorStatusFlags (I3C_Type *base) |
Gets the I3C slave error status flags. More... | |
static void | I3C_SlaveClearErrorStatusFlags (I3C_Type *base, uint32_t statusMask) |
Clears the I3C slave error status flag state. More... | |
i3c_slave_activity_state_t | I3C_SlaveGetActivityState (I3C_Type *base) |
Gets the I3C slave state. More... | |
Interrupts | |
static void | I3C_SlaveEnableInterrupts (I3C_Type *base, uint32_t interruptMask) |
Enables the I3C slave interrupt requests. More... | |
static void | I3C_SlaveDisableInterrupts (I3C_Type *base, uint32_t interruptMask) |
Disables the I3C slave interrupt requests. More... | |
static uint32_t | I3C_SlaveGetEnabledInterrupts (I3C_Type *base) |
Returns the set of currently enabled I3C slave interrupt requests. More... | |
static uint32_t | I3C_SlaveGetPendingInterrupts (I3C_Type *base) |
Returns the set of pending I3C slave interrupt requests. More... | |
DMA control | |
static void | I3C_SlaveEnableDMA (I3C_Type *base, bool enableTx, bool enableRx, uint32_t width) |
Enables or disables I3C slave DMA requests. More... | |
static uint32_t | I3C_SlaveGetTxFifoAddress (I3C_Type *base, uint32_t width) |
Gets I3C slave transmit data register address for DMA transfer. More... | |
static uint32_t | I3C_SlaveGetRxFifoAddress (I3C_Type *base, uint32_t width) |
Gets I3C slave receive data register address for DMA transfer. More... | |
FIFO control | |
static void | I3C_SlaveSetWatermarks (I3C_Type *base, i3c_tx_trigger_level_t txLvl, i3c_rx_trigger_level_t rxLvl, bool flushTx, bool flushRx) |
Sets the watermarks for I3C slave FIFOs. More... | |
static void | I3C_SlaveGetFifoCounts (I3C_Type *base, size_t *rxCount, size_t *txCount) |
Gets the current number of bytes in the I3C slave FIFOs. More... | |
Bus operations | |
void | I3C_SlaveRequestEvent (I3C_Type *base, i3c_slave_event_t event) |
I3C slave request event. More... | |
status_t | I3C_SlaveSend (I3C_Type *base, const void *txBuff, size_t txSize) |
Performs a polling send transfer on the I3C bus. More... | |
status_t | I3C_SlaveReceive (I3C_Type *base, void *rxBuff, size_t rxSize) |
Performs a polling receive transfer on the I3C bus. More... | |
Slave non-blocking | |
void | I3C_SlaveTransferCreateHandle (I3C_Type *base, i3c_slave_handle_t *handle, i3c_slave_transfer_callback_t callback, void *userData) |
Creates a new handle for the I3C slave non-blocking APIs. More... | |
status_t | I3C_SlaveTransferNonBlocking (I3C_Type *base, i3c_slave_handle_t *handle, uint32_t eventMask) |
Starts accepting slave transfers. More... | |
status_t | I3C_SlaveTransferGetCount (I3C_Type *base, i3c_slave_handle_t *handle, size_t *count) |
Gets the slave transfer status during a non-blocking transfer. More... | |
void | I3C_SlaveTransferAbort (I3C_Type *base, i3c_slave_handle_t *handle) |
Aborts the slave non-blocking transfers. More... | |
Slave IRQ handler | |
void | I3C_SlaveTransferHandleIRQ (I3C_Type *base, i3c_slave_handle_t *handle) |
Reusable routine to handle slave interrupts. More... | |
void | I3C_SlaveRequestIBIWithData (I3C_Type *base, i3c_slave_handle_t *handle, uint8_t *data, size_t dataSize) |
I3C slave request IBI event with payload. More... | |
struct i3c_slave_config_t |
This structure holds configuration settings for the I3C peripheral. To initialize this structure to reasonable defaults, call the I3C_SlaveGetDefaultConfig() function and pass a pointer to your configuration structure instance.
The configuration structure can be made constant so it resides in flash.
Data Fields | |
bool | enableSlave |
Whether to enable slave. More... | |
bool | isHotJoin |
Whether to enable slave hotjoin before enable slave. More... | |
uint8_t | staticAddr |
Static address. More... | |
uint16_t | vendorID |
Device vendor ID(manufacture ID). More... | |
bool | enableRandomPart |
Whether to generate random part number, if using random part number, the partNumber variable setting is meaningless. More... | |
uint32_t | partNumber |
Device part number info. | |
uint8_t | dcr |
Device characteristics register information. More... | |
uint8_t | bcr |
Bus characteristics register information. More... | |
uint8_t | hdrMode |
Support hdr mode, could be OR logic in enumeration:i3c_hdr_mode_t. More... | |
bool | nakAllRequest |
Whether to reply NAK to all requests except broadcast CCC. More... | |
bool | ignoreS0S1Error |
Whether to ignore S0/S1 error in SDR mode. More... | |
bool | offline |
Whether to wait 60 us of bus quiet or HDR request to ensure slave track SDR mode safely. More... | |
bool | matchSlaveStartStop |
Whether to assert start/stop status only the time slave is addressed. More... | |
uint32_t | maxWriteLength |
Maximum write length. More... | |
uint32_t | maxReadLength |
Maximum read length. More... | |
bool i3c_slave_config_t::enableSlave |
bool i3c_slave_config_t::isHotJoin |
uint8_t i3c_slave_config_t::staticAddr |
uint16_t i3c_slave_config_t::vendorID |
bool i3c_slave_config_t::enableRandomPart |
uint8_t i3c_slave_config_t::dcr |
uint8_t i3c_slave_config_t::bcr |
uint8_t i3c_slave_config_t::hdrMode |
bool i3c_slave_config_t::nakAllRequest |
bool i3c_slave_config_t::ignoreS0S1Error |
bool i3c_slave_config_t::offline |
bool i3c_slave_config_t::matchSlaveStartStop |
uint32_t i3c_slave_config_t::maxWriteLength |
uint32_t i3c_slave_config_t::maxReadLength |
struct i3c_slave_transfer_t |
Data Fields | |
uint32_t | event |
Reason the callback is being invoked. More... | |
uint8_t * | txData |
Transfer buffer. | |
size_t | txDataSize |
Transfer size. | |
uint8_t * | rxData |
Transfer buffer. | |
size_t | rxDataSize |
Transfer size. | |
status_t | completionStatus |
Success or error code describing how the transfer completed. More... | |
size_t | transferredCount |
Number of bytes actually transferred since start or last repeated start. More... | |
uint32_t i3c_slave_transfer_t::event |
status_t i3c_slave_transfer_t::completionStatus |
Only applies for kI3C_SlaveCompletionEvent.
size_t i3c_slave_transfer_t::transferredCount |
struct _i3c_slave_handle |
Data Fields | |
i3c_slave_transfer_t | transfer |
I3C slave transfer copy. More... | |
bool | isBusy |
Whether transfer is busy. More... | |
bool | wasTransmit |
Whether the last transfer was a transmit. More... | |
uint32_t | eventMask |
Mask of enabled events. More... | |
uint32_t | transferredCount |
Count of bytes transferred. More... | |
i3c_slave_transfer_callback_t | callback |
Callback function called at transfer event. More... | |
void * | userData |
Callback parameter passed to callback. More... | |
uint8_t * | ibiData |
IBI data buffer. | |
size_t | ibiDataSize |
IBI data size. | |
i3c_slave_transfer_t i3c_slave_handle_t::transfer |
bool i3c_slave_handle_t::isBusy |
bool i3c_slave_handle_t::wasTransmit |
uint32_t i3c_slave_handle_t::eventMask |
uint32_t i3c_slave_handle_t::transferredCount |
i3c_slave_transfer_callback_t i3c_slave_handle_t::callback |
void* i3c_slave_handle_t::userData |
typedef void(* i3c_slave_transfer_callback_t)(I3C_Type *base, i3c_slave_transfer_t *transfer, void *userData) |
This callback is used only for the slave non-blocking transfer API. To install a callback, use the I3C_SlaveSetCallback() function after you have created a handle.
base | Base address for the I3C instance on which the event occurred. |
transfer | Pointer to transfer descriptor containing values passed to and/or from the callback. |
userData | Arbitrary pointer-sized value passed from the application. |
enum _i3c_slave_flags |
The following status register flags can be cleared:
Only below flags can be enabled as interrupts.
enum i3c_slave_event_t |
These event enumerations are used for two related purposes. First, a bit mask created by OR'ing together events is passed to I3C_SlaveTransferNonBlocking() in order to specify which events to enable. Then, when the slave callback is invoked, it is passed the current event through its transfer parameter.
void I3C_SlaveGetDefaultConfig | ( | i3c_slave_config_t * | slaveConfig | ) |
This function provides the following default configuration for the I3C slave peripheral:
After calling this function, you can override any settings in order to customize the configuration, prior to initializing the slave driver with I3C_SlaveInit().
[out] | slaveConfig | User provided configuration structure for default values. Refer to i3c_slave_config_t. |
void I3C_SlaveInit | ( | I3C_Type * | base, |
const i3c_slave_config_t * | slaveConfig, | ||
uint32_t | slowClock_Hz | ||
) |
This function enables the peripheral clock and initializes the I3C slave peripheral as described by the user provided configuration.
base | The I3C peripheral base address. |
slaveConfig | User provided peripheral configuration. Use I3C_SlaveGetDefaultConfig() to get a set of defaults that you can override. |
slowClock_Hz | Frequency in Hertz of the I3C slow clock. Used to calculate the bus match condition values. |
void I3C_SlaveDeinit | ( | I3C_Type * | base | ) |
This function disables the I3C slave peripheral and gates the clock.
base | The I3C peripheral base address. |
|
inlinestatic |
base | The I3C peripheral base address. |
isEnable | Enable or disable. |
|
inlinestatic |
A bit mask with the state of all I3C slave status flags is returned. For each flag, the corresponding bit in the return value is set if the flag is asserted.
base | The I3C peripheral base address. |
|
inlinestatic |
The following status register flags can be cleared:
Attempts to clear other flags has no effect.
base | The I3C peripheral base address. |
statusMask | A bitmask of status flags that are to be cleared. The mask is composed of _i3c_slave_flags enumerators OR'd together. You may pass the result of a previous call to I3C_SlaveGetStatusFlags(). |
|
inlinestatic |
A bit mask with the state of all I3C slave error status flags is returned. For each flag, the corresponding bit in the return value is set if the flag is asserted.
base | The I3C peripheral base address. |
|
inlinestatic |
base | The I3C peripheral base address. |
statusMask | A bitmask of error status flags that are to be cleared. The mask is composed of _i3c_slave_error_flags enumerators OR'd together. You may pass the result of a previous call to I3C_SlaveGetErrorStatusFlags(). |
i3c_slave_activity_state_t I3C_SlaveGetActivityState | ( | I3C_Type * | base | ) |
base | The I3C peripheral base address. |
|
inlinestatic |
Only below flags can be enabled as interrupts.
base | The I3C peripheral base address. |
interruptMask | Bit mask of interrupts to enable. See _i3c_slave_flags for the set of constants that should be OR'd together to form the bit mask. |
|
inlinestatic |
Only below flags can be disabled as interrupts.
base | The I3C peripheral base address. |
interruptMask | Bit mask of interrupts to disable. See _i3c_slave_flags for the set of constants that should be OR'd together to form the bit mask. |
|
inlinestatic |
base | The I3C peripheral base address. |
|
inlinestatic |
base | The I3C peripheral base address. |
|
inlinestatic |
base | The I3C peripheral base address. |
enableTx | Enable flag for transmit DMA request. Pass true for enable, false for disable. |
enableRx | Enable flag for receive DMA request. Pass true for enable, false for disable. |
width | DMA read/write unit in bytes. |
|
inlinestatic |
base | The I3C peripheral base address. |
width | DMA read/write unit in bytes. |
|
inlinestatic |
base | The I3C peripheral base address. |
width | DMA read/write unit in bytes. |
|
inlinestatic |
base | The I3C peripheral base address. |
txLvl | Transmit FIFO watermark level. The kI3C_SlaveTxReadyFlag flag is set whenever the number of words in the transmit FIFO reaches txLvl. |
rxLvl | Receive FIFO watermark level. The kI3C_SlaveRxReadyFlag flag is set whenever the number of words in the receive FIFO reaches rxLvl. |
flushTx | true if TX FIFO is to be cleared, otherwise TX FIFO remains unchanged. |
flushRx | true if RX FIFO is to be cleared, otherwise RX FIFO remains unchanged. |
|
inlinestatic |
base | The I3C peripheral base address. | |
[out] | txCount | Pointer through which the current number of bytes in the transmit FIFO is returned. Pass NULL if this value is not required. |
[out] | rxCount | Pointer through which the current number of bytes in the receive FIFO is returned. Pass NULL if this value is not required. |
void I3C_SlaveRequestEvent | ( | I3C_Type * | base, |
i3c_slave_event_t | event | ||
) |
base | The I3C peripheral base address. |
event | I3C slave event of type i3c_slave_event_t |
status_t I3C_SlaveSend | ( | I3C_Type * | base, |
const void * | txBuff, | ||
size_t | txSize | ||
) |
base | The I3C peripheral base address. |
txBuff | The pointer to the data to be transferred. |
txSize | The length in bytes of the data to be transferred. |
status_t I3C_SlaveReceive | ( | I3C_Type * | base, |
void * | rxBuff, | ||
size_t | rxSize | ||
) |
base | The I3C peripheral base address. |
rxBuff | The pointer to the data to be transferred. |
rxSize | The length in bytes of the data to be transferred. |
void I3C_SlaveTransferCreateHandle | ( | I3C_Type * | base, |
i3c_slave_handle_t * | handle, | ||
i3c_slave_transfer_callback_t | callback, | ||
void * | userData | ||
) |
The creation of a handle is for use with the non-blocking APIs. Once a handle is created, there is not a corresponding destroy handle. If the user wants to terminate a transfer, the I3C_SlaveTransferAbort() API shall be called.
base | The I3C peripheral base address. | |
[out] | handle | Pointer to the I3C slave driver handle. |
callback | User provided pointer to the asynchronous callback function. | |
userData | User provided pointer to the application callback data. |
status_t I3C_SlaveTransferNonBlocking | ( | I3C_Type * | base, |
i3c_slave_handle_t * | handle, | ||
uint32_t | eventMask | ||
) |
Call this API after calling I2C_SlaveInit() and I3C_SlaveTransferCreateHandle() to start processing transactions driven by an I2C master. The slave monitors the I2C bus and pass events to the callback that was passed into the call to I3C_SlaveTransferCreateHandle(). The callback is always invoked from the interrupt context.
The set of events received by the callback is customizable. To do so, set the eventMask parameter to the OR'd combination of i3c_slave_transfer_event_t enumerators for the events you wish to receive. The kI3C_SlaveTransmitEvent and kI3C_SlaveReceiveEvent events are always enabled and do not need to be included in the mask. Alternatively, you can pass 0 to get a default set of only the transmit and receive events that are always enabled. In addition, the kI3C_SlaveAllEvents constant is provided as a convenient way to enable all events.
base | The I3C peripheral base address. |
handle | Pointer to struct: _i3c_slave_handle structure which stores the transfer state. |
eventMask | Bit mask formed by OR'ing together i3c_slave_transfer_event_t enumerators to specify which events to send to the callback. Other accepted values are 0 to get a default set of only the transmit and receive events, and kI3C_SlaveAllEvents to enable all events. |
kStatus_Success | Slave transfers were successfully started. |
kStatus_I3C_Busy | Slave transfers have already been started on this handle. |
status_t I3C_SlaveTransferGetCount | ( | I3C_Type * | base, |
i3c_slave_handle_t * | handle, | ||
size_t * | count | ||
) |
base | The I3C peripheral base address. | |
handle | Pointer to i2c_slave_handle_t structure. | |
[out] | count | Pointer to a value to hold the number of bytes transferred. May be NULL if the count is not required. |
kStatus_Success | |
kStatus_NoTransferInProgress |
void I3C_SlaveTransferAbort | ( | I3C_Type * | base, |
i3c_slave_handle_t * | handle | ||
) |
base | The I3C peripheral base address. |
handle | Pointer to struct: _i3c_slave_handle structure which stores the transfer state. |
kStatus_Success | |
kStatus_I3C_Idle |
void I3C_SlaveTransferHandleIRQ | ( | I3C_Type * | base, |
i3c_slave_handle_t * | handle | ||
) |
base | The I3C peripheral base address. |
handle | Pointer to struct: _i3c_slave_handle structure which stores the transfer state. |
void I3C_SlaveRequestIBIWithData | ( | I3C_Type * | base, |
i3c_slave_handle_t * | handle, | ||
uint8_t * | data, | ||
size_t | dataSize | ||
) |
base | The I3C peripheral base address. |
handle | Pointer to struct: _i3c_slave_handle structure which stores the transfer state. |
data | Pointer to IBI data to be sent in the request. |
dataSize | IBI data size. |