summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2014-07-30 11:03:21 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-07-30 23:42:16 +0000
commit947f7ff93679a9ecff2acde78f2bdd292299b04c (patch)
tree356be37d4c264510831469d3ea86159af5e697ee
parent61d0caf338bddf3842809c9b833f26a0eab769fa (diff)
downloadchrome-ec-947f7ff93679a9ecff2acde78f2bdd292299b04c.tar.gz
stm32f0: Fix buffer size for i2c host command receive
Packets can be 128 bytes, and are preceded by a prefix byte. So we need a 129-byte buffer, not a 128-byte buffer. BUG=chrome-os-partner:30079 BRANCH=none TEST=do pd software sync; see that 128-byte packets transfer correctly Change-Id: Ic1e6cfec2c042537768d1cd0eecea509cc90c052 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/210502 Reviewed-by: Alec Berg <alecaberg@chromium.org>
-rw-r--r--chip/stm32/i2c-stm32f0.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/chip/stm32/i2c-stm32f0.c b/chip/stm32/i2c-stm32f0.c
index e042befa10..e877c5f139 100644
--- a/chip/stm32/i2c-stm32f0.c
+++ b/chip/stm32/i2c-stm32f0.c
@@ -121,8 +121,11 @@ static void i2c_init_port(const struct i2c_port_t *p)
/*****************************************************************************/
#ifdef HAS_TASK_HOSTCMD
/* Host command slave */
-/* Buffer for host commands (including version, error code and checksum) */
-static uint8_t host_buffer[I2C_MAX_HOST_PACKET_SIZE];
+/*
+ * Buffer for received host command packets (including prefix byte on request,
+ * and result/size on response)
+ */
+static uint8_t host_buffer[I2C_MAX_HOST_PACKET_SIZE + 2];
static uint8_t params_copy[I2C_MAX_HOST_PACKET_SIZE] __aligned(4);
static int host_i2c_resp_port;
static int tx_pending;