summaryrefslogtreecommitdiff
path: root/include/util.h
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2012-01-27 23:10:25 +0000
committerVincent Palatin <vpalatin@chromium.org>2012-01-31 22:29:13 +0000
commite3edad44599ed0f66b46c110b6a0b8abc51e671c (patch)
tree0bc3c1bd4e1b3d46ecc7a1de8e80a1b0c852e96b /include/util.h
parentdf1d8933223817b4b5afe33101e939ff243aa9f6 (diff)
downloadchrome-ec-e3edad44599ed0f66b46c110b6a0b8abc51e671c.tar.gz
stm32l: add UART driver
simple UART driver to get the serial console on the USART3. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=None TEST=run on Discovery board and check we get the first message on the UART and the console is echoing the characters. Change-Id: Id85999a5ddbd75804e9317a1b8c2fd4afb89eb38
Diffstat (limited to 'include/util.h')
-rw-r--r--include/util.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/util.h b/include/util.h
index 3381911293..5a76a66a72 100644
--- a/include/util.h
+++ b/include/util.h
@@ -38,6 +38,12 @@
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define NULL ((void *)0)
+/**
+ * macros for integer division with various rounding variants
+ * default integer division rounds down.
+ */
+#define DIV_ROUND_UP(x, y) (((x) + ((y) - 1)) / (y))
+#define DIV_ROUND_NEAREST(x, y) (((x) + ((y) / 2)) / (y))
/* Standard library functions */
int atoi(const char *nptr);