This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
redirecting diag to nil
- From: Øyvind Harboe <oyvind dot harboe at zylin dot com>
- To: ecos-discuss at sources dot redhat dot com
- Date: Wed, 21 Jul 2004 09:54:01 +0200
- Subject: [ECOS] redirecting diag to nil
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
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
//=============================================================================
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
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss