Classes | Typedefs | Enumerations
fsl_lpi2c.h File Reference
#include <stddef.h>
#include "fsl_device_registers.h"
#include "fsl_common.h"
Include dependency graph for fsl_lpi2c.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _lpi2c_master_config
 Structure with settings to initialize the LPI2C master module. More...
 
struct  _lpi2c_master_handle
 Driver handle for master non-blocking APIs. More...
 
struct  _lpi2c_master_transfer
 Non-blocking transfer descriptor structure. More...
 
struct  _lpi2c_match_config
 LPI2C master data match configuration structure. More...
 
struct  _lpi2c_slave_config
 Structure with settings to initialize the LPI2C slave module. More...
 
struct  _lpi2c_slave_handle
 LPI2C slave handle structure. More...
 
struct  _lpi2c_slave_transfer
 LPI2C slave transfer structure. More...
 

Typedefs

typedef enum _lpi2c_data_match_config_mode lpi2c_data_match_config_mode_t
 LPI2C master data match configuration modes. More...
 
typedef struct _lpi2c_match_config lpi2c_data_match_config_t
 LPI2C master data match configuration structure. More...
 
typedef enum _lpi2c_direction lpi2c_direction_t
 Direction of master and slave transfers. More...
 
typedef enum _lpi2c_host_request_polarity lpi2c_host_request_polarity_t
 LPI2C master host request pin polarity configuration. More...
 
typedef enum _lpi2c_host_request_source lpi2c_host_request_source_t
 LPI2C master host request selection. More...
 
typedef struct _lpi2c_master_config lpi2c_master_config_t
 Structure with settings to initialize the LPI2C master module. More...
 
typedef struct _lpi2c_master_handle lpi2c_master_handle_t
 
typedef enum _lpi2c_master_pin_config lpi2c_master_pin_config_t
 LPI2C pin configuration. More...
 
typedef void(* lpi2c_master_transfer_callback_t) (LPI2C_Type *base, lpi2c_master_handle_t *handle, status_t completionStatus, void *userData)
 Master completion callback function pointer type. More...
 
typedef struct _lpi2c_master_transfer lpi2c_master_transfer_t
 
typedef enum _lpi2c_slave_address_match lpi2c_slave_address_match_t
 LPI2C slave address match options. More...
 
typedef struct _lpi2c_slave_config lpi2c_slave_config_t
 Structure with settings to initialize the LPI2C slave module. More...
 
typedef struct _lpi2c_slave_handle lpi2c_slave_handle_t
 
typedef void(* lpi2c_slave_transfer_callback_t) (LPI2C_Type *base, lpi2c_slave_transfer_t *transfer, void *userData)
 Slave event callback function pointer type. More...
 
typedef enum _lpi2c_slave_transfer_event lpi2c_slave_transfer_event_t
 Set of events sent to the callback for non blocking slave transfers. More...
 
typedef struct _lpi2c_slave_transfer lpi2c_slave_transfer_t
 LPI2C slave transfer structure. More...
 

Enumerations

enum  {
  kLPI2C_MasterTxReadyFlag = LPI2C_MSR_TDF_MASK, kLPI2C_MasterRxReadyFlag = LPI2C_MSR_RDF_MASK, kLPI2C_MasterEndOfPacketFlag = LPI2C_MSR_EPF_MASK, kLPI2C_MasterStopDetectFlag = LPI2C_MSR_SDF_MASK,
  kLPI2C_MasterNackDetectFlag = LPI2C_MSR_NDF_MASK, kLPI2C_MasterArbitrationLostFlag = LPI2C_MSR_ALF_MASK, kLPI2C_MasterFifoErrFlag = LPI2C_MSR_FEF_MASK, kLPI2C_MasterPinLowTimeoutFlag = LPI2C_MSR_PLTF_MASK,
  kLPI2C_MasterDataMatchFlag = LPI2C_MSR_DMF_MASK, kLPI2C_MasterBusyFlag = LPI2C_MSR_MBF_MASK, kLPI2C_MasterBusBusyFlag = LPI2C_MSR_BBF_MASK
}
 LPI2C master peripheral flags. More...
 
enum  _lpi2c_data_match_config_mode {
  kLPI2C_MatchDisabled = 0x0U, kLPI2C_1stWordEqualsM0OrM1 = 0x2U, kLPI2C_AnyWordEqualsM0OrM1 = 0x3U, kLPI2C_1stWordEqualsM0And2ndWordEqualsM1,
  kLPI2C_AnyWordEqualsM0AndNextWordEqualsM1, kLPI2C_1stWordAndM1EqualsM0AndM1, kLPI2C_AnyWordAndM1EqualsM0AndM1
}
 LPI2C master data match configuration modes. More...
 
enum  _lpi2c_direction { kLPI2C_Write = 0U, kLPI2C_Read = 1U }
 Direction of master and slave transfers. More...
 
enum  _lpi2c_host_request_polarity { kLPI2C_HostRequestPinActiveLow = 0x0U, kLPI2C_HostRequestPinActiveHigh = 0x1U }
 LPI2C master host request pin polarity configuration. More...
 
enum  _lpi2c_host_request_source { kLPI2C_HostRequestExternalPin = 0x0U, kLPI2C_HostRequestInputTrigger = 0x1U }
 LPI2C master host request selection. More...
 
enum  _lpi2c_master_pin_config {
  kLPI2C_2PinOpenDrain = 0x0U, kLPI2C_2PinOutputOnly = 0x1U, kLPI2C_2PinPushPull = 0x2U, kLPI2C_4PinPushPull = 0x3U,
  kLPI2C_2PinOpenDrainWithSeparateSlave, kLPI2C_2PinOutputOnlyWithSeparateSlave, kLPI2C_2PinPushPullWithSeparateSlave, kLPI2C_4PinPushPullWithInvertedOutput = 0x7U
}
 LPI2C pin configuration. More...
 
enum  _lpi2c_master_transfer_flags { kLPI2C_TransferDefaultFlag = 0x00U, kLPI2C_TransferNoStartFlag = 0x01U, kLPI2C_TransferRepeatedStartFlag = 0x02U, kLPI2C_TransferNoStopFlag = 0x04U }
 Transfer option flags. More...
 
enum  _lpi2c_slave_address_match { kLPI2C_MatchAddress0 = 0U, kLPI2C_MatchAddress0OrAddress1 = 2U, kLPI2C_MatchAddress0ThroughAddress1 = 6U }
 LPI2C slave address match options. More...
 
enum  _lpi2c_slave_flags {
  kLPI2C_SlaveTxReadyFlag = LPI2C_SSR_TDF_MASK, kLPI2C_SlaveRxReadyFlag = LPI2C_SSR_RDF_MASK, kLPI2C_SlaveAddressValidFlag = LPI2C_SSR_AVF_MASK, kLPI2C_SlaveTransmitAckFlag = LPI2C_SSR_TAF_MASK,
  kLPI2C_SlaveRepeatedStartDetectFlag = LPI2C_SSR_RSF_MASK, kLPI2C_SlaveStopDetectFlag = LPI2C_SSR_SDF_MASK, kLPI2C_SlaveBitErrFlag = LPI2C_SSR_BEF_MASK, kLPI2C_SlaveFifoErrFlag = LPI2C_SSR_FEF_MASK,
  kLPI2C_SlaveAddressMatch0Flag = LPI2C_SSR_AM0F_MASK, kLPI2C_SlaveAddressMatch1Flag = LPI2C_SSR_AM1F_MASK, kLPI2C_SlaveGeneralCallFlag = LPI2C_SSR_GCF_MASK, kLPI2C_SlaveBusyFlag = LPI2C_SSR_SBF_MASK,
  kLPI2C_SlaveBusBusyFlag = LPI2C_SSR_BBF_MASK
}
 LPI2C slave peripheral flags. More...
 
enum  _lpi2c_slave_transfer_event {
  kLPI2C_SlaveAddressMatchEvent = 0x01U, kLPI2C_SlaveTransmitEvent = 0x02U, kLPI2C_SlaveReceiveEvent = 0x04U, kLPI2C_SlaveTransmitAckEvent = 0x08U,
  kLPI2C_SlaveRepeatedStartEvent = 0x10U, kLPI2C_SlaveCompletionEvent = 0x20U, kLPI2C_SlaveAllEvents
}
 Set of events sent to the callback for non blocking slave transfers. More...
 

Functions

Initialization and deinitialization
status_t LPI2C_CheckForBusyBus (LPI2C_Type *base)
 Make sure the bus isn't already busy. More...
 
status_t LPI2C_MasterCheckAndClearError (LPI2C_Type *base, uint32_t status)
 Convert provided flags to status code, and clear any errors if present. More...
 
void LPI2C_MasterConfigureDataMatch (LPI2C_Type *base, const lpi2c_data_match_config_t *config)
 Configures LPI2C master data match feature. More...
 
void LPI2C_MasterDeinit (LPI2C_Type *base)
 Deinitializes the LPI2C master peripheral. More...
 
static void LPI2C_MasterEnable (LPI2C_Type *base, bool enable)
 Enables or disables the LPI2C module as master. More...
 
void LPI2C_MasterGetDefaultConfig (lpi2c_master_config_t *masterConfig)
 Provides a default configuration for the LPI2C master peripheral. More...
 
void LPI2C_MasterInit (LPI2C_Type *base, const lpi2c_master_config_t *masterConfig, uint32_t sourceClock_Hz)
 Initializes the LPI2C master peripheral. More...
 
static void LPI2C_MasterReset (LPI2C_Type *base)
 Performs a software reset. More...
 
Status
static void LPI2C_MasterClearStatusFlags (LPI2C_Type *base, uint32_t statusMask)
 Clears the LPI2C master status flag state. More...
 
static uint32_t LPI2C_MasterGetStatusFlags (LPI2C_Type *base)
 Gets the LPI2C master status flags. More...
 
Interrupts
static void LPI2C_MasterDisableInterrupts (LPI2C_Type *base, uint32_t interruptMask)
 Disables the LPI2C master interrupt requests. More...
 
static void LPI2C_MasterEnableInterrupts (LPI2C_Type *base, uint32_t interruptMask)
 Enables the LPI2C master interrupt requests. More...
 
static uint32_t LPI2C_MasterGetEnabledInterrupts (LPI2C_Type *base)
 Returns the set of currently enabled LPI2C master interrupt requests. More...
 
DMA control
static void LPI2C_MasterEnableDMA (LPI2C_Type *base, bool enableTx, bool enableRx)
 Enables or disables LPI2C master DMA requests. More...
 
static uint32_t LPI2C_MasterGetRxFifoAddress (LPI2C_Type *base)
 Gets LPI2C master receive data register address for DMA transfer. More...
 
static uint32_t LPI2C_MasterGetTxFifoAddress (LPI2C_Type *base)
 Gets LPI2C master transmit data register address for DMA transfer. More...
 
FIFO control
static void LPI2C_MasterGetFifoCounts (LPI2C_Type *base, size_t *rxCount, size_t *txCount)
 Gets the current number of words in the LPI2C master FIFOs. More...
 
static void LPI2C_MasterSetWatermarks (LPI2C_Type *base, size_t txWords, size_t rxWords)
 Sets the watermarks for LPI2C master FIFOs. More...
 
Bus operations
static bool LPI2C_MasterGetBusIdleState (LPI2C_Type *base)
 Returns whether the bus is idle. More...
 
status_t LPI2C_MasterReceive (LPI2C_Type *base, void *rxBuff, size_t rxSize)
 Performs a polling receive transfer on the I2C bus. More...
 
static status_t LPI2C_MasterRepeatedStart (LPI2C_Type *base, uint8_t address, lpi2c_direction_t dir)
 Sends a repeated START signal and slave address on the I2C bus. More...
 
status_t LPI2C_MasterSend (LPI2C_Type *base, void *txBuff, size_t txSize)
 Performs a polling send transfer on the I2C bus. More...
 
void LPI2C_MasterSetBaudRate (LPI2C_Type *base, uint32_t sourceClock_Hz, uint32_t baudRate_Hz)
 Sets the I2C bus frequency for master transactions. More...
 
status_t LPI2C_MasterStart (LPI2C_Type *base, uint8_t address, lpi2c_direction_t dir)
 Sends a START signal and slave address on the I2C bus. More...
 
status_t LPI2C_MasterStop (LPI2C_Type *base)
 Sends a STOP signal on the I2C bus. More...
 
status_t LPI2C_MasterTransferBlocking (LPI2C_Type *base, lpi2c_master_transfer_t *transfer)
 Performs a master polling transfer on the I2C bus. More...
 
Non-blocking
void LPI2C_MasterTransferAbort (LPI2C_Type *base, lpi2c_master_handle_t *handle)
 Terminates a non-blocking LPI2C master transmission early. More...
 
void LPI2C_MasterTransferCreateHandle (LPI2C_Type *base, lpi2c_master_handle_t *handle, lpi2c_master_transfer_callback_t callback, void *userData)
 Creates a new handle for the LPI2C master non-blocking APIs. More...
 
status_t LPI2C_MasterTransferGetCount (LPI2C_Type *base, lpi2c_master_handle_t *handle, size_t *count)
 Returns number of bytes transferred so far. More...
 
status_t LPI2C_MasterTransferNonBlocking (LPI2C_Type *base, lpi2c_master_handle_t *handle, lpi2c_master_transfer_t *transfer)
 Performs a non-blocking transaction on the I2C bus. More...
 
IRQ handler
void LPI2C_MasterTransferHandleIRQ (LPI2C_Type *base, lpi2c_master_handle_t *handle)
 Reusable routine to handle master interrupts. More...
 
Slave initialization and deinitialization
void LPI2C_SlaveDeinit (LPI2C_Type *base)
 Deinitializes the LPI2C slave peripheral. More...
 
static void LPI2C_SlaveEnable (LPI2C_Type *base, bool enable)
 Enables or disables the LPI2C module as slave. More...
 
void LPI2C_SlaveGetDefaultConfig (lpi2c_slave_config_t *slaveConfig)
 Provides a default configuration for the LPI2C slave peripheral. More...
 
void LPI2C_SlaveInit (LPI2C_Type *base, const lpi2c_slave_config_t *slaveConfig, uint32_t sourceClock_Hz)
 Initializes the LPI2C slave peripheral. More...
 
static void LPI2C_SlaveReset (LPI2C_Type *base)
 Performs a software reset of the LPI2C slave peripheral. More...
 
Slave status
static void LPI2C_SlaveClearStatusFlags (LPI2C_Type *base, uint32_t statusMask)
 Clears the LPI2C status flag state. More...
 
static uint32_t LPI2C_SlaveGetStatusFlags (LPI2C_Type *base)
 Gets the LPI2C slave status flags. More...
 
Slave interrupts
static void LPI2C_SlaveDisableInterrupts (LPI2C_Type *base, uint32_t interruptMask)
 Disables the LPI2C slave interrupt requests. More...
 
static void LPI2C_SlaveEnableInterrupts (LPI2C_Type *base, uint32_t interruptMask)
 Enables the LPI2C slave interrupt requests. More...
 
static uint32_t LPI2C_SlaveGetEnabledInterrupts (LPI2C_Type *base)
 Returns the set of currently enabled LPI2C slave interrupt requests. More...
 
Slave DMA control
static void LPI2C_SlaveEnableDMA (LPI2C_Type *base, bool enableAddressValid, bool enableRx, bool enableTx)
 Enables or disables the LPI2C slave peripheral DMA requests. More...
 
Slave bus operations
static bool LPI2C_SlaveGetBusIdleState (LPI2C_Type *base)
 Returns whether the bus is idle. More...
 
static uint32_t LPI2C_SlaveGetReceivedAddress (LPI2C_Type *base)
 Returns the slave address sent by the I2C master. More...
 
status_t LPI2C_SlaveReceive (LPI2C_Type *base, void *rxBuff, size_t rxSize, size_t *actualRxSize)
 Performs a polling receive transfer on the I2C bus. More...
 
status_t LPI2C_SlaveSend (LPI2C_Type *base, void *txBuff, size_t txSize, size_t *actualTxSize)
 Performs a polling send transfer on the I2C bus. More...
 
static void LPI2C_SlaveTransmitAck (LPI2C_Type *base, bool ackOrNack)
 Transmits either an ACK or NAK on the I2C bus in response to a byte from the master. More...
 
Slave non-blocking
void LPI2C_SlaveTransferAbort (LPI2C_Type *base, lpi2c_slave_handle_t *handle)
 Aborts the slave non-blocking transfers. More...
 
void LPI2C_SlaveTransferCreateHandle (LPI2C_Type *base, lpi2c_slave_handle_t *handle, lpi2c_slave_transfer_callback_t callback, void *userData)
 Creates a new handle for the LPI2C slave non-blocking APIs. More...
 
status_t LPI2C_SlaveTransferGetCount (LPI2C_Type *base, lpi2c_slave_handle_t *handle, size_t *count)
 Gets the slave transfer status during a non-blocking transfer. More...
 
status_t LPI2C_SlaveTransferNonBlocking (LPI2C_Type *base, lpi2c_slave_handle_t *handle, uint32_t eventMask)
 Starts accepting slave transfers. More...
 
Slave IRQ handler
void LPI2C_SlaveTransferHandleIRQ (LPI2C_Type *base, lpi2c_slave_handle_t *handle)
 Reusable routine to handle slave interrupts. More...
 

Driver version

enum  {
  kStatus_LPI2C_Busy = MAKE_STATUS(kStatusGroup_LPI2C, 0), kStatus_LPI2C_Idle = MAKE_STATUS(kStatusGroup_LPI2C, 1), kStatus_LPI2C_Nak = MAKE_STATUS(kStatusGroup_LPI2C, 2), kStatus_LPI2C_FifoError = MAKE_STATUS(kStatusGroup_LPI2C, 3),
  kStatus_LPI2C_BitError = MAKE_STATUS(kStatusGroup_LPI2C, 4), kStatus_LPI2C_ArbitrationLost = MAKE_STATUS(kStatusGroup_LPI2C, 5), kStatus_LPI2C_PinLowTimeout, kStatus_LPI2C_NoTransferInProgress,
  kStatus_LPI2C_DmaRequestFail = MAKE_STATUS(kStatusGroup_LPI2C, 8), kStatus_LPI2C_Timeout = MAKE_STATUS(kStatusGroup_LPI2C, 9)
}
 LPI2C status return codes. More...
 
#define FSL_LPI2C_DRIVER_VERSION   (MAKE_VERSION(2, 1, 11))
 LPI2C driver version 2.1.11. More...
 
#define I2C_RETRY_TIMES   0U /* Define to zero means keep waiting until the flag is assert/deassert. */
 Retry times for waiting flag. More...
 


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:57