diff options
author | Bill Richardson <wfrichar@chromium.org> | 2012-04-25 13:56:09 -0700 |
---|---|---|
committer | Bill Richardson <wfrichar@chromium.org> | 2012-04-25 18:42:36 -0700 |
commit | e763812a3a420e313d8784ad1c0ab510f2c174b3 (patch) | |
tree | 79aed3667377eb4358ab667ad9a137def24ec23a /include | |
parent | 93a4ed6bcdaef3b36865b04a41c3e26ffd96108c (diff) | |
download | chrome-ec-e763812a3a420e313d8784ad1c0ab510f2c174b3.tar.gz |
Give ectool the same lightbar commands as the console.
BUG=chrome-os-partner:7839
TEST=manual
Try "lightbar help" on the EC console and "ectool lightbar help" on the
host. You should see the same commands and behavior.
Change-Id: I6e879e8bb892ef5ada7ef85a97fdf243149f4cb6
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/lightbar.h | 21 | ||||
-rw-r--r-- | include/lightbar_msg_list.h | 26 | ||||
-rw-r--r-- | include/lpc_commands.h | 48 |
3 files changed, 71 insertions, 24 deletions
diff --git a/include/lightbar.h b/include/lightbar.h index a18f236f3f..0cc19e2b9b 100644 --- a/include/lightbar.h +++ b/include/lightbar.h @@ -7,8 +7,11 @@ #ifndef __CROS_EC_LIGHTBAR_H #define __CROS_EC_LIGHTBAR_H +/****************************************************************************/ +/* Internal stuff */ + /* Define the types of sequences */ -#define LBMSG(state) LIGHTBAR_##state, +#define LBMSG(state) LIGHTBAR_##state #include "lightbar_msg_list.h" enum lightbar_sequence { LIGHTBAR_MSG_LIST @@ -19,4 +22,20 @@ enum lightbar_sequence { /* Request a preset sequence from the lightbar task. */ void lightbar_sequence(enum lightbar_sequence s); +/****************************************************************************/ +/* External stuff */ + +/* These are the commands available to the EC console or via LPC. */ +enum lightbar_command { + LIGHTBAR_CMD_DUMP, + LIGHTBAR_CMD_OFF, + LIGHTBAR_CMD_ON, + LIGHTBAR_CMD_INIT, + LIGHTBAR_CMD_BRIGHTNESS, + LIGHTBAR_CMD_SEQ, + LIGHTBAR_CMD_REG, + LIGHTBAR_CMD_RGB, + LIGHTBAR_NUM_CMDS +}; + #endif /* __CROS_EC_LIGHTBAR_H */ diff --git a/include/lightbar_msg_list.h b/include/lightbar_msg_list.h index d6a33ed20f..f1c73a7f83 100644 --- a/include/lightbar_msg_list.h +++ b/include/lightbar_msg_list.h @@ -7,16 +7,16 @@ * types. */ #define LIGHTBAR_MSG_LIST \ - LBMSG(ERROR) \ - LBMSG(S5) \ - LBMSG(S3) \ - LBMSG(S0) \ - LBMSG(S5S3) \ - LBMSG(S3S0) \ - LBMSG(S0S3) \ - LBMSG(S3S5) \ - LBMSG(STOP) \ - LBMSG(RUN) \ - LBMSG(PULSE) \ - LBMSG(TEST) \ - LBMSG(KONAMI) + LBMSG(ERROR), \ + LBMSG(S5), \ + LBMSG(S3), \ + LBMSG(S0), \ + LBMSG(S5S3), \ + LBMSG(S3S0), \ + LBMSG(S0S3), \ + LBMSG(S3S5), \ + LBMSG(STOP), \ + LBMSG(RUN), \ + LBMSG(PULSE), \ + LBMSG(TEST), \ + LBMSG(KONAMI), diff --git a/include/lpc_commands.h b/include/lpc_commands.h index d9890b7b25..a3386c7280 100644 --- a/include/lpc_commands.h +++ b/include/lpc_commands.h @@ -345,18 +345,46 @@ struct lpc_params_pwm_set_keyboard_backlight { } __attribute__ ((packed)); /*****************************************************************************/ -/* Lightbar commands */ - -#define EC_LPC_COMMAND_LIGHTBAR_RESET 0x28 -/* No params needed */ - -#define EC_LPC_COMMAND_LIGHTBAR_TEST 0x29 -struct lpc_params_lightbar_test { - uint8_t tbd; +/* Lightbar commands. This looks worse than it is. Since we only use one LPC + * command to say "talk to the lightbar", we put the "and tell it to do X" + * part into a subcommand. We'll make separate structs for subcommands with + * different input args, so that we know how much to expect. */ + +#define EC_LPC_COMMAND_LIGHTBAR_CMD 0x28 +struct lpc_params_lightbar_cmd { + union { + union { + uint8_t cmd; + struct { + uint8_t cmd; + } dump, off, on, init; + struct num { + uint8_t cmd; + uint8_t num; + } brightness, seq; + + struct reg { + uint8_t cmd; + uint8_t ctrl, reg, value; + } reg; + struct rgb { + uint8_t cmd; + uint8_t led, red, green, blue; + } rgb; + } in; + union { + uint8_t dump[69]; + uint8_t off[0]; + uint8_t on[0]; + uint8_t init[0]; + uint8_t brightness[0]; + uint8_t seq[0]; + uint8_t reg[0]; + uint8_t rgb[0]; + } out; + }; } __attribute__ ((packed)); - - /*****************************************************************************/ /* USB charging control commands */ |