summaryrefslogtreecommitdiff
path: root/include/util.h
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-09-10 17:55:02 +0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-09-11 19:45:38 +0000
commiteff7a1910a60b1d30b10257fd4a12b5ed1402594 (patch)
treed604e3ec704575a5bdbedc7f172ed062586cdf12 /include/util.h
parent876d4c0031ce0d277f23eb08760c83b854038064 (diff)
downloadchrome-ec-eff7a1910a60b1d30b10257fd4a12b5ed1402594.tar.gz
Support multi-bit mask in STM32L's GPIO functions
The definition of GPIO interface allows passing in multi-bit mask, and this is what's done by gpio_config_module(). Fix STM32L's function so that it doesn't accidentally set incorrect GPIO register values. BUG=chrome-os-partner:22605 TEST=On Kirby, do 'led r 0' and check the value of 0x40020800 is 0x01540000. BRANCH=None Change-Id: I9a1c8074aab7345485a590ecf138bf99d0742997 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/168739 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include/util.h')
-rw-r--r--include/util.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/util.h b/include/util.h
index 0408940b35..8ba25c1780 100644
--- a/include/util.h
+++ b/include/util.h
@@ -101,6 +101,16 @@ int tolower(int c);
*/
int uint64divmod(uint64_t *v, int by);
+/**
+ * Get-and-clear next bit from mask.
+ *
+ * Starts with most significant bit.
+ *
+ * @param mask Bitmask to extract next bit from. Must NOT be zero.
+ * @return bit position (0..31)
+ */
+int get_next_bit(uint32_t *mask);
+
/****************************************************************************/
/* Conditional stuff.