I2C: Eliminate the I2C_WRITEREAD method

This commit is contained in:
Gregory Nutt 2016-01-26 10:26:16 -06:00
parent 67f38169b2
commit d4a53ee131
9 changed files with 10 additions and 40 deletions

View File

@ -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).

4
TODO
View File

@ -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)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2
arch

@ -1 +1 @@
Subproject commit 17e8a324c80f02bb9881a12cf6d02509a128c431
Subproject commit 40aba37060aa2746c7a492045ae0b79d014afad2

@ -1 +1 @@
Subproject commit 927eaf0772fa49978c0f64aa5e9d60c4e105ebd4
Subproject commit e569b357a25df0f74730dfb4464f70a3acded6b2

View File

@ -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

View File

@ -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
*

View File

@ -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.
*/

View File

@ -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.
*/

View File

@ -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);