Remove I2C slave methods from I2C master interface; rename i2c_dev_s to i2c_master_s.

This commit is contained in:
Gregory Nutt 2016-01-30 08:36:47 -06:00
parent ceb415204e
commit 3a781a2d3f
59 changed files with 171 additions and 209 deletions

@ -1 +1 @@
Subproject commit b7d0b9c21a8f8990810c2db4ff5dbd1b747e3d03
Subproject commit bd05adddce9f801523a2b77363a8dddb01c952b3

2
arch

@ -1 +1 @@
Subproject commit ce5362e2daf21444768b5219eb0eca6fa7929ea1
Subproject commit 5ea918534aef71cdff40f56081c70de8818cb5bc

@ -1 +1 @@
Subproject commit 6b24789ace585ef78778cff3a3c894ad11db6166
Subproject commit c4eea61723a32ae07781338cd9a80637dec07822

View file

@ -2464,7 +2464,7 @@ static void wm8904_hw_reset(FAR struct wm8904_dev_s *priv)
****************************************************************************/
FAR struct audio_lowerhalf_s *
wm8904_initialize(FAR struct i2c_dev_s *i2c, FAR struct i2s_dev_s *i2s,
wm8904_initialize(FAR struct i2c_master_s *i2c, FAR struct i2s_dev_s *i2s,
FAR const struct wm8904_lower_s *lower)
{
FAR struct wm8904_dev_s *priv;

View file

@ -1067,7 +1067,7 @@ struct wm8904_dev_s
/* Our specific driver data goes here */
const FAR struct wm8904_lower_s *lower; /* Pointer to the board lower functions */
FAR struct i2c_dev_s *i2c; /* I2C driver to use */
FAR struct i2c_master_s *i2c; /* I2C driver to use */
FAR struct i2s_dev_s *i2s; /* I2S driver to use */
struct dq_queue_s pendq; /* Queue of pending buffers to be sent */
struct dq_queue_s doneq; /* Queue of sent buffers to be returned */

View file

@ -68,7 +68,8 @@
*
****************************************************************************/
int i2c_read(FAR struct i2c_dev_s *dev, FAR const struct i2c_config_s *config,
int i2c_read(FAR struct i2c_master_s *dev,
FAR const struct i2c_config_s *config,
FAR uint8_t *buffer, int buflen)
{
struct i2c_msg_s msg;

View file

@ -68,7 +68,8 @@
*
****************************************************************************/
int i2c_write(FAR struct i2c_dev_s *dev, FAR const struct i2c_config_s *config,
int i2c_write(FAR struct i2c_master_s *dev,
FAR const struct i2c_config_s *config,
FAR const uint8_t *buffer, int buflen)
{
struct i2c_msg_s msg;

View file

@ -69,7 +69,8 @@
*
****************************************************************************/
int i2c_writeread(FAR struct i2c_dev_s *dev, FAR const struct i2c_config_s *config,
int i2c_writeread(FAR struct i2c_master_s *dev,
FAR const struct i2c_config_s *config,
FAR const uint8_t *wbuffer, int wbuflen,
FAR uint8_t *rbuffer, int rbuflen)
{

View file

@ -165,7 +165,7 @@ struct mxt_dev_s
* lower half configuration data.
*/
FAR struct i2c_dev_s *i2c;
FAR struct i2c_master_s *i2c;
FAR const struct mxt_lower_s *lower;
/* This is the allocated array of object information */
@ -1850,7 +1850,7 @@ errout_with_objtab:
*
****************************************************************************/
int mxt_register(FAR struct i2c_dev_s *i2c,
int mxt_register(FAR struct i2c_master_s *i2c,
FAR const struct mxt_lower_s * const lower, int minor)
{
FAR struct mxt_dev_s *priv;

View file

@ -138,7 +138,7 @@ struct stmpe811_dev_s
#ifdef CONFIG_STMPE811_SPI
FAR struct spi_dev_s *spi; /* Saved SPI driver instance */
#else
FAR struct i2c_dev_s *i2c; /* Saved I2C driver instance */
FAR struct i2c_master_s *i2c; /* Saved I2C driver instance */
#endif
uint8_t inuse; /* STMPE811 pins in use */

View file

@ -287,7 +287,7 @@ static void stmpe811_reset(FAR struct stmpe811_dev_s *priv)
STMPE811_HANDLE stmpe811_instantiate(FAR struct spi_dev_s *dev,
FAR struct stmpe811_config_s *config)
#else
STMPE811_HANDLE stmpe811_instantiate(FAR struct i2c_dev_s *dev,
STMPE811_HANDLE stmpe811_instantiate(FAR struct i2c_master_s *dev,
FAR struct stmpe811_config_s *config)
#endif
{

View file

@ -165,7 +165,7 @@ struct tsc2007_dev_s
sem_t waitsem; /* Used to wait for the availability of data */
FAR struct tsc2007_config_s *config; /* Board configuration data */
FAR struct i2c_dev_s *i2c; /* Saved I2C driver instance */
FAR struct i2c_master_s *i2c; /* Saved I2C driver instance */
struct work_s work; /* Supports the interrupt handling "bottom half" */
struct tsc2007_sample_s sample; /* Last sampled touch point data */
@ -1210,7 +1210,7 @@ errout:
*
****************************************************************************/
int tsc2007_register(FAR struct i2c_dev_s *dev,
int tsc2007_register(FAR struct i2c_master_s *dev,
FAR struct tsc2007_config_s *config, int minor)
{
FAR struct tsc2007_dev_s *priv;

View file

@ -587,7 +587,7 @@ static int pca9555_interrupt(int irq, FAR void *context)
*
****************************************************************************/
FAR struct ioexpander_dev_s *pca9555_initialize(FAR struct i2c_dev_s *i2cdev,
FAR struct ioexpander_dev_s *pca9555_initialize(FAR struct i2c_master_s *i2cdev,
FAR struct pca9555_config_s *config)
{
FAR struct pca9555_dev_s *pcadev;

View file

@ -116,14 +116,14 @@
struct pca9555_dev_s
{
struct ioexpander_dev_s dev; /* Nested structure to allow casting as public gpio expander. */
struct ioexpander_dev_s dev; /* Nested structure to allow casting as public gpio expander. */
#ifdef CONFIG_PCA9555_MULTIPLE
FAR struct pca9555_dev_s * flink; /* Supports a singly linked list of drivers */
FAR struct pca9555_dev_s *flink; /* Supports a singly linked list of drivers */
#endif
FAR struct pca9555_config_s *config; /* Board configuration data */
FAR struct i2c_dev_s * i2c; /* Saved I2C driver instance */
FAR struct i2c_master_s *i2c; /* Saved I2C driver instance */
};

View file

@ -234,7 +234,7 @@ struct ssd1306_dev_s
#ifdef CONFIG_LCD_SSD1306_SPI
FAR struct spi_dev_s *spi; /* Cached SPI device reference */
#else
FAR struct i2c_dev_s *i2c; /* Cached SPI device reference */
FAR struct i2c_master_s *i2c; /* Cached SPI device reference */
uint8_t addr; /* 7-bit I2C address */
#endif
uint8_t contrast; /* Current contrast setting */

View file

@ -807,7 +807,7 @@ static int ssd1306_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
#ifdef CONFIG_LCD_SSD1306_SPI
FAR struct lcd_dev_s *ssd1306_initialize(FAR struct spi_dev_s *dev, unsigned int devno)
#else
FAR struct lcd_dev_s *ssd1306_initialize(FAR struct i2c_dev_s *dev, unsigned int devno)
FAR struct lcd_dev_s *ssd1306_initialize(FAR struct i2c_master_s *dev, unsigned int devno)
#endif
{
FAR struct ssd1306_dev_s *priv = &g_oleddev;

View file

@ -54,7 +54,7 @@
struct pca9635pw_dev_s
{
FAR struct i2c_dev_s *i2c;
FAR struct i2c_master_s *i2c;
uint8_t i2c_addr;
};
@ -351,7 +351,7 @@ static int pca9635pw_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
*
****************************************************************************/
int pca9635pw_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
int pca9635pw_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
uint8_t const pca9635pw_i2c_addr)
{
/* Sanity check */

View file

@ -150,15 +150,15 @@
struct at24c_dev_s
{
struct mtd_dev_s mtd; /* MTD interface */
FAR struct i2c_dev_s *dev; /* Saved I2C interface instance */
bool initd; /* True: The device has been initialize */
struct mtd_dev_s mtd; /* MTD interface */
FAR struct i2c_master_s *dev; /* Saved I2C interface instance */
bool initd; /* True: The device has been initialize */
#ifdef CONFIG_AT24XX_EXTENDED
bool extended; /* True: use extended memory region */
bool extended; /* True: use extended memory region */
#endif
uint8_t addr; /* I2C address */
uint16_t pagesize; /* 32, 63 */
uint16_t npages; /* 128, 256, 512, 1024 */
uint8_t addr; /* I2C address */
uint16_t pagesize; /* 32, 63 */
uint16_t npages; /* 128, 256, 512, 1024 */
};
/************************************************************************************
@ -547,9 +547,9 @@ static int at24c_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
************************************************************************************/
#ifdef CONFIG_AT24XX_MULTI
FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_dev_s *dev, uint8_t address)
FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_master_s *dev, uint8_t address)
#else
FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_dev_s *dev)
FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_master_s *dev)
#endif
{
FAR struct at24c_dev_s *priv;

View file

@ -93,13 +93,13 @@ struct bq2425x_dev_s
/* The common part of the battery driver visible to the upper-half driver */
FAR const struct battery_charger_operations_s *ops; /* Battery operations */
sem_t batsem; /* Enforce mutually exclusive access */
sem_t batsem; /* Enforce mutually exclusive access */
/* Data fields specific to the lower half BQ2425x driver follow */
FAR struct i2c_dev_s *i2c; /* I2C interface */
uint8_t addr; /* I2C address */
uint32_t frequency; /* I2C frequency */
FAR struct i2c_master_s *i2c; /* I2C interface */
uint8_t addr; /* I2C address */
uint32_t frequency; /* I2C frequency */
};
/****************************************************************************
@ -715,8 +715,9 @@ static int bq2425x_current(struct battery_charger_dev_s *dev, int value)
*
****************************************************************************/
FAR struct battery_charger_dev_s *bq2425x_initialize(FAR struct i2c_dev_s *i2c,
uint8_t addr, uint32_t frequency)
FAR struct battery_charger_dev_s *
bq2425x_initialize(FAR struct i2c_master_s *i2c, uint8_t addr,
uint32_t frequency)
{
FAR struct bq2425x_dev_s *priv;
int ret;

View file

@ -178,13 +178,13 @@ struct max1704x_dev_s
/* The common part of the battery driver visible to the upper-half driver */
FAR const struct battery_gauge_operations_s *ops; /* Battery operations */
sem_t batsem; /* Enforce mutually exclusive access */
sem_t batsem; /* Enforce mutually exclusive access */
/* Data fields specific to the lower half MAX1704x driver follow */
FAR struct i2c_dev_s *i2c; /* I2C interface */
uint8_t addr; /* I2C address */
uint32_t frequency; /* I2C frequency */
FAR struct i2c_master_s *i2c; /* I2C interface */
uint8_t addr; /* I2C address */
uint32_t frequency; /* I2C frequency */
};
/****************************************************************************
@ -520,7 +520,7 @@ static int max1704x_capacity(struct battery_gauge_dev_s *dev, b16_t *value)
*
****************************************************************************/
FAR struct battery_gauge_dev_s *max1704x_initialize(FAR struct i2c_dev_s *i2c,
FAR struct battery_gauge_dev_s *max1704x_initialize(FAR struct i2c_master_s *i2c,
uint8_t addr,
uint32_t frequency)
{

View file

@ -120,7 +120,7 @@ struct adxl345_dev_s
#ifdef CONFIG_ADXL345_SPI
FAR struct spi_dev_s *spi; /* Saved SPI driver instance */
#else
FAR struct i2c_dev_s *i2c; /* Saved I2C driver instance */
FAR struct i2c_master_s *i2c; /* Saved I2C driver instance */
#endif
uint8_t status; /* See ADXL345_STAT_* definitions */

View file

@ -384,7 +384,7 @@ static void adxl345_reset(FAR struct adxl345_dev_s *priv)
ADXL345_HANDLE adxl345_instantiate(FAR struct spi_dev_s *dev,
FAR struct adxl345_config_s *config)
#else
ADXL345_HANDLE adxl345_instantiate(FAR struct i2c_dev_s *dev,
ADXL345_HANDLE adxl345_instantiate(FAR struct i2c_master_s *dev,
FAR struct adxl345_config_s *config)
#endif
{

View file

@ -57,9 +57,9 @@
struct as5048b_dev_s
{
struct qe_lowerhalf_s lower; /* AS5048B quadrature encoder lower half */
FAR struct i2c_dev_s *i2c; /* I2C interface */
uint8_t addr; /* I2C address */
struct qe_lowerhalf_s lower; /* AS5048B quadrature encoder lower half */
FAR struct i2c_master_s *i2c; /* I2C interface */
uint8_t addr; /* I2C address */
};
/****************************************************************************
@ -577,7 +577,7 @@ static int as5048b_ioctl(FAR struct qe_lowerhalf_s *lower, int cmd,
*
****************************************************************************/
FAR struct qe_lowerhalf_s *as5048b_initialize(FAR struct i2c_dev_s *i2c,
FAR struct qe_lowerhalf_s *as5048b_initialize(FAR struct i2c_master_s *i2c,
uint8_t addr)
{
FAR struct as5048b_dev_s *priv;

View file

@ -110,10 +110,10 @@
struct bmp180_dev_s
{
FAR struct i2c_dev_s *i2c; /* I2C interface */
uint8_t addr; /* BMP180 I2C address */
int freq; /* BMP180 Frequency <= 3.4MHz */
int16_t bmp180_cal_ac1; /* Calibration coefficients */
FAR struct i2c_master_s *i2c; /* I2C interface */
uint8_t addr; /* BMP180 I2C address */
int freq; /* BMP180 Frequency <= 3.4MHz */
int16_t bmp180_cal_ac1; /* Calibration coefficients */
int16_t bmp180_cal_ac2;
int16_t bmp180_cal_ac3;
uint16_t bmp180_cal_ac4;
@ -124,8 +124,8 @@ struct bmp180_dev_s
int16_t bmp180_cal_mb;
int16_t bmp180_cal_mc;
int16_t bmp180_cal_md;
int32_t bmp180_utemp; /* Uncompensated temperature read from BMP180 */
int32_t bmp180_upress; /* Uncompensated pressure read from BMP180 */
int32_t bmp180_utemp; /* Uncompensated temperature read from BMP180 */
int32_t bmp180_upress; /* Uncompensated pressure read from BMP180 */
};
/****************************************************************************
@ -569,7 +569,7 @@ static ssize_t bmp180_write(FAR struct file *filep, FAR const char *buffer,
*
****************************************************************************/
int bmp180_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c)
int bmp180_register(FAR const char *devpath, FAR struct i2c_master_s *i2c)
{
FAR struct bmp180_dev_s *priv;
int ret;

View file

@ -93,7 +93,7 @@
struct lis331dl_dev_s
{
struct i2c_dev_s *i2c;
struct i2c_master_s *i2c;
uint8_t address;
struct lis331dl_vector_s a;
uint8_t cr1;
@ -217,7 +217,7 @@ static int lis331dl_readregs(FAR struct lis331dl_dev_s *dev)
* Public Functions
****************************************************************************/
FAR struct lis331dl_dev_s *lis331dl_init(FAR struct i2c_dev_s *i2c,
FAR struct lis331dl_dev_s *lis331dl_init(FAR struct i2c_master_s *i2c,
uint16_t address)
{
FAR struct lis331dl_dev_s * dev;

View file

@ -67,9 +67,9 @@
struct lm75_dev_s
{
FAR struct i2c_dev_s *i2c; /* I2C interface */
uint8_t addr; /* I2C address */
bool fahrenheit; /* true: temperature will be reported in fahrenheit */
FAR struct i2c_master_s *i2c; /* I2C interface */
uint8_t addr; /* I2C address */
bool fahrenheit; /* true: temperature will be reported in fahrenheit */
};
/****************************************************************************
@ -503,7 +503,7 @@ static int lm75_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
*
****************************************************************************/
int lm75_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c, uint8_t addr)
int lm75_register(FAR const char *devpath, FAR struct i2c_master_s *i2c, uint8_t addr)
{
FAR struct lm75_dev_s *priv;
int ret;

View file

@ -69,9 +69,9 @@
struct lm92_dev_s
{
FAR struct i2c_dev_s *i2c; /* I2C interface */
uint8_t addr; /* I2C address */
bool fahrenheit; /* true: temperature will be reported in Fahrenheit */
FAR struct i2c_master_s *i2c; /* I2C interface */
uint8_t addr; /* I2C address */
bool fahrenheit; /* true: temperature will be reported in Fahrenheit */
};
/****************************************************************************
@ -595,7 +595,7 @@ static int lm92_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
*
****************************************************************************/
int lm92_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
int lm92_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
uint8_t addr)
{
FAR struct lm92_dev_s *priv;

View file

@ -500,7 +500,7 @@ struct lsm9ds1_ops_s
struct lsm9ds1_dev_s
{
FAR struct i2c_dev_s *i2c; /* I2C interface */
FAR struct i2c_master_s *i2c; /* I2C interface */
uint8_t addr; /* I2C address */
FAR const struct lsm9ds1_ops_s *ops;
@ -567,7 +567,7 @@ static int lsm9ds1_ioctl(FAR struct file *filep, int cmd,
/* Common Register Function */
static int lsm9ds1_register(FAR const char *devpath,
FAR struct i2c_dev_s *i2c, uint8_t addr,
FAR struct i2c_master_s *i2c, uint8_t addr,
FAR const struct lsm9ds1_ops_s *ops,
uint8_t datareg);
@ -1413,7 +1413,7 @@ static int lsm9ds1_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
****************************************************************************/
static int lsm9ds1_register(FAR const char *devpath,
FAR struct i2c_dev_s *i2c, uint8_t addr,
FAR struct i2c_master_s *i2c, uint8_t addr,
FAR const struct lsm9ds1_ops_s *ops,
uint8_t datareg)
{
@ -1486,7 +1486,7 @@ static int lsm9ds1_register(FAR const char *devpath,
*
****************************************************************************/
int lsm9ds1accel_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
int lsm9ds1accel_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
uint8_t addr)
{
/* Sanity check */
@ -1513,7 +1513,7 @@ int lsm9ds1accel_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
*
****************************************************************************/
int lsm9ds1gyro_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
int lsm9ds1gyro_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
uint8_t addr)
{
/* Sanity check */
@ -1540,7 +1540,7 @@ int lsm9ds1gyro_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
*
****************************************************************************/
int lsm9ds1mag_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
int lsm9ds1mag_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
uint8_t addr)
{
/* Sanity check */

View file

@ -57,8 +57,8 @@
struct mb7040_dev_s
{
FAR struct i2c_dev_s *i2c; /* I2C interface */
uint8_t addr; /* I2C address */
FAR struct i2c_master_s *i2c; /* I2C interface */
uint8_t addr; /* I2C address */
};
/****************************************************************************
@ -336,7 +336,7 @@ static int mb7040_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
*
****************************************************************************/
int mb7040_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
int mb7040_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
uint8_t addr)
{
FAR struct mb7040_dev_s *priv;

View file

@ -56,8 +56,8 @@
struct mcp9844_dev_s
{
FAR struct i2c_dev_s *i2c; /* I2C interface */
uint8_t addr; /* I2C address */
FAR struct i2c_master_s *i2c; /* I2C interface */
uint8_t addr; /* I2C address */
};
/****************************************************************************
@ -317,7 +317,7 @@ static int mcp9844_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
*
****************************************************************************/
int mcp9844_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
int mcp9844_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
uint8_t addr)
{
/* Sanity check */

View file

@ -75,18 +75,18 @@
struct ms58xx_dev_s
{
FAR struct i2c_dev_s *i2c; /* I2C interface */
uint8_t addr; /* I2C address */
FAR struct i2c_master_s *i2c; /* I2C interface */
uint8_t addr; /* I2C address */
enum ms58xx_model_e model;
uint8_t crcindex;
uint8_t crcshift;
int32_t temp; /* Uncompensated temperature (degrees Centigrade) */
int32_t press; /* Uncompensated pressure (millibar) */
int32_t temp; /* Uncompensated temperature (degrees Centigrade) */
int32_t press; /* Uncompensated pressure (millibar) */
uint8_t osr; /* Oversampling ratio bits */
useconds_t delay; /* Oversampling ratio delay */
uint8_t osr; /* Oversampling ratio bits */
useconds_t delay; /* Oversampling ratio delay */
/* Calibration coefficients */
@ -838,7 +838,7 @@ static int ms58xx_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
*
****************************************************************************/
int ms58xx_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
int ms58xx_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
uint8_t addr, uint16_t osr, enum ms58xx_model_e model)
{
FAR struct ms58xx_dev_s *priv;

View file

@ -108,7 +108,7 @@
struct ds3231_dev_s
{
FAR struct i2c_dev_s *i2c; /* Contained reference to the I2C bus driver */
FAR struct i2c_master_s *i2c; /* Contained reference to the I2C bus driver */
};
/************************************************************************************
@ -237,7 +237,7 @@ static int rtc_bcd2bin(uint8_t value)
*
************************************************************************************/
int dsxxxx_rtc_initialize(FAR struct i2c_dev_s *i2c)
int dsxxxx_rtc_initialize(FAR struct i2c_master_s *i2c)
{
/* Remember the i2c device and claim that the RTC is enabled */

View file

@ -108,7 +108,7 @@
struct pcf85263_dev_s
{
FAR struct i2c_dev_s *i2c; /* Contained reference to the I2C bus driver */
FAR struct i2c_master_s *i2c; /* Contained reference to the I2C bus driver */
};
/************************************************************************************
@ -237,7 +237,7 @@ static int rtc_bcd2bin(uint8_t value)
*
************************************************************************************/
int pcf85263_rtc_initialize(FAR struct i2c_dev_s *i2c)
int pcf85263_rtc_initialize(FAR struct i2c_master_s *i2c)
{
/* Remember the i2c device and claim that the RTC is enabled */

View file

@ -286,16 +286,16 @@ struct ovr2640_reg_s
/* OV2640 register operations */
static int ov2640_putreg(FAR struct i2c_dev_s *i2c, uint8_t regaddr,
static int ov2640_putreg(FAR struct i2c_master_s *i2c, uint8_t regaddr,
uint8_t regval);
static uint8_t ov2640_getreg(FAR struct i2c_dev_s *i2c, uint8_t regaddr);
static int ov2640_putreglist(FAR struct i2c_dev_s *i2c,
static uint8_t ov2640_getreg(FAR struct i2c_master_s *i2c, uint8_t regaddr);
static int ov2640_putreglist(FAR struct i2c_master_s *i2c,
FAR const struct ovr2640_reg_s *reglist, size_t nentries);
/* Initialization */
static int ovr2640_chipid(FAR struct i2c_dev_s *i2c);
static int ov2640_reset(FAR struct i2c_dev_s *i2c);
static int ovr2640_chipid(FAR struct i2c_master_s *i2c);
static int ov2640_reset(FAR struct i2c_master_s *i2c);
/****************************************************************************
* Private Data
@ -687,7 +687,7 @@ static const struct ovr2640_reg_s g_ov2640_jpeg_uxga_resolution[] =
*
****************************************************************************/
static int ov2640_putreg(FAR struct i2c_dev_s *i2c, uint8_t regaddr,
static int ov2640_putreg(FAR struct i2c_master_s *i2c, uint8_t regaddr,
uint8_t regval)
{
uint8_t buffer[2];
@ -731,7 +731,7 @@ static int ov2640_putreg(FAR struct i2c_dev_s *i2c, uint8_t regaddr,
*
****************************************************************************/
static uint8_t ov2640_getreg(FAR struct i2c_dev_s *i2c, uint8_t regaddr)
static uint8_t ov2640_getreg(FAR struct i2c_master_s *i2c, uint8_t regaddr)
{
uint8_t regval;
int ret;
@ -780,7 +780,7 @@ static uint8_t ov2640_getreg(FAR struct i2c_dev_s *i2c, uint8_t regaddr)
*
****************************************************************************/
static int ov2640_putreglist(FAR struct i2c_dev_s *i2c,
static int ov2640_putreglist(FAR struct i2c_master_s *i2c,
FAR const struct ovr2640_reg_s *reglist,
size_t nentries)
{
@ -815,7 +815,7 @@ static int ov2640_putreglist(FAR struct i2c_dev_s *i2c,
*
****************************************************************************/
static int ovr2640_chipid(FAR struct i2c_dev_s *i2c)
static int ovr2640_chipid(FAR struct i2c_master_s *i2c)
{
uint8_t pidl;
uint8_t pidh;
@ -870,7 +870,7 @@ static int ovr2640_chipid(FAR struct i2c_dev_s *i2c)
*
****************************************************************************/
static int ov2640_reset(FAR struct i2c_dev_s *i2c)
static int ov2640_reset(FAR struct i2c_master_s *i2c)
{
int ret;
@ -903,7 +903,7 @@ static int ov2640_reset(FAR struct i2c_dev_s *i2c)
*
****************************************************************************/
int ov2640_initialize(FAR struct i2c_dev_s *i2c)
int ov2640_initialize(FAR struct i2c_master_s *i2c)
{
int ret;

View file

@ -214,12 +214,12 @@ extern "C"
*
****************************************************************************/
struct i2c_dev_s; /* Forward reference. Defined in include/nuttx/i2c/i2c_master.h */
struct i2c_master_s; /* Forward reference. Defined in include/nuttx/i2c/i2c_master.h */
struct i2s_dev_s; /* Forward reference. Defined in include/nuttx/audio/i2s.h */
struct audio_lowerhalf_s; /* Forward reference. Defined in nuttx/audio/audio.h */
FAR struct audio_lowerhalf_s *
wm8904_initialize(FAR struct i2c_dev_s *i2c, FAR struct i2s_dev_s *i2s,
wm8904_initialize(FAR struct i2c_master_s *i2c, FAR struct i2s_dev_s *i2s,
FAR const struct wm8904_lower_s *lower);
/****************************************************************************

View file

@ -47,17 +47,6 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* If a dynamic timeout is selected, then a non-negative, non-zero micro-
* seconds per byte value must be provided as well.
*/
#ifdef CONFIG_STM32_I2C_DYNTIMEO
# if CONFIG_STM32_I2C_DYNTIMEO_USECPERBYTE < 1
# warning "Ignoring CONFIG_STM32_I2C_DYNTIMEO because of CONFIG_STM32_I2C_DYNTIMEO_USECPERBYTE"
# undef CONFIG_STM32_I2C_DYNTIMEO
# endif
#endif
/* I2C address calculation. Convert 7- and 10-bit address to 8-bit and
* 16-bit read/write address
*/
@ -95,7 +84,7 @@
*
* Description:
* Set the I2C frequency. This frequency will be retained in the struct
* i2c_dev_s instance and will be used with all transfers. Required.
* i2c_master_s instance and will be used with all transfers. Required.
*
* Input Parameters:
* dev - Device-specific state data
@ -113,7 +102,7 @@
*
* Description:
* Set the I2C slave address. This frequency will be retained in the struct
* i2c_dev_s instance and will be used with all transfers. Required.
* i2c_master_s instance and will be used with all transfers. Required.
*
* Input Parameters:
* dev - Device-specific state data
@ -127,32 +116,6 @@
#define I2C_SETADDRESS(d,a,n) ((d)->ops->setaddress(d,a,n))
/****************************************************************************
* Name: I2C_SETOWNADDRESS
*
* Description:
* Set our own I2C address. Calling this function enables Slave mode and
* disables Master mode on given instance (note that I2C is a bus, where
* multiple masters and slave may be handled by one device driver).
*
* One may register a callback to be notified about reception. During the
* slave mode reception, the function READ and WRITE must be used to
* to handle reads and writes from a master.
*
* Input Parameters:
* dev - Device-specific state data
* address - Our own slave address; If it is 0x00, then the device driver
* listens to general call
* nbits - The number of address bits provided (7 or 10)
*
* Returned Value:
* OK on valid address and if the same address has not been assigned
* to another instance sharing the same port. Otherwise ERROR is returned.
*
****************************************************************************/
#define I2C_SETOWNADDRESS(d,a,n) ((d)->ops->setownaddress(d,a,n))
/****************************************************************************
* Name: I2C_WRITE
*
@ -222,25 +185,20 @@
/* The I2C vtable */
struct i2c_dev_s;
struct i2c_master_s;
struct i2c_msg_s;
struct i2c_ops_s
{
uint32_t (*setfrequency)(FAR struct i2c_dev_s *dev, uint32_t frequency);
int (*setaddress)(FAR struct i2c_dev_s *dev, int addr, int nbits);
int (*write)(FAR struct i2c_dev_s *dev, FAR const uint8_t *buffer,
uint32_t (*setfrequency)(FAR struct i2c_master_s *dev, uint32_t frequency);
int (*setaddress)(FAR struct i2c_master_s *dev, int addr, int nbits);
int (*write)(FAR struct i2c_master_s *dev, FAR const uint8_t *buffer,
int buflen);
int (*read)(FAR struct i2c_dev_s *dev, FAR uint8_t *buffer,
int (*read)(FAR struct i2c_master_s *dev, FAR uint8_t *buffer,
int buflen);
#ifdef CONFIG_I2C_TRANSFER
int (*transfer)(FAR struct i2c_dev_s *dev, FAR struct i2c_msg_s *msgs,
int (*transfer)(FAR struct i2c_master_s *dev, FAR struct i2c_msg_s *msgs,
int count);
#endif
#ifdef CONFIG_I2C_SLAVE
int (*setownaddress)(FAR struct i2c_dev_s *dev, int addr, int nbits);
int (*registercallback)(FAR struct i2c_dev_s *dev,
int (*callback)(FAR void *arg), FAR void *arg);
#endif
};
/* This structure contains the full state of I2C as needed for a specific
@ -273,7 +231,7 @@ struct i2c_msg_s
* add additional, device specific fields after the vtable.
*/
struct i2c_dev_s
struct i2c_master_s
{
const struct i2c_ops_s *ops; /* I2C vtable */
};
@ -296,7 +254,7 @@ extern "C"
*
* Description:
* Initialize the selected I2C port. And return a unique instance of struct
* struct i2c_dev_s. This function may be called to obtain multiple
* struct i2c_master_s. This function may be called to obtain multiple
* instances of the interface, each of which may be set up with a
* different frequency and slave address.
*
@ -308,7 +266,7 @@ extern "C"
*
****************************************************************************/
FAR struct i2c_dev_s *up_i2cinitialize(int port);
FAR struct i2c_master_s *up_i2cinitialize(int port);
/****************************************************************************
* Name: up_i2cuninitialize
@ -325,7 +283,7 @@ FAR struct i2c_dev_s *up_i2cinitialize(int port);
*
****************************************************************************/
int up_i2cuninitialize(FAR struct i2c_dev_s *dev);
int up_i2cuninitialize(FAR struct i2c_master_s *dev);
/************************************************************************************
* Name: up_i2creset
@ -336,7 +294,7 @@ int up_i2cuninitialize(FAR struct i2c_dev_s *dev);
************************************************************************************/
#ifdef CONFIG_I2C_RESET
int up_i2creset(FAR struct i2c_dev_s *dev);
int up_i2creset(FAR struct i2c_master_s *dev);
#endif
/****************************************************************************
@ -360,7 +318,7 @@ int up_i2creset(FAR struct i2c_dev_s *dev);
****************************************************************************/
#ifdef CONFIG_I2C_TRANSFER
int i2c_writeread(FAR struct i2c_dev_s *dev, FAR const struct i2c_config_s *config,
int i2c_writeread(FAR struct i2c_master_s *dev, FAR const struct i2c_config_s *config,
FAR const uint8_t *wbuffer, int wbuflen,
FAR uint8_t *rbuffer, int rbuflen);
#endif
@ -385,7 +343,7 @@ int i2c_writeread(FAR struct i2c_dev_s *dev, FAR const struct i2c_config_s *conf
****************************************************************************/
#ifdef CONFIG_I2C_TRANSFER
int i2c_write(FAR struct i2c_dev_s *dev, FAR const struct i2c_config_s *config,
int i2c_write(FAR struct i2c_master_s *dev, FAR const struct i2c_config_s *config,
FAR const uint8_t *buffer, int buflen);
#endif
@ -409,7 +367,7 @@ int i2c_write(FAR struct i2c_dev_s *dev, FAR const struct i2c_config_s *config,
****************************************************************************/
#ifdef CONFIG_I2C_TRANSFER
int i2c_read(FAR struct i2c_dev_s *dev, FAR const struct i2c_config_s *config,
int i2c_read(FAR struct i2c_master_s *dev, FAR const struct i2c_config_s *config,
FAR uint8_t *buffer, int buflen);
#endif

View file

@ -199,7 +199,7 @@ extern "C"
*
****************************************************************************/
int mxt_register(FAR struct i2c_dev_s *i2c,
int mxt_register(FAR struct i2c_master_s *i2c,
FAR const struct mxt_lower_s *lower, int minor);
#undef EXTERN

View file

@ -549,7 +549,7 @@ extern "C"
STMPE811_HANDLE stmpe811_instantiate(FAR struct spi_dev_s *dev,
FAR struct stmpe811_config_s *config);
#else
STMPE811_HANDLE stmpe811_instantiate(FAR struct i2c_dev_s *dev,
STMPE811_HANDLE stmpe811_instantiate(FAR struct i2c_master_s *dev,
FAR struct stmpe811_config_s *config);
#endif

View file

@ -160,7 +160,7 @@ extern "C"
*
****************************************************************************/
int tsc2007_register(FAR struct i2c_dev_s *dev,
int tsc2007_register(FAR struct i2c_master_s *dev,
FAR struct tsc2007_config_s *config, int minor);
#undef EXTERN

View file

@ -110,7 +110,7 @@ extern "C"
*
********************************************************************************************/
FAR struct ioexpander_dev_s* pca9555_initialize(FAR struct i2c_dev_s *dev,
FAR struct ioexpander_dev_s* pca9555_initialize(FAR struct i2c_master_s *dev,
FAR struct pca9555_config_s *config);
#ifdef __cplusplus

View file

@ -243,7 +243,7 @@ struct spi_dev_s; /* See include/nuttx/spi/spi.h */
#ifdef CONFIG_LCD_SSD1306_SPI
FAR struct lcd_dev_s *ssd1306_initialize(FAR struct spi_dev_s *dev, unsigned int devno);
#else
FAR struct lcd_dev_s *ssd1306_initialize(FAR struct i2c_dev_s *dev, unsigned int devno);
FAR struct lcd_dev_s *ssd1306_initialize(FAR struct i2c_master_s *dev, unsigned int devno);
#endif
/************************************************************************************************

View file

@ -157,7 +157,7 @@ struct pca9635pw_setled_brightness_arg_s
* Forward declarations
****************************************************************************/
struct i2c_dev_s;
struct i2c_master_s;
/****************************************************************************
* Public Types
@ -189,7 +189,7 @@ extern "C"
*
****************************************************************************/
int pca9635pw_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
int pca9635pw_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
uint8_t const pca9635pw_i2c_addr);
#undef EXTERN

View file

@ -381,13 +381,13 @@ FAR struct mtd_dev_s *at45db_initialize(FAR struct spi_dev_s *dev);
*
****************************************************************************/
struct i2c_dev_s; /* Forward reference */
struct i2c_master_s; /* Forward reference */
#ifdef CONFIG_AT24XX_MULTI
FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_dev_s *dev,
FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_master_s *dev,
uint8_t address);
#else
FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_dev_s *dev);
FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_master_s *dev);
#endif
/************************************************************************************

View file

@ -217,9 +217,9 @@ int battery_charger_register(FAR const char *devpath,
****************************************************************************/
#if defined(CONFIG_I2C) && defined(CONFIG_I2C_BQ2425X)
struct i2c_dev_s; /* Forward reference */
struct i2c_master_s; /* Forward reference */
FAR struct battery_charger_dev_s *bq2425x_initialize(FAR struct i2c_dev_s *i2c,
FAR struct battery_charger_dev_s *bq2425x_initialize(FAR struct i2c_master_s *i2c,
uint8_t addr,
uint32_t frequency);
#endif

View file

@ -198,9 +198,9 @@ int battery_gauge_register(FAR const char *devpath,
****************************************************************************/
#if defined(CONFIG_I2C) && defined(CONFIG_I2C_MAX1704X)
struct i2c_dev_s; /* Forward reference */
struct i2c_master_s; /* Forward reference */
FAR struct battery_gauge_dev_s *max1704x_initialize(FAR struct i2c_dev_s *i2c
FAR struct battery_gauge_dev_s *max1704x_initialize(FAR struct i2c_master_s *i2c
uint8_t addr,
uint32_t frequency);
#endif

View file

@ -325,7 +325,7 @@ struct adxl345_config_s
typedef FAR void *ADXL345_HANDLE;
struct i2c_dev_s;
struct i2c_master_s;
struct spi_dev_s;
/********************************************************************************************
@ -361,7 +361,7 @@ extern "C"
ADXL345_HANDLE adxl345_instantiate(FAR struct spi_dev_s *dev,
FAR struct adxl345_config_s *config);
#else
ADXL345_HANDLE adxl345_instantiate(FAR struct i2c_dev_s *dev,
ADXL345_HANDLE adxl345_instantiate(FAR struct i2c_master_s *dev,
FAR struct adxl345_config_s *config);
#endif

View file

@ -99,7 +99,7 @@
* Public Types
****************************************************************************/
struct i2c_dev_s;
struct i2c_master_s;
/****************************************************************************
* Public Function Prototypes
@ -129,7 +129,7 @@ extern "C"
*
****************************************************************************/
FAR struct qe_lowerhalf_s *as5048b_initialize(FAR struct i2c_dev_s *i2c,
FAR struct qe_lowerhalf_s *as5048b_initialize(FAR struct i2c_master_s *i2c,
uint8_t addr);
#undef EXTERN

View file

@ -59,7 +59,7 @@
* Public Types
****************************************************************************/
struct i2c_dev_s;
struct i2c_master_s;
/********************************************************************************************
* Public Function Prototypes
@ -89,7 +89,7 @@ extern "C"
*
****************************************************************************/
int bmp180_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c);
int bmp180_register(FAR const char *devpath, FAR struct i2c_master_s *i2c);
#undef EXTERN
#ifdef __cplusplus

View file

@ -71,7 +71,7 @@ struct lis331dl_vector_s
int8_t z;
};
struct i2c_dev_s;
struct i2c_master_s;
/************************************************************************************
* Public Function Prototypes
@ -100,7 +100,7 @@ struct i2c_dev_s;
*
************************************************************************************/
FAR struct lis331dl_dev_s *lis331dl_init(FAR struct i2c_dev_s * i2c,
FAR struct lis331dl_dev_s *lis331dl_init(FAR struct i2c_master_s * i2c,
uint16_t address);
/************************************************************************************

View file

@ -99,7 +99,7 @@
* Public Types
****************************************************************************/
struct i2c_dev_s;
struct i2c_master_s;
/****************************************************************************
* Public Function Prototypes
@ -131,7 +131,7 @@ extern "C"
*
****************************************************************************/
int lm75_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
int lm75_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
uint8_t addr);
#undef EXTERN

View file

@ -106,7 +106,7 @@
* Public Types
****************************************************************************/
struct i2c_dev_s;
struct i2c_master_s;
/****************************************************************************
* Public Function Prototypes
@ -139,7 +139,7 @@ extern "C"
*
****************************************************************************/
int lm92_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
int lm92_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
uint8_t addr);
#undef EXTERN

View file

@ -75,7 +75,7 @@
* Public Types
****************************************************************************/
struct i2c_dev_s;
struct i2c_master_s;
/****************************************************************************
* Public Function Prototypes
@ -102,7 +102,7 @@ extern "C"
*
****************************************************************************/
int lsm9ds1accel_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
int lsm9ds1accel_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
uint8_t addr);
/****************************************************************************
@ -121,7 +121,7 @@ int lsm9ds1accel_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
*
****************************************************************************/
int lsm9ds1gyro_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
int lsm9ds1gyro_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
uint8_t addr);
/****************************************************************************
@ -140,7 +140,7 @@ int lsm9ds1gyro_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
*
****************************************************************************/
int lsm9ds1mag_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
int lsm9ds1mag_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
uint8_t addr);
#ifdef __cplusplus

View file

@ -78,7 +78,7 @@
* Public Types
****************************************************************************/
struct i2c_dev_s;
struct i2c_master_s;
/****************************************************************************
* Public Function Prototypes
@ -108,7 +108,7 @@ extern "C"
*
****************************************************************************/
int mb7040_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
int mb7040_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
uint8_t addr);
#undef EXTERN

View file

@ -86,7 +86,7 @@ enum mcp9844_resolution_e
RES_0_0625 = MCP9844_RESO_REG_BIT_1 | MCP9844_RESO_REG_BIT_0
};
struct i2c_dev_s;
struct i2c_master_s;
/****************************************************************************
* Public Function Prototypes
@ -116,7 +116,7 @@ extern "C"
*
****************************************************************************/
int mcp9844_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
int mcp9844_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
uint8_t addr);
#undef EXTERN

View file

@ -87,7 +87,7 @@ enum ms58xx_model_e
MS58XX_MODEL_MS5837_30 = 7
};
struct i2c_dev_s;
struct i2c_master_s;
/****************************************************************************
* Public Function Prototypes
@ -119,7 +119,7 @@ extern "C"
*
****************************************************************************/
int ms58xx_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
int ms58xx_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
uint8_t addr, uint16_t osr, enum ms58xx_model_e model);
#undef EXTERN

View file

@ -163,13 +163,13 @@
struct cs2100_config_s
{
FAR struct i2c_dev_s *i2c; /* Instance of an I2C interface */
uint32_t refclk; /* RefClk/XTAL frequency */
uint32_t clkin; /* Frequency CLK_IN provided to the CS2100-CP */
uint32_t clkout; /* Desired CLK_OUT frequency */
uint8_t i2caddr; /* CP2100-CP I2C address */
uint8_t loopbw; /* Minimum loop bandwidth: 1-128 */
bool xtal; /* false: Refclck, true: Crystal on XTI/XTO */
FAR struct i2c_master_s *i2c; /* Instance of an I2C interface */
uint32_t refclk; /* RefClk/XTAL frequency */
uint32_t clkin; /* Frequency CLK_IN provided to the CS2100-CP */
uint32_t clkout; /* Desired CLK_OUT frequency */
uint8_t i2caddr; /* CP2100-CP I2C address */
uint8_t loopbw; /* Minimum loop bandwidth: 1-128 */
bool xtal; /* false: Refclck, true: Crystal on XTI/XTO */
};
/********************************************************************************************
@ -188,7 +188,7 @@ extern "C"
* Public Function Prototypes
********************************************************************************************/
struct i2c_dev_s; /* Forward reference */
struct i2c_master_s; /* Forward reference */
/********************************************************************************************
* Name: cs2100_enable

View file

@ -78,8 +78,8 @@ extern "C"
*
************************************************************************************/
struct i2c_dev_s; /* Forward reference */
int dsxxxx_rtc_initialize(FAR struct i2c_dev_s *i2c);
struct i2c_master_s; /* Forward reference */
int dsxxxx_rtc_initialize(FAR struct i2c_master_s *i2c);
#undef EXTERN
#ifdef __cplusplus

View file

@ -78,8 +78,8 @@ extern "C"
*
************************************************************************************/
struct i2c_dev_s; /* Forward reference */
int pcf85263_rtc_initialize(FAR struct i2c_dev_s *i2c);
struct i2c_master_s; /* Forward reference */
int pcf85263_rtc_initialize(FAR struct i2c_master_s *i2c);
#undef EXTERN
#ifdef __cplusplus

View file

@ -77,8 +77,8 @@ extern "C"
*
****************************************************************************/
struct i2c_dev_s;
int ov2640_initialize(FAR struct i2c_dev_s *i2c);
struct i2c_master_s;
int ov2640_initialize(FAR struct i2c_master_s *i2c);
#undef EXTERN
#ifdef __cplusplus