summaryrefslogtreecommitdiff
path: root/common/host_event_commands.c
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2012-05-10 22:47:11 +0000
committerVincent Palatin <vpalatin@chromium.org>2012-05-14 23:33:21 +0000
commit87d3707f62c14376f9c5013e455544bf32d0fb33 (patch)
treea3f88652a3961a51299e4d71605b5e12fb772afd /common/host_event_commands.c
parent805299d838c996c1a96b9808214d742ea28eb707 (diff)
downloadchrome-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 'common/host_event_commands.c')
-rw-r--r--common/host_event_commands.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/common/host_event_commands.c b/common/host_event_commands.c
index 3590966fd2..d009d5df65 100644
--- a/common/host_event_commands.c
+++ b/common/host_event_commands.c
@@ -60,43 +60,46 @@ DECLARE_CONSOLE_COMMAND(hostevent, command_host_event);
/*****************************************************************************/
/* Host commands */
-static enum lpc_status host_event_get_smi_mask(uint8_t *data)
+static int host_event_get_smi_mask(uint8_t *data, int *resp_size)
{
struct lpc_response_host_event_mask *r =
(struct lpc_response_host_event_mask *)data;
r->mask = lpc_get_host_event_mask(LPC_HOST_EVENT_SMI);
+ *resp_size = sizeof(struct lpc_response_host_event_mask);
return EC_LPC_RESULT_SUCCESS;
}
DECLARE_HOST_COMMAND(EC_LPC_COMMAND_HOST_EVENT_GET_SMI_MASK,
host_event_get_smi_mask);
-static enum lpc_status host_event_get_sci_mask(uint8_t *data)
+static int host_event_get_sci_mask(uint8_t *data, int *resp_size)
{
struct lpc_response_host_event_mask *r =
(struct lpc_response_host_event_mask *)data;
r->mask = lpc_get_host_event_mask(LPC_HOST_EVENT_SCI);
+ *resp_size = sizeof(struct lpc_response_host_event_mask);
return EC_LPC_RESULT_SUCCESS;
}
DECLARE_HOST_COMMAND(EC_LPC_COMMAND_HOST_EVENT_GET_SCI_MASK,
host_event_get_sci_mask);
-static enum lpc_status host_event_get_wake_mask(uint8_t *data)
+static int host_event_get_wake_mask(uint8_t *data, int *resp_size)
{
struct lpc_response_host_event_mask *r =
(struct lpc_response_host_event_mask *)data;
r->mask = lpc_get_host_event_mask(LPC_HOST_EVENT_WAKE);
+ *resp_size = sizeof(struct lpc_response_host_event_mask);
return EC_LPC_RESULT_SUCCESS;
}
DECLARE_HOST_COMMAND(EC_LPC_COMMAND_HOST_EVENT_GET_WAKE_MASK,
host_event_get_wake_mask);
-static enum lpc_status host_event_set_smi_mask(uint8_t *data)
+static int host_event_set_smi_mask(uint8_t *data, int *resp_size)
{
const struct lpc_params_host_event_mask *p =
(const struct lpc_params_host_event_mask *)data;
@@ -108,7 +111,7 @@ DECLARE_HOST_COMMAND(EC_LPC_COMMAND_HOST_EVENT_SET_SMI_MASK,
host_event_set_smi_mask);
-static enum lpc_status host_event_set_sci_mask(uint8_t *data)
+static int host_event_set_sci_mask(uint8_t *data, int *resp_size)
{
const struct lpc_params_host_event_mask *p =
(const struct lpc_params_host_event_mask *)data;
@@ -120,7 +123,7 @@ DECLARE_HOST_COMMAND(EC_LPC_COMMAND_HOST_EVENT_SET_SCI_MASK,
host_event_set_sci_mask);
-static enum lpc_status host_event_set_wake_mask(uint8_t *data)
+static int host_event_set_wake_mask(uint8_t *data, int *resp_size)
{
const struct lpc_params_host_event_mask *p =
(const struct lpc_params_host_event_mask *)data;
@@ -132,7 +135,7 @@ DECLARE_HOST_COMMAND(EC_LPC_COMMAND_HOST_EVENT_SET_WAKE_MASK,
host_event_set_wake_mask);
-static enum lpc_status host_event_clear(uint8_t *data)
+static int host_event_clear(uint8_t *data, int *resp_size)
{
const struct lpc_params_host_event_mask *p =
(const struct lpc_params_host_event_mask *)data;