diff options
author | Mary Ruthven <mruthven@chromium.org> | 2021-01-05 17:19:18 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-01-07 19:21:56 +0000 |
commit | 4ecdbc3b1e4ddd94bd488f148c87db87720de61c (patch) | |
tree | 1482fdc98756e7dc6a6e4c56dd532884ea091178 | |
parent | d619e3e95b67728f1c6faff6eb39ac9101ca2328 (diff) | |
download | chrome-ec-4ecdbc3b1e4ddd94bd488f148c87db87720de61c.tar.gz |
coil: i2c slave_addr -> periph_addr
BUG=b:175244613
TEST=make buildall -j
Change-Id: Ifb547770fd829e27437079bee809d07fff90a77a
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2611760
Reviewed-by: Namyoon Woo <namyoon@chromium.org>
-rw-r--r-- | chip/g/i2cm.c | 14 | ||||
-rw-r--r-- | chip/host/i2c.c | 20 | ||||
-rw-r--r-- | chip/lm4/i2c.c | 6 | ||||
-rw-r--r-- | common/i2c_master.c | 149 | ||||
-rw-r--r-- | common/i2c_trace.c | 58 | ||||
-rw-r--r-- | common/i2c_wedge.c | 38 | ||||
-rw-r--r-- | include/i2c.h | 82 | ||||
-rw-r--r-- | include/test_util.h | 8 |
8 files changed, 188 insertions, 187 deletions
diff --git a/chip/g/i2cm.c b/chip/g/i2cm.c index 4959cdbba0..0496fa1a93 100644 --- a/chip/g/i2cm.c +++ b/chip/g/i2cm.c @@ -247,7 +247,7 @@ static int i2cm_poll_for_complete(int port) return EC_ERROR_TIMEOUT; } -static uint32_t i2cm_create_inst(int slave_addr_flags, int is_write, +static uint32_t i2cm_create_inst(int periph_addr_flags, int is_write, size_t size, uint32_t flags) { uint32_t inst = 0; @@ -258,7 +258,7 @@ static uint32_t i2cm_create_inst(int slave_addr_flags, int is_write, * to be included. */ inst |= INST_START; - inst |= INST_DEVADDRVAL(I2C_GET_ADDR(slave_addr_flags)); + inst |= INST_DEVADDRVAL(I2C_GET_ADDR(periph_addr_flags)); inst |= INST_RWDEVADDR; } @@ -276,7 +276,7 @@ static uint32_t i2cm_create_inst(int slave_addr_flags, int is_write, return inst; } -static int i2cm_execute_sequence(int port, int slave_addr_flags, +static int i2cm_execute_sequence(int port, int periph_addr_flags, const uint8_t *out, int out_size, uint8_t *in, int in_size, int flags) @@ -309,7 +309,7 @@ static int i2cm_execute_sequence(int port, int slave_addr_flags, seq_flags &= ~I2C_XFER_STOP; /* Build sequence instruction */ - inst = i2cm_create_inst(slave_addr_flags, is_write, + inst = i2cm_create_inst(periph_addr_flags, is_write, batch_size, seq_flags); /* If this is a write - copy data into the FIFO. */ @@ -353,7 +353,7 @@ static int i2cm_execute_sequence(int port, int slave_addr_flags, /* Perform an i2c transaction. */ -int chip_i2c_xfer(const int port, const uint16_t slave_addr_flags, +int chip_i2c_xfer(const int port, const uint16_t periph_addr_flags, const uint8_t *out, int out_size, uint8_t *in, int in_size, int flags) { @@ -376,14 +376,14 @@ int chip_i2c_xfer(const int port, const uint16_t slave_addr_flags, if (out_size) { /* Process write before read. */ - rv = i2cm_execute_sequence(port, slave_addr_flags, out, + rv = i2cm_execute_sequence(port, periph_addr_flags, out, out_size, NULL, 0, flags); if (rv != EC_SUCCESS) return rv; } if (in_size) - rv = i2cm_execute_sequence(port, slave_addr_flags, + rv = i2cm_execute_sequence(port, periph_addr_flags, NULL, 0, in, in_size, flags); return rv; diff --git a/chip/host/i2c.c b/chip/host/i2c.c index 5b863c1d41..c35f60f528 100644 --- a/chip/host/i2c.c +++ b/chip/host/i2c.c @@ -14,7 +14,7 @@ struct i2c_dev { int port; - uint16_t slave_addr_flags; + uint16_t periph_addr_flags; int valid; }; @@ -28,7 +28,7 @@ static void detach_init(void) } DECLARE_HOOK(HOOK_INIT, detach_init, HOOK_PRIO_FIRST); -int test_detach_i2c(const int port, const uint16_t slave_addr_flags) +int test_detach_i2c(const int port, const uint16_t periph_addr_flags) { int i; @@ -40,20 +40,20 @@ int test_detach_i2c(const int port, const uint16_t slave_addr_flags) return EC_ERROR_OVERFLOW; detached_devs[i].port = port; - detached_devs[i].slave_addr_flags = slave_addr_flags; + detached_devs[i].periph_addr_flags = periph_addr_flags; detached_devs[i].valid = 1; return EC_SUCCESS; } -int test_attach_i2c(const int port, const uint16_t slave_addr_flags) +int test_attach_i2c(const int port, const uint16_t periph_addr_flags) { int i; for (i = 0; i < MAX_DETACHED_DEV_COUNT; ++i) if (detached_devs[i].valid && detached_devs[i].port == port && - detached_devs[i].slave_addr_flags == slave_addr_flags) + detached_devs[i].periph_addr_flags == periph_addr_flags) break; if (i == MAX_DETACHED_DEV_COUNT) @@ -64,29 +64,29 @@ int test_attach_i2c(const int port, const uint16_t slave_addr_flags) } static int test_check_detached(const int port, - const uint16_t slave_addr_flags) + const uint16_t periph_addr_flags) { int i; for (i = 0; i < MAX_DETACHED_DEV_COUNT; ++i) if (detached_devs[i].valid && detached_devs[i].port == port && - detached_devs[i].slave_addr_flags == slave_addr_flags) + detached_devs[i].periph_addr_flags == periph_addr_flags) return 1; return 0; } -int chip_i2c_xfer(const int port, const uint16_t slave_addr_flags, +int chip_i2c_xfer(const int port, const uint16_t periph_addr_flags, const uint8_t *out, int out_size, uint8_t *in, int in_size, int flags) { const struct test_i2c_xfer *p; int rv; - if (test_check_detached(port, slave_addr_flags)) + if (test_check_detached(port, periph_addr_flags)) return EC_ERROR_UNKNOWN; for (p = __test_i2c_xfer; p < __test_i2c_xfer_end; ++p) { - rv = p->routine(port, slave_addr_flags, + rv = p->routine(port, periph_addr_flags, out, out_size, in, in_size, flags); if (rv != EC_ERROR_INVAL) diff --git a/chip/lm4/i2c.c b/chip/lm4/i2c.c index 7cd06c430f..2392182415 100644 --- a/chip/lm4/i2c.c +++ b/chip/lm4/i2c.c @@ -165,7 +165,7 @@ int i2c_do_work(int port) return 0; } -int chip_i2c_xfer(const int port, const uint16_t slave_addr_flags, +int chip_i2c_xfer(const int port, const uint16_t periph_addr_flags, const uint8_t *out, int out_size, uint8_t *in, int in_size, int flags) { @@ -193,7 +193,7 @@ int chip_i2c_xfer(const int port, const uint16_t slave_addr_flags, CPRINTS("I2C%d Addr:%02X bad status 0x%02x, SCL=%d, SDA=%d", port, - I2C_GET_ADDR(slave_addr_flags), + I2C_GET_ADDR(periph_addr_flags), reg_mcs, i2c_get_line_levels(port) & I2C_LINE_SCL_HIGH, i2c_get_line_levels(port) & I2C_LINE_SDA_HIGH); @@ -219,7 +219,7 @@ int chip_i2c_xfer(const int port, const uint16_t slave_addr_flags, } /* Set slave address for transmit */ - LM4_I2C_MSA(port) = (I2C_GET_ADDR(slave_addr_flags) << 1) & 0xff; + LM4_I2C_MSA(port) = (I2C_GET_ADDR(periph_addr_flags) << 1) & 0xff; /* Enable interrupts */ pd->task_waiting = task_get_current(); diff --git a/common/i2c_master.c b/common/i2c_master.c index c7f8530eac..5a8f58196f 100644 --- a/common/i2c_master.c +++ b/common/i2c_master.c @@ -72,18 +72,18 @@ const struct i2c_port_t *get_i2c_port(const int port) } static int chip_i2c_xfer_with_notify(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, const uint8_t *out, int out_size, uint8_t *in, int in_size, int flags) { int ret; - uint16_t addr_flags = slave_addr_flags; + uint16_t addr_flags = periph_addr_flags; if (IS_ENABLED(CONFIG_I2C_DEBUG)) - i2c_trace_notify(port, slave_addr_flags, 0, out, out_size); + i2c_trace_notify(port, periph_addr_flags, 0, out, out_size); if (IS_ENABLED(CONFIG_I2C_XFER_BOARD_CALLBACK)) - i2c_start_xfer_notify(port, slave_addr_flags); + i2c_start_xfer_notify(port, periph_addr_flags); if (IS_ENABLED(CONFIG_SMBUS_PEC)) /* @@ -95,10 +95,10 @@ static int chip_i2c_xfer_with_notify(const int port, flags); if (IS_ENABLED(CONFIG_I2C_XFER_BOARD_CALLBACK)) - i2c_end_xfer_notify(port, slave_addr_flags); + i2c_end_xfer_notify(port, periph_addr_flags); if (IS_ENABLED(CONFIG_I2C_DEBUG)) - i2c_trace_notify(port, slave_addr_flags, 1, in, in_size); + i2c_trace_notify(port, periph_addr_flags, 1, in, in_size); return ret; } @@ -109,7 +109,7 @@ static int chip_i2c_xfer_with_notify(const int port, * if in_size exceeds CONFIG_I2C_CHIP_MAX_READ_SIZE. */ static int i2c_xfer_no_retry(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, const uint8_t *out, int out_size, uint8_t *in, int in_size, int flags) { @@ -119,14 +119,14 @@ static int i2c_xfer_no_retry(const int port, in_size -= in_chunk_size; out_flags |= !in_size ? (flags & I2C_XFER_STOP) : 0; - ret = chip_i2c_xfer_with_notify(port, slave_addr_flags, + ret = chip_i2c_xfer_with_notify(port, periph_addr_flags, out, out_size, in, in_chunk_size, out_flags); in += in_chunk_size; while (in_size && ret == EC_SUCCESS) { in_chunk_size = MIN(in_size, CONFIG_I2C_CHIP_MAX_READ_SIZE); in_size -= in_chunk_size; - ret = chip_i2c_xfer_with_notify(port, slave_addr_flags, + ret = chip_i2c_xfer_with_notify(port, periph_addr_flags, NULL, 0, in, in_chunk_size, !in_size ? (flags & I2C_XFER_STOP) : 0); in += in_chunk_size; @@ -136,14 +136,14 @@ static int i2c_xfer_no_retry(const int port, #endif /* CONFIG_I2C_XFER_LARGE_READ */ int i2c_xfer_unlocked(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, const uint8_t *out, int out_size, uint8_t *in, int in_size, int flags) { int i; int ret = EC_SUCCESS; - uint16_t addr_flags = slave_addr_flags & ~I2C_FLAG_PEC; + uint16_t addr_flags = periph_addr_flags & ~I2C_FLAG_PEC; if (!i2c_port_is_locked(port)) { CPUTS("Access I2C without lock!"); @@ -167,14 +167,14 @@ int i2c_xfer_unlocked(const int port, } int i2c_xfer(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, const uint8_t *out, int out_size, uint8_t *in, int in_size) { int rv; i2c_lock(port, 1); - rv = i2c_xfer_unlocked(port, slave_addr_flags, + rv = i2c_xfer_unlocked(port, periph_addr_flags, out, out_size, in, in_size, I2C_XFER_SINGLE); i2c_lock(port, 0); @@ -226,27 +226,27 @@ void i2c_prepare_sysjump(void) } /* i2c_readN with optional error checking */ -static int i2c_read(const int port, const uint16_t slave_addr_flags, +static int i2c_read(const int port, const uint16_t periph_addr_flags, uint8_t reg, uint8_t *in, int in_size) { - if (!IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(slave_addr_flags)) + if (!IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(periph_addr_flags)) return EC_ERROR_UNIMPLEMENTED; - if (IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(slave_addr_flags)) { + if (IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(periph_addr_flags)) { int i, rv; /* addr_8bit = 7 bit addr_flags + 1 bit r/w */ - uint8_t addr_8bit = I2C_GET_ADDR(slave_addr_flags) << 1; + uint8_t addr_8bit = I2C_GET_ADDR(periph_addr_flags) << 1; uint8_t out[3] = {addr_8bit, reg, addr_8bit | 1}; uint8_t pec_local = 0, pec_remote; i2c_lock(port, 1); for (i = 0; i <= CONFIG_I2C_NACK_RETRY_COUNT; i++) { - rv = i2c_xfer_unlocked(port, slave_addr_flags, ®, 1, + rv = i2c_xfer_unlocked(port, periph_addr_flags, ®, 1, in, in_size, I2C_XFER_START); if (rv) continue; - rv = i2c_xfer_unlocked(port, slave_addr_flags, NULL, 0, + rv = i2c_xfer_unlocked(port, periph_addr_flags, NULL, 0, &pec_remote, 1, I2C_XFER_STOP); if (rv) continue; @@ -263,19 +263,19 @@ static int i2c_read(const int port, const uint16_t slave_addr_flags, return rv; } - return i2c_xfer(port, slave_addr_flags, ®, 1, in, in_size); + return i2c_xfer(port, periph_addr_flags, ®, 1, in, in_size); } /* i2c_writeN with optional error checking */ -static int i2c_write(const int port, const uint16_t slave_addr_flags, +static int i2c_write(const int port, const uint16_t periph_addr_flags, const uint8_t *out, int out_size) { - if (!IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(slave_addr_flags)) + if (!IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(periph_addr_flags)) return EC_ERROR_UNIMPLEMENTED; - if (IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(slave_addr_flags)) { + if (IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(periph_addr_flags)) { int i, rv; - uint8_t addr_8bit = I2C_GET_ADDR(slave_addr_flags) << 1; + uint8_t addr_8bit = I2C_GET_ADDR(periph_addr_flags) << 1; uint8_t pec; pec = crc8(&addr_8bit, 1); @@ -283,13 +283,13 @@ static int i2c_write(const int port, const uint16_t slave_addr_flags, i2c_lock(port, 1); for (i = 0; i <= CONFIG_I2C_NACK_RETRY_COUNT; i++) { - rv = i2c_xfer_unlocked(port, slave_addr_flags, + rv = i2c_xfer_unlocked(port, periph_addr_flags, out, out_size, NULL, 0, I2C_XFER_START); if (rv) continue; - rv = i2c_xfer_unlocked(port, slave_addr_flags, + rv = i2c_xfer_unlocked(port, periph_addr_flags, &pec, 1, NULL, 0, I2C_XFER_STOP); if (!rv) @@ -300,11 +300,11 @@ static int i2c_write(const int port, const uint16_t slave_addr_flags, return rv; } - return i2c_xfer(port, slave_addr_flags, out, out_size, NULL, 0); + return i2c_xfer(port, periph_addr_flags, out, out_size, NULL, 0); } int i2c_read32(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, int offset, int *data) { int rv; @@ -312,12 +312,12 @@ int i2c_read32(const int port, reg = offset & 0xff; /* I2C read 32-bit word: transmit 8-bit offset, and read 32bits */ - rv = i2c_read(port, slave_addr_flags, reg, buf, sizeof(uint32_t)); + rv = i2c_read(port, periph_addr_flags, reg, buf, sizeof(uint32_t)); if (rv) return rv; - if (I2C_IS_BIG_ENDIAN(slave_addr_flags)) + if (I2C_IS_BIG_ENDIAN(periph_addr_flags)) *data = ((int)buf[0] << 24) | ((int)buf[1] << 16) | ((int)buf[0] << 8) | buf[1]; else @@ -328,14 +328,14 @@ int i2c_read32(const int port, } int i2c_write32(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, int offset, int data) { uint8_t buf[1 + sizeof(uint32_t)]; buf[0] = offset & 0xff; - if (I2C_IS_BIG_ENDIAN(slave_addr_flags)) { + if (I2C_IS_BIG_ENDIAN(periph_addr_flags)) { buf[1] = (data >> 24) & 0xff; buf[2] = (data >> 16) & 0xff; buf[3] = (data >> 8) & 0xff; @@ -347,11 +347,11 @@ int i2c_write32(const int port, buf[4] = (data >> 24) & 0xff; } - return i2c_write(port, slave_addr_flags, buf, sizeof(uint32_t) + 1); + return i2c_write(port, periph_addr_flags, buf, sizeof(uint32_t) + 1); } int i2c_read16(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, int offset, int *data) { int rv; @@ -359,12 +359,12 @@ int i2c_read16(const int port, reg = offset & 0xff; /* I2C read 16-bit word: transmit 8-bit offset, and read 16bits */ - rv = i2c_read(port, slave_addr_flags, reg, buf, sizeof(uint16_t)); + rv = i2c_read(port, periph_addr_flags, reg, buf, sizeof(uint16_t)); if (rv) return rv; - if (I2C_IS_BIG_ENDIAN(slave_addr_flags)) + if (I2C_IS_BIG_ENDIAN(periph_addr_flags)) *data = ((int)buf[0] << 8) | buf[1]; else *data = ((int)buf[1] << 8) | buf[0]; @@ -373,14 +373,14 @@ int i2c_read16(const int port, } int i2c_write16(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, int offset, int data) { uint8_t buf[1 + sizeof(uint16_t)]; buf[0] = offset & 0xff; - if (I2C_IS_BIG_ENDIAN(slave_addr_flags)) { + if (I2C_IS_BIG_ENDIAN(periph_addr_flags)) { buf[1] = (data >> 8) & 0xff; buf[2] = data & 0xff; } else { @@ -388,11 +388,11 @@ int i2c_write16(const int port, buf[2] = (data >> 8) & 0xff; } - return i2c_write(port, slave_addr_flags, buf, 1 + sizeof(uint16_t)); + return i2c_write(port, periph_addr_flags, buf, 1 + sizeof(uint16_t)); } int i2c_read8(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, int offset, int *data) { int rv; @@ -401,7 +401,7 @@ int i2c_read8(const int port, reg = offset; - rv = i2c_read(port, slave_addr_flags, reg, &buf, sizeof(uint8_t)); + rv = i2c_read(port, periph_addr_flags, reg, &buf, sizeof(uint8_t)); if (!rv) *data = buf; @@ -409,7 +409,7 @@ int i2c_read8(const int port, } int i2c_write8(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, int offset, int data) { uint8_t buf[2]; @@ -417,11 +417,11 @@ int i2c_write8(const int port, buf[0] = offset; buf[1] = data; - return i2c_write(port, slave_addr_flags, buf, sizeof(buf)); + return i2c_write(port, periph_addr_flags, buf, sizeof(buf)); } int i2c_read_offset16(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, uint16_t offset, int *data, int len) { int rv; @@ -434,7 +434,7 @@ int i2c_read_offset16(const int port, addr[1] = offset & 0xff; /* I2C read 16-bit word: transmit 16-bit offset, and read buffer */ - rv = i2c_xfer(port, slave_addr_flags, addr, 2, buf, len); + rv = i2c_xfer(port, periph_addr_flags, addr, 2, buf, len); if (rv) return rv; @@ -442,7 +442,7 @@ int i2c_read_offset16(const int port, if (len == 1) { *data = buf[0]; } else { - if (I2C_IS_BIG_ENDIAN(slave_addr_flags)) + if (I2C_IS_BIG_ENDIAN(periph_addr_flags)) *data = ((int)buf[0] << 8) | buf[1]; else *data = ((int)buf[1] << 8) | buf[0]; @@ -452,7 +452,7 @@ int i2c_read_offset16(const int port, } int i2c_write_offset16(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, uint16_t offset, int data, int len) { uint8_t buf[2 + sizeof(uint16_t)]; @@ -466,7 +466,7 @@ int i2c_write_offset16(const int port, if (len == 1) { buf[2] = data & 0xff; } else { - if (I2C_IS_BIG_ENDIAN(slave_addr_flags)) { + if (I2C_IS_BIG_ENDIAN(periph_addr_flags)) { buf[2] = (data >> 8) & 0xff; buf[3] = data & 0xff; } else { @@ -475,11 +475,11 @@ int i2c_write_offset16(const int port, } } - return i2c_xfer(port, slave_addr_flags, buf, 2 + len, NULL, 0); + return i2c_xfer(port, periph_addr_flags, buf, 2 + len, NULL, 0); } int i2c_read_offset16_block(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, uint16_t offset, uint8_t *data, int len) { uint8_t addr[sizeof(uint16_t)]; @@ -487,11 +487,11 @@ int i2c_read_offset16_block(const int port, addr[0] = (offset >> 8) & 0xff; addr[1] = offset & 0xff; - return i2c_xfer(port, slave_addr_flags, addr, 2, data, len); + return i2c_xfer(port, periph_addr_flags, addr, 2, data, len); } int i2c_write_offset16_block(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, uint16_t offset, const uint8_t *data, int len) { int rv; @@ -505,10 +505,10 @@ int i2c_write_offset16_block(const int port, * appending the destination address with the data array. */ i2c_lock(port, 1); - rv = i2c_xfer_unlocked(port, slave_addr_flags, addr, 2, NULL, 0, + rv = i2c_xfer_unlocked(port, periph_addr_flags, addr, 2, NULL, 0, I2C_XFER_START); if (!rv) - rv = i2c_xfer_unlocked(port, slave_addr_flags, + rv = i2c_xfer_unlocked(port, periph_addr_flags, data, len, NULL, 0, I2C_XFER_STOP); i2c_lock(port, 0); @@ -516,13 +516,13 @@ int i2c_write_offset16_block(const int port, } int i2c_read_string(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, int offset, uint8_t *data, int len) { int i, rv; uint8_t reg, block_length; - if (!IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(slave_addr_flags)) + if (!IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(periph_addr_flags)) return EC_ERROR_UNIMPLEMENTED; reg = offset; @@ -535,7 +535,7 @@ int i2c_read_string(const int port, * Send device reg space offset, and read back block length. * Keep this session open without a stop. */ - rv = i2c_xfer_unlocked(port, slave_addr_flags, + rv = i2c_xfer_unlocked(port, periph_addr_flags, ®, 1, &block_length, 1, I2C_XFER_START); if (rv) @@ -547,12 +547,13 @@ int i2c_read_string(const int port, data_length = block_length; if (IS_ENABLED(CONFIG_SMBUS_PEC) && - I2C_USE_PEC(slave_addr_flags)) { - uint8_t addr_8bit = I2C_GET_ADDR(slave_addr_flags) << 1; + I2C_USE_PEC(periph_addr_flags)) { + uint8_t addr_8bit = + I2C_GET_ADDR(periph_addr_flags) << 1; uint8_t out[3] = {addr_8bit, reg, addr_8bit | 1}; uint8_t pec, pec_remote; - rv = i2c_xfer_unlocked(port, slave_addr_flags, + rv = i2c_xfer_unlocked(port, periph_addr_flags, 0, 0, data, data_length, 0); data[data_length] = 0; if (rv) @@ -567,7 +568,7 @@ int i2c_read_string(const int port, while (block_length) { uint8_t byte; - rv = i2c_xfer_unlocked(port, slave_addr_flags, + rv = i2c_xfer_unlocked(port, periph_addr_flags, NULL, 0, &byte, 1, 0); if (rv) break; @@ -577,7 +578,7 @@ int i2c_read_string(const int port, if (rv) continue; - rv = i2c_xfer_unlocked(port, slave_addr_flags, NULL, 0, + rv = i2c_xfer_unlocked(port, periph_addr_flags, NULL, 0, &pec_remote, 1, I2C_XFER_STOP); if (rv) continue; @@ -585,7 +586,7 @@ int i2c_read_string(const int port, if (pec != pec_remote) rv = EC_ERROR_CRC; } else { - rv = i2c_xfer_unlocked(port, slave_addr_flags, + rv = i2c_xfer_unlocked(port, periph_addr_flags, 0, 0, data, data_length, I2C_XFER_STOP); data[data_length] = 0; @@ -602,28 +603,28 @@ int i2c_read_string(const int port, } int i2c_read_block(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, int offset, uint8_t *data, int len) { int rv; uint8_t reg_address = offset; - rv = i2c_xfer(port, slave_addr_flags, ®_address, 1, data, len); + rv = i2c_xfer(port, periph_addr_flags, ®_address, 1, data, len); return rv; } int i2c_write_block(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, int offset, const uint8_t *data, int len) { int i, rv; uint8_t reg_address = offset, pec = 0; - if (!IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(slave_addr_flags)) + if (!IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(periph_addr_flags)) return EC_ERROR_UNIMPLEMENTED; - if (IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(slave_addr_flags)) { - uint8_t addr_8bit = I2C_GET_ADDR(slave_addr_flags) << 1; + if (IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(periph_addr_flags)) { + uint8_t addr_8bit = I2C_GET_ADDR(periph_addr_flags) << 1; pec = crc8(&addr_8bit, sizeof(uint8_t)); pec = crc8_arg(data, len, pec); @@ -635,25 +636,25 @@ int i2c_write_block(const int port, */ i2c_lock(port, 1); for (i = 0; i <= CONFIG_I2C_NACK_RETRY_COUNT; i++) { - rv = i2c_xfer_unlocked(port, slave_addr_flags, + rv = i2c_xfer_unlocked(port, periph_addr_flags, ®_address, 1, NULL, 0, I2C_XFER_START); if (rv) continue; - if (I2C_USE_PEC(slave_addr_flags)) { - rv = i2c_xfer_unlocked(port, slave_addr_flags, + if (I2C_USE_PEC(periph_addr_flags)) { + rv = i2c_xfer_unlocked(port, periph_addr_flags, data, len, NULL, 0, 0); if (rv) continue; - rv = i2c_xfer_unlocked(port, slave_addr_flags, + rv = i2c_xfer_unlocked(port, periph_addr_flags, &pec, sizeof(uint8_t), NULL, 0, I2C_XFER_STOP); if (rv) continue; } else { - rv = i2c_xfer_unlocked(port, slave_addr_flags, + rv = i2c_xfer_unlocked(port, periph_addr_flags, data, len, NULL, 0, I2C_XFER_STOP); if (rv) diff --git a/common/i2c_trace.c b/common/i2c_trace.c index 66696df52a..0408751f53 100644 --- a/common/i2c_trace.c +++ b/common/i2c_trace.c @@ -15,23 +15,23 @@ struct i2c_trace_range { bool enabled; int port; - int slave_addr_lo; /* Inclusive */ - int slave_addr_hi; /* Inclusive */ + int periph_addr_lo; /* Inclusive */ + int periph_addr_hi; /* Inclusive */ }; static struct i2c_trace_range trace_entries[8]; -void i2c_trace_notify(int port, uint16_t slave_addr_flags, +void i2c_trace_notify(int port, uint16_t periph_addr_flags, int direction, const uint8_t *data, size_t size) { size_t i; - uint16_t addr = I2C_GET_ADDR(slave_addr_flags); + uint16_t addr = I2C_GET_ADDR(periph_addr_flags); for (i = 0; i < ARRAY_SIZE(trace_entries); i++) if (trace_entries[i].enabled && trace_entries[i].port == port - && trace_entries[i].slave_addr_lo <= addr - && trace_entries[i].slave_addr_hi >= addr) + && trace_entries[i].periph_addr_lo <= addr + && trace_entries[i].periph_addr_hi >= addr) goto trace_enabled; return; @@ -57,11 +57,11 @@ static int command_i2ctrace_list(void) ccprintf("%2d %4d 0x%X", i, trace_entries[i].port, - trace_entries[i].slave_addr_lo); - if (trace_entries[i].slave_addr_hi - != trace_entries[i].slave_addr_lo) + trace_entries[i].periph_addr_lo); + if (trace_entries[i].periph_addr_hi + != trace_entries[i].periph_addr_lo) ccprintf(" to 0x%X", - trace_entries[i].slave_addr_hi); + trace_entries[i].periph_addr_hi); ccprintf("\n"); } } @@ -78,8 +78,8 @@ static int command_i2ctrace_disable(size_t id) return EC_SUCCESS; } -static int command_i2ctrace_enable(int port, int slave_addr_lo, - int slave_addr_hi) +static int command_i2ctrace_enable(int port, int periph_addr_lo, + int periph_addr_hi) { struct i2c_trace_range *t; struct i2c_trace_range *new_entry = NULL; @@ -87,7 +87,7 @@ static int command_i2ctrace_enable(int port, int slave_addr_lo, if (port >= i2c_ports_used) return EC_ERROR_PARAM2; - if (slave_addr_lo > slave_addr_hi) + if (periph_addr_lo > periph_addr_hi) return EC_ERROR_PARAM3; /* @@ -99,36 +99,36 @@ static int command_i2ctrace_enable(int port, int slave_addr_lo, t++) { if (t->enabled && t->port == port) { /* Subset of existing range, do nothing */ - if (t->slave_addr_lo <= slave_addr_lo && - t->slave_addr_hi >= slave_addr_hi) + if (t->periph_addr_lo <= periph_addr_lo && + t->periph_addr_hi >= periph_addr_hi) return EC_SUCCESS; - /* Extends exising range on both directions, replace */ - if (t->slave_addr_lo >= slave_addr_lo && - t->slave_addr_hi <= slave_addr_hi) { + /* Extends existing range on both directions, replace */ + if (t->periph_addr_lo >= periph_addr_lo && + t->periph_addr_hi <= periph_addr_hi) { t->enabled = 0; return command_i2ctrace_enable( - port, slave_addr_lo, slave_addr_hi); + port, periph_addr_lo, periph_addr_hi); } /* Extends existing range below */ - if (t->slave_addr_lo - 1 <= slave_addr_hi && - t->slave_addr_hi >= slave_addr_hi) { + if (t->periph_addr_lo - 1 <= periph_addr_hi && + t->periph_addr_hi >= periph_addr_hi) { t->enabled = 0; return command_i2ctrace_enable( port, - slave_addr_lo, - t->slave_addr_hi); + periph_addr_lo, + t->periph_addr_hi); } /* Extends existing range above */ - if (t->slave_addr_lo <= slave_addr_lo && - t->slave_addr_hi + 1 >= slave_addr_lo) { + if (t->periph_addr_lo <= periph_addr_lo && + t->periph_addr_hi + 1 >= periph_addr_lo) { t->enabled = 0; return command_i2ctrace_enable( port, - t->slave_addr_lo, - slave_addr_hi); + t->periph_addr_lo, + periph_addr_hi); } } else if (!t->enabled && !new_entry) { new_entry = t; @@ -139,8 +139,8 @@ static int command_i2ctrace_enable(int port, int slave_addr_lo, if (new_entry) { new_entry->enabled = 1; new_entry->port = port; - new_entry->slave_addr_lo = slave_addr_lo; - new_entry->slave_addr_hi = slave_addr_hi; + new_entry->periph_addr_lo = periph_addr_lo; + new_entry->periph_addr_hi = periph_addr_hi; return EC_SUCCESS; } diff --git a/common/i2c_wedge.c b/common/i2c_wedge.c index 7b52698ed5..f044b84dc3 100644 --- a/common/i2c_wedge.c +++ b/common/i2c_wedge.c @@ -178,19 +178,19 @@ static void i2c_bang_init(void) i2c_raw_mode(I2C_PORT_HOST, 1); } -static void i2c_bang_xfer(int slave_addr, int reg) +static void i2c_bang_xfer(int periph_addr, int reg) { int byte; i2c_bang_init(); - /* State a write command to 'slave_addr' */ - i2c_bang_out_byte(1 /*start*/, 0 /*stop*/, slave_addr); + /* State a write command to 'periph_addr' */ + i2c_bang_out_byte(1 /*start*/, 0 /*stop*/, periph_addr); /* Write 'reg' */ i2c_bang_out_byte(0 /*start*/, 0 /*stop*/, reg); /* Start a read command */ - i2c_bang_out_byte(1 /*start*/, 0 /*stop*/, slave_addr | 1); + i2c_bang_out_byte(1 /*start*/, 0 /*stop*/, periph_addr | 1); /* Read two bytes */ byte = i2c_bang_in_byte(0, 0); /* ack and no stop */ @@ -199,15 +199,15 @@ static void i2c_bang_xfer(int slave_addr, int reg) ccprintf(" read byte: %d\n", byte); } -static void i2c_bang_wedge_write(int slave_addr, int byte, int bit_count, +static void i2c_bang_wedge_write(int periph_addr, int byte, int bit_count, int reboot) { int i; i2c_bang_init(); - /* State a write command to 'slave_addr' */ - i2c_bang_out_byte(1 /*start*/, 0 /*stop*/, slave_addr); + /* State a write command to 'periph_addr' */ + i2c_bang_out_byte(1 /*start*/, 0 /*stop*/, periph_addr); /* Send a few bits and stop */ for (i = 0; i < bit_count; ++i) { i2c_bang_out_bit((byte & 0x80) != 0); @@ -219,20 +219,20 @@ static void i2c_bang_wedge_write(int slave_addr, int byte, int bit_count, system_reset(0); } -static void i2c_bang_wedge_read(int slave_addr, int reg, int bit_count, +static void i2c_bang_wedge_read(int periph_addr, int reg, int bit_count, int reboot) { int i; i2c_bang_init(); - /* State a write command to 'slave_addr' */ - i2c_bang_out_byte(1 /*start*/, 0 /*stop*/, slave_addr); + /* State a write command to 'periph_addr' */ + i2c_bang_out_byte(1 /*start*/, 0 /*stop*/, periph_addr); /* Write 'reg' */ i2c_bang_out_byte(0 /*start*/, 0 /*stop*/, reg); /* Start a read command */ - i2c_bang_out_byte(1 /*start*/, 0 /*stop*/, slave_addr | 1); + i2c_bang_out_byte(1 /*start*/, 0 /*stop*/, periph_addr | 1); /* Read bit_count bits and stop */ for (i = 0; i < bit_count; ++i) @@ -250,7 +250,7 @@ static void i2c_bang_wedge_read(int slave_addr, int reg, int bit_count, static int command_i2c_wedge(int argc, char **argv) { - int slave_addr, reg, wedge_flag = 0, wedge_bit_count = -1; + int periph_addr, reg, wedge_flag = 0, wedge_bit_count = -1; char *e; enum gpio_signal tmp; @@ -263,7 +263,7 @@ static int command_i2c_wedge(int argc, char **argv) } if (argc < 3) { - ccputs("Usage: i2cwedge slave_addr out_byte " + ccputs("Usage: i2cwedge periph_addr out_byte " "[wedge_flag [wedge_bit_count]]\n"); ccputs(" wedge_flag - (1: wedge out; 2: wedge in;" " 5: wedge out+reboot; 6: wedge in+reboot)]\n"); @@ -271,9 +271,9 @@ static int command_i2c_wedge(int argc, char **argv) return EC_ERROR_UNKNOWN; } - slave_addr = strtoi(argv[1], &e, 0); + periph_addr = strtoi(argv[1], &e, 0); if (*e) { - ccprintf("Invalid slave_addr %s\n", argv[1]); + ccprintf("Invalid periph_addr %s\n", argv[1]); return EC_ERROR_INVAL; } reg = strtoi(argv[2], &e, 0); @@ -301,15 +301,15 @@ static int command_i2c_wedge(int argc, char **argv) if (wedge_flag & WEDGE_WRITE) { if (wedge_bit_count < 0) wedge_bit_count = 8; - i2c_bang_wedge_write(slave_addr, reg, wedge_bit_count, + i2c_bang_wedge_write(periph_addr, reg, wedge_bit_count, (wedge_flag & WEDGE_REBOOT)); } else if (wedge_flag & WEDGE_READ) { if (wedge_bit_count < 0) wedge_bit_count = 2; - i2c_bang_wedge_read(slave_addr, reg, wedge_bit_count, + i2c_bang_wedge_read(periph_addr, reg, wedge_bit_count, (wedge_flag & WEDGE_REBOOT)); } else { - i2c_bang_xfer(slave_addr, reg); + i2c_bang_xfer(periph_addr, reg); } /* Put it back into normal mode */ @@ -325,7 +325,7 @@ static int command_i2c_wedge(int argc, char **argv) return EC_SUCCESS; } DECLARE_CONSOLE_COMMAND(i2cwedge, command_i2c_wedge, - "i2cwedge slave_addr out_byte " + "i2cwedge periph_addr out_byte " "[wedge_flag [wedge_bit_count]]", "Wedge host I2C bus"); diff --git a/include/i2c.h b/include/i2c.h index 8ec73ac03e..0121bfb413 100644 --- a/include/i2c.h +++ b/include/i2c.h @@ -19,10 +19,10 @@ * EC will favor 7bit I2C/SPI address encoding. The variable/define * naming should follow the pattern, if it is just the 7 bit address * then end the variable as "addr". This can be addr, i2c_addr, - * slave_addr, etc. If the 7 bit address contains flags for BIG + * periph_addr, etc. If the 7 bit address contains flags for BIG * ENDIAN or overloading the address to be a SPI address, then it * will be customary to end the variable as "addr_flags". This can - * be addr_flags, i2c_addr_flags, slave_addr_flags, etc. + * be addr_flags, i2c_addr_flags, periph_addr_flags, etc. * * 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 @@ -117,10 +117,10 @@ struct i2c_stress_test_dev { struct i2c_test_reg_info reg_info; struct i2c_test_results test_results; int (*i2c_read)(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, const int reg, int *data); int (*i2c_write)(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_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); @@ -148,7 +148,7 @@ extern const int i2c_test_dev_used; * by locking the I2C port and performing an I2C_XFER_SINGLE transfer. * * @param port Port to access - * @param slave_addr Slave device address + * @param periph_addr Slave device address * @param out Data to send * @param out_size Number of bytes to send * @param in Destination buffer for received data @@ -156,7 +156,7 @@ extern const int i2c_test_dev_used; * @return EC_SUCCESS, or non-zero if error. */ int i2c_xfer(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, const uint8_t *out, int out_size, uint8_t *in, int in_size); @@ -167,7 +167,7 @@ int i2c_xfer(const int port, * @param flags Flags (see I2C_XFER_* above) */ int i2c_xfer_unlocked(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, const uint8_t *out, int out_size, uint8_t *in, int in_size, int flags); @@ -183,7 +183,7 @@ int i2c_xfer_unlocked(const int port, * i2c_xfer(). * * @param port Port to access - * @param slave_addr Slave device address + * @param periph_addr Slave device address * @param out Data to send * @param out_size Number of bytes to send * @param in Destination buffer for received data @@ -192,7 +192,7 @@ int i2c_xfer_unlocked(const int port, * @return EC_SUCCESS, or non-zero if error. */ int chip_i2c_xfer(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, const uint8_t *out, int out_size, uint8_t *in, int in_size, int flags); @@ -287,83 +287,83 @@ void i2c_prepare_sysjump(void); void i2c_set_timeout(int port, uint32_t timeout); /** - * Read a 32-bit register from the slave at 7-bit slave address <slaveaddr>, at + * Read a 32-bit register from the slave at 7-bit slave address <periphaddr>, at * the specified 8-bit <offset> in the slave's address space. */ int i2c_read32(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, int offset, int *data); /** - * Write a 32-bit register to the slave at 7-bit slave address <slaveaddr>, at + * Write a 32-bit register to the slave at 7-bit slave address <periphaddr>, at * the specified 8-bit <offset> in the slave's address space. */ int i2c_write32(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, int offset, int data); /** - * Read a 16-bit register from the slave at 7-bit slave address <slaveaddr>, at + * Read a 16-bit register from the slave at 7-bit slave address <periphaddr>, at * the specified 8-bit <offset> in the slave's address space. */ int i2c_read16(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, int offset, int *data); /** - * Write a 16-bit register to the slave at 7-bit slave address <slaveaddr>, at + * Write a 16-bit register to the slave at 7-bit slave address <periphaddr>, at * the specified 8-bit <offset> in the slave's address space. */ int i2c_write16(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, int offset, int data); /** - * Read an 8-bit register from the slave at 7-bit slave address <slaveaddr>, at + * Read an 8-bit register from the slave at 7-bit slave address <periphaddr>, at * the specified 8-bit <offset> in the slave's address space. */ int i2c_read8(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, int offset, int *data); /** - * Write an 8-bit register to the slave at 7-bit slave address <slaveaddr>, at + * Write an 8-bit register to the slave at 7-bit slave address <periphaddr>, at * the specified 8-bit <offset> in the slave's address space. */ int i2c_write8(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_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. + * * <periphaddr>, at 16-bit <offset> in the slave's address space. */ int i2c_read_offset16(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_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. + * <periphaddr>, at 16-bit <offset> in the slave's address space. */ int i2c_write_offset16(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_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. + * * <periphaddr>, at 16-bit <offset> in the slave's address space. */ int i2c_read_offset16_block(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_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. + * <periphaddr>, at 16-bit <offset> in the slave's address space. */ int i2c_write_offset16_block(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, uint16_t offset, const uint8_t *data, int len); /** @@ -382,7 +382,7 @@ int i2c_unwedge(int port); /** * Read ascii string using smbus read block protocol. - * Read bytestream from <slaveaddr>:<offset> with format: + * Read bytestream from <periphaddr>:<offset> with format: * [length_N] [byte_0] [byte_1] ... [byte_N-1] * * <len> : the max length of receiving buffer. to read N bytes @@ -392,25 +392,25 @@ int i2c_unwedge(int port); * <len> == 0 : buffer size > 255 */ int i2c_read_string(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, int offset, uint8_t *data, int len); /** * Read a data block of <len> 8-bit transfers from the slave at 7-bit slave - * address <slaveaddr>, at the specified 8-bit <offset> in the slave's address + * address <periphaddr>, at the specified 8-bit <offset> in the slave's address * space. */ int i2c_read_block(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, int offset, uint8_t *data, int len); /** * Write a data block of <len> 8-bit transfers to the slave at 7-bit slave - * address <slaveaddr>, at the specified 8-bit <offset> in the slave's address + * address <periphaddr>, at the specified 8-bit <offset> in the slave's address * space. */ int i2c_write_block(const int port, - const uint16_t slave_addr_flags, + const uint16_t periph_addr_flags, int offset, const uint8_t *data, int len); /** @@ -487,11 +487,11 @@ int board_is_i2c_port_powered(int port); * CONFIG_I2C_XFER_BOARD_CALLBACK. * * @param port: I2C port number - * @param slave_addr: Slave device address + * @param periph_addr: Slave device address * */ void i2c_start_xfer_notify(const int port, - const uint16_t slave_addr_flags); + const uint16_t periph_addr_flags); /** * Function to allow board to take any action after an i2c transaction on a @@ -499,24 +499,24 @@ void i2c_start_xfer_notify(const int port, * CONFIG_I2C_XFER_BOARD_CALLBACK. * * @param port: I2C port number - * @param slave_addr: Slave device address + * @param periph_addr: Slave device address * */ void i2c_end_xfer_notify(const int port, - const uint16_t slave_addr_flags); + const uint16_t periph_addr_flags); /** * Defined in common/i2c_trace.c, used by i2c master to notify tracing * funcionality of transactions. * * @param port: I2C port number - * @param slave_addr: slave device address + * @param periph_addr: slave device address * @param direction: 0 for write, * 1 for read * @param data: pointer to data read or written * @param size: size of data read or written */ -void i2c_trace_notify(int port, uint16_t slave_addr_flags, +void i2c_trace_notify(int port, uint16_t periph_addr_flags, int direction, const uint8_t *data, size_t size); /* diff --git a/include/test_util.h b/include/test_util.h index bfcd940cea..21ea21595b 100644 --- a/include/test_util.h +++ b/include/test_util.h @@ -283,20 +283,20 @@ struct test_i2c_write_dev { * specified port and slave address returns error. * * @param port The port that the detached device is connected to - * @param slave_addr The address of the detached device + * @param periph_addr The address of the detached device * @return EC_SUCCESS if detached; EC_ERROR_OVERFLOW if too many devices are * detached. */ -int test_detach_i2c(const int port, const uint16_t slave_addr_flags); +int test_detach_i2c(const int port, const uint16_t periph_addr_flags); /* * Re-attach an I2C device. * * @param port The port that the detached device is connected to - * @param slave_addr The address of the detached device + * @param periph_addr The address of the detached device * @return EC_SUCCESS if re-attached; EC_ERROR_INVAL if the specified device * is not a detached device. */ -int test_attach_i2c(const int port, const uint16_t slave_addr_flags); +int test_attach_i2c(const int port, const uint16_t periph_addr_flags); #endif /* __CROS_EC_TEST_UTIL_H */ |