summaryrefslogtreecommitdiff
path: root/include/i2c.h
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@chromium.org>2019-07-16 15:10:11 -0600
committerCommit Bot <commit-bot@chromium.org>2019-07-20 23:09:18 +0000
commit473bd883b60fd5b00377766dae2bacad246de0d2 (patch)
tree992d9f03104277934c22c869eceb634e2cf5f7ec /include/i2c.h
parent053491b560d2c4e374bb739373d8ae25c41f6315 (diff)
downloadchrome-ec-473bd883b60fd5b00377766dae2bacad246de0d2.tar.gz
Remove __7b, __8b and __7bf
The extentions were added to make the compiler perform most of the verification that the conversion was being done correctly to remove 8bit addressing as the standard I2C/SPI address type. Now that the compiler has verified the code, the extra extentions are being removed BUG=chromium:971296 BRANCH=none TEST=make buildall -j TEST=verify sensor functionality on arcada_ish Change-Id: I36894f8bb9daefb5b31b5e91577708f6f9af2a4f Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704792 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'include/i2c.h')
-rw-r--r--include/i2c.h106
1 files changed, 48 insertions, 58 deletions
diff --git a/include/i2c.h b/include/i2c.h
index 1281b8280d..ccb65fc7a0 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -27,7 +27,7 @@
* Some of the drivers use an 8bit left shifted 7bit address. Since
* this is driver specific, it will be up to the driver to make this
* clear. I suggest, since this is a very small amount of usage, that
- * ending the variable as "addr__8bit" would make this clear.
+ * ending the variable as "addr_8bit" would make this clear.
*
* NOTE: Slave addresses are always 16 bit values. The least significant
* 10 bits are available as an address. More significant bits are
@@ -39,9 +39,8 @@
/* BIT(15) SPI_FLAG - used in motion_sense to overload address */
#define I2C_FLAG_ADDR_IS_SPI BIT(15)
-#define I2C_GET_ADDR(x) (I2C_GET_ADDR__7b(x))
-#define I2C_GET_ADDR__7b(x__7bf) ((x__7bf) & I2C_ADDR_MASK)
-#define I2C_IS_BIG_ENDIAN(x__7bf) ((x__7bf) & I2C_FLAG_BIG_ENDIAN)
+#define I2C_GET_ADDR(addr_flags) ((addr_flags) & I2C_ADDR_MASK)
+#define I2C_IS_BIG_ENDIAN(addr_flags) ((addr_flags) & I2C_FLAG_BIG_ENDIAN)
/*
* Max data size for a version 3 request/response packet. This is
@@ -62,16 +61,7 @@ enum i2c_freq {
struct i2c_info_t {
uint16_t port; /* Physical port for device */
-
- /*
- * union is temporary to accommodate ec_tools
- * and will be reduced to the non-__7bf version
- * before the final merge
- */
- union {
- uint16_t addr_flags;
- uint16_t addr__7bf;
- };
+ uint16_t addr_flags;
};
/* Data structure to define I2C port configuration. */
@@ -83,8 +73,8 @@ struct i2c_port_t {
enum gpio_signal sda; /* Port SDA GPIO line */
/* When bus is protected, returns true if passthru allowed for address.
* If the function is not defined, the default value is true. */
- int (*passthru_allowed__7bf)(const struct i2c_port_t *port,
- uint16_t addr__7bf);
+ int (*passthru_allowed)(const struct i2c_port_t *port,
+ uint16_t addr_flags);
};
extern const struct i2c_port_t i2c_ports[];
@@ -108,11 +98,11 @@ struct i2c_test_results {
struct i2c_stress_test_dev {
struct i2c_test_reg_info reg_info;
struct i2c_test_results test_results;
- int (*i2c_read__7bf)(const int port,
- const uint16_t slave_addr__7bf,
+ int (*i2c_read)(const int port,
+ const uint16_t slave_addr_flags,
const int reg, int *data);
- int (*i2c_write__7bf)(const int port,
- const uint16_t slave_addr__7bf,
+ int (*i2c_write)(const int port,
+ const uint16_t slave_addr_flags,
const int reg, int data);
int (*i2c_read_dev)(const int reg, int *data);
int (*i2c_write_dev)(const int reg, int data);
@@ -120,7 +110,7 @@ struct i2c_stress_test_dev {
struct i2c_stress_test {
int port;
- uint16_t addr__7bf;
+ uint16_t addr_flags;
struct i2c_stress_test_dev *i2c_test;
};
@@ -147,8 +137,8 @@ extern const int i2c_test_dev_used;
* @param in_size Number of bytes to receive
* @return EC_SUCCESS, or non-zero if error.
*/
-int i2c_xfer__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_xfer(const int port,
+ const uint16_t slave_addr_flags,
const uint8_t *out, int out_size,
uint8_t *in, int in_size);
@@ -158,8 +148,8 @@ int i2c_xfer__7bf(const int port,
*
* @param flags Flags (see I2C_XFER_* above)
*/
-int i2c_xfer_unlocked__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_xfer_unlocked(const int port,
+ const uint16_t slave_addr_flags,
const uint8_t *out, int out_size,
uint8_t *in, int in_size, int flags);
@@ -183,8 +173,8 @@ int i2c_xfer_unlocked__7bf(const int port,
* @param flags Flags (see I2C_XFER_* above)
* @return EC_SUCCESS, or non-zero if error.
*/
-int chip_i2c_xfer__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int chip_i2c_xfer(const int port,
+ const uint16_t slave_addr_flags,
const uint8_t *out, int out_size,
uint8_t *in, int in_size, int flags);
@@ -282,80 +272,80 @@ void i2c_set_timeout(int port, uint32_t timeout);
* Read a 32-bit register from the slave at 7-bit slave address <slaveaddr>, at
* the specified 8-bit <offset> in the slave's address space.
*/
-int i2c_read32__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_read32(const int port,
+ const uint16_t slave_addr_flags,
int offset, int *data);
/**
* Write a 32-bit register to the slave at 7-bit slave address <slaveaddr>, at
* the specified 8-bit <offset> in the slave's address space.
*/
-int i2c_write32__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_write32(const int port,
+ const uint16_t slave_addr_flags,
int offset, int data);
/**
* Read a 16-bit register from the slave at 7-bit slave address <slaveaddr>, at
* the specified 8-bit <offset> in the slave's address space.
*/
-int i2c_read16__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_read16(const int port,
+ const uint16_t slave_addr_flags,
int offset, int *data);
/**
* Write a 16-bit register to the slave at 7-bit slave address <slaveaddr>, at
* the specified 8-bit <offset> in the slave's address space.
*/
-int i2c_write16__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_write16(const int port,
+ const uint16_t slave_addr_flags,
int offset, int data);
/**
* Read an 8-bit register from the slave at 7-bit slave address <slaveaddr>, at
* the specified 8-bit <offset> in the slave's address space.
*/
-int i2c_read8__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_read8(const int port,
+ const uint16_t slave_addr_flags,
int offset, int *data);
/**
* Write an 8-bit register to the slave at 7-bit slave address <slaveaddr>, at
* the specified 8-bit <offset> in the slave's address space.
*/
-int i2c_write8__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_write8(const int port,
+ const uint16_t slave_addr_flags,
int offset, int data);
/**
* Read one or two bytes data from the slave at 7-bit slave address
* * <slaveaddr>, at 16-bit <offset> in the slave's address space.
*/
-int i2c_read_offset16__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_read_offset16(const int port,
+ const uint16_t slave_addr_flags,
uint16_t offset, int *data, int len);
/**
* Write one or two bytes data to the slave at 7-bit slave address
* <slaveaddr>, at 16-bit <offset> in the slave's address space.
*/
-int i2c_write_offset16__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_write_offset16(const int port,
+ const uint16_t slave_addr_flags,
uint16_t offset, int data, int len);
/**
* Read <len> bytes block data from the slave at 7-bit slave address
* * <slaveaddr>, at 16-bit <offset> in the slave's address space.
*/
-int i2c_read_offset16_block__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_read_offset16_block(const int port,
+ const uint16_t slave_addr_flags,
uint16_t offset, uint8_t *data, int len);
/**
* Write <len> bytes block data to the slave at 7-bit slave address
* <slaveaddr>, at 16-bit <offset> in the slave's address space.
*/
-int i2c_write_offset16_block__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_write_offset16_block(const int port,
+ const uint16_t slave_addr_flags,
uint16_t offset, const uint8_t *data, int len);
/**
@@ -383,8 +373,8 @@ int i2c_unwedge(int port);
* always written into the output buffer.
* <len> == 0 : buffer size > 255
*/
-int i2c_read_string__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_read_string(const int port,
+ const uint16_t slave_addr_flags,
int offset, uint8_t *data, int len);
/**
@@ -392,8 +382,8 @@ int i2c_read_string__7bf(const int port,
* address <slaveaddr>, at the specified 8-bit <offset> in the slave's address
* space.
*/
-int i2c_read_block__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_read_block(const int port,
+ const uint16_t slave_addr_flags,
int offset, uint8_t *data, int len);
/**
@@ -401,8 +391,8 @@ int i2c_read_block__7bf(const int port,
* address <slaveaddr>, at the specified 8-bit <offset> in the slave's address
* space.
*/
-int i2c_write_block__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_write_block(const int port,
+ const uint16_t slave_addr_flags,
int offset, const uint8_t *data, int len);
/**
@@ -476,8 +466,8 @@ int board_is_i2c_port_powered(int port);
* @param slave_addr: Slave device address
*
*/
-void i2c_start_xfer_notify__7bf(const int port,
- const uint16_t slave_addr__7bf);
+void i2c_start_xfer_notify(const int port,
+ const uint16_t slave_addr_flags);
/**
* Function to allow board to take any action after an i2c transaction on a
@@ -488,8 +478,8 @@ void i2c_start_xfer_notify__7bf(const int port,
* @param slave_addr: Slave device address
*
*/
-void i2c_end_xfer_notify__7bf(const int port,
- const uint16_t slave_addr__7bf);
+void i2c_end_xfer_notify(const int port,
+ const uint16_t slave_addr_flags);
/**
* Defined in common/i2c_trace.c, used by i2c master to notify tracing
@@ -502,7 +492,7 @@ void i2c_end_xfer_notify__7bf(const int port,
* @param data: pointer to data read or written
* @param size: size of data read or written
*/
-void i2c_trace_notify__7bf(int port, uint16_t slave_addr__7bf,
+void i2c_trace_notify(int port, uint16_t slave_addr_flags,
int direction, const uint8_t *data, size_t size);
#endif /* __CROS_EC_I2C_H */