summaryrefslogtreecommitdiff
path: root/test/extpwr_gpio.c
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-09-29 00:55:36 +0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-10-01 08:16:34 +0000
commitc77575ac0daa5966772779cedbaab6f607cf9a98 (patch)
treef1e7cf3ca7f232e4be95b7bd57e652253eddaacc /test/extpwr_gpio.c
parent2d856c51039153effe4b9e9d7924c841fb741da5 (diff)
downloadchrome-ec-c77575ac0daa5966772779cedbaab6f607cf9a98.tar.gz
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 <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/170907 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'test/extpwr_gpio.c')
-rw-r--r--test/extpwr_gpio.c13
1 files changed, 1 insertions, 12 deletions
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);
}