aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-05-29 21:31:09 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2023-05-29 21:31:09 +0300
commit3ace1ddd76b9c04f3ed23883de6279b4485612e8 (patch)
tree2f4af69d70967c2455cb83d8c18a5416c8d1b54d /include
parentb7f53b9a9001708dea5303faf52f1b508eefb712 (diff)
downloadkmi-3ace1ddd76b9c04f3ed23883de6279b4485612e8.tar.gz
kmi-3ace1ddd76b9c04f3ed23883de6279b4485612e8.zip
start trying to boot on visionfive 2
+ Not bootable quite yet. Among other things, I couldn't get the current starfive u-boot fork to boot, so try adding support for booting with precompiled u-boot via the `go` command. Initial testing with qemu shows that this should be possible, and if it works, might be useful in the (far) future with other slightly janky SBCs. Also, NS16550 is 8250-based, and I'm really only using the base 8250, so rename and add visionfive 2 uart to list of compatibles. Visionfive 2 is still completely untested.
Diffstat (limited to 'include')
-rw-r--r--include/kmi/debug.h4
-rw-r--r--include/kmi/string.h15
2 files changed, 17 insertions, 2 deletions
diff --git a/include/kmi/debug.h b/include/kmi/debug.h
index deca4ca..4079048 100644
--- a/include/kmi/debug.h
+++ b/include/kmi/debug.h
@@ -320,8 +320,8 @@
#if defined(DEBUG)
/** Serial devices supported. */
enum serial_dev {
- /** NS16550A and compatible. Currently the only supported serial device. */
- NS16550A,
+ /** 8250 and compatible. Currently the only supported serial device. */
+ UART_8250,
};
/**
diff --git a/include/kmi/string.h b/include/kmi/string.h
index 2b26a2d..f72299b 100644
--- a/include/kmi/string.h
+++ b/include/kmi/string.h
@@ -215,6 +215,21 @@ void *memmove(void *dst, const void *src, size_t num);
*/
int memcmp(const void *ptr1, const void *ptr2, size_t num);
+/**
+ * Try to convert string \p s into a corresponding
+ * \c uintptr_t. Handles decimal, octal and hex,
+ * assuming hex starts with \c 0x or \c 0X and octal with
+ * \c 0, otherwise assumes decimal. Allows \c + and \c - in
+ * decimal.
+ *
+ * Note that u-boot likes to skip leading \c 0x when using hex,
+ * so if you're passing u-boot variables make sure to check prefixes.
+ *
+ * @param s String to convert to pointer.
+ * @return Corresponding pointer value.
+ */
+uintptr_t strtouintptr(const char *s);
+
/* Honorable mentions:
*
* char *strerror(int err);