summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEric Caruso <ejcaruso@chromium.org>2014-09-17 16:52:31 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-09-25 07:59:16 +0000
commitfb5ff7b1bb59174ea140d18cb84ce1d6599337c1 (patch)
tree9e78996ca8d6fbe6c51cf272b94e5b5e00727f2b /include
parent2939b986cfc4fc3f8b46b37b4d345bec270418ca (diff)
downloadchrome-ec-fb5ff7b1bb59174ea140d18cb84ce1d6599337c1.tar.gz
lightbar: add seq type PROGRAM for user-programmable sequences
This diff allows the user to send small programs to the EC and gain control of the lightbar. Right now, this is only exposed through ectool, and sysfs support will come later. To send a program to the EC, use $ ectool lightbar program /path/to/program.bin and then start running the program with $ ectool lightbar seq program BUG=None BRANCH=ToT TEST=Using the above steps with hand-assembled programs. Checked that infinite bytecode loops do not hang the EC. Checked that bad opcodes exit with an error. Stress tested pushing programs and changing sequences. Signed-off-by: Eric Caruso <ejcaruso@chromium.org> Change-Id: I635fb041a5dc5c403f7c26fb9a41b5563be9b6b7 Reviewed-on: https://chromium-review.googlesource.com/219558 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/ec_commands.h12
-rw-r--r--include/lightbar_msg_list.h3
2 files changed, 13 insertions, 2 deletions
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 552fc5dfc0..e148660644 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -1032,6 +1032,13 @@ struct lightbar_params_v1 {
struct rgb_s color[8]; /* 0-3 are Google colors */
} __packed;
+/* Lightbyte program. */
+#define LB_PROG_LEN 192
+struct lb_program {
+ uint8_t size;
+ uint8_t data[LB_PROG_LEN];
+};
+
struct ec_params_lightbar {
uint8_t cmd; /* Command (see enum lightbar_command) */
union {
@@ -1058,6 +1065,7 @@ struct ec_params_lightbar {
struct lightbar_params_v0 set_params_v0;
struct lightbar_params_v1 set_params_v1;
+ struct lb_program set_program;
};
} __packed;
@@ -1090,7 +1098,8 @@ struct ec_response_lightbar {
struct {
/* no return params */
} off, on, init, set_brightness, seq, reg, set_rgb,
- demo, set_params_v0, set_params_v1;
+ demo, set_params_v0, set_params_v1,
+ set_program;
};
} __packed;
@@ -1114,6 +1123,7 @@ enum lightbar_command {
LIGHTBAR_CMD_GET_DEMO = 15,
LIGHTBAR_CMD_GET_PARAMS_V1 = 16,
LIGHTBAR_CMD_SET_PARAMS_V1 = 17,
+ LIGHTBAR_CMD_SET_PROGRAM = 18,
LIGHTBAR_NUM_CMDS
};
diff --git a/include/lightbar_msg_list.h b/include/lightbar_msg_list.h
index fe75ccc021..77b8c60ad2 100644
--- a/include/lightbar_msg_list.h
+++ b/include/lightbar_msg_list.h
@@ -20,4 +20,5 @@
LBMSG(PULSE), /* A */ \
LBMSG(TEST), /* B */ \
LBMSG(KONAMI), /* C */ \
- LBMSG(TAP), /* D */
+ LBMSG(TAP), /* D */ \
+ LBMSG(PROGRAM), /* E */