summaryrefslogtreecommitdiffstats
path: root/target/linux/realtek/files/arch/rlx/bsp/kgdb.c
diff options
context:
space:
mode:
authorRoman Yeryomin <roman@advem.lv>2012-09-13 00:40:35 +0300
committerRoman Yeryomin <roman@advem.lv>2012-12-03 00:13:21 +0200
commit5deb3317cb51ac52de922bb55f8492624018906d (patch)
treec2fbe6346699d9bb0f2100490c3029519bb8fde8 /target/linux/realtek/files/arch/rlx/bsp/kgdb.c
parent0239d37124f9184b478a42de8a7fa1bc85a6a6fe (diff)
Add realtek target files
Signed-off-by: Roman Yeryomin <roman@advem.lv>
Diffstat (limited to 'target/linux/realtek/files/arch/rlx/bsp/kgdb.c')
-rw-r--r--target/linux/realtek/files/arch/rlx/bsp/kgdb.c81
1 files changed, 81 insertions, 0 deletions
diff --git a/target/linux/realtek/files/arch/rlx/bsp/kgdb.c b/target/linux/realtek/files/arch/rlx/bsp/kgdb.c
new file mode 100644
index 000000000..93960b21f
--- /dev/null
+++ b/target/linux/realtek/files/arch/rlx/bsp/kgdb.c
@@ -0,0 +1,81 @@
+/*
+ * Realtek semiconductor Corp.
+ *
+ * arch/rlx/rlxocp/kgdb.c:
+ * Kernel debugging on the rtl5739.
+ *
+ * Tony Wu (tonywu@realtek.com.tw)
+ * Dec. 7, 2007
+ */
+#include <asm/system.h>
+#include <asm/tx3912.h>
+
+static int remoteDebugInitialized = 0;
+
+void debugInit(void)
+{
+/*
+ * If low-level debugging (before GDB or console operational) is
+ * configured, then we do not need to re-initialize the UART.
+ */
+#ifndef CONFIG_DEBUG_LL
+// earlyInitUartPR31700();
+#endif
+}
+
+char getDebugChar(void)
+{
+ char buf;
+ unsigned long int2, flags;
+
+ if (!remoteDebugInitialized) {
+ debugInit();
+ remoteDebugInitialized = 1;
+ }
+
+ save_and_cli(flags);
+
+ int2 = IntEnable2;
+
+ IntEnable2 = 0;
+
+ while (!(UartA_Ctrl1 & UART_RX_HOLD_FULL));
+
+ buf = UartA_Data;
+
+ IntEnable2 = int2;
+
+ restore_flags(flags);
+
+ return buf;
+}
+
+int putDebugChar(char c)
+{
+ int i;
+ unsigned long int2;
+
+ if (!remoteDebugInitialized) {
+ debugInit();
+ remoteDebugInitialized = 1;
+ }
+
+ int2 = IntEnable2;
+
+ IntEnable2 &=
+ ~(INT2_UARTATXINT | INT2_UARTATXOVERRUN | INT2_UARTAEMPTY);
+
+ for (i = 0; !(IntStatus2 & INT2_UARTATXINT) && (i < 10000); i++);
+
+ IntClear2 = INT2_UARTATXINT | INT2_UARTATXOVERRUN | INT2_UARTAEMPTY;
+
+ UartA_Data = c;
+
+ for (i = 0; !(IntStatus2 & INT2_UARTATXINT) && (i < 10000); i++);
+
+ IntClear2 = INT2_UARTATXINT | INT2_UARTATXOVERRUN | INT2_UARTAEMPTY;
+
+ IntEnable2 = int2;
+
+ return 1;
+}