diff options
author | Vic Yang <victoryang@chromium.org> | 2012-09-10 16:34:41 +0800 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-09-10 03:06:19 -0700 |
commit | c23dc460731cac6f6377a026b9986fc20527feb9 (patch) | |
tree | 2b290d4d574094a510afbf88b7632ef1edf3beff /common | |
parent | e0f9dc74d9d105ecdad992a79b4d49dcce128b68 (diff) | |
download | chrome-ec-c23dc460731cac6f6377a026b9986fc20527feb9.tar.gz |
Add host command to dump charge state machine context
This is a temporary debug command and will be reverted once unnecessary.
BUG=chrome-os-partner:12801
TEST=Manual
BRANCH=link
Change-Id: Ib1b4221db31ed2521762ee32748bd9d2e177229d
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/32696
Reviewed-by: Rong Chang <rongchang@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/charge_state.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/common/charge_state.c b/common/charge_state.c index 5c02f59253..caa9caa6b6 100644 --- a/common/charge_state.c +++ b/common/charge_state.c @@ -707,3 +707,20 @@ static int charge_command_force_idle(struct host_cmd_handler_args *args) } DECLARE_HOST_COMMAND(EC_CMD_CHARGE_FORCE_IDLE, charge_command_force_idle, EC_VER_MASK(0)); + +static int charge_command_dump(struct host_cmd_handler_args *args) +{ + char *dest = (char *)args->response; + + if (system_is_locked()) + return EC_RES_ACCESS_DENIED; + + ASSERT(sizeof(task_ctx) <= args->response_max); + + memcpy(dest, &task_ctx, sizeof(task_ctx)); + args->response_size = sizeof(task_ctx); + + return EC_RES_SUCCESS; +} +DECLARE_HOST_COMMAND(EC_CMD_CHARGE_DUMP, charge_command_dump, + EC_VER_MASK(0)); |