summaryrefslogtreecommitdiff
path: root/common/lightbar.c
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2014-09-26 15:50:23 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-09-30 01:53:53 +0000
commit87762fa6997d3deb55dec777d5fa42c3cabdf7ca (patch)
treefc057b0aedbb8c26417f0d83705d869ee7e7fed3 /common/lightbar.c
parentaf3d103dbc3ddbb6004240186a946efe1cc8b8f4 (diff)
downloadchrome-ec-87762fa6997d3deb55dec777d5fa42c3cabdf7ca.tar.gz
Add compiler/decompiler for lightbar bytecode programs.
BUG=none BRANCH=ToT TEST=manual make BOARD=samus for i in extra/lightbar/programs/[g-z]*.bin; do ./build/samus/util/lbcc -d $i /tmp/x.lbs ./build/samus/util/lbcc /tmp/x.lbs /tmp/x.bin cmp $i /tmp/x.bin done Change-Id: I86c014c425e917ecafadd1c6845fcf2e5b4edbb7 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220244
Diffstat (limited to 'common/lightbar.c')
-rw-r--r--common/lightbar.c34
1 files changed, 6 insertions, 28 deletions
diff --git a/common/lightbar.c b/common/lightbar.c
index 8065996fce..6538e04668 100644
--- a/common/lightbar.c
+++ b/common/lightbar.c
@@ -988,23 +988,8 @@ static struct lb_program cur_prog;
static struct lb_program next_prog;
static uint8_t pc;
-enum lb_color {
- LB_COL_RED,
- LB_COL_GREEN,
- LB_COL_BLUE,
- LB_COL_ALL
-};
-
-enum lb_control {
- LB_CONT_COLOR0,
- LB_CONT_COLOR1,
- LB_CONT_PHASE,
- LB_CONT_MAX
-};
-
static uint8_t led_desc[NUM_LEDS][LB_CONT_MAX][3];
static uint32_t lb_ramp_delay;
-
/* Get one byte of data pointed to by the pc and advance
* the pc forward.
*/
@@ -1261,33 +1246,26 @@ static uint32_t lightbyte_CYCLE(void)
#undef GET_INTERP_VALUE
-#define OPCODE_TABLE \
- OP(JUMP), \
- OP(DELAY), \
- OP(SET_BRIGHTNESS), \
- OP(SET_COLOR), \
- OP(SET_DELAY_TIME), \
- OP(RAMP_ONCE), \
- OP(CYCLE_ONCE), \
- OP(CYCLE),
-
#define OP(X) X
+#include "lightbar_opcode_list.h"
enum lightbyte_opcode {
- OPCODE_TABLE
+ LIGHTBAR_OPCODE_TABLE
HALT,
MAX_OPCODE
};
#undef OP
#define OP(X) lightbyte_ ## X
+#include "lightbar_opcode_list.h"
static uint32_t (*lightbyte_dispatch[])(void) = {
- OPCODE_TABLE
+ LIGHTBAR_OPCODE_TABLE
};
#undef OP
#define OP(X) # X
+#include "lightbar_opcode_list.h"
static const char * const lightbyte_names[] = {
- OPCODE_TABLE
+ LIGHTBAR_OPCODE_TABLE
"HALT"
};
#undef OP