From c77575ac0daa5966772779cedbaab6f607cf9a98 Mon Sep 17 00:00:00 2001 From: Vic Yang Date: Sun, 29 Sep 2013 00:55:36 +0800 Subject: Emulator support of fake GPIO input For all GPIOs, the current values are recorded. A test can then change the value of a GPIO input by gpio_set_level(). The changed value is recorded and also interrupt is fired if the change fits the interrupt flags defined in board/host/board.c. BUG=chrome-os-partner:19235 TEST=Pass all tests BRANCH=None Change-Id: If8e547e5adf4a20dcb118f5fe2187293005d4ca3 Signed-off-by: Vic Yang Reviewed-on: https://chromium-review.googlesource.com/170907 Reviewed-by: Bill Richardson Reviewed-by: Randall Spangler Reviewed-by: Vincent Palatin --- test/extpwr_gpio.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'test/extpwr_gpio.c') diff --git a/test/extpwr_gpio.c b/test/extpwr_gpio.c index c10dad6627..e2a6f830bf 100644 --- a/test/extpwr_gpio.c +++ b/test/extpwr_gpio.c @@ -15,22 +15,11 @@ #include "timer.h" #include "util.h" -static int mock_ac; static int ac_hook_count; -int gpio_get_level(enum gpio_signal signal) -{ - if (signal == GPIO_AC_PRESENT) - return mock_ac; - return 0; -} - static void set_ac(int val) { - if (val == mock_ac) - return; - mock_ac = val; - extpower_interrupt(GPIO_AC_PRESENT); + gpio_set_level(GPIO_AC_PRESENT, val); msleep(50); } -- cgit v1.2.1