From 947f7ff93679a9ecff2acde78f2bdd292299b04c Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Wed, 30 Jul 2014 11:03:21 -0700 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/210502 Reviewed-by: Alec Berg --- chip/stm32/i2c-stm32f0.c | 7 +++++-- 1 file 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; -- cgit v1.2.1