summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2019-07-11 18:17:34 -0600
committerCommit Bot <commit-bot@chromium.org>2019-07-17 21:45:18 +0000
commitf8d6179a26bf512c43638d0916fde0fc966cc3fb (patch)
treed4df87ff4a738060d20f874eaa75cc3b2d24cdb9 /include
parent21a255ea953e8ac64d05147ad7f11491db126cf4 (diff)
downloadchrome-ec-f8d6179a26bf512c43638d0916fde0fc966cc3fb.tar.gz
common: add i2c tracing functionality
crbug.com/982442 requests a way for developers to enable tracing of i2c commands when debugging. This adds a new debug feature, the i2ctrace command, which provides that. The command is guarded by CONFIG_I2C_DEBUG. BUG=chromium:982442 BRANCH=none TEST=enabled CONFIG_I2C_DEBUG on arcada_ish, made sure that command functioned as it says on the tin Change-Id: I9c762271237cbf131e5ef7c0f605c89af4f209fd Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1699347 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/i2c.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/i2c.h b/include/i2c.h
index 057f38f2e8..566ae7b402 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -11,6 +11,7 @@
#include "common.h"
#include "gpio.h"
#include "host_command.h"
+#include "stddef.h"
/* Flags for slave address field, in addition to the 8-bit address */
#define I2C_FLAG_BIG_ENDIAN 0x100 /* 16 byte values are MSB-first */
@@ -426,4 +427,18 @@ void i2c_start_xfer_notify(int port, int slave_addr);
*/
void i2c_end_xfer_notify(int port, int slave_addr);
+/**
+ * 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 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, int slave_addr, int direction,
+ const uint8_t *data, size_t size);
+
#endif /* __CROS_EC_I2C_H */