summaryrefslogtreecommitdiff
path: root/chip
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2019-11-01 16:13:00 -0600
committerCommit Bot <commit-bot@chromium.org>2019-11-04 21:48:19 +0000
commit86893761dcfcb76addf04b44426d97154608e03b (patch)
tree451de010c5586d8e2ba5aaaf20a09c6eff03795d /chip
parent8b54f65a87e93b427cdfd0b21de0936d547dc8cb (diff)
downloadchrome-ec-86893761dcfcb76addf04b44426d97154608e03b.tar.gz
host: adding gpio print for debugging
Add console print when GPIO line changes for easier unit test debugging BRANCH=none BUG=none TEST=verified that gpio print occurs in unit tests Change-Id: I888859c8ef4a1b879146e9c01767ee487f7ce564 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1896124 Commit-Queue: Raul E Rangel <rrangel@chromium.org> Reviewed-by: Raul E Rangel <rrangel@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r--chip/host/gpio.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/chip/host/gpio.c b/chip/host/gpio.c
index ace8cbd482..3c15205ad5 100644
--- a/chip/host/gpio.c
+++ b/chip/host/gpio.c
@@ -8,6 +8,7 @@
#include "console.h"
#include "common.h"
+#include "console.h"
#include "gpio.h"
#include "timer.h"
#include "util.h"
@@ -15,6 +16,15 @@
static int gpio_values[GPIO_COUNT];
static int gpio_interrupt_enabled[GPIO_COUNT];
+/* Create a dictionary of names for debug console print */
+#define GPIO_INT(name, pin, flags, signal) #name,
+#define GPIO(name, pin, flags) #name,
+const char * gpio_names[GPIO_COUNT] = {
+ #include "gpio.wrap"
+};
+#undef GPIO
+#undef GPIO_INT
+
test_mockable void gpio_pre_init(void)
{
/* Nothing */
@@ -47,6 +57,8 @@ test_mockable void gpio_set_level(enum gpio_signal signal, int value)
gpio_values[signal] = value;
+ ccprints("Setting GPIO_%s to %d", gpio_names[signal], value);
+
if (signal >= GPIO_IH_COUNT || !gpio_interrupt_enabled[signal])
return;