diff options
author | Hung-Te Lin <hungte@chromium.org> | 2013-06-21 20:11:47 +0800 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2013-07-10 23:15:42 +0200 |
commit | 23fb9979d999a155a2560a9f09f4fcdc1b96e9e7 (patch) | |
tree | c7a867647807a694ff0e16cd7328f764ecfd0938 /src/ec/google/chromeec/ec.h | |
parent | c357aed3d7954c87375ab5f7f6c0902a302adf09 (diff) | |
download | coreboot-23fb9979d999a155a2560a9f09f4fcdc1b96e9e7.tar.xz |
ec/google: Generalize communication protocol support in EC drivers.
Since EC protocol v3, the packet format will be the same for all buses (inclding
I2C, SPI, and LPC). That will simplify the implementation in each individual bus
driver source file.
To prepare for that, we will move the protocol part into crosec_proto.c:
crosec_command_proto, with bus driver in callback "crosec_io".
Change-Id: I9ccd19a57a182899dd1ef1cd90598679c1546295
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: http://review.coreboot.org/3749
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/ec/google/chromeec/ec.h')
-rw-r--r-- | src/ec/google/chromeec/ec.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h index 7679a8bcc6..13e9f234b1 100644 --- a/src/ec/google/chromeec/ec.h +++ b/src/ec/google/chromeec/ec.h @@ -21,6 +21,8 @@ #ifndef _EC_GOOGLE_CHROMEEC_EC_H #define _EC_GOOGLE_CHROMEEC_EC_H +#include <stddef.h> +#include <stdint.h> #ifndef __PRE_RAM__ u32 google_chromeec_get_wake_mask(void); @@ -60,6 +62,13 @@ struct chromeec_command { * actual received size out */ }; +/* internal standard implementation for EC command protocols. */ +typedef int (*crosec_io_t)(uint8_t *write_bytes, size_t write_size, + uint8_t *read_bytes, size_t read_size, + void *context); +int crosec_command_proto(struct chromeec_command *cec_command, + crosec_io_t crosec_io, void *context); + int google_chromeec_command(struct chromeec_command *cec_command); #endif /* _EC_GOOGLE_CHROMEEC_EC_H */ |