diff options
author | Werner Zeh <werner.zeh@siemens.com> | 2022-08-26 13:17:52 +0200 |
---|---|---|
committer | Martin L Roth <gaumless@gmail.com> | 2022-09-04 14:55:59 +0000 |
commit | 63f72f0cd0d01ef6138bfba80b7cd19d57c6602c (patch) | |
tree | 87da2616c21e262eed5133fd4fa3d0b024846528 /src/include/device | |
parent | 74a00b9cec6ce4f1a92d6ade4baa305dbe9e5ffb (diff) |
device/i2c_bus: Add routines to read and write multiple bytes
Some devices require that several bytes are written with a single I2C
write command. Extend the i2c_bus interface functions and add both, read
and write for more than one byte at a defined byte offset.
Change-Id: I0eec2e1d4185170f02b4ab35aa6546dc69569303
Signed-off-by: Werner Zeh <werner.zeh@siemens.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/67098
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Mario Scheithauer <mario.scheithauer@siemens.com>
Diffstat (limited to 'src/include/device')
-rw-r--r-- | src/include/device/i2c_bus.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/include/device/i2c_bus.h b/src/include/device/i2c_bus.h index 1a7e777278..4c9b98d14f 100644 --- a/src/include/device/i2c_bus.h +++ b/src/include/device/i2c_bus.h @@ -90,5 +90,19 @@ int i2c_dev_writeb_at(struct device *, uint8_t off, uint8_t val); * value on error. */ int i2c_dev_read_at16(struct device *, uint8_t *buf, size_t len, uint16_t off); +/* + * Sends the 8-bit register offset `off` and reads `len` bytes into `buf`. + * + * Returns the number of bytes read on success, negative `enum cb_err` + * value on error. + */ +int i2c_dev_read_at(struct device *, uint8_t *buf, size_t len, uint8_t off); +/* + * Sends the 8-bit register offset `off` and writes `len` bytes from `buf`. + * + * Returns the number of bytes written on success, negative `enum cb_err` + * value on error. + */ +int i2c_dev_write_at(struct device *, uint8_t *buf, size_t len, uint8_t off); #endif /* _DEVICE_I2C_BUS_H_ */ |