summaryrefslogtreecommitdiff
path: root/board/cr50/rdd.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2017-08-28 15:54:14 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-08-29 19:37:05 -0700
commitb0891c9450516f94ae44cc17f0cd5cf0436b77da (patch)
treecb5221ab267a25ea9a6af36cf81e129072e7be9e /board/cr50/rdd.c
parent63deaa4f59e7a769ea5ea24a6528a1b5adda5211 (diff)
downloadchrome-ec-b0891c9450516f94ae44cc17f0cd5cf0436b77da.tar.gz
cr50: Let state machines print their own states
Add a function to translate device_state enum into a string, then use it for printing the ec and RDD state. Refactor ec_state so that all state transitions go through a set_state() function, which makes it easier to turn on debugging all state transitions. That's normally not compiled in because it would be spammy during debouncing. BUG=none BRANCH=cr50 TEST=ccd command prints EC and RDD states Change-Id: Ie7bc56c7b66beee23d1d1989711c640e5e39ce43 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/642121 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Diffstat (limited to 'board/cr50/rdd.c')
-rw-r--r--board/cr50/rdd.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/board/cr50/rdd.c b/board/cr50/rdd.c
index bfc58a136c..ca2da0fd75 100644
--- a/board/cr50/rdd.c
+++ b/board/cr50/rdd.c
@@ -189,9 +189,10 @@ static int command_ccd(int argc, char **argv)
return EC_ERROR_PARAM1;
}
- ccprintf("CCD: %s\n",
- rdd_detect_is_forced() ? "forced enable" :
- rdd_is_connected() ? "enabled" : "disabled");
+ print_ec_state();
+ print_rdd_state();
+
+ ccprintf("CCD: %s\n", rdd_is_connected() ? "enabled" : "disabled");
ccprintf("AP UART: %s\n",
uartn_is_enabled(UART_AP) ?
uart_tx_is_connected(UART_AP) ? "RX+TX" : "RX" : "disabled");