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
This commit is contained in:
Bill Richardson
2014-09-26 15:50:23 -07:00
committed by chrome-internal-fetch
parent af3d103dbc
commit 87762fa699
6 changed files with 640 additions and 29 deletions

View File

@@ -1037,6 +1037,7 @@ struct lightbar_params_v1 {
/* Lightbyte program. */
#define LB_PROG_LEN 192
#define LB_PROG_MAX_OPERANDS 4
struct lb_program {
uint8_t size;
uint8_t data[LB_PROG_LEN];

View File

@@ -19,6 +19,21 @@ enum lightbar_sequence {
};
#undef LBMSG
/* Bytecode field constants */
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
};
/* Request a preset sequence from the lightbar task. */
void lightbar_sequence(enum lightbar_sequence s);

View File

@@ -0,0 +1,15 @@
/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* This defines a list of lightbar opcodes for programmable sequences.
*/
#define LIGHTBAR_OPCODE_TABLE \
OP(JUMP), \
OP(DELAY), \
OP(SET_BRIGHTNESS), \
OP(SET_COLOR), \
OP(SET_DELAY_TIME), \
OP(RAMP_ONCE), \
OP(CYCLE_ONCE), \
OP(CYCLE),