diff options
author | Vic Yang <victoryang@chromium.org> | 2013-09-16 14:45:35 +0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-09-17 03:22:12 +0000 |
commit | d5e183f9e56d9e623885b163d9b71203d04880cf (patch) | |
tree | a3baabc92658407f296e69a4a308cd94d50e8c53 /include/link_defs.h | |
parent | cdd5c206cd2125983f83ef3a54470b5e99f82031 (diff) | |
download | chrome-ec-d5e183f9e56d9e623885b163d9b71203d04880cf.tar.gz |
Fake I2C device support for emulator
To test drivers, we need a way to fake I2C periphrals. With this CL, a
fake peripheral can be done by declaring its own I2C read/write
functions. The fake I2C peripherals may return EC_ERROR_INVAL to
indicate it's not responding. The emulator I2C read/write call scans
through all registered I2C peripherals and uses the first response.
BUG=chrome-os-partner:19235
TEST=Pass sbs_charging test with the next CL.
BRANCH=None
Change-Id: I9380dc40e147781b42e09eb6979c864bbd9f2ac4
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/169511
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include/link_defs.h')
-rw-r--r-- | include/link_defs.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/link_defs.h b/include/link_defs.h index d5e4ccd595..52782760b1 100644 --- a/include/link_defs.h +++ b/include/link_defs.h @@ -12,6 +12,7 @@ #include "hooks.h" #include "host_command.h" #include "task.h" +#include "test_util.h" /* Console commands */ extern const struct console_command __cmds[]; @@ -53,6 +54,18 @@ extern const struct hook_data __hooks_second_end[]; extern const struct deferred_data __deferred_funcs[]; extern const struct deferred_data __deferred_funcs_end[]; +/* I2C fake devices for unit testing */ +extern const struct test_i2c_read_dev __test_i2c_read8[]; +extern const struct test_i2c_read_dev __test_i2c_read8_end[]; +extern const struct test_i2c_write_dev __test_i2c_write8[]; +extern const struct test_i2c_write_dev __test_i2c_write8_end[]; +extern const struct test_i2c_read_dev __test_i2c_read16[]; +extern const struct test_i2c_read_dev __test_i2c_read16_end[]; +extern const struct test_i2c_write_dev __test_i2c_write16[]; +extern const struct test_i2c_write_dev __test_i2c_write16_end[]; +extern const struct test_i2c_read_string_dev __test_i2c_read_string[]; +extern const struct test_i2c_read_string_dev __test_i2c_read_string_end[]; + /* Host commands */ extern const struct host_command __hcmds[]; extern const struct host_command __hcmds_end[]; |