bdi
GDB
for GNU Debugger, BDI2000 (ARM)
User Manual
44
© Copyright 1997-2005 by ABATRON AG Switzerland
V 1.17
3.3.6 Target DCC I/O via BDI
It is possible to route a TCP/IP port to the ARM’s debug communciation channel (DCC). This way, the
application running on the target can output messages via DCC that are displayed for example in a
Telnet window. The BDI routes every byte received via DCC to the connected TCP/IP channel and
vice versa. Below some simple functions you can link to your application in order to implement IO via
DCC.
#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));
}
static unsigned int poll_dcc(void) {
unsigned int ret;
__asm__(
"mrc p14,0, %0, c0, c0\n"
: "=r" (ret));
return ret;
}
void write_dcc_char(unsigned int c) {
while(poll_dcc() & DCC_OUTPUT_BUSY);
write_dcc(c);
}
unsigned int read_dcc_char(void) {
while(!(poll_dcc() & DCC_INPUT_READY));
return read_dcc();
}
void write_dcc_string(const char* s)
{
while (*s) write_dcc_char(*s++);
}