TMPM4G9  V1.0.0.0
bsp_i2c.h File Reference

This file provides all the functions prototypes for I2C Driver. More...

#include "txz_i2c.h"
#include "txz_cg.h"

Go to the source code of this file.

Data Structures

struct  i2c_internal_info_t
 I2C internal information structure definenition. More...
 
struct  i2c_buffer_t
 I2C buffer structure definenition. More...
 
struct  i2c_t
 I2C handle structure definenition. More...
 

Macros

#define I2C_NULL   ((void *)0)
 
#define I2C_NACK   (0)
 
#define I2C_ACK   (1)
 
#define I2C_ERROR_NO_ERROR   (0)
 
#define I2C_ERROR_NO_SLAVE   (-1)
 
#define I2C_ERROR_BUS_BUSY   (-2)
 
#define I2C_ERROR_PARAM   (-3)
 
#define I2C_ERROR_OTHERS   (-4)
 
#define I2C_ERROR_ARBITRATION   (-5)
 
#define I2C_EVENT_ERROR   (1 << 1)
 
#define I2C_EVENT_ERROR_NO_SLAVE   (1 << 2)
 
#define I2C_EVENT_TRANSFER_COMPLETE   (1 << 3)
 
#define I2C_EVENT_TRANSFER_EARLY_NACK   (1 << 4)
 
#define I2C_EVENT_ALL   (I2C_EVENT_ERROR | I2C_EVENT_TRANSFER_COMPLETE | I2C_EVENT_ERROR_NO_SLAVE | I2C_EVENT_TRANSFER_EARLY_NACK)
 
#define I2C_NO_DATA   (0)
 
#define I2C_READ_ADDRESSED   (1)
 
#define I2C_WRITE_GENERAL   (2)
 
#define I2C_WRITE_ADDRESSED   (3)
 
#define I2C_CHANNEL3
 
#define I2Cx_TEXT   "I2C3"
 
#define I2C_CFG_PORT_SCL   (I2C_PORT_PJ7)
 
#define I2C_CFG_PORT_SDA   (I2C_PORT_PJ6)
 

Enumerations

enum  i2c_port_t {
  I2C_PORT_PG2 = 0, I2C_PORT_PG3, I2C_PORT_PF2, I2C_PORT_PF3,
  I2C_PORT_PG4, I2C_PORT_PG5, I2C_PORT_PJ6, I2C_PORT_PJ7,
  I2C_PORT_PJ2, I2C_PORT_PJ3
}
 i2c Port Enumerated Type Definition. More...
 

Functions

TXZ_Result i2c_init (i2c_t *p_obj, i2c_port_t sda, i2c_port_t scl)
 Initialize the I2C Driver. More...
 
TXZ_Result i2c_frequency (i2c_t *p_obj, int32_t hz)
 Configure the I2C frequency. More...
 
void i2c_reset (i2c_t *p_obj)
 Reset I2C peripheral. More...
 
TXZ_Result i2c_check_bus_free (i2c_t *p_obj)
 Check bus free on the I2C bus. More...
 
TXZ_Result i2c_start (i2c_t *p_obj)
 Creates a start condition on the I2C bus. More...
 
TXZ_Result i2c_stop (i2c_t *p_obj)
 Creates a stop condition on the I2C bus. More...
 
int32_t i2c_read (i2c_t *p_obj, int32_t address, uint8_t *p_data, int32_t length, int32_t stop)
 Blocking reading data. More...
 
int32_t i2c_write (i2c_t *p_obj, int32_t address, uint8_t *p_data, int32_t length, int32_t stop)
 Blocking sending data. More...
 
int32_t i2c_byte_read (i2c_t *p_obj, int32_t last)
 Read one byte. More...
 
int32_t i2c_byte_write (i2c_t *p_obj, int32_t data)
 Write one byte. More...
 
uint8_t i2c_active (i2c_t *p_obj)
 Attempts to determine if the I2C bus is already in use. More...
 
TXZ_Result i2c_transfer_asynch (i2c_t *p_obj, uint8_t *p_tx, int32_t tx_length, uint8_t *p_rx, int32_t rx_length, int32_t address, int32_t stop)
 Start I2C asynchronous transfer. More...
 
uint32_t i2c_irq_handler_asynch (i2c_t *p_obj)
 The asynchronous IRQ handler. More...
 
void i2c_abort_asynch (i2c_t *p_obj)
 Abort asynchronous transfer. More...
 
void i2c_slave_mode (i2c_t *p_obj, int32_t enable_slave)
 Configure I2C as slave or master. More...
 
int32_t i2c_slave_receive (i2c_t *p_obj)
 Check to see if the I2C slave has been addressed. More...
 
int32_t i2c_slave_read (i2c_t *p_obj, uint8_t *p_data, int32_t length)
 Blocking reading data. More...
 
int32_t i2c_slave_write (i2c_t *p_obj, uint8_t *p_data, int32_t length)
 Blocking sending data. More...
 
void i2c_slave_address (i2c_t *p_obj, uint32_t address)
 Configure I2C slave address. More...
 
TXZ_Result i2c_slave_transfer_asynch (i2c_t *p_obj, uint8_t *p_tx, int32_t tx_length, uint8_t *p_rx, int32_t rx_length)
 Start I2C asynchronous transfer. More...
 
uint32_t i2c_slave_irq_handler_asynch (i2c_t *p_obj)
 The asynchronous IRQ handler. More...
 
void i2c_slave_abort_asynch (i2c_t *p_obj)
 Abort asynchronous transfer. More...
 

Detailed Description

This file provides all the functions prototypes for I2C Driver.

Version
V1.0.0.2
Date
2018-02-08

DO NOT USE THIS SOFTWARE WITHOUT THE SOFTWARE LISENSE AGREEMENT.

Copyright(C) Toshiba Electronic Device Solutions Corporation 2019