From d4a53ee131bf41d40056c301e638040858ebe218 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 26 Jan 2016 10:26:16 -0600 Subject: [PATCH] I2C: Eliminate the I2C_WRITEREAD method --- ChangeLog | 3 ++- TODO | 4 ++-- arch | 2 +- configs | 2 +- drivers/i2c/Kconfig | 4 ---- drivers/ioexpander/pca9555.h | 4 ++-- drivers/timers/ds3231.c | 2 +- drivers/timers/pcf85263.c | 2 +- include/nuttx/i2c.h | 27 --------------------------- 9 files changed, 10 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f4a34eb31e..d1930acca63 100755 --- a/ChangeLog +++ b/ChangeLog @@ -11370,5 +11370,6 @@ * drivers/ioexpander/pca9555: Convert to use I2C_TRANSFER vs. I2C_WRITEREAD, the former is thread safe while the latter is deprecated (2016-01-26). * drivers/i2c/i2c_writeread.c: Create a wrapper that uses I2C_TRANSFER - to implement I2C_WRITEREAD functionalit (2016-01-26). + to implement I2C_WRITEREAD functionality (2016-01-26). + * I2C: Eliminate the I@C_WRITEREAD method (2016-01-26). diff --git a/TODO b/TODO index 5a828ea9011..9d7c25dfad9 100644 --- a/TODO +++ b/TODO @@ -1614,7 +1614,7 @@ o Other drivers (drivers/) in a multi-tasking I2C environment: - I2C_SETFREQUENCY: Frequency setting can be overwritten by other I2C usage. - - I2C_SETADDRESS used with I2C_READ, I2C_WRITE, and I2C_WRITEREAD: + - I2C_SETADDRESS used with I2C_READ and I2C_WRITE: Similarly, address can and will be changed by other I2C usage. NOTE also that I2C_SETADDRESS also sets the address width (either 7 or 10 bits). @@ -1627,7 +1627,7 @@ o Other drivers (drivers/) as is provided with the SPI interface, or (2) make each interface self-contained and atomic: Remove the I2C_FREQUENCY and I2C_ADDRESS methods; Add frequency to all interfaces and add the address to - I2C_READ, I2C_WRITE, and I2C_WRITEREAD. + I2C_READ and I2C_WRITE. o Linux/Cywgin simulation (arch/sim) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/arch b/arch index 17e8a324c80..40aba37060a 160000 --- a/arch +++ b/arch @@ -1 +1 @@ -Subproject commit 17e8a324c80f02bb9881a12cf6d02509a128c431 +Subproject commit 40aba37060aa2746c7a492045ae0b79d014afad2 diff --git a/configs b/configs index 927eaf0772f..e569b357a25 160000 --- a/configs +++ b/configs @@ -1 +1 @@ -Subproject commit 927eaf0772fa49978c0f64aa5e9d60c4e105ebd4 +Subproject commit e569b357a25df0f74730dfb4464f70a3acded6b2 diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index 664b1059203..72f331cc040 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig @@ -13,10 +13,6 @@ config I2C_TRANSFER bool "Support the I2C transfer() method" default n -config I2C_WRITEREAD - bool "Support the I2C writeread() method" - default n - config I2C_POLLED bool "Polled I2C (no interrupts)" default n diff --git a/drivers/ioexpander/pca9555.h b/drivers/ioexpander/pca9555.h index 5a8e1b69df0..258cf0e6401 100644 --- a/drivers/ioexpander/pca9555.h +++ b/drivers/ioexpander/pca9555.h @@ -63,8 +63,8 @@ /* Prerequisites: * CONFIG_I2C * I2C support is required - * CONFIG_I2C_WRITEREAD - * Support for the I2C writeread method is required. + * CONFIG_I2C_TRANSFER + * Support for the I2C transfer method is required. * CONFIG_IOEXPANDER * Enables support for the PCA9555 I/O expander * diff --git a/drivers/timers/ds3231.c b/drivers/timers/ds3231.c index 894c069d229..18a60c1b623 100644 --- a/drivers/timers/ds3231.c +++ b/drivers/timers/ds3231.c @@ -334,7 +334,7 @@ int up_rtc_getdatetime(FAR struct tm *tp) I2C_SETFREQUENCY(g_ds3231.i2c, CONFIG_DS3231_I2C_FREQUENCY); - /* Perform the transfer (This could be done with I2C_WRITEREAD()). The + /* Perform the transfer (This could be done with i2c_writeread()). The * transfer may be performed repeatedly of the seconds values decreases, * meaning that that was a rollover in the seconds. */ diff --git a/drivers/timers/pcf85263.c b/drivers/timers/pcf85263.c index 9fa04887cb2..6081d880188 100644 --- a/drivers/timers/pcf85263.c +++ b/drivers/timers/pcf85263.c @@ -333,7 +333,7 @@ int up_rtc_getdatetime(FAR struct tm *tp) I2C_SETFREQUENCY(g_pcf85263.i2c, CONFIG_PCF85263_I2C_FREQUENCY); - /* Perform the transfer (This could be done with I2C_WRITEREAD()). The + /* Perform the transfer (This could be done with i2c_writeread()). The * transfer may be performed repeatedly of the seconds values decreases, * meaning that that was a rollover in the seconds. */ diff --git a/include/nuttx/i2c.h b/include/nuttx/i2c.h index 264c0beeb47..8c053d820a1 100644 --- a/include/nuttx/i2c.h +++ b/include/nuttx/i2c.h @@ -195,28 +195,6 @@ #define I2C_READ(d,b,l) ((d)->ops->read(d,b,l)) -/**************************************************************************** - * Name: I2C_WRITEREAD - * - * Description: - * Send a block of data on I2C using the previously selected I2C - * frequency and slave address, followed by restarted read access. - * It provides a convenient wrapper to the transfer function. - * - * Input Parameters: - * dev - Device-specific state data - * wbuffer - A pointer to the read-only buffer of data to be written to device - * wbuflen - The number of bytes to send from the buffer - * rbuffer - A pointer to a buffer of data to receive the data from the device - * rbuflen - The requested number of bytes to be read - * - * Returned Value: - * 0: success, <0: A negated errno - * - ****************************************************************************/ - -#define I2C_WRITEREAD(d,wb,wl,rb,rl) ((d)->ops->writeread(d,wb,wl,rb,rl)) - /**************************************************************************** * Name: I2C_TRANSFER * @@ -253,11 +231,6 @@ struct i2c_ops_s int (*write)(FAR struct i2c_dev_s *dev, const uint8_t *buffer, int buflen); int (*read)(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen); -#ifdef CONFIG_I2C_WRITEREAD - int (*writeread)(FAR struct i2c_dev_s *dev, - FAR const uint8_t *wbuffer, int wbuflen, - FAR uint8_t *rbuffer, int rbuflen); -#endif #ifdef CONFIG_I2C_TRANSFER int (*transfer)(FAR struct i2c_dev_s *dev, FAR struct i2c_msg_s *msgs, int count);