[PATCHv1 4/8] unicore32 additional architecture files: low-level lib: ocd debug

Previous thread: [PATCHv1 3/8] unicore32 additional architecture files: ptrace by Guan Xuetao on Monday, January 3, 2011 - 4:50 am. (1 message)

Next thread: [PATCHv1 5/8] unicore32 additional architecture files: low-level lib: io by Guan Xuetao on Monday, January 3, 2011 - 4:52 am. (1 message)
From: Guan Xuetao
Date: Monday, January 3, 2011 - 4:51 am

From: Guan Xuetao <guanxuetao@mprc.pku.edu.cn>

Patch 4 implements low-level debug libraries with On-Chip-Debugger hardware support.

Signed-off-by: Guan Xuetao <guanxuetao@mprc.pku.edu.cn>
---
 arch/unicore32/include/asm/mach/debug-macro.S |   89 +++++++++++++++++++++++++
 arch/unicore32/include/asm/mach/ocd.h         |   36 ++++++++++
 arch/unicore32/kernel/debug.S                 |   85 +++++++++++++++++++++++
 arch/unicore32/kernel/early_printk.c          |   59 ++++++++++++++++
 4 files changed, 269 insertions(+), 0 deletions(-)

diff --git a/arch/unicore32/include/asm/mach/debug-macro.S b/arch/unicore32/include/asm/mach/debug-macro.S
new file mode 100644
index 0000000..b830d61
--- /dev/null
+++ b/arch/unicore32/include/asm/mach/debug-macro.S
@@ -0,0 +1,89 @@
+/*
+ * linux/arch/unicore32/include/asm/mach/debug-macro.S
+ *
+ * Code specific to PKUnity SoC and UniCore ISA
+ *
+ * Copyright (C) 2001-2010 GUAN Xue-tao
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Debugging macro include header
+ */
+#include <generated/asm-offsets.h>
+#include <asm/mach/hardware.h>
+
+		.macro	put_word_ocd, rd, rx=r16
+1001:		movc		\rx, p1.c0, #0
+		cand.a	\rx, #2
+		bne	1001b
+		movc		p1.c1, \rd, #1
+		.endm
+
+#ifdef CONFIG_DEBUG_OCD
+		/* debug using UniCore On-Chip-Debugger */
+		.macro	addruart, rx
+		.endm
+
+		.macro	senduart, rd, rx
+		put_word_ocd	\rd, \rx
+		.endm
+
+		.macro	busyuart, rd, rx
+		.endm
+
+		.macro	waituart, rd, rx
+		.endm
+#else
+#define UART_CLK_DEFAULT        3686400 * 20
+	/* Uartclk = MCLK/ 2, The MCLK on my board is 3686400 * 40  */
+#define BAUD_RATE_DEFAULT	115200
+	/* The baud rate of the serial port */
+
+#define UART_DIVISOR_DEFAULT	(UART_CLK_DEFAULT \
+				/ (16 * BAUD_RATE_DEFAULT) - 1)
+
+		.macro	addruart,rx
+		mrc	p0, #0, \rx, c1, c0
+		tst	\rx, #1			@ MMU ...
Previous thread: [PATCHv1 3/8] unicore32 additional architecture files: ptrace by Guan Xuetao on Monday, January 3, 2011 - 4:50 am. (1 message)

Next thread: [PATCHv1 5/8] unicore32 additional architecture files: low-level lib: io by Guan Xuetao on Monday, January 3, 2011 - 4:52 am. (1 message)