aboutsummaryrefslogtreecommitdiff
path: root/PL0_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'PL0_utils.c')
-rw-r--r--PL0_utils.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/PL0_utils.c b/PL0_utils.c
new file mode 100644
index 0000000..2cede90
--- /dev/null
+++ b/PL0_utils.c
@@ -0,0 +1,27 @@
+#include <stddef.h>
+#include <stdint.h>
+
+#include "svc_interface.h"
+
+// most generic definition possible
+// the actual function defined in svc.S
+uint32_t svc(enum svc_type, ...);
+
+void putchar(int character)
+{
+ svc(UART_PUTCHAR, character);
+}
+
+int getchar(void)
+{
+ return svc(UART_GETCHAR);
+}
+
+void puts(char *string)
+{
+ for (size_t i = 0; string[i]; i++)
+ putchar(string[i]);
+
+ putchar('\n');
+ putchar('\r');
+}