diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2012-05-10 22:47:11 +0000 |
---|---|---|
committer | Vincent Palatin <vpalatin@chromium.org> | 2012-05-14 23:33:21 +0000 |
commit | 87d3707f62c14376f9c5013e455544bf32d0fb33 (patch) | |
tree | a3f88652a3961a51299e4d71605b5e12fb772afd /chip | |
parent | 805299d838c996c1a96b9808214d742ea28eb707 (diff) | |
download | chrome-ec-87d3707f62c14376f9c5013e455544bf32d0fb33.tar.gz |
Slightly update the host commands API
Preparatory work to use common host command code between ARM and x86.
Every command sends back explicitly the size of the response payload.
The size of the response defaults to 0 ond can be updated.
Add a protocol version number returned as command 0x00 to help with
backward compatibility.
move a couple of function from lpc specific header to host commands to
be able to implement them for the I2C link.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=chrome-os-partner:9614
TEST=make BOARD=link
Change-Id: I6a28edf02996ddf6b7f32a3831d07d5f0271848f
Diffstat (limited to 'chip')
-rw-r--r-- | chip/lm4/lpc.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/chip/lm4/lpc.c b/chip/lm4/lpc.c index 64cdfb2d50..9587c6b8fa 100644 --- a/chip/lm4/lpc.c +++ b/chip/lm4/lpc.c @@ -114,7 +114,7 @@ static void lpc_generate_sci(void) } -uint8_t *lpc_get_host_range(int slot) +uint8_t *host_get_buffer(int slot) { return (uint8_t *)LPC_POOL_CMD_DATA + EC_LPC_PARAM_SIZE * slot; } @@ -126,7 +126,7 @@ uint8_t *lpc_get_memmap_range(void) } -void lpc_send_host_response(int slot, int result) +void host_send_result(int slot, int result) { int ch = slot ? LPC_CH_USER : LPC_CH_KERNEL; @@ -151,6 +151,15 @@ void lpc_send_host_response(int slot, int result) lpc_generate_sci(); } +void host_send_response(int slot, const uint8_t *data, int size) +{ + uint8_t *out = host_get_buffer(slot); + + if (data != out) + memcpy(out, data, size); + + host_send_result(slot, EC_LPC_RESULT_SUCCESS); +} /* Return true if the TOH is still set */ int lpc_keyboard_has_char(void) { |