summaryrefslogtreecommitdiff
path: root/arch/blackfin
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-07-23 11:34:49 -0400
committerMike Frysinger <vapier@gentoo.org>2010-07-25 15:17:31 -0400
commit4fff5ac2f89140361e373818aa3c8c6c7dbd20e9 (patch)
treeca350d1231e060789885a5744288438155bb6101 /arch/blackfin
parent5079d8bbad77bf21ecc5f17e05141f04cfaaabb3 (diff)
Blackfin: jtag-console: add debug markers
While we're in here, add some useful debug points. We need custom debug statements because we need the output to only go to the serial port. If we used the standard debug helpers, the output would also go to the stdout (which would be the jtag console) and make it hard to figure out what is going where exactly. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin')
-rw-r--r--arch/blackfin/cpu/jtag-console.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/arch/blackfin/cpu/jtag-console.c b/arch/blackfin/cpu/jtag-console.c
index 46b30a0f8c0..bde8beeca54 100644
--- a/arch/blackfin/cpu/jtag-console.c
+++ b/arch/blackfin/cpu/jtag-console.c
@@ -10,6 +10,22 @@
#include <stdio_dev.h>
#include <asm/blackfin.h>
+#ifdef DEBUG
+# define dprintf(...) serial_printf(__VA_ARGS__)
+#else
+# define dprintf(...) do { if (0) printf(__VA_ARGS__); } while (0)
+#endif
+
+static inline void dprintf_decode(const char *s, uint32_t len)
+{
+ uint32_t i;
+ for (i = 0; i < len; ++i)
+ if (s[i] < 0x20 || s[i] >= 0x7f)
+ dprintf("\\%o", s[i]);
+ else
+ dprintf("%c", s[i]);
+}
+
static inline uint32_t bfin_write_emudat(uint32_t emudat)
{
__asm__ __volatile__("emudat = %0;" : : "d"(emudat));
@@ -52,6 +68,10 @@ static void jtag_send(const char *c, uint32_t len)
if (len == 0)
return;
+ dprintf("%s(\"", __func__);
+ dprintf_decode(c, len);
+ dprintf("\", %i)\n", len);
+
/* First send the length */
if (jtag_write_emudat(len))
return;
@@ -83,7 +103,10 @@ static size_t inbound_len, leftovers_len;
/* Lower layers want to know when jtag has data */
static int jtag_tstc_dbg(void)
{
- return (bfin_read_DBGSTAT() & 0x2);
+ int ret = (bfin_read_DBGSTAT() & 0x2);
+ if (ret)
+ dprintf("%s: ret:%i\n", __func__, ret);
+ return ret;
}
/* Higher layers want to know when any data is available */
@@ -101,6 +124,9 @@ static int jtag_getc(void)
int ret;
uint32_t emudat;
+ dprintf("%s: inlen:%zu leftlen:%zu left:%x\n", __func__,
+ inbound_len, leftovers_len, leftovers);
+
/* see if any data is left over */
if (leftovers_len) {
--leftovers_len;