S32 SDK
lpi2c_driver.h File Reference
#include <stddef.h>
#include <stdbool.h>
#include "device_registers.h"
#include "status.h"
#include "lpi2c_hal.h"
#include "edma_driver.h"
#include "osif.h"

Go to the source code of this file.

Data Structures

struct  lpi2c_master_user_config_t
 Master configuration structure. More...
 
struct  lpi2c_slave_user_config_t
 Slave configuration structure. More...
 
struct  lpi2c_baud_rate_params_t
 Baud rate structure. More...
 
struct  lpi2c_master_state_t
 Master internal context structure. More...
 
struct  lpi2c_slave_state_t
 Slave internal context structure. More...
 

Typedefs

typedef void(* lpi2c_master_callback_t) (uint8_t instance, lpi2c_master_event_t masterEvent, void *userData)
 Defines the example structure. More...
 
typedef void(* lpi2c_slave_callback_t) (uint8_t instance, lpi2c_slave_event_t slaveEvent, void *userData)
 LPI2C slave callback function. More...
 

Enumerations

enum  lpi2c_mode_t { LPI2C_STANDARD_MODE = 0x0U, LPI2C_FAST_MODE = 0x1U }
 I2C operating modes Implements : lpi2c_mode_t_Class. More...
 
enum  lpi2c_master_event_t {
  LPI2C_MASTER_EVENT_TX = 0x0U, LPI2C_MASTER_EVENT_RX = 0x1U, LPI2C_MASTER_EVENT_FIFO_ERROR = 0x2U, LPI2C_MASTER_EVENT_ARBITRATION_LOST = 0x3U,
  LPI2C_MASTER_EVENT_NACK = 0x4U
}
 LPI2C master events Implements : lpi2c_master_event_t_Class. More...
 
enum  lpi2c_slave_event_t {
  LPI2C_SLAVE_EVENT_TX_REQ = 0x02U, LPI2C_SLAVE_EVENT_RX_REQ = 0x04U, LPI2C_SLAVE_EVENT_TX_EMPTY = 0x10U, LPI2C_SLAVE_EVENT_RX_FULL = 0x20U,
  LPI2C_SLAVE_EVENT_STOP = 0x80U
}
 LPI2C slave events Implements : lpi2c_slave_event_t_Class. More...
 
enum  lpi2c_transfer_type_t { LPI2C_USING_DMA = 0, LPI2C_USING_INTERRUPTS = 1 }
 Type of LPI2C transfer (based on interrupts or DMA). Implements : lpi2c_transfer_type_t_Class. More...
 

Functions

LPI2C Driver
status_t LPI2C_DRV_MasterInit (uint32_t instance, const lpi2c_master_user_config_t *userConfigPtr, lpi2c_master_state_t *master)
 Initialize the LPI2C master mode driver. More...
 
status_t LPI2C_DRV_MasterDeinit (uint32_t instance)
 De-initialize the LPI2C master mode driver. More...
 
void LPI2C_DRV_MasterGetBaudRate (uint32_t instance, lpi2c_baud_rate_params_t *baudRate)
 Get the currently configured baud rate. More...
 
void LPI2C_DRV_MasterSetBaudRate (uint32_t instance, const lpi2c_mode_t operatingMode, const lpi2c_baud_rate_params_t baudRate)
 Set the baud rate for any subsequent I2C communication. More...
 
void LPI2C_DRV_MasterSetSlaveAddr (uint32_t instance, const uint16_t address, const bool is10bitAddr)
 Set the slave address for any subsequent I2C communication. More...
 
status_t LPI2C_DRV_MasterSendData (uint32_t instance, const uint8_t *txBuff, uint32_t txSize, bool sendStop)
 Perform a non-blocking send transaction on the I2C bus. More...
 
status_t LPI2C_DRV_MasterSendDataBlocking (uint32_t instance, const uint8_t *txBuff, uint32_t txSize, bool sendStop, uint32_t timeout)
 Perform a blocking send transaction on the I2C bus. More...
 
status_t LPI2C_DRV_MasterAbortTransferData (uint32_t instance)
 Abort a non-blocking I2C Master transmission or reception. More...
 
status_t LPI2C_DRV_MasterReceiveData (uint32_t instance, uint8_t *rxBuff, uint32_t rxSize, bool sendStop)
 Perform a non-blocking receive transaction on the I2C bus. More...
 
status_t LPI2C_DRV_MasterReceiveDataBlocking (uint32_t instance, uint8_t *rxBuff, uint32_t rxSize, bool sendStop, uint32_t timeout)
 Perform a blocking receive transaction on the I2C bus. More...
 
status_t LPI2C_DRV_MasterGetTransferStatus (uint32_t instance, uint32_t *bytesRemaining)
 Return the current status of the I2C master transfer. More...
 
void LPI2C_DRV_MasterIRQHandler (uint32_t instance)
 Handle master operation when I2C interrupt occurs. More...
 
status_t LPI2C_DRV_SlaveInit (uint32_t instance, const lpi2c_slave_user_config_t *userConfigPtr, lpi2c_slave_state_t *slave)
 Initialize the I2C slave mode driver. More...
 
status_t LPI2C_DRV_SlaveDeinit (uint32_t instance)
 De-initialize the I2C slave mode driver. More...
 
status_t LPI2C_DRV_SlaveSetTxBuffer (uint32_t instance, const uint8_t *txBuff, uint32_t txSize)
 Provide a buffer for transmitting data. More...
 
status_t LPI2C_DRV_SlaveSetRxBuffer (uint32_t instance, uint8_t *rxBuff, uint32_t rxSize)
 Provide a buffer for receiving data. More...
 
status_t LPI2C_DRV_SlaveSendData (uint32_t instance, const uint8_t *txBuff, uint32_t txSize)
 Perform a non-blocking send transaction on the I2C bus. More...
 
status_t LPI2C_DRV_SlaveSendDataBlocking (uint32_t instance, const uint8_t *txBuff, uint32_t txSize, uint32_t timeout)
 Perform a blocking send transaction on the I2C bus. More...
 
status_t LPI2C_DRV_SlaveReceiveData (uint32_t instance, uint8_t *rxBuff, uint32_t rxSize)
 Perform a non-blocking receive transaction on the I2C bus. More...
 
status_t LPI2C_DRV_SlaveReceiveDataBlocking (uint32_t instance, uint8_t *rxBuff, uint32_t rxSize, uint32_t timeout)
 Perform a blocking receive transaction on the I2C bus. More...
 
status_t LPI2C_DRV_SlaveGetTransferStatus (uint32_t instance, uint32_t *bytesRemaining)
 Return the current status of the I2C slave transfer. More...
 
status_t LPI2C_DRV_SlaveAbortTransferData (uint32_t instance)
 Abort a non-blocking I2C Master transmission or reception. More...
 
void LPI2C_DRV_SlaveIRQHandler (uint32_t instance)
 Handle slave operation when I2C interrupt occurs. More...