summaryrefslogtreecommitdiff
path: root/board/zinger/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/zinger/debug.c')
-rw-r--r--board/zinger/debug.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/board/zinger/debug.c b/board/zinger/debug.c
new file mode 100644
index 0000000000..2cf62996bf
--- /dev/null
+++ b/board/zinger/debug.c
@@ -0,0 +1,41 @@
+/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+/* Synchronous UART debug printf */
+
+#include "common.h"
+#include "printf.h"
+#include "registers.h"
+#include "util.h"
+
+static int debug_txchar(void *context, int c)
+{
+ if (c == '\n') {
+ while (!(STM32_USART_SR(UARTN) & STM32_USART_SR_TXE))
+ ;
+ STM32_USART_TDR(UARTN) = '\r';
+ }
+
+ /* Wait for space to transmit */
+ while (!(STM32_USART_SR(UARTN) & STM32_USART_SR_TXE))
+ ;
+ STM32_USART_TDR(UARTN) = c;
+
+ return 0;
+}
+
+
+
+void debug_printf(const char *format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+ vfnprintf(debug_txchar, NULL, format, args);
+ va_end(args);
+}
+
+void panic(const char *msg)
+{
+}