public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] redirecting diag to nil
@ 2004-07-21  8:16 Øyvind Harboe
  2004-07-21 11:22 ` Gary Thomas
  0 siblings, 1 reply; 3+ messages in thread
From: Øyvind Harboe @ 2004-07-21  8:16 UTC (permalink / raw)
  To: ecos-discuss

[-- Attachment #1: Type: text/plain, Size: 183 bytes --]

Q: is there a builtin facility in eCos redirect diag to the
bit-bucket?


I used the attached changes to redirect diag over JTAG.


-- 
Øyvind Harboe
http://www.zylin.com


[-- Attachment #2: dccpartone.txt --]
[-- Type: text/x-patch, Size: 1512 bytes --]

Index: current/cdl/debugging.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/common/current/cdl/debugging.cdl,v
retrieving revision 1.13
diff -u -w -r1.13 debugging.cdl
--- current/cdl/debugging.cdl	23 Feb 2004 14:55:30 -0000	1.13
+++ current/cdl/debugging.cdl	21 Jul 2004 07:50:33 -0000
@@ -166,4 +166,13 @@
         your memory constraints, one of these options may be better."
 }
 
+cdl_option CYGDBG_HAL_DIAG_TO_HW_DEBUG_CHANNEL {
+    display       "Redirect diag to dedicated hardware debug channel"
+    flavor        data
+    default_value {0}
+    description   "
+        Some CPUs have a dedicated hardware channel, such as the ARM
+	DCC which is redirected over the JTAG link."
+}
+
 # EOF debugging.cdl
Index: current/src/hal_if.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/common/current/src/hal_if.c,v
retrieving revision 1.27
diff -u -w -r1.27 hal_if.c
--- current/src/hal_if.c	21 Dec 2003 13:18:02 -0000	1.27
+++ current/src/hal_if.c	21 Jul 2004 07:50:34 -0000
@@ -779,6 +779,7 @@
 #endif // CYGSEM_HAL_VIRTUAL_VECTOR_INHERIT_CONSOLE
 }
 
+#if !CYGDBG_HAL_DIAG_TO_HW_DEBUG_CHANNEL
 void 
 hal_if_diag_write_char(char c)
 {
@@ -824,6 +825,7 @@
         *c = CYGACC_COMM_IF_GETC(*__chan);
     }
 }
+#endif // CYGDBG_HAL_DIAG_TO_HW_DEBUG_CHANNEL
 #endif // CYGSEM_HAL_VIRTUAL_VECTOR_DIAG
 
 //=============================================================================

[-- Attachment #3: dccparttwo.txt --]
[-- Type: text/x-patch, Size: 1373 bytes --]

Index: current/src/hal_misc.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/arch/current/src/hal_misc.c,v
retrieving revision 1.20
diff -u -w -r1.20 hal_misc.c
--- current/src/hal_misc.c	24 May 2004 12:32:10 -0000	1.20
+++ current/src/hal_misc.c	21 Jul 2004 07:51:20 -0000
@@ -348,5 +348,56 @@
 }
 #endif
 
+#if CYGDBG_HAL_DIAG_TO_HW_DEBUG_CHANNEL
+
+#define DCC_OUTPUT_BUSY 2
+#define DCC_INPUT_READY 1
+static unsigned int read_dcc(void) {
+  unsigned int c;
+  __asm__(
+	  "mrc p14,0, %0, c1, c0\n"
+	  : "=r" (c));
+  return c;
+}
+
+static void write_dcc(unsigned int c) {
+  __asm__(
+	  "mcr p14,0, %0, c1, c0\n"
+	  :
+	  : "r" (c));
+}
+
+/* Here be dragons! GCC does not believe that this 
+   register can change, hence it will optimise the poll
+   away entirely unless we make this fn non-static.
+*/
+unsigned int poll_dcc(void) {
+  unsigned int ret;
+  __asm__(
+	  "mrc p14,0, %0, c0, c0\n"
+	  : "=r" (ret));
+  return ret;
+}
+
+void 
+hal_if_diag_write_char(char c)
+{
+  for (;;) {
+    if (!(poll_dcc() & DCC_OUTPUT_BUSY)) {
+	break;
+      }
+  }
+
+  write_dcc(c);
+}
+
+void 
+hal_if_diag_read_char(char *c)
+{
+  while(!(poll_dcc() & DCC_INPUT_READY));
+  *c=read_dcc();
+}
+#endif
+
 /*------------------------------------------------------------------------*/
 // EOF hal_misc.c


[-- Attachment #4: Type: text/plain, Size: 148 bytes --]

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] redirecting diag to nil
  2004-07-21  8:16 [ECOS] redirecting diag to nil Øyvind Harboe
@ 2004-07-21 11:22 ` Gary Thomas
  2004-07-21 12:03   ` Øyvind Harboe
  0 siblings, 1 reply; 3+ messages in thread
From: Gary Thomas @ 2004-07-21 11:22 UTC (permalink / raw)
  To: Øyvind Harboe; +Cc: ecos-discuss

On Wed, 2004-07-21 at 01:54, Øyvind Harboe wrote:
> Q: is there a builtin facility in eCos redirect diag to the
> bit-bucket?
> 
> 
> I used the attached changes to redirect diag over JTAG.

Why not just call diag_init_putc() with a function that is the bit
bucket?  Look at how this is used in RedBoot.

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] redirecting diag to nil
  2004-07-21 11:22 ` Gary Thomas
@ 2004-07-21 12:03   ` Øyvind Harboe
  0 siblings, 0 replies; 3+ messages in thread
From: Øyvind Harboe @ 2004-07-21 12:03 UTC (permalink / raw)
  To: Gary Thomas; +Cc: ecos-discuss

On Wed, 2004-07-21 at 12:52, Gary Thomas wrote:
> On Wed, 2004-07-21 at 01:54, Øyvind Harboe wrote:
> > Q: is there a builtin facility in eCos redirect diag to the
> > bit-bucket?
> > 
> > 
> > I used the attached changes to redirect diag over JTAG.
> 
> Why not just call diag_init_putc() with a function that is the bit
> bucket?  Look at how this is used in RedBoot.

Yup. Just what I need. This also dovetails nicely with my ARM DCC JTAG
code. :-)

-- 
Øyvind Harboe
http://www.zylin.com



--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-07-21 11:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-21  8:16 [ECOS] redirecting diag to nil Øyvind Harboe
2004-07-21 11:22 ` Gary Thomas
2004-07-21 12:03   ` Øyvind Harboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).