summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorDavid Hendricks <dhendrix@chromium.org>2014-11-06 15:05:35 -0800
committerPatrick Georgi <pgeorgi@google.com>2015-04-10 11:59:30 +0200
commit21db62eb0e900b031cf7398149a76a3dfa6ceb5f (patch)
treefb7550374f3412d6ee6fa75875a0a2f155a46dc7 /src/include
parent3fc6368e1cb6800159acb769557d22a542c9bb93 (diff)
downloadcoreboot-21db62eb0e900b031cf7398149a76a3dfa6ceb5f.tar.xz
gpio: add a function to read GPIO array as base-2 value
This adds gpio_base2_value() which reads an array of 2-state GPIOs and returns a base-2 value, where gpio[0] represents the least significant bit. BUG=none BRANCH=none TEST=tested with follow-up patches for pinky Change-Id: I0d6bfac369da0d68079a38de0988c7b59d269a97 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 27873b7a9ea237d13f0cbafd10033a8d0f821cbe Original-Change-Id: Ia7ffc16eb60e93413c0812573b9cf0999b92828e Original-Signed-off-by: David Hendricks <dhendrix@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/228323 Original-Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-on: http://review.coreboot.org/9412 Tested-by: build bot (Jenkins) Reviewed-by: David Hendricks <dhendrix@chromium.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gpio.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/include/gpio.h b/src/include/gpio.h
index e54b156ce7..7b64ebfe80 100644
--- a/src/include/gpio.h
+++ b/src/include/gpio.h
@@ -36,6 +36,15 @@ void gpio_output(gpio_t gpio, int value);
/*
* Read the value presented by the set of GPIOs, when each pin is interpreted
+ * as a base-2 digit (LOW = 0, HIGH = 1).
+ *
+ * gpio[]: pin positions to read. gpio[0] is less significant than gpio[1].
+ * num_gpio: number of pins to read.
+ */
+int gpio_base2_value(gpio_t gpio[], int num_gpio);
+
+/*
+ * Read the value presented by the set of GPIOs, when each pin is interpreted
* as a base-3 digit (LOW = 0, HIGH = 1, Z/floating = 2).
* Example: X1 = Z, X2 = 1 -> gpio_base3_value({GPIO(X1), GPIO(X2)}) = 5
* BASE3() from <base3.h> can generate numbers to compare the result to.