diff options
author | Randall Spangler <rspangler@chromium.org> | 2017-08-25 12:39:16 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-09-01 14:41:47 -0700 |
commit | fe0a3b99ff8303113c52e4573361325b44574b5c (patch) | |
tree | beadcd492d1b065cce1c2f939d4b9b2239e9c2c7 /board/cr50/rdd.c | |
parent | af00619b1ed671fcbef16b48ee7d7172f3a8dc77 (diff) | |
download | chrome-ec-fe0a3b99ff8303113c52e4573361325b44574b5c.tar.gz |
cr50: Split servo state machine into its own file
This is the last state machine which used common/device_state.c. But
servo is more complex than that, because it needs to differentiate
state-isn't-known (debouncing) from state-isn't-knowable (Cr50 driving
EC TX), so it's cleaner to split it out the way we did AP and EC state
machines in previous CLs.
BUG=b:35587387
BRANCH=cr50
TEST=manual with CR50_DEV=1 build
// Test detect at boot, even with CCD connected
Pull CCD_MODE_L low
Pull DETECT_SERVO high
Pull DETECT_EC high
reboot -> 'Servo connect'
// CCD is not driving EC UART TX
ccd -> EC on, Servo connected, CCD enabled, EC UART RX
// When servo disconnects CCD can drive EC TX
Pull DETECT_SERVO low --> 'Servo disconnect'
ccd -> EC on, Servo undetectable, CCD enabled, EC UART RX+TX
// Can't detect servo reconnecting if we're driving EC TX
Pull DETECT_SERVO high --> (no change)
ccd -> EC on, Servo undetectable, CCD enabled, EC UART RX+TX
// When we stop driving EC TX, can redetect servo
Pull EC_DETECT low --> See 'EC off', 'Servo connected'
ccd -> EC off, Servo connected, CCD enabled, EC UART disabled
// Test debouncing at boot
Pull DETECT_EC high
Pull DETECT_SERVO low
Pull CCD_MODE_L high
reboot
Within 1 sec, pull DETECT_SERVO high --> 'Servo connected'
// Test debouncing after boot
Pull DETECT_SERVO low then high < 1 sec --> (no message)
Change-Id: I964bd36c35f52c8ef7b3ea3793b6e0764e93587c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/636047
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Diffstat (limited to 'board/cr50/rdd.c')
-rw-r--r-- | board/cr50/rdd.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/board/cr50/rdd.c b/board/cr50/rdd.c index 03b1785d90..db38fbcd52 100644 --- a/board/cr50/rdd.c +++ b/board/cr50/rdd.c @@ -5,7 +5,6 @@ #include "case_closed_debug.h" #include "console.h" -#include "device_state.h" #include "gpio.h" #include "hooks.h" #include "i2c.h" @@ -51,11 +50,6 @@ static void uart_select_tx(int uart, int signal) } } -int servo_is_connected(void) -{ - return device_get_state(DEVICE_SERVO) == DEVICE_STATE_ON; -} - void uartn_tx_connect(int uart) { /* @@ -188,6 +182,7 @@ static int command_ccd(int argc, char **argv) print_ap_state(); print_ec_state(); print_rdd_state(); + print_servo_state(); ccprintf("CCD: %s\n", rdd_is_connected() ? "enabled" : "disabled"); ccprintf("AP UART: %s\n", |